admin
2019-12-27 ff076ec18ccc61d9d03863d859000e4a46c19a76
自购返利维权到账修改
8个文件已修改
131 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/MongodbBaseDao.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateOrderJob.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/tb/TaoBaoWeiQuanDrawBackServiceImpl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoWeiQuanOrderServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -153,6 +153,7 @@
        }
        // 去除前后空格
        text = text.trim();
        String originalText=text;
        try {
            TokenVO tokenVO = tokenRecordService.discernToken(text, uid, acceptData);
@@ -231,7 +232,7 @@
            tb = TaoBaoUtil.isAlimama(id);
            if (tb == null) {
                type = 4;
                tb = getTaoBaoGoodsBriefFromGoodsId(id);
                tb = getTaoBaoGoodsBriefFromGoodsId(id,originalText);
            }
        } else if (text.contains("http://zmnxbc.com")) { // 手机端天猫APP分享
            tb = TaoBaoUtil.parsePhoneShareUrlByTM(text);
@@ -243,7 +244,7 @@
            tb = TaoBaoUtil.isAlimama(id);
            if (tb == null) {
                type = 4;
                tb = getTaoBaoGoodsBriefFromGoodsId(id);
                tb = getTaoBaoGoodsBriefFromGoodsId(id,originalText);
            }
        } else if (text.contains("v.douyin.com")) { // 抖音
            analysisDouYin(acceptData, text, out);
@@ -254,7 +255,7 @@
            if (tb == null) {
                String goodsId = TaoBaoUtil.getGoodsIdByPhoneShareUrl(text);
                if (!StringUtil.isNullOrEmpty(goodsId)) {
                    tb = getTaoBaoGoodsBriefFromGoodsId(goodsId);
                    tb = getTaoBaoGoodsBriefFromGoodsId(goodsId,originalText);
                    if (tb != null)
                        type = 4;
                }
@@ -404,12 +405,22 @@
        out.print(JsonUtil.loadTrueResult(root));
    }
    private TaoBaoGoodsBrief getTaoBaoGoodsBriefFromGoodsId(String goodsId) {
    private TaoBaoGoodsBrief getTaoBaoGoodsBriefFromGoodsId(String goodsId, String text) {
        TaoBaoGoodsBrief tb = TaoBaoUtil.getTmallGoodsInfo(goodsId);
        if (tb == null && NumberUtil.isNumeric(goodsId)) {// 是数字
            tb = TaoBaoUtil.getSimpleGoodsBrief(Long.parseLong(goodsId));
            if (tb != null) {
                tb.setPictUrl(TbImgUtil.getTBSize220Img(tb.getPictUrl()));
//            tb = TaoBaoUtil.getSimpleGoodsBrief(Long.parseLong(goodsId));
//            if (tb != null) {
//                tb.setPictUrl(TbImgUtil.getTBSize220Img(tb.getPictUrl()));
//            }
            if (tb == null) {
                tb = new TaoBaoGoodsBrief();
                if (text.trim().indexOf("【") == 0 && text.trim().indexOf("】") > 0) {
                    // 截取标题
                    String title = text.trim().substring(1, text.trim().lastIndexOf("】"));
                    tb.setAuctionId(Long.parseLong(goodsId));
                    tb.setTitle(title);
                    tb.setPictUrl("http://");
                }
            }
        }
        return tb;
fanli/src/main/java/com/yeshi/fanli/dao/MongodbBaseDao.java
@@ -6,6 +6,7 @@
import javax.annotation.Resource;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
fanli/src/main/java/com/yeshi/fanli/job/order/taobao/UpdateOrderJob.java
@@ -16,6 +16,8 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.yeshi.fanli.dto.taobao.WeiQuanOrderResult;
import com.yeshi.fanli.entity.bus.user.LostOrder;
import com.yeshi.fanli.entity.bus.user.Order;
@@ -368,11 +370,14 @@
    }
    // 每月25号9点执行返利
    @Scheduled(cron = "0 0 9 25 * ? ")
    public void fanliInvaiteAndShare() {
        if (!Constant.IS_TASK)
            return;
        orderProcessService.fanliInvaiteAndShare();
    // @Scheduled(cron = "0 0 9 25 * ? ")
    @XxlJob("fanliInvaiteAndShareHandler")
    public ReturnT<String> fanliInvaiteAndShareHandler(String param) throws Exception {
        if (StringUtil.isNullOrEmpty(param))
            orderProcessService.fanliInvaiteAndShare();
        else
            orderProcessService.fanliInvaiteAndShare(Long.parseLong(param));
        return ReturnT.SUCCESS;
    }
    // 维权订单处理-处理最近60天的
fanli/src/main/java/com/yeshi/fanli/service/impl/money/tb/TaoBaoWeiQuanDrawBackServiceImpl.java
@@ -39,6 +39,7 @@
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.money.InviteOrderSubsidyDebtService;
import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
import com.yeshi.fanli.service.inter.money.UserMoneyService;
import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
@@ -88,6 +89,9 @@
    @Resource
    private InviteOrderSubsidyDebtService inviteOrderSubsidyDebtService;
    @Resource
    private UserMoneyDetailService userMoneyDetailService;
    @Override
    public void addWeiQuanDrawBack(TaoBaoWeiQuanDrawBack taoBaoWeiQuanDrawBack) {
@@ -265,11 +269,34 @@
                        e1.printStackTrace();
                    }
                }
                if (userMoneyDetail == null)
                    throw new TaoBaoWeiQuanException(110, "资金记录生成失败");
                userMoneyService.subUserMoney(uid, drawBackMoney, userMoneyDetail);
                // 新版通知
                userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, orderId, Constant.SOURCE_TYPE_TAOBAO,
                        drawBackMoney, userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
            } else {// 记录资金记录,但是不显示给用户
                UserMoneyDetail userMoneyDetail = null;
                // 新版资金记录
                try {
                    userMoneyDetail = UserMoneyDetailFactory.createFanLiWeiQuan(uid, weiQuanDrawBack, drawBackMoney);
                } catch (UserMoneyDetailException e) {
                    try {
                        LogHelper.errorDetailInfo(e);
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }
                }
                if (userMoneyDetail == null)
                    throw new TaoBaoWeiQuanException(110, "资金记录生成失败");
                userMoneyDetail.setShow(false);
                try {
                    userMoneyDetailService.addUserMoneyDetail(userMoneyDetail);
                } catch (UserMoneyDetailException e) {
                    throw new TaoBaoWeiQuanException(111, "插入记录生成失败");
                }
            }
        }
        return userSubMoneyMap;
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
@@ -479,7 +479,7 @@
                        Long uid = its.next();
                        if (userSubMoneyMap.get(uid) != null) {
                            // 减去维权资金
                            userMoney.put(uid, userMoney.get(uid).subtract(userSubMoneyMap.get(uid)));
                            userMoney.put(uid, userMoney.get(uid).subtract(userSubMoneyMap.get(uid)));
                        }
                    }
                }
fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoWeiQuanOrderServiceImpl.java
@@ -110,7 +110,7 @@
                    updateCommonOrder.setState(CommonOrder.STATE_WQ);
                    updateCommonOrder.setUpdateTime(new Date());
                    commonOrderService.updateByPrimaryKeySelective(updateCommonOrder);
                    userOrderWeiQuanRecordService.addTaoBaoWeiQuan(taoBaoWeiQuanOrder);
                    userOrderWeiQuanRecordService.addTaoBaoWeiQuan(order);
                }
            }
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
@@ -93,7 +93,7 @@
    public BigDecimal getRewardMoney(Long uid) {
        return redPackWinInviteMapper.getRewardMoney(uid);
    }
    @Override
    @RequestSerializableByKeyService(key = "#teamUid")
    @Transactional(rollbackFor = Exception.class)
@@ -106,13 +106,13 @@
        if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
                activeLog.getVersionCode()))
            return;
        // 同一队员只记录一次
        int totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, teamUid,
                RedPackWinInviteTypeEnum.zeroStageReward.name());
        if (totalReward > 0)
            return;
        // 获得红包
        RedPackWinInvite winInvite = new RedPackWinInvite();
        winInvite.setUid(bossId);
@@ -124,14 +124,14 @@
        winInvite.setUpdateTime(new Date());
        redPackWinInviteMapper.insertSelective(winInvite);
    }
    @Override
    @RequestSerializableByKeyService(key = "#teamUid")
    @Transactional(rollbackFor = Exception.class)
    public void inviteSucceedReward(Long teamUid) throws Exception {
        // 是否在上线之后的邀请关系
        ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, TimeUtil.convertDateToTemp(Constant.RED_PACK_ONLINE_TIME));
        ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid,
                TimeUtil.convertDateToTemp(Constant.RED_PACK_ONLINE_TIME));
        if (threeSale == null)
            return;
@@ -144,6 +144,11 @@
        // 小于2.0.2版本不增加
        if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
                activeLog.getVersionCode()))
            return;
        int totalRewardZero = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, teamUid,
                RedPackWinInviteTypeEnum.zeroStageReward.name());
        if (totalRewardZero <= 0)
            return;
        // 同一队员奖励一次
@@ -222,7 +227,8 @@
            return;
        // 验证上下级关系
        ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, TimeUtil.convertDateToTemp(Constant.RED_PACK_ONLINE_TIME));
        ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid,
                TimeUtil.convertDateToTemp(Constant.RED_PACK_ONLINE_TIME));
        if (threeSale == null || threeSale.getBoss().getId().longValue() != uid.longValue())
            return;
@@ -252,7 +258,7 @@
     * @param orderNo
     * @param bossId
     */
    @Transactional(rollbackFor=Exception.class)
    @Transactional(rollbackFor = Exception.class)
    private void twoStageRewardToBoss(Long bossId, Long teamUid, Date oneStageTime, Integer source, String orderNo)
            throws Exception {
        // 第一阶段完成之后的90天内 ; 队友产生的订单中(自购+分享),邀请人累计产生≥1 元奖金
@@ -305,7 +311,7 @@
     * @param orderNo
     * @param bossId
     */
    @Transactional(rollbackFor=Exception.class)
    @Transactional(rollbackFor = Exception.class)
    private void threeStageRewardToBoss(Long bossId, Long teamUid, Date twoStageTime, Integer source, String orderNo)
            throws Exception {
        // 二、三阶段不可同月
@@ -366,25 +372,24 @@
                money, "粉丝(好友)完成第三阶段连续[第" + monthSpace + "个月]", new Gson().toJson(dto));
    }
    @Override
    public List<RedPackWinProgressVO> getInviteProgressByWorkerId(Long uid, Long tid) {
        List<RedPackWinProgressVO> listVO = new ArrayList<RedPackWinProgressVO>();
        ThreeSale threeSale = threeSaleSerivce.getNearRelationByBossIdAndWorkerId(uid, tid);
        if (threeSale == null || threeSale.getSucceedTime() == null)
            return listVO;
        UserInfo userInfo = userInfoService.selectByPKey(tid);
        if (userInfo == null)
        if (userInfo == null)
            return listVO;
        // 奖励记录
        List<RedPackWinInvite> listWin = redPackWinInviteMapper.getWinListByBossIdAndTeamUid(uid, tid);
        if (listWin == null || listWin.size() == 0)
        if (listWin == null || listWin.size() == 0)
            return listVO;
        int month = 1;
        for (RedPackWinInvite win: listWin) {
        for (RedPackWinInvite win : listWin) {
            if (win.getType() == RedPackWinInviteTypeEnum.zeroStageReward) {
                listVO.add(new RedPackWinProgressVO("成功注册", TimeUtil.formatDate(userInfo.getCreatetime())));
                listVO.add(new RedPackWinProgressVO("确立邀请", TimeUtil.formatDate(threeSale.getSucceedTime())));
@@ -394,37 +399,35 @@
            if (win.getType() == RedPackWinInviteTypeEnum.oneStageReward) {
                listVO.add(new RedPackWinProgressVO("第一阶段", time, money.toString()));
                continue;
            }
            }
            if (win.getType() == RedPackWinInviteTypeEnum.twoStageReward) {
                listVO.add(new RedPackWinProgressVO("第二阶段", time, money.toString()));
                continue;
            }
            }
            if (win.getType() == RedPackWinInviteTypeEnum.threeStageReward) {
                listVO.add(new RedPackWinProgressVO("第三阶段第" + month + "个月", time, money.toString()));
                month ++;
                month++;
                continue;
            }
        }
        return listVO;
    }
    @Override
    public List<RedPackWinInvite> getWinTopListByBossId(int page, int count, Long uid) {
        return redPackWinInviteMapper.getWinTopListByBossId(count * (page-1), count, uid);
        return redPackWinInviteMapper.getWinTopListByBossId(count * (page - 1), count, uid);
    }
    @Override
    public long countWinTopListByBossId(Long uid) {
        return redPackWinInviteMapper.countWinTopListByBossId(uid);
    }
    @Override
    public long countTeamNumByTid(Long uid, Long teamUid) {
        return redPackWinInviteMapper.countTeamNumByTid(uid, teamUid);
    }
}
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -162,7 +162,7 @@
            doTaoBaoOrders();// 处理淘宝订单
            doTaoBaoNewOrders();// 处理淘宝订单(刚刚产生的)
            doOrderFanLiNew();// 新版返利
            doOrderTiChengFanLi();// 处理订单提成返利
//            doOrderTiChengFanLi();// 处理订单提成返利
            doWeiQuanOrder();// 处理维权订单
            doPushIOS();// 处理发送IOS消息
            doUserMoneyDebtJob();// 债务偿还