From 0c29b75ff7831413718aa0d91e8489b35137f99d Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 07 五月 2025 14:13:21 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java |   63 ++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java
index d173f98..9a268c9 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java
@@ -226,9 +226,12 @@
         List<InoutRecord> yearList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
                 .selectAll(InoutRecord.class)
                 .eq(InoutRecord::getIsdeleted,Constants.ZERO)
+                .eq(InoutRecord::getInOrOut,Constants.ZERO)
                 .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarCode)
                 .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberPhone)
                 .apply(" ( DATE_FORMAT(CREATE_DATE, '%Y') = DATE_FORMAT(now(), '%Y') ) ")
+                .orderByAsc(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarBizType)
+                .orderByAsc(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberType)
         );
         List<InoutRecord> monthList = yearList.stream().filter(i->DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(DateUtil.formatDate(new Date(),"yyyy-MM"))).collect(Collectors.toList());
         List<InoutRecord> weekList = yearList.stream().filter(i->i.getCreateDate().getTime()>=weekStart).collect(Collectors.toList());
@@ -273,7 +276,7 @@
                 GeneralDataVO generalDataVO = new GeneralDataVO();
                 generalDataVO.setName(userTypeList[i]);
                 int index = i;
-                generalDataVO.setTotal(yearList.stream().filter(j->Constants.equalsInteger(j.getType(), index)).collect(Collectors.toList()).size());
+                generalDataVO.setTotal(yearList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), index)).collect(Collectors.toList()).size());
                 yearSortList.add(generalDataVO);
             }
         }else{
@@ -322,6 +325,7 @@
         List<InoutRecord> yearList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
                 .selectAll(InoutRecord.class)
                 .eq(InoutRecord::getIsdeleted,Constants.ZERO)
+                .eq(InoutRecord::getInOrOut,Constants.ZERO)
                 .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarCode)
                 .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberPhone)
                 .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)," ( DATE_FORMAT(CREATE_DATE, '%Y') =  '"+inParkDataDTO.getDateStr()+"' ) ")
@@ -342,12 +346,13 @@
                 GeneralDataVO generalDataVO = new GeneralDataVO();
                 generalDataVO.setName(userTypeList[i]);
                 int index = i;
-                generalDataVO.setTotal(yearList.stream().filter(j->Constants.equalsInteger(j.getType(), index)).collect(Collectors.toList()).size());
+                generalDataVO.setTotal(yearList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), index)).collect(Collectors.toList()).size());
                 generalDataVO.setRata(new BigDecimal(generalDataVO.getTotal().toString()).divide(new BigDecimal(yearList.size()+""),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
                 rataList.add(generalDataVO);
             }
         }else{
-            List<String> categoryNameList = yearList.stream().filter(i-> StringUtils.isNotBlank(i.getCategoryParentName())).map(i->i.getCategoryParentName()).collect(Collectors.toList());
+            List<String> categoryNameList = yearList.stream().filter(i-> StringUtils.isNotBlank(i.getCategoryParentName()))
+                    .map(i->i.getCategoryParentName()).collect(Collectors.toList());
             if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryNameList)){
                 Set<String> setList = new HashSet<>(categoryNameList);
                 for (String categoryName:setList) {
@@ -377,6 +382,7 @@
         List<InoutRecord> allList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
                 .selectAll(InoutRecord.class)
                 .eq(InoutRecord::getIsdeleted,Constants.ZERO)
+                .eq(InoutRecord::getInOrOut,Constants.ZERO)
                 .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),InoutRecord::getCarCode)
                 .isNotNull(Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),InoutRecord::getMemberPhone)
                 .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)," ( DATE_FORMAT(CREATE_DATE, '%Y') =  '"+inParkDataDTO.getDateStr()+"' ) ")
@@ -397,26 +403,26 @@
             if(Constants.equalsInteger(DateUtil.getNowYearNum(),Integer.valueOf(inParkDataDTO.getDateStr()))){
                 maxMonth =  DateUtil.getNowMonthNum();
             }
-            for (int i = 1; i <= maxMonth; i++) {
+            for (int i = maxMonth; i >0 ; i--) {
                 dateList.add(DateUtil.getNowYearNum()+"-"+ StringUtils.leftPad(i+"",2,"0"));
             }
         }else {
             //鏃ユ湡
             Integer year  = Integer.valueOf(inParkDataDTO.getDateStr().substring(0,4));
-            Integer month = Integer.valueOf(inParkDataDTO.getDateStr().substring(5,6));
+            Integer month = Integer.valueOf(inParkDataDTO.getDateStr().substring(5,7));
             Integer today = DateUtil.getNowDayNum();
             YearMonth yearMonth = YearMonth.of(year, month);
             // 鑾峰彇璇ユ湀鐨勬渶鍚庝竴澶�
             LocalDate lastDayDate = yearMonth.atEndOfMonth();
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd");
             Integer lastDay = Integer.valueOf(lastDayDate.format(formatter));
             if(Constants.equalsInteger(year,DateUtil.getNowYearNum()) && Constants.equalsInteger(month,DateUtil.getNowMonthNum())){
                 if(today <  lastDay){
                     lastDay = today;
                 }
             }
-            for (int i = 1; i <= lastDay; i++) {
-                dateList.add(year + "-" + StringUtils.leftPad(month.toString(),2,"0") + "-" + StringUtils.leftPad(lastDay.toString(),2,"0"));
+            for (int i = lastDay; i > 0 ; i--) {
+                dateList.add(year + "-" + StringUtils.leftPad(month.toString(),2,"0") + "-" + StringUtils.leftPad(Integer.toString(i),2,"0"));
             }
         }
         return this.dealResultData(allList,dateList,inParkDataDTO.getType(),inParkDataDTO.getDateStr());
@@ -438,11 +444,11 @@
             }
             totalString.add("鍚堣");
             resultList.add(totalString);
-            Integer total = 0;
             for (String str:dataList) {
+                Integer total = 0;
+                List<String> dataChildList = new ArrayList<>();
+                dataChildList.add(str);
                 for (String categoryName:setList) {
-                    List<String> dataChildList = new ArrayList<>();
-                    dataChildList.add(str);
                     if(Constants.equalsInteger(dateStr.length(),4)){
                         Integer childNum = allList.stream().filter(i->categoryName.equals(i.getCategoryName())
                                 && DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(str)).collect(Collectors.toList()).size();
@@ -458,9 +464,9 @@
                         );
                         total = total + childNum;
                     }
-                    dataChildList.add(Integer.toString(total));
-                    resultList.add(dataChildList);
                 }
+                dataChildList.add(Integer.toString(total));
+                resultList.add(dataChildList);
             }
         }else{
             for (int j = 0; j < userTypeList.length; j++) {
@@ -468,32 +474,37 @@
                     continue;
                 }
                 totalString.add(userTypeList[j]);
-                totalString.add("鍚堣");
-                resultList.add(totalString);
             }
-            Integer total = 0;
+            totalString.add("鍚堣");
+            resultList.add(totalString);
             for (String str:dataList) {
-                for (String typeName:userTypeList) {
-                    List<String> dataChildList = new ArrayList<>();
-                    dataChildList.add(str);
+                Integer total = 0;
+                List<String> dataChildList = new ArrayList<>();
+                dataChildList.add(str);
+                for (int i = 0; i < userTypeList.length; i++) {
+                    String typeName = userTypeList[i];
+                    if(StringUtils.isBlank(typeName)){
+                        continue;
+                    }
+                    int finalI = i;
                     if(Constants.equalsInteger(dateStr.length(),4)){
-                        Integer childNum = allList.stream().filter(i->typeName.equals(i.getCategoryName())
-                                && DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(str)).collect(Collectors.toList()).size();
+                        Integer childNum = allList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), finalI)
+                                && DateUtil.formatDate(j.getCreateDate(),"yyyy-MM").equals(str)).collect(Collectors.toList()).size();
                         dataChildList.add(
                                 Integer.toString(childNum)
                         );
                         total = total + childNum;
                     }else if(Constants.equalsInteger(dateStr.length(),7)){
-                        Integer childNum = allList.stream().filter(i->typeName.equals(i.getCategoryName())
-                                &&DateUtil.formatDate(i.getCreateDate(),"yyyy-MM-dd").equals(str)).collect(Collectors.toList()).size();
+                        Integer childNum = allList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), finalI)
+                                &&DateUtil.formatDate(j.getCreateDate(),"yyyy-MM-dd").equals(str)).collect(Collectors.toList()).size();
                         dataChildList.add(
                                 Integer.toString(childNum)
                         );
                         total = total + childNum;
                     }
-                    dataChildList.add(Integer.toString(total));
-                    resultList.add(dataChildList);
                 }
+                dataChildList.add(Integer.toString(total));
+                resultList.add(dataChildList);
             }
         }
         return resultList;
@@ -516,7 +527,6 @@
                         person -> person,
                         (existing, replacement) -> existing
                 ));
-
         List<InoutRecord> uniqueList = new ArrayList<>(uniqueByMemberPhone.values());
         return uniqueList;
     }
@@ -528,7 +538,6 @@
                         person -> person,
                         (existing, replacement) -> existing
                 ));
-
         List<InoutRecord> uniqueList = new ArrayList<>(uniqueByCarCode.values());
         return uniqueList;
     }

--
Gitblit v1.9.3