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 061e3730
authored
Aug 14, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v5.8.5' of
http://192.168.3.233:8090/usedCarAuction/aus
into v5.8.5
2 parents
984777b6
79fa41ad
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
5 deletions
aus-admin/src/main/java/com/glsx/usedcar/web/rest/vehicle/VehicleController.java
aus-core/src/main/java/com/glsx/usedcar/module/vehicle/service/VehicleService.java
aus-core/src/main/java/com/glsx/usedcar/module/vehicle/vo/VehicleAllStateCountRespVO.java
aus-front/admin/src/api/VehicleController.ts
aus-front/admin/src/views/vehicle/auction/AuctionVehiclePage.vue
aus-admin/src/main/java/com/glsx/usedcar/web/rest/vehicle/VehicleController.java
View file @
061e373
...
@@ -11,6 +11,7 @@ import com.glsx.usedcar.module.vehicle.domain.VehicleVenue;
...
@@ -11,6 +11,7 @@ import com.glsx.usedcar.module.vehicle.domain.VehicleVenue;
import
com.glsx.usedcar.module.vehicle.entity.Vehicle
;
import
com.glsx.usedcar.module.vehicle.entity.Vehicle
;
import
com.glsx.usedcar.module.vehicle.entity.Vehicle_
;
import
com.glsx.usedcar.module.vehicle.entity.Vehicle_
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleAutoBidVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleAutoBidVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleAllStateCountRespVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleStateCountRespVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleStateCountRespVO
;
import
com.glsx.usedcar.module.vehicle.service.VehicleService
;
import
com.glsx.usedcar.module.vehicle.service.VehicleService
;
import
com.glsx.usedcar.resp.BaseResp
;
import
com.glsx.usedcar.resp.BaseResp
;
...
@@ -79,6 +80,15 @@ public class VehicleController {
...
@@ -79,6 +80,15 @@ public class VehicleController {
}
}
/**
/**
* 库存车辆各状态数量统计(查询条件与分页列表完全一致,统计每个状态的数量)
*/
@PostMapping
(
"vehicleAllStateCount"
)
@Operation
(
summary
=
"库存车辆各状态数量统计"
,
description
=
"查询条件与分页列表完全一致,统计每个状态的数量"
)
public
BaseResp
<
VehicleAllStateCountRespVO
>
vehicleAllStateCount
(
@RequestBody
Pagination
<
Vehicle
>
pagination
)
{
return
BaseResp
.
success
(
vehicleService
.
countVehicleByAllStates
(
pagination
));
}
/**
* 构建库存车辆分页查询条件(包含vehicleStateIndex状态过滤)
* 构建库存车辆分页查询条件(包含vehicleStateIndex状态过滤)
*/
*/
private
void
buildVehicleFilters
(
Pagination
<
Vehicle
>
pagination
)
{
private
void
buildVehicleFilters
(
Pagination
<
Vehicle
>
pagination
)
{
...
...
aus-core/src/main/java/com/glsx/usedcar/module/vehicle/service/VehicleService.java
View file @
061e373
...
@@ -18,6 +18,7 @@ import com.glsx.usedcar.module.vehicle.domain.VehicleHistoryProjection;
...
@@ -18,6 +18,7 @@ import com.glsx.usedcar.module.vehicle.domain.VehicleHistoryProjection;
import
com.glsx.usedcar.module.vehicle.domain.VehicleVenue
;
import
com.glsx.usedcar.module.vehicle.domain.VehicleVenue
;
import
com.glsx.usedcar.module.vehicle.entity.*
;
import
com.glsx.usedcar.module.vehicle.entity.*
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleAutoBidVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleAutoBidVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleAllStateCountRespVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleStateCountRespVO
;
import
com.glsx.usedcar.module.vehicle.vo.VehicleStateCountRespVO
;
import
com.glsx.usedcar.module.venue.dao.AreaDao
;
import
com.glsx.usedcar.module.venue.dao.AreaDao
;
import
com.glsx.usedcar.module.venue.dao.VenueDao
;
import
com.glsx.usedcar.module.venue.dao.VenueDao
;
...
@@ -33,6 +34,7 @@ import com.glsx.usedcar.module.vrsystem.entity.VrOrg;
...
@@ -33,6 +34,7 @@ import com.glsx.usedcar.module.vrsystem.entity.VrOrg;
import
com.glsx.usedcar.resp.BaseResp
;
import
com.glsx.usedcar.resp.BaseResp
;
import
com.glsx.usedcar.util.CoderGenerator
;
import
com.glsx.usedcar.util.CoderGenerator
;
import
jakarta.annotation.Resource
;
import
jakarta.annotation.Resource
;
import
jakarta.persistence.criteria.Predicate
;
import
jakarta.persistence.criteria.Root
;
import
jakarta.persistence.criteria.Root
;
import
jakarta.persistence.criteria.Subquery
;
import
jakarta.persistence.criteria.Subquery
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -174,6 +176,53 @@ public class VehicleService {
...
@@ -174,6 +176,53 @@ public class VehicleService {
}
}
/**
/**
* 库存车辆各状态数量统计(查询条件与分页列表完全一致,按vehicleState分组统计每个状态的数量)
*
* @param pagination 分页查询条件
* @return 各状态数量统计
*/
public
VehicleAllStateCountRespVO
countVehicleByAllStates
(
Pagination
<
Vehicle
>
pagination
)
{
try
{
// 复制分页条件用于统计
Pagination
<
Vehicle
>
p
=
pagination
.
copyForCount
();
applyVehicleFilters
(
p
);
// 移除vehicleState过滤条件,否则会只统计过滤后的状态
p
.
removeFilter
(
"vehicleState"
);
// 创建安全的Specification,确保predicate不为null
Specification
<
Vehicle
>
spec
=
(
root
,
query
,
builder
)
->
{
Predicate
predicate
=
p
.
toPredicate
(
root
,
query
,
builder
);
return
predicate
!=
null
?
predicate
:
builder
.
conjunction
();
};
// 按vehicleState分组统计所有状态
Map
<?,
Long
>
stateCountMap
=
vehicleDao
.
countAndGroupBy
(
Vehicle_
.
vehicleState
,
spec
);
// 计算总数
long
total
=
stateCountMap
.
values
().
stream
().
mapToLong
(
Long:
:
longValue
).
sum
();
// 转换key为String类型
Map
<
String
,
Long
>
result
=
new
java
.
util
.
HashMap
<>();
stateCountMap
.
forEach
((
key
,
value
)
->
{
if
(
key
!=
null
)
{
result
.
put
(
key
.
toString
(),
value
);
}
});
return
VehicleAllStateCountRespVO
.
builder
()
.
total
(
total
)
.
stateCountMap
(
result
)
.
build
();
}
catch
(
Exception
e
)
{
log
.
error
(
"统计车辆各状态数量失败"
,
e
);
return
VehicleAllStateCountRespVO
.
builder
()
.
total
(
0L
)
.
stateCountMap
(
new
java
.
util
.
HashMap
<>())
.
build
();
}
}
/**
* 执行车辆条件查询并返回总数(不做fillVrOrgName填充,避免统计场景的无效数据库查询)
* 执行车辆条件查询并返回总数(不做fillVrOrgName填充,避免统计场景的无效数据库查询)
*/
*/
private
long
countVehicleTotal
(
Pagination
<
Vehicle
>
pagination
)
{
private
long
countVehicleTotal
(
Pagination
<
Vehicle
>
pagination
)
{
...
...
aus-core/src/main/java/com/glsx/usedcar/module/vehicle/vo/VehicleAllStateCountRespVO.java
0 → 100644
View file @
061e373
package
com
.
glsx
.
usedcar
.
module
.
vehicle
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.Map
;
/**
* 库存车辆各状态数量统计响应
*
* @author Claude
* @since 2026-08-14
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema
(
description
=
"库存车辆各状态数量统计响应"
)
public
class
VehicleAllStateCountRespVO
{
@Schema
(
description
=
"全部数量"
)
private
Long
total
;
@Schema
(
description
=
"各状态数量统计,key为状态枚举名称,value为数量"
)
private
Map
<
String
,
Long
>
stateCountMap
;
}
aus-front/admin/src/api/VehicleController.ts
View file @
061e373
...
@@ -89,6 +89,13 @@ export class VehicleController{
...
@@ -89,6 +89,13 @@ export class VehicleController{
return
axios
.
post
(
'vehicle/vehicleStateCount'
,
params
);
return
axios
.
post
(
'vehicle/vehicleStateCount'
,
params
);
}
}
/**
* 参拍车辆管理tab统计数据
*/
static
getVehicleAllStateCount
(
axios
:
AxiosStatic
,
params
:
any
):
Promise
<
AxiosResponse
<
any
>>
{
return
axios
.
post
(
'vehicle/vehicleAllStateCount'
,
params
);
}
/**
/**
*/
*/
static
getVehicleCountByStateAndDateRange
(
axios
:
AxiosStatic
,
startDate
:
Dayjs
|
string
,
endDate
:
Dayjs
|
string
):
Promise
<
AxiosResponse
<
any
>>
{
static
getVehicleCountByStateAndDateRange
(
axios
:
AxiosStatic
,
startDate
:
Dayjs
|
string
,
endDate
:
Dayjs
|
string
):
Promise
<
AxiosResponse
<
any
>>
{
...
...
aus-front/admin/src/views/vehicle/auction/AuctionVehiclePage.vue
View file @
061e373
...
@@ -114,12 +114,11 @@ export default class AuctionVehiclePage extends PaginationComponent<Vehicle> {
...
@@ -114,12 +114,11 @@ export default class AuctionVehiclePage extends PaginationComponent<Vehicle> {
get
tabs
()
{
get
tabs
()
{
let
total
=
0
;
let
total
=
0
;
for
(
const
vehicleState
of
this
.
vehicleStates
)
{
for
(
const
vehicleState
of
this
.
vehicleStates
)
{
total
=
total
+
(
this
.
vehicleCount
[
vehicleState
]
??
0
);
total
=
total
+
(
this
.
vehicleCount
?.
stateCountMap
[
vehicleState
]
??
0
);
}
}
const
tabs
=
[{
key
:
''
,
tab
:
`全部(
${
total
}
)`
}];
const
tabs
=
[{
key
:
''
,
tab
:
`全部(
${
total
}
)`
}];
this
.
vehicleStates
.
forEach
(
item
=>
{
this
.
vehicleStates
.
forEach
(
item
=>
{
tabs
.
push
({
key
:
item
,
tab
:
this
.
$t
(
'enum.vehicle.vehicleState.'
+
item
)
+
`(
${
this
.
vehicleCount
[
item
]
??
0
})
`});
tabs
.
push
({
key
:
item
,
tab
:
this
.
$t
(
'enum.vehicle.vehicleState.'
+
item
)
+
`(
${
this
.
vehicleCount
?.
stateCountMap
[
item
]
??
0
})
`});
});
});
return tabs;
return tabs;
}
}
...
@@ -139,8 +138,9 @@ export default class AuctionVehiclePage extends PaginationComponent<Vehicle> {
...
@@ -139,8 +138,9 @@ export default class AuctionVehiclePage extends PaginationComponent<Vehicle> {
}
}
loadVehicleCount() {
loadVehicleCount() {
VehicleController.getVehicleCountByState(this.axios).then(res => {
VehicleController.getVehicleAllStateCount(this.axios, this.pagination.requestParams).then(res => {
this.vehicleCount = res.data;
console.log(res.data?.data)
this.vehicleCount = res.data.data;
});
});
}
}
...
...
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