Commit e3b823c9 by liuyang

2024-09-24

1.文档库:复制功能需支持按项目和文件夹复制附件
parent 57792d92
......@@ -454,36 +454,19 @@ public class ServiceHGWD001 extends ServiceEPBase {
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.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());
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", fileIds);
StringBuilder strFileName = new StringBuilder();
String parentId = result1Rows.get(0).getParentId();
// 写入数据
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(",");
addCopyFile(hgwd001, parentId, fileId);
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) {
......@@ -492,28 +475,17 @@ public class ServiceHGWD001 extends ServiceEPBase {
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);
private void addCopyFile(HGWD001 hgwd001,String parentId,String fileId){
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", hgwd001.getFileId());
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.setBizId(fileId);
hgwd099.setStatus(HgWdConstant.FileStatus.S_0);
DaoUtils.insert(HGWD099.INSERT, hgwd099);
strFileName.append(hgwd099.getDocName()).append(",");
......@@ -523,16 +495,13 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd001a.setChangeEnd(hgwd099.getDocName());
HGWDTools.HgWd001.addHGWD001A(hgwd001a);
}
hgwd001.setParentId(parentId);
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;
HGWDTools.interaction(hgwd001, strFileName.substring(0, strFileName.length() - 1));
}
public EiInfo queryProjectManager(EiInfo inInfo) {
......
......@@ -163,6 +163,20 @@ public class HGWDTools {
queryMap.put(User.FIELD_USER_ID, userId);
}
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);
List<HGWD001> results = DaoBase.getInstance().query(HGWD001.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results;
......
......@@ -389,7 +389,8 @@ $(function () {
projCode: '',
companyCode: '',
leafLevel: '',
type: '',
leafType: '',
},
// expandLevel:1,
/**
......@@ -831,13 +832,11 @@ 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();
......@@ -1007,28 +1006,24 @@ 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);
}
}
}
......
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