修改对外报告管理

This commit is contained in:
gaosong
2022-07-29 11:22:45 +08:00
parent bee93d3caa
commit c4dc1c8f9f
5 changed files with 68 additions and 29 deletions
@@ -512,3 +512,40 @@ INSERT INTO `sys_role` VALUES ('1552536424587862017', '对外报告管理员', '
-- 菜单管理 添加对外报告文件夹管理按钮权限 2022-07-28 已同步生产环境
INSERT INTO `sys_permission` VALUES ('1552182885208608770', '1549937961282908162', '对外报告文件夹管理', '', NULL, NULL, NULL, 2, 'externalReports:folder', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', '2022-7-27 14:43:33', NULL, NULL, 0, 0, '1', 0, 'External Report Folder Management ');
-- 对外报告文件夹表 2022-7-29 已同步生产环境
DROP TABLE IF EXISTS `ext_repo_folder`;
CREATE TABLE `ext_repo_folder` (
`id` varchar(36) NOT NULL,
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
`update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新日期',
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '所属部门',
`folder_name` varchar(255) DEFAULT NULL COMMENT '文件夹名称',
`order_id` int(11) DEFAULT NULL COMMENT '文件夹排序',
`sup_folder` varchar(36) DEFAULT NULL COMMENT '所属文件夹',
`auth_view_ids_name` varchar(2000) DEFAULT NULL COMMENT '查看权限人员',
`auth_manage_ids_name` varchar(2000) DEFAULT NULL COMMENT '管理权限人员',
`auth_view_ids` varchar(2000) DEFAULT NULL COMMENT '查看权限人员id',
`auth_manage_ids` varchar(2000) DEFAULT NULL COMMENT '管理权限人员id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `ext_repo_folder` VALUES ('1552846304994131970', 'admin', '2022-07-01 11:11:11', 'admin', '2022-11-11 11:11:11', 'A01', '文件夹', '1', 'root', '', '', '', '');
-- 对外报告数据表 2022-7-29 已同步生产环境
DROP TABLE IF EXISTS `ext_repo_data`;
CREATE TABLE `ext_repo_data` (
`id` varchar(36) NOT NULL,
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
`update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新日期',
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '所属部门',
`file_key` varchar(255) DEFAULT NULL COMMENT '文件标识',
`file_name` varchar(255) DEFAULT NULL COMMENT '文件名称',
`file_description` varchar(255) DEFAULT NULL COMMENT '文件说明',
`sup_folder` varchar(36) DEFAULT NULL COMMENT '所属文件夹',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@@ -46,12 +46,12 @@ public class ERFTreeData implements Comparable<ERFTreeData> {
/**
* 查看权限人员
*/
private String authView = "";
private String authViewIdsName = "";
/**
* 管理权限人员
*/
private String authManage = "";
private String authManageIdsName = "";
/**
* 查看权限人员id
@@ -135,20 +135,20 @@ public class ERFTreeData implements Comparable<ERFTreeData> {
this.folderName = folderName;
}
public String getAuthView() {
return authView;
public String getAuthViewIdsName() {
return authViewIdsName;
}
public void setAuthView(String authView) {
this.authView = authView;
public void setAuthViewIdsName(String authViewIdsName) {
this.authViewIdsName = authViewIdsName;
}
public String getAuthManage() {
return authManage;
public String getAuthManageIdsName() {
return authManageIdsName;
}
public void setAuthManage(String authManage) {
this.authManage = authManage;
public void setAuthManageIdsName(String authManageIdsName) {
this.authManageIdsName = authManageIdsName;
}
public String getAuthViewIds() {
@@ -76,12 +76,12 @@ public class ExtRepoFolder implements Serializable {
/**查看权限人员*/
@Excel(name = "查看权限人员", width = 15)
@ApiModelProperty(value = "查看权限人员")
private String authView;
private String authViewIdsName;
/**管理权限人员*/
@Excel(name = "管理权限人员", width = 15)
@ApiModelProperty(value = "管理权限人员")
private String authManage;
private String authManageIdsName;
/**查看权限人员id*/
@Excel(name = "查看权限人员id", width = 15)
@@ -11,9 +11,9 @@
<result column="folder_name" property="folderName" />
<result column="order_id" property="orderId" />
<result column="sup_folder" property="supFolder" />
<result column="auth_view" property="authView" />
<result column="auth_manage" property="authManage" />
<result column="auth_view_ids" property="authViewIds" />
<result column="auth_manage_ids" property="authManageIds" />
<result column="auth_view_ids_name" property="authViewIdsName" />
<result column="auth_manage_ids_name" property="authManageIdsName" />
<result column="auth_view_ids" property="authViewIdsName" />
<result column="auth_manage_ids" property="authManageIdsName" />
</resultMap>
</mapper>
@@ -53,9 +53,11 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
Date now = new Date();
extRepoFolder.setCreateTime(now);
extRepoFolder.setUpdateTime(now);
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
extRepoFolder.setAuthManage(extRepoFolder.getAuthManage() + "," + sysUser.getUsername());
extRepoFolder.setAuthManageIds(extRepoFolder.getAuthManageIds() + "," + sysUser.getId());
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// extRepoFolder.setAuthManageName(extRepoFolder.getAuthManageName() + "," + sysUser.getUsername());
// extRepoFolder.setAuthManageIds(extRepoFolder.getAuthManageIds() + "," + sysUser.getId());
extRepoFolder.setAuthManageIdsName(extRepoFolder.getAuthManageIdsName());
extRepoFolder.setAuthManageIds(extRepoFolder.getAuthManageIds());
save(extRepoFolder);
editOrderId(extRepoFolder);
} else {
@@ -120,16 +122,16 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
*/
private void editAuth(ExtRepoFolder erf_orig, ExtRepoFolder erf_new) throws Exception {
//管理权限
Map<String, String> authManage_orig = getAuthMap(erf_orig.getAuthManage(), erf_orig.getAuthManageIds());
Map<String, String> authManage_new = getAuthMap(erf_new.getAuthManage(), erf_new.getAuthManageIds());
Map<String, String> authManage_orig = getAuthMap(erf_orig.getAuthManageIdsName(), erf_orig.getAuthManageIds());
Map<String, String> authManage_new = getAuthMap(erf_new.getAuthManageIdsName(), erf_new.getAuthManageIds());
//增加管理权限的人
Map<String, String> addManageRole = getDefMap(authManage_new, authManage_orig);
//删除管理权限的人
Map<String, String> delManageRole = getDefMap(authManage_orig, authManage_new);
//查看权限
Map<String, String> authView_orig = getAuthMap(erf_orig.getAuthView(), erf_orig.getAuthViewIds());
Map<String, String> authView_new = getAuthMap(erf_new.getAuthView(), erf_new.getAuthViewIds());
Map<String, String> authView_orig = getAuthMap(erf_orig.getAuthViewIdsName(), erf_orig.getAuthViewIds());
Map<String, String> authView_new = getAuthMap(erf_new.getAuthViewIdsName(), erf_new.getAuthViewIds());
//增加查看权限的人
Map<String, String> addViewRole = getDefMap(authView_new, authView_orig);
//删除查看权限的人
@@ -140,8 +142,8 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
List<ExtRepoFolder> updateFolder = new ArrayList<ExtRepoFolder>();
for (ExtRepoFolder erf : allSubFolder) {
boolean isChange = false;
Map<String, String> authManage_erf = getAuthMap(erf.getAuthManage(), erf.getAuthManageIds());
Map<String, String> authView_erf = getAuthMap(erf.getAuthView(), erf.getAuthViewIds());
Map<String, String> authManage_erf = getAuthMap(erf.getAuthManageIdsName(), erf.getAuthManageIds());
Map<String, String> authView_erf = getAuthMap(erf.getAuthViewIdsName(), erf.getAuthViewIds());
for (String add : addManageRole.keySet()) {
if (!authManage_erf.keySet().contains(add)) {
authManage_erf.put(add, addManageRole.get(add));
@@ -169,9 +171,9 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
isChange = true;
}
}
erf.setAuthManage(StringUtils.join(authManage_erf.keySet(), ","));
erf.setAuthManageIdsName(StringUtils.join(authManage_erf.keySet(), ","));
erf.setAuthManageIds(StringUtils.join(authManage_erf.values(), ","));
erf.setAuthView(StringUtils.join(authView_erf.keySet(), ","));
erf.setAuthViewIdsName(StringUtils.join(authView_erf.keySet(), ","));
erf.setAuthViewIds(StringUtils.join(authView_erf.values(), ","));
if (isChange) {
updateFolder.add(erf);
@@ -291,9 +293,9 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
//检查有没有权限查看
date.setDisplay(haveViewAuth(erf.getSupFolder()));
int childLevel = date.getLevel() + 1;
date.setAuthManage(erf.getAuthManage());
date.setAuthManageIdsName(erf.getAuthManageIdsName());
date.setAuthManageIds(erf.getAuthManageIds());
date.setAuthView(erf.getAuthManage());
date.setAuthViewIdsName(erf.getAuthViewIdsName());
date.setAuthViewIds(erf.getAuthViewIds());
date.setChildren(getSubFolder(erf.getId(), list, childLevel));
date.sortChildren();