From f899a6f51928d2801d79d3080ff8f7548f5a834d Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Fri, 19 Dec 2025 12:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A4=A7=E5=B1=8F-=E6=9C=BA?= =?UTF-8?q?=E6=9E=84=E9=97=AE=E9=A2=98=E6=8E=92=E5=90=8D=EF=BC=8C=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=B6=8B=E5=8A=BF=E6=95=B0=E6=8D=AE=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datav/DataVGlobalController.java | 15 +++- .../pojo/vo/OrganizeProblemRankVo.java | 31 ++++++-- .../supdepart/SupDepartResourceService.java | 9 ++- .../supervision/service/RpcApplyService.java | 4 ++ .../service/datav/DatavService.java | 7 ++ .../service/datav/DatavServiceImpl.java | 70 ++++++++++++++++++- .../resources/mapper/SupTaskProblemMapper.xml | 2 +- 7 files changed, 127 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java index 136a302..db5576a 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java @@ -67,8 +67,10 @@ public class DataVGlobalController { * @param beginTime 开始时间 * @param endTime 结束时间 * @return Result + * 弃用 请看 {@link #getOrganizationRank(DataVRequest)} */ @Operation(summary = "机构问题排名") + @Deprecated @GetMapping("/getOrganizationRank") public Result getOrganizationRank(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { @@ -80,8 +82,15 @@ public class DataVGlobalController { .fluentPut("jsdwlist", jsdwlist); return Result.success(res); } - - + /** + * 机构问题排名 + * @return Result + */ + @Operation(summary = "机构问题排名") + @PostMapping("/getOrganizationRank") + public Result getOrganizationRank(@RequestBody DataVRequest request) { + return datavService.getOrganizationRank(request); + } /** * 业务类型占比 * @@ -137,8 +146,10 @@ public class DataVGlobalController { * @param beginTime 开始时间 * @param endTime 结束时间 * @return Result + * 弃用 请看 {@link #getGlobalMap(DataVRequest)} */ @Operation(summary = "首页大屏地图Icon数据") + @Deprecated @GetMapping("/getGlobalMap") // @Cacheable(cacheNames = "Supervision:Screen:GlobalMap", key = "#beginTime.getTime()+'_'+#endTime.getTime()") public Result getGlobalMap(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, diff --git a/src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java b/src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java index 211fabb..64edc1e 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java @@ -1,5 +1,6 @@ package com.biutag.supervision.pojo.vo; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; /** @@ -8,10 +9,32 @@ import lombok.Data; * @Description: 机构问题排名VO */ @Data +@Schema(description = "机构问题排名VO") public class OrganizeProblemRankVo { - private String label; // 部门名 - private String value; // 问题数 - private String cityNumber;//市局问题数 - private String countyNumber; //县局问题数 + + @Schema(description = "部门名") + private String label; + + @Schema(description = "问题数") + private String value; + + @Schema(description = "市局问题数") + private String cityNumber; + + @Schema(description = "县局问题数") + private String countyNumber; + + + + public static OrganizeProblemRankVo of(String departName) { + OrganizeProblemRankVo vo = new OrganizeProblemRankVo(); + vo.setLabel(departName); + return vo; + } + + + + + } diff --git a/src/main/java/com/biutag/supervision/repository/supdepart/SupDepartResourceService.java b/src/main/java/com/biutag/supervision/repository/supdepart/SupDepartResourceService.java index cf67b84..d21cbe6 100644 --- a/src/main/java/com/biutag/supervision/repository/supdepart/SupDepartResourceService.java +++ b/src/main/java/com/biutag/supervision/repository/supdepart/SupDepartResourceService.java @@ -32,14 +32,19 @@ public class SupDepartResourceService { List departAndSubDepart = supDepartMapper.getDepartAndSubDepart(param); for (DepartAndSubDepartDto dto : departAndSubDepart) { - Set childIds = Arrays.stream(dto.getChildIdsStr().split(",")).filter(StrUtil::isNotBlank).collect(Collectors.toSet()); + Set childIds = Optional.ofNullable(dto.getChildIdsStr()) + .filter(StrUtil::isNotBlank) + .map(str -> Arrays.stream(str.split(",")) + .filter(StrUtil::isNotBlank) + .collect(Collectors.toSet())) + .orElse(new HashSet<>()); dto.setChildIds(childIds); // 创建新的集合包含所有部门ID Set allDepartIds = new HashSet<>(childIds); allDepartIds.add(dto.getParentId()); dto.setAllDepartIds(allDepartIds); } - return departAndSubDepart.stream().collect(Collectors.toMap(DepartAndSubDepartDto::getParentId, dto->dto)); + return departAndSubDepart.stream().collect(Collectors.toMap(DepartAndSubDepartDto::getParentId, dto -> dto)); } } diff --git a/src/main/java/com/biutag/supervision/service/RpcApplyService.java b/src/main/java/com/biutag/supervision/service/RpcApplyService.java index b9f08ae..a534c9d 100644 --- a/src/main/java/com/biutag/supervision/service/RpcApplyService.java +++ b/src/main/java/com/biutag/supervision/service/RpcApplyService.java @@ -30,6 +30,7 @@ import com.biutag.supervision.repository.supPolice.SupPoliceResourceService; import com.biutag.supervision.util.JSON; import jakarta.annotation.Resource; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -42,6 +43,7 @@ import java.util.stream.Collectors; @RequiredArgsConstructor @Service +@Slf4j public class RpcApplyService extends ServiceImpl { private final RpcRightPersonService rpcRightPersonService; @@ -124,6 +126,8 @@ public class RpcApplyService extends ServiceImpl { if(StrUtil.isNotBlank(queryParam.getCode())){ queryWrapper.eq("a.verified","2"); } + log.info("最终查询条件 SQL 片段:{}", queryWrapper.getSqlSegment()); + log.info("查询条件 SQL WHERE 部分: {}", queryWrapper.getCustomSqlSegment()); return baseMapper.queryRightsPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper); } diff --git a/src/main/java/com/biutag/supervision/service/datav/DatavService.java b/src/main/java/com/biutag/supervision/service/datav/DatavService.java index 8ca690f..ad99faf 100644 --- a/src/main/java/com/biutag/supervision/service/datav/DatavService.java +++ b/src/main/java/com/biutag/supervision/service/datav/DatavService.java @@ -26,4 +26,11 @@ public interface DatavService { * @return */ Result getGlobalMap(DataVRequest request); + + /** + * 获取一级首页的机构问题排名 + * @param request + * @return + */ + Result getOrganizationRank(DataVRequest request); } diff --git a/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java b/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java index c452ce1..1066be0 100644 --- a/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java @@ -8,16 +8,15 @@ import com.biutag.supervision.constants.enums.ProblemSourcesEnum; import com.biutag.supervision.constants.enums.invest.DeleteStatusEnum; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.dto.DepartAndSubDepartDto; -import com.biutag.supervision.pojo.entity.DataPetitionComplaint; import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.entity.NegativeBlame; import com.biutag.supervision.pojo.entity.SupExternalDepart; -import com.biutag.supervision.pojo.entity.mailbox.Mail; import com.biutag.supervision.pojo.entity.report.ReportProject; import com.biutag.supervision.pojo.param.*; import com.biutag.supervision.pojo.request.datav.DataVRequest; import com.biutag.supervision.pojo.vo.AuditSuperviseMapIconVo; import com.biutag.supervision.pojo.vo.GlobalMapIconVo; +import com.biutag.supervision.pojo.vo.OrganizeProblemRankVo; import com.biutag.supervision.repository.dataPetitionComplaint.DataPetitionComplaintResourceService; import com.biutag.supervision.repository.mail.MailResourceService; import com.biutag.supervision.repository.negative.NegativeResourceService; @@ -207,4 +206,71 @@ public class DatavServiceImpl implements DatavService { JSONObject data = new JSONObject().fluentPut("globalTempMapVoList", globalMapIconVoList); return Result.success(data); } + + @Override + public Result getOrganizationRank(DataVRequest request) { + Map fxsjDepartAndSubDepartData = getDepartAndSubDepartData(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId()); + Map jsdwDepartAndSubDepartData = getDepartAndSubDepartData(DepartGroupEnum.BUREAU_AFFILIATED.getId()); + List dates = Arrays.asList(request.getBeginTime(), request.getEndTime()); + List fxsjlist = new ArrayList<>(); + List jsdwlist = new ArrayList<>(); + for (DepartAndSubDepartDto dto : fxsjDepartAndSubDepartData.values()) { + Set allDepartIds = dto.getAllDepartIds(); + NegativeQueryParam negativeQueryParam = new NegativeQueryParam(); + negativeQueryParam.setCrtTime(dates); + negativeQueryParam.setInvolveDepartIds(allDepartIds); + // 问题数 + long count = negativeResourceService.count(negativeQueryParam); + OrganizeProblemRankVo organizeProblemRankVo = OrganizeProblemRankVo.of(dto.getParentName()); + if (count > 0) { + organizeProblemRankVo.setValue(String.valueOf(count)); + fxsjlist.add(organizeProblemRankVo); + } + } + for (DepartAndSubDepartDto dto : jsdwDepartAndSubDepartData.values()) { + Set allDepartIds = dto.getAllDepartIds(); + NegativeQueryParam negativeQueryParam = new NegativeQueryParam(); + negativeQueryParam.setCrtTime(dates); + negativeQueryParam.setInvolveDepartIds(allDepartIds); + // 问题数 + long count = negativeResourceService.count(negativeQueryParam); + OrganizeProblemRankVo organizeProblemRankVo = OrganizeProblemRankVo.of(dto.getParentName()); + if (count > 0) { + organizeProblemRankVo.setValue(String.valueOf(count)); + jsdwlist.add(organizeProblemRankVo); + } + } + fxsjlist.sort((o1, o2) -> { + int value1 = Integer.parseInt(o1.getValue()); + int value2 = Integer.parseInt(o2.getValue()); + return Integer.compare(value2, value1); + }); + jsdwlist.sort((o1, o2) -> { + int value1 = Integer.parseInt(o1.getValue()); + int value2 = Integer.parseInt(o2.getValue()); + return Integer.compare(value2, value1); + }); + JSONObject res = new JSONObject() + .fluentPut("fxsjlist", fxsjlist) + .fluentPut("jsdwlist", jsdwlist); + + return Result.success(res); + } + + + /** + * @return 部门和子部门映射数据 + */ + public Map getDepartAndSubDepartData(Integer groupId) { + // 创建参数对象 + SupDepartGroupParam supDepartGroupParam = new SupDepartGroupParam(); + supDepartGroupParam.setGroupId(groupId); + supDepartGroupParam.setParentLevel(2); + supDepartGroupParam.setChildLevel(3); + + // 调用服务获取数据 + return supDepartResourceService.getDepartAndSubDepart(supDepartGroupParam); + } + + } diff --git a/src/main/resources/mapper/SupTaskProblemMapper.xml b/src/main/resources/mapper/SupTaskProblemMapper.xml index 2ecd7db..f88cb5c 100644 --- a/src/main/resources/mapper/SupTaskProblemMapper.xml +++ b/src/main/resources/mapper/SupTaskProblemMapper.xml @@ -22,7 +22,7 @@ FROM sup_month_monthname m LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime, '%m') = m.`month` AND YEAR(ng.crtTime) = #{year} - AND ng.problemSourcesCode IN (2, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30) +-- AND ng.problemSourcesCode IN (2, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30) GROUP BY m.month_name ORDER BY m.`month` ASC