Browse Source

现场督察大屏2024/11/17 2:46 现场督察大屏后端

main
parent
commit
1071b760a7
  1. 25
      src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java
  2. 17
      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. 92
      src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java

25
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;
@ -56,8 +53,7 @@ public class SupervisionNotifyController {
// 黄赌毒总览
List<Map<String, String>> hddzlList = new ArrayList<>();
List<RankVo> hddzlList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime);
// 黄毒赌列表
List<RankVo> hddList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime);
@ -81,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);
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);

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

@ -251,7 +251,22 @@ public interface NegativeMapper extends BaseMapper<Negative> {
" 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<RankVo> getYellowBet(Date beginTime, Date endTime);
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; // 整改率
}

92
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;
@ -81,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)
@ -124,35 +122,18 @@ 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);
}
// 使用 Stream API 进行排序
rankVoRes = rankVoRes.stream().sorted((o1, o2) -> o2.getRate().compareTo(o1.getRate())).collect(Collectors.toList());
// 排序
return rankVoRes;
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);
}
return res;
}
public List<EchartsVo> getProblemTypeRatio(Date beginTime, Date endTime) {
@ -179,12 +160,53 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
}
public List<RankVo> getYellowBet(Date beginTime, Date endTime) {
List<RankVo> res = negativeMapper.getYellowBet(beginTime, endTime);
return res;
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 resv;
}
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");
}
if (res.getProblem_number() == null) {
res.setProblem_number("0");
}
}
return res;
}
}

Loading…
Cancel
Save