1、柜体板件视图分页和cadinfo接口支持多柜体入参;2、新增订单详情柜体数和部件树返回cad图纸id和图纸fileHash;

This commit is contained in:
gaoqr
2026-02-13 09:14:11 +08:00
parent 410c959245
commit 79364d8fb1
15 changed files with 160 additions and 74 deletions
@@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.util.Map;
import java.util.Set;
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory = @FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
@Tag(name = "RPC 服务 - 文件") @Tag(name = "RPC 服务 - 文件")
public interface FileApi { public interface FileApi {
@@ -95,4 +98,8 @@ public interface FileApi {
default Long createFileAndReturnId(byte[] content, String fileName) { default Long createFileAndReturnId(byte[] content, String fileName) {
return createFileAndReturnId(new FileCreateReqDTO().setName(fileName).setPath(null).setContent(content)).getCheckedData(); return createFileAndReturnId(new FileCreateReqDTO().setName(fileName).setPath(null).setContent(content)).getCheckedData();
} }
@PostMapping(PREFIX + "/getFileHashByIds")
@Operation(summary = "根据文件id请求和fileHash的对应关系")
CommonResult<Map<Long, String>> getFileHashMapByIds(@RequestBody Set<Long> fileIds);
} }
@@ -2,12 +2,18 @@ package com.cf.imes.module.infra.api.file;
import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO; import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
import com.cf.imes.module.infra.service.file.FileService; import com.cf.imes.module.infra.service.file.FileService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用 @RestController // 提供 RESTful API 接口,给 Feign 调用
@@ -39,4 +45,13 @@ public class FileApiImpl implements FileApi {
return success(fileService.createFileDO(createReqDTO.getName(), createReqDTO.getPath(), return success(fileService.createFileDO(createReqDTO.getName(), createReqDTO.getPath(),
createReqDTO.getContent())); createReqDTO.getContent()));
} }
@Override
public CommonResult<Map<Long, String>> getFileHashMapByIds(Set<Long> fileIds) {
List<FileDO> fileDOList = fileService.getByIds(fileIds);
return success(fileDOList.stream().collect(Collectors.toMap(
FileDO::getId,
FileDO::getName
)));
}
} }
@@ -29,6 +29,8 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.io.IOException;
import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 文件存储") @Tag(name = "管理后台 - 文件存储")
@@ -44,7 +46,7 @@ public class FileController {
@PostMapping("/upload") @PostMapping("/upload")
@Operation(summary = "上传文件") @Operation(summary = "上传文件")
@OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要 @OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要
public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception { public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws IOException {
MultipartFile file = uploadReqVO.getFile(); MultipartFile file = uploadReqVO.getFile();
String path = uploadReqVO.getPath(); String path = uploadReqVO.getPath();
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()))); return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
@@ -53,8 +55,8 @@ public class FileController {
@PostMapping("/cadview") @PostMapping("/cadview")
@Operation(summary = "上传CAD图纸数据") @Operation(summary = "上传CAD图纸数据")
@OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要 @OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要
public CommonResult<Long> uploadCadViewFile(@RequestPart("file") MultipartFile file) throws Exception { public CommonResult<Long> uploadCadViewFile(@RequestPart("file") MultipartFile file) throws IOException {
return success(fileService.createFileDO("cadViewFile", null, file.getBytes())); return success(fileService.createFileDO(file.getOriginalFilename(), null, file.getBytes()));
} }
@@ -62,7 +64,7 @@ public class FileController {
@Operation(summary = "删除文件") @Operation(summary = "删除文件")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('infra:file:delete')") @PreAuthorize("@ss.hasPermission('infra:file:delete')")
public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception { public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) {
fileService.deleteFile(id); fileService.deleteFile(id);
return success(true); return success(true);
} }
@@ -4,6 +4,9 @@ import com.cf.imes.module.infra.controller.admin.file.vo.file.FilePageReqVO;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.module.infra.dal.dataobject.file.FileDO; import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
import java.util.List;
import java.util.Set;
/** /**
* 文件 Service 接口 * 文件 Service 接口
* *
@@ -70,4 +73,12 @@ public interface FileService {
* @return * @return
*/ */
Boolean deleteFileByPath(String path); Boolean deleteFileByPath(String path);
/**
* 通过文件id获取文件列表
*
* @param ids
* @return
*/
List<FileDO> getByIds(Set<Long> ids);
} }
@@ -17,7 +17,9 @@ import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
@@ -170,4 +172,8 @@ public class FileServiceImpl implements FileService {
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public List<FileDO> getByIds(Set<Long> ids) {
return fileMapper.selectByIds(ids);
}
} }
@@ -13,6 +13,8 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import java.util.Set;
@Schema(description = "管理后台 - WEBCAD视图板材分组条件") @Schema(description = "管理后台 - WEBCAD视图板材分组条件")
@Data @Data
@ToString(callSuper = true) @ToString(callSuper = true)
@@ -25,19 +27,12 @@ public class OrderCadViewPlatePageReqVO extends PageParam {
@NotNull(message = "{order.cadview.plate.page.orderid.not.null}",groups = {OrderCadViewPageGroup.class}) @NotNull(message = "{order.cadview.plate.page.orderid.not.null}",groups = {OrderCadViewPageGroup.class})
private Long orderId; private Long orderId;
@Schema(description = "房间编号", example = "1024")
private Long roomId;
@Schema(description = "柜体编号", example = "1024") @Schema(description = "柜体编号", example = "1024")
private Long bodyId; private Set<Long> bodyIds;
@Schema(description = "加工组编号", example = "1024") @Schema(description = "加工组编号", example = "1024")
private Long groupId; private Long groupId;
@Schema(description = "板件编号", example = "1024")
@NotNull(message = "{order.cadview.plate.cadinfo.plateno.not.null}", groups = OrderCadViewInfoGroup.class)
private Long plateNo;
@Schema(description = "部件编号", example = "1024") @Schema(description = "部件编号", example = "1024")
private Long componentId; private Long componentId;
@@ -55,10 +55,6 @@ public class OrderBodyRespVO {
@ExcelProperty("异型数量") @ExcelProperty("异型数量")
private Short unregularNum; private Short unregularNum;
// @Schema(description = "生产单详情内容", requiredMode = Schema.RequiredMode.REQUIRED)
// @ExcelProperty("生产单详情内容")
// private List<OrderItemDO> orderItemDOS;
@Schema(description = "文件名", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰") @Schema(description = "文件名", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("文件名") @ExcelProperty("文件名")
private String filename; private String filename;
@@ -70,4 +66,10 @@ public class OrderBodyRespVO {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "CAD图纸文件ID")
private Long cadViewFileId;
@Schema(description = "CAD图纸文件哈希值")
private String fileHash;
} }
@@ -19,4 +19,7 @@ public class OrderComponentRespVO {
@Schema(description = "cad图纸数据文件id") @Schema(description = "cad图纸数据文件id")
private Long cadViewFileId; private Long cadViewFileId;
@Schema(description = "CAD图纸文件哈希值")
private String fileHash;
} }
@@ -136,15 +136,15 @@ public class PlateController {
return success(plateService.createNewPlate(reqVO)); return success(plateService.createNewPlate(reqVO));
} }
@GetMapping("/body/view/page") @PostMapping("/body/view/page")
@Operation(summary = "获取柜体下的板件视图分页列表数据") @Operation(summary = "获取柜体下的板件视图分页列表数据")
public CommonResult<PageResult<OrderViewPlatePageRespVO>> getBodyViewPlatesPage(@Validated(OrderCadViewPageGroup.class) OrderCadViewPlatePageReqVO orderCadViewPlatePageReqVO) { public CommonResult<PageResult<OrderViewPlatePageRespVO>> getBodyViewPlatesPage(@Validated(OrderCadViewPageGroup.class) @RequestBody OrderCadViewPlatePageReqVO orderCadViewPlatePageReqVO) {
return success(plateService.getBodyViewPlatesPage(orderCadViewPlatePageReqVO)); return success(plateService.getBodyViewPlatesPage(orderCadViewPlatePageReqVO));
} }
@GetMapping("/body/view/cadinfo") @PostMapping("/body/view/cadinfo")
@Operation(summary = "获取板件对应柜体下的所有板件视图列表数据") @Operation(summary = "获取板件对应柜体下的所有板件视图列表数据")
public CommonResult<List<OrderViewPlatePageRespVO>> getBodyViewPlatesCadInfo(@Validated(OrderCadViewInfoGroup.class) OrderCadViewPlatePageReqVO orderCadViewPlatePageReqVO) { public CommonResult<List<OrderViewPlatePageRespVO>> getBodyViewPlatesCadInfo(@Validated(OrderCadViewInfoGroup.class) @RequestBody OrderCadViewPlatePageReqVO orderCadViewPlatePageReqVO) {
return success(plateService.getBodyViewPlatesCadInfo(orderCadViewPlatePageReqVO)); return success(plateService.getBodyViewPlatesCadInfo(orderCadViewPlatePageReqVO));
} }
} }
@@ -86,4 +86,14 @@ public class OrderBodyViewPlatesPageDO {
* 部件id * 部件id
*/ */
private Long compId; private Long compId;
/**
* 柜体id
*/
private Long bodyId;
/**
* cad图纸文件id
*/
private Long cadViewFileId;
} }
@@ -192,20 +192,16 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
* *
* @param page 分页参数 * @param page 分页参数
* @param orderId 订单ID * @param orderId 订单ID
* @param roomId 房间ID * @param bodyIds 柜体ID列表
* @param bodyId 柜体ID
* @param groupId 加工组ID * @param groupId 加工组ID
* @param organId 组织ID
* @param componentIds 部件ID列表 * @param componentIds 部件ID列表
* @param cadView 是否需要cad图纸内信息:cad_view_id、seal_left、seal_down、seal_right、seal_up * @param cadView 是否需要cad图纸内信息:cad_view_id、seal_left、seal_down、seal_right、seal_up
* @return * @return
*/ */
IPage<OrderBodyViewPlatesPageDO> selectBodyViewPlatesPage(@Param("page") IPage<OrderBodyViewPlatesPageDO> page, IPage<OrderBodyViewPlatesPageDO> selectBodyViewPlatesPage(@Param("page") IPage<OrderBodyViewPlatesPageDO> page,
@Param("orderId") Long orderId, @Param("orderId") Long orderId,
@Param("roomId") Long roomId, @Param("bodyIds") Set<Long> bodyIds,
@Param("bodyId") Long bodyId,
@Param("groupId") Long groupId, @Param("groupId") Long groupId,
@Param("organId") Long organId,
@Param("componentIds") Set<Long> componentIds, @Param("componentIds") Set<Long> componentIds,
@Param("cadView") boolean cadView); @Param("cadView") boolean cadView);
} }
@@ -1,5 +1,6 @@
package com.cf.imes.module.executor.service.order; package com.cf.imes.module.executor.service.order;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@@ -13,6 +14,7 @@ import com.cf.imes.framework.common.enums.DeletedCodeEnum;
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum; import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum; import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.Assert.AssertUtils;
@@ -32,7 +34,6 @@ import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRema
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO; import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO; import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO; import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO; import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
@@ -76,6 +77,7 @@ import com.cf.imes.module.executor.util.deviseData.structure.FieldConstants;
import com.cf.imes.module.executor.util.deviseData.structure.PlateDetail; import com.cf.imes.module.executor.util.deviseData.structure.PlateDetail;
import com.cf.imes.module.executor.util.elasticsearch.EsUtils; import com.cf.imes.module.executor.util.elasticsearch.EsUtils;
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataTypeVo; import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataTypeVo;
import com.cf.imes.module.infra.api.file.FileApi;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext; import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -188,6 +190,9 @@ public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private OrderImportHandlerFactory orderImportHandlerFactory; private OrderImportHandlerFactory orderImportHandlerFactory;
@Autowired
private FileApi fileApi;
@Override @Override
public Long createOrder(OrderSaveReqVO createReqVO) { public Long createOrder(OrderSaveReqVO createReqVO) {
//校验手机号是否合法 //校验手机号是否合法
@@ -263,7 +268,19 @@ public class OrderServiceImpl implements OrderService {
@Override @Override
public List<OrderBodyRespVO> getOrderBody(Long orderId, Integer deleted) { public List<OrderBodyRespVO> getOrderBody(Long orderId, Integer deleted) {
return BeanUtils.toBean(orderBodyMapper.selectList(orderId, deleted, getUserOrganId()), OrderBodyRespVO.class); List<OrderBodyRespVO> bodyRespVOS = BeanUtil.copyToList(orderBodyMapper.selectList(orderId, deleted, getUserOrganId()), OrderBodyRespVO.class);
// 获取文件 fileHash
Set<Long> cadViewFileIds = bodyRespVOS.stream().map(OrderBodyRespVO::getCadViewFileId).collect(Collectors.toSet());
if (CollUtil.isNotEmpty(cadViewFileIds)) {
CommonResult<Map<Long, String>> fileHashMapByIdsResult = fileApi.getFileHashMapByIds(cadViewFileIds);
if (fileHashMapByIdsResult.isSuccess()) {
Map<Long, String> fileHashMapByIds = fileHashMapByIdsResult.getData();
bodyRespVOS.forEach(body ->
body.setFileHash(fileHashMapByIds.get(body.getCadViewFileId()))
);
}
}
return bodyRespVOS;
} }
@Override @Override
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.Assert.AssertUtils;
@@ -29,6 +30,7 @@ import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
import com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper; import com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper; import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
import com.cf.imes.module.executor.enums.ErrorCodeConstants; import com.cf.imes.module.executor.enums.ErrorCodeConstants;
import com.cf.imes.module.infra.api.file.FileApi;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -48,7 +50,6 @@ import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_DELETE_PLATE_IN_PLAN; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_DELETE_PLATE_IN_PLAN;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NOT_EXIST; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NOT_EXIST;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NO_NEED_TO_RESTORE; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NO_NEED_TO_RESTORE;
@@ -82,6 +83,9 @@ public class OrderComponentServiceImpl implements OrderComponentService {
@Resource @Resource
private OrderBodyMapper orderBodyMapper; private OrderBodyMapper orderBodyMapper;
@Resource
private FileApi fileApi;
@Override @Override
public List<OrderComponentRespVO> getOrderComponentList(OrderDetailComponentListReqVO reqVO) { public List<OrderComponentRespVO> getOrderComponentList(OrderDetailComponentListReqVO reqVO) {
List<OrderComponentRespVO> resultList = new ArrayList<>(); List<OrderComponentRespVO> resultList = new ArrayList<>();
@@ -150,7 +154,19 @@ public class OrderComponentServiceImpl implements OrderComponentService {
.eqIfPresent(OrderComponentDO::getProcessStatus, reqVO.getProcessStatus()) .eqIfPresent(OrderComponentDO::getProcessStatus, reqVO.getProcessStatus())
.select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName, OrderComponentDO::getCadViewFileId)); .select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName, OrderComponentDO::getCadViewFileId));
return BeanUtil.copyToList(topComponentList, OrderComponentRespVO.class); List<OrderComponentRespVO> orderComponentRespVOS = BeanUtil.copyToList(topComponentList, OrderComponentRespVO.class);
// 3、获取文件 fileHash
Set<Long> cadViewFileIds = orderComponentRespVOS.stream().map(OrderComponentRespVO::getCadViewFileId).collect(Collectors.toSet());
if (CollUtil.isNotEmpty(cadViewFileIds)) {
CommonResult<Map<Long, String>> fileHashMapByIdsResult = fileApi.getFileHashMapByIds(cadViewFileIds);
if (fileHashMapByIdsResult.isSuccess()) {
Map<Long, String> fileHashMapByIds = fileHashMapByIdsResult.getData();
orderComponentRespVOS.forEach(component ->
component.setFileHash(fileHashMapByIds.get(component.getCadViewFileId()))
);
}
}
return orderComponentRespVOS;
} }
@Override @Override
@@ -189,7 +205,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
// 分页查询板件 // 分页查询板件
PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null, IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
null, null, getUserOrganId(), queryComponentIds, false); null, queryComponentIds, false);
long total = pageRes.getTotal(); long total = pageRes.getTotal();
List<OrderBodyViewPlatesPageDO> records = pageRes.getRecords(); List<OrderBodyViewPlatesPageDO> records = pageRes.getRecords();
@@ -235,7 +251,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
// 查询所有板件的视图所需信息 // 查询所有板件的视图所需信息
PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE); PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
IPage<OrderBodyViewPlatesPageDO> viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null, IPage<OrderBodyViewPlatesPageDO> viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
null, null, getUserOrganId(), componentIds, true); null, componentIds, true);
List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords(); List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords();
List<OrderViewPlatePageRespVO> resultList = new ArrayList<>(); List<OrderViewPlatePageRespVO> resultList = new ArrayList<>();
@@ -811,37 +811,51 @@ public class PlateServiceImpl implements PlateService {
@Override @Override
public PageResult<OrderViewPlatePageRespVO> getBodyViewPlatesPage(OrderCadViewPlatePageReqVO pageReqVO) { public PageResult<OrderViewPlatePageRespVO> getBodyViewPlatesPage(OrderCadViewPlatePageReqVO pageReqVO) {
Set<Long> bodyIds = pageReqVO.getBodyIds();
if (CollUtil.isEmpty(bodyIds)) {
return new PageResult<>(Collections.emptyList(), 0L);
}
List<OrderBodyDO> orderBodyDOList = orderBodyMapper.selectByIds(bodyIds);
if (CollUtil.isEmpty(orderBodyDOList)) {
throw new ServiceException(ORDER_BODY_NOT_EXISTS);
}
// 整理出body_id和cad图纸id的关系
Map<Long, Long> bodyIdAndCadViewFileIdMap = orderBodyDOList.stream()
.collect(Collectors.toMap(OrderBodyDO::getId, OrderBodyDO::getCadViewFileId));
PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, pageReqVO.getOrderId(), pageReqVO.getRoomId(), IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, pageReqVO.getOrderId(),
pageReqVO.getBodyId(), pageReqVO.getGroupId(), getUserOrganId(), null, false); bodyIds, pageReqVO.getGroupId(), null, false);
return new PageResult<>(BeanUtil.copyToList(pageRes.getRecords(), OrderViewPlatePageRespVO.class), pageRes.getTotal());
List<OrderBodyViewPlatesPageDO> records = pageRes.getRecords();
// cad图纸id赋到每块板上
if(CollUtil.isNotEmpty(records)) {
records.forEach(item -> item.setCadViewFileId(bodyIdAndCadViewFileIdMap.get(item.getBodyId())));
}
return new PageResult<>(BeanUtil.copyToList(records, OrderViewPlatePageRespVO.class), pageRes.getTotal());
} }
@Override @Override
public List<OrderViewPlatePageRespVO> getBodyViewPlatesCadInfo(OrderCadViewPlatePageReqVO reqVO) { public List<OrderViewPlatePageRespVO> getBodyViewPlatesCadInfo(OrderCadViewPlatePageReqVO reqVO) {
Long plateId = reqVO.getPlateNo(); Long orderId = reqVO.getOrderId();
// 匹配板材 OrderDO orderDO = orderMapper.selectById(orderId);
PlateDO plateDO = plateMapper.selectById(plateId); AssertUtils.notEmpty(orderDO, ORDER_NOT_EXISTS);
if (ObjectUtil.isNull(plateDO)) {
throw new ServiceException(PLATE_NOT_EXISTS);
}
// 匹配orderItem Set<Long> bodyIds = reqVO.getBodyIds();
OrderItemDO orderItemDO = orderItemMapper.selectOne(new LambdaUpdateWrapper<OrderItemDO>()
.eq(OrderItemDO::getPlateId, plateId)
.eq(OrderItemDO::getOrderId, plateDO.getOrderId())
.eq(OrderItemDO::getOrganId, plateDO.getOrganId()));
if (ObjectUtil.isNull(orderItemDO)) {
throw new ServiceException(PLATE_NOT_EXISTS);
}
// 匹配柜体 // 匹配柜体
OrderBodyDO orderBodyDO = orderBodyMapper.selectById(orderItemDO.getBodyId()); if(CollUtil.isEmpty(bodyIds)) {
if (ObjectUtil.isNull(orderBodyDO)) { return Collections.emptyList();
}
List<OrderBodyDO> orderBodyDOList = orderBodyMapper.selectByIds(bodyIds);
if (CollUtil.isEmpty(orderBodyDOList)) {
throw new ServiceException(ORDER_BODY_NOT_EXISTS); throw new ServiceException(ORDER_BODY_NOT_EXISTS);
} }
Long cadViewFileId = orderBodyDO.getCadViewFileId(); // 整理出body_id和cad图纸id的关系
Map<Long, Long> bodyIdAndCadViewFileIdMap = orderBodyDOList.stream()
.collect(Collectors.toMap(OrderBodyDO::getId, OrderBodyDO::getCadViewFileId));
// 查询所有板件的视图所需信息 // 查询所有板件的视图所需信息
PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE); PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
@@ -849,24 +863,16 @@ public class PlateServiceImpl implements PlateService {
Integer range = reqVO.getRange(); Integer range = reqVO.getRange();
if (OrderCadViewPlateRangeEnum.BODY.getRange().equals(range)) { if (OrderCadViewPlateRangeEnum.BODY.getRange().equals(range)) {
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(), viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, bodyIds, null, null, true);
orderItemDO.getBodyId(), null, orderItemDO.getOrganId(), null, true);
} else { } else {
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(), viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, bodyIds, reqVO.getGroupId(), null, true);
orderItemDO.getBodyId(), orderItemDO.getGroupId(), orderItemDO.getOrganId(), null, true);
} }
List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords(); List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords();
List<OrderViewPlatePageRespVO> resultList = new ArrayList<>(); // cad图纸id赋到每块板上
if (CollUtil.isNotEmpty(records)) { if(CollUtil.isNotEmpty(records)) {
resultList = records.stream().map(item -> { records.forEach(item -> item.setCadViewFileId(bodyIdAndCadViewFileIdMap.get(item.getBodyId())));
OrderViewPlatePageRespVO vo = new OrderViewPlatePageRespVO();
BeanUtil.copyProperties(item, vo);
vo.setCadViewFileId(cadViewFileId);
return vo;
}).toList();
} }
return resultList; return BeanUtil.copyToList(records, OrderViewPlatePageRespVO.class);
} }
} }
@@ -535,9 +535,9 @@
</select> </select>
<select id="selectBodyViewPlatesPage" resultType="com.cf.imes.module.executor.dal.dataobject.orderItem.OrderBodyViewPlatesPageDO"> <select id="selectBodyViewPlatesPage" resultType="com.cf.imes.module.executor.dal.dataobject.orderItem.OrderBodyViewPlatesPageDO">
SELECT p.plate_no, p.name, p.width, p.height, p.thickness, g.material, g.color, p.cad_plate_no as customNumber, p.id SELECT p.plate_no, p.name, p.width, p.height, p.thickness, g.material, g.color, p.cad_plate_no as customNumber, p.id, i.body_id, p.cad_view_id
<if test="cadView"> <if test="cadView">
, p.cad_view_id, p.seal_left, p.seal_down, p.seal_right, p.seal_up , p.seal_left, p.seal_down, p.seal_right, p.seal_up
</if> </if>
<if test="componentIds != null and componentIds.size() > 0"> <if test="componentIds != null and componentIds.size() > 0">
, i.comp_id , i.comp_id
@@ -545,12 +545,12 @@
FROM order_item i FROM order_item i
LEFT JOIN `order_plate` p ON i.plate_id = p.id LEFT JOIN `order_plate` p ON i.plate_id = p.id
LEFT JOIN `order_goods` g ON g.id = p.goods_id LEFT JOIN `order_goods` g ON g.id = p.goods_id
WHERE i.order_id = #{orderId} AND i.organ_id = #{organId} AND p.deleted = false and i.plate_id != 0 WHERE i.order_id = #{orderId} AND p.deleted = false and i.plate_id != 0
<if test="roomId != null"> <if test="bodyIds != null and bodyIds.size() > 0">
AND i.room_id = #{roomId} AND i.body_id in
</if> <foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
<if test="bodyId != null"> #{bodyId}
AND i.body_id = #{bodyId} </foreach>
</if> </if>
<if test="groupId != null"> <if test="groupId != null">
AND i.group_id = #{groupId} AND i.group_id = #{groupId}