Commit e3b823c9 by liuyang

2024-09-24

1.文档库:复制功能需支持按项目和文件夹复制附件
parent 57792d92
...@@ -454,36 +454,19 @@ public class ServiceHGWD001 extends ServiceEPBase { ...@@ -454,36 +454,19 @@ public class ServiceHGWD001 extends ServiceEPBase {
try { try {
Map<String,String> queryMap= EiInfoUtils.getFirstRow(inInfo,EiConstant.queryBlock); Map<String,String> queryMap= EiInfoUtils.getFirstRow(inInfo,EiConstant.queryBlock);
List<HGWD001> result1Rows = MapUtils.toDaoEPBases(inInfo.getBlock("result2").getRows(), HGWD001.class); List<HGWD001> result1Rows = MapUtils.toDaoEPBases(inInfo.getBlock("result2").getRows(), HGWD001.class);
List<HGWD001> hgwd001List = HGWDTools.HgWd001.queryByParentId(queryMap.get(HGWD001.FIELD_PROJ_CODE),queryMap.get(HGWD001.FIELD_PARENT_ID));
if (queryMap.get("leafType").equals(HgWdConstant.LeafType.P)){
hgwd001List = HGWDTools.HgWd001.queryByProjCode(queryMap.get(HGWD001.FIELD_PROJ_CODE),queryMap.get(HGWD001.FIELD_PARENT_ID));
}
// 要复制项目 // 要复制项目
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()); String parentId = result1Rows.get(0).getParentId();
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", fileIds);
StringBuilder strFileName = new StringBuilder();
// 写入数据 // 写入数据
for (HGWD001 hgwd001:hgwd001List) { for (HGWD001 hgwd001:hgwd001List) {
String fileId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.WD_FILE_ID); String fileId = SequenceGenerator.getNextSequence(HGConstant.SequenceId.WD_FILE_ID);
hgwd001.setParentId(result1Rows.get(0).getProjCode()); addCopyFile(hgwd001, parentId, fileId);
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.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgwd001List.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + hgwd001List.size() + "]条数据保存成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -492,47 +475,33 @@ public class ServiceHGWD001 extends ServiceEPBase { ...@@ -492,47 +475,33 @@ public class ServiceHGWD001 extends ServiceEPBase {
return inInfo; return inInfo;
} }
@OperationLogAnnotation(operModul = "文档库",operType = "复制文件",operDesc = "文档库-复制文件-复制文件操作") private void addCopyFile(HGWD001 hgwd001,String parentId,String fileId){
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()); List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", hgwd001.getFileId());
hgwd001.setStatus(HgWdConstant.FileStatus.S_0); StringBuilder strFileName = new StringBuilder();
hgwd001.setDocVersion(0);
strFileName.append(hgwd001.getFileName()).append("上传附件:附件名称"); strFileName.append(hgwd001.getFileName()).append("上传附件:附件名称");
List<HGWD099> hgwd099s = hgwd099List.stream().filter(hgdm099 -> hgdm099.getBizId().equals(hgwd001.getFileId())).collect(Collectors.toList()); List<HGWD099> hgwd099s = hgwd099List.stream().filter(hgdm099 -> hgdm099.getBizId().equals(hgwd001.getFileId())).collect(Collectors.toList());
for (HGWD099 hgwd099 : hgwd099s) { for (HGWD099 hgwd099 : hgwd099s) {
cleanBaseInfo(hgwd099); cleanBaseInfo(hgwd099);
hgwd099.setDeleteFlag(CommonConstant.YesNo.NO_0); hgwd099.setDeleteFlag(CommonConstant.YesNo.NO_0);
hgwd099.setBizId(hgwd001.getFileId()); hgwd099.setBizId(fileId);
hgwd099.setStatus(HgWdConstant.FileStatus.S_0); hgwd099.setStatus(HgWdConstant.FileStatus.S_0);
DaoUtils.insert(HGWD099.INSERT, hgwd099); DaoUtils.insert(HGWD099.INSERT, hgwd099);
strFileName.append(hgwd099.getDocName()).append(","); strFileName.append(hgwd099.getDocName()).append(",");
HGWD001A hgwd001a =initHgwd001a(hgwd001, hgwd099,ChangeTypeEnum.UPLOAD_ADD.getCode()); HGWD001A hgwd001a =initHgwd001a(hgwd001, hgwd099,ChangeTypeEnum.UPLOAD_ADD.getCode());
hgwd001a.setChangeEndCode(hgwd099.getDocId()); hgwd001a.setChangeEndCode(hgwd099.getDocId());
hgwd001a.setChangeEnd(hgwd099.getDocName()); hgwd001a.setChangeEnd(hgwd099.getDocName());
HGWDTools.HgWd001.addHGWD001A(hgwd001a); 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; hgwd001.setParentId(parentId);
hgwd001.setFileId(fileId);
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
cleanBaseInfo(hgwd001);
DaoUtils.insert(HGWD001.INSERT, hgwd001);
HGWDTools.interaction(hgwd001, strFileName.substring(0, strFileName.length() - 1));
} }
public EiInfo queryProjectManager(EiInfo inInfo) { public EiInfo queryProjectManager(EiInfo inInfo) {
......
...@@ -163,6 +163,20 @@ public class HGWDTools { ...@@ -163,6 +163,20 @@ public class HGWDTools {
queryMap.put(User.FIELD_USER_ID, userId); queryMap.put(User.FIELD_USER_ID, userId);
} }
queryMap.put(HGWD001.FIELD_PROJ_CODE, projCode); queryMap.put(HGWD001.FIELD_PROJ_CODE, projCode);
queryMap.put(HGWD001.FIELD_PARENT_ID, parentId);
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
public static List<HGWD001> queryByParentId(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); queryMap.put(HGWD001.FIELD_FILE_ID, parentId);
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap); List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results; return CollectionUtils.isEmpty(results) ? null : results;
......
...@@ -389,7 +389,8 @@ $(function () { ...@@ -389,7 +389,8 @@ $(function () {
projCode: '', projCode: '',
companyCode: '', companyCode: '',
leafLevel: '', leafLevel: '',
type: '', leafType: '',
}, },
// expandLevel:1, // expandLevel:1,
/** /**
...@@ -831,13 +832,11 @@ let showAuthButton = function () { ...@@ -831,13 +832,11 @@ let showAuthButton = function () {
$("#UPLOAD_FILE").attr("disabled", false); $("#UPLOAD_FILE").attr("disabled", false);
$("#CHANGE_RECORD").attr("disabled", true); $("#CHANGE_RECORD").attr("disabled", true);
$("#COPY_FILE").attr("disabled", false); $("#COPY_FILE").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
} else { } else {
$("#RELEASE").attr("disabled", true); $("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", true); $("#UPLOAD_FILE").attr("disabled", true);
$("#CHANGE_RECORD").attr("disabled", false); $("#CHANGE_RECORD").attr("disabled", false);
$("#COPY_FILE").attr("disabled", true); $("#COPY_FILE").attr("disabled", true);
$("#COPY_PROT_FILE").attr("disabled", true);
} }
isProjectManager(parentId); isProjectManager(parentId);
/*let inEiInfo = new EiInfo(); /*let inEiInfo = new EiInfo();
...@@ -1007,28 +1006,24 @@ let isProjectManager = function (parentId) { ...@@ -1007,28 +1006,24 @@ let isProjectManager = function (parentId) {
$("#UPLOAD_FILE").attr("disabled", false); $("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false); $("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false); $("#PREVIEW").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
break; break;
case 2: case 2:
$("#RELEASE").attr("disabled", false); $("#RELEASE").attr("disabled", false);
$("#UPLOAD_FILE").attr("disabled", false); $("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false); $("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false); $("#PREVIEW").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
break; break;
case 3: case 3:
$("#RELEASE").attr("disabled", true); $("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", false); $("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false); $("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false); $("#PREVIEW").attr("disabled", false);
$("#COPY_PROT_FILE").attr("disabled", false);
break break
default: default:
$("#RELEASE").attr("disabled", true); $("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", true); $("#UPLOAD_FILE").attr("disabled", true);
$("#COPY_FILE").attr("disabled", true); $("#COPY_FILE").attr("disabled", true);
$("#PREVIEW").attr("disabled", true); $("#PREVIEW").attr("disabled", true);
$("#COPY_PROT_FILE").attr("disabled", 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