相关人员提示语修改

This commit is contained in:
xiejunyu
2022-05-13 18:13:44 +08:00
parent 4cbd3597d3
commit 941270e0f7
3 changed files with 24 additions and 32 deletions
@@ -166,11 +166,10 @@ public class ProjectRelatedPersonnelController extends JeroController<ProjectRel
@AutoLog(value = "项目库-相关人员维护表-通过excel导入数据")
@ApiOperation(value="项目库-相关人员维护表-通过excel导入数据", notes="项目库-相关人员维护表-通过excel导入数据")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(MultipartFile file,
public void importExcel(MultipartFile file,
@RequestParam(name="projectId",required=true) String projectId,
@RequestParam(name="cut",required=true) String cut) throws IOException, InvalidFormatException {
String message = projectRelatedPersonnelService.importExcel(file, ProjectRelatedPersonnel.class, projectId, cut);
return Result.OK(message);
projectRelatedPersonnelService.importExcel(file, ProjectRelatedPersonnel.class, projectId, cut);
}
/**
@@ -80,10 +80,10 @@ public interface IProjectRelatedPersonnelService extends IService<ProjectRelated
/**设置导出模板*/
void exportTemplate(ProjectRelatedPersonnel projectRelatedPersonnel, HttpServletResponse response, HttpServletRequest request);
String importExcel(MultipartFile file, Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException;
void importExcel(MultipartFile file, Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException;
String oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut);
void oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut);
ProjectRelatedPersonnel queryByProjectIdAndDutyTerritory(String projectId, String dutyTerritory);
@@ -648,12 +648,11 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
/**
* 导入excel数据
*
* @return
*/
@Override
public String importExcel(MultipartFile file,
Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException {
String message = "";
public void importExcel(MultipartFile file,
Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException {
String explainInfo= null;
String titleOne = "";
@@ -706,41 +705,38 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
if (i == 0){
if (i == 0 && !cell.getStringCellValue().equals(titleOneList.get(j))) {//检查表头
if (CutEnum.CN.getValue().equals(cut)) {
message="读取失败.请检查第 " + (i+1) + " 行表头,请严格按照模板文件导入数据";
throw new JeroBootException("读取失败.请检查第 " + (i+1) + " 行表头,请严格按照模板文件导入数据");
} else {
message="The data fails to be read.Please check header in line " + (i+1) + " .Import data strictly according to the template file.";
throw new JeroBootException("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)){
if (CutEnum.CN.getValue().equals(cut)) {
message="导入的列数不对,请检查";
throw new JeroBootException("导入的列数不对,请检查");
} else {
message="The number of imported columns is wrong. Please check!";
throw new JeroBootException("The number of imported columns is wrong. Please check!");
}
return message;
}
}else{
if (CutEnum.CN.getValue().equals(cut)) {
message="导入的数据不能为空,请检查";
throw new JeroBootException("导入的数据不能为空,请检查");
} else {
message="The imported data of cannot be empty. Please check!";
throw new JeroBootException("The imported data of cannot be empty. Please check!");
}
return message;
}
if (i == 1) {//校验填写说明
row = sheet.getRow(i);
int columNos = row.getLastCellNum();
if(columNos != 1 /*|| (!row.getCell(0).getStringCellValue().equals(explainInfo))*/){
if (CutEnum.CN.getValue().equals(cut)) {
message="填写说明列数不对,请严格按照模板文件导入数据";
throw new JeroBootException("填写说明列数不对,请严格按照模板文件导入数据");
}else{
message="The number of columns of filling explanation is wrong. Please import data strictly according to the template file.";
throw new JeroBootException("The number of columns of filling explanation is wrong. Please import data strictly according to the template file.");
}
return message;
}
}
if (i > 1) {//读取数据
//获取每一行数据
@@ -753,11 +749,10 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
projectRelatedPersonnel.setDutyTerritory(row.getCell(0).toString());
}else{//责任领域不能为空,报错
if(CutEnum.CN.getValue().equals(cut)){
message="请填写责任领域,带*的为必填.请检查第 "+ (i+1) + "";
throw new JeroBootException("请填写责任领域,带*的为必填.请检查第 "+ (i+1) + "");
}else{
message="Please fill in the Responsible Field and those marked with * are required. .Please check line" + (i+1);
throw new JeroBootException("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();
@@ -776,11 +771,10 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
projectRelatedPersonnel.setCertificationEngineerName("");
}else {//除了责任领域,备注,有一个为空都报错
if(CutEnum.CN.getValue().equals(cut)){
message="请填写必填字段内容,带*的为必填.请检查第 "+ (i+1) + "";
throw new JeroBootException("请填写必填字段内容,带*的为必填.请检查第 "+ (i+1) + "");
}else{
message="Please fill in the required fields marked with * .Please check line" + (i+1);
throw new JeroBootException("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();
@@ -796,17 +790,16 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
}
workbook.close();
//把数据翻译成id,并保存
message = oppositeDisposeData(list, projectId, cut);
return message;
oppositeDisposeData(list, projectId, cut);
}
/**
* 把导入的数据翻译成对应的id,校验,不存
* 若除责任领域外的导入数据不能为空
* @return
*/
@Override
public String oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut) {
public void oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut) {
int row=3;
StringBuilder message = new StringBuilder();
for (ProjectRelatedPersonnel projectRelatedPersonnel:records) {
@@ -974,7 +967,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
message.append("Import succeeded.");
}
}
return message.toString();
throw new JeroBootException(message.toString());
}
@Override