admin
2020-06-09 98886779111650e6d475031fba1426e2a2251ffe
订单搜索修改
3个文件已修改
220 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java 216 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/vipshop/VipShopOrderServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java
@@ -340,6 +340,8 @@
                goodsEvaluateService.addGoodsEvaluate(itemId + "", imageList, user, doc, null, new Date(startTime-1000*60*20L*i));
            } catch (GoodsEvaluateException e) {
                e.printStackTrace();
            }catch(Exception e){
                e.printStackTrace();
            }
        }
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
@@ -119,7 +119,7 @@
    @Resource
    private HongBaoV2Service hongBaoV2Service;
    @Resource
    private HongBaoOrderService hongBaoOrderService;
@@ -128,42 +128,39 @@
    @Resource
    private CommonOrderGoodsService commonOrderGoodsService;
    @Resource
    private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
    @Resource
    private JumpDetailV2Service jumpDetailV2Service;
    @Resource
    private UserSystemCouponRecordService userSystemCouponRecordService;
    @Resource
    private UserInviteService userInviteService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private OrderHongBaoMapService orderHongBaoMapService;
    @Resource
    private  PreviewInfoService previewInfoService;
    private PreviewInfoService previewInfoService;
    @Resource
    private TeamDividentsSourceOrderService teamDividentsSourceOrderService;
    @Resource
    private TeamDividentsSourceOrderUserMapService teamDividentsSourceOrderUserMapService;
    @Resource
    private UserOrderWeiQuanRecordService userOrderWeiQuanRecordService;
    @Resource
    private ThreeSaleDetailService threeSaleDetailService;
    /**
     * 订单列表
@@ -282,11 +279,11 @@
        }
        try {
            boolean notBackSuVip =  false;
            boolean notBackSuVip = false;
            if (!VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
                notBackSuVip = true;
            }
            // 筛选结果顶部统计
            String validMoney = "0.00";
            String invalidMoney = "0.00";
@@ -309,21 +306,20 @@
                    }
                }
            }
            long count = 0L;
            List<CommonOrderVO> list = null;
            if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
                list = commonOrderService.getOrderList(acceptData, page, uid, state, orderType,
                        orderState, orderNo, startTime, endTime, dateType, listSource, notBackSuVip);
                count = commonOrderService.countOrderList(uid, state, orderType, orderState, orderNo,
                list = commonOrderService.getOrderList(acceptData, page, uid, state, orderType, orderState, orderNo,
                        startTime, endTime, dateType, listSource, notBackSuVip);
                count = commonOrderService.countOrderList(uid, state, orderType, orderState, orderNo, startTime,
                        endTime, dateType, listSource, notBackSuVip);
            } else {
                list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType,
                        orderState, orderNo, startTime, endTime, dateType, listSource);
                count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo,
                list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState, orderNo,
                        startTime, endTime, dateType, listSource);
                count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, startTime,
                        endTime, dateType, listSource);
            }
            // 判断是否需要显示订单找回提示 8秒内请求3次触发
@@ -360,8 +356,12 @@
            long count = 0;
            List<CommonOrderVO> list = null;
            if (NumberUtil.isNumeric(key.replace("-", ""))) {
                list = commonOrderService.getOrderByUid(acceptData, page, uid, null, null, null, key, null, null, null,
                        null);
                if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
                    commonOrderService.getOrderList(acceptData, page, uid, null, null, null, key, null, null, null,
                            null, false);
                } else
                    list = commonOrderService.getOrderByUid(acceptData, page, uid, null, null, null, key, null, null,
                            null, null);
            }
            if (list == null || list.size() == 0) {
@@ -511,14 +511,13 @@
                }
            }
        }
        if (selfMoney == null) {
            selfMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 1, null);
            shareMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 2, null);
            teamMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 3, null);
        }
        JSONObject data = new JSONObject();
        data.put("show", show);
        data.put("selfMoney", selfMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
@@ -527,7 +526,6 @@
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 返利说明
     * @param acceptData
@@ -551,9 +549,10 @@
        }
        // 红包信息
        List<HongBaoOrder> hoList = hongBaoOrderService.listDetailByOrderIdAndSourceTypeAndUid(orderNo, sourceType, uid);
        List<HongBaoOrder> hoList = hongBaoOrderService.listDetailByOrderIdAndSourceTypeAndUid(orderNo, sourceType,
                uid);
        HongBaoCountVO hongBaoCountVO = hongBaoOrderService.getHongBaoCountVO(hoList);
        Integer hongBaoState = hongBaoCountVO.getCurrentState();
        String stateDesc = "";
        String predictDesc = "";
@@ -565,7 +564,7 @@
        } else if (HongBaoV2.STATE_SHIXIAO == hongBaoState) {
            stateDesc = "已失效";
        }
        int type = 0;
        String typeName = "";
        int hongBaoType = hoList.get(0).getHongBaoV2().getType();
@@ -580,8 +579,8 @@
                || HongBaoV2.TYPE_ERJI == hongBaoType) {
            type = 3;
            typeName = "收益";
        }
        }
        List<Long> goodsIdList = new ArrayList<>();
        if (hoList != null)
            for (HongBaoOrder hongBaoOrder : hoList) {
@@ -594,8 +593,7 @@
        if (goodsList != null)
            for (CommonOrderGoods goods : goodsList)
                orderGoodsMap.put(goods.getId(), goods);
        OrderRebateVO orderRebateVO = new OrderRebateVO();
        // 红包信息
        BigDecimal hongBao = hongBaoCountVO.getValidMoney();
@@ -603,9 +601,9 @@
            List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderService.getWeiQuanSuccessOrders(orderNo);
            if (listWQ != null && listWQ.size() > 0) {
                BigDecimal weiQuanMoney = commonOrderService.getWeiQuanMoney(listWQ, sourceType, uid);
                orderRebateVO.setWq(true);
                orderRebateVO.setWqMoney("¥"+ weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN));
                orderRebateVO.setWqMoney("¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN));
                if (hongBao.compareTo(weiQuanMoney) > 0) {
                    orderRebateVO.setWqDesc("部分售后退回");
                } else {
@@ -615,14 +613,14 @@
                hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
            }
        }
        // 红包获得者
        HongBaoV2 hongBaoV2 = hoList.get(0).getHongBaoV2();
        UserLevelEnum userLevel = UserLevelUtil.getByOrderRank(hongBaoV2.getUrank());
        if (userLevel == null)
            userLevel = UserLevelEnum.daRen;
        UserLevelEnum upperLevel =  UserLevelEnum.superVIP;
        UserLevelEnum upperLevel = UserLevelEnum.superVIP;
        // 订单购买者
        CommonOrder commonOrder1 = hoList.get(0).getCommonOrder();
        Date downTime = commonOrder1.getThirdCreateTime();
@@ -630,77 +628,80 @@
        if (buyer == null) {
            buyer = UserLevelEnum.daRen;
        }
        BigDecimal upperTotalMoney = new BigDecimal(0);
        List<GoodsRebateVO> voList = new ArrayList<>();
        for (HongBaoOrder hongBaoOrder : hoList) {
            if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_SHIXIAO)
                hongBaoOrder.getHongBaoV2().setMoney(new BigDecimal(0));
            GoodsRebateVO goodsVO = new GoodsRebateVO();
            // 标题、图片
            CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
            if (orderGoodsMap.get(commonOrder.getCommonOrderGoods().getId()) != null) {
                goodsVO.setTitle(orderGoodsMap.get(commonOrder.getCommonOrderGoods().getId()).getTitle());
                goodsVO.setPicture(orderGoodsMap.get(commonOrder.getCommonOrderGoods().getId()).getPicture());
            }
            // 实付款
            BigDecimal payment = hongBaoOrder.getCommonOrder().getPayment();
            // 若已结算 -显示结算金额
            Integer orderState = hongBaoOrder.getCommonOrder().getState();
            if (hongBaoOrder.getCommonOrder().getSettlement() != null
            if (hongBaoOrder.getCommonOrder().getSettlement() != null
                    && (orderState == CommonOrder.STATE_JS || orderState == CommonOrder.STATE_WQ))
                payment = hongBaoOrder.getCommonOrder().getSettlement();
            if (payment == null)
                payment = new BigDecimal(0);
            goodsVO.setActualPay("¥" + payment.setScale(2, BigDecimal.ROUND_DOWN));
            BigDecimal fanli = hongBaoOrder.getHongBaoV2().getMoney();
            // 基础佣金
            BigDecimal commission = orderHongBaoMoneyComputeService.computeBaseFanliMoney(commonOrder);
            goodsVO.setCommision("¥" +commission.setScale(2, BigDecimal.ROUND_DOWN));
            // 平台补贴  = 返利 - 基础佣金
            goodsVO.setCommision("¥" + commission.setScale(2, BigDecimal.ROUND_DOWN));
            // 平台补贴 = 返利 - 基础佣金
            goodsVO.setSubsidy("¥" + fanli.subtract(commission).setScale(2, BigDecimal.ROUND_DOWN));
            //  达人补贴
            // 达人补贴
            if (userLevel != UserLevelEnum.daRen) {
                BigDecimal darenFanli = orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, UserLevelEnum.daRen);
                BigDecimal darenFanli = orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder,
                        UserLevelEnum.daRen);
                goodsVO.setOriginSubsidy("¥" + darenFanli.subtract(commission).setScale(2, BigDecimal.ROUND_DOWN) + "");
            }
            if (type == 3) { // 奖金
                goodsVO.setBonus("¥" + fanli.setScale(2, BigDecimal.ROUND_DOWN) +"");
                goodsVO.setBonus("¥" + fanli.setScale(2, BigDecimal.ROUND_DOWN) + "");
            }
            voList.add(goodsVO);
            if (type == 1 ) {
                upperTotalMoney = upperTotalMoney.add(orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, upperLevel));
            if (type == 1) {
                upperTotalMoney = upperTotalMoney
                        .add(orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, upperLevel));
            } else if (type == 2) {
                upperTotalMoney = upperTotalMoney.add(orderHongBaoMoneyComputeService.computeShareMoney(commonOrder, upperLevel));
                upperTotalMoney = upperTotalMoney
                        .add(orderHongBaoMoneyComputeService.computeShareMoney(commonOrder, upperLevel));
            } else if (type == 3) {
                List<UserTeamLevel> bossLevelList = new ArrayList<>();
                if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {
                    bossLevelList.add(new UserTeamLevel(null, UserLevelEnum.superVIP));
                    upperTotalMoney = upperTotalMoney.add(orderHongBaoMoneyComputeService.computeFirstInviteMoney(commonOrder,
                            buyer, bossLevelList));
                    upperTotalMoney = upperTotalMoney.add(
                            orderHongBaoMoneyComputeService.computeFirstInviteMoney(commonOrder, buyer, bossLevelList));
                } else {
                    Integer bRank = hongBaoV2Service.getDirectBossUrankByPid(hongBaoOrder.getHongBaoV2().getParent().getId());
                    Integer bRank = hongBaoV2Service
                            .getDirectBossUrankByPid(hongBaoOrder.getHongBaoV2().getParent().getId());
                    UserLevelEnum directBoss = UserLevelUtil.getByOrderRank(bRank);
                    if (directBoss == null) {
                        directBoss = UserLevelEnum.daRen;
                    }
                    bossLevelList.add(new UserTeamLevel(null, directBoss));
                    bossLevelList.add(new UserTeamLevel(null, UserLevelEnum.superVIP));
                    upperTotalMoney = upperTotalMoney.add(orderHongBaoMoneyComputeService.computeSecondInviteMoney(commonOrder,
                            buyer, bossLevelList));
                    upperTotalMoney = upperTotalMoney.add(orderHongBaoMoneyComputeService
                            .computeSecondInviteMoney(commonOrder, buyer, bossLevelList));
                }
            }
        }
        orderRebateVO.setFanLiDesc(predictDesc + typeName);
        orderRebateVO.setFanLi("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN));
        orderRebateVO.setType(type);
@@ -711,7 +712,7 @@
        } else {
            orderRebateVO.setUserLevel(userLevel.name());
        }
        // 超级会员返利
        if (upperLevel != null) {
            orderRebateVO.setUpperFanLi("¥" + upperTotalMoney);
@@ -722,23 +723,26 @@
        boolean rewardSuccess = false;
        List<String> listNo = new ArrayList<String>();
        listNo.add(orderNo);
        List<UserSystemCouponRecord> useRecord = userSystemCouponRecordService.getRecordByOrderNoList(sourceType, listNo);
        List<UserSystemCouponRecord> useRecord = userSystemCouponRecordService.getRecordByOrderNoList(sourceType,
                listNo);
        if (useRecord != null && useRecord.size() > 0) {
            for (UserSystemCouponRecord couponRecord : useRecord) {
                Integer state = couponRecord.getState();
                String cType = couponRecord.getCouponType();
                if (CouponTypeEnum.rebatePercentCoupon.name().equals(cType) && UserSystemCouponRecord.STATE_SUCCESS == state) {
                if (CouponTypeEnum.rebatePercentCoupon.name().equals(cType)
                        && UserSystemCouponRecord.STATE_SUCCESS == state) {
                    rewardSuccess = true;
                    break;
                } else if (CouponTypeEnum.freeCoupon.name().equals(cType) || CouponTypeEnum.welfareFreeCoupon.name().equals(cType)
                } else if (CouponTypeEnum.freeCoupon.name().equals(cType)
                        || CouponTypeEnum.welfareFreeCoupon.name().equals(cType)
                        || CouponTypeEnum.freeCouponBuy.name().equals(cType)) {
                    freeState = state;
                    break;
                }
            }
        }
        if (rewardSuccess) {  // 已使用奖励券
        if (rewardSuccess) { // 已使用奖励券
            JSONObject params = new JSONObject();
            params.put("orderNo", orderNo);
            params.put("goodsType", sourceType + "");
@@ -749,7 +753,7 @@
            orderRebateVO.setCouponType(1);
            orderRebateVO.setCouponUse(true);
            orderRebateVO.setCouponText("奖励成功");
            orderRebateVO.setCouponDesc("已再返¥" +couponMoney.setScale(2, BigDecimal.ROUND_DOWN));
            orderRebateVO.setCouponDesc("已再返¥" + couponMoney.setScale(2, BigDecimal.ROUND_DOWN));
            orderRebateVO.setCouponParams(params.toString());
            orderRebateVO.setCouponJumpDetail(jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
        } else if (freeState > 0) { // 已使用免单券
@@ -771,12 +775,13 @@
        } else {
            Date accountTime = hongBaoV2.getGetTime();
            // 到账时间 -红包金额限制
            if (accountTime != null && hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) <= 0) {
            if (accountTime != null && hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) <= 0) {
                boolean vip = userInviteService.verifyVIP(uid);
                Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime);
                long currentTime = java.lang.System.currentTimeMillis();
                if (endDay.getTime() > currentTime && !vip) {
                    UserSystemCouponRecord couponRecord = userSystemCouponRecordService.getRecordByOrderNo(orderNo, null);
                    UserSystemCouponRecord couponRecord = userSystemCouponRecordService.getRecordByOrderNo(orderNo,
                            null);
                    if (couponRecord == null) {
                        orderRebateVO.setCoupon(true);
                        orderRebateVO.setCouponType(1);
@@ -786,13 +791,12 @@
                }
            }
        }
        JSONObject data = new JSONObject();
        data.put("result", orderRebateVO);
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
    /**
     * 用户订单统计
     * 
@@ -803,12 +807,13 @@
     * @param out
     */
    @RequestMapping(value = "teamOrderSearch")
    public void teamOrderSearch(String callback, AcceptData acceptData, Long uid, Integer page, String key, PrintWriter out) {
    public void teamOrderSearch(String callback, AcceptData acceptData, Long uid, Integer page, String key,
            PrintWriter out) {
        if (uid == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        List<TeamOrderVO> resultList = new ArrayList<>();
        if (StringUtil.isNullOrEmpty(key)) {
            JSONObject data = new JSONObject();
@@ -821,14 +826,15 @@
        try {
            if (page == null)
                page = 1;
            List<TeamOrderVO> list = teamDividentsSourceOrderUserMapService.searchByOrderNoOrSourceUid((page-1)*20, 20, uid, key);
            List<TeamOrderVO> list = teamDividentsSourceOrderUserMapService.searchByOrderNoOrSourceUid((page - 1) * 20,
                    20, uid, key);
            if (list == null) {
                list = new ArrayList<>();
            }
            if (list.size() > 0) {
                for (int i = 0; i < list.size(); i ++) {
                for (int i = 0; i < list.size(); i++) {
                    TeamOrderVO teamVO = list.get(i);
                    // 粉丝代数
                    ThreeSaleDetail threeDetail = threeSaleDetailService.getByBossUidAndWorkerUid(uid, teamVO.getUid());
@@ -838,7 +844,7 @@
                        continue;
                    }
                    teamVO.setTeamGrade(threeDetail.getLevel());
                    // 粉丝基本信息
                    UserInfo userInfo = userInfoService.getUserByIdWithMybatis(teamVO.getUid());
                    if (userInfo == null) {
@@ -848,45 +854,46 @@
                    }
                    teamVO.setNickName(userInfo.getNickName());
                    teamVO.setPortrait(userInfo.getPortrait());
                    BigDecimal payment = BigDecimal.ZERO;
                    List<CommonOrder> listOrder = commonOrderService.listBySourceTypeAndOrderId(teamVO.getSourceType(), teamVO.getOrderNo());
                    List<CommonOrder> listOrder = commonOrderService.listBySourceTypeAndOrderId(teamVO.getSourceType(),
                            teamVO.getOrderNo());
                    if (listOrder != null && listOrder.size() > 0) {
                        for (CommonOrder order: listOrder) {
                        for (CommonOrder order : listOrder) {
                            payment = payment.add(order.getPayment());
                            teamVO.setSourceName(order.getChildSourceType());
                            teamVO.setDownTime(TimeUtil.formatDate(order.getThirdCreateTime()));
                            // 下单时等级
                            UserLevelEnum userLevel = UserLevelUtil.getByOrderRank(order.getUrank());
                            if (userLevel == null)
                                userLevel = UserLevelEnum.daRen;
                            teamVO.setUserRank(UserLevelUtil.getShowLevel(userLevel).name());
                            // 结算时间
                            Date settleTime = order.getSettleTime();
                            if (settleTime != null)
                            if (settleTime != null)
                                teamVO.setSettleTime(TimeUtil.formatDate(settleTime));
                            // 维权信息
                            Integer orderState = order.getState();
                            if (!StringUtil.isNullOrEmpty(teamVO.getServiceTime()) && CommonOrder.STATE_WQ == orderState) {
                            if (!StringUtil.isNullOrEmpty(teamVO.getServiceTime())
                                    && CommonOrder.STATE_WQ == orderState) {
                                if (order.getSourceType() == Constant.SOURCE_TYPE_TAOBAO) {
                                    UserOrderWeiQuanRecord record = userOrderWeiQuanRecordService.selectByOrderInfoAndUid(uid, order.getTradeId(), order.getSourceType());
                                    UserOrderWeiQuanRecord record = userOrderWeiQuanRecordService
                                            .selectByOrderInfoAndUid(uid, order.getTradeId(), order.getSourceType());
                                    if (record != null) {
                                        teamVO.setServiceTime(TimeUtil.formatDate(record.getCreateTime()));
                                    }
                                }
                            }
                        }
                    }
                    teamVO.setPayment(payment);
                    // 订单时间信息
                    String orderTime = "下单" + teamVO.getDownTime() ;
                    String orderTime = "下单" + teamVO.getDownTime();
                    if (!StringUtil.isNullOrEmpty(teamVO.getSettleTime())) {
                        orderTime += "\n收货" + teamVO.getSettleTime();
                    }
@@ -896,8 +903,7 @@
                    teamVO.setOrderTime(orderTime);
                }
            }
            GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
            gsonBuilder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
                @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/order/vipshop/VipShopOrderServiceImpl.java
@@ -78,7 +78,7 @@
        } else {
            detail.setId(old.getId());
            detail.setUpdateTime(new Date());
            vipShopOrderDetailMapper.insertSelective(detail);
            vipShopOrderDetailMapper.updateByPrimaryKey(detail);
            detailId = detail.getId();
        }