yujian
2020-04-13 e7435f02fcbe040e32dfd21c308957eb2de2837d
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
@@ -58,6 +58,7 @@
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.util.user.UserLevelUtil;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.CurrentBonusVO;
import com.yeshi.fanli.vo.order.GoodsRebateVO;
@@ -727,7 +728,7 @@
            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 {
@@ -779,7 +780,7 @@
         
         // 平台补贴
         BigDecimal vipFanli = hongBaoOrder.getHongBaoV2().getMoney();
         goodsVO.setSubsidy(vipFanli.subtract(commission).setScale(2) + "");
         goodsVO.setSubsidy("¥" + vipFanli.subtract(commission).setScale(2));
         //  达人补贴
         if (userLevel != UserLevelEnum.daRen) {
            BigDecimal darenFanli = orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, UserLevelEnum.daRen);
@@ -832,17 +833,48 @@
         orderRebateVO.setJumpLink(upperLevel.getDetailLink());
      }
      // 奖励券使用
      Date accountTime = hongBaoCountVO.getAccountTime();
      if (accountTime != null) {
         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);
            if (couponRecord == null
                  || (couponRecord.getCouponType() == CouponTypeEnum.rebatePercentCoupon.name() && couponRecord.getState() != UserSystemCouponRecord.STATE_SUCCESS)) {
               orderRebateVO.setCoupon(true);
      boolean rewardSuccess = false;
      List<String> listNo = new ArrayList<String>();
      listNo.add(orderNo);
      List<UserSystemCouponRecord> useRecord = userSystemCouponRecordService.getRecordByOrderNoList(sourceType, listNo);
      if (useRecord != null && useRecord.size() > 0) {
         for (UserSystemCouponRecord couponRecord : useRecord) {
            int goodSource = couponRecord.getGoodSource();
            if (goodSource == 0)
               goodSource = 1;
            Integer state = couponRecord.getState();
            String systemCouponType = couponRecord.getCouponType();
            if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType)
                  && UserSystemCouponRecord.STATE_SUCCESS == state) {
               rewardSuccess = true;
               break;
            }
         }
      }
      if (rewardSuccess) {  // 已使用奖励券
         Map<String, Object> jumpLink = new HashMap<String, Object>();
         jumpLink.put("orderNo", orderNo);
         jumpLink.put("goodsType", sourceType + "");
         orderRebateVO.setCouponSuccess(true);
         orderRebateVO.setCouponParams(jumpLink.toString());
         orderRebateVO.setCouponJumpDetail(jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
      } else { // 可使用奖励券
         Date accountTime = hongBaoCountVO.getAccountTime();
         if (accountTime != null) {
            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);
               if (couponRecord == null
                     || (couponRecord.getCouponType() == CouponTypeEnum.rebatePercentCoupon.name() && couponRecord.getState() != UserSystemCouponRecord.STATE_SUCCESS)) {
                  orderRebateVO.setCoupon(true);
               }
            }
         }
      }