Преглед на файлове

修改获取数据的日期

zhuoning преди 2 години
родител
ревизия
2cb3c26a3f
променени са 1 файла, в които са добавени 25 реда и са изтрити 35 реда
  1. 25 35
      huimv-farm-produce/src/main/java/com/huimv/produce/produce/service/impl/WeightImpl.java

+ 25 - 35
huimv-farm-produce/src/main/java/com/huimv/produce/produce/service/impl/WeightImpl.java

@@ -63,16 +63,14 @@ public class WeightImpl implements IWeight {
     public Result getEggWeightDetails() throws ParseException {
 //        String url = "http://39.171.45.196:9200/egg/getWeightDetails?date=2022-06-10";
 //        String url = "http://39.171.45.196:9200/egg/getWeightDetails";
-        // 获取全部数据;
-//        String url = initUrl();
+
         // 获取今天数据
-//        String todayDate = new DateUtil().getTodayDateText();
+        String todayDate = new DateUtil().getTodayDateText();
         // test
-        String todayDate = "2022-06-10";
+//        String todayDate = "2022-06-10";
         String url = weightHttp + weightPath;
         url += "?date=" + todayDate;
-//        url += "?date=2022-06-10";
-//        System.out.println("url=" + url);
+        System.out.println("url=" + url);
         String result = restTemplate.getForObject(url, String.class);
         JSONArray resultJa = JSONArray.parseArray(result);
         log.info("接口返回数量=" + resultJa.size());
@@ -135,9 +133,6 @@ public class WeightImpl implements IWeight {
             }
             netTotalPurchaseBg = netTotalPurchaseBg.add(nw);
         }
-//        System.out.println("grossTotalPurchaseBg=" + grossTotalPurchaseBg.toString());
-//        System.out.println("tareTotalPurchaseBg=" + tareTotalPurchaseBg.toString());
-//        System.out.println("netTotalPurchaseBg=" + netTotalPurchaseBg.toString());
 
         ProdWeightDayEntity purchaseWeightDayEntity = new ProdWeightDayEntity();
         purchaseWeightDayEntity.setAddDate(new java.sql.Date(dateUtil.parseDate(todayDate).getTime()));
@@ -169,9 +164,6 @@ public class WeightImpl implements IWeight {
             }
             netTotalSalesBg = netTotalSalesBg.add(nw);
         }
-//        System.out.println("grossTotalSalesBg=" + grossTotalSalesBg.toString());
-//        System.out.println("tareTotalSalesBg=" + tareTotalSalesBg.toString());
-//        System.out.println("netTotalSalesBg=" + netTotalSalesBg.toString());
 
         ProdWeightDayEntity salesWeightDayEntity = new ProdWeightDayEntity();
         salesWeightDayEntity.setAddDate(new java.sql.Date(dateUtil.parseDate(todayDate).getTime()));
@@ -240,7 +232,7 @@ public class WeightImpl implements IWeight {
         }
     }
 
-    //
+    // 读取当天
     private List<ProdWeightDetailsEntity> getTodayWeightDetails(String todayDate) {
         List<ProdWeightDetailsEntity> list = prodWeightDetailsRepo.getWeightDetails(todayDate);
         return list;
@@ -560,41 +552,39 @@ public class WeightImpl implements IWeight {
     }
 
     /**
-     * @Method      : getManyDayWeight
-     * @Description : 
-     * @Params      : [days, poundType]
-     * @Return      : com.huimv.common.utils.Result
-     * 
-     * @Author      : ZhuoNing
-     * @Date        : 2022/7/2       
-     * @Time        : 5:57
+     * @Method : getManyDayWeight
+     * @Description :
+     * @Params : [days, poundType]
+     * @Return : com.huimv.common.utils.Result
+     * @Author : ZhuoNing
+     * @Date : 2022/7/2
+     * @Time : 5:57
      */
     @Override
     public Result getManyDayWeight(Integer days, String poundType) {
-        if(StringUtils.isBlank(poundType)){
+        if (StringUtils.isBlank(poundType)) {
             poundType = "Sales";
         }
         //
-        List<ProdWeightDayEntity> dayWeightList = prodWeightDayRepo.findDayWeight(days,poundType);
+        List<ProdWeightDayEntity> dayWeightList = prodWeightDayRepo.findDayWeight(days, poundType);
         List newList = new ArrayList();
-        for(int a=dayWeightList.size()-1 ; a >= 0 ; a--){
+        for (int a = dayWeightList.size() - 1; a >= 0; a--) {
             newList.add(dayWeightList.get(a));
         }
-        return new Result(ResultCode.SUCCESS,newList);
+        return new Result(ResultCode.SUCCESS, newList);
     }
 
     /**
-     * @Method      : getWeightDetails
-     * @Description : 
-     * @Params      : [poundType, carNumber, consigner, consignee, variety, startDate, endDate, pageNo, pageSize]
-     * @Return      : com.huimv.common.utils.Result
-     * 
-     * @Author      : ZhuoNing
-     * @Date        : 2022/7/2       
-     * @Time        : 6:03
+     * @Method : getWeightDetails
+     * @Description :
+     * @Params : [poundType, carNumber, consigner, consignee, variety, startDate, endDate, pageNo, pageSize]
+     * @Return : com.huimv.common.utils.Result
+     * @Author : ZhuoNing
+     * @Date : 2022/7/2
+     * @Time : 6:03
      */
     @Override
-    public Result getWeightDetails(String poundType, String carNumber, String consigner, String consignee, String variety, Date startDate,Date endDate,Integer pageNo,Integer pageSize) {
+    public Result getWeightDetails(String poundType, String carNumber, String consigner, String consignee, String variety, Date startDate, Date endDate, Integer pageNo, Integer pageSize) {
 //        .
         Specification<ProdWeightDetailsEntity> sf = (Specification<ProdWeightDetailsEntity>) (root, criteriaQuery, criteriaBuilder) -> {
             //
@@ -635,7 +625,7 @@ public class WeightImpl implements IWeight {
             orders.add(criteriaBuilder.desc(root.get("id")));
             return criteriaQuery.orderBy(orders).getRestriction();
         };
-        Pageable pageable = PageRequest.of( pageNo - 1, pageSize);
+        Pageable pageable = PageRequest.of(pageNo - 1, pageSize);
 //        return new Result(ResultCode.SUCCESS,applyRepo.listApply(pageable,applyId));
         return new Result(ResultCode.SUCCESS, prodWeightDetailsRepo.findAll(sf, pageable));
     }