| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | |
| | | return success(null); |
| | | } |
| | | MesProBatchRespVO respVO = buildBatchRespVOList(Collections.singletonList(batch)).get(0); |
| | | respVO.setBindingMode(batchService.getBindingMode(id)); |
| | | // 填充人员配置 |
| | | respVO.setWorkers(buildWorkerRespVOList(batchService.getBatchWorkerListByBatchId(id))); |
| | | return success(respVO); |
| | |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| | | convertSet(list, MesProBatchDO::getOwnerUserId)); |
| | | Map<Long, MesMdmItemDO> itemMap = mdmItemService.getItemMap(convertSet(list, MesProBatchDO::getItemId)); |
| | | // 批次下已生成的正式托盘码(批量查询,避免逐行查询) |
| | | Map<Long, List<String>> palletCodeMap = palletService.getPalletListByBatchIds( |
| | | convertSet(list, MesProBatchDO::getId)).stream() |
| | | .filter(pallet -> StrUtil.isNotBlank(pallet.getCode())) |
| | | .collect(Collectors.groupingBy(MesProPalletDO::getBatchId, |
| | | Collectors.mapping(MesProPalletDO::getCode, Collectors.toList()))); |
| | | return BeanUtils.toBean(list, MesProBatchRespVO.class, vo -> { |
| | | MapUtils.findAndThen(userMap, vo.getOwnerUserId(), user -> vo.setOwnerUserName(user.getNickname())); |
| | | MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { vo.setItemCode(item.getCode()); vo.setItemName(item.getName()); }); |
| | | vo.setPalletCodes(palletCodeMap.getOrDefault(vo.getId(), Collections.emptyList())); |
| | | }); |
| | | } |
| | | |