郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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<EmergencyPracticeReportItem> analysisEmgcReportData(EmergencyDataBO emergencyDataBO){
        if(emergencyDataBO == null || emergencyDataBO.getPracticeData() == null || emergencyDataBO.getPracticeData().isEmpty())
            return null;
        List<EmergencyPracticeReportItem> 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<IncidentMonthReportItem> 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<IncidentMonthReportItem> 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;
    }
}