xuhy
2026-03-27 0923c2a6f1a7b4d28e39f566f9ff27557e2bf250
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java
@@ -1,5 +1,6 @@
package com.ruoyi.web.controller.api;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.model.*;
@@ -13,6 +14,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Api(tags = "数据大屏")
@@ -31,8 +33,9 @@
    private final TLargeVolunteerService largeVolunteerService;
    private final TLargeKeyGridUserService largeKeyGridUserService;
    private final TLargeKeyPersonnelTypeService largeKeyPersonnelTypeService;
    private final THelpNeedsService tHelpNeedsService;
    @Autowired
    public DataStatisticsController(TAppealServicesService appealServicesService, TOldsterWarningService oldsterWarningService, THtmlConfigService htmlConfigService, TLargeDeptService largeDeptService, TLargeUserService largeUserService, TLargeOrganizationService largeOrganizationService, TLargeResourceService largeResourceService, TLargeSocialWorkerService largeSocialWorkerService, TLargeVolunteerService largeVolunteerService, TLargeKeyGridUserService largeKeyGridUserService, TLargeKeyPersonnelTypeService largeKeyPersonnelTypeService) {
    public DataStatisticsController(TAppealServicesService appealServicesService, TOldsterWarningService oldsterWarningService, THtmlConfigService htmlConfigService, TLargeDeptService largeDeptService, TLargeUserService largeUserService, TLargeOrganizationService largeOrganizationService, TLargeResourceService largeResourceService, TLargeSocialWorkerService largeSocialWorkerService, TLargeVolunteerService largeVolunteerService, TLargeKeyGridUserService largeKeyGridUserService, TLargeKeyPersonnelTypeService largeKeyPersonnelTypeService, THelpNeedsService tHelpNeedsService) {
        this.appealServicesService = appealServicesService;
        this.oldsterWarningService = oldsterWarningService;
        this.htmlConfigService = htmlConfigService;
@@ -44,6 +47,7 @@
        this.largeVolunteerService = largeVolunteerService;
        this.largeKeyGridUserService = largeKeyGridUserService;
        this.largeKeyPersonnelTypeService = largeKeyPersonnelTypeService;
        this.tHelpNeedsService = tHelpNeedsService;
    }
    /**
@@ -58,11 +62,11 @@
    /**
     * 获取组织人员管理列表
     */
    @ApiOperation(value = "获取组织人员分页列表")
    @ApiOperation(value = "获取组织人员列表")
    @GetMapping(value = "/largeUserList")
    public R<List<TLargeUser>> largeUserList(@RequestParam String deptId) {
    public R<List<TLargeUser>> largeUserList(String deptId) {
        List<TLargeUser> list = largeUserService.list(Wrappers.lambdaQuery(TLargeUser.class)
                .eq(TLargeUser::getDeptId, deptId)
                .eq(Objects.nonNull(deptId),TLargeUser::getDeptId, deptId)
                .orderByDesc(TLargeUser::getCreateTime));
        return R.ok(list);
    }
@@ -77,9 +81,18 @@
        long appealServicesCount = appealServicesService.count();
        // 养老告警事件
        long warningCount = oldsterWarningService.count();
        // 随手拍
        long photoCount = appealServicesService.count(new LambdaQueryWrapper<TAppealServices>().eq(TAppealServices::getAppealType,2));
        // 诉求服务
        long appealCount = appealServicesService.count(new LambdaQueryWrapper<TAppealServices>().eq(TAppealServices::getAppealType,1));
        // 助需
        long helpNeedsCount = tHelpNeedsService.count();
        Map<String,Long> map = new HashMap<>();
        map.put("appealServicesCount",appealServicesCount);
        map.put("appealServicesCount",appealServicesCount+photoCount+appealCount+helpNeedsCount);
        map.put("warningCount",warningCount);
        map.put("photoCount",photoCount);
        map.put("appealCount",appealCount);
        map.put("helpNeedsCount",helpNeedsCount);
        return R.ok(map);
    }
@@ -126,12 +139,19 @@
        // 重点人数
        long keyCount = largeKeyGridUserService.count(Wrappers.lambdaQuery(TLargeKeyGridUser.class)
                .eq(TLargeKeyGridUser::getUserType, 1));
        List<TLargeKeyPersonnelType> list = largeKeyPersonnelTypeService.list(Wrappers.lambdaQuery(TLargeKeyPersonnelType.class)
                .eq(TLargeKeyPersonnelType::getShowType, 1));
        if(!CollectionUtils.isEmpty(list)){
            int sum = list.stream().filter(e->Objects.nonNull(e.getShowNumber())).mapToInt(TLargeKeyPersonnelType::getShowNumber).sum();
            keyCount += sum;
        }
        // 网格人数
        long gridCount = largeKeyGridUserService.count(Wrappers.lambdaQuery(TLargeKeyGridUser.class)
                .eq(TLargeKeyGridUser::getUserType, 2));
        Map<String,Long> map = new HashMap<>();
        map.put("keyCount",keyCount);
        map.put("gridCount",gridCount);
        map.put("gridCount",17079L);
//        map.put("gridCount",gridCount);
        return R.ok(map);
    }
@@ -142,7 +162,8 @@
    @GetMapping(value = "/keyPersonnelSituation")
    public R<List<TLargeKeyPersonnelType>> keyPersonnelSituation() {
        List<TLargeKeyPersonnelType> list = largeKeyPersonnelTypeService.list();
        List<TLargeKeyGridUser> largeKeyGridUsers = largeKeyGridUserService.list();
        List<TLargeKeyGridUser> largeKeyGridUsers = largeKeyGridUserService.list(Wrappers.lambdaQuery(TLargeKeyGridUser.class)
                .eq(TLargeKeyGridUser::getUserType, 1));
        for (TLargeKeyPersonnelType largeKeyPersonnelType : list) {
            if(largeKeyPersonnelType.getShowType() == 2 && !CollectionUtils.isEmpty(largeKeyGridUsers)){
                // 查询真实的汇总数据