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 b6f36e18
authored
Mar 20, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:跨域配置以及修改检测工单开始检测,结束检测的方法签名
1 parent
2c746078
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
138 additions
and
32 deletions
aus-core/src/main/java/com/glsx/usedcar/module/inspect/dao/InspectionReportRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/dao/InspectionWorkOrderRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/entity/InspectionWorkOrder.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionReportService.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionWorkOrderService.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectionReportRespVO.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectionWODetailRespVO.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectionWORespVO.java
aus-inspector/src/main/java/com/glsx/usedcar/config/CorsFilterConfig.java
aus-inspector/src/main/java/com/glsx/usedcar/controller/InspectionWorkOrderController.java
aus-inspector/src/main/java/com/glsx/usedcar/req/InspectionWorkOrderReq.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/dao/InspectionReportRepository.java
View file @
b6f36e1
...
@@ -33,7 +33,7 @@ public interface InspectionReportRepository extends BaseRepository<InspectionRep
...
@@ -33,7 +33,7 @@ public interface InspectionReportRepository extends BaseRepository<InspectionRep
* @param woId 工单号
* @param woId 工单号
* @return 检测报告列表
* @return 检测报告列表
*/
*/
List
<
InspectionReport
>
findByWoId
(
String
woId
);
Optional
<
InspectionReport
>
findByWoIdAndDeleteFlag
(
String
woId
,
String
deleteFlag
);
/**
/**
* 根据车辆ID查询未删除的检测报告
* 根据车辆ID查询未删除的检测报告
...
...
aus-core/src/main/java/com/glsx/usedcar/module/inspect/dao/InspectionWorkOrderRepository.java
View file @
b6f36e1
...
@@ -60,6 +60,7 @@ public interface InspectionWorkOrderRepository extends BaseRepository<Inspection
...
@@ -60,6 +60,7 @@ public interface InspectionWorkOrderRepository extends BaseRepository<Inspection
* @param deletedFlag 删除标识
* @param deletedFlag 删除标识
* @return 检测工单信息
* @return 检测工单信息
*/
*/
@EntityGraph
(
attributePaths
=
{
"vehicle"
,
"inspector"
})
Optional
<
InspectionWorkOrder
>
findByIdAndDeleteFlag
(
Long
taskId
,
String
deletedFlag
);
Optional
<
InspectionWorkOrder
>
findByIdAndDeleteFlag
(
Long
taskId
,
String
deletedFlag
);
...
@@ -88,4 +89,12 @@ public interface InspectionWorkOrderRepository extends BaseRepository<Inspection
...
@@ -88,4 +89,12 @@ public interface InspectionWorkOrderRepository extends BaseRepository<Inspection
boolean
existsByVehicleAndDeleteFlagAndStatusIn
(
Vehicle
vehicle
,
String
deleteFlag
,
List
<
Integer
>
status
);
boolean
existsByVehicleAndDeleteFlagAndStatusIn
(
Vehicle
vehicle
,
String
deleteFlag
,
List
<
Integer
>
status
);
Long
countByStatusAndDeleteFlag
(
Integer
status
,
String
deleteFlag
);
Long
countByStatusAndDeleteFlag
(
Integer
status
,
String
deleteFlag
);
/**
* 按检测师、工单状态、删除标识统计工单数量
* @param inspector 检测师
* @param status 工单状态
* @param deleteFlag 删除标识
* @return 符合条件的工单数量
*/
Long
countByInspectorAndStatusAndDeleteFlag
(
Inspector
inspector
,
Integer
status
,
String
deleteFlag
);
}
}
\ No newline at end of file
\ No newline at end of file
aus-core/src/main/java/com/glsx/usedcar/module/inspect/entity/InspectionWorkOrder.java
View file @
b6f36e1
...
@@ -58,7 +58,7 @@ public class InspectionWorkOrder extends AuditingEntity implements Serializable
...
@@ -58,7 +58,7 @@ public class InspectionWorkOrder extends AuditingEntity implements Serializable
@JsonView
(
value
=
Summary
.
class
)
@JsonView
(
value
=
Summary
.
class
)
private
Long
id
;
private
Long
id
;
@
Many
ToOne
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
)
@
One
ToOne
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
@JoinColumn
(
name
=
"vehicle_id"
,
name
=
"vehicle_id"
,
referencedColumnName
=
"vehicleId"
,
referencedColumnName
=
"vehicleId"
,
...
@@ -66,7 +66,7 @@ public class InspectionWorkOrder extends AuditingEntity implements Serializable
...
@@ -66,7 +66,7 @@ public class InspectionWorkOrder extends AuditingEntity implements Serializable
)
)
private
Vehicle
vehicle
;
private
Vehicle
vehicle
;
@
Many
ToOne
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
)
@
One
ToOne
(
cascade
=
{},
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
@JoinColumn
(
name
=
"inspector_id"
,
name
=
"inspector_id"
,
referencedColumnName
=
"id"
,
referencedColumnName
=
"id"
,
...
...
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionReportService.java
View file @
b6f36e1
...
@@ -408,11 +408,6 @@ public class InspectionReportService {
...
@@ -408,11 +408,6 @@ public class InspectionReportService {
return
inspectionReportRepository
.
findByVehicleAndDeleteFlag
(
vehicle
,
DeleteFlag
.
NOT_DELETED
.
getCode
());
return
inspectionReportRepository
.
findByVehicleAndDeleteFlag
(
vehicle
,
DeleteFlag
.
NOT_DELETED
.
getCode
());
}
}
public
List
<
InspectionReport
>
listByWoId
(
String
woId
)
{
log
.
info
(
"【报告查询】按工单号查询,工单号={}"
,
woId
);
return
inspectionReportRepository
.
findByWoId
(
woId
);
}
public
List
<
InspectionReport
>
listByBindStatus
(
Integer
bindStatus
)
{
public
List
<
InspectionReport
>
listByBindStatus
(
Integer
bindStatus
)
{
log
.
info
(
"【报告查询】按绑定状态查询,状态={}"
,
bindStatus
);
log
.
info
(
"【报告查询】按绑定状态查询,状态={}"
,
bindStatus
);
if
(
bindStatus
!=
1
&&
bindStatus
!=
2
)
{
if
(
bindStatus
!=
1
&&
bindStatus
!=
2
)
{
...
...
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectionWorkOrderService.java
View file @
b6f36e1
...
@@ -3,8 +3,7 @@ package com.glsx.usedcar.module.inspect.service;
...
@@ -3,8 +3,7 @@ package com.glsx.usedcar.module.inspect.service;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
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.InspectionWorkOrderConverter
;
import
com.glsx.usedcar.converts.*
;
import
com.glsx.usedcar.converts.InspectionWorkOrderOpLogConverter
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.inspect.*
;
import
com.glsx.usedcar.enums.inspect.*
;
import
com.glsx.usedcar.module.inspect.dao.*
;
import
com.glsx.usedcar.module.inspect.dao.*
;
...
@@ -43,9 +42,11 @@ public class InspectionWorkOrderService {
...
@@ -43,9 +42,11 @@ public class InspectionWorkOrderService {
private
final
RedisCacheUtil
redisCacheUtil
;
private
final
RedisCacheUtil
redisCacheUtil
;
private
final
InspectionWorkOrderConverter
inspectionWorkOrderConverter
;
private
final
InspectionWorkOrderConverter
inspectionWorkOrderConverter
;
private
final
InspectionWorkOrderOpLogConverter
inspectionWorkOrderOpLogConverter
;
private
final
InspectionWorkOrderOpLogConverter
inspectionWorkOrderOpLogConverter
;
private
final
InspectionReportConverter
inspectionReportConverter
;
private
final
VehicleDao
vehicleDao
;
private
final
VehicleDao
vehicleDao
;
private
final
InspectorRepository
inspectorRepository
;
private
final
InspectorRepository
inspectorRepository
;
private
final
InspectionReportService
inspectionReportService
;
private
final
InspectionReportService
inspectionReportService
;
private
final
InspectionReportRepository
inspectionReportRepository
;
/**
/**
* 保存检测工单操作日志
* 保存检测工单操作日志
...
@@ -338,10 +339,18 @@ public class InspectionWorkOrderService {
...
@@ -338,10 +339,18 @@ public class InspectionWorkOrderService {
if
(
wo
==
null
)
{
if
(
wo
==
null
)
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"工单没有找到"
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"工单没有找到"
);
}
}
InspectionReport
report
=
inspectionReportRepository
.
findByWoIdAndDeleteFlag
(
wo
.
getWoId
(),
DeleteFlag
.
NOT_DELETED
.
getCode
()).
orElse
(
null
);
InspectionReportRespVO
inspectionReportRespVO
=
inspectionReportConverter
.
inspectionReportMapRespVO
(
report
);
InspectionWORespVO
inspectionWORespVO
=
inspectionWorkOrderConverter
.
inspectorMapRespVO
(
wo
);
InspectionWORespVO
inspectionWORespVO
=
inspectionWorkOrderConverter
.
inspectorMapRespVO
(
wo
);
List
<
InspectionWorkOrderOpLog
>
logList
=
inspectionWorkOrderOpLogRepository
.
findByWorkOrderInnerIdAndDeleteFlag
(
wo
.
getId
(),
DeleteFlag
.
NOT_DELETED
.
getCode
());
List
<
InspectionWorkOrderOpLog
>
logList
=
inspectionWorkOrderOpLogRepository
.
findByWorkOrderInnerIdAndDeleteFlag
(
wo
.
getId
(),
DeleteFlag
.
NOT_DELETED
.
getCode
());
List
<
InspectionWOOpLogRespVo
>
inspectionWOOpLogRespVos
=
inspectionWorkOrderOpLogConverter
.
inspectionWorkOrderOpLogMapRespVO
(
logList
);
List
<
InspectionWOOpLogRespVo
>
inspectionWOOpLogRespVos
=
inspectionWorkOrderOpLogConverter
.
inspectionWorkOrderOpLogMapRespVO
(
logList
);
return
new
InspectionWODetailRespVO
(
inspectionWORespVO
,
inspectionWOOpLogRespVos
);
InspectionWODetailRespVO
result
=
new
InspectionWODetailRespVO
();
result
.
setInspectionWORespVO
(
inspectionWORespVO
);
result
.
setLogList
(
inspectionWOOpLogRespVos
);
if
(
inspectionReportRespVO
!=
null
)
{
result
.
setInspectionReportRespVO
(
inspectionReportRespVO
);
}
return
result
;
}
}
...
@@ -450,16 +459,10 @@ public class InspectionWorkOrderService {
...
@@ -450,16 +459,10 @@ public class InspectionWorkOrderService {
* 开始检测(修改状态+记录开始时间+保存日志)
* 开始检测(修改状态+记录开始时间+保存日志)
*
*
* @param id 工单主键ID
* @param id 工单主键ID
* @param opId 操作人ID(外部传入)
* @param opName 操作人姓名
* @param platTypeEnum 平台标识枚举
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
startInspection
(
Long
id
,
Integer
opId
,
String
opName
,
InspectionPlatTypeEnum
platTypeEnum
)
{
public
void
startInspection
(
Long
id
)
{
// 1. 基础参数校验
// 1. 基础参数校验
if
(
opId
==
null
||
StrUtil
.
isBlank
(
opName
)
||
platTypeEnum
==
null
)
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"操作人信息/平台标识不能为空"
);
}
if
(
id
==
null
)
{
if
(
id
==
null
)
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"工单ID不能为空"
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"工单ID不能为空"
);
}
}
...
@@ -474,6 +477,10 @@ public class InspectionWorkOrderService {
...
@@ -474,6 +477,10 @@ public class InspectionWorkOrderService {
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
String
.
format
(
"工单状态为[%s],仅已派单状态可开始检测,工单ID:"
,
workOrder
.
getStatus
()),
id
);
String
.
format
(
"工单状态为[%s],仅已派单状态可开始检测,工单ID:"
,
workOrder
.
getStatus
()),
id
);
}
}
Inspector
inspector
=
workOrder
.
getInspector
();
String
opName
=
inspector
.
getName
();
Long
opId
=
inspector
.
getId
();
InspectionPlatTypeEnum
platTypeEnum
=
InspectionPlatTypeEnum
.
INSPECTOR
;
// 3. 保存原始状态(用于日志)
// 3. 保存原始状态(用于日志)
Integer
originalStatus
=
workOrder
.
getStatus
();
Integer
originalStatus
=
workOrder
.
getStatus
();
...
@@ -507,24 +514,23 @@ public class InspectionWorkOrderService {
...
@@ -507,24 +514,23 @@ public class InspectionWorkOrderService {
* 完成检测(修改状态+记录结束时间+保存日志)
* 完成检测(修改状态+记录结束时间+保存日志)
*
*
* @param id 工单主键ID
* @param id 工单主键ID
* @param opId 操作人ID(外部传入)
* @param opName 操作人姓名
* @param platTypeEnum 平台标识枚举
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
completeInspection
(
Long
id
,
Integer
opId
,
String
opName
,
InspectionPlatTypeEnum
platTypeEnum
)
{
public
void
completeInspection
(
Long
id
)
{
// 1. 基础参数校验
// 1. 基础参数校验
if
(
opId
==
null
||
StrUtil
.
isBlank
(
opName
)
||
platTypeEnum
==
null
)
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"操作人信息/平台标识不能为空"
);
}
if
(
id
==
null
)
{
if
(
id
==
null
)
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"工单ID不能为空"
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PARAM_ERROR
,
"工单ID不能为空"
);
}
}
InspectionPlatTypeEnum
platTypeEnum
=
InspectionPlatTypeEnum
.
INSPECTOR
;
// 2. 查询工单并校验(未删除+状态合法)
// 2. 查询工单并校验(未删除+状态合法)
InspectionWorkOrder
workOrder
=
inspectionWorkOrderRepository
.
findByIdAndDeleteFlag
(
id
,
DeleteFlag
.
NOT_DELETED
.
getCode
())
InspectionWorkOrder
workOrder
=
inspectionWorkOrderRepository
.
findByIdAndDeleteFlag
(
id
,
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
orElseThrow
(()
->
new
BusinessCodeException
(
ErrorCodeEnum
.
DATA_NOT_EXIST
,
"检测工单不存在,工单ID:"
+
id
));
.
orElseThrow
(()
->
new
BusinessCodeException
(
ErrorCodeEnum
.
DATA_NOT_EXIST
,
"检测工单不存在,工单ID:"
+
id
));
Inspector
inspector
=
workOrder
.
getInspector
();
String
opName
=
inspector
.
getName
();
Long
opId
=
inspector
.
getId
();
// 仅「检测中」状态可完成检测
// 仅「检测中」状态可完成检测
Integer
inProgressStatus
=
InspectionWorkOrderStatusEnum
.
IN_PROGRESS
.
getCode
();
Integer
inProgressStatus
=
InspectionWorkOrderStatusEnum
.
IN_PROGRESS
.
getCode
();
if
(!
Objects
.
equals
(
workOrder
.
getStatus
(),
inProgressStatus
))
{
if
(!
Objects
.
equals
(
workOrder
.
getStatus
(),
inProgressStatus
))
{
...
@@ -584,4 +590,37 @@ public class InspectionWorkOrderService {
...
@@ -584,4 +590,37 @@ public class InspectionWorkOrderService {
countVO
.
getCompletedCount
(),
countVO
.
getCanceledCount
());
countVO
.
getCompletedCount
(),
countVO
.
getCanceledCount
());
return
countVO
;
return
countVO
;
}
}
/**
* 统计指定检测师的各状态检测工单数量(仅统计未删除工单)
* @param inspector 检测师
* @return 该检测师的各状态数量统计结果
*/
public
InspectionWorkOrderStatusCountVO
countByStatusAndInspector
(
Inspector
inspector
)
{
// 空值校验:避免检测师为null导致的空指针异常
if
(
inspector
==
null
)
{
log
.
warn
(
"统计检测师维度工单数量时,检测师参数为null,返回空统计结果"
);
return
new
InspectionWorkOrderStatusCountVO
();
}
InspectionWorkOrderStatusCountVO
countVO
=
new
InspectionWorkOrderStatusCountVO
();
// 查询未删除标识(复用现有枚举)
String
notDeleted
=
DeleteFlag
.
NOT_DELETED
.
getCode
();
// 统计该检测师各状态的未删除工单数量(关联枚举编码,避免硬编码)
countVO
.
setDispatchedCount
(
inspectionWorkOrderRepository
.
countByInspectorAndStatusAndDeleteFlag
(
inspector
,
InspectionWorkOrderStatusEnum
.
DISPATCHED
.
getCode
(),
notDeleted
));
countVO
.
setInProgressCount
(
inspectionWorkOrderRepository
.
countByInspectorAndStatusAndDeleteFlag
(
inspector
,
InspectionWorkOrderStatusEnum
.
IN_PROGRESS
.
getCode
(),
notDeleted
));
countVO
.
setCompletedCount
(
inspectionWorkOrderRepository
.
countByInspectorAndStatusAndDeleteFlag
(
inspector
,
InspectionWorkOrderStatusEnum
.
COMPLETED
.
getCode
(),
notDeleted
));
countVO
.
setCanceledCount
(
inspectionWorkOrderRepository
.
countByInspectorAndStatusAndDeleteFlag
(
inspector
,
InspectionWorkOrderStatusEnum
.
CANCELED
.
getCode
(),
notDeleted
));
log
.
info
(
"检测师[{}]的工单状态统计完成:待检测={}, 检测中={}, 已完成={}, 已取消={}"
,
inspector
.
getId
(),
// 假设Inspector有id字段,可替换为姓名等标识
countVO
.
getDispatchedCount
(),
countVO
.
getInProgressCount
(),
countVO
.
getCompletedCount
(),
countVO
.
getCanceledCount
());
return
countVO
;
}
}
}
\ No newline at end of file
\ No newline at end of file
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectionReportRespVO.java
View file @
b6f36e1
...
@@ -20,9 +20,6 @@ public class InspectionReportRespVO {
...
@@ -20,9 +20,6 @@ public class InspectionReportRespVO {
@Schema
(
description
=
"关联工单号"
,
example
=
"WO20260317001"
)
@Schema
(
description
=
"关联工单号"
,
example
=
"WO20260317001"
)
private
String
woId
;
private
String
woId
;
@Schema
(
description
=
"关联工单信息"
)
private
InspectionWORespVO
workOrder
;
@Schema
(
description
=
"车辆信息"
)
@Schema
(
description
=
"车辆信息"
)
private
Vehicle
vehicle
;
private
Vehicle
vehicle
;
...
...
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectionWODetailRespVO.java
View file @
b6f36e1
...
@@ -16,9 +16,10 @@ public class InspectionWODetailRespVO {
...
@@ -16,9 +16,10 @@ public class InspectionWODetailRespVO {
@Schema
(
description
=
"工单信息"
)
@Schema
(
description
=
"工单信息"
)
private
InspectionWORespVO
inspectionWORespVO
;
private
InspectionWORespVO
inspectionWORespVO
;
@Schema
(
description
=
"日志信息"
)
@Schema
(
description
=
"日志信息"
)
private
List
<
InspectionWOOpLogRespVo
>
logList
;
private
List
<
InspectionWOOpLogRespVo
>
logList
;
@Schema
(
description
=
"报告信息"
)
private
InspectionReportRespVO
inspectionReportRespVO
;
}
}
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectionWORespVO.java
View file @
b6f36e1
...
@@ -85,4 +85,7 @@ public class InspectionWORespVO {
...
@@ -85,4 +85,7 @@ public class InspectionWORespVO {
@Schema
(
description
=
"备注"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
private
String
remark
;
@Schema
(
description
=
"驳回原因"
)
private
String
cancelContent
;
}
}
aus-inspector/src/main/java/com/glsx/usedcar/config/CorsFilterConfig.java
0 → 100644
View file @
b6f36e1
package
com
.
glsx
.
usedcar
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.cors.CorsConfiguration
;
import
org.springframework.web.cors.UrlBasedCorsConfigurationSource
;
import
org.springframework.web.filter.CorsFilter
;
@Configuration
public
class
CorsFilterConfig
{
@Bean
public
CorsFilter
corsFilter
()
{
// 1. 创建跨域配置对象
CorsConfiguration
config
=
new
CorsConfiguration
();
// 允许的源(通配符)
config
.
addAllowedOriginPattern
(
"*"
);
// 允许携带 Cookie
config
.
setAllowCredentials
(
true
);
// 允许的请求方法
config
.
addAllowedMethod
(
"*"
);
// 允许的请求头
config
.
addAllowedHeader
(
"*"
);
// 预检请求缓存时间
config
.
setMaxAge
(
3600L
);
// 2. 配置哪些路径生效
UrlBasedCorsConfigurationSource
source
=
new
UrlBasedCorsConfigurationSource
();
source
.
registerCorsConfiguration
(
"/**"
,
config
);
// 3. 创建并返回过滤器
return
new
CorsFilter
(
source
);
}
}
\ No newline at end of file
\ No newline at end of file
aus-inspector/src/main/java/com/glsx/usedcar/controller/InspectionWorkOrderController.java
View file @
b6f36e1
package
com
.
glsx
.
usedcar
.
controller
;
package
com
.
glsx
.
usedcar
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
com.glsx.usedcar.annotation.RequireLogin
;
import
com.glsx.usedcar.annotation.RequireLogin
;
import
com.glsx.usedcar.consts.inspect.JpaQueryConstants
;
import
com.glsx.usedcar.context.InspectorContext
;
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.service.InspectionWorkOrderService
;
import
com.glsx.usedcar.module.inspect.service.InspectionWorkOrderService
;
import
com.glsx.usedcar.module.inspect.vo.InspectionWODetailRespVO
;
import
com.glsx.usedcar.module.inspect.vo.*
;
import
com.glsx.usedcar.module.inspect.vo.InspectionWORespVO
;
import
com.glsx.usedcar.req.InspectionWorkOrderReq
;
import
com.glsx.usedcar.req.InspectionWorkOrderReq
;
import
com.glsx.usedcar.resp.BaseResp
;
import
com.glsx.usedcar.resp.BaseResp
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
...
@@ -12,8 +15,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
...
@@ -12,8 +15,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import
jakarta.validation.Valid
;
import
jakarta.validation.Valid
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Pagination
;
import
org.summerframework.orm.paging.Pagination
;
...
@@ -44,7 +49,9 @@ public class InspectionWorkOrderController {
...
@@ -44,7 +49,9 @@ public class InspectionWorkOrderController {
int
size
=
req
.
getSize
()
==
null
||
req
.
getSize
()
<
1
?
20
:
req
.
getSize
();
int
size
=
req
.
getSize
()
==
null
||
req
.
getSize
()
<
1
?
20
:
req
.
getSize
();
Pagination
<
InspectionWorkOrder
>
pagination
=
new
Pagination
<>((
page
-
1
)
*
size
,
size
);
Pagination
<
InspectionWorkOrder
>
pagination
=
new
Pagination
<>((
page
-
1
)
*
size
,
size
);
pagination
.
addFilter
(
"status"
,
req
.
getStatus
(),
Operator
.
eq
);
pagination
.
addFilter
(
"status"
,
req
.
getStatus
(),
Operator
.
eq
);
if
(
StringUtils
.
isNotBlank
(
req
.
getKeyword
()))
{
pagination
.
addFilter
(
JpaQueryConstants
.
InspectionWorkOrder
.
KEYWORD
,
req
.
getKeyword
(),
Operator
.
eq
);
}
log
.
info
(
"分页查询检测工单请求: page={}, size={}, status={}"
,
page
,
size
,
req
.
getStatus
());
log
.
info
(
"分页查询检测工单请求: page={}, size={}, status={}"
,
page
,
size
,
req
.
getStatus
());
Page
<
InspectionWORespVO
>
result
=
inspectionWorkOrderService
.
pageList
(
pagination
);
Page
<
InspectionWORespVO
>
result
=
inspectionWorkOrderService
.
pageList
(
pagination
);
return
BaseResp
.
success
(
result
);
return
BaseResp
.
success
(
result
);
...
@@ -72,4 +79,22 @@ public class InspectionWorkOrderController {
...
@@ -72,4 +79,22 @@ public class InspectionWorkOrderController {
return
BaseResp
.
fail
(
"获取检测工单详情失败:"
+
e
.
getMessage
());
return
BaseResp
.
fail
(
"获取检测工单详情失败:"
+
e
.
getMessage
());
}
}
}
}
@Operation
(
summary
=
"统计各状态工单数量"
,
description
=
"统计未删除的待检测、检测中、已完成、已取消工单数量"
)
@GetMapping
(
"/countByStatus"
)
public
BaseResp
<
InspectionWorkOrderStatusCountVO
>
countByStatus
()
{
log
.
info
(
"开始统计各状态检测工单数量"
);
try
{
Inspector
inspector
=
InspectorContext
.
getInspector
();
InspectionWorkOrderStatusCountVO
countVO
=
inspectionWorkOrderService
.
countByStatusAndInspector
(
inspector
);
return
BaseResp
.
success
(
countVO
);
}
catch
(
BusinessCodeException
be
)
{
log
.
error
(
"统计各状态工单数量失败!业务异常!"
,
be
);
return
BaseResp
.
fail
(
StrUtil
.
toString
(
be
.
getCode
()),
StrUtil
.
toString
(
be
.
getMessage
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"统计各状态工单数量失败!系统异常!"
,
e
);
return
BaseResp
.
fail
(
"系统异常: "
+
e
.
getMessage
());
}
}
}
}
\ No newline at end of file
\ No newline at end of file
aus-inspector/src/main/java/com/glsx/usedcar/req/InspectionWorkOrderReq.java
View file @
b6f36e1
...
@@ -27,4 +27,7 @@ public class InspectionWorkOrderReq {
...
@@ -27,4 +27,7 @@ public class InspectionWorkOrderReq {
@Schema
(
description
=
"工单状态 1:待检测;2:检测中;3:已完成;4:已取消"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@Schema
(
description
=
"工单状态 1:待检测;2:检测中;3:已完成;4:已取消"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@NotNull
(
message
=
"查询状态不能为空"
)
@NotNull
(
message
=
"查询状态不能为空"
)
private
Integer
status
;
private
Integer
status
;
@Schema
(
description
=
"模糊查询参数"
,
example
=
"1"
)
private
String
keyword
;
}
}
\ 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