Commit 10bc84d0 by 宋祥

1.文档权限可以复制,增加项目经理设置

parent 03292e86
......@@ -19,7 +19,19 @@ public class HgWdSqlConstant {
// 搜索树节点
public static final String SEARCH_TREE_NODE = "HGWD001.searchTreeNode";
}
/**
* @author:songx
* @date:2024/9/3,10:57
*/
public static class HgWd003 {
// 模块
public static final String MODULE = "HGWD003.";
// 修改信息
public static final String UPDATE_INFO = MODULE + "updateInfo";
}
/**
* HGCW999 SQL定义
*
......@@ -27,7 +39,7 @@ public class HgWdSqlConstant {
* @date:2024/2/22,13:57
*/
public static class HgWd099 {
// 预览自增
public static final String PREVIEW_INCR = "HGWD099.previewIncr";
// 下载自增
......
......@@ -36,6 +36,7 @@ public class HGWD003 extends DaoEPBase {
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
public static final String FIELD_USER_NAME = "userName"; /* 用户姓名*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_IS_PROJECT_MANAGER = "isProjectManager"; /* 是否项目经理,0=否,1=是*/
public static final String FIELD_ORG_ID = "orgId"; /* 部门编码*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 部门名称*/
......@@ -53,6 +54,7 @@ public class HGWD003 extends DaoEPBase {
public static final String COL_USER_ID = "USER_ID"; /* 用户ID*/
public static final String COL_USER_NAME = "USER_NAME"; /* 用户姓名*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_IS_PROJECT_MANAGER = "IS_PROJECT_MANAGER"; /* 是否项目经理,0=否,1=是*/
public static final String COL_ORG_ID = "ORG_ID"; /* 部门编码*/
public static final String COL_ORG_CNAME = "ORG_CNAME"; /* 部门名称*/
......@@ -76,6 +78,7 @@ public class HGWD003 extends DaoEPBase {
private String userId = " "; /* 用户ID*/
private String userName = " "; /* 用户姓名*/
private String remark = " "; /* 备注*/
private Integer isProjectManager = 0; /* 是否项目经理,0=否,1=是*/
private String orgId = " "; /* 部门编码*/
private String orgCname = " "; /* 部门名称*/
......@@ -142,6 +145,10 @@ public class HGWD003 extends DaoEPBase {
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_IS_PROJECT_MANAGER);
eiColumn.setDescName("是否项目经理");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
......@@ -377,6 +384,14 @@ public class HGWD003 extends DaoEPBase {
this.remark = remark;
}
public Integer getIsProjectManager() {
return isProjectManager;
}
public void setIsProjectManager(Integer isProjectManager) {
this.isProjectManager = isProjectManager;
}
public String getOrgId() {
return orgId;
}
......@@ -415,6 +430,7 @@ public class HGWD003 extends DaoEPBase {
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_ID)), userId));
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_NAME)), userName));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setIsProjectManager(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_PROJECT_MANAGER)), isProjectManager));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
}
......@@ -440,6 +456,7 @@ public class HGWD003 extends DaoEPBase {
map.put(FIELD_USER_ID, StringUtils.toString(userId, eiMetadata.getMeta(FIELD_USER_ID)));
map.put(FIELD_USER_NAME, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_USER_NAME)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_IS_PROJECT_MANAGER, StringUtils.toString(isProjectManager, eiMetadata.getMeta(FIELD_IS_PROJECT_MANAGER)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
......
......@@ -222,6 +222,32 @@ public class ServiceHGWD003 extends ServiceEPBase {
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录");
List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class);
for (HGWD003 fWd003 : fWd003s) {
DaoUtils.update(HgWdSqlConstant.HgWd003.UPDATE_INFO, fWd003);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 设置叶子节点是否可以展开
*
* @param nodes
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD003B extends ServiceEPBase {
private EiBlockMeta eiMetadata = null;
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD001().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGWD001.QUERY, new HGWD001());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 复制用户
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo copyUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID信息
String mainFileId = MapUtils.getString(queryMap, "mainFileId");
HGWD001 dbWd001 = HGWDTools.HgWd001.get(mainFileId);
AssertUtils.isNull(dbWd001, String.format("【%s】文档目录不存在", mainFileId));
// 获取FILE_ID授权信息
List<HGWD003> dbMainWd003s = HGWDTools.HgWd003.listByFile(mainFileId);
AssertUtils.isEmpty(dbMainWd003s, String.format("文档目录【%s】还未进行授权,请授权后再进行复制", dbWd001.getFileName()));
// 复制授权信息
List<HGWD001> fWd001s = MapUtils.toDaoEPBases(inInfo, HGWD001.class);
this.copyAuthUser(fWd001s, dbMainWd003s);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("复制授权用户成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "复制授权用户失败");
}
return inInfo;
}
/**
* 复制授权用户
*
* @param fWd001s
* @param dbMainWd003s
*/
private void copyAuthUser(List<HGWD001> fWd001s, List<HGWD003> dbMainWd003s) {
// 已授权信息
Map<String, List<HGWD003>> dbWd003Map = HGWDTools.HgWd003.map(
ObjectUtils.listEpKey(fWd001s, HGWD001.FIELD_FILE_ID));
for (HGWD001 fWd001 : fWd001s) {
String fileId = fWd001.getFileId();
// 已存在的授权用户信息
List<HGWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(fileId);
List<String> userIds = CollectionUtils.isEmpty(dbWd003s) ? new ArrayList<>()
: dbWd003Map.get(fileId).stream().map(HGWD003::getUserId).collect(Collectors.toList());
// 过滤出未授权的用户,并重新赋值FILE_ID
List<HGWD003> filterWd003s = dbMainWd003s.stream()
.filter(dbMainWd003 -> !userIds.contains(dbMainWd003.getUserId()))
.map(dbMainWd003 -> {
dbMainWd003.setFileId(fWd001.getFileId());
return dbMainWd003;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(filterWd003s)) {
DaoUtils.insertBatch(HGWD003.INSERT, filterWd003s);
}
}
}
}
......@@ -111,7 +111,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
PROJ_CODE DESC, ID DESC
</isEmpty>
</dynamic>
</sql>
......
......@@ -15,7 +15,8 @@
A.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
A.FILE_ID as "fileId", <!-- 文件ID -->
A.USER_ID as "userId", <!-- 用户ID -->
A.REMARK as "remark" <!-- 备注 -->
A.REMARK as "remark", <!-- 备注 -->
A.IS_PROJECT_MANAGER as "isProjectManager" <!-- 是否项目经理,0=否,1=是 -->
</sql>
<sql id="columnB">
......@@ -41,6 +42,9 @@
<isNotEmpty prepend=" AND " property="userId">
A.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileIds">
A.FILE_ID IN <iterate close=")" open="(" conjunction="," property="fileIds">#fileIds[]#</iterate>
</isNotEmpty>
</sql>
<sql id="conditionB">
......@@ -115,4 +119,13 @@
UPDATE ${hggpSchema}.HGWD003 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<!-- 修改信息 -->
<update id="updateInfo">
UPDATE ${hggpSchema}.HGWD003
SET
IS_PROJECT_MANAGER = #isProjectManager#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
......@@ -11,6 +11,7 @@ import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
......@@ -40,12 +41,11 @@ public class HGWDTools {
* @return
*/
public static HGWD001 get(String fileId) {
//AssertUtils.isEmpty(fileId, "文件ID不能为空");
AssertUtils.isEmpty(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
if (fileId != null) {
queryMap.put(HGWD001.FIELD_FILE_ID, fileId);
}
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
......@@ -63,6 +63,29 @@ public class HGWDTools {
}
/**
* @param fileIds
* @return
*/
public static List<HGWD001> list(List<String> fileIds) {
AssertUtils.isEmpty(fileIds, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put("fileIds", fileIds);
return DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
}
/**
* @param fileIds
* @return
*/
public static Map<String, HGWD001> map(List<String> fileIds) {
List<HGWD001> dbWd001s = list(fileIds);
if (CollectionUtils.isEmpty(dbWd001s)) {
return null;
}
return dbWd001s.stream().collect(Collectors.toMap(HGWD001::getFileId, item -> item));
}
/**
* 根据父节点统计
*
* @param parentIds
......@@ -135,10 +158,53 @@ public class HGWDTools {
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
/**
* HGWD003 定义
*
* @author:songx
* @date:2024/9/3,10:14
*/
public static class HgWd003 {
/**
* @param fileId
* @return
*/
public static List<HGWD003> listByFile(String fileId) {
AssertUtils.isEmpty(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD003.FIELD_FILE_ID, fileId);
return DaoBase.getInstance().query(HGWD003.QUERY, queryMap);
}
/**
* @param fileIds
* @return
*/
public static List<HGWD003> list(List<String> fileIds) {
AssertUtils.isEmpty(fileIds, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put("fileIds", fileIds);
return DaoBase.getInstance().query(HGWD003.QUERY, queryMap);
}
/**
* @param fileIds
* @return
*/
public static Map<String, List<HGWD003>> map(List<String> fileIds) {
List<HGWD003> dbWd001s = list(fileIds);
if (CollectionUtils.isEmpty(dbWd001s)) {
return null;
}
return dbWd001s.stream().collect(Collectors.groupingBy(HGWD003::getFileId));
}
}
public static class HgWd099 {
public static List<HGWD099> getByDocId(String bizType, String docId) {
AssertUtils.isEmpty(docId, "文件ID不能为空");
Map<String, Object> paramMap = new HashMap();
......@@ -146,7 +212,7 @@ public class HGWDTools {
paramMap.put(HGWD099.FIELD_DOC_ID, docId);
return DaoBase.getInstance().query(HGWD099.QUERY, paramMap);
}
/**
* 预览记录自增
*
......
......@@ -33,7 +33,8 @@ $(function () {
break;
}
return '<span class="' + icon + '" style="padding-right: 8px"> </span>'
+ '<span class="titleClass" title="' + item.label + '">' + item.text + '</span>'
+ '<span class="titleClass" title="' + item.label + '">'
+ item.text + '</span>'
},
selectNode: {
treeId: '',
......@@ -58,12 +59,17 @@ $(function () {
// 查询
$("#QUERY").on("click", query);
// 保存
$("#SAVE").on("click", save);
// 授权
$("#AUTH").on("click", auth);
// 删除
// 删除用户
$("#REMOVE_USER").on("click", removeUser);
// 复制用户
$("#COPY_USER").on("click", copyUser);
});
/**
......@@ -132,14 +138,34 @@ function expandTreeNode(tree, nodes) {
}
/**
* 保存
*/
let save = function () {
if (!checkSelectMain()) {
return;
}
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD003", "save", true, function (res) {
message(res.msg);
});
}
});
}
/**
* 授权
*/
let auth = function () {
let fileId = $("#inqu_status-0-fileId").val();
if (isBlank(fileId)) {
message("请选择需要授权的目录");
if (!checkSelectMain()) {
return;
}
let fileId = $("#inqu_status-0-fileId").val();
let fileName = $("#inqu_status-0-fileName").val();
let params = {
"inqu_status-0-fileId": fileId
......@@ -166,12 +192,15 @@ let authCallback = function (res) {
* 删除授权用户
*/
let removeUser = function () {
if (!checkSelectMain()) {
return;
}
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"取消授权用户\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD003", "removeUser",
false, function (res) {
......@@ -186,6 +215,34 @@ let removeUser = function () {
}
/**
* 复制授权用户
*/
let copyUser = function () {
if (!checkSelectMain()) {
return;
}
let fileId = $("#inqu_status-0-fileId").val();
let fileName = $("#inqu_status-0-fileName").val();
let params = {
"inqu_status-0-mainFileId": fileId
}
JSColorbox.open({
href: "HGWD003B",
title: "<div style='text-align: center;'>正在复制:【" + fileName + "】的授权用户...</div>",
width: "70%",
height: "80%",
params: params,
callbackName: copyUserCallback
});
}
/**
* 授权回调
*/
let copyUserCallback = function (res) {
}
/**
* 显示授权按钮
*/
let showAuthButton = function () {
......@@ -194,8 +251,24 @@ let showAuthButton = function () {
if (leafType && leafType === 'C') {
$("#AUTH").attr("disabled", false);
$("#REMOVE_USER").attr("disabled", false);
$("#COPY_USER").attr("disabled", false);
$("#SAVE").attr("disabled", false);
} else {
$("#AUTH").attr("disabled", true);
$("#REMOVE_USER").attr("disabled", true);
$("#COPY_USER").attr("disabled", true);
$("#SAVE").attr("disabled", true);
}
}
/**
* 校验是否选择的目录
*/
let checkSelectMain = function () {
let fileId = $("#inqu_status-0-fileId").val();
if (isBlank(fileId)) {
message("请选择需要目录");
return false;
}
return true;
}
......@@ -41,6 +41,10 @@
<EF:EFColumn ename="orgCname" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="用户账号" enable="false" width="100" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="isProjectManager" cname="是否项目经理" width="100" align="center"
required="true" copy="true">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
......
......@@ -3,6 +3,10 @@ $(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 100, 150],
},
loadComplete: function (grid) {
}
}
......
......@@ -15,8 +15,8 @@
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh">
<EF:EFColumn ename="userId" cname="用户ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="depName" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="loginName" cname="用户账号" enable="false" width="120" align="center"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 100, 150],
},
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 复制用户
$("#COPY_USER").on("click", copyUser);
});
/**
* 页面加载
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 复制用户
*/
let copyUser = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"复制\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD003B", "copyUser",
false, function (res) {
message(res.msg);
if (res.status !== -1) {
parent.JSColorbox.setValueCallback(res);
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="复制授权用户">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="mainFileId" cname="文件ID" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput ename="projName" cname="项目名称" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput ename="fileName" cname="目录名称" blockId="inqu_status" row="0" colWidth="4"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh">
<EF:EFColumn ename="fileId" cname="目录ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="projCode" cname="项目编号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="left"/>
<EF:EFColumn ename="fileName" cname="目录名称" enable="false" width="120" align="left"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment