fix(88290): 标准解读流程(标准主解读人分发) --不分发--导入模板没有做数据格式校验

This commit is contained in:
yjz
2024-08-08 18:20:03 +08:00
parent 0497f2353b
commit 187bd3d7bc
@@ -143,7 +143,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
private final List<String> tempList = new ArrayList<>();
private final int TEXT_LENGTH = 50;
private final int TEXT_DICT_LENGTH = 500;
private final int TEXT_AREA_LENGTH = 2000;
@Override
public void flowStart(StandardInterpretFlowDTO standardInterpretFlowDTO) {
// 流程信息
@@ -991,6 +993,39 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
}
}
String technicalSpecificationDesignGuide = data.getTechnicalSpecificationDesignGuide();
textLenghtCheck(technicalSpecificationDesignGuide, TEXT_LENGTH, errorList, "技术规范/设计指南");
String drawingTemplate = data.getDrawingTemplate();
textLenghtCheck(drawingTemplate, TEXT_LENGTH, errorList, "图纸模板");
String technicalAgreementTemplate = data.getTechnicalAgreementTemplate();
textLenghtCheck(technicalAgreementTemplate, TEXT_LENGTH, errorList, "技术协议模板");
String verificationReportTemplateChecklist = data.getVerificationReportTemplateChecklist();
textLenghtCheck(verificationReportTemplateChecklist, TEXT_LENGTH, errorList, "校验报告模块/checklist");
String dvpTemplate = data.getDvpTemplate();
textLenghtCheck(dvpTemplate, TEXT_LENGTH, errorList, "DVP模板");
String dfema = data.getDfema();
textLenghtCheck(dfema, TEXT_LENGTH, errorList, "DFEMA");
String keyTechnologyDecompositionTable = data.getKeyTechnologyDecompositionTable();
textLenghtCheck(keyTechnologyDecompositionTable, TEXT_LENGTH, errorList, "关键技术分解表");
String otherDocumentsTemplates = data.getOtherDocumentsTemplates();
textLenghtCheck(otherDocumentsTemplates, TEXT_LENGTH, errorList, "其他文件或模板");
String p3 = data.getP3();
textLenghtCheck(p3, TEXT_LENGTH, errorList, "P3证明符合性的交付物名称");
String p5 = data.getP5();
textLenghtCheck(p5, TEXT_LENGTH, errorList, "P5证明符合性的交付物名称");
String remarks = data.getRemarks();
textLenghtCheck(remarks, TEXT_AREA_LENGTH, errorList, "备注");
String investigationStage = data.getInvestigationStage();
if (StringUtils.isNotBlank(investigationStage)){
boolean flag = true;
@@ -1014,6 +1049,14 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
return errorList;
}
private void textLenghtCheck(String technicalSpecificationDesignGuide, int length, List<String> errorList, String x) {
if (StringUtils.isNotBlank(technicalSpecificationDesignGuide)) {
if (technicalSpecificationDesignGuide.length() > length) {
errorList.add(x + "长度超出" + length + "位!");
}
}
}
private List<String> fifthVerify(ProcessStandardInterpretClauseSublist data) {
List<String> errorList = new ArrayList<>();
String applications = data.getApplications();
@@ -1228,6 +1271,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
String isSameAsPrevVersion = data.getIsSameAsPrevVersion();
if (StringUtils.isNotBlank(isSameAsPrevVersion)){
if (isSameAsPrevVersion.length() > 1){
textLenghtCheck(isSameAsPrevVersion, 1, errorList, "是否与上一版相同");
}
List<DictModel> dictItems = sysDictService.getDictItems("yn");
Optional<DictModel> optionalDictModel = dictItems.stream()
.filter(dictModel -> dictModel.getText().equals(isSameAsPrevVersion)).findFirst();
@@ -1238,6 +1284,12 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
}
}
String changeDescription = data.getChangeDescription();
textLenghtCheck(changeDescription, TEXT_LENGTH, errorList, "相对上一版变化点说明长度超出");
String regulatoryNotes = data.getRegulatoryNotes();
textLenghtCheck(regulatoryNotes, TEXT_LENGTH, errorList, "法规注释长度超出");
String domainArea = data.getDomainArea();
if (StringUtils.isNotBlank(domainArea)){
boolean flag = true;
@@ -1258,11 +1310,32 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
}
}
String configurationRequirements = data.getConfigurationRequirements();
if (StringUtils.isNotBlank(configurationRequirements)){
boolean flag = true;
List<String> list = new ArrayList<>();
List<DictModel> dictItems = sysDictService.getDictItems("configuration_requirements");
for (String str : configurationRequirements.split(",")) {
Optional<DictModel> optionalDictModel = dictItems.stream()
.filter(dictModel -> dictModel.getText().equals(str)).findFirst();
if (!optionalDictModel.isPresent()){
errorList.add("配置需求不存在!");
flag = false;
break;
}
list.add(optionalDictModel.get().getValue());
}
if (flag){
data.setConfigurationRequirements(String.join(",", list));
}
}
String newCerImplementDate = data.getNewCerImplementDate();
if (StringUtils.isNotBlank(newCerImplementDate)){
for (String str : newCerImplementDate.split(",")) {
try {
dateFormat.parse(str);
textLenghtCheck(str.split("-")[0], 4, errorList, "新认证车实施日期年份");
} catch (ParseException e) {
errorList.add("新认证车实施日期格式错误!");
break;
@@ -1270,11 +1343,25 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
}
}
String newProductionImplementation = data.getNewProductionImplementation();
if (StringUtils.isNotBlank(newProductionImplementation)){
for (String str : newProductionImplementation.split(",")) {
try {
dateFormat.parse(str);
textLenghtCheck(str.split("-")[0], 4, errorList, "新生产车实施日期年份");
} catch (ParseException e) {
errorList.add("新生产车实施日期格式错误!");
break;
}
}
}
String registrationDate = data.getRegistrationDate();
if (StringUtils.isNotBlank(registrationDate)){
for (String str : registrationDate.split(",")) {
try {
dateFormat.parse(str);
textLenghtCheck(str.split("-")[0], 4, errorList, "注册日期年份");
} catch (ParseException e) {
errorList.add("注册日期格式错误!");
break;