双重预防项目-国泰新华二开定制版
16639036659
2024-04-23 d91ee46e736cd877ee9c55e6917f135e5ffd1338
src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java
@@ -1,6 +1,10 @@
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.dto.DataCountDangerLevelRectifiedRespDO;
import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO;
import com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO;
@@ -13,7 +17,6 @@
import com.ruoyi.doublePrevention.service.baseService.PreventRiskDangerInfoService;
import com.ruoyi.doublePrevention.service.baseService.TrHiddenDangerCheckPointService;
import com.ruoyi.doublePrevention.vo.ResultVO;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +24,7 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -158,6 +162,46 @@
        return parameterVerificationResult;
    }
    @Override
    public ResultVO<SPIDataRespDTO> getSPIData(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;
        }
        if (ObjectUtils.isEmpty(spiDataReqBO.getStartTime())){
            spiDataReqBO.setStartTime(new Date(123, 3,1));
        }
        if (ObjectUtils.isEmpty(spiDataReqBO.getEndTime())){
            spiDataReqBO.setEndTime(new Date());
        }
        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;
    }
    /**
     * @description 参数校验