Ver código fonte

Merge branch 'zrq' into dev

LT32820A 3 meses atrás
pai
commit
e5e038f64f

+ 1 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/AppmanageController.java

@@ -34,6 +34,7 @@ public class AppmanageController {
     public Result<String> addAppInfo(@RequestBody AppInfo appInfo) throws Exception {
         System.out.println(appInfo.toString());
         String message = appInfoService.addAppInfo(appInfo);
+        if (message.equals("应用名称已存在")) return Result.error(message);
         return Result.OK(message);
     }
 

+ 2 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/AppmanageEntity/AppBaseInfo.java

@@ -17,6 +17,8 @@ import lombok.Data;
 public class AppBaseInfo {
     @TableId
     private String id;
+    @TableField(exist = false)
+    private String key;
     private String name;
     private String type;
     private String status;

+ 4 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/AppmanageEntity/AppDocInfo.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.entity.AppmanageEntity;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -53,6 +54,9 @@ public class AppDocInfo {
      */
     private String other;
 
+    @TableLogic
+    private String del_flag;
+
     // 用于当前用户是否可以编辑该条信息
     @TableField(exist = false)
     private Boolean isEdit;

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

@@ -102,11 +102,16 @@ public class AppmanageServiceImpl implements AppmanageService {
         LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         // 先行添加应用基础信息。获得appid
         AppBaseInfo appBaseInfo = appInfo.getAppBaseInfoDTO();
+        // 查询有无相同的应用名
+        QueryWrapper<AppBaseInfo> appBaseInfoQueryWrapper = new QueryWrapper<>();
+        appBaseInfoQueryWrapper.eq("name", appBaseInfo.getName());
+        if (baseInfoMapper.selectOne(appBaseInfoQueryWrapper) != null) return "应用名称已存在";
+
         appBaseInfo.setCreateBy(loginUser.getId());
         appBaseInfo.setAddType(appInfo.getAddType());
         baseInfoMapper.insert(appBaseInfo);
         // 简易注册模式下添加基础信息即可
-        if (appBaseInfo.getAddType().equals("easy")) return "添加成功";
+        if (appBaseInfo.getAddType().equals("easy")) return "提交成功";
         String appid = appBaseInfo.getId();
 
         // 添加默认角色信息
@@ -119,7 +124,6 @@ public class AppmanageServiceImpl implements AppmanageService {
 
         // 获取角色编码
         String roleid = role.getId();
-
         ArrayList<String> useridlist = new ArrayList<>();
         // 添加应用用户信息
         appInfo.getUserInfo().forEach(userid -> {
@@ -175,12 +179,12 @@ public class AppmanageServiceImpl implements AppmanageService {
         AppDocInfo appDocInfo = appInfo.getAppDocInfoDTO();
         appDocInfo.setAppid(appid);
         docInfoMapper.insert(appDocInfo);
-        return "添加成功";
+        return "提交成功";
     }
 
     /**
      * 删除应用信息
-     * @param ids
+     * @param ids 应用id集合
      * @return
      */
     @Override
@@ -194,14 +198,30 @@ public class AppmanageServiceImpl implements AppmanageService {
             baseInfoPOQueryWrapper.select("admin").in("id", ids[0]);
             AppBaseInfo appBaseInfo = baseInfoMapper.selectOne(baseInfoPOQueryWrapper);
             if (!appBaseInfo.getAdmin().equals(loginUser.getId())) return false;
-        }else {
+        }else {  //  批量删除应用信息时,如果有一个应用不是当前登录用户所创建,则返回false
             for (String id : ids) {
                 AppBaseInfo appBaseInfo = baseInfoMapper.selectById(id);
                 if (!appBaseInfo.getAdmin().equals(loginUser.getId())) return false;
             }
         }
         for (String id : ids) {
+            // 不能删除基础平台的应用信息
+            if (id.equals("0")) return false;
+
+            // 删除所属该应用的基础信息、环境信息、文档信息、用户信息
             baseInfoMapper.deleteById(id);
+            envInfoMapper.delete(new QueryWrapper<AppEnvInfo>().eq("appid", id));
+            docInfoMapper.delete(new QueryWrapper<AppDocInfo>().eq("appid", id));
+            userInfoMapper.delete(new QueryWrapper<AppUserInfo>().eq("appid", id));
+
+            // 删除该应用下所创建的菜单
+//            List<SysPermission> sysPermissions = sysPermissionService(loginUser.getUsername());
+//            String permissionsid = sysPermissions.stream().filter(permission -> permission.getAppId().equals(id)).findFirst().get().getId();
+//            sysPermissionService.deletePermission(permissionsid);
+
+            // 删除该应用下所创建的角色信息
+//            sysRoleService.listRoleIdsByAppId()
+
         }
         return true;
     }
@@ -323,11 +343,13 @@ public class AppmanageServiceImpl implements AppmanageService {
         Map<String, String> appManagerInfo = new HashMap<>();
         baseInfos.forEach(baseInfo -> {
             appManagerInfo.put(baseInfo.getId(), baseInfo.getAdminid());
+
             // 查询字典
             String typeText = sysDictService.queryDictTextByKey("app_type", baseInfo.getType());
             String statusText = sysDictService.queryDictTextByKey("app_status", baseInfo.getStatus());
             baseInfo.setType(typeText);
             baseInfo.setStatus(statusText);
+            baseInfo.setKey(baseInfo.getId());
             appBaseInfoS.add(baseInfo);
         });
         redisUtil.set("appManagerInfo", appManagerInfo, 60*60*24);
@@ -425,27 +447,31 @@ public class AppmanageServiceImpl implements AppmanageService {
                     managerId = appManagerInfo.get(queryParams.getAppid());
                 }
                 editUserInfoEntity.setIsEdit(loginUser.getId().equals(managerId));
-
+                AppBaseInfo appBaseInfo = baseInfoMapper.selectById(queryParams.getAppid());
                 // 查询用户角色信息
                 appUserInfos.forEach(map -> {
                     QueryWrapper<AppUserInfo> appUserInfoQueryWrapper = new QueryWrapper<>();
                     appUserInfoQueryWrapper.select("roles")
                             .eq("userid", map.get("id")).eq("appid", queryParams.getAppid());
                     AppUserInfo roleInfo = userInfoMapper.selectOne(appUserInfoQueryWrapper);
+                    // 查询应用基础信息的相关用户信息
+                    String roleNameInfo = baseInfoToUserInfoRoles(appBaseInfo, (String) map.get("id"));
                     // 使用 Stream API 将字符串转换为 List
                     if (roleInfo!=null){
+                        // 将应用用户表中存的的角色信息字符串转换为List
                         List<String> list = Arrays.stream(roleInfo.getRoles().split(","))
                                 .collect(Collectors.toList());
                         QueryWrapper<SysRole> sysRoleQueryWrapper = new QueryWrapper<>();
                         sysRoleQueryWrapper.select("role_name").in("id", list);
+                        // 查询角色名信息
                         List<SysRole> sysRoles = sysRoleMapper.selectList(sysRoleQueryWrapper);
-                        String roleNameInfo = sysRoles.stream()
-                                .map(SysRole::getRoleName)
-                                .collect(Collectors.joining(","));
-                        map.put("roles", roleNameInfo);
-                    }else {
-                        map.put("roles", "");
+                        if (!sysRoles.isEmpty()&&!roleNameInfo.isEmpty()){
+                            roleNameInfo =roleNameInfo +", "+ sysRoles.stream()
+                                    .map(SysRole::getRoleName)
+                                    .collect(Collectors.joining(", "));
+                        }
                     }
+                    map.put("roles", roleNameInfo);
                 });
             }
         }else { // 作为添加表单时的查询(查询全部用户), 角色分配用户时亦使用
@@ -464,6 +490,8 @@ public class AppmanageServiceImpl implements AppmanageService {
         editUserInfoEntity.setUserinfos(appUserInfos);
         return editUserInfoEntity;
     }
+
+
     /**
      * 根据appid查询应用详情信息
      * @param appid
@@ -593,4 +621,40 @@ public class AppmanageServiceImpl implements AppmanageService {
         int i = userInfoMapper.updateById(appUserInfo);
         return i>0;
     }
+
+    private String baseInfoToUserInfoRoles(AppBaseInfo appBaseInfo, String userid){
+        String roleNameInfo = "";
+        if (appBaseInfo.getAdmin()!=null&&appBaseInfo.getAdmin().equals(userid)){
+            roleNameInfo = "应用管理员";
+        }
+        if (appBaseInfo.getDevelopUser()!=null&&appBaseInfo.getDevelopUser().equals(userid)){
+            if (roleNameInfo.isEmpty()){
+                roleNameInfo = "开发负责人";
+            }else {
+                roleNameInfo = roleNameInfo+", "+"开发负责人";
+            }
+        }
+        if (appBaseInfo.getOperationUser()!=null&&appBaseInfo.getOperationUser().equals(userid)){
+            if (roleNameInfo.isEmpty()){
+                roleNameInfo = "运维负责人";
+            }else {
+                roleNameInfo = roleNameInfo+","+"运维负责人";
+            }
+        }
+        if(appBaseInfo.getBusinessUser()!=null&&appBaseInfo.getBusinessUser().equals(userid)){
+            if (roleNameInfo.isEmpty()){
+                roleNameInfo = "业务对接人";
+            }else {
+                roleNameInfo = roleNameInfo+","+"业务对接人";
+            }
+        }
+        if(appBaseInfo.getRequirementUser()!=null&&appBaseInfo.getRequirementUser().equals(userid)){
+            if (roleNameInfo.isEmpty()){
+                roleNameInfo = "需求对接人";
+            }else {
+                roleNameInfo = roleNameInfo+","+"需求对接人";
+            }
+        }
+        return roleNameInfo;
+    }
 }

+ 1 - 1
jeecgboot-vue3/src/views/appmanage/AppBaseInfo.data.ts

@@ -445,7 +445,7 @@ export const listColumns2 =[
     {
         title: '开发负责人',
         align: 'center',
-        dataIndex: 'devUser',
+        dataIndex: 'developUser',
     },
     {
         title: '应用状态',

+ 26 - 29
jeecgboot-vue3/src/views/appmanage/AppInfoList.vue

@@ -221,13 +221,7 @@
 import { SmileOutlined, DownOutlined, AndroidOutlined,GoldOutlined,PartitionOutlined,SearchOutlined,UndoOutlined} from '@ant-design/icons-vue';
 import { computed, reactive, toRefs, ref,defineComponent} from 'vue';
 import { listColumns2,Appdescschema} from './AppBaseInfo.data';
-import {
-  list,
-  getDictItem,
-  lookBaseInforeq,
-  lookEnvInforeq,
-  lookDocInforeq,
-  deleteOne,
+import {list, getDictItem, lookBaseInforeq, lookEnvInforeq, lookDocInforeq, deleteOne,
   lookAppInfoDetail,
   isInfoUser, isAppAdminOrDevOrOpe, isAppAdmin
 } from './AppBaseInfo.api'
@@ -240,8 +234,6 @@ import { message } from 'ant-design-vue';
 import Description from '@/components/Description/src/Description.vue'
 import { useDescription } from '/@/components/Description';
 import {menuInfoisshow} from "@/views/appmanage/addForm/data";
-import { useUserStore } from '/@/store/modules/user';
-
 const isLoading = ref(true);
 const columns = ref(listColumns2)
 const modalVisible = ref(false);
@@ -271,20 +263,8 @@ const addFormDraftData = ref({
 })  // 添加表单草稿数据,存储添加至一半时关闭表单且已填入的数据
 
 type Key = string | number;
-const state = reactive<{
-  selectedRowKeys: Key[];
-  loading: boolean;
-}>({
-  selectedRowKeys: [], // Check here to configure the default column
-  loading: false,
-});
-const hasSelected = computed(() => state.selectedRowKeys.length > 0);
 
-const onSelectChange = (selectedRowKeys: Key[]) => {
-  console.log('selectedRowKeys changed: ', selectedRowKeys);
-  state.selectedRowKeys = selectedRowKeys;
-  batchDeleteAvailable.value = selectedRowKeys.length > 0
-};
+
 
 interface FormState {
   appname: string;
@@ -564,11 +544,11 @@ export default defineComponent({
     // 应用信息批量删除事件
     async batchDelete(){
       console.log("批量删除")
-      const params = state.selectedRowKeys
-      await deleteOne(params).then(() =>{
-        console.log("删除成功")
-        this.resetAppInfo()
-      })
+      // const params = state.selectedRowKeys
+      // await deleteOne(params).then(() =>{
+      //   console.log("删除成功")
+      //   this.resetAppInfo()
+      // })
     },
 
     // 查询按钮事件
@@ -585,7 +565,7 @@ export default defineComponent({
           let dateB = new Date(b.createTime);
           return dateB - dateA;
         });
-        this.tableData = res
+        this.tableData = res.filter(obj => obj.id !== '0');
       })
       console.log("发送了一次查询")
       console.dir(this.tableData)
@@ -596,11 +576,13 @@ export default defineComponent({
       formState.appname = ''
       formState.apptype = ''
       formState.appstatus = ''
-      this.tableData = await list({
+      await list({
         appname: '', // 根据需要设置查询参数
         apptype: '',
         appstatus: '',
         userid: formState.user
+      }).then(res=>{
+        this.tableData = res.filter(obj => obj.id !== '0');
       })
     },
 
@@ -623,6 +605,21 @@ export default defineComponent({
     const [descriPtionregister] = useDescription({
       schema: Appdescschema,
     });
+    const state = reactive<{
+      selectedRowKeys: Key[];
+      loading: boolean;
+    }>({
+      selectedRowKeys: [], // Check here to configure the default column
+      loading: false,
+    });
+    const hasSelected = computed(() => state.selectedRowKeys.length > 0);
+
+    const onSelectChange = (selectedRowKeys: Key[]) => {
+      console.log('selectedRowKeys changed: ', selectedRowKeys);
+      state.selectedRowKeys = selectedRowKeys;
+      batchDeleteAvailable.value = selectedRowKeys.length > 0
+    };
+
 
     const start = () => {
       state.loading = true;

+ 4 - 3
jeecgboot-vue3/src/views/appmanage/addForm/Step1.vue

@@ -121,10 +121,11 @@ const infoDeptUseroptions = ref<SelectProps['options']>([]);
         appInfoData.appBaseInfoDTO = addFormvalues
         console.log("提交数据")
         console.dir(appInfoData)
-        await saveOrUpdate(appInfoData,false).then(async (res) => {
-          console.log("保存结果:" + res)
+        const res = await saveOrUpdate(appInfoData,false)
+        console.log("保存结果:" + res)
+        if (res !== '应用名称已存在'){
           await this.closeModal('submitted')
-        })
+        }
       },
 
       // 向父组件传值触发关闭对话框事件

+ 3 - 2
jeecgboot-vue3/src/views/appmanage/addForm/Step4.vue

@@ -61,7 +61,8 @@
     <!-- 表单数据区 -->
     <div class="tableDataArea">
      <!-- 应用用户数据列表(反审核前)  -->
-     <a-table :columns="columns" :data-source="data" v-show="uncheckTag&&!tag" :scroll="{y: 500}"/>
+     <a-table :columns="columns" :data-source="data" v-show="uncheckTag&&!tag" :scroll="{y: 500}"
+              :pagination="pagination" @change="handleTableChange"/>
       <div class="table_container" >
         <!-- 左用户数据列表    -->
         <div class="table_left">
@@ -430,7 +431,7 @@ export default defineComponent({
         // 由于分页限制了data的大小,故需自己去查询表单一所添加的用户的信息
         await this.step1Tostep4DataRelationDeal(step1Values)
         // 将左用户信息栏角色列去除
-        columns.value = userTableSchemas.filter(item => item.dataIndex !== 'roles' && item.dataIndex !== 'action');// 应用用户表列配置
+        columns.value = userTableSchemas.filter(item => item.dataIndex !== 'roles');// 应用用户表列配置
         console.dir(value)
         try {
           if (value.value!==undefined) addForm_newlyUserData.value = value

+ 3 - 3
jeecgboot-vue3/src/views/appmanage/addForm/index.vue

@@ -142,11 +142,11 @@
         appInfoData.userInfo = addUserids
         console.log("提交数据")
         console.dir(appInfoData)
-        await saveOrUpdate(appInfoData,false).then((res) =>{
-          console.log("保存结果:"+res)
+        const res = await saveOrUpdate(appInfoData,false)
+        if (res !== '应用名称已存在'){
           closeModal("isAdd")
           current.value = 0
-        })
+        }
       }
 
       function handleRedo() {

+ 2 - 6
jeecgboot-vue3/src/views/appmanage/components/data.tsx

@@ -13,16 +13,12 @@ export const userTableSchemas = [
     {
         title: '部门',
         dataIndex: 'depart',
-        width: 200
+        width: 150
     },
     {
         title: '应用内角色',
         dataIndex: 'roles',
-    },
-    {
-      title: '操作',
-      dataIndex: 'action',
-    },
+    }
 ];
 
 export const newlyuserTableSchemas = [