Commit 55456451 by 宋祥

1.备件制造图状态调整

parent 190897f0
......@@ -7,7 +7,6 @@ import com.baosight.hggp.core.tools.CodeValueTools;
import com.baosight.hggp.hg.constant.HGConstant;
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;
......@@ -294,36 +293,31 @@ public class ServiceHGWD001D extends TreeService {
// SPARE:备件制造图不限制;非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
boolean isManager = HgWdUtils.HgWd009.isManager(userId);
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId);
boolean isSpare = HgWdUtils.HgWd001.isSpare(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);
if (isSourceAuth && !isManager) {
if (!isSpare && !isManager) {
queryMap.put("userId", userId);
}
List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap);
if (CollectionUtils.isEmpty(dbSc001s)) {
return results;
}
//List<String> projCodes = dbSc001s.stream().map(HGSC001::getProjCode).distinct().collect(Collectors.toList());
//List<HGWD003> hgwd003s = HGWDTools.HgWd003.list(projCodes);
for (HGSC001 dbSc001 : dbSc001s) {
String text = dbSc001.getProjName() + "(" + dbSc001.getProjCode() + ")";
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P);
int count = getChildCount(dbSc001.getProjCode(), isManager, isSourceAuth, null);
//Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbSc001.getProjCode())).count();
int count = getChildCount(dbSc001.getProjCode(), isManager, isSpare, null);
leafMap.put("projCode", dbSc001.getProjCode());
leafMap.put("projName", dbSc001.getProjName());
leafMap.put("ename", dbSc001.getProjCode());
leafMap.put("type", "1");
leafMap.put("leafLevel", "0");
leafMap.put("count", count);
leafMap.put("isAuth", isSourceAuth ? "1" : "0");
leafMap.put("filePath", ProjectSourceEnum.getByCode(parentId).getName()+"/"+text);
leafMap.put("isAuth", isSpare ? "0" : "1");
leafMap.put("filePath", ProjectSourceEnum.getByCode(parentId).getName() + "/" + text);
results.add(leafMap);
}
// 设置叶子节点
......@@ -342,17 +336,15 @@ public class ServiceHGWD001D extends TreeService {
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:需要权限
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
// 查询项目来源,备件制造图不需要授权
boolean isSpare = HgWdUtils.HgWd001.isSpare(parentId, projCode);
// 是否文档管理员
boolean isManager = HgWdUtils.HgWd009.isManager();
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
queryMap.put("ename", ename);
// 递归查询有权限的文件夹,管理员和备件制造图不限制
if (!isManager && isSourceAuth) {
if (!isManager && !isSpare) {
queryMap.put("treeUserId", userId);
}
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
......@@ -364,7 +356,7 @@ public class ServiceHGWD001D extends TreeService {
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(), isManager, isSourceAuth, pageCode);
int count = getChildCount(dbWd001.getFileId(), isManager, isSpare, pageCode);
leafMap.put("projCode", dbWd001.getProjCode());
leafMap.put("projName", dbWd001.getProjName());
leafMap.put("ename", dbWd001.getProjCode());
......@@ -375,7 +367,7 @@ public class ServiceHGWD001D extends TreeService {
if ("HGWD002".equals(pageCode) && count == 0) {
continue;
}
if (!isManager && isSourceAuth) {
if (!isManager && !isSpare) {
leafMap.put("isAuth", "1");
// 从已授权的信息中查找出自己
HGWD003 dbWd003 = dbWd003s == null ? null : dbWd003s.stream().filter(item
......@@ -434,11 +426,11 @@ public class ServiceHGWD001D extends TreeService {
/**
* 获取子级节点数量
* @param fileId 目录ID
* @param isSourceAuth true:需要权限
* @param isSpare true:备件制造图
* @return 节点数量
*/
public int getChildCount(String fileId, boolean isManager, boolean isSourceAuth, String pageCode) {
List<HGWD001> hgwd001List = HgWdUtils.HgWd001.queryChildren(fileId, isManager, isSourceAuth); //查询子级目录
public int getChildCount(String fileId, boolean isManager, boolean isSpare, String pageCode) {
List<HGWD001> hgwd001List = HgWdUtils.HgWd001.queryChildren(fileId, isManager, isSpare); //查询子级目录
List<String> childIds = Optional.ofNullable(hgwd001List).orElse(new ArrayList<>()).stream()
.map(HGWD001::getFileId).collect(Collectors.toList());
// 已授权人员信息
......@@ -446,13 +438,13 @@ public class ServiceHGWD001D extends TreeService {
List<HGWD099> fWd099s = HGWDTools.HgWd099.queryByBiz("WD", childIds, pageCode);
int dbWd099s = fWd099s == null ? 0 : fWd099s.size();
int count = 0;
if ("HGWD002".equals(pageCode) && dbWd099s == 0){
if ("HGWD002".equals(pageCode) && dbWd099s == 0) {
return 0;
} else if (dbWd003List!=null && dbWd003List.size() > 0 && dbWd099s > 0){
} else if (dbWd003List != null && !dbWd003List.isEmpty() && dbWd099s > 0) {
count = 3;
}else if (dbWd003List!=null && dbWd003List.size() > 0){
} else if (dbWd003List != null && !dbWd003List.isEmpty()) {
count = 2;
}else if (dbWd099s > 0){
} else if (dbWd099s > 0) {
count = 1;
}
return count;
......
......@@ -94,12 +94,12 @@ public class HgWdUtils {
*
* @param parentId
* @param isManager true:管理员
* @param isSourceAuth true:需要权限
* @param isSpare true:备件制造图
* @return
*/
public static List<HGWD001> queryChildren(String parentId, boolean isManager, boolean isSourceAuth) {
public static List<HGWD001> queryChildren(String parentId, boolean isManager, boolean isSpare) {
// 管理员或者备件制造图查询所有子节点;其余查询当前节点有权限的子节点
if (isManager || !isSourceAuth) {
if (isManager || isSpare) {
return HGWDTools.HgWd001.queryChildren(parentId);
} else {
return HGWDTools.HgWd001.queryChildrenByUser(parentId);
......@@ -107,7 +107,6 @@ public class HgWdUtils {
}
}
/**
* @author:songx
* @date:2024/8/19,14:57
......
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