✨ 新增调度端档案统计接口,供小程序资料页取司机与车辆证照数

This commit is contained in:
2026-10-28 16:14:20 +08:00
parent e74e6edacb
commit 29bce66d63
4 changed files with 202 additions and 0 deletions
@@ -0,0 +1,47 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 调度端档案统计(司机 + 车辆证件有效期)
*/
@Data
@Schema(description = "调度端档案统计")
public class ArchiveManageStatsVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Schema(description = "司机证件有效期统计")
private DriverExpiryStatVO driver = new DriverExpiryStatVO();
@Schema(description = "车辆证件有效期统计")
private TransportVehicleExpiryStatVO vehicle = new TransportVehicleExpiryStatVO();
}
@@ -0,0 +1,64 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springblade.transport.pojo.vo.ArchiveManageStatsVO;
import org.springblade.transport.service.IManageArchiveService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 调度端档案(小程序管理端)
* <p>
* 对外完整路径:{@code /api/blade-transport/archive/manage/**}
* (网关 StripPrefix 去掉 {@code blade-transport} 后落入 {@code /archive/manage/**})。
* 同时兼容未去前缀直连({@code /blade-transport/archive/manage/**})。
* 仅需登录态,不挂管理端菜单鉴权。
* <p>
* 为什么单独一个接口:管理端 {@code /driver/expiry-stat}、{@code /transport-vehicle/expiry-stat}
* 挂在 {@code @PreAuth(menu = "driver")} / {@code @PreAuth(menu = "transport_vehicle")} 下,
* 小程序登录的令牌 roleId 是占位值 "0"、查不到 blade_role_menu,必然被拒(401 请求未授权)。
*/
@RestController
@AllArgsConstructor
@RequestMapping({"/archive/manage", "/blade-transport/archive/manage"})
@Tag(name = "调度端档案", description = "小程序调度端资料页档案统计")
public class ManageArchiveController extends BladeController {
private final IManageArchiveService manageArchiveService;
@GetMapping("/stats")
@ApiOperationSupport(order = 1)
@Operation(summary = "档案统计", description = "司机档案与车辆档案的总数、30 天内到期数、已到期数;不按组织收口")
public R<ArchiveManageStatsVO> stats() {
return R.data(manageArchiveService.stats());
}
}
@@ -0,0 +1,37 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.service;
import org.springblade.transport.pojo.vo.ArchiveManageStatsVO;
/**
* 调度端档案统计
*/
public interface IManageArchiveService {
/**
* 司机与车辆档案的证件有效期统计
*/
ArchiveManageStatsVO stats();
}
@@ -0,0 +1,54 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.service.impl;
import lombok.AllArgsConstructor;
import org.springblade.transport.pojo.vo.ArchiveManageStatsVO;
import org.springblade.transport.pojo.vo.DriverVO;
import org.springblade.transport.pojo.vo.TransportVehicleVO;
import org.springblade.transport.service.IDriverService;
import org.springblade.transport.service.IManageArchiveService;
import org.springblade.transport.service.ITransportVehicleService;
import org.springframework.stereotype.Service;
/**
* 调度端档案统计
*/
@Service
@AllArgsConstructor
public class ManageArchiveServiceImpl implements IManageArchiveService {
private final IDriverService driverService;
private final ITransportVehicleService transportVehicleService;
@Override
public ArchiveManageStatsVO stats() {
// 复用管理端同一套统计:today / warningDate 由各 service 的 prepareQuery 自己填,
// 不传筛选条件即全量计数(与小程序侧 searchDrivers 同口径,未按组织收口)
ArchiveManageStatsVO vo = new ArchiveManageStatsVO();
vo.setDriver(driverService.expiryStat(new DriverVO()));
vo.setVehicle(transportVehicleService.expiryStat(new TransportVehicleVO()));
return vo;
}
}