From ac9efc618210e1df40dfba9f779ca27739d2b343 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 08 五月 2024 17:29:00 +0800
Subject: [PATCH] 考核模板关联定时任务

---
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java         |    3 
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml                    |    8 
 ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java           |    3 
 ycl-common/src/main/java/constant/CheckConstants.java                                |    9 
 ycl-pojo/src/main/java/com/ycl/system/entity/BaseEntity.java                         |    6 
 ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ScoreIndexDTO.java                |   13 +
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java           |   15 +
 ycl-server/src/main/java/com/ycl/platform/service/ICheckTemplateService.java         |   26 +
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml                   |    8 
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java            |    4 
 ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml                |    2 
 ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java            |   62 ++--
 /dev/null                                                                            |   26 --
 ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java               |    6 
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java             |    4 
 ycl-server/src/main/java/com/ycl/platform/controller/CheckTemplateController.java    |   14 
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java                |    5 
 ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java                            |  159 +++++++++++++
 ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml                       |   23 +
 ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java                         |   30 ++
 ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java       |   11 
 ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java    |  133 ++++++----
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml                  |    9 
 ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java |   86 ++++--
 24 files changed, 475 insertions(+), 190 deletions(-)

diff --git a/ycl-common/src/main/java/constant/CheckConstants.java b/ycl-common/src/main/java/constant/CheckConstants.java
index ad105a6..b6c52e9 100644
--- a/ycl-common/src/main/java/constant/CheckConstants.java
+++ b/ycl-common/src/main/java/constant/CheckConstants.java
@@ -11,8 +11,17 @@
     //浜鸿劯瑙勫垯
     public static final Short Rule_Category_Face = 3;
 
+    //鐪佸巺
+    public static final Short Examine_Tag_City = 0;
+    //鍖哄幙
+    public static final Short Examine_Tag_County = 1;
+
     public static final String Delete = "1";
 
+    //涔�
+    public static final String Multiply = "*";
+    //闄�
+    public static final String Divided = "/";
     public static final String Status_Use = "0";
     public static final String Status_Stop = "1";
 
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
index b6485cc..55c23d9 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
@@ -4,11 +4,14 @@
 import com.fasterxml.jackson.annotation.JsonFormat;
 
 import java.util.Date;
+import java.util.List;
 
 public abstract class CheckIndex {
     public Long id;
-    //鏌ヨ鏉′欢锛屾棩鏈�
+    //鏌ヨ鏉′欢锛屾湀浠�
     public String date;
+    //鏌ヨ鏉′欢锛屾棩鏈�
+    public String day;
 
     @Excel(name = "鏃ユ湡",dateFormat = "yyyy-MM-dd")
     public Date createTime;
@@ -19,9 +22,9 @@
 
     /** 鑰冩牳鏍囩锛堢渷鍘�/甯傚眬锛� */
     @Excel(name = "鑰冩牳鏍囩", dictType = "platform_examine_tag")
-    public Long examineTag;
+    public Short examineTag;
 
-
+    public List<Integer> deptIds;
     public Long getId() {
         return id;
     }
@@ -62,11 +65,28 @@
         this.deptName = deptName;
     }
 
-    public Long getExamineTag() {
+    public Short getExamineTag() {
         return examineTag;
     }
 
-    public void setExamineTag(Long examineTag) {
+    public void setExamineTag(Short examineTag) {
         this.examineTag = examineTag;
     }
+
+    public List<Integer> getDeptIds() {
+        return deptIds;
+    }
+
+
+    public String getDay() {
+        return day;
+    }
+
+    public void setDay(String day) {
+        this.day = day;
+    }
+
+    public void setDeptIds(List<Integer> deptIds) {
+        this.deptIds = deptIds;
+    }
 }
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 05c3213..38eaacf 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
@@ -1,9 +1,10 @@
 package com.ycl.platform.domain.dto;
 
+import com.ycl.system.entity.BaseEntity;
 import lombok.Data;
 
 @Data
-public class CheckScoreIndexDTO {
+public class CheckScoreIndexDTO extends BaseEntity {
     private Long id;
     private String date;
 }
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
new file mode 100644
index 0000000..aa15b1c
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ScoreIndexDTO.java
@@ -0,0 +1,13 @@
+package com.ycl.platform.domain.dto;
+
+import com.ycl.system.entity.BaseEntity;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class ScoreIndexDTO extends BaseEntity {
+    private String tableName;
+    private Long deptId;
+    private String date;
+}
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 224f9e3..1d85b4c 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
@@ -109,12 +109,12 @@
     }
 
     @Override
-    public Long getExamineTag() {
+    public Short getExamineTag() {
         return super.getExamineTag();
     }
 
     @Override
-    public void setExamineTag(Long examineTag) {
+    public void setExamineTag(Short examineTag) {
         super.setExamineTag(examineTag);
     }
     public void setViewConnectStability(BigDecimal viewConnectStability) 
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 299a991..46a0275 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
@@ -167,12 +167,12 @@
     }
 
     @Override
-    public Long getExamineTag() {
+    public Short getExamineTag() {
         return super.getExamineTag();
     }
 
     @Override
-    public void setExamineTag(Long examineTag) {
+    public void setExamineTag(Short examineTag) {
         super.setExamineTag(examineTag);
     }
 
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 2d41919..d9e4844 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
@@ -96,6 +96,9 @@
     @Excel(name = "瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」",width = 25)
     private BigDecimal videoTransmissionBoundaryIntegrityDetection;
 
+    /** 瑙嗛浼犺緭缃戣竟鐣屽畬鏁存�ф娴嬫墸鍒嗛」 */
+    @Excel(name = "閲嶇偣鎸囨尌鍥惧儚鍦ㄧ嚎鐜�",width = 25)
+    private BigDecimal keyCommandImageOnline;
     /** 鏈堣繍琛岀巼 */
     @Excel(name = "鏈堣繍琛岀巼")
     private BigDecimal operatingRate;
@@ -186,6 +189,14 @@
 
     public void setKeyAnnotationAccuracy(BigDecimal keyAnnotationAccuracy) {
         this.keyAnnotationAccuracy = keyAnnotationAccuracy;
+    }
+
+    public BigDecimal getKeyCommandImageOnline() {
+        return keyCommandImageOnline;
+    }
+
+    public void setKeyCommandImageOnline(BigDecimal keyCommandImageOnline) {
+        this.keyCommandImageOnline = keyCommandImageOnline;
     }
 
     public BigDecimal getKeyTimingAccuracy() {
@@ -311,12 +322,12 @@
     }
 
     @Override
-    public Long getExamineTag() {
+    public Short getExamineTag() {
         return super.getExamineTag();
     }
 
     @Override
-    public void setExamineTag(Long examineTag) {
+    public void setExamineTag(Short examineTag) {
         super.setExamineTag(examineTag);
     }
 
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 97ca2bb..030bc2c 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
@@ -6,12 +6,14 @@
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ycl.system.entity.BaseEntity;
 import lombok.Data;
+import lombok.experimental.Accessors;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.Map;
 
 /**
  * 鑰冩牳绉垎鏄庣粏瀵硅薄 t_check_score
@@ -21,7 +23,7 @@
  */
 @Data
 @TableName("t_check_score")
-public class CheckScore
+public class CheckScore extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
@@ -66,4 +68,5 @@
     //鎶樼嚎鍥炬棩鏈熷弬鏁�
     @TableField(exist = false)
     private String date;
+
 }
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java
index e09c47e..0a703e8 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java
@@ -44,6 +44,9 @@
     @Excel(name = "瑙勫垯鏉冮噸")
     @TableField("weight")
     private BigDecimal weight;
+
     @TableField(exist = false)
     private String checkRuleName;
+    @TableField(exist = false)
+    private String ruleIndex;
 }
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 52bc99e..78f5483 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
@@ -5,6 +5,7 @@
 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;
@@ -35,15 +36,16 @@
     private Date createTime;
 
     /** 鏇存柊鑰� */
-    @TableField(fill = FieldFill.UPDATE)
+    @TableField(exist = false)
     private String updateBy;
 
     /** 鏇存柊鏃堕棿 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @TableField(fill = FieldFill.UPDATE)
+    @TableField(exist = false)
     private Date updateTime;
 
     /** 澶囨敞 */
+    @TableField(exist = false)
     private String remark;
 
     /** 璇锋眰鍙傛暟 */
diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
index f3e736c..bdcb0ec 100644
--- a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
+++ b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
@@ -35,7 +35,7 @@
     /**
      * 鏌ヨ鑰冩牳绉垎鍗$墖鍒楄〃
      */
-    @PreAuthorize("@ss.hasPermi('check:score:list')")
+//    @PreAuthorize("@ss.hasPermi('check:score:list')")
     @GetMapping("/list")
     public AjaxResult list(CheckScore checkScore)
     {
@@ -46,7 +46,7 @@
     /**
      * 鍖哄幙璇︽儏鍒楄〃
      */
-    @PreAuthorize("@ss.hasPermi('check:score:list')")
+//    @PreAuthorize("@ss.hasPermi('check:score:list')")
     @GetMapping("/detail")
     public TableDataInfo detail(CheckScore checkScore)
     {
@@ -59,7 +59,7 @@
     /**
      * 鑾峰彇鑰冩牳鎸囨爣璇︾粏淇℃伅
      */
-    @PreAuthorize("@ss.hasPermi('check:score:query')")
+//    @PreAuthorize("@ss.hasPermi('check:score:query')")
     @GetMapping(value = "/detail/index")
     public AjaxResult getIndex(CheckScoreIndexDTO checkScoreIndexDTO)
     {
@@ -70,19 +70,18 @@
     /**
      * 鍙戝竷鑰冩牳绉垎
      */
-    @PreAuthorize("@ss.hasPermi('check:score:edit')")
+//    @PreAuthorize("@ss.hasPermi('check:score:edit')")
     @Log(title = "鍙戝竷鑰冩牳绉垎", businessType = BusinessType.UPDATE)
     @PutMapping("/publish")
     public AjaxResult edit(@RequestBody CheckScoreDTO checkScoreDTO)
     {
-
         return toAjax(checkScoreService.publishCheckScore(checkScoreDTO));
     }
 
     /**
      * 瀵煎嚭鑰冩牳绉垎鍒楄〃
      */
-    @PreAuthorize("@ss.hasPermi('check:score:export')")
+//    @PreAuthorize("@ss.hasPermi('check:score:export')")
     @Log(title = "瀵煎嚭鑰冩牳绉垎", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, CheckScore checkScore) throws IOException {
diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/CheckTemplateController.java b/ycl-server/src/main/java/com/ycl/platform/controller/CheckTemplateController.java
index 46aae35..ddce8d5 100644
--- a/ycl-server/src/main/java/com/ycl/platform/controller/CheckTemplateController.java
+++ b/ycl-server/src/main/java/com/ycl/platform/controller/CheckTemplateController.java
@@ -1,6 +1,7 @@
 package com.ycl.platform.controller;
 
 import annotation.Log;
+import com.ycl.exception.job.TaskException;
 import com.ycl.platform.domain.entity.CheckTemplate;
 import com.ycl.platform.domain.entity.CheckTemplateRule;
 import com.ycl.platform.domain.query.CheckTemplateQuery;
@@ -12,6 +13,7 @@
 import com.ycl.system.page.TableDataInfo;
 import enumeration.BusinessType;
 import io.swagger.annotations.ApiOperation;
+import org.quartz.SchedulerException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -63,8 +65,7 @@
     @PreAuthorize("@ss.hasPermi('check:template:add')")
     @Log(title = "鏂板鑰冩牳妯℃澘", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody @Validated CheckTemplateQuery checkTemplateDTO)
-    {
+    public AjaxResult add(@RequestBody @Validated CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
 
         return toAjax(checkTemplateService.insertCheckTemplate(checkTemplateDTO));
     }
@@ -75,8 +76,7 @@
     @PreAuthorize("@ss.hasPermi('check:template:copy')")
     @Log(title = "澶嶅埗鑰冩牳妯℃澘", businessType = BusinessType.INSERT)
     @PostMapping("/copy")
-    public AjaxResult copy(@RequestBody CheckTemplateQuery checkTemplateDTO)
-    {
+    public AjaxResult copy(@RequestBody CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
         return toAjax(checkTemplateService.copyCheckTemplate(checkTemplateDTO));
     }
 
@@ -86,8 +86,7 @@
     @PreAuthorize("@ss.hasPermi('check:template:edit')")
     @Log(title = "淇敼鑰冩牳妯℃澘", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody CheckTemplateQuery checkTemplateDTO)
-    {
+    public AjaxResult edit(@RequestBody CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
         return checkTemplateService.updateCheckTemplate(checkTemplateDTO);
     }
 
@@ -107,8 +106,7 @@
     @PreAuthorize("@ss.hasPermi('check:template:remove')")
     @Log(title = "鍒犻櫎鑰冩牳妯℃澘", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{id}")
-    public AjaxResult remove(@PathVariable String id)
-    {
+    public AjaxResult remove(@PathVariable String id) throws SchedulerException {
         return toAjax(checkTemplateService.deleteCheckTemplateById(Integer.parseInt(id)));
     }
 
diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java
index 59510a7..526a05d 100644
--- a/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java
+++ b/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java
@@ -3,6 +3,7 @@
 import annotation.AutoFill;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ycl.platform.domain.dto.CheckScoreDTO;
+import com.ycl.platform.domain.dto.ScoreIndexDTO;
 import com.ycl.platform.domain.entity.CheckScore;
 import enumeration.OperationType;
 
@@ -68,5 +69,8 @@
     @AutoFill(OperationType.UPDATE)
     int publishCheckScore(CheckScoreDTO checkScoreDTO);
 
-    List<Map> selectScoreIndex(String tableName,Long deptId,String date);
+    List<Map> selectScoreIndex(ScoreIndexDTO scoreIndexDTO);
+
+    void saveBatch(List<CheckScore> scoreList);
+
 }
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java b/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java
index 588183b..0d3f138 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java
@@ -35,41 +35,41 @@
      */
     public Map<Long, List<CheckScore>> selectCheckScoreList(CheckScore checkScore);
 
-    /**
-     * 鏂板鑰冩牳绉垎鏄庣粏
-     * 
-     * @param checkScore 鑰冩牳绉垎鏄庣粏
-     * @return 缁撴灉
-     */
-    public int insertCheckScore(CheckScore checkScore);
-
-    /**
-     * 淇敼鑰冩牳绉垎鏄庣粏
-     * 
-     * @param checkScore 鑰冩牳绉垎鏄庣粏
-     * @return 缁撴灉
-     */
-    public int updateCheckScore(CheckScore checkScore);
-
-    /**
-     * 鎵归噺鍒犻櫎鑰冩牳绉垎鏄庣粏
-     * 
-     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳绉垎鏄庣粏涓婚敭闆嗗悎
-     * @return 缁撴灉
-     */
-    public int deleteCheckScoreByIds(Long[] ids);
-
-    /**
-     * 鍒犻櫎鑰冩牳绉垎鏄庣粏淇℃伅
-     * 
-     * @param id 鑰冩牳绉垎鏄庣粏涓婚敭
-     * @return 缁撴灉
-     */
-    public int deleteCheckScoreById(Long id);
 
     int publishCheckScore(CheckScoreDTO checkScoreDTO);
 
     List<CheckScore> page(CheckScore checkScore);
 
     void exportIndex(HttpServletResponse response,CheckScore checkScore) throws IOException;
+//    /**
+//     * 鏂板鑰冩牳绉垎鏄庣粏
+//     *
+//     * @param checkScore 鑰冩牳绉垎鏄庣粏
+//     * @return 缁撴灉
+//     */
+//    public int insertCheckScore(CheckScore checkScore);
+//
+//    /**
+//     * 淇敼鑰冩牳绉垎鏄庣粏
+//     *
+//     * @param checkScore 鑰冩牳绉垎鏄庣粏
+//     * @return 缁撴灉
+//     */
+//    public int updateCheckScore(CheckScore checkScore);
+//
+//    /**
+//     * 鎵归噺鍒犻櫎鑰冩牳绉垎鏄庣粏
+//     *
+//     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳绉垎鏄庣粏涓婚敭闆嗗悎
+//     * @return 缁撴灉
+//     */
+//    public int deleteCheckScoreByIds(Long[] ids);
+//
+//    /**
+//     * 鍒犻櫎鑰冩牳绉垎鏄庣粏淇℃伅
+//     *
+//     * @param id 鑰冩牳绉垎鏄庣粏涓婚敭
+//     * @return 缁撴灉
+//     */
+//    public int deleteCheckScoreById(Long id);
 }
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/ICheckTemplateService.java b/ycl-server/src/main/java/com/ycl/platform/service/ICheckTemplateService.java
index 0415e69..ba336b4 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/ICheckTemplateService.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/ICheckTemplateService.java
@@ -1,10 +1,12 @@
 package com.ycl.platform.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ycl.exception.job.TaskException;
 import com.ycl.platform.domain.entity.CheckTemplate;
 import com.ycl.platform.domain.query.CheckTemplateQuery;
 import com.ycl.system.AjaxResult;
 import com.ycl.system.Result;
+import org.quartz.SchedulerException;
 
 import java.util.List;
 
@@ -38,7 +40,7 @@
      * @param checkTemplateDTO 鑰冩牳妯℃澘
      * @return 缁撴灉
      */
-    public int insertCheckTemplate(CheckTemplateQuery checkTemplateDTO);
+    public int insertCheckTemplate(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException;
 
     /**
      * 淇敼鑰冩牳妯℃澘
@@ -46,15 +48,9 @@
      * @param checkTemplateDTO 鑰冩牳妯℃澘
      * @return 缁撴灉
      */
-    public AjaxResult updateCheckTemplate(CheckTemplateQuery checkTemplateDTO);
+    public AjaxResult updateCheckTemplate(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException;
 
-    /**
-     * 鎵归噺鍒犻櫎鑰冩牳妯℃澘
-     * 
-     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳妯℃澘涓婚敭闆嗗悎
-     * @return 缁撴灉
-     */
-    public int deleteCheckTemplateByIds(Integer[] ids);
+
 
     /**
      * 鍒犻櫎鑰冩牳妯℃澘淇℃伅
@@ -62,9 +58,17 @@
      * @param id 鑰冩牳妯℃澘涓婚敭
      * @return 缁撴灉
      */
-    public int deleteCheckTemplateById(Integer id);
+    public int deleteCheckTemplateById(Integer id) throws SchedulerException;
 
     Result pullList();
 
-    int copyCheckTemplate(CheckTemplateQuery checkTemplateDTO);
+    int copyCheckTemplate(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException;
+
+//    /**
+//     * 鎵归噺鍒犻櫎鑰冩牳妯℃澘
+//     *
+//     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳妯℃澘涓婚敭闆嗗悎
+//     * @return 缁撴灉
+//     */
+//    public int deleteCheckTemplateByIds(Integer[] ids);
 }
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 b1568b9..8ec391a 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
@@ -1,10 +1,12 @@
 package com.ycl.platform.service.impl;
 
+import annotation.DataScope;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ycl.platform.base.BaseSelect;
 import com.ycl.platform.base.CheckIndex;
 import com.ycl.platform.domain.dto.CheckScoreDTO;
 import com.ycl.platform.domain.dto.CheckScoreIndexDTO;
+import com.ycl.platform.domain.dto.ScoreIndexDTO;
 import com.ycl.platform.domain.entity.*;
 import com.ycl.platform.domain.vo.CheckScoreDetailVO;
 import com.ycl.platform.mapper.CheckRuleMapper;
@@ -68,12 +70,13 @@
     @Autowired
     private ISysDeptService deptService;
     /**
-     * 鏌ヨ鑰冩牳绉垎
+     * 鏌ヨ鑰冩牳绉垎鎸囨爣
      * 
      * @param id 鑰冩牳绉垎涓婚敭
      * @return 鑰冩牳绉垎
      */
     @Override
+    @DataScope(deptAlias = "d",userAlias = "u")
     public CheckScoreDetailVO selectCheckScoreById(CheckScoreIndexDTO checkScoreIndexDTO)
     {
         Long checkScoreId = checkScoreIndexDTO.getId();
@@ -104,7 +107,13 @@
             SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
             date = formatter.format(createTime);
         }
-        List<Map> map = scoreMapper.selectScoreIndex(tableName,checkScore.getDeptId(),date);
+
+        ScoreIndexDTO scoreIndexDTO = new ScoreIndexDTO()
+                .setTableName(tableName)
+                .setDeptId(checkScore.getDeptId())
+                .setDate(date);
+        scoreIndexDTO.setParams(checkScoreIndexDTO.getParams());
+        List<Map> map = scoreMapper.selectScoreIndex(scoreIndexDTO);
 
         scoreMap.put("tableData",checkRules);
         scoreMap.put("dataMap",map);
@@ -122,9 +131,11 @@
      * @return 鑰冩牳绉垎
      */
     @Override
+    @DataScope(deptAlias = "d",userAlias = "u")
     public Map<Long, List<CheckScore>> selectCheckScoreList(CheckScore checkScore)
     {
-        //TODO:鏁版嵁鏉冮檺
+        //鍖哄幙鍙兘鐪嬪凡鍙戝竷
+        roleControl(checkScore);
 
         //鏌ヨ鎴愮哗
         String date = checkScore.getDate();
@@ -142,6 +153,8 @@
         Map<Long, List<CheckScore>> deptMap = checkScores.stream().collect(Collectors.groupingBy(CheckScore::getDeptId));
         return deptMap;
     }
+
+
     /**
      * 鍖哄幙璇︽儏
      *
@@ -149,61 +162,13 @@
      * @return 鑰冩牳绉垎
      */
     @Override
+    @DataScope(deptAlias = "d",userAlias = "u")
     public List<CheckScore> page(CheckScore checkScore) {
-        //TODO:鏁版嵁鏉冮檺
+        //鍖哄幙鍙兘鐪嬪凡鍙戝竷
+        roleControl(checkScore);
         return scoreMapper.selectCheckScoreList(checkScore);
     }
 
-
-    /**
-     * 鏂板鑰冩牳绉垎
-     * 
-     * @param checkScore 鑰冩牳绉垎
-     * @return 缁撴灉
-     */
-    @Override
-    public int insertCheckScore(CheckScore checkScore)
-    {
-        checkScore.setCreateTime(DateUtils.getNowDate());
-        return scoreMapper.insertCheckScore(checkScore);
-    }
-
-    /**
-     * 淇敼鑰冩牳鏄庣粏
-     * 
-     * @param checkScore 鑰冩牳绉垎鏄庣粏
-     * @return 缁撴灉
-     */
-    @Override
-    public int updateCheckScore(CheckScore checkScore)
-    {
-
-        return scoreMapper.updateCheckScore(checkScore);
-    }
-
-    /**
-     * 鎵归噺鍒犻櫎鑰冩牳绉垎
-     * 
-     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳绉垎涓婚敭
-     * @return 缁撴灉
-     */
-    @Override
-    public int deleteCheckScoreByIds(Long[] ids)
-    {
-        return scoreMapper.deleteCheckScoreByIds(ids);
-    }
-
-    /**
-     * 鍒犻櫎鑰冩牳绉垎淇℃伅
-     * 
-     * @param id 鑰冩牳绉垎涓婚敭
-     * @return 缁撴灉
-     */
-    @Override
-    public int deleteCheckScoreById(Long id)
-    {
-        return scoreMapper.deleteCheckScoreById(id);
-    }
     /**
      * 鍙戝竷鑰冩牳绉垎淇℃伅
      *
@@ -301,4 +266,64 @@
         util.exportExcel(response, checkIndexes, "鑰冩牳绉垎鏄庣粏鏁版嵁");
 
     }
+
+    private void roleControl(CheckScore checkScore) {
+        List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
+        SysRole sysRole = roles.get(0);
+        if("zg_province".equals(sysRole.getRoleKey())){
+            Map<String, Object> params = checkScore.getParams();
+            params.put("publish",PublishType.PUBLISHED.getCode());
+        }
+    }
+
+
+    //    /**
+//     * 鏂板鑰冩牳绉垎
+//     *
+//     * @param checkScore 鑰冩牳绉垎
+//     * @return 缁撴灉
+//     */
+//    @Override
+//    public int insertCheckScore(CheckScore checkScore)
+//    {
+//        checkScore.setCreateTime(DateUtils.getNowDate());
+//        return scoreMapper.insertCheckScore(checkScore);
+//    }
+//
+//    /**
+//     * 淇敼鑰冩牳鏄庣粏
+//     *
+//     * @param checkScore 鑰冩牳绉垎鏄庣粏
+//     * @return 缁撴灉
+//     */
+//    @Override
+//    public int updateCheckScore(CheckScore checkScore)
+//    {
+//
+//        return scoreMapper.updateCheckScore(checkScore);
+//    }
+//
+//    /**
+//     * 鎵归噺鍒犻櫎鑰冩牳绉垎
+//     *
+//     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳绉垎涓婚敭
+//     * @return 缁撴灉
+//     */
+//    @Override
+//    public int deleteCheckScoreByIds(Long[] ids)
+//    {
+//        return scoreMapper.deleteCheckScoreByIds(ids);
+//    }
+//
+//    /**
+//     * 鍒犻櫎鑰冩牳绉垎淇℃伅
+//     *
+//     * @param id 鑰冩牳绉垎涓婚敭
+//     * @return 缁撴灉
+//     */
+//    @Override
+//    public int deleteCheckScoreById(Long id)
+//    {
+//        return scoreMapper.deleteCheckScoreById(id);
+//    }
 }
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java
index 9f9e35e..883a9e7 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson2.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ycl.exception.job.TaskException;
 import com.ycl.platform.base.BaseSelect;
 import com.ycl.platform.domain.entity.CheckTemplate;
 import com.ycl.platform.domain.entity.CheckTemplateRule;
@@ -13,10 +14,13 @@
 import com.ycl.platform.service.ICheckTemplateService;
 import com.ycl.system.AjaxResult;
 import com.ycl.system.Result;
+import com.ycl.system.domain.SysJob;
 import com.ycl.system.entity.SysDept;
 import com.ycl.system.service.ISysDeptService;
+import com.ycl.system.service.ISysJobService;
 import com.ycl.utils.SecurityUtils;
 import constant.CheckConstants;
+import org.quartz.SchedulerException;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
@@ -44,6 +48,8 @@
     private ICheckTemplateRuleService templateRuleServicee;
     @Autowired
     private CheckTemplateRuleMapper checkTemplateRuleMapper;
+    @Autowired
+    private ISysJobService jobService;
 
     /**
      * 鏌ヨ鑰冩牳妯℃澘
@@ -70,8 +76,6 @@
             list.add(map);
         }
         checkTemplateQuery.setRuleFormList(list);
-        //TODO:鏌ヨtemplate_rule琛ㄤ腑鐨勬潈閲嶄俊鎭��
-
 
         return checkTemplateQuery;
     }
@@ -107,10 +111,7 @@
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int insertCheckTemplate(CheckTemplateQuery checkTemplateDTO) {
-        //TODO:鏂板瀹氭椂浠诲姟锛岀姸鎬佸悓妯℃澘,鐒跺悗璧嬪�糺obId缁檛emplate
-
-
+    public int insertCheckTemplate(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
         String username = SecurityUtils.getUsername();
         /** 鎻掑叆t_template */
         CheckTemplate checkTemplate = new CheckTemplate();
@@ -126,6 +127,12 @@
                 //涓嶅~鎶ヨ鍒嗘暟---->闆跺垎---->涓嶆姤璀�
                 .setAlarmScore(new BigDecimal(checkTemplateDTO.getAlarmScore() == null ? "" : checkTemplateDTO.getAlarmScore()));
         int i = checkTemplateMapper.insertCheckTemplate(checkTemplate);
+
+        //鏂板瀹氭椂浠诲姟锛岀姸鎬佸悓妯℃澘,鐒跺悗璧嬪�糺obId缁檛emplate
+        SysJob sysJob = addJob(checkTemplateDTO.setId(checkTemplate.getId()));
+        checkTemplate.setJobId(Integer.parseInt(sysJob.getJobId() + ""));
+        checkTemplateMapper.updateCheckTemplate(checkTemplate);
+
         /** t_template_rule鏂板鏉冮噸 */
         insertTemlpateRule(checkTemplateDTO, checkTemplate);
 
@@ -140,9 +147,7 @@
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int copyCheckTemplate(CheckTemplateQuery checkTemplateDTO) {
-        //TODO:鏂板瀹氭椂浠诲姟锛岀姸鎬佸悓妯℃澘,鐒跺悗璧嬪�糺obId缁檛emplate
-
+    public int copyCheckTemplate(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
         //鎻掑叆妯℃澘琛�
         CheckTemplate checkTemplate = checkTemplateMapper.selectCheckTemplateById(checkTemplateDTO.getId());
         String username = SecurityUtils.getUsername();
@@ -155,7 +160,10 @@
         List<CheckTemplateRule> templateRuleList = checkTemplateRuleMapper.selectListByTemplateId(checkTemplateDTO.getId());
         templateRuleList.forEach(checkTemplateRule -> checkTemplateRule.setCheckTemplateId(checkTemplate.getId()).setId(null));
         templateRuleServicee.saveBatch(templateRuleList);
-
+        //鏂板瀹氭椂浠诲姟锛岀姸鎬佸悓妯℃澘,鐒跺悗璧嬪�糺obId缁檛emplate
+        SysJob sysJob = addJob(checkTemplateDTO.setId(checkTemplate.getId()));
+        checkTemplate.setJobId(Integer.parseInt(sysJob.getJobId() + ""));
+        checkTemplateMapper.updateCheckTemplate(checkTemplate);
         return i;
     }
 
@@ -167,7 +175,7 @@
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public AjaxResult updateCheckTemplate(CheckTemplateQuery checkTemplateDTO) {
+    public AjaxResult updateCheckTemplate(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
         CheckTemplate checkTemplate = new CheckTemplate();
         BeanUtils.copyProperties(checkTemplateDTO, checkTemplate);
         checkTemplate.setUpdateUserName(SecurityUtils.getUsername());
@@ -178,25 +186,17 @@
         checkTemplateMapper.updateCheckTemplate(checkTemplate);
 
         /** t_template_rule淇敼鏉冮噸 */
-        if (!CollectionUtils.isEmpty(checkTemplateDTO.getRuleFormList()) ) {
+        if (!CollectionUtils.isEmpty(checkTemplateDTO.getRuleFormList())) {
             //鍏堝垹闄ゅ師鏁版嵁
             checkTemplateRuleMapper.deleteByTemplateId(checkTemplate.getId());
             //鎻掑叆鏂拌鍒欐暟鎹�
             insertTemlpateRule(checkTemplateDTO, checkTemplate);
         }
-        //TODO:鍒ゆ柇鐘舵�佹槸鍚︿慨鏀癸紝璋冩暣job琛ㄩ噷鐨勭姸鎬�
+        //璋冩暣job琛ㄩ噷鐨勭姸鎬�
+        SysJob job = jobService.selectJobById(Long.valueOf(checkTemplateDTO.getJobId()));
+        job.setStatus(checkTemplateDTO.getStatus());
+        jobService.updateJob(job);
         return AjaxResult.success();
-    }
-
-    /**
-     * 鎵归噺鍒犻櫎鑰冩牳妯℃澘
-     *
-     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳妯℃澘涓婚敭
-     * @return 缁撴灉
-     */
-    @Override
-    public int deleteCheckTemplateByIds(Integer[] ids) {
-        return checkTemplateMapper.deleteCheckTemplateByIds(ids);
     }
 
     /**
@@ -206,10 +206,15 @@
      * @return 缁撴灉
      */
     @Override
-    public int deleteCheckTemplateById(Integer id) {
-        //TODO:鍒犻櫎瀹氭椂浠诲姟
-
-
+    public int deleteCheckTemplateById(Integer id) throws SchedulerException {
+        CheckTemplate checkTemplate = checkTemplateMapper.selectCheckTemplateById(id);
+        //鍒犻櫎瀹氭椂浠诲姟
+        SysJob job = new SysJob();
+        if (checkTemplate.getJobId() != null) {
+            job.setJobId(Long.valueOf(checkTemplate.getJobId()));
+            job.setJobGroup("CHECK");
+            jobService.deleteJob(job);
+        }
         return checkTemplateMapper.updateCheckTemplate(new CheckTemplate().setId(id)
                 .setDeleted(CheckConstants.Delete));
     }
@@ -236,4 +241,29 @@
             templateRuleServicee.saveBatch(templateRuleList);
         }
     }
+
+    private SysJob addJob(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
+        SysJob job = new SysJob();
+        job.setCreateBy(SecurityUtils.getLoginUser().getUsername());
+        //璋冪敤鏂规硶鍚�
+        job.setInvokeTarget("checkScoreTask.executeTemplate(" + checkTemplateDTO.getId() + ")");
+        job.setConcurrent("1");
+        job.setStatus(checkTemplateDTO.getStatus());
+        job.setJobGroup("CHECK");
+        job.setCronExpression("0 0 12 * * ?");
+        job.setJobName(checkTemplateDTO.getTemplateName());
+        int i = jobService.insertJob(job);
+        return job;
+    }
+
+    //    /**
+//     * 鎵归噺鍒犻櫎鑰冩牳妯℃澘
+//     *
+//     * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳妯℃澘涓婚敭
+//     * @return 缁撴灉
+//     */
+//    @Override
+//    public int deleteCheckTemplateByIds(Integer[] ids) {
+//        return checkTemplateMapper.deleteCheckTemplateByIds(ids);
+//    }
 }
diff --git a/ycl-server/src/main/java/com/ycl/task/CheckScore.java b/ycl-server/src/main/java/com/ycl/task/CheckScore.java
deleted file mode 100644
index 410693b..0000000
--- a/ycl-server/src/main/java/com/ycl/task/CheckScore.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.ycl.task;
-
-import com.ycl.platform.domain.entity.CheckTemplate;
-import com.ycl.platform.service.ICheckTemplateRuleService;
-import com.ycl.platform.service.ICheckTemplateService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-
-@Component("checkScore")
-@Slf4j
-public class CheckScore {
-    @Autowired
-    private ICheckTemplateService templateService;
-    @Autowired
-    private ICheckTemplateRuleService templateRuleService;
-
-    public void check(Integer templateId){
-        log.info("鎵ц鑰冩牳妯℃澘---------->{}",templateId);
-        CheckTemplate checkTemplate = templateService.getById(templateId);
-        
-
-
-    }
-}
diff --git a/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
new file mode 100644
index 0000000..85ab0ec
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
@@ -0,0 +1,159 @@
+package com.ycl.task;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.google.common.base.CaseFormat;
+import com.ycl.platform.base.CheckIndex;
+import com.ycl.platform.domain.entity.*;
+import com.ycl.platform.mapper.CheckScoreMapper;
+import com.ycl.platform.mapper.CheckTemplateMapper;
+import com.ycl.platform.mapper.CheckTemplateRuleMapper;
+import com.ycl.platform.service.*;
+import constant.CheckConstants;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+@Slf4j
+@Component("checkScoreTask")
+public class CheckScoreTask {
+    @Autowired
+    private CheckTemplateMapper templateMapper;
+    @Autowired
+    private CheckTemplateRuleMapper checkTemplateRuleMapper;
+    @Autowired
+    private CheckScoreMapper scoreMapper;
+    @Autowired
+    private MongoTemplate mongoTemplate;
+    @Autowired
+    private ICheckIndexVideoService videoService;
+    @Autowired
+    private ICheckIndexFaceService faceService;
+    @Autowired
+    private ICheckIndexCarService carService;
+
+    public void executeTemplate(Integer templateId) {
+        CheckTemplate checkTemplate = templateMapper.selectCheckTemplateById(templateId);
+        if (checkTemplate != null) {
+            log.info("鎵ц鑰冩牳妯℃澘---------->{}", checkTemplate.getTemplateName());
+            Short examineCategory = checkTemplate.getExamineCategory();
+            Short examineTag = checkTemplate.getExamineTag();
+            //鏌ユ潈閲�
+            CheckTemplateRule checkTemplateRule = new CheckTemplateRule();
+            checkTemplateRule.setCheckTemplateId(templateId);
+            List<CheckTemplateRule> templateRuleList = checkTemplateRuleMapper.selectListByTemplateId(templateId);
+            //鏌ヤ粖澶╃殑index鎸囨爣
+            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            String day = dateFormat.format(new Date());
+
+            //鍒涘缓score闆嗗悎鏂逛究鏈�鍚庢壒閲忓瓨鍌�
+            List<CheckScore> scoreList = new ArrayList<>();
+            //鏍规嵁鑰冩牳绫诲埆鍜岃�冩牳鏍囩锛屾煡涓嶅悓index琛紙鍖哄垎鐪佸巺鍖哄幙锛�
+            if (CheckConstants.Rule_Category_Video.equals(examineCategory)) {
+                CheckIndexVideo checkIndexVideo = new CheckIndexVideo();
+                checkIndexVideo.setExamineTag(examineTag);
+                checkIndexVideo.setDay(day);
+                checkIndexVideo.setDeptIds(JSONArray.parseArray(checkTemplate.getDeptId(), Integer.class));
+                //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�瑙嗛鏁版嵁
+                List<CheckIndexVideo> checkIndexVideos = videoService.selectCheckIndexVideoList(checkIndexVideo);
+                for (CheckIndexVideo indexVideo : checkIndexVideos) {
+                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexVideo,CheckConstants.Rule_Category_Video);
+                }
+            } else if (CheckConstants.Rule_Category_Car.equals(examineCategory)) {
+                CheckIndexCar checkIndexCar = new CheckIndexCar();
+                checkIndexCar.setDay(day);
+                checkIndexCar.setExamineTag(examineTag);
+                checkIndexCar.setDeptIds(JSONArray.parseArray(checkTemplate.getDeptId(), Integer.class));
+                //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�杞﹁締鏁版嵁
+                List<CheckIndexCar> checkIndexCars = carService.selectCheckIndexCarList(checkIndexCar);
+                for (CheckIndexCar indexCar : checkIndexCars) {
+                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexCar,CheckConstants.Rule_Category_Car);
+                }
+            } else if (CheckConstants.Rule_Category_Face.equals(examineCategory)) {
+                CheckIndexFace checkIndexFace = new CheckIndexFace();
+                checkIndexFace.setDay(day);
+                checkIndexFace.setExamineTag(examineTag);
+                checkIndexFace.setDeptIds(JSONArray.parseArray(checkTemplate.getDeptId(), Integer.class));
+                //鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�浜鸿劯鏁版嵁
+                List<CheckIndexFace> checkIndexFaces = faceService.selectCheckIndexFaceList(checkIndexFace);
+                for (CheckIndexFace indexFace : checkIndexFaces) {
+                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace,CheckConstants.Rule_Category_Face);
+                }
+            }
+
+            //鍌ㄥ瓨鍒嗘暟
+            scoreMapper.saveBatch(scoreList);
+            //TODO锛氭牴鎹姤璀﹀垎鏁伴槇鍊硷紝娣诲姞鎶ヨ淇℃伅
+
+        }
+    }
+
+    private <T extends CheckIndex>void addToList(Integer templateId, CheckTemplate checkTemplate, Short examineTag, List<CheckTemplateRule> templateRuleList, List<CheckScore> scoreList, T indexObject,Short checkCategory) {
+        CheckScore checkScore = new CheckScore();
+        BigDecimal scoreFinal = BigDecimal.ZERO;
+        for (CheckTemplateRule templateRule : templateRuleList) {
+            //璁$畻鍒嗘暟
+            scoreFinal = getScoreFinal(indexObject, scoreFinal, templateRule);
+        }
+        //琛ュ厖checkScore
+        fillCheckScore(templateId, checkTemplate, examineTag, indexObject, checkScore, scoreFinal,checkCategory);
+        scoreList.add(checkScore);
+    }
+
+    //閫氱敤鏂规硶璁$畻鍒嗘暟
+    private <T>BigDecimal getScoreFinal(T object, BigDecimal scoreFinal, CheckTemplateRule templateRule) {
+        String ruleIndex = templateRule.getRuleIndex();
+        //灏哸_b_c杞崲涓篴BC
+        String camelRuleIndex = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, ruleIndex);
+        try {
+            //鍙嶅皠鑾峰彇灞炴�у��
+            Class<T> clazz = (Class<T>) object.getClass();
+            Field field = clazz.getDeclaredField(camelRuleIndex);
+            field.setAccessible(true);
+            BigDecimal index = (BigDecimal) field.get(object);
+            BigDecimal score = index.multiply(templateRule.getWeight());
+            scoreFinal = scoreFinal.add(score);
+        } catch (Exception e) {
+            log.info("鍙嶅皠寮傚父",e);
+        }
+        return scoreFinal;
+    }
+    //璁剧疆checkScore瀵硅薄
+    private void fillCheckScore(Integer templateId, CheckTemplate checkTemplate, Short examineTag, CheckIndex checkIndex, CheckScore checkScore, BigDecimal scoreFinal,Short checkCategory) {
+        //鏍规嵁璋冩暣绯绘暟璋冩暣鏈�缁堝垎鏁板ぇ灏�
+        String adjustWay = checkTemplate.getAdjustWay();
+        BigDecimal adjustCoefficient = checkTemplate.getAdjustCoefficient();
+        if(CheckConstants.Multiply.equals(adjustWay)){
+            scoreFinal = adjustCoefficient.multiply(scoreFinal).multiply(new BigDecimal(100));
+        }else if(CheckConstants.Divided.equals(adjustWay)){
+            //鍥涜垗浜斿叆淇濈暀灏忔暟鍚庡洓浣�
+            scoreFinal = scoreFinal.divide(adjustCoefficient,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
+        }
+        checkScore.setCreateTime(new Date());
+        checkScore.setExamineTag(Integer.parseInt(examineTag +""));
+        checkScore.setExamineCategory(checkCategory);
+        checkScore.setDeptId(checkIndex.getDeptId());
+        checkScore.setTemplateId(templateId);
+        checkScore.setScore(scoreFinal);
+    }
+
+    //鏌ongo鏁版嵁褰掓。鍒癿ysql
+    public void dataArchiving() {
+        //TODO:褰掓。check_index_car,鍖哄垎鐪佸巺甯傚眬锛屾瘡涓尯鍘夸竴鏉℃暟鎹�
+        CheckIndexCar checkIndexCar = new CheckIndexCar();
+        //TODO:褰掓。check_index_face
+        CheckIndexFace checkIndexFace = new CheckIndexFace();
+        //TODO:褰掓。check_index_video
+        CheckIndexVideo checkIndexVideo = new CheckIndexVideo();
+
+    }
+}
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
index 42f8fe4..5281b89 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
@@ -29,9 +29,10 @@
         select tcic.*,sd.dept_name
         from t_check_index_car tcic left join sys_dept sd on tcic.dept_id = sd.dept_id
         <where>  
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="deptId != null "> and tcic.dept_id = #{deptId}</if>
             <if test="examineTag != null "> and examine_tag = #{examineTag}</if>
             <if test="date != null "> and  date_format(tcic.create_time,'%Y-%m') = #{date}</if>
+            <if test="day != null "> and  date(tcic.create_time) = #{day}</if>
             <if test="viewConnectStability != null "> and view_connect_stability = #{viewConnectStability}</if>
             <if test="siteOnline != null "> and site_online = #{siteOnline}</if>
             <if test="deviceDirectoryConsistent != null "> and device_directory_consistent = #{deviceDirectoryConsistent}</if>
@@ -42,6 +43,11 @@
             <if test="vehicleUploadTimeliness != null "> and vehicle_upload_timeliness = #{vehicleUploadTimeliness}</if>
             <if test="vehicleUrlAvailability != null "> and vehicle_url_availability = #{vehicleUrlAvailability}</if>
             <if test="vehiclePictureAvailability != null "> and vehicle_picture_availability = #{vehiclePictureAvailability}</if>
+            <if test="deptIds != null ">and tcic.dept_id in
+                <foreach collection="deptIds" separator="," open="(" close=")" item="deptId">
+                    #{deptId}
+                </foreach>
+            </if>
         </where>
     </select>
     
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
index 37b36f7..7c73d45 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
@@ -27,9 +27,10 @@
         select tcif.*,sd.dept_name
         from t_check_index_face tcif left join sys_dept sd on tcif.dept_id = sd.dept_id
         <where>  
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="deptId != null "> and tcif.dept_id = #{deptId}</if>
             <if test="examineTag != null "> and examine_tag = #{examineTag}</if>
             <if test="date != null "> and  date_format(tcif.create_time,'%Y-%m') = #{date}</if>
+            <if test="day != null "> and  date(tcif.create_time) = #{day}</if>
             <if test="viewConnectStability != null "> and view_connect_stability = #{viewConnectStability}</if>
             <if test="siteOnline != null "> and site_online = #{siteOnline}</if>
             <if test="deviceDirectoryConsistent != null "> and device_directory_consistent = #{deviceDirectoryConsistent}</if>
@@ -38,6 +39,11 @@
             <if test="faceTimingAccuracy != null "> and face_timing_accuracy = #{faceTimingAccuracy}</if>
             <if test="faceUploadTimeliness != null "> and face_upload_timeliness = #{faceUploadTimeliness}</if>
             <if test="facePictureAvailability != null "> and face_picture_availability = #{facePictureAvailability}</if>
+            <if test="deptIds != null ">and tcif.dept_id in
+                <foreach collection="deptIds" separator="," open="(" close=")" item="deptId">
+                    #{deptId}
+                </foreach>
+            </if>
         </where>
     </select>
     
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
index 9279f6a..a1c6e1e 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
@@ -39,9 +39,11 @@
         select tciv.*,sd.dept_name
         from t_check_index_video tciv left join sys_dept sd on tciv.dept_id = sd.dept_id
         <where>  
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="deptId != null "> and tciv.dept_id = #{deptId}</if>
             <if test="examineTag != null "> and examine_tag = #{examineTag}</if>
             <if test="date != null "> and  date_format(tciv.create_time,'%Y-%m') = #{date}</if>
+            <if test="day != null "> and  date(tciv.create_time) = #{day}</if>
+            <if test="createTime != null "> and  date(tciv.create_time) = #{createTime}</if>
             <if test="platformOnline != null "> and platform_online = #{platformOnline}</if>
             <if test="monitorQualification != null "> and monitor_qualification = #{monitorQualification}</if>
             <if test="monitorRegistration != null "> and monitor_registration = #{monitorRegistration}</if>
@@ -62,6 +64,11 @@
             <if test="videoTransmissionDangerousAssetsScore != null "> and video_transmission_dangerous_assets_score = #{videoTransmissionDangerousAssetsScore}</if>
             <if test="videoTransmissionBoundaryIntegrityDetection != null "> and video_transmission_boundary_integrity_detection = #{videoTransmissionBoundaryIntegrityDetection}</if>
             <if test="operatingRate != null "> and operating_rate = #{operatingRate}</if>
+            <if test="deptIds != null ">and tciv.dept_id in
+            <foreach collection="deptIds" separator="," open="(" close=")" item="deptId">
+                #{deptId}
+            </foreach>
+            </if>
         </where>
     </select>
     
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
index de4ffb3..45fc2ec 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
@@ -18,20 +18,22 @@
     </resultMap>
 
     <sql id="selectCheckScoreVo">
-        select id, score, dept_id, template_id, examine_tag, examine_category, create_time,update_time,update_user, publish from t_check_score
+        select id, score, tcs.dept_id, template_id, examine_tag, examine_category, tcs.create_time,tcs.update_time,tcs.update_user, publish
+        from t_check_score tcs left join sys_dept d on tcs.dept_id = d.dept_id
     </sql>
 
     <select id="selectCheckScoreList" resultMap="CheckScoreResult">
         <include refid="selectCheckScoreVo"/>
         <where>
             <if test="score != null "> and score = #{score}</if>
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
             <if test="templateId != null "> and template_id = #{templateId}</if>
-            <if test="createTime != null "> and  DATE(create_time) = #{createTime}</if>
-            <if test="date != null "> and  date_format(create_time,'%Y-%m')  = #{date}</if>
+            <if test="createTime != null "> and  DATE(tcs.create_time) = #{createTime}</if>
+            <if test="date != null "> and  date_format(tcs.create_time,'%Y-%m')  = #{date}</if>
             <if test="examineTag != null "> and examine_tag = #{examineTag}</if>
             <if test="examineCategory != null "> and examine_category = #{examineCategory}</if>
-            <if test="publish != null  and publish != ''"> and publish = #{publish}</if>
+            <if test="params.publish != null  and params.publish != ''"> and publish = #{params.publish}</if>
+            <if test="deptId != null "> and tcs.dept_id = #{deptId}</if>
+            ${params.dataScope}
         </where>
     </select>
     
@@ -101,6 +103,15 @@
     </update>
 
     <select id="selectScoreIndex" resultType="java.util.Map">
-        select * from ${tableName} where dept_id =#{deptId} and date_format(create_time,'%Y-%m')  = #{date}
+        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}
+        ${params.dataScope}
     </select>
+
+    <insert id="saveBatch">
+        insert into t_check_score (score,dept_id,template_id,examine_tag,examine_category,create_time) values <foreach collection="scoreList" separator="," item="score">
+        (#{score.score},#{score.deptId},#{score.templateId},#{score.examineTag},#{score.examineCategory},#{score.createTime})
+    </foreach>
+    </insert>
 </mapper>
\ No newline at end of file
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml
index e685719..8445c62 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml
@@ -67,7 +67,7 @@
         delete from t_check_template_rule where check_template_id = #{templateId}
     </delete>
     <select id="selectListByTemplateId" resultType="com.ycl.platform.domain.entity.CheckTemplateRule">
-        select tctr.*,tcr.rule_name as checkRuleName from t_check_template_rule tctr
+        select tctr.*,tcr.rule_name as checkRuleName,tcr.rule_index from t_check_template_rule tctr
         left join t_check_rule tcr on tctr.check_rule_id = tcr.id
         where check_template_id = #{checkTemplateId}
     </select>

--
Gitblit v1.8.0