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; } } 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; } } 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; } 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; } 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()) { 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} 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} 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} 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>