Browse Source

Merge remote-tracking branch 'origin/master'

main
sjh 1 year ago
parent
commit
69bd5f85e2
  1. 80
      src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java
  2. 27
      src/main/java/com/biutag/supervision/mapper/NegativeMapper.java
  3. 72
      src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java
  4. 17
      src/main/java/com/biutag/supervision/pojo/vo/CommonVo.java
  5. 26
      src/main/java/com/biutag/supervision/pojo/vo/GobalMapIconVo.java
  6. 16
      src/main/java/com/biutag/supervision/pojo/vo/StrongProblemRank.java
  7. 55
      src/main/java/com/biutag/supervision/service/DataGobalService.java

80
src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java

@ -3,13 +3,11 @@ package com.biutag.supervision.controller.datav;
import com.alibaba.fastjson.JSONObject;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.OrganizeProblemRankVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByMonthVo;
import com.biutag.supervision.pojo.vo.RecentTrendByMonthVo;
import com.biutag.supervision.pojo.vo.*;
import com.biutag.supervision.service.DataGobalService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.activation.DataHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
@ -19,6 +17,7 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
@ -51,7 +50,7 @@ public class DataGobalController {
// 获取数据大屏中央总数概览
JSONObject overview = dataGobalService.getAllGobalCount(beginTime, endTime);
// 获取数据大屏各机构问题排名
// 机构问题排名 fxsjlist中必有所有机构,不会为空
List<OrganizeProblemRankVo> fxsjlist = dataGobalService.getOrganizeProblemRank(3, beginTime, endTime);
List<OrganizeProblemRankVo> jsdwlist = dataGobalService.getOrganizeProblemRank(4, beginTime, endTime);
@ -61,34 +60,73 @@ public class DataGobalController {
// 问题类型占比
List<EchartsVo> wtlxlist = dataGobalService.getProblemRate(beginTime, endTime);
// 突出问题排名
List<StrongProblemRank> tcwtlist = dataGobalService.getStrongProblemRank(beginTime, endTime);
// 地图显示结果
List<GobalMapIconVo> gobalMapVoList = new ArrayList<>();
fxsjlist.forEach(item -> {
// 添加总数
GobalMapIconVo gobalMapVo = new GobalMapIconVo();
gobalMapVo.setName(item.getLabel());
gobalMapVo.setTotalPro(Integer.parseInt(item.getValue()));
gobalMapVoList.add(gobalMapVo);
});
// 市县分局的督察问题
List<CommonVo> superviseProList = dataGobalService.getSuperviseProTotal(beginTime, endTime);
List<CommonVo> caseVerifyProList = dataGobalService.getCaseVerifyProTotal(beginTime, endTime);
List<CommonVo> mailProList = dataGobalService.getMailProTotal(beginTime, endTime);
List<CommonVo> policeProList = dataGobalService.getPoliceProTotal(beginTime, endTime);
List<CommonVo> reviewProList = dataGobalService.getReviewProTotal(beginTime, endTime);
List<GobalMapIconVo> gobalTempMapVoList = new ArrayList<>();
if (false) {
updateProList(superviseProList, gobalMapVoList, GobalMapIconVo::setSupervisePro);
updateProList(caseVerifyProList, gobalMapVoList, GobalMapIconVo::setCaseVerifyPro);
updateProList(mailProList, gobalMapVoList, GobalMapIconVo::setMailPro);
updateProList(policeProList, gobalMapVoList, GobalMapIconVo::setPolicePro);
updateProList(reviewProList, gobalMapVoList, GobalMapIconVo::setReviewPro);
}else {
gobalTempMapVoList.add(new GobalMapIconVo("芙蓉分局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("天心分局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("岳麓分局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("开福分局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("雨花分局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("长沙县局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("望城分局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("宁乡市局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("浏阳市局", 11,11,11,11,11,11));
gobalTempMapVoList.add(new GobalMapIconVo("高新分局", 11,11,11,11,11,11));
}
JSONObject data = new JSONObject().fluentPut("overview", overview)
.fluentPut("fxsjlist", fxsjlist)
.fluentPut("jsdwlist", jsdwlist)
.fluentPut("ywzblist", ywzblist)
.fluentPut("wtlxlist", wtlxlist);
.fluentPut("wtlxlist", wtlxlist)
.fluentPut("tcwtlist", tcwtlist)
.fluentPut("gobalMapVoList", gobalMapVoList)
.fluentPut("gobalTempMapVoList", gobalTempMapVoList);
return Result.success(data);
}
@Operation(summary = "机构问题排名")
@GetMapping("{groupType}")
public Result<JSONObject> getOrganizeProblemRank(
@PathVariable Integer groupType,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
List<OrganizeProblemRankVo> fxsjlist = dataGobalService.getOrganizeProblemRank(groupType, beginTime, endTime);
List<OrganizeProblemRankVo> jsdwlist = dataGobalService.getOrganizeProblemRank(groupType, beginTime, endTime);
JSONObject data = new JSONObject()
.fluentPut("fxsjlist", fxsjlist)
.fluentPut("jsdwlist", jsdwlist);
return Result.success(data);
public void updateProList(List<CommonVo> proList, List<GobalMapIconVo> gobalMapVoList, BiConsumer<GobalMapIconVo, Integer> setter) {
for (GobalMapIconVo gobalMapIconVo : gobalMapVoList) {
for (CommonVo commonVo : proList) {
if (gobalMapIconVo.getName().equals(commonVo.getName())) {
Integer temp = Integer.parseInt(commonVo.getValue());
setter.accept(gobalMapIconVo, Integer.parseInt(commonVo.getValue()) + temp);
}
}
}
}
/**
* 数据大屏问题趋势统计按月
*
* @param year
* @return
*/
@ -127,7 +165,7 @@ public class DataGobalController {
}
// 截取月份
List<String> monthOnlyList = monthList.stream()
.map(date -> date.substring(date.indexOf('-') + 1)+"月")
.map(date -> date.substring(date.indexOf('-') + 1) + "月")
.collect(Collectors.toList());
JSONObject jsonObject = new JSONObject()
.fluentPut("monthList", monthOnlyList)

27
src/main/java/com/biutag/supervision/mapper/NegativeMapper.java

@ -14,30 +14,41 @@ import java.util.List;
public interface NegativeMapper extends BaseMapper<Negative> {
/**
* 查询组织问题排名
* 查询机构问题问题排名
* @param beginTime
* @param endTime
*/
@Select("SELECT sd.short_name as label, sd.statistics_group_id, count(*) as value FROM sup_depart sd INNER JOIN " +
"(SELECT ng.handle_second_depart_id, ng.handle_second_depart_name FROM negative ng WHERE " +
" crtTime BETWEEN #{beginTime} and #{endTime} and checkStatus=1 ) temp " +
" on sd.id=temp.handle_second_depart_id GROUP BY short_name HAVING statistics_group_id=#{groupType} " +
" ORDER BY value desc")
@Select("SELECT sd1.short_name as label, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 AND checkStatus=1 " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=#{groupType} " +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC ")
List<OrganizeProblemRankVo> selectOrganizeProblemRank(Integer groupType, Date beginTime, Date endTime);
@Select("SELECT businessTypeName as name, count(*) value FROM negative " +
"WHERE " +
"crtTime BETWEEN #{beginTime} and #{endTime} and checkStatus=1 " +
"discoveryTime BETWEEN #{beginTime} and #{endTime} and checkStatus=1 " +
"GROUP BY businessTypeName")
List<EchartsVo> selectBusinessRate(Date beginTime,Date endTime);
@Select("SELECT DATE_FORMAT(ng.crtTime, '%Y-%m') AS monthTime, COUNT(*) total FROM negative ng " +
"WHERE YEAR(ng.crtTime)=#{year} and checkStatus=1 " +
"WHERE YEAR(ng.discoveryTime)=#{year} and checkStatus=1 " +
"GROUP BY monthTime " +
"order BY monthTime asc")
List<RecentTrendByMonthVo> selectRecentTrendByMonth(String year);
/**
* @Select("SELECT sd.short_name as label, sd.statistics_group_id, count(*) as value FROM sup_depart sd INNER JOIN " +
* "(SELECT ng.handle_second_depart_id, ng.handle_second_depart_name FROM negative ng WHERE " +
* " crtTime BETWEEN #{beginTime} and #{endTime} and checkStatus=1 ) temp " +
* " on sd.id=temp.handle_second_depart_id GROUP BY short_name HAVING statistics_group_id=#{groupType} " +
* " ORDER BY value desc")
*/
}

72
src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java

@ -2,7 +2,9 @@ package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.NegativeProblemRelation;
import com.biutag.supervision.pojo.vo.CommonVo;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.StrongProblemRank;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
@ -16,4 +18,74 @@ public interface NegativeProblemRelationMapper extends BaseMapper<NegativeProble
"WHERE npr.oneLevelContent is not NULL " +
"GROUP BY `name` ")
List<EchartsVo> selectProblemRate(Date beginTime, Date endTime);
@Select("SELECT (@row_number := @row_number + 1) AS sort, sorted_results.label, sorted_results.value " +
"FROM " +
"(SELECT npr.threeLevelContent AS label, COUNT(*) AS value " +
"FROM negative_problem_relation npr " +
"WHERE npr.threeLevelContent IS NOT NULL " +
"GROUP BY label " +
"ORDER BY value DESC) " +
"AS sorted_results, (SELECT @row_number := 0) AS t;")
List<StrongProblemRank> selectStrongProblemRank(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(13, 14, 15, 16) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectSuperviseProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(17, 18, 19, 20) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectCaseVerifyProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(21, 22, 23, 24, 25) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectMailProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(2) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectPoliceProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(26) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectReviewProTotal(Date beginTime, Date endTime);
}

17
src/main/java/com/biutag/supervision/pojo/vo/CommonVo.java

@ -0,0 +1,17 @@
package com.biutag.supervision.pojo.vo;
import lombok.Data;
/**
* @Auther: sh
* @Date: 2024/11/12 16:53
* @Description: 一般VO name: 名称 value:
*/
@Data
public class CommonVo {
private String name;
private String value;
}

26
src/main/java/com/biutag/supervision/pojo/vo/GobalMapIconVo.java

@ -0,0 +1,26 @@
package com.biutag.supervision.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Auther: sh
* @Date: 2024/11/12 16:22
* @Description: 首页数据大屏地图悬浮图标VO
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GobalMapIconVo {
private String name; // 分县市局名称
private Integer totalPro; // 总问题
private Integer supervisePro; // 督察问题
private Integer caseVerifyPro; // 案件核查问题
private Integer mailPro; // 信访投诉问题
private Integer policePro; // 警务评议问题
private Integer reviewPro; // 审计监督问题
}

16
src/main/java/com/biutag/supervision/pojo/vo/StrongProblemRank.java

@ -0,0 +1,16 @@
package com.biutag.supervision.pojo.vo;
import lombok.Data;
/**
* @Auther: sh
* @Date: 2024/11/12 09:39
* @Description: 首页数据大屏的突出问题VO
*/
@Data
public class StrongProblemRank {
private Integer sort;
private String label; // 问题
private String value; // 数量
}

55
src/main/java/com/biutag/supervision/service/DataGobalService.java

@ -11,9 +11,7 @@ import com.biutag.supervision.pojo.dto.CaseVerifDepart;
import com.biutag.supervision.pojo.entity.DataCaseVerif;
import com.biutag.supervision.pojo.entity.DataSupervisionNotify;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.OrganizeProblemRankVo;
import com.biutag.supervision.pojo.vo.RecentTrendByMonthVo;
import com.biutag.supervision.pojo.vo.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -79,7 +77,6 @@ public class DataGobalService {
/**
* 查询核查属实的公共方法
*
* @param checkStatus 检查状态
* @param startTime 开始时间
* @param endTime 结束时间
@ -89,7 +86,7 @@ public class DataGobalService {
public Long getCountByConditions(Integer checkStatus, Date startTime, Date endTime, Integer... problemSourcesCodes) {
QueryWrapper<Negative> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("checkStatus", checkStatus)
.between("happenTime", startTime, endTime)
.between("crtTime", startTime, endTime)
.and(wrapper -> {
for (int i = 0; i < problemSourcesCodes.length; i++) {
if (i == 0) {
@ -113,8 +110,8 @@ public class DataGobalService {
}
public List<RecentTrendByMonthVo> getGobalRecentlyTrendByMonth(String year) {
List<RecentTrendByMonthVo> trendByMonthVoList = negativeMapper.selectRecentTrendByMonth(year);
return trendByMonthVoList;
List<RecentTrendByMonthVo> res = negativeMapper.selectRecentTrendByMonth(year);
return res;
}
/**
@ -124,14 +121,42 @@ public class DataGobalService {
* @return
*/
public List<EchartsVo> getProblemRate(Date beginTime, Date endTime) {
List<EchartsVo> res = negativeProblemRelationMapper.selectProblemRate(beginTime, endTime);
return res;
}
/**
* 获取突出问题排名
* @return
*/
public List<StrongProblemRank> getStrongProblemRank(Date beginTime, Date endTime) {
List<StrongProblemRank> res= negativeProblemRelationMapper.selectStrongProblemRank(beginTime, endTime);
return res;
}
public List<CommonVo> getSuperviseProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectSuperviseProTotal(beginTime, endTime);
return res;
}
public List<CommonVo> getCaseVerifyProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectCaseVerifyProTotal(beginTime, endTime);
return res;
}
public List<CommonVo> getMailProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectMailProTotal(beginTime, endTime);
return res;
}
public List<CommonVo> getPoliceProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectPoliceProTotal(beginTime, endTime);
return res;
}
/**
* SELECT npr.oneLevelContent as name, count(*) value
* FROM negative_problem_relation npr
* WHERE npr.oneLevelContent is not NULL
* GROUP BY `name`
*/
List<EchartsVo> wtlxList = negativeProblemRelationMapper.selectProblemRate(beginTime, endTime);
return wtlxList;
public List<CommonVo> getReviewProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectReviewProTotal(beginTime, endTime);
return res;
}
}

Loading…
Cancel
Save