Commit 57792d92 by liuyang

2024-09-24

1.文档库:复制功能需支持按项目和文件夹复制附件
parent afc54580
......@@ -25,6 +25,7 @@ import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -368,9 +369,15 @@ public class ServiceHGWD001 extends ServiceEPBase {
try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo, "inqu_status1");
queryRow.put(HGWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
queryRow.put(User.FIELD_USER_ID, userId);
}
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.addRow(queryRow);
inInfo.setBlock(block);
return super.query(inInfo, HGWD001.QUERY, new HGWD001(), false, new HGWD001().eiMetadata, "inqu_status1","result1","result1",null);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
......@@ -418,6 +425,116 @@ public class ServiceHGWD001 extends ServiceEPBase {
return inInfo;
}
/**
* 复制项目列表
* @param inInfo
* @return
*/
public EiInfo query2(EiInfo inInfo) {
try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo, "inqu_status2");
queryRow.put(HGWD001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
queryRow.put(User.FIELD_USER_ID, userId);
}
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.addRow(queryRow);
inInfo.setBlock(block);
return super.query(inInfo, HGWD001.QUERY, new HGWD001(), false, new HGWD001().eiMetadata, "inqu_status2","result2","result2",null);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "文档库",operType = "复制项目",operDesc = "文档库-复制项目-复制项目操作")
public EiInfo save2(EiInfo inInfo) {
try {
Map<String,String> queryMap= EiInfoUtils.getFirstRow(inInfo,EiConstant.queryBlock);
List<HGWD001> result1Rows = MapUtils.toDaoEPBases(inInfo.getBlock("result2").getRows(), HGWD001.class);
// 要复制项目
List<HGWD001> hgwd001List = HGWDTools.HgWd001.queryByProjCode(queryMap.get(HGWD001.FIELD_PROJ_CODE),queryMap.get(HGWD001.FIELD_PARENT_ID));
List<String> fileIds = hgwd001List.stream().map(HGWD001::getFileId).collect(Collectors.toList());
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", fileIds);
StringBuilder strFileName = new StringBuilder();
// 写入数据
for (HGWD001 hgwd001:hgwd001List) {
String fileId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.WD_FILE_ID);
hgwd001.setParentId(result1Rows.get(0).getProjCode());
strFileName.append(hgwd001.getFileName()).append("上传附件:附件名称");
List<HGWD099> hgwd099s = hgwd099List.stream().filter(hgdm099 -> hgdm099.getBizId().equals(hgwd001.getFileId())).collect(Collectors.toList());
for (HGWD099 hgwd099 : hgwd099s) {
cleanBaseInfo(hgwd099);
hgwd099.setDeleteFlag(CommonConstant.YesNo.NO_0);
hgwd099.setBizId(fileId);
hgwd099.setStatus(HgWdConstant.FileStatus.S_0);
DaoUtils.insert(HGWD099.INSERT, hgwd099);
strFileName.append(hgwd099.getDocName()).append(",");
HGWD001A hgwd001a =initHgwd001a(hgwd001, hgwd099,ChangeTypeEnum.UPLOAD_ADD.getCode());
hgwd001a.setChangeEndCode(hgwd099.getDocId());
hgwd001a.setChangeEnd(hgwd099.getDocName());
HGWDTools.HgWd001.addHGWD001A(hgwd001a);
}
hgwd001.setFileId(fileId);
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
cleanBaseInfo(hgwd001);
DaoUtils.insert(HGWD001.INSERT, hgwd001);
}
HGWDTools.interaction(result1Rows.get(0), strFileName.substring(0, strFileName.length() - 1));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgwd001List.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "文档库",operType = "复制文件",operDesc = "文档库-复制文件-复制文件操作")
public EiInfo save3(EiInfo inInfo) {
try {
Map<String,String> queryMap= EiInfoUtils.getFirstRow(inInfo,EiConstant.queryBlock);
List<HGWD001> result1Rows = MapUtils.toDaoEPBases(inInfo.getBlock("result2").getRows(), HGWD001.class);
// 要复制项目
List<HGWD001> hgwd001List = HGWDTools.HgWd001.queryByProjCode(queryMap.get(HGWD001.FIELD_PROJ_CODE),queryMap.get(HGWD001.FIELD_PARENT_ID));
List<String> fileIds = hgwd001List.stream().map(HGWD001::getFileId).collect(Collectors.toList());
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", fileIds);
StringBuilder strFileName = new StringBuilder();
// 写入数据
for (HGWD001 hgwd001:hgwd001List) {
hgwd001.setParentId(result1Rows.get(0).getProjCode());
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
hgwd001.setDocVersion(0);
strFileName.append(hgwd001.getFileName()).append("上传附件:附件名称");
List<HGWD099> hgwd099s = hgwd099List.stream().filter(hgdm099 -> hgdm099.getBizId().equals(hgwd001.getFileId())).collect(Collectors.toList());
for (HGWD099 hgwd099 : hgwd099s) {
cleanBaseInfo(hgwd099);
hgwd099.setDeleteFlag(CommonConstant.YesNo.NO_0);
hgwd099.setBizId(hgwd001.getFileId());
hgwd099.setStatus(HgWdConstant.FileStatus.S_0);
DaoUtils.insert(HGWD099.INSERT, hgwd099);
strFileName.append(hgwd099.getDocName()).append(",");
HGWD001A hgwd001a =initHgwd001a(hgwd001, hgwd099,ChangeTypeEnum.UPLOAD_ADD.getCode());
hgwd001a.setChangeEndCode(hgwd099.getDocId());
hgwd001a.setChangeEnd(hgwd099.getDocName());
HGWDTools.HgWd001.addHGWD001A(hgwd001a);
}
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
DaoUtils.insert(HGWD001.INSERT, hgwd001);
}
HGWDTools.interaction(result1Rows.get(0), strFileName.substring(0, strFileName.length() - 1));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgwd001List.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public EiInfo queryProjectManager(EiInfo inInfo) {
try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo);
......@@ -439,4 +556,15 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd099.setDepCode(null);
hgwd099.setId(null);
}
private static void cleanBaseInfo(HGWD001 hgwd001){
hgwd001.setCreatedBy(null);
hgwd001.setCreatedName(null);
hgwd001.setCreatedTime(null);
hgwd001.setUpdatedBy(null);
hgwd001.setUpdatedName(null);
hgwd001.setUpdatedTime(null);
hgwd001.setDepCode(null);
hgwd001.setId(null);
}
}
......@@ -110,7 +110,13 @@
<isNotEmpty prepend=" AND " property="managerUserId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID
AND M.USER_ID = #managerUserId#
AND M.IS_PROJECT_MANAGER = 1)
AND M.IS_PROJECT_MANAGER = 1
)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID
AND M.USER_ID = #userId#
)
</isNotEmpty>
</sql>
......
......@@ -82,6 +82,9 @@
<isNotEmpty prepend=" AND " property="createdDateTo">
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizIds">
BIZ_ID in <iterate close=")" open="(" conjunction="," property="bizIds">#bizIds[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy">
......
......@@ -14,6 +14,7 @@ import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.domain.HGWD009;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
......@@ -148,6 +149,24 @@ public class HGWDTools {
List results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
AssertUtils.isTrue(!CollectionUtils.isEmpty(results), "项目已存在,不能重复添加!");
}
public static List<HGWD001> queryByProjCode(String projCode) {
return queryByProjCode(projCode,projCode);
}
public static List<HGWD001> queryByProjCode(String projCode, String parentId) {
Map queryMap = new HashMap<>();
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put(User.FIELD_USER_ID, userId);
}
queryMap.put(HGWD001.FIELD_PROJ_CODE, projCode);
queryMap.put(HGWD001.FIELD_FILE_ID, parentId);
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
}
......@@ -346,7 +365,19 @@ public class HGWDTools {
);
return results;
}
public static List<HGWD099> queryByBiz(String bizType, List<String> bizIds) {
AssertUtils.isNull(bizType, "业务类型不能为空!");
AssertUtils.isNull(bizIds, "业务ID不能为空!");
List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY,
new HashMap<String, Object>() {{
put("bizType", bizType);
put("bizIds", bizIds);
}}
);
return results;
}
}
/**
......
......@@ -18,6 +18,9 @@ $(function () {
$("#QUERY1").on("click", function (e) {
result1Grid.dataSource.page(1);
});
$("#QUERY2").on("click", function (e) {
result2Grid.dataSource.page(1);
});
// 分割线组件
(function () {
splitter = $("#splitter").kendoSplitter({
......@@ -107,6 +110,7 @@ $(function () {
$("[name = 'inqu_status-0-companyCode']").val(_data.companyCode);
$("[name = 'inqu_status-0-type']").val(typeValue);
$("[name = 'inqu_status-0-fileName']").val(_data.text);
$("[name = 'inqu_status-0-leafType']").val(_data.leafType);
resultGrid.dataSource.page(1);
// 编辑、删除树节点时,需要刷新的树节点
$("[name = 'inqu_status-0-orgParentId']").val(_data.parentId);
......@@ -475,6 +479,8 @@ $(function () {
$("#CHANGE_RECORD").on("click", changeResord);
// 复制附件
$("#COPY_FILE").on("click", copyFile);
// 复制文件
$("#COPY_PROT_FILE").on("click", copyProtFile);
// 预览
$("#PREVIEW").on("click", preview);
},
......@@ -503,7 +509,14 @@ $(function () {
}
],
},
result1:{
"result1":{
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
}
},
"result2":{
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 10,
......@@ -517,6 +530,7 @@ $(function () {
// 查询
$("#BTN_DELETE").on("click", deleteFunc);
$("#SAVE1").on("click", saveFunc);
$("#SAVE2").on("click", saveProtFunc);
//确认发布
$("#confirmRelease").on("click", updateRelease);
});
......@@ -669,6 +683,7 @@ let setTreeNodeValue = function (nodeData) {
IPLATUI.EFTree.categoryTree.selectTreeNode.companyCode = nodeData.companyCode;
IPLATUI.EFTree.categoryTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel = nodeData.leafLevel;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafType = nodeData.leafType;
}
/**
......@@ -816,11 +831,13 @@ let showAuthButton = function () {
$("#UPLOAD_FILE").attr("disabled", false);
$("#CHANGE_RECORD").attr("disabled", true);
$("#COPY_FILE").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
} else {
$("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", true);
$("#CHANGE_RECORD").attr("disabled", false);
$("#COPY_FILE").attr("disabled", true);
$("#COPY_PROT_FILE").attr("disabled", true);
}
isProjectManager(parentId);
/*let inEiInfo = new EiInfo();
......@@ -881,7 +898,7 @@ let copyFile = function () {
}
/**
* 复制
* 复制
*/
function saveFunc() {
var rows = result1Grid.getCheckedRows();
......@@ -918,6 +935,57 @@ function saveFunc() {
}
/**
* 复制项目
*/
let copyProtFile = function () {
let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.parentId;
if (isBlank(parentId)){
message("请选择文档目录树节点!")
return;
}
let selectOrgWindow = $("#selectProjWindow");
selectOrgWindow.data("kendoWindow").center();
selectOrgWindow.data("kendoWindow").open();
result2Grid.dataSource.page(1);
}
/**
* 复制项目
*/
function saveProtFunc() {
var rows = result2Grid.getCheckedRows();
if (rows.length == 0) {
message("请勾选数据文件!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据\"确认\"操作?", {
ok: function () {
JSUtils.submitGridsData("result2", "HGWD001", "save2", true,
function (ei) {
if (ei.getStatus() >= 0) {
try {
$("#selectProjWindow").data("kendoWindow").close()
$("#inqu_status2-0-companyCode").val('');
$("#inqu_status2-0-projName").val('');
refreshTree();
query();
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
});
}
})
}
/**
* 预览
*/
let preview = function () {
......@@ -939,24 +1007,28 @@ let isProjectManager = function (parentId) {
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
break;
case 2:
$("#RELEASE").attr("disabled", false);
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
break;
case 3:
$("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
break
default:
$("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", true);
$("#COPY_FILE").attr("disabled", true);
$("#PREVIEW").attr("disabled", true);
$("#COPY_PROT_FILE").attr("disabled", true);
}
}
}
......
......@@ -57,6 +57,7 @@
<EF:EFInput cname="文档库id" ename="fileId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="类型" ename="type" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="层级" ename="leafLevel" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="是否是文件" ename="leafType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库名称" ename="fileName" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="父级Id" ename="orgParentId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="登录用户" ename="userId" blockId="inqu_status" row="0" colWidth="3" value="${loginName}" type="hidden"/>
......@@ -103,7 +104,7 @@
</div>
</EF:EFWindow>
<%--复制选中文件--%>
<EF:EFWindow id="selectOrgWindow" width="70%" height="70%" title="选择文档">
<EF:EFRegion id="inqu1" title="查询条件">
<div class="row">
......@@ -151,6 +152,42 @@
</EF:EFRegion>
</EF:EFWindow>
<%--复制项目下的所以文件--%>
<EF:EFWindow id="selectProjWindow" width="70%" height="70%" title="选择文档">
<EF:EFRegion id="inqu2" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status2" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status2" row="0" ename="projName" cname="项目名称" colWidth="3" placeholder="模糊查询项目名称"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result2" title="明细信息" >
<EF:EFGrid blockId="result2" autoDraw="override" isFloat="true" checkMode="single" queryMethod="query2">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="parentId" cname="上级ID" hidden="true"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="160" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" width="160" enable="true" readonly="true" align="center"
required="true" hidden="true"/>
<EF:EFComboColumn ename="projCode" cname="项目名称" blockName="proj_record_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="200" required="true"
align="center" filter="contains" sort="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="true" align="center"
required="true" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFWindow>
<EF:EFWindow id="releaseWindow" title="发布变更" width="50%" height="30%">
<EF:EFRegion id="inqu2" title="">
<EF:EFInput blockId="inqu_status" row="0" ename="changeContent" cname="变更内容" type="textarea" colWidth="12" ratio="2:10" required="true"/>
......
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