admin
2020-02-18 ddf5db7d31af51fcf697eac0cee7dd46ff73bcc1
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -45,6 +45,8 @@
import com.yeshi.fanli.exception.order.CommonOrderException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.log.LogManager;
import com.yeshi.fanli.log.LogType;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemCouponService;
@@ -169,26 +171,30 @@
   public List<CommonOrderVO> listGroupOrderNoByUid(long start, int count, Long uid, Integer state, Integer type,
         Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, Integer source)
         throws CommonOrderException {
      List<Integer> listSource = new ArrayList<>();
      if (source != null) {
         listSource.add(source);
      }
      return commonOrderMapper.listUserOrder(start, count, uid, state, type, orderState, orderNo, startTime, endTime,
            dateType, source);
            dateType, listSource);
   }
   @Override
   public long countGroupOrderNoByUid(Long uid, Integer state, Integer type, Integer orderState, String orderNo,
         String startTime, String endTime, Integer dateType, Integer source) throws CommonOrderException {
         String startTime, String endTime, Integer dateType, List<Integer> listSource) throws CommonOrderException {
      return commonOrderMapper.countUserOrder(uid, state, type, orderState, orderNo, startTime, endTime, dateType,
            source);
            listSource);
   }
   @Override
   public List<CommonOrderVO> getOrderByUid(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type,
         Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, Integer source)
         throws CommonOrderException, Exception {
         Integer orderState, String orderNo, String startTime, String endTime, Integer dateType,
         List<Integer> listSource) throws CommonOrderException, Exception {
      int pageSize = Constant.PAGE_SIZE;
      List<CommonOrderVO> listOrder = listGroupOrderNoByUid((page - 1) * pageSize, pageSize, uid, state, type,
            orderState, orderNo, startTime, endTime, dateType, source);
      List<CommonOrderVO> listOrder = commonOrderMapper.listUserOrder((page - 1) * pageSize, pageSize, uid, state,
            type, orderState, orderNo, startTime, endTime, dateType, listSource);
      // 订单信息为空
      if (listOrder == null || listOrder.size() == 0) {
@@ -470,7 +476,7 @@
            signList.add(CommonOrder.TYPE_INVITE);
            // 版本区分:2-0-2
            if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
            if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
               InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid,
                     order.getOrderNo(), sourceType);
               if (orderSubsidy != null) {
@@ -596,7 +602,7 @@
      boolean freeOrder = false;
      // 是否奖励成功
      boolean rewardSuccess = false;
      boolean version2_1 = VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion());
      boolean version2_1 = VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion());
      if (list != null && list.size() > 0) {
         for (UserSystemCouponRecord couponRecord : list) {
@@ -699,9 +705,9 @@
            return;
         // 下单日期是否是符合上线日期
         long downOrderTime = thirdCreateTime.getTime();
         long downOrderTime = thirdCreateTime.getTime();
         long limitDate = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
         if (downOrderTime > limitDate)  {
         if (downOrderTime > limitDate) {
            // 2.1 开始新版
            rewardCounponLimitTime(order, accountTime);
         } else if (hasRewardCoupon) {
@@ -814,8 +820,8 @@
   }
   @Override
   public OrderCountVO getOrderCount(Long uid, Integer day, Integer source) {
      return commonOrderMapper.getOrderCount(uid, day, source);
   public OrderCountVO getOrderCount(Long uid, Integer day, List<Integer> listSource) {
      return commonOrderMapper.getOrderCount(uid, day, listSource);
   }
   @Override
@@ -873,7 +879,7 @@
      return commonOrderMapper.listBySourceTypeAndOrderNo(sourceType, orderId);
   }
   @Transactional(rollbackFor=Exception.class)
   @Transactional(rollbackFor = Exception.class)
   @Override
   public List<CommonOrderAddResultDTO> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrders, Long uid)
         throws CommonOrderException {
@@ -910,11 +916,15 @@
            TaoBaoGoodsBrief taoBaoGoods = null;
            try {
               taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
               LogManager.getLogger(LogType.taobaoGoods).info(String.format("订单商品分类:%s#%s#%s",
                     taoBaoGoods.getAuctionId(), taoBaoGoods.getRootCategoryName(), taoBaoGoods.getLeafName()));
            } catch (TaobaoGoodsDownException e) {
               e.printStackTrace();
               LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), "");
               try {
                  taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
                  // 记录商品分类
               } catch (Exception e1) {
                  CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(
                        taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO);
@@ -935,7 +945,7 @@
      return commonOrderList;
   }
   @Transactional(rollbackFor=Exception.class)
   @Transactional(rollbackFor = Exception.class)
   @Override
   public List<CommonOrderAddResultDTO> addPDDOrder(List<PDDOrder> pddOrderList, Long uid)
         throws CommonOrderException {
@@ -985,7 +995,7 @@
      return commonOrderList;
   }
   @Transactional(rollbackFor=Exception.class)
   @Transactional(rollbackFor = Exception.class)
   @Override
   public List<CommonOrderAddResultDTO> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException {
      List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>();
@@ -1055,7 +1065,7 @@
    * 
    * @param commonOrder
    */
   @Transactional(rollbackFor=Exception.class)
   @Transactional(rollbackFor = Exception.class)
   private CommonOrderAddResultDTO addCommonOrder(CommonOrder commonOrder) throws CommonOrderException {
      // 判断商品是否存在
      if (commonOrder == null)
@@ -1656,16 +1666,15 @@
   public long count24HValidOrderByUid(Long uid, Date minTime) {
      return commonOrderMapper.count24HValidOrderByUid(uid, minTime);
   }
   @Override
   public long countSearchOrderByUid(Long uid, List<ESOrder> list) {
      return commonOrderMapper.countSearchOrderByUid(uid, list);
   }
   @Override
   public List<CommonOrderVO> searchOrderByUid (int page, int size, Long uid, List<ESOrder> list) throws Exception {
      List<CommonOrderVO> listVO = commonOrderMapper.searchOrderByUid((page-1) * size, size, uid, list);
   public List<CommonOrderVO> searchOrderByUid(int page, int size, Long uid, List<ESOrder> list) throws Exception {
      List<CommonOrderVO> listVO = commonOrderMapper.searchOrderByUid((page - 1) * size, size, uid, list);
      // 订单信息为空
      if (listVO == null || listVO.size() == 0) {
@@ -1682,11 +1691,10 @@
      // 数据加工重新组织
      orderVOFactoryNew(listVO, listGoods, uid);
      return listVO;
   }
   /**
    * 订单信息加工
    * 
@@ -1695,7 +1703,8 @@
    * @param listGoods
    * @param uid
    */
   private void orderVOFactoryNew(List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) throws Exception {
   private void orderVOFactoryNew(List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid)
         throws Exception {
      List<String> listTB = new ArrayList<String>();
      List<String> listJD = new ArrayList<String>();
      List<String> listPDD = new ArrayList<String>();
@@ -1892,8 +1901,7 @@
                  orderStateContent = "售后成功";
                  WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
                  weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
                  weiQuanInfo
                        .setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
                  weiQuanInfo.setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
                  hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
                  order.setWeiQuanInfo(weiQuanInfo);
               }
@@ -1937,8 +1945,8 @@
            signList.add(CommonOrder.TYPE_INVITE);
            // 超级会员补贴信息
            InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid,
                  order.getOrderNo(), sourceType);
            InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, order.getOrderNo(),
                  sourceType);
            if (orderSubsidy != null) {
               ClientTextStyleVO subsidyInfo = new ClientTextStyleVO();
               subsidyInfo.setContent("(补贴¥" + orderSubsidy.getMoney() + ")");
@@ -2051,8 +2059,8 @@
    * @param list
    * @param signList
    */
   private void couponFactoryNew(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType,
         List<UserSystemCouponRecord> list, Long uid, boolean vip) throws Exception {
   private void couponFactoryNew(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState,
         Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip) throws Exception {
      // 是否免单商品
      boolean freeOrder = false;
      // 是否奖励成功
@@ -2149,7 +2157,7 @@
         // 下单日期是否是符合上线日期
         long downOrderTime = thirdCreateTime.getTime();
         long limitDate = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
         if (downOrderTime > limitDate)  {
         if (downOrderTime > limitDate) {
            // 2.1 开始新版
            rewardCounponLimitTime(order, accountTime);
         } else if (hasRewardCoupon) {
@@ -2175,6 +2183,5 @@
         }
      }
   }
}