|
|
@@ -695,7 +695,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
"from m_wbs_tree_contract where contract_id = " + contractId + " and find_in_set( " + id + ",ancestors_p_id) and is_deleted=0";
|
|
|
List<Map<String, Object>> tmp = this.jdbcTemplate.queryForList(sql);
|
|
|
if (tmp.size() > 0) {
|
|
|
- for (Map<String, Object> map : tmp) {
|
|
|
+ // 排序
|
|
|
+ List<Map<String, Object>> list = tmp.stream().sorted(Comparator.comparing((Map<String, Object> item) -> (Integer) item.get("sort"), Comparator.nullsFirst(Comparator.naturalOrder()))
|
|
|
+ .thenComparing(new ComplexStringComparator<>(obj -> obj.get("title") != null ? (String) obj.get("title") : ""))
|
|
|
+ .thenComparing((Map<String, Object> item) -> (Date) item.get("createTime"), Comparator.nullsLast(Comparator.reverseOrder())))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
if (StringUtils.isEquals(map.get("nodeType"), 6)) {
|
|
|
listMaps.add(map);
|
|
|
}
|
|
|
@@ -712,6 +717,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
List<Map<String, Object>> listMaps = new ArrayList<>();
|
|
|
descendantType46(tec.getCurrentNode().getParentPkeyId(),tec.getCurrentNode().getContractId(), listMaps);
|
|
|
if (listMaps.size() > 0) {
|
|
|
+ for (int i = 0; i < listMaps.size(); i++) {
|
|
|
+ listMaps.get(i).put("sort", i);
|
|
|
+ }
|
|
|
tec.getCurrentNode().getDivisional().addAll(listMaps.stream().map(m -> BeanUtil.toBean(m, CurrentNode.class)).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|