Browse Source

首页大屏-机构问题排名,问题趋势数据校对

master
buaixuexideshitongxue 2 months ago
parent
commit
f899a6f519
  1. 15
      src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java
  2. 31
      src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java
  3. 7
      src/main/java/com/biutag/supervision/repository/supdepart/SupDepartResourceService.java
  4. 4
      src/main/java/com/biutag/supervision/service/RpcApplyService.java
  5. 7
      src/main/java/com/biutag/supervision/service/datav/DatavService.java
  6. 70
      src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java
  7. 2
      src/main/resources/mapper/SupTaskProblemMapper.xml

15
src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java

@ -67,8 +67,10 @@ public class DataVGlobalController {
* @param beginTime 开始时间 * @param beginTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @return Result<JSONObject> * @return Result<JSONObject>
* 弃用 请看 {@link #getOrganizationRank(DataVRequest)}
*/ */
@Operation(summary = "机构问题排名") @Operation(summary = "机构问题排名")
@Deprecated
@GetMapping("/getOrganizationRank") @GetMapping("/getOrganizationRank")
public Result<JSONObject> getOrganizationRank(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, public Result<JSONObject> getOrganizationRank(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
@ -80,8 +82,15 @@ public class DataVGlobalController {
.fluentPut("jsdwlist", jsdwlist); .fluentPut("jsdwlist", jsdwlist);
return Result.success(res); return Result.success(res);
} }
/**
* 机构问题排名
* @return Result<JSONObject>
*/
@Operation(summary = "机构问题排名")
@PostMapping("/getOrganizationRank")
public Result<JSONObject> getOrganizationRank(@RequestBody DataVRequest request) {
return datavService.getOrganizationRank(request);
}
/** /**
* 业务类型占比 * 业务类型占比
* *
@ -137,8 +146,10 @@ public class DataVGlobalController {
* @param beginTime 开始时间 * @param beginTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @return Result<JSONObject> * @return Result<JSONObject>
* 弃用 请看 {@link #getGlobalMap(DataVRequest)}
*/ */
@Operation(summary = "首页大屏地图Icon数据") @Operation(summary = "首页大屏地图Icon数据")
@Deprecated
@GetMapping("/getGlobalMap") @GetMapping("/getGlobalMap")
// @Cacheable(cacheNames = "Supervision:Screen:GlobalMap", key = "#beginTime.getTime()+'_'+#endTime.getTime()") // @Cacheable(cacheNames = "Supervision:Screen:GlobalMap", key = "#beginTime.getTime()+'_'+#endTime.getTime()")
public Result<JSONObject> getGlobalMap(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, public Result<JSONObject> getGlobalMap(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,

31
src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java

@ -1,5 +1,6 @@
package com.biutag.supervision.pojo.vo; package com.biutag.supervision.pojo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
/** /**
@ -8,10 +9,32 @@ import lombok.Data;
* @Description: 机构问题排名VO * @Description: 机构问题排名VO
*/ */
@Data @Data
@Schema(description = "机构问题排名VO")
public class OrganizeProblemRankVo { public class OrganizeProblemRankVo {
private String label; // 部门名
private String value; // 问题数 @Schema(description = "部门名")
private String cityNumber;//市局问题数 private String label;
private String countyNumber; //县局问题数
@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;
}
} }

7
src/main/java/com/biutag/supervision/repository/supdepart/SupDepartResourceService.java

@ -32,7 +32,12 @@ public class SupDepartResourceService {
List<DepartAndSubDepartDto> departAndSubDepart = supDepartMapper.getDepartAndSubDepart(param); List<DepartAndSubDepartDto> departAndSubDepart = supDepartMapper.getDepartAndSubDepart(param);
for (DepartAndSubDepartDto dto : departAndSubDepart) { for (DepartAndSubDepartDto dto : departAndSubDepart) {
Set<String> childIds = Arrays.stream(dto.getChildIdsStr().split(",")).filter(StrUtil::isNotBlank).collect(Collectors.toSet()); Set<String> 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); dto.setChildIds(childIds);
// 创建新的集合包含所有部门ID // 创建新的集合包含所有部门ID
Set<String> allDepartIds = new HashSet<>(childIds); Set<String> allDepartIds = new HashSet<>(childIds);

4
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 com.biutag.supervision.util.JSON;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -42,6 +43,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
@Slf4j
public class RpcApplyService extends ServiceImpl<RpcApplyMapper, RpcApply> { public class RpcApplyService extends ServiceImpl<RpcApplyMapper, RpcApply> {
private final RpcRightPersonService rpcRightPersonService; private final RpcRightPersonService rpcRightPersonService;
@ -124,6 +126,8 @@ public class RpcApplyService extends ServiceImpl<RpcApplyMapper, RpcApply> {
if(StrUtil.isNotBlank(queryParam.getCode())){ if(StrUtil.isNotBlank(queryParam.getCode())){
queryWrapper.eq("a.verified","2"); 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); return baseMapper.queryRightsPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper);
} }

7
src/main/java/com/biutag/supervision/service/datav/DatavService.java

@ -26,4 +26,11 @@ public interface DatavService {
* @return * @return
*/ */
Result<JSONObject> getGlobalMap(DataVRequest request); Result<JSONObject> getGlobalMap(DataVRequest request);
/**
* 获取一级首页的机构问题排名
* @param request
* @return
*/
Result<JSONObject> getOrganizationRank(DataVRequest request);
} }

70
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.constants.enums.invest.DeleteStatusEnum;
import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.DepartAndSubDepartDto; 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.Negative;
import com.biutag.supervision.pojo.entity.NegativeBlame; import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.entity.SupExternalDepart; 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.entity.report.ReportProject;
import com.biutag.supervision.pojo.param.*; import com.biutag.supervision.pojo.param.*;
import com.biutag.supervision.pojo.request.datav.DataVRequest; import com.biutag.supervision.pojo.request.datav.DataVRequest;
import com.biutag.supervision.pojo.vo.AuditSuperviseMapIconVo; import com.biutag.supervision.pojo.vo.AuditSuperviseMapIconVo;
import com.biutag.supervision.pojo.vo.GlobalMapIconVo; 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.dataPetitionComplaint.DataPetitionComplaintResourceService;
import com.biutag.supervision.repository.mail.MailResourceService; import com.biutag.supervision.repository.mail.MailResourceService;
import com.biutag.supervision.repository.negative.NegativeResourceService; import com.biutag.supervision.repository.negative.NegativeResourceService;
@ -207,4 +206,71 @@ public class DatavServiceImpl implements DatavService {
JSONObject data = new JSONObject().fluentPut("globalTempMapVoList", globalMapIconVoList); JSONObject data = new JSONObject().fluentPut("globalTempMapVoList", globalMapIconVoList);
return Result.success(data); return Result.success(data);
} }
@Override
public Result<JSONObject> getOrganizationRank(DataVRequest request) {
Map<String, DepartAndSubDepartDto> fxsjDepartAndSubDepartData = getDepartAndSubDepartData(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId());
Map<String, DepartAndSubDepartDto> jsdwDepartAndSubDepartData = getDepartAndSubDepartData(DepartGroupEnum.BUREAU_AFFILIATED.getId());
List<Date> dates = Arrays.asList(request.getBeginTime(), request.getEndTime());
List<OrganizeProblemRankVo> fxsjlist = new ArrayList<>();
List<OrganizeProblemRankVo> jsdwlist = new ArrayList<>();
for (DepartAndSubDepartDto dto : fxsjDepartAndSubDepartData.values()) {
Set<String> 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<String> 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<String, DepartAndSubDepartDto> getDepartAndSubDepartData(Integer groupId) {
// 创建参数对象
SupDepartGroupParam supDepartGroupParam = new SupDepartGroupParam();
supDepartGroupParam.setGroupId(groupId);
supDepartGroupParam.setParentLevel(2);
supDepartGroupParam.setChildLevel(3);
// 调用服务获取数据
return supDepartResourceService.getDepartAndSubDepart(supDepartGroupParam);
}
} }

2
src/main/resources/mapper/SupTaskProblemMapper.xml

@ -22,7 +22,7 @@
FROM sup_month_monthname m FROM sup_month_monthname m
LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime, '%m') = m.`month` LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime, '%m') = m.`month`
AND YEAR(ng.crtTime) = #{year} 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 GROUP BY m.month_name
ORDER BY m.`month` ASC ORDER BY m.`month` ASC
</select> </select>

Loading…
Cancel
Save