模块管理导入功能交互

dev^2
lijinyu 1 year ago
parent 24740d7d44
commit ed181a656e
  1. 275
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java

@ -393,6 +393,32 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String name = cell.getStringCellValue();
propertyNames.add(name);
}
if(propertyNames.size()!=19 || !propertyNames.get(0).equals("上级模块名称")
|| !propertyNames.get(1).equals("项目名称")
|| !propertyNames.get(2).equals("中文名称")
|| !propertyNames.get(3).equals("英文名称")
|| !propertyNames.get(4).equals("模块编码")
|| !propertyNames.get(5).equals("内容描述")
|| !propertyNames.get(6).equals("责任人")
|| !propertyNames.get(7).equals("任务等级")
|| !propertyNames.get(8).equals("任务状态")
|| !propertyNames.get(9).equals("发布时间")
|| !propertyNames.get(10).equals("任务时长")
|| !propertyNames.get(11).equals("开始时间")
|| !propertyNames.get(12).equals("提交时间")
|| !propertyNames.get(13).equals("实际时长")
|| !propertyNames.get(14).equals("用户角色")
|| !propertyNames.get(15).equals("关联实体")
|| !propertyNames.get(16).equals("模块状态")
|| !propertyNames.get(17).equals("版本状态")
|| !propertyNames.get(18).equals("版本号")){
message.put("isError", "true");
message.put("status", "模块管理execl表格不规范,请对比模板重新上传");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("模块管理execl表格不规范,请对比模板重新上传");
}
} else {
ModulexTemplate modulexVo = new ModulexTemplate();
//处理数据
@ -405,43 +431,15 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulexVo.setPid(value);
break;
case 1:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "项目名称为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "项目名称为空");
}
modulexVo.setProjectId(value);
break;
case 2:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "中文名称为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "中文名称为空");
}
modulexVo.setModuleName(value);
break;
case 3:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "英文名称为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "英文名称为空");
}
modulexVo.setModuleEnName(value);
break;
case 4:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "模块编码为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "模块编码为空");
}
modulexVo.setModuleCode(value);
break;
case 5:
@ -451,36 +449,15 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulexVo.setManagerUsers(value);
break;
case 7:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "任务等级为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "任务等级为空");
}
modulexVo.setWorkLevel(value);
break;
case 8:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "开发状态为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "开发状态为空");
}
modulexVo.setWorkStatus(value);
break;
case 9:
modulexVo.setPublishTime(value);
break;
case 10:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "任务时长为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "任务时长为空");
}
modulexVo.setDuration(value);
break;
case 11:
@ -490,13 +467,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulexVo.setSubmitTime(value);
break;
case 13:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "实际时长为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "实际时长为空");
}
modulexVo.setRealDuration(value);
break;
case 14:
@ -506,48 +476,20 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulexVo.setRelatedBean(value);
break;
case 16:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "模块状态为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "模块状态为空");
}
modulexVo.setStatus(value);
break;
case 17:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "版本状态为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "版本状态为空");
}
modulexVo.setVerisonStatus(value);
break;
case 18:
if (value == null || value == "") {
message.put("isError", "true");
message.put("status","文件读取失败"+"第" + (j + 1) + "行" + propertyNames.get(k) + "版本号为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "版本号为空");
}else if(value.length()<=0||value.length()>50){
message.put("isError", "true");
message.put("status","文件读取失败,"+"版本号不符合规范");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("版本号不符合规范");
}else {
modulexVo.setVerison(value);
}
break;
default:
message.put("isError", "true");
message.put("status","文件读取失败,"+"未知错误");
message.put("status","数据匹配读取失败,"+"请重新导入");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("未知错误");
return Result.error("数据匹配读取失败,"+"请重新导入");
}
modulexVo.setUploadPerson(username);
}
@ -555,6 +497,25 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}
}
}
List<String> moduleNameList = new ArrayList<>();
List<String> moduleNameAndPidList = new ArrayList<>();
for (ModulexTemplate template : modulexVoList) {
String moduleName = template.getModuleName();
String pid = template.getPid();
String pinName = pid + moduleName;
moduleNameList.add(moduleName);
moduleNameAndPidList.add(pinName);
}
HashSet<String> setList = new HashSet<>(moduleNameList);
HashSet<String> setPid = new HashSet<>(moduleNameAndPidList);
if(moduleNameList.size()!=setList.size()||moduleNameAndPidList.size()!= setPid.size()){
message.put("isError", "true");
message.put("status","导入失败,相同上级的模块不能重名,一级模块也不能重名,请重新导入");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,,相同上级的模块不能重名,一级模块也不能重名,请重新导入");
}
modulexTemplateService.saveBatch(modulexVoList);
@ -571,6 +532,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
return Result.error("导入失败,预读数据失败,获取不到表格中的数据,请重新导入");
}
else {
for (ModulexTemplate modulexTemplate : modulexTemplates) {
String modulexTemplateId = modulexTemplate.getId();
ids.add(modulexTemplateId);
@ -584,7 +546,8 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
return Result.error("预读数据删除失败,请重新导入");
}
message.put("status", "导入数据中");
for (ModulexTemplate modulexTemplate : modulexTemplates) {
for (int i = 0; i < modulexTemplates.size(); i++) {
ModulexTemplate modulexTemplate = modulexTemplates.get(i);
Modulex modulex = new Modulex();
String pid = modulexTemplate.getPid();
if(StringUtils.isBlank(pid)){
@ -595,7 +558,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
List<Modulex> list = this.list(queryWrapper);
if(list==null ||list.size()==0){
message.put("isError", "true");
message.put("status","导入失败此模块不存在上级");
message.put("status","导入失败,第" + i+4 +"行" +"此模块不存在上级");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,此模块不存在上级");
@ -603,14 +566,14 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Modulex one =list.get(0);
if(one==null){
message.put("isError", "true");
message.put("status","导入失败此模块不存在上级");
message.put("status","导入失败,第" + i+4 +"行" +"此模块不存在上级");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,此模块不存在上级");
}String pid1 = one.getId();
if(pid1==null){
message.put("isError", "true");
message.put("status","导入失败此模块不存在上级");
message.put("status","导入失败,第" + i+4 +"行" +"此模块不存在上级");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,此模块不存在上级");
@ -620,7 +583,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String projectId = modulexTemplate.getProjectId();
if(projectId==null){
message.put("isError", "true");
message.put("status","导入失败,项目名称不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"项目名称不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,项目名称不能为空");
@ -630,10 +593,10 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Projectx projectx = projectxService.getOne(projectxLambdaQueryWrapper);
if(projectx==null){
message.put("isError", "true");
message.put("status","导入失败,项目名称不存在");
message.put("status","导入失败,第" + i+4 +"行" +"项目名称不存在");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,项目名称不存在");
return Result.error("导入失败,项目名称不存在");
} else {
String projectxId = projectx.getId();
modulex.setProjectId(projectxId);
@ -643,11 +606,21 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String pid1 = modulex.getPid();
if(moduleName==null){
message.put("isError", "true");
message.put("status","导入失败,中文名称不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"中文名称不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,中文名称不能为空");
}else if(pid1==null){
LambdaQueryWrapper<Modulex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Modulex::getModuleName,moduleName);
List<Modulex> modulexes = this.list(queryWrapper);
if(modulexes.size()>0){
message.put("isError", "true");
message.put("status","导入失败,第" + i+4 +"行" +"模块中文名称已存在,请重新输入");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("模块中文名称已存在,请重新输入");
}
modulex.setModuleName(moduleName);
}
LambdaQueryWrapper<Modulex> modulexLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -655,7 +628,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Modulex modulex1 = this.getOne(modulexLambdaQueryWrapper);
if(modulex1!=null){
message.put("isError", "true");
message.put("status","导入失败,相同的上级模块不能重名");
message.put("status","导入失败,第" + i+4 +"行" +"相同的上级模块不能重名");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,相同的上级模块不能重名");
@ -663,7 +636,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String moduleEnName = modulexTemplate.getModuleEnName();
if(moduleEnName==null){
message.put("isError", "true");
message.put("status","导入失败,英文名称不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"英文名称不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,英文名称不能为空");
@ -671,7 +644,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String moduleCode = modulexTemplate.getModuleCode();
if(moduleCode==null||moduleCode.length()>30){
message.put("isError", "true");
message.put("status","导入失败,模块编码不能为空或者模块编码过长");
message.put("status","导入失败,第" + i+4 +"行" +"模块编码不能为空或者模块编码过长");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块编码不能为空或者模块编码过长");
@ -684,15 +657,15 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String projectCode = projectx.getProjectCode();
if(projectCode==null){
message.put("isError", "true");
message.put("status","项目编码不存在,请重新填写");
message.put("status","导入失败,第" + i+4 +"行" +"项目编码不存在,请重新填写");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("项目编码不存在,请重新填写");
return Result.error("项目编码不存在,请重新填写");
}
modulecode = projectCode + firstChar;
if(!modulecode.equals(moduleCode)){
message.put("isError", "true");
message.put("status","模块编码不规范,导入失败");
message.put("status","导入失败,第" + i+4 +"行" +"模块编码不规范,导入失败");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("模块编码不规范,导入失败");
@ -701,18 +674,27 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String pmDescribe = modulexTemplate.getPmDescribe();
if(StringUtils.isBlank(pmDescribe)){
modulex.setPmDescribe(null);
}modulex.setPmDescribe(pmDescribe);
}if(pmDescribe.length()>500){
message.put("isError", "true");
message.put("status","导入失败,第" + i+4 +"行" +"内容描述过长,导入失败");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("内容描述过长,导入失败");
}
modulex.setPmDescribe(pmDescribe);
String managerUsers = modulexTemplate.getManagerUsers();
if(StringUtils.isBlank(managerUsers)){
modulex.setManagerUsers(null);
modulex.setManagerUsers(null);
}else {
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
String[] split = managerUsers.split(",");
sysUserLambdaQueryWrapper.in(SysUser::getUsername,split);
List<String> managerUserName= Arrays.stream(split).map(String::valueOf).collect(Collectors.toList());
sysUserLambdaQueryWrapper.in(SysUser::getUsername,managerUserName);
List<SysUser> iSysUserServiceOne = iSysUserService.list(sysUserLambdaQueryWrapper);
if(iSysUserServiceOne==null){
message.put("isError", "true");
message.put("status","导入失败,责任人信息查询不到");
message.put("status","导入失败,第" + i+4 +"行" +"责任人信息查询不到");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,责任人信息查询不到");
@ -720,27 +702,37 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
List<String> list = iSysUserServiceOne.stream().map(SysUser::getId).collect(Collectors.toList());
if (list == null) {
message.put("isError", "true");
message.put("status","导入失败,责任人信息查询不到");
message.put("status","导入失败,第" + i+4 +"行" +"责任人信息查询不到");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,责任人信息查询不到");
}
modulex.setManagerUsers(String.valueOf(list));
String strip = org.apache.commons.lang.StringUtils.strip(list.toString(), "[]");
modulex.setManagerUsers(strip);
}
}
String workLevel = modulexTemplate.getWorkLevel();
if(StringUtils.isBlank(workLevel)){
message.put("isError", "true");
message.put("status","导入失败,任务等级不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"任务等级不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,任务等级不能为空");
}
else {
Integer integer = Integer.valueOf(workLevel);
Integer integer = null;
try {
integer = Integer.valueOf(workLevel);
} catch (Exception e) {
message.put("isError", "true");
message.put("status","导入失败,第" + i+4 +"行" +"任务等级不规范");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,任务等级不规范");
}
if(integer<=0&&integer>=6){
message.put("isError", "true");
message.put("status","导入失败,任务等级不规范");
message.put("status","导入失败,第" + i+4 +"行" +"任务等级不规范");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,任务等级不规范");
@ -750,31 +742,31 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String workStatus = modulexTemplate.getWorkStatus();
if(StringUtils.isBlank(workStatus)){
message.put("isError", "true");
message.put("status","导入失败,工作状态不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"任务状态不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,工作状态不能为空");
return Result.error("导入失败,任务状态不能为空");
}else {
Integer integer = 100;
switch (workStatus){
case "未发布": integer = 0;
break;
break;
case "已发布": integer = 1;
break;
break;
case "开发中": integer = 2;
break;
break;
case "已完成": integer = 3;
break;
break;
case "已撤回": integer = 4;
break;
break;
case "已取出": integer = 9;
break;
break;
default:
message.put("isError", "true");
message.put("status","导入失败,开发状态不规范");
message.put("status","导入失败,第" + i+4 +"行" +"任务状态不规范");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,开发状态不规范");
return Result.error("导入失败,任务状态不规范");
}
modulex.setWorkStatus(integer);
}
@ -785,7 +777,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Boolean result = this.checkTime(publishTime);
if(!result){
message.put("isError", "true");
message.put("status","导入失败,日期格式不规范");
message.put("status","导入失败,第" + i+4 +"行" +"日期格式不规范");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,日期格式不规范");
@ -797,7 +789,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String duration = modulexTemplate.getDuration();
if(StringUtils.isBlank(duration)){
message.put("isError", "true");
message.put("status","导入失败,任务时长不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"任务时长不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,任务时长不能为空");
@ -812,7 +804,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Boolean result = this.checkTime(startTime);
if(!result){
message.put("isError", "true");
message.put("status","导入失败,开始时间不规范");
message.put("status","导入失败,第" + i+4 +"行" +"开始时间不规范");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,开始时间不规范");
@ -828,7 +820,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Boolean result = this.checkTime(submitTime);
if(!result){
message.put("isError", "true");
message.put("status","导入失败,提交时间不规范");
message.put("status","导入失败,第" + i+4 +"行" +"提交时间不规范");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,提交时间不规范");
@ -840,7 +832,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String realDuration = modulexTemplate.getRealDuration();
if(StringUtils.isBlank(realDuration)){
message.put("isError", "true");
message.put("status","导入失败,实际时长不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"实际时长不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,实际时长不能为空");
@ -848,7 +840,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
double parseDouble = Double.parseDouble(realDuration);
if(parseDouble<0.1){
message.put("isError", "true");
message.put("status","导入失败,最小时间0.1小时");
message.put("status","导入失败,第" + i+4 +"行" +"最小时间0.1小时");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,最小时间0.1小时");
@ -864,7 +856,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
SysRole one = iSysRoleService.getOne(sysRoleLambdaQueryWrapper);
if(one==null){
message.put("isError", "true");
message.put("status","导入失败,用户角色不存在");
message.put("status","导入失败,第" + i+4 +"行" +"用户角色不存在");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,用户角色不存在");
@ -872,7 +864,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String useRole = one.getId();
if(useRole==null){
message.put("isError", "true");
message.put("status","导入失败,用户角色不存在");
message.put("status","导入失败,第" + i+4 +"行" +"用户角色不存在");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,用户角色不存在");
@ -885,7 +877,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Boolean extracted = extracted(modulex, relatedBean);
if(!extracted){
message.put("isError", "true");
message.put("status","关联实体不存在");
message.put("status","导入失败,第" + i+4 +"行" +"关联实体不存在");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("关联实体不存在");
@ -894,7 +886,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String status = modulexTemplate.getStatus();
if(StringUtils.isBlank(status)){
message.put("isError", "true");
message.put("status","导入失败,模块状态不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"模块状态不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块状态不能为空");
@ -902,14 +894,14 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Integer integer = 100;
switch (status){
case "正常": integer = 1;
break;
break;
case "停用": integer = 0;
break;
break;
case "废弃": integer = 9;
break;
break;
default:
message.put("isError", "true");
message.put("status","导入失败模块状态不规范匹配不到");
message.put("status","导入失败,第" + i+4 +"行" +"模块状态不规范匹配不到");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块状态不规范匹配不到");
@ -919,7 +911,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String verisonStatus = modulexTemplate.getVerisonStatus();
if(StringUtils.isBlank(verisonStatus)){
message.put("isError", "true");
message.put("status","导入失败,版本状态不能为空");
message.put("status","导入失败,第" + i+4 +"行" +"版本状态不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,版本状态不能为空");
@ -927,31 +919,34 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
Integer integer = 100;
switch (verisonStatus){
case "当前": integer = 1;
break;
break;
case "历史": integer = 0;
break;
break;
default:
message.put("isError", "true");
message.put("status","导入失败,版本状态不规范,匹配失败");
message.put("status","导入失败,第" + i+4 +"行" +"版本状态不规范,匹配失败");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
Result.error("导入失败,版本状态不规范,匹配失败");
return Result.error("导入失败,版本状态不规范,匹配失败");
}
modulex.setVerisonStatus(integer);
}
String verison = modulexTemplate.getVerison();
if(StringUtils.isBlank(verison)){
message.put("isError", "true");
message.put("status","导入失败,版本号不能为空");
message.put("status","导入失败,第" + i+4 +"行" + "版本号不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,版本号不能为空");
return Result.error("导入失败,版本号不能为空");
}else {
int parseInt = Integer.parseInt(verison);
modulex.setVerison(parseInt);
}
modulexList.add(modulex);
}
// for (ModulexTemplate modulexTemplate : modulexTemplates) {
//
// }
boolean result = this.saveSingleBatch(modulexList, loginUser, message);
if(!result){
message.put("isError", "true");

Loading…
Cancel
Save