|
|
|
|
@ -4,15 +4,18 @@ 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.InspectCaseEnum; |
|
|
|
|
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.mapper.SupDepartMapper; |
|
|
|
|
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.entity.SupDepart; |
|
|
|
|
import com.biutag.supervision.pojo.vo.RankVo; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -37,33 +40,29 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
|
|
|
|
|
|
|
|
|
|
private final NegativeBlameService blameService; |
|
|
|
|
|
|
|
|
|
private final SupDepartMapper supDepartMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取所有现场督察的数量 |
|
|
|
|
* 现场督察代码: 13 |
|
|
|
|
* 获取所有 现场督察+专项督察 的数量 |
|
|
|
|
* 现场督察代码: 13 专项督察代码: 15 |
|
|
|
|
* |
|
|
|
|
* @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); // 涉及单位数
|
|
|
|
|
|
|
|
|
|
// 通报问题数
|
|
|
|
|
Long supervisionNotifyTotal = negativeMapper.selectSupervisionNotifyCount(beginTime, endTime, InspectCaseEnum.TRUE.getValue()); |
|
|
|
|
|
|
|
|
|
// 整改中
|
|
|
|
|
Long supervisionNotifyChangingTotal = negativeMapper.selectChangSupervisionNotifyCount(beginTime, endTime, InspectCaseEnum.TRUE.getValue(), "0"); |
|
|
|
|
|
|
|
|
|
// 已整改
|
|
|
|
|
Long supervisionNotifyChangedTotal = negativeMapper.selectChangSupervisionNotifyCount(beginTime, endTime, InspectCaseEnum.TRUE.getValue(), "1"); |
|
|
|
|
|
|
|
|
|
// 涉及单位数
|
|
|
|
|
Long supervisionNotifyOrgTotal = negativeMapper.selectRelationOrgCount(beginTime, endTime, "1"); |
|
|
|
|
/** |
|
|
|
|
* 涉及人数 |
|
|
|
|
* 1、查出在 negative中的id集合 |
|
|
|
|
@ -71,7 +70,8 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
|
|
|
|
|
*/ |
|
|
|
|
QueryWrapper<Negative> preQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
preQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); |
|
|
|
|
ArrayList<Negative> negatives = (ArrayList<Negative>) negativeMapper.selectList(preQueryWrapper); |
|
|
|
|
|
|
|
|
|
List<Negative> negatives = negativeMapper.selectList(preQueryWrapper); |
|
|
|
|
Long supervisionNotifyPreTotal = 0L; |
|
|
|
|
for (Negative negative : negatives) { |
|
|
|
|
String id = negative.getId(); |
|
|
|
|
@ -79,68 +79,60 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
|
|
|
|
|
totalWrapper.eq("negativeId", id); |
|
|
|
|
supervisionNotifyPreTotal += negativeBlameMapper.selectCount(totalWrapper); |
|
|
|
|
} |
|
|
|
|
double correctionRate = supervisionNotifyTotal != 0 ? (supervisionNotifyChangedTotal * 1.0 / supervisionNotifyTotal) * 100 : 0; // 整改率
|
|
|
|
|
// 整改率
|
|
|
|
|
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("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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取日常督察数量概览 |
|
|
|
|
* |
|
|
|
|
* @param groupType |
|
|
|
|
* @param beginTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public JSONObject getDailySupervisionCount(Integer groupType, Date beginTime, Date endTime) { |
|
|
|
|
|
|
|
|
|
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 proTotal = negativeMapper.getCountByGroupType(groupType, beginTime, endTime); |
|
|
|
|
Long changing = negativeMapper.getChangCountByGroupType(groupType, beginTime, endTime, 0); |
|
|
|
|
Long changed = negativeMapper.getChangCountByGroupType(groupType, beginTime, endTime, 1); |
|
|
|
|
// 整改率
|
|
|
|
|
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) |
|
|
|
|
double correctionRate = proTotal != 0 ? (changed * 1.0 / proTotal) * 100 : 0; |
|
|
|
|
JSONObject res = new JSONObject() |
|
|
|
|
.fluentPut("proTotal", proTotal) |
|
|
|
|
.fluentPut("changing", changing) |
|
|
|
|
.fluentPut("changed", changed) |
|
|
|
|
.fluentPut("correctionRate", correctionRate); |
|
|
|
|
return jsonObject; |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取日常督察整改率排名 |
|
|
|
|
* |
|
|
|
|
* @param groupType |
|
|
|
|
* @param beginTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public List<RankVo> getChangedRateRank(Integer groupType, Date beginTime, Date endTime) { |
|
|
|
|
List<RankVo> rankVos = new ArrayList<>(); |
|
|
|
|
List<SupDepart> departs = supDepartMapper.selectDepartsByGroupType(groupType); |
|
|
|
|
// negativeMapper.select
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|