ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -21,25 +22,34 @@ //查询条件,日期 @TableField(exist = false) public String day; @Excel(name = "日期",dateFormat = "yyyy-MM-dd") @TableField("create_time") public Date createTime; @TableField("dept_id") public Long deptId; @Excel(name = "区县") @TableField(exist = false) public String deptName; /** 考核标签(省厅/市局) */ @TableField("examine_tag") public Short examineTag; @TableField("create_time") public Date createTime; @Excel(name = "日期") @TableField(exist = false) public String createTimeStr; @Excel(name = "区县") @TableField(exist = false) public String deptName; @Excel(name = "考核标签") @TableField(exist = false) public String examineTagStr; /** 得分 */ @Excel(name = "得分") @TableField(exist = false) private BigDecimal score; @TableField(exist = false) public List<Integer> deptIds; @TableField(exist = false) public List<Integer> examineTags; @TableField(exist = false) public List<Integer> examineCategories; /** 请求参数 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) @TableField(exist = false) ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckResultExportDTO.java
New file @@ -0,0 +1,24 @@ package com.ycl.platform.domain.dto; import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; import java.util.List; @Data public class CheckResultExportDTO { private String date; /** 时间范围 */ private List<String> quarter; /** 积分id 用于详情页导出*/ private Long id; /** 部门id 用于详情页导出*/ private Long deptId; /** 部门ids 用于卡片页导出 */ private List<Integer> deptIds; /** 考核标签0/1 省厅/市局 用于卡片页导出 */ private List<Integer> examineTags; /** 是否需要平均值 用于卡片页导出 */ private Boolean average; } ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
@@ -8,9 +8,11 @@ import constant.CheckConstants; import lombok.Data; import org.springframework.lang.NonNull; import utils.StringUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.List; /** @@ -21,47 +23,66 @@ */ @Data @TableName("t_check_index_car") public class CheckIndexCar extends CheckIndex { public class CheckIndexCar extends CheckIndex { private static final long serialVersionUID = 1L; /** 视图库对接稳定性 */ /** * 视图库对接稳定性 */ @TableField("view_connect_stability") private BigDecimal viewConnectStability; /** 点位在线率 */ /** * 点位在线率 */ @TableField("site_online") private BigDecimal siteOnline; /** 联网卡口设备目录一致率 */ /** * 联网卡口设备目录一致率 */ @TableField("device_directory_consistent") private BigDecimal deviceDirectoryConsistent; /** 车辆卡口信息采集准确率 */ /** * 车辆卡口信息采集准确率 */ @TableField("vehicle_information_collection_accuracy") private BigDecimal vehicleInformationCollectionAccuracy; /** 车辆卡口设备抓拍数据完整性 */ /** * 车辆卡口设备抓拍数据完整性 */ @TableField("vehicle_capture_integrity") private BigDecimal vehicleCaptureIntegrity; /** 车辆卡口设备抓拍数据准确性 */ /** * 车辆卡口设备抓拍数据准确性 */ @TableField("vehicle_capture_accuracy") private BigDecimal vehicleCaptureAccuracy; /** 车辆卡口设备时钟准确性 */ /** * 车辆卡口设备时钟准确性 */ @TableField("vehicle_timing_accuracy") private BigDecimal vehicleTimingAccuracy; /** 车辆卡口设备抓拍数据上传及时性 */ /** * 车辆卡口设备抓拍数据上传及时性 */ @TableField("vehicle_upload_timeliness") private BigDecimal vehicleUploadTimeliness; /** 车辆卡口设备url可用性 */ /** * 车辆卡口设备url可用性 */ @TableField("vehicle_url_availability") private BigDecimal vehicleUrlAvailability; /** 车辆卡口设备抓拍数据大图可用性 */ /** * 车辆卡口设备抓拍数据大图可用性 */ @TableField("vehicle_picture_availability") private BigDecimal vehiclePictureAvailability; @@ -72,19 +93,72 @@ //转换成字符串用于excel导出 public static CheckIndexCarVO getExcelVo(@NonNull CheckIndexCar checkIndexCar) { CheckIndexCarVO checkIndexCarVo = new CheckIndexCarVO(); checkIndexCarVo.setScore(checkIndexCar.getScore()); checkIndexCarVo.setDeptName(checkIndexCar.getDeptName()); checkIndexCarVo.setCreateTime(checkIndexCar.getCreateTime()); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); //避免合计行报错(合计数据 缺少createTimeStr字段 直接将createTimeStr设置为"合计") if (StringUtils.isEmpty(checkIndexCar.getCreateTimeStr())) { checkIndexCarVo.setCreateTimeStr(format.format(checkIndexCar.getCreateTime())); }else { checkIndexCarVo.setCreateTimeStr(checkIndexCar.getCreateTimeStr()); } checkIndexCarVo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexCar.getExamineTag()) ? "省厅考核" : "区县考核"); 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)+"%"); 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; } /** * 导出时用于计算平均值 */ public static CheckIndexCar calculateAverage(List<CheckIndexCar> checkIndexCars) { BigDecimal scoreSum = BigDecimal.ZERO; BigDecimal viewConnectStabilitySum = BigDecimal.ZERO; BigDecimal siteOnlineSum = BigDecimal.ZERO; BigDecimal deviceDirectoryConsistentSum = BigDecimal.ZERO; BigDecimal vehicleInformationCollectionAccuracySum = BigDecimal.ZERO; BigDecimal vehicleCaptureIntegritySum = BigDecimal.ZERO; BigDecimal vehicleCaptureAccuracySum = BigDecimal.ZERO; BigDecimal vehicleTimingAccuracySum = BigDecimal.ZERO; BigDecimal vehicleUploadTimelinessSum = BigDecimal.ZERO; BigDecimal vehicleUrlAvailabilitySum = BigDecimal.ZERO; BigDecimal vehiclePictureAvailabilitySum = BigDecimal.ZERO; for (CheckIndexCar car : checkIndexCars) { scoreSum = scoreSum.add(car.getScore() == null ? BigDecimal.ZERO : car.getScore()); viewConnectStabilitySum = viewConnectStabilitySum.add(car.getViewConnectStability()); siteOnlineSum = siteOnlineSum.add(car.getSiteOnline()); deviceDirectoryConsistentSum = deviceDirectoryConsistentSum.add(car.getDeviceDirectoryConsistent()); vehicleInformationCollectionAccuracySum = vehicleInformationCollectionAccuracySum.add(car.getVehicleInformationCollectionAccuracy()); vehicleCaptureIntegritySum = vehicleCaptureIntegritySum.add(car.getVehicleCaptureIntegrity()); vehicleCaptureAccuracySum = vehicleCaptureAccuracySum.add(car.getVehicleCaptureAccuracy()); vehicleTimingAccuracySum = vehicleTimingAccuracySum.add(car.getVehicleTimingAccuracy()); vehicleUploadTimelinessSum = vehicleUploadTimelinessSum.add(car.getVehicleUploadTimeliness()); vehicleUrlAvailabilitySum = vehicleUrlAvailabilitySum.add(car.getVehicleUrlAvailability()); vehiclePictureAvailabilitySum = vehiclePictureAvailabilitySum.add(car.getVehiclePictureAvailability()); } CheckIndexCar checkIndexCar = new CheckIndexCar(); checkIndexCar.setCreateTimeStr("合计"); checkIndexCar.setDeptName(checkIndexCars.get(0).getDeptName()); checkIndexCar.setExamineTag(checkIndexCars.get(0).getExamineTag()); checkIndexCar.setScore(scoreSum); checkIndexCar.setViewConnectStability(viewConnectStabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setSiteOnline(siteOnlineSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setDeviceDirectoryConsistent(deviceDirectoryConsistentSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setVehicleInformationCollectionAccuracy(vehicleInformationCollectionAccuracySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setVehicleCaptureIntegrity(vehicleCaptureIntegritySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setVehicleCaptureAccuracy(vehicleCaptureAccuracySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setVehicleTimingAccuracy(vehicleTimingAccuracySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setVehicleUploadTimeliness(vehicleUploadTimelinessSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setVehicleUrlAvailability(vehicleUrlAvailabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); checkIndexCar.setVehiclePictureAvailability(vehiclePictureAvailabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); return checkIndexCar; } } ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
@@ -10,9 +10,11 @@ import constant.CheckConstants; import lombok.Data; import org.springframework.lang.NonNull; import utils.StringUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -81,8 +83,15 @@ //转换成字符串用于excel导出 public static CheckIndexFaceVO getExcelVo(@NonNull CheckIndexFace checkIndexFace) { CheckIndexFaceVO checkIndexFaceVo = new CheckIndexFaceVO(); checkIndexFaceVo.setScore(checkIndexFace.getScore()); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); //避免合计行报错(合计数据 缺少createTimeStr字段 直接将createTimeStr设置为"合计") if (StringUtils.isEmpty(checkIndexFace.getCreateTimeStr())) { checkIndexFaceVo.setCreateTimeStr(format.format(checkIndexFace.getCreateTime())); }else { checkIndexFaceVo.setCreateTimeStr(checkIndexFace.getCreateTimeStr()); } checkIndexFaceVo.setDeptName(checkIndexFace.getDeptName()); checkIndexFaceVo.setCreateTime(checkIndexFace.getCreateTime()); checkIndexFaceVo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexFace.getExamineTag()) ? "省厅考核" : "区县考核"); 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) + "%"); @@ -95,4 +104,44 @@ return checkIndexFaceVo; } /** 用于导出计算平均值 */ public static CheckIndexFace calculateAverage(List<CheckIndexFace> checkIndexFaces) { BigDecimal scoreSum = BigDecimal.ZERO; BigDecimal totalViewConnectStability = BigDecimal.ZERO; BigDecimal totalSiteOnline = BigDecimal.ZERO; BigDecimal totalDeviceDirectoryConsistent = BigDecimal.ZERO; BigDecimal totalFaceInformationCollectionAccuracy = BigDecimal.ZERO; BigDecimal totalFacePictureQualification = BigDecimal.ZERO; BigDecimal totalFaceTimingAccuracy = BigDecimal.ZERO; BigDecimal totalFaceUploadTimeliness = BigDecimal.ZERO; BigDecimal totalFacePictureAvailability = BigDecimal.ZERO; int count = checkIndexFaces.size(); for (CheckIndexFace indexFace : checkIndexFaces) { scoreSum = scoreSum.add(indexFace.getScore() == null ? BigDecimal.ZERO : indexFace.getScore()); totalViewConnectStability = totalViewConnectStability.add(indexFace.getViewConnectStability()); totalSiteOnline = totalSiteOnline.add(indexFace.getSiteOnline()); totalDeviceDirectoryConsistent = totalDeviceDirectoryConsistent.add(indexFace.getDeviceDirectoryConsistent()); totalFaceInformationCollectionAccuracy = totalFaceInformationCollectionAccuracy.add(indexFace.getFaceInformationCollectionAccuracy()); totalFacePictureQualification = totalFacePictureQualification.add(indexFace.getFacePictureQualification()); totalFaceTimingAccuracy = totalFaceTimingAccuracy.add(indexFace.getFaceTimingAccuracy()); totalFaceUploadTimeliness = totalFaceUploadTimeliness.add(indexFace.getFaceUploadTimeliness()); totalFacePictureAvailability = totalFacePictureAvailability.add(indexFace.getFacePictureAvailability()); } CheckIndexFace result = new CheckIndexFace(); result.setCreateTimeStr("合计"); result.setDeptName(checkIndexFaces.get(0).getDeptName()); result.setExamineTag(checkIndexFaces.get(0).getExamineTag()); result.setScore(scoreSum); result.setViewConnectStability(totalViewConnectStability.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); result.setSiteOnline(totalSiteOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); result.setDeviceDirectoryConsistent(totalDeviceDirectoryConsistent.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); result.setFaceInformationCollectionAccuracy(totalFaceInformationCollectionAccuracy.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); result.setFacePictureQualification(totalFacePictureQualification.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); result.setFaceTimingAccuracy(totalFaceTimingAccuracy.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); result.setFaceUploadTimeliness(totalFaceUploadTimeliness.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); result.setFacePictureAvailability(totalFacePictureAvailability.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); return result; } } ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
@@ -10,9 +10,11 @@ import constant.CheckConstants; import lombok.Data; import org.springframework.lang.NonNull; import utils.StringUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -100,7 +102,7 @@ private BigDecimal keyTimingAccuracy; /** * 重点指挥图像在线率 * 重点指挥图像在线率 */ @TableField("key_command_image_online") private BigDecimal keyCommandImageOnline; @@ -115,27 +117,98 @@ @ExcelIgnore @TableField(exist = false) private List<String> quarter; //转换成字符串用于excel导出 public static CheckIndexVideoVO getExcelVo(@NonNull CheckIndexVideo checkIndexVideo) { CheckIndexVideoVO checkIndexVideoVO = new CheckIndexVideoVO(); checkIndexVideoVO.setScore(checkIndexVideo.getScore()); checkIndexVideoVO.setDeptName(checkIndexVideo.getDeptName()); checkIndexVideoVO.setCreateTime(checkIndexVideo.getCreateTime()); //避免合计行报错(合计数据 缺少createTimeStr字段 直接将createTimeStr设置为"合计") if (StringUtils.isEmpty(checkIndexVideo.getCreateTimeStr())) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); checkIndexVideoVO.setCreateTimeStr(format.format(checkIndexVideo.getCreateTime())); }else { checkIndexVideoVO.setCreateTimeStr(checkIndexVideo.getCreateTimeStr()); } checkIndexVideoVO.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexVideo.getExamineTag()) ? "省厅考核" : "区县考核"); 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)+"%"); 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; } /** * 用于导出计算平均值 */ public static CheckIndexVideo calculateAverage(List<CheckIndexVideo> videos) { BigDecimal scoreSum = BigDecimal.ZERO; BigDecimal totalPlatformOnline = BigDecimal.ZERO; BigDecimal totalMonitorQualification = BigDecimal.ZERO; BigDecimal totalMonitorRegistration = BigDecimal.ZERO; BigDecimal totalArchivesRate = BigDecimal.ZERO; BigDecimal totalSiteOnline = BigDecimal.ZERO; BigDecimal totalVideoAvailable = BigDecimal.ZERO; BigDecimal totalMinistrySiteOnline = BigDecimal.ZERO; BigDecimal totalMinistryVideoAvailable = BigDecimal.ZERO; BigDecimal totalKeySiteOnline = BigDecimal.ZERO; BigDecimal totalKeyVideoAvailable = BigDecimal.ZERO; BigDecimal totalKeyAnnotationAccuracy = BigDecimal.ZERO; BigDecimal totalKeyTimingAccuracy = BigDecimal.ZERO; BigDecimal totalKeyCommandImageOnline = BigDecimal.ZERO; BigDecimal totalImageResourceSecurity = BigDecimal.ZERO; int count = videos.size(); for (CheckIndexVideo video : videos) { scoreSum = scoreSum.add(video.getScore() == null ? BigDecimal.ZERO : video.getScore()); totalPlatformOnline = totalPlatformOnline.add(video.getPlatformOnline()); totalMonitorQualification = totalMonitorQualification.add(video.getMonitorQualification()); totalMonitorRegistration = totalMonitorRegistration.add(video.getMonitorRegistration()); totalArchivesRate = totalArchivesRate.add(video.getArchivesRate()); totalSiteOnline = totalSiteOnline.add(video.getSiteOnline()); totalVideoAvailable = totalVideoAvailable.add(video.getVideoAvailable()); totalMinistrySiteOnline = totalMinistrySiteOnline.add(video.getMinistrySiteOnline()); totalMinistryVideoAvailable = totalMinistryVideoAvailable.add(video.getMinistryVideoAvailable()); totalKeySiteOnline = totalKeySiteOnline.add(video.getKeySiteOnline()); totalKeyVideoAvailable = totalKeyVideoAvailable.add(video.getKeyVideoAvailable()); totalKeyAnnotationAccuracy = totalKeyAnnotationAccuracy.add(video.getKeyAnnotationAccuracy()); totalKeyTimingAccuracy = totalKeyTimingAccuracy.add(video.getKeyTimingAccuracy()); totalKeyCommandImageOnline = totalKeyCommandImageOnline.add(video.getKeyCommandImageOnline()); totalImageResourceSecurity = totalImageResourceSecurity.add(video.getImageResourceSecurity()); } // 创建一个新的CheckIndexVideo对象并设置平均值 CheckIndexVideo averageVideo = new CheckIndexVideo(); averageVideo.setCreateTimeStr("合计"); averageVideo.setDeptName(videos.get(0).getDeptName()); averageVideo.setExamineTag(videos.get(0).getExamineTag()); averageVideo.setScore(scoreSum); averageVideo.setPlatformOnline(totalPlatformOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setMonitorQualification(totalMonitorQualification.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setMonitorRegistration(totalMonitorRegistration.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setArchivesRate(totalArchivesRate.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setSiteOnline(totalSiteOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setVideoAvailable(totalVideoAvailable.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setMinistrySiteOnline(totalMinistrySiteOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setMinistryVideoAvailable(totalMinistryVideoAvailable.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setKeySiteOnline(totalKeySiteOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setKeyVideoAvailable(totalKeyVideoAvailable.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setKeyAnnotationAccuracy(totalKeyAnnotationAccuracy.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setKeyTimingAccuracy(totalKeyTimingAccuracy.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setKeyCommandImageOnline(totalKeyCommandImageOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); averageVideo.setImageResourceSecurity(totalImageResourceSecurity.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP)); return averageVideo; } } ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java
@@ -13,7 +13,7 @@ /** * 考核积分明细对象 t_check_score * * * @author ruoyi * @date 2024-04-22 */ @@ -31,6 +31,7 @@ @Excel(name = "分值") private BigDecimal score; /** deptid */ @Excel(name = "区县") private Long deptId; @@ -38,7 +39,8 @@ /** 考核模板id */ @Excel(name = "考核模板id") private Integer templateId; /** 对应check_index_表id */ private Long indexId; /** 考核标签(省厅/市局) */ @Excel(name = "考核标签(省厅/市局)") private Integer examineTag; ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexCarVO.java
@@ -3,8 +3,12 @@ import annotation.Excel; import com.ycl.platform.base.CheckIndex; import lombok.Data; import java.math.BigDecimal; @Data public class CheckIndexCarVO extends CheckIndex { /** 视图库对接稳定性 */ @Excel(name = "视图库对接稳定性") private String viewConnectStabilityText; ycl-pojo/src/main/java/com/ycl/platform/domain/vo/RuleExcelVO.java
New file @@ -0,0 +1,33 @@ package com.ycl.platform.domain.vo; import annotation.Excel; import lombok.Data; import java.math.BigDecimal; @Data public class RuleExcelVO { /** 规则id */ private Integer ruleId; /** 考核类别 */ private Integer examineCategory; /** 考核标签 */ private Integer examineTag; /** 权重 */ private BigDecimal weight; /** 模板名 */ @Excel(name = "模板名") private String templateName; /** 规则名 */ @Excel(name = "规则名",width = 25) private String ruleName; /** 权重 */ @Excel(name = "省厅考核权重") private BigDecimal provinceWeight; /** 权重 */ @Excel(name = "区县考核权重") private BigDecimal countyWeight; /** 规则描述 */ @Excel(name = "规则描述",width = 200,height = 25) private String ruleDescription; } ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
@@ -1,6 +1,7 @@ package com.ycl.platform.controller; import annotation.Log; import com.ycl.platform.domain.dto.CheckResultExportDTO; import com.ycl.platform.domain.dto.CheckScoreDTO; import com.ycl.platform.domain.dto.CheckScoreIndexDTO; import com.ycl.platform.domain.entity.CheckScore; @@ -8,6 +9,7 @@ import com.ycl.system.AjaxResult; import com.ycl.system.controller.BaseController; import com.ycl.system.page.TableDataInfo; import com.ycl.utils.SecurityUtils; import enumeration.BusinessType; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; @@ -88,13 +90,28 @@ } /** * 导出考核积分列表 * 详情页导出考核积分列表 */ @PreAuthorize("@ss.hasPermi('check:score:export')") @Log(title = "导出考核积分", businessType = BusinessType.EXPORT) @Log(title = "详情页导出考核积分", businessType = BusinessType.EXPORT) @PostMapping("/detailExport") @PreAuthorize("@ss.hasPermi('check:result:detail:export')") //共用的一个方法用checkScore接参,new对象的方式防护。 public void detailExport(HttpServletResponse response, CheckScore checkScore) throws IOException { CheckResultExportDTO exportDTO = new CheckResultExportDTO(); exportDTO.setDate(checkScore.getDate()); exportDTO.setQuarter(checkScore.getQuarter()); exportDTO.setDeptId(checkScore.getDeptId()); exportDTO.setId(checkScore.getId()); checkScoreService.exportIndex(response,exportDTO); } /** * 卡片页导出考核积分列表 */ @PreAuthorize("@ss.hasPermi('check:result:export')") @Log(title = "卡片页导出考核积分", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CheckScore checkScore) throws IOException { checkScoreService.exportIndex(response,checkScore); public void export(HttpServletResponse response, CheckResultExportDTO exportDTO) throws IOException { checkScoreService.exportIndex(response,exportDTO); } // /** // * 新增考核积分 ycl-server/src/main/java/com/ycl/platform/mapper/CheckTemplateRuleMapper.java
@@ -2,12 +2,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ycl.platform.domain.entity.CheckTemplateRule; import com.ycl.platform.domain.vo.RuleExcelVO; import java.util.List; /** * 考核模板-规则中间Mapper接口 * * * @author ruoyi * @date 2024-04-01 */ @@ -15,7 +16,7 @@ { /** * 查询考核模板-规则中间 * * * @param id 考核模板-规则中间主键 * @return 考核模板-规则中间 */ @@ -23,7 +24,7 @@ /** * 查询考核模板-规则中间列表 * * * @param checkTemplateRule 考核模板-规则中间 * @return 考核模板-规则中间集合 */ @@ -31,7 +32,7 @@ /** * 新增考核模板-规则中间 * * * @param checkTemplateRule 考核模板-规则中间 * @return 结果 */ @@ -39,7 +40,7 @@ /** * 修改考核模板-规则中间 * * * @param checkTemplateRule 考核模板-规则中间 * @return 结果 */ @@ -47,7 +48,7 @@ /** * 删除考核模板-规则中间 * * * @param id 考核模板-规则中间主键 * @return 结果 */ @@ -55,7 +56,7 @@ /** * 批量删除考核模板-规则中间 * * * @param ids 需要删除的数据主键集合 * @return 结果 */ @@ -64,4 +65,6 @@ List<CheckTemplateRule> selectListByTemplateId(Integer id); void deleteByTemplateId(Integer templateId); List<RuleExcelVO> getAllRuleTemplate(); } ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java
@@ -1,6 +1,7 @@ package com.ycl.platform.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.platform.domain.dto.CheckResultExportDTO; import com.ycl.platform.domain.dto.CheckScoreDTO; import com.ycl.platform.domain.dto.CheckScoreIndexDTO; import com.ycl.platform.domain.entity.CheckScore; @@ -13,7 +14,7 @@ /** * 考核积分明细Service接口 * * * @author ruoyi * @date 2024-04-22 */ @@ -21,7 +22,7 @@ { /** * 查询考核积分明细 * * * @param * @return 考核积分明细 */ @@ -29,7 +30,7 @@ /** * 查询考核积分明细列表 * * * @param checkScore 考核积分明细 * @return 考核积分明细集合 */ @@ -48,7 +49,7 @@ List<CheckScore> page(CheckScore checkScore); void exportIndex(HttpServletResponse response,CheckScore checkScore) throws IOException; void exportIndex(HttpServletResponse response, CheckResultExportDTO exportDTO) throws IOException; /** * 首页考核预警 ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -5,14 +5,12 @@ 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.CheckResultExportDTO; 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.CheckIndexCarVO; import com.ycl.platform.domain.vo.CheckIndexFaceVO; import com.ycl.platform.domain.vo.CheckIndexVideoVO; import com.ycl.platform.domain.vo.CheckScoreDetailVO; import com.ycl.platform.domain.vo.*; import com.ycl.platform.mapper.CheckRuleMapper; import com.ycl.platform.mapper.CheckScoreMapper; import com.ycl.platform.mapper.CheckTemplateMapper; @@ -40,9 +38,12 @@ import utils.poi.ExcelUtilManySheet; import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; /** @@ -71,6 +72,7 @@ @Autowired private ISysDeptService deptService; /** * 查询考核积分指标 * @@ -88,10 +90,10 @@ Integer templateId = 0; //方便切换改为:根据score考核类别和dto考核标签查模板规则和权重,注意同种类同标签只能有一个模板 QueryWrapper<CheckTemplate> wrapper = new QueryWrapper<>(); wrapper.eq("examine_tag",checkScoreIndexDTO.getExamineTag()); wrapper.eq("examine_category",checkScore.getExamineCategory()); wrapper.eq("examine_tag", checkScoreIndexDTO.getExamineTag()); wrapper.eq("examine_category", checkScore.getExamineCategory()); Optional<CheckTemplate> first = templateMapper.selectList(wrapper).stream().findFirst(); if(first.isPresent()){ if (first.isPresent()) { CheckTemplate checkTemplate = first.get(); templateId = checkTemplate.getId(); } @@ -256,31 +258,25 @@ //控制index表的发布状态 List<Integer> ids = checkScoreDTO.getId(); QueryWrapper<CheckScore> queryWrapper = new QueryWrapper<>(); queryWrapper.in("id",ids); 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)){ 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())); updateWrapper.set("publish", code); updateWrapper.eq("id", checkScore.getIndexId()); indexVideoService.update(updateWrapper); }else if(CheckConstants.Rule_Category_Car.equals(examineCategory)){ } 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())); updateWrapper.set("publish", code); updateWrapper.eq("id", checkScore.getIndexId()); indexCarService.update(updateWrapper); }else if(CheckConstants.Rule_Category_Face.equals(examineCategory)){ } 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())); updateWrapper.set("publish", code); updateWrapper.eq("id", checkScore.getIndexId()); indexFaceService.update(updateWrapper); } } @@ -294,24 +290,47 @@ * @return 考核积分 */ @Override public void exportIndex(HttpServletResponse response, CheckScore checkScoreDTO) throws IOException { String date = checkScoreDTO.getDate(); public void exportIndex(HttpServletResponse response, CheckResultExportDTO exportDTO) throws IOException { String date = exportDTO.getDate(); //如果请求参数时间为空,查这条记录的时间 if (StringUtils.isEmpty(checkScoreDTO.getDate()) && CollectionUtils.isEmpty(checkScoreDTO.getQuarter())) { CheckScore checkScore = getById(checkScoreDTO.getId()); Date createTime = checkScore.getCreateTime(); if (StringUtils.isEmpty(exportDTO.getDate()) && CollectionUtils.isEmpty(exportDTO.getQuarter())) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); date = formatter.format(createTime); if (exportDTO.getId() != null) { CheckScore checkScore = getById(exportDTO.getId()); Date createTime = checkScore.getCreateTime(); date = formatter.format(createTime); } else { //防止卡片页面导出不传scoreId,导致报错 date = formatter.format(new Date()); } } /** 导三张sheet */ //车辆 CheckIndexCar checkIndexCar = new CheckIndexCar(); checkIndexCar.setDate(date); checkIndexCar.setQuarter(checkScoreDTO.getQuarter()); checkIndexCar.setQuarter(exportDTO.getQuarter()); checkIndexCar.setDeptId(exportDTO.getDeptId()); checkIndexCar.setDeptIds(exportDTO.getDeptIds()); checkIndexCar.setExamineTags(exportDTO.getExamineTags()); //权限控制 只能查看已发布 roleControl(checkIndexCar); List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar); //计算平均值放在excel最后 if (exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexCars)) { //先区分各个区县,再区分考核标签 Map<Long, List<CheckIndexCar>> carMap = checkIndexCars.stream().collect(Collectors.groupingBy(CheckIndexCar::getDeptId)); carMap.forEach((deptId,list)->{ List<CheckIndexCar> provinceList = list.stream().filter(car -> CheckConstants.Examine_Tag_Province.equals(car.getExamineTag())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(provinceList)) { checkIndexCars.add(CheckIndexCar.calculateAverage(provinceList)); } List<CheckIndexCar> countyList = list.stream().filter(car -> CheckConstants.Examine_Tag_County.equals(car.getExamineTag())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(countyList)) { checkIndexCars.add(CheckIndexCar.calculateAverage(countyList)); } }); } List<CheckIndexCarVO> checkIndexCarVOS = new ArrayList<>(); for (CheckIndexCar indexCar : checkIndexCars) { CheckIndexCarVO excelVo = CheckIndexCar.getExcelVo(indexCar); @@ -321,10 +340,28 @@ //人脸 CheckIndexFace checkIndexFace = new CheckIndexFace(); checkIndexFace.setDate(date); checkIndexFace.setQuarter(checkScoreDTO.getQuarter()); checkIndexFace.setQuarter(exportDTO.getQuarter()); checkIndexFace.setDeptId(exportDTO.getDeptId()); checkIndexFace.setDeptIds(exportDTO.getDeptIds()); checkIndexFace.setExamineTags(exportDTO.getExamineTags()); //权限控制 只能查看已发布 roleControl(checkIndexFace); List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace); //计算平均值放在excel最后 if (exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexFaces)) { //先区分各个区县,再区分考核标签 Map<Long, List<CheckIndexFace>> faceMap = checkIndexFaces.stream().collect(Collectors.groupingBy(CheckIndexFace::getDeptId)); faceMap.forEach((deptId,list)->{ List<CheckIndexFace> provinceList = list.stream().filter(face -> CheckConstants.Examine_Tag_Province.equals(face.getExamineTag())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(provinceList)) { checkIndexFaces.add(CheckIndexFace.calculateAverage(provinceList)); } List<CheckIndexFace> countyList = list.stream().filter(face -> CheckConstants.Examine_Tag_County.equals(face.getExamineTag())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(countyList)) { checkIndexFaces.add(CheckIndexFace.calculateAverage(countyList)); } }); } List<CheckIndexFaceVO> checkIndexFaceVOS = new ArrayList<>(); for (CheckIndexFace indexFace : checkIndexFaces) { CheckIndexFaceVO excelVo = CheckIndexFace.getExcelVo(indexFace); @@ -334,10 +371,28 @@ //视频 CheckIndexVideo checkIndexVideo = new CheckIndexVideo(); checkIndexVideo.setDate(date); checkIndexVideo.setQuarter(checkScoreDTO.getQuarter()); checkIndexVideo.setQuarter(exportDTO.getQuarter()); checkIndexVideo.setDeptId(exportDTO.getDeptId()); checkIndexVideo.setDeptIds(exportDTO.getDeptIds()); checkIndexVideo.setExamineTags(exportDTO.getExamineTags()); //权限控制 只能查看已发布 roleControl(checkIndexVideo); List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo); //计算平均值放在excel最后 if (exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexVideos)) { //先区分各个区县,再区分考核标签 Map<Long, List<CheckIndexVideo>> videoMap = checkIndexVideos.stream().collect(Collectors.groupingBy(CheckIndexVideo::getDeptId)); videoMap.forEach((deptId,list)->{ List<CheckIndexVideo> provinceList = list.stream().filter(video -> CheckConstants.Examine_Tag_Province.equals(video.getExamineTag())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(provinceList)) { checkIndexVideos.add(CheckIndexVideo.calculateAverage(provinceList)); } List<CheckIndexVideo> countyList = list.stream().filter(video -> CheckConstants.Examine_Tag_County.equals(video.getExamineTag())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(countyList)) { checkIndexVideos.add(CheckIndexVideo.calculateAverage(countyList)); } }); } List<CheckIndexVideoVO> checkIndexVideoVOS = new ArrayList<>(); for (CheckIndexVideo indexVideo : checkIndexVideos) { CheckIndexVideoVO excelVo = CheckIndexVideo.getExcelVo(indexVideo); @@ -349,6 +404,23 @@ mysheet.add(e1); mysheet.add(e2); mysheet.add(e3); //规则明细 List<RuleExcelVO> allRuleTemplate = templateRuleMapper.getAllRuleTemplate(); //整合数据 List<RuleExcelVO> countyRuleList = allRuleTemplate.stream().filter(vo -> vo.getExamineTag().equals(Integer.parseInt(CheckConstants.Examine_Tag_County + ""))).collect(Collectors.toList()); List<RuleExcelVO> provinceRuleList = allRuleTemplate.stream().filter(vo -> vo.getExamineTag().equals(Integer.parseInt(CheckConstants.Examine_Tag_Province + ""))).collect(Collectors.toList()); //用区县规则做主体展示 for (RuleExcelVO countyRule : countyRuleList) { countyRule.setCountyWeight(countyRule.getWeight()); //筛选同种规则权重 for (RuleExcelVO provinceRule : provinceRuleList) { if (provinceRule.getRuleId().equals(countyRule.getRuleId()) && provinceRule.getExamineCategory().equals(countyRule.getExamineCategory())) { countyRule.setProvinceWeight(provinceRule.getWeight()); } } } ExcelExp e4 = new ExcelExp("规则明细", countyRuleList, RuleExcelVO.class); mysheet.add(e4); ExcelUtilManySheet<List<ExcelExp>> util = new ExcelUtilManySheet<>(mysheet); util.exportExcelManySheet(response, mysheet); @@ -366,6 +438,7 @@ } } } private void roleControl(BaseEntity checkScore) { List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles(); SysUser user = SecurityUtils.getLoginUser().getUser(); ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
@@ -97,6 +97,7 @@ 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(); checkScore.setIndexId(indexObject.getId()); BigDecimal scoreFinal = BigDecimal.ZERO; for (CheckTemplateRule templateRule : templateRuleList) { //计算分数 ycl-server/src/main/java/com/ycl/task/MonitorTask.java
@@ -58,6 +58,7 @@ private RedisTemplate redisTemplate; //同步mongodb一机一档到数据库 @Transactional(rollbackFor = Exception.class) public void synchronize() { log.info("开始同步mongodb一机一档到数据库"); Date yesterday = DateUtils.addDays(new Date(), -1); ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
@@ -9,6 +9,7 @@ <result property="deptId" column="dept_id" /> <result property="examineTag" column="examine_tag" /> <result property="createTime" column="create_time" /> <result property="score" column="score" /> <result property="viewConnectStability" column="view_connect_stability" /> <result property="siteOnline" column="site_online" /> <result property="deviceDirectoryConsistent" column="device_directory_consistent" /> @@ -26,29 +27,25 @@ </sql> <select id="selectCheckIndexCarList" resultMap="CheckIndexCarResult"> select tcic.*,sd.dept_name select tcic.*,sd.dept_name,tcs.score from t_check_index_car tcic left join sys_dept sd on tcic.dept_id = sd.dept_id left join t_check_score tcs on tcic.id = tcs.index_id <where> <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> <if test="vehicleInformationCollectionAccuracy != null "> and vehicle_information_collection_accuracy = #{vehicleInformationCollectionAccuracy}</if> <if test="vehicleCaptureIntegrity != null "> and vehicle_capture_integrity = #{vehicleCaptureIntegrity}</if> <if test="vehicleCaptureAccuracy != null "> and vehicle_capture_accuracy = #{vehicleCaptureAccuracy}</if> <if test="vehicleTimingAccuracy != null "> and vehicle_timing_accuracy = #{vehicleTimingAccuracy}</if> <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 <if test="deptIds != null and deptIds.size()>0">and tcic.dept_id in <foreach collection="deptIds" separator="," open="(" close=")" item="deptId"> #{deptId} </foreach> </if> <if test="examineTags != null and examineTags.size()>0">and tcic.examine_tag in <foreach collection="examineTags" separator="," open="(" close=")" item="examineTag"> #{examineTag} </foreach> </if> </where> </select> ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
@@ -24,27 +24,25 @@ </sql> <select id="selectCheckIndexFaceList" resultMap="CheckIndexFaceResult"> select tcif.*,sd.dept_name select tcif.*,sd.dept_name,tcs.score from t_check_index_face tcif left join sys_dept sd on tcif.dept_id = sd.dept_id left join t_check_score tcs on tcif.id = tcs.index_id <where> <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> <if test="faceInformationCollectionAccuracy != null "> and face_information_collection_accuracy = #{faceInformationCollectionAccuracy}</if> <if test="facePictureQualification != null "> and face_picture_qualification = #{facePictureQualification}</if> <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} </foreach> </if> <if test="examineTags != null and examineTags.size()>0">and tcif.examine_tag in <foreach collection="examineTags" separator="," open="(" close=")" item="examineTag"> #{examineTag} </foreach> </if> </where> </select> ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
@@ -30,34 +30,26 @@ </sql> <select id="selectCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult"> select tciv.*,sd.dept_name select tciv.*,sd.dept_name,tcs.score from t_check_index_video tciv left join sys_dept sd on tciv.dept_id = sd.dept_id left join t_check_score tcs on tciv.id = tcs.index_id <where> <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> <if test="archivesRate != null "> and archives_rate = #{archivesRate}</if> <if test="siteOnline != null "> and site_online = #{siteOnline}</if> <if test="videoAvailable != null "> and video_available = #{videoAvailable}</if> <if test="ministrySiteOnline != null "> and ministry_site_online = #{ministrySiteOnline}</if> <if test="ministryVideoAvailable != null "> and ministry_video_available = #{ministryVideoAvailable}</if> <if test="keySiteOnline != null "> and key_site_online = #{keySiteOnline}</if> <if test="keyVideoAvailable != null "> and key_video_available = #{keyVideoAvailable}</if> <if test="keyAnnotationAccuracy != null "> and key_annotation_accuracy = #{keyAnnotationAccuracy}</if> <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} </foreach> </if> <if test="examineTags != null and examineTags.size()>0">and tciv.examine_tag in <foreach collection="examineTags" separator="," open="(" close=")" item="examineTag"> #{examineTag} </foreach> </if> </where> </select> ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
@@ -137,9 +137,9 @@ </select> <insert id="saveBatch"> insert into t_check_score (score,dept_id,template_id,examine_tag,examine_category,create_time) values insert into t_check_score (score,dept_id,template_id,index_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}) (#{score.score},#{score.deptId},#{score.templateId},#{score.indexId},#{score.examineTag},#{score.examineCategory},#{score.createTime}) </foreach> </insert> ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml
@@ -72,4 +72,13 @@ where tctr.check_template_id = #{checkTemplateId} </select> <select id="getAllRuleTemplate" resultType="com.ycl.platform.domain.vo.RuleExcelVO"> select cr.id as ruleId,ct.examine_category as examineCategory,ct.examine_tag as examineTag,ct.template_name as templateName,cr.rule_name as ruleName,ctr.weight as weight,cr.rule_description as ruleDescription from t_check_template_rule ctr left join t_check_template ct on ctr.check_template_id = ct.id left join t_check_rule cr on ctr.check_rule_id = cr.id where ct.status = 0 and ct.deleted = 0 </select> </mapper>