Commit f26f2752 by 江和松

Merge remote-tracking branch 'origin/dev' into dev

parents 90b9942c ae61af53
......@@ -316,7 +316,7 @@ public class HGKCUtils {
newKc010.setWhCode(whCode);
newKc010.setInventCode(inventCode);
newKc010.setInvQty(qty);
newKc010.setInvUnitWeight(unitWeight);
newKc010.setInvUnitWeight(unitWeight == null ? weight.divide(qty, 3, RoundingMode.HALF_UP) : unitWeight);
newKc010.setInvWeight(weight);
return newKc010;
}
......
......@@ -138,8 +138,7 @@ public class ServiceHGPZ009 extends ServiceBase {
dao.insert(HGPZ009.INSERT, fPz009);
// 默认新增企业管理员账号
String userId = fPz009.getLoginPrefix() + "0000";
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName(),
null, null, null, "1");
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName());
// 关联企业管理员角色
this.insertGroupMember(fPz009, userId);
// 新增组织机构顶级
......
......@@ -37,6 +37,7 @@ public class HGWD003 extends DaoEPBase {
public static final String FIELD_USER_NAME = "userName"; /* 用户姓名*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_IS_PROJECT_MANAGER = "isProjectManager"; /* 是否项目经理,0=否,1=是*/
public static final String FIELD_EXT_ID = "extId"; /* 外部系统主键ID*/
public static final String FIELD_ORG_ID = "orgId"; /* 部门编码*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 部门名称*/
......@@ -55,6 +56,7 @@ public class HGWD003 extends DaoEPBase {
public static final String COL_USER_NAME = "USER_NAME"; /* 用户姓名*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_IS_PROJECT_MANAGER = "IS_PROJECT_MANAGER"; /* 是否项目经理,0=否,1=是*/
public static final String COL_EXT_ID = "EXT_ID"; /* 外部系统主键ID*/
public static final String COL_ORG_ID = "ORG_ID"; /* 部门编码*/
public static final String COL_ORG_CNAME = "ORG_CNAME"; /* 部门名称*/
......@@ -79,6 +81,7 @@ public class HGWD003 extends DaoEPBase {
private String userName = " "; /* 用户姓名*/
private String remark = " "; /* 备注*/
private Integer isProjectManager = 0; /* 是否项目经理,0=否,1=是*/
private String extId = " "; /* 外部系统主键ID*/
private String orgId = " "; /* 部门编码*/
private String orgCname = " "; /* 部门名称*/
......@@ -149,6 +152,10 @@ public class HGWD003 extends DaoEPBase {
eiColumn.setDescName("是否项目经理");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EXT_ID);
eiColumn.setDescName("外部系统主键ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
......@@ -392,6 +399,14 @@ public class HGWD003 extends DaoEPBase {
this.isProjectManager = isProjectManager;
}
public String getExtId() {
return extId;
}
public void setExtId(String extId) {
this.extId = extId;
}
public String getOrgId() {
return orgId;
}
......@@ -431,6 +446,7 @@ public class HGWD003 extends DaoEPBase {
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_NAME)), userName));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setIsProjectManager(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_PROJECT_MANAGER)), isProjectManager));
setExtId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EXT_ID)), extId));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
}
......@@ -457,6 +473,7 @@ public class HGWD003 extends DaoEPBase {
map.put(FIELD_USER_NAME, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_USER_NAME)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_IS_PROJECT_MANAGER, StringUtils.toString(isProjectManager, eiMetadata.getMeta(FIELD_IS_PROJECT_MANAGER)));
map.put(FIELD_EXT_ID, StringUtils.toString(extId, eiMetadata.getMeta(FIELD_EXT_ID)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
......
......@@ -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.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.setChangeStartCode(hgwd099.getDocId());
hgwd001a.setChangeStart(hgwd099.getDocName());
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,30 +361,28 @@ 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);
cleanBaseInfo(hgdm099);
hgdm099.setDeleteFlag(CommonConstant.YesNo.NO_0);
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);
......
......@@ -19,6 +19,8 @@ import java.util.List;
import java.util.Map;
/**
* 文档预览
*
* @author:songx
* @date:2024/5/9,11:04
*/
......
......@@ -19,6 +19,8 @@ import java.util.List;
import java.util.Map;
/**
* 文档下载
*
* @author:songx
* @date:2024/5/9,11:04
*/
......
......@@ -5,8 +5,15 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.*;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.ef.ui.tree.TreeService;
......@@ -169,24 +176,132 @@ public class ServiceHGWD001D extends TreeService {
}
public EiInfo searchNodePath(EiInfo inInfo) {
String leafName = (String)inInfo.get("leafName");
Map map = new HashMap();
List queryNodeList = this.dao.query("XSOG01.queryOrganiation", map);
List nodeList = new ArrayList();
Iterator var6 = queryNodeList.iterator();
while(var6.hasNext()) {
Object node = var6.next();
String parentId = (String)((HashMap)node).get("parentOrgId");
if (!"".equals(parentId.trim())) {
((HashMap)node).put("parentId", parentId);
nodeList.add(node);
}
}
ServiceXSTreeNode root = ServiceXSTreeNode.buildTree(nodeList);
List allPath = ServiceXSTreeNode.findAllPath(root, nodeList, leafName);
inInfo.set("allPath", allPath);
return inInfo;
String leafName = (String) inInfo.get("leafName");
Map map = new HashMap();
List queryNodeList = this.dao.query("XSOG01.queryOrganiation", map);
List nodeList = new ArrayList();
Iterator var6 = queryNodeList.iterator();
while (var6.hasNext()) {
Object node = var6.next();
String parentId = (String) ((HashMap) node).get("parentOrgId");
if (!"".equals(parentId.trim())) {
((HashMap) node).put("parentId", parentId);
nodeList.add(node);
}
}
ServiceXSTreeNode root = ServiceXSTreeNode.buildTree(nodeList);
List allPath = ServiceXSTreeNode.findAllPath(root, nodeList, leafName);
inInfo.set("allPath", allPath);
return inInfo;
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo queryTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 查询树根
*
* @return
*/
public List queryTopNode(String parentId) {
List<Map> results = new ArrayList();
List<HGSC001> dbSc001s = dao.query(HGSC001.QUERY, new HashMap<>());
if (CollectionUtils.isEmpty(dbSc001s)) {
return results;
}
for (HGSC001 dbSc001 : dbSc001s) {
String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName();
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P);
leafMap.put("projCode", dbSc001.getProjCode());
leafMap.put("projName", dbSc001.getProjName());
leafMap.put("ename", dbSc001.getProjCode());
leafMap.put("type", "1");
leafMap.put("leafLevel", "0");
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 查询叶子节点
*
* @param parentId
* @return
*/
public List queryChildNode(String parentId) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HGWD001 dbWd001 : dbWd001s) {
Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C);
leafMap.put("projCode", dbWd001.getProjCode());
leafMap.put("projName", dbWd001.getProjName());
leafMap.put("ename", dbWd001.getProjCode());
leafMap.put("type", dbWd001.getFileType());
leafMap.put("leafLevel", dbWd001.getLeafLevel());
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 设置叶子节点是否可以展开
*
* @param nodes
*/
private void setTreeNodeLeaf(List<Map> nodes) {
if (CollectionUtils.isEmpty(nodes)) {
return;
}
List<String> labels = ObjectUtils.listKey(nodes, "label");
Map<String, Integer> resultMap = HGWDTools.HgWd001.countByParent(labels);
for (Map node : nodes) {
Integer cnt = resultMap == null ? null : resultMap.get(node.get("label"));
node.put("leaf", cnt == null || cnt == 0 ? 1 : 0);
}
}
/**
* 构建叶子节点
*
* @param parentId
* @param label
* @param text
*/
private HashMap buildLeaf(String parentId, String label, String text, String leafType) {
HashMap<String, String> leafMap = new HashMap();
leafMap.put("parentId", parentId);
leafMap.put("label", label);
leafMap.put("text", text);
leafMap.put("leafType", leafType);
return leafMap;
}
}
......@@ -73,69 +73,6 @@ public class ServiceHGWD003 extends ServiceEPBase {
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo queryTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 查询树根
*
* @return
*/
public List queryTopNode(String parentLabel) {
List<Map> results = new ArrayList();
List<HGSC001> dbSc001s = dao.query(HGSC001.QUERY, new HashMap<>());
if (CollectionUtils.isEmpty(dbSc001s)) {
return results;
}
for (HGSC001 dbSc001 : dbSc001s) {
String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName();
results.add(buildLeaf(parentLabel, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P));
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 查询叶子节点
*
* @param parentLabel
* @return
*/
public List queryChildNode(String parentLabel) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentLabel);
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HGWD001 dbWd001 : dbWd001s) {
results.add(buildLeaf(parentLabel, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C));
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 搜索树节点
*
* @param inInfo
......@@ -247,21 +184,4 @@ public class ServiceHGWD003 extends ServiceEPBase {
return inInfo;
}
/**
* 设置叶子节点是否可以展开
*
* @param nodes
*/
private void setTreeNodeLeaf(List<Map> nodes) {
if (CollectionUtils.isEmpty(nodes)) {
return;
}
List<String> labels = ObjectUtils.listKey(nodes, "label");
Map<String, Integer> resultMap = HGWDTools.HgWd001.countByParent(labels);
for (Map node : nodes) {
Integer cnt = resultMap == null ? null : resultMap.get(node.get("label"));
node.put("leaf", cnt == null || cnt == 0 ? 1 : 0);
}
}
}
......@@ -51,7 +51,7 @@ public class ServiceHGWD003A extends ServiceEPBase {
}
/**
* 树节点查询
* 查询
*
* @param inInfo
* @return
......
......@@ -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();
}
}
}
......@@ -16,7 +16,8 @@
A.FILE_ID as "fileId", <!-- 文件ID -->
A.USER_ID as "userId", <!-- 用户ID -->
A.REMARK as "remark", <!-- 备注 -->
A.IS_PROJECT_MANAGER as "isProjectManager" <!-- 是否项目经理,0=否,1=是 -->
A.IS_PROJECT_MANAGER as "isProjectManager", <!-- 是否项目经理,0=否,1=是 -->
A.EXT_ID as "extId" <!-- 外部系统ID -->
</sql>
<sql id="columnB">
......@@ -106,11 +107,12 @@
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
FILE_ID, <!-- 文件ID -->
USER_ID, <!-- 文件ID -->
REMARK <!-- 备注 -->
USER_ID, <!-- 用户ID -->
REMARK, <!-- 备注 -->
EXT_ID <!-- 外部系统ID -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#fileId#, #userId#, #remark#
#fileId#, #userId#, #remark#, #extId#
)
</insert>
......
......@@ -9,7 +9,8 @@
A.GENDER as "gender", <!-- 性别 -->
A.MOBILE as "mobile", <!-- 手机号 -->
A.EMAIL as "email", <!-- 邮箱 -->
A.ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
A.EXT_ID as "extId" <!-- 外部系统主键ID -->
</sql>
<sql id="columnB">
......
......@@ -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(HGWD003::getExtId)
.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();
}
}
}
......@@ -47,6 +47,7 @@ public class User extends DaoEPBase {
public static final String FIELD_DEP_NAME = "depName"; /* 部门名称*/
public static final String FIELD_ID_CODE = "idCode";
public static final String FIELD_ID_CARD = "idCard";
public static final String FIELD_EXT_ID = "extId";
public static final String COL_USER_ID = "USER_ID"; /* 用户ID*/
public static final String COL_LOGIN_NAME = "LOGIN_NAME";
......@@ -101,6 +102,7 @@ public class User extends DaoEPBase {
private String depName = ""; /* 部门名称*/
private String idCode = "";
private String idCard = "";
private String extId = "";
/**
* initialize the metadata.
*/
......@@ -207,6 +209,11 @@ public class User extends DaoEPBase {
eiColumn = new EiColumn(FIELD_ID_CARD);
eiColumn.setDescName("身份证号码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EXT_ID);
eiColumn.setDescName("外部系统ID");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -589,6 +596,14 @@ public class User extends DaoEPBase {
this.idCard = idCard;
}
public String getExtId() {
return extId;
}
public void setExtId(String extId) {
this.extId = extId;
}
/**
* get the value from Map.
*
......@@ -622,6 +637,7 @@ public class User extends DaoEPBase {
setDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_NAME)), depName));
setIdCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ID_CODE)), idCode));
setIdCard(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ID_CARD)), idCard));
setExtId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EXT_ID)), extId));
}
/**
......@@ -656,6 +672,7 @@ public class User extends DaoEPBase {
map.put(FIELD_DEP_NAME, StringUtils.toString(depName, eiMetadata.getMeta(FIELD_DEP_NAME)));
map.put(FIELD_ID_CODE, StringUtils.toString(idCode, eiMetadata.getMeta(FIELD_ID_CODE)));
map.put(FIELD_ID_CARD, StringUtils.toString(idCard, eiMetadata.getMeta(FIELD_ID_CARD)));
map.put(FIELD_EXT_ID, StringUtils.toString(extId, eiMetadata.getMeta(FIELD_EXT_ID)));
return map;
}
......
......@@ -304,7 +304,7 @@ public class ServiceHGXSUser extends ServiceBase {
String isLock = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
// 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, dcUser.getName(), dcUser.getSex(), dcUser.getEmail(),
dcUser.getCardid(), isLock);
dcUser.getCardid(), isLock, dcUserList.getOrd().toString());
// 新增用户和组织机构关系
Map addMap = new HashMap();
addMap.put("orgId", dbPz009.getLoginPrefix() + dcUser.getOrgsid());
......@@ -329,6 +329,7 @@ public class ServiceHGXSUser extends ServiceBase {
// -1:冻结用户,1:正常
String isLock = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
updateMap.put(User.FIELD_IS_LOCKED, isLock);
updateMap.put(User.FIELD_EXT_ID, dcUserList.getOrd());
updateMap.put(User.FIELD_REC_REVISOR, "System");
updateMap.put(User.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
dao.update(HgXsSqlConstant.HgXsUser.UPDATE_DC_USER, updateMap);
......
......@@ -9,7 +9,8 @@
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
EXT_ID as extId <!-- 外部系统主键ID -->
</sql>
<sql id="condition">
......@@ -124,6 +125,7 @@
EMAIL = #email#,
ID_CARD = #idCard#,
IS_LOCKED = #isLocked#,
EXT_ID = #extId#,
REC_REVISOR = #recRevisor#,
REC_REVISE_TIME = #recReviseTime#
WHERE LOGIN_NAME = #loginName#
......
......@@ -204,13 +204,25 @@ public class HGXSTools {
* @param accountCode
* @param userId
* @param userName
* @throws Exception
*/
public static void addUser(String accountCode, String userId, String userName) throws Exception {
addUser(accountCode, userId, userName, null, null, null, null, null);
}
/**
* 初始化新增用户
*
* @param accountCode
* @param userId
* @param userName
* @param gender
* @param mobile
* @param idCard
* @param isLock
*/
public static void addUser(String accountCode, String userId, String userName, String gender, String mobile,
String idCard, String isLock) throws Exception {
String idCard, String isLock, String extId) throws Exception {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", userId);
inInfoRowMap.put("loginName", userId);
......@@ -223,6 +235,8 @@ public class HGXSTools {
inInfoRowMap.put("idCard", StringUtils.isBlank(idCard) ? " " : idCard);
inInfoRowMap.put("gender", HGXSUtils.XsUser.convertGender(gender));
inInfoRowMap.put("mobile", StringUtils.isBlank(mobile) ? " " : mobile);
inInfoRowMap.put("isLock", isLock);
inInfoRowMap.put("extId", extId);
inInfoRowMap.put("accountCode", accountCode);
EiInfo inInfo = new EiInfo();
inInfo.addBlock("details").addRow(inInfoRowMap);
......
......@@ -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, {
......@@ -918,14 +919,15 @@ function uploadFileCallback(data) {
inEiInfo.set("result-0-bizId", data.bizId);
inEiInfo.set("result-0-docId", data.docId);
inEiInfo.set("result-0-docName", data.docName);
inEiInfo.set("result-0-docType", data.docType);
inEiInfo.set("result-0-docType", isBlank(data.docType) ? "" : data.docType.substring(1));
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";
EiCommunicator.send(serviceName, methodName, inEiInfo, {
onSuccess(response) {
EiCommunicator.send(serviceName, methodName, inEiInfo, {
onSuccess(response) {
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
......@@ -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%"
});
}
......
......@@ -31,7 +31,7 @@
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="categoryTree" ename="tree_name" textField="text" valueField="label"
hasChildren="leaf" pid="parentId"
serviceName="HGWD001D" methodName="query">
serviceName="HGWD001D" methodName="queryTree">
</EF:EFTree>
</div>
......@@ -65,16 +65,20 @@
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="附件详情" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="no" personal="true" serviceName="HGWD099" queryMethod="query" deleteMethod="delete">
<EF:EFGrid blockId="result" autoDraw="no" personal="true" serviceName="HGWD099" queryMethod="query"
deleteMethod="delete">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="180"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="180" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="140" align="center"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="180"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center" defaultValue="0" hidden="false">
<EF:EFColumn ename="docType" cname="文件类型" enable="false" width="110"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center"
defaultValue="0" hidden="false">
<EF:EFCodeOption codeName="hggp.hgwd.status"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="140" align="center"/>
parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
......
......@@ -268,13 +268,7 @@ let preview = function () {
if (res.status > -1) {
for (let i = 0; i < rows.length; i++) {
let row = rows[i];
let docType = row['docType'];
if (!isBlank(docType) && docType.toLowerCase() == ".docx") {
let url = "HGWD098?inqu_status-0-docId=" + row['docId'];
window.open(url, '_blank');
} else {
window.open(downloadHref(rows[i]['docId'], true), '_blank');
}
previewDoc(row['docType'], row['docId']);
}
} else {
message(res.msg);
......
......@@ -18,7 +18,7 @@
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HGWD003" methodName="queryTree">
serviceName="HGWD001D" methodName="queryTree">
</EF:EFTree>
</div>
</EF:EFRegion>
......
......@@ -36,7 +36,7 @@ function isInteger(obj) {
* @returns {boolean}
*/
function isPositiveInteger(input) {
var pattern = /^[1-9]\d*$/; // 只能包含非零开头的数字
let pattern = /^[1-9]\d*$/; // 只能包含非零开头的数字
if (pattern.test(input)) {
return true;
} else {
......@@ -85,7 +85,7 @@ function message(msg) {
* @param title
* @param msg
*/
function message2(title,msg) {
function message2(title, msg) {
WindowUtil({
title: title,
content: "<div class='kendo-del-message'>" + msg + "</div>"
......@@ -109,6 +109,21 @@ function downloadHref(docId, isPreview) {
}
/**
* 预览
*
* @param 文件类型,例如:jpg/docx/pdf
* @param 文件ID
*/
function previewDoc(fileType, docId) {
if (!isBlank(fileType) && fileType.toLowerCase() == "docx") {
let url = "HGWD098?inqu_status-0-docId=" + docId;
window.open(url, '_blank');
} else {
window.open(downloadHref(docId, true), '_blank');
}
}
/**
* 获取窗口宽度
*
* @returns {number}
......
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