| | |
| | | |
| | | @Override |
| | | public IPage<ProductionOperationTaskVo> pageProductionOperationTask(Page<ProductionOperationTaskDto> page, ProductionOperationTaskDto dto) { |
| | | // 分页查询生产工序任务 |
| | | Page<ProductionOperationTaskVo> voPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal()); |
| | | IPage<ProductionOperationTaskVo> result = baseMapper.pageProductionOperationTask(voPage, dto); |
| | | fillUserNames(result.getRecords()); |
| | |
| | | |
| | | @Override |
| | | public List<ProductionOperationTaskVo> listProductionOperationTask(ProductionOperationTaskDto dto) { |
| | | // 查询工序任务列表 |
| | | List<ProductionOperationTaskVo> result = BeanUtil.copyToList(this.list(buildQueryWrapper(dto)), ProductionOperationTaskVo.class); |
| | | fillUserNames(result); |
| | | return result; |
| | |
| | | |
| | | @Override |
| | | public ProductionOperationTaskVo getProductionOperationTaskInfo(Long id) { |
| | | // 获取生产工序任务详情 |
| | | ProductionOperationTask item = this.getById(id); |
| | | if (item == null) { |
| | | return null; |
| | |
| | | |
| | | @Override |
| | | public boolean saveProductionOperationTask(ProductionOperationTask productionOperationTask) { |
| | | // 保存生产工序任务 |
| | | return this.saveOrUpdate(productionOperationTask); |
| | | } |
| | | |
| | | @Override |
| | | public boolean removeProductionOperationTask(List<Long> ids) { |
| | | // 删除生产工序任务 |
| | | return ids != null && !ids.isEmpty() && this.removeByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public int updateProductWorkOrder(ProductionOperationTaskDto dto) { |
| | | // 更新工序任务对应的工单信息 |
| | | return baseMapper.updateById(dto); |
| | | } |
| | | |
| | | @Override |
| | | public boolean assign(ProductionOperationTaskDto dto) { |
| | | // 分配工序任务执行人 |
| | | if (dto == null || dto.getId() == null) { |
| | | throw new ServiceException("工单ID不能为空"); |
| | | } |
| | |
| | | } |
| | | |
| | | private LambdaQueryWrapper<ProductionOperationTask> buildQueryWrapper(ProductionOperationTaskDto dto) { |
| | | // 按条件动态构建数据库查询条件 |
| | | ProductionOperationTask query = dto == null ? new ProductionOperationTask() : dto; |
| | | return Wrappers.<ProductionOperationTask>lambdaQuery() |
| | | .eq(query.getId() != null, ProductionOperationTask::getId, query.getId()) |
| | |
| | | } |
| | | |
| | | private void fillUserNames(List<ProductionOperationTaskVo> voList) { |
| | | // 填充用户名称 |
| | | if (voList == null || voList.isEmpty()) { |
| | | return; |
| | | } |
| | | Set<Long> userIdSet = new LinkedHashSet<>(); |
| | | // 遍历处理数据并组装结果 |
| | | for (ProductionOperationTaskVo vo : voList) { |
| | | if (vo == null) { |
| | | continue; |
| | |
| | | } |
| | | |
| | | private List<Long> parseUserIdList(String userIds, boolean strict) { |
| | | // 解析并校验用户ID数组字符串 |
| | | if (StringUtils.isBlank(userIds)) { |
| | | if (strict) { |
| | | throw new ServiceException("userIds格式不正确,必须为JSON数字数组"); |
| | |
| | | |
| | | @Override |
| | | public void down(HttpServletResponse response, ProductionOperationTaskDto dto) { |
| | | // 导出工序任务数据 |
| | | if (dto == null || dto.getId() == null) { |
| | | throw new ServiceException("工单ID不能为空"); |
| | | } |
| | |
| | | } |
| | | |
| | | private List<Map<String, Object>> buildTaskAttachmentImages(Long taskId) { |
| | | // 组装任务附件图片数据用于导出 |
| | | List<Map<String, Object>> images = new ArrayList<>(); |
| | | StorageAttachmentDTO storageAttachmentDTO = new StorageAttachmentDTO(); |
| | | storageAttachmentDTO.setRecordType(RecordTypeEnum.PRODUCTION_OPERATION_TASK.getType()); |
| | | storageAttachmentDTO.setRecordId(taskId); |
| | | List<StorageBlobVO> taskWorkOrderFiles = |
| | | fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(storageAttachmentDTO); |
| | | // 参数与前置条件校验 |
| | | if (CollectionUtils.isEmpty(taskWorkOrderFiles)) { |
| | | return images; |
| | | } |
| | | // 遍历处理数据并组装结果 |
| | | for (StorageBlobVO blobVO : taskWorkOrderFiles) { |
| | | if (blobVO == null) { |
| | | continue; |
| | |
| | | } |
| | | |
| | | private File resolveImageFile(StorageBlobVO blobVO) { |
| | | // 将附件信息解析为本地图片文件对象 |
| | | if (blobVO == null || StringUtils.isBlank(blobVO.getUidFilename())) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | private PictureType resolvePictureType(StorageBlobVO blobVO) { |
| | | // 按文件名或内容类型识别图片格式 |
| | | if (blobVO == null) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | private PictureType parsePictureTypeByFileName(String fileName) { |
| | | // 根据文件后缀解析图片格式 |
| | | if (StringUtils.isBlank(fileName) || !fileName.contains(".")) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | private PictureType parsePictureTypeByContentType(String contentType) { |
| | | // 根据Content-Type解析图片格式 |
| | | if (StringUtils.isBlank(contentType)) { |
| | | return null; |
| | | } |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionOperationTaskVo> getOperation(ProductionOperationTaskDto dto) { |
| | | // 查询工序任务列表 |
| | | return baseMapper.getOperation(dto); |
| | | } |
| | | } |