认证清单导入增加三个字段,并判断字符长度验证

This commit is contained in:
cuijiaming
2023-03-30 14:00:37 +08:00
parent 5871b2e2bd
commit aa931dbec1
@@ -2711,13 +2711,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
public void importData(MultipartFile file, ProjectCertificationInventoryEO projectCertificationInventoryEO) {
String title = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEO.getCut())){
title = "*类别,*检验项目,*配置项,*WVTA ID," +
title = title = "*类别,*检验项目,*配置项,*WVTA ID," +
"*标准编号,*责任领域,*工程接口人,*责任人," +
"*交付物类型,交付物模板,*截止日期";
"*交付物类型,交付物模板,*截止日期,报告编号,产品型号,生产企业名称";
}else {
title = "*Category,*Inspection Items,*Configuration Item,*WVTA ID," +
"*Standard No,*Responsible Field,*Eng. Interface,*Assignee," +
"*Deliverable Type,Deliverable Template,*Due Date";
"*Deliverable Type,Deliverable Template,*Due Date,Report No,Product Model,Name Of Manufacturer";
}
int pos = file.getOriginalFilename().lastIndexOf(".");
@@ -2989,6 +2989,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
//截止时间
String endTime = projectCertificationInventoryEO.getEndTimeStr();
//报告编号
String reportNumber = projectCertificationInventoryEO.getReportNumber();
//产品型号
String productModel = projectCertificationInventoryEO.getProductModel();
//生产企业名称
String productionEnterpriseName = projectCertificationInventoryEO.getProductionEnterpriseName();
//文件
//交付物模板
@@ -3000,16 +3006,51 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
//编号必填
flag = must(projectCertificationInventoryEO, errorMsg, msgList, serialNumber, "编号", "Standard No");
//报告编号
if(StringUtils.isNotBlank(reportNumber)){
if(reportNumber.length() > 200){
String message = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){
message = errorMsg + "报告编号不能超过200个字符, ";
}else{
message = errorMsg + " The Report No cannot contain more than 200 characters, ";
}
msgList.add(message);
}
}
//产品型号
if(StringUtils.isNotBlank(productModel)){
if(productModel.length() > 200){
String message = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){
message = errorMsg + "产品型号不能超过200个字符, ";
}else{
message = errorMsg + " The Product Model cannot contain more than 200 characters, ";
}
msgList.add(message);
}
}
//生产企业名称
if(StringUtils.isNotBlank(productionEnterpriseName)){
if(productionEnterpriseName.length() > 200){
String message = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){
message = errorMsg + "生产企业名称不能超过200个字符, ";
}else{
message = errorMsg + " The Name Of Manufacturer cannot contain more than 200 characters, ";
}
msgList.add(message);
}
}
//WVTA ID
if(StringUtils.isNotBlank(wvtaId)){
if(wvtaId.length() > 100){
if(wvtaId.length() > 300){
String message = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){
message = errorMsg + "WVTA ID不能超过100个字符, ";
message = errorMsg + "WVTA ID不能超过300个字符, ";
}else{
message = errorMsg + " The WVTA ID cannot contain more than 100 characters, ";
message = errorMsg + " The WVTA ID cannot contain more than 300 characters, ";
}
msgList.add(message);
}
@@ -3025,12 +3066,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
//类别
if(StringUtils.isNotBlank(category)){
if(category.length() > 100){
if(category.length() > 300){
String message = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){
message = errorMsg + "类别不能超过100个字符, ";
message = errorMsg + "类别不能超过300个字符, ";
}else{
message = errorMsg + " The Category cannot contain more than 100 characters, ";
message = errorMsg + " The Category cannot contain more than 300 characters, ";
}
msgList.add(message);
}
@@ -3049,9 +3090,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(inspectionItem.length() > 100){
String message = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){
message = errorMsg + "检验项目不能超过100个字符, ";
message = errorMsg + "检验项目不能超过300个字符, ";
}else{
message = errorMsg + " The InspectionItem cannot contain more than 100 characters, ";
message = errorMsg + " The InspectionItem cannot contain more than 300 characters, ";
}
msgList.add(message);
}
@@ -3067,12 +3108,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
//配置项
if(StringUtils.isNotBlank(configItem)){
if(configItem.length() > 100){
if(configItem.length() > 300){
String message = "";
if(CutEnum.CN.getValue().equals(projectCertificationInventoryEOTemp.getCut())){
message = errorMsg + "配置项不能超过100个字符, ";
}else{
message = errorMsg + " The ConfigItem cannot contain more than 100 characters, ";
message = errorMsg + " The ConfigItem cannot contain more than 300 characters, ";
}
msgList.add(message);
}