|
@@ -860,49 +860,60 @@ public class SysImplementPlanManager {
|
|
|
implPlanDetailsService.getDetailsByPlanId(
|
|
|
p.getPlanId(), UpmsState.ImplPlanDetailsState.PASSED);
|
|
|
copied.setPlanDetails(details);
|
|
|
- if (details != null) {
|
|
|
-
|
|
|
- // 拆解子项
|
|
|
- List<SysImplPlanDetailsItem> detailsItems =
|
|
|
- implPlanDetailsItemService.listDetailItems(details.getDetailsId()).stream()
|
|
|
- .filter(item -> item.getQty() > 0)
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- List<Map<String, Object>> coll = null;
|
|
|
- if (CollUtil.isNotEmpty(detailsItems)) {
|
|
|
-
|
|
|
- coll =
|
|
|
- detailsItems.stream()
|
|
|
- .map(
|
|
|
- item -> {
|
|
|
- Map<String, Object> map = BeanUtil.copyProperties(item, Map.class);
|
|
|
- WmTaskType taskType = collect.get(item.getTaskTypeName());
|
|
|
- map.put(
|
|
|
- "orgTaskTypeId",
|
|
|
- Objects.nonNull(taskType) ? taskType.getId() : null);
|
|
|
- map.put(
|
|
|
- "baseId",
|
|
|
- Objects.nonNull(taskType) ? taskType.getBaseId() : null);
|
|
|
- map.put(
|
|
|
- "parent_id",
|
|
|
- Objects.nonNull(taskType) ? taskType.getParentId() : null);
|
|
|
- return map;
|
|
|
- })
|
|
|
- .filter(m -> Objects.nonNull(m.get("parent_id")))
|
|
|
- .sorted(Comparator.comparing(m -> (String) m.get("parent_id")))
|
|
|
- .collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
- copied.setPlanItems(CollUtil.isNotEmpty(coll) ? coll : Collections.emptyList());
|
|
|
- }
|
|
|
+ copied.setPlanItems(getDetailItems(collect, details));
|
|
|
|
|
|
return copied;
|
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+ private List<Map<String, Object>> getDetailItems(Map<String, WmTaskType> collect,
|
|
|
+ SysImplPlanDetails details) {
|
|
|
+ if (details != null) {
|
|
|
+
|
|
|
+ // 拆解子项
|
|
|
+ List<SysImplPlanDetailsItem> detailsItems =
|
|
|
+ implPlanDetailsItemService.listDetailItems(details.getDetailsId()).stream()
|
|
|
+ .filter(item -> item.getQty() > 0)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Map<String, Object>> coll = null;
|
|
|
+ if (CollUtil.isNotEmpty(detailsItems)) {
|
|
|
+
|
|
|
+ coll =
|
|
|
+ detailsItems.stream()
|
|
|
+ .map(
|
|
|
+ item -> {
|
|
|
+ Map<String, Object> map = BeanUtil.copyProperties(item, Map.class);
|
|
|
+ WmTaskType taskType = collect.get(item.getTaskTypeName());
|
|
|
+ map.put(
|
|
|
+ "orgTaskTypeId",
|
|
|
+ Objects.nonNull(taskType) ? taskType.getId() : null);
|
|
|
+ map.put(
|
|
|
+ "baseId",
|
|
|
+ Objects.nonNull(taskType) ? taskType.getBaseId() : null);
|
|
|
+ map.put(
|
|
|
+ "parent_id",
|
|
|
+ Objects.nonNull(taskType) ? taskType.getParentId() : null);
|
|
|
+ return map;
|
|
|
+ })
|
|
|
+ .filter(m -> Objects.nonNull(m.get("parent_id")))
|
|
|
+ .sorted(Comparator.comparing(m -> (String) m.get("parent_id")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(coll)) {
|
|
|
+ return coll;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
public SysImplementPlanVO.ToList findById(Long planId) {
|
|
|
SysImplementPlan p = implementPlanService.getById(planId);
|
|
|
+ if (p == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
SysImplementPlanVO.ToList copied = BeanUtil.copyProperties(p, SysImplementPlanVO.ToList.class);
|
|
|
|
|
|
// 设置承接人信息
|
|
@@ -940,6 +951,13 @@ public class SysImplementPlanManager {
|
|
|
.orderByDesc(SysImplPlanDetails::getUpdateTime));
|
|
|
copied.setPlanDetails(CollUtil.isEmpty(details) ? null : details.get(0));
|
|
|
|
|
|
+ Map<String, WmTaskType> collect =
|
|
|
+ taskTypeService
|
|
|
+ .list(Wrappers.<WmTaskType>lambdaQuery().lt(WmTaskType::getId, "100"))
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(WmTaskType::getTaskTypeName, Function.identity()));
|
|
|
+ copied.setPlanItems(getDetailItems(collect, copied.getPlanDetails()));
|
|
|
+
|
|
|
// 获取父级
|
|
|
Integer parentId = p.getParentId();
|
|
|
|