Commit 3aafdb98 by 宋祥

1.目录树仅显示有权限和有文件的目录

parent 2ae78552
...@@ -7,7 +7,7 @@ package com.baosight.hggp.hg.sc.enums; ...@@ -7,7 +7,7 @@ package com.baosight.hggp.hg.sc.enums;
public enum ProjectSourceEnum { public enum ProjectSourceEnum {
ENGINEERING("engineering", "工程设计图"), ENGINEERING("engineering", "工程设计图"),
FOREIGN("foreign", "生产制造图"), FOREIGN("foreign", "工程制造图"),
SPARE("spare", "备件制造图"), SPARE("spare", "备件制造图"),
OTHER("other", "其他"), OTHER("other", "其他"),
; ;
......
...@@ -26,6 +26,10 @@ public class HgWdSqlConstant { ...@@ -26,6 +26,10 @@ public class HgWdSqlConstant {
public static final String QUERY_ALL = "HGWD001.queryAll"; public static final String QUERY_ALL = "HGWD001.queryAll";
// 查询子节点 // 查询子节点
public static final String QUERY_FILE_CHILD = "HGWD001.queryFileChild"; 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"; public static final String UPDATE_FILE_PATH = "HGWD001.updateFilePath";
} }
......
...@@ -9,6 +9,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC001; ...@@ -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.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant; 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.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099; import com.baosight.hggp.hg.wd.domain.HGWD099;
...@@ -241,25 +242,46 @@ public class ServiceHGWD001D extends TreeService { ...@@ -241,25 +242,46 @@ public class ServiceHGWD001D extends TreeService {
*/ */
public List queryTopNode(String parentId) { public List queryTopNode(String parentId) {
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
// 管理员不做限制
boolean isManager = HgWdUtils.HgWd009.isManager();
List<String> projectSources = isManager ? null : listTopNode();
// 项目来源小代码
List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projectSource"); List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projectSource");
if (CollectionUtils.isEmpty(codesetMaps)) {
return results;
}
for (Map codesetMap : codesetMaps) { for (Map codesetMap : codesetMaps) {
String label = MapUtils.getString(codesetMap, "value"); String id = MapUtils.getString(codesetMap, "value");
String text = MapUtils.getString(codesetMap, "label"); 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("type", "-1");
leafMap.put("leafLevel", "-1"); leafMap.put("leafLevel", "-1");
leafMap.put("filePath", text); leafMap.put("filePath", text);
leafMap.put("leaf", 0);
results.add(leafMap); results.add(leafMap);
} }
// 设置叶子节点
setTreeNodeLeaf(results, true);
return results; 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 * @param parentId
...@@ -267,7 +289,8 @@ public class ServiceHGWD001D extends TreeService { ...@@ -267,7 +289,8 @@ public class ServiceHGWD001D extends TreeService {
* @return * @return
*/ */
public List queryFirstNode(String parentId, String ename) { public List queryFirstNode(String parentId, String ename) {
boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId); // SPARE:备件制造图不限制
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId);
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
Map queryMap = new HashMap<>(); Map queryMap = new HashMap<>();
queryMap.put("ename", ename); queryMap.put("ename", ename);
...@@ -275,7 +298,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -275,7 +298,7 @@ public class ServiceHGWD001D extends TreeService {
queryMap.put(HGSC001.FIELD_approval_status, HGConstant.ApprovalStatus.YS); queryMap.put(HGSC001.FIELD_approval_status, HGConstant.ApprovalStatus.YS);
// 非管理员仅查询自己有权限的项目 // 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
if (isAuth && !HgWdUtils.HgWd009.isManager(userId)) { if (isSourceAuth && !HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put("userId", userId); queryMap.put("userId", userId);
} }
List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap); List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap);
...@@ -295,7 +318,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -295,7 +318,7 @@ public class ServiceHGWD001D extends TreeService {
leafMap.put("type", "1"); leafMap.put("type", "1");
leafMap.put("leafLevel", "0"); leafMap.put("leafLevel", "0");
leafMap.put("count", count); leafMap.put("count", count);
leafMap.put("isAuth", isAuth ? "1" : "0"); leafMap.put("isAuth", isSourceAuth ? "1" : "0");
leafMap.put("filePath", ProjectSourceEnum.getByCode(parentId).getName()+"/"+text); leafMap.put("filePath", ProjectSourceEnum.getByCode(parentId).getName()+"/"+text);
results.add(leafMap); results.add(leafMap);
} }
...@@ -319,30 +342,36 @@ public class ServiceHGWD001D extends TreeService { ...@@ -319,30 +342,36 @@ public class ServiceHGWD001D extends TreeService {
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode); HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode);
// true:需要权限 // true:需要权限
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource()); boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
// 是否文档管理员
boolean isManager = HgWdUtils.HgWd009.isManager();
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("parentId", parentId); queryMap.put("parentId", parentId);
queryMap.put("ename", ename); queryMap.put("ename", ename);
// 递归查询有权限的文件夹,管理员和备件制造图不限制
if (!isManager && isSourceAuth) {
queryMap.put("treeUserId", userId);
}
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap); List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) { if (CollectionUtils.isEmpty(dbWd001s)) {
return results; return results;
} }
// 是否文档管理员
boolean isManager = HgWdUtils.HgWd009.isManager();
List<String> fileIds = dbWd001s.stream().map(HGWD001::getFileId).distinct().collect(Collectors.toList()); List<String> fileIds = dbWd001s.stream().map(HGWD001::getFileId).distinct().collect(Collectors.toList());
// 查询目录授权人数 // 查询目录授权人数
Map<String, List<HGWD003>> dbWd003Map = HGWDTools.HgWd003.map(fileIds); Map<String, List<HGWD003>> dbWd003Map = HGWDTools.HgWd003.map(fileIds);
// 查询目录下下的文件列表
Map<String, List<HGWD099>> fWd099s = HGWDTools.HgWd099.map(fileIds); Map<String, List<HGWD099>> fWd099s = HGWDTools.HgWd099.map(fileIds);
for (HGWD001 dbWd001 : dbWd001s) { for (HGWD001 dbWd001 : dbWd001s) {
Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C); String fileId = dbWd001.getFileId();
Map leafMap = buildLeaf(parentId, fileId, dbWd001.getFileName(), HgWdConstant.LeafType.C);
// 已授权人员信息 // 已授权人员信息
List<HGWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(dbWd001.getFileId()); List<HGWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(fileId);
int dbWd099s = fWd099s.get(dbWd001.getFileId()) == null ? 0 : fWd099s.get(dbWd001.getFileId()).size(); int dbWd099Count = fWd099s == null || fWd099s.get(fileId) == null ? 0 : fWd099s.get(fileId).size();
int count = 0; int count = 0;
if (dbWd003s!=null && dbWd003s.size() > 0 && dbWd099s > 0){ if (dbWd003s != null && dbWd003s.size() > 0 && dbWd099Count > 0) {
count = 3; count = 3;
}else if (dbWd003s!=null && dbWd003s.size() > 0){ } else if (dbWd003s != null && dbWd003s.size() > 0) {
count = 2; count = 2;
}else if (dbWd099s > 0){ } else if (dbWd099Count > 0) {
count = 1; count = 1;
} }
leafMap.put("projCode", dbWd001.getProjCode()); leafMap.put("projCode", dbWd001.getProjCode());
......
...@@ -60,7 +60,7 @@ public class ServiceHGWD003B extends ServiceEPBase { ...@@ -60,7 +60,7 @@ public class ServiceHGWD003B extends ServiceEPBase {
// 仅查询自己是项目经理的目录 // 仅查询自己是项目经理的目录
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) { if (!HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put("managerUserId", userId); queryMap.put("projectManagerUserId", userId);
} }
inInfo = super.query(inInfo, HGWD001.QUERY, new HGWD001()); inInfo = super.query(inInfo, HGWD001.QUERY, new HGWD001());
} catch (Exception e) { } catch (Exception e) {
......
...@@ -11,10 +11,12 @@ import com.baosight.hggp.hg.wd.domain.HGWD001A; ...@@ -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.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099; import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools; 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.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -22,10 +24,8 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -22,10 +24,8 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -62,19 +62,26 @@ public class ServiceHGWD099 extends ServiceEPBase { ...@@ -62,19 +62,26 @@ public class ServiceHGWD099 extends ServiceEPBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
if (ObjectUtils.isNotBlank(queryRow.get(HGWD001.FIELD_PARENT_ID))){ String parentId = MapUtils.getString(queryRow, HGWD001.FIELD_PARENT_ID);
List<Map> childList = HGWDTools.HgWd001.queryFileChild(queryRow.get(HGWD001.FIELD_PARENT_ID).toString()); String projCode = MapUtils.getString(queryRow, HGWD001.FIELD_PROJ_CODE);
List<String> childFileIdList = Optional.ofNullable(childList).orElse(new ArrayList<>()).stream().map(map -> map.get(HGWD001.FIELD_FILE_ID).toString()).collect(Collectors.toList()); if (StringUtils.isBlank(parentId)) {
queryRow.put("bizIds",childFileIdList); return inInfo;
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()); 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) { } catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
return inInfo; return inInfo;
} }
/** /**
......
...@@ -32,29 +32,12 @@ ...@@ -32,29 +32,12 @@
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<!-- 仅查询审批通过的项目 -->
<include refid="HGXSDataAuth.authCondition"/> <include refid="HGXSDataAuth.authCondition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -82,18 +65,9 @@ ...@@ -82,18 +65,9 @@
<isNotEmpty prepend=" AND " property="fileName"> <isNotEmpty prepend=" AND " property="fileName">
FILE_NAME LIKE CONCAT('%', #fileName#, '%') FILE_NAME LIKE CONCAT('%', #fileName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="docVersion">
DOC_VERSION = #docVersion#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="releaseDate">
RELEASE_DATE = #releaseDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath"> <isNotEmpty prepend=" AND " property="filePath">
FILE_PATH = #filePath# FILE_PATH = #filePath#
</isNotEmpty> </isNotEmpty>
...@@ -106,17 +80,27 @@ ...@@ -106,17 +80,27 @@
<isNotEmpty prepend=" AND " property="parentIds"> <isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate> PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="managerUserId"> <isNotEmpty prepend=" AND " property="projectManagerUserId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.DELETE_FLAG = 0
AND M.USER_ID = #managerUserId# AND T.FILE_ID = M.FILE_ID AND M.USER_ID = #projectManagerUserId#
AND M.IS_PROJECT_MANAGER = 1 AND M.IS_PROJECT_MANAGER = 1
) )
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="userId" open="(" close=")"> <isNotEmpty prepend=" AND " property="userId" open="(" close=")">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.DELETE_FLAG = 0
AND M.USER_ID = #userId# AND T.FILE_ID = M.FILE_ID AND M.USER_ID = #userId#
) OR PROJECT_SOURCE = 'spare' ) OR PROJECT_SOURCE = 'spare'
</isNotEmpty> </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>
<sql id="orderBy"> <sql id="orderBy">
...@@ -145,6 +129,14 @@ ...@@ -145,6 +129,14 @@
<include refid="condition"/> <include refid="condition"/>
</select> </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 id="countByParent" resultClass="java.util.HashMap">
SELECT PARENT_ID, COUNT(1) AS CNT SELECT PARENT_ID, COUNT(1) AS CNT
...@@ -344,6 +336,18 @@ ...@@ -344,6 +336,18 @@
order by CREATED_TIME asc order by CREATED_TIME asc
</select> </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 id="queryFileChild" resultClass="java.util.HashMap">
SELECT SELECT
......
...@@ -229,6 +229,34 @@ public class HGWDTools { ...@@ -229,6 +229,34 @@ public class HGWDTools {
List<Map> results = DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.QUERY_FILE_CHILD, queryMap); List<Map> results = DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.QUERY_FILE_CHILD, queryMap);
return CollectionUtils.isEmpty(results) ? null : results; 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);
}
} }
......
...@@ -9,6 +9,8 @@ import com.baosight.hggp.hg.wd.domain.HGWD003; ...@@ -9,6 +9,8 @@ import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import java.util.List;
/** /**
* @author:songx * @author:songx
* @date:2024/9/23,14:57 * @date:2024/9/23,14:57
...@@ -27,14 +29,21 @@ public class HgWdUtils { ...@@ -27,14 +29,21 @@ public class HgWdUtils {
/** /**
* 是否备件制造图 * 是否备件制造图
* *
* @param fileId * @param treeId
* @return * @return
*/ */
public static boolean isSpare(String fileId) { public static boolean isSpare(String treeId) {
if (StringUtils.isBlank(fileId)) { if (ProjectSourceEnum.SPARE.getCode().equals(treeId)) {
return false; 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())) { if (dbWd001 == null || StringUtils.isBlank(dbWd001.getProjectSource())) {
return false; return false;
} }
...@@ -61,6 +70,24 @@ public class HgWdUtils { ...@@ -61,6 +70,24 @@ public class HgWdUtils {
} }
return ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource()); 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);
}
}
} }
......
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