From 04107fa6592a165e02fa2e9714d3738a96effc20 Mon Sep 17 00:00:00 2001
From: lijinyu <3023846734@qq.com>
Date: Wed, 19 Jul 2023 17:02:14 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97=E5=AF=BC?=
=?UTF-8?q?=E5=85=A5=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jeecg-boot/jeecg-boot-module-system/pom.xml | 7 ++
.../demo/functionx/entity/FunctionxTest.java | 5 --
.../impl/FunctionXTestServiceImpl.java | 29 +++----
.../modulex/entity/ModulexTemplate.java | 13 +--
.../modulex/service/IModulexService.java | 1 +
.../service/impl/ModulexServiceImpl.java | 81 ++++++++++++++-----
6 files changed, 81 insertions(+), 55 deletions(-)
diff --git a/jeecg-boot/jeecg-boot-module-system/pom.xml b/jeecg-boot/jeecg-boot-module-system/pom.xml
index 47eb4bf..157365a 100644
--- a/jeecg-boot/jeecg-boot-module-system/pom.xml
+++ b/jeecg-boot/jeecg-boot-module-system/pom.xml
@@ -110,6 +110,13 @@
3.17
+
+
+ com.belerweb
+ pinyin4j
+ 2.5.1
+
+
org.jeecgframework.boot
jeecg-boot-module-cms
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java
index 7ac0734..daa02f1 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/entity/FunctionxTest.java
@@ -52,11 +52,6 @@ public class FunctionxTest implements Serializable {
*/
private String pmDescribe;
- /**
- * 分析图
- */
- private String diagrams;
-
/**
* 用户角色
*/
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java
index 3d0031b..b11e5fb 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionXTestServiceImpl.java
@@ -101,19 +101,18 @@ public class FunctionXTestServiceImpl extends ServiceImpl queryWrapperUser = new LambdaQueryWrapper<>();
queryWrapperUser.eq(ProjectUserRole::getUserRole,userRole); // 是否匹配项目id?
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java
index 328efab..9cfca17 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/entity/ModulexTemplate.java
@@ -171,18 +171,7 @@ public class ModulexTemplate implements Serializable {
@ApiModelProperty(value = "关联实体")
@Dict(dictTable = "tablex", dicText = "table_name", dicCode = "id")
private String relatedBean;
- /**
- * 原型图
- */
- @Excel(name = "原型图", width = 15)
- @ApiModelProperty(value = "原型图")
- private String prototypes;
- /**
- * 分析图
- */
- @Excel(name = "分析图", width = 15)
- @ApiModelProperty(value = "分析图")
- private String diagrams;
+
/**
* 模块状态
* 值:正常1、停用0、废弃9;默认1
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java
index 485d49d..ab443a0 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java
@@ -42,4 +42,5 @@ public interface IModulexService extends IService {
List exportXlslist(HttpServletRequest request, String selections,Modulex modulex);
Result> importExcel(MultipartFile file) throws Exception;
+
}
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
index 5f596a7..d941267 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
@@ -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 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 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 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 impl
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块编码不能为空或者模块编码过长");
}
+ String modulecode = null;
+ LambdaQueryWrapper 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 impl
modulex.setManagerUsers(null);
}else {
LambdaQueryWrapper 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 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 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 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 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;
+ }
+
+
+
}