Commit 04a78cfb by liuyang

文档库文件夹颜色优化

parent b3011cba
...@@ -30,11 +30,7 @@ import com.baosight.xservices.xs.util.LoginUserDetails; ...@@ -30,11 +30,7 @@ import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -282,12 +278,14 @@ public class ServiceHGWD001D extends TreeService { ...@@ -282,12 +278,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());
...@@ -330,21 +328,11 @@ public class ServiceHGWD001D extends TreeService { ...@@ -330,21 +328,11 @@ public class ServiceHGWD001D extends TreeService {
boolean isManager = HgWdUtils.HgWd009.isManager(); 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); List<HGWD003> dbWd003s = HGWDTools.HgWd003.list(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); Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C);
// 已授权人员信息
List<HGWD003> dbWd003s = dbWd003Map == null ? null : dbWd003Map.get(dbWd001.getFileId()); int count = getChildCount(dbWd001.getFileId());
int dbWd099s = fWd099s.get(dbWd001.getFileId()) == null ? 0 : fWd099s.get(dbWd001.getFileId()).size();
int count = 0;
if (dbWd003s!=null && dbWd003s.size() > 0 && dbWd099s > 0){
count = 3;
}else if (dbWd003s!=null && dbWd003s.size() > 0){
count = 2;
}else if (dbWd099s > 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());
...@@ -407,4 +395,27 @@ public class ServiceHGWD001D extends TreeService { ...@@ -407,4 +395,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;
}
} }
...@@ -294,7 +294,9 @@ public class HGWDTools { ...@@ -294,7 +294,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);
...@@ -447,12 +449,12 @@ public class HGWDTools { ...@@ -447,12 +449,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);
}} }}
); );
......
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