Commit adce8e92 by 宋祥

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

# Conflicts:
#	src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD001D.java
#	src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD099.java
parents 3aafdb98 04a78cfb
...@@ -305,12 +305,14 @@ public class ServiceHGWD001D extends TreeService { ...@@ -305,12 +305,14 @@ public class ServiceHGWD001D extends TreeService {
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<String> projCodes = dbSc001s.stream().map(HGSC001::getProjCode).distinct().collect(Collectors.toList());
List<HGWD003> hgwd003s = HGWDTools.HgWd003.list(projCodes); //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);
Long count = hgwd003s.stream().filter(hgwd003 -> hgwd003.getFileId().equals(dbSc001.getProjCode())).count();
int count = getChildCount(dbSc001.getProjCode());
//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());
...@@ -357,23 +359,11 @@ public class ServiceHGWD001D extends TreeService { ...@@ -357,23 +359,11 @@ public class ServiceHGWD001D extends TreeService {
} }
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); List<HGWD003> dbWd003s = HGWDTools.HgWd003.list(fileIds);
// 查询目录下下的文件列表
Map<String, List<HGWD099>> fWd099s = HGWDTools.HgWd099.map(fileIds);
for (HGWD001 dbWd001 : dbWd001s) { for (HGWD001 dbWd001 : dbWd001s) {
String fileId = dbWd001.getFileId(); Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C);
Map leafMap = buildLeaf(parentId, fileId, dbWd001.getFileName(), HgWdConstant.LeafType.C);
// 已授权人员信息 int count = getChildCount(dbWd001.getFileId());
List<HGWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(fileId);
int dbWd099Count = fWd099s == null || fWd099s.get(fileId) == null ? 0 : fWd099s.get(fileId).size();
int count = 0;
if (dbWd003s != null && dbWd003s.size() > 0 && dbWd099Count > 0) {
count = 3;
} else if (dbWd003s != null && dbWd003s.size() > 0) {
count = 2;
} else if (dbWd099Count > 0) {
count = 1;
}
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());
...@@ -436,4 +426,27 @@ public class ServiceHGWD001D extends TreeService { ...@@ -436,4 +426,27 @@ public class ServiceHGWD001D extends TreeService {
leafMap.put("leafType", leafType); leafMap.put("leafType", leafType);
return leafMap; return leafMap;
} }
/**
* 获取子级节点数量
* @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());
// 已授权人员信息
List<HGWD003> dbWd003List = HGWDTools.HgWd003.list(childIds);
List<HGWD099> fWd099s = HGWDTools.HgWd099.queryByBiz("WD",childIds);
int dbWd099s = fWd099s == null ? 0 : fWd099s.size();
int count = 0;
if (dbWd003List!=null && dbWd003List.size() > 0 && dbWd099s > 0){
count = 3;
}else if (dbWd003List!=null && dbWd003List.size() > 0){
count = 2;
}else if (dbWd099s > 0){
count = 1;
}
return count;
}
} }
...@@ -322,7 +322,9 @@ public class HGWDTools { ...@@ -322,7 +322,9 @@ public class HGWDTools {
* @return * @return
*/ */
public static List<HGWD003> list(List<String> fileIds) { public static List<HGWD003> list(List<String> fileIds) {
AssertUtils.isEmpty(fileIds, "文件ID不能为空"); if (CollectionUtils.isEmpty(fileIds)){
return null;
}
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("fileIds", fileIds); queryMap.put("fileIds", fileIds);
return DaoBase.getInstance().query(HGWD003.QUERY, queryMap); return DaoBase.getInstance().query(HGWD003.QUERY, queryMap);
...@@ -475,12 +477,12 @@ public class HGWDTools { ...@@ -475,12 +477,12 @@ public class HGWDTools {
} }
public static List<HGWD099> queryByBiz(String bizType, List<String> bizIds) { public static List<HGWD099> queryByBiz(String bizType, List<String> bizIds) {
AssertUtils.isNull(bizType, "业务类型不能为空!"); if (CollectionUtils.isEmpty(bizIds)){
AssertUtils.isNull(bizIds, "业务ID不能为空!"); return null;
}
List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY, List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY,
new HashMap<String, Object>() {{ new HashMap<String, Object>() {{
put("bizType", bizType); put("bizType", bizType==null?"WD":bizType);
put("bizIds", bizIds); put("bizIds", bizIds);
}} }}
); );
......
...@@ -143,11 +143,17 @@ let save = function (btnNode) { ...@@ -143,11 +143,17 @@ let save = function (btnNode) {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let projCode= item.get("projCode"); let projCode= item.get("projCode");
let fileName= item.get("fileName");
if(isBlank(projCode)){ if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!"); message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(fileName)){
message("选中的第"+(index+1)+"行\"目录名称\",不能为空!");
flag = false;
return false;
}
}); });
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
......
...@@ -122,11 +122,17 @@ let save = function (btnNode) { ...@@ -122,11 +122,17 @@ let save = function (btnNode) {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let projCode= item.get("projName"); let projCode= item.get("projName");
let fileName= item.get("fileName");
if(isBlank(projCode)){ if(isBlank(projCode)){
message("选中的第"+(index+1)+"行\"所属项目\",不能为空!"); message("选中的第"+(index+1)+"行\"所属项目\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(isBlank(fileName)){
message("选中的第"+(index+1)+"行\"目录名称\",不能为空!");
flag = false;
return false;
}
}); });
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
......
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