From f5ab83dfad01c87828232af8cd18c676e69fd917 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 21 五月 2025 09:14:11 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java |   69 ++++++++++++++++++++++++++--------
 1 files changed, 52 insertions(+), 17 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 bd7d8a3..7426367 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
@@ -331,21 +331,60 @@
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
-        List<InoutRecord> allList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
-                .selectAll(InoutRecord.class)
-                .eq(InoutRecord::getIsdeleted,Constants.ZERO)
+        List<InoutRecord> allList = new ArrayList<>();
+        MPJLambdaWrapper mpjLambdaWrapper = new MPJLambdaWrapper<InoutRecord>().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()+"' ) ")
-                .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)," ( DATE_FORMAT(CREATE_DATE, '%Y-%m') =  '"+inParkDataDTO.getDateStr()+"' ) ")
-        );
+                .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)," ( DATE_FORMAT(CREATE_DATE, '%Y-%m') =  '"+inParkDataDTO.getDateStr()+"' ) ");
+        if(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ONE)){
+             mpjLambdaWrapper.groupBy(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),
+                            "car_code,category_name,DATE_FORMAT(CREATE_DATE, '%Y-%m')")
+                    .groupBy(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO),
+                            "car_code,category_name,DATE_FORMAT(CREATE_DATE, '%Y-%m-%d')")
+                    .groupBy(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),
+                            "member_phone,MEMBER_TYPE,DATE_FORMAT(CREATE_DATE, '%Y-%m')")
+                    .groupBy(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE),
+                            "member_phone,MEMBER_TYPE,DATE_FORMAT(CREATE_DATE, '%Y-%m-%d')");
+            if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO)){
+                mpjLambdaWrapper.select("car_code,category_name,DATE_FORMAT(CREATE_DATE, '%Y-%m') as createDateStr ");
+            }else if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO)){
+                mpjLambdaWrapper.select("car_code,category_name,DATE_FORMAT(CREATE_DATE, '%Y-%m-%d') as createDateStr ");
+            }else if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE)){
+
+                mpjLambdaWrapper.select("member_phone,MEMBER_TYPE,DATE_FORMAT(CREATE_DATE, '%Y-%m') as createDateStr");
+            }else{
+                mpjLambdaWrapper.select("member_phone,MEMBER_TYPE,DATE_FORMAT(CREATE_DATE, '%Y-%m-%d') as createDateStr ");
+            }
+
+        }else{
+            mpjLambdaWrapper.selectAll(InoutRecord.class);
+            if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO)){
+                mpjLambdaWrapper.select("DATE_FORMAT(CREATE_DATE, '%Y-%m') as createDateStr ");
+            }else if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO)){
+                mpjLambdaWrapper.select("DATE_FORMAT(CREATE_DATE, '%Y-%m-%d') as createDateStr ");
+            }else if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE)){
+
+                mpjLambdaWrapper.select("DATE_FORMAT(CREATE_DATE, '%Y-%m') as createDateStr");
+            }else{
+                mpjLambdaWrapper.select("DATE_FORMAT(CREATE_DATE, '%Y-%m-%d') as createDateStr ");
+            }
+//           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()+"' ) ")
+//                    .apply(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)," ( DATE_FORMAT(CREATE_DATE, '%Y-%m') =  '"+inParkDataDTO.getDateStr()+"' ) ")
+//            );
+        }
+        allList = inoutRecordMapper.selectJoinList(InoutRecord.class,mpjLambdaWrapper);
+
         List<List<String>>  resultList = new ArrayList<>();
         if(CollectionUtils.isEmpty(allList)){
             return resultList;
-        }
-        if(Constants.equalsInteger(inParkDataDTO.getIsGroupBy(),Constants.ONE)){
-            allList = this.getListByType(allList,inParkDataDTO.getType());
         }
 
         List<String> dateList = new ArrayList<>();
@@ -384,7 +423,7 @@
     public List<List<String>> dealResultData(List<InoutRecord> allList,List<String> dataList ,Integer type,String dateStr){
         List<List<String>>  resultList = new ArrayList<>();
         List<String> totalString = new ArrayList<>();
-        totalString.add("鏃ユ湡");
+        totalString.add("鏁版嵁鏃ユ湡");
         if(Constants.equalsInteger(type,Constants.ZERO)){
             List<String> categoryNameList = allList.stream().filter(j-> StringUtils.isNotBlank(j.getCategoryName())).map(j->j.getCategoryName()).collect(Collectors.toList());
             if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(categoryNameList)){
@@ -403,14 +442,14 @@
                 for (String categoryName:setList) {
                     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();
+                                && i.getCreateDateStr().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->categoryName.equals(i.getCategoryName())
-                                &&DateUtil.formatDate(i.getCreateDate(),"yyyy-MM-dd").equals(str)).collect(Collectors.toList()).size();
+                                &&i.getCreateDateStr().equals(str)).collect(Collectors.toList()).size();
                         dataChildList.add(
                                 Integer.toString(childNum)
                         );
@@ -441,14 +480,14 @@
                     int finalI = i;
                     if(Constants.equalsInteger(dateStr.length(),4)){
                         Integer childNum = allList.stream().filter(j->Constants.equalsInteger(j.getMemberType(), finalI)
-                                && DateUtil.formatDate(j.getCreateDate(),"yyyy-MM").equals(str)).collect(Collectors.toList()).size();
+                                && j.getCreateDateStr().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(j->Constants.equalsInteger(j.getMemberType(), finalI)
-                                &&DateUtil.formatDate(j.getCreateDate(),"yyyy-MM-dd").equals(str)).collect(Collectors.toList()).size();
+                                &&j.getCreateDateStr().equals(str)).collect(Collectors.toList()).size();
                         dataChildList.add(
                                 Integer.toString(childNum)
                         );
@@ -461,10 +500,6 @@
         }
         return resultList;
     }
-
-
-
-
 
 
     public List<InoutRecord> getListByType(List<InoutRecord> list,Integer type){

--
Gitblit v1.9.3