From 28cf328a098334b51a3e9d2d56f983fb8c862211 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期六, 23 五月 2020 09:54:38 +0800 Subject: [PATCH] 足迹、收藏订单兼容新需求 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 101 ++++++++++++++++++++++++++++---------------------- 1 files changed, 57 insertions(+), 44 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 c56c1c9..5e9a369 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 @@ -37,7 +37,6 @@ import com.yeshi.fanli.entity.jd.JDGoods; import com.yeshi.fanli.entity.jd.JDOrder; import com.yeshi.fanli.entity.jd.JDOrderItem; -import com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt; import com.yeshi.fanli.entity.order.CommonOrder; import com.yeshi.fanli.entity.order.CommonOrderGoods; import com.yeshi.fanli.entity.order.CommonOrderTradeIdMap; @@ -60,7 +59,6 @@ import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.config.SystemCouponService; import com.yeshi.fanli.service.inter.goods.CommonGoodsService; -import com.yeshi.fanli.service.inter.money.InviteOrderSubsidyDebtService; import com.yeshi.fanli.service.inter.order.CommonOrderService; import com.yeshi.fanli.service.inter.order.HongBaoOrderService; import com.yeshi.fanli.service.inter.order.HongBaoV2Service; @@ -137,9 +135,6 @@ @Resource private InviteOrderSubsidyService inviteOrderSubsidyService; - - @Resource - private InviteOrderSubsidyDebtService inviteOrderSubsidyDebtService; @Resource private UserVIPInfoService userVIPInfoService; @@ -223,6 +218,7 @@ List<Integer> listSource) throws CommonOrderException, Exception { int pageSize = Constant.PAGE_SIZE; + List<CommonOrderVO> listOrder = commonOrderMapper.listUserOrder((page - 1) * pageSize, pageSize, uid, state, type, orderState, orderNo, startTime, endTime, dateType, listSource); @@ -595,22 +591,22 @@ if (HongBaoV2.TYPE_ZIGOU == hongBaoType) { // 濂栧姳璁㈠崟銆佸厤鍗� 浣跨敤璁板綍 if (sourceType == null) { - couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData, hongBao); + couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData, + hongBao); } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { - couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, - acceptData, hongBao); + couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, acceptData, + hongBao); } else if (sourceType == Constant.SOURCE_TYPE_JD) { - couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, - acceptData, hongBao); + couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, acceptData, + hongBao); } else if (sourceType == Constant.SOURCE_TYPE_PDD) { couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip, acceptData, hongBao); } } - // 鍒嗕韩銆侀個璇� 闅愯棌璁㈠崟鍙� - if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType || HongBaoV2.TYPE_YAOQING == hongBaoType - || HongBaoV2.TYPE_YIJI == hongBaoType || HongBaoV2.TYPE_ERJI == hongBaoType + // 閭�璇� 闅愯棌璁㈠崟鍙� + if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) { order.setOrderNo(UserUtil.filterOrderId(order.getOrderNo())); } @@ -627,7 +623,8 @@ * @param signList */ private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, - List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData, BigDecimal hongBao) throws Exception { + List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData, BigDecimal hongBao) + throws Exception { // 鏄惁鍏嶅崟鍟嗗搧 boolean freeOrder = false; @@ -726,10 +723,10 @@ } // 浣跨敤濂栧姳鍒� 閲戦棰濋檺鍒� - if (hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) > 0){ + if (hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) > 0) { return; } - + // 鏄惁鍙娇鐢ㄥ鍔卞埜 if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState && !vip && CommonOrder.STATE_WQ != order.getState()) { @@ -1820,11 +1817,12 @@ @Override public List<CommonOrderVO> getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, - List<Integer> listSource) throws CommonOrderException, Exception { + List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException, Exception { int pageSize = Constant.PAGE_SIZE; + List<CommonOrderVO> listOrder = commonOrderMapper.getOrderList((page - 1) * pageSize, pageSize, uid, state, - type, orderState, orderNo, startTime, endTime, dateType, listSource); + type, orderState, orderNo, startTime, endTime, dateType, listSource,notBackSuVip); // 璁㈠崟淇℃伅涓虹┖ if (listOrder == null || listOrder.size() == 0) { @@ -1846,9 +1844,9 @@ @Override public long countOrderList(Long uid, Integer state, Integer type, Integer orderState, String orderNo, - String startTime, String endTime, Integer dateType, List<Integer> listSource) throws CommonOrderException { + String startTime, String endTime, Integer dateType, List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException { return commonOrderMapper.countOrderList(uid, state, type, orderState, orderNo, startTime, endTime, dateType, - listSource); + listSource, notBackSuVip); } /** @@ -1866,13 +1864,14 @@ List<String> listPDD = new ArrayList<String>(); 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_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { Integer urank = order.getUrank(); if (urank != null) { - String levelName = UserLevelUtil.getLevelName(urank); - if (!StringUtil.isNullOrEmpty(levelName)) { - order.setOrderDesc("璁㈠崟鏉ユ簮锛�" + levelName); + UserLevelEnum levelEnum = UserLevelUtil.getByOrderRank(urank); + if (levelEnum != null) { + levelEnum = UserLevelUtil.getShowLevel(levelEnum); + order.setOrderDesc("璁㈠崟鏉ユ簮锛�" + levelEnum.getName()); } } } @@ -2036,6 +2035,14 @@ List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper .selectListByOrderIdAndState(order.getOrderNo(), "缁存潈鎴愬姛"); BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); + + if (settleTime != null) { + orderStateContent = "鍞悗鎴愬姛"; + WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); + weiQuanInfo.setOldHongBao("楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); + weiQuanInfo.setWqHongBao("鍞悗锛�-楼" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); + order.setWeiQuanInfo(weiQuanInfo); + } hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); } } @@ -2043,7 +2050,6 @@ orderStateMap.put("fontColor", "#666666"); order.setOrderState(orderStateMap); - // 璁㈠崟鏍囪瘑 List<String> signList = new ArrayList<String>(); /* 璁㈠崟杩斿埄绫诲瀷 杞崲 */ @@ -2074,23 +2080,6 @@ order.setOrderOrigin("3"); order.setHongBaoTypePic(CommonOrder.TYPE_INVITE); signList.add(CommonOrder.TYPE_INVITE); - - // 绾㈠寘鍔犱笂琛ヨ创閲戦 - InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, orderNo, - sourceType); - if (orderSubsidy != null && orderSubsidy.getMoney() != null) { - BigDecimal subsidyMoney = orderSubsidy.getMoney(); - // 缁存潈閲戦 - InviteOrderSubsidyDebt subsidyDebt = inviteOrderSubsidyDebtService - .getBySourceId(orderSubsidy.getId()); - if (subsidyDebt != null && subsidyDebt.getOriginMoney() != null) { - subsidyMoney = subsidyMoney.subtract(subsidyDebt.getOriginMoney()); - } - // 鏈�缁堣ˉ璐� - if (subsidyMoney.compareTo(new BigDecimal(0)) > 0) { - hongBao = hongBao.add(subsidyMoney); - } - } } order.setSignList(signList); @@ -2135,7 +2124,8 @@ order.setAccountState(stateMap); Map<String, String> hongBaoMap = new HashMap<String, String>(); - hongBaoMap.put("content", hongBaoState_Str + "鏀剁泭 楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); + hongBaoMap.put("content", + hongBaoState_Str + "鏀剁泭 楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); hongBaoMap.put("fontColor", hongbaoInfoFontColor); order.setHongBaoInfo(hongBaoMap); @@ -2179,7 +2169,7 @@ text = "鍏嶅崟涓�"; } else if (UserSystemCouponRecord.STATE_SUCCESS == state) { text = "宸插厤鍗�"; - } + } } break; } @@ -2196,4 +2186,27 @@ order.setRewardDetail(rewardMap); } } + + + @Override + public long countOrderByUidAndSettled(Long uid, BigDecimal payment) { + Long count = commonOrderMapper.countOrderByUidAndSettled(uid, payment); + if (count == null) { + count = 0L; + } + return count; + } + + + @Override + public String getNewestOrderNoByTaoBao() { + return commonOrderMapper.getNewestOrderNoByTaoBao(); + } + + + @Override + public List<CommonOrder> listByOrderNo(String orderNo) { + return commonOrderMapper.listByOrderNo(orderNo); + } + } -- Gitblit v1.8.0