diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java index 543afab..a702b50 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java @@ -4,18 +4,25 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.NumberUtil; 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.extension.plugins.pagination.Page; +import com.biutag.supervision.common.UserContextHolder; +import com.biutag.supervision.constants.AppConstants; import com.biutag.supervision.constants.enums.InspectCaseEnum; import com.biutag.supervision.constants.enums.ProblemSourcesEnum; import com.biutag.supervision.constants.enums.ProcessingStatusEnum; +import com.biutag.supervision.constants.enums.RoleCodeEnum; import com.biutag.supervision.mapper.NegativeMapper; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.entity.NegativeBlame; import com.biutag.supervision.pojo.entity.News; import com.biutag.supervision.pojo.entity.SuperviseReport; +import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.vo.*; import com.biutag.supervision.service.NegativeBlameService; import com.biutag.supervision.service.NewsService; +import com.biutag.supervision.service.SupDepartService; import com.biutag.supervision.service.SuperviseReportService; import com.biutag.supervision.util.CompletableUtils.CompletableFutureUtil; import io.swagger.v3.oas.annotations.Operation; @@ -28,6 +35,7 @@ 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.concurrent.CompletableFuture; @@ -51,6 +59,7 @@ public class DataVSupervisionNotifyController { private final NewsService newsService; private final NegativeBlameService negativeBlameService; private final SuperviseReportService superviseReportService; + private final SupDepartService departService; // region 左边 @@ -69,13 +78,17 @@ public class DataVSupervisionNotifyController { endTime= DateUtil.endOfDay(endTime); DayTimeSuperviseVo fxsjRankOverview = negativeMapper.getSupervisionRank(beginTime, endTime, 3); DayTimeSuperviseVo jsdwRankOverview = negativeMapper.getSupervisionRank(beginTime, endTime, 4); + + DayTimeSuperviseVo overview = new DayTimeSuperviseVo().addVO(fxsjRankOverview,jsdwRankOverview); + List fxsjChangedRankList = negativeMapper.getChangedRateRank(beginTime, endTime, 3); List jsdwChangedRankList = negativeMapper.getChangedRateRank(beginTime, endTime, 4); JSONObject data = new JSONObject() .fluentPut("fxsjRankOverview", fxsjRankOverview) .fluentPut("jsdwRankOverview", jsdwRankOverview) .fluentPut("fxsjChangedRankList", fxsjChangedRankList) - .fluentPut("jsdwChangedRankList", jsdwChangedRankList); + .fluentPut("jsdwChangedRankList", jsdwChangedRankList) + .fluentPut("overview",overview); return Result.success(data); } @@ -123,6 +136,23 @@ public class DataVSupervisionNotifyController { overView.setProcessingNumber(negatives.size() - overView.getCompletedNumber()); // 办结率 overView.setCompletedRate(overView.getProblemNumber() == 0 ? 0: NumberUtil.roundHalfEven(NumberUtil.mul(NumberUtil.div(overView.getCompletedNumber(), overView.getProblemNumber()), 100), 0).doubleValue()); + + + + QueryWrapper queryWrapper = new QueryWrapper<>(); + UserAuth user = UserContextHolder.getCurrentUser(); + // 权限 + if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { + if (user.getAuthDepartIds().isEmpty() || user.getRoleCodes().isEmpty()) { + //特殊处理 + overView.setReportNumber(0L); + } + List orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); + queryWrapper.in("t.crt_depart_id", orgIds); + } + + overView.setReportNumber(superviseReportService.count(queryWrapper)); + CompletableFuture.allOf( CompletableFutureUtil.runSyncObject(() -> { long personNumber = negativeIds.isEmpty() ? 0 : negativeBlameService.count(new LambdaQueryWrapper().in(NegativeBlame::getNegativeId, negativeIds) @@ -200,7 +230,10 @@ public class DataVSupervisionNotifyController { DayTimeSuperviseVo bureauOverview = negativeMapper.getYellowBetOverview(beginTime, endTime, 4, dictValue); List bureauRankList = negativeMapper.getYellowBetRankList(beginTime, endTime, 4, dictValue); + DayTimeSuperviseVo overView = new DayTimeSuperviseVo().addVO(countyOverview,bureauOverview); + JSONObject data = new JSONObject() + .fluentPut("overView",overView) .fluentPut("countyOverview", countyOverview) .fluentPut("countyRankList", countyRankList) .fluentPut("bureauOverview", bureauOverview) diff --git a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java index ac2e6cd..d226af9 100644 --- a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java +++ b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneSupervisionNotifyController.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ArrayUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.biutag.supervision.constants.enums.InspectCaseEnum; import com.biutag.supervision.constants.enums.ProblemSourcesEnum; import com.biutag.supervision.constants.enums.ProcessingStatusEnum; @@ -12,10 +13,7 @@ import com.biutag.supervision.mapper.NegativeMapper; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.pojo.vo.*; -import com.biutag.supervision.service.NegativeBlameService; -import com.biutag.supervision.service.NewsService; -import com.biutag.supervision.service.SubOneSupervisionNotifyService; -import com.biutag.supervision.service.SuperviseReportService; +import com.biutag.supervision.service.*; import com.biutag.supervision.util.CompletableUtils.CompletableFutureUtil; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -55,6 +53,7 @@ public class SubOneSupervisionNotifyController { private final NegativeBlameService negativeBlameService; private final CountyStreetDeptMapper countyStreetDeptMapper; private final SuperviseReportService superviseReportService; + private final SupDepartService departService; // region 左边 /** @@ -74,7 +73,9 @@ public class SubOneSupervisionNotifyController { DayTimeSuperviseVo teamRankOverview = negativeMapper.getTeamRankOverview(departId, beginTime, endTime); List policeChangedRankList = negativeMapper.getPoliceChangedRankList(departId, beginTime, endTime); List teamChangedRankList = negativeMapper.getTeamChangedRankList(departId, beginTime, endTime); + DayTimeSuperviseVo overview = new DayTimeSuperviseVo().addVO(policeRankOverview,teamRankOverview); JSONObject data = new JSONObject() + .fluentPut("overview",overview) .fluentPut("fxsjRankOverview", policeRankOverview) .fluentPut("jsdwRankOverview", teamRankOverview) .fluentPut("fxsjChangedRankList", policeChangedRankList) @@ -139,6 +140,12 @@ public class SubOneSupervisionNotifyController { .between(SuperviseReport::getCrtTime,beginTime,endTime)); overView.setProblemQuarter(problemQuarter); + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + List orgIds = departService.getAllNodeIds(String.valueOf(departId)); + queryWrapper.in(SuperviseReport::getCrtDepartId, orgIds); + + overView.setReportNumber(superviseReportService.count(queryWrapper)); + // 办结率 // overView.setCompletedRate(overView.getProblemNumber() == 0 ? 0: NumberUtil.roundHalfEven(NumberUtil.mul(NumberUtil.div(overView.getCompletedNumber(), overView.getProblemNumber()), 100), 0).doubleValue()); @@ -262,15 +269,17 @@ public class SubOneSupervisionNotifyController { @GetMapping("/getSubOneYellowBetDrug") public Result getYellowBetDrug(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,@RequestParam Integer type) { // 黄赌毒总览 - DayTimeSuperviseVo fxsjYellowBetOverview = negativeMapper.getSubOnePoliceYellowBetOverview(beginTime, endTime, departId, 1); - DayTimeSuperviseVo jsdwYellowBetOverview = negativeMapper.getSubOneTeamYellowBetOverview(beginTime, endTime, departId, 1); + DayTimeSuperviseVo fxsjYellowBetOverview = negativeMapper.getSubOnePoliceYellowBetOverview(beginTime, endTime, departId, type); + DayTimeSuperviseVo jsdwYellowBetOverview = negativeMapper.getSubOneTeamYellowBetOverview(beginTime, endTime, departId, type); // 黄毒赌列表 - List fxsjYellowBetRankList = negativeMapper.getSubOnePoliceYellowBetRankList(beginTime, endTime, departId, 1); - List jsdwYellowBetRankList = negativeMapper.getSubOneTeamYellowBetRankList(beginTime, endTime, departId, 1); + List fxsjYellowBetRankList = negativeMapper.getSubOnePoliceYellowBetRankList(beginTime, endTime, departId, type); + List jsdwYellowBetRankList = negativeMapper.getSubOneTeamYellowBetRankList(beginTime, endTime, departId, type); + DayTimeSuperviseVo overview = new DayTimeSuperviseVo().addVO(fxsjYellowBetOverview,jsdwYellowBetOverview); JSONObject data = new JSONObject() + .fluentPut("overview",overview) .fluentPut("fxsjYellowBetOverview", fxsjYellowBetOverview) .fluentPut("jsdwYellowBetOverview", jsdwYellowBetOverview) .fluentPut("fxsjYellowBetRankList", fxsjYellowBetRankList) @@ -279,118 +288,6 @@ public class SubOneSupervisionNotifyController { } - /** - * 枪支管理数据 - * - * @param departId 部门id (分县市局ID) - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return JSONObject - */ - @Operation(summary = "枪支管理数据") - @GetMapping("/getSubOneGunController") - public Result getSubOneGunController(@RequestParam Integer departId, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - // 枪支管理总览 - DayTimeSuperviseVo fxsjGunControllerOverview = negativeMapper.getSubOnePoliceYellowBetOverview(beginTime, endTime, departId, 2); - DayTimeSuperviseVo jsdwGunControllerOverview = negativeMapper.getSubOneTeamYellowBetOverview(beginTime, endTime, departId, 2); - // 枪支管理列表 - List fxsjGunControllerRankList = negativeMapper.getSubOnePoliceYellowBetRankList(beginTime, endTime, departId, 2); - List jsdwGunControllerRankList = negativeMapper.getSubOneTeamYellowBetRankList(beginTime, endTime, departId, 2); - - JSONObject data = new JSONObject() - .fluentPut("fxsjGunControllerOverview", fxsjGunControllerOverview) - .fluentPut("jsdwGunControllerOverview", jsdwGunControllerOverview) - .fluentPut("fxsjGunControllerRankList", fxsjGunControllerRankList) - .fluentPut("jsdwGunControllerRankList", jsdwGunControllerRankList); - return Result.success(data); - } - - /** - * 涉企问题数据 - * - * @param departId 部门id (分县市局ID) - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return JSONObject - */ - @Operation(summary = "涉企问题数据") - @GetMapping("/getSubOneCompanyProblem") - public Result getSubOneCompanyProblem(@RequestParam Integer departId, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - // 涉企问题总览 - DayTimeSuperviseVo fxsjCompanyProblemOverview = negativeMapper.getSubOnePoliceYellowBetOverview(beginTime, endTime, departId, 3); - DayTimeSuperviseVo jsdwCompanyProblemOverview = negativeMapper.getSubOneTeamYellowBetOverview(beginTime, endTime, departId, 3); - // 涉企问题列表 - List fxsjCompanyProblemRankList = negativeMapper.getSubOnePoliceYellowBetRankList(beginTime, endTime, departId, 3); - List jsdwCompanyProblemRankList = negativeMapper.getSubOneTeamYellowBetRankList(beginTime, endTime, departId, 3); - - JSONObject data = new JSONObject() - .fluentPut("fxsjCompanyProblemOverview", fxsjCompanyProblemOverview) - .fluentPut("jsdwCompanyProblemOverview", jsdwCompanyProblemOverview) - .fluentPut("fxsjCompanyProblemRankList", fxsjCompanyProblemRankList) - .fluentPut("jsdwCompanyProblemRankList", jsdwCompanyProblemRankList); - return Result.success(data); - } - - /** - * 执法办案数据 - * - * @param departId 部门id (分县市局ID) - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return JSONObject - */ - @Operation(summary = "执法办案数据") - @GetMapping("/getSubOneHandleCase") - public Result getSubOneHandleCase(@RequestParam Integer departId, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - // 执法办案总览 - DayTimeSuperviseVo fxsjHandleCaseOverview = negativeMapper.getSubOnePoliceYellowBetOverview(beginTime, endTime, departId, 4); - DayTimeSuperviseVo jsdwHandleCaseOverview = negativeMapper.getSubOneTeamYellowBetOverview(beginTime, endTime, departId, 4); - // 执法办案列表 - List fxsjHandleCaseRankList = negativeMapper.getSubOnePoliceYellowBetRankList(beginTime, endTime, departId, 4); - List jsdwHandleCaseRankList = negativeMapper.getSubOneTeamYellowBetRankList(beginTime, endTime, departId, 4); - - JSONObject data = new JSONObject() - .fluentPut("fxsjHandleCaseOverview", fxsjHandleCaseOverview) - .fluentPut("jsdwHandleCaseOverview", jsdwHandleCaseOverview) - .fluentPut("fxsjHandleCaseRankList", fxsjHandleCaseRankList) - .fluentPut("jsdwHandleCaseRankList", jsdwHandleCaseRankList); - return Result.success(data); - } - - - /** - * 工作日测酒数据 - * - * @param departId 部门id (分县市局ID) - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return JSONObject - */ - @Operation(summary = "工作日测酒数据") - @GetMapping("/getSubOneCheckBeer") - public Result getSubOneCheckBeer(@RequestParam Integer departId, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - // 工作日测酒总览 - DayTimeSuperviseVo fxsjCheckBeerOverview = negativeMapper.getSubOnePoliceYellowBetOverview(beginTime, endTime, departId, 5); - DayTimeSuperviseVo jsdwCheckBeerOverview = negativeMapper.getSubOneTeamYellowBetOverview(beginTime, endTime, departId, 5); - // 工作日测酒列表 - List fxsjCheckBeerRankList = negativeMapper.getSubOnePoliceYellowBetRankList(beginTime, endTime, departId, 5); - List jsdwCheckBeerRankList = negativeMapper.getSubOneTeamYellowBetRankList(beginTime, endTime, departId, 5); - - JSONObject data = new JSONObject() - .fluentPut("fxsjCheckBeerOverview", fxsjCheckBeerOverview) - .fluentPut("jsdwCheckBeerOverview", jsdwCheckBeerOverview) - .fluentPut("fxsjCheckBeerRankList", fxsjCheckBeerRankList) - .fluentPut("jsdwCheckBeerRankList", jsdwCheckBeerRankList); - return Result.success(data); - } /** * 督察工作动态 diff --git a/src/main/java/com/biutag/supervision/controller/supervise/SuperviseReportController.java b/src/main/java/com/biutag/supervision/controller/supervise/SuperviseReportController.java index 32414cc..d24c4e6 100644 --- a/src/main/java/com/biutag/supervision/controller/supervise/SuperviseReportController.java +++ b/src/main/java/com/biutag/supervision/controller/supervise/SuperviseReportController.java @@ -36,6 +36,11 @@ public class SuperviseReportController { Result> queryPage(SuperviseReportQueryParam queryParam){ return Result.success(service.page(queryParam)); } + + @GetMapping("subQueryPage") + Result> subQueryPage(SuperviseReportQueryParam queryParam){ + return Result.success(service.page(queryParam)); + } /** * 根据报告获取问题列表 * */ diff --git a/src/main/java/com/biutag/supervision/pojo/param/SuperviseReportQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/SuperviseReportQueryParam.java index 993b482..ba841eb 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/SuperviseReportQueryParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/SuperviseReportQueryParam.java @@ -12,4 +12,6 @@ public class SuperviseReportQueryParam extends BasePage{ private String crtUser; private String id; + + private String deptId; } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/DayTimeSuperviseVo.java b/src/main/java/com/biutag/supervision/pojo/vo/DayTimeSuperviseVo.java index 7333f63..499b89e 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/DayTimeSuperviseVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/DayTimeSuperviseVo.java @@ -1,9 +1,13 @@ package com.biutag.supervision.pojo.vo; +import cn.hutool.core.util.NumberUtil; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import java.math.BigDecimal; +import java.math.RoundingMode; + /** * @Auther: sh * @Date: 2024/11/28 10:32 @@ -23,6 +27,48 @@ public class DayTimeSuperviseVo { private Long changed; - private Long correctionRate; + private Double correctionRate; + + public DayTimeSuperviseVo addVO(DayTimeSuperviseVo one,DayTimeSuperviseVo two){ + DayTimeSuperviseVo vo =new DayTimeSuperviseVo(); + //问题总数 + vo.setProTotal(one.getProTotal() + two.proTotal); + //办理中 + vo.setProcessingNumber(isZero(one.getProcessingNumber()) + isZero(two.getProcessingNumber())); + //已办结 + vo.setCompletedNumber(isZero(one.getCompletedNumber() )+ isZero(two.getCompletedNumber())); + //区县大屏 办理中 + vo.setChanging(isZero(one.getChanging()) + isZero(one.getChanging())); + //区县大屏 已办结 + vo.setChanged(isZero(one.getChanged() ) + isZero(one.getChanged() )); + + //区县大屏 整改率 + if(vo.getProTotal() == null || vo.getProTotal() == 0 || vo.getChanged() == 0){ + vo.setCorrectionRate(0.0); + }else{ + BigDecimal result = new BigDecimal(vo.getChanged() * 100) + .divide(new BigDecimal(vo.getProTotal()), 1, RoundingMode.HALF_UP); + vo.setCorrectionRate(result.doubleValue()); + } + + + //办结率 + if(vo.getProTotal() == null || vo.getProTotal() == 0 || vo.getCompletedNumber() == 0){ + vo.setCompletedRate(0.0); + }else{ + BigDecimal result = new BigDecimal(vo.getCompletedNumber() * 100) + .divide(new BigDecimal(vo.getProTotal()), 1, RoundingMode.HALF_UP); + vo.setCompletedRate(result.doubleValue()); + } + + + return vo; + } + + public Long isZero(Long val){ + return val != null?val:0L; + } + + } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/SupervisionNotifyOverView.java b/src/main/java/com/biutag/supervision/pojo/vo/SupervisionNotifyOverView.java index 711e719..ca5e8c0 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/SupervisionNotifyOverView.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/SupervisionNotifyOverView.java @@ -23,5 +23,7 @@ public class SupervisionNotifyOverView { private Long personNumber; // 办结率 private Double completedRate; + // 通报数 + private Long reportNumber; } diff --git a/src/main/java/com/biutag/supervision/service/SuperviseReportService.java b/src/main/java/com/biutag/supervision/service/SuperviseReportService.java index 2f4bc55..615ef2c 100644 --- a/src/main/java/com/biutag/supervision/service/SuperviseReportService.java +++ b/src/main/java/com/biutag/supervision/service/SuperviseReportService.java @@ -50,6 +50,11 @@ public class SuperviseReportService extends ServiceImpl orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); queryWrapper.in("t.crt_depart_id", orgIds); } + + if(StrUtil.isNotBlank(queryParam.getDeptId())){ + List orgIds = departService.getAllNodeIds(queryParam.getDeptId()); + queryWrapper.in("t.crt_depart_id", orgIds); + } //查询条件 queryWrapper.like(StrUtil.isNotEmpty(queryParam.getReportName()),"t.report_name",queryParam.getReportName()) .like(StrUtil.isNotEmpty(queryParam.getCrtUser()),"t.crt_user",queryParam.getCrtUser())