From 109d785b5b30dc28fd9a106f0dcbb7fd45526810 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 19 五月 2025 16:25:43 +0800
Subject: [PATCH] 代码初始化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java |   63 +++++++++++++++++++++++++------
 1 files changed, 51 insertions(+), 12 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 c8a1819..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<>();
@@ -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)
                         );

--
Gitblit v1.9.3