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 528d6f7f
authored
Mar 26, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 检测提交时校验检测师
1 parent
bba25fb2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionRecordService.java
aus-framework/src/main/java/org/summerframework/core/enums/ErrorCodeEnum.java
aus-inspector/src/main/java/com/glsx/usedcar/controller/InspectionRecordController.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionRecordService.java
View file @
528d6f7
...
@@ -89,10 +89,11 @@ public class InspectionRecordService {
...
@@ -89,10 +89,11 @@ public class InspectionRecordService {
* </pre>
* </pre>
*
*
* @param req 保存请求
* @param req 保存请求
* @param inspector 当前登录的检测师
* @return 检测记录 ID
* @return 检测记录 ID
*/
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
)
public
Long
saveInspection
(
InspectionSaveVO
req
)
{
public
Long
saveInspection
(
InspectionSaveVO
req
,
Inspector
inspector
)
{
Long
taskId
=
req
.
getTaskId
();
Long
taskId
=
req
.
getTaskId
();
String
lockKey
=
StringUtils
.
templateFormat
(
InspectConstants
.
INSPECTION_LOCK_KEY
,
taskId
);
String
lockKey
=
StringUtils
.
templateFormat
(
InspectConstants
.
INSPECTION_LOCK_KEY
,
taskId
);
...
@@ -110,6 +111,11 @@ public class InspectionRecordService {
...
@@ -110,6 +111,11 @@ public class InspectionRecordService {
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
NOT_ABLE_INSPECT
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
NOT_ABLE_INSPECT
);
}
}
// 校验检测师
if
(!
inspector
.
getId
().
equals
(
Optional
.
ofNullable
(
inspectionWorkOrder
.
getInspector
()).
map
(
Inspector:
:
getId
).
orElse
(
null
)))
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
NOT_CURR_WORK_INSPECTOR
);
}
boolean
nextFlag
=
BooleanUtil
.
isTrue
(
req
.
getNextFlag
());
boolean
nextFlag
=
BooleanUtil
.
isTrue
(
req
.
getNextFlag
());
log
.
info
(
"保存检测数据,taskId: {}, nextFlag: {}"
,
taskId
,
nextFlag
);
log
.
info
(
"保存检测数据,taskId: {}, nextFlag: {}"
,
taskId
,
nextFlag
);
...
@@ -406,10 +412,11 @@ public class InspectionRecordService {
...
@@ -406,10 +412,11 @@ public class InspectionRecordService {
* </pre>
* </pre>
*
*
* @param req 完成检测请求
* @param req 完成检测请求
* @param inspector 当前登录的检测师
* @return 第一个未完成的根节点 id,全部完成返回 null
* @return 第一个未完成的根节点 id,全部完成返回 null
*/
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
)
public
CompleteInspectionRespVO
completeInspection
(
CompleteInspectionVO
req
)
{
public
CompleteInspectionRespVO
completeInspection
(
CompleteInspectionVO
req
,
Inspector
inspector
)
{
Long
taskId
=
req
.
getTaskId
();
Long
taskId
=
req
.
getTaskId
();
log
.
info
(
"检测师完成检测,taskId: {}"
,
taskId
);
log
.
info
(
"检测师完成检测,taskId: {}"
,
taskId
);
...
@@ -429,6 +436,11 @@ public class InspectionRecordService {
...
@@ -429,6 +436,11 @@ public class InspectionRecordService {
}
}
InspectionTemplateDTO
inspectionTemplateDTO
=
inspectionTemplateService
.
getTemplateByIdAndVersion
(
inspectionWorkOrder
.
getTemplateId
(),
inspectionWorkOrder
.
getTemplateVersion
());
InspectionTemplateDTO
inspectionTemplateDTO
=
inspectionTemplateService
.
getTemplateByIdAndVersion
(
inspectionWorkOrder
.
getTemplateId
(),
inspectionWorkOrder
.
getTemplateVersion
());
// 校验检测师
if
(!
inspector
.
getId
().
equals
(
Optional
.
ofNullable
(
inspectionWorkOrder
.
getInspector
()).
map
(
Inspector:
:
getId
).
orElse
(
null
)))
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
NOT_CURR_WORK_INSPECTOR
);
}
// 1. 查询检测记录,不存在则新建
// 1. 查询检测记录,不存在则新建
InspectionRecord
record
;
InspectionRecord
record
;
Optional
<
InspectionRecord
>
inspectionRecordOptional
=
inspectionRecordRepository
.
findByTaskIdAndDeletedFlag
(
taskId
,
DeleteFlag
.
NOT_DELETED
.
getCode
());
Optional
<
InspectionRecord
>
inspectionRecordOptional
=
inspectionRecordRepository
.
findByTaskIdAndDeletedFlag
(
taskId
,
DeleteFlag
.
NOT_DELETED
.
getCode
());
...
...
aus-framework/src/main/java/org/summerframework/core/enums/ErrorCodeEnum.java
View file @
528d6f7
...
@@ -45,6 +45,8 @@ public enum ErrorCodeEnum {
...
@@ -45,6 +45,8 @@ public enum ErrorCodeEnum {
NOT_ABLE_INSPECT
(
1001104
,
"当前工单无法提交检测"
),
NOT_ABLE_INSPECT
(
1001104
,
"当前工单无法提交检测"
),
NODE_CHECK_RULE_ERROR
(
1001105
,
"【{0}】校验规则解析异常"
),
NODE_CHECK_RULE_ERROR
(
1001105
,
"【{0}】校验规则解析异常"
),
NOT_CURR_WORK_INSPECTOR
(
1001106
,
"您不是当前工单的检测师,无法提交!"
)
;
;
private
final
Integer
code
;
private
final
Integer
code
;
private
final
String
message
;
private
final
String
message
;
...
...
aus-inspector/src/main/java/com/glsx/usedcar/controller/InspectionRecordController.java
View file @
528d6f7
...
@@ -2,6 +2,8 @@ package com.glsx.usedcar.controller;
...
@@ -2,6 +2,8 @@ package com.glsx.usedcar.controller;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.glsx.usedcar.annotation.RequireLogin
;
import
com.glsx.usedcar.annotation.RequireLogin
;
import
com.glsx.usedcar.context.InspectorContext
;
import
com.glsx.usedcar.module.inspect.entity.Inspector
;
import
com.glsx.usedcar.module.inspect.service.InspectionRecordService
;
import
com.glsx.usedcar.module.inspect.service.InspectionRecordService
;
import
com.glsx.usedcar.module.inspect.vo.CompleteInspectionRespVO
;
import
com.glsx.usedcar.module.inspect.vo.CompleteInspectionRespVO
;
import
com.glsx.usedcar.module.inspect.vo.CompleteInspectionVO
;
import
com.glsx.usedcar.module.inspect.vo.CompleteInspectionVO
;
...
@@ -16,9 +18,12 @@ import lombok.RequiredArgsConstructor;
...
@@ -16,9 +18,12 @@ import lombok.RequiredArgsConstructor;
import
lombok.Value
;
import
lombok.Value
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Optional
;
/**
/**
* 检测记录前端控制器
* 检测记录前端控制器
...
@@ -46,14 +51,18 @@ public class InspectionRecordController {
...
@@ -46,14 +51,18 @@ public class InspectionRecordController {
@PostMapping
(
"/save"
)
@PostMapping
(
"/save"
)
@Operation
(
summary
=
"保存/下一步"
,
description
=
"分步保存同一级的所有叶子节点数据,包括检测记录主表和检测值明细"
)
@Operation
(
summary
=
"保存/下一步"
,
description
=
"分步保存同一级的所有叶子节点数据,包括检测记录主表和检测值明细"
)
public
BaseResp
<
Long
>
saveInspection
(
@RequestBody
@Valid
InspectionSaveVO
req
)
{
public
BaseResp
<
Long
>
saveInspection
(
@RequestBody
@Valid
InspectionSaveVO
req
)
{
Long
recordId
=
inspectionRecordService
.
saveInspection
(
req
);
Inspector
inspector
=
Optional
.
ofNullable
(
InspectorContext
.
getInspector
())
.
orElseThrow
(()
->
new
BusinessCodeException
(
ErrorCodeEnum
.
LOGIN_ERROR
));
Long
recordId
=
inspectionRecordService
.
saveInspection
(
req
,
inspector
);
return
BaseResp
.
success
(
recordId
,
"保存成功"
);
return
BaseResp
.
success
(
recordId
,
"保存成功"
);
}
}
@PostMapping
(
"/completeInspection"
)
@PostMapping
(
"/completeInspection"
)
@Operation
(
summary
=
"完成检测"
,
description
=
"完成检测,全量检查所有必填选项"
)
@Operation
(
summary
=
"完成检测"
,
description
=
"完成检测,全量检查所有必填选项"
)
public
BaseResp
<
CompleteInspectionRespVO
>
completeInspection
(
@RequestBody
@Valid
CompleteInspectionVO
req
)
{
public
BaseResp
<
CompleteInspectionRespVO
>
completeInspection
(
@RequestBody
@Valid
CompleteInspectionVO
req
)
{
return
BaseResp
.
success
(
inspectionRecordService
.
completeInspection
(
req
),
"完成检测"
);
Inspector
inspector
=
Optional
.
ofNullable
(
InspectorContext
.
getInspector
())
.
orElseThrow
(()
->
new
BusinessCodeException
(
ErrorCodeEnum
.
LOGIN_ERROR
));
return
BaseResp
.
success
(
inspectionRecordService
.
completeInspection
(
req
,
inspector
),
"完成检测"
);
}
}
/**
/**
...
...
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