From 8269e7b56dace572d0abf328bebad6cabaed069e Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 29 一月 2019 09:40:02 +0800 Subject: [PATCH] 活动红包规则添加 --- fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java | 37 ++++++++++++++++++++++++++++++++++++- 1 files changed, 36 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java index 51df0e4..9fbdf3b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java @@ -31,26 +31,31 @@ import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail; import com.yeshi.fanli.entity.bus.user.HongBao; import com.yeshi.fanli.entity.bus.user.HongBaoV2; +import com.yeshi.fanli.entity.bus.user.Order; import com.yeshi.fanli.entity.bus.user.UserInfo; 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.taobao.PidOrder; import com.yeshi.fanli.entity.taobao.TaoBaoOrder; import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder; import com.yeshi.fanli.exception.HongBaoException; import com.yeshi.fanli.exception.share.UserShareGoodsRecordException; import com.yeshi.fanli.log.LogHelper; +import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service; import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce; import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService; import com.yeshi.fanli.service.inter.order.CommonOrderService; +import com.yeshi.fanli.service.inter.order.ShareGoodsActivityOrderService; import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.service.inter.user.UserNotificationService; import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; +import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil; @@ -107,6 +112,12 @@ @Resource private UserOrderMsgNotificationService userOrderMsgNotificationService; + + @Resource + private ConfigService configService; + + @Resource + private ShareGoodsActivityOrderService shareGoodsActivityOrderService; @Override public int insert(HongBaoV2 record) { @@ -577,7 +588,16 @@ } } else if (type == HongBaoV2.TYPE_SHARE_GOODS) { - BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime()); + BigDecimal fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); + Order order = orderMapper.selectOrderByOrderId(commonOrder.getOrderNo()); + if (order != null) { + List<ShareGoodsActivityOrder> list = shareGoodsActivityOrderService + .listByOrderIdAndUid(commonOrder.getUserInfo().getId(), order.getId()); + if (list != null && list.size() > 0) { + fanliRate = list.get(0).getShareRate(); + } + } + HongBaoV2 hongBao = new HongBaoV2(hongBaoOrder.getHongBaoV2().getId()); hongBao.setUpdateTime(new Date()); // 鏇存敼鐘舵�佷笌璧勯噾 @@ -815,6 +835,21 @@ return; // 鍒嗕韩璧� BigDecimal shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); + + // 鍒ゆ柇璁㈠崟鍒嗕韩娲诲姩鏄惁寮�鍚� + if ("1".equalsIgnoreCase(configService.get("share_goods_activity_open"))) { + // 娌℃湁璁㈠崟锛屽苟涓旀槸娓犻亾ID鏉ョ殑锛屽苟涓� + List<TaoBaoOrder> taoBaoOrderList = taoBaoOrderMapper + .selectTaoBaoOrderByOrderId(commonOrder.getOrderNo()); + if (taoBaoOrderList != null && taoBaoOrderList.size() > 0 + && !StringUtil.isNullOrEmpty(taoBaoOrderList.get(0).getRelationId())) { + if (shareGoodsActivityOrderService.listByUid(commonOrder.getUserInfo().getId()).size() < 1) { + shareRate = new BigDecimal(hongBaoManageService.get("share_activity_proportion")); + } + } + + } + HongBaoV2 hongBao = new HongBaoV2(); hongBao.setCreateTime(new Date()); hongBao.setType(HongBaoV2.TYPE_SHARE_GOODS); -- Gitblit v1.8.0