From 856cfb39131da63ad1d4cbae20af3ad247ce8547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E7=88=B1=E5=AD=A6=E4=B9=A0=E7=9A=84=E7=9F=B3?= =?UTF-8?q?=E5=90=8C=E5=AD=A6?= <2936013465@qq.com> Date: Thu, 31 Oct 2024 10:04:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E8=AE=BF=E5=A4=A7=E5=B1=8F1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constants/enums/RepeatEnum.java | 18 ++++ .../DataPetitionComplaintViewController.java | 71 ++++++++++++++ .../mapper/DataPetitionComplaintMapper.java | 22 +++++ .../service/DataPetitionComplaintService.java | 96 +++++++++++++++++-- 4 files changed, 201 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/constants/enums/RepeatEnum.java create mode 100644 src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java diff --git a/src/main/java/com/biutag/supervision/constants/enums/RepeatEnum.java b/src/main/java/com/biutag/supervision/constants/enums/RepeatEnum.java new file mode 100644 index 0000000..0ad1243 --- /dev/null +++ b/src/main/java/com/biutag/supervision/constants/enums/RepeatEnum.java @@ -0,0 +1,18 @@ +package com.biutag.supervision.constants.enums; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum RepeatEnum { + + FIRST_MAIL(1, "初访信件"), + REPEAT_MAIL(2, "重访信件"); + + private Integer id; + + private String label; + +} diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java b/src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java new file mode 100644 index 0000000..7d99035 --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java @@ -0,0 +1,71 @@ +package com.biutag.supervision.controller.datav; + + +import cn.hutool.core.util.NumberUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.supervision.constants.enums.DepartGroupEnum; +import com.biutag.supervision.constants.enums.RepeatEnum; +import com.biutag.supervision.mapper.DataCaseVerifMapper; +import com.biutag.supervision.mapper.DataPetitionComplaintMapper; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.dto.CaseVerifDepart; +import com.biutag.supervision.pojo.entity.DataPetitionComplaint; +import com.biutag.supervision.service.DataPetitionComplaintService; +import lombok.RequiredArgsConstructor; +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.math.BigDecimal; +import java.util.Date; +import java.util.List; + + +/** + * @author: sh + * @date: 2024/10/31 + */ +@RequestMapping("datav/mailVisits") +@RequiredArgsConstructor +@RestController +public class DataPetitionComplaintViewController { + + private final DataPetitionComplaintService dataPetitionComplaintService; + private final DataPetitionComplaintMapper dataPetitionComplaintMapper; + + /** + * 信访数据大屏统计 + * + * @param beginTime + * @param endTime + * @return + */ + @GetMapping + public Result mailVisits(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + // 信访数据总数概览 + JSONObject overview = dataPetitionComplaintService.allMailCount(beginTime, endTime); + // 分县市局信初重访领导访排名 + List fxsjFirstMailList = dataPetitionComplaintService.mailRank(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId(), RepeatEnum.FIRST_MAIL.getId(), beginTime, endTime); + List fxsjRepeatMailList = dataPetitionComplaintService.mailRank(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId(), RepeatEnum.REPEAT_MAIL.getId(), beginTime, endTime); + List fxsjLeaderViewMailList = dataPetitionComplaintMapper.selectLeaderViewMail(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId(), beginTime, endTime); + // 部委支队初重领导访排名 + List bwzdFirstMailList = dataPetitionComplaintService.mailRank(DepartGroupEnum.BUREAU_AFFILIATED.getId(), RepeatEnum.FIRST_MAIL.getId(), beginTime, endTime); + List bwzdRepeatMailList = dataPetitionComplaintService.mailRank(DepartGroupEnum.BUREAU_AFFILIATED.getId(), RepeatEnum.REPEAT_MAIL.getId(), beginTime, endTime); + List bwzdLeaderViewMailList = dataPetitionComplaintMapper.selectLeaderViewMail(DepartGroupEnum.BUREAU_AFFILIATED.getId(), beginTime, endTime); + // + + JSONObject data = new JSONObject().fluentPut("overview", overview) + .fluentPut("fxsjFirstMailList", fxsjFirstMailList) + .fluentPut("fxsjRepeatMailList", fxsjRepeatMailList) + .fluentPut("fxsjLeaderViewMailList", fxsjLeaderViewMailList) + .fluentPut("bwzdFirstMailList", bwzdFirstMailList) + .fluentPut("bwzdRepeatMailList", bwzdRepeatMailList) + .fluentPut("bwzdLeaderViewMailList", bwzdLeaderViewMailList); + return Result.success(data); + } + + +} diff --git a/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java b/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java index c90c93f..18e5373 100644 --- a/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java @@ -1,8 +1,30 @@ package com.biutag.supervision.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.dto.CaseVerifDepart; import com.biutag.supervision.pojo.entity.DataPetitionComplaint; +import org.apache.ibatis.annotations.Select; + +import java.util.Date; +import java.util.List; public interface DataPetitionComplaintMapper extends BaseMapper { + + + @Select("SELECT sd.id, sd.short_name label,count(*) value " + + "FROM (SELECT * FROM data_petition_complaint dpc " + + "WHERE dpc.create_time BETWEEN #{beginTime} AND #{endTime}) as temp " + + "INNER JOIN sup_depart sd on sd.id=temp.second_depart_id " + + "WHERE sd.statistics_group_id=#{departId} and temp.initial_petition=#{Repeat} " + + "GROUP BY temp.second_depart_id") + List selectDepartStatistic(Integer departId, Integer Repeat, Date beginTime, Date endTime); + + @Select("SELECT sd.id, sd.short_name label,count(*) value " + + "FROM (SELECT * FROM data_petition_complaint dpc " + + "WHERE dpc.create_time BETWEEN #{beginTime} AND #{endTime}) as temp " + + "INNER JOIN sup_depart sd on sd.id=temp.second_depart_id " + + "WHERE sd.statistics_group_id=#{departId} and temp.receiving_leader_name is not null " + + "GROUP BY temp.second_depart_id") + List selectLeaderViewMail(Integer departId, Date beginTime, Date endTime); } diff --git a/src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java b/src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java index bfdda49..166145f 100644 --- a/src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java +++ b/src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java @@ -2,30 +2,34 @@ package com.biutag.supervision.service; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.biutag.supervision.constants.enums.DataUpdateMethodEnum; -import com.biutag.supervision.constants.enums.DistributionStateEnum; -import com.biutag.supervision.constants.enums.HostLevelEnums; -import com.biutag.supervision.constants.enums.ProblemSourcesEnum; +import com.biutag.supervision.constants.enums.*; import com.biutag.supervision.mapper.DataPetitionComplaintMapper; import com.biutag.supervision.pojo.dto.*; import com.biutag.supervision.pojo.entity.DataPetitionComplaint; import com.biutag.supervision.pojo.param.DataPetitionComplaintQueryParam; import lombok.RequiredArgsConstructor; +import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; @RequiredArgsConstructor @Service public class DataPetitionComplaintService extends ServiceImpl { private final NegativeService negativeService; - + + private final DataPetitionComplaintMapper dataPetitionComplaintMapper; + public Page page(DataPetitionComplaintQueryParam queryParam) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(DataPetitionComplaint::getProblemSourcesCode, queryParam.getProblemSourcesCode()) @@ -47,6 +51,7 @@ public class DataPetitionComplaintService extends ServiceImpl countryQueryWrapper = new QueryWrapper<>(); + countryQueryWrapper.eq("problem_sources_code", 21); + countryQueryWrapper.between("create_time", beginTime, endTime); + Long countryMail = dataPetitionComplaintMapper.selectCount(countryQueryWrapper); + // 公安部信访 + QueryWrapper policeQueryWrapper = new QueryWrapper<>(); + policeQueryWrapper.eq("problem_sources_code", 22); + policeQueryWrapper.between("create_time", beginTime, endTime); + Long policeMail = dataPetitionComplaintMapper.selectCount(policeQueryWrapper); + // 初访 + QueryWrapper firstQueryWrapper = new QueryWrapper<>(); + firstQueryWrapper.eq("initial_petition", 1); + firstQueryWrapper.between("create_time", beginTime, endTime); + Long firstMail = dataPetitionComplaintMapper.selectCount(firstQueryWrapper); + // 重访 + QueryWrapper secondQueryWrapper = new QueryWrapper<>(); + secondQueryWrapper.eq("initial_petition", 2); + secondQueryWrapper.between("create_time", beginTime, endTime); + Long secondMail = dataPetitionComplaintMapper.selectCount(secondQueryWrapper); + // 领导接访 + QueryWrapper leaderQueryWrapper = new QueryWrapper<>(); + leaderQueryWrapper.isNotNull("receiving_leader_name"); + leaderQueryWrapper.between("create_time", beginTime, endTime); + Long leaderReceiveMail = dataPetitionComplaintMapper.selectCount(leaderQueryWrapper); + // 领导督办 + QueryWrapper leaderViewQueryWrapper = new QueryWrapper<>(); + leaderViewQueryWrapper.isNotNull("receiving_leader_name"); + leaderViewQueryWrapper.between("create_time", beginTime, endTime); + Long leaderViewMail = dataPetitionComplaintMapper.selectCount(leaderViewQueryWrapper); + // 闹访 + QueryWrapper tangleQueryWrapper = new QueryWrapper<>(); + tangleQueryWrapper.eq("entanglement_visits", 1); + tangleQueryWrapper.between("create_time", beginTime, endTime); + Long tangleMail = dataPetitionComplaintMapper.selectCount(tangleQueryWrapper); + // 集访 + QueryWrapper massQueryWrapper = new QueryWrapper<>(); + massQueryWrapper.eq("mass_visits", 1); + massQueryWrapper.between("create_time", beginTime, endTime); + Long massMail = dataPetitionComplaintMapper.selectCount(massQueryWrapper); + JSONObject overview = new JSONObject() + // 信访总数(起) + .fluentPut("total", totalMail) + // 国家信访 + .fluentPut("countryMail", countryMail) + // 公安部信访 + .fluentPut("policeMail", policeMail) + // 局长信箱 + .fluentPut("commissionerMail", 10) + // 12337信访 + .fluentPut("numMail", 10) + // 初访; + .fluentPut("firstMail", firstMail) + // 重访 + .fluentPut("secondMail", secondMail) + // 领导接访 + .fluentPut("leaderReceiveMail", leaderReceiveMail) + // 领导督办 + .fluentPut("leaderViewMail", leaderViewMail) + // 闹访问 + .fluentPut("tangleMail", tangleMail) + // 集访 + .fluentPut("massMail", massMail); + return overview; + } + + + // 分类数据排行 + public List mailRank(Integer departId, Integer Repeat, Date beginTime, Date endTime) { + List list = dataPetitionComplaintMapper. + selectDepartStatistic(departId, Repeat, beginTime, endTime); + return list; + } + + + }