yujian
2020-04-01 27c1fd58461e2fd15be392b3c308b4343af8d973
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -63,6 +63,7 @@
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@@ -135,6 +136,9 @@
   @Resource
   private UserInfoService userInfoService;
   @Resource
   private UserInviteService userInviteService;
   @Resource(name = "producer")
   private Producer orderProducer;
@@ -1730,6 +1734,14 @@
      return commonOrderMapper.countSearchOrderByUid(uid, list);
   }
   @Override
   public List<CommonOrder> getMinSettleTimeAndUid() {
      return commonOrderMapper.getMinSettleTimeAndUid();
   }
   @Override
   public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list)
         throws Exception {
@@ -1824,8 +1836,8 @@
      // 2019.8.1开始返回维权信息
      Date august = TimeUtil.parse("2019-08-01");
      // 当前用户是否VIP
      boolean vip = userVIPInfoService.isVIP(uid);
      // 当前用户是否可以使用奖励券
      boolean isvip = userInviteService.verifyVIP(uid);
      // 是否存在奖励券
      boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
@@ -1844,7 +1856,9 @@
            if (sourceType.equals(commonOrder.getSourceType()) && orderNo.equals(commonOrder.getOrderNo())) {
               CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO();
               PropertyUtils.copyProperties(commonGoodsVO, goods);
               commonGoodsVO.setGoodsType(sourceType);
               if (commonGoodsVO.getGoodsType() == null) {
                  commonGoodsVO.setGoodsType(sourceType);
               }
               // 淘宝商品图片处理
               String picture = commonGoodsVO.getPicture();
@@ -1876,24 +1890,35 @@
               }
               // 订单类型为空时 已商品类为准
               Integer orderType = order.getOrderType();
               if (orderType == null) {
                  String shopType = commonGoodsVO.getShopType();
                  if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
                     order.setOrderType(1);
                  } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
                     order.setOrderType(2);
                  }
               String shopType = commonGoodsVO.getShopType();
               if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
                  order.setOrderType(1);
               } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
                  order.setOrderType(2);
               }
               
               Integer goodsType = commonGoodsVO.getGoodsType();
               if (goodsType != null & goodsType == 6) {
                  order.setOrderType(5); // 饿了么订单
               if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) {
                  order.setOrderType(Constant.SOURCE_TYPE_ELME); // 饿了么订单
               }
               order.getListOrderGoods().add(commonGoodsVO);
            }
         }
         // 订单类型
         if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
            Integer orderType = order.getOrderType();
            if (orderType == null) {
               order.setOrderType(1);
            }
         } else if (sourceType == Constant.SOURCE_TYPE_JD) {
            order.setOrderType(3);
         } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
            order.setOrderType(4);
         }
         Date thirdCreateTime = order.getThirdCreateTime();
         if (thirdCreateTime != null) {
@@ -1906,16 +1931,6 @@
            order.setReceiveTime("收货时间:" + format.format(settleTime));
         }
         // 订单类型
         if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
            Integer orderType = order.getOrderType();
            if (orderType == null)
               order.setOrderType(1);
         } else if (sourceType == Constant.SOURCE_TYPE_JD) {
            order.setOrderType(3);
         } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
            order.setOrderType(4);
         }
         /* 订单状态 转换处理 */
         String orderStateContent = "";
@@ -1966,7 +1981,6 @@
               List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper
                     .selectListByOrderIdAndState(order.getOrderNo(), "维权成功");
               boolean isPart = false;// 默认失效
               BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid);
               if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) {
                  orderStateContent = "售后成功";
@@ -2101,13 +2115,13 @@
         if (HongBaoV2.TYPE_ZIGOU == hongBaoType) {
            // 奖励订单、免单 使用记录
            if (sourceType == null) {
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip);
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, isvip);
            } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip);
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, isvip);
            } else if (sourceType == Constant.SOURCE_TYPE_JD) {
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip);
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, isvip);
            } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip);
               couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, isvip);
            }
         }