From ee5c8055b1c0dd7c67a9025a76b10bd287c93d9a Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 15 四月 2020 09:52:27 +0800 Subject: [PATCH] 资金明细增加团队分红 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java | 92 +++++++++++++++++++-------------------------- 1 files changed, 39 insertions(+), 53 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java index b6cfc24..e50225f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java @@ -30,10 +30,12 @@ import com.yeshi.fanli.entity.bus.user.ThreeSale; import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; import com.yeshi.fanli.entity.bus.user.UserInfo; +import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; import com.yeshi.fanli.entity.order.CommonOrder; import com.yeshi.fanli.entity.order.CommonOrderGoods; import com.yeshi.fanli.entity.order.HongBaoOrder; import com.yeshi.fanli.entity.order.ShareGoodsActivityOrder; +import com.yeshi.fanli.entity.system.ConfigKeyEnum; import com.yeshi.fanli.entity.taobao.TaoBaoOrder; import com.yeshi.fanli.exception.order.HongBaoException; import com.yeshi.fanli.exception.order.ShareGoodsActivityOrderException; @@ -146,7 +148,7 @@ return hongBaoV2Mapper.selectByPrimaryKey(id); } - @Transactional + @Transactional(rollbackFor = Exception.class) @Override public int addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException, UserAccountException { Set<Integer> stateSet = new HashSet<>();// 璁㈠崟鐘舵�丼et @@ -189,63 +191,36 @@ switch (t) { case HongBaoV2.TYPE_ZIGOU: userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType, - commonOrder.getPayment(), money, goodsCount, state); + commonOrder.getPayment(), money, goodsCount, commonOrder.getState(), + commonOrder.getThirdCreateTime()); + break; case HongBaoV2.TYPE_SHARE_GOODS: userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType, - commonOrder.getPayment(), money, goodsCount, state); + commonOrder.getPayment(), money, goodsCount, commonOrder.getState(), + commonOrder.getThirdCreateTime()); + break; case HongBaoV2.TYPE_YIJI: - userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, - commonOrder.getPayment(), money, goodsCount, state); + commonOrder.getPayment(), money, goodsCount, commonOrder.getState(), + commonOrder.getThirdCreateTime()); break; case HongBaoV2.TYPE_ERJI: - - userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, - commonOrder.getPayment(), money, goodsCount, state); + userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money, + goodsCount, commonOrder.getState(), commonOrder.getThirdCreateTime()); break; case HongBaoV2.TYPE_SHARE_YIJI: - userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId, orderType, - commonOrder.getPayment(), money, goodsCount, state, notify.getBeizhu()); + userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, + commonOrder.getPayment(), money, goodsCount, commonOrder.getState(), + commonOrder.getThirdCreateTime()); + + case HongBaoV2.TYPE_SHARE_ERJI: + userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money, + goodsCount, commonOrder.getState(), commonOrder.getThirdCreateTime()); break; - } - } - } - - // 娣诲姞鏂扮増鏈�氱煡 - - if (!hasAdd) { - Iterator<Integer> its = notificationMap.keySet().iterator(); - while (its.hasNext()) { - Integer t = its.next(); - HongBaoV2 notify = notificationMap.get(t).getHongBaoV2(); - CommonOrder commonOrder = notificationMap.get(t).getCommonOrder(); - String orderId = commonOrderList.get(0).getOrderNo(); - Long uid = notify.getUserInfo().getId(); - BigDecimal money = notify.getMoney(); - switch (t) { - case HongBaoV2.TYPE_ZIGOU: - userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, orderType, - commonOrder.getPayment(), money, state); - break; - case HongBaoV2.TYPE_SHARE_GOODS: - userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, orderType, - commonOrder.getPayment(), money, state); - break; - case HongBaoV2.TYPE_YIJI: - userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType, - commonOrder.getPayment(), money, state); - break; - case HongBaoV2.TYPE_ERJI: - userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType, - commonOrder.getPayment(), money, state); - break; - case HongBaoV2.TYPE_SHARE_YIJI: - userOrderMsgNotificationService.orderShareFirstLevelStateChanged(uid, orderId, orderType, - commonOrder.getPayment(), money, state); } } } @@ -276,7 +251,7 @@ return CommonOrder.STATE_SX; } - @Transactional + @Transactional(rollbackFor = Exception.class) private boolean updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException, UserAccountException { System.out.println(commonOrder.getOrderNo()); @@ -285,11 +260,11 @@ if (oldHongBao == null) throw new HongBaoException(10, "绾㈠寘瀵硅薄涓嶅瓨鍦�"); // 宸茬粡澶辨晥锛屽凡缁忛鍙栵紝鏂拌�佺姸鎬佷竴鑷寸殑绾㈠寘涓嶅仛澶勭悊 - if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO||oldHongBao.getState() == HongBaoV2.STATE_YILINGQU) + if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU) return false; if (type == HongBaoV2.TYPE_ZIGOU) {// 鑾峰彇鑷喘鐨勮繑鍒╂瘮渚� - BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime()); + BigDecimal fanliRate = hongBaoManageService.getFanLiRate(UserLevelEnum.daRen,commonOrder.getCreateTime().getTime()); // 鍏嶅崟澶勭悊 boolean mianDan = false; List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO, @@ -371,6 +346,9 @@ List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId()); if (children != null && children.size() > 0) for (HongBaoV2 child : children) { + if (child.getState() == HongBaoV2.STATE_YILINGQU) + continue; + HongBaoV2 childUpdate = new HongBaoV2(child.getId()); childUpdate.setState(hongBao.getState()); childUpdate.setUpdateTime(new Date()); @@ -540,7 +518,7 @@ && commonOrder.getSourcePosition().equalsIgnoreCase(TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT)) fanliRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime()); else - fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); + fanliRate = hongBaoManageService.getShareRate(UserLevelEnum.daRen,commonOrder.getCreateTime().getTime()); List<ShareGoodsActivityOrder> list = shareGoodsActivityOrderService .listByOrderIdAndUid(commonOrder.getUserInfo().getId(), commonOrder.getOrderNo()); @@ -592,6 +570,9 @@ List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId()); if (children != null) for (HongBaoV2 child : children) { + if (child.getState() == HongBaoV2.STATE_YILINGQU) + continue; + HongBaoV2 childUpdate = new HongBaoV2(child.getId()); // 缁熶竴璁剧疆鐘舵�� childUpdate.setState(hongBao.getState()); @@ -657,11 +638,11 @@ return true; } - @Transactional + @Transactional(rollbackFor = Exception.class) private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException, UserAccountException { if (type == HongBaoV2.TYPE_ZIGOU) {// 鑾峰彇鑷喘鐨勮繑鍒╂瘮渚� - BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime()); + BigDecimal fanliRate = hongBaoManageService.getFanLiRate(UserLevelEnum.daRen,commonOrder.getCreateTime().getTime()); // 鏌ヨ鏄惁鏈夊厤鍗曡鍒� BigDecimal mianDanMoney = null; if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK) { @@ -876,10 +857,10 @@ && commonOrder.getSourcePosition().equalsIgnoreCase(TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT))// 鏉ヨ嚜浜庢窐绀奸噾鐨勫垎浜� shareRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime()); else - shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); + shareRate = hongBaoManageService.getShareRate(UserLevelEnum.daRen,commonOrder.getCreateTime().getTime()); // 鍒ゆ柇璁㈠崟鍒嗕韩娲诲姩鏄惁寮�鍚� - if ("1".equalsIgnoreCase(configService.get("share_goods_activity_open"))) { + if ("1".equalsIgnoreCase(configService.get(ConfigKeyEnum.shareGoodsActivityOpen.getKey()))) { // 娌℃湁璁㈠崟锛屽苟涓旀槸娓犻亾ID鏉ョ殑锛屽苟涓� UserExtraTaoBaoInfo taoBaoExtraInfo = userExtraTaoBaoInfoService .getByUid(commonOrder.getUserInfo().getId()); @@ -1171,4 +1152,9 @@ return hongBaoV2Mapper.listByIds(idList); } + @Override + public List<HongBaoDTO> listByOrderTradeId(String tradeId) { + return hongBaoV2Mapper.listByOrderTradeId(tradeId); + } + } -- Gitblit v1.8.0