Parcourir la source

月统计导出调整

lzm il y a 3 ans
Parent
commit
ed1c69a41f

+ 20 - 11
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java

@@ -311,24 +311,33 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             String day = statistics.getDay();
             String key = StrUtil.sub(day, 8, 10);
             ExportMonthDataDTO data = dataMap.get(key);
-            List<TbBusinessCar> inCarList = tbBusinessCarService.findInCarByDay(day);
-            List<TbBusinessCar> outCarList = tbBusinessCarService.findOutCarByDay(day);
-            Integer inNum = inCarList != null ? inCarList.size() : 0;
-            Integer outNum = outCarList != null ? outCarList.size() : 0;
-            Integer addNum = inNum - outNum;
-            data.setDay(day).setInNum(inNum).setOutNum(outNum).setAddNum(addNum);
             if(data.getDayMoney() == null){
                 data.setDayMoney(BigDecimal.valueOf(0));
             }
             data.setDayMoney(data.getDayMoney().add(statistics.getTaxMoney()));
-            //dataMap.put(key, data);
-            totalIn += inNum;
-            totalOut += outNum;
-            totalAdd += addNum;
             totalMoney = totalMoney.add(statistics.getTaxMoney());
         }
         List<ExportMonthDataDTO> exportList = new ArrayList<>(dataMap.values()) ;
-
+        for (ExportMonthDataDTO dto : exportList) {
+            String day = dto.getDay();
+            List<TbBusinessCar> inCarList = tbBusinessCarService.findInCarByDay(day);
+            List<TbBusinessCar> outCarList = tbBusinessCarService.findOutCarByDay(day);
+            Integer inNum = inCarList != null ? inCarList.size() : 0;
+            Integer outNum = outCarList != null ? outCarList.size() : 0;
+            Integer addNum = inNum - outNum;
+            if(inNum != 0){
+                dto.setInNum(inNum);
+                totalIn += inNum;
+            }
+            if(outNum != 0){
+                dto.setOutNum(outNum);
+                totalOut += outNum;
+            }
+            if(addNum != 0){
+                dto.setAddNum(addNum);
+                totalAdd += addNum;
+            }
+        }
         Map<String, String> head = new HashMap<>();
         Integer exportMonth = Integer.valueOf(StrUtil.sub(monthStr, 5,7));
         String today = DateUtil.today();