Commit c75479df by 章家宝

feat:获取工单详情接口兼容报告id输入

1 parent 757757a2
......@@ -185,7 +185,7 @@ public class InspectionWorkOrderExportBean implements Serializable {
// 基础信息
if (vehicle.getBaseInfo() != null) {
this.sourceNo = vehicle.getBaseInfo().getSourceNo();
this.carTypeName = vehicle.getBaseInfo().getCarTypeName();
this.carTypeName = vehicle.getBaseInfo().getCarSeriesName() + " " + vehicle.getBaseInfo().getCarTypeName();
this.vin = vehicle.getBaseInfo().getVin();
this.licensePlate = vehicle.getBaseInfo().getLicensePlate();
} else {
......
......@@ -119,11 +119,11 @@ public class InspectionWorkOrderController {
@Operation(summary = "获取检测工单详情", description = "获取检测工单详情")
@GetMapping("/detail/{id}")
public BaseResp<InspectionWODetailRespVO> detail(@PathVariable("id") Long id) {
log.info("获取检测工单详情: {}", id);
@PostMapping("/detail")
public BaseResp<InspectionWODetailRespVO> detail(@RequestBody InspectionWorkOrderDetailReqVO reqVO) {
log.info("获取检测工单详情: {} {}", reqVO.getWorkOrderId(), reqVO.getReportId());
try {
InspectionWODetailRespVO result = inspectionWorkOrderService.detail(id);
InspectionWODetailRespVO result = inspectionWorkOrderService.detail(reqVO);
return BaseResp.success(result);
} catch (Exception e) {
log.error("获取检测工单详情失败!系统异常!", e);
......
package com.glsx.usedcar.converts;
import com.glsx.usedcar.module.inspect.entity.InspectionReportOpLog;
import com.glsx.usedcar.module.inspect.entity.InspectionWorkOrderOpLog;
import com.glsx.usedcar.module.inspect.vo.InspectionWOOpLogRespVo;
import org.mapstruct.Mapper;
......@@ -17,6 +18,8 @@ public interface InspectionWorkOrderOpLogConverter {
*/
InspectionWOOpLogRespVo inspectionWorkOrderOpLogMapRespVO(InspectionWorkOrderOpLog log);
InspectionWOOpLogRespVo inspectionReportOpLogMapRespVO(InspectionReportOpLog log);
/**
* 多个实体转换为VO
*
......@@ -25,5 +28,6 @@ public interface InspectionWorkOrderOpLogConverter {
*/
List<InspectionWOOpLogRespVo> inspectionWorkOrderOpLogMapRespVO(List<InspectionWorkOrderOpLog> list);
List<InspectionWOOpLogRespVo> inspectionReportOpLogMapRespVO(List<InspectionReportOpLog> list);
}
......@@ -44,6 +44,7 @@ import java.util.concurrent.TimeUnit;
public class InspectionWorkOrderService {
private final InspectionWorkOrderRepository inspectionWorkOrderRepository;
private final InspectionWorkOrderOpLogRepository inspectionWorkOrderOpLogRepository;
private final InspectionReportOpLogRepository inspectionReportOpLogRepository;
private final RedisCacheUtil redisCacheUtil;
private final InspectionWorkOrderConverter inspectionWorkOrderConverter;
private final InspectionWorkOrderOpLogConverter inspectionWorkOrderOpLogConverter;
......@@ -419,7 +420,9 @@ public class InspectionWorkOrderService {
}
public InspectionWODetailRespVO detail(Long id) {
public InspectionWODetailRespVO detail(InspectionWorkOrderDetailReqVO reqVO) {
if (reqVO.getWorkOrderId() != null) {
Long id = reqVO.getWorkOrderId();
InspectionWorkOrder wo = inspectionWorkOrderRepository.findByIdAndDeleteFlag(id, DeleteFlag.NOT_DELETED.getCode()).orElse(null);
if (wo == null) {
throw new BusinessCodeException(ErrorCodeEnum.PARAM_ERROR, "工单没有找到");
......@@ -446,6 +449,21 @@ public class InspectionWorkOrderService {
List<InspectionNodeSummaryDTO> nodeVOList = inspectionNodeService.summaryLeafNodes(id);
result.setNodeVOList(nodeVOList);
return result;
} else {
Long reportId = reqVO.getReportId();
InspectionReport report = inspectionReportRepository.findByIdAndDeleteFlag(reportId, DeleteFlag.NOT_DELETED.getCode()).orElse(null);
InspectionWorkOrder wo = report.getWorkOrder();
List<InspectionReportOpLog> logList = inspectionReportOpLogRepository.findByReportInnerIdAndDeleteFlag(reportId, DeleteFlag.NOT_DELETED.getCode());
List<InspectionNodeSummaryDTO> nodeVOList = inspectionNodeService.summaryLeafNodes(wo.getId());
InspectionWODetailRespVO result = new InspectionWODetailRespVO();
InspectionWORespVO inspectionWORespVO = inspectionWorkOrderConverter.inspectorMapRespVO(wo);
result.setInspectionWORespVO(inspectionWORespVO);
result.setNodeVOList(nodeVOList);
InspectionReportRespVO inspectionReportRespVO = inspectionReportConverter.inspectionReportMapRespVO(report);
result.setInspectionReportRespVO(inspectionReportRespVO);
result.setLogList(inspectionWorkOrderOpLogConverter.inspectionReportOpLogMapRespVO(logList));
return result;
}
}
......@@ -726,4 +744,15 @@ public class InspectionWorkOrderService {
return countVO;
}
/**
* 获取工单H5地址
* @param id 工单ID
* @return 工单H5地址
*/
public String getH5Url(Long id) {
// 拼接一个默认报告
InspectionRecord inspectionRecord = inspectionRecordRepository.findByTaskIdAndDeletedFlag(id, DeleteFlag.NOT_DELETED.getCode())
.orElseThrow(() -> new BusinessCodeException(ErrorCodeEnum.COMMON_ERROR, "检测记录不存在,ID:" + id));
return String.format(inspectorConfig.getInspectionRecordH5Url(), inspectionRecord.getId());
}
}
\ No newline at end of file
package com.glsx.usedcar.module.inspect.vo;
import lombok.Data;
/**
*
*/
@Data
public class InspectionWorkOrderDetailReqVO {
private Long workOrderId;
private Long reportId;
}
......@@ -61,6 +61,19 @@ public class InspectionWorkOrderController {
return BaseResp.fail("分页查询检测工单失败:" + e.getMessage());
}
}
@Operation(summary = "根据id获取h5地址", description = "根据id获取h5地址")
@GetMapping("/getH5Url/{id}")
public BaseResp<String> getH5Url(@PathVariable("id") Long id) {
try {
log.info("根据id获取h5地址请求: id={}", id);
String result = inspectionWorkOrderService.getH5Url(id);
return BaseResp.success(result);
} catch (Exception e) {
log.error("分页查询检测工单失败!系统异常!", e);
return BaseResp.fail("分页查询检测工单失败:" + e.getMessage());
}
}
/**
* 获取检测工单详情
......@@ -73,7 +86,9 @@ public class InspectionWorkOrderController {
public BaseResp<InspectionWODetailRespVO> getDetail(@PathVariable("id") Long id) {
log.info("获取检测工单详情: id={}", id);
try {
InspectionWODetailRespVO result = inspectionWorkOrderService.detail(id);
InspectionWorkOrderDetailReqVO reqVO = new InspectionWorkOrderDetailReqVO();
reqVO.setWorkOrderId(id);
InspectionWODetailRespVO result = inspectionWorkOrderService.detail(reqVO);
return BaseResp.success(result);
} catch (Exception e) {
log.error("获取检测工单详情失败!系统异常!", e);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!