相关人员导入提示语修改
This commit is contained in:
+20
-15
@@ -653,7 +653,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
@Override
|
@Override
|
||||||
public String importExcel(MultipartFile file,
|
public String importExcel(MultipartFile file,
|
||||||
Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException {
|
Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException {
|
||||||
|
String message = "";
|
||||||
String explainInfo= null;
|
String explainInfo= null;
|
||||||
String titleOne = "";
|
String titleOne = "";
|
||||||
|
|
||||||
@@ -706,38 +706,41 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
if (i == 0){
|
if (i == 0){
|
||||||
if (i == 0 && !cell.getStringCellValue().equals(titleOneList.get(j))) {//检查表头
|
if (i == 0 && !cell.getStringCellValue().equals(titleOneList.get(j))) {//检查表头
|
||||||
if (CutEnum.CN.getValue().equals(cut)) {
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
throw new JeroBootException("读取失败.请检查第 " + (i+1) + " 行表头,请严格按照模板文件导入数据");
|
message="读取失败.请检查第 " + (i+1) + " 行表头,请严格按照模板文件导入数据";
|
||||||
} else {
|
} else {
|
||||||
throw new JeroBootException("The data fails to be read.Please check header in line " + (i+1) + " .Import data strictly according to the template file.");
|
message="The data fails to be read.Please check header in line " + (i+1) + " .Import data strictly according to the template file.";
|
||||||
}
|
}
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if((i!=1 && columNos != 5) || (i==2 && columNos !=1)){
|
}else if((i!=1 && columNos != 5) || (i==2 && columNos !=1)){
|
||||||
if (CutEnum.CN.getValue().equals(cut)) {
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
throw new JeroBootException("导入的列数不对,请检查");
|
message="导入的列数不对,请检查";
|
||||||
} else {
|
} else {
|
||||||
throw new JeroBootException("The number of imported columns is wrong. Please check!");
|
message="The number of imported columns is wrong. Please check!";
|
||||||
}
|
}
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if (CutEnum.CN.getValue().equals(cut)) {
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
throw new JeroBootException("导入的数据不能为空,请检查");
|
message="导入的数据不能为空,请检查";
|
||||||
} else {
|
} else {
|
||||||
throw new JeroBootException("The imported data of cannot be empty. Please check!");
|
message="The imported data of cannot be empty. Please check!";
|
||||||
}
|
}
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
if (i == 1) {//校验填写说明
|
if (i == 1) {//校验填写说明
|
||||||
row = sheet.getRow(i);
|
row = sheet.getRow(i);
|
||||||
int columNos = row.getLastCellNum();
|
int columNos = row.getLastCellNum();
|
||||||
if(columNos != 1 /*|| (!row.getCell(0).getStringCellValue().equals(explainInfo))*/){
|
if(columNos != 1 /*|| (!row.getCell(0).getStringCellValue().equals(explainInfo))*/){
|
||||||
if (CutEnum.CN.getValue().equals(cut)) {
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
throw new JeroBootException("填写说明列数不对,请严格按照模板文件导入数据");
|
message="填写说明列数不对,请严格按照模板文件导入数据";
|
||||||
}else{
|
}else{
|
||||||
throw new JeroBootException("The number of columns of filling explanation is wrong. Please import data strictly according to the template file.");
|
message="The number of columns of filling explanation is wrong. Please import data strictly according to the template file.";
|
||||||
}
|
}
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (i > 1) {//读取数据
|
if (i > 1) {//读取数据
|
||||||
//获取每一行数据
|
//获取每一行数据
|
||||||
@@ -750,10 +753,11 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
projectRelatedPersonnel.setDutyTerritory(row.getCell(0).toString());
|
projectRelatedPersonnel.setDutyTerritory(row.getCell(0).toString());
|
||||||
}else{//责任领域不能为空,报错
|
}else{//责任领域不能为空,报错
|
||||||
if(CutEnum.CN.getValue().equals(cut)){
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
throw new JeroBootException("请填写责任领域,带*的为必填.请检查第 "+ (i+1) + "行");
|
message="请填写责任领域,带*的为必填.请检查第 "+ (i+1) + "行";
|
||||||
}else{
|
}else{
|
||||||
throw new JeroBootException("Please fill in the Responsible Field and those marked with * are required. .Please check line" + (i+1));
|
message="Please fill in the Responsible Field and those marked with * are required. .Please check line" + (i+1);
|
||||||
}
|
}
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
String lawEngineerName = row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
|
String lawEngineerName = row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
|
||||||
@@ -772,10 +776,11 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
projectRelatedPersonnel.setCertificationEngineerName("");
|
projectRelatedPersonnel.setCertificationEngineerName("");
|
||||||
}else {//除了责任领域,备注,有一个为空都报错
|
}else {//除了责任领域,备注,有一个为空都报错
|
||||||
if(CutEnum.CN.getValue().equals(cut)){
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
throw new JeroBootException("请填写必填字段内容,带*的为必填.请检查第 "+ (i+1) + "行");
|
message="请填写必填字段内容,带*的为必填.请检查第 "+ (i+1) + "行";
|
||||||
}else{
|
}else{
|
||||||
throw new JeroBootException("Please fill in the required fields marked with * .Please check line" + (i+1));
|
message="Please fill in the required fields marked with * .Please check line" + (i+1);
|
||||||
}
|
}
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
String remark = row.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
|
String remark = row.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
|
||||||
@@ -791,7 +796,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
}
|
}
|
||||||
workbook.close();
|
workbook.close();
|
||||||
//把数据翻译成id,并保存
|
//把数据翻译成id,并保存
|
||||||
String message = oppositeDisposeData(list, projectId, cut);
|
message = oppositeDisposeData(list, projectId, cut);
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user