diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java index 00784bc7db..c606583613 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java @@ -153,4 +153,32 @@ public class FileUtils { return templateFilePathStr; } + /** + * @description: 删除文件 + * @param path: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 9:47 AM + */ + public static void deleteFileIfExists(Path path) { + if (path != null) { + try { + Files.deleteIfExists(path); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + /** + * @description: 删除文件 + * @param path: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 9:47 AM + */ + public static void deleteFileIfExists(String path) { + deleteFileIfExists(Paths.get(path)); + } + } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index 43766990ba..14bde6bfe9 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -22,7 +22,7 @@ import java.util.Map; * @date 2020/6/4 10:28 */ @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class) - //@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class, url = "http://localhost:8103") + // @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class, url = "http://localhost:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java index a8b08efd29..88193f832c 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java @@ -54,4 +54,23 @@ public class ImportTaskUtils implements ResultDataResolver { return SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class).finishImportTask(form); } + /** + * @description: 结束导入任务 + * @return + * @author: WangXianZhang + * @date: 2023/4/20 9:55 AM + */ + public static Result finishImportTask(String taskId, String processStatus, String resultDescFilePath, String resultDesc, Integer successItemsQty, Integer failItemsQty) { + ImportTaskCommonFormDTO form = new ImportTaskCommonFormDTO(); + form.setTaskId(taskId); + form.setOperatorId(EpmetRequestHolder.getHeader(AppClientConstant.USER_ID)); + form.setProcessStatus(processStatus); + form.setResultDescFilePath(resultDescFilePath); + form.setResultDesc(resultDesc); + form.setSuccessItemsQty(successItemsQty); + form.setFailItemsQty(failItemsQty); + + return SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class).finishImportTask(form); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java index 1d99dbce93..9ee0be759e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java @@ -63,11 +63,9 @@ public class LingShanSpecialCrowdController { try { lingShanSpecialCrowdService.importSpecialCrowd(crowdCategory, fileSavePath.toString(), originalFilename); } catch (Exception e) { + // 3.出错的话,删除文件 + FileUtils.deleteFileIfExists(fileSavePath); throw e; - // ... - } finally { - // 3.删除文件 - deleteSpecialCrowdTempFile(fileSavePath); } return new Result(); @@ -97,21 +95,5 @@ public class LingShanSpecialCrowdController { } } - /** - * @description: 删除特殊人群临时文件 - * @param fileSavePath: - * @return - * @author: WangXianZhang - * @date: 2023/4/18 9:47 AM - */ - public void deleteSpecialCrowdTempFile(Path fileSavePath) { - if (fileSavePath != null) { - try { - Files.deleteIfExists(fileSavePath); - } catch ( - IOException e) { - log.error("【灵山街道】导入社会维稳数据,删除临时文件失败"); - } - } - } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdIsOrNotConverter.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdIsOrNotConverter.java deleted file mode 100644 index e146615243..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdIsOrNotConverter.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.epmet.excel.converter; - -import com.alibaba.excel.converters.Converter; -import com.alibaba.excel.converters.ReadConverterContext; -import com.alibaba.excel.enums.CellDataTypeEnum; -import org.apache.commons.lang3.StringUtils; - -/** - * 灵山-是否转换器 - */ -public class LingShanSpecialCrowdIsOrNotConverter implements Converter { - @Override - public CellDataTypeEnum supportExcelTypeKey() { - return CellDataTypeEnum.STRING; - } - - @Override - public Class supportJavaTypeKey() { - return Integer.class; - } - - @Override - public Integer convertToJavaData(ReadConverterContext context) throws Exception { - String content = context.getReadCellData().getStringValue(); - if (StringUtils.isNotBlank(content)) { - if (content.equals("是") || content.equals("有")) { - return 1; - } else if (content.equals("无") || content.equals("否")) { - return 0; - } - } - return Converter.super.convertToJavaData(context); - } -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java index fbefaf92fd..3a6282cf2c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java @@ -2,56 +2,128 @@ package com.epmet.excel.converter; import com.alibaba.excel.converters.Converter; import com.alibaba.excel.converters.ReadConverterContext; +import com.alibaba.excel.converters.WriteConverterContext; import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import com.epmet.excel.data.LingshanSpecialCrowdDetailJzhzExcelData; /** * 灵山-诊断类型转换器 */ public class LingShanSpecialCrowdJzhzConverter implements Converter { + @Override public CellDataTypeEnum supportExcelTypeKey() { return CellDataTypeEnum.STRING; } @Override - public Integer convertToJavaData(ReadConverterContext context) throws Exception { - String content = context.getReadCellData().getStringValue(); - if (content instanceof String) { - switch (content) { - // 诊断类型 - case "精神分裂症": - return 1; - case "分裂情感性障碍": - return 2; - case "持久的妄想性障碍(偏执性精神病)": - return 3; - case "双相(情感)障碍": - return 4; - case "癫痫所致精神障碍": - return 5; - case "精神发育迟滞伴发精神障碍": - return 6; - case "重度抑郁发作": - return 7; - case "精神活性物质所致精神障碍": - return 8; - case "其他": - return 9; - // 危险性评估等级 - case "0级": - return 0; - case "1级": - return 1; - case "2级": - return 2; - case "3级": - return 3; - case "4级": - return 4; - case "5级": - return 5; + public Class supportJavaTypeKey() { + return Integer.class; + } + + @Override + public Integer convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + String value = cellData.getStringValue(); + if (fieldName.equals("currentDiagnosis")) { + return Diagnosis.getByName(value).code; + } else if (fieldName.equals("dangerousClass")) { + return DangerousClass.getByName(value).code; + } + + return Converter.super.convertToJavaData(cellData, contentProperty, globalConfiguration); + } + + @Override + public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + if (fieldName.equals("currentDiagnosis")) { + return new WriteCellData<>(Diagnosis.getByCode(value).name); + } else if (fieldName.equals("dangerousClass")) { + return new WriteCellData<>(DangerousClass.getByCode(value).name); + } + + return Converter.super.convertToExcelData(value, contentProperty, globalConfiguration); + } + + + /** + * 诊断 + */ + public enum Diagnosis { + JSFLZ(1, "精神分裂症"), + FLQGXZA(2, "分裂情感性障碍"), + CJDWXXZA(3, "持久的妄想性障碍(偏执性精神病)"), + SXZA(4, "双相(情感)障碍"), + DXSZJSZA(5, "癫痫所致精神障碍"), + JSFYCZBFJSZA(6, "精神发育迟滞伴发精神障碍"), + ZDYYFZ(7, "重度抑郁发作"), + JSHXWZ(8, "精神活性物质所致精神障碍"), + OTHERS(9, "其他"); + + private Integer code; + private String name; + + Diagnosis(Integer code, String name) { + this.code = code; + this.name = name; + } + + static Diagnosis getByCode(Integer code) { + for (Diagnosis d : Diagnosis.values()) { + if (d.code.equals(code)) { + return d; + } + } + return null; + } + + static Diagnosis getByName(String name) { + for (Diagnosis d : Diagnosis.values()) { + if (d.name.equals(name)) { + return d; + } + } + return null; + } + } + + public enum DangerousClass { + ZERO(0, "0级"), + ONE(1, "1级"), + TOW(2, "2级(偏执性精神病)"), + THREE(3, "3级(情感)障碍"), + FOUR(4, "4级"), + FIVE(5, "5级"); + + private Integer code; + private String name; + + DangerousClass(Integer code, String name) { + this.code = code; + this.name = name; + } + + static DangerousClass getByCode(Integer code) { + for (DangerousClass d : DangerousClass.values()) { + if (d.code.equals(code)) { + return d; + } + } + return null; + } + + static DangerousClass getByName(String name) { + for (DangerousClass d : DangerousClass.values()) { + if (d.name.equals(name)) { + return d; + } } + return null; } - return Converter.super.convertToJavaData(context); } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java index 8de25b0e9a..7e352d1b81 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java @@ -3,6 +3,11 @@ package com.epmet.excel.converter; import com.alibaba.excel.converters.Converter; import com.alibaba.excel.converters.ReadConverterContext; import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import org.omg.CORBA.PRIVATE_MEMBER; /** * 灵山-社区矫正转换器 @@ -19,33 +24,103 @@ public class LingShanSpecialCrowdSqjzConverter implements Converter { } @Override - public Integer convertToJavaData(ReadConverterContext context) throws Exception { - Object content = context.getReadCellData().getStringValue(); - if (content instanceof String) { - switch ((String) content) { - // 矫正类型 - case "管制": - return 1; - case "缓刑": - return 2; - case "假释": - return 3; - case "暂予监外执行": - return 4; - case "剥夺政治权利": - return 5; - // 接受方式 - case "自行报到": - return 1; - case "狱所押送": - return 2; - case "当庭交接": - return 3; - case "其他": - return 4; + public Integer convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + String value = cellData.getStringValue(); + if (fieldName.equals("rectificateType")) { + return RectificateType.getByName(value).code; + } else if (fieldName.equals("receiveWay")) { + return ReceiveWay.getByName(value).code; + } + + return Converter.super.convertToJavaData(cellData, contentProperty, globalConfiguration); + } + + @Override + public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + if (fieldName.equals("rectificateType")) { + return new WriteCellData(RectificateType.getByCode(value).name); + } else if (fieldName.equals("receiveWay")) { + return new WriteCellData(ReceiveWay.getByCode(value).name); + } + + return Converter.super.convertToExcelData(value, contentProperty, globalConfiguration); + } + + /** + * 矫正类型 + */ + public enum RectificateType { + GUANZHI(1,"管制"), + HUANXING(2,"缓刑"), + JIASHI(3,"假释"), + ZYJWZX(4,"暂予监外执行"), + BDZZQL(5,"剥夺政治权利"); + + private Integer code; + private String name; + + RectificateType(Integer code, String name) { + this.code = code; + this.name = name; + } + + static RectificateType getByCode(Integer code) { + for (RectificateType d : RectificateType.values()) { + if (d.code.equals(code)) { + return d; + } } + return null; + } + + static RectificateType getByName(String name) { + for (RectificateType d : RectificateType.values()) { + if (d.name.equals(name)) { + return d; + } + } + return null; + } + } + + /** + * 接受方式。1.自行报到,2狱所押送,3当庭交接,4其他 + */ + public enum ReceiveWay { + ZXBD(1,"自行报到"), + YSYS(2,"狱所押送"), + DTJJ(3,"当庭交接"), + OTHERS(4,"其他"); + + private Integer code; + private String name; + + ReceiveWay(Integer code, String name) { + this.code = code; + this.name = name; + } + + static ReceiveWay getByCode(Integer code) { + for (ReceiveWay d : ReceiveWay.values()) { + if (d.code.equals(code)) { + return d; + } + } + return null; + } + + static ReceiveWay getByName(String name) { + for (ReceiveWay d : ReceiveWay.values()) { + if (d.name.equals(name)) { + return d; + } + } + return null; } - return Converter.super.convertToJavaData(context); } + + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdYesOrNoConverter.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdYesOrNoConverter.java new file mode 100644 index 0000000000..1f9281d224 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdYesOrNoConverter.java @@ -0,0 +1,78 @@ +package com.epmet.excel.converter; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.converters.ReadConverterContext; +import com.alibaba.excel.converters.WriteConverterContext; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.data.WriteCellData; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.List; + +/** + * 灵山-是否转换器 + */ +public class LingShanSpecialCrowdYesOrNoConverter implements Converter { + List group1 = Arrays.asList("localFlag", "multipleFlag", "recidivismFlag", "emplacementFlag", "canceledFlag", + "detachedFlag", "canGoOutFlag", "violenceFlag", "allowanceFlag", "subsistenceFlag"); + + List group2 = Arrays.asList("criminalHistoryFlag", "drugRepetitionFlag", "causeTroubleHistoryFlag"); + + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + @Override + public Class supportJavaTypeKey() { + return Integer.class; + } + + @Override + public Integer convertToJavaData(ReadConverterContext context) throws Exception { + String content = context.getReadCellData().getStringValue(); + if (StringUtils.isNotBlank(content)) { + if (content.equals("是") || content.equals("有")) { + return 1; + } else if (content.equals("无") || content.equals("否")) { + return 0; + } + } + return Converter.super.convertToJavaData(context); + } + + @Override + public WriteCellData convertToExcelData(WriteConverterContext context) throws Exception { + String fieldName = context.getContentProperty().getField().getName(); + Integer value = context.getValue(); + if (group1.contains(fieldName)) { + return convertYesOrNoFlag(value); + } else if (group2.contains(fieldName)) { + return convertHaveOrNotFlag(value); + } + + return Converter.super.convertToExcelData(context); + } + + WriteCellData convertHaveOrNotFlag(Integer value) { + if (value.equals(1)) { + return new WriteCellData("有"); + } else if (value.equals(0)) { + return new WriteCellData("无"); + } else { + return new WriteCellData("未知"); + } + } + + WriteCellData convertYesOrNoFlag(Integer value) { + if (value.equals(1)) { + return new WriteCellData("是"); + } else if (value.equals(0)) { + return new WriteCellData("否"); + } else { + return new WriteCellData("未知"); + } + } +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java index 49bacc91d7..64c5b887b3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java @@ -1,7 +1,8 @@ package com.epmet.excel.data; import com.alibaba.excel.annotation.ExcelProperty; -import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -26,30 +27,33 @@ public class LingShanSpecialCrowdDetailAzbjExcelData extends LingShanSpecialCrow */ @ExcelProperty(value = "*释放日期") @NotNull(message = "释放日期不能为空") + @DateTimeFormat("yyyy/MM/dd") private Date releaseDate; /** * 原判刑期(单位:月) */ @ExcelProperty(value = "原判刑期(单位:月)") + @DateTimeFormat("yyyy/MM/dd") private Date originPrisonTerm; /** * 是否累犯。0否,1是 */ - @ExcelProperty(value = "是否累犯", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否累犯", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer recidivismFlag; /** * 是否安置。0否,1是 */ - @ExcelProperty(value = "是否安置", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否安置", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer emplacementFlag; /** * 安置日期 */ @ExcelProperty(value = "安置日期") + @DateTimeFormat("yyyy/MM/dd") private Date emplacementDate; /** @@ -61,7 +65,7 @@ public class LingShanSpecialCrowdDetailAzbjExcelData extends LingShanSpecialCrow /** * 是否注销 */ - @ExcelProperty(value = "是否注销", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否注销", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer canceledFlag; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java index 1d43fb5790..27c97a9d0e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java @@ -26,5 +26,6 @@ public class LingShanSpecialCrowdDetailBaseExcelData { /** * 错误信息 */ + @ExcelProperty(value = "错误信息") private String errorInfo; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java index 8ca975af70..76f17cb45f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java @@ -1,13 +1,10 @@ package com.epmet.excel.data; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; import lombok.Data; -import lombok.EqualsAndHashCode; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.Date; @@ -23,14 +20,14 @@ public class LingshanSpecialCrowdDetailJdryExcelData extends LingShanSpecialCrow /** * 有无犯罪史 */ - @ExcelProperty(value = "*有无犯罪史", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "*有无犯罪史", converter = LingShanSpecialCrowdYesOrNoConverter.class) @NotNull(message = "有无犯罪史不能为空") private Integer criminalHistoryFlag; /** * 有无复吸史 */ - @ExcelProperty(value = "*有无复吸史", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "*有无复吸史", converter = LingShanSpecialCrowdYesOrNoConverter.class) @NotNull(message = "有无复吸史不能为空") private Integer drugRepetitionFlag; @@ -38,6 +35,7 @@ public class LingshanSpecialCrowdDetailJdryExcelData extends LingShanSpecialCrow * 初次发现日期 */ @ExcelProperty(value = "初次发现日期") + @DateTimeFormat("yyyy/MM/dd") private Date firstDiscoveryDate; /** @@ -67,7 +65,7 @@ public class LingshanSpecialCrowdDetailJdryExcelData extends LingShanSpecialCrow /** * 是否脱管 */ - @ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer detachedFlag; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java index 067cd35987..98d5012bb1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java @@ -1,11 +1,10 @@ package com.epmet.excel.data; import com.alibaba.excel.annotation.ExcelProperty; -import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; import com.epmet.excel.converter.LingShanSpecialCrowdJzhzConverter; import lombok.Data; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; /** @@ -22,7 +21,7 @@ public class LingshanSpecialCrowdDetailJzhzExcelData extends LingShanSpecialCrow /** * 有无肇事肇祸史 */ - @ExcelProperty(value = "*有无肇事肇祸史", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "*有无肇事肇祸史", converter = LingShanSpecialCrowdYesOrNoConverter.class) @NotNull(message = "有无肇事肇祸史不能为空") private Integer causeTroubleHistoryFlag; @@ -48,25 +47,25 @@ public class LingshanSpecialCrowdDetailJzhzExcelData extends LingShanSpecialCrow /** * 是否具备外出能力 */ - @ExcelProperty(value = "是否具备外出能力", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否具备外出能力", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer canGoOutFlag; /** * 是否有暴力倾向 */ - @ExcelProperty(value = "是否有暴力倾向", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否有暴力倾向", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer violenceFlag; /** * 是否落实监管补助 */ - @ExcelProperty(value = "是否落实监管补助", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否落实监管补助", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer allowanceFlag; /** * 是否纳入低保 */ - @ExcelProperty(value = "是否纳入低保", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否纳入低保", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer subsistenceFlag; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java index 950ce47381..06966e6de8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java @@ -1,14 +1,11 @@ package com.epmet.excel.data; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; import com.epmet.excel.converter.LingShanSpecialCrowdSqjzConverter; import lombok.Data; -import lombok.EqualsAndHashCode; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.Date; @@ -33,12 +30,14 @@ public class LingshanSpecialCrowdDetailSqjzExcelData extends LingShanSpecialCrow * 矫正开始日期 */ @ExcelProperty(value = "矫正开始日期") + @DateTimeFormat("yyyy/MM/dd") private Date rectificateStartDate; /** * 矫正结束日期 */ @ExcelProperty(value = "矫正结束日期") + @DateTimeFormat("yyyy/MM/dd") private Date rectificateEndDate; /** @@ -68,7 +67,7 @@ public class LingshanSpecialCrowdDetailSqjzExcelData extends LingShanSpecialCrow /** * 是否脱管 */ - @ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer detachedFlag; /** @@ -80,7 +79,7 @@ public class LingshanSpecialCrowdDetailSqjzExcelData extends LingShanSpecialCrow /** * 是否注销 */ - @ExcelProperty(value = "是否注销" , converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否注销" , converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer canceledFlag; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java index f7a865a3ba..5ba1ca13bb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java @@ -1,11 +1,8 @@ package com.epmet.excel.data; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import com.epmet.excel.converter.LingShanSpecialCrowdIsOrNotConverter; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; import lombok.Data; -import lombok.EqualsAndHashCode; import javax.validation.constraints.NotBlank; @@ -35,13 +32,13 @@ public class LingshanSpecialCrowdDetailXfryExcelData extends LingShanSpecialCrow /** * 是否多次上访 */ - @ExcelProperty(value = "是否多次上访", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否多次上访", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer multipleFlag; /** * 是否在当地 */ - @ExcelProperty(value = "是否在当地", converter = LingShanSpecialCrowdIsOrNotConverter.class) + @ExcelProperty(value = "是否在当地", converter = LingShanSpecialCrowdYesOrNoConverter.class) private Integer localFlag; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java index 72bea84f54..58c06e92e3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java @@ -34,6 +34,7 @@ import org.apache.commons.lang3.StringUtils; import org.redisson.api.RLock; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -99,6 +100,8 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener correctDatas = new ArrayList<>(); + private AtomicInteger correctDatasQty = new AtomicInteger(); + private List persons = new ArrayList<>(); private List personTypes = new ArrayList<>(); @@ -118,6 +121,7 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener