| | |
| | | package com.ruoyi.doublePrevention.service.impl; |
| | | |
| | | import com.ruoyi.doublePrevention.entity.DoublePreventDept; |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | return parameterVerificationResult; |
| | | } |
| | | |
| | | @Override |
| | | public ResultVO<TroubleData> 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; |
| | | } |
| | | LocalDateTime startTime = LocalDate.now().withDayOfMonth(1).atStartOfDay(); |
| | | for (int i = 0; i < 12; i++) { |
| | | startTime = startTime.minus(Period.ofMonths(1)); |
| | | } |
| | | spiDataReqBO.setStartTime(startTime); |
| | | spiDataReqBO.setEndTime(LocalDateTime.now()); |
| | | |
| | | |
| | | List<TroubleData> spiData = checkPointService.getSPIData(spiDataReqBO); |
| | | |
| | | |
| | | resultVO.setData(spiData); |
| | | |
| | | 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 参数校验 |