|
|
@@ -697,7 +697,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
"from m_wbs_tree_contract where parent_id =? and is_deleted=0";
|
|
|
List<Map<String, Object>> tmp = this.jdbcTemplate.queryForList(sql, id);
|
|
|
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);
|
|
|
} else {
|
|
|
@@ -713,6 +718,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
List<Map<String, Object>> listMaps = new ArrayList<>();
|
|
|
descendantType46(tec.getCurrentNode().getParentId(), 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()));
|
|
|
}
|
|
|
}
|