From 1341b18605bcb800eba683eda18640520a6508a5 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期四, 15 九月 2022 15:38:05 +0800
Subject: [PATCH] 事故数据字典fix
---
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/WorkInjuryTypeEnum.java | 47 +++
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoDetailDO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoDetailDO.java | 18
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfo.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportGradeEnum.java | 50 ++++
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationDetailRespDTO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java | 122 ++++++----
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentExpressEnum.java | 46 +++
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/WorkInjuryDeclarationReqDTO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoPageDO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java | 13
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentReportReqDTO.java | 18
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoPageDO.java | 12
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationPageRespDTO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfo.java | 18
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportDetailRespDTO.java | 18
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportPageRespDTO.java | 12
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportLevelEnum.java | 50 ++++
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java | 6
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java | 90 ++++---
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java | 57 +++-
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportTypeEnum.java | 50 ++++
27 files changed, 497 insertions(+), 196 deletions(-)
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java
index 3830da5..accca9c 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java
@@ -40,7 +40,7 @@
private Boolean casualties;
- private String accidentCause;
+ private Byte accidentCause;
private Date occurrenceTime;
@@ -130,11 +130,11 @@
this.casualties = casualties;
}
- public String getAccidentCause() {
+ public Byte getAccidentCause() {
return accidentCause;
}
- public void setAccidentCause(String accidentCause) {
+ public void setAccidentCause(Byte accidentCause) {
this.accidentCause = accidentCause;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java
index d589fd9..8bd74ba 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java
@@ -21,7 +21,7 @@
private Boolean casualties;
- private String accidentCause;
+ private Byte accidentCause;
private Date occurrenceTime;
@@ -74,11 +74,11 @@
this.casualties = casualties;
}
- public String getAccidentCause() {
+ public Byte getAccidentCause() {
return accidentCause;
}
- public void setAccidentCause(String accidentCause) {
+ public void setAccidentCause(Byte accidentCause) {
this.accidentCause = accidentCause;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java
index 36bc5fe..4517334 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java
@@ -26,7 +26,7 @@
private Long createUid;
- private String accidentCause;
+ private Byte accidentCause;
private Date occurrenceTime;
@@ -61,11 +61,11 @@
}
- public String getAccidentCause() {
+ public Byte getAccidentCause() {
return accidentCause;
}
- public void setAccidentCause(String accidentCause) {
+ public void setAccidentCause(Byte accidentCause) {
this.accidentCause = accidentCause;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfo.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfo.java
index 5363e39..80085c2 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfo.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfo.java
@@ -45,9 +45,9 @@
private Long accidentExpressId;
- private String accidentType;
+ private Byte accidentType;
- private String accidentGrade;
+ private Byte accidentGrade;
private BigDecimal economicLoss;
@@ -61,7 +61,7 @@
private Date reportDeadline;
- private String accidentLevel;
+ private Byte accidentLevel;
private String accidentDelayApply;
@@ -137,19 +137,19 @@
this.accidentExpressId = accidentExpressId;
}
- public String getAccidentType() {
+ public Byte getAccidentType() {
return accidentType;
}
- public void setAccidentType(String accidentType) {
+ public void setAccidentType(Byte accidentType) {
this.accidentType = accidentType;
}
- public String getAccidentGrade() {
+ public Byte getAccidentGrade() {
return accidentGrade;
}
- public void setAccidentGrade(String accidentGrade) {
+ public void setAccidentGrade(Byte accidentGrade) {
this.accidentGrade = accidentGrade;
}
@@ -201,11 +201,11 @@
this.reportDeadline = reportDeadline;
}
- public String getAccidentLevel() {
+ public Byte getAccidentLevel() {
return accidentLevel;
}
- public void setAccidentLevel(String accidentLevel) {
+ public void setAccidentLevel(Byte accidentLevel) {
this.accidentLevel = accidentLevel;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoDetailDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoDetailDO.java
index 790db17..1012667 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoDetailDO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoDetailDO.java
@@ -44,9 +44,9 @@
private Long accidentExpressId;
- private String accidentType;
+ private Byte accidentType;
- private String accidentGrade;
+ private Byte accidentGrade;
private BigDecimal economicLoss;
@@ -60,7 +60,7 @@
private Date reportDeadline;
- private String accidentLevel;
+ private Byte accidentLevel;
private String accidentDelayApply;
@@ -96,19 +96,19 @@
this.accidentExpressId = accidentExpressId;
}
- public String getAccidentType() {
+ public Byte getAccidentType() {
return accidentType;
}
- public void setAccidentType(String accidentType) {
+ public void setAccidentType(Byte accidentType) {
this.accidentType = accidentType;
}
- public String getAccidentGrade() {
+ public Byte getAccidentGrade() {
return accidentGrade;
}
- public void setAccidentGrade(String accidentGrade) {
+ public void setAccidentGrade(Byte accidentGrade) {
this.accidentGrade = accidentGrade;
}
@@ -160,11 +160,11 @@
this.reportDeadline = reportDeadline;
}
- public String getAccidentLevel() {
+ public Byte getAccidentLevel() {
return accidentLevel;
}
- public void setAccidentLevel(String accidentLevel) {
+ public void setAccidentLevel(Byte accidentLevel) {
this.accidentLevel = accidentLevel;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoPageDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoPageDO.java
index 120a251..bf8d706 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoPageDO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentReportInfoPageDO.java
@@ -32,9 +32,9 @@
private Long accidentExpressId;
- private String accidentType;
+ private Byte accidentType;
- private String accidentGrade;
+ private Byte accidentGrade;
public Long getId() {
return id;
@@ -52,11 +52,11 @@
this.accidentExpressId = accidentExpressId;
}
- public String getAccidentType() {
+ public Byte getAccidentType() {
return accidentType;
}
- public void setAccidentType(String accidentType) {
+ public void setAccidentType(Byte accidentType) {
this.accidentType = accidentType;
}
@@ -70,11 +70,11 @@
'}';
}
- public String getAccidentGrade() {
+ public Byte getAccidentGrade() {
return accidentGrade;
}
- public void setAccidentGrade(String accidentGrade) {
+ public void setAccidentGrade(Byte accidentGrade) {
this.accidentGrade = accidentGrade;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfo.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfo.java
index 8092fdd..3a737f8 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfo.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfo.java
@@ -31,7 +31,7 @@
private Long accidentExpressId;
- private String workInjuryType;
+ private Byte workInjuryType;
private Date declareDate;
@@ -127,11 +127,11 @@
this.accidentExpressId = accidentExpressId;
}
- public String getWorkInjuryType() {
+ public Byte getWorkInjuryType() {
return workInjuryType;
}
- public void setWorkInjuryType(String workInjuryType) {
+ public void setWorkInjuryType(Byte workInjuryType) {
this.workInjuryType = workInjuryType;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoDetailDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoDetailDO.java
index 2442049..e502a24 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoDetailDO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoDetailDO.java
@@ -42,7 +42,7 @@
private Long accidentExpressId;
- private String workInjuryType;
+ private Byte workInjuryType;
private Date declareDate;
@@ -98,11 +98,11 @@
this.accidentExpressId = accidentExpressId;
}
- public String getWorkInjuryType() {
+ public Byte getWorkInjuryType() {
return workInjuryType;
}
- public void setWorkInjuryType(String workInjuryType) {
+ public void setWorkInjuryType(Byte workInjuryType) {
this.workInjuryType = workInjuryType;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoPageDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoPageDO.java
index 360ffe9..427ae67 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoPageDO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/WorkInjuryDeclarationInfoPageDO.java
@@ -38,7 +38,7 @@
private Long accidentExpressId;
- private String workInjuryType;
+ private Byte workInjuryType;
private Date declareDate;
@@ -77,11 +77,11 @@
this.accidentExpressId = accidentExpressId;
}
- public String getWorkInjuryType() {
+ public Byte getWorkInjuryType() {
return workInjuryType;
}
- public void setWorkInjuryType(String workInjuryType) {
+ public void setWorkInjuryType(Byte workInjuryType) {
this.workInjuryType = workInjuryType;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentExpressEnum.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentExpressEnum.java
new file mode 100644
index 0000000..53510a4
--- /dev/null
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentExpressEnum.java
@@ -0,0 +1,46 @@
+package com.gkhy.safePlatform.incidentManage.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum AccidentExpressEnum {
+
+ HUMAN_UNSAFE_BEHAVIOR((byte) 1, "人的不安全行为"),
+ MATTER_UNSAFE_BEHAVIOR((byte) 2, "物的不安全状态");
+
+ private Byte code;
+ private String value;
+
+ AccidentExpressEnum(Byte code, String value) {
+ this.code = code;
+ this.value = value;
+ }
+
+ public Byte getCode() {
+ return code;
+ }
+
+ public void setCode(Byte code) {
+ this.code = code;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
+ public static Map<Byte, AccidentExpressEnum> toMap() {
+ Map<Byte, AccidentExpressEnum> map = new HashMap();
+ for (AccidentExpressEnum accidentExpressEnum : AccidentExpressEnum.values()) {
+ map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
+ }
+ return map;
+ }
+ public static AccidentExpressEnum getByCode(Byte code){
+ return toMap().get(code);
+ }
+}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportGradeEnum.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportGradeEnum.java
new file mode 100644
index 0000000..a7fb34b
--- /dev/null
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportGradeEnum.java
@@ -0,0 +1,50 @@
+package com.gkhy.safePlatform.incidentManage.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum AccidentReportGradeEnum {
+
+
+ GRADE_ONE((byte) 1, "一级"),
+ GRADE_TWO((byte) 2, "二级"),
+ GRADE_THREE((byte) 3, "三级"),
+ GRADE_FOUR((byte) 4, "四级");
+
+
+ private Byte code;
+ private String value;
+
+ AccidentReportGradeEnum(Byte code, String value) {
+ this.code = code;
+ this.value = value;
+ }
+
+ public Byte getCode() {
+ return code;
+ }
+
+ public void setCode(Byte code) {
+ this.code = code;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
+ public static Map<Byte, AccidentReportGradeEnum> toMap() {
+ Map<Byte, AccidentReportGradeEnum> map = new HashMap();
+ for (AccidentReportGradeEnum accidentExpressEnum : AccidentReportGradeEnum.values()) {
+ map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
+ }
+ return map;
+ }
+ public static AccidentReportGradeEnum getByCode(Byte code){
+ return toMap().get(code);
+ }
+}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportLevelEnum.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportLevelEnum.java
new file mode 100644
index 0000000..10746bc
--- /dev/null
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportLevelEnum.java
@@ -0,0 +1,50 @@
+package com.gkhy.safePlatform.incidentManage.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum AccidentReportLevelEnum {
+
+ LEVEL_ONE((byte) 1, "特大事故"),
+ LEVEL_TWO((byte) 2, "重大事故"),
+ LEVEL_THREE((byte) 3, "较大事故"),
+ LEVEL_FOUR((byte) 4, "一般事故"),
+ LEVEL_FIVE((byte) 5, "未遂事故");
+
+
+ private Byte code;
+ private String value;
+
+ AccidentReportLevelEnum(Byte code, String value) {
+ this.code = code;
+ this.value = value;
+ }
+
+ public Byte getCode() {
+ return code;
+ }
+
+ public void setCode(Byte code) {
+ this.code = code;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
+ public static Map<Byte, AccidentReportLevelEnum> toMap() {
+ Map<Byte, AccidentReportLevelEnum> map = new HashMap();
+ for (AccidentReportLevelEnum accidentExpressEnum : AccidentReportLevelEnum.values()) {
+ map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
+ }
+ return map;
+ }
+ public static AccidentReportLevelEnum getByCode(Byte code){
+ return toMap().get(code);
+ }
+}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportTypeEnum.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportTypeEnum.java
new file mode 100644
index 0000000..10c98f9
--- /dev/null
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentReportTypeEnum.java
@@ -0,0 +1,50 @@
+package com.gkhy.safePlatform.incidentManage.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum AccidentReportTypeEnum {
+
+ TYPE_ONE((byte) 1, "人员伤亡事故"),
+ TYPE_TWO((byte) 2, "火灾爆炸事故"),
+ TYPE_THREE((byte) 3, "危险品泄露事故"),
+ TYPE_FOUR((byte) 4, "设备事故"),
+ TYPE_FIVE((byte) 5, "工艺事故");
+
+
+ private Byte code;
+ private String value;
+
+ AccidentReportTypeEnum(Byte code, String value) {
+ this.code = code;
+ this.value = value;
+ }
+
+ public Byte getCode() {
+ return code;
+ }
+
+ public void setCode(Byte code) {
+ this.code = code;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
+ public static Map<Byte, AccidentReportTypeEnum> toMap() {
+ Map<Byte, AccidentReportTypeEnum> map = new HashMap();
+ for (AccidentReportTypeEnum accidentExpressEnum : AccidentReportTypeEnum.values()) {
+ map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
+ }
+ return map;
+ }
+ public static AccidentReportTypeEnum getByCode(Byte code){
+ return toMap().get(code);
+ }
+}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java
index 5ed5295..e569ede 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java
@@ -4,7 +4,6 @@
ACCIDENT_EXPRESS_NULL("A1001", "事故快报不可为空"),
ACCIDENT_EXPRESS_NOT_EXIST("A1002", "事故快报不存在"),
-
EXPRESS_NAME_NULL("E1001","事故快报名称不能为空"),
EXPRESS_DEPARTMENT_NULL("E1002","事故快报事故部门不能为空"),
EXPRESS_TIME_NULL("E1003","事故快报发生时间不能为空"),
@@ -14,11 +13,11 @@
EXPRESS_BRIEF_PROCESS_NULL("E1007","事故快报事故简要经过不能为空"),
EXPRESS_CASE_PRELIMINARY_ANALYSIS_NULL("E1008","事故快报事故原因初步分析不能为空"),
EXPRESS_EMERGENCY_PRECAUTIONS_NULL("E1009","事故快报应急防范措施不能为空"),
+ EXPRESS_ENUMS_CAUSE_NOT_EXIST("E1010","事故快报事故原因参数非法"),
ACCIDENT_REPORT_NULL("A1003", "事故报告不可为空"),
ACCIDENT_REPORT_NOT_EXIST("A1004", "事故报告不存在"),
-
REPORT_TYPE_NULL("R1001","事故报告事故类型不能为空"),
REPORT_GRADE_NULL("R1002","事故报告事故等级不能为空"),
REPORT_ECONOMIC_LOSS_NULL("R1003","事故报告经济损失不能为空"),
@@ -30,15 +29,19 @@
REPORT_ACCIDENT_HANDLING_NULL("R1009","事故报告事故处理不能为空"),
REPORT_FILL_IN_USER_UID_NULL("R1010","事故报告填写人不能为空"),
REPORT_FILL_IN_TIME_NULL("R1011","事故报告填写日期不能为空"),
+ REPORT_ENUMS_TYPE_NOT_EXIST("E1012","事故报告事故类别参数非法"),
+ REPORT_ENUMS_GRADE_NOT_EXIST("E1013","事故报告事故等级参数非法"),
+ REPORT_ENUMS_LEVEL_NOT_EXIST("E1014","事故报告事故级别参数非法"),
+
WORK_INJURY_DECLARATION_NULL("W1001", "工伤申报不可为空"),
WORK_INJURY_DECLARATION_NOT_EXIST("W1002", "工伤申报不存在"),
-
WORK_INJURY_DECLARATION_USERNAME_NULL("W1003", "申报人名称不可为空"),
WORK_INJURY_DECLARATION_GENDER_NULL("W1003", "申报人名称不可为空"),
WORK_INJURY_DECLARATION_USERNAME_NOT_EXIST("W1005", "申报人部门不可为空"),
WORK_INJURY_DECLARATION_TYPE_NULL("W1006", "工伤类型不可为空"),
- WORK_INJURY_DECLARATION_Date_NULL("W1006", "申报日期不可为空"),
+ WORK_INJURY_DECLARATION_DATA_NULL("W1006", "申报日期不可为空"),
+ WORK_INJURY_DECLARATION_ENUMS_TYPE_NOT_EXIST("W1007","工伤申报工伤类型参数非法"),
CASE_NULL("C1001", "事故案例不可为空"),
CASE_NOT_EXIST("C1002", "事故案例不存在"),
@@ -47,6 +50,8 @@
YEAR_NULL("Y1001" , "年份不能为空"),
+
+
ERROR("A3000", "未知错误");
private String code;
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/WorkInjuryTypeEnum.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/WorkInjuryTypeEnum.java
new file mode 100644
index 0000000..210b5b7
--- /dev/null
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/WorkInjuryTypeEnum.java
@@ -0,0 +1,47 @@
+package com.gkhy.safePlatform.incidentManage.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum WorkInjuryTypeEnum {
+
+ TYPE_TWO((byte) 1, "轻伤"),
+ TYPE_THREE((byte) 2, "重伤");
+
+
+ private Byte code;
+ private String value;
+
+ WorkInjuryTypeEnum(Byte code, String value) {
+ this.code = code;
+ this.value = value;
+ }
+
+ public Byte getCode() {
+ return code;
+ }
+
+ public void setCode(Byte code) {
+ this.code = code;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
+ public static Map<Byte, WorkInjuryTypeEnum> toMap() {
+ Map<Byte, WorkInjuryTypeEnum> map = new HashMap();
+ for (WorkInjuryTypeEnum accidentExpressEnum : WorkInjuryTypeEnum.values()) {
+ map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
+ }
+ return map;
+ }
+ public static WorkInjuryTypeEnum getByCode(Byte code){
+ return toMap().get(code);
+ }
+}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java
index 5ceded1..261c1b2 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java
@@ -27,7 +27,7 @@
private Boolean casualties;
- private String accidentCause;
+ private Byte accidentCause;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date occurrenceTime;
@@ -81,11 +81,11 @@
this.casualties = casualties;
}
- public String getAccidentCause() {
+ public Byte getAccidentCause() {
return accidentCause;
}
- public void setAccidentCause(String accidentCause) {
+ public void setAccidentCause(Byte accidentCause) {
this.accidentCause = accidentCause;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentReportReqDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentReportReqDTO.java
index 839b073..eda7b2c 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentReportReqDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentReportReqDTO.java
@@ -32,9 +32,9 @@
private Long accidentExpressId;
- private String accidentType;
+ private Byte accidentType;
- private String accidentGrade;
+ private Byte accidentGrade;
private BigDecimal economicLoss;
@@ -49,7 +49,7 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reportDeadline;
- private String accidentLevel;
+ private Byte accidentLevel;
private String accidentDelayApply;
@@ -88,19 +88,19 @@
this.accidentExpressId = accidentExpressId;
}
- public String getAccidentType() {
+ public Byte getAccidentType() {
return accidentType;
}
- public void setAccidentType(String accidentType) {
+ public void setAccidentType(Byte accidentType) {
this.accidentType = accidentType;
}
- public String getAccidentGrade() {
+ public Byte getAccidentGrade() {
return accidentGrade;
}
- public void setAccidentGrade(String accidentGrade) {
+ public void setAccidentGrade(Byte accidentGrade) {
this.accidentGrade = accidentGrade;
}
@@ -152,11 +152,11 @@
this.reportDeadline = reportDeadline;
}
- public String getAccidentLevel() {
+ public Byte getAccidentLevel() {
return accidentLevel;
}
- public void setAccidentLevel(String accidentLevel) {
+ public void setAccidentLevel(Byte accidentLevel) {
this.accidentLevel = accidentLevel;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/WorkInjuryDeclarationReqDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/WorkInjuryDeclarationReqDTO.java
index 6402836..93ccde3 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/WorkInjuryDeclarationReqDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/WorkInjuryDeclarationReqDTO.java
@@ -18,7 +18,7 @@
private Long accidentExpressId;
- private String workInjuryType;
+ private Byte workInjuryType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date declareDate;
@@ -77,11 +77,11 @@
this.accidentExpressId = accidentExpressId;
}
- public String getWorkInjuryType() {
+ public Byte getWorkInjuryType() {
return workInjuryType;
}
- public void setWorkInjuryType(String workInjuryType) {
+ public void setWorkInjuryType(Byte workInjuryType) {
this.workInjuryType = workInjuryType;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java
index 8a5271f..9792c14 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java
@@ -19,7 +19,7 @@
private Boolean casualties;
- private String accidentCause;
+ private Byte accidentCause;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date occurrenceTime;
@@ -73,11 +73,11 @@
this.casualties = casualties;
}
- public String getAccidentCause() {
+ public Byte getAccidentCause() {
return accidentCause;
}
- public void setAccidentCause(String accidentCause) {
+ public void setAccidentCause(Byte accidentCause) {
this.accidentCause = accidentCause;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java
index 3a90c70..9d127fd 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java
@@ -36,7 +36,7 @@
private Long createUid;
- private String accidentCause;
+ private Byte accidentCause;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date occurrenceTime;
@@ -72,11 +72,11 @@
}
- public String getAccidentCause() {
+ public Byte getAccidentCause() {
return accidentCause;
}
- public void setAccidentCause(String accidentCause) {
+ public void setAccidentCause(Byte accidentCause) {
this.accidentCause = accidentCause;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportDetailRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportDetailRespDTO.java
index 32f3412..aa6d64d 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportDetailRespDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportDetailRespDTO.java
@@ -84,9 +84,9 @@
private Long accidentExpressId;
- private String accidentType;
+ private Byte accidentType;
- private String accidentGrade;
+ private Byte accidentGrade;
private BigDecimal economicLoss;
@@ -101,7 +101,7 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reportDeadline;
- private String accidentLevel;
+ private Byte accidentLevel;
private String accidentDelayApply;
@@ -140,19 +140,19 @@
this.accidentExpressId = accidentExpressId;
}
- public String getAccidentType() {
+ public Byte getAccidentType() {
return accidentType;
}
- public void setAccidentType(String accidentType) {
+ public void setAccidentType(Byte accidentType) {
this.accidentType = accidentType;
}
- public String getAccidentGrade() {
+ public Byte getAccidentGrade() {
return accidentGrade;
}
- public void setAccidentGrade(String accidentGrade) {
+ public void setAccidentGrade(Byte accidentGrade) {
this.accidentGrade = accidentGrade;
}
@@ -204,11 +204,11 @@
this.reportDeadline = reportDeadline;
}
- public String getAccidentLevel() {
+ public Byte getAccidentLevel() {
return accidentLevel;
}
- public void setAccidentLevel(String accidentLevel) {
+ public void setAccidentLevel(Byte accidentLevel) {
this.accidentLevel = accidentLevel;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportPageRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportPageRespDTO.java
index d4c2081..77e752a 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportPageRespDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentReportPageRespDTO.java
@@ -64,9 +64,9 @@
private Long accidentExpressId;
- private String accidentType;
+ private Byte accidentType;
- private String accidentGrade;
+ private Byte accidentGrade;
public Long getId() {
return id;
@@ -92,19 +92,19 @@
this.accidentExpressId = accidentExpressId;
}
- public String getAccidentType() {
+ public Byte getAccidentType() {
return accidentType;
}
- public void setAccidentType(String accidentType) {
+ public void setAccidentType(Byte accidentType) {
this.accidentType = accidentType;
}
- public String getAccidentGrade() {
+ public Byte getAccidentGrade() {
return accidentGrade;
}
- public void setAccidentGrade(String accidentGrade) {
+ public void setAccidentGrade(Byte accidentGrade) {
this.accidentGrade = accidentGrade;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationDetailRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationDetailRespDTO.java
index 3ba6871..32efbd8 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationDetailRespDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationDetailRespDTO.java
@@ -40,7 +40,7 @@
private Long accidentExpressId;
- private String workInjuryType;
+ private Byte workInjuryType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date declareDate;
@@ -99,11 +99,11 @@
this.accidentExpressId = accidentExpressId;
}
- public String getWorkInjuryType() {
+ public Byte getWorkInjuryType() {
return workInjuryType;
}
- public void setWorkInjuryType(String workInjuryType) {
+ public void setWorkInjuryType(Byte workInjuryType) {
this.workInjuryType = workInjuryType;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationPageRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationPageRespDTO.java
index adc1d94..354b65c 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationPageRespDTO.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/WorkInjuryDeclarationPageRespDTO.java
@@ -35,7 +35,7 @@
private Long accidentExpressId;
- private String workInjuryType;
+ private Byte workInjuryType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date declareDate;
@@ -74,11 +74,11 @@
this.accidentExpressId = accidentExpressId;
}
- public String getWorkInjuryType() {
+ public Byte getWorkInjuryType() {
return workInjuryType;
}
- public void setWorkInjuryType(String workInjuryType) {
+ public void setWorkInjuryType(Byte workInjuryType) {
this.workInjuryType = workInjuryType;
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
index c1e1c20..f67fef8 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
@@ -12,6 +12,7 @@
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.entity.*;
+import com.gkhy.safePlatform.incidentManage.enums.AccidentExpressEnum;
import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes;
import com.gkhy.safePlatform.incidentManage.exception.AccidentException;
import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentExpressCasualtyReqDTO;
@@ -68,7 +69,7 @@
Map<Long, String> depPool = new HashMap<>();
- respList.forEach(AccidentExpressPageRespDTO ->{
+ respList.forEach(AccidentExpressPageRespDTO -> {
// 设置部门名称
if (!depPool.containsKey(AccidentExpressPageRespDTO.getAccidentDepartmentId())) {
ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(AccidentExpressPageRespDTO.getAccidentDepartmentId());
@@ -78,7 +79,8 @@
depPool.put(dep.getDepId(), dep.getDepName());
}
- }}
+ }
+ }
String depName = depPool.get(AccidentExpressPageRespDTO.getAccidentDepartmentId());
AccidentExpressPageRespDTO.setDeptName(depName);
@@ -87,7 +89,7 @@
return new SearchResultVO<>(
true,
pageIndex,
- pageSize,page.getPages(),
+ pageSize, page.getPages(),
page.getTotal(),
respList,
ResultCodes.OK
@@ -101,6 +103,9 @@
//必填项验证
checkRequired(accidentExpressReqDTO);
+ //枚举验证
+ checkEnum(accidentExpressReqDTO);
+
Date nowDate = new Date();
//1.新增事故快报
AccidentExpressInfo accidentExpressInfo = new AccidentExpressInfo();
@@ -111,16 +116,16 @@
accidentExpressInfo.setGmtCreate(nowDate);
accidentExpressInfoService.addAccidentExpress(accidentExpressInfo);
//2.新增事故快报附件
- if (!CollectionUtils.isEmpty(accidentExpressReqDTO.getFileList())){
- addAccidentExpressFile(accidentExpressInfo.getId(),uid,nowDate,accidentExpressReqDTO.getFileList());
+ if (!CollectionUtils.isEmpty(accidentExpressReqDTO.getFileList())) {
+ addAccidentExpressFile(accidentExpressInfo.getId(), uid, nowDate, accidentExpressReqDTO.getFileList());
}
AccidentExpressDetailRespDTO accidentExpressDetailRespDTO = new AccidentExpressDetailRespDTO();
- BeanUtils.copyProperties(accidentExpressInfo,accidentExpressDetailRespDTO);
- return new ResultVO<>(ResultCodes.OK,accidentExpressDetailRespDTO);
+ BeanUtils.copyProperties(accidentExpressInfo, accidentExpressDetailRespDTO);
+ return new ResultVO<>(ResultCodes.OK, accidentExpressDetailRespDTO);
}
- private void addAccidentExpressFile(Long accidentExpressId ,Long uid , Date nowDate , List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList){
+ private void addAccidentExpressFile(Long accidentExpressId, Long uid, Date nowDate, List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList) {
List<AccidentExpressFileInfo> fileInfoList = BeanCopyUtils.copyBeanList(AccidentExpressFileReqDTOList, AccidentExpressFileInfo.class);
fileInfoList.forEach(AccidentExpressFileInfo -> {
AccidentExpressFileInfo.setAccidentExpressId(accidentExpressId);
@@ -128,7 +133,7 @@
AccidentExpressFileInfo.setCreateUid(uid);
AccidentExpressFileInfo.setGmtCreate(nowDate);
});
- for (AccidentExpressFileInfo AccidentExpressFileInfo :fileInfoList){
+ for (AccidentExpressFileInfo AccidentExpressFileInfo : fileInfoList) {
accidentExpressFileInfoService.addAccidentExpressFile(AccidentExpressFileInfo);
}
}
@@ -138,40 +143,46 @@
AccidentExpressDetailRespDTO AccidentExpressDetailRespDTO = new AccidentExpressDetailRespDTO();
//查询是否存在
AccidentExpressInfoDetailDO AccidentExpressInfoDetailDO = accidentExpressInfoService.selectAccidentExpressById(id);
- if (AccidentExpressInfoDetailDO==null){
+ if (AccidentExpressInfoDetailDO == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST);
- }else{
- BeanUtils.copyProperties(AccidentExpressInfoDetailDO,AccidentExpressDetailRespDTO);
+ } else {
+ BeanUtils.copyProperties(AccidentExpressInfoDetailDO, AccidentExpressDetailRespDTO);
//查找对应的附件
List<AccidentExpressFileInfoDO> AccidentExpressFileInfoDOList = accidentExpressFileInfoService.selectByAccidentExpressId(id);
- if (!CollectionUtils.isEmpty(AccidentExpressFileInfoDOList)){
- List<AccidentExpressFileRespDTO> accidentExpressFileRespDTOList = BeanCopyUtils.copyBeanList(AccidentExpressFileInfoDOList , AccidentExpressFileRespDTO.class);
+ if (!CollectionUtils.isEmpty(AccidentExpressFileInfoDOList)) {
+ List<AccidentExpressFileRespDTO> accidentExpressFileRespDTOList = BeanCopyUtils.copyBeanList(AccidentExpressFileInfoDOList, AccidentExpressFileRespDTO.class);
AccidentExpressDetailRespDTO.setFileList(accidentExpressFileRespDTOList);
}
- return new ResultVO<>(ResultCodes.OK ,AccidentExpressDetailRespDTO);
+ return new ResultVO<>(ResultCodes.OK, AccidentExpressDetailRespDTO);
}
}
@Override
public ResultVO updateAccidentExpress(Long uid, AccidentExpressReqDTO accidentExpressReqDTO) {
+
+ //必填项验证
+ checkRequired(accidentExpressReqDTO);
+ //枚举验证
+ checkEnum(accidentExpressReqDTO);
+
Date nowDate = new Date();
//查询是否存在
AccidentExpressInfoDetailDO AccidentExpressInfoDetailDO = accidentExpressInfoService.selectAccidentExpressById(accidentExpressReqDTO.getId());
- if (AccidentExpressInfoDetailDO==null){
+ if (AccidentExpressInfoDetailDO == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST);
- }else{
+ } else {
AccidentExpressInfo accidentExpressInfo = new AccidentExpressInfo();
- BeanUtils.copyProperties(accidentExpressReqDTO,accidentExpressInfo);
+ BeanUtils.copyProperties(accidentExpressReqDTO, accidentExpressInfo);
accidentExpressInfo.setUpdateUid(uid);
accidentExpressInfo.setGmtModitify(nowDate);
accidentExpressInfoService.updateAccidentExpress(accidentExpressInfo);
//修改事故快报附件
- updateAccidentExpressFile(uid,accidentExpressReqDTO.getId(),nowDate,accidentExpressReqDTO.getFileList());
+ updateAccidentExpressFile(uid, accidentExpressReqDTO.getId(), nowDate, accidentExpressReqDTO.getFileList());
return new ResultVO(ResultCodes.OK);
}
}
- private void updateAccidentExpressFile(Long uid ,Long accidentExpressId ,Date nowDate,List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList){
+ private void updateAccidentExpressFile(Long uid, Long accidentExpressId, Date nowDate, List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList) {
List<AccidentExpressFileInfoDO> accidentExpressFileInfoDOList = accidentExpressFileInfoService.selectByAccidentExpressId(accidentExpressId);
List<Long> oldIdsList = accidentExpressFileInfoDOList.stream().map(AccidentExpressFileInfoDO::getId).collect(Collectors.toList());
@@ -181,11 +192,11 @@
List<AccidentExpressFileInfo> addList = new ArrayList<>();
//删除的附件集合(id)
List<Long> deleteList = new ArrayList<>();
- for (AccidentExpressFileReqDTO AccidentExpressFileReqDTO : AccidentExpressFileReqDTOList){
+ for (AccidentExpressFileReqDTO AccidentExpressFileReqDTO : AccidentExpressFileReqDTOList) {
//如果不存在id则表示页面新增的附件
- if (AccidentExpressFileReqDTO.getId() == null){
+ if (AccidentExpressFileReqDTO.getId() == null) {
AccidentExpressFileInfo AccidentExpressFileInfo = new AccidentExpressFileInfo();
- BeanUtils.copyProperties(AccidentExpressFileReqDTO,AccidentExpressFileInfo);
+ BeanUtils.copyProperties(AccidentExpressFileReqDTO, AccidentExpressFileInfo);
AccidentExpressFileInfo.setDelFlag(false);
AccidentExpressFileInfo.setGmtCreate(nowDate);
AccidentExpressFileInfo.setCreateUid(uid);
@@ -193,21 +204,21 @@
addList.add(AccidentExpressFileInfo);
}
//如果存在id则判断页面是否删除
- else{
+ else {
newIdsList.add(AccidentExpressFileReqDTO.getId());
}
}
- for (Long oldId : oldIdsList){
- if (!newIdsList.contains(oldId)){
+ for (Long oldId : oldIdsList) {
+ if (!newIdsList.contains(oldId)) {
deleteList.add(oldId);
}
}
- if (!CollectionUtils.isEmpty(addList)){
- for (AccidentExpressFileInfo AccidentExpressFileInfo : addList){
+ if (!CollectionUtils.isEmpty(addList)) {
+ for (AccidentExpressFileInfo AccidentExpressFileInfo : addList) {
accidentExpressFileInfoService.addAccidentExpressFile(AccidentExpressFileInfo);
}
}
- if (!CollectionUtils.isEmpty(deleteList)){
+ if (!CollectionUtils.isEmpty(deleteList)) {
accidentExpressFileInfoService.deleteAccidentExpressFileByIds(deleteList);
}
}
@@ -215,10 +226,10 @@
@Override
public ResultVO batchDeleteAccidentExpress(Long[] ids) {
- if (ids == null || ids.length==0){
+ if (ids == null || ids.length == 0) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL);
- }else{
- for (Long id : ids){
+ } else {
+ for (Long id : ids) {
deleteAccidentExpress(id);
}
return new ResultVO(ResultCodes.OK);
@@ -228,9 +239,9 @@
private void deleteAccidentExpress(Long id) {
//查询是否存在
AccidentExpressInfoDetailDO AccidentExpressInfoDetailDO = accidentExpressInfoService.selectAccidentExpressById(id);
- if (AccidentExpressInfoDetailDO==null){
+ if (AccidentExpressInfoDetailDO == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST);
- }else{
+ } else {
accidentExpressInfoService.deleteAccidentExpressById(id);
//删除附件
accidentExpressFileInfoService.deleteAccidentExpressFileByAccidentExpressId(id);
@@ -242,17 +253,17 @@
@Override
public ResultVO selectAccidentExpressCasualtyList(Long accidentExpressId) {
List<AccidentExpressCasualtyInfoDO> accidentExpressCasualtyInfoDOList = accidentExpressCasualtyInfoService.selectByAccidentExpressId(accidentExpressId);
- List<AccidentExpressCasualtyRespDTO> respList =BeanCopyUtils.copyBeanList(accidentExpressCasualtyInfoDOList, AccidentExpressCasualtyRespDTO.class);
- return new ResultVO<>(ResultCodes.OK,respList);
+ List<AccidentExpressCasualtyRespDTO> respList = BeanCopyUtils.copyBeanList(accidentExpressCasualtyInfoDOList, AccidentExpressCasualtyRespDTO.class);
+ return new ResultVO<>(ResultCodes.OK, respList);
}
@Override
public ResultVO addAccidentExpressCasualty(Long uid, AccidentExpressCasualtyReqDTO accidentExpressCasualtyReqDTO) {
- if (accidentExpressCasualtyReqDTO.getAccidentExpressId()==null){
+ if (accidentExpressCasualtyReqDTO.getAccidentExpressId() == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL);
- }else{
+ } else {
AccidentExpressCasualtyInfo accidentExpressCasualtyInfo = new AccidentExpressCasualtyInfo();
- BeanUtils.copyProperties(accidentExpressCasualtyReqDTO,accidentExpressCasualtyInfo);
+ BeanUtils.copyProperties(accidentExpressCasualtyReqDTO, accidentExpressCasualtyInfo);
accidentExpressCasualtyInfo.setDelFlag(false);
accidentExpressCasualtyInfo.setGmtCreate(new Date());
accidentExpressCasualtyInfo.setCreateUid(uid);
@@ -268,48 +279,59 @@
}
-
/**
* 验证必填项
+ *
* @return
*/
- private void checkRequired(AccidentExpressReqDTO AccidentExpressReqDTO) {
+ private void checkRequired(AccidentExpressReqDTO accidentExpressReqDTO) {
//名称
- if (StringUtils.isBlank(AccidentExpressReqDTO.getAccidentName())) {
+ if (StringUtils.isBlank(accidentExpressReqDTO.getAccidentName())) {
throw new AccidentException(AccidentResultCodes.EXPRESS_NAME_NULL);
}
//部门
- if (AccidentExpressReqDTO.getAccidentDepartmentId()==null) {
+ if (accidentExpressReqDTO.getAccidentDepartmentId() == null) {
throw new AccidentException(AccidentResultCodes.EXPRESS_DEPARTMENT_NULL);
}
//发生时间
- if (AccidentExpressReqDTO.getOccurrenceTime() == null ) {
+ if (accidentExpressReqDTO.getOccurrenceTime() == null) {
throw new AccidentException(AccidentResultCodes.EXPRESS_TIME_NULL);
}
//发生地点
- if (StringUtils.isBlank(AccidentExpressReqDTO.getOccurrencePlace())) {
+ if (StringUtils.isBlank(accidentExpressReqDTO.getOccurrencePlace())) {
throw new AccidentException(AccidentResultCodes.EXPRESS_PLACE_NULL);
}
//事故原因
- if (StringUtils.isBlank(AccidentExpressReqDTO.getAccidentCause())) {
+ if (accidentExpressReqDTO.getAccidentCause() == null) {
throw new AccidentException(AccidentResultCodes.EXPRESS_CAUSE_NULL);
}
//是否有伤亡
- if (AccidentExpressReqDTO.getCasualties()==null) {
+ if (accidentExpressReqDTO.getCasualties() == null) {
throw new AccidentException(AccidentResultCodes.EXPRESS_CASUALTIES_NULL);
}
//简要经过
- if (StringUtils.isBlank(AccidentExpressReqDTO.getAccidentBriefProcess())) {
+ if (StringUtils.isBlank(accidentExpressReqDTO.getAccidentBriefProcess())) {
throw new AccidentException(AccidentResultCodes.EXPRESS_BRIEF_PROCESS_NULL);
}
//初步分析
- if (StringUtils.isBlank(AccidentExpressReqDTO.getAccidentCausesPreliminaryAnalysis())) {
+ if (StringUtils.isBlank(accidentExpressReqDTO.getAccidentCausesPreliminaryAnalysis())) {
throw new AccidentException(AccidentResultCodes.EXPRESS_CASE_PRELIMINARY_ANALYSIS_NULL);
}
//应急防范措施
- if (StringUtils.isBlank(AccidentExpressReqDTO.getEmergencyPrecautions())) {
+ if (StringUtils.isBlank(accidentExpressReqDTO.getEmergencyPrecautions())) {
throw new AccidentException(AccidentResultCodes.EXPRESS_EMERGENCY_PRECAUTIONS_NULL);
}
}
+ /**
+ *
+ * 枚举验证
+ *
+ */
+ private void checkEnum(AccidentExpressReqDTO accidentExpressReqDTO){
+ if (AccidentExpressEnum.getByCode(accidentExpressReqDTO.getAccidentCause())==null){
+ throw new AccidentException(AccidentResultCodes.EXPRESS_ENUMS_CAUSE_NOT_EXIST);
+ }
+ }
+
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
index 69ee086..72b3cc9 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
@@ -10,6 +10,9 @@
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.entity.*;
+import com.gkhy.safePlatform.incidentManage.enums.AccidentReportGradeEnum;
+import com.gkhy.safePlatform.incidentManage.enums.AccidentReportLevelEnum;
+import com.gkhy.safePlatform.incidentManage.enums.AccidentReportTypeEnum;
import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes;
import com.gkhy.safePlatform.incidentManage.exception.AccidentException;
import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentReportFileReqDTO;
@@ -99,6 +102,8 @@
public ResultVO addAccidentReport(Long uid, AccidentReportReqDTO accidentReportReqDTO) {
//必填项验证
checkRequired(accidentReportReqDTO);
+ // 验证枚举
+ checkEnum(accidentReportReqDTO);
Date nowDate = new Date();
//1.新增事故报告
@@ -157,6 +162,9 @@
@Override
public ResultVO updateAccidentReport(Long uid, AccidentReportReqDTO accidentReportReqDTO) {
+ // 验证枚举
+ checkEnum(accidentReportReqDTO);
+
Date nowDate = new Date();
//查询是否存在
AccidentReportInfoDetailDO AccidentReportInfoDetailDO = accidentReportInfoService.selectAccidentReportById(accidentReportReqDTO.getId());
@@ -218,11 +226,11 @@
@Override
public ResultVO batchDeleteAccidentReport(Long[] ids) {
- if (ids == null || ids.length==0){
+ if (ids == null || ids.length == 0) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NULL);
} else {
- for (Long id : ids){
+ for (Long id : ids) {
deleteAccidentReport(id);
}
return new ResultVO(ResultCodes.OK);
@@ -248,64 +256,79 @@
*
* @return
*/
- private void checkRequired(AccidentReportReqDTO AccidentReportReqDTO) {
+ private void checkRequired(AccidentReportReqDTO accidentReportReqDTO) {
//事故快报
- if (AccidentReportReqDTO.getAccidentExpressId() == null) {
+ if (accidentReportReqDTO.getAccidentExpressId() == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL);
}
- AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(AccidentReportReqDTO.getAccidentExpressId());
+ AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(accidentReportReqDTO.getAccidentExpressId());
if (accidentExpressInfo == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST);
}
//事故类型
- if (StringUtils.isBlank(AccidentReportReqDTO.getAccidentType())) {
+ if (accidentReportReqDTO.getAccidentType() == null) {
throw new AccidentException(AccidentResultCodes.REPORT_TYPE_NULL);
}
//事故等级
- if (StringUtils.isBlank(AccidentReportReqDTO.getAccidentGrade())) {
+ if (accidentReportReqDTO.getAccidentGrade() == null) {
throw new AccidentException(AccidentResultCodes.REPORT_GRADE_NULL);
}
//经济损失
- if (AccidentReportReqDTO.getEconomicLoss() == null) {
+ if (accidentReportReqDTO.getEconomicLoss() == null) {
throw new AccidentException(AccidentResultCodes.REPORT_ECONOMIC_LOSS_NULL);
}
//要求报告完成期限
- if (AccidentReportReqDTO.getReportDeadline() == null) {
+ if (accidentReportReqDTO.getReportDeadline() == null) {
throw new AccidentException(AccidentResultCodes.REPORT_REPORT_DEADLINE_NULL);
}
//事故级别
- if (StringUtils.isBlank(AccidentReportReqDTO.getAccidentLevel())) {
+ if (accidentReportReqDTO.getAccidentLevel() == null) {
throw new AccidentException(AccidentResultCodes.REPORT_LEVEL_NULL);
}
//原因综合分析(直接)
- if (StringUtils.isBlank(AccidentReportReqDTO.getComprehensiveAnalysisDirect())) {
+ if (StringUtils.isBlank(accidentReportReqDTO.getComprehensiveAnalysisDirect())) {
throw new AccidentException(AccidentResultCodes.REPORT_COMPREHENSIVE_ANALYSIS_DIRECT_NULL);
}
//原因综合分析(直接)
- if (StringUtils.isBlank(AccidentReportReqDTO.getComprehensiveAnalysisDirect())) {
+ if (StringUtils.isBlank(accidentReportReqDTO.getComprehensiveAnalysisDirect())) {
throw new AccidentException(AccidentResultCodes.REPORT_COMPREHENSIVE_ANALYSIS_DIRECT_NULL);
}
//原因综合分析(间接)
- if (StringUtils.isBlank(AccidentReportReqDTO.getComprehensiveAnalysisIndirect())) {
+ if (StringUtils.isBlank(accidentReportReqDTO.getComprehensiveAnalysisIndirect())) {
throw new AccidentException(AccidentResultCodes.REPORT_COMPREHENSIVE_ANALYSIS_INDIRECT_NULL);
}
//整改措施
- if (StringUtils.isBlank(AccidentReportReqDTO.getRectificationMeasures())) {
+ if (StringUtils.isBlank(accidentReportReqDTO.getRectificationMeasures())) {
throw new AccidentException(AccidentResultCodes.REPORT_RECTIFICATION_MEASURES_NULL);
}
//事故处理
- if (StringUtils.isBlank(AccidentReportReqDTO.getAccidentHandling())) {
+ if (StringUtils.isBlank(accidentReportReqDTO.getAccidentHandling())) {
throw new AccidentException(AccidentResultCodes.REPORT_ACCIDENT_HANDLING_NULL);
}
//填写人
- if (AccidentReportReqDTO.getFillInUserUid() == null) {
+ if (accidentReportReqDTO.getFillInUserUid() == null) {
throw new AccidentException(AccidentResultCodes.REPORT_FILL_IN_USER_UID_NULL);
}
//填写日期
- if (AccidentReportReqDTO.getFillInTime() == null) {
+ if (accidentReportReqDTO.getFillInTime() == null) {
throw new AccidentException(AccidentResultCodes.REPORT_FILL_IN_TIME_NULL);
}
}
+ /**
+ * 枚举验证
+ */
+ private void checkEnum(AccidentReportReqDTO accidentExpressReqDTO) {
+ if (AccidentReportTypeEnum.getByCode(accidentExpressReqDTO.getAccidentType()) == null) {
+ throw new AccidentException(AccidentResultCodes.REPORT_ENUMS_TYPE_NOT_EXIST);
+ }
+ if (AccidentReportGradeEnum.getByCode(accidentExpressReqDTO.getAccidentGrade()) == null) {
+ throw new AccidentException(AccidentResultCodes.REPORT_ENUMS_GRADE_NOT_EXIST);
+ }
+ if (AccidentReportLevelEnum.getByCode(accidentExpressReqDTO.getAccidentLevel()) == null) {
+ throw new AccidentException(AccidentResultCodes.REPORT_ENUMS_LEVEL_NOT_EXIST);
+ }
+ }
+
}
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java
index f508e17..7429f08 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/WorkInjuryDeclarationServiceImpl.java
@@ -11,6 +11,7 @@
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.entity.*;
import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes;
+import com.gkhy.safePlatform.incidentManage.enums.WorkInjuryTypeEnum;
import com.gkhy.safePlatform.incidentManage.exception.AccidentException;
import com.gkhy.safePlatform.incidentManage.model.dto.req.WorkInjuryDeclarationFileReqDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.req.WorkInjuryDeclarationReqDTO;
@@ -86,7 +87,7 @@
return new SearchResultVO<>(
true,
pageIndex,
- pageSize,page.getPages(),
+ pageSize, page.getPages(),
page.getTotal(),
respList,
ResultCodes.OK
@@ -107,13 +108,13 @@
WorkInjuryDeclarationInfo.setGmtCreate(nowDate);
workInjuryDeclarationInfoService.addWorkInjuryDeclaration(WorkInjuryDeclarationInfo);
//2.新增工伤申报附件
- if (!CollectionUtils.isEmpty(WorkInjuryDeclarationReqDTO.getFileList())){
- addWorkInjuryDeclarationFile(WorkInjuryDeclarationInfo.getId(),uid,nowDate,WorkInjuryDeclarationReqDTO.getFileList());
+ if (!CollectionUtils.isEmpty(WorkInjuryDeclarationReqDTO.getFileList())) {
+ addWorkInjuryDeclarationFile(WorkInjuryDeclarationInfo.getId(), uid, nowDate, WorkInjuryDeclarationReqDTO.getFileList());
}
return new ResultVO(ResultCodes.OK);
}
- private void addWorkInjuryDeclarationFile(Long WorkInjuryDeclarationId ,Long uid , Date nowDate , List<WorkInjuryDeclarationFileReqDTO> WorkInjuryDeclarationFileReqDTOList){
+ private void addWorkInjuryDeclarationFile(Long WorkInjuryDeclarationId, Long uid, Date nowDate, List<WorkInjuryDeclarationFileReqDTO> WorkInjuryDeclarationFileReqDTOList) {
List<WorkInjuryDeclarationFileInfo> fileInfoList = BeanCopyUtils.copyBeanList(WorkInjuryDeclarationFileReqDTOList, WorkInjuryDeclarationFileInfo.class);
fileInfoList.forEach(WorkInjuryDeclarationFileInfo -> {
WorkInjuryDeclarationFileInfo.setWorkInjuryDeclarationId(WorkInjuryDeclarationId);
@@ -121,7 +122,7 @@
WorkInjuryDeclarationFileInfo.setCreateUid(uid);
WorkInjuryDeclarationFileInfo.setGmtCreate(nowDate);
});
- for (WorkInjuryDeclarationFileInfo WorkInjuryDeclarationFileInfo :fileInfoList){
+ for (WorkInjuryDeclarationFileInfo WorkInjuryDeclarationFileInfo : fileInfoList) {
workInjuryDeclarationFileInfoService.addWorkInjuryDeclarationFile(WorkInjuryDeclarationFileInfo);
}
}
@@ -131,17 +132,17 @@
WorkInjuryDeclarationDetailRespDTO WorkInjuryDeclarationDetailRespDTO = new WorkInjuryDeclarationDetailRespDTO();
//查询是否存在
WorkInjuryDeclarationInfoDetailDO WorkInjuryDeclarationInfoDetailDO = workInjuryDeclarationInfoService.selectWorkInjuryDeclarationById(id);
- if (WorkInjuryDeclarationInfoDetailDO==null){
+ if (WorkInjuryDeclarationInfoDetailDO == null) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NOT_EXIST);
- }else{
- BeanUtils.copyProperties(WorkInjuryDeclarationInfoDetailDO,WorkInjuryDeclarationDetailRespDTO);
+ } else {
+ BeanUtils.copyProperties(WorkInjuryDeclarationInfoDetailDO, WorkInjuryDeclarationDetailRespDTO);
//查找对应的附件
List<WorkInjuryDeclarationFileInfoDO> WorkInjuryDeclarationFileInfoDOList = workInjuryDeclarationFileInfoService.selectByWorkInjuryDeclarationId(id);
- if (!CollectionUtils.isEmpty(WorkInjuryDeclarationFileInfoDOList)){
- List<WorkInjuryDeclarationFileRespDTO> WorkInjuryDeclarationFileRespDTOList = BeanCopyUtils.copyBeanList(WorkInjuryDeclarationFileInfoDOList , WorkInjuryDeclarationFileRespDTO.class);
+ if (!CollectionUtils.isEmpty(WorkInjuryDeclarationFileInfoDOList)) {
+ List<WorkInjuryDeclarationFileRespDTO> WorkInjuryDeclarationFileRespDTOList = BeanCopyUtils.copyBeanList(WorkInjuryDeclarationFileInfoDOList, WorkInjuryDeclarationFileRespDTO.class);
WorkInjuryDeclarationDetailRespDTO.setFileList(WorkInjuryDeclarationFileRespDTOList);
}
- return new ResultVO<>(ResultCodes.OK ,WorkInjuryDeclarationDetailRespDTO);
+ return new ResultVO<>(ResultCodes.OK, WorkInjuryDeclarationDetailRespDTO);
}
}
@@ -150,21 +151,21 @@
Date nowDate = new Date();
//查询是否存在
WorkInjuryDeclarationInfoDetailDO WorkInjuryDeclarationInfoDetailDO = workInjuryDeclarationInfoService.selectWorkInjuryDeclarationById(WorkInjuryDeclarationReqDTO.getId());
- if (WorkInjuryDeclarationInfoDetailDO==null){
+ if (WorkInjuryDeclarationInfoDetailDO == null) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NOT_EXIST);
- }else{
+ } else {
WorkInjuryDeclarationInfo WorkInjuryDeclarationInfo = new WorkInjuryDeclarationInfo();
- BeanUtils.copyProperties(WorkInjuryDeclarationReqDTO,WorkInjuryDeclarationInfo);
+ BeanUtils.copyProperties(WorkInjuryDeclarationReqDTO, WorkInjuryDeclarationInfo);
WorkInjuryDeclarationInfo.setUpdateUid(uid);
WorkInjuryDeclarationInfo.setGmtModitify(nowDate);
workInjuryDeclarationInfoService.updateWorkInjuryDeclaration(WorkInjuryDeclarationInfo);
//修改工伤申报附件
- updateWorkInjuryDeclarationFile(uid,WorkInjuryDeclarationReqDTO.getId(),nowDate,WorkInjuryDeclarationReqDTO.getFileList());
+ updateWorkInjuryDeclarationFile(uid, WorkInjuryDeclarationReqDTO.getId(), nowDate, WorkInjuryDeclarationReqDTO.getFileList());
return new ResultVO(ResultCodes.OK);
}
}
- private void updateWorkInjuryDeclarationFile(Long uid ,Long WorkInjuryDeclarationId ,Date nowDate,List<WorkInjuryDeclarationFileReqDTO> WorkInjuryDeclarationFileReqDTOList){
+ private void updateWorkInjuryDeclarationFile(Long uid, Long WorkInjuryDeclarationId, Date nowDate, List<WorkInjuryDeclarationFileReqDTO> WorkInjuryDeclarationFileReqDTOList) {
List<WorkInjuryDeclarationFileInfoDO> WorkInjuryDeclarationFileInfoDOList = workInjuryDeclarationFileInfoService.selectByWorkInjuryDeclarationId(WorkInjuryDeclarationId);
List<Long> oldIdsList = WorkInjuryDeclarationFileInfoDOList.stream().map(WorkInjuryDeclarationFileInfoDO::getId).collect(Collectors.toList());
@@ -174,11 +175,11 @@
List<WorkInjuryDeclarationFileInfo> addList = new ArrayList<>();
//删除的附件集合(id)
List<Long> deleteList = new ArrayList<>();
- for (WorkInjuryDeclarationFileReqDTO WorkInjuryDeclarationFileReqDTO : WorkInjuryDeclarationFileReqDTOList){
+ for (WorkInjuryDeclarationFileReqDTO WorkInjuryDeclarationFileReqDTO : WorkInjuryDeclarationFileReqDTOList) {
//如果不存在id则表示页面新增的附件
- if (WorkInjuryDeclarationFileReqDTO.getId() == null){
+ if (WorkInjuryDeclarationFileReqDTO.getId() == null) {
WorkInjuryDeclarationFileInfo WorkInjuryDeclarationFileInfo = new WorkInjuryDeclarationFileInfo();
- BeanUtils.copyProperties(WorkInjuryDeclarationFileReqDTO,WorkInjuryDeclarationFileInfo);
+ BeanUtils.copyProperties(WorkInjuryDeclarationFileReqDTO, WorkInjuryDeclarationFileInfo);
WorkInjuryDeclarationFileInfo.setDelFlag(false);
WorkInjuryDeclarationFileInfo.setGmtCreate(nowDate);
WorkInjuryDeclarationFileInfo.setCreateUid(uid);
@@ -186,21 +187,21 @@
addList.add(WorkInjuryDeclarationFileInfo);
}
//如果存在id则判断页面是否删除
- else{
+ else {
newIdsList.add(WorkInjuryDeclarationFileReqDTO.getId());
}
}
- for (Long oldId : oldIdsList){
- if (!newIdsList.contains(oldId)){
+ for (Long oldId : oldIdsList) {
+ if (!newIdsList.contains(oldId)) {
deleteList.add(oldId);
}
}
- if (!CollectionUtils.isEmpty(addList)){
- for (WorkInjuryDeclarationFileInfo WorkInjuryDeclarationFileInfo : addList){
+ if (!CollectionUtils.isEmpty(addList)) {
+ for (WorkInjuryDeclarationFileInfo WorkInjuryDeclarationFileInfo : addList) {
workInjuryDeclarationFileInfoService.addWorkInjuryDeclarationFile(WorkInjuryDeclarationFileInfo);
}
}
- if (!CollectionUtils.isEmpty(deleteList)){
+ if (!CollectionUtils.isEmpty(deleteList)) {
workInjuryDeclarationFileInfoService.deleteWorkInjuryDeclarationFileByIds(deleteList);
}
}
@@ -209,10 +210,10 @@
@Override
public ResultVO batchDeleteWorkInjuryDeclaration(Long[] ids) {
- if (ids == null || ids.length==0){
+ if (ids == null || ids.length == 0) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NULL);
- }else{
- for (Long id : ids){
+ } else {
+ for (Long id : ids) {
deleteWorkInjuryDeclaration(id);
}
return new ResultVO(ResultCodes.OK);
@@ -222,9 +223,9 @@
private void deleteWorkInjuryDeclaration(Long id) {
//查询是否存在
WorkInjuryDeclarationInfoDetailDO WorkInjuryDeclarationInfoDetailDO = workInjuryDeclarationInfoService.selectWorkInjuryDeclarationById(id);
- if (WorkInjuryDeclarationInfoDetailDO==null){
+ if (WorkInjuryDeclarationInfoDetailDO == null) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_NOT_EXIST);
- }else{
+ } else {
workInjuryDeclarationInfoService.deleteWorkInjuryDeclarationById(id);
//删除附件
workInjuryDeclarationFileInfoService.deleteWorkInjuryDeclarationFileByWorkInjuryDeclarationId(id);
@@ -232,41 +233,48 @@
}
-
-
/**
* 验证必填项
+ *
* @return
*/
- private void checkRequired(WorkInjuryDeclarationReqDTO WorkInjuryDeclarationReqDTO) {
+ private void checkRequired(WorkInjuryDeclarationReqDTO workInjuryDeclarationReqDTO) {
//申报人姓名
- if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getDeclareUserName())) {
+ if (StringUtils.isBlank(workInjuryDeclarationReqDTO.getDeclareUserName())) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_USERNAME_NULL);
}
//事故性别
- if (WorkInjuryDeclarationReqDTO.getDeclareUserGender() == null ) {
+ if (workInjuryDeclarationReqDTO.getDeclareUserGender() == null) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_GENDER_NULL);
}
//申报人部门
- if (WorkInjuryDeclarationReqDTO.getDeclareDepartmentId()==null) {
+ if (workInjuryDeclarationReqDTO.getDeclareDepartmentId() == null) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_USERNAME_NOT_EXIST);
}
//事故名称
- if (WorkInjuryDeclarationReqDTO.getAccidentExpressId() == null ) {
+ if (workInjuryDeclarationReqDTO.getAccidentExpressId() == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL);
}
- AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(WorkInjuryDeclarationReqDTO.getAccidentExpressId());
+ AccidentExpressInfoDetailDO accidentExpressInfo = accidentExpressInfoService.selectAccidentExpressById(workInjuryDeclarationReqDTO.getAccidentExpressId());
if (accidentExpressInfo == null) {
throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST);
}
//工伤类型
- if (StringUtils.isBlank(WorkInjuryDeclarationReqDTO.getWorkInjuryType())) {
+ if (workInjuryDeclarationReqDTO.getWorkInjuryType() == null) {
throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_TYPE_NULL);
}
//申报日期
- if (WorkInjuryDeclarationReqDTO.getDeclareDate()==null) {
- throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_Date_NULL);
+ if (workInjuryDeclarationReqDTO.getDeclareDate() == null) {
+ throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_DATA_NULL);
}
}
+ /**
+ * 枚举验证
+ */
+ private void checkEnum(WorkInjuryDeclarationReqDTO workInjuryDeclarationReqDTO) {
+ if (WorkInjuryTypeEnum.getByCode(workInjuryDeclarationReqDTO.getWorkInjuryType()) == null) {
+ throw new AccidentException(AccidentResultCodes.WORK_INJURY_DECLARATION_ENUMS_TYPE_NOT_EXIST);
+ }
+ }
}
--
Gitblit v1.9.2