Commit 31695a03 by 宋祥

Merge branch 'dev-sx' of http://129.211.46.84:8800/platform/hg-smart into dev

parents ea2ed0fd 652ff1db
...@@ -7,7 +7,6 @@ import com.baosight.hggp.core.tools.CodeValueTools; ...@@ -7,7 +7,6 @@ import com.baosight.hggp.core.tools.CodeValueTools;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001; 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.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.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
...@@ -294,36 +293,31 @@ public class ServiceHGWD001D extends TreeService { ...@@ -294,36 +293,31 @@ public class ServiceHGWD001D extends TreeService {
// SPARE:备件制造图不限制;非管理员仅查询自己有权限的项目 // SPARE:备件制造图不限制;非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
boolean isManager = HgWdUtils.HgWd009.isManager(userId); boolean isManager = HgWdUtils.HgWd009.isManager(userId);
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId); boolean isSpare = HgWdUtils.HgWd001.isSpare(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);
queryMap.put(HGSC001.FIELD_project_source, parentId); queryMap.put(HGSC001.FIELD_project_source, parentId);
queryMap.put(HGSC001.FIELD_approval_status, HGConstant.ApprovalStatus.YS); queryMap.put(HGSC001.FIELD_approval_status, HGConstant.ApprovalStatus.YS);
if (isSourceAuth && !isManager) { if (!isSpare && !isManager) {
queryMap.put("userId", userId); queryMap.put("userId", userId);
} }
List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap); List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap);
if (CollectionUtils.isEmpty(dbSc001s)) { if (CollectionUtils.isEmpty(dbSc001s)) {
return results; 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) { for (HGSC001 dbSc001 : dbSc001s) {
String text = dbSc001.getProjName() + "(" + dbSc001.getProjCode() + ")"; String text = dbSc001.getProjName() + "(" + dbSc001.getProjCode() + ")";
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P); Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P);
int count = getChildCount(dbSc001.getProjCode(), isManager, isSpare, null);
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()); leafMap.put("projCode", dbSc001.getProjCode());
leafMap.put("projName", dbSc001.getProjName()); leafMap.put("projName", dbSc001.getProjName());
leafMap.put("ename", dbSc001.getProjCode()); leafMap.put("ename", dbSc001.getProjCode());
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", isSourceAuth ? "1" : "0"); leafMap.put("isAuth", isSpare ? "0" : "1");
leafMap.put("filePath", ProjectSourceEnum.getByCode(parentId).getName()+"/"+text); leafMap.put("filePath", ProjectSourceEnum.getByCode(parentId).getName() + "/" + text);
results.add(leafMap); results.add(leafMap);
} }
// 设置叶子节点 // 设置叶子节点
...@@ -342,17 +336,15 @@ public class ServiceHGWD001D extends TreeService { ...@@ -342,17 +336,15 @@ public class ServiceHGWD001D extends TreeService {
public List queryChildNode(String projCode, String parentId, String ename, String pageCode) { public List queryChildNode(String projCode, String parentId, String ename, String pageCode) {
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
// 查询项目来源 // 查询项目来源,备件制造图不需要授权
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode); boolean isSpare = HgWdUtils.HgWd001.isSpare(parentId, projCode);
// 备件制造图不需要授权,true:需要权限
boolean isSourceAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
// 是否文档管理员 // 是否文档管理员
boolean isManager = HgWdUtils.HgWd009.isManager(); 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) { if (!isManager && !isSpare) {
queryMap.put("treeUserId", userId); queryMap.put("treeUserId", userId);
} }
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap); List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
...@@ -364,7 +356,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -364,7 +356,7 @@ public class ServiceHGWD001D extends TreeService {
List<HGWD003> dbWd003s = HGWDTools.HgWd003.list(fileIds); List<HGWD003> dbWd003s = HGWDTools.HgWd003.list(fileIds);
for (HGWD001 dbWd001 : dbWd001s) { for (HGWD001 dbWd001 : dbWd001s) {
Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C); 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("projCode", dbWd001.getProjCode());
leafMap.put("projName", dbWd001.getProjName()); leafMap.put("projName", dbWd001.getProjName());
leafMap.put("ename", dbWd001.getProjCode()); leafMap.put("ename", dbWd001.getProjCode());
...@@ -375,7 +367,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -375,7 +367,7 @@ public class ServiceHGWD001D extends TreeService {
if ("HGWD002".equals(pageCode) && count == 0) { if ("HGWD002".equals(pageCode) && count == 0) {
continue; continue;
} }
if (!isManager && isSourceAuth) { if (!isManager && !isSpare) {
leafMap.put("isAuth", "1"); leafMap.put("isAuth", "1");
// 从已授权的信息中查找出自己 // 从已授权的信息中查找出自己
HGWD003 dbWd003 = dbWd003s == null ? null : dbWd003s.stream().filter(item HGWD003 dbWd003 = dbWd003s == null ? null : dbWd003s.stream().filter(item
...@@ -434,11 +426,11 @@ public class ServiceHGWD001D extends TreeService { ...@@ -434,11 +426,11 @@ public class ServiceHGWD001D extends TreeService {
/** /**
* 获取子级节点数量 * 获取子级节点数量
* @param fileId 目录ID * @param fileId 目录ID
* @param isSourceAuth true:需要权限 * @param isSpare true:备件制造图
* @return 节点数量 * @return 节点数量
*/ */
public int getChildCount(String fileId, boolean isManager, boolean isSourceAuth, String pageCode) { public int getChildCount(String fileId, boolean isManager, boolean isSpare, String pageCode) {
List<HGWD001> hgwd001List = HgWdUtils.HgWd001.queryChildren(fileId, isManager, isSourceAuth); //查询子级目录 List<HGWD001> hgwd001List = HgWdUtils.HgWd001.queryChildren(fileId, isManager, isSpare); //查询子级目录
List<String> childIds = Optional.ofNullable(hgwd001List).orElse(new ArrayList<>()).stream() List<String> childIds = Optional.ofNullable(hgwd001List).orElse(new ArrayList<>()).stream()
.map(HGWD001::getFileId).collect(Collectors.toList()); .map(HGWD001::getFileId).collect(Collectors.toList());
// 已授权人员信息 // 已授权人员信息
...@@ -446,13 +438,13 @@ public class ServiceHGWD001D extends TreeService { ...@@ -446,13 +438,13 @@ public class ServiceHGWD001D extends TreeService {
List<HGWD099> fWd099s = HGWDTools.HgWd099.queryByBiz("WD", childIds, pageCode); List<HGWD099> fWd099s = HGWDTools.HgWd099.queryByBiz("WD", childIds, pageCode);
int dbWd099s = fWd099s == null ? 0 : fWd099s.size(); int dbWd099s = fWd099s == null ? 0 : fWd099s.size();
int count = 0; int count = 0;
if ("HGWD002".equals(pageCode) && dbWd099s == 0){ if ("HGWD002".equals(pageCode) && dbWd099s == 0) {
return 0; return 0;
} else if (dbWd003List!=null && dbWd003List.size() > 0 && dbWd099s > 0){ } else if (dbWd003List != null && !dbWd003List.isEmpty() && dbWd099s > 0) {
count = 3; count = 3;
}else if (dbWd003List!=null && dbWd003List.size() > 0){ } else if (dbWd003List != null && !dbWd003List.isEmpty()) {
count = 2; count = 2;
}else if (dbWd099s > 0){ } else if (dbWd099s > 0) {
count = 1; count = 1;
} }
return count; return count;
......
...@@ -94,12 +94,12 @@ public class HgWdUtils { ...@@ -94,12 +94,12 @@ public class HgWdUtils {
* *
* @param parentId * @param parentId
* @param isManager true:管理员 * @param isManager true:管理员
* @param isSourceAuth true:需要权限 * @param isSpare true:备件制造图
* @return * @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); return HGWDTools.HgWd001.queryChildren(parentId);
} else { } else {
return HGWDTools.HgWd001.queryChildrenByUser(parentId); return HGWDTools.HgWd001.queryChildrenByUser(parentId);
...@@ -107,7 +107,6 @@ public class HgWdUtils { ...@@ -107,7 +107,6 @@ public class HgWdUtils {
} }
} }
/** /**
* @author:songx * @author:songx
* @date:2024/8/19,14:57 * @date:2024/8/19,14:57
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="180" align="left" <EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="180" align="left"
alias="a.fieldCode"/> alias="a.fieldCode"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left" sort="false"/> <EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left" sort="false"/>
<EF:EFColumn ename="viewSql" cname="视图语句" enable="false" width="200" align="left" sort="false"/>
<EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left" sort="false"/> <EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left" sort="false"/>
<EF:EFColumn ename="sortNum" cname="排序" width="100" align="center" required="true" alias="a.sortNum"/> <EF:EFColumn ename="sortNum" cname="排序" width="100" align="center" required="true" alias="a.sortNum"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" align="center" sort="false"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" align="center" sort="false"/>
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<EF:EFColumn ename="tableName" cname="页面中文名" enable="false" width="140" align="left"/> <EF:EFColumn ename="tableName" cname="页面中文名" enable="false" width="140" align="left"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="160" align="left"/> <EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left"/> <EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left"/>
<EF:EFColumn ename="viewSql" cname="视图语句" enable="false" width="200" align="left"/>
<EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left"/> <EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="sortNum" cname="排序" enable="false" width="80" align="center"/> <EF:EFColumn ename="sortNum" cname="排序" enable="false" width="80" align="center"/>
</EF:EFGrid> </EF:EFGrid>
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
<EF:EFColumn ename="tableName" cname="页面中文名" enable="false" width="140" align="left" sort="false"/> <EF:EFColumn ename="tableName" cname="页面中文名" enable="false" width="140" align="left" sort="false"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="180" align="left"/> <EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="180" align="left"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left" sort="false"/> <EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left" sort="false"/>
<EF:EFColumn ename="viewSql" cname="视图SQL" enable="false" width="200" align="left" sort="false"/>
<EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left" sort="false"/> <EF:EFColumn ename="aliasName" cname="字段别名" enable="false" width="160" align="left" sort="false"/>
<EF:EFColumn ename="sortNum" cname="排序" width="80" align="center" required="true"/> <EF:EFColumn ename="sortNum" cname="排序" width="80" align="center" required="true"/>
<EF:EFComboColumn ename="isDefault" cname="是否默认" width="100" align="center" copy="true" required="true" <EF:EFComboColumn ename="isDefault" cname="是否默认" width="100" align="center" copy="true" required="true"
......
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
required="true"/> required="true"/>
</div> </div>
<div class="row"> <div class="row">
<EF:EFInput ename="viewSql" cname="视图语句" blockId="result" row="0" colWidth="6" ratio="2:10"/>
</div>
<div class="row">
<EF:EFInput ename="aliasName" cname="别名" blockId="result" row="0" colWidth="6" ratio="2:10" <EF:EFInput ename="aliasName" cname="别名" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true"/> required="true"/>
</div> </div>
......
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