From 1abab3ed63e5648b8d88c412dce70aad0736b98a Mon Sep 17 00:00:00 2001
From: luoyisheng <yangdongji@argo-ai.cn>
Date: 星期二, 25 三月 2025 15:13:30 +0800
Subject: [PATCH] bug

---
 medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppMwWarningRecordController.java |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppMwWarningRecordController.java b/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppMwWarningRecordController.java
index c282814..2aa60e8 100644
--- a/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppMwWarningRecordController.java
+++ b/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppMwWarningRecordController.java
@@ -5,8 +5,10 @@
 import com.sinata.common.core.domain.entity.SysUser;
 import com.sinata.common.utils.SecurityUtils;
 import com.sinata.system.domain.MwWarningRecord;
+import com.sinata.system.domain.SysDepartment;
 import com.sinata.system.domain.dto.CollectTotalUpDto;
 import com.sinata.system.service.MwWarningRecordService;
+import com.sinata.system.service.SysDepartmentService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -32,12 +34,33 @@
 @AllArgsConstructor
 public class AppMwWarningRecordController {
     private  final MwWarningRecordService mwWarningRecordService;
+    private final SysDepartmentService sysDepartmentService;
 
     @ApiOperation("预警记录")
     @PostMapping("/record")
     public R<Page<MwWarningRecord>> record(@RequestParam Integer pageNum,@RequestParam Integer pageSize) {
-        SysUser sysUser = SecurityUtils.getLoginUser().getUser();
-        Page<MwWarningRecord> page = mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId, sysUser.getDepartmentId()).page(Page.of(pageNum, pageSize));
+        SysDepartment myDepartment = sysDepartmentService.getMyDepartment();
+        Page<MwWarningRecord> page = mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId, myDepartment.getId()).page(Page.of(pageNum, pageSize));
+        return R.ok(page);
+    }
+
+    @ApiOperation(value = "预警统计",tags = "监管人员")
+    @PostMapping("/danger")
+    public R<List<SysDepartment>> danger(String name, Long areaId) {
+        SysDepartment byId = sysDepartmentService.getById(areaId);
+        //
+        List<SysDepartment> list = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, byId.getTreeCode()).like(name!=null,SysDepartment::getDepartmentName,name).in(SysDepartment::getOrgType, 2,3).list();
+        for (SysDepartment sysDepartment : list) {
+            sysDepartment.setDangerCount(mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId,sysDepartment.getId()).count());
+        }
+        return R.ok(list);
+    }
+
+
+    @ApiOperation(value = "预警统计详情",tags = "监管人员")
+    @PostMapping("/detail/record")
+    public R<Page<MwWarningRecord>> record1(@RequestParam Long id,@RequestParam Integer pageNum,@RequestParam Integer pageSize) {
+        Page<MwWarningRecord> page = mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId, id).page(Page.of(pageNum, pageSize));
         return R.ok(page);
     }
 

--
Gitblit v1.7.1