diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ArchiveManageStatsVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ArchiveManageStatsVO.java new file mode 100644 index 00000000..085673f4 --- /dev/null +++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ArchiveManageStatsVO.java @@ -0,0 +1,47 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * 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(); + +} diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ManageArchiveController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ManageArchiveController.java new file mode 100644 index 00000000..e38ba183 --- /dev/null +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ManageArchiveController.java @@ -0,0 +1,64 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * 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; + +/** + * 调度端档案(小程序管理端) + *

+ * 对外完整路径:{@code /api/blade-transport/archive/manage/**} + * (网关 StripPrefix 去掉 {@code blade-transport} 后落入 {@code /archive/manage/**})。 + * 同时兼容未去前缀直连({@code /blade-transport/archive/manage/**})。 + * 仅需登录态,不挂管理端菜单鉴权。 + *

+ * 为什么单独一个接口:管理端 {@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 stats() { + return R.data(manageArchiveService.stats()); + } + +} diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IManageArchiveService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IManageArchiveService.java new file mode 100644 index 00000000..478f7654 --- /dev/null +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IManageArchiveService.java @@ -0,0 +1,37 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.transport.service; + +import org.springblade.transport.pojo.vo.ArchiveManageStatsVO; + +/** + * 调度端档案统计 + */ +public interface IManageArchiveService { + + /** + * 司机与车辆档案的证件有效期统计 + */ + ArchiveManageStatsVO stats(); + +} diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageArchiveServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageArchiveServiceImpl.java new file mode 100644 index 00000000..8bf23edf --- /dev/null +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/ManageArchiveServiceImpl.java @@ -0,0 +1,54 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * 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; + } + +}