From 93c20ce82e56710f7cf93789e7ac7a06153111a1 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 04 六月 2025 16:13:28 +0800 Subject: [PATCH] 优化附件 --- ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java index 550d9ad..54b2ecc 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java @@ -31,6 +31,7 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -56,9 +57,15 @@ @GetMapping("/getCarWarnList") @ApiOperation(value = "获取车辆预警列表数据", tags = {"车辆管理", "预警记录", "首页"}) - public R<PageInfo<CarWarnListResp>> getCarWarnList(CarWarnListReq carWarnListReq) { + public R<Map<String, Object>> getCarWarnList(CarWarnListReq carWarnListReq) { PageInfo<CarWarnListResp> pageInfo = warnService.getCarWarnList(carWarnListReq); - return R.ok(pageInfo); + Map<String, Object> map = new HashMap<>(); + map.put("page", pageInfo); + List<Warn> list = warnService.getAllCarWarnList(carWarnListReq); + map.put("total", list.size()); + map.put("processed", list.stream().filter(s->!s.getTreatmentState().equals("处理中")).count()); + map.put("unprocessed", list.stream().filter(s->s.getTreatmentState().equals("处理中")).count()); + return R.ok(map); } @@ -123,6 +130,7 @@ warnResp.setLon(new BigDecimal(warn.getLongitude())); warnResp.setLat(new BigDecimal(warn.getLatitude())); warnResp.setAddress(warn.getAddress()); + warnResp.setImageUrl(warn.getPicUrl()); warnList.add(warnResp); } carWarnInfoResp.setWarnList(warnList); @@ -142,4 +150,14 @@ List<Map<String, Object>> warnGroupCountTop10 = warnService.getWarnGroupCountTop10(); return R.ok(warnGroupCountTop10); } + + + + + @GetMapping("/getAllWarnGroupVehicleType") + @ApiOperation(value = "获取根据车辆类型的报警汇总数据", tags = {"首页"}) + public R<List<Map<String, Object>>> getAllWarnGroupVehicleType(){ + List<Map<String, Object>> allWarnGroupVehicleType = warnService.getAllWarnGroupVehicleType(); + return R.ok(allWarnGroupVehicleType); + } } -- Gitblit v1.7.1