From f4b7ba5ab9850b45e969ff5967b1214f708f1f70 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: Fri, 29 Jul 2022 16:36:23 +0800
Subject: [PATCH] 导入/导出模块
---
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelSheet.java | 66 +
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelUtil.java | 762 +++++++++++++++
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/FieldForSortting.java | 61 +
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentDetailExcel.java | 82 +
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/req/RewardPunishmentStandardImportExcel.java | 65 +
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/EquipmentInfoImportExcel.java | 530 ++++++++++
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLog.java | 79 +
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelCell.java | 81 +
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentStandardExcel.java | 66 +
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/DateUtils.java | 70 +
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLogs.java | 62 +
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/KeypointEquipmentInfoExcel.java | 345 ++++++
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/EquipmentInfoExcel.java | 541 ++++++++++
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/KeypointEquipmentInfoImportExcel.java | 184 +++
14 files changed, 2,994 insertions(+), 0 deletions(-)
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/EquipmentInfoImportExcel.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/EquipmentInfoImportExcel.java
new file mode 100644
index 0000000..5020ff6
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/EquipmentInfoImportExcel.java
@@ -0,0 +1,530 @@
+package com.gkhy.safePlatform.equipment.model.dto.req;
+
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelCell;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+public class EquipmentInfoImportExcel implements Serializable {
+ //类型/类别外键
+ @ExcelCell(index = 1)
+ private Long equipmentTypeId;
+ //具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施
+ @ExcelCell(index = 2)
+ private Integer infoType;
+ //名称
+ @ExcelCell(index = 3)
+ private String qName;
+ //位号
+ @ExcelCell(index = 4)
+ private String positionNum;
+ //用途
+ @ExcelCell(index = 5)
+ private String qUsage;
+ //型号
+ @ExcelCell(index = 6)
+ private String model;
+ //单位部门外键
+ @ExcelCell(index = 7)
+ private Long departmentId;
+ //设置部位
+ @ExcelCell(index = 8)
+ private String setPart;
+ //生产日期
+ @ExcelCell(index = 9)
+ private Timestamp produceTime;
+ //使用期限(天)
+ @ExcelCell(index = 10)
+ private String useEndDay;
+ //生命周期 1:已使用 2:库存中 3:报废
+ @ExcelCell(index = 11)
+ private Integer lifeCycle;
+ //投用日期
+ @ExcelCell(index = 12)
+ private Timestamp useDate;
+ //维修状态 1:维修中 2:已修好
+ @ExcelCell(index = 13)
+ private Integer repairStatus;
+ //停用状态 1:停用 2.在用 3.维修 4.报废
+ @ExcelCell(index = 14)
+ private Integer stopStatus;
+ //上次检查日期
+ @ExcelCell(index = 15)
+ private Timestamp previousCheckDate;
+ //上次检测日期
+ @ExcelCell(index = 16)
+ private Timestamp previousTestDate;
+ //上次保养日期
+ @ExcelCell(index = 17)
+ private Timestamp previousTakecareDate;
+ //下次检查日期
+ @ExcelCell(index = 18)
+ private Timestamp nextCheckDate;
+ //下次检测日期
+ @ExcelCell(index = 19)
+ private Timestamp nextTestDate;
+ //下次保养日期
+ @ExcelCell(index = 20)
+ private Timestamp nextTakecareDate;
+ //负责人ID外键
+ @ExcelCell(index = 21)
+ private Long leadingPersonId;
+ //负责人部门外键
+ @ExcelCell(index = 22)
+ private Long leadingPersonDepartmentId;
+ //供应商
+ @ExcelCell(index = 23)
+ private String supplyName;
+ //使用说明
+ @ExcelCell(index = 24)
+ private String useMemo;
+ //是否检查 1:是 2:否
+ @ExcelCell(index = 25)
+ private Integer isNeedCheck;
+ //检查周期
+ @ExcelCell(index = 26)
+ private String checkCycle;
+ //检查提前提醒
+ @ExcelCell(index = 27)
+ private String checkWarn;
+ //是否检测 1:是 2:否
+ @ExcelCell(index = 28)
+ private Integer isNeedTest;
+ //检测周期
+ @ExcelCell(index = 29)
+ private String testCycle;
+ //检测提前提醒
+ @ExcelCell(index = 30)
+ private String testWarn;
+ //是否保养 1:是 2:否
+ @ExcelCell(index = 31)
+ private Integer isNeedTakecare;
+ //检查内容
+ @ExcelCell(index = 32)
+ private String checkContent;
+ //负责部门/外键
+ @ExcelCell(index = 33)
+ private Long leadingDepartmentId;
+ //检查指标
+ @ExcelCell(index = 34)
+ private String checkPoint;
+ //预警值
+ @ExcelCell(index = 35)
+ private String alertNum;
+ //联锁值
+ @ExcelCell(index = 36)
+ private String lockNum;
+ //停用理由
+ @ExcelCell(index = 37)
+ private String stopReason;
+ //停用后措施
+ @ExcelCell(index = 38)
+ private String afterStopStep;
+ //实际停用日期
+ @ExcelCell(index = 39)
+ private Timestamp actualStopDate;
+ //停用提交人/外键
+ @ExcelCell(index = 40)
+ private Long stopSubmitPersonId;
+ //停用提交日期
+ @ExcelCell(index = 41)
+ private Timestamp stopSubmitDate;
+ //恢复理由
+ @ExcelCell(index = 42)
+ private String recoveryReason;
+ //恢复填报日期
+ @ExcelCell(index = 43)
+ private Timestamp recoverySubmitDate;
+ //实际恢复日期
+ @ExcelCell(index = 44)
+ private Timestamp actualRecoveryDate;
+ //报废理由
+ @ExcelCell(index = 45)
+ private String destoryReason;
+ //报废填报日期
+ @ExcelCell(index = 46)
+ private Timestamp destorySubmitDate;
+ //实际报废日期
+ @ExcelCell(index = 47)
+ private Timestamp actualDestoryDate;
+
+
+ //类型/类别外键
+ public Long getEquipmentTypeId() {
+ return equipmentTypeId;
+ }
+
+ public void setEquipmentTypeId(Long equipmentTypeId) {
+ this.equipmentTypeId = equipmentTypeId;
+ }
+ //具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施
+ public Integer getInfoType() {
+ return infoType;
+ }
+
+ public void setInfoType(Integer infoType) {
+ this.infoType = infoType;
+ }
+ //位号
+ public String getPositionNum() {
+ return positionNum;
+ }
+
+ public void setPositionNum(String positionNum) {
+ this.positionNum = positionNum;
+ }
+
+ public String getqName() {
+ return qName;
+ }
+
+ public void setqName(String qName) {
+ this.qName = qName;
+ }
+
+ public String getqUsage() {
+ return qUsage;
+ }
+
+ public void setqUsage(String qUsage) {
+ this.qUsage = qUsage;
+ }
+
+ //型号
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+ //单位部门外键
+ public Long getDepartmentId() {
+ return departmentId;
+ }
+
+ public void setDepartmentId(Long departmentId) {
+ this.departmentId = departmentId;
+ }
+ //设置部位
+ public String getSetPart() {
+ return setPart;
+ }
+
+ public void setSetPart(String setPart) {
+ this.setPart = setPart;
+ }
+ //生产日期
+ public Timestamp getProduceTime() {
+ return produceTime;
+ }
+
+ public void setProduceTime(Timestamp produceTime) {
+ this.produceTime = produceTime;
+ }
+ //使用期限(天)
+ public String getUseEndDay() {
+ return useEndDay;
+ }
+
+ public void setUseEndDay(String useEndDay) {
+ this.useEndDay = useEndDay;
+ }
+ //生命周期 1:已使用 2:库存中 3:报废
+ public Integer getLifeCycle() {
+ return lifeCycle;
+ }
+
+ public void setLifeCycle(Integer lifeCycle) {
+ this.lifeCycle = lifeCycle;
+ }
+ //投用日期
+ public Timestamp getUseDate() {
+ return useDate;
+ }
+
+ public void setUseDate(Timestamp useDate) {
+ this.useDate = useDate;
+ }
+ //维修状态 1:维修中 2:已修好
+ public Integer getRepairStatus() {
+ return repairStatus;
+ }
+
+ public void setRepairStatus(Integer repairStatus) {
+ this.repairStatus = repairStatus;
+ }
+ //停用状态 1:停用 2.在用 3.维修 4.报废
+ public Integer getStopStatus() {
+ return stopStatus;
+ }
+
+ public void setStopStatus(Integer stopStatus) {
+ this.stopStatus = stopStatus;
+ }
+ //上次检查日期
+ public Timestamp getPreviousCheckDate() {
+ return previousCheckDate;
+ }
+
+ public void setPreviousCheckDate(Timestamp previousCheckDate) {
+ this.previousCheckDate = previousCheckDate;
+ }
+ //上次检测日期
+ public Timestamp getPreviousTestDate() {
+ return previousTestDate;
+ }
+
+ public void setPreviousTestDate(Timestamp previousTestDate) {
+ this.previousTestDate = previousTestDate;
+ }
+ //上次保养日期
+ public Timestamp getPreviousTakecareDate() {
+ return previousTakecareDate;
+ }
+
+ public void setPreviousTakecareDate(Timestamp previousTakecareDate) {
+ this.previousTakecareDate = previousTakecareDate;
+ }
+ //下次检查日期
+ public Timestamp getNextCheckDate() {
+ return nextCheckDate;
+ }
+
+ public void setNextCheckDate(Timestamp nextCheckDate) {
+ this.nextCheckDate = nextCheckDate;
+ }
+ //下次检测日期
+ public Timestamp getNextTestDate() {
+ return nextTestDate;
+ }
+
+ public void setNextTestDate(Timestamp nextTestDate) {
+ this.nextTestDate = nextTestDate;
+ }
+ //下次保养日期
+ public Timestamp getNextTakecareDate() {
+ return nextTakecareDate;
+ }
+
+ public void setNextTakecareDate(Timestamp nextTakecareDate) {
+ this.nextTakecareDate = nextTakecareDate;
+ }
+ //负责人ID外键
+ public Long getLeadingPersonId() {
+ return leadingPersonId;
+ }
+
+ public void setLeadingPersonId(Long leadingPersonId) {
+ this.leadingPersonId = leadingPersonId;
+ }
+ //负责人部门外键
+ public Long getLeadingPersonDepartmentId() {
+ return leadingPersonDepartmentId;
+ }
+
+ public void setLeadingPersonDepartmentId(Long leadingPersonDepartmentId) {
+ this.leadingPersonDepartmentId = leadingPersonDepartmentId;
+ }
+ //供应商
+ public String getSupplyName() {
+ return supplyName;
+ }
+
+ public void setSupplyName(String supplyName) {
+ this.supplyName = supplyName;
+ }
+ //使用说明
+ public String getUseMemo() {
+ return useMemo;
+ }
+
+ public void setUseMemo(String useMemo) {
+ this.useMemo = useMemo;
+ }
+ //是否检查 1:是 2:否
+ public Integer getIsNeedCheck() {
+ return isNeedCheck;
+ }
+
+ public void setIsNeedCheck(Integer isNeedCheck) {
+ this.isNeedCheck = isNeedCheck;
+ }
+ //检查周期
+ public String getCheckCycle() {
+ return checkCycle;
+ }
+
+ public void setCheckCycle(String checkCycle) {
+ this.checkCycle = checkCycle;
+ }
+ //检查提前提醒
+ public String getCheckWarn() {
+ return checkWarn;
+ }
+
+ public void setCheckWarn(String checkWarn) {
+ this.checkWarn = checkWarn;
+ }
+ //是否检测 1:是 2:否
+ public Integer getIsNeedTest() {
+ return isNeedTest;
+ }
+
+ public void setIsNeedTest(Integer isNeedTest) {
+ this.isNeedTest = isNeedTest;
+ }
+ //检测周期
+ public String getTestCycle() {
+ return testCycle;
+ }
+
+ public void setTestCycle(String testCycle) {
+ this.testCycle = testCycle;
+ }
+ //检测提前提醒
+ public String getTestWarn() {
+ return testWarn;
+ }
+
+ public void setTestWarn(String testWarn) {
+ this.testWarn = testWarn;
+ }
+ //是否保养 1:是 2:否
+ public Integer getIsNeedTakecare() {
+ return isNeedTakecare;
+ }
+
+ public void setIsNeedTakecare(Integer isNeedTakecare) {
+ this.isNeedTakecare = isNeedTakecare;
+ }
+ //检查内容
+ public String getCheckContent() {
+ return checkContent;
+ }
+
+ public void setCheckContent(String checkContent) {
+ this.checkContent = checkContent;
+ }
+ //负责部门/外键
+ public Long getLeadingDepartmentId() {
+ return leadingDepartmentId;
+ }
+
+ public void setLeadingDepartmentId(Long leadingDepartmentId) {
+ this.leadingDepartmentId = leadingDepartmentId;
+ }
+ //检查指标
+ public String getCheckPoint() {
+ return checkPoint;
+ }
+
+ public void setCheckPoint(String checkPoint) {
+ this.checkPoint = checkPoint;
+ }
+ //预警值
+ public String getAlertNum() {
+ return alertNum;
+ }
+
+ public void setAlertNum(String alertNum) {
+ this.alertNum = alertNum;
+ }
+ //联锁值
+ public String getLockNum() {
+ return lockNum;
+ }
+
+ public void setLockNum(String lockNum) {
+ this.lockNum = lockNum;
+ }
+ //停用理由
+ public String getStopReason() {
+ return stopReason;
+ }
+
+ public void setStopReason(String stopReason) {
+ this.stopReason = stopReason;
+ }
+ //停用后措施
+ public String getAfterStopStep() {
+ return afterStopStep;
+ }
+
+ public void setAfterStopStep(String afterStopStep) {
+ this.afterStopStep = afterStopStep;
+ }
+ //实际停用日期
+ public Timestamp getActualStopDate() {
+ return actualStopDate;
+ }
+
+ public void setActualStopDate(Timestamp actualStopDate) {
+ this.actualStopDate = actualStopDate;
+ }
+ //停用提交人/外键
+ public Long getStopSubmitPersonId() {
+ return stopSubmitPersonId;
+ }
+
+ public void setStopSubmitPersonId(Long stopSubmitPersonId) {
+ this.stopSubmitPersonId = stopSubmitPersonId;
+ }
+ //停用提交日期
+ public Timestamp getStopSubmitDate() {
+ return stopSubmitDate;
+ }
+
+ public void setStopSubmitDate(Timestamp stopSubmitDate) {
+ this.stopSubmitDate = stopSubmitDate;
+ }
+ //恢复理由
+ public String getRecoveryReason() {
+ return recoveryReason;
+ }
+
+ public void setRecoveryReason(String recoveryReason) {
+ this.recoveryReason = recoveryReason;
+ }
+ //恢复填报日期
+ public Timestamp getRecoverySubmitDate() {
+ return recoverySubmitDate;
+ }
+
+ public void setRecoverySubmitDate(Timestamp recoverySubmitDate) {
+ this.recoverySubmitDate = recoverySubmitDate;
+ }
+ //实际恢复日期
+ public Timestamp getActualRecoveryDate() {
+ return actualRecoveryDate;
+ }
+
+ public void setActualRecoveryDate(Timestamp actualRecoveryDate) {
+ this.actualRecoveryDate = actualRecoveryDate;
+ }
+ //报废理由
+ public String getDestoryReason() {
+ return destoryReason;
+ }
+
+ public void setDestoryReason(String destoryReason) {
+ this.destoryReason = destoryReason;
+ }
+ //报废填报日期
+ public Timestamp getDestorySubmitDate() {
+ return destorySubmitDate;
+ }
+
+ public void setDestorySubmitDate(Timestamp destorySubmitDate) {
+ this.destorySubmitDate = destorySubmitDate;
+ }
+ //实际报废日期
+ public Timestamp getActualDestoryDate() {
+ return actualDestoryDate;
+ }
+
+ public void setActualDestoryDate(Timestamp actualDestoryDate) {
+ this.actualDestoryDate = actualDestoryDate;
+ }
+
+}
\ No newline at end of file
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/KeypointEquipmentInfoImportExcel.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/KeypointEquipmentInfoImportExcel.java
new file mode 100644
index 0000000..9217946
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/req/KeypointEquipmentInfoImportExcel.java
@@ -0,0 +1,184 @@
+package com.gkhy.safePlatform.equipment.model.dto.req;
+
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelCell;
+
+import java.io.Serializable;
+
+public class KeypointEquipmentInfoImportExcel implements Serializable {
+ //类型/类别外键
+ @ExcelCell(index = 1)
+ private Long equipmentTypeId;
+ //名称
+ @ExcelCell(index = 2)
+ private String name;
+ //单位部门外键
+ @ExcelCell(index = 3)
+ private Long departmentId;
+ //所属部门名称
+ private String departmentName;
+ //具体位置
+ @ExcelCell(index = 4)
+ private String position;
+ //负责人姓名
+ @ExcelCell(index = 5)
+ private String leadingPersonName;
+ //联系人/外键
+ @ExcelCell(index = 6)
+ private Long connectPersonId;
+ //录入人/外键
+ @ExcelCell(index = 7)
+ private Long inputPersonId;
+ //责任人/外键
+ @ExcelCell(index = 8)
+ private Long responsibilityPersonId;
+ //装置部位分类 1:关键装置 2:重点部位
+ @ExcelCell(index = 9)
+ private Integer partType;
+ //检查周期
+ @ExcelCell(index = 10)
+ private String checkCycle;
+ //应急预案/外键
+ @ExcelCell(index = 11)
+ private Long emergencePlanId;
+ //主要危险有害因素
+ @ExcelCell(index = 12)
+ private String dangerousElement;
+ //易导致风险
+ @ExcelCell(index = 13)
+ private String toDangerous;
+ //应急处置措施
+ @ExcelCell(index = 14)
+ private String treatment;
+ //现场图片
+ @ExcelCell(index = 15)
+ private String scenePic;
+
+ public String getDepartmentName() {
+ return departmentName;
+ }
+
+ public void setDepartmentName(String departmentName) {
+ this.departmentName = departmentName;
+ }
+ //类型/类别外键
+ public Long getEquipmentTypeId() {
+ return equipmentTypeId;
+ }
+
+ public void setEquipmentTypeId(Long equipmentTypeId) {
+ this.equipmentTypeId = equipmentTypeId;
+ }
+ //名称
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //单位部门外键
+ public Long getDepartmentId() {
+ return departmentId;
+ }
+
+ public void setDepartmentId(Long departmentId) {
+ this.departmentId = departmentId;
+ }
+ //具体位置
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+ //负责人姓名
+ public String getLeadingPersonName() {
+ return leadingPersonName;
+ }
+
+ public void setLeadingPersonName(String leadingPersonName) {
+ this.leadingPersonName = leadingPersonName;
+ }
+ //联系人/外键
+ public Long getConnectPersonId() {
+ return connectPersonId;
+ }
+
+ public void setConnectPersonId(Long connectPersonId) {
+ this.connectPersonId = connectPersonId;
+ }
+ //录入人/外键
+ public Long getInputPersonId() {
+ return inputPersonId;
+ }
+
+ public void setInputPersonId(Long inputPersonId) {
+ this.inputPersonId = inputPersonId;
+ }
+ //责任人/外键
+ public Long getResponsibilityPersonId() {
+ return responsibilityPersonId;
+ }
+
+ public void setResponsibilityPersonId(Long responsibilityPersonId) {
+ this.responsibilityPersonId = responsibilityPersonId;
+ }
+ //装置部位分类 1:关键装置 2:重点部位
+ public Integer getPartType() {
+ return partType;
+ }
+
+ public void setPartType(Integer partType) {
+ this.partType = partType;
+ }
+ //检查周期
+ public String getCheckCycle() {
+ return checkCycle;
+ }
+
+ public void setCheckCycle(String checkCycle) {
+ this.checkCycle = checkCycle;
+ }
+ //应急预案/外键
+ public Long getEmergencePlanId() {
+ return emergencePlanId;
+ }
+
+ public void setEmergencePlanId(Long emergencePlanId) {
+ this.emergencePlanId = emergencePlanId;
+ }
+ //主要危险有害因素
+ public String getDangerousElement() {
+ return dangerousElement;
+ }
+
+ public void setDangerousElement(String dangerousElement) {
+ this.dangerousElement = dangerousElement;
+ }
+ //易导致风险
+ public String getToDangerous() {
+ return toDangerous;
+ }
+
+ public void setToDangerous(String toDangerous) {
+ this.toDangerous = toDangerous;
+ }
+ //应急处置措施
+ public String getTreatment() {
+ return treatment;
+ }
+
+ public void setTreatment(String treatment) {
+ this.treatment = treatment;
+ }
+ //现场图片
+ public String getScenePic() {
+ return scenePic;
+ }
+
+ public void setScenePic(String scenePic) {
+ this.scenePic = scenePic;
+ }
+
+}
\ No newline at end of file
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/EquipmentInfoExcel.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/EquipmentInfoExcel.java
new file mode 100644
index 0000000..e140344
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/EquipmentInfoExcel.java
@@ -0,0 +1,541 @@
+package com.gkhy.safePlatform.equipment.model.dto.resp;
+
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelCell;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+public class EquipmentInfoExcel implements Serializable {
+ //ID
+ @ExcelCell(index = 0)
+ private Long id;
+ //类型/类别外键
+ @ExcelCell(index = 1)
+ private Long equipmentTypeId;
+ //具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施
+ @ExcelCell(index = 2)
+ private Integer infoType;
+ //名称
+ @ExcelCell(index = 3)
+ private String qName;
+ //位号
+ @ExcelCell(index = 4)
+ private String positionNum;
+ //用途
+ @ExcelCell(index = 5)
+ private String qUsage;
+ //型号
+ @ExcelCell(index = 6)
+ private String model;
+ //单位部门外键
+ @ExcelCell(index = 7)
+ private Long departmentId;
+ //设置部位
+ @ExcelCell(index = 8)
+ private String setPart;
+ //生产日期
+ @ExcelCell(index = 9)
+ private Timestamp produceTime;
+ //使用期限(天)
+ @ExcelCell(index = 10)
+ private String useEndDay;
+ //生命周期 1:已使用 2:库存中 3:报废
+ @ExcelCell(index = 11)
+ private Integer lifeCycle;
+ //投用日期
+ @ExcelCell(index = 12)
+ private Timestamp useDate;
+ //维修状态 1:维修中 2:已修好
+ @ExcelCell(index = 13)
+ private Integer repairStatus;
+ //停用状态 1:停用 2.在用 3.维修 4.报废
+ @ExcelCell(index = 14)
+ private Integer stopStatus;
+ //上次检查日期
+ @ExcelCell(index = 15)
+ private Timestamp previousCheckDate;
+ //上次检测日期
+ @ExcelCell(index = 16)
+ private Timestamp previousTestDate;
+ //上次保养日期
+ @ExcelCell(index = 17)
+ private Timestamp previousTakecareDate;
+ //下次检查日期
+ @ExcelCell(index = 18)
+ private Timestamp nextCheckDate;
+ //下次检测日期
+ @ExcelCell(index = 19)
+ private Timestamp nextTestDate;
+ //下次保养日期
+ @ExcelCell(index = 20)
+ private Timestamp nextTakecareDate;
+ //负责人ID外键
+ @ExcelCell(index = 21)
+ private Long leadingPersonId;
+ //负责人部门外键
+ @ExcelCell(index = 22)
+ private Long leadingPersonDepartmentId;
+ //供应商
+ @ExcelCell(index = 23)
+ private String supplyName;
+ //使用说明
+ @ExcelCell(index = 24)
+ private String useMemo;
+ //是否检查 1:是 2:否
+ @ExcelCell(index = 25)
+ private Integer isNeedCheck;
+ //检查周期
+ @ExcelCell(index = 26)
+ private String checkCycle;
+ //检查提前提醒
+ @ExcelCell(index = 27)
+ private String checkWarn;
+ //是否检测 1:是 2:否
+ @ExcelCell(index = 28)
+ private Integer isNeedTest;
+ //检测周期
+ @ExcelCell(index = 29)
+ private String testCycle;
+ //检测提前提醒
+ @ExcelCell(index = 30)
+ private String testWarn;
+ //是否保养 1:是 2:否
+ @ExcelCell(index = 31)
+ private Integer isNeedTakecare;
+ //检查内容
+ @ExcelCell(index = 32)
+ private String checkContent;
+ //负责部门/外键
+ @ExcelCell(index = 33)
+ private Long leadingDepartmentId;
+ //检查指标
+ @ExcelCell(index = 34)
+ private String checkPoint;
+ //预警值
+ @ExcelCell(index = 35)
+ private String alertNum;
+ //联锁值
+ @ExcelCell(index = 36)
+ private String lockNum;
+ //停用理由
+ @ExcelCell(index = 37)
+ private String stopReason;
+ //停用后措施
+ @ExcelCell(index = 38)
+ private String afterStopStep;
+ //实际停用日期
+ @ExcelCell(index = 39)
+ private Timestamp actualStopDate;
+ //停用提交人/外键
+ @ExcelCell(index = 40)
+ private Long stopSubmitPersonId;
+ //停用提交日期
+ @ExcelCell(index = 41)
+ private Timestamp stopSubmitDate;
+ //恢复理由
+ @ExcelCell(index = 42)
+ private String recoveryReason;
+ //恢复填报日期
+ @ExcelCell(index = 43)
+ private Timestamp recoverySubmitDate;
+ //实际恢复日期
+ @ExcelCell(index = 44)
+ private Timestamp actualRecoveryDate;
+ //报废理由
+ @ExcelCell(index = 45)
+ private String destoryReason;
+ //报废填报日期
+ @ExcelCell(index = 46)
+ private Timestamp destorySubmitDate;
+ //实际报废日期
+ @ExcelCell(index = 47)
+ private Timestamp actualDestoryDate;
+
+
+ //ID
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+ //类型/类别外键
+ public Long getEquipmentTypeId() {
+ return equipmentTypeId;
+ }
+
+ public void setEquipmentTypeId(Long equipmentTypeId) {
+ this.equipmentTypeId = equipmentTypeId;
+ }
+ //具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施
+ public Integer getInfoType() {
+ return infoType;
+ }
+
+ public void setInfoType(Integer infoType) {
+ this.infoType = infoType;
+ }
+ //位号
+ public String getPositionNum() {
+ return positionNum;
+ }
+
+ public void setPositionNum(String positionNum) {
+ this.positionNum = positionNum;
+ }
+
+ public String getqName() {
+ return qName;
+ }
+
+ public void setqName(String qName) {
+ this.qName = qName;
+ }
+
+ public String getqUsage() {
+ return qUsage;
+ }
+
+ public void setqUsage(String qUsage) {
+ this.qUsage = qUsage;
+ }
+
+ //型号
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+ //单位部门外键
+ public Long getDepartmentId() {
+ return departmentId;
+ }
+
+ public void setDepartmentId(Long departmentId) {
+ this.departmentId = departmentId;
+ }
+ //设置部位
+ public String getSetPart() {
+ return setPart;
+ }
+
+ public void setSetPart(String setPart) {
+ this.setPart = setPart;
+ }
+ //生产日期
+ public Timestamp getProduceTime() {
+ return produceTime;
+ }
+
+ public void setProduceTime(Timestamp produceTime) {
+ this.produceTime = produceTime;
+ }
+ //使用期限(天)
+ public String getUseEndDay() {
+ return useEndDay;
+ }
+
+ public void setUseEndDay(String useEndDay) {
+ this.useEndDay = useEndDay;
+ }
+ //生命周期 1:已使用 2:库存中 3:报废
+ public Integer getLifeCycle() {
+ return lifeCycle;
+ }
+
+ public void setLifeCycle(Integer lifeCycle) {
+ this.lifeCycle = lifeCycle;
+ }
+ //投用日期
+ public Timestamp getUseDate() {
+ return useDate;
+ }
+
+ public void setUseDate(Timestamp useDate) {
+ this.useDate = useDate;
+ }
+ //维修状态 1:维修中 2:已修好
+ public Integer getRepairStatus() {
+ return repairStatus;
+ }
+
+ public void setRepairStatus(Integer repairStatus) {
+ this.repairStatus = repairStatus;
+ }
+ //停用状态 1:停用 2.在用 3.维修 4.报废
+ public Integer getStopStatus() {
+ return stopStatus;
+ }
+
+ public void setStopStatus(Integer stopStatus) {
+ this.stopStatus = stopStatus;
+ }
+ //上次检查日期
+ public Timestamp getPreviousCheckDate() {
+ return previousCheckDate;
+ }
+
+ public void setPreviousCheckDate(Timestamp previousCheckDate) {
+ this.previousCheckDate = previousCheckDate;
+ }
+ //上次检测日期
+ public Timestamp getPreviousTestDate() {
+ return previousTestDate;
+ }
+
+ public void setPreviousTestDate(Timestamp previousTestDate) {
+ this.previousTestDate = previousTestDate;
+ }
+ //上次保养日期
+ public Timestamp getPreviousTakecareDate() {
+ return previousTakecareDate;
+ }
+
+ public void setPreviousTakecareDate(Timestamp previousTakecareDate) {
+ this.previousTakecareDate = previousTakecareDate;
+ }
+ //下次检查日期
+ public Timestamp getNextCheckDate() {
+ return nextCheckDate;
+ }
+
+ public void setNextCheckDate(Timestamp nextCheckDate) {
+ this.nextCheckDate = nextCheckDate;
+ }
+ //下次检测日期
+ public Timestamp getNextTestDate() {
+ return nextTestDate;
+ }
+
+ public void setNextTestDate(Timestamp nextTestDate) {
+ this.nextTestDate = nextTestDate;
+ }
+ //下次保养日期
+ public Timestamp getNextTakecareDate() {
+ return nextTakecareDate;
+ }
+
+ public void setNextTakecareDate(Timestamp nextTakecareDate) {
+ this.nextTakecareDate = nextTakecareDate;
+ }
+ //负责人ID外键
+ public Long getLeadingPersonId() {
+ return leadingPersonId;
+ }
+
+ public void setLeadingPersonId(Long leadingPersonId) {
+ this.leadingPersonId = leadingPersonId;
+ }
+ //负责人部门外键
+ public Long getLeadingPersonDepartmentId() {
+ return leadingPersonDepartmentId;
+ }
+
+ public void setLeadingPersonDepartmentId(Long leadingPersonDepartmentId) {
+ this.leadingPersonDepartmentId = leadingPersonDepartmentId;
+ }
+ //供应商
+ public String getSupplyName() {
+ return supplyName;
+ }
+
+ public void setSupplyName(String supplyName) {
+ this.supplyName = supplyName;
+ }
+ //使用说明
+ public String getUseMemo() {
+ return useMemo;
+ }
+
+ public void setUseMemo(String useMemo) {
+ this.useMemo = useMemo;
+ }
+ //是否检查 1:是 2:否
+ public Integer getIsNeedCheck() {
+ return isNeedCheck;
+ }
+
+ public void setIsNeedCheck(Integer isNeedCheck) {
+ this.isNeedCheck = isNeedCheck;
+ }
+ //检查周期
+ public String getCheckCycle() {
+ return checkCycle;
+ }
+
+ public void setCheckCycle(String checkCycle) {
+ this.checkCycle = checkCycle;
+ }
+ //检查提前提醒
+ public String getCheckWarn() {
+ return checkWarn;
+ }
+
+ public void setCheckWarn(String checkWarn) {
+ this.checkWarn = checkWarn;
+ }
+ //是否检测 1:是 2:否
+ public Integer getIsNeedTest() {
+ return isNeedTest;
+ }
+
+ public void setIsNeedTest(Integer isNeedTest) {
+ this.isNeedTest = isNeedTest;
+ }
+ //检测周期
+ public String getTestCycle() {
+ return testCycle;
+ }
+
+ public void setTestCycle(String testCycle) {
+ this.testCycle = testCycle;
+ }
+ //检测提前提醒
+ public String getTestWarn() {
+ return testWarn;
+ }
+
+ public void setTestWarn(String testWarn) {
+ this.testWarn = testWarn;
+ }
+ //是否保养 1:是 2:否
+ public Integer getIsNeedTakecare() {
+ return isNeedTakecare;
+ }
+
+ public void setIsNeedTakecare(Integer isNeedTakecare) {
+ this.isNeedTakecare = isNeedTakecare;
+ }
+ //检查内容
+ public String getCheckContent() {
+ return checkContent;
+ }
+
+ public void setCheckContent(String checkContent) {
+ this.checkContent = checkContent;
+ }
+ //负责部门/外键
+ public Long getLeadingDepartmentId() {
+ return leadingDepartmentId;
+ }
+
+ public void setLeadingDepartmentId(Long leadingDepartmentId) {
+ this.leadingDepartmentId = leadingDepartmentId;
+ }
+ //检查指标
+ public String getCheckPoint() {
+ return checkPoint;
+ }
+
+ public void setCheckPoint(String checkPoint) {
+ this.checkPoint = checkPoint;
+ }
+ //预警值
+ public String getAlertNum() {
+ return alertNum;
+ }
+
+ public void setAlertNum(String alertNum) {
+ this.alertNum = alertNum;
+ }
+ //联锁值
+ public String getLockNum() {
+ return lockNum;
+ }
+
+ public void setLockNum(String lockNum) {
+ this.lockNum = lockNum;
+ }
+ //停用理由
+ public String getStopReason() {
+ return stopReason;
+ }
+
+ public void setStopReason(String stopReason) {
+ this.stopReason = stopReason;
+ }
+ //停用后措施
+ public String getAfterStopStep() {
+ return afterStopStep;
+ }
+
+ public void setAfterStopStep(String afterStopStep) {
+ this.afterStopStep = afterStopStep;
+ }
+ //实际停用日期
+ public Timestamp getActualStopDate() {
+ return actualStopDate;
+ }
+
+ public void setActualStopDate(Timestamp actualStopDate) {
+ this.actualStopDate = actualStopDate;
+ }
+ //停用提交人/外键
+ public Long getStopSubmitPersonId() {
+ return stopSubmitPersonId;
+ }
+
+ public void setStopSubmitPersonId(Long stopSubmitPersonId) {
+ this.stopSubmitPersonId = stopSubmitPersonId;
+ }
+ //停用提交日期
+ public Timestamp getStopSubmitDate() {
+ return stopSubmitDate;
+ }
+
+ public void setStopSubmitDate(Timestamp stopSubmitDate) {
+ this.stopSubmitDate = stopSubmitDate;
+ }
+ //恢复理由
+ public String getRecoveryReason() {
+ return recoveryReason;
+ }
+
+ public void setRecoveryReason(String recoveryReason) {
+ this.recoveryReason = recoveryReason;
+ }
+ //恢复填报日期
+ public Timestamp getRecoverySubmitDate() {
+ return recoverySubmitDate;
+ }
+
+ public void setRecoverySubmitDate(Timestamp recoverySubmitDate) {
+ this.recoverySubmitDate = recoverySubmitDate;
+ }
+ //实际恢复日期
+ public Timestamp getActualRecoveryDate() {
+ return actualRecoveryDate;
+ }
+
+ public void setActualRecoveryDate(Timestamp actualRecoveryDate) {
+ this.actualRecoveryDate = actualRecoveryDate;
+ }
+ //报废理由
+ public String getDestoryReason() {
+ return destoryReason;
+ }
+
+ public void setDestoryReason(String destoryReason) {
+ this.destoryReason = destoryReason;
+ }
+ //报废填报日期
+ public Timestamp getDestorySubmitDate() {
+ return destorySubmitDate;
+ }
+
+ public void setDestorySubmitDate(Timestamp destorySubmitDate) {
+ this.destorySubmitDate = destorySubmitDate;
+ }
+ //实际报废日期
+ public Timestamp getActualDestoryDate() {
+ return actualDestoryDate;
+ }
+
+ public void setActualDestoryDate(Timestamp actualDestoryDate) {
+ this.actualDestoryDate = actualDestoryDate;
+ }
+
+}
\ No newline at end of file
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/KeypointEquipmentInfoExcel.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/KeypointEquipmentInfoExcel.java
new file mode 100644
index 0000000..a021dfa
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/model/dto/resp/KeypointEquipmentInfoExcel.java
@@ -0,0 +1,345 @@
+package com.gkhy.safePlatform.equipment.model.dto.resp;
+
+import com.gkhy.safePlatform.equipment.entity.*;
+import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelCell;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class KeypointEquipmentInfoExcel implements Serializable {
+ //ID
+ @ExcelCell(index = 0)
+ private Long id;
+ //类型/类别外键
+ @ExcelCell(index = 1)
+ private Long equipmentTypeId;
+ //名称
+ @ExcelCell(index = 2)
+ private String name;
+ //单位部门外键
+ @ExcelCell(index = 3)
+ private Long departmentId;
+ //所属部门名称
+ private String departmentName;
+ //具体位置
+ @ExcelCell(index = 4)
+ private String position;
+ //负责人姓名
+ @ExcelCell(index = 5)
+ private String leadingPersonName;
+ //联系人/外键
+ @ExcelCell(index = 6)
+ private Long connectPersonId;
+ //录入人/外键
+ @ExcelCell(index = 7)
+ private Long inputPersonId;
+ //责任人/外键
+ @ExcelCell(index = 8)
+ private Long responsibilityPersonId;
+ //装置部位分类 1:关键装置 2:重点部位
+ @ExcelCell(index = 9)
+ private Integer partType;
+ //检查周期
+ @ExcelCell(index = 10)
+ private String checkCycle;
+ //应急预案/外键
+ @ExcelCell(index = 11)
+ private Long emergencePlanId;
+ //主要危险有害因素
+ @ExcelCell(index = 12)
+ private String dangerousElement;
+ //易导致风险
+ @ExcelCell(index = 13)
+ private String toDangerous;
+ //应急处置措施
+ @ExcelCell(index = 14)
+ private String treatment;
+ //现场图片
+ @ExcelCell(index = 15)
+ private String scenePic;
+
+ private Date createTime;
+
+ private Date updateTime;
+
+ public String getDepartmentName() {
+ return departmentName;
+ }
+
+ public void setDepartmentName(String departmentName) {
+ this.departmentName = departmentName;
+ }
+
+ //设备保养
+ private List<EquipmentTakecareDetail> takecareDetailList = new ArrayList<>();
+
+ //设备检测
+ private List<EquipmentTestDetail> testDetailList = new ArrayList<>();
+
+ //设备检查
+ private List checkDetailList = new ArrayList<>();
+
+ //设备维修
+ private List<EquipmentRepairDetail> repaireDetailList = new ArrayList<>();
+
+ //保养标准
+ private List<EquipmentTakecareStardardDetail> takecareStardardeDetailList = new ArrayList<>();
+
+ //检查标准
+ private List<EquipmentCheckStandardDetail> checkStandardeDetailList = new ArrayList<>();
+
+
+
+ //要删除的设备保养
+ private String delTakecareDetails;
+
+ //要删除的设备检测
+ private String delTestDetails;
+
+ //要删除的设备维修
+ private String delRepaireDetails;
+
+ //要删除的保养标准
+ private String delTakecareStardardeDetails;
+
+ //要删除的检查标准
+ private String delCheckStandardeDetails;
+
+ public String getDelTakecareDetails() {
+ return delTakecareDetails;
+ }
+
+ public void setDelTakecareDetails(String delTakecareDetails) {
+ this.delTakecareDetails = delTakecareDetails;
+ }
+
+ public String getDelTestDetails() {
+ return delTestDetails;
+ }
+
+ public void setDelTestDetails(String delTestDetails) {
+ this.delTestDetails = delTestDetails;
+ }
+
+ public String getDelRepaireDetails() {
+ return delRepaireDetails;
+ }
+
+ public void setDelRepaireDetails(String delRepaireDetails) {
+ this.delRepaireDetails = delRepaireDetails;
+ }
+
+ public String getDelTakecareStardardeDetails() {
+ return delTakecareStardardeDetails;
+ }
+
+ public void setDelTakecareStardardeDetails(String delTakecareStardardeDetails) {
+ this.delTakecareStardardeDetails = delTakecareStardardeDetails;
+ }
+
+ public String getDelCheckStandardeDetails() {
+ return delCheckStandardeDetails;
+ }
+
+ public void setDelCheckStandardeDetails(String delCheckStandardeDetails) {
+ this.delCheckStandardeDetails = delCheckStandardeDetails;
+ }
+
+
+
+
+ public List<EquipmentTakecareDetail> getTakecareDetailList() {
+ return takecareDetailList;
+ }
+
+ public void setTakecareDetailList(List<EquipmentTakecareDetail> takecareDetailList) {
+ this.takecareDetailList = takecareDetailList;
+ }
+
+ public List<EquipmentTestDetail> getTestDetailList() {
+ return testDetailList;
+ }
+
+ public void setTestDetailList(List<EquipmentTestDetail> testDetailList) {
+ this.testDetailList = testDetailList;
+ }
+
+ public List getCheckDetailList() {
+ return checkDetailList;
+ }
+
+ public void setCheckDetailList(List checkDetailList) {
+ this.checkDetailList = checkDetailList;
+ }
+
+ public List<EquipmentRepairDetail> getRepaireDetailList() {
+ return repaireDetailList;
+ }
+
+ public void setRepaireDetailList(List<EquipmentRepairDetail> repaireDetailList) {
+ this.repaireDetailList = repaireDetailList;
+ }
+
+ public List<EquipmentTakecareStardardDetail> getTakecareStardardeDetailList() {
+ return takecareStardardeDetailList;
+ }
+
+ public void setTakecareStardardeDetailList(List<EquipmentTakecareStardardDetail> takecareStardardeDetailList) {
+ this.takecareStardardeDetailList = takecareStardardeDetailList;
+ }
+
+ public List<EquipmentCheckStandardDetail> getCheckStandardeDetailList() {
+ return checkStandardeDetailList;
+ }
+
+ public void setCheckStandardeDetailList(List<EquipmentCheckStandardDetail> checkStandardeDetailList) {
+ this.checkStandardeDetailList = checkStandardeDetailList;
+ }
+
+ //ID
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+ //类型/类别外键
+ public Long getEquipmentTypeId() {
+ return equipmentTypeId;
+ }
+
+ public void setEquipmentTypeId(Long equipmentTypeId) {
+ this.equipmentTypeId = equipmentTypeId;
+ }
+ //名称
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //单位部门外键
+ public Long getDepartmentId() {
+ return departmentId;
+ }
+
+ public void setDepartmentId(Long departmentId) {
+ this.departmentId = departmentId;
+ }
+ //具体位置
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+ //负责人姓名
+ public String getLeadingPersonName() {
+ return leadingPersonName;
+ }
+
+ public void setLeadingPersonName(String leadingPersonName) {
+ this.leadingPersonName = leadingPersonName;
+ }
+ //联系人/外键
+ public Long getConnectPersonId() {
+ return connectPersonId;
+ }
+
+ public void setConnectPersonId(Long connectPersonId) {
+ this.connectPersonId = connectPersonId;
+ }
+ //录入人/外键
+ public Long getInputPersonId() {
+ return inputPersonId;
+ }
+
+ public void setInputPersonId(Long inputPersonId) {
+ this.inputPersonId = inputPersonId;
+ }
+ //责任人/外键
+ public Long getResponsibilityPersonId() {
+ return responsibilityPersonId;
+ }
+
+ public void setResponsibilityPersonId(Long responsibilityPersonId) {
+ this.responsibilityPersonId = responsibilityPersonId;
+ }
+ //装置部位分类 1:关键装置 2:重点部位
+ public Integer getPartType() {
+ return partType;
+ }
+
+ public void setPartType(Integer partType) {
+ this.partType = partType;
+ }
+ //检查周期
+ public String getCheckCycle() {
+ return checkCycle;
+ }
+
+ public void setCheckCycle(String checkCycle) {
+ this.checkCycle = checkCycle;
+ }
+ //应急预案/外键
+ public Long getEmergencePlanId() {
+ return emergencePlanId;
+ }
+
+ public void setEmergencePlanId(Long emergencePlanId) {
+ this.emergencePlanId = emergencePlanId;
+ }
+ //主要危险有害因素
+ public String getDangerousElement() {
+ return dangerousElement;
+ }
+
+ public void setDangerousElement(String dangerousElement) {
+ this.dangerousElement = dangerousElement;
+ }
+ //易导致风险
+ public String getToDangerous() {
+ return toDangerous;
+ }
+
+ public void setToDangerous(String toDangerous) {
+ this.toDangerous = toDangerous;
+ }
+ //应急处置措施
+ public String getTreatment() {
+ return treatment;
+ }
+
+ public void setTreatment(String treatment) {
+ this.treatment = treatment;
+ }
+ //现场图片
+ public String getScenePic() {
+ return scenePic;
+ }
+
+ public void setScenePic(String scenePic) {
+ this.scenePic = scenePic;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public Date getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ }
+}
\ No newline at end of file
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/DateUtils.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/DateUtils.java
new file mode 100644
index 0000000..ba61bd7
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/DateUtils.java
@@ -0,0 +1,70 @@
+package com.gkhy.safePlatform.equipment.utils;
+
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class DateUtils {
+
+ public static final String PATTERN_STANDARD = "yyyy-MM-dd HH:mm:ss";
+
+ public static final String PATTERN_DATE = "yyyy-MM-dd";
+
+ public static final String PATTERN_DATE_MIN="yyyy-MM-dd HH:mm";
+ // 小时分钟格式 (分笔成交时间)
+ public static final String PATTERN_HOUR_MIN = "HH:mm";
+
+ public static final String PATTERN_DATE_HOUR="yyyy-MM-dd HH";
+
+ public static final String PATTERN_DATE_DATE_CHS="yyyy年MM月dd日";
+
+ public static final String PATTERN1_DATE = "yyyy/MM/dd";
+
+ public static final String PATTERN_CONNECT_DATE="yyyyMMddHHmmss";
+ public static final String PATTERN_CONNECT_DATE_YYYYMMDD="yyyyMMdd";
+ public static final String PATTERN_CONNECT_DATE_YYMMDD="yyMMdd";
+ public static final String PATTERN_ALLTIME_NOSIGN = "yyyyMMddHHmmssSSS";
+
+ public static final String PATTERN_MONTH = "yyyy-MM";
+
+ public static final String PATTERN_MONTH1 = "yyyyMM";
+
+ public static final String PATTERN2_STANDARD = "yyyy-MM-dd HH:mm:ss.SSS";
+
+ public static final String PATTERN_UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+
+ public static String date2String(Date date, String pattern) {
+ if (date == null) {
+ throw new IllegalArgumentException("timestamp null illegal");
+ }
+ if (pattern == null || pattern.equals("")) {
+ pattern = PATTERN_STANDARD;
+ ;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+ return sdf.format(date);
+ }
+
+
+ public static Timestamp string2Timestamp(String strDateTime, String pattern) {
+ if (strDateTime == null || strDateTime.equals("")) {
+ throw new IllegalArgumentException("Date Time Null Illegal");
+ }
+ if (pattern == null || pattern.equals("")) {
+ pattern = PATTERN_STANDARD;
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+ Date date = null;
+ try {
+ date = sdf.parse(strDateTime);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ return new Timestamp(date.getTime());
+ }
+
+
+}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelCell.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelCell.java
new file mode 100644
index 0000000..73d31ad
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelCell.java
@@ -0,0 +1,81 @@
+package com.gkhy.safePlatform.equipment.utils.poihelper;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * The <code>ExcelCell</code><br>
+ * 数值型的栏位只能使用Double
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ExcelCell {
+ /**
+ * 顺序 default 100
+ *
+ * @return index
+ */
+ int index();
+
+ /**
+ * 当值为null时要显示的值 default StringUtils.EMPTY
+ *
+ * @return defaultValue
+ */
+ String defaultValue() default "";
+
+ /**
+ * 用于验证
+ *
+ * @return valid
+ */
+ Valid valid() default @Valid();
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.FIELD)
+ @interface Valid {
+ /**
+ * 必须与in中String相符,目前仅支持String类型
+ *
+ * @return e.g. {"key","value"}
+ */
+ String[] in() default {};
+
+ /**
+ * 是否允许为空,用于验证数据 default true
+ *
+ * @return allowNull
+ */
+ boolean allowNull() default true;
+
+ /**
+ * Apply a "greater than" constraint to the named property
+ *
+ * @return gt
+ */
+ double gt() default Double.NaN;
+
+ /**
+ * Apply a "less than" constraint to the named property
+ * @return lt
+ */
+ double lt() default Double.NaN;
+
+ /**
+ * Apply a "greater than or equal" constraint to the named property
+ *
+ * @return ge
+ */
+ double ge() default Double.NaN;
+
+ /**
+ * Apply a "less than or equal" constraint to the named property
+ *
+ * @return le
+ */
+ double le() default Double.NaN;
+ }
+}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLog.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLog.java
new file mode 100644
index 0000000..f94accc
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLog.java
@@ -0,0 +1,79 @@
+package com.gkhy.safePlatform.equipment.utils.poihelper;
+
+/**
+ * The <code>ExcelLog</code>
+ *
+ */
+public class ExcelLog {
+ private Integer rowNum;
+ private Object object;
+ private String log;
+
+ /**
+ * @return the rowNum
+ */
+ public Integer getRowNum() {
+ return rowNum;
+ }
+
+ /**
+ * @param rowNum
+ * the rowNum to set
+ */
+ public void setRowNum(Integer rowNum) {
+ this.rowNum = rowNum;
+ }
+
+ /**
+ * @return the object
+ */
+ public Object getObject() {
+ return object;
+ }
+
+ /**
+ * @param object
+ * the object to set
+ */
+ public void setObject(Object object) {
+ this.object = object;
+ }
+
+ /**
+ * @return the log
+ */
+ public String getLog() {
+ return log;
+ }
+
+ /**
+ * @param object
+ * @param log
+ */
+ public ExcelLog(Object object, String log) {
+ super();
+ this.object = object;
+ this.log = log;
+ }
+
+ /**
+ * @param rowNum
+ * @param object
+ * @param log
+ */
+ public ExcelLog(Object object, String log, Integer rowNum) {
+ super();
+ this.rowNum = rowNum;
+ this.object = object;
+ this.log = log;
+ }
+
+ /**
+ * @param log
+ * the log to set
+ */
+ public void setLog(String log) {
+ this.log = log;
+ }
+
+}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLogs.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLogs.java
new file mode 100644
index 0000000..43e2daf
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelLogs.java
@@ -0,0 +1,62 @@
+package com.gkhy.safePlatform.equipment.utils.poihelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The <code>ExcelLogs</code>
+ *
+ */
+public class ExcelLogs {
+ private Boolean hasError;
+ private List<ExcelLog> logList;
+
+ /**
+ *
+ */
+ public ExcelLogs() {
+ super();
+ hasError = false;
+ }
+
+ /**
+ * @return the hasError
+ */
+ public Boolean getHasError() {
+ return hasError;
+ }
+
+ /**
+ * @param hasError
+ * the hasError to set
+ */
+ public void setHasError(Boolean hasError) {
+ this.hasError = hasError;
+ }
+
+ /**
+ * @return the logList
+ */
+ public List<ExcelLog> getLogList() {
+ return logList;
+ }
+
+ public List<ExcelLog> getErrorLogList() {
+ List<ExcelLog> errList = new ArrayList<>();
+ for (ExcelLog log : this.logList) {
+ if (log != null && ExcelUtil.isNotBlank(log.getLog())) {
+ errList.add(log);
+ }
+ }
+ return errList;
+ }
+
+ /**
+ * @param logList
+ * the logList to set
+ */
+ public void setLogList(List<ExcelLog> logList) {
+ this.logList = logList;
+ }
+
+}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelSheet.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelSheet.java
new file mode 100644
index 0000000..6bfec7e
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelSheet.java
@@ -0,0 +1,66 @@
+package com.gkhy.safePlatform.equipment.utils.poihelper;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * 用于汇出多个sheet的Vo The <code>ExcelSheet</code>
+ *
+ */
+public class ExcelSheet<T> {
+ private String sheetName;
+ private Map<String,String> headers;
+ private Collection<T> dataset;
+
+ /**
+ * @return the sheetName
+ */
+ public String getSheetName() {
+ return sheetName;
+ }
+
+ /**
+ * Excel页签名称
+ *
+ * @param sheetName
+ * the sheetName to set
+ */
+ public void setSheetName(String sheetName) {
+ this.sheetName = sheetName;
+ }
+
+ /**
+ * Excel表头
+ *
+ * @return the headers
+ */
+ public Map<String,String> getHeaders() {
+ return headers;
+ }
+
+ /**
+ * @param headers
+ * the headers to set
+ */
+ public void setHeaders(Map<String,String> headers) {
+ this.headers = headers;
+ }
+
+ /**
+ * Excel数据集合
+ *
+ * @return the dataset
+ */
+ public Collection<T> getDataset() {
+ return dataset;
+ }
+
+ /**
+ * @param dataset
+ * the dataset to set
+ */
+ public void setDataset(Collection<T> dataset) {
+ this.dataset = dataset;
+ }
+
+}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelUtil.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelUtil.java
new file mode 100644
index 0000000..e46b8c1
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/ExcelUtil.java
@@ -0,0 +1,762 @@
+package com.gkhy.safePlatform.equipment.utils.poihelper;
+
+import com.gkhy.safePlatform.equipment.utils.DateUtils;
+import org.apache.commons.beanutils.BeanComparator;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.ComparatorUtils;
+import org.apache.commons.collections.comparators.ComparableComparator;
+import org.apache.commons.collections.comparators.ComparatorChain;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.sql.Timestamp;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * The <code>ExcelUtil</code> 与 {@link ExcelCell}搭配使用
+ *
+ */
+public class ExcelUtil {
+
+ private static Logger LG = LoggerFactory.getLogger(ExcelUtil.class);
+
+ /**
+ * 用来验证excel与Vo中的类型是否一致 <br>
+ * Map<栏位类型,只能是哪些Cell类型>
+ */
+ private static Map<Class<?>, CellType[]> validateMap = new HashMap<>();
+
+ static {
+ validateMap.put(String[].class, new CellType[]{CellType.STRING});
+ validateMap.put(Double[].class, new CellType[]{CellType.NUMERIC});
+ validateMap.put(String.class, new CellType[]{CellType.STRING});
+ validateMap.put(Double.class, new CellType[]{CellType.NUMERIC});
+ validateMap.put(Timestamp.class, new CellType[]{CellType.NUMERIC, CellType.STRING});
+ validateMap.put(Date.class, new CellType[]{CellType.NUMERIC, CellType.STRING});
+ validateMap.put(Integer.class, new CellType[]{CellType.NUMERIC});
+ validateMap.put(Float.class, new CellType[]{CellType.NUMERIC});
+ validateMap.put(Long.class, new CellType[]{CellType.NUMERIC});
+ validateMap.put(Boolean.class, new CellType[]{CellType.BOOLEAN});
+ }
+
+ /**
+ * 获取cell类型的文字描述
+ *
+ * @param cellType <pre>
+ * CellType.BLANK
+ * CellType.BOOLEAN
+ * CellType.ERROR
+ * CellType.FORMULA
+ * CellType.NUMERIC
+ * CellType.STRING
+ * </pre>
+ * @return
+ */
+ private static String getCellTypeByInt(CellType cellType) {
+ if(cellType == CellType.BLANK)
+ return "Null type";
+ else if(cellType == CellType.BOOLEAN)
+ return "Boolean type";
+ else if(cellType == CellType.ERROR)
+ return "Error type";
+ else if(cellType == CellType.FORMULA)
+ return "Formula type";
+ else if(cellType == CellType.NUMERIC)
+ return "Numeric type";
+ else if(cellType == CellType.STRING)
+ return "String type";
+ else
+ return "Unknown type";
+ }
+
+ /**
+ * 获取单元格值
+ *
+ * @param cell
+ * @return
+ */
+ private static Object getCellValue(Cell cell) {
+ if (cell == null
+ || (cell.getCellTypeEnum() == CellType.STRING && isBlank(cell
+ .getStringCellValue()))) {
+ return null;
+ }
+ DataFormatter dataFormatter = new DataFormatter();
+ String s = dataFormatter.formatCellValue(cell);
+ return s;
+
+// CellType cellType = cell.getCellTypeEnum();
+// if(cellType == CellType.BLANK)
+// return null;
+// else if(cellType == CellType.BOOLEAN)
+// return cell.getBooleanCellValue();
+// else if(cellType == CellType.ERROR)
+// return cell.getErrorCellValue();
+// else if(cellType == CellType.FORMULA) {
+// try {
+// if (HSSFDateUtil.isCellDateFormatted(cell)) {
+// return cell.getDateCellValue();
+// } else {
+// return cell.getNumericCellValue();
+// }
+// } catch (IllegalStateException e) {
+// return cell.getRichStringCellValue();
+// }
+// }
+// else if(cellType == CellType.NUMERIC){
+// if (DateUtil.isCellDateFormatted(cell)) {
+// return cell.getDateCellValue();
+// } else {
+// return cell.getNumericCellValue();
+// }
+// }
+// else if(cellType == CellType.STRING)
+// return cell.getStringCellValue();
+// else
+// return null;
+ }
+
+ /**
+ * 利用JAVA的反射机制,将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出到指定IO设备上<br>
+ * 用于单个sheet
+ *
+ * @param <T>
+ * @param headers 表格属性列名数组
+ * @param dataset 需要显示的数据集合,集合中一定要放置符合javabean风格的类的对象。此方法支持的
+ * javabean属性的数据类型有基本数据类型及String,Date,String[],Double[]
+ * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
+ */
+ public static <T> void exportExcel(Map<String,String> headers, Collection<T> dataset, OutputStream out) {
+ exportExcel(headers, dataset, out, null);
+ }
+
+ /**
+ * 利用JAVA的反射机制,将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出到指定IO设备上<br>
+ * 用于单个sheet
+ *
+ * @param <T>
+ * @param headers 表格属性列名数组
+ * @param dataset 需要显示的数据集合,集合中一定要放置符合javabean风格的类的对象。此方法支持的
+ * javabean属性的数据类型有基本数据类型及String,Date,String[],Double[]
+ * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
+ * @param pattern 如果有时间数据,设定输出格式。默认为"yyy-MM-dd"
+ */
+ public static <T> void exportExcel(Map<String,String> headers, Collection<T> dataset, OutputStream out,
+ String pattern) {
+ // 声明一个工作薄
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ // 生成一个表格
+ HSSFSheet sheet = workbook.createSheet();
+
+ write2Sheet(workbook,sheet, headers, dataset, pattern);
+ try {
+ workbook.write(out);
+ } catch (IOException e) {
+ LG.error(e.toString(), e);
+ }
+ }
+
+ public static void exportExcel(String[][] datalist, OutputStream out,boolean autoColumnWidth) {
+ try {
+ // 声明一个工作薄
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ // 生成一个表格
+ HSSFSheet sheet = workbook.createSheet();
+
+ for (int i = 0; i < datalist.length; i++) {
+ String[] r = datalist[i];
+ HSSFRow row = sheet.createRow(i);
+ for (int j = 0; j < r.length; j++) {
+ HSSFCell cell = row.createCell(j);
+ //cell max length 32767
+ if (r[j] != null && r[j].length() > 32767) {
+ r[j] = "--此字段过长(超过32767),已被截断--" + r[j];
+ r[j] = r[j].substring(0, 32766);
+ }
+ cell.setCellValue(r[j]);
+ }
+ }
+ //自动列宽
+ if(autoColumnWidth) {
+ if (datalist.length > 0) {
+ int colcount = datalist[0].length;
+ for (int i = 0; i < colcount; i++) {
+ sheet.autoSizeColumn(i);
+ }
+ }
+ }
+ workbook.write(out);
+ } catch (IOException e) {
+ LG.error(e.toString(), e);
+ }
+ }
+ public static void exportExcel(String[][] datalist, OutputStream out) {
+ exportExcel(datalist,out,true);
+ }
+
+ /**
+ * 利用JAVA的反射机制,将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出到指定IO设备上<br>
+ * 用于多个sheet
+ *
+ * @param <T>
+ * @param sheets {@link ExcelSheet}的集合
+ * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
+ */
+ public static <T> void exportExcel(List<ExcelSheet<T>> sheets, OutputStream out) {
+ exportExcel(sheets, out, null);
+ }
+
+ /**
+ * 利用JAVA的反射机制,将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出到指定IO设备上<br>
+ * 用于多个sheet
+ *
+ * @param <T>
+ * @param sheets {@link ExcelSheet}的集合
+ * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
+ * @param pattern 如果有时间数据,设定输出格式。默认为"yyy-MM-dd"
+ */
+ public static <T> void exportExcel(List<ExcelSheet<T>> sheets, OutputStream out, String pattern) {
+ if (CollectionUtils.isEmpty(sheets)) {
+ return;
+ }
+ // 声明一个工作薄
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ for (ExcelSheet<T> sheet : sheets) {
+ // 生成一个表格
+ HSSFSheet hssfSheet = workbook.createSheet(sheet.getSheetName());
+ write2Sheet(workbook,hssfSheet, sheet.getHeaders(), sheet.getDataset(), pattern);
+ }
+ try {
+ workbook.write(out);
+ } catch (IOException e) {
+ LG.error(e.toString(), e);
+ }
+ }
+
+ /**
+ * 每个sheet的写入
+ *
+ * @param sheet 页签
+ * @param headers 表头
+ * @param dataset 数据集合
+ * @param pattern 日期格式
+ */
+ private static <T> void write2Sheet(HSSFWorkbook workbook,HSSFSheet sheet, Map<String,String> headers, Collection<T> dataset,
+ String pattern) {
+ //时间格式默认"yyyy-MM-dd"
+ if (isBlank(pattern)){
+ pattern = "yyyy-MM-dd";
+ }
+ // 产生表格标题行
+ HSSFRow row = sheet.createRow(0);
+ // 标题行转中文
+ Set<String> keys = headers.keySet();
+ Iterator<String> it1 = keys.iterator();
+ String key = ""; //存放临时键变量
+ int c= 0; //标题列数
+ while (it1.hasNext()){
+ key = it1.next();
+ if (headers.containsKey(key)) {
+ HSSFCell cell = row.createCell(c);
+ cell.setCellStyle(getTopColumnStyle(workbook));
+ HSSFRichTextString text = new HSSFRichTextString(headers.get(key));
+ cell.setCellValue(text);
+ c++;
+ }
+ }
+
+ // 遍历集合数据,产生数据行
+ Iterator<T> it = dataset.iterator();
+ int index = 0;
+ while (it.hasNext()) {
+ index++;
+ row = sheet.createRow(index);
+ T t = it.next();
+ try {
+ if (t instanceof Map) {
+ @SuppressWarnings("unchecked")
+ Map<String, Object> map = (Map<String, Object>) t;
+ int cellNum = 0;
+ //遍历列名
+ Iterator<String> it2 = keys.iterator();
+ while (it2.hasNext()){
+ key = it2.next();
+ if (!headers.containsKey(key)) {
+ LG.error("Map 中 不存在 key [" + key + "]");
+ continue;
+ }
+ Object value = map.get(key);
+ HSSFCell cell = row.createCell(cellNum);
+ cell.setCellStyle(getColumnStyle(workbook));
+
+ cellNum = setCellValue(cell,value,pattern,cellNum,null,row);
+
+ cellNum++;
+ }
+ } else {
+ List<FieldForSortting> fields = sortFieldByAnno(t.getClass());
+ int cellNum = 0;
+ for (int i = 0; i < fields.size(); i++) {
+ HSSFCell cell = row.createCell(cellNum);
+ cell.setCellStyle(getColumnStyle(workbook));
+ Field field = fields.get(i).getField();
+ field.setAccessible(true);
+ Object value = field.get(t);
+
+ cellNum = setCellValue(cell,value,pattern,cellNum,field,row);
+
+ cellNum++;
+ }
+ }
+ } catch (Exception e) {
+ LG.error(e.toString(), e);
+ }
+ }
+ // 设定自动宽度
+ for (int i = 0; i < headers.size(); i++) {
+ sheet.autoSizeColumn(i);
+ int cw = (int) (sheet.getColumnWidth(i) * 0.8);
+ // increase width to accommodate drop-down arrow in the header
+ sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 20 / 10);
+ }
+ }
+
+ private static int setCellValue(HSSFCell cell,Object value,String pattern,int cellNum,Field field,HSSFRow row){
+ String textValue = null;
+ if (value instanceof Integer) {
+ int intValue = (Integer) value;
+ cell.setCellValue(intValue);
+ } else if (value instanceof Float) {
+ float fValue = (Float) value;
+ cell.setCellValue(fValue);
+ } else if (value instanceof Double) {
+ double dValue = (Double) value;
+ cell.setCellValue(dValue);
+ } else if (value instanceof Long) {
+ long longValue = (Long) value;
+ cell.setCellValue(longValue);
+ } else if (value instanceof Boolean) {
+ boolean bValue = (Boolean) value;
+ cell.setCellValue(bValue);
+ } else if (value instanceof Date) {
+ Date date = (Date) value;
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+ textValue = sdf.format(date);
+ } else if (value instanceof String[]) {
+ String[] strArr = (String[]) value;
+ for (int j = 0; j < strArr.length; j++) {
+ String str = strArr[j];
+ cell.setCellValue(str);
+ if (j != strArr.length - 1) {
+ cellNum++;
+ cell = row.createCell(cellNum);
+ }
+ }
+ } else if (value instanceof Double[]) {
+ Double[] douArr = (Double[]) value;
+ for (int j = 0; j < douArr.length; j++) {
+ Double val = douArr[j];
+ // 值不为空则set Value
+ if (val != null) {
+ cell.setCellValue(val);
+ }
+
+ if (j != douArr.length - 1) {
+ cellNum++;
+ cell = row.createCell(cellNum);
+ }
+ }
+ } else {
+ // 其它数据类型都当作字符串简单处理
+ String empty = "";
+ if(field != null) {
+ ExcelCell anno = field.getAnnotation(ExcelCell.class);
+ if (anno != null) {
+ empty = anno.defaultValue();
+ }
+ }
+ textValue = value == null ? empty : value.toString();
+ }
+ if (textValue != null) {
+ HSSFRichTextString richString = new HSSFRichTextString(textValue);
+ cell.setCellValue(richString);
+ }
+ return cellNum;
+ }
+
+
+ /*
+ * 设置单元格样式
+ */
+ private static HSSFCellStyle getColumnStyle(HSSFWorkbook workbook) {
+
+ //设置样式;
+ HSSFCellStyle style = workbook.createCellStyle();
+ //设置自动换行;
+ style.setWrapText(false);
+ //设置水平对齐的样式为居中对齐;
+ style.setAlignment(HorizontalAlignment.CENTER);
+ //设置垂直对齐的样式为居中对齐;
+ style.setVerticalAlignment(VerticalAlignment.CENTER);
+
+ return style;
+ }
+
+ /*
+ * 设置单元格样式
+ */
+ private static HSSFCellStyle getTopColumnStyle(HSSFWorkbook workbook) {
+
+ //设置样式;
+ HSSFCellStyle style = workbook.createCellStyle();
+ //设置自动换行;
+ style.setWrapText(true);
+ //设置水平对齐的样式为居中对齐;
+ style.setAlignment(HorizontalAlignment.CENTER);
+ //设置垂直对齐的样式为居中对齐;
+ style.setVerticalAlignment(VerticalAlignment.CENTER);
+ style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());// 设置背景色
+ style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+
+ // 设置字体
+ HSSFFont font = workbook.createFont();
+ //字体加粗
+ font.setBold(true);
+ font.setFontHeightInPoints((short) 14);//设置字体大小
+ font.setColor(IndexedColors.WHITE.index);
+ style.setFont(font);
+ return style;
+ }
+
+ /**
+ * 把Excel的数据封装成voList
+ *
+ * @param clazz vo的Class
+ * @param inputStream excel输入流
+ * @param pattern 如果有时间数据,设定输入格式。默认为"yyy-MM-dd"
+ * @param logs 错误log集合
+ * @param arrayCount 如果vo中有数组类型,那就按照index顺序,把数组应该有几个值写上.
+ * @return voList
+ * @throws RuntimeException
+ */
+ public static <T> Collection<T> importExcel(Class<T> clazz, InputStream inputStream,
+ String pattern, ExcelLogs logs, Integer... arrayCount) {
+ Workbook workBook;
+ try {
+ workBook = WorkbookFactory.create(inputStream);
+ } catch (Exception e) {
+ LG.error("load excel file error",e);
+ return null;
+ }
+ List<T> list = new ArrayList<>();
+ Sheet sheet = workBook.getSheetAt(0);
+ Iterator<Row> rowIterator = sheet.rowIterator();
+ try {
+ List<ExcelLog> logList = new ArrayList<>();
+ // Map<title,index>
+ Map<String, Integer> titleMap = new HashMap<>();
+
+ while (rowIterator.hasNext()) {
+ Row row = rowIterator.next();
+ if (row.getRowNum() == 0) {
+ if (clazz == Map.class) {
+ // 解析map用的key,就是excel标题行
+ Iterator<Cell> cellIterator = row.cellIterator();
+ Integer index = 0;
+ while (cellIterator.hasNext()) {
+ String value = cellIterator.next().getStringCellValue();
+ titleMap.put(value, index);
+ index++;
+ }
+ }
+ continue;
+ }
+ // 整行都空,就跳过
+ boolean allRowIsNull = true;
+ Iterator<Cell> cellIterator = row.cellIterator();
+ while (cellIterator.hasNext()) {
+ Object cellValue = getCellValue(cellIterator.next());
+ if (cellValue != null) {
+ allRowIsNull = false;
+ break;
+ }
+ }
+ if (allRowIsNull) {
+ LG.warn("Excel row " + row.getRowNum() + " all row value is null!");
+ continue;
+ }
+ StringBuilder log = new StringBuilder();
+ if (clazz == Map.class) {
+ Map<String, Object> map = new HashMap<>();
+ for (String k : titleMap.keySet()) {
+ Integer index = titleMap.get(k);
+ Cell cell = row.getCell(index);
+ // 判空
+ if (cell == null) {
+ map.put(k, null);
+ } else {
+ cell.setCellType(CellType.STRING);
+ String value = cell.getStringCellValue();
+ map.put(k, value);
+ }
+ }
+ list.add((T) map);
+
+ } else {
+ T t = clazz.newInstance();
+ int arrayIndex = 0;// 标识当前第几个数组了
+ int cellIndex = 0;// 标识当前读到这一行的第几个cell了
+ List<FieldForSortting> fields = sortFieldByAnno(clazz);
+ for (FieldForSortting ffs : fields) {
+ Field field = ffs.getField();
+ field.setAccessible(true);
+ if (field.getType().isArray()) {
+ Integer count = arrayCount[arrayIndex];
+ Object[] value;
+ if (field.getType().equals(String[].class)) {
+ value = new String[count];
+ } else {
+ // 目前只支持String[]和Double[]
+ value = new Double[count];
+ }
+ for (int i = 0; i < count; i++) {
+ Cell cell = row.getCell(cellIndex);
+ String errMsg = validateCell(cell, field, cellIndex);
+ if (isBlank(errMsg)) {
+ value[i] = getCellValue(cell);
+ } else {
+ log.append(errMsg);
+ log.append(";");
+ logs.setHasError(true);
+ }
+ cellIndex++;
+ }
+ field.set(t, value);
+ arrayIndex++;
+ } else {
+ Cell cell = row.getCell(cellIndex);
+ String errMsg = validateCell(cell, field, cellIndex);
+ if (isBlank(errMsg)) {
+ Object value = null;
+ // 处理特殊情况,Excel中的String,转换成Bean的Date
+ if (field.getType().equals(Timestamp.class)) {
+ Object strDate = getCellValue(cell);
+ value = DateUtils.string2Timestamp(strDate.toString(),pattern);
+ }else if (field.getType().equals(Integer.class)) {
+ Object data = getCellValue(cell);
+ if(data != null){
+ value = Integer.parseInt(String.valueOf(data));
+ }
+ }else if (field.getType().equals(Long.class)) {
+ Object data = getCellValue(cell);
+ if(data != null){
+ value = Long.parseLong(String.valueOf(data));
+ }
+ } else {
+ value = getCellValue(cell);
+ // 处理特殊情况,excel的value为String,且bean中为其他,且defaultValue不为空,那就=defaultValue
+ ExcelCell annoCell = field.getAnnotation(ExcelCell.class);
+ if (value instanceof String && !field.getType().equals(String.class)
+ && isNotBlank(annoCell.defaultValue())) {
+ value = annoCell.defaultValue();
+ }
+ }
+ field.set(t, value);
+ }
+ if (isNotBlank(errMsg)) {
+ log.append(errMsg);
+ log.append(";");
+ logs.setHasError(true);
+ }
+ cellIndex++;
+ }
+ }
+ list.add(t);
+ logList.add(new ExcelLog(t, log.toString(), row.getRowNum() + 1));
+ }
+ }
+ logs.setLogList(logList);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(MessageFormat.format("can not instance class:{0}",
+ clazz.getSimpleName()), e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(MessageFormat.format("can not instance class:{0}",
+ clazz.getSimpleName()), e);
+ }
+ return list;
+ }
+
+ /**
+ * 驗證Cell類型是否正確
+ *
+ * @param cell cell單元格
+ * @param field 欄位
+ * @param cellNum 第幾個欄位,用於errMsg
+ * @return
+ */
+ private static String validateCell(Cell cell, Field field, int cellNum) {
+ String columnName = CellReference.convertNumToColString(cellNum);
+ String result = null;
+ CellType[] cellTypeArr = validateMap.get(field.getType());
+ if (cellTypeArr == null) {
+ result = MessageFormat.format("Unsupported type [{0}]", field.getType().getSimpleName());
+ return result;
+ }
+ ExcelCell annoCell = field.getAnnotation(ExcelCell.class);
+ if (cell == null
+ || (cell.getCellTypeEnum() == CellType.STRING && isBlank(cell
+ .getStringCellValue()))) {
+ if (annoCell != null && annoCell.valid().allowNull() == false) {
+ result = MessageFormat.format("the cell [{0}] can not null", columnName);
+ }
+ ;
+ }
+// else if (cell.getCellTypeEnum() == CellType.BLANK && annoCell.valid().allowNull()) {
+// return result;
+// }
+// else {
+// List<CellType> cellTypes = Arrays.asList(cellTypeArr);
+//
+// // 如果類型不在指定範圍內,並且沒有默認值
+// if (!(cellTypes.contains(cell.getCellTypeEnum()))
+// || isNotBlank(annoCell.defaultValue())
+// && cell.getCellTypeEnum() == CellType.STRING) {
+// StringBuilder strType = new StringBuilder();
+// for (int i = 0; i < cellTypes.size(); i++) {
+// CellType cellType = cellTypes.get(i);
+// strType.append(getCellTypeByInt(cellType));
+// if (i != cellTypes.size() - 1) {
+// strType.append(",");
+// }
+// }
+// result =
+// MessageFormat.format("the cell [{0}] type must [{1}]", columnName, strType.toString());
+// } else {
+// // 类型符合验证,但值不在要求范围内的
+// // String in
+// if (annoCell.valid().in().length != 0 && cell.getCellTypeEnum() == CellType.STRING) {
+// String[] in = annoCell.valid().in();
+// String cellValue = cell.getStringCellValue();
+// boolean isIn = false;
+// for (String str : in) {
+// if (str.equals(cellValue)) {
+// isIn = true;
+// }
+// }
+// if (!isIn) {
+// result = MessageFormat.format("the cell [{0}] value must in {1}", columnName, in);
+// }
+// }
+// // 数字型
+// if (cell.getCellTypeEnum() == CellType.NUMERIC) {
+// double cellValue = cell.getNumericCellValue();
+// // 小于
+// if (!Double.isNaN(annoCell.valid().lt())) {
+// if (!(cellValue < annoCell.valid().lt())) {
+// result =
+// MessageFormat.format("the cell [{0}] value must less than [{1}]", columnName,
+// annoCell.valid().lt());
+// }
+// }
+// // 大于
+// if (!Double.isNaN(annoCell.valid().gt())) {
+// if (!(cellValue > annoCell.valid().gt())) {
+// result =
+// MessageFormat.format("the cell [{0}] value must greater than [{1}]", columnName,
+// annoCell.valid().gt());
+// }
+// }
+// // 小于等于
+// if (!Double.isNaN(annoCell.valid().le())) {
+// if (!(cellValue <= annoCell.valid().le())) {
+// result =
+// MessageFormat.format("the cell [{0}] value must less than or equal [{1}]",
+// columnName, annoCell.valid().le());
+// }
+// }
+// // 大于等于
+// if (!Double.isNaN(annoCell.valid().ge())) {
+// if (!(cellValue >= annoCell.valid().ge())) {
+// result =
+// MessageFormat.format("the cell [{0}] value must greater than or equal [{1}]",
+// columnName, annoCell.valid().ge());
+// }
+// }
+// }
+// }
+// }
+ return result;
+ }
+
+ /**
+ * 根据annotation的seq排序后的栏位
+ *
+ * @param clazz
+ * @return
+ */
+ private static List<FieldForSortting> sortFieldByAnno(Class<?> clazz) {
+ Field[] fieldsArr = clazz.getDeclaredFields();
+ List<FieldForSortting> fields = new ArrayList<>();
+ List<FieldForSortting> annoNullFields = new ArrayList<>();
+ for (Field field : fieldsArr) {
+ ExcelCell ec = field.getAnnotation(ExcelCell.class);
+ if (ec == null) {
+ // 没有ExcelCell Annotation 视为不汇入
+ continue;
+ }
+ int id = ec.index();
+ fields.add(new FieldForSortting(field, id));
+ }
+ fields.addAll(annoNullFields);
+ sortByProperties(fields, true, false, "index");
+ return fields;
+ }
+
+ private static void sortByProperties(List<? extends Object> list, boolean isNullHigh,
+ boolean isReversed, String... props) {
+ if (CollectionUtils.isNotEmpty(list)) {
+ Comparator<?> typeComp = ComparableComparator.getInstance();
+ if (isNullHigh == true) {
+ typeComp = ComparatorUtils.nullHighComparator(typeComp);
+ } else {
+ typeComp = ComparatorUtils.nullLowComparator(typeComp);
+ }
+ if (isReversed) {
+ typeComp = ComparatorUtils.reversedComparator(typeComp);
+ }
+
+ List<Object> sortCols = new ArrayList<Object>();
+
+ if (props != null) {
+ for (String prop : props) {
+ sortCols.add(new BeanComparator(prop, typeComp));
+ }
+ }
+ if (sortCols.size() > 0) {
+ Comparator<Object> sortChain = new ComparatorChain(sortCols);
+ Collections.sort(list, sortChain);
+ }
+ }
+ }
+
+ private static boolean isBlank(String str){
+ if(str == null){
+ return true;
+ }
+ return str.length() == 0;
+ }
+
+ protected static boolean isNotBlank(String str){
+ return !isBlank(str);
+ }
+
+}
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/FieldForSortting.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/FieldForSortting.java
new file mode 100644
index 0000000..82dc438
--- /dev/null
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/utils/poihelper/FieldForSortting.java
@@ -0,0 +1,61 @@
+package com.gkhy.safePlatform.equipment.utils.poihelper;
+
+import java.lang.reflect.Field;
+
+/**
+ * The <code>FieldForSortting</code>
+ *
+ */
+public class FieldForSortting {
+ private Field field;
+ private int index;
+
+ /**
+ * @param field
+ */
+ public FieldForSortting(Field field) {
+ super();
+ this.field = field;
+ }
+
+ /**
+ * @param field
+ * @param index
+ */
+ public FieldForSortting(Field field, int index) {
+ super();
+ this.field = field;
+ this.index = index;
+ }
+
+ /**
+ * @return the field
+ */
+ public Field getField() {
+ return field;
+ }
+
+ /**
+ * @param field
+ * the field to set
+ */
+ public void setField(Field field) {
+ this.field = field;
+ }
+
+ /**
+ * @return the index
+ */
+ public int getIndex() {
+ return index;
+ }
+
+ /**
+ * @param index
+ * the index to set
+ */
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+}
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/req/RewardPunishmentStandardImportExcel.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/req/RewardPunishmentStandardImportExcel.java
new file mode 100644
index 0000000..c723524
--- /dev/null
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/req/RewardPunishmentStandardImportExcel.java
@@ -0,0 +1,65 @@
+package com.gkhy.safePlatform.targetDuty.model.dto.req;
+
+import com.gkhy.safePlatform.targetDuty.utils.poihelper.ExcelCell;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+public class RewardPunishmentStandardImportExcel implements Serializable {
+ //奖惩名称
+ @ExcelCell(index = 1)
+ private String qName;
+ //奖惩类型 1:奖励 2:惩罚
+ @ExcelCell(index = 2)
+ private Integer standardType;
+ //奖惩内容
+ @ExcelCell(index = 3)
+ private String content;
+ //依据
+ @ExcelCell(index = 4)
+ private String reason;
+ //备注信息
+ @ExcelCell(index = 5)
+ private String memo;
+
+ //奖惩类型 1:奖励 2:惩罚
+ public Integer getStandardType() {
+ return standardType;
+ }
+
+ public void setStandardType(Integer standardType) {
+ this.standardType = standardType;
+ }
+ //奖惩内容
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+ //奖惩名称
+ public String getQName() {
+ return qName;
+ }
+
+ public void setQName(String qName) {
+ this.qName = qName;
+ }
+ //依据
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+ //备注信息
+ public String getMemo() {
+ return memo;
+ }
+
+ public void setMemo(String memo) {
+ this.memo = memo;
+ }
+}
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentDetailExcel.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentDetailExcel.java
new file mode 100644
index 0000000..d7c1f50
--- /dev/null
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentDetailExcel.java
@@ -0,0 +1,82 @@
+package com.gkhy.safePlatform.targetDuty.model.dto.resp;
+
+import com.gkhy.safePlatform.targetDuty.utils.poihelper.ExcelCell;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+public class RewardPunishmentDetailExcel implements Serializable {
+ //员工(多个用逗号隔开)
+ private String personId;
+
+ @ExcelCell(index = 1)
+ private Timestamp createTime;
+
+ //奖惩类型 1:奖励 2:惩罚
+ @ExcelCell(index = 2)
+ private Integer standardType;
+
+ //被奖惩者
+ @ExcelCell(index = 3)
+ private String personName;
+
+ //奖惩内容
+ @ExcelCell(index = 4)
+ private String content;
+
+ //依据
+ @ExcelCell(index = 5)
+ private String reason;
+
+ public Integer getStandardType() {
+ return standardType;
+ }
+
+ public void setStandardType(Integer standardType) {
+ this.standardType = standardType;
+ }
+
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+
+ public String getPersonId() {
+ return personId;
+ }
+
+ public void setPersonId(String personId) {
+ this.personId = personId;
+ }
+
+ public String getPersonName() {
+ return personName;
+ }
+
+ public void setPersonName(String personName) {
+ this.personName = personName;
+ }
+
+ public Timestamp getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Timestamp createTime) {
+ this.createTime = createTime;
+ }
+
+}
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentStandardExcel.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentStandardExcel.java
new file mode 100644
index 0000000..25dc15d
--- /dev/null
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/RewardPunishmentStandardExcel.java
@@ -0,0 +1,66 @@
+package com.gkhy.safePlatform.targetDuty.model.dto.resp;
+
+import com.gkhy.safePlatform.targetDuty.utils.poihelper.ExcelCell;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+public class RewardPunishmentStandardExcel implements Serializable {
+ //奖惩名称
+ @ExcelCell(index = 1)
+ private String qName;
+ //奖惩类型 1:奖励 2:惩罚
+ @ExcelCell(index = 2)
+ private Integer standardType;
+ //奖惩内容
+ @ExcelCell(index = 3)
+ private String content;
+ //依据
+ @ExcelCell(index = 4)
+ private String reason;
+ //备注信息
+ @ExcelCell(index = 5)
+ private String memo;
+
+ //奖惩类型 1:奖励 2:惩罚
+ public Integer getStandardType() {
+ return standardType;
+ }
+
+ public void setStandardType(Integer standardType) {
+ this.standardType = standardType;
+ }
+ //奖惩内容
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+ //奖惩名称
+ public String getQName() {
+ return qName;
+ }
+
+ public void setQName(String qName) {
+ this.qName = qName;
+ }
+ //依据
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+ //备注信息
+ public String getMemo() {
+ return memo;
+ }
+
+ public void setMemo(String memo) {
+ this.memo = memo;
+ }
+
+}
\ No newline at end of file
--
Gitblit v1.9.2