Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 881b74ef
authored
Mar 24, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:小程序查询报告接口新增事故火烧水泡返回
1 parent
1ba077c6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
47 deletions
aus-config/src/main/resources/config/aus-inspector-dev.yaml
aus-core/src/main/java/com/glsx/usedcar/config/InspectorConfig.java
aus-core/src/main/java/com/glsx/usedcar/consts/inspect/JpaQueryConstants.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/entity/InspectionReport.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionReportService.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/VehicleInspectScoreRespVO.java
aus-config/src/main/resources/config/aus-inspector-dev.yaml
View file @
881b74e
...
@@ -20,6 +20,7 @@ spring:
...
@@ -20,6 +20,7 @@ spring:
thread-name-prefix
:
inspector-dev-
thread-name-prefix
:
inspector-dev-
inspector
:
inspector
:
inspection-audit-url
:
http://192.168.1.125:5173/#/detection/order
inspection-audit-url
:
http://192.168.1.125:5173/#/detection/order
inspection-record-h5-url
:
http://192.168.1.125:5173/#/detection/record?id=%s
application
:
application
:
jwt
:
jwt
:
...
...
aus-core/src/main/java/com/glsx/usedcar/config/InspectorConfig.java
View file @
881b74e
...
@@ -25,4 +25,10 @@ public class InspectorConfig {
...
@@ -25,4 +25,10 @@ public class InspectorConfig {
*/
*/
private
String
inspectionAuditUrl
;
private
String
inspectionAuditUrl
;
// inspection-record-h5-url
/**
* 检测记录h5地址
*/
private
String
inspectionRecordH5Url
;
}
}
aus-core/src/main/java/com/glsx/usedcar/consts/inspect/JpaQueryConstants.java
View file @
881b74e
...
@@ -85,6 +85,11 @@ public interface JpaQueryConstants {
...
@@ -85,6 +85,11 @@ public interface JpaQueryConstants {
* 精确匹配
* 精确匹配
*/
*/
String
INSPECTOR_ID
=
"inspectorId"
;
String
INSPECTOR_ID
=
"inspectorId"
;
/**
* 车辆状态,精确匹配
*/
String
VEHICLE_STATE
=
"vehicleState"
;
}
}
}
}
aus-core/src/main/java/com/glsx/usedcar/module/inspect/entity/InspectionReport.java
View file @
881b74e
...
@@ -15,7 +15,6 @@ import org.summerframework.orm.validator.UpdateValidGroup;
...
@@ -15,7 +15,6 @@ import org.summerframework.orm.validator.UpdateValidGroup;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
static
jakarta
.
persistence
.
GenerationType
.
IDENTITY
;
import
static
jakarta
.
persistence
.
GenerationType
.
IDENTITY
;
...
@@ -34,12 +33,11 @@ import static jakarta.persistence.GenerationType.IDENTITY;
...
@@ -34,12 +33,11 @@ import static jakarta.persistence.GenerationType.IDENTITY;
@Table
(
@Table
(
name
=
"inspection_report"
,
name
=
"inspection_report"
,
indexes
=
{
indexes
=
{
// 对齐数据库索引配置
@Index
(
name
=
"uk_report_no"
,
columnList
=
"report_no"
,
unique
=
true
),
@Index
(
name
=
"uk_report_no"
,
columnList
=
"report_no"
,
unique
=
true
),
@Index
(
name
=
"idx_wo_id_del"
,
columnList
=
"wo_id, delete_flag"
),
@Index
(
name
=
"idx_wo_id_del"
,
columnList
=
"wo_id, delete_flag"
),
@Index
(
name
=
"idx_work_order_inner_id_del"
,
columnList
=
"work_order_inner_id, delete_flag"
),
@Index
(
name
=
"idx_work_order_inner_id_del"
,
columnList
=
"work_order_inner_id, delete_flag"
),
@Index
(
name
=
"idx_vehicle_id_del"
,
columnList
=
"vehicle_id, delete_flag"
),
@Index
(
name
=
"idx_vehicle_id_del"
,
columnList
=
"vehicle_id, delete_flag"
),
@Index
(
name
=
"idx_
score_level_bind_status_del"
,
columnList
=
"score_level, bind_status
, delete_flag"
)
@Index
(
name
=
"idx_
inspection_record_id_del"
,
columnList
=
"inspection_record_id
, delete_flag"
)
}
}
)
)
@EntityListeners
(
AuditingEntityListener
.
class
)
@EntityListeners
(
AuditingEntityListener
.
class
)
...
@@ -83,7 +81,6 @@ public class InspectionReport extends AuditingEntity implements Serializable {
...
@@ -83,7 +81,6 @@ public class InspectionReport extends AuditingEntity implements Serializable {
/**
/**
* 关联检测工单主键ID(对应inspection_work_order.id)
* 关联检测工单主键ID(对应inspection_work_order.id)
* 关联InspectionWorkOrder实体(懒加载,非级联)
*/
*/
@JsonView
(
value
=
Summary
.
class
)
@JsonView
(
value
=
Summary
.
class
)
@OneToOne
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
)
@OneToOne
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
)
...
@@ -108,26 +105,20 @@ public class InspectionReport extends AuditingEntity implements Serializable {
...
@@ -108,26 +105,20 @@ public class InspectionReport extends AuditingEntity implements Serializable {
private
Vehicle
vehicle
;
private
Vehicle
vehicle
;
/**
/**
* 评分(保留1位小数,与工单评分一致)
* 检测记录ID(关联InspectionRecord实体)
* 对齐数据库 decimal(4,1)
*/
*/
@JsonView
(
value
=
Summary
.
class
)
@JsonView
(
value
=
Summary
.
class
)
@Column
(
name
=
"score"
,
nullable
=
true
,
precision
=
4
,
scale
=
1
)
@OneToOne
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
)
private
BigDecimal
score
;
@JoinColumn
(
name
=
"inspection_record_id"
,
/**
referencedColumnName
=
"id"
,
* 评分级别(ABCDEF)
nullable
=
false
* 对齐数据库 char(1)
)
*/
@ReadOnlyProperty
@JsonView
(
value
=
Summary
.
class
)
private
InspectionRecord
inspectionRecord
;
@NotBlank
(
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Size
(
max
=
1
,
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Column
(
name
=
"score_level"
,
nullable
=
false
,
columnDefinition
=
"char(1)"
)
private
String
scoreLevel
;
/**
/**
* 绑定状态(1:已绑定;2:未绑定)
* 绑定状态(1:已绑定;2:未绑定)
* 对齐数据库 tinyint(2)
*/
*/
@JsonView
(
value
=
Summary
.
class
)
@JsonView
(
value
=
Summary
.
class
)
@NotNull
(
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@NotNull
(
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
...
@@ -144,10 +135,9 @@ public class InspectionReport extends AuditingEntity implements Serializable {
...
@@ -144,10 +135,9 @@ public class InspectionReport extends AuditingEntity implements Serializable {
/**
/**
* 删除标识 N:未删除 D:已删除
* 删除标识 N:未删除 D:已删除
* 对齐数据库 char(1) DEFAULT 'N'
*/
*/
@Builder
.
Default
@Builder
.
Default
@Column
(
name
=
"delete_flag"
,
nullable
=
false
,
length
=
1
,
columnDefinition
=
"char(1) DEFAULT 'N'"
)
@Column
(
name
=
"delete_flag"
,
nullable
=
false
,
columnDefinition
=
"char(1) DEFAULT 'N'"
)
private
String
deleteFlag
=
"N"
;
private
String
deleteFlag
=
"N"
;
}
}
\ No newline at end of file
\ No newline at end of file
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionReportService.java
View file @
881b74e
...
@@ -3,13 +3,14 @@ package com.glsx.usedcar.module.inspect.service;
...
@@ -3,13 +3,14 @@ package com.glsx.usedcar.module.inspect.service;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.glsx.usedcar.config.InspectorConfig
;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.consts.inspect.JpaQueryConstants
;
import
com.glsx.usedcar.consts.inspect.JpaQueryConstants
;
import
com.glsx.usedcar.converts.InspectionReportConverter
;
import
com.glsx.usedcar.converts.*
;
import
com.glsx.usedcar.converts.InspectionReportOpLogConverter
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
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.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.*
;
import
com.glsx.usedcar.module.vehicle.dao.VehicleDao
;
import
com.glsx.usedcar.module.vehicle.dao.VehicleDao
;
...
@@ -25,7 +26,6 @@ import org.summerframework.core.enums.ErrorCodeEnum;
...
@@ -25,7 +26,6 @@ import org.summerframework.core.enums.ErrorCodeEnum;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.orm.paging.Pagination
;
import
org.summerframework.orm.paging.Pagination
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
...
@@ -49,6 +49,8 @@ public class InspectionReportService {
...
@@ -49,6 +49,8 @@ public class InspectionReportService {
private
final
InspectionReportOpLogConverter
inspectionReportOpLogConverter
;
private
final
InspectionReportOpLogConverter
inspectionReportOpLogConverter
;
private
final
VehicleDao
vehicleDao
;
private
final
VehicleDao
vehicleDao
;
private
final
InspectionRecordRepository
inspectionRecordRepository
;
private
final
InspectionRecordRepository
inspectionRecordRepository
;
private
final
InspectorConfig
inspectorConfig
;
private
final
InspectionRecordService
InspectionRecordService
;
// ======================== 日志保存方法(核心,接收真实操作人) ========================
// ======================== 日志保存方法(核心,接收真实操作人) ========================
/**
/**
...
@@ -133,17 +135,18 @@ public class InspectionReportService {
...
@@ -133,17 +135,18 @@ public class InspectionReportService {
// 1. 生成唯一报告编号
// 1. 生成唯一报告编号
String
reportNo
=
genReportNo
();
String
reportNo
=
genReportNo
();
log
.
info
(
"【报告新增】操作人={},开始生成报告,编号={},关联工单号={}"
,
operatorName
,
reportNo
,
wo
.
getWoId
());
log
.
info
(
"【报告新增】操作人={},开始生成报告,编号={},关联工单号={}"
,
operatorName
,
reportNo
,
wo
.
getWoId
());
InspectionRecord
inspectionRecord
=
inspectionRecordRepository
.
findByTaskIdAndDeletedFlag
(
wo
.
getId
(),
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
orElseThrow
(()
->
new
BusinessCodeException
(
ErrorCodeEnum
.
COMMON_ERROR
,
"检测记录不存在,ID:"
+
wo
.
getId
()));
String
h5Url
=
String
.
format
(
inspectorConfig
.
getInspectionRecordH5Url
(),
inspectionRecord
.
getId
());
// 2. 构建报告实体
// 2. 构建报告实体
InspectionReport
report
=
InspectionReport
.
builder
()
InspectionReport
report
=
InspectionReport
.
builder
()
.
reportNo
(
reportNo
)
.
reportNo
(
reportNo
)
.
woId
(
wo
.
getWoId
())
.
woId
(
wo
.
getWoId
())
.
vehicle
(
vehicle
)
.
vehicle
(
vehicle
)
.
workOrder
(
wo
)
.
workOrder
(
wo
)
.
score
(
BigDecimal
.
ZERO
)
.
inspectionRecord
(
inspectionRecord
)
.
scoreLevel
(
""
)
.
bindStatus
(
2
)
.
bindStatus
(
2
)
// 初始未绑定
.
h5Url
(
h5Url
)
.
h5Url
(
""
)
.
deleteFlag
(
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
deleteFlag
(
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
build
();
.
build
();
inspectionReportRepository
.
save
(
report
);
inspectionReportRepository
.
save
(
report
);
...
@@ -188,21 +191,6 @@ public class InspectionReportService {
...
@@ -188,21 +191,6 @@ public class InspectionReportService {
Integer
operationType
=
InspectionReportOperationTypeEnum
.
OTHER_UPDATE
.
getCode
();
Integer
operationType
=
InspectionReportOperationTypeEnum
.
OTHER_UPDATE
.
getCode
();
StringBuilder
operationContent
=
new
StringBuilder
(
"修改检测报告:"
);
StringBuilder
operationContent
=
new
StringBuilder
(
"修改检测报告:"
);
// 评分+评分级别更新
boolean
isScoreUpdate
=
false
;
if
(
updateVO
.
getScore
()
!=
null
&&
!
Objects
.
equals
(
report
.
getScore
(),
updateVO
.
getScore
()))
{
operationContent
.
append
(
String
.
format
(
"评分从[%s]改为[%s];"
,
report
.
getScore
(),
updateVO
.
getScore
()));
report
.
setScore
(
updateVO
.
getScore
());
isScoreUpdate
=
true
;
}
if
(
updateVO
.
getScoreLevel
()
!=
null
&&
!
Objects
.
equals
(
report
.
getScoreLevel
(),
updateVO
.
getScoreLevel
()))
{
operationContent
.
append
(
String
.
format
(
"评分级别从[%s]改为[%s];"
,
report
.
getScoreLevel
(),
updateVO
.
getScoreLevel
()));
report
.
setScoreLevel
(
updateVO
.
getScoreLevel
());
isScoreUpdate
=
true
;
}
if
(
isScoreUpdate
)
{
operationType
=
InspectionReportOperationTypeEnum
.
UPDATE_SCORE_LEVEL
.
getCode
();
}
// 其他字段更新
// 其他字段更新
if
(
updateVO
.
getWoId
()
!=
null
&&
!
Objects
.
equals
(
report
.
getWoId
(),
updateVO
.
getWoId
()))
{
if
(
updateVO
.
getWoId
()
!=
null
&&
!
Objects
.
equals
(
report
.
getWoId
(),
updateVO
.
getWoId
()))
{
operationContent
.
append
(
String
.
format
(
"关联工单号从[%s]改为[%s];"
,
report
.
getWoId
(),
updateVO
.
getWoId
()));
operationContent
.
append
(
String
.
format
(
"关联工单号从[%s]改为[%s];"
,
report
.
getWoId
(),
updateVO
.
getWoId
()));
...
@@ -390,7 +378,7 @@ public class InspectionReportService {
...
@@ -390,7 +378,7 @@ public class InspectionReportService {
}
}
if
(
seqNum
>
9999
)
{
if
(
seqNum
>
9999
)
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
SYSTEM
_ERROR
,
"当日报告编号流水号已达上限(9999),请次日再试"
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
COMMON
_ERROR
,
"当日报告编号流水号已达上限(9999),请次日再试"
);
}
}
return
String
.
format
(
"BG%s%04d"
,
dateStr
,
seqNum
);
return
String
.
format
(
"BG%s%04d"
,
dateStr
,
seqNum
);
...
@@ -398,7 +386,7 @@ public class InspectionReportService {
...
@@ -398,7 +386,7 @@ public class InspectionReportService {
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"【报告编号】生成失败"
,
e
);
log
.
error
(
"【报告编号】生成失败"
,
e
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
SYSTEM
_ERROR
,
"生成检测报告编号失败"
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
COMMON
_ERROR
,
"生成检测报告编号失败"
);
}
}
}
}
...
@@ -450,6 +438,11 @@ public class InspectionReportService {
...
@@ -450,6 +438,11 @@ public class InspectionReportService {
builder
.
like
(
root
.
get
(
InspectionReport_
.
workOrder
).
get
(
InspectionWorkOrder_
.
woId
),
likePattern
)
builder
.
like
(
root
.
get
(
InspectionReport_
.
workOrder
).
get
(
InspectionWorkOrder_
.
woId
),
likePattern
)
));
));
}
}
Object
status
=
pagination
.
getFilterValueOrElseNull
(
JpaQueryConstants
.
InspectionReport
.
VEHICLE_STATE
);
if
(
status
instanceof
String
s
&&
StrUtil
.
isNotBlank
(
s
))
{
pagination
.
removeFilter
(
JpaQueryConstants
.
InspectionReport
.
VEHICLE_STATE
);
pagination
.
addCondition
((
root
,
query
,
builder
)
->
builder
.
equal
(
root
.
get
(
InspectionReport_
.
vehicle
).
get
(
Vehicle_
.
vehicleState
),
s
));
}
Object
inspectorId
=
pagination
.
getFilterValueOrElseNull
(
JpaQueryConstants
.
InspectionReport
.
INSPECTOR_ID
);
Object
inspectorId
=
pagination
.
getFilterValueOrElseNull
(
JpaQueryConstants
.
InspectionReport
.
INSPECTOR_ID
);
if
(
inspectorId
!=
null
)
{
if
(
inspectorId
!=
null
)
{
pagination
.
removeFilter
(
JpaQueryConstants
.
InspectionReport
.
INSPECTOR_ID
);
pagination
.
removeFilter
(
JpaQueryConstants
.
InspectionReport
.
INSPECTOR_ID
);
...
@@ -540,6 +533,10 @@ public class InspectionReportService {
...
@@ -540,6 +533,10 @@ public class InspectionReportService {
respVO
.
setExteriorScore
(
record
.
getExteriorScore
());
// 外观分数
respVO
.
setExteriorScore
(
record
.
getExteriorScore
());
// 外观分数
respVO
.
setSkeletonLevel
(
record
.
getSkeletonLevel
());
// 骨架评级
respVO
.
setSkeletonLevel
(
record
.
getSkeletonLevel
());
// 骨架评级
respVO
.
setInteriorLevel
(
record
.
getInteriorLevel
());
// 内饰评级
respVO
.
setInteriorLevel
(
record
.
getInteriorLevel
());
// 内饰评级
AccidentBurnWadeDTO
accidentBurnWadeDTO
=
InspectionRecordService
.
getAccidentBurnWadeDTO
(
record
.
getId
());
respVO
.
setAccident
(
accidentBurnWadeDTO
.
getAccident
());
respVO
.
setBurn
(
accidentBurnWadeDTO
.
getBurn
());
respVO
.
setWade
(
accidentBurnWadeDTO
.
getWade
());
log
.
info
(
"【查询成功】vehicleId={},综合分数={},外观分数={},骨架评级={},内饰评级={}"
,
log
.
info
(
"【查询成功】vehicleId={},综合分数={},外观分数={},骨架评级={},内饰评级={}"
,
vehicleId
,
vehicleId
,
...
@@ -547,7 +544,6 @@ public class InspectionReportService {
...
@@ -547,7 +544,6 @@ public class InspectionReportService {
respVO
.
getExteriorScore
(),
respVO
.
getExteriorScore
(),
respVO
.
getSkeletonLevel
(),
respVO
.
getSkeletonLevel
(),
respVO
.
getInteriorLevel
());
respVO
.
getInteriorLevel
());
// TODO 需要加上无事故无火烧无水泡
return
respVO
;
return
respVO
;
}
}
...
...
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/VehicleInspectScoreRespVO.java
View file @
881b74e
...
@@ -23,4 +23,22 @@ public class VehicleInspectScoreRespVO {
...
@@ -23,4 +23,22 @@ public class VehicleInspectScoreRespVO {
@Schema
(
description
=
"内饰评级(A/B/C/D)"
,
example
=
"B"
)
@Schema
(
description
=
"内饰评级(A/B/C/D)"
,
example
=
"B"
)
private
String
interiorLevel
;
private
String
interiorLevel
;
/**
* 是否有事故 0 否 1 是
*/
@Schema
(
description
=
"是否有事故 0 否 1 是"
,
example
=
"0"
)
private
String
accident
;
/**
* 是否有火烧 0 否 1 是
*/
@Schema
(
description
=
"是否有火烧 0 否 1 是"
,
example
=
"0"
)
private
String
burn
;
/**
* 是否有涉水 0 否 1 是
*/
@Schema
(
description
=
"是否有涉水 0 否 1 是"
,
example
=
"0"
)
private
String
wade
;
}
}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment