| | |
| | | import com.gkhy.fourierSpecialGasMonitor.commons.enums.ResultCode; |
| | | import com.gkhy.fourierSpecialGasMonitor.commons.exception.BusinessException; |
| | | import com.gkhy.fourierSpecialGasMonitor.commons.model.PageQuery; |
| | | import com.gkhy.fourierSpecialGasMonitor.commons.utils.BeanCopyUtils; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.*; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.query.GasAtmospherePageQuery; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.query.GasFluxPageQuery; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.query.GasPageQuery; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.req.GasAtmosphereLineChartReqDTO; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.req.GasFluxLineChartReqDTO; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.req.GasLineChartReqDTO; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.req.*; |
| | | import com.gkhy.fourierSpecialGasMonitor.entity.resp.*; |
| | | import com.gkhy.fourierSpecialGasMonitor.service.*; |
| | | import com.gkhy.fourierSpecialGasMonitor.utils.AreaHandle; |
| | | import com.gkhy.fourierSpecialGasMonitor.utils.PositionHandle; |
| | | import io.micrometer.core.instrument.util.StringUtils; |
| | | import jodd.bean.BeanCopy; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | searchResult.setData(respDTOS); |
| | | return searchResult; |
| | | } |
| | | |
| | | @Override |
| | | public Result gasFluxExport(GasFluxExportBO gasFluxExportBO) { |
| | | |
| | | Result<List<GasFluxExportDTO>> result = new Result<>(); |
| | | |
| | | List<GasFlux> gasFluxes = gasFluxService.gasFluxExport(gasFluxExportBO); |
| | | List<GasFluxExportDTO> exportLists = new ArrayList<>(); |
| | | AreaHandle areaHandle = new AreaHandle(); |
| | | for (GasFlux gasFlux : gasFluxes) { |
| | | GasFluxExportDTO gasFluxExportDTO = BeanCopyUtils.copyBean(gasFlux, GasFluxExportDTO.class); |
| | | gasFluxExportDTO.setGasName01("甲烷CH4"); |
| | | gasFluxExportDTO.setGasName02("乙烷C2H6"); |
| | | gasFluxExportDTO.setGasName03("丙烷C3H8"); |
| | | gasFluxExportDTO.setGasName04("丁烷C4H10"); |
| | | gasFluxExportDTO.setGasName05("硫化氢H2S"); |
| | | gasFluxExportDTO.setGasName06("乙烯C2H4"); |
| | | gasFluxExportDTO.setGasName07("异丁烷C4H10"); |
| | | gasFluxExportDTO.setAreaId(areaHandle.areaHandleMethod(gasFlux.getAreaId())); |
| | | if (gasFluxExportBO.getCh4() == 0){ |
| | | gasFluxExportDTO.setGasValue01(null); |
| | | } |
| | | if (gasFluxExportBO.getC2h6() == 0){ |
| | | gasFluxExportDTO.setGasValue02(null); |
| | | } |
| | | if (gasFluxExportBO.getC3H8() == 0){ |
| | | gasFluxExportDTO.setGasValue03(null); |
| | | } |
| | | if (gasFluxExportBO.getC4h101() == 0){ |
| | | gasFluxExportDTO.setGasValue04(null); |
| | | } |
| | | if (gasFluxExportBO.getH2s() == 0){ |
| | | gasFluxExportDTO.setGasValue05(null); |
| | | } |
| | | if (gasFluxExportBO.getC2h4() == 0){ |
| | | gasFluxExportDTO.setGasValue06(null); |
| | | } |
| | | if (gasFluxExportBO.getC4h102() == 0){ |
| | | gasFluxExportDTO.setGasValue07(null); |
| | | } |
| | | exportLists.add(gasFluxExportDTO); |
| | | } |
| | | |
| | | //sql根据时间查所有,业务中处理数据项 |
| | | |
| | | |
| | | result.setData(exportLists); |
| | | result.setCode(200); |
| | | result.setCount(exportLists.size()); |
| | | result.setMsg("通量数据导出成功"); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Result gasConcentrationExport(GasConcentrationExportBO gasConcentrationExportBO) { |
| | | |
| | | Result<List<GasConcentrationExportDTO>> result = new Result<>(); |
| | | |
| | | List<GasConcentration> gasConcentrationList = gasConcentrationService.gasConcentrationExport(gasConcentrationExportBO); |
| | | List<GasConcentrationExportDTO> exportLists = new ArrayList<>(); |
| | | PositionHandle positionHandle = new PositionHandle(); |
| | | |
| | | for (GasConcentration gasConcentration : gasConcentrationList) { |
| | | GasConcentrationExportDTO gasConcentrationExportDTO = BeanCopyUtils.copyBean(gasConcentration, GasConcentrationExportDTO.class); |
| | | |
| | | gasConcentrationExportDTO.setPosition(positionHandle.positionHandleMethod(gasConcentration.getPosition())); |
| | | gasConcentrationExportDTO.setGasName01("甲烷CH4"); |
| | | gasConcentrationExportDTO.setGasName02("乙烷C2H6"); |
| | | gasConcentrationExportDTO.setGasName03("丙烷C3H8"); |
| | | gasConcentrationExportDTO.setGasName04("丁烷C4H10"); |
| | | gasConcentrationExportDTO.setGasName05("硫化氢H2S"); |
| | | gasConcentrationExportDTO.setGasName06("乙烯C2H4"); |
| | | gasConcentrationExportDTO.setGasName07("异丁烷C4H10"); |
| | | if (gasConcentrationExportBO.getCh4() == 0){ |
| | | gasConcentrationExportDTO.setGasValue01(null); |
| | | } |
| | | if (gasConcentrationExportBO.getC2h6() == 0){ |
| | | gasConcentrationExportDTO.setGasValue02(null); |
| | | } |
| | | if (gasConcentrationExportBO.getC3H8() == 0){ |
| | | gasConcentrationExportDTO.setGasValue03(null); |
| | | } |
| | | if (gasConcentrationExportBO.getC4h101() == 0){ |
| | | gasConcentrationExportDTO.setGasValue04(null); |
| | | } |
| | | if (gasConcentrationExportBO.getH2s() == 0){ |
| | | gasConcentrationExportDTO.setGasValue05(null); |
| | | } |
| | | if (gasConcentrationExportBO.getC2h4() == 0){ |
| | | gasConcentrationExportDTO.setGasValue06(null); |
| | | } |
| | | if (gasConcentrationExportBO.getC4h102() == 0){ |
| | | gasConcentrationExportDTO.setGasValue07(null); |
| | | } |
| | | exportLists.add(gasConcentrationExportDTO); |
| | | } |
| | | |
| | | //sql根据时间查所有,业务中处理数据项 |
| | | |
| | | result.setData(exportLists); |
| | | result.setCode(200); |
| | | result.setCount(exportLists.size()); |
| | | result.setMsg("气体浓度数据导出成功"); |
| | | return result; |
| | | } |
| | | } |