package com.gkhy.safePlatform.riskCtrl.utils; import cn.hutool.core.date.DateUtil; import com.gkhy.safePlatform.doublePrevent.rpc.apimodel.model.resp.RPCDataCountI1RespDTO; import com.gkhy.safePlatform.doublePrevent.rpc.apimodel.model.resp.RPCDataCountI2RespDTO; import com.gkhy.safePlatform.emergency.rpc.api.model.dto.resp.EmergencyExecuteNumDetailRPCResp; import com.gkhy.safePlatform.emergency.rpc.api.model.dto.resp.EmergencyExecuteNumRPCResp; import com.gkhy.safePlatform.emergency.rpc.api.model.dto.resp.EmergencyExecuteTimeRPCResp; import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.IncidentManageCountDetailRPCResp; import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.IncidentManageCountRPCResp; import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.IncidentManageRPCResp; import com.gkhy.safePlatform.riskCtrl.entity.EmergencyPracticeReportItem; import com.gkhy.safePlatform.riskCtrl.entity.IncidentMonthReportItem; import com.gkhy.safePlatform.riskCtrl.entity.PreventMonthReportDetail; import com.gkhy.safePlatform.riskCtrl.model.bo.*; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; public class RiskReportAnalysisHandler { public PreventMonthReportDetail analysisPrevReportData(RiskDataBO riskDataBO){ if(riskDataBO == null) return null; PreventMonthReportDetail detail = new PreventMonthReportDetail(); detail.setRiskTotalCount(riskDataBO.getMajorRiskData().getRiskCount()+riskDataBO.getGeneralRiskData().getRiskCount()); detail.setDeathCount(riskDataBO.getCauseDeathCount()); detail.setHeavyInjureCount(riskDataBO.getCauseHeavyInjureCount()); detail.setLightInjureCount(riskDataBO.getCauseLightInjureCount()); detail.setHeavyRiskCount(riskDataBO.getMajorRiskData().getRiskCount()); detail.setHeavyRiskFinishCount(riskDataBO.getMajorRiskData().getRectifyCount()); detail.setLightRiskCount(riskDataBO.getGeneralRiskData().getRiskCount()); detail.setLightRiskFinishCount(riskDataBO.getGeneralRiskData().getRectifyCount()); return detail; } /** * 计算应急演练月度报表项值 * @return */ public List analysisEmgcReportData(EmergencyDataBO emergencyDataBO){ if(emergencyDataBO == null || emergencyDataBO.getPracticeData() == null || emergencyDataBO.getPracticeData().isEmpty()) return null; List reportItemList = new ArrayList<>(); for(EmergencyCountBO countBO : emergencyDataBO.getPracticeData()){ if(countBO == null) continue; EmergencyPracticeReportItem reportItem = new EmergencyPracticeReportItem(); reportItem.setDepLevel(countBO.getDepLevel()); reportItem.setPracticeCount(countBO.getPracticeCount()); reportItem.setLastPracticeTime(countBO.getLastPracticeTime()); reportItemList.add(reportItem); } return reportItemList; } /** * 计算事故月报数值 * @return */ public List analysisIncidentReportDate(IncidentDataBO incidentDataBO){ if(incidentDataBO == null) return null; //特大事故 IncidentMonthReportItem l1ReportItem = null; IncidentCauseCountBO l1CauseCountBO = incidentDataBO.getL1AccidentData(); if(l1CauseCountBO != null){ l1ReportItem = new IncidentMonthReportItem(); l1ReportItem.setLevel((byte)1); l1ReportItem.setCount(l1CauseCountBO.getAccidentCount()); l1ReportItem.setCauseDeathCount(l1CauseCountBO.getCauseDeathCount()); l1ReportItem.setLoss(l1CauseCountBO.getLoss()); l1ReportItem.setCauseHeavyInjureCount(l1CauseCountBO.getCauseHeavyInjureCount()); l1ReportItem.setCauseLightInjureCount(l1CauseCountBO.getCauseLightInjureCount()); } //重大事故 IncidentMonthReportItem l2ReportItem = null; IncidentCauseCountBO l2CauseCountBO = incidentDataBO.getL2AccidentData(); if(l2CauseCountBO != null){ l2ReportItem = new IncidentMonthReportItem(); l2ReportItem.setLevel((byte)2); l2ReportItem.setCount(l2CauseCountBO.getAccidentCount()); l2ReportItem.setCauseDeathCount(l2CauseCountBO.getCauseDeathCount()); l2ReportItem.setLoss(l2CauseCountBO.getLoss()); l2ReportItem.setCauseHeavyInjureCount(l2CauseCountBO.getCauseHeavyInjureCount()); l2ReportItem.setCauseLightInjureCount(l2CauseCountBO.getCauseLightInjureCount()); } //较大事故 IncidentMonthReportItem l3ReportItem = null; IncidentCauseCountBO l3CauseCountBO = incidentDataBO.getL1AccidentData(); if(l3CauseCountBO != null){ l3ReportItem = new IncidentMonthReportItem(); l3ReportItem.setLevel((byte)3); l3ReportItem.setCount(l3CauseCountBO.getAccidentCount()); l3ReportItem.setCauseDeathCount(l3CauseCountBO.getCauseDeathCount()); l3ReportItem.setLoss(l3CauseCountBO.getLoss()); l3ReportItem.setCauseHeavyInjureCount(l3CauseCountBO.getCauseHeavyInjureCount()); l3ReportItem.setCauseLightInjureCount(l3CauseCountBO.getCauseLightInjureCount()); } //一般事故 IncidentMonthReportItem l4ReportItem = null; IncidentCauseCountBO l4CauseCountBO = incidentDataBO.getL4AccidentData(); if(l4CauseCountBO != null){ l4ReportItem = new IncidentMonthReportItem(); l4ReportItem.setLevel((byte)4); l4ReportItem.setCount(l4CauseCountBO.getAccidentCount()); l4ReportItem.setCauseDeathCount(l4CauseCountBO.getCauseDeathCount()); l4ReportItem.setLoss(l4CauseCountBO.getLoss()); l4ReportItem.setCauseHeavyInjureCount(l4CauseCountBO.getCauseHeavyInjureCount()); l4ReportItem.setCauseLightInjureCount(l4CauseCountBO.getCauseLightInjureCount()); } //未遂事故 IncidentMonthReportItem l5ReportItem = null; IncidentCauseCountBO l5CauseCountBO = incidentDataBO.getL1AccidentData(); if(l5CauseCountBO != null){ l5ReportItem = new IncidentMonthReportItem(); l5ReportItem.setLevel((byte)5); l5ReportItem.setCount(l5CauseCountBO.getAccidentCount()); l5ReportItem.setCauseDeathCount(l5CauseCountBO.getCauseDeathCount()); l5ReportItem.setLoss(l5CauseCountBO.getLoss()); l5ReportItem.setCauseHeavyInjureCount(l5CauseCountBO.getCauseHeavyInjureCount()); l5ReportItem.setCauseLightInjureCount(l5CauseCountBO.getCauseLightInjureCount()); } List list = new ArrayList<>(); if(l1CauseCountBO != null) list.add(l1ReportItem); if(l2CauseCountBO != null) list.add(l2ReportItem); if(l3CauseCountBO != null) list.add(l3ReportItem); if(l4CauseCountBO != null) list.add(l4ReportItem); if(l5CauseCountBO != null) list.add(l5ReportItem); return list; } }