diff --git a/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java b/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java index 9ca59c1..fc6021c 100644 --- a/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java +++ b/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java @@ -111,6 +111,11 @@ public class DataCaseVerifController { return Result.success(dataCaseVerifService.removeById(id)); } + /** + * 下发 + * @param dataDistribute 页面数据 办理时限 审核流程 + * @return + */ @PostMapping("distribute") public Result distribute(@RequestBody DataCaseVerifDistribute dataDistribute) { return Result.success(dataCaseVerifService.distribution(dataDistribute)); diff --git a/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaint12337Controller.java b/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaint12337Controller.java index 0c5a382..803c671 100644 --- a/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaint12337Controller.java +++ b/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaint12337Controller.java @@ -10,6 +10,7 @@ import com.biutag.supervision.pojo.entity.DataPetitionComplaint; import com.biutag.supervision.pojo.param.DataPetitionComplaintQueryParam; import com.biutag.supervision.pojo.vo.DataPetition12337Vo; import com.biutag.supervision.service.DataPetition12337Service; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; @@ -19,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +@Tag(name = "12337信访投诉菜单") @Slf4j @RequiredArgsConstructor @RequestMapping("data/petitionComplaint12337") diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java b/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java new file mode 100644 index 0000000..ec6ff54 --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java @@ -0,0 +1,138 @@ +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.service.DataGobalService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.web.bind.annotation.*; + +import java.time.YearMonth; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + + +/** + * 数据大屏首页 + * + * @author: sh + * @date: 2024/11/7 + */ +@Tag(name = "数据大屏首页", description = "数据大屏首页") +@RestController +@RequiredArgsConstructor +@RequestMapping("datav/dataGobalScreen") +public class DataGobalController { + + + private final DataGobalService dataGobalService; + + /** + * 获取数据大屏总数概览 + * + * @param beginTime + * @param endTime + * @return + */ + @Operation(summary = "初始化大屏中央数据") + @GetMapping + public Result getAllGobalCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + // 获取数据大屏中央总数概览 + JSONObject overview = dataGobalService.getAllGobalCount(beginTime, endTime); + + // 获取数据大屏各机构问题排名 + List fxsjlist = dataGobalService.getOrganizeProblemRank(3, beginTime, endTime); + List jsdwlist = dataGobalService.getOrganizeProblemRank(4, beginTime, endTime); + + // 业务类型占比 + List ywzblist = dataGobalService.getBusinessRate(beginTime, endTime); + + // 问题类型占比 + List wtlxlist = dataGobalService.getProblemRate(beginTime, endTime); + + + JSONObject data = new JSONObject().fluentPut("overview", overview) + .fluentPut("fxsjlist", fxsjlist) + .fluentPut("jsdwlist", jsdwlist) + .fluentPut("ywzblist", ywzblist) + .fluentPut("wtlxlist", wtlxlist); + return Result.success(data); + } + + + @Operation(summary = "机构问题排名") + @GetMapping("{groupType}") + public Result getOrganizeProblemRank( + @PathVariable Integer groupType, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + + List fxsjlist = dataGobalService.getOrganizeProblemRank(groupType, beginTime, endTime); + List jsdwlist = dataGobalService.getOrganizeProblemRank(groupType, beginTime, endTime); + JSONObject data = new JSONObject() + .fluentPut("fxsjlist", fxsjlist) + .fluentPut("jsdwlist", jsdwlist); + return Result.success(data); + } + + + /** + * 数据大屏问题趋势统计(按月) + * @param year + * @return + */ + @Operation(summary = "数据大屏问题趋势统计(按月)") + @GetMapping("/getGobalRecentlyTrendByMonth") + public Result getGobalRecentlyTrendByMonth(@RequestParam Integer year) { + + List recentTrendVoList = dataGobalService.getGobalRecentlyTrendByMonth(String.valueOf(year)); + ArrayList monthList = new ArrayList<>(); + ArrayList totalList = new ArrayList<>(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); + // 要展示到的月份 从那个月开始 + YearMonth endMonth = YearMonth.of(year, new Date().getMonth()); + YearMonth startMonth = YearMonth.of(year, 1); + for (RecentTrendByMonthVo recentTrendByMonthVo : recentTrendVoList) { + YearMonth trendMonth = YearMonth.parse(recentTrendByMonthVo.getMonthTime(), formatter); + + while (startMonth.isBefore(trendMonth)) { + String res = startMonth.format(formatter); + monthList.add(res); // 添加到monthList + totalList.add("0"); // 插入没有数据的月份,总数为0 + startMonth = startMonth.plusMonths(1); + } + String res = trendMonth.format(formatter); + monthList.add(res); + totalList.add(recentTrendByMonthVo.getTotal()); + startMonth = trendMonth.plusMonths(1); + } + + // 添加从最后一个有数据的月份到当前月份的缺失月份 + while (!startMonth.isAfter(endMonth)) { + String res = startMonth.format(formatter); + monthList.add(res); // 添加到monthList + totalList.add("0"); // 插入没有数据的月份,总数为0 + startMonth = startMonth.plusMonths(1); + } + // 截取月份 + List monthOnlyList = monthList.stream() + .map(date -> date.substring(date.indexOf('-') + 1)+"月") + .collect(Collectors.toList()); + JSONObject jsonObject = new JSONObject() + .fluentPut("monthList", monthOnlyList) + .fluentPut("totalList", totalList); + return Result.success(jsonObject); + } + +} diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java b/src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java index d6b689c..f83fae4 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java @@ -10,6 +10,8 @@ import com.biutag.supervision.pojo.dto.CaseVerifDepart; import com.biutag.supervision.pojo.vo.RecentMailTrendByDayVo; import com.biutag.supervision.pojo.vo.RecentMailTrendByMonthVo; import com.biutag.supervision.service.DataPetitionComplaintService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; @@ -31,6 +33,7 @@ import java.util.stream.Collectors; * @author: sh * @date: 2024/10/31 */ +@Tag(name = "信访数据大屏选相关") @RequestMapping("datav/mailVisits") @RequiredArgsConstructor @RestController @@ -45,6 +48,7 @@ public class DataPetitionComplaintViewController { * @param endTime * @return */ + @Operation(summary = "信访数据大屏中央数据统计") @GetMapping public Result mailVisits(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { // 信访数据总数概览 @@ -80,6 +84,7 @@ public class DataPetitionComplaintViewController { /** * 信访数据大屏信访趋势统计(按日) */ + @Operation(summary = "信访数据大屏信访趋势统计(按日)") @GetMapping("/getRecentlyMailTrendByDay") public Result getRecentlyMailTrendByDay(@RequestParam Integer sourcesCode, @RequestParam Integer days, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { JSONObject jsonObject = new JSONObject(); @@ -118,6 +123,7 @@ public class DataPetitionComplaintViewController { * @param year * @return */ + @Operation(summary = "信访数据大屏信访趋势统计(按月)") @GetMapping("/getRecentlyMailTrendMonth") public Result getRecentlyMailTrendByMonth(@RequestParam Integer sourcesCode, @RequestParam Integer year) { JSONObject jsonObject = new JSONObject(); @@ -140,6 +146,7 @@ public class DataPetitionComplaintViewController { * @param year * @return */ + @Operation(summary = "信访数据大屏12337信访趋势统计(按月)") @GetMapping("/getRecentlyMailTrendByMonth12337") public Result getRecentlyMailTrendByMonth12337(@RequestParam Integer year) { JSONObject jsonObject = new JSONObject(); diff --git a/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java b/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java new file mode 100644 index 0000000..1604560 --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java @@ -0,0 +1,67 @@ +package com.biutag.supervision.controller.datav; + +import com.alibaba.fastjson.JSONObject; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.dto.CaseVerifDepart; +import com.biutag.supervision.pojo.vo.RankVo; +import com.biutag.supervision.service.DataSupervisionNotifyServiceImpl; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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.Date; +import java.util.List; + +/** + * @Auther: sh + * @Date: 2024/11/7 10:30 + * @Description: 现场督察相关 + */ +@Slf4j +@RestController +@RequiredArgsConstructor +@RequestMapping("datav/supervisonNotify") +@Tag(name = "现场督察相关") +public class SupervisionNotifyController { + + private final DataSupervisionNotifyServiceImpl dataSupervisionNotifyService; + + /** + * 获取所有现场督察钟中央总数数量 + * @return + */ + @Operation(summary = "获取所有督察通知相关数量") + @GetMapping + public Result getAllSupervisionNotifyCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ + JSONObject overview = dataSupervisionNotifyService.getAllSupervisionNotifyCount(beginTime, endTime); + JSONObject data = new JSONObject().fluentPut("overview", overview); + return Result.success(data); + } + + + /** + * 获取日常督察排行 + * @param groupType 分组类型 1: 分县市局 2: 局属单位 + * @return + */ + @Operation(summary = "获取日常督察排行") + @GetMapping("/rank") + public Result getChangedRank(@RequestParam Integer groupType, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ + List changedRank = dataSupervisionNotifyService.getChangedRank(groupType, beginTime, endTime); + JSONObject data = new JSONObject().fluentPut("changedRank", changedRank); + return Result.success(data); + } + + + +} + diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java index 6df2f7c..85ba7db 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java @@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.math.BigDecimal; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; @@ -140,8 +141,10 @@ public class ProfilePoliceController { List problemTypeRadarData = problemTypeBarList.stream().map(BarItem::getValue).toList(); profilePolice.setProblemTypeRadarIndicator(problemTypeRadarIndicator); profilePolice.setProblemTypeRadarData(problemTypeRadarData); - // - profilePolice.setScore(profilePoliceService.getPoliceScore(beginTime, endTime, idCode)); + + List result = profilePoliceService.getPoliceScore(beginTime, endTime, idCode); + profilePolice.setScore((BigDecimal) result.get(0)); + profilePolice.setExpression(result.get(1).toString()); return Result.success(profilePolice); } @@ -160,7 +163,8 @@ public class ProfilePoliceController { Page pageData = negativeService.page(page, new LambdaQueryWrapper() .between(Negative::getDiscoveryTime, beginTime, endTime) .in(Negative::getId, negativeIds) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))); + .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())) + .orderByDesc(Negative::getUpdTime)); return Result.success(pageData); } diff --git a/src/main/java/com/biutag/supervision/controller/work/NegativeController.java b/src/main/java/com/biutag/supervision/controller/work/NegativeController.java index dc096d2..126cc3c 100644 --- a/src/main/java/com/biutag/supervision/controller/work/NegativeController.java +++ b/src/main/java/com/biutag/supervision/controller/work/NegativeController.java @@ -49,6 +49,12 @@ public class NegativeController { return Result.success(negativeQueryService.page(queryParam)); } + /** + * 获取 negative blame negative_history negative_file ...表 + * @param id + * @param workId + * @return NegativeDetail + */ @GetMapping("{id}") public Result get(@PathVariable String id, Integer workId) { return Result.success(negativeService.get(id, workId)); @@ -86,6 +92,9 @@ public class NegativeController { return Result.success(); } + /** + * 确定签收 提交审核 + */ @PostMapping("{id}/execute") public Result execute(@PathVariable String id, @RequestBody ActionDto action) { action.setNegativeId(id); diff --git a/src/main/java/com/biutag/supervision/flow/action/SaveAction.java b/src/main/java/com/biutag/supervision/flow/action/SaveAction.java index 684e29b..faccd99 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SaveAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SaveAction.java @@ -68,7 +68,9 @@ public class SaveAction implements Action { .set(Negative::getInvolveDepartName, depart.getShortName()); } negativeService.update(updateWrapper); - + /** + * 如果涉及不为空,则先删除原有数据,再新增 + */ if (!verifyData.getBlames().isEmpty()) { negativeBlameService.remove(negativeId); List problemRelations = new ArrayList<>(); diff --git a/src/main/java/com/biutag/supervision/job/ScoreJob.java b/src/main/java/com/biutag/supervision/job/ScoreJob.java index 02a3143..f7ba08e 100644 --- a/src/main/java/com/biutag/supervision/job/ScoreJob.java +++ b/src/main/java/com/biutag/supervision/job/ScoreJob.java @@ -1,6 +1,7 @@ package com.biutag.supervision.job; import cn.hutool.core.util.NumberUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.biutag.supervision.constants.enums.NegativeLevelEnum; import com.biutag.supervision.mapper.NegativeBlameMapper; import com.biutag.supervision.mapper.SupDictContentMapper; @@ -37,42 +38,44 @@ public class ScoreJob { private final SupDictContentMapper supDictContentMapper; -// @Scheduled(fixedRate = 6000000) + @Scheduled(fixedRate = 600000) public void updateScore() { System.out.println("updateScore-------------------------------------------------"); List negativeBlames = blameMapper.selectVerifyTrue(); - String formula = "%s + (1 * %s) + (1 * %s)"; - List scorePolices = negativeBlames.stream().map(blame -> { + String formula = "%s + (%s * %s) + (%s * %s)"; + negativeBlames.forEach(blame -> { Negative negative = negativeService.getById(blame.getNegativeId()); NegativeScorePolice negativeScorePolice = new NegativeScorePolice() .setNegativeId(blame.getNegativeId()) .setIdCode(blame.getBlameIdCode()) .setDiscoveryTime(negative.getDiscoveryTime()) - .setIdCode(blame.getBlameIdCode()); + .setIdCode(blame.getBlameIdCode()) + .setBusinessTypeCode(negative.getBusinessTypeCode()) + .setCreateTime(LocalDateTime.now()); List problems = problemRelationService.list(blame.getNegativeId(), blame.getBlameId()); List codes = problems.stream().map(NegativeProblemRelation::getThreeLevelCode).toList(); if (codes.isEmpty()) { - throw new RuntimeException("数据异常"); + return; } SupDictProblemType problemType = supDictContentMapper.selectOneByMaxScore(codes); LocalDateTime endTime = negative.getDiscoveryTime(); LocalDateTime beginTime = endTime.minusYears(1); int frequency = blameService.countByTrue(blame.getBlameIdCode(), problemType.getParentCode(), beginTime, endTime); String expression = String.format(formula, + problemType.getScore(), problemType.getScore(), NegativeLevelEnum.GENERAL_IMPACT.getScore(), + problemType.getScore(), ScoreRule.getFrequencyScore(frequency)); - negativeScorePolice.setExpression(expression); + double calculate = NumberUtil.calculate(expression); double score = NumberUtil.roundHalfEven(calculate, 2).doubleValue(); - negativeScorePolice.setScore(score); - negativeScorePolice.setCreateTime(LocalDateTime.now()); - return negativeScorePolice; - }).toList(); - if (!scorePolices.isEmpty()) { - negativeScorePoliceService.saveBatch(scorePolices); - } + negativeScorePolice.setScore(score) + .setExpression(expression); + negativeScorePoliceService.remove(new LambdaQueryWrapper().eq(NegativeScorePolice::getNegativeId, negative.getId()).eq(NegativeScorePolice::getIdCode, blame.getBlameIdCode())); + negativeScorePoliceService.save(negativeScorePolice); + }); } diff --git a/src/main/java/com/biutag/supervision/mapper/DataSupervisionNotifyMapper.java b/src/main/java/com/biutag/supervision/mapper/DataSupervisionNotifyMapper.java new file mode 100644 index 0000000..c61d4cb --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/DataSupervisionNotifyMapper.java @@ -0,0 +1,18 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.DataSupervisionNotify; + +/** +* @author 舒云 +* @description 针对表【data_supervision_notify】的数据库操作Mapper +* @createDate 2024-11-07 09:38:29 +* @Entity generator.domain.DataSupervisionNotify +*/ +public interface DataSupervisionNotifyMapper extends BaseMapper { + +} + + + + diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java index 1d000aa..261bd23 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -2,6 +2,42 @@ package com.biutag.supervision.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.RankVo; +import com.biutag.supervision.pojo.vo.RecentTrendByMonthVo; +import org.apache.ibatis.annotations.Select; + +import java.util.Date; +import java.util.List; public interface NegativeMapper extends BaseMapper { + + /** + * 查询组织问题排名 + * @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") + List 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 " + + "GROUP BY businessTypeName") + List 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 " + + "GROUP BY monthTime " + + "order BY monthTime asc") + List selectRecentTrendByMonth(String year); + + + } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java index 4b33425..976155d 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java @@ -2,7 +2,18 @@ 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.EchartsVo; +import org.apache.ibatis.annotations.Select; + +import java.util.Date; +import java.util.List; public interface NegativeProblemRelationMapper extends BaseMapper { + + @Select("SELECT npr.oneLevelContent as name, count(*) value " + + "FROM negative_problem_relation npr " + + "WHERE npr.oneLevelContent is not NULL " + + "GROUP BY `name` ") + List selectProblemRate(Date beginTime, Date endTime); } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java b/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java index adf718d..c9bf8a3 100644 --- a/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java +++ b/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java @@ -19,6 +19,8 @@ public class ProfilePolice { private BigDecimal score; + private String expression; + private SupPolice policeInfo = new SupPolice(); private NegativeInfo negativeInfo = new NegativeInfo(); private List problemSourcesList = new ArrayList<>(); diff --git a/src/main/java/com/biutag/supervision/pojo/entity/DataPetition12337.java b/src/main/java/com/biutag/supervision/pojo/entity/DataPetition12337.java index fcc5db6..bf3cd9f 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/DataPetition12337.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/DataPetition12337.java @@ -607,6 +607,10 @@ public class DataPetition12337 implements Serializable { private String distributionState; + @TableField(value="is_real") + private Integer isReal; + + @TableField(exist = false) private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/DataSupervisionNotify.java b/src/main/java/com/biutag/supervision/pojo/entity/DataSupervisionNotify.java new file mode 100644 index 0000000..0d1a85e --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/DataSupervisionNotify.java @@ -0,0 +1,139 @@ +package com.biutag.supervision.pojo.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * + * @TableName data_supervision_notify + */ +@TableName(value ="data_supervision_notify") +@Data +public class DataSupervisionNotify implements Serializable { + /** + * 序号 + */ + @TableId(value = "id") + private Integer id; + + /** + * 通报名称 + */ + @TableField(value = "tb_name") + private String tbName; + + /** + * 监督单位 + */ + @TableField(value = "tb_unit") + private String tbUnit; + + /** + * 被监督二级机构 + */ + @TableField(value = "sec_org_name") + private String secOrgName; + + /** + * 被监督三级机构 + */ + @TableField(value = "th_org_name") + private String thOrgName; + + /** + * 监督发现问题日期 + */ + @TableField(value = "dis_date") + private String disDate; + + /** + * 问题内容 + */ + @TableField(value = "pro_content") + private String proContent; + + /** + * 问题类型 + */ + @TableField(value = "pro_type") + private String proType; + + /** + * 具体问题 + */ + @TableField(value = "pro_specific") + private String proSpecific; + + /** + * 回复期限 + */ + @TableField(value = "rep_date_limit") + private String repDateLimit; + + /** + * 回复日期 + */ + @TableField(value = "rep_date") + private String repDate; + + /** + * 是否及时回复 + */ + @TableField(value = "is_rep_timely") + private String isRepTimely; + + /** + * 回复情况 + */ + @TableField(value = "rep_content") + private String repContent; + + /** + * 是否属实(1属实 2部分属实 3不属实) + */ + @TableField(value = "is_real") + private Integer isReal; + + /** + * 被问责人员姓名 + */ + @TableField(value = "pro_person_name") + private String proPersonName; + + /** + * 人员类型 + */ + @TableField(value = "person_type") + private String personType; + + /** + * 问责情况(个人) + */ + @TableField(value = "wz_content_single") + private String wzContentSingle; + + /** + * 问责情况(单位) + */ + @TableField(value = "wz_content_org") + private String wzContentOrg; + + /** + * 被监督二级机构id + */ + @TableField(value = "second_depart_id") + private String secondDepartId; + + /** + * 被监督三级机构id + */ + @TableField(value = "third_depart_id") + private String thirdDepartId; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/FlowNode.java b/src/main/java/com/biutag/supervision/pojo/entity/FlowNode.java index ca1b062..08bbe36 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/FlowNode.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/FlowNode.java @@ -7,6 +7,9 @@ import lombok.Setter; import java.time.LocalDateTime; +/** + * 流程节点表 + */ @Setter @Getter public class FlowNode { diff --git a/src/main/java/com/biutag/supervision/pojo/param/DataPetitionComplaintQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/DataPetitionComplaintQueryParam.java index 6306ba1..79f9247 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/DataPetitionComplaintQueryParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/DataPetitionComplaintQueryParam.java @@ -24,6 +24,8 @@ public class DataPetitionComplaintQueryParam extends BasePage { @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private List discoveryTime = new ArrayList<>(); + private String checkStatus; // 是否属实 1属实 2部分属实 3不属实 + private String thingDesc; } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/DataPetition12337Vo.java b/src/main/java/com/biutag/supervision/pojo/vo/DataPetition12337Vo.java index ba6763a..8e32723 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/DataPetition12337Vo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/DataPetition12337Vo.java @@ -168,6 +168,11 @@ public class DataPetition12337Vo implements Serializable { */ private String distributionState; + /** + * 是否属实 + */ + private Integer isReal; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/vo/EchartsVo.java b/src/main/java/com/biutag/supervision/pojo/vo/EchartsVo.java new file mode 100644 index 0000000..0934b3c --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/EchartsVo.java @@ -0,0 +1,15 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Data; + +/** + * @Auther: sh + * @Date: 2024/11/11 18:21 + * @Description: + */ +@Data +public class EchartsVo { + private String name; + private Integer value; +} + diff --git a/src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java b/src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java new file mode 100644 index 0000000..c3ea260 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/OrganizeProblemRankVo.java @@ -0,0 +1,15 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Data; + +/** + * @Auther: sh + * @Date: 2024/11/8 11:17 + * @Description: 首页大屏机构问题排名VO + */ +@Data +public class OrganizeProblemRankVo { + private String label; // 部门名 + private String value; // 问题数 +} + diff --git a/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java b/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java new file mode 100644 index 0000000..169b8c5 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java @@ -0,0 +1,19 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Data; + +/** + * @Auther: sh + * @Date: 2024/11/7 19:32 + * @Description: 带排名的部门 VO + */ +@Data +public class RankVo { + + private String label; // 部门名称 + private String departId; // 部门id + private Integer value; // 数量 + private String numerator; // 分子 已整改 + private String denominator; // 分母 问题数 +} + diff --git a/src/main/java/com/biutag/supervision/pojo/vo/RecentTrendByMonthVo.java b/src/main/java/com/biutag/supervision/pojo/vo/RecentTrendByMonthVo.java new file mode 100644 index 0000000..56d9905 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/RecentTrendByMonthVo.java @@ -0,0 +1,15 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Data; + +/** + * @Auther: sh + * @Date: 2024/11/11 19:21 + * @Description: + */ +@Data +public class RecentTrendByMonthVo { + private String MonthTime; // 24/01 + private String total; // 10 +} + diff --git a/src/main/java/com/biutag/supervision/service/BusinessPoliceService.java b/src/main/java/com/biutag/supervision/service/BusinessPoliceService.java index 843ba3e..457a5fe 100644 --- a/src/main/java/com/biutag/supervision/service/BusinessPoliceService.java +++ b/src/main/java/com/biutag/supervision/service/BusinessPoliceService.java @@ -2,6 +2,7 @@ package com.biutag.supervision.service; import cn.hutool.core.util.StrUtil; import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -428,5 +429,9 @@ public class BusinessPoliceService extends ServiceImpl list(Date beginTime, Date endTime, String businessType) { + return list(new LambdaQueryWrapper().between(BusinessPolice::getDate, beginTime, endTime).eq(BusinessPolice::getBusinessType, businessType)); + } + } diff --git a/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java b/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java index f036883..f76dc3a 100644 --- a/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java +++ b/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java @@ -57,19 +57,24 @@ public class DataCaseVerifService extends ServiceImpl { NegativeDto negativeDto = new NegativeDto(); - negativeDto.setOriginId(item.getOriginId()); + negativeDto.setOriginId(item.getOriginId()); // 设置数据源id negativeDto.setHappenTime(item.getHappenTime()); negativeDto.setDiscoveryTime(item.getDiscoveryTime()); - negativeDto.setProblemSourcesCode(ProblemSourcesEnum.A12389.getValue()); + negativeDto.setProblemSourcesCode(ProblemSourcesEnum.A12389.getValue()); // 来源分类 negativeDto.setProblemSources(ProblemSourcesEnum.A12389.getLabel()); // negativeDto.setBusinessTypeCode(BusinessTypeEnum.ABWW); // negativeDto.setBusinessTypeName(); - negativeDto.setResponderName(item.getResponderName()); + negativeDto.setResponderName(item.getResponderName()); // 投诉人 negativeDto.setContactPhone(item.getResponderPhone()); - negativeDto.setThingDesc(item.getThingDesc()); + negativeDto.setThingDesc(item.getThingDesc()); // 投诉详情 String departId; String departName; if (StrUtil.isBlank(item.getThirdDepartId())) { @@ -79,18 +84,17 @@ public class DataCaseVerifService extends ServiceImpl().eq(DataCaseVerif::getOriginId, item.getOriginId()) .set(DataCaseVerif::getDistributionState, DistributionStateEnum.DISTRIBUTED.getValue())); diff --git a/src/main/java/com/biutag/supervision/service/DataGobalService.java b/src/main/java/com/biutag/supervision/service/DataGobalService.java new file mode 100644 index 0000000..b8864d2 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/DataGobalService.java @@ -0,0 +1,137 @@ +package com.biutag.supervision.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.supervision.constants.enums.InspectCaseEnum; +import com.biutag.supervision.mapper.DataCaseVerifMapper; +import com.biutag.supervision.mapper.DataSupervisionNotifyMapper; +import com.biutag.supervision.mapper.NegativeMapper; +import com.biutag.supervision.mapper.NegativeProblemRelationMapper; +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 lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 数据大屏服务层 + * + * @author sh + * @date 2024/11/6 + */ +@RequiredArgsConstructor +@Service +public class DataGobalService { + + + private final NegativeMapper negativeMapper; + private final NegativeProblemRelationMapper negativeProblemRelationMapper; + + /** + * 获取所有大屏统计数据 + * + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @return 返回所有大屏统计数据 + */ + public JSONObject getAllGobalCount(Date beginTime, Date endTime) { + // 获取案件核查问题数量(查实版本) + Long caseVerificationPro = getCountByConditions( + Integer.parseInt(InspectCaseEnum.TRUE.getValue()), + beginTime, endTime, + 17, 18, 19, 20); + // 督察问题数量(查实版本) + Long supervisionPro = getCountByConditions( + Integer.parseInt(InspectCaseEnum.TRUE.getValue()), + beginTime, endTime, + 13, 15, 16); + // 信访投诉问题数量(查实版本) + Long complaintPro = getCountByConditions( + Integer.parseInt(InspectCaseEnum.TRUE.getValue()), + beginTime, endTime, + 21, 22, 23, 24, 25); + // 警务评议问题数量(查实版本) + Long reviewPro = getCountByConditions( + Integer.parseInt(InspectCaseEnum.TRUE.getValue()), + beginTime, endTime, + 2); + // 审计监督问题数量(查实版本) + Long auditPro = getCountByConditions( + Integer.parseInt(InspectCaseEnum.TRUE.getValue()), + beginTime, endTime, + 26); + JSONObject overview = new JSONObject(); + overview.fluentPut("caseVerificationPro", caseVerificationPro) + .fluentPut("supervisionPro", supervisionPro) + .fluentPut("complaintPro", complaintPro) + .fluentPut("reviewPro", reviewPro) + .fluentPut("auditPro", auditPro); + return overview; + } + + + /** + * 查询核查属实的公共方法 + * + * @param checkStatus 检查状态 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param problemSourcesCodes 问题来源代码数组 + * @return 满足条件的记录数 + */ + public Long getCountByConditions(Integer checkStatus, Date startTime, Date endTime, Integer... problemSourcesCodes) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("checkStatus", checkStatus) + .between("happenTime", startTime, endTime) + .and(wrapper -> { + for (int i = 0; i < problemSourcesCodes.length; i++) { + if (i == 0) { + wrapper.eq("problemSourcesCode", problemSourcesCodes[i]); + } else { + wrapper.or().eq("problemSourcesCode", problemSourcesCodes[i]); + } + } + }); + return negativeMapper.selectCount(queryWrapper); + } + + public List getOrganizeProblemRank(Integer groupType, Date beginTime, Date endTime) { + List res = negativeMapper.selectOrganizeProblemRank(groupType, beginTime, endTime); + return res; + } + + public List getBusinessRate(Date beginTime,Date endTime) { + List res= negativeMapper.selectBusinessRate(beginTime, endTime); + return res; + } + + public List getGobalRecentlyTrendByMonth(String year) { + List trendByMonthVoList = negativeMapper.selectRecentTrendByMonth(year); + return trendByMonthVoList; + } + + /** + * 获取问题类型占比 + * @param beginTime + * @param endTime + * @return + */ + public List getProblemRate(Date beginTime, Date endTime) { + + /** + * SELECT npr.oneLevelContent as name, count(*) value + * FROM negative_problem_relation npr + * WHERE npr.oneLevelContent is not NULL + * GROUP BY `name` + */ + List wtlxList = negativeProblemRelationMapper.selectProblemRate(beginTime, endTime); + return wtlxList; + } +} diff --git a/src/main/java/com/biutag/supervision/service/DataPetition12337Service.java b/src/main/java/com/biutag/supervision/service/DataPetition12337Service.java index 1714a62..c1812bb 100644 --- a/src/main/java/com/biutag/supervision/service/DataPetition12337Service.java +++ b/src/main/java/com/biutag/supervision/service/DataPetition12337Service.java @@ -12,6 +12,7 @@ import com.biutag.supervision.mapper.DataPetition12337Mapper; import com.biutag.supervision.pojo.dto.DataDataPetitionComplainDistribute; import com.biutag.supervision.pojo.dto.DataDataPetitionComplainDistribute12337; import com.biutag.supervision.pojo.dto.NegativeDto; +import com.biutag.supervision.pojo.entity.DataCaseVerif; import com.biutag.supervision.pojo.entity.DataPetition12337; import com.biutag.supervision.pojo.entity.DataPetitionComplaint; import com.biutag.supervision.pojo.param.DataPetitionComplaintQueryParam; @@ -32,6 +33,7 @@ public class DataPetition12337Service extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.like(StrUtil.isNotBlank(queryParam.getOriginId()), DataPetition12337::getOnlyId, queryParam.getOriginId()) .like(StrUtil.isNotBlank(queryParam.getThingDesc()), DataPetition12337::getWjwfProject, queryParam.getThingDesc()) + .eq(StrUtil.isNotBlank(queryParam.getCheckStatus()), DataPetition12337::getIsReal, queryParam.getCheckStatus()) // 按创建时间倒序排序 .orderByDesc(DataPetition12337::getDiscoverTime); // 如果 discoveryTime 有两个值(表示时间范围),则添加范围查询条件 diff --git a/src/main/java/com/biutag/supervision/service/DataScreenService.java b/src/main/java/com/biutag/supervision/service/DataScreenService.java deleted file mode 100644 index 126ea00..0000000 --- a/src/main/java/com/biutag/supervision/service/DataScreenService.java +++ /dev/null @@ -1,18 +0,0 @@ -//package com.biutag.supervision.service; -// -//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -//import lombok.RequiredArgsConstructor; -//import org.springframework.stereotype.Service; -// -//import java.util.List; -//import java.util.Map; -// -//@RequiredArgsConstructor -//@Service -//public class DataScreenService extends ServiceImpl { -// -// -// public List> mapData() { -// return null; -// } -//} diff --git a/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java b/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java new file mode 100644 index 0000000..7be0b94 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java @@ -0,0 +1,148 @@ +package com.biutag.supervision.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.constants.enums.DepartGroupEnum; +import com.biutag.supervision.constants.enums.ProblemSourcesEnum; +import com.biutag.supervision.constants.enums.RepeatEnum; +import com.biutag.supervision.mapper.DataSupervisionNotifyMapper; +import com.biutag.supervision.mapper.NegativeBlameMapper; +import com.biutag.supervision.mapper.NegativeMapper; +import com.biutag.supervision.pojo.dto.CaseVerifDepart; +import com.biutag.supervision.pojo.entity.DataSupervisionNotify; +import com.biutag.supervision.pojo.entity.Negative; +import com.biutag.supervision.pojo.entity.NegativeBlame; +import com.biutag.supervision.pojo.vo.RankVo; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @author 舒云 + * @description 针对表【data_supervision_notify】的数据库操作Service实现 + * @createDate 2024-11-07 09:38:29 + */ +@RequiredArgsConstructor +@Service +public class DataSupervisionNotifyServiceImpl extends ServiceImpl { + + private final DataSupervisionNotifyMapper dataSupervisionNotifyMapper; + + private final NegativeMapper negativeMapper; + private final NegativeBlameMapper negativeBlameMapper; + + private final NegativeBlameService blameService; + + /** + * 获取所有现场督察的数量 + * 现场督察代码: 13 + * @param beginTime + * @param endTime + * @return + */ + public JSONObject getAllSupervisionNotifyCount(Date beginTime, Date endTime) { + QueryWrapper negativeQueryWrapper = new QueryWrapper<>(); + negativeQueryWrapper.between("crtTime", beginTime, endTime); + negativeQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); + Long supervisionNotifyTotal = negativeMapper.selectCount(negativeQueryWrapper); // 通报问题数 + /* QueryWrapper changingQueryWrapper = new QueryWrapper<>(); + changingQueryWrapper.between("crtTime", beginTime, endTime); + changingQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); + changingQueryWrapper.eq("isRectifyCode", 1); + Long supervisionNotifyChangingTotal = negativeMapper.selectCount(changingQueryWrapper); */ // 整改中问题数 + QueryWrapper changedQueryWrapper = new QueryWrapper<>(); + changedQueryWrapper.between("crtTime", beginTime, endTime); + changedQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); + changedQueryWrapper.eq("isRectifyCode", 1); + Long supervisionNotifyChangedTotal = negativeMapper.selectCount(changedQueryWrapper); // 已整改问题数 + QueryWrapper orgQueryWrapper = new QueryWrapper<>(); + orgQueryWrapper.between("crtTime", beginTime, endTime); + orgQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); + orgQueryWrapper.select("distinct involveDepartId"); + Long supervisionNotifyOrgTotal = negativeMapper.selectCount(orgQueryWrapper); // 涉及单位数 + /** + * 涉及人数 + * 1、查出在 negative中的id集合 + * 2、查出集合在blame中的涉及人数 + */ + QueryWrapper preQueryWrapper = new QueryWrapper<>(); + preQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); + ArrayList negatives = (ArrayList) negativeMapper.selectList(preQueryWrapper); + Long supervisionNotifyPreTotal = 0L; + for (Negative negative : negatives) { + String id = negative.getId(); + QueryWrapper totalWrapper = new QueryWrapper<>(); + totalWrapper.eq("negativeId", id); + supervisionNotifyPreTotal += negativeBlameMapper.selectCount(totalWrapper); + } + double correctionRate = supervisionNotifyTotal != 0 ? (supervisionNotifyChangedTotal * 1.0 / supervisionNotifyTotal) * 100 : 0; // 整改率 + JSONObject jsonObject = new JSONObject(); + jsonObject.fluentPut("supervisionNotifyTotal", supervisionNotifyTotal) + .fluentPut("supervisionNotifyOrgTotal", supervisionNotifyOrgTotal) + .fluentPut("supervisionNotifyPreTotal", supervisionNotifyPreTotal) +// .fluentPut("supervisionNotifyChangingTotal", supervisionNotifyChangingTotal) + .fluentPut("supervisionNotifyChangedTotal", supervisionNotifyChangedTotal) + .fluentPut("correctionRate", correctionRate); + return jsonObject; + } + + + public List getChangedRank(Integer groupType, Date beginTime, Date endTime) { +// List changedList = negativeMapper.rank(groupType, beginTime, endTime); + // 计算整改率 +// return changedList; + return null; + } + + + + + private JSONObject getJsonObject(Date beginTime, Date endTime) { + // 通报问题数 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.between("dis_date", beginTime, endTime); + queryWrapper.select("distinct tb_name"); + Long supervisionNotifyTotal = dataSupervisionNotifyMapper.selectCount(queryWrapper); + // 涉及单位数 + QueryWrapper orgQueryWrapper = new QueryWrapper<>(); + orgQueryWrapper.between("dis_date", beginTime, endTime); + orgQueryWrapper.select("distinct th_org_name"); + Long supervisionNotifyOrgTotal = dataSupervisionNotifyMapper.selectCount(orgQueryWrapper); + // 涉及人数 + QueryWrapper preQueryWrapper = new QueryWrapper<>(); + preQueryWrapper.between("dis_date", beginTime, endTime); + preQueryWrapper.select("distinct pro_person_name"); + Long supervisionNotifyPreTotal = dataSupervisionNotifyMapper.selectCount(preQueryWrapper); + // 整改中 + QueryWrapper changingQueryWrapper = new QueryWrapper<>(); + changingQueryWrapper.between("dis_date", beginTime, endTime); + changingQueryWrapper.isNull("rep_content"); + Long supervisionNotifyChangingTotal = dataSupervisionNotifyMapper.selectCount(changingQueryWrapper); + // 已整改 + QueryWrapper changedQueryWrapper = new QueryWrapper<>(); + changedQueryWrapper.between("dis_date", beginTime, endTime); + changedQueryWrapper.isNotNull("rep_content"); + Long supervisionNotifyChangedTotal = dataSupervisionNotifyMapper.selectCount(changedQueryWrapper); + // 整改率 + long count = this.count(); // 库里面总数 + double correctionRate = count != 0 ? (supervisionNotifyChangedTotal * 1.0 / count) * 100 : 0; + JSONObject jsonObject = new JSONObject(); + jsonObject.fluentPut("supervisionNotifyTotal", supervisionNotifyTotal) + .fluentPut("supervisionNotifyOrgTotal", supervisionNotifyOrgTotal) + .fluentPut("supervisionNotifyPreTotal", supervisionNotifyPreTotal) + .fluentPut("supervisionNotifyChangingTotal", supervisionNotifyChangingTotal) + .fluentPut("supervisionNotifyChangedTotal", supervisionNotifyChangedTotal) + .fluentPut("correctionRate", correctionRate); + return jsonObject; + } + + +} + + + + diff --git a/src/main/java/com/biutag/supervision/service/NegativeService.java b/src/main/java/com/biutag/supervision/service/NegativeService.java index 6e28a3c..0fed256 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeService.java @@ -166,18 +166,18 @@ public class NegativeService extends ServiceImpl { BeanUtil.copyProperties(negativeDto, negative); if (StrUtil.isBlank(negativeDto.getOriginId())) { String originId = generateOriginId(negativeDto.getProblemSourcesCode(), negativeDto.getBusinessTypeCode()); - negative.setOriginId(originId); + negative.setOriginId(originId); // 如果是空就生成随机的线索源 } LocalDateTime now = LocalDateTime.now(); - negative.setId(IdUtil.getSnowflakeNextIdStr()) + negative.setId(IdUtil.getSnowflakeNextIdStr()) // negative唯一标识 雪花 .setProcessingStatus(ProcessingStatusEnum.signing.name()) - .setFlowKey(FlowNodeEnum.FIRST_DISTRIBUTE.getKey()) + .setFlowKey(FlowNodeEnum.FIRST_DISTRIBUTE.getKey()) // 市局下发 .setCrtTime(now) .setUpdTime(now); if (Objects.nonNull(negativeDto.getInvolveProblem())) { negative.setInvolveProblem(JSON.toJSONString(negativeDto.getInvolveProblem())); } - save(negative); + save(negative); // 添加一条 negative 数据 negativeDto.setId(negative.getId()); if (!negativeDto.getThingFiles().isEmpty()) { List files = negativeDto.getThingFiles().stream().map(item -> { @@ -199,7 +199,7 @@ public class NegativeService extends ServiceImpl { .setProblemSourcesCode(negative.getProblemSourcesCode()) .setUpdateTime(now) .setCreateTime(now); - workService.save(work); + workService.save(work); // 添加一条 negative_work 数据 工作状态 // 下发 FirstDistributeData firstDistributeData = new FirstDistributeData(); @@ -211,7 +211,7 @@ public class NegativeService extends ServiceImpl { .setWorkId(work.getId()) .setNextFlowKey(FlowNodeEnum.SECOND_SIGN.getKey()) .setData(firstDistributeData); - SpringUtil.getBean(FlowService.class).execute(actionDto); + SpringUtil.getBean(FlowService.class).execute(actionDto); // 创建一条历史数据 return true; } diff --git a/src/main/java/com/biutag/supervision/service/ProfilePoliceService.java b/src/main/java/com/biutag/supervision/service/ProfilePoliceService.java index 36b41b3..7f11f00 100644 --- a/src/main/java/com/biutag/supervision/service/ProfilePoliceService.java +++ b/src/main/java/com/biutag/supervision/service/ProfilePoliceService.java @@ -2,16 +2,14 @@ package com.biutag.supervision.service; import cn.hutool.core.util.NumberUtil; import com.biutag.supervision.constants.enums.BusinessTypeEnum; +import com.biutag.supervision.pojo.entity.BusinessPolice; import com.biutag.supervision.pojo.entity.NegativeScorePolice; +import com.biutag.supervision.pojo.entity.SupPolice; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -32,6 +30,10 @@ public class ProfilePoliceService { private final NegativeScorePoliceService negativeScorePoliceService; + private final BusinessPoliceService businessPoliceService; + + private final SupPoliceService policeService; + // 业务权重 = 单个业务风险指数 / 总业务风险指数之和 public double getBusinessWeight(Double totalScore, List businessScorePolice) { if (totalScore == 0) { @@ -58,8 +60,29 @@ public class ProfilePoliceService { return Math.sqrt(group.values().stream().mapToDouble(val -> Math.pow(val.size() - avgNumber, 2)).sum() / policeSize); } + // 业务差异值1 = (个人问题发生率 - 平均问题发生率) / 业务标准差 + // 平均问题发生率 = 总问题数 / 总业务量 + // 个人问题发生率 = 个人问题数 / 个人业务量 + public double getDiff1(List businessScorePolice, SupPolice police, Date beginTime, Date endTime, String businessTypeCode, double sd) { + if (sd == 0) { + return 0; + } + List businessPolices = businessPoliceService.list(beginTime, endTime, businessTypeCode); + // 总业务量 + int totalBusinessSize = businessPolices.stream().mapToInt(BusinessPolice::getNumber).sum(); + // 平均问题发生率 + double avgRate = totalBusinessSize == 0? 0: NumberUtil.div(businessScorePolice.size(), totalBusinessSize); + // 个人问题数 + long personSize = businessScorePolice.stream().filter(item -> police.getIdCode().equals(item.getIdCode())).count(); + // 个人业务量 + long personBusinessSize = businessPolices.stream().filter(item -> police.getName().equals(item.getPoliceName()) && police.getEmpNo().equals(item.getEmpNo())).count(); + // 个人问题发生率 + double personRate = personBusinessSize == 0? 0: NumberUtil.div(personSize, personBusinessSize); + return NumberUtil.div(personRate - avgRate, sd); + } + // 业务差异值2 = (问题数 - 平均问题数) / 业务标准差 - public double getDiff(List businessScorePolice, String idCode, double avgNumber, double sd) { + public double getDiff2(List businessScorePolice, String idCode, double avgNumber, double sd) { if (sd == 0) { return 0; } @@ -67,6 +90,7 @@ public class ProfilePoliceService { return NumberUtil.div(size - avgNumber, sd); } + public double getBusinessScore(double diff) { return 50 + (diff * 15); } @@ -79,9 +103,11 @@ public class ProfilePoliceService { // 业务风险指数 = 50 + (业务差异值 * 15) // 业务权重 = 单个业务风险指数 / 总业务风险指数之和 // 个人风险指数 = sum(业务风险指数 * 业务权重) - public BigDecimal getPoliceScore(Date beginTime, Date endTime, String idCode) { + public List getPoliceScore(Date beginTime, Date endTime, String idCode) { List scorePolices = negativeScorePoliceService.list(beginTime, endTime); Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum(); + SupPolice police = policeService.getByIdCode(idCode); + List expressionArr = new ArrayList<>(); double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { List businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); // 业务涉及人数 @@ -91,19 +117,22 @@ public class ProfilePoliceService { // 业务标准差 double sd = getSd(businessScorePolice, avgNumber, policeSize); // 业务差异值 - double diff = 0; + double diff; if (businessTypeEnum.getBusinessVolume()) { - + diff = getDiff1(businessScorePolice, police, beginTime, endTime, businessTypeEnum.getValue(), sd); } else { - diff = getDiff(businessScorePolice, idCode, avgNumber, sd); + diff = getDiff2(businessScorePolice, idCode, avgNumber, sd); } // 业务风险指数 double businessScore = getBusinessScore(diff); // 业务权重 double businessWeight = getBusinessWeight(totalScore, businessScorePolice); + expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight)); return NumberUtil.mul(businessScore, businessWeight); }).sum(); - return NumberUtil.roundHalfEven(policeScore, 2); + BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); + String expression = String.join(" + ", expressionArr); + return List.of(score, expression); } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index de0a18a..b2c2506 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -68,4 +68,5 @@ springdoc: - group: 'plugin' paths-to-match: - '/api/plugin/**' - - '/login' \ No newline at end of file + - '/login' + - '/**'