|
|
|
@ -4,6 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.extension.api.R; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import net.sourceforge.pinyin4j.PinyinHelper; |
|
|
|
|
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; |
|
|
|
|
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; |
|
|
|
|
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; |
|
|
|
|
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; |
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
|
|
import org.apache.poi.ss.usermodel.Cell; |
|
|
|
|
import org.apache.poi.ss.usermodel.Row; |
|
|
|
@ -479,12 +484,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
modulexVo.setRelatedBean(value); |
|
|
|
|
break; |
|
|
|
|
case 16: |
|
|
|
|
modulexVo.setPrototypes(value); |
|
|
|
|
break; |
|
|
|
|
case 17: |
|
|
|
|
modulexVo.setDiagrams(value); |
|
|
|
|
break; |
|
|
|
|
case 18: |
|
|
|
|
if (value == null || value == "") { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
@ -492,7 +491,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
} |
|
|
|
|
modulexVo.setStatus(value); |
|
|
|
|
break; |
|
|
|
|
case 19: |
|
|
|
|
case 17: |
|
|
|
|
if (value == null || value == "") { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
@ -500,7 +499,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
} |
|
|
|
|
modulexVo.setVerisonStatus(value); |
|
|
|
|
break; |
|
|
|
|
case 20: |
|
|
|
|
case 18: |
|
|
|
|
if (value == null || value == "") { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
@ -621,6 +620,23 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("导入失败,模块编码不能为空或者模块编码过长"); |
|
|
|
|
} |
|
|
|
|
String modulecode = null; |
|
|
|
|
LambdaQueryWrapper<Projectx> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(Projectx::getProjectName,projectId); |
|
|
|
|
Projectx projectx = projectxService.getOne(queryWrapper); |
|
|
|
|
String firstChar = this.toFirstChar(moduleName); |
|
|
|
|
String projectCode = projectx.getProjectCode(); |
|
|
|
|
if(projectCode==null){ |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("项目编码不存在,请重新填写"); |
|
|
|
|
} |
|
|
|
|
modulecode = projectCode + firstChar; |
|
|
|
|
if(!modulecode.equals(moduleCode)){ |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("模块编码不规范,导入失败"); |
|
|
|
|
} |
|
|
|
|
modulex.setModuleCode(moduleCode); |
|
|
|
|
String pmDescribe = modulexTemplate.getPmDescribe(); |
|
|
|
|
if(StringUtils.isBlank(pmDescribe)){ |
|
|
|
@ -631,20 +647,23 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
modulex.setManagerUsers(null); |
|
|
|
|
}else { |
|
|
|
|
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
sysUserLambdaQueryWrapper.eq(SysUser::getUsername,managerUsers); |
|
|
|
|
SysUser iSysUserServiceOne = iSysUserService.getOne(sysUserLambdaQueryWrapper); |
|
|
|
|
String[] split = managerUsers.split(","); |
|
|
|
|
// sysUserLambdaQueryWrapper.eq(SysUser::getUsername,managerUsers);
|
|
|
|
|
sysUserLambdaQueryWrapper.in(SysUser::getUsername,split); |
|
|
|
|
List<SysUser> iSysUserServiceOne = iSysUserService.list(sysUserLambdaQueryWrapper); |
|
|
|
|
if(iSysUserServiceOne==null){ |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("导入失败,责任人信息查询不到"); |
|
|
|
|
}else { |
|
|
|
|
String id = iSysUserServiceOne.getId(); |
|
|
|
|
if (id == null) { |
|
|
|
|
List<String> list = iSysUserServiceOne.stream().map(SysUser::getId).collect(Collectors.toList()); |
|
|
|
|
// String id = iSysUserServiceOne.getId();
|
|
|
|
|
if (list == null) { |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("导入失败,责任人信息查询不到"); |
|
|
|
|
} |
|
|
|
|
modulex.setManagerUsers(id); |
|
|
|
|
modulex.setManagerUsers(String.valueOf(list)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String workLevel = modulexTemplate.getWorkLevel(); |
|
|
|
@ -784,14 +803,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
return Result.error("关联实体不存在"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String prototypes = modulexTemplate.getPrototypes(); |
|
|
|
|
if(StringUtils.isBlank(prototypes)){ |
|
|
|
|
modulex.setPrototypes(null); |
|
|
|
|
}modulex.setPrototypes(prototypes); |
|
|
|
|
String diagrams = modulexTemplate.getDiagrams(); |
|
|
|
|
if(StringUtils.isBlank(diagrams)){ |
|
|
|
|
modulex.setDiagrams(null); |
|
|
|
|
}modulex.setDiagrams(diagrams); |
|
|
|
|
String status = modulexTemplate.getStatus(); |
|
|
|
|
if(StringUtils.isBlank(status)){ |
|
|
|
|
message.put("isVisible", "false"); |
|
|
|
@ -1179,4 +1190,32 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl |
|
|
|
|
moduleFunctionRule.setVerison(x.getVerison()); |
|
|
|
|
return moduleFunctionRule; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取字符串拼音的第一个字母 |
|
|
|
|
* @param chinese |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static String toFirstChar(String chinese){ |
|
|
|
|
String pinyinStr = ""; |
|
|
|
|
char[] newChar = chinese.toCharArray(); //转为单个字符
|
|
|
|
|
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); |
|
|
|
|
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); |
|
|
|
|
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); |
|
|
|
|
for (int i = 0; i < newChar.length; i++) { |
|
|
|
|
if (newChar[i] > 128) { |
|
|
|
|
try { |
|
|
|
|
pinyinStr += PinyinHelper.toHanyuPinyinStringArray(newChar[i], defaultFormat)[0].charAt(0); |
|
|
|
|
} catch (BadHanyuPinyinOutputFormatCombination e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
pinyinStr += newChar[i]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return pinyinStr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|