| | |
| | | .toList(); |
| | | |
| | | // 获取计划列表和状态列表 |
| | | List<ApsPlatePlan> planList = Optional.ofNullable(apsPlatePlanMapper.selectApsPlatePlanList(platePlan)) |
| | | .orElse(Collections.emptyList()); |
| | | List<ApsPlateProcessShopPlanStat> planList = apsPlateProcessShopStatMapper.selectPlatePlanBaseTable(); |
| | | |
| | | List<ApsPlateProcessShopStat> shopStates = Optional.ofNullable(apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatList(new ApsPlateProcessShopStat())) |
| | | .orElse(Collections.emptyList()); |
| | |
| | | List<SysDictData> documentStatusDic = DictUtils.getDictCache("aps_document_status"); |
| | | |
| | | // 构建结果列表 |
| | | List<ApsPlateProcessShopPlanStat> shopPlanStats = planList.stream() |
| | | .map(plan -> { |
| | | ApsPlateProcessShopPlanStat shopPlanStat = new ApsPlateProcessShopPlanStat(); |
| | | BeanUtils.copyProperties(plan, shopPlanStat); // 确保目标对象是合法的单个对象实例 |
| | | |
| | | planList.forEach( |
| | | plan -> { |
| | | // 根据 docNo 获取对应的 shopStatList |
| | | List<ApsPlateProcessShopStat> shopStatList = shopStatesByDocNo.getOrDefault(plan.getDocumentNumber(), Collections.emptyList()); |
| | | shopPlanStat.setDeptPlans(shopStatList); |
| | | plan.setDeptPlans(shopStatList); |
| | | if (businessTypeDic != null) { |
| | | businessTypeDic.stream().filter(x -> x.getDictValue().equals(plan.getBusinessType())).findFirst() |
| | | .ifPresent(sysDictData -> shopPlanStat.setBusinessType(sysDictData.getDictLabel())); |
| | | .ifPresent(sysDictData -> plan.setBusinessType(sysDictData.getDictLabel())); |
| | | } |
| | | if (documentStatusDic != null) { |
| | | documentStatusDic.stream().filter(x->x.getDictValue().equals(plan.getDocumentStatus())) |
| | | .findFirst().ifPresent(sysDictData -> shopPlanStat.setDocumentStatus(sysDictData.getDictLabel())); |
| | | .findFirst().ifPresent(sysDictData -> plan.setDocumentStatus(sysDictData.getDictLabel())); |
| | | } |
| | | return shopPlanStat; |
| | | }).toList(); |
| | | }); |
| | | // 构建返回结果 |
| | | AjaxResult success = AjaxResult.success(shopPlanStats); |
| | | AjaxResult success = AjaxResult.success(planList); |
| | | success.put("shopNames", shopList); |
| | | return success; |
| | | } |