双重预防项目-国泰新华二开定制版
16639036659
2024-04-28 c588bf4ecd889823225b4d0ec37edf8924894c4a
SPI数据按照需求调整
已修改4个文件
51 ■■■■ 文件已修改
src/main/java/com/ruoyi/doublePrevention/controller/SPIDataController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataReqBO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/doublePrevention/controller/SPIDataController.java
@@ -1,10 +1,7 @@
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.entity.SPI.*;
import com.ruoyi.doublePrevention.service.SPIDataCountService;
import com.ruoyi.doublePrevention.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,7 +18,7 @@
    private SPIDataCountService spiDataCountService;
    @PostMapping("/select/getSPIData")
    public ResultVO<SPIDataRespDTO> getSPIData(@RequestBody SPIDataReqBO spiDataReqBO) {
    public ResultVO<TroubleData> getSPIData(@RequestBody SPIDataReqBO spiDataReqBO) {
        return spiDataCountService.getSPIData(spiDataReqBO);
    }
src/main/java/com/ruoyi/doublePrevention/entity/SPI/SPIDataReqBO.java
@@ -1,16 +1,20 @@
package com.ruoyi.doublePrevention.entity.SPI;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.time.LocalDateTime;
@Data
public class SPIDataReqBO {
    private String key;
    private Date startTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;
    private Date endTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;
    private String year;
@@ -24,19 +28,19 @@
        this.key = key;
    }
    public Date getStartTime() {
    public LocalDateTime getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
    public LocalDateTime getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }
src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java
@@ -1,9 +1,6 @@
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.SPI.*;
import com.ruoyi.doublePrevention.entity.dto.req.SPIDataCountReqDTO;
import com.ruoyi.doublePrevention.entity.dto.resp.SPIDataCountRespDTO;
import com.ruoyi.doublePrevention.vo.ResultVO;
@@ -15,7 +12,7 @@
     */
    ResultVO<SPIDataCountRespDTO> listDangerResultCountByMonthOrYear(SPIDataCountReqDTO spiDataCountReqDTO);
    ResultVO<SPIDataRespDTO> getSPIData(SPIDataReqBO spiDataReqBO);
    ResultVO<TroubleData> getSPIData(SPIDataReqBO spiDataReqBO);
    ResultVO<TroubleLevel> getSPIDataForPieChart(SPIDataReqBO spiDataReqBO);
}
src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java
@@ -21,7 +21,9 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -160,7 +162,7 @@
    }
    @Override
    public ResultVO<SPIDataRespDTO> getSPIData(SPIDataReqBO spiDataReqBO) {
    public ResultVO<TroubleData> getSPIData(SPIDataReqBO spiDataReqBO) {
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
@@ -178,19 +180,18 @@
            resultVO.setMsg("key不正确");
            return resultVO;
        }
        if (ObjectUtils.isEmpty(spiDataReqBO.getStartTime())){
            spiDataReqBO.setStartTime(new Date(123, 3,1));
        LocalDateTime startTime = LocalDate.now().withDayOfMonth(1).atStartOfDay();
        for (int i = 0; i < 12; i++) {
            startTime = startTime.minus(Period.ofMonths(1));
        }
        if (ObjectUtils.isEmpty(spiDataReqBO.getEndTime())){
            spiDataReqBO.setEndTime(new Date());
        }
        spiDataReqBO.setStartTime(startTime);
        spiDataReqBO.setEndTime(LocalDateTime.now());
        List<TroubleData> spiData = checkPointService.getSPIData(spiDataReqBO);
        SPIDataRespDTO spiDataRespDTO = new SPIDataRespDTO();
        spiDataRespDTO.setTroubleDataList(spiData);
        resultVO.setData(spiDataRespDTO);
        resultVO.setData(spiData);
        return resultVO;
    }