Commit 109448f2 by liuyang

2024-09-04 文档库消息模板调整

parent 052589a5
......@@ -185,9 +185,18 @@ public class ServiceHGWD001 extends ServiceEPBase {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
StringBuilder strFileName = new StringBuilder();
String changeContent = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGWD001A.FIELD_CHANGE_CONTENT);
HGWD001 hgwd001 = new HGWD001();
List<HGWD099> list = HGWDTools.HgWd099.queryByBiz("WD");
String fileId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGWD001.FIELD_FILE_ID);
HGWD001 hgwd001 = HGWDTools.HgWd001.get(fileId);
hgwd001.setRemark(changeContent);
List<HGWD099> listByBizId = HGWDTools.HgWd099.queryByBiz("WD",fileId).stream().filter(hgwd099 -> hgwd099.getStatus()==1).collect(Collectors.toList());
if (listByBizId.size()>0){
List<String> docNames = listByBizId.stream().map(HGWD099::getDocName).collect(Collectors.toList());
strFileName.append("发布前文件名称:").append(String.join(",", docNames)).append(", ");
}
strFileName.append("新发布的文件名称:");
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGWD099 hgwd099 = new HGWD099();
......@@ -201,21 +210,10 @@ public class ServiceHGWD001 extends ServiceEPBase {
AssertUtils.isEmpty(hgwd003s, "您不是该项目的项目经理管理员,无法发布!");
DaoUtils.update(HgWdSqlConstant.HgWd099.RELEASE_DATE, hgwd099); //发布附件
hgwd001 = HGWDTools.HgWd001.get(hgwd099.getBizId());
List<HGWD099> cw999List =list.stream().filter(hgwcw999 -> hgwcw999.getBizId().equals(hgwd099.getBizId())).collect(Collectors.toList());
AssertUtils.isEmpty(cw999List, String.format("未找到[%s]所属项目有关的附件, 发布失败!", hgwd001.getProjName()));
strFileName.append(hgwd099.getDocName()).append(",");
HGWD001A hgwd001a = new HGWD001A();
hgwd001a.setCompanyCode(hgwd001.getCompanyCode());
hgwd001a.setCompanyName(hgwd001.getCompanyName());
hgwd001a.setProjCode(hgwd001.getProjCode());
hgwd001a.setProjName(hgwd001.getProjName());
hgwd001a.setChangeType(ChangeTypeEnum.RELEASE.getCode());
hgwd001a.setMatId(hgwd001.getId());
hgwd001a.setChangeContent(changeContent.trim().length()==0?"附件发布":changeContent);
hgwd001a.setChangeStart("V".concat(hgwd001.getDocVersion()+""));
hgwd001a.setChangeEnd("V".concat(hgwd001.getDocVersion()+1+""));
//添加变更记录
HGWD001A hgwd001a = initHgwd001a(hgwd001, hgwd099, ChangeTypeEnum.RELEASE.getCode());
HGWDTools.HgWd001.addHGWD001A(hgwd001a);
hgwd001.setStatus(HgWdConstant.FileStatus.S_1);
......@@ -223,7 +221,8 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd001.setRemark(changeContent.trim().length()==0?"附件发布":changeContent);
DaoUtils.update(HGWD001.RELEASE_DATE, hgwd001);
}
this.interaction(hgwd001,changeContent);
HGWDTools.interaction(hgwd001,strFileName.append("变更内容:").append(changeContent).toString());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "发布成功")});
} catch (PlatException e) {
......@@ -235,14 +234,20 @@ public class ServiceHGWD001 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "文档库",operType = "修改",operDesc = "文档库-附件变更-变更附件操作")
public EiInfo updateFile(EiInfo inInfo) {
try {
StringBuilder strFileName = new StringBuilder();
strFileName.append("本次上传文件名称:");
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
HGWD001 hgwd001 = HGWDTools.HgWd001.get(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGWD001.FIELD_FILE_ID));
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD");
for (Map resultRow : resultRows) {
String ndocId = resultRow.get("ndocId").toString();
List<HGWD099> hgwd099s = HGWDTools.HgWd099.getByDocId("WD",ndocId);
List<HGWD099> hgwd099s = hgwd099List.stream().filter(hgwd099 -> hgwd099.getDocId().equals(ndocId)).collect(Collectors.toList());
AssertUtils.isEmpty(hgwd099s, String.format("未找到[%s]对应的附件,请检查!", ndocId));
HGWD099 hgwd099 = hgwd099s.get(0);
HGWD001 hgwd001 = HGWDTools.HgWd001.get(hgwd099.getBizId());
this.interaction(hgwd001, hgwd099.getDocName(), resultRow.get(HGWD099.FIELD_DOC_NAME).toString());
strFileName.append("变更前附件名称:")
.append(hgwd099.getDocName()).append(",")
.append("变更后附件名称:").append(resultRow.get(HGWD099.FIELD_DOC_NAME)).append(",");
if (hgwd001 != null) {
HGWD001A hgwd001a =initHgwd001a(hgwd001, hgwd099,ChangeTypeEnum.UPLOAD_UPDATE.getCode());
hgwd001a.setChangeEndCode(resultRow.get(HGWD099.FIELD_DOC_ID).toString());
......@@ -260,7 +265,7 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd099.setStatus(HgWdConstant.FileStatus.S_0);
DaoUtils.insert(HGWD099.UPDATE, hgwd099);
}
HGWDTools.interaction(hgwd001,strFileName.substring(0,strFileName.length()-1));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
......@@ -288,10 +293,14 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd001a.setChangeType(ChangeTypeEnum.UPLOAD_DELETE.getCode());
}else if (ChangeTypeEnum.UPLOAD_UPDATE.getCode().equals(type)){
hgwd001a.setChangeType(ChangeTypeEnum.UPLOAD_UPDATE.getCode());
}
hgwd001a.setChangeContent(hgwd001.getFileName());
hgwd001a.setChangeStartCode(hgwd099.getDocId());
hgwd001a.setChangeStart(hgwd099.getDocName());
}else if (ChangeTypeEnum.RELEASE.getCode().equals(type)){
hgwd001a.setChangeContent(hgwd001.getRemark().trim().length()==0?"附件发布":hgwd001.getRemark().trim());
hgwd001a.setChangeStart("V".concat(hgwd001.getDocVersion()+""));
hgwd001a.setChangeEnd("V".concat(hgwd001.getDocVersion()+1+""));
}
hgwd001a.setChangeContent(hgwd001.getFileName());
hgwd001a.setMatId(hgwd001.getId());
return hgwd001a;
}
......@@ -330,57 +339,6 @@ public class ServiceHGWD001 extends ServiceEPBase {
return inInfo;
}
/**
* 附件变更通知
* @param hgwd001 待变更的项目名称
* @param changeContent 变更内容
*/
public void interaction(HGWD001 hgwd001, String changeContent){
try {
HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode());
List<HGWD003> hgwd003s = DaoBase.getInstance().query(HGWD003.QUERY,
new HashMap<String,String>(){{
put("fileId",hgwd001.getFileId());
}}
);
List<String> userIds =hgwd003s.stream().filter(item -> !item.getUserId().equals(UserSessionUtils.getUserId())).map(item -> item.getUserId().replace(hgpz009.getLoginPrefix(),"")).filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());
if (userIds.size()>0){
DcOpenApi.interactionAdd(
String.format("[%s]项目附件变更", hgwd001.getProjName()),
changeContent,String.join(",",userIds));
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 附件变更通知
* @param hgwd001 待变更的项目名称
* @param oldName 变更前附件名称
* @param newName 变更后附件名称
*/
public void interaction(HGWD001 hgwd001,String oldName,String newName){
try {
if (Objects.nonNull(hgwd001)){
HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode());
List<HGWD003> hgwd003s = DaoBase.getInstance().query(HGWD003.QUERY,
new HashMap<String,String>(){{
put("fileId",hgwd001.getFileId());
}}
);
List<String> userIds =hgwd003s.stream().map(item -> item.getUserId().replace(hgpz009.getLoginPrefix(),"")).filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());
DcOpenApi.interactionAdd(
String.format("[%s]项目附件变更", hgwd001.getProjName()),
String.format("变更前附件名称[%s],变更后附件名称[%s]", oldName,newName),String.join(",",userIds));
}
} catch (IOException e) {
e.printStackTrace();
}
}
public EiInfo query1(EiInfo inInfo) {
try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo, "inqu_status1");
......@@ -403,8 +361,10 @@ public class ServiceHGWD001 extends ServiceEPBase {
//List<Map<String, Object>> edcm01List = Iplat4jTools.EdCm01.list("hggp.hgwd.fileType");
// 写入数据
for (Map result1Row:result1Rows) {
StringBuilder strFileName = new StringBuilder();
HGWD001 hgwd001 = new HGWD001();
hgwd001.fromMap(result1Row);
strFileName.append(hgwd001.getFileName()).append("上传附件:附件名称");
for (Map resultRow : resultRows) {
HGWD099 hgdm099 = new HGWD099();
hgdm099.fromMap(resultRow);
......@@ -413,21 +373,16 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgdm099.setBizId(hgwd001.getFileId());
hgdm099.setStatus(HgWdConstant.FileStatus.S_0);
DaoUtils.insert(HGWD099.INSERT, hgdm099);
strFileName.append(hgdm099.getDocName()).append(",");
HGWD001A hgwd001a = new HGWD001A();
hgwd001a.setCompanyCode(hgwd001.getCompanyCode());
hgwd001a.setCompanyName(hgwd001.getCompanyName());
hgwd001a.setProjCode(hgwd001.getProjCode());
hgwd001a.setProjName(hgwd001.getProjName());
hgwd001a.setChangeType(ChangeTypeEnum.UPLOAD_ADD.getCode());
hgwd001a.setChangeContent(hgwd001.getFileName());
hgwd001a.setChangeEnd(hgdm099.getDocName());
HGWD001A hgwd001a =initHgwd001a(hgwd001, hgdm099,ChangeTypeEnum.UPLOAD_ADD.getCode());
hgwd001a.setChangeEndCode(hgdm099.getDocId());
hgwd001a.setMatId(hgwd001.getId());
hgwd001a.setChangeEnd(hgdm099.getDocName());
HGWDTools.HgWd001.addHGWD001A(hgwd001a);
}
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
HGWDTools.HgWd001.updateStatus(hgwd001);
HGWDTools.interaction(hgwd001, strFileName.substring(0, strFileName.length() - 1));
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -84,13 +84,15 @@ public class ServiceHGWD099 extends ServiceEPBase {
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
HGWD001 hgwd001 = HGWDTools.HgWd001.get(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGWD001.FIELD_FILE_ID));
StringBuilder strFileName = new StringBuilder();
strFileName.append("本次上传文件名称:");
for (Map resultRow : resultRows) {
HGWD099 hgdm099 = new HGWD099();
hgdm099.fromMap(resultRow);
hgdm099.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HGWD099.INSERT, hgdm099);
//项目文件
HGWD001 hgwd001 =HGWDTools.HgWd001.get(hgdm099.getBizId());
strFileName.append(hgdm099.getDocName()).append(",");
if (hgwd001 != null) {
HGWD001A hgwd001a = new HGWD001A();
hgwd001a.setCompanyCode(hgwd001.getCompanyCode());
......@@ -107,9 +109,9 @@ public class ServiceHGWD099 extends ServiceEPBase {
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
HGWDTools.HgWd001.updateStatus(hgwd001);
}
interaction(hgwd001,hgdm099.getDocName());
}
HGWDTools.interaction(hgwd001,strFileName.substring(0, strFileName.length() - 1));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
......@@ -160,30 +162,4 @@ public class ServiceHGWD099 extends ServiceEPBase {
return inInfo;
}
/**
* 附件上传通知
* @param hgwd001 待变更的项目名称
* @param newName 变更后附件名称
*/
public void interaction(HGWD001 hgwd001,String newName){
try {
if (Objects.nonNull(hgwd001)){
List<HGWD003> listByFile = HGWDTools.HgWd003.listByFile(hgwd001.getFileId()); //获取文件下的权限人员
//当前登录用户是否是设计人员,是设计人员则通知项目经理
List<HGWD003> hgwd003s = listByFile.stream().filter(hgwd003 -> hgwd003.getUserId().equals(UserSessionUtils.getUserId()) && hgwd003.getIsProjectManager() == 0).collect(Collectors.toList());
if (hgwd003s.size()>0){
HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode());
List<String> userIds = listByFile.stream().filter(hgwd003 -> hgwd003.getIsProjectManager() == 1).map(hgwd003 -> hgwd003.getUserId().replace(hgpz009.getLoginPrefix(),"")).distinct().collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(userIds)){
DcOpenApi.interactionAdd(
String.format("[%s]项目上传附件请审核发布", hgwd001.getProjName()),
String.format("上传附件名称[%s]",newName),String.join(",",userIds));
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -4,9 +4,13 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.constant.HgCwSqlConstant;
import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.dm.domain.HGDM099;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
......@@ -15,13 +19,12 @@ 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;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -246,5 +249,42 @@ public class HGWDTools {
return results;
}
public static List<HGWD099> queryByBiz(String bizType, String bizId) {
AssertUtils.isNull(bizType, "业务类型不能为空!");
AssertUtils.isNull(bizId, "业务ID不能为空!");
List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY,
new HashMap<String,Object>(){{put("bizType",bizType); put("bizId",bizId);}}
);
return results;
}
}
/**
* 附件上传通知
* @param hgwd001 待变更的项目名称
* @param changeContent 变更内容
*/
public static void interaction(HGWD001 hgwd001, String changeContent){
try {
if (Objects.nonNull(hgwd001)){
List<HGWD003> listByFile = HGWDTools.HgWd003.listByFile(hgwd001.getFileId()); //获取文件下的权限人员
HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode());
List<String> userIds = listByFile.stream().filter(item -> !item.getUserId().equals(UserSessionUtils.getUserId()) && item.getIsProjectManager() == 1)
.map(item -> item.getUserId().replace(hgpz009.getLoginPrefix(),""))
.filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());
if (userIds.size()>0){
DcOpenApi.interactionAdd(
String.format("[%s]项目变更", hgwd001.getProjName()),
changeContent,
String.join(",",userIds));
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -492,6 +492,7 @@ $(function () {
let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.fileId;
let inEiInfo = new EiInfo();
inEiInfo.set("inqu_status-0-fileId", parentId);
$("#inqu_status-0-changeContent").val('');
//inEiInfo.set("inqu_status-0-isProjectManager", "1");
//inEiInfo.set("inqu_status-0-userId", $("#inqu_status-0-userId").val());
EiCommunicator.send("HGWD003", "query", inEiInfo, {
......@@ -921,6 +922,7 @@ function uploadFileCallback(data) {
inEiInfo.set("result-0-docType", data.docType);
inEiInfo.set("result-0-bizType", data.bizType);
inEiInfo.set("result-0-ndocId", data.ndocId);
inEiInfo.set("inqu_status-0-fileId", data.bizId);
let serviceName = data.operType == "add" ? "HGWD099" : "HGWD001";
let methodName = data.operType == "add" ? "insert" : "updateFile";
......@@ -975,6 +977,7 @@ function updateRelease() {
let inEiInfo = new EiInfo();
inEiInfo.addBlock(JSUtils.checkedRows2Block("result"));
inEiInfo.set("inqu_status-0-changeContent", changeContent);
inEiInfo.set("inqu_status-0-fileId", IPLATUI.EFTree.categoryTree.selectTreeNode.fileId);
EiCommunicator.send('HGWD001', 'updateRelease', inEiInfo, {
onSuccess(response) {
if (response.status != -1) {
......@@ -1052,8 +1055,7 @@ function changeResord() {
"&efParentFormEname=HGWD001",
title: "<div style='text-align: center;'>变更记录</div>",
width: "80%",
height: "80%",
callbackName: uploadFileCallback
height: "80%"
});
}
......
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