admin
2019-09-06 2012b3b5db3c6b06535a68f775bcc81b16151b90
加入任务
3个文件已修改
138 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
@@ -42,7 +42,6 @@
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.brand.BrandInfoVO;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.goods.ShopInfoVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java
@@ -372,7 +372,7 @@
    }
    
    
//    @Async()
    @Async()
    @Override
    public void firstRebateOrderRewardBoss(Long uid, Long originUid, String beizu) {
        if (uid == null || originUid == null)
@@ -384,7 +384,7 @@
        firstOrderReward(uid, originUid, Integer.parseInt(reward), "一", beizu);
    }
    
//    @Async()
    @Async()
    @Override
    public void firstRebateOrderRewardBossSuper(Long uid, Long originUid, String beizu) {
        if (uid == null || originUid == null)
@@ -397,7 +397,7 @@
    }
    
    
//    @Async()
    @Async()
    @Override
    public void firstShareOrderReward(Long uid, String beizu) {
        if(uid == null)
@@ -410,7 +410,7 @@
    }
    
    
//    @Async()
    @Async()
    @Override
    public void firstSharerOrderRewardBoss(Long uid, Long originUid, String beizu) {
        if (uid == null || originUid == null)
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -36,6 +36,7 @@
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.integral.IntegralGetService;
import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
import com.yeshi.fanli.service.inter.jd.JDOrderService;
import com.yeshi.fanli.service.inter.lable.BoutiqueAutoRuleService;
import com.yeshi.fanli.service.inter.lable.LabelService;
@@ -123,6 +124,9 @@
    @Resource
    private HongBaoOrderService hongBaoOrderService;
    @Resource
    private IntegralTaskRecordService integralTaskRecordService;
    private static boolean isInited = false;
@@ -779,68 +783,83 @@
                    if (map != null) {
                        // 是否是首单
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
                            String key = its.next();
                            Order order = map.get(key);
                            // 统计订单下的用户所获得的返利金额
                            List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(order.getOrderType(),
                                    order.getOrderId());
                            Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
                            if (list != null)
                                for (CommonOrder commonOrder : list) {
                                    HongBaoOrder hongBaoOrder = hongBaoOrderService
                                            .selectDetailByCommonOrderId(commonOrder.getId());
                                    if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
                                        Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
                                        if (hongBaoMoney.get(mainUid) == null)
                                            hongBaoMoney.put(mainUid, new BigDecimal(0));
                                        hongBaoMoney.put(mainUid,
                                                hongBaoMoney.get(mainUid).add(hongBaoOrder.getHongBaoV2().getMoney()));
                                        // 查询上级
                                        List<HongBaoV2> children = hongBaoV2Service
                                                .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
                                        if (children != null) {
                                            for (HongBaoV2 hongBao : children) {
                                                Long uid = hongBao.getUserInfo().getId();
                                                if (hongBaoMoney.get(uid) == null)
                                                    hongBaoMoney.put(uid, new BigDecimal(0));
                                                hongBaoMoney.put(uid, hongBaoMoney.get(uid).add(hongBao.getMoney()));
                            try {
                                String key = its.next();
                                Order order = map.get(key);
                                // 统计订单下的用户所获得的返利金额
                                List<CommonOrder> list = commonOrderService
                                        .listBySourceTypeAndOrderId(order.getOrderType(), order.getOrderId());
                                Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
                                if (list != null)
                                    for (CommonOrder commonOrder : list) {
                                        HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                .selectDetailByCommonOrderId(commonOrder.getId());
                                        if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
                                            Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
                                            if (hongBaoMoney.get(mainUid) == null)
                                                hongBaoMoney.put(mainUid, new BigDecimal(0));
                                            hongBaoMoney.put(mainUid, hongBaoMoney.get(mainUid)
                                                    .add(hongBaoOrder.getHongBaoV2().getMoney()));
                                            // 查询上级
                                            List<HongBaoV2> children = hongBaoV2Service
                                                    .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
                                            if (children != null) {
                                                for (HongBaoV2 hongBao : children) {
                                                    Long uid = hongBao.getUserInfo().getId();
                                                    if (hongBaoMoney.get(uid) == null)
                                                        hongBaoMoney.put(uid, new BigDecimal(0));
                                                    hongBaoMoney.put(uid,
                                                            hongBaoMoney.get(uid).add(hongBao.getMoney()));
                                                }
                                            }
                                        }
                                    }
                                }
                            if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                    order.getUserInfo().getId())) {// 有效的首单
                                if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
                                        .get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
                                    // TODO 分享奖金是0
                                }
                                if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                        order.getUserInfo().getId())) {// 有效的首单
                                    if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
                                            .get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
                                        // 分享奖金是0
                                        integralTaskRecordService.firstShareOrderReward(order.getUserInfo().getId(),
                                                null);
                                    }
                                // 获取上两级数据
                                UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                if (boss != null) {// 判断上级的红包
                                    if (hongBaoMoney.get(boss.getId()) == null
                                            || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                        // TODO 补偿资金
                                    // 获取上两级数据
                                    UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null
                                                || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币
                                            integralTaskRecordService.firstSharerOrderRewardBoss(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                    }
                                } else {// 自购订单
                                    UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null
                                                || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币1级
                                            integralTaskRecordService.firstRebateOrderRewardBoss(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                    }
                                    boss = threeSaleSerivce.getBoss(boss.getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null
                                                || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币2级
                                            integralTaskRecordService.firstRebateOrderRewardBossSuper(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                    }
                                }
                            } else {// 自购订单
                                UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                if (boss != null) {// 判断上级的红包
                                    if (hongBaoMoney.get(boss.getId()) == null
                                            || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                        // TODO 补偿资金1级
                                    }
                                }
                                boss = threeSaleSerivce.getBoss(boss.getId());
                                if (boss != null) {// 判断上级的红包
                                    if (hongBaoMoney.get(boss.getId()) == null
                                            || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                        // TODO 补偿资金2级
                                    }
                                }
                                PlaceOrderCMQManager.getInstance().deleteQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL,
                                        key);
                            } catch (Exception e) {
                                LogHelper.errorDetailInfo(e);
                            }
                        }