feat: 国标外标模板下载多余字段去除
This commit is contained in:
+17
@@ -1334,6 +1334,22 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 去除国标导入逻辑不需要显示的字段
|
||||
if (TableNameEnum.DOMESTIC_REGULATIONS.getTableName().equals(tableName)) {
|
||||
fieldList = fieldList.stream()
|
||||
.filter(lawsTag -> !lawsTag.getDbFieldName().equals(FieldCommon.STANDARD_CLASS))
|
||||
.filter(lawsTag -> !lawsTag.getDbFieldName().equals(FieldCommon.YEAR_NUMBER))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 去除外标导入逻辑不需要显示的字段
|
||||
if (TableNameEnum.FOREIGN_REGULATIONS.getTableName().equals(tableName)) {
|
||||
fieldList = fieldList.stream()
|
||||
.filter(lawsTag -> !lawsTag.getDbFieldName().equals(FieldCommon.STANDARD_CLASS))
|
||||
.filter(lawsTag -> !lawsTag.getDbFieldName().equals(FieldCommon.YEAR_NUMBER))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 创建一个Excel工作簿
|
||||
Workbook workbook = this.createWorkBookWithLawsTags(fieldList);
|
||||
|
||||
@@ -1474,6 +1490,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
LawsTag tag = headerMap.get(cell.toString().replace("*", ""));
|
||||
if (tag == null && !cell.toString().equals("稽查内容")) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
log.error("找不到" + cell + "对应的字段");
|
||||
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.IMPORT_TEMPLATE_ERROR));
|
||||
} else {
|
||||
headerList.add(tag);
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ public class LawsDomesticController {
|
||||
@ApiOperation(value="国内法规标准-导入", notes="国内法规标准-导入")
|
||||
@PostMapping("/importExcelWithData")
|
||||
public Result<?> importExcelWithData(@RequestParam("file") MultipartFile file) {
|
||||
List<String> errorMessages = lawsCommonService.importExcelWithData(file, TableNameEnum.ENTERPRISE_STANDARDS.getValue());
|
||||
List<String> errorMessages = lawsCommonService.importExcelWithData(file, TableNameEnum.DOMESTIC_REGULATIONS.getValue());
|
||||
if (errorMessages.size() > 0) {
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.IMPORT_ERROR), errorMessages);
|
||||
}
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ public class LawsOverseasController {
|
||||
@ApiOperation(value="海外法规标准-导入", notes="海外法规标准-导入")
|
||||
@PostMapping("/importExcelWithData")
|
||||
public Result<?> importExcelWithData(@RequestParam("file") MultipartFile file) {
|
||||
List<String> errorMessages = lawsCommonService.importExcelWithData(file, TableNameEnum.ENTERPRISE_STANDARDS.getValue());
|
||||
List<String> errorMessages = lawsCommonService.importExcelWithData(file, TableNameEnum.FOREIGN_REGULATIONS.getValue());
|
||||
if (errorMessages.size() > 0) {
|
||||
return Result.error(ResultCommon.IMPORT_ERROR, errorMessages);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user