Commit 8311c62e by 宋祥
parents 5c2f6d24 c4b1ef75
......@@ -8,20 +8,25 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.hg.cw.domain.HGCW002;
import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.cw.domain.HGCW006;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.pz.domain.HGPZ001;
import com.baosight.hggp.hg.pz.domain.HGPZ002;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ExcelUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -32,7 +37,13 @@ import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -54,7 +65,6 @@ public class ServiceHGCW002 extends ServiceBase {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCW002().eiMetadata);
outInfo = super.query(inInfo, HGCW002.QUERY, new HGCW002());
Map<String, Object> qarma = new HashMap<>();
EiInfoUtils.addBlock(outInfo, "roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID, DdynamicEnum.CONTRACT_BLOCK_ID));
......@@ -88,6 +98,7 @@ public class ServiceHGCW002 extends ServiceBase {
@OperationLogAnnotation(operModul = "账期维护", operType = "查询", operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
if (!roleCompanyCode.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW002.FIELD_COMPANY_CODES, roleCompanyCode);
......
package com.baosight.hggp.hg.pz.utils;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.hg.pz.domain.HGPZ020A;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.pz.enums.DynamicTableEnum;
......@@ -69,7 +70,7 @@ public class HGPZUtils {
List<HGPZ020A> dbPz020as = HGPZTools.HgPz020A.listByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz020as)) {
return dbPz020as.stream().map(item -> {
if (StringUtils.isEmpty(item.getViewSql())) {
if (StringUtils.isBlank(item.getViewSql())) {
return item.getFieldCode() + " as \"" + item.getAliasName() + "\"";
} else {
return item.getViewSql() + " as \"" + item.getAliasName() + "\"";
......@@ -90,6 +91,24 @@ public class HGPZUtils {
}
/**
* 设置动态列
*
* @param dynamicTableEnum 动态表
*/
public static List<String> listDynamicColumnAlias(DynamicTableEnum dynamicTableEnum) {
// 查询企业配置的字段,如果未配置使用默认字段
List<HGPZ020A> dbPz020as = HGPZTools.HgPz020A.listByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz020as)) {
return dbPz020as.stream().map(HGPZ020::getAliasName).collect(Collectors.toList());
}
List<HGPZ021> dbPz021s = HGPZTools.HgPz021.listDefaultByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz021s)) {
return dbPz021s.stream().map(HGPZ021::getAliasName).collect(Collectors.toList());
}
return new ArrayList<>();
}
/**
* 填充EiMetadata
*
* @param inInfo
......
......@@ -7,7 +7,7 @@ package com.baosight.hggp.hg.sc.enums;
public enum ProjectSourceEnum {
ENGINEERING("engineering", "工程设计图"),
FOREIGN("foreign", "生产制造图"),
FOREIGN("foreign", "工程制造图"),
SPARE("spare", "备件制造图"),
OTHER("other", "其他"),
;
......
......@@ -7,8 +7,6 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ001;
import com.baosight.hggp.hg.pz.enums.DynamicTableEnum;
import com.baosight.hggp.hg.pz.utils.HGPZUtils;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
......@@ -68,11 +66,7 @@ public class ServiceHGSC001 extends ServiceBase {
@OperationLogAnnotation(operModul = "项目立项", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
// 设置动态列
HGPZUtils.HgPz020.buildDynamicColumn(inInfo, DynamicTableEnum.HGSC001);
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
// 根据结果集填充eiMetadata
HGPZUtils.HgPz020.buildEiMetaData(inInfo, HGSC001.class);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......
......@@ -238,8 +238,7 @@
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT
<isEmpty property="dynamicColumn"><include refid="column"/></isEmpty>
<isNotEmpty property="dynamicColumn">$dynamicColumn$</isNotEmpty>
<include refid="column"/>
FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
......
......@@ -26,6 +26,10 @@ public class HgWdSqlConstant {
public static final String QUERY_ALL = "HGWD001.queryAll";
// 查询子节点
public static final String QUERY_FILE_CHILD = "HGWD001.queryFileChild";
// 查询子节点
public static final String QUERY_CHILDREN = "HGWD001.queryChildren";
// 查询项目来源
public static final String QUERY_PROJECT_SOURCE = "HGWD001.queryProjectSource";
public static final String UPDATE_FILE_PATH = "HGWD001.updateFilePath";
}
......
......@@ -9,6 +9,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099;
......@@ -30,7 +31,12 @@ import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -217,12 +223,13 @@ public class ServiceHGWD001D extends TreeService {
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
String ename = MapUtils.getString(queryMap, CommonConstant.Field.ENAME);
String projCode = MapUtils.getString(queryMap, HGWD001.FIELD_PROJ_CODE);
String pageCode = MapUtils.getString(queryMap, "pageCode");
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node));
} else if (ProjectSourceEnum.contains(node)) {
inInfo.addBlock(node).setRows(queryFirstNode(node, ename));
} else {
inInfo.addBlock(node).setRows(queryChildNode(projCode, node, ename));
inInfo.addBlock(node).setRows(queryChildNode(projCode, node, ename, pageCode));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
......@@ -237,25 +244,46 @@ public class ServiceHGWD001D extends TreeService {
*/
public List queryTopNode(String parentId) {
List<Map> results = new ArrayList();
// 管理员不做限制
boolean isManager = HgWdUtils.HgWd009.isManager();
List<String> projectSources = isManager ? null : listTopNode();
// 项目来源小代码
List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projectSource");
if (CollectionUtils.isEmpty(codesetMaps)) {
return results;
}
for (Map codesetMap : codesetMaps) {
String label = MapUtils.getString(codesetMap, "value");
String id = MapUtils.getString(codesetMap, "value");
String text = MapUtils.getString(codesetMap, "label");
Map leafMap = buildLeaf(parentId, label, text, HgWdConstant.LeafType.P);
// 不是管理员,且不存在,且不是备件制造图就不显示
if (!isManager && !projectSources.contains(id) && !ProjectSourceEnum.SPARE.getCode().equals(id)) {
continue;
}
Map leafMap = buildLeaf(parentId, id, text, HgWdConstant.LeafType.P);
leafMap.put("type", "-1");
leafMap.put("leafLevel", "-1");
leafMap.put("filePath", text);
leafMap.put("leaf", 0);
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results, true);
return results;
}
/**
* 查询顶级节点
*
* @return
*/
private List<String> listTopNode() {
// 查询有权限的顶级目录,管理员不做要求,并且项目是审核通过
Map queryMap = new HashMap();
queryMap.put("userId", UserSessionUtils.getUserId());
queryMap.put("projectStatusYs", HGConstant.ApprovalStatus.YS);
List<HGWD001> dbWd001s = dao.query(HgWdSqlConstant.HgWd001.QUERY_PROJECT_SOURCE, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return new ArrayList<>();
}
return dbWd001s.stream().map(HGWD001::getProjectSource).collect(Collectors.toList());
}
/**
* 查询一级节点
*
* @param parentId
......@@ -263,15 +291,16 @@ public class ServiceHGWD001D extends TreeService {
* @return
*/
public List queryFirstNode(String parentId, String ename) {
boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId);
// SPARE:备件制造图不限制;非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
boolean isManager = HgWdUtils.HgWd009.isManager(userId);
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId);
List<Map> results = new ArrayList();
Map queryMap = new HashMap<>();
queryMap.put("ename", ename);
queryMap.put(HGSC001.FIELD_project_source, parentId);
queryMap.put(HGSC001.FIELD_approval_status, HGConstant.ApprovalStatus.YS);
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (isAuth && !HgWdUtils.HgWd009.isManager(userId)) {
if (isSourceAuth && !isManager) {
queryMap.put("userId", userId);
}
List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap);
......@@ -284,7 +313,7 @@ public class ServiceHGWD001D extends TreeService {
String text = dbSc001.getProjName() + "(" + dbSc001.getProjCode() + ")";
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P);
int count = getChildCount(dbSc001.getProjCode());
int count = getChildCount(dbSc001.getProjCode(), isManager, isSourceAuth, null);
//Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbSc001.getProjCode())).count();
leafMap.put("projCode", dbSc001.getProjCode());
......@@ -293,7 +322,7 @@ public class ServiceHGWD001D extends TreeService {
leafMap.put("type", "1");
leafMap.put("leafLevel", "0");
leafMap.put("count", count);
leafMap.put("isAuth", isAuth ? "1" : "0");
leafMap.put("isAuth", isSourceAuth ? "1" : "0");
leafMap.put("filePath", ProjectSourceEnum.getByCode(parentId).getName()+"/"+text);
results.add(leafMap);
}
......@@ -310,29 +339,33 @@ public class ServiceHGWD001D extends TreeService {
* @param ename
* @return
*/
public List queryChildNode(String projCode, String parentId, String ename) {
public List queryChildNode(String projCode, String parentId, String ename, String pageCode) {
List<Map> results = new ArrayList();
String userId = UserSessionUtils.getLoginName();
// 查询项目来源
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode);
// true:需要权限
// 备件制造图不需要授权,true:需要权限
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
// 是否文档管理员
boolean isManager = HgWdUtils.HgWd009.isManager();
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
queryMap.put("ename", ename);
// 递归查询有权限的文件夹,管理员和备件制造图不限制
if (!isManager && isSourceAuth) {
queryMap.put("treeUserId", userId);
}
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
// 是否文档管理员
boolean isManager = HgWdUtils.HgWd009.isManager();
List<String> fileIds = dbWd001s.stream().map(HGWD001::getFileId).distinct().collect(Collectors.toList());
// 查询目录授权人数
List<HGWD003> dbWd003s = HGWDTools.HgWd003.list(fileIds);
for (HGWD001 dbWd001 : dbWd001s) {
Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C);
int count = getChildCount(dbWd001.getFileId());
int count = getChildCount(dbWd001.getFileId(), isManager, isSourceAuth, pageCode);
leafMap.put("projCode", dbWd001.getProjCode());
leafMap.put("projName", dbWd001.getProjName());
leafMap.put("ename", dbWd001.getProjCode());
......@@ -340,6 +373,9 @@ public class ServiceHGWD001D extends TreeService {
leafMap.put("leafLevel", dbWd001.getLeafLevel());
leafMap.put("count", count);
leafMap.put("filePath",dbWd001.getFilePath());
if ("HGWD002".equals(pageCode)&& count == 0){
continue;
}
if (!isManager && isSourceAuth) {
leafMap.put("isAuth", "1");
// 从已授权的信息中查找出自己
......@@ -401,15 +437,18 @@ public class ServiceHGWD001D extends TreeService {
* @param fileId 目录ID
* @return 节点数量
*/
public int getChildCount(String fileId){
List<Map> hgwd001List = HGWDTools.HgWd001.queryFileChild(fileId); //查询子级目录
List<String> childIds = Optional.ofNullable(hgwd001List).orElse(new ArrayList<>()).stream().map(o -> o.get("fileId").toString()).collect(Collectors.toList());
public int getChildCount(String fileId, boolean isManager, boolean isSourceAuth,String pageCode) {
List<HGWD001> hgwd001List = HgWdUtils.HgWd001.queryChildren(fileId, isManager, isSourceAuth); //查询子级目录
List<String> childIds = Optional.ofNullable(hgwd001List).orElse(new ArrayList<>()).stream()
.map(HGWD001::getFileId).collect(Collectors.toList());
// 已授权人员信息
List<HGWD003> dbWd003List = HGWDTools.HgWd003.list(childIds);
List<HGWD099> fWd099s = HGWDTools.HgWd099.queryByBiz("WD",childIds);
List<HGWD099> fWd099s = HGWDTools.HgWd099.queryByBiz("WD", childIds, pageCode);
int dbWd099s = fWd099s == null ? 0 : fWd099s.size();
int count = 0;
if (dbWd003List!=null && dbWd003List.size() > 0 && dbWd099s > 0){
if ("HGWD002".equals(pageCode) && dbWd099s == 0){
return 0;
} else if (dbWd003List!=null && dbWd003List.size() > 0 && dbWd099s > 0){
count = 3;
}else if (dbWd003List!=null && dbWd003List.size() > 0){
count = 2;
......
......@@ -17,6 +17,7 @@ import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -78,6 +79,7 @@ public class ServiceHGWD001F extends ServiceEPBase {
hgwd001.fromMap(resultRow);
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
if (wd001 == null){
AssertUtils.isEmpty(Collections.singleton(hgwd001), "项目编号不能为空");
String filePath = setFilePath(hgsc001,edcm01Map.get("app.sc.projectSource"));
hgwd001.setFilePath(filePath+"/"+hgwd001.getFileName());
}else {
......@@ -157,8 +159,8 @@ public class ServiceHGWD001F extends ServiceEPBase {
.filter(map -> !hgwd001.getFileId().equals(map.get(HGWD001.FIELD_FILE_ID)))
.map(map -> map.get(HGWD001.FIELD_FILE_ID).toString()).collect(Collectors.toList());
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD",childFileIdList);
Map<String, List<HGWD099>> listMap = hgwd099List.stream().collect(Collectors.groupingBy(HGWD099::getBizId,Collectors.toList()));
int end = wd001out.getFilePath().length()+1;
Map<String, List<HGWD099>> listMap = Optional.ofNullable(hgwd099List).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(HGWD099::getBizId,Collectors.toList()));
int end =wd001out ==null ? 0: wd001out.getFilePath().length()+1;
if (childList != null && childList.size() > 0) {
for (Map child : childList) {
HGWD001 childOut = new HGWD001();
......
......@@ -3,6 +3,8 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
......@@ -73,9 +75,18 @@ public class ServiceHGWD003A extends ServiceEPBase {
// 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录");
// 确认是否是项目文件
HGSC001 sc001 = HGSCTools.Hgsc001.queryByCode(fileId);
List<Map> mapList =DaoBase.getInstance().query("HGWD001.queryFileChild",new HashMap<String,String>(){{
put("parentId",fileId);
}});
if (sc001 !=null){
//给项目文件添加授权用户
Map<String,String> map = new HashMap<>();
map.put(HGWD001.FIELD_FILE_ID,sc001.getProjCode());
map.put(HGWD001.FIELD_FILE_NAME,sc001.getProjName());
mapList.add(map);
}
List<String> fileIds = mapList.stream().map(map -> MapUtils.getString(map, HGWD001.FIELD_FILE_ID)).collect(Collectors.toList());
List<HGWD003> hgwd003s = HGWDTools.HgWd003.list(fileIds);
// 判断是否是管理员或项目经理
......
......@@ -60,7 +60,7 @@ public class ServiceHGWD003B extends ServiceEPBase {
// 仅查询自己是项目经理的目录
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put("managerUserId", userId);
queryMap.put("projectManagerUserId", userId);
}
inInfo = super.query(inInfo, HGWD001.QUERY, new HGWD001());
} catch (Exception e) {
......
......@@ -11,10 +11,12 @@ import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
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.hggp.util.StringUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -22,10 +24,8 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -62,22 +62,26 @@ public class ServiceHGWD099 extends ServiceEPBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo);
if (ObjectUtils.isNotBlank(queryRow.get(HGWD001.FIELD_PARENT_ID))){
List<Map> childList = HGWDTools.HgWd001.queryFileChild(queryRow.get(HGWD001.FIELD_PARENT_ID).toString());
if(childList == null){
return inInfo;
}
List<String> childFileIdList = Optional.of(childList).orElse(new ArrayList<>()).stream().map(map -> map.get(HGWD001.FIELD_FILE_ID).toString()).collect(Collectors.toList());
queryRow.put("bizIds",childFileIdList);
queryRow.remove(HGWD099.FIELD_BIZ_ID);
inInfo.getBlock(EiConstant.queryBlock).getRow(ACConstants.ROW_CODE_0).remove(HGWD001.FIELD_PARENT_ID);
inInfo = super.query(inInfo, HGWD099.QUERY, new HGWD099());
}
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String parentId = MapUtils.getString(queryRow, HGWD001.FIELD_PARENT_ID);
String projCode = MapUtils.getString(queryRow, HGWD001.FIELD_PROJ_CODE);
if (StringUtils.isBlank(parentId)) {
return inInfo;
}
// 查询子节点
List<HGWD001> children = HgWdUtils.HgWd001.queryChildren(parentId, projCode);
if (CollectionUtils.isEmpty(children)) {
return inInfo;
}
// 需要包含自身
queryRow.put("bizIds", children.stream().map(HGWD001::getFileId).collect(Collectors.toList()));
queryRow.remove(HGWD099.FIELD_BIZ_ID);
inInfo.getBlock(EiConstant.queryBlock).getRow(ACConstants.ROW_CODE_0).remove(HGWD001.FIELD_PARENT_ID);
inInfo = super.query(inInfo, HGWD099.QUERY, new HGWD099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
return inInfo;
}
/**
......
......@@ -32,29 +32,12 @@
<sql id="condition">
AND DELETE_FLAG = 0
<!-- 仅查询审批通过的项目 -->
<include refid="HGXSDataAuth.authCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -82,18 +65,9 @@
<isNotEmpty prepend=" AND " property="fileName">
FILE_NAME LIKE CONCAT('%', #fileName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docVersion">
DOC_VERSION = #docVersion#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="releaseDate">
RELEASE_DATE = #releaseDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath">
FILE_PATH = #filePath#
</isNotEmpty>
......@@ -106,17 +80,27 @@
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="managerUserId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID
AND M.USER_ID = #managerUserId#
<isNotEmpty prepend=" AND " property="projectManagerUserId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.DELETE_FLAG = 0
AND T.FILE_ID = M.FILE_ID AND M.USER_ID = #projectManagerUserId#
AND M.IS_PROJECT_MANAGER = 1
)
)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId" open="(" close=")">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID
AND M.USER_ID = #userId#
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.DELETE_FLAG = 0
AND T.FILE_ID = M.FILE_ID AND M.USER_ID = #userId#
) OR PROJECT_SOURCE = 'spare'
</isNotEmpty>
<isNotEmpty prepend=" AND " property="treeUserId" >
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.DELETE_FLAG = 0
AND M.USER_ID = #treeUserId#
AND FIND_IN_SET(M.FILE_ID, (SELECT ${hggpSchema}.queryWdTreeInfo(T.FILE_ID)))
)
</isNotEmpty>
<!-- 项目状态,2-审核通过 -->
<isNotEmpty prepend=" AND " property="projectStatusYs">
EXISTS (SELECT * FROM ${hggpSchema}.HGSC001 M WHERE T.PROJ_CODE = M.PROJ_CODE AND M.APPROVAL_STATUS = 2)
</isNotEmpty>
</sql>
<sql id="orderBy">
......@@ -145,6 +129,14 @@
<include refid="condition"/>
</select>
<select id="queryProjectSource" resultClass="com.baosight.hggp.hg.wd.domain.HGWD001">
SELECT
DISTINCT PROJECT_SOURCE as "projectSource"
FROM ${hggpSchema}.HGWD001 T
WHERE 1=1
<include refid="condition"/>
</select>
<!-- 更具父级节点统计 -->
<select id="countByParent" resultClass="java.util.HashMap">
SELECT PARENT_ID, COUNT(1) AS CNT
......@@ -344,6 +336,18 @@
order by CREATED_TIME asc
</select>
<!-- 查询字节点,包含自身 -->
<select id="queryChildren" resultClass="com.baosight.hggp.hg.wd.domain.HGWD001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGWD001 T WHERE DELETE_FLAG = 0
AND FIND_IN_SET(FILE_ID, (SELECT ${hggpSchema}.queryWdTreeInfo(#parentId#)))
<isNotEmpty prepend=" AND " property="userId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.DELETE_FLAG = 0
AND M.FILE_ID = T.FILE_ID AND M.USER_ID = #userId#
)
</isNotEmpty>
</select>
<!--档库所有子节点树查询-->
<select id="queryFileChild" resultClass="java.util.HashMap">
SELECT
......
......@@ -229,6 +229,34 @@ public class HGWDTools {
List<Map> results = DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.QUERY_FILE_CHILD, queryMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
/**
* 查询有权限的子节点
*
* @param parentId
* @return
*/
public static List<HGWD001> queryChildrenByUser(String parentId) {
AssertUtils.isEmpty(parentId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
queryMap.put("userId", UserSessionUtils.getUserId());
return DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.QUERY_CHILDREN, queryMap);
}
/**
* 查询所有的子节点
*
* @param parentId
* @return
*/
public static List<HGWD001> queryChildren(String parentId) {
AssertUtils.isEmpty(parentId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
return DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.QUERY_CHILDREN, queryMap);
}
}
......@@ -461,6 +489,20 @@ public class HGWDTools {
return results;
}
public static List<HGWD099> queryByBiz(String bizType, List<String> bizIds,String pageCode) {
if (CollectionUtils.isEmpty(bizIds)){
return null;
}
List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY,
new HashMap<String, Object>() {{
put("bizType", bizType==null?"WD":bizType);
put("status", "HGWD002".equals(pageCode)?1:0);
put("bizIds", bizIds);
}}
);
return results;
}
/**
* @param fileIds
* @return
......
......@@ -9,6 +9,8 @@ import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.StringUtils;
import java.util.List;
/**
* @author:songx
* @date:2024/9/23,14:57
......@@ -27,14 +29,21 @@ public class HgWdUtils {
/**
* 是否备件制造图
*
* @param fileId
* @param treeId
* @return
*/
public static boolean isSpare(String fileId) {
if (StringUtils.isBlank(fileId)) {
return false;
public static boolean isSpare(String treeId) {
if (ProjectSourceEnum.SPARE.getCode().equals(treeId)) {
return true;
}
HGWD001 dbWd001 = HGWDTools.HgWd001.get(fileId);
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(treeId);
if (dbSc001 != null) {
if (StringUtils.isBlank(dbSc001.getProjectSource())) {
return false;
}
return ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
}
HGWD001 dbWd001 = HGWDTools.HgWd001.get(treeId);
if (dbWd001 == null || StringUtils.isBlank(dbWd001.getProjectSource())) {
return false;
}
......@@ -61,6 +70,41 @@ public class HgWdUtils {
}
return ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
}
/**
* 查询子节点
*
* @param parentId
* @param projCode
* @return
*/
public static List<HGWD001> queryChildren(String parentId, String projCode) {
// 管理员或者备件制造图查询所有子节点;其余查询当前节点有权限的子节点
boolean isManager = HgWdUtils.HgWd009.isManager();
boolean isSpare = HgWdUtils.HgWd001.isSpare(parentId, projCode);
if (isManager || isSpare) {
return HGWDTools.HgWd001.queryChildren(parentId);
} else {
return HGWDTools.HgWd001.queryChildrenByUser(parentId);
}
}
/**
* 查询子节点
*
* @param parentId
* @param isManager
* @param isSpare
* @return
*/
public static List<HGWD001> queryChildren(String parentId, boolean isManager, boolean isSpare) {
// 管理员或者备件制造图查询所有子节点;其余查询当前节点有权限的子节点
if (isManager || isSpare) {
return HGWDTools.HgWd001.queryChildren(parentId);
} else {
return HGWDTools.HgWd001.queryChildrenByUser(parentId);
}
}
}
......
$(function() {
// 查询
$("#QUERY").on("click", function () {
query();
});
$("#QUERY").on("click", query);
$("#QUERY_MORE").on("click",function (){
grush.queryMore(68)
})
......@@ -14,17 +13,20 @@ $(function() {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="contractDetailFunc(' + item.id + ')">合同详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="fileDetailFunc(' + item.id + ')">附件详情</a>';
return template;
}
}
],
columns: [{
field: "operator",
title: "操作",
template: function (item) {
if (CommonUtils.isBlank(item.id) || item.id === "0") {
return "";
}
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="contractDetailFunc(' + item.id + ')">合同详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="fileDetailFunc(' + item.id + ')">附件详情</a>';
return template;
}
}],
exportGrid: {
beforeExport: function (gridInstance) {
var validator1 = IPLAT.Validator({
......
......@@ -11,7 +11,7 @@
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="account_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="result" row="0" colWidth="3" filter="contains"
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
......
......@@ -12,7 +12,7 @@
required="true">
<EF:EFOptions blockId="account_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="result" row="0" colWidth="3" filter="contains"
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
......
......@@ -101,7 +101,7 @@ function remove() {
* 导入
*/
let importData = function () {
CommonUtils.importData("HGPZ021", "字段导入", importDataCallback);
CommonUtils.importData("HGPZ021", "页面字段导入", importDataCallback);
}
/**
......
......@@ -7,7 +7,7 @@
<EF:EFPage title="页面字段定义">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="result" row="0" colWidth="3" filter="contains"
<EF:EFSelect ename="tableCode" cname="页面名称" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
......
$(function () {
var projTypeList = __eiInfo.getBlock("proj_type_block_id").getMappedRows();
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
$("#QUERY").on("click", query);
$("#QUERY_MORE").on("click",function (){
grush.queryMore(34)
......@@ -16,6 +14,7 @@ $(function () {
},
columns: [{
field: "projType",
title: "项目性质",
template: function (item) {
let template = "";
if (item.projType && projTypeList && projTypeList.length > 0) {
......@@ -39,13 +38,10 @@ $(function () {
title: "操作",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'onclick="showInfo(' + item.id + ')" >立项详情</a>';
return template;
}
}
],
+ 'onclick="showInfo(' + item.id + ')" >立项详情</a>';
return template;
}
}],
exportGrid: {
beforeExport: function (gridInstance) {
var validator1 = IPLAT.Validator({
......@@ -98,18 +94,18 @@ $(function () {
}
});
$(window).load(function () {
// 查
query();
});
/**
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
resultGrid.dataSource.page(1);
}
$(window).load(function () {
// 查
query();
});
function showInfo(id) {
JSColorbox.open({
href: "HGSC001D?inqu_status-0-id=" + id + "&efParentFormEname=HGSC001",
......
<%@ page import="com.baosight.hggp.hg.pz.utils.HGPZUtils" %>
<%@ page import="com.baosight.hggp.hg.pz.enums.DynamicTableEnum" %>
<%@ page import="java.util.List" %>
<%@ page import="org.apache.commons.collections.CollectionUtils" %>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
......@@ -11,9 +16,14 @@
transition: height 0.5s ease-in-out;
}
</style>
<script>
var ctx = "${ctx}";
</script>
<%
// 查询动态显示列的别名
List<String> dynamicColumnAlias = HGPZUtils.HgPz020.listDynamicColumnAlias(DynamicTableEnum.HGSC001);
// 以#隔开字段别名
request.setAttribute("dynamicColumnAlias", CollectionUtils.isEmpty(dynamicColumnAlias) ? "" :
"#" + String.join("#", dynamicColumnAlias) + "#");
%>
<EF:EFPage title="项目立项">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
......@@ -47,34 +57,47 @@
role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="mixed" isFloat="true" copyToAdd="false" sort="single">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center" sort="false"/>
<%-- <EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="center"/>--%>
<%-- <EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"/>--%>
<%-- <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="center"/>--%>
<%-- <EF:EFColumn ename="subcontractName" cname="分包方" enable="false" width="120" align="center"/>--%>
<%-- <EF:EFColumn ename="genralContractName" cname="总包方" enable="false" width="120" align="center"/>--%>
<EF:EFComboColumn ename="branchUnit" cname="分支单位" enable="false" width="130" align="left"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" required="true"
filter="contains" sort="true">
<EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<%-- <EF:EFColumn ename="projType" cname="项目性质" enable="false" width="120" align="center"/>--%>
<%-- <EF:EFColumn ename="permissStartDate" cname="准许开工日期" enable="false" width="120" align="center"/>--%>
<%-- <EF:EFColumn ename="startDate" cname="开工日期" enable="false" width="120" align="center"/>--%>
<%-- <EF:EFColumn ename="endDate" cname="完工日期" enable="false" width="120" align="center"/>--%>
<EF:EFComboColumn ename="projStatus" cname="项目状态" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hggp.projStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="approvalStatus" cname="提交状态" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hggp.commitStatus"/>
</EF:EFComboColumn>
<EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" autoBind="false" copyToAdd="false" sort="single"
height="69vh">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"
sort="false"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#companyName#')? false: true}"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#projCode#')? false: true}"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#projName#')? false: true}"/>
<EF:EFColumn ename="subcontractName" cname="分包方" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#subcontractName#')? false: true}"/>
<EF:EFColumn ename="genralContractName" cname="总包方" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#genralContractName#')? false: true}"/>
<EF:EFComboColumn ename="branchUnit" cname="分支单位" enable="false" width="130" align="left"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" maxLength="16" required="true"
filter="contains" sort="true"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#branchUnit#')? false: true}">
<EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="projType" cname="项目性质" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#projType#')? false: true}"/>
<EF:EFColumn ename="permissStartDate" cname="准许开工日期" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#permissStartDate#')? false: true}"/>
<EF:EFColumn ename="startDate" cname="开工日期" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#startDate#')? false: true}"/>
<EF:EFColumn ename="endDate" cname="完工日期" enable="false" width="120" align="center"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#endDate#')? false: true}"/>
<EF:EFComboColumn ename="projStatus" cname="项目状态" width="100" align="center" required="true"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#projStatus#')? false: true}"
readonly="true">
<EF:EFCodeOption codeName="hggp.projStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="approvalStatus" cname="提交状态" width="100" align="center" required="true"
hidden="${fn:contains(requestScope.dynamicColumnAlias, '#approvalStatus#')? false: true}"
readonly="true">
<EF:EFCodeOption codeName="hggp.commitStatus"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -903,7 +903,7 @@ let showAuthButton = function () {
return
}
// 0:不授权
if (isAuth === 0) {
if (isAuth === "0") {
notAuthShowButton();
} else {
isProjectManager(parentId);
......
......@@ -98,6 +98,7 @@ $(function () {
// 设置选中节点
treeSelectClick(model);
inInfo.set("inqu_status-0-projCode", $("#inqu_status-0-projCode").val());
inInfo.set("inqu_status-0-pageCode","HGWD002");
return inInfo;
},
select: function (e) {
......
......@@ -745,9 +745,9 @@ function loadChange(grid,e,field) {
* @param value
* @returns {boolean}
*/
function isBlank(data) {
return data == null || data === undefined || data === 'null' || $.trim(data) === '' ||
data === 'undefined' || data === 'unknown';
function isBlank(value) {
return value == null || value === 'null' || $.trim(value) === ''
|| value === 'undefined' || value === 'unknown';
}
/**
......
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