From 8c21633f241b9a1c02cd246544928da9b6089040 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期三, 31 七月 2024 18:16:53 +0800
Subject: [PATCH] feat:考核结果明细

---
 ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java        |    3 +
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java          |   13 ++++++
 ycl-pojo/src/main/java/com/ycl/system/entity/BaseEntity.java                      |    3 -
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java             |    4 ++
 ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml                    |    8 +++
 ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java |   31 +++++++++------
 ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ScoreIndexDTO.java             |    3 +
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java        |   17 ++++++--
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java         |   17 ++++++--
 9 files changed, 75 insertions(+), 24 deletions(-)

diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java
index 38eaacf..a3b5448 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java
@@ -3,8 +3,11 @@
 import com.ycl.system.entity.BaseEntity;
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 public class CheckScoreIndexDTO extends BaseEntity {
     private Long id;
     private String date;
+    private List<String> quarter;
 }
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ScoreIndexDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ScoreIndexDTO.java
index aa15b1c..4c408c9 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ScoreIndexDTO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ScoreIndexDTO.java
@@ -4,10 +4,13 @@
 import lombok.Data;
 import lombok.experimental.Accessors;
 
+import java.util.List;
+
 @Data
 @Accessors(chain = true)
 public class ScoreIndexDTO extends BaseEntity {
     private String tableName;
     private Long deptId;
     private String date;
+    private List<String> quarter;
 }
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
index 1d85b4c..4f81312 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
@@ -1,10 +1,12 @@
 package com.ycl.platform.domain.entity;
 
 import annotation.Excel;
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.ycl.platform.base.CheckIndex;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 杞﹁締鎸囨爣姒傜巼鏁版嵁瀵硅薄 t_check_index_car
@@ -58,6 +60,17 @@
     @Excel(name = "杞﹁締鍗″彛璁惧鎶撴媿鏁版嵁澶у浘鍙敤鎬�",width = 25)
     private BigDecimal vehiclePictureAvailability;
 
+    @ExcelIgnore
+    private List<String> quarter;
+
+    public List<String> getQuarter() {
+        return quarter;
+    }
+
+    public void setQuarter(List<String> quarter) {
+        this.quarter = quarter;
+    }
+
     @Override
     public Long getId() {
         return super.getId();
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
index 46a0275..761475d 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
@@ -1,14 +1,12 @@
 package com.ycl.platform.domain.entity;
 
 import annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.ycl.platform.base.CheckIndex;
-import com.ycl.system.entity.BaseEntity;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 浜鸿劯鎸囨爣姒傜巼鏁版嵁瀵硅薄 t_check_index_face
@@ -52,6 +50,17 @@
     @Excel(name = "浜鸿劯鍗″彛璁惧鎶撴媿鏁版嵁澶у浘鍙敤鎬�",width = 25)
     private BigDecimal facePictureAvailability;
 
+    @ExcelIgnore
+    private List<String> quarter;
+
+    public List<String> getQuarter() {
+        return quarter;
+    }
+
+    public void setQuarter(List<String> quarter) {
+        this.quarter = quarter;
+    }
+
     public BigDecimal getViewConnectStability() {
         return viewConnectStability;
     }
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
index d9e4844..5f1d164 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
@@ -1,14 +1,12 @@
 package com.ycl.platform.domain.entity;
 
 import annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.ycl.platform.base.CheckIndex;
-import com.ycl.system.entity.BaseEntity;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 瑙嗛鎸囨爣姒傜巼鏁版嵁瀵硅薄 t_check_index_video
@@ -103,6 +101,17 @@
     @Excel(name = "鏈堣繍琛岀巼")
     private BigDecimal operatingRate;
 
+    @ExcelIgnore
+    private List<String> quarter;
+
+    public List<String> getQuarter() {
+        return quarter;
+    }
+
+    public void setQuarter(List<String> quarter) {
+        this.quarter = quarter;
+    }
+
     public BigDecimal getPlatformOnline() {
         return platformOnline;
     }
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java
index cf3e0a7..9006893 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java
@@ -9,6 +9,7 @@
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 鑰冩牳绉垎鏄庣粏瀵硅薄 t_check_score
@@ -70,4 +71,7 @@
     @TableField(exist = false)
     private Date endDate;
 
+    @TableField(exist = false)
+    private List<String> quarter;
+
 }
diff --git a/ycl-pojo/src/main/java/com/ycl/system/entity/BaseEntity.java b/ycl-pojo/src/main/java/com/ycl/system/entity/BaseEntity.java
index 78f5483..a87c5b1 100644
--- a/ycl-pojo/src/main/java/com/ycl/system/entity/BaseEntity.java
+++ b/ycl-pojo/src/main/java/com/ycl/system/entity/BaseEntity.java
@@ -1,11 +1,9 @@
 package com.ycl.system.entity;
 
-import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonInclude;
-import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -50,6 +48,7 @@
 
     /** 璇锋眰鍙傛暟 */
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    @TableField(exist = false)
     private Map<String, Object> params;
 
     public String getSearchValue()
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
index 84cdd90..c790715 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -91,20 +91,22 @@
         Short examineCategory = checkScore.getExamineCategory();
         String[] indexTableArr ={"","t_check_index_video","t_check_index_car","t_check_index_face"};
         String tableName = indexTableArr[examineCategory];
-        //鑾峰綋鏈堜唤
-        String date = checkScoreIndexDTO.getDate();
-        if(StringUtils.isEmpty(date)){
-            //濡傛灉鏌ヨ鏉′欢涓嶅惈鍙傛暟锛屾煡璇㈢Н鍒嗗搴斿垱寤烘椂闂�
-            Date createTime = checkScore.getCreateTime();
-            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
-            date = formatter.format(createTime);
-        }
 
         ScoreIndexDTO scoreIndexDTO = new ScoreIndexDTO()
                 .setTableName(tableName)
                 .setDeptId(checkScore.getDeptId())
-                .setDate(date);
+                .setDate(checkScoreIndexDTO.getDate())
+                .setQuarter(checkScoreIndexDTO.getQuarter());
         scoreIndexDTO.setParams(checkScoreIndexDTO.getParams());
+
+        //鑾峰綋鏈堜唤
+        if(StringUtils.isEmpty(scoreIndexDTO.getDate()) && CollectionUtils.isEmpty(checkScoreIndexDTO.getQuarter())){
+            //濡傛灉鏌ヨ鏉′欢涓嶅惈鍙傛暟锛屾煡璇㈢Н鍒嗗搴斿垱寤烘椂闂�
+            Date createTime = checkScore.getCreateTime();
+            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
+            scoreIndexDTO.setDate(formatter.format(createTime));
+        }
+
         List<Map> map = scoreMapper.selectScoreIndex(scoreIndexDTO);
 
         scoreMap.put("tableData",checkRules);
@@ -168,7 +170,7 @@
             //濡傛灉涓虹┖鏌ユ湰鏈堢殑鏁版嵁
             Calendar now = Calendar.getInstance();
             //鍙栨槰澶�
-            now.add(Calendar.DATE, -1);
+            // now.add(Calendar.DATE, -1);
             Date yesterday = now.getTime();
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
             date = simpleDateFormat.format(yesterday);
@@ -225,27 +227,30 @@
     public void exportIndex(HttpServletResponse response,CheckScore checkScoreDTO) throws IOException {
         String date = checkScoreDTO.getDate();
         //濡傛灉璇锋眰鍙傛暟鏃堕棿涓虹┖锛屾煡杩欐潯璁板綍鐨勬椂闂�
-        if(StringUtils.isEmpty(date)) {
+        if(StringUtils.isEmpty(checkScoreDTO.getDate()) && CollectionUtils.isEmpty(checkScoreDTO.getQuarter())){
             CheckScore checkScore = getById(checkScoreDTO.getId());
             Date createTime = checkScore.getCreateTime();
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
-            date = simpleDateFormat.format(createTime);
+            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
+            date = formatter.format(createTime);
         }
 
         /** 瀵间笁寮爏heet */
         //杞﹁締
         CheckIndexCar checkIndexCar = new CheckIndexCar();
         checkIndexCar.setDate(date);
+        checkIndexCar.setQuarter(checkScoreDTO.getQuarter());
         List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar);
         ExcelExp e1 = new ExcelExp("杞﹁締鑰冩牳鎸囨爣鏁版嵁",checkIndexCars,CheckIndexCar.class);
         //浜鸿劯
         CheckIndexFace checkIndexFace = new CheckIndexFace();
         checkIndexFace.setDate(date);
+        checkIndexFace.setQuarter(checkScoreDTO.getQuarter());
         List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace);
         ExcelExp e2 = new ExcelExp("浜鸿劯鑰冩牳鎸囨爣鏁版嵁",checkIndexFaces,CheckIndexFace.class);
         //瑙嗛
         CheckIndexVideo checkIndexVideo = new CheckIndexVideo();
         checkIndexVideo.setDate(date);
+        checkIndexVideo.setQuarter(checkScoreDTO.getQuarter());
         List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo);
         ExcelExp e3 = new ExcelExp("瑙嗛鑰冩牳鎸囨爣鏁版嵁",checkIndexVideos,CheckIndexVideo.class);
 
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
index 0efeca1..2bc0f1f 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
@@ -105,7 +105,13 @@
     <select id="selectScoreIndex" resultType="java.util.Map">
         select t.* from ${tableName} t
         left join sys_dept d on t.dept_id = d.dept_id
-        where t.dept_id =#{deptId} and date_format(t.create_time,'%Y-%m')  = #{date}
+        where t.dept_id = #{deptId}
+        <if test="date != null">
+            and date_format(t.create_time,'%Y-%m') = #{date}
+        </if>
+        <if test="quarter != null and quarter.size > 0">
+            and date_format(t.create_time, '%Y-%m') between #{quarter[0]} and #{quarter[1]}
+        </if>
         ${params.dataScope}
     </select>
 

--
Gitblit v1.8.0