31 changed files with 891 additions and 62 deletions
@ -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<JSONObject> getAllGobalCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { |
||||
// 获取数据大屏中央总数概览
|
||||
JSONObject overview = dataGobalService.getAllGobalCount(beginTime, endTime); |
||||
|
||||
// 获取数据大屏各机构问题排名
|
||||
List<OrganizeProblemRankVo> fxsjlist = dataGobalService.getOrganizeProblemRank(3, beginTime, endTime); |
||||
List<OrganizeProblemRankVo> jsdwlist = dataGobalService.getOrganizeProblemRank(4, beginTime, endTime); |
||||
|
||||
// 业务类型占比
|
||||
List<EchartsVo> ywzblist = dataGobalService.getBusinessRate(beginTime, endTime); |
||||
|
||||
// 问题类型占比
|
||||
List<EchartsVo> 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<JSONObject> getOrganizeProblemRank( |
||||
@PathVariable Integer groupType, |
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { |
||||
|
||||
List<OrganizeProblemRankVo> fxsjlist = dataGobalService.getOrganizeProblemRank(groupType, beginTime, endTime); |
||||
List<OrganizeProblemRankVo> jsdwlist = dataGobalService.getOrganizeProblemRank(groupType, beginTime, endTime); |
||||
JSONObject data = new JSONObject() |
||||
.fluentPut("fxsjlist", fxsjlist) |
||||
.fluentPut("jsdwlist", jsdwlist); |
||||
return Result.success(data); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 数据大屏问题趋势统计(按月) |
||||
* @param year |
||||
* @return |
||||
*/ |
||||
@Operation(summary = "数据大屏问题趋势统计(按月)") |
||||
@GetMapping("/getGobalRecentlyTrendByMonth") |
||||
public Result<JSONObject> getGobalRecentlyTrendByMonth(@RequestParam Integer year) { |
||||
|
||||
List<RecentTrendByMonthVo> recentTrendVoList = dataGobalService.getGobalRecentlyTrendByMonth(String.valueOf(year)); |
||||
ArrayList<String> monthList = new ArrayList<>(); |
||||
ArrayList<String> 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<String> 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); |
||||
} |
||||
|
||||
} |
||||
@ -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<JSONObject> 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<JSONObject> getChangedRank(@RequestParam Integer groupType, |
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ |
||||
List<RankVo> changedRank = dataSupervisionNotifyService.getChangedRank(groupType, beginTime, endTime); |
||||
JSONObject data = new JSONObject().fluentPut("changedRank", changedRank); |
||||
return Result.success(data); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
@ -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<DataSupervisionNotify> { |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
@ -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; |
||||
} |
||||
@ -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; |
||||
} |
||||
|
||||
@ -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; // 问题数
|
||||
} |
||||
|
||||
@ -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; // 分母 问题数
|
||||
} |
||||
|
||||
@ -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
|
||||
} |
||||
|
||||
@ -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<Negative> 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<OrganizeProblemRankVo> getOrganizeProblemRank(Integer groupType, Date beginTime, Date endTime) { |
||||
List<OrganizeProblemRankVo> res = negativeMapper.selectOrganizeProblemRank(groupType, beginTime, endTime); |
||||
return res; |
||||
} |
||||
|
||||
public List<EchartsVo> getBusinessRate(Date beginTime,Date endTime) { |
||||
List<EchartsVo> res= negativeMapper.selectBusinessRate(beginTime, endTime); |
||||
return res; |
||||
} |
||||
|
||||
public List<RecentTrendByMonthVo> getGobalRecentlyTrendByMonth(String year) { |
||||
List<RecentTrendByMonthVo> trendByMonthVoList = negativeMapper.selectRecentTrendByMonth(year); |
||||
return trendByMonthVoList; |
||||
} |
||||
|
||||
/** |
||||
* 获取问题类型占比 |
||||
* @param beginTime |
||||
* @param endTime |
||||
* @return |
||||
*/ |
||||
public List<EchartsVo> 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<EchartsVo> wtlxList = negativeProblemRelationMapper.selectProblemRate(beginTime, endTime); |
||||
return wtlxList; |
||||
} |
||||
} |
||||
@ -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<Map<String, Object>> mapData() {
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
@ -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<DataSupervisionNotifyMapper, DataSupervisionNotify> { |
||||
|
||||
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<Negative> negativeQueryWrapper = new QueryWrapper<>(); |
||||
negativeQueryWrapper.between("crtTime", beginTime, endTime); |
||||
negativeQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); |
||||
Long supervisionNotifyTotal = negativeMapper.selectCount(negativeQueryWrapper); // 通报问题数
|
||||
/* QueryWrapper<Negative> changingQueryWrapper = new QueryWrapper<>(); |
||||
changingQueryWrapper.between("crtTime", beginTime, endTime); |
||||
changingQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); |
||||
changingQueryWrapper.eq("isRectifyCode", 1); |
||||
Long supervisionNotifyChangingTotal = negativeMapper.selectCount(changingQueryWrapper); */ // 整改中问题数
|
||||
QueryWrapper<Negative> changedQueryWrapper = new QueryWrapper<>(); |
||||
changedQueryWrapper.between("crtTime", beginTime, endTime); |
||||
changedQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); |
||||
changedQueryWrapper.eq("isRectifyCode", 1); |
||||
Long supervisionNotifyChangedTotal = negativeMapper.selectCount(changedQueryWrapper); // 已整改问题数
|
||||
QueryWrapper<Negative> 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<Negative> preQueryWrapper = new QueryWrapper<>(); |
||||
preQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); |
||||
ArrayList<Negative> negatives = (ArrayList<Negative>) negativeMapper.selectList(preQueryWrapper); |
||||
Long supervisionNotifyPreTotal = 0L; |
||||
for (Negative negative : negatives) { |
||||
String id = negative.getId(); |
||||
QueryWrapper<NegativeBlame> 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<RankVo> getChangedRank(Integer groupType, Date beginTime, Date endTime) { |
||||
// List<RankVo> changedList = negativeMapper.rank(groupType, beginTime, endTime);
|
||||
// 计算整改率
|
||||
// return changedList;
|
||||
return null; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
private JSONObject getJsonObject(Date beginTime, Date endTime) { |
||||
// 通报问题数
|
||||
QueryWrapper<DataSupervisionNotify> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.between("dis_date", beginTime, endTime); |
||||
queryWrapper.select("distinct tb_name"); |
||||
Long supervisionNotifyTotal = dataSupervisionNotifyMapper.selectCount(queryWrapper); |
||||
// 涉及单位数
|
||||
QueryWrapper<DataSupervisionNotify> orgQueryWrapper = new QueryWrapper<>(); |
||||
orgQueryWrapper.between("dis_date", beginTime, endTime); |
||||
orgQueryWrapper.select("distinct th_org_name"); |
||||
Long supervisionNotifyOrgTotal = dataSupervisionNotifyMapper.selectCount(orgQueryWrapper); |
||||
// 涉及人数
|
||||
QueryWrapper<DataSupervisionNotify> preQueryWrapper = new QueryWrapper<>(); |
||||
preQueryWrapper.between("dis_date", beginTime, endTime); |
||||
preQueryWrapper.select("distinct pro_person_name"); |
||||
Long supervisionNotifyPreTotal = dataSupervisionNotifyMapper.selectCount(preQueryWrapper); |
||||
// 整改中
|
||||
QueryWrapper<DataSupervisionNotify> changingQueryWrapper = new QueryWrapper<>(); |
||||
changingQueryWrapper.between("dis_date", beginTime, endTime); |
||||
changingQueryWrapper.isNull("rep_content"); |
||||
Long supervisionNotifyChangingTotal = dataSupervisionNotifyMapper.selectCount(changingQueryWrapper); |
||||
// 已整改
|
||||
QueryWrapper<DataSupervisionNotify> 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; |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in new issue