kami 1 year ago
parent
commit
1400d502e7
  1. 36
      src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java
  2. 36
      src/main/java/com/biutag/supervision/mapper/NegativeMapper.java
  3. 19
      src/main/java/com/biutag/supervision/pojo/vo/RankVoSup.java
  4. 21
      src/main/java/com/biutag/supervision/pojo/vo/RankVoSupTwo.java
  5. 1
      src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java
  6. 137
      src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java

36
src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java

@ -2,10 +2,7 @@ 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.GobalMapIconVo;
import com.biutag.supervision.pojo.vo.RankVo;
import com.biutag.supervision.pojo.vo.SuperviseMapIconVo;
import com.biutag.supervision.pojo.vo.*;
import com.biutag.supervision.service.DataSupervisionNotifyServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -21,6 +18,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @Auther: sh
@ -53,8 +51,17 @@ public class SupervisionNotifyController {
//地图数据
List<SuperviseMapIconVo> superviseTempMapVoList = dataSupervisionNotifyService.getsupervisionMapIconInfo(beginTime, endTime);
// 黄赌毒总览
List<RankVo> hddzlList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime);
// 黄毒赌列表
List<RankVo> hddList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime);
JSONObject data = new JSONObject().fluentPut("wtlxList", wtlxList)
.fluentPut("overview", overview);
.fluentPut("overview", overview)
.fluentPut("superviseTempMapVoList", superviseTempMapVoList)
.fluentPut("hddList", hddList);
return Result.success(data);
}
@ -70,8 +77,23 @@ public class SupervisionNotifyController {
public Result<JSONObject> getChangedRank(@RequestParam Integer groupType,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
JSONObject rankOverview = dataSupervisionNotifyService.getDailySupervisionCount(groupType, beginTime, endTime);
List<RankVo> changedRankList = dataSupervisionNotifyService.getChangedRateRank(groupType, beginTime, endTime);
RankVoSup temp = dataSupervisionNotifyService.getSuperversionRank( beginTime, endTime);
JSONObject rankOverview=new JSONObject();
if ( temp != null) {
rankOverview
.fluentPut("proTotal", temp.getProblem_number())
.fluentPut("changing", temp.getRectifing_number())
.fluentPut("changed", temp.getRectifed_number())
.fluentPut("correctionRate", temp.getRectify_rate());
}else {
rankOverview
.fluentPut("proTotal",0)
.fluentPut("changing", 0)
.fluentPut("changed", 0)
.fluentPut("correctionRate", 0);
}
List<RankVo> changedRankList = dataSupervisionNotifyService.getChangedRateRank(groupType, beginTime, endTime);
JSONObject data = new JSONObject()
.fluentPut("rankOverview", rankOverview)
.fluentPut("changedRankList", changedRankList);

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

@ -3,10 +3,7 @@ package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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 com.biutag.supervision.pojo.vo.*;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
@ -240,6 +237,37 @@ public interface NegativeMapper extends BaseMapper<Negative> {
@Select("")
Long getRelationOrgCountByDepartId(String departId);
@Select("SELECT a.departId, a.name, COUNT(DISTINCT c.id) AS totalPro, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS changing, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS changed, COUNT(DISTINCT c.involveDepartId) AS relationOrg, COUNT(DISTINCT d.blameIdCode) AS personNum, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS changedRate\n" +
"FROM statistics_depart a INNER JOIN sup_depart b ON a.departId = b.pid " +
" INNER JOIN negative c ON b.id = c.involveDepartId " +
" LEFT JOIN negative_blame d ON c.id = d.negativeId " +
"WHERE a.groupId = 3 AND discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND problemSourcesCode IN (13, 15) " +
"GROUP BY a.name, a.departId")
List<SuperviseMapIconVo> getMap(Date beginTime, Date endTime);
@Select("SELECT a.name, COUNT(DISTINCT c.id) AS problem_number, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate\n" +
"FROM statistics_depart a INNER JOIN sup_depart b ON a.departId = b.pid " +
" INNER JOIN negative c ON b.id = c.involveDepartId " +
" LEFT JOIN negative_blame d ON c.id = d.negativeId " +
"WHERE a.groupId = 3 AND discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND special_supervision = 1\n" +
"GROUP BY a.name")
List<RankVoSupTwo> getYellowBet(Date beginTime, Date endTime);
@Select("SELECT COUNT(DISTINCT c.id) AS problem_number, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate\n" +
"FROM sup_depart b INNER JOIN negative c ON b.id = c.involveDepartId " +
" LEFT JOIN negative_blame d ON c.id = d.negativeId " +
"WHERE discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND problemSourcesCode = 13 ")
RankVoSup getSuperversionRank(Date beginTime, Date endTime);
@Select("SELECT a.name, COUNT(DISTINCT c.id) AS problem_number, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate\n" +
"FROM statistics_depart a INNER JOIN sup_depart b ON a.departId = b.pid \n" +
" INNER JOIN negative c ON b.id = c.involveDepartId \n" +
" LEFT JOIN negative_blame d ON c.id = d.negativeId\n" +
"WHERE a.groupId = 3 AND discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND problemSourcesCode = 13\n" +
"GROUP BY a.name")
List<RankVoSupTwo> getChangedRateRank(Date beginTime, Date endTime);
// endregion

19
src/main/java/com/biutag/supervision/pojo/vo/RankVoSup.java

@ -0,0 +1,19 @@
package com.biutag.supervision.pojo.vo;
import lombok.Data;
/**
* @Auther: sh
* @Date: 2024/11/17 01:35
* @Description:
*/
@Data
public class RankVoSup {
private String problem_number; // 问题数
private String rectifing_number; // 整改中
private String rectifed_number; // 已整改
private String depart_number; // 部门数
private String person_number; // 人员数
private String rectify_rate; // 整改率
}

21
src/main/java/com/biutag/supervision/pojo/vo/RankVoSupTwo.java

@ -0,0 +1,21 @@
package com.biutag.supervision.pojo.vo;
import lombok.Data;
/**
* @Auther: sh
* @Date: 2024/11/17 01:35
* @Description:
*/
@Data
public class RankVoSupTwo {
private String name; // 名字
private String problem_number; // 问题数
private String rectifing_number; // 整改中
private String rectifed_number; // 已整改
private String depart_number; //
private String person_number; // 人数
private String rectify_rate; // 整改率
}

1
src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java

@ -15,6 +15,7 @@ public class SuperviseMapIconVo {
private String changed;
private String relationOrg;
private String changedRate;
private String personNum;
private String departId;
}

137
src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java

@ -16,11 +16,9 @@ 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.entity.SupDepart;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.GobalMapIconVo;
import com.biutag.supervision.pojo.vo.RankVo;
import com.biutag.supervision.pojo.vo.SuperviseMapIconVo;
import com.biutag.supervision.pojo.vo.*;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.formula.functions.Intercept;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -62,6 +60,7 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
// 涉及单位数
Long supervisionNotifyOrgTotal = negativeMapper.selectRelationOrgCount(beginTime, endTime, "1");
/**
* 涉及人数
* 1查出在 negative中的id集合
@ -80,7 +79,7 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
supervisionNotifyPreTotal += negativeBlameMapper.selectCount(totalWrapper);
}
// 整改率
double correctionRate = supervisionNotifyTotal != 0 ? (supervisionNotifyChangedTotal * 1.0 / supervisionNotifyTotal) * 100 : 0;
Integer correctionRate = supervisionNotifyTotal != 0 ? (int) ((supervisionNotifyChangedTotal * 1.0 / supervisionNotifyTotal) * 100) : 0;
JSONObject jsonObject = new JSONObject();
jsonObject.fluentPut("supervisionNotifyTotal", supervisionNotifyTotal)
.fluentPut("supervisionNotifyOrgTotal", supervisionNotifyOrgTotal)
@ -123,40 +122,22 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
* @return
*/
public List<RankVo> getChangedRateRank(Integer groupType, Date beginTime, Date endTime) {
List<RankVo> rankVoRes = new ArrayList<>();
// 所有分局部门
List<SupDepart> departs = supDepartMapper.selectDepartsByGroupType(groupType);
for (SupDepart depart : departs) {
List<RankVoSupTwo> rankVoRes = negativeMapper.getChangedRateRank(beginTime, endTime);
List<RankVo> res = new ArrayList<>();
for (RankVoSupTwo one : rankVoRes) {
RankVo rankVo = new RankVo();
rankVo.setLabel(depart.getShortName());
rankVo.setDepartId(depart.getId());
rankVoRes.add(rankVo);
}
for (RankVo rankVoRe : rankVoRes) {
String departId = rankVoRe.getDepartId();
Long changed = negativeMapper.getChangedCountByGroupType(beginTime, endTime, departId);
Long totalPro = negativeMapper.getCountByGroupType(beginTime, endTime, departId);
totalPro = totalPro == null ? 0L : totalPro;
changed = changed == null ? 0L : changed;
rankVoRe.setDenominator(totalPro.toString());
rankVoRe.setNumerator(changed.toString());
Double rate = totalPro != 0 ? (changed * 1.0 / totalPro) * 100 : 0;
int intRate = (int) Math.ceil(rate);
rankVoRe.setRate((double) intRate);
rankVoRe.setDenominator(totalPro.toString());
rankVoRe.setNumerator(changed.toString());
rankVoRe.setRate(rate);
rankVoRe.setValue(rate);
rankVo.setLabel(one.getName());
rankVo.setValue(Double.parseDouble(one.getRectify_rate()));
rankVo.setRate(Double.parseDouble(one.getRectify_rate()));
rankVo.setNumerator(one.getRectifed_number());
rankVo.setDenominator(one.getRectifed_number());
res.add(rankVo);
}
// 使用 Stream API 进行排序
rankVoRes = rankVoRes.stream().sorted((o1, o2) -> o2.getRate().compareTo(o1.getRate())).collect(Collectors.toList());
// 排序
return rankVoRes;
return res;
}
public List<EchartsVo> getProblemTypeRatio(Date beginTime, Date endTime) {
List<EchartsVo> echartsVos = new ArrayList<>();
echartsVos = negativeMapper.getProblemTypes(beginTime, endTime);
List<EchartsVo> echartsVos = negativeMapper.getProblemTypes(beginTime, endTime);
return echartsVos;
}
@ -166,7 +147,6 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
return echartsVos;
}
/**
* 包括现场督察和专项
*
@ -175,51 +155,58 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
* @return
*/
public List<SuperviseMapIconVo> getsupervisionMapIconInfo(Date beginTime, Date endTime) {
List<SuperviseMapIconVo> res = new ArrayList<>();
List<SupDepart> supDeparts = supDepartMapper.selectDepartsByGroupType(3);
for (SupDepart supDepart : supDeparts) {
SuperviseMapIconVo SuperviseMapIconVo = new SuperviseMapIconVo();
SuperviseMapIconVo.setName(supDepart.getShortName());
SuperviseMapIconVo.setDepartId(supDepart.getId());
res.add(SuperviseMapIconVo);
}
for (SuperviseMapIconVo re : res) {
String departId = re.getDepartId();
Long changed = negativeMapper.getNotifyChanged(beginTime, endTime, departId);
Long changing = negativeMapper.getNotifyChanging(beginTime, endTime, departId);
Long totalPro = changed + changing;
Long relationOrg = negativeMapper.getRelationOrgCountByDepartId(departId);
QueryWrapper<Negative> preQueryWrapper = new QueryWrapper<>();
preQueryWrapper.in("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue(), ProblemSourcesEnum.ZXDC.getValue());
List<Negative> negatives = 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);
}
List<SuperviseMapIconVo> res = negativeMapper.getMap(beginTime, endTime);
return res;
}
public List<RankVo> getYellowBet(Date beginTime, Date endTime) {
List<RankVoSupTwo> res = negativeMapper.getYellowBet(beginTime, endTime);
List<RankVo> resv = new ArrayList<>();
for (RankVoSupTwo re : res) {
RankVo rankVo = new RankVo();
rankVo.setLabel(re.getName());
rankVo.setValue(Double.parseDouble(re.getProblem_number()));
resv.add(rankVo);
}
return null;
return resv;
}
/**
* 涉及人数
* 1查出在 negative中的id集合
* 2查出集合在blame中的涉及人数
*/
/*QueryWrapper<Negative> preQueryWrapper = new QueryWrapper<>();
preQueryWrapper.in("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue(), ProblemSourcesEnum.ZXDC.getValue());
public RankVoSup getSuperversionRank(Date beginTime, Date endTime) {
RankVoSup res = negativeMapper.getSuperversionRank(beginTime, endTime);
if (res == null) {
res=new RankVoSup();
res.setRectify_rate("0");
res.setProblem_number("0");
res.setRectifing_number("0");
res.setDepart_number("0");
res.setPerson_number("0");
res.setRectifed_number("0");
}else {
if (res.getProblem_number() == null) {
res.setRectifed_number("0");
}
if (res.getRectifing_number() == null) {
res.setRectifing_number("0");
}
if (res.getDepart_number() == null) {
res.setDepart_number("0");
}
if (res.getRectify_rate() == null) {
res.setRectify_rate("0");
}
if (res.getRectifed_number() == null) {
res.setRectifed_number("0");
List<Negative> negatives = 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);
}*/
}
if (res.getProblem_number() == null) {
res.setProblem_number("0");
}
}
return res;
}
}

Loading…
Cancel
Save