From d0c6d869cbe9fc388fee13448d31a69138796442 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 15 四月 2020 18:11:32 +0800
Subject: [PATCH] 邀请等级
---
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 585 ++-------------------------------------------------------
1 files changed, 28 insertions(+), 557 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 02b41b5..1e03ab2 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
@@ -36,6 +36,7 @@
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;
@@ -57,6 +58,7 @@
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;
@@ -133,6 +135,9 @@
@Resource
private InviteOrderSubsidyService inviteOrderSubsidyService;
+
+ @Resource
+ private InviteOrderSubsidyDebtService inviteOrderSubsidyDebtService;
@Resource
private UserVIPInfoService userVIPInfoService;
@@ -1789,504 +1794,6 @@
return listVO;
}
- /**
- * 璁㈠崟淇℃伅鍔犲伐
- *
- * @param acceptData
- * @param listOrder
- * @param listGoods
- * @param uid
- */
- private void orderVOFactoryNew(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods,
- Long uid) throws Exception {
- List<String> listTB = new ArrayList<String>();
- List<String> listJD = new ArrayList<String>();
- List<String> listPDD = new ArrayList<String>();
- for (CommonOrderVO commonOrderVO : listOrder) {
- Integer sourceType = commonOrderVO.getSourceType();
- if (sourceType == null) {
- continue;
- } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
- listTB.add(commonOrderVO.getOrderNo());
- } else if (sourceType == Constant.SOURCE_TYPE_JD) {
- listJD.add(commonOrderVO.getOrderNo());
- } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
- listPDD.add(commonOrderVO.getOrderNo());
- }
- }
-
- List<UserSystemCouponRecord> listRecordTB = null;
- if (listTB.size() > 0) {
- listRecordTB = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_TAOBAO, listTB);
- }
-
- List<UserSystemCouponRecord> listRecordJD = null;
- if (listJD.size() > 0) {
- listRecordJD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_JD, listJD);
- }
-
- List<UserSystemCouponRecord> listRecordPDD = null;
- if (listPDD.size() > 0) {
- listRecordPDD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_PDD, listPDD);
- }
-
- // 闇�瑕佹煡璇㈡槸鍚︿负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()));
- }
-
- 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) {
- Integer urank = order.getUrank();
- if (urank != null) {
- String levelName = UserLevelUtil.getLevelName(urank);
- if (!StringUtil.isNullOrEmpty(levelName)) {
- order.setOrderDesc("璁㈠崟鏉ユ簮锛�" + levelName);
- }
- }
- }
- }
-
- SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
- SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
- // 2019.8.1寮�濮嬭繑鍥炵淮鏉冧俊鎭�
- Date august = TimeUtil.parse("2019-08-01");
-
- // 褰撳墠鐢ㄦ埛鏄惁鍙互浣跨敤濂栧姳鍒�
- boolean isvip = userInviteService.verifyVIP(uid);
- // 鏄惁瀛樺湪濂栧姳鍒�
- boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
-
- for (CommonOrderVO order : listOrder) {
- String orderNo = order.getOrderNo();
- Integer sourceType = order.getSourceType();
- Integer hongBaoType = order.getHongBaoType();
-
- // 鍟嗗搧淇℃伅缁勫悎
- 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);
- if (commonGoodsVO.getGoodsType() == null) {
- commonGoodsVO.setGoodsType(sourceType);
- }
-
- // 娣樺疂鍟嗗搧鍥剧墖澶勭悊
- String picture = commonGoodsVO.getPicture();
- 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);
-
- // 閭�璇疯鍗曚俊鎭繚鎶�
- if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
- || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
- || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
- Map<String, String> titleMap = new HashMap<String, String>();
- titleMap.put("content", "涓轰繚闅滅敤鎴烽殣绉侊紝鍟嗗搧淇℃伅宸查殣钘�!");
- titleMap.put("fontColor", "#888888");
- titleMap.put("bottomColor", "#E9E9E9");
- commonGoodsVO.setTitle(null);
- commonGoodsVO.setGoodsTitle(titleMap);
- }
-
- // 璁㈠崟绫诲瀷涓虹┖鏃� 宸插晢鍝佺被涓哄噯
- String shopType = commonGoodsVO.getShopType();
- if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
- order.setOrderType(1);
- } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
- order.setOrderType(2);
- }
-
- Integer goodsType = commonGoodsVO.getGoodsType();
- if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) {
- order.setOrderType(Constant.SOURCE_TYPE_ELME); // 楗夸簡涔堣鍗�
- }
-
- order.getListOrderGoods().add(commonGoodsVO);
- }
- }
-
- // 璁㈠崟绫诲瀷
- if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
- Integer orderType = order.getOrderType();
- if (orderType == null) {
- order.setOrderType(1);
- }
- } else if (sourceType == Constant.SOURCE_TYPE_JD) {
- order.setOrderType(3);
- } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
- order.setOrderType(4);
- }
-
- Date thirdCreateTime = order.getThirdCreateTime();
- if (thirdCreateTime != null) {
- order.setDownTime("涓嬪崟鏃堕棿锛�" + format.format(thirdCreateTime));
- order.setObtainTime(thirdCreateTime.getTime());
- }
-
- Date settleTime = order.getSettleTime();
- if (settleTime != null) {
- order.setReceiveTime("鏀惰揣鏃堕棿锛�" + format.format(settleTime));
- }
-
- /* 璁㈠崟鐘舵�� 杞崲澶勭悊 */
- String orderStateContent = "";
- Map<String, String> orderStateMap = new HashMap<String, String>();
- // 璁㈠崟鐘舵��
- Integer orderState = order.getState();
- // 绾㈠寘鐘舵��
- Integer hongBaoState = order.getHongBaoState();
-
- Integer stateWholeOrder = order.getStateWholeOrder();
- if (CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO == stateWholeOrder) {
- // 鏁翠釜璁㈠崟閮ㄥ垎澶辨晥锛氬垽鏂湡瀹炵姸鎬� 璁㈠崟銆佺孩鍖�
- CommonOrderVO buFenOrder = commonOrderMapper.getBuFenOrderState(uid, order.getOrderNo());
- if (buFenOrder != null) {
- // 鏈夋晥鐨勮鍗曠姸鎬�
- orderState = buFenOrder.getState();
- // 鏈夋晥鐨勭孩鍖呯姸鎬�
- hongBaoState = buFenOrder.getHongBaoState();
- }
- }
-
- // 2.1鏄剧ず杩斿埄璇存槑杩炴帴> 鏈け鏁�-鑷喘-鍒嗕韩
- if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
- if (CommonOrder.STATE_SX != orderState
- && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME)
- && ((HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType)
- || HongBaoV2.TYPE_SHARE_GOODS == hongBaoType)) {
- String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey());
- order.setRebateLink(rebateLink + "?orderNo=" + orderNo + "&sourceType=" + sourceType);
- }
- }
-
- BigDecimal hongBao = order.getHongBao();
- if (hongBao == null) {
- hongBao = new BigDecimal(0);
- }
-
- if (CommonOrder.STATE_FK == orderState) {
- orderStateContent = "宸蹭粯娆�";
- } else if (CommonOrder.STATE_JS == orderState) {
- orderStateContent = "宸叉敹璐�";
- } else if (CommonOrder.STATE_SX == orderState) {
- orderStateContent = "鏈粯娆�/宸查��娆�";
- } else if (CommonOrder.STATE_WQ == orderState) {
- orderStateContent = "宸插敭鍚�";
- if (sourceType != null && sourceType == Constant.SOURCE_TYPE_TAOBAO) {
- /* 璁㈠崟缁存潈 鍒ゆ柇鏄惁鍏ㄩ儴缁存潈 */
- List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper
- .selectListByOrderIdAndState(order.getOrderNo(), "缁存潈鎴愬姛");
-
- BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid);
- if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) {
- orderStateContent = "鍞悗鎴愬姛";
- WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
- weiQuanInfo.setOldHongBao("楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
- weiQuanInfo.setWqHongBao("鍞悗锛�-楼" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
- hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
- order.setWeiQuanInfo(weiQuanInfo);
- }
- }
- }
- orderStateMap.put("content", orderStateContent);
- orderStateMap.put("fontColor", "#666666");
- order.setOrderState(orderStateMap);
-
- String hongbaoInfo = "";
- // 璁㈠崟鏍囪瘑
- List<String> signList = new ArrayList<String>();
- /* 璁㈠崟杩斿埄绫诲瀷 杞崲 */
- if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) {
- // 鑷喘
- hongbaoInfo = "杩斿埄";
- order.setOrderOrigin("1");
- order.setHongBaoTypePic(CommonOrder.TYPE_FANLI);
- signList.add(CommonOrder.TYPE_FANLI);
- } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) {
- // 鍒嗕韩
- hongbaoInfo = "濂栭噾";
- order.setOrderOrigin("2");
- order.setHongBaoTypePic(CommonOrder.TYPE_SHARE);
- 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) {
- // 閭�璇疯鍗�
- hongbaoInfo = "濂栭噾";
- order.setOrderOrigin("3");
- order.setHongBaoTypePic(CommonOrder.TYPE_INVITE);
- signList.add(CommonOrder.TYPE_INVITE);
-
- // 瓒呯骇浼氬憳琛ヨ创淇℃伅
- InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, order.getOrderNo(),
- sourceType);
- if (orderSubsidy != null) {
- ClientTextStyleVO subsidyInfo = new ClientTextStyleVO();
- subsidyInfo.setContent("(琛ヨ创楼" + orderSubsidy.getMoney() + ")");
- if (orderSubsidy.getState() == InviteOrderSubsidy.STATE_SUBSIDIZED) {
- subsidyInfo.setColor("#E5005C");
- } else {
- subsidyInfo.setColor("#888888");
- }
- order.setSubsidy(subsidyInfo);
-
- // 瑙i噴淇℃伅锛堥棶鍙凤級
- List<String> subsidyList = new ArrayList<String>();
- subsidyList.add("棰濆琛ヨ创鑳藉惁鑾峰緱鐢辩郴缁熺畻娉曡嚜鍔ㄥ垽鏂紝浜轰负鏃犳硶骞叉秹锛�");
- subsidyList.add("棰濆琛ヨ创鍒拌处鏃堕棿浠ュ強閲戦璇蜂互瀹為檯鍒拌处涓哄噯锛�");
- subsidyList.add("棰濆琛ヨ创浜х敓鍚庡皢浼氬湪娑堟伅-璧勯噾娑堟伅涓彁閱掍綘銆�");
- order.setSubsidyList(subsidyList);
- }
- }
- order.setSignList(signList);
-
- String hongBaoDate = null;
- String hongBaoState_Str = "";
- String hongbaoInfoFontColor = "#E5005C";
-
- /* 绾㈠寘鐘舵�� 杞崲 */
- String stateContent = "";
- String stateFontColor = "#E5005C";
- Integer orderHongBaoState = null;
-
- if (HongBaoV2.STATE_KELINGQU == hongBaoState || HongBaoV2.STATE_BUKELINGQU == hongBaoState) {
- orderHongBaoState = 1;
- stateContent = "鏈埌璐�";
- hongBaoState_Str = "棰勪及";
-
- Date preAccountTime = order.getPreAccountTime();
- if (preAccountTime != null) {
- hongBaoDate = "棰勮鍒拌处鏃堕棿锛�" + formatday.format(preAccountTime);
- }
-
- } else if (HongBaoV2.STATE_YILINGQU == hongBaoState) {
- orderHongBaoState = 3;
- stateContent = "宸插埌璐�";
-
- Date accountTime = order.getAccountTime();
- if (accountTime != null) {
- hongBaoDate = "鍒拌处鏃堕棿锛�" + formatday.format(accountTime);
- }
-
- } else if (HongBaoV2.STATE_BUFENSHIXIAO == hongBaoState) {
- stateContent = "閮ㄥ垎澶辨晥";
- orderHongBaoState = 3;
- Date accountTime = order.getAccountTime();
- if (accountTime != null) {
- hongBaoDate = "鍒拌处鏃堕棿锛�" + formatday.format(accountTime);
- }
-
- } else if (HongBaoV2.STATE_SHIXIAO == hongBaoState) {
- orderHongBaoState = 4;
- stateContent = "宸插け鏁�";
- hongbaoInfoFontColor = "#888888";
- }
- order.setHongBaoState(orderHongBaoState);
- order.setHongBaoDate(hongBaoDate);
-
- 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);
- order.setAccountState(stateMap);
-
- hongbaoInfo = hongBaoState_Str + hongbaoInfo;
-
- Map<String, String> hongBaoMap = new HashMap<String, String>();
- hongBaoMap.put("content", hongbaoInfo + " 楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
- hongBaoMap.put("fontColor", hongbaoInfoFontColor);
- order.setHongBaoInfo(hongBaoMap);
-
- // 鏄剧ず杩斿埄銆佸厤鍗曡鎯�
- if (HongBaoV2.TYPE_ZIGOU == hongBaoType) {
- // 濂栧姳璁㈠崟銆佸厤鍗� 浣跨敤璁板綍
- if (sourceType == null) {
- couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, isvip);
- } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
- couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, isvip);
- } else if (sourceType == Constant.SOURCE_TYPE_JD) {
- couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, isvip);
- } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
- couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, isvip);
- }
- }
-
- // 鍒嗕韩銆侀個璇� 闅愯棌璁㈠崟鍙�
- if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType || 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()));
- }
- }
- }
-
- /**
- * 璁㈠崟锛� 鍏嶅崟鏍囪瘑 濂栧姳鏍囪瘑
- *
- * @param order
- * @param hasRewardCoupon
- * @param hongBaoState
- * @param list
- * @param signList
- */
- private void couponFactoryNew(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState,
- Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip) throws Exception {
- // 鏄惁鍏嶅崟鍟嗗搧
- boolean freeOrder = false;
- // 鏄惁濂栧姳鎴愬姛
- boolean rewardSuccess = false;
- if (list != null && list.size() > 0) {
- for (UserSystemCouponRecord couponRecord : list) {
- int goodSource = couponRecord.getGoodSource();
- if (goodSource == 0)
- goodSource = 1;
-
- if (order.getOrderNo().equals(couponRecord.getOrderNo()) && goodSource == order.getSourceType()) {
- Integer state = couponRecord.getState();
- String systemCouponType = couponRecord.getCouponType();
- if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType)
- && UserSystemCouponRecord.STATE_SUCCESS == state) {
- rewardSuccess = true;
- } else if (CouponTypeEnum.freeCoupon.name().equals(systemCouponType)
- || CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType)
- || CouponTypeEnum.freeCouponBuy.name().equals(systemCouponType)) {
-
- if (UserSystemCouponRecord.STATE_FREE_ON == state) {
- // 鍏嶅崟涓�
- freeOrder = true;
- order.getSignList().add(PIC_FREE_ON);
- } else if (UserSystemCouponRecord.STATE_SUCCESS == state) {
- // 鍏嶅崟鎴愬姛
- freeOrder = true;
- order.getSignList().add(PIC_FREE_SUCCEED);
- } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state
- || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) {
- // 瑙勫垯涓嶅尮閰嶃�侀��娆�
- freeOrder = true;
- order.getSignList().add(PIC_FREE_FAIL);
- }
- }
- break;
- }
- }
- }
-
- // 鍏嶅崟璇︽儏
- if (freeOrder) {
- ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
- rewardStyleVO.setContent("鍏嶅崟璇︽儏 >");
- rewardStyleVO.setColor("#E5005C");
- rewardStyleVO.setBottomColor("#FFDCEA");
-
- 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", 1); // 椤甸潰璺宠浆
- jump.put("params", jumpLink);
- jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail"));
-
- Map<String, Object> rewardMap = new HashMap<String, Object>();
- rewardMap.put("text", rewardStyleVO);
- rewardMap.put("jump", jump);
- order.setRewardDetail(rewardMap);
- }
-
- // 宸蹭娇鐢ㄥ鍔卞埜
- if (rewardSuccess) {
- ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
- rewardStyleVO.setColor("#E5005C");
- rewardStyleVO.setBottomColor("#FFDCEA");
- rewardStyleVO.setContent("宸蹭娇鐢ㄥ鍔卞埜 >");
-
- Map<String, Object> rewardMap = new HashMap<String, Object>();
- 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", 1); // 1 甯歌璺宠浆椤甸潰
- jump.put("params", jumpLink);
- jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
- rewardMap.put("jump", jump);
- order.setRewardDetail(rewardMap);
- }
-
- // 鏄惁鍙娇鐢ㄥ鍔卞埜
- if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType
- && HongBaoV2.STATE_YILINGQU == hongBaoState && !vip && CommonOrder.STATE_WQ != order.getState()) {
- // 涓嬪崟鏃堕棿
- Date thirdCreateTime = order.getThirdCreateTime();
- // 鍒拌处鏃堕棿
- Date accountTime = order.getAccountTime();
- if (thirdCreateTime == null || accountTime == null)
- return;
-
- // 涓嬪崟鏃ユ湡鏄惁鏄鍚堜笂绾挎棩鏈�
- long downOrderTime = thirdCreateTime.getTime();
- long limitDate = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
- if (downOrderTime > limitDate) {
- // 2.1 寮�濮嬫柊鐗�
- rewardCounponLimitTime(order, accountTime);
- } else if (hasRewardCoupon) {
- // 鍦�2.1鏂扮増涓婄嚎涔嬪墠璁㈠崟-瀛樺湪鍒欐樉绀哄鍔卞埜鍙娇鐢�
- ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
- rewardStyleVO.setColor("#E5005C");
- rewardStyleVO.setBottomColor("#FFDCEA");
- rewardStyleVO.setContent("浣跨敤濂栧姳鍒�");
-
- 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", 2); // 寮规
- jump.put("params", jumpLink);
- jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
-
- Map<String, Object> rewardMap = new HashMap<String, Object>();
- rewardMap.put("text", rewardStyleVO);
- rewardMap.put("jump", jump);
- order.setRewardDetail(rewardMap);
- }
- }
- }
@Override
public Date getThirdCreateTime(String orderId, int sourceType) {
@@ -2296,8 +1803,6 @@
return list.get(0).getThirdCreateTime();
}
-
-
@Override
public List<CommonOrderVO> getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type,
@@ -2562,6 +2067,21 @@
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);
@@ -2604,9 +2124,8 @@
stateMap.put("content", stateContent);
stateMap.put("fontColor", stateFontColor);
order.setAccountState(stateMap);
-
hongbaoInfo = hongBaoState_Str + hongbaoInfo;
-
+
Map<String, String> hongBaoMap = new HashMap<String, String>();
hongBaoMap.put("content", hongbaoInfo + " 楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
hongBaoMap.put("fontColor", hongbaoInfoFontColor);
@@ -2624,20 +2143,14 @@
* 璁㈠崟锛� 鍏嶅崟鏍囪瘑 濂栧姳鏍囪瘑
*
* @param order
- * @param hasRewardCoupon
- * @param hongBaoState
* @param list
- * @param signList
*/
private void couponUseFactory(CommonOrderVO order, List<UserSystemCouponRecord> list) throws Exception {
if (list == null || list.size() == 0) {
return;
}
- // 鏄惁鍏嶅崟鍟嗗搧
- boolean freeOrder = false;
- // 鏄惁濂栧姳鎴愬姛
- boolean rewardSuccess = false;
+ String text = null;
for (UserSystemCouponRecord couponRecord : list) {
int goodSource = couponRecord.getGoodSource();
if (goodSource == 0)
@@ -2649,70 +2162,28 @@
String systemCouponType = couponRecord.getCouponType();
if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType)
&& UserSystemCouponRecord.STATE_SUCCESS == state) {
- // 宸蹭娇鐢ㄥ鍔卞埜
- rewardSuccess = true;
+ text = "宸插鍔�";
} else if (CouponTypeEnum.freeCoupon.name().equals(systemCouponType)
|| CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType)
|| CouponTypeEnum.freeCouponBuy.name().equals(systemCouponType)) {
if (UserSystemCouponRecord.STATE_FREE_ON == state) {
- // 鍏嶅崟涓�
- freeOrder = true;
- order.getSignList().add(PIC_FREE_ON);
+ text = "鍏嶅崟涓�";
} else if (UserSystemCouponRecord.STATE_SUCCESS == state) {
- // 鍏嶅崟鎴愬姛
- freeOrder = true;
- order.getSignList().add(PIC_FREE_SUCCEED);
- } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state
- || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) {
- // 瑙勫垯涓嶅尮閰嶃�侀��娆�
- freeOrder = true;
- order.getSignList().add(PIC_FREE_FAIL);
- }
+ text = "鍏嶅崟鎴愬姛";
+ }
}
break;
}
}
- // 鍏嶅崟璇︽儏
- if (freeOrder) {
+ if (!StringUtil.isNullOrEmpty(text)) {
ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
- rewardStyleVO.setContent("鍏嶅崟璇︽儏 >");
+ rewardStyleVO.setContent(text);
rewardStyleVO.setColor("#E5005C");
rewardStyleVO.setBottomColor("#FFDCEA");
- 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", 1); // 椤甸潰璺宠浆
- jump.put("params", jumpLink);
- jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail"));
-
Map<String, Object> rewardMap = new HashMap<String, Object>();
rewardMap.put("text", rewardStyleVO);
- rewardMap.put("jump", jump);
- order.setRewardDetail(rewardMap);
- }
-
- // 宸蹭娇鐢ㄥ鍔卞埜
- if (rewardSuccess) {
- ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
- rewardStyleVO.setColor("#E5005C");
- rewardStyleVO.setBottomColor("#FFDCEA");
- rewardStyleVO.setContent("宸蹭娇鐢ㄥ鍔卞埜 >");
-
- Map<String, Object> rewardMap = new HashMap<String, Object>();
- 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", 1); // 1 甯歌璺宠浆椤甸潰
- jump.put("params", jumpLink);
- jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
- rewardMap.put("jump", jump);
order.setRewardDetail(rewardMap);
}
}
--
Gitblit v1.8.0