Commit d395155a by liuyang

2024-09-24

1.文档库:复制功能需支持按项目和文件夹复制附件和子节点
parent ce5e99e2
......@@ -462,23 +462,42 @@ public class ServiceHGWD001 extends ServiceEPBase {
String parentId = result1Rows.get(0).getParentId();
if (!StringUtils.isNull(hgwd001List)){
// 写入数据
for (HGWD001 hgwd001:hgwd001List) {
String fileId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.WD_FILE_ID);
addCopyFile(hgwd001, parentId, fileId);
}
hgwd001List.forEach(hgwd001 -> {
hgwd001.setParentId(parentId);
});
// 查询添加子节点
addNode(hgwd001List);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgwd001List == null ? String.valueOf(0) : hgwd001List.size() + "]条数据保存成功!");
inInfo.setMsg("操作复制文件成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
LogUtils.setDetailMsg(inInfo, e, "复制文件失败");
}
return inInfo;
}
private void addCopyFile(HGWD001 hgwd001,String parentId,String fileId){
public void addNode(List<HGWD001> hgwd001List){
List<String> fileIds = hgwd001List.stream().map(HGWD001::getFileId).collect(Collectors.toList());
List<HGWD001> hgwd001s = HGWDTools.HgWd001.listByParentIds(fileIds);
for (HGWD001 hgwd001:hgwd001List) {
String fileId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.WD_FILE_ID);
if (!StringUtils.isNull(hgwd001s)){
hgwd001s.forEach(o -> {
if (o.getParentId().equals(hgwd001.getFileId())){
o.setParentId(fileId);
}
});
}
addCopyFile(hgwd001, fileId);
}
if (hgwd001s != null && hgwd001s.size() > 0){
addNode(hgwd001s);
}
}
private void addCopyFile(HGWD001 hgwd001, String fileId){
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", hgwd001.getFileId());
StringBuilder strFileName = new StringBuilder();
......@@ -498,7 +517,7 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd001a.setChangeEnd(hgwd099.getDocName());
HGWDTools.HgWd001.addHGWD001A(hgwd001a);
}
hgwd001.setParentId(parentId);
//hgwd001.setParentId(parentId);
hgwd001.setFileId(fileId);
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
cleanBaseInfo(hgwd001);
......
......@@ -181,6 +181,28 @@ public class HGWDTools {
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
/**
* 根据父节点统计
*
* @param parentIds
* @return
*/
public static List<HGWD001> listByParentIds(List<String> parentIds) {
AssertUtils.isEmpty(parentIds, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put("parentIds", parentIds);
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put(User.FIELD_USER_ID, userId);
}
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results;
}
}
......
......@@ -967,11 +967,8 @@ function saveProtFunc() {
$("#inqu_status2-0-companyCode").val('');
$("#inqu_status2-0-projName").val('');
const tree = $('#categoryTree').data('kendoTreeView');
const parentId = $("#inqu_status-0-orgParentId").val();
// 刷新树节点
tree.reload(parentId);
// 展开树
expandTreeNode(tree, parentId);
tree.select();
refreshTree();
} catch (e) {
// TODO: handle exception
......
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