yujian
2020-03-28 63bf3eac0b63606348e40d994a54de1cd4b6d3b9
fanli/src/main/java/com/yeshi/fanli/service/impl/count/DailyCountOrderServiceImpl.java
@@ -61,10 +61,9 @@
   @Resource
   private LostOrderService lostOrderService;
   
   @Override
   public List<DailyCountOrder> getDailyCountList(String type, Date startTime, Date endTime, String channel) throws Exception {
   public List<DailyCountOrder> getDailyCountList(String type, Date startTime, Date endTime, String channel)
         throws Exception {
      // 查询类型
      DailyCountOrderEnum typeEnum = getTypeEnum(type);
      if (typeEnum == null) {
@@ -79,6 +78,7 @@
   /**
    * 获取枚举类型
    *
    * @param type
    * @return
    */
@@ -96,9 +96,9 @@
      return null;
   }
   /**
    * 获取枚举类型
    *
    * @param type
    * @return
    */
@@ -118,10 +118,9 @@
      return "";
   }
   /**
    * 初始数据
    *
    * @param typeEnum
    * @throws Exception
    */
@@ -131,7 +130,12 @@
      if (lastRecord != null) {
         lastDate = lastRecord.getUpdateDate();
      } else {
         lastDate = TimeUtil.parse("2017-05-06");
         lastDate = TimeUtil.parse("2018-01-20");
      }
      long min = DateUtil.dateDiffMin(lastDate, new Date());
      if (min <= 10) { // 10分钟以内不统计
         return;
      }
      Date today = new Date();
@@ -176,6 +180,7 @@
   /**
    * 统计订单数量
    *
    * @param preDay
    * @param typeEnum
    * @param orderType
@@ -197,6 +202,7 @@
   
   /**
    * 统计各个渠道订单数据
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -228,7 +234,7 @@
               
               for (UserInfoRegister register: listRegister) {
                  Long uid = register.getId();
                  String vlaue =register.getChannel().getVlaue();
                  String vlaue = register.getChannel();
                  // 渠道 、用户id匹配
                  if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == orderUid.longValue()) {
                     count ++;
@@ -237,7 +243,6 @@
               }
            }
         }
         
         DailyCountOrder obj = new DailyCountOrder();
         obj.setTotal(BigDecimal.valueOf(count));
@@ -252,6 +257,7 @@
   
   /**
    * 统计新人24H内下单数量
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -284,6 +290,7 @@
   
   /**
    * 统计渠道金额
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -301,7 +308,6 @@
         listRegister = userInfoRegisterService.listByMultipleUids(listUid);
      }
      
      ChannelEnum[] channels = ChannelEnum.values();
      for (int i = 0; i < channels.length; i++) {
         BigDecimal money = new BigDecimal(0);
@@ -311,13 +317,13 @@
            for (CountOrderDTO dto: listOrder) {
               Long orderUid = dto.getUid();
               BigDecimal commission = dto.getCommission();
               if (commission != null || orderUid == null) {
               if (commission == null || orderUid == null) {
                  continue;
               }
               
               for (UserInfoRegister register: listRegister) {
                  Long uid = register.getId();
                  String vlaue =register.getChannel().getVlaue();
                  String vlaue = register.getChannel();
                  // 渠道 、用户id匹配
                  if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == orderUid.longValue()) {
                     money = MoneyBigDecimalUtil.add(money, commission);
@@ -325,7 +331,6 @@
               }
            }
         }
         
         DailyCountOrder obj = new DailyCountOrder();
         obj.setTotal(money);
@@ -340,6 +345,7 @@
   
   /**
    * 统计维权订单数量
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -358,9 +364,9 @@
      dailyCountOrderDao.save(obj);
   }
   
   /**
    * 查询维权金额
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -379,9 +385,9 @@
      dailyCountOrderDao.save(obj);
   }
   
   /**
    * 淘宝订单跟踪率
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -400,6 +406,9 @@
      }   
      DailyCountOrder obj = new DailyCountOrder();
      obj.setRate(true);
      obj.setTotalDay(BigDecimal.valueOf(total));
      obj.setTotalValid(BigDecimal.valueOf(count));
      obj.setTotal(rate);
      obj.setType(typeEnum);
      obj.setUpdateDate(new Date());
@@ -410,6 +419,7 @@
   
   /**
    * 京东订单跟踪率
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -428,6 +438,9 @@
      }   
      DailyCountOrder obj = new DailyCountOrder();
      obj.setRate(true);
      obj.setTotalDay(BigDecimal.valueOf(total));
      obj.setTotalValid(BigDecimal.valueOf(count));
      obj.setTotal(rate);
      obj.setType(typeEnum);
      obj.setUpdateDate(new Date());
@@ -436,10 +449,9 @@
      dailyCountOrderDao.save(obj);
   }
   
   /**
    * 拼多多订单跟踪率
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -457,6 +469,9 @@
      }   
      DailyCountOrder obj = new DailyCountOrder();
      obj.setRate(true);
      obj.setTotalDay(BigDecimal.valueOf(total));
      obj.setTotalValid(BigDecimal.valueOf(count));
      obj.setTotal(rate);
      obj.setType(typeEnum);
      obj.setUpdateDate(new Date());
@@ -467,6 +482,7 @@
   /**
    * 统计申诉订单未处理数量
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -485,9 +501,9 @@
      dailyCountOrderDao.save(obj);
   }
   
   /**
    * 统计申诉订单 处理失败
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -506,10 +522,9 @@
      dailyCountOrderDao.save(obj);
   }
   
   /**
    * 统计申诉订单 处理成功
    *
    * @param preDay
    * @param typeEnum
    * @throws Exception
@@ -530,6 +545,7 @@
   
   /**
    * 订单找回成功统计金额
    *
    * @param preDay
    * @throws Exception
    */