From 486e22c57ca8a1e2dc6877b539e2f3add67250f1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 23 十一月 2019 18:28:00 +0800 Subject: [PATCH] 冲突解决 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 163 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 92 insertions(+), 71 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java index 44f0522..7f5fc6e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java @@ -54,6 +54,7 @@ import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService; import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService; import com.yeshi.fanli.service.inter.user.UserSystemCouponService; +import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; @@ -113,10 +114,12 @@ @Resource private HongBaoOrderService hongBaoOrderService; - + @Resource private InviteOrderSubsidyService inviteOrderSubsidyService; - + + @Resource + private UserVIPInfoService userVIPInfoService; // 濂栧姳璁㈠崟鍥剧墖 public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png"; @@ -174,7 +177,7 @@ @Override public List<CommonOrderVO> getOrderByUid(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, Integer source) - throws CommonOrderException, Exception{ + throws CommonOrderException, Exception { int pageSize = Constant.PAGE_SIZE; @@ -196,11 +199,10 @@ // 鏁版嵁鍔犲伐閲嶆柊缁勭粐 orderInfoFactory(acceptData, listOrder, listGoods, uid); - //listDataFactory(acceptData, listOrder, listGoods, uid); + // listDataFactory(acceptData, listOrder, listGoods, uid); return listOrder; } - /** * 璁㈠崟锛� 鍏嶅崟鏍囪瘑 濂栧姳鏍囪瘑 * @@ -215,7 +217,7 @@ AcceptData acceptData) { // 鏄惁鍏嶅崟鍟嗗搧 - boolean freeOrder = false; + boolean freeOrder = false; // 鏄惁濂栧姳鎴愬姛 boolean rewardSuccess = false; @@ -278,7 +280,7 @@ int type = 1; // 1 甯歌璺宠浆椤甸潰 2寮瑰嚭閫夐」锛堝鍔卞埜锛� if (rewardSuccess) { if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { - rewardOrder = true; //濂栧姳鎴愬姛 2.0.2 娑堝け + rewardOrder = true; // 濂栧姳鎴愬姛 2.0.2 娑堝け } } else if (hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState) { @@ -293,13 +295,14 @@ String num = null; String unit = null; boolean canUse = false; - + // 鐗堟湰鍖哄垎锛�2.1 if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { Date thirdCreateTime = order.getThirdCreateTime(); if (thirdCreateTime != null) { long downOrderTime = thirdCreateTime.getTime(); - long limitDate = Long.parseLong("1571760000000"); // TODO 鏃ユ湡寰呯‘瀹�2019-11-10 + long limitDate = Long.parseLong("1571760000000"); // TODO + // 鏃ユ湡寰呯‘瀹�2019-11-10 if (downOrderTime > limitDate) { newEdition = true; Date endDay = DateUtil.plusDayDate(4, thirdCreateTime); @@ -351,23 +354,23 @@ } } else if (canUse) { rewardStyleVO.setContent("浣跨敤濂栧姳鍒�"); - + ClientTextStyleVO txt1 = new ClientTextStyleVO(); txt1.setContent("鍓�"); txt1.setColor("#666666"); txt1.setBottomColor("#FFDCEA"); - + ClientTextStyleVO txt2 = new ClientTextStyleVO(); txt2.setContent(num); txt2.setColor("#E5005C"); txt2.setBottomColor("#FFDCEA"); txt2.setFontSize("1.33"); - + ClientTextStyleVO txt3 = new ClientTextStyleVO(); txt3.setContent(unit + "鍏抽棴 >"); txt3.setColor("#666666"); txt3.setBottomColor("#FFDCEA"); - + List<ClientTextStyleVO> ticking = new ArrayList<ClientTextStyleVO>(); ticking.add(txt1); ticking.add(txt2); @@ -375,11 +378,11 @@ rewardMap.put("ticking", ticking); } rewardMap.put("text", rewardStyleVO); - + Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); jumpLink.put("goodsType", order.getSourceType() + ""); - + Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", type); jump.put("params", jumpLink); @@ -402,7 +405,7 @@ Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { - jumpLink.put("goodsType", order.getSourceType()+""); + jumpLink.put("goodsType", order.getSourceType() + ""); } Map<String, Object> jump = new HashMap<String, Object>(); @@ -418,17 +421,16 @@ } } - - /** * 璁㈠崟淇℃伅鍔犲伐 + * * @param acceptData * @param listOrder * @param listGoods * @param uid */ public void orderInfoFactory(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, - Long uid) throws Exception{ + Long uid) throws Exception { List<String> listTB = new ArrayList<String>(); List<String> listJD = new ArrayList<String>(); List<String> listPDD = new ArrayList<String>(); @@ -464,46 +466,69 @@ SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); // 2019.8.1寮�濮嬭繑鍥炵淮鏉冧俊鎭� Date august = TimeUtil.parse("2019-08-01"); - + // 鏄惁瀛樺湪濂栧姳鍒� boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid); boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid); - - for (CommonOrderVO order: listOrder) { + // 闇�瑕佹煡璇㈡槸鍚︿负VIP鐨勭敤鎴稩D,鍙湁閭�璇疯鍗曟墠闇�瑕佹煡璇� + List<Long> needSelectVIPUidList = new ArrayList<>(); + + for (CommonOrderVO order : listOrder) { + if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI + || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI + || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) + needSelectVIPUidList.add(Long.parseLong(order.getUserId())); + } + Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); + + // 璁剧疆鏄惁涓簐ip璁㈠崟 + for (CommonOrderVO order : listOrder) { + if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI + || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI + || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { + if (vipUserMap.get(Long.parseLong(order.getUserId())) != null + && vipUserMap.get(Long.parseLong(order.getUserId())) == true) + order.setVipOrder(true); + else + order.setVipOrder(false); + } else + order.setVipOrder(false); + } + + for (CommonOrderVO order : listOrder) { String orderNo = order.getOrderNo(); Integer sourceType = order.getSourceType(); - + // 鍟嗗搧淇℃伅缁勫悎 - for (CommonOrderVO commonOrder: listGoods) { + for (CommonOrderVO commonOrder : listGoods) { CommonOrderGoods goods = commonOrder.getCommonOrderGoods(); if (goods == null) { continue; } - + if (sourceType.equals(commonOrder.getSourceType()) && orderNo.equals(commonOrder.getOrderNo())) { CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO(); PropertyUtils.copyProperties(commonGoodsVO, goods); commonGoodsVO.setGoodsType(sourceType); - + // 娣樺疂鍟嗗搧鍥剧墖澶勭悊 String picture = commonGoodsVO.getPicture(); - if (sourceType == Constant.SOURCE_TYPE_TAOBAO && !StringUtil.isNullOrEmpty(picture) + if (sourceType == Constant.SOURCE_TYPE_TAOBAO && !StringUtil.isNullOrEmpty(picture) && !picture.contains("320x320")) { commonGoodsVO.setPicture(TbImgUtil.getTBSize320Img(picture)); } - + // 璐拱鏁伴噺 commonGoodsVO.setActualCount(commonOrder.getTotalCount() + "浠�"); - + // 瀹炰粯娆� BigDecimal totalSettlement = commonOrder.getTotalSettlement(); if (totalSettlement == null || totalSettlement.compareTo(new BigDecimal(0)) <= 0) { totalSettlement = commonOrder.getTotalPayment(); } commonGoodsVO.setActualPay("浠樻閲戦锛毬�" + totalSettlement); - - + Integer hongBaoType = order.getHongBaoType(); // 閭�璇疯鍗曚俊鎭繚鎶� if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType @@ -517,7 +542,6 @@ commonGoodsVO.setGoodsTitle(titleMap); } - // 璁㈠崟绫诲瀷涓虹┖鏃� 宸插晢鍝佺被涓哄噯 Integer orderType = order.getOrderType(); if (orderType == null) { @@ -528,12 +552,11 @@ order.setOrderType(2); } } - + order.getListOrderGoods().add(commonGoodsVO); } } - - + Date thirdCreateTime = order.getThirdCreateTime(); if (thirdCreateTime != null) { order.setDownTime("涓嬪崟鏃堕棿锛�" + format.format(thirdCreateTime)); @@ -544,7 +567,7 @@ if (settleTime != null) { order.setReceiveTime("鏀惰揣鏃堕棿锛�" + format.format(settleTime)); } - + // 璁㈠崟绫诲瀷 if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { Integer orderType = order.getOrderType(); @@ -555,9 +578,7 @@ } else if (sourceType == Constant.SOURCE_TYPE_PDD) { order.setOrderType(4); } - - - + /* 璁㈠崟鐘舵�� 杞崲澶勭悊 */ String orderStateContent = ""; Map<String, String> orderStateMap = new HashMap<String, String>(); @@ -611,7 +632,8 @@ orderStateContent = "缁存潈鎴愬姛"; WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); weiQuanInfo.setOldHongBao("楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); - weiQuanInfo.setWqHongBao("缁存潈锛�-楼" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); + weiQuanInfo + .setWqHongBao("缁存潈锛�-楼" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); order.setWeiQuanInfo(weiQuanInfo); } @@ -621,10 +643,7 @@ orderStateMap.put("content", orderStateContent); orderStateMap.put("fontColor", "#666666"); order.setOrderState(orderStateMap); - - - - + String hongbaoInfo = ""; // 璁㈠崟鏍囪瘑 List<String> signList = new ArrayList<String>(); @@ -644,11 +663,12 @@ signList.add(CommonOrder.TYPE_SHARE); } else if (HongBaoV2.TYPE_SHARE_YIJI == hongBaoType || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) { - // 涓嬬骇鐨勫垎浜鍗曪細 鏄剧ず閭�璇� + // 涓嬬骇鐨勫垎浜鍗曪細 鏄剧ず閭�璇� hongbaoInfo = "濂栭噾"; order.setOrderOrigin("3"); order.setHongBaoTypePic(CommonOrder.TYPE_INVITE); signList.add(CommonOrder.TYPE_INVITE); + } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType || HongBaoV2.TYPE_ERJI == hongBaoType) { // 閭�璇疯鍗� @@ -656,10 +676,11 @@ order.setOrderOrigin("3"); order.setHongBaoTypePic(CommonOrder.TYPE_INVITE); signList.add(CommonOrder.TYPE_INVITE); - + // 鐗堟湰鍖哄垎锛�2-0-2 if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { - InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, order.getOrderNo(), sourceType); + InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, + order.getOrderNo(), sourceType); if (orderSubsidy != null) { ClientTextStyleVO subsidyInfo = new ClientTextStyleVO(); subsidyInfo.setContent("(琛ヨ创楼" + orderSubsidy.getMoney() + ")"); @@ -669,7 +690,7 @@ subsidyInfo.setColor("#888888"); } order.setSubsidy(subsidyInfo); - + // 瑙i噴淇℃伅锛堥棶鍙凤級 List<String> subsidyList = new ArrayList<String>(); subsidyList.add("棰濆琛ヨ创鑳藉惁鑾峰緱鐢辩郴缁熺畻娉曡嚜鍔ㄥ垽鏂紝浜轰负鏃犳硶骞叉秹锛�"); @@ -727,7 +748,7 @@ if (!StringUtil.isNullOrEmpty(order.getStateDesc())) { stateContent = stateContent + "-" + order.getStateDesc(); } - + Map<String, String> stateMap = new HashMap<String, String>(); stateMap.put("content", stateContent); stateMap.put("fontColor", stateFontColor); @@ -767,8 +788,9 @@ order.setOrderNo(UserUtil.filterOrderId(order.getOrderNo())); } } + } - + @Override public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) { return commonOrderMapper.countHistoryOrder(uid, day, source); @@ -793,8 +815,8 @@ } @Override - public Long countUserOrderToApp(Long uid, Integer type, String startTime, String endTime, - Integer day, Integer source, Integer state, Integer stateOrder) { + public Long countUserOrderToApp(Long uid, Integer type, String startTime, String endTime, Integer day, + Integer source, Integer state, Integer stateOrder) { return commonOrderMapper.countUserOrderToApp(uid, type, startTime, endTime, day, source, state, stateOrder); } @@ -824,10 +846,6 @@ return weiQuanMoney; } - - - - @Override public List<CommonOrder> listBySourceTypeAndOrderId(int sourceType, String orderId) { return commonOrderMapper.listBySourceTypeAndOrderNo(sourceType, orderId); @@ -1062,7 +1080,9 @@ return new CommonOrderAddResultDTO(commonOrder, CommonOrderAddResultDTO.TYPE_ADD); } else {// 淇敼 // 闈炰含涓滃凡缁忕粨绠楋紝宸茬粡澶辨晥锛岀姸鎬佹湭鏀瑰彉鐨勮鍗曚笉澶勭悊 - if ((oldCommonOrder.getState() == CommonOrder.STATE_JS&&oldCommonOrder.getSourceType()!=Constant.SOURCE_TYPE_JD) || oldCommonOrder.getState() == CommonOrder.STATE_SX + if ((oldCommonOrder.getState() == CommonOrder.STATE_JS + && oldCommonOrder.getSourceType() != Constant.SOURCE_TYPE_JD) + || oldCommonOrder.getState() == CommonOrder.STATE_SX || oldCommonOrder.getState() == CommonOrder.STATE_WQ || (oldCommonOrder.getState().intValue() == commonOrder.getState())) { return new CommonOrderAddResultDTO(oldCommonOrder, CommonOrderAddResultDTO.TYPE_NOUPDATE); @@ -1177,9 +1197,8 @@ @Override public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state, - Integer type, Integer orderState, String startTime, String endTime, Integer source,List<Long> listShopId, - List<Long> listGoodsId, Date minTime, BigDecimal money) - throws CommonOrderException { + Integer type, Integer orderState, String startTime, String endTime, Integer source, List<Long> listShopId, + List<Long> listGoodsId, Date minTime, BigDecimal money) throws CommonOrderException { List<CommonOrderVO> list = null; @@ -1190,7 +1209,7 @@ list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState, startTime, endTime, source, listShopId, listGoodsId, minTime, money); } - + if (list == null) { list = new ArrayList<CommonOrderVO>(); } @@ -1380,8 +1399,8 @@ return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime, source); } else { - return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source, listShopId, - listGoodsId, minTime,money); + return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source, + listShopId, listGoodsId, minTime, money); } } @@ -1500,7 +1519,7 @@ Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", orderNo); - jumpLink.put("goodsType", goodsType == null? goodsType: goodsType +""); + jumpLink.put("goodsType", goodsType == null ? goodsType : goodsType + ""); Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", 1); @@ -1578,31 +1597,33 @@ return commonOrderList.get(0); } - - @Override public CommonOrderVO firstValidOrderByUid(Long uid) { return commonOrderMapper.firstValidOrderByUid(uid, null, null); } - + @Override public CommonOrderVO firstValidOrderByUidAndType(Long uid, Integer type) { return commonOrderMapper.firstValidOrderByUid(uid, type, null); } - - + @Override public CommonOrderVO firstValidOrderLastMonthByUidAndType(Long uid, Integer type) { return commonOrderMapper.firstValidOrderByUid(uid, type, 4); } - + @Override public CommonOrder getFirstShareOrderByUid(Long uid) { return commonOrderMapper.getFirstShareOrderByUid(uid); } - + @Override public BigDecimal getTotalRewardMoneyByOrderNoAndSourceType(String orderNo, Integer sourceType) { return commonOrderMapper.getTotalRewardMoneyByOrderNoAndSourceType(orderNo, sourceType); } + + @Override + public long count24HValidOrderByUid(Long uid, Date minTime) { + return commonOrderMapper.count24HValidOrderByUid(uid, minTime); + } } -- Gitblit v1.8.0