From a97edfd66bec89867e47730b8e9ef7b378dbc953 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 07 五月 2025 10:33:57 +0800
Subject: [PATCH] 代码初始化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java |   48 +++++++++++++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 19 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..9791dcb 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,7 +346,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());
                 generalDataVO.setRata(new BigDecimal(generalDataVO.getTotal().toString()).divide(new BigDecimal(yearList.size()+""),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
                 rataList.add(generalDataVO);
             }
@@ -377,6 +381,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 +402,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());
@@ -468,32 +473,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;

--
Gitblit v1.9.3