ci: 同步企标字段名称
This commit is contained in:
+28
-15
@@ -149,24 +149,37 @@ public class EnterpriseStandardUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> splitStandardNumber(String standardNumber) {
|
public static Map<String, String> splitStandardNumber(String standardNumber) {
|
||||||
// 使用正则表达式匹配所需的各个部分
|
// 定义多个正则表达式来匹配不同的标准号格式
|
||||||
Pattern pattern = Pattern.compile("([A-Za-z]{1,2})\\/([A-Za-z]{1,2}) (\\d)(\\d{4})-(\\d{4})");
|
String[] regexPatterns = {
|
||||||
Matcher matcher = pattern.matcher(standardNumber);
|
"([A-Za-z]{1,2})[-\\/]([A-Za-z]{1,2})\\s+([A-Za-z0-9]{1,3})[-—–]?(\\d{4,5}(?:\\.\\d+)?)[-—–](\\d{4})", // 下面四种综合的正则
|
||||||
|
"([A-Za-z]{1,2})\\/([A-Za-z]{1,2}) (\\d)(\\d{4})-(\\d{4})",// 正常格式
|
||||||
|
"([A-Za-z]{1,2})\\/([A-Za-z]{1,2}) (\\d{1,3})(\\.\\d+)?-(\\d{4})", // 带小数的格式
|
||||||
|
"([A-Za-z]{1,2})\\/([A-Za-z]{1,2})\\s+([A-Za-z0-9]{1,3})-(\\d{4})", // 类别代号J11这种格式
|
||||||
|
"([A-Za-z]{1,2})[-\\/]([A-Za-z]{1,2})\\s+([A-Za-z0-9]{1,3})[-—–]\\d{4,5}(\\.\\d+)?-(\\d{4})"
|
||||||
|
};
|
||||||
|
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
if (matcher.find()) {
|
boolean isMatched = false;
|
||||||
String esCode = matcher.group(1);
|
for (String regex : regexPatterns) {
|
||||||
String eNameCode = matcher.group(2);
|
Pattern pattern = Pattern.compile(regex);
|
||||||
String sCategoryCode = matcher.group(3);
|
Matcher matcher = pattern.matcher(standardNumber);
|
||||||
String yearNum = matcher.group(5);
|
if (matcher.find()) {
|
||||||
|
String esCode = matcher.group(1);
|
||||||
|
String eNameCode = matcher.group(2);
|
||||||
|
String sCategoryCode = matcher.group(3);
|
||||||
|
String yearNum = matcher.group(5);
|
||||||
|
|
||||||
map.put(FieldCommon.ENTERPRISE_STANDARD_CODE, esCode);
|
map.put(FieldCommon.ENTERPRISE_STANDARD_CODE, esCode);
|
||||||
map.put(FieldCommon.ENTERPRISE_NAME_CODE, eNameCode);
|
map.put(FieldCommon.ENTERPRISE_NAME_CODE, eNameCode);
|
||||||
map.put(FieldCommon.STANDARD_CATEGORY_CODE, sCategoryCode);
|
map.put(FieldCommon.STANDARD_CATEGORY_CODE, sCategoryCode);
|
||||||
map.put(FieldCommon.YEAR_NUMBER, yearNum);
|
map.put(FieldCommon.YEAR_NUMBER, yearNum);
|
||||||
} else {
|
|
||||||
log.error("企标标准号拆分失败");
|
isMatched = true;
|
||||||
throw new JeroBootException("企标标准号拆分失败");
|
break; // 匹配成功,跳出循环
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isMatched) {
|
||||||
|
log.error("企标标准号" + standardNumber + "拆分失败");
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -25,6 +25,7 @@ import com.jero.modules.tag.entity.LawsTag;
|
|||||||
import com.jero.modules.tag.enums.TableNameEnum;
|
import com.jero.modules.tag.enums.TableNameEnum;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -242,8 +243,10 @@ public class LawsEnterpriseController {
|
|||||||
@AutoLog(value = "企业法规标准-老法规企标数据库Zip导入")
|
@AutoLog(value = "企业法规标准-老法规企标数据库Zip导入")
|
||||||
@ApiOperation(value="企业法规标准-老法规企标数据库Zip导入", notes="企业法规标准-老法规企标数据库Zip导入")
|
@ApiOperation(value="企业法规标准-老法规企标数据库Zip导入", notes="企业法规标准-老法规企标数据库Zip导入")
|
||||||
@PostMapping("/importOldSystemESZip")
|
@PostMapping("/importOldSystemESZip")
|
||||||
public Result<?> importOldSystemESZip(@RequestParam("file") MultipartFile file) {
|
public Result<?> importOldSystemESZip(@RequestParam("file") MultipartFile file,
|
||||||
enterpriseStandardService.importExcelOldSystem(file);
|
@ApiParam(value = "0不导入 1导入企标 2导入国标", required = true)
|
||||||
|
@RequestParam("type") String type) {
|
||||||
|
enterpriseStandardService.importExcelOldSystem(file, type);
|
||||||
return Result.OK("导入成功");
|
return Result.OK("导入成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ public class LawsEnterpriseStandard implements Serializable {
|
|||||||
* 企标英文名称
|
* 企标英文名称
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "企标英文名称")
|
@ApiModelProperty(value = "企标英文名称")
|
||||||
private String englishName;
|
private String standardEnglishName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准等级分类
|
* 标准等级分类
|
||||||
|
|||||||
+1
-1
@@ -23,5 +23,5 @@ public interface ILawsEnterpriseStandardService extends IService<LawsEnterpriseS
|
|||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void importExcelOldSystem(MultipartFile file);
|
void importExcelOldSystem(MultipartFile file, String type);
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-14
@@ -105,7 +105,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importExcelOldSystem(MultipartFile zipFile) {
|
public void importExcelOldSystem(MultipartFile zipFile, String type) {
|
||||||
// 验证文件是否为压缩格式
|
// 验证文件是否为压缩格式
|
||||||
if (!Objects.requireNonNull(zipFile.getContentType()).contains("zip")) {
|
if (!Objects.requireNonNull(zipFile.getContentType()).contains("zip")) {
|
||||||
throw new JeroBootException("文件格式不正确,请上传zip格式的压缩包。");
|
throw new JeroBootException("文件格式不正确,请上传zip格式的压缩包。");
|
||||||
@@ -175,18 +175,25 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
|||||||
log.error("导入失败;{}", e.getMessage());
|
log.error("导入失败;{}", e.getMessage());
|
||||||
}
|
}
|
||||||
// 导入企标
|
// 导入企标
|
||||||
// 判断是否需要跳过
|
switch (type) {
|
||||||
if (esDatalist.isEmpty()) {
|
case "0":
|
||||||
log.info("企标数据为空,跳过导入");
|
break;
|
||||||
} else {
|
case "1":
|
||||||
// this.oldSysESImport(esDatalist);
|
// 判断是否需要跳过
|
||||||
}
|
if (esDatalist.isEmpty()) {
|
||||||
// 导入国标
|
log.info("企标数据为空,跳过导入");
|
||||||
// 判断是否需要跳过
|
} else {
|
||||||
if (gbDatalist.isEmpty()) {
|
this.oldSysESImport(esDatalist);
|
||||||
log.info("国标数据为空,跳过导入");
|
}
|
||||||
} else {
|
break;
|
||||||
this.oldSysGBImport(gbDatalist);
|
case "2":
|
||||||
|
// 导入国标
|
||||||
|
// 判断是否需要跳过
|
||||||
|
if (gbDatalist.isEmpty()) {
|
||||||
|
log.info("国标数据为空,跳过导入");
|
||||||
|
} else {
|
||||||
|
this.oldSysGBImport(gbDatalist);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +281,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
|||||||
LawsEnterpriseStandard es = new LawsEnterpriseStandard();
|
LawsEnterpriseStandard es = new LawsEnterpriseStandard();
|
||||||
es.setStandardNumber(dto.getBzh());
|
es.setStandardNumber(dto.getBzh());
|
||||||
es.setStandardName(dto.getBzmc());
|
es.setStandardName(dto.getBzmc());
|
||||||
es.setEnglishName(dto.getBzywmc());
|
es.setStandardEnglishName(dto.getBzywmc());
|
||||||
es.setReleaseDate(dto.getFbrq());
|
es.setReleaseDate(dto.getFbrq());
|
||||||
es.setImplementationDate(dto.getSsrq());
|
es.setImplementationDate(dto.getSsrq());
|
||||||
String standardState = dto.getBzzt();
|
String standardState = dto.getBzzt();
|
||||||
|
|||||||
Reference in New Issue
Block a user