From 11d541c9a8ec391447bb00477027e9fc357b598d Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 04 九月 2024 18:45:45 +0800
Subject: [PATCH] 考核指标详情页面权限控制

---
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml                 |    1 
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java          |   25 ++--
 ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml                    |   94 +++++++++------
 ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java                      |   85 ++-----------
 ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java |   62 +++++++++
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java        |   33 ++--
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml                |    1 
 ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml               |    1 
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java         |   21 +-
 9 files changed, 174 insertions(+), 149 deletions(-)

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 31e99cf..8fb2927 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
@@ -3,10 +3,15 @@
 import annotation.Excel;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
 
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
+@Data
 public abstract class CheckIndex {
     @TableField("id")
     public Long id;
@@ -34,76 +39,18 @@
     public String examineTagStr;
     @TableField(exist = false)
     public List<Integer> deptIds;
-    public Long getId() {
-        return id;
-    }
 
-    public void setId(Long id) {
-        this.id = id;
-    }
+    /** 璇锋眰鍙傛暟 */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    @TableField(exist = false)
+    private Map<String, Object> params;
 
-    public String getDate() {
-        return date;
-    }
-
-    public void setDate(String date) {
-        this.date = date;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    public String getDeptName() {
-        return deptName;
-    }
-
-    public void setDeptName(String deptName) {
-        this.deptName = deptName;
-    }
-
-    public Short getExamineTag() {
-        return 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;
-    }
-
-    public String getExamineTagStr() {
-        return examineTagStr;
-    }
-
-    public void setExamineTagStr(String examineTagStr) {
-        this.examineTagStr = examineTagStr;
+    public Map<String, Object> getParams()
+    {
+        if (params == null)
+        {
+            params = new HashMap<>();
+        }
+        return params;
     }
 }
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 e7ce000..d7fda06 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
@@ -10,6 +10,7 @@
 import org.springframework.lang.NonNull;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.List;
 
 /**
@@ -68,22 +69,22 @@
     @TableField(exist = false)
     private List<String> quarter;
 
-
+    //杞崲鎴愬瓧绗︿覆鐢ㄤ簬excel瀵煎嚭
     public static CheckIndexCarVO getExcelVo(@NonNull CheckIndexCar checkIndexCar) {
         CheckIndexCarVO checkIndexCarVo = new CheckIndexCarVO();
         checkIndexCarVo.setDeptName(checkIndexCar.getDeptName());
-        checkIndexCarVo.setDate(checkIndexCar.getDate());
+        checkIndexCarVo.setCreateTime(checkIndexCar.getCreateTime());
         checkIndexCarVo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexCar.getExamineTag()) ? "鐪佸巺鑰冩牳" : "鍖哄幙鑰冩牳");
-        checkIndexCarVo.setSiteOnlineText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setVehicleCaptureAccuracyText(checkIndexCar.getVehicleCaptureAccuracy().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setDeviceDirectoryConsistentText(checkIndexCar.getDeviceDirectoryConsistent().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setVehicleCaptureIntegrityText(checkIndexCar.getVehicleCaptureIntegrity().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setVehicleTimingAccuracyText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setVehicleUploadTimelinessText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setViewConnectStabilityText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setVehicleUrlAvailabilityText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setVehiclePictureAvailabilityText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexCarVo.setVehicleInformationCollectionAccuracyText(checkIndexCar.getVehicleInformationCollectionAccuracy().multiply(new BigDecimal(100))+"%");
+        checkIndexCarVo.setSiteOnlineText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setVehicleCaptureAccuracyText(checkIndexCar.getVehicleCaptureAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setDeviceDirectoryConsistentText(checkIndexCar.getDeviceDirectoryConsistent().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setVehicleCaptureIntegrityText(checkIndexCar.getVehicleCaptureIntegrity().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setVehicleTimingAccuracyText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setVehicleUploadTimelinessText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setViewConnectStabilityText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setVehicleUrlAvailabilityText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setVehiclePictureAvailabilityText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexCarVo.setVehicleInformationCollectionAccuracyText(checkIndexCar.getVehicleInformationCollectionAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
         return checkIndexCarVo;
     }
 }
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 15867f8..3ae107b 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
@@ -12,6 +12,7 @@
 import org.springframework.lang.NonNull;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.Date;
 import java.util.List;
 
@@ -77,20 +78,20 @@
     @ExcelIgnore
     @TableField(exist = false)
     private List<String> quarter;
-
+    //杞崲鎴愬瓧绗︿覆鐢ㄤ簬excel瀵煎嚭
     public static CheckIndexFaceVO getExcelVo(@NonNull CheckIndexFace checkIndexFace) {
         CheckIndexFaceVO checkIndexFaceVo = new CheckIndexFaceVO();
         checkIndexFaceVo.setDeptName(checkIndexFace.getDeptName());
-        checkIndexFaceVo.setDate(checkIndexFace.getDate());
+        checkIndexFaceVo.setCreateTime(checkIndexFace.getCreateTime());
         checkIndexFaceVo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexFace.getExamineTag()) ? "鐪佸巺鑰冩牳" : "鍖哄幙鑰冩牳");
-        checkIndexFaceVo.setSiteOnlineText(checkIndexFace.getSiteOnline().multiply(new BigDecimal(100)) + "%");
-        checkIndexFaceVo.setFaceInformationCollectionAccuracyText(checkIndexFace.getFaceInformationCollectionAccuracy().multiply(new BigDecimal(100)) + "%");
-        checkIndexFaceVo.setFacePictureAvailabilityText(checkIndexFace.getFacePictureAvailability().multiply(new BigDecimal(100)) + "%");
-        checkIndexFaceVo.setDeviceDirectoryConsistentTextText(checkIndexFace.getDeviceDirectoryConsistent().multiply(new BigDecimal(100)) + "%");
-        checkIndexFaceVo.setFaceTimingAccuracyText(checkIndexFace.getFaceTimingAccuracy().multiply(new BigDecimal(100)) + "%");
-        checkIndexFaceVo.setFacePictureQualificationText(checkIndexFace.getFacePictureQualification().multiply(new BigDecimal(100)) + "%");
-        checkIndexFaceVo.setViewConnectStabilityText(checkIndexFace.getViewConnectStability().multiply(new BigDecimal(100)) + "%");
-        checkIndexFaceVo.setFaceUploadTimelinessText(checkIndexFace.getFaceUploadTimeliness().multiply(new BigDecimal(100)) + "%");
+        checkIndexFaceVo.setSiteOnlineText(checkIndexFace.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%");
+        checkIndexFaceVo.setFaceInformationCollectionAccuracyText(checkIndexFace.getFaceInformationCollectionAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%");
+        checkIndexFaceVo.setFacePictureAvailabilityText(checkIndexFace.getFacePictureAvailability().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%");
+        checkIndexFaceVo.setDeviceDirectoryConsistentTextText(checkIndexFace.getDeviceDirectoryConsistent().multiply(new BigDecimal(100)) .setScale(2, RoundingMode.HALF_UP)+ "%");
+        checkIndexFaceVo.setFaceTimingAccuracyText(checkIndexFace.getFaceTimingAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%");
+        checkIndexFaceVo.setFacePictureQualificationText(checkIndexFace.getFacePictureQualification().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%");
+        checkIndexFaceVo.setViewConnectStabilityText(checkIndexFace.getViewConnectStability().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%");
+        checkIndexFaceVo.setFaceUploadTimelinessText(checkIndexFace.getFaceUploadTimeliness().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%");
 
         return checkIndexFaceVo;
     }
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 1e94d59..d747433 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
@@ -12,6 +12,7 @@
 import org.springframework.lang.NonNull;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.Date;
 import java.util.List;
 
@@ -114,26 +115,26 @@
     @ExcelIgnore
     @TableField(exist = false)
     private List<String> quarter;
-
+    //杞崲鎴愬瓧绗︿覆鐢ㄤ簬excel瀵煎嚭
     public static CheckIndexVideoVO getExcelVo(@NonNull CheckIndexVideo checkIndexVideo) {
         CheckIndexVideoVO checkIndexVideoVO = new CheckIndexVideoVO();
         checkIndexVideoVO.setDeptName(checkIndexVideo.getDeptName());
-        checkIndexVideoVO.setDate(checkIndexVideo.getDate());
+        checkIndexVideoVO.setCreateTime(checkIndexVideo.getCreateTime());
         checkIndexVideoVO.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexVideo.getExamineTag()) ? "鐪佸巺鑰冩牳" : "鍖哄幙鑰冩牳");
-        checkIndexVideoVO.setSiteOnlineText(checkIndexVideo.getSiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setImageResourceSecurityText(checkIndexVideo.getImageResourceSecurity().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setArchivesRateText(checkIndexVideo.getArchivesRate().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setKeyAnnotationAccuracyText(checkIndexVideo.getKeyAnnotationAccuracy().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setKeyCommandImageOnlineText(checkIndexVideo.getKeyCommandImageOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setKeyVideoAvailableText(checkIndexVideo.getKeyVideoAvailable().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setKeySiteOnlineText(checkIndexVideo.getKeySiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setKeyTimingAccuracyText(checkIndexVideo.getKeyTimingAccuracy().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setMinistryVideoAvailableText(checkIndexVideo.getMinistryVideoAvailable().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setVideoAvailableText(checkIndexVideo.getVideoAvailable().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setMinistrySiteOnlineText(checkIndexVideo.getMinistrySiteOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setPlatformOnlineText(checkIndexVideo.getPlatformOnline().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setMonitorQualificationText(checkIndexVideo.getMonitorQualification().multiply(new BigDecimal(100))+"%");
-        checkIndexVideoVO.setMonitorRegistrationText(checkIndexVideo.getMonitorRegistration().multiply(new BigDecimal(100))+"%");
+        checkIndexVideoVO.setSiteOnlineText(checkIndexVideo.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setImageResourceSecurityText(checkIndexVideo.getImageResourceSecurity().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setArchivesRateText(checkIndexVideo.getArchivesRate().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setKeyAnnotationAccuracyText(checkIndexVideo.getKeyAnnotationAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setKeyCommandImageOnlineText(checkIndexVideo.getKeyCommandImageOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setKeyVideoAvailableText(checkIndexVideo.getKeyVideoAvailable().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setKeySiteOnlineText(checkIndexVideo.getKeySiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setKeyTimingAccuracyText(checkIndexVideo.getKeyTimingAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setMinistryVideoAvailableText(checkIndexVideo.getMinistryVideoAvailable().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setVideoAvailableText(checkIndexVideo.getVideoAvailable().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setMinistrySiteOnlineText(checkIndexVideo.getMinistrySiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setPlatformOnlineText(checkIndexVideo.getPlatformOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setMonitorQualificationText(checkIndexVideo.getMonitorQualification().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+        checkIndexVideoVO.setMonitorRegistrationText(checkIndexVideo.getMonitorRegistration().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%");
 
         return checkIndexVideoVO;
     }
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 49f85e4..eb9098a 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
@@ -2,7 +2,9 @@
 
 import annotation.DataScope;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+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;
@@ -19,6 +21,7 @@
 import com.ycl.platform.service.ICheckIndexFaceService;
 import com.ycl.platform.service.ICheckIndexVideoService;
 import com.ycl.platform.service.ICheckScoreService;
+import com.ycl.system.entity.BaseEntity;
 import com.ycl.system.entity.SysRole;
 import com.ycl.system.entity.SysUser;
 import com.ycl.system.service.ISysDeptService;
@@ -31,6 +34,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import pojo.ExcelExp;
 import utils.poi.ExcelUtilManySheet;
@@ -122,6 +126,8 @@
             scoreIndexDTO.setDate(formatter.format(createTime));
         }
 
+        //鏉冮檺鎺у埗
+        roleControl(scoreIndexDTO);
         List<Map> map = scoreMapper.selectScoreIndex(scoreIndexDTO);
 
         scoreMap.put("tableData", checkRules);
@@ -233,6 +239,7 @@
      * @return 缁撴灉
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public int publishCheckScore(CheckScoreDTO checkScoreDTO) {
         if (CollectionUtils.isEmpty(checkScoreDTO.getId())) {
             return 0;
@@ -245,8 +252,39 @@
         }
         String code = publishType.getCode();
         checkScoreDTO.setPublish(code);
-
-        return scoreMapper.publishCheckScore(checkScoreDTO);
+        int i = scoreMapper.publishCheckScore(checkScoreDTO);
+        //鎺у埗index琛ㄧ殑鍙戝竷鐘舵��
+        List<Integer> ids = checkScoreDTO.getId();
+        QueryWrapper<CheckScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id",ids);
+        List<CheckScore> scoreList = scoreMapper.selectList(queryWrapper);
+        //鏈�澶氫负3娆″惊鐜�
+        for (CheckScore checkScore : scoreList) {
+            Short examineCategory = checkScore.getExamineCategory();
+            if(CheckConstants.Rule_Category_Video.equals(examineCategory)){
+                UpdateWrapper<CheckIndexVideo> updateWrapper = new UpdateWrapper<>();
+                updateWrapper.set("publish",code);
+                updateWrapper.eq("dept_id",checkScore.getDeptId());
+                updateWrapper.eq("examine_tag",checkScore.getExamineTag());
+                updateWrapper.between("create_time",DateUtils.getDayStart(checkScore.getCreateTime()),DateUtils.getDayEnd(checkScore.getCreateTime()));
+                indexVideoService.update(updateWrapper);
+            }else if(CheckConstants.Rule_Category_Car.equals(examineCategory)){
+                UpdateWrapper<CheckIndexCar> updateWrapper = new UpdateWrapper<>();
+                updateWrapper.set("publish",code);
+                updateWrapper.eq("dept_id",checkScore.getDeptId());
+                updateWrapper.eq("examine_tag",checkScore.getExamineTag());
+                updateWrapper.between("create_time",DateUtils.getDayStart(checkScore.getCreateTime()),DateUtils.getDayEnd(checkScore.getCreateTime()));
+                indexCarService.update(updateWrapper);
+            }else if(CheckConstants.Rule_Category_Face.equals(examineCategory)){
+                UpdateWrapper<CheckIndexFace> updateWrapper = new UpdateWrapper<>();
+                updateWrapper.set("publish",code);
+                updateWrapper.eq("dept_id",checkScore.getDeptId());
+                updateWrapper.eq("examine_tag",checkScore.getExamineTag());
+                updateWrapper.between("create_time",DateUtils.getDayStart(checkScore.getCreateTime()),DateUtils.getDayEnd(checkScore.getCreateTime()));
+                indexFaceService.update(updateWrapper);
+            }
+        }
+        return i;
     }
 
     /**
@@ -271,6 +309,8 @@
         CheckIndexCar checkIndexCar = new CheckIndexCar();
         checkIndexCar.setDate(date);
         checkIndexCar.setQuarter(checkScoreDTO.getQuarter());
+        //鏉冮檺鎺у埗 鍙兘鏌ョ湅宸插彂甯�
+        roleControl(checkIndexCar);
         List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar);
         List<CheckIndexCarVO> checkIndexCarVOS = new ArrayList<>();
         for (CheckIndexCar indexCar : checkIndexCars) {
@@ -282,6 +322,8 @@
         CheckIndexFace checkIndexFace = new CheckIndexFace();
         checkIndexFace.setDate(date);
         checkIndexFace.setQuarter(checkScoreDTO.getQuarter());
+        //鏉冮檺鎺у埗 鍙兘鏌ョ湅宸插彂甯�
+        roleControl(checkIndexFace);
         List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace);
         List<CheckIndexFaceVO> checkIndexFaceVOS = new ArrayList<>();
         for (CheckIndexFace indexFace : checkIndexFaces) {
@@ -293,6 +335,8 @@
         CheckIndexVideo checkIndexVideo = new CheckIndexVideo();
         checkIndexVideo.setDate(date);
         checkIndexVideo.setQuarter(checkScoreDTO.getQuarter());
+        //鏉冮檺鎺у埗 鍙兘鏌ョ湅宸插彂甯�
+        roleControl(checkIndexVideo);
         List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo);
         List<CheckIndexVideoVO> checkIndexVideoVOS = new ArrayList<>();
         for (CheckIndexVideo indexVideo : checkIndexVideos) {
@@ -310,7 +354,19 @@
 
     }
 
-    private void roleControl(CheckScore checkScore) {
+    private void roleControl(CheckIndex checkIndex) {
+        List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if (!user.isAdmin()) {
+            for (SysRole role : roles) {
+                if (role.getPermissions().contains("check:score:role:publish")) {
+                    Map<String, Object> params = checkIndex.getParams();
+                    params.put("publish", PublishType.PUBLISHED.getCode());
+                }
+            }
+        }
+    }
+    private void roleControl(BaseEntity checkScore) {
         List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
         SysUser user = SecurityUtils.getLoginUser().getUser();
         if (!user.isAdmin()) {
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
index 0564240..7f624f8 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
@@ -43,6 +43,7 @@
             <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="params.publish != null  and params.publish != ''">and publish = #{params.publish}</if>
             <if test="deptIds != null ">and tcic.dept_id in
                 <foreach collection="deptIds" separator="," open="(" close=")" item="deptId">
                     #{deptId}
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
index 8570bc1..01203f4 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
@@ -39,6 +39,7 @@
             <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="params.publish != null  and params.publish != ''">and publish = #{params.publish}</if>
             <if test="deptIds != null ">and tcif.dept_id in
                 <foreach collection="deptIds" separator="," open="(" close=")" item="deptId">
                     #{deptId}
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
index d9428bf..eb5d13e 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
@@ -52,6 +52,7 @@
             <if test="keyTimingAccuracy != null "> and key_timing_accuracy = #{keyTimingAccuracy}</if>
             <if test="keyCommandImageOnline != null "> and key_command_image_online = #{keyCommandImageOnline}</if>
             <if test="imageResourceSecurity != null "> and image_resource_security = #{imageResourceSecurity}</if>
+            <if test="params.publish != null  and params.publish != ''">and publish = #{params.publish}</if>
             <if test="deptIds != null ">and tciv.dept_id in
             <foreach collection="deptIds" separator="," open="(" close=")" item="deptId">
                 #{deptId}
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
index df07d02..bede2bc 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
@@ -18,9 +18,18 @@
     </resultMap>
 
     <sql id="selectCheckScoreVo">
-        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
+        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">
@@ -87,7 +96,9 @@
     </update>
 
     <delete id="deleteCheckScoreById" parameterType="Long">
-        delete from t_check_score where id = #{id}
+        delete
+        from t_check_score
+        where id = #{id}
     </delete>
 
     <delete id="deleteCheckScoreByIds" parameterType="String">
@@ -107,17 +118,22 @@
     <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}
-        <if test="examineTag != null">
-            and examine_tag = #{examineTag}
-        </if>
-        <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}
+        <where>
+            t.dept_id = #{deptId}
+            <if test="examineTag != null">
+                and examine_tag = #{examineTag}
+            </if>
+            <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>
+            <if test="params.publish != null  and params.publish != ''">
+                and publish = #{params.publish}
+            </if>
+            ${params.dataScope}
+        </where>
     </select>
 
     <insert id="saveBatch">
@@ -140,15 +156,16 @@
         LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id
         <where>
             examine_tag = #{examineTag}
-            AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m')
+            AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND
+            DATE_FORMAT(#{endDate}, '%Y-%m')
             <if test="params.publish != null  and params.publish != ''">and publish = #{params.publish}</if>
             ${params.dataScope}
         </where>
---         GROUP BY tcs.dept_id, tcs.examine_category, tcs.examine_tag
+        -- GROUP BY tcs.dept_id, tcs.examine_category, tcs.examine_tag
     </select>
 
     <select id="getLast" resultType="com.ycl.platform.domain.entity.CheckScore">
-        select * from t_check_score tcs  LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id
+        select * from t_check_score tcs LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id
         <where>
             tcs.examine_tag = #{examineTag}
             <if test="params.publish != null  and params.publish != ''">and tcs.publish = #{params.publish}</if>
@@ -158,33 +175,32 @@
     </select>
     <select id="home" resultType="java.util.Map">
         <![CDATA[
-        SELECT
-            DATE_FORMAT(cs.create_time, '%Y-%m-%d %h:%i:%s') AS createTime,
-            d.area,
-            CASE WHEN cs.examine_tag = '0' THEN '鐪佸巺' WHEN cs.examine_tag = '1' THEN '甯傚眬' WHEN cs.examine_tag = '2' THEN '' END AS examineTag,
-            ct.template_name AS templateName,
-            cs.score
-        FROM
-            t_check_score cs
-                LEFT JOIN t_check_template ct ON cs.template_id = ct.id
-                LEFT JOIN sys_dept d ON cs.dept_id = d.dept_id
+        SELECT DATE_FORMAT(cs.create_time, '%Y-%m-%d %h:%i:%s') AS createTime,
+               d.area,
+               CASE
+                   WHEN cs.examine_tag = '0' THEN '鐪佸巺'
+                   WHEN cs.examine_tag = '1' THEN '甯傚眬'
+                   WHEN cs.examine_tag = '2' THEN '' END        AS examineTag,
+               ct.template_name                                 AS templateName,
+               cs.score
+        FROM t_check_score cs
+                 LEFT JOIN t_check_template ct ON cs.template_id = ct.id
+                 LEFT JOIN sys_dept d ON cs.dept_id = d.dept_id
         WHERE cs.score < ct.alarm_score
         ORDER BY cs.create_time DESC
         ]]>
     </select>
 
     <select id="calculate" resultType="java.util.Map">
-        SELECT
-        area AS deptName,
-        ROUND(AVG(score)) AS score
-        FROM
-        t_check_score tcs
-        LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id
-        WHERE
-        examine_tag = 1
-        AND examine_category = #{category}
-        AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate},
-        '%Y-%m')
+        SELECT area              AS deptName,
+               ROUND(AVG(score)) AS score
+        FROM t_check_score tcs
+                 LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id
+        WHERE examine_tag = 1
+          AND examine_category = #{category}
+          AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(
+                #{endDate},
+                '%Y-%m')
         GROUP BY tcs.dept_id
         ORDER BY score DESC, tcs.dept_id
     </select>

--
Gitblit v1.8.0