admin
2019-12-12 4a2d0d30b1993fa4b3fdd943c93e327124c6cff7
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -72,6 +72,7 @@
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.order.CommonOrderGoodsVO;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
import com.yeshi.fanli.vo.order.WeiQuanInfo;
import net.sf.json.JSONObject;
@@ -212,9 +213,9 @@
    * @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,   Integer hongBaoState,
         Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList,
         Long uid, AcceptData acceptData) {
      // 是否免单商品
      boolean freeOrder = false;
@@ -261,34 +262,34 @@
      // 订单标识
      order.setSignList(signList);
      // 1.6.5 是否存在新兑换的券
      if (!hasRewardCoupon && exchangeCoupon) {
         try {
            Date thirdCreateTime = order.getThirdCreateTime();
            if (thirdCreateTime != null) {
               long downOrderTime = thirdCreateTime.getTime();
               long limitDate = TimeUtil.convertDateToTemp("2019-09-10");
               if (downOrderTime > limitDate)
                  hasRewardCoupon = true;
            }
         } catch (Exception e) {
            e.printStackTrace();
         }
      }
      boolean rewardOrder = false;
      int type = 1; // 1 常规跳转页面 2弹出选项(奖励券)
      if (rewardSuccess) {
         if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
            rewardOrder = true; // 奖励成功 2.0.2 消失
      boolean rewardOrder = false;
      if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
         if (rewardSuccess) {
            rewardOrder = true; // 以前版本奖励成功 的显示入口
         }
         // 已到账的返利订单、非会员可使用奖励券
         if (!freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState
               && !userVIPInfoService.isVIP(uid)) {
            type = 2;
            rewardOrder = true;
         }
      } else if (hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType
            && HongBaoV2.STATE_YILINGQU == hongBaoState) {
         // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单
         type = 2;
         rewardOrder = true;
               && HongBaoV2.STATE_YILINGQU == hongBaoState && !userVIPInfoService.isVIP(uid)) {
          // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单、 非超级会员
         type = 2;
         rewardOrder = true;
      }
      // 维权订单 不可使用
      Integer orderState = order.getState();
      if(CommonOrder.STATE_WQ == orderState) {
         rewardOrder = false;
      }
      if (rewardOrder) {
         try {
            boolean newEdition = false;
@@ -296,13 +297,12 @@
            String unit = null;
            boolean canUse = false;
            // 版本区分:2.1
            // 版本区分:2.1  奖励券倒计时
            if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
               Date thirdCreateTime = order.getThirdCreateTime();
               if (thirdCreateTime != null) {
                  long downOrderTime = thirdCreateTime.getTime();
                  long limitDate = Long.parseLong("1571760000000"); // TODO
                                                         // 日期待确定2019-11-10
                  long limitDate = TimeUtil.parse(Constant.COUPON_REWARD_TIME).getTime();
                  if (downOrderTime > limitDate) {
                     newEdition = true;
                     Date endDay = DateUtil.plusDayDate(4, thirdCreateTime);
@@ -468,8 +468,7 @@
      Date august = TimeUtil.parse("2019-08-01");
      // 是否存在奖励券
      boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid);
      boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid);
      boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
      // 需要查询是否为VIP的用户ID,只有邀请订单才需要查询
      List<Long> needSelectVIPUidList = new ArrayList<>();
@@ -494,6 +493,9 @@
               order.setVipOrder(false);
         } else
            order.setVipOrder(false);
         if(order.isVipOrder())
            order.setVipOrderDesc("订单来源:由超级会员的粉丝产生");
      }
      for (CommonOrderVO order : listOrder) {
@@ -611,7 +613,7 @@
         } else if (CommonOrder.STATE_SX == orderState) {
            orderStateContent = "未付款/已退款";
         } else if (CommonOrder.STATE_WQ == orderState) {
            orderStateContent = "已维权";
            orderStateContent = "已售后";
            if (sourceType != null && sourceType == Constant.SOURCE_TYPE_TAOBAO) {
               /* 订单维权 判断是否全部维权 */
               List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper
@@ -629,11 +631,11 @@
               } else {
                  // 2019.8.1 返回维权信息
                  if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) {
                     orderStateContent = "维权成功";
                     orderStateContent = "售后成功";
                     WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
                     weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
                     weiQuanInfo
                           .setWqHongBao("维权:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
                           .setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
                     hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
                     order.setWeiQuanInfo(weiQuanInfo);
                  }
@@ -767,17 +769,17 @@
         } else {
            // 奖励订单、免单 使用记录
            if (sourceType == null) {
               setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null,
                     signList, acceptData);
               setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, null,
                     signList, uid, acceptData);
            } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
               setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                     listRecordTB, signList, acceptData);
               setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType,
                     listRecordTB, signList, uid, acceptData);
            } else if (sourceType == Constant.SOURCE_TYPE_JD) {
               setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                     listRecordJD, signList, acceptData);
               setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType,
                     listRecordJD, signList, uid, acceptData);
            } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
               setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                     listRecordPDD, signList, acceptData);
               setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType,
                     listRecordPDD, signList, uid, acceptData);
            }
         }
@@ -794,6 +796,11 @@
   @Override
   public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) {
      return commonOrderMapper.countHistoryOrder(uid, day, source);
   }
   @Override
   public OrderCountVO getOrderCount(Long uid, Integer day, Integer source) {
      return commonOrderMapper.getOrderCount(uid, day, source);
   }
   @Override
@@ -1621,7 +1628,7 @@
   public BigDecimal getTotalRewardMoneyByOrderNoAndSourceType(String orderNo, Integer sourceType) {
      return commonOrderMapper.getTotalRewardMoneyByOrderNoAndSourceType(orderNo, sourceType);
   }
   @Override
   public long count24HValidOrderByUid(Long uid, Date minTime) {
      return commonOrderMapper.count24HValidOrderByUid(uid, minTime);