| | |
| | | return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime, day, source);
|
| | | }
|
| | |
|
| | | private BigDecimal getWeiQuanMoney(List<TaoBaoWeiQuanOrder> listWQ, int sourceType, Long uid) {
|
| | | BigDecimal weiQuanMoney = new BigDecimal(0);
|
| | | if (listWQ != null && listWQ.size() > 0) {
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : listWQ) {
|
| | | String tradeId = weiQuanOrder.getOrderItemId();
|
| | | // 查询红包
|
| | | List<String> tradeList = new ArrayList<>();
|
| | | tradeList.add(tradeId);
|
| | | List<HongBaoV2> hongBaoList = hongBaoV2Service.listBySourceTypeAndTradeIdListAndUid(sourceType, uid,
|
| | | tradeList);
|
| | | if (hongBaoList != null && hongBaoList.size() > 0) {
|
| | | CommonOrder commonOrder = commonOrderMapper.selectBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | if (commonOrder != null && commonOrder.getSettlement().compareTo(new BigDecimal(0)) > 0) {
|
| | | BigDecimal wqMoney = MoneyBigDecimalUtil
|
| | | .mul(hongBaoList.get(0).getMoney(), weiQuanOrder.getMoney())
|
| | | .divide(commonOrder.getSettlement(), 2, BigDecimal.ROUND_UP);
|
| | | if (wqMoney.compareTo(hongBaoList.get(0).getMoney()) > 0)
|
| | | wqMoney = hongBaoList.get(0).getMoney();
|
| | | weiQuanMoney = weiQuanMoney.add(wqMoney);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return weiQuanMoney;
|
| | | }
|
| | |
|
| | | public void listDataFactory(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods,
|
| | | Long uid) {
|
| | |
|
| | |
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
|
| | |
|
| | | // 是否存在奖励券
|
| | | //boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid);
|
| | | // boolean hasRewardCoupon =
|
| | | // userSystemCouponService.hasRewardCoupon(uid);
|
| | | boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid);
|
| | | boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid);
|
| | |
|
| | |
| | | .selectListByOrderIdAndState(order.getOrderNo(), "维权成功");
|
| | |
|
| | | boolean isPart = false;// 默认失效
|
| | | BigDecimal weiQuanMoney = new BigDecimal(0);
|
| | | if (listWQ != null && listWQ.size() > 0) {
|
| | | BigDecimal fanTotalMoney = new BigDecimal(0);
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : listWQ) {
|
| | | BigDecimal fanMoney = weiQuanOrder.getFanMoney();
|
| | | if (fanMoney != null) {
|
| | | fanTotalMoney = MoneyBigDecimalUtil.add(fanTotalMoney, fanMoney);
|
| | | }
|
| | | weiQuanMoney = MoneyBigDecimalUtil.add(weiQuanOrder.getMoney(), weiQuanMoney);
|
| | | }
|
| | |
|
| | | if (fanTotalMoney.compareTo(hongBao) < 0) {
|
| | | isPart = true;
|
| | | }
|
| | | }
|
| | | BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid);
|
| | |
|
| | | if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (isPart) {
|
| | |
| | | orderStateContent = "维权成功";
|
| | | WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
|
| | | weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | if (isPart) {
|
| | | // 维权失效金额=维权的金额*获得的红包/结算金额
|
| | | BigDecimal settlement = order.getSettlement();
|
| | | BigDecimal wqHongbao = MoneyBigDecimalUtil
|
| | | .div(MoneyBigDecimalUtil.mul(hongBao, settlement), settlement);
|
| | | weiQuanInfo.setWqHongBao(
|
| | | "维权:-¥" + wqHongbao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBao = MoneyBigDecimalUtil.sub(hongBao, wqHongbao);
|
| | | } else {
|
| | | weiQuanInfo
|
| | | .setWqHongBao("维权:-¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBao = new BigDecimal(0);
|
| | | }
|
| | | // if (isPart) {
|
| | | weiQuanInfo
|
| | | .setWqHongBao("维权:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
|
| | | // } else {
|
| | | // weiQuanInfo
|
| | | // .setWqHongBao("维权:-¥" + weiQuanMoney.setScale(2,
|
| | | // BigDecimal.ROUND_DOWN).toString());
|
| | | // hongBao = MoneyBigDecimalUtil.sub(hongBao,
|
| | | // weiQuanMoney);
|
| | | // }
|
| | | order.setWeiQuanInfo(weiQuanInfo);
|
| | | }
|
| | | }
|
| | |
| | | } else {
|
| | | // 奖励订单、免单 使用记录
|
| | | if (sourceType == null) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null, signList, acceptData);
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null,
|
| | | signList, acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordTB, signList, acceptData);
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
|
| | | listRecordTB, signList, acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordJD, signList, acceptData);
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
|
| | | listRecordJD, signList, acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordPDD, signList, acceptData);
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
|
| | | listRecordPDD, signList, acceptData);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @param list
|
| | | * @param signList
|
| | | */
|
| | | public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon, Integer hongBaoState,
|
| | | Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList, AcceptData acceptData) {
|
| | | public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon,
|
| | | Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList,
|
| | | AcceptData acceptData) {
|
| | |
|
| | | // 是否免单商品
|
| | | boolean freeOrder = false;
|
| | |
| | | // 1.6.5 是否存在新兑换的券
|
| | | if (!hasRewardCoupon && exchangeCoupon) {
|
| | | try {
|
| | | String downTime = order.getDownTime();
|
| | | if (!StringUtil.isNullOrEmpty(downTime)) {
|
| | | long downOrderTime = TimeUtil.convertDateToTemp2(downTime);
|
| | | long limitDate = TimeUtil.convertDateToTemp("2019-09-01");
|
| | | if (downOrderTime > limitDate )
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | long downOrderTime = thirdCreateTime.getTime();
|
| | | long limitDate = TimeUtil.convertDateToTemp("2019-09-05");
|
| | | if (downOrderTime > limitDate)
|
| | | hasRewardCoupon = true;
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | boolean rewardOrder = false;
|
| | |
|
| | | int type = 1; // 1 常规跳转页面 2弹出选项(奖励券)
|
| | |
| | | // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单
|
| | | type = 2;
|
| | | rewardOrder = true;
|
| | | } |
| | | }
|
| | |
|
| | | if (rewardOrder) {
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | |
| | | return commonOrderMapper.listBySourceTypeAndStateAndThirdCrateTime(sourceType, state, minTime, maxTime,
|
| | | (page - 1) * pageSize, pageSize);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<CommonOrder> getByOrderNo(Long uid, String orderNO) {
|
| | | return commonOrderMapper.getByOrderNo(uid, orderNO);
|