Commit 84c92f21 by 章家宝

fixbug:1修复测试提的bug。2检测报告导出审批字典修改。3 检测报告分页查询新增检测地址。

1 parent ebdc34c2
...@@ -163,10 +163,10 @@ public class InspectionWorkOrderExportBean implements Serializable { ...@@ -163,10 +163,10 @@ public class InspectionWorkOrderExportBean implements Serializable {
// 审核状态转换 // 审核状态转换
this.auditStatus = switch (vo.getAuditStatus()) { this.auditStatus = switch (vo.getAuditStatus()) {
case 1 -> "待审批"; case 1 -> "待审核";
case 2 -> "审批中"; case 2 -> "审批中";
case 3 -> "审批通过"; case 3 -> "已通过";
case 4 -> "审批驳回"; case 4 -> "已驳回";
default -> "未知状态"; default -> "未知状态";
}; };
......
...@@ -22,12 +22,12 @@ public enum InspectionWorkOrderAuditStatusEnum { ...@@ -22,12 +22,12 @@ public enum InspectionWorkOrderAuditStatusEnum {
/** /**
* 审批通过 * 审批通过
*/ */
PASS(3, "审批通过"), PASS(3, "已通过"),
/** /**
* 审批驳回 * 审批驳回
*/ */
REJECT(4, "审批驳回"), REJECT(4, "已驳回"),
; ;
...@@ -77,4 +77,12 @@ public enum InspectionWorkOrderAuditStatusEnum { ...@@ -77,4 +77,12 @@ public enum InspectionWorkOrderAuditStatusEnum {
public static boolean isValidCode(Integer code) { public static boolean isValidCode(Integer code) {
return Objects.nonNull(getByCode(code)); return Objects.nonNull(getByCode(code));
} }
public static String getDescByCode(Integer status) {
InspectionWorkOrderAuditStatusEnum s = getByCode(status);
if (s == null) {
return "";
}
return s.getDesc();
}
} }
\ No newline at end of file \ No newline at end of file
package com.glsx.usedcar.module.inspect.dao; package com.glsx.usedcar.module.inspect.dao;
import com.glsx.usedcar.module.inspect.domain.InspectorWorkOrderStatsProjection; import com.glsx.usedcar.module.inspect.domain.InspectorWorkOrderStatsProjection;
import com.glsx.usedcar.module.inspect.domain.WoAddressProjection;
import com.glsx.usedcar.module.inspect.entity.InspectionWorkOrder; import com.glsx.usedcar.module.inspect.entity.InspectionWorkOrder;
import com.glsx.usedcar.module.inspect.entity.Inspector; import com.glsx.usedcar.module.inspect.entity.Inspector;
import com.glsx.usedcar.module.vehicle.entity.Vehicle; import com.glsx.usedcar.module.vehicle.entity.Vehicle;
...@@ -13,8 +15,7 @@ import org.springframework.stereotype.Repository; ...@@ -13,8 +15,7 @@ import org.springframework.stereotype.Repository;
import org.summerframework.orm.BaseRepository; import org.summerframework.orm.BaseRepository;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.*;
import java.util.Optional;
/** /**
* 检测工单数据访问层 * 检测工单数据访问层
...@@ -144,4 +145,13 @@ public interface InspectionWorkOrderRepository extends BaseRepository<Inspection ...@@ -144,4 +145,13 @@ public interface InspectionWorkOrderRepository extends BaseRepository<Inspection
@Param("statusList") List<Integer> statusList, @Param("statusList") List<Integer> statusList,
@Param("deleteFlag") String deleteFlag @Param("deleteFlag") String deleteFlag
); );
/**
* 根据工单ID列表,查询工单的检测地址
* @param woIdSet 工单ID列表
* @return 工单ID和检测地址的映射
*/
@Query("SELECT w.woId AS woId, w.inspectionAddress AS inspectionAddress FROM InspectionWorkOrder w WHERE w.woId IN :woIdSet")
List<WoAddressProjection> findInspectionAddressByWoIdList(Set<String> woIdSet);
} }
\ No newline at end of file \ No newline at end of file
package com.glsx.usedcar.module.inspect.domain;
public interface WoAddressProjection {
String getWoId();
String getInspectionAddress();
}
\ No newline at end of file \ No newline at end of file
...@@ -12,6 +12,7 @@ import com.glsx.usedcar.enums.common.DeleteFlag; ...@@ -12,6 +12,7 @@ import com.glsx.usedcar.enums.common.DeleteFlag;
import com.glsx.usedcar.enums.inspect.InspectionReportBindStatus; import com.glsx.usedcar.enums.inspect.InspectionReportBindStatus;
import com.glsx.usedcar.enums.inspect.InspectionReportOperationTypeEnum; import com.glsx.usedcar.enums.inspect.InspectionReportOperationTypeEnum;
import com.glsx.usedcar.module.inspect.dao.*; import com.glsx.usedcar.module.inspect.dao.*;
import com.glsx.usedcar.module.inspect.domain.WoAddressProjection;
import com.glsx.usedcar.module.inspect.dto.AccidentBurnWadeDTO; import com.glsx.usedcar.module.inspect.dto.AccidentBurnWadeDTO;
import com.glsx.usedcar.module.inspect.entity.*; import com.glsx.usedcar.module.inspect.entity.*;
import com.glsx.usedcar.module.inspect.vo.*; import com.glsx.usedcar.module.inspect.vo.*;
...@@ -38,6 +39,7 @@ import java.time.LocalDateTime; ...@@ -38,6 +39,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/** /**
* 检测报告服务(含操作日志保存) * 检测报告服务(含操作日志保存)
...@@ -49,6 +51,7 @@ import java.util.concurrent.TimeUnit; ...@@ -49,6 +51,7 @@ import java.util.concurrent.TimeUnit;
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class InspectionReportService { public class InspectionReportService {
private final InspectionReportRepository inspectionReportRepository; private final InspectionReportRepository inspectionReportRepository;
private final InspectionWorkOrderRepository inspectionWorkOrderRepository;
private final InspectionReportOpLogRepository inspectionReportOpLogRepository; private final InspectionReportOpLogRepository inspectionReportOpLogRepository;
private final ObjectMapper objectMapper = new ObjectMapper(); private final ObjectMapper objectMapper = new ObjectMapper();
private final RedisCacheUtil redisCacheUtil; private final RedisCacheUtil redisCacheUtil;
...@@ -124,7 +127,8 @@ public class InspectionReportService { ...@@ -124,7 +127,8 @@ public class InspectionReportService {
log.info("【报告日志】保存成功: 报告编号={}, 操作人={}, 操作类型={}, 平台标识={}", log.info("【报告日志】保存成功: 报告编号={}, 操作人={}, 操作类型={}, 平台标识={}",
report.getReportNo(), operatorName, operationType, platType); report.getReportNo(), operatorName, operationType, platType);
} catch (Exception e) { } catch (Exception e) {
log.error("【报告日志】保存失败: 报告编号={}, 操作人={}", report.getReportNo(), operatorName, e); String reportNo = report == null ? "" : report.getReportNo();
log.error("【报告日志】保存失败: 报告编号={}, 操作人={}", reportNo, operatorName, e);
} }
} }
...@@ -462,6 +466,7 @@ public class InspectionReportService { ...@@ -462,6 +466,7 @@ public class InspectionReportService {
pagination.removeFilter(JpaQueryConstants.InspectionReport.CARTYPE); pagination.removeFilter(JpaQueryConstants.InspectionReport.CARTYPE);
String likePattern = SymbolConsts.PERCENT + ct + SymbolConsts.PERCENT; String likePattern = SymbolConsts.PERCENT + ct + SymbolConsts.PERCENT;
pagination.addCondition((root, query, builder) -> builder.or( pagination.addCondition((root, query, builder) -> builder.or(
builder.like(root.get(InspectionReport_.reportNo), likePattern),
builder.like(root.get(InspectionReport_.vehicle).get(Vehicle_.baseInfo).get(BaseInfo_.licensePlate), likePattern), builder.like(root.get(InspectionReport_.vehicle).get(Vehicle_.baseInfo).get(BaseInfo_.licensePlate), likePattern),
builder.like(root.get(InspectionReport_.vehicle).get(Vehicle_.baseInfo).get(BaseInfo_.vin), likePattern), builder.like(root.get(InspectionReport_.vehicle).get(Vehicle_.baseInfo).get(BaseInfo_.vin), likePattern),
builder.like(root.get(InspectionReport_.vehicle).get(Vehicle_.baseInfo).get(BaseInfo_.carTypeName), likePattern), builder.like(root.get(InspectionReport_.vehicle).get(Vehicle_.baseInfo).get(BaseInfo_.carTypeName), likePattern),
...@@ -484,7 +489,23 @@ public class InspectionReportService { ...@@ -484,7 +489,23 @@ public class InspectionReportService {
Page<InspectionReport> resultPage = inspectionReportRepository.findAll(pagination, pagination.getPageRequest()); Page<InspectionReport> resultPage = inspectionReportRepository.findAll(pagination, pagination.getPageRequest());
// 4. 转换为VO分页对象 // 4. 转换为VO分页对象
return resultPage.map(inspectionReportConverter::inspectionReportMapRespVO); Page<InspectionReportRespVO> map = resultPage.map(inspectionReportConverter::inspectionReportMapRespVO);
// 5. 填充检测地址
List<InspectionReportRespVO> content = map.getContent();
if (!content.isEmpty()) {
Set<String> woIdSet = content.stream().map(InspectionReportRespVO::getWoId).collect(Collectors.toSet());
List<WoAddressProjection> inspectionAddressByWoIdList = inspectionWorkOrderRepository.findInspectionAddressByWoIdList(woIdSet);
Map<String, String> resultMap = inspectionAddressByWoIdList.stream()
.collect(Collectors.toMap(
WoAddressProjection::getWoId, // Key:工单ID
WoAddressProjection::getInspectionAddress // Value:检测地址
));
for (InspectionReportRespVO inspectionReportRespVO : content) {
inspectionReportRespVO.setInspectionAddress(resultMap.get(inspectionReportRespVO.getWoId()));
}
}
return map;
} }
......
...@@ -43,4 +43,7 @@ public class InspectionReportRespVO { ...@@ -43,4 +43,7 @@ public class InspectionReportRespVO {
@Schema(description = "更新时间") @Schema(description = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime updateTime; private LocalDateTime updateTime;
@Schema(description = "检测地址")
private String inspectionAddress;
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!