浏览代码

925下午 定时备份

LT32820A 2 月之前
父节点
当前提交
eea891f38e

+ 3 - 3
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/AppCustomMapper.java

@@ -22,9 +22,9 @@ public interface AppCustomMapper {
     })
     List<String> queryUseridByAppAdminRole(@Param("roleName") String roleName);
 
-    // 通过用户id查询用户真实姓名
-    @Select("SELECT realname FROM sys_user WHERE id = #{userId}")
-    String queryRealnameByUserId(@Param("userId") String userId);
+    // 通过用户id查询用户账号
+    @Select("SELECT username FROM sys_user WHERE id = #{userId}")
+    String queryUsernameByUserId(@Param("userId") String userId);
 
     AppBaseInfo queryBaseInfoById(@Param("id") String id);
 

+ 9 - 19
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/AppmanageServiceImpl.java

@@ -1,21 +1,15 @@
 package org.jeecg.modules.system.service.impl;
 
-//import bp.wf.Dev2Interface;
-import java.lang.reflect.Field;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import org.apache.http.HttpRequest;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.dto.message.TemplateMessageDTO;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.config.mqtoken.UserTokenContext;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.base.service.BaseCommonService;
-import org.jeecg.modules.client.AppManage.WorkFlowClient;
 import org.jeecg.modules.system.controller.SysUserController;
 import org.jeecg.modules.system.entity.*;
 import org.jeecg.modules.system.entity.AppmanageEntity.*;
@@ -27,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.util.*;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.stream.Collectors;
@@ -124,19 +117,19 @@ public class AppmanageServiceImpl implements AppmanageService {
         appBaseInfo.setDelFlag(1);
         baseInfoMapper.insert(appBaseInfo);
 
-        // 提交至工作流的表单信息(临时将用户id换成真名,字典值换成字典文本)
+        // 提交至工作流的表单信息(将用户id换成用户账号,字典值换成字典文本)
         AppBaseInfo sendCheck_appBaseInfo = appBaseInfo;
-//        sendCheck_appBaseInfo.setAdmin(customMapper.queryRealnameByUserId(appBaseInfo.getAdmin()));
-//        if (appBaseInfo.getDevelopUser()!=null)
-            sendCheck_appBaseInfo.setDevelopUser(customMapper.queryRealnameByUserId(appBaseInfo.getDevelopUser()));
+        sendCheck_appBaseInfo.setAdmin(customMapper.queryUsernameByUserId(appBaseInfo.getAdmin()));
+        if (appBaseInfo.getDevelopUser()!=null)
+            sendCheck_appBaseInfo.setDevelopUser(customMapper.queryUsernameByUserId(appBaseInfo.getDevelopUser()));
         if (appBaseInfo.getOperationUser()!=null)
-            sendCheck_appBaseInfo.setOperationUser(customMapper.queryRealnameByUserId(appBaseInfo.getOperationUser()));
+            sendCheck_appBaseInfo.setOperationUser(customMapper.queryUsernameByUserId(appBaseInfo.getOperationUser()));
         if (appBaseInfo.getRequirementUser()!=null)
-            sendCheck_appBaseInfo.setRequirementUser(customMapper.queryRealnameByUserId(appBaseInfo.getRequirementUser()));
+            sendCheck_appBaseInfo.setRequirementUser(customMapper.queryUsernameByUserId(appBaseInfo.getRequirementUser()));
         if (appBaseInfo.getBusinessUser()!=null)
-            sendCheck_appBaseInfo.setBusinessUser(customMapper.queryRealnameByUserId(appBaseInfo.getBusinessUser()));
-        sendCheck_appBaseInfo.setType(sysDictService.queryDictTextByKey("app_type", appBaseInfo.getType()));
-        sendCheck_appBaseInfo.setStatus(sysDictService.queryDictTextByKey("app_status", appBaseInfo.getStatus()));
+            sendCheck_appBaseInfo.setBusinessUser(customMapper.queryUsernameByUserId(appBaseInfo.getBusinessUser()));
+//        sendCheck_appBaseInfo.setType(sysDictService.queryDictTextByKey("app_type", appBaseInfo.getType()));
+//        sendCheck_appBaseInfo.setStatus(sysDictService.queryDictTextByKey("app_status", appBaseInfo.getStatus()));
         AppDocInfo appDocInfo = appInfo.getAppDocInfoDTO();
         boolean hasEnvInfo = false;
         if (appInfo.getAppEnvInfoDTO()!=null) hasEnvInfo = appInfo.getAppEnvInfoDTO().size()>0;
@@ -667,9 +660,6 @@ public class AppmanageServiceImpl implements AppmanageService {
         appManageUtil.CompareOldAppBaseInfoAndNewAppBaseInfo(appBaseInfo, formData);
         // 以通过审批的应用信息为准更新应用信息
         int i = baseInfoMapper.updateBaseInfo(appBaseInfo);
-//        QueryWrapper<AppBaseInfo> appBaseInfoQueryWrapper = new QueryWrapper<>();
-//        appBaseInfoQueryWrapper.eq("id", appid);
-//        int i = baseInfoMapper.update(appBaseInfo, appBaseInfoQueryWrapper);
         // 查询该应用信息
 
         String toUser = baseInfoMapper.queryUsernameById(appBaseInfo.getCreateBy());

+ 12 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/util/AppManageUtil.java

@@ -11,6 +11,7 @@ import org.jeecg.modules.system.entity.AppmanageEntity.APP_Register_workFlow_For
 import org.jeecg.modules.system.entity.AppmanageEntity.AppBaseInfo;
 import org.jeecg.modules.system.entity.AppmanageEntity.AppDocInfo;
 import org.jeecg.modules.system.entity.AppmanageEntity.AppEnvInfo;
+import org.jeecg.modules.system.mapper.SysUserMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -31,6 +32,9 @@ public class AppManageUtil {
     @Autowired
     private WorkFlowClient workFlowClient;
 
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
     public APP_Register_workFlow_FormEntity TransitionEnvInfoToAppRegisterWorkFlowForm(APP_Register_workFlow_FormEntity appRegisterWorkFlowForm, List<AppEnvInfo> appEnvInfoList){
         for (AppEnvInfo appEnvInfo : appEnvInfoList){
             if (appEnvInfo.getEnv().equals("prod")){
@@ -176,6 +180,14 @@ public class AppManageUtil {
             String fieldValue = formDataMap.get(fieldName);
             if (fieldValue != null) {
                 try {
+                    if (fieldName.equals("admin")
+                            ||fieldName.equals("developUser")
+                            ||fieldName.equals("operationUser")
+                            ||fieldName.equals("requirementUser")
+                            || fieldName.equals("businessUser")){
+                        String username = fieldValue;
+                        fieldValue = sysUserMapper.getUserIdByName(username);
+                    }
                     field.set(appBaseInfo, fieldValue);
                 } catch (IllegalAccessException e) {
                     e.printStackTrace();