| | |
| | | import com.yeshi.fanli.dto.mq.user.body.UserForbiddenMQMsg;
|
| | | import com.yeshi.fanli.dto.order.UserTeamLevel;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.money.TeamDividentsDebtException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsSourceOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsManager;
|
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsSourceManager;
|
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.order.CommonOrderUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | |
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private TeamUserLevelStatisticService teamUserLevelStatisticService;
|
| | | private UserLevelManager userLevelManager;
|
| | |
|
| | | public OrderDividentsMessageListener() {
|
| | |
|
| | |
| | | }
|
| | | } else if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {
|
| | |
|
| | | OrderMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | if (dto == null || dto.getStaticticDate().getTime() < Constant.NEW_ORDER_FANLI_RULE_TIME)
|
| | | return Action.CommitMessage;
|
| | |
|
| | | if (dto.isMiandan())// 免单的商品不参与分红
|
| | | return Action.CommitMessage;
|
| | |
|
| | | if (dto.getHandleType() == OrderMQMsg.HANDLE_TYPE_ADD) {
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndOrderId(dto.getType(),
|
| | | dto.getOrderId());
|
| | |
| | | List<ThreeSale> threeSalesList = threeSaleSerivce.getMyBossDeepList(dto.getUid(), 100);
|
| | | if (threeSalesList != null)
|
| | | for (ThreeSale ts : threeSalesList) {
|
| | | TeamUserLevelStatistic levelStatistic = teamUserLevelStatisticService
|
| | | .selectByUid(ts.getBoss().getId());
|
| | | if (levelStatistic == null) {
|
| | | teamUserLevelStatisticService.initData(ts.getBoss().getId());
|
| | | levelStatistic = teamUserLevelStatisticService.selectByUid(ts.getBoss().getId());
|
| | | }
|
| | | bossList.add(new UserTeamLevel(ts.getBoss().getId(), levelStatistic.getLevel()));
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(ts.getBoss().getId());
|
| | | bossList.add(new UserTeamLevel(ts.getBoss().getId(), level));
|
| | | }
|
| | | try {
|
| | | teamDividentsSourceManager.addSource(commonOrderList, bossList);
|
| | |
| | | }
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderConfirm.name())) {// 订单确认收货
|
| | | // 插入分红
|
| | | OrderConfirmMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderConfirmMQMsg.class);
|
| | | teamDividentsSourceManager.orderSettle(dto.getOrderNo(), dto.getSourceType());
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.taoBaoOrderWeiQuan.name())) {
|