双重预防项目-国泰新华二开定制版
16639036659
2024-04-25 21e7d491658dbd969adbcf0bc2f13a5d563ab863
SPI数据,隐患等级饼图信息独立出来,调整查询方式
已修改6个文件
已添加1个文件
112 ■■■■ 文件已修改
src/main/java/com/ruoyi/doublePrevention/controller/SPIDataController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataForPieChartRespDTO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataReqBO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataRespDTO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mybatis/doublePrevention/TrHiddenDangerCheckPointMapper.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/controller/SPIDataController.java
@@ -1,8 +1,10 @@
package com.ruoyi.doublePrevention.controller;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataForPieChartRespDTO;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataReqBO;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataRespDTO;
import com.ruoyi.doublePrevention.entity.SPI.TroubleLevel;
import com.ruoyi.doublePrevention.service.SPIDataCountService;
import com.ruoyi.doublePrevention.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,4 +25,8 @@
        return spiDataCountService.getSPIData(spiDataReqBO);
    }
    @PostMapping("/select/getSPIDataForPieChart")
    public ResultVO<TroubleLevel> getSPIDataForPieChart(@RequestBody SPIDataReqBO spiDataReqBO) {
        return spiDataCountService.getSPIDataForPieChart(spiDataReqBO);
    }
}
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataForPieChartRespDTO.java
对比新文件
@@ -0,0 +1,20 @@
package com.ruoyi.doublePrevention.entity.SPI;
import lombok.Data;
import java.util.List;
@Data
public class SPIDataForPieChartRespDTO {
    private TroubleLevel troubleLevel;
    public TroubleLevel getTroubleLevel() {
        return troubleLevel;
    }
    public void setTroubleLevel(TroubleLevel troubleLevel) {
        this.troubleLevel = troubleLevel;
    }
}
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataReqBO.java
@@ -12,6 +12,10 @@
    private Date endTime;
    private String year;
    private String month;
    public String getKey() {
        return key;
    }
@@ -35,4 +39,20 @@
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
    public String getMonth() {
        return month;
    }
    public void setMonth(String month) {
        this.month = month;
    }
}
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataRespDTO.java
@@ -9,21 +9,9 @@
    private List<TroubleData> troubleDataList;
    private TroubleLevel troubleLevel;
    public List<TroubleData> getTroubleDataList() {
        return troubleDataList;
    }
    public void setTroubleDataList(List<TroubleData> troubleDataList) {
        this.troubleDataList = troubleDataList;
    }
    public TroubleLevel getTroubleLevel() {
        return troubleLevel;
    }
    public void setTroubleLevel(TroubleLevel troubleLevel) {
        this.troubleLevel = troubleLevel;
    }
}
src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java
@@ -1,7 +1,9 @@
package com.ruoyi.doublePrevention.service;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataForPieChartRespDTO;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataReqBO;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataRespDTO;
import com.ruoyi.doublePrevention.entity.SPI.TroubleLevel;
import com.ruoyi.doublePrevention.entity.dto.req.SPIDataCountReqDTO;
import com.ruoyi.doublePrevention.entity.dto.resp.SPIDataCountRespDTO;
import com.ruoyi.doublePrevention.vo.ResultVO;
@@ -14,4 +16,6 @@
    ResultVO<SPIDataCountRespDTO> listDangerResultCountByMonthOrYear(SPIDataCountReqDTO spiDataCountReqDTO);
    ResultVO<SPIDataRespDTO> getSPIData(SPIDataReqBO spiDataReqBO);
    ResultVO<TroubleLevel> getSPIDataForPieChart(SPIDataReqBO spiDataReqBO);
}
src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java
@@ -1,10 +1,7 @@
package com.ruoyi.doublePrevention.service.impl;
import com.ruoyi.doublePrevention.entity.DoublePreventDept;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataReqBO;
import com.ruoyi.doublePrevention.entity.SPI.SPIDataRespDTO;
import com.ruoyi.doublePrevention.entity.SPI.TroubleData;
import com.ruoyi.doublePrevention.entity.SPI.TroubleLevel;
import com.ruoyi.doublePrevention.entity.SPI.*;
import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRectifiedRespDO;
import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO;
import com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO;
@@ -190,18 +187,50 @@
        List<TroubleData> spiData = checkPointService.getSPIData(spiDataReqBO);
        TroubleLevel troubleLevel = checkPointService.getTroubleLevel(spiDataReqBO);
        SPIDataRespDTO spiDataRespDTO = new SPIDataRespDTO();
        spiDataRespDTO.setTroubleDataList(spiData);
        spiDataRespDTO.setTroubleLevel(troubleLevel);
        resultVO.setData(spiDataRespDTO);
        return resultVO;
    }
    @Override
    public ResultVO<TroubleLevel> getSPIDataForPieChart(SPIDataReqBO spiDataReqBO) {
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
        String key = "006a4740-8f2d-4fdc-a25b-a7413a37a2ba";
        if (ObjectUtils.isEmpty(spiDataReqBO.getKey())){
            resultVO.setCode("400");
            resultVO.setMsg("key不能为空");
            return resultVO;
        }
        if (!spiDataReqBO.getKey().equals(key)){
            resultVO.setCode("400");
            resultVO.setMsg("key不正确");
            return resultVO;
        }
        SPIDataForPieChartRespDTO spiDataForPieChartRespDTO = new SPIDataForPieChartRespDTO();
        if (ObjectUtils.isEmpty(spiDataReqBO.getYear())){
            spiDataReqBO.setYear("2024");
            TroubleLevel troubleLevel = checkPointService.getTroubleLevel(spiDataReqBO);
            resultVO.setData(troubleLevel);
            return resultVO;
        }
        TroubleLevel troubleLevel = checkPointService.getTroubleLevel(spiDataReqBO);
        resultVO.setData(troubleLevel);
        return resultVO;
    }
    /**
     * @description 参数校验
src/main/resources/mybatis/doublePrevention/TrHiddenDangerCheckPointMapper.xml
@@ -131,6 +131,9 @@
            sum(case when trouble_type_name = 'B级隐患' then 1 else 0 end) B,
            sum(case when trouble_type_name = 'C级隐患' then 1 else 0 end) C
        from tr_hidden_danger_check_point
        WHERE register_create_time >= #{spiDataReqBO.startTime} and #{spiDataReqBO.endTime} >= register_create_time  and whether_danger = 1
        WHERE YEAR(register_create_time) = #{spiDataReqBO.year}
        <if test="spiDataReqBO.month != null and spiDataReqBO.month != ''">
            AND MONTH(register_create_time) = #{spiDataReqBO.month}
        </if>
    </select>
</mapper>