Browse Source

视频督察二级大屏1.0

main
不爱学习的石同学 12 months ago
parent
commit
b102789d46
  1. 20
      src/main/java/com/biutag/supervision/controller/datav/DataMailViewController.java
  2. 67
      src/main/java/com/biutag/supervision/controller/subdatav/SubOneController.java
  3. 170
      src/main/java/com/biutag/supervision/controller/subdatav/SubOneVideoSuperviseController.java
  4. 6
      src/main/java/com/biutag/supervision/mapper/DataPetition12337Mapper.java
  5. 7
      src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java
  6. 70
      src/main/java/com/biutag/supervision/mapper/NegativeMapper.java
  7. 23
      src/main/java/com/biutag/supervision/pojo/vo/MailMapIconVo.java
  8. 12
      src/main/java/com/biutag/supervision/pojo/vo/SubOneOverViewVo.java
  9. 4
      src/main/java/com/biutag/supervision/service/DataGlobalService.java
  10. 81
      src/main/java/com/biutag/supervision/service/DataMailService.java
  11. 15
      src/main/java/com/biutag/supervision/service/SubOneService.java
  12. 45
      src/main/java/com/biutag/supervision/service/SubOneVideoSuperviseService.java
  13. 51
      src/main/resources/mapper/NegativeMapper.xml
  14. 33
      src/test/java/com/biutag/supervision/service/DataMailServiceTest.java

20
src/main/java/com/biutag/supervision/controller/datav/DataMailViewController.java

@ -11,6 +11,7 @@ import com.biutag.supervision.service.DataMailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -98,6 +99,25 @@ public class DataMailViewController {
}
/**
* 信访数据中央地图小图标数据
* @param beginTime 开始时间
* @param endTime 结束时间
* @return Result<JSONObject>
*/
@Operation(summary = "信访数据中央地图小图标数据")
@GetMapping("/getMailMapIcon")
@Cacheable(cacheNames = "MailMap", key = "'p_'+ #endTime")
public Result<JSONObject> getMailMapIcon(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
// 信访数据总数概览
List<MailMapIconVo> mailMapIconList = dataMailService.getMailMapIcon(beginTime, endTime);
JSONObject data = new JSONObject().fluentPut("mailMapIconList", mailMapIconList);
return Result.success(data);
}
/**
* 信访数据大屏信访趋势统计
* @param year 年份

67
src/main/java/com/biutag/supervision/controller/datav/SubOneController.java → src/main/java/com/biutag/supervision/controller/subdatav/SubOneController.java

@ -1,4 +1,4 @@
package com.biutag.supervision.controller.datav;
package com.biutag.supervision.controller.subdatav;
import com.alibaba.fastjson.JSONObject;
import com.biutag.supervision.pojo.Result;
@ -28,9 +28,9 @@ import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.*;
/**
* @Auther: sh
* @Date: 2024/12/4 16:30
* @Description: 一级子屏
* @Description: 首页一级子屏
*/
@Tag(name = "一级子屏")
@Tag(name = "首页一级子屏")
@RequestMapping("datav/sub1/")
@RequiredArgsConstructor
@RestController
@ -40,9 +40,51 @@ public class SubOneController {
private final CountyStreetDeptService countyStreetDeptService;
private final SubOneService subOneService;
// region右边
@Operation(summary = "获取首页一级子屏督察问题排名")
@GetMapping("/getSubOneSupervisionRank")
public Result<JSONObject> getSubOneSupervisionRank(@RequestParam Integer departPId,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
SubOneOverViewVo supervisionPrecinctOverView = subOneService.getSubOneSupervisionRankOverView(departPId, 10, beginTime, endTime, XCDC.getValue(), ZXDC.getValue(), SPDC.getValue());
SubOneOverViewVo supervisionTeamOverView = subOneService.getSubOneSupervisionRankOverView(departPId, -1, beginTime, endTime, XCDC.getValue(), ZXDC.getValue(), SPDC.getValue());
List<RankVo> supervisionPrecinctList = subOneService.getSubOneSupervisionRank(departPId, 10, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); // 案件核查派出所排名
List<RankVo> supervisionTeamList = subOneService.getSubOneSupervisionRank(departPId, -1, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); // 案件核查派出所排名
JSONObject jsonObject = new JSONObject();
jsonObject.fluentPut("supervisionPrecinctOverView", supervisionPrecinctOverView)
.fluentPut("supervisionTeamOverView", supervisionTeamOverView)
.fluentPut("supervisionPrecinctList", supervisionPrecinctList)
.fluentPut("supervisionTeamList", supervisionTeamList);
return Result.success(jsonObject);
}
// endregion
// region 中间
/**
* 获取一级子屏总览
* @param departPId 2级单位的id
* @param beginTime 开始时间
* @param endTime 结束时间
* @return
*/
@Operation(summary = "获取一级子屏总览")
@GetMapping("/getSubOneOverView")
public Result<JSONObject> getSubOneOverView(@RequestParam Integer departPId,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
SubOneOverViewVo subOneOverViewVo = subOneService.getSubOneOverView(departPId, beginTime, endTime);
JSONObject jsonObject = new JSONObject();
jsonObject.fluentPut("subOneOverViewVo",subOneOverViewVo);
return Result.success(jsonObject);
}
/**
* 获取问题趋势
*
@ -68,6 +110,7 @@ public class SubOneController {
/**
* 获取地图数据
*
* @param departPId 2级单位的id
* @return json格式的地图数据
*/
@ -105,16 +148,17 @@ public class SubOneController {
/**
* 获取首页一级子屏案件核查排名
* @param departPId 2级单位的id
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 总览和排名
*
* @param departPId 2级单位的id
* @param beginTime 开始时间
* @param endTime 结束时间
* @return 总览和排名
*/
@Operation(summary = "获取首页一级子屏案件核查排名")
@GetMapping("/getCaseVerifyRank")
public Result<JSONObject> getCaseVerifyRank(@RequestParam Integer departPId,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
@GetMapping("/getSubOneCaseVerifyRank")
public Result<JSONObject> getSubOneCaseVerifyRank(@RequestParam Integer departPId,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
SubOneOverViewVo caseVerifyPrecinctOverView = subOneService.getCaseVerifyOverView(departPId, 10, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue());
SubOneOverViewVo caseVerifyTeamOverView = subOneService.getCaseVerifyOverView(departPId, -1, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue());
List<RankVo> caseVerifyPrecinctList = subOneService.getCaseVerifyRank(departPId, 10, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); // 案件核查派出所排名
@ -129,3 +173,4 @@ public class SubOneController {
// endregion
}

170
src/main/java/com/biutag/supervision/controller/subdatav/SubOneVideoSuperviseController.java

@ -0,0 +1,170 @@
package com.biutag.supervision.controller.subdatav;
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.VideoSuperviseCountVo;
import com.biutag.supervision.pojo.vo.VideoSuperviseMapIconVo;
import com.biutag.supervision.service.SubOneVideoSuperviseService;
import com.biutag.supervision.service.VideoSuperviseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.SPDC;
/**
* @Auther: sh
* @Date: 2024/12/16 17:12
* @Description:
*/
@Tag(name = "视频督察子屏", description = "视频督察子屏")
@RestController
@RequiredArgsConstructor
@RequestMapping("datav/sub1/videoSupervise")
public class SubOneVideoSuperviseController {
private final SubOneVideoSuperviseService subOneVideoSuperviseService;
// //region 左边
//
// /**
// * 获取视频督察大屏问题数排名
// * @param beginTime 开始时间
// * @param endTime 结束时间
// * @return
// */
// @Operation(summary = "视频督察大屏问题数排名")
// @GetMapping("/getVideoSuperviseProblemRank")
// public Result<JSONObject> getVideoSuperviseProblemRank(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
// List<OrganizeProblemRankVo> fxsjVideoSuperviseProblemRankList = videoSuperviseService.getVideoSuperviseProblemRank(beginTime, endTime, 3);
// List<OrganizeProblemRankVo> jsdwVideoSuperviseProblemRankList = videoSuperviseService.getVideoSuperviseProblemRank(beginTime, endTime, 4);
// JSONObject data = new JSONObject();
// data.fluentPut("fxsjVideoSuperviseProblemRankList", fxsjVideoSuperviseProblemRankList);
// data.fluentPut("jsdwVideoSuperviseProblemRankList", jsdwVideoSuperviseProblemRankList);
// return Result.success(data);
// }
// //endregion
//
// //region 中间
//
// /**
// * 获取视频督察中央数据
// * @param beginTime 开始时间
// * @param endTime 结束时间
// * @return Result<JSONObject>
// */
// @Operation(summary = "视频督察大屏中央数据")
// @GetMapping("/getAllVideoSuperviseCount")
// public Result<JSONObject> getAllVideoSuperviseCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
// // 获取视频督察中央数据
// VideoSuperviseCountVo overview = videoSuperviseService.getAllVideoSuperviseCount(beginTime, endTime);
// JSONObject data = new JSONObject().fluentPut("overview", overview);
// return Result.success(data);
// }
//
// /**
// * 获取视频督察地图数据
// * @param beginTime 开始时间
// * @param endTime 结束时间
// * @return
// */
// @Operation(summary = "视频督察大屏地图数据")
// @GetMapping("/getVideoSuperviseMap")
// @Cacheable(cacheNames = "videoSuperviseMap", key = "'p_'+ #endTime")
// public Result<JSONObject> getVideoSuperviseMap(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
//
// // 地图数据
// List<VideoSuperviseMapIconVo> videoSuperviseMapIconVoList = Optional.ofNullable(videoSuperviseService.getVideoSuperviseMapIconInfo(beginTime, endTime)).
// orElseGet(ArrayList::new);
// JSONObject data = new JSONObject().fluentPut("videoSuperviseMapIconVoList", videoSuperviseMapIconVoList);
// return Result.success(data);
// }
//
// // 获取视频督察大屏中央问题趋势统计
// @Operation(summary = "数据大屏问题趋势统计")
// @GetMapping("/getVideoSuperviseTrend")
// public Result<JSONObject> getVideoSuperviseTrend(@RequestParam Integer year) {
// List<EchartsVo> videoSuperviseTrendList = videoSuperviseService.getVideoSuperviseTrend(String.valueOf(year), SPDC.getValue());
// JSONObject jsonObject = new JSONObject().fluentPut("videoSuperviseTrendList", videoSuperviseTrendList);
// return Result.success(jsonObject);
// }
// //endregion
//
//
// // region 右边
//
// // 问题类型占比
// @Operation(summary = "数据大屏问题类型占比")
// @GetMapping("/getVideoSuperviseProblemTypeRate")
// public Result<JSONObject> getVideoSuperviseProblemTypeRate(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
// List<EchartsVo> videoSuperviseProblemTypeRate = videoSuperviseService.getVideoSuperviseProblemTypeRate(beginTime, endTime);
// JSONObject jsonObject = new JSONObject().fluentPut("videoSuperviseProblemTypeRate", videoSuperviseProblemTypeRate);
// return Result.success(jsonObject);
// }
//
//
// // endregion
@Operation(summary = "视频督察二级大屏问题数排名")
@GetMapping("/getSubOneVideoSuperviseProblemRank")
public Result<JSONObject> getSubOneVideoSuperviseProblemRank(@RequestParam Integer departId,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
List<OrganizeProblemRankVo> policeVideoSuperviseProblemRankList = subOneVideoSuperviseService.getSuboOneVideoSuperviseProblemRank(beginTime, endTime, 10, departId);
List<OrganizeProblemRankVo> teamVideoSuperviseProblemRankList = subOneVideoSuperviseService.getSuboOneVideoSuperviseProblemRank(beginTime, endTime, -1, departId);
JSONObject data = new JSONObject();
data.fluentPut("policeVideoSuperviseProblemRankList", policeVideoSuperviseProblemRankList);
data.fluentPut("teamVideoSuperviseProblemRankList", teamVideoSuperviseProblemRankList);
return Result.success(data);
}
/**
* 视频督察二级大屏中央数据
*
* @param beginTime 开始时间
* @param endTime 结束时间
* @return Result<JSONObject>
*/
@Operation(summary = "视频督察二级大屏中央数据")
@GetMapping("/getSubOneAllVideoSuperviseCount")
public Result<JSONObject> getSubOneAllVideoSuperviseCount(@RequestParam Integer departId,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
VideoSuperviseCountVo overview = subOneVideoSuperviseService.getSubOneAllVideoSuperviseCount(beginTime, endTime, departId);
JSONObject data = new JSONObject().fluentPut("overview", overview);
return Result.success(data);
}
// 获取视频督察大屏中央问题趋势统计
@Operation(summary = "数据大屏问题趋势统计")
@GetMapping("/getSubOneVideoSuperviseTrend")
public Result<JSONObject> getSubOneVideoSuperviseTrend(@RequestParam Integer departId, @RequestParam Integer year) {
List<EchartsVo> videoSuperviseTrendList = subOneVideoSuperviseService.getSubOneVideoSuperviseTrend(String.valueOf(year), SPDC.getValue(), departId.toString());
JSONObject jsonObject = new JSONObject().fluentPut("videoSuperviseTrendList", videoSuperviseTrendList);
return Result.success(jsonObject);
}
}

6
src/main/java/com/biutag/supervision/mapper/DataPetition12337Mapper.java

@ -6,6 +6,7 @@ import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByMonthVo;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
/**
@ -25,6 +26,11 @@ public interface DataPetition12337Mapper extends BaseMapper<DataPetition12337> {
List<RecentMailTrendByMonthVo> selectRecentlyMailTrendByMonth12337(String year);
List<EchartsVo> getMailTrend12337(Integer year);
@Select("select count(*) from data_petition_12337 " +
"where discover_time between #{beginTime} and #{endTime} " +
"and second_depart_id=#{departId}")
Integer select12337MailBySourceCode(Date beginTime, Date endTime, String departId);
}

7
src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java

@ -50,6 +50,7 @@ public interface DataPetitionComplaintMapper extends BaseMapper<DataPetitionComp
/**
* 缠访闹访分县市局排行
*
* @param id
* @param isEntanglement
* @param beginTime
@ -154,5 +155,9 @@ public interface DataPetitionComplaintMapper extends BaseMapper<DataPetitionComp
List<OrganizeProblemRankVo> getMassMailRank(Date beginTime, Date endTime, int groupId);
@Select("select count(*) from data_petition_complaint dpc " +
"where problem_sources_code=#{problemSourcesCode} " +
"and second_depart_id=#{departId} " +
"and discovery_time between #{beginTime} and #{endTime}")
Integer selectMailBySourceCode(Date beginTime, Date endTime, String problemSourcesCode, String departId);
}

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

@ -12,7 +12,7 @@ import java.util.List;
public interface NegativeMapper extends BaseMapper<Negative> {
// region 首页大屏
// region 首页大屏
/**
* 查询机构问题问题排名
@ -57,7 +57,7 @@ public interface NegativeMapper extends BaseMapper<Negative> {
" and sd1.LEVEL=2 AND sd1.statistics_group_id=3" +
" ) " +
"as temp on ng.involveDepartId=temp.id " +
"WHERE ng.checkStatus<>3 AND problemSourcesCode=11 " +
"WHERE ng.checkStatus<>3 AND problemSourcesCode=(17, 18, 19, 20) " +
"AND temp.pid=#{departId} AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Integer seleGlobalMapIconInfoAjhc(Date beginTime, Date endTime, Integer departId);
@ -98,7 +98,7 @@ public interface NegativeMapper extends BaseMapper<Negative> {
// endregion
// region 现场督察大屏
// region 现场督察大屏
@Select("SELECT count(DISTINCT(ng.id)) as proTotal, " +
"count(DISTINCT IF(ng.isRectifyCode = 1, ng.id, null) ) as changed, " +
@ -140,7 +140,8 @@ public interface NegativeMapper extends BaseMapper<Negative> {
@Select("SELECT COUNT(DISTINCT c.id) AS problem_number, " +
"COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, " +
"COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, " +
"COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, " +
"COUNT(DISTINCT c.involveDepartId) AS depart_number, " +
"COUNT(DISTINCT d.blameIdCode) AS person_number, " +
"ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate " +
"FROM sup_depart b INNER JOIN negative c ON b.id = c.involveDepartId " +
" LEFT JOIN negative_blame d ON c.id = d.negativeId " +
@ -337,12 +338,67 @@ public interface NegativeMapper extends BaseMapper<Negative> {
List<EchartsVo> getSubOneTrend(@Param("departPId") Integer departPId, @Param("year") Integer year, @Param("args") String[] args);
// endregion
List<RankVo> getCaseVerifyRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args);
// region 首页大屏的子屏
List<RankVo> getCaseVerifyRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args);
SubOneOverViewVo getCaseVerifyOverView(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args);
SubOneOverViewVo getSubOneSupervisionRankOverView(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args);
// endregion
List<RankVo> getSubOneSupervisionRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args);
@Select("SELECT count(DISTINCT ng.id) AS one, " +
"COUNT(processing_status='processing' ) AS two, " +
"count(DISTINCT involveDepartId) AS three, " +
"count(DISTINCT nb.blameIdCode) AS four, " +
"COALESCE( ROUND( COUNT(processing_status='completed' ) / NULLIF(COUNT(DISTINCT ng.id), 0) * 100, 1), 0) AS five " +
"FROM negative ng " +
"INNER JOIN (SELECT id, short_name FROM sup_depart sd WHERE sd.pid = #{departPId} ) AS temp ON ng.involveDepartId=temp.id " +
"LEFT JOIN negative_blame nb ON ng.id=nb.negativeId " +
" WHERE discoveryTime BETWEEN #{beginTime} and #{endTime}")
SubOneOverViewVo getSubOneOverView(Integer departPId, Date beginTime, Date endTime);
// endregion
@Select("SELECT COUNT(DISTINCT ng.id) AS discoverProblem, " +
"COUNT(DISTINCT IF(ng.isRectifyCode=1, ng.id, NULL)) AS changedProblem, " +
"COUNT(DISTINCT ng.involveDepartId) AS relativeOrg, " +
"COUNT(DISTINCT nb.blameName) AS relativePer, " +
"IFNULL( ROUND((COUNT(DISTINCT IF(ng.isRectifyCode=1, ng.id, NULL)) / COUNT(DISTINCT ng.id)) * 100, 1), 0) AS changedRate " +
"FROM sup_depart sd " +
"INNER JOIN negative ng ON sd.id = ng.involveDepartId AND sd.pid=#{departId} " +
"LEFT JOIN negative_blame nb ON ng.id = nb.negativeId " +
"WHERE ng.checkStatus IN ('1','2') " +
"AND problemSourcesCode = 16 " +
"AND discoveryTime BETWEEN #{beginTime} AND #{endTime}; ")
VideoSuperviseCountVo getSubOneAllVideoSuperviseCount(Date beginTime, Date endTime, Integer departId);
@Select("SELECT sd.short_name AS label, " +
"count(*) as `value` " +
" FROM negative ng " +
"INNER JOIN sup_depart sd ON ng.involveDepartId=sd.id " +
"AND sd.pid=#{departId} AND sd.statistics_group_id=10 " +
"WHERE checkStatus <> 3 " +
"AND problemSourcesCode=16 " +
"AND discoveryTime BETWEEN #{beginTime} AND #{endTime} " +
"GROUP BY sd.short_name " +
"ORDER BY `value` DESC ")
List<OrganizeProblemRankVo> getSuboOneVideoSupervisePoliceProblemRank(Date beginTime, Date endTime, Integer groupId, Integer departId);
@Select("SELECT sd.short_name AS label, " +
"count(*) as `value` " +
" FROM negative ng " +
"INNER JOIN sup_depart sd ON ng.involveDepartId=sd.id " +
"AND sd.pid=#{departId} AND sd.statistics_group_id!=10 " +
"WHERE checkStatus <> 3 " +
"AND problemSourcesCode=16 " +
"AND discoveryTime BETWEEN #{beginTime} AND #{endTime} " +
"GROUP BY sd.short_name " +
"ORDER BY `value` DESC ")
List<OrganizeProblemRankVo> getSuboOneVideoSuperviseTeamProblemRank(Date beginTime, Date endTime, Integer groupId, Integer departId);
List<EchartsVo> getSubOneVideoSuperviseTrend(String year, String problemCode, String departId);
}

23
src/main/java/com/biutag/supervision/pojo/vo/MailMapIconVo.java

@ -0,0 +1,23 @@
package com.biutag.supervision.pojo.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: sh
* @Date: 2024/12/16 09:26
* @Description: 信访大屏地图vo
*/
@Data
public class MailMapIconVo implements Serializable {
private String name; // 分县市局名字
private String departId; // 分县市局id
private String total;
private String countryTotal;
private String policeTotal;
private String commissionerTotal;
private String numTotal; // 12337
}

12
src/main/java/com/biutag/supervision/pojo/vo/SubOneOverViewVo.java

@ -16,11 +16,11 @@ import java.io.Serializable;
@NoArgsConstructor
public class SubOneOverViewVo implements Serializable {
// 首页大屏一级子屏的各种总览,从左到右对应
private String one;
private String two;
private String three;
private String four;
private String five;
private String six;
private Integer one;
private Integer two;
private Integer three;
private Integer four;
private Integer five;
private Integer six;
}

4
src/main/java/com/biutag/supervision/service/DataGlobalService.java

@ -14,6 +14,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static com.biutag.supervision.constants.enums.DepartGroupEnum.COUNTY_CITY_BUREAUS;
/**
* 数据大屏服务层
*
@ -97,7 +99,7 @@ public class DataGlobalService {
// 地图数据
public List<GlobalMapIconVo> getMapIconInfo(Date beginTime, Date endTime) {
List<GlobalMapIconVo> res = new ArrayList<>();
List<SupDepart> supDeparts = supDepartMapper.selectDepartsByGroupType(3);
List<SupDepart> supDeparts = supDepartMapper.selectDepartsByGroupType(COUNTY_CITY_BUREAUS.getId());
for (SupDepart supDepart : supDeparts) {
GlobalMapIconVo mapIconVo = new GlobalMapIconVo();
mapIconVo.setName(supDepart.getShortName());

81
src/main/java/com/biutag/supervision/service/DataMailService.java

@ -12,21 +12,29 @@ import com.biutag.supervision.constants.enums.*;
import com.biutag.supervision.mapper.DataPetition12337Mapper;
import com.biutag.supervision.mapper.DataPetitionComplaintMapper;
import com.biutag.supervision.mapper.NegativeMapper;
import com.biutag.supervision.mapper.SupDepartMapper;
import com.biutag.supervision.pojo.dto.*;
import com.biutag.supervision.pojo.entity.DataPetition12337;
import com.biutag.supervision.pojo.entity.DataPetitionComplaint;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.param.DataPetitionComplaintQueryParam;
import com.biutag.supervision.pojo.vo.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static com.biutag.supervision.constants.enums.DepartGroupEnum.COUNTY_CITY_BUREAUS;
import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.*;
@RequiredArgsConstructor
@Service
public class DataMailService extends ServiceImpl<DataPetitionComplaintMapper, DataPetitionComplaint> {
@ -36,8 +44,10 @@ public class DataMailService extends ServiceImpl<DataPetitionComplaintMapper, Da
private final DataPetitionComplaintMapper dataPetitionComplaintMapper;
private final DataPetition12337Mapper dataPetition12337Mapper;
private final SupDepartMapper supDepartMapper;
private final NegativeMapper negativeMapper;
public Page<DataPetitionComplaint> page(DataPetitionComplaintQueryParam queryParam) {
LambdaQueryWrapper<DataPetitionComplaint> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DataPetitionComplaint::getProblemSourcesCode, queryParam.getProblemSourcesCode())
@ -145,41 +155,11 @@ public class DataMailService extends ServiceImpl<DataPetitionComplaintMapper, Da
Long policeMail = dataPetitionComplaintMapper.selectCount(policeQueryWrapper);
System.out.println("公安部信访数量:" + policeMail);
// 12337信访
QueryWrapper<DataPetition12337> queryWrapper12337 = new QueryWrapper<>();
QueryWrapper<DataPetition12337> queryWrapper12337 = new QueryWrapper<>();
Long numberMail = dataPetition12337Mapper.selectCount(queryWrapper12337);
System.out.println("12337信访数量:" + numberMail);
// // 初访
// QueryWrapper<DataPetitionComplaint> firstQueryWrapper = new QueryWrapper<>();
// firstQueryWrapper.eq("initial_petition", 1);
// firstQueryWrapper.between("discovery_time", beginTime, endTime);
// Long firstMail = dataPetitionComplaintMapper.selectCount(firstQueryWrapper);
// // 重访
// QueryWrapper<DataPetitionComplaint> secondQueryWrapper = new QueryWrapper<>();
// secondQueryWrapper.eq("initial_petition", 2);
// secondQueryWrapper.between("discovery_time", beginTime, endTime);
// Long secondMail = dataPetitionComplaintMapper.selectCount(secondQueryWrapper);
// // 领导接访
// QueryWrapper<DataPetitionComplaint> leaderQueryWrapper = new QueryWrapper<>();
// leaderQueryWrapper.isNotNull("receiving_leader_name");
// leaderQueryWrapper.between("discovery_time", beginTime, endTime);
// Long leaderReceiveMail = dataPetitionComplaintMapper.selectCount(leaderQueryWrapper);
// // 领导督办
// QueryWrapper<DataPetitionComplaint> leaderViewQueryWrapper = new QueryWrapper<>();
// leaderViewQueryWrapper.isNotNull("receiving_leader_name");
// leaderViewQueryWrapper.between("discovery_time", beginTime, endTime);
// Long leaderViewMail = dataPetitionComplaintMapper.selectCount(leaderViewQueryWrapper);
// // 闹访 1:闹 0:不闹
// QueryWrapper<DataPetitionComplaint> tangleQueryWrapper = new QueryWrapper<>();
// tangleQueryWrapper.eq("entanglement_visits", 1);
// tangleQueryWrapper.between("discovery_time", beginTime, endTime);
// Long tangleMail = dataPetitionComplaintMapper.selectCount(tangleQueryWrapper);
// // 集访 1:集 0:不集
// QueryWrapper<DataPetitionComplaint> massQueryWrapper = new QueryWrapper<>();
// massQueryWrapper.eq("mass_visits", 1);
// massQueryWrapper.between("discovery_time", beginTime, endTime);
// Long massMail = dataPetitionComplaintMapper.selectCount(massQueryWrapper);
// 总数
long totalMail = countryMail+policeMail+numberMail;
long totalMail = countryMail + policeMail + numberMail;
JSONObject overview = new JSONObject()
// 信访总数(起)
@ -204,7 +184,7 @@ public class DataMailService extends ServiceImpl<DataPetitionComplaintMapper, Da
}
public List<RecentMailTrendByDayVo> getRecentlyMailTrendByDay(Integer sourcesCode, Integer days, Date endTime) {
public List<RecentMailTrendByDayVo> getRecentlyMailTrendByDay(Integer sourcesCode, Integer days, Date endTime) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
// 将 endTime 转换为 LocalDate
LocalDate endLocalDate = endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
@ -231,24 +211,23 @@ public class DataMailService extends ServiceImpl<DataPetitionComplaintMapper, Da
}
public MailOverviewVo getAllMailCount(Date beginTime, Date endTime) {
MailOverviewVo res = negativeMapper.getAllMailCount(beginTime, endTime);
MailOverviewVo res = negativeMapper.getAllMailCount(beginTime, endTime);
return res;
}
public List<EchartsVo> getMailTrend(Integer year, Integer type) {
List<EchartsVo> res = negativeMapper.getMailTrend(year, type);
List<EchartsVo> res = negativeMapper.getMailTrend(year, type);
return res;
}
public MailFirstAndRepeatOverviewVo getFirstAndRepeatOverview(Date beginTime, Date endTime) {
MailFirstAndRepeatOverviewVo res = dataPetitionComplaintMapper.getFirstAndRepeatOverview(beginTime, endTime);
return res;
}
public List<OrganizeProblemRankVo> getMailRank(Date beginTime, Date endTime, int groupId, Integer isRepeat) {
List<OrganizeProblemRankVo> res = dataPetitionComplaintMapper.getMailRank(beginTime, endTime, groupId, isRepeat);
List<OrganizeProblemRankVo> res = dataPetitionComplaintMapper.getMailRank(beginTime, endTime, groupId, isRepeat);
return res;
}
@ -263,7 +242,6 @@ public class DataMailService extends ServiceImpl<DataPetitionComplaintMapper, Da
}
public List<OrganizeProblemRankVo> getEntanglementMailRank(Date beginTime, Date endTime, int groupId) {
List<OrganizeProblemRankVo> res = dataPetitionComplaintMapper.getEntanglementMailRank(beginTime, endTime, groupId);
return res;
@ -278,4 +256,31 @@ public class DataMailService extends ServiceImpl<DataPetitionComplaintMapper, Da
List<EchartsVo> res = dataPetition12337Mapper.getMailTrend12337(year);
return res;
}
public List<MailMapIconVo> getMailMapIcon(Date beginTime, Date endTime) {
List<MailMapIconVo> res = new ArrayList<>();
List<SupDepart> supDeparts = supDepartMapper.selectDepartsByGroupType(COUNTY_CITY_BUREAUS.getId());
for (SupDepart supDepart : supDeparts) {
MailMapIconVo mapIconVo = new MailMapIconVo();
mapIconVo.setName(supDepart.getShortName());
mapIconVo.setDepartId(supDepart.getId());
res.add(mapIconVo);
}
for (MailMapIconVo re : res) {
String departId = re.getDepartId();
Integer countryTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, GJXFPT.getValue(), departId);
Integer policeTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, GABXF.getValue(), departId);
// String commissionerTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, JZXX.getValue(), departId);
Integer commissionerTotal = 0;
Integer numTotal = dataPetition12337Mapper.select12337MailBySourceCode(beginTime, endTime, departId);
Integer total = countryTotal + policeTotal + commissionerTotal + numTotal;
// if (StringUtils.isAnyBlank(departId, total.toString() ))
re.setCountryTotal(countryTotal.toString());
re.setPoliceTotal(policeTotal.toString());
re.setCommissionerTotal(commissionerTotal.toString());
re.setNumTotal(numTotal.toString());
re.setTotal(total.toString());
}
return res;
}
}

15
src/main/java/com/biutag/supervision/service/SubOneService.java

@ -39,5 +39,20 @@ public class SubOneService {
SubOneOverViewVo res = negativeMapper.getCaseVerifyOverView(departPId, statisticsGroupId, beginTime, endTime, args);
return res;
}
public SubOneOverViewVo getSubOneSupervisionRankOverView(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String... args) {
SubOneOverViewVo res = negativeMapper.getSubOneSupervisionRankOverView(departPId, statisticsGroupId, beginTime, endTime, args);
return res;
}
public List<RankVo> getSubOneSupervisionRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String... args) {
List<RankVo> res = negativeMapper.getSubOneSupervisionRank(departPId, statisticsGroupId, beginTime, endTime, args);
return res;
}
public SubOneOverViewVo getSubOneOverView(Integer departPId, Date beginTime, Date endTime) {
SubOneOverViewVo res = negativeMapper.getSubOneOverView(departPId, beginTime, endTime);
return res;
}
}

45
src/main/java/com/biutag/supervision/service/SubOneVideoSuperviseService.java

@ -0,0 +1,45 @@
package com.biutag.supervision.service;
import com.biutag.supervision.mapper.NegativeMapper;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.OrganizeProblemRankVo;
import com.biutag.supervision.pojo.vo.VideoSuperviseCountVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Auther: sh
* @Date: 2024/12/16 17:18
* @Description:
*/
@RequiredArgsConstructor
@Service
public class SubOneVideoSuperviseService {
private final NegativeMapper negativeMapper;
public VideoSuperviseCountVo getSubOneAllVideoSuperviseCount(Date beginTime, Date endTime, Integer departId) {
VideoSuperviseCountVo res = negativeMapper.getSubOneAllVideoSuperviseCount(beginTime, endTime, departId);
return res;
}
public List<OrganizeProblemRankVo> getSuboOneVideoSuperviseProblemRank(Date beginTime, Date endTime, Integer groupId, Integer departId) {
List<OrganizeProblemRankVo> res ;
if (groupId == 10) {
res = negativeMapper.getSuboOneVideoSupervisePoliceProblemRank(beginTime, endTime, groupId, departId);
} else {
res = negativeMapper.getSuboOneVideoSuperviseTeamProblemRank(beginTime, endTime, groupId, departId);
}
return res;
}
public List<EchartsVo> getSubOneVideoSuperviseTrend(String year, String problemCode, String departId) {
List<EchartsVo> res = negativeMapper.getSubOneVideoSuperviseTrend(year, problemCode, departId);
return res;
}
}

51
src/main/resources/mapper/NegativeMapper.xml

@ -141,6 +141,57 @@
AND discoveryTime BETWEEN #{beginTime} AND #{endTime};
</select>
<!-- 首页一级大屏督察问题总览 -->
<select id="getSubOneSupervisionRankOverView" resultType="com.biutag.supervision.pojo.vo.SubOneOverViewVo">
SELECT COUNT(DISTINCT ng.id) as one,
count(DISTINCT IF(ng.isRectifyCode = 1, ng.id, null) ) as two,
count(DISTINCT IF(ng.isRectifyCode = 0, ng.id, null) ) as three,
ROUND(COALESCE(COUNT(DISTINCT IF(ng.isRectifyCode = 1, ng.id, NULL)) / NULLIF(COUNT(DISTINCT ng.id), 0), 0) *
100, 1) AS four
FROM negative ng INNER JOIN
(SELECT id, short_name FROM sup_depart sd
WHERE sd.pid = #{departPId}
<if test="statisticsGroupId != 0">AND statistics_group_id = #{statisticsGroupId}</if>
<if test="statisticsGroupId == 0">AND statistics_group_id != 10</if>
) AS temp
ON ng.involveDepartId = temp.id
WHERE ng.problemSourcesCode IN
<foreach collection="args" item="arg" open="(" separator="," close=")">#{arg}</foreach>
AND discoveryTime BETWEEN #{beginTime} AND #{endTime};
</select>
<!-- 首页一级大屏督察问题排行 -->
<select id="getSubOneSupervisionRank" resultType="com.biutag.supervision.pojo.vo.RankVo">
SELECT temp.short_name as label,
temp.id AS departId,
count(DISTINCT ng.id) AS denominator,
count(DISTINCT IF(ng.isRectifyCode = 1, ng.id, NULL)) AS numerator,
ROUND(COUNT(DISTINCT if(ng.isRectifyCode = 1, ng.id, NULL)) / count(DISTINCT ng.id) * 100, 1) AS rate,
ROUND(COUNT(DISTINCT if(ng.isRectifyCode = 1, ng.id, NULL)) / count(DISTINCT ng.id) * 100, 1) AS `value`
FROM negative ng
INNER JOIN
(SELECT id, short_name FROM sup_depart sd WHERE sd.pid = #{departPId}
<if test="statisticsGroupId != 0">AND statistics_group_id = #{statisticsGroupId}</if>
<if test="statisticsGroupId == 0">AND statistics_group_id != 10</if>
) AS temp
ON ng.involveDepartId = temp.id
WHERE ng.problemSourcesCode IN
<foreach collection="args" item="arg" open="(" separator="," close=")">#{arg}</foreach>
AND discoveryTime BETWEEN #{beginTime} AND #{endTime}
GROUP BY label
order by rate desc;
</select>
<select id="getSubOneVideoSuperviseTrend" resultType="com.biutag.supervision.pojo.vo.EchartsVo">
SELECT m.month_name AS `name`, IFNULL(COUNT(ng.id), 0) AS `value`
FROM sup_month_monthname m
LEFT JOIN negative ng ON DATE_FORMAT(ng.discoveryTime, '%m') = m.month
inner JOIN sup_depart sd on ng.involveDepartId = sd.id and sd.pid = #{departId}
AND YEAR(ng.discoveryTime) = #{year}
AND ng.checkStatus != 3
AND ng.problemSourcesCode = #{problemCode}
GROUP BY m.month_name
ORDER BY m.month ASC;
</select>
</mapper>

33
src/test/java/com/biutag/supervision/service/DataMailServiceTest.java

@ -0,0 +1,33 @@
package com.biutag.supervision.service;
import com.biutag.supervision.pojo.vo.MailMapIconVo;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.xml.crypto.Data;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
class DataMailServiceTest {
@Resource
private DataMailService dataMailService;
@Test
void getMailMapIcon() throws ParseException {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date begin = formatter.parse("2024-01-01");
Date end = formatter.parse("2024-12-29");
List<MailMapIconVo> mailMapIcon = dataMailService.getMailMapIcon(begin, end);
for (MailMapIconVo mailMapIconVo : mailMapIcon) {
System.out.println(mailMapIconVo.toString());
}
}
}
Loading…
Cancel
Save