fuliqi
2024-11-04 92961b33e531ae3f61ec908252081bfe679d3300
考核积分导出
13个文件已修改
113 ■■■■■ 已修改文件
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/calculate/CarClockAccuracyCalculation.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/calculate/CarConsistentCalculation.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/calculate/IndexCalculationUtils.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/YwPointMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/ImageResourceSecurityMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java
@@ -37,6 +37,8 @@
    private Long deptId;
    @TableField(exist = false)
    private String deptName;
    //设备数量
    private Integer deviceCount;
    /** 考核模板id */
    @Excel(name = "考核模板id")
    private Integer templateId;
ycl-server/src/main/java/com/ycl/calculate/CarClockAccuracyCalculation.java
@@ -1,9 +1,12 @@
package com.ycl.calculate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ycl.platform.domain.entity.CheckIndexCar;
import com.ycl.platform.domain.entity.YwPoint;
import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult;
import com.ycl.platform.mapper.CheckIndexCarMapper;
import com.ycl.platform.mapper.TMonitorMapper;
import com.ycl.platform.mapper.YwPointMapper;
import com.ycl.platform.service.ICheckIndexCarService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +18,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * 计算车辆时钟准确性
ycl-server/src/main/java/com/ycl/calculate/CarConsistentCalculation.java
@@ -1,8 +1,11 @@
package com.ycl.calculate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ycl.platform.domain.entity.CheckIndexCar;
import com.ycl.platform.domain.entity.YwPoint;
import com.ycl.platform.domain.result.UY.MonitorQualifyResult;
import com.ycl.platform.mapper.CheckIndexCarMapper;
import com.ycl.platform.mapper.YwPointMapper;
import com.ycl.platform.service.ICheckIndexCarService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +30,6 @@
    private CheckIndexCarMapper checkIndexCarMapper;
    @Autowired
    private ICheckIndexCarService checkIndexCarService;
    //区域车辆目录一致率的内部类
    protected static class AreaStats {
        int totalSites = 0;
@@ -42,6 +44,7 @@
        // 查询是否index表已经存在今日数据
        List<CheckIndexCar> checkIndexCarList = checkIndexCarMapper.selectToday(DateUtils.getDate());
        List<CheckIndexCar> checkIndexCars = new ArrayList<>();
        areaStatsMap.forEach((deptId, stats) -> {
            if (stats.totalSites > 0) {
ycl-server/src/main/java/com/ycl/calculate/IndexCalculationUtils.java
@@ -1,10 +1,16 @@
package com.ycl.calculate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ycl.platform.base.CheckIndex;
import com.ycl.platform.domain.entity.YwPoint;
import com.ycl.platform.mapper.YwPointMapper;
import constant.ApiConstants;
import constant.CheckConstants;
import enumeration.general.PublishType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -12,14 +18,15 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
@Slf4j
public class IndexCalculationUtils {
    //检查是否存在当日数据
    public <T extends CheckIndex> T getCheckIndex(String key, List<T> checkIndexList, Class<T> clazz) {
        T checkIndex;
        // 检查是否已存在今日数据
        Optional<T> existingIndex = checkIndexList.stream()
                .filter(index -> key.startsWith(ApiConstants.Province) ?
@@ -46,7 +53,9 @@
        return checkIndex;
    }
    /** --------指标算法---------*/
    /**
     * --------指标算法---------
     */
    //一机一档合格率
    public BigDecimal monitorQualify(Map<String, Object> param) {
@@ -110,7 +119,7 @@
    public BigDecimal viewConnectStability(Map<String, Object> param) {
        BigDecimal totalDataSum = new BigDecimal((Integer) param.get("totalDataSum"));
        BigDecimal lastCount = (BigDecimal) param.get("lastCount");
        log.info("视图库对接稳定性,totalDataSum:{},lastCount:{}",totalDataSum,lastCount);
        log.info("视图库对接稳定性,totalDataSum:{},lastCount:{}", totalDataSum, lastCount);
        return totalDataSum.divide(lastCount, 4, RoundingMode.HALF_UP);
    }
ycl-server/src/main/java/com/ycl/platform/mapper/YwPointMapper.java
@@ -123,4 +123,13 @@
     * @return
     */
    Integer distinctCount(@Param("query") DataCenterQuery query);
    /**
     * 设备数量
     * @param examineCategory
     * @param examineTag
     * @return
     */
    List<YwPointVO> selectToCount(Short examineCategory, Short examineTag);
}
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -322,9 +322,7 @@
            //权限控制 只能查看已发布
            roleControl(checkIndexCar);
            checkIndexCar.setExamineTag(Short.valueOf(examineTag + ""));
            if (examineTag == 0) {
                checkIndexCar.setProvinceTag(Boolean.TRUE);
            }
            checkIndexCars.addAll(indexCarService.selectCheckIndexCarList(checkIndexCar));
        }
        //计算平均值放在excel最后
@@ -372,9 +370,6 @@
            //权限控制 只能查看已发布
            roleControl(checkIndexFace);
            checkIndexFace.setExamineTag(Short.valueOf(examineTag + ""));
            if (examineTag == 0) {
                checkIndexFace.setProvinceTag(Boolean.TRUE);
            }
            checkIndexFaces.addAll(indexFaceService.selectCheckIndexFaceList(checkIndexFace));
        }
        //计算平均值放在excel最后
@@ -421,12 +416,6 @@
            //权限控制 只能查看已发布
            roleControl(checkIndexVideo);
            checkIndexVideo.setExamineTag(Short.valueOf(examineTag + ""));
            if (examineTag == 0) {
                checkIndexVideo.setProvinceTag(Boolean.TRUE);
            }else if(examineTag ==2){
                //只有视频有公安部数据
                checkIndexVideo.setDeptTag(Boolean.TRUE);
            }
            checkIndexVideos.addAll(indexVideoService.selectCheckIndexVideoList(checkIndexVideo));
        }
        //计算平均值放在excel最后
ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
@@ -4,6 +4,7 @@
import com.google.common.base.CaseFormat;
import com.ycl.platform.base.CheckIndex;
import com.ycl.platform.domain.entity.*;
import com.ycl.platform.domain.vo.YwPointVO;
import com.ycl.platform.mapper.*;
import com.ycl.platform.service.*;
import constant.CheckConstants;
@@ -41,12 +42,15 @@
    private CheckIndexFaceMapper faceMapper;
    @Autowired
    private CheckIndexCarMapper carMapper;
    @Autowired
    private YwPointMapper pointMapper;
    //公安部只有视频考核
    public void executeTemplate(Integer templateId) {
        CheckTemplate checkTemplate = templateMapper.selectCheckTemplateById(templateId);
        if (checkTemplate != null) {
            Short examineCategory = checkTemplate.getExamineCategory();
            Short examineTag = checkTemplate.getExamineTag();
            List<YwPointVO> pointVOS= pointMapper.selectToCount(examineCategory, examineTag);
            //查权重
            CheckTemplateRule checkTemplateRule = new CheckTemplateRule();
            checkTemplateRule.setCheckTemplateId(templateId);
@@ -65,7 +69,7 @@
                //根据模板的考核标签查各区县对应省厅或市局或公安部视频数据
                List<CheckIndexVideo> checkIndexVideos = videoMapper.getCheckIndexVideoList(checkIndexVideo);
                for (CheckIndexVideo indexVideo : checkIndexVideos) {
                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexVideo, CheckConstants.Rule_Category_Video);
                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexVideo, CheckConstants.Rule_Category_Video,pointVOS);
                }
            } else if (CheckConstants.Rule_Category_Car.equals(examineCategory)) {
                CheckIndexCar checkIndexCar = new CheckIndexCar();
@@ -75,7 +79,7 @@
                //根据模板的考核标签查各区县对应省厅或市局或公安部车辆数据
                List<CheckIndexCar> checkIndexCars = carMapper.getCheckIndexCarList(checkIndexCar);
                for (CheckIndexCar indexCar : checkIndexCars) {
                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexCar, CheckConstants.Rule_Category_Car);
                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexCar, CheckConstants.Rule_Category_Car,pointVOS);
                }
            } else if (CheckConstants.Rule_Category_Face.equals(examineCategory)) {
                CheckIndexFace checkIndexFace = new CheckIndexFace();
@@ -85,7 +89,7 @@
                //根据模板的考核标签查各区县对应省厅或市局或公安部人脸数据
                List<CheckIndexFace> checkIndexFaces = faceMapper.getCheckIndexFaceList(checkIndexFace);
                for (CheckIndexFace indexFace : checkIndexFaces) {
                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace, CheckConstants.Rule_Category_Face);
                    addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace, CheckConstants.Rule_Category_Face,pointVOS);
                }
            }
@@ -109,7 +113,7 @@
        }
    }
    private <T extends CheckIndex> void addToList(Integer templateId, CheckTemplate checkTemplate, Short examineTag, List<CheckTemplateRule> templateRuleList, List<CheckScore> scoreList, T indexObject, Short checkCategory) {
    private <T extends CheckIndex> void addToList(Integer templateId, CheckTemplate checkTemplate, Short examineTag, List<CheckTemplateRule> templateRuleList, List<CheckScore> scoreList, T indexObject, Short checkCategory, List<YwPointVO> pointVOS) {
        CheckScore checkScore = new CheckScore();
        checkScore.setIndexId(indexObject.getId());
        BigDecimal scoreFinal = BigDecimal.ZERO;
@@ -118,7 +122,7 @@
            scoreFinal = getScoreFinal(indexObject, scoreFinal, templateRule);
        }
        //补充checkScore
        fillCheckScore(templateId, checkTemplate, examineTag, indexObject, checkScore, scoreFinal, checkCategory);
        fillCheckScore(templateId, checkTemplate, examineTag, indexObject, checkScore, scoreFinal, checkCategory,pointVOS);
        scoreList.add(checkScore);
    }
@@ -142,7 +146,7 @@
    }
    //设置checkScore对象
    private void fillCheckScore(Integer templateId, CheckTemplate checkTemplate, Short examineTag, CheckIndex checkIndex, CheckScore checkScore, BigDecimal scoreFinal, Short checkCategory) {
    private void fillCheckScore(Integer templateId, CheckTemplate checkTemplate, Short examineTag, CheckIndex checkIndex, CheckScore checkScore, BigDecimal scoreFinal, Short checkCategory, List<YwPointVO> pointVOS) {
        //根据调整系数调整最终分数大小
        String adjustWay = checkTemplate.getAdjustWay();
        BigDecimal adjustCoefficient = checkTemplate.getAdjustCoefficient();
@@ -159,5 +163,9 @@
        checkScore.setTemplateId(templateId);
        checkScore.setScore(scoreFinal);
        checkScore.setPublish(PublishType.PUBLISHED.getCode());
        if(!CollectionUtils.isEmpty(pointVOS)) {
            long count = pointVOS.stream().filter(ywPointVO -> checkIndex.getDeptId().equals(ywPointVO.getDeptId())).count();
            checkScore.setDeviceCount((int) count);
        }
    }
}
ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
@@ -28,17 +28,13 @@
    </sql>
    <select id="selectCheckIndexCarList"  resultMap="CheckIndexCarResult">
        select tcic.*,sd.dept_name,tcs.score,count(m.serial_number) as num
        select tcic.*,sd.dept_name,tcs.score,IFNULL(tcs.device_count,0) as num
        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
        left join t_yw_point p on p.dept_id = tcic.dept_id and p.examine_status = 1
        left join t_monitor m on p.serial_number = m.serial_number
        <where>
            tcs.examine_category = 2 and m.camera_fun_type like concat('%',2,'%')
            tcs.examine_category = 2
            <if test="deptId != null "> and tcic.dept_id = #{deptId}</if>
            <if test="examineTag != null "> and tcic.examine_tag = #{examineTag}</if>
            <if test="provinceTag != null "> and p.province_tag = #{provinceTag}</if>
            <if test="deptTag != null "> and p.dept_tag = #{deptTag}</if>
            <if test="quarter != null and quarter.size > 0">
                and date_format(tcs.create_time, '%Y-%m') between #{quarter[0]} and #{quarter[1]}
            </if>
@@ -51,7 +47,6 @@
                </foreach>
            </if>
        </where>
        group by tcic.id
        order by tcic.examine_tag desc,sd.area_code,tcic.create_time
    </select>
ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
@@ -26,17 +26,13 @@
    </sql>
    <select id="selectCheckIndexFaceList"  resultMap="CheckIndexFaceResult">
        select tcif.*,sd.dept_name,tcs.score,count(m.serial_number) as num
        select tcif.*,sd.dept_name,tcs.score,IFNULL(tcs.device_count,0) as num
        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
        left join t_yw_point p on p.dept_id = tcif.dept_id  and p.examine_status = 1
        left join t_monitor m on p.serial_number = m.serial_number
        <where>
            tcs.examine_category = 3 and m.camera_fun_type like concat('%',3,'%')
            tcs.examine_category = 3
            <if test="deptId != null "> and tcif.dept_id = #{deptId}</if>
            <if test="examineTag != null "> and tcif.examine_tag = #{examineTag}</if>
            <if test="provinceTag != null "> and p.province_tag = #{provinceTag}</if>
            <if test="deptTag != null "> and p.dept_tag = #{deptTag}</if>
            <if test="quarter != null and quarter.size > 0">
                and date_format(tcs.create_time, '%Y-%m') between #{quarter[0]} and #{quarter[1]}
            </if>
@@ -49,7 +45,6 @@
                </foreach>
            </if>
        </where>
        group by tcif.id
        order by tcif.examine_tag desc,sd.area_code,tcif.create_time
    </select>
ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
@@ -32,17 +32,13 @@
    </sql>
    <select id="selectCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult">
        select tciv.*,sd.dept_name,tcs.score,count(m.serial_number) as num
        select tciv.*,sd.dept_name,tcs.score,IFNULL(tcs.device_count,0) as num
        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
        left join t_yw_point p on p.dept_id = tciv.dept_id  and p.examine_status = 1
        left join t_monitor m on p.serial_number = m.serial_number
        <where>
            tcs.examine_category = 1 and m.camera_fun_type like concat('%',1,'%')
            tcs.examine_category = 1
            <if test="deptId != null "> and tciv.dept_id = #{deptId}</if>
            <if test="examineTag != null "> and tciv.examine_tag = #{examineTag}</if>
            <if test="provinceTag != null "> and p.province_tag = #{provinceTag}</if>
            <if test="deptTag != null "> and p.dept_tag = #{deptTag}</if>
            <if test="quarter != null and quarter.size > 0">
                and date_format(tcs.create_time, '%Y-%m') between #{quarter[0]} and #{quarter[1]}
            </if>
@@ -56,7 +52,6 @@
            </foreach>
            </if>
        </where>
        group by tciv.id
        order by tciv.examine_tag desc,sd.area_code,tciv.create_time
    </select>
    <select id="getCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult">
ycl-server/src/main/resources/mapper/zgyw/ImageResourceSecurityMapper.xml
@@ -103,7 +103,7 @@
    </delete>
    <select id="getLatest" resultType="com.ycl.platform.domain.entity.ImageResourceSecurity">
        select * from t_image_resource_security where dept_id = #{deptId}
        where date_format(create_time,'%Y-%m')  = DATE_FORMAT(#{date}, '%Y-%m')
        where date_format(create_time,'%Y-%m')  = date_format(#{date}, '%Y-%m')
        order by create_time desc
        limit 1
    </select>
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -105,7 +105,7 @@
        camera_dept, hybm, lxbm,d.dept_id, d.dept_name from t_monitor m
        left join t_yw_point p on m.serial_number = p.serial_number
        left join sys_dept d on p.dept_id = d.dept_id
        where m.serial_number in
        where p.examine_status = 1 and  m.serial_number in
        <foreach collection="list" separator="," item="id" open="(" close=")">
            #{id}
        </foreach>
ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
@@ -358,5 +358,17 @@
        serial_number, province_tag, important_tag, important_command_image_tag, dept_tag
    </select>
    <select id="selectToCount" resultType="com.ycl.platform.domain.vo.YwPointVO">
        select p.* from t_yw_point p
        left join t_monitor m on p.serial_number = m.serial_number
        <where>
            p.examine_status = 1 and m.camera_fun_type like concat('%',#{examineCategory},'%')
            <if test="examineTag == 0">
                and p.province_tag = 1
            </if>
            <if test="examineTag == 2">
                and p.dept_tag = 1
            </if>
        </where>
    </select>
</mapper>