fuliqi
2024-09-20 9ca86187d65db0180f6d23b8efd13136b6db394c
考核成绩导出优化
10个文件已修改
101 ■■■■■ 已修改文件
ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexVideoVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java
@@ -43,11 +43,15 @@
    @Excel(name = "得分")
    @TableField(exist = false)
    private BigDecimal score;
    /** 设备数量 */
    @Excel(name = "设备数量")
    @TableField(exist = false)
    private Integer num;
    @TableField(exist = false)
    public List<Integer> deptIds;
    @TableField(exist = false)
    public List<Integer> examineTags;
    public Integer examineTagQuery;
    @TableField(exist = false)
    public List<Integer> examineCategories;
    /** 请求参数 */
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexCar.java
@@ -93,6 +93,7 @@
    //转换成字符串用于excel导出
    public static CheckIndexCarVO getExcelVo(@NonNull CheckIndexCar checkIndexCar) {
        CheckIndexCarVO checkIndexCarVo = new CheckIndexCarVO();
        checkIndexCarVo.setNum(checkIndexCar.getNum());
        checkIndexCarVo.setScore(checkIndexCar.getScore().setScale(2,RoundingMode.HALF_UP));
        checkIndexCarVo.setDeptName(checkIndexCar.getDeptName());
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
@@ -120,6 +121,7 @@
     * 导出时用于计算平均值
     */
    public static CheckIndexCar calculateAverage(List<CheckIndexCar> checkIndexCars) {
        Integer numSum = 0;
        BigDecimal scoreSum = BigDecimal.ZERO;
        BigDecimal viewConnectStabilitySum = BigDecimal.ZERO;
        BigDecimal siteOnlineSum = BigDecimal.ZERO;
@@ -132,6 +134,7 @@
        BigDecimal vehicleUrlAvailabilitySum = BigDecimal.ZERO;
        BigDecimal vehiclePictureAvailabilitySum = BigDecimal.ZERO;
        for (CheckIndexCar car : checkIndexCars) {
            numSum = numSum + (car.getNum() == null? 0:car.getNum());
            scoreSum = scoreSum.add(car.getScore() == null ? BigDecimal.ZERO : car.getScore());
            viewConnectStabilitySum = viewConnectStabilitySum.add(car.getViewConnectStability());
            siteOnlineSum = siteOnlineSum.add(car.getSiteOnline());
@@ -149,6 +152,7 @@
        checkIndexCar.setDeptName(checkIndexCars.get(0).getDeptName());
        checkIndexCar.setExamineTag(checkIndexCars.get(0).getExamineTag());
        checkIndexCar.setScore(scoreSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP));
        checkIndexCar.setNum(numSum/checkIndexCars.size());
        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));
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexFace.java
@@ -83,6 +83,7 @@
    //转换成字符串用于excel导出
    public static CheckIndexFaceVO getExcelVo(@NonNull CheckIndexFace checkIndexFace) {
        CheckIndexFaceVO checkIndexFaceVo = new CheckIndexFaceVO();
        checkIndexFaceVo.setNum(checkIndexFace.getNum());
        checkIndexFaceVo.setScore(checkIndexFace.getScore().setScale(2,RoundingMode.HALF_UP));
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        //避免合计行报错(合计数据 缺少createTimeStr字段 直接将createTimeStr设置为"合计")
@@ -106,6 +107,7 @@
    }
    /** 用于导出计算平均值 */
    public static CheckIndexFace calculateAverage(List<CheckIndexFace> checkIndexFaces) {
        Integer numSum = 0;
        BigDecimal scoreSum = BigDecimal.ZERO;
        BigDecimal totalViewConnectStability = BigDecimal.ZERO;
        BigDecimal totalSiteOnline = BigDecimal.ZERO;
@@ -119,6 +121,7 @@
        int count = checkIndexFaces.size();
        for (CheckIndexFace indexFace : checkIndexFaces) {
            numSum = numSum + (indexFace.getNum() == null? 0:indexFace.getNum());
            scoreSum = scoreSum.add(indexFace.getScore() == null ? BigDecimal.ZERO : indexFace.getScore());
            totalViewConnectStability = totalViewConnectStability.add(indexFace.getViewConnectStability());
            totalSiteOnline = totalSiteOnline.add(indexFace.getSiteOnline());
@@ -133,6 +136,7 @@
        result.setCreateTimeStr("合计");
        result.setDeptName(checkIndexFaces.get(0).getDeptName());
        result.setExamineTag(checkIndexFaces.get(0).getExamineTag());
        result.setNum(numSum/count);
        result.setScore(scoreSum.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
        result.setViewConnectStability(totalViewConnectStability.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
        result.setSiteOnline(totalSiteOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckIndexVideo.java
@@ -121,6 +121,7 @@
    //转换成字符串用于excel导出
    public static CheckIndexVideoVO getExcelVo(@NonNull CheckIndexVideo checkIndexVideo) {
        CheckIndexVideoVO checkIndexVideoVO = new CheckIndexVideoVO();
        checkIndexVideoVO.setNum(checkIndexVideo.getNum());
        checkIndexVideoVO.setScore(checkIndexVideo.getScore().setScale(2,RoundingMode.HALF_UP));
        checkIndexVideoVO.setDeptName(checkIndexVideo.getDeptName());
        //避免合计行报错(合计数据 缺少createTimeStr字段 直接将createTimeStr设置为"合计")
@@ -153,6 +154,7 @@
     * 用于导出计算平均值
     */
    public static CheckIndexVideo calculateAverage(List<CheckIndexVideo> videos) {
        Integer numSum = 0;
        BigDecimal scoreSum = BigDecimal.ZERO;
        BigDecimal totalPlatformOnline = BigDecimal.ZERO;
        BigDecimal totalMonitorQualification = BigDecimal.ZERO;
@@ -171,6 +173,7 @@
        int count = videos.size();
        for (CheckIndexVideo video : videos) {
            numSum = numSum + (video.getNum() == null? 0:video.getNum());
            scoreSum = scoreSum.add(video.getScore() == null ? BigDecimal.ZERO : video.getScore());
            totalPlatformOnline = totalPlatformOnline.add(video.getPlatformOnline());
            totalMonitorQualification = totalMonitorQualification.add(video.getMonitorQualification());
@@ -193,6 +196,7 @@
        averageVideo.setCreateTimeStr("合计");
        averageVideo.setDeptName(videos.get(0).getDeptName());
        averageVideo.setExamineTag(videos.get(0).getExamineTag());
        averageVideo.setNum(numSum/count);
        averageVideo.setScore(scoreSum.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
        averageVideo.setPlatformOnline(totalPlatformOnline.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
        averageVideo.setMonitorQualification(totalMonitorQualification.divide(BigDecimal.valueOf(count), 2, RoundingMode.HALF_UP));
ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckIndexVideoVO.java
@@ -42,7 +42,7 @@
    /**
     * 录象可用率
     */
    @Excel(name = "录象可用率")
    @Excel(name = "录像可用率")
    private String videoAvailableText;
    /**
ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java
@@ -95,7 +95,6 @@
    @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());
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -319,10 +319,16 @@
        checkIndexCar.setQuarter(exportDTO.getQuarter());
        checkIndexCar.setDeptId(exportDTO.getDeptId());
        checkIndexCar.setDeptIds(exportDTO.getDeptIds());
        checkIndexCar.setExamineTags(exportDTO.getExamineTags());
        //权限控制 只能查看已发布
        roleControl(checkIndexCar);
        List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar);
        List<CheckIndexCar> checkIndexCars = new ArrayList<>();
        for (Integer examineTag : exportDTO.getExamineTags()) {
            checkIndexCar.setExamineTag(Short.valueOf(examineTag+""));
            if(examineTag ==0){
                checkIndexCar.setExamineTagQuery(1);
            }
            checkIndexCars.addAll(indexCarService.selectCheckIndexCarList(checkIndexCar));
        }
        //计算平均值放在excel最后
        if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexCars)) {
            //先区分考核标签,再区分区县
@@ -361,10 +367,16 @@
        checkIndexFace.setQuarter(exportDTO.getQuarter());
        checkIndexFace.setDeptId(exportDTO.getDeptId());
        checkIndexFace.setDeptIds(exportDTO.getDeptIds());
        checkIndexFace.setExamineTags(exportDTO.getExamineTags());
        //权限控制 只能查看已发布
        roleControl(checkIndexFace);
        List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace);
        List<CheckIndexFace> checkIndexFaces = new ArrayList<>();
        for (Integer examineTag : exportDTO.getExamineTags()) {
            checkIndexFace.setExamineTag(Short.valueOf(examineTag+""));
            if(examineTag ==0){
                checkIndexFace.setExamineTagQuery(1);
            }
            checkIndexFaces.addAll(indexFaceService.selectCheckIndexFaceList(checkIndexFace));
        }
        //计算平均值放在excel最后
        if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexFaces)) {
            //先区分考核标签,再区分区县
@@ -403,10 +415,16 @@
        checkIndexVideo.setQuarter(exportDTO.getQuarter());
        checkIndexVideo.setDeptId(exportDTO.getDeptId());
        checkIndexVideo.setDeptIds(exportDTO.getDeptIds());
        checkIndexVideo.setExamineTags(exportDTO.getExamineTags());
        //权限控制 只能查看已发布
        roleControl(checkIndexVideo);
        List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo);
        List<CheckIndexVideo> checkIndexVideos = new ArrayList<>();
        for (Integer examineTag : exportDTO.getExamineTags()) {
            checkIndexVideo.setExamineTag(Short.valueOf(examineTag+""));
            if(examineTag ==0){
                checkIndexVideo.setExamineTagQuery(1);
            }
            checkIndexVideos.addAll(indexVideoService.selectCheckIndexVideoList(checkIndexVideo));
        }
        //计算平均值放在excel最后
        if (exportDTO.getAverage() != null && exportDTO.getAverage() && !CollectionUtils.isEmpty(checkIndexVideos)) {
            //先区分考核标签,再区分区县
ycl-server/src/main/resources/mapper/zgyw/CheckIndexCarMapper.xml
@@ -10,6 +10,7 @@
        <result property="examineTag"    column="examine_tag"    />
        <result property="createTime"    column="create_time"    />
        <result property="score"    column="score"    />
        <result property="num"    column="num"    />
        <result property="viewConnectStability"    column="view_connect_stability"    />
        <result property="siteOnline"    column="site_online"    />
        <result property="deviceDirectoryConsistent"    column="device_directory_consistent"    />
@@ -27,13 +28,16 @@
    </sql>
    <select id="selectCheckIndexCarList"  resultMap="CheckIndexCarResult">
        select tcic.*,sd.dept_name,tcs.score
        select tcic.*,sd.dept_name,tcs.score,count(m.serial_number) 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
        left join t_monitor m on p.serial_number = m.serial_number
        <where>
            tcs.examine_category = 2
            tcs.examine_category = 2 and m.camera_fun_type like concat('%',2,'%')
            <if test="deptId != null "> and tcic.dept_id = #{deptId}</if>
            <if test="examineTag != null "> and tcic.examine_tag = #{examineTag}</if>
            <if test="examineTagQuery != null "> and p.province_tag = #{examineTagQuery}</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="params.publish != null  and params.publish != ''">and tcic.publish = #{params.publish}</if>
@@ -42,13 +46,9 @@
                    #{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>
        order by tcic.examine_tag desc,tcic.create_time,tcs.score desc
        group by tcic.id
        order by tcic.examine_tag desc,sd.area_code,tcic.create_time
    </select>
    <select id="getCheckIndexCarList"  resultMap="CheckIndexCarResult">
ycl-server/src/main/resources/mapper/zgyw/CheckIndexFaceMapper.xml
@@ -8,6 +8,8 @@
        <result property="id"    column="id"    />
        <result property="deptId"    column="dept_id"    />
        <result property="examineTag"    column="examine_tag"    />
        <result property="num"    column="num"    />
        <result property="score"    column="score"    />
        <result property="createTime"    column="create_time"    />
        <result property="viewConnectStability"    column="view_connect_stability"    />
        <result property="siteOnline"    column="site_online"    />
@@ -24,13 +26,16 @@
    </sql>
    <select id="selectCheckIndexFaceList"  resultMap="CheckIndexFaceResult">
        select tcif.*,sd.dept_name,tcs.score
        select tcif.*,sd.dept_name,tcs.score,count(m.serial_number) 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
        left join t_monitor m on p.serial_number = m.serial_number
        <where>
            tcs.examine_category = 3
            tcs.examine_category = 3 and m.camera_fun_type like concat('%',3,'%')
            <if test="deptId != null "> and tcif.dept_id = #{deptId}</if>
            <if test="examineTag != null "> and tcif.examine_tag = #{examineTag}</if>
            <if test="examineTagQuery != null "> and p.province_tag = #{examineTagQuery}</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="params.publish != null  and params.publish != ''">and tcif.publish = #{params.publish}</if>
@@ -39,13 +44,9 @@
                    #{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>
        order by tcif.examine_tag desc,tcif.create_time,tcs.score desc
        group by tcif.id
        order by tcif.examine_tag desc,sd.area_code,tcif.create_time
    </select>
    <select id="getCheckIndexFaceList"  resultMap="CheckIndexFaceResult">
ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
@@ -8,6 +8,8 @@
        <result property="id"    column="id"    />
        <result property="deptId"    column="dept_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="num"    column="num"    />
        <result property="score"    column="score"    />
        <result property="examineTag"    column="examine_tag"    />
        <result property="platformOnline"    column="platform_online"    />
        <result property="monitorQualification"    column="monitor_qualification"    />
@@ -30,13 +32,16 @@
    </sql>
    <select id="selectCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult">
        select tciv.*,sd.dept_name,tcs.score
        select tciv.*,sd.dept_name,tcs.score,count(m.serial_number) 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
        left join t_monitor m on p.serial_number = m.serial_number
        <where>
            tcs.examine_category = 1
            tcs.examine_category = 1 and m.camera_fun_type like concat('%',1,'%')
            <if test="deptId != null "> and tciv.dept_id = #{deptId}</if>
            <if test="examineTag != null "> and tciv.examine_tag = #{examineTag}</if>
            <if test="examineTagQuery != null "> and p.province_tag = #{examineTagQuery}</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>
@@ -46,13 +51,9 @@
                #{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>
        order by tciv.examine_tag desc,tciv.create_time,tcs.score desc
        group by tciv.id
        order by tciv.examine_tag desc,sd.area_code,tciv.create_time
    </select>
    <select id="getCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult">
        select tciv.*,sd.dept_name