|
|
|
@ -11,18 +11,18 @@ import com.biutag.supervision.pojo.dto.report.base.ReportBaseQueryResponseDTO; |
|
|
|
import com.biutag.supervision.pojo.dto.report.businessLine.*; |
|
|
|
import com.biutag.supervision.pojo.dto.report.businessLine.*; |
|
|
|
import com.biutag.supervision.pojo.dto.report.closed.ClosedStatsCalcRequestDTO; |
|
|
|
import com.biutag.supervision.pojo.dto.report.closed.ClosedStatsCalcRequestDTO; |
|
|
|
import com.biutag.supervision.pojo.dto.report.closed.ClosedStatsCalcResponseDTO; |
|
|
|
import com.biutag.supervision.pojo.dto.report.closed.ClosedStatsCalcResponseDTO; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.dto.report.problemType.ReportProblemTypeStatsRequestDTO; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.dto.report.problemType.ReportProblemTypeStatsResponseDTO; |
|
|
|
import com.biutag.supervision.pojo.entity.NegativeBlame; |
|
|
|
import com.biutag.supervision.pojo.entity.NegativeBlame; |
|
|
|
import com.biutag.supervision.pojo.entity.NegativeProblemRelation; |
|
|
|
import com.biutag.supervision.pojo.entity.NegativeProblemRelation; |
|
|
|
import com.biutag.supervision.pojo.param.NegativeQueryParam; |
|
|
|
import com.biutag.supervision.pojo.param.NegativeQueryParam; |
|
|
|
import com.biutag.supervision.pojo.vo.DictProblemSourceTree; |
|
|
|
import com.biutag.supervision.pojo.vo.DictProblemSourceTree; |
|
|
|
import com.biutag.supervision.pojo.vo.NegativeQueryVo; |
|
|
|
import com.biutag.supervision.pojo.vo.NegativeQueryVo; |
|
|
|
|
|
|
|
import com.biutag.supervision.repository.supdepart.SupDepartResourceService; |
|
|
|
import com.biutag.supervision.service.NegativeProblemRelationService; |
|
|
|
import com.biutag.supervision.service.NegativeProblemRelationService; |
|
|
|
import com.biutag.supervision.service.NegativeQueryService; |
|
|
|
import com.biutag.supervision.service.NegativeQueryService; |
|
|
|
import com.biutag.supervision.service.SupDictProblemSourceService; |
|
|
|
import com.biutag.supervision.service.SupDictProblemSourceService; |
|
|
|
import com.biutag.supervision.service.report.ReportAccountabilityStatsService; |
|
|
|
import com.biutag.supervision.service.report.*; |
|
|
|
import com.biutag.supervision.service.report.ReportBaseQueryService; |
|
|
|
|
|
|
|
import com.biutag.supervision.service.report.ReportBusinessLineSectionService; |
|
|
|
|
|
|
|
import com.biutag.supervision.service.report.ReportClosedStatsService; |
|
|
|
|
|
|
|
import com.biutag.supervision.util.ChartRenderUtil; |
|
|
|
import com.biutag.supervision.util.ChartRenderUtil; |
|
|
|
import com.biutag.supervision.util.ReportTrendUtil; |
|
|
|
import com.biutag.supervision.util.ReportTrendUtil; |
|
|
|
import com.deepoove.poi.data.PictureRenderData; |
|
|
|
import com.deepoove.poi.data.PictureRenderData; |
|
|
|
@ -31,6 +31,7 @@ import com.deepoove.poi.data.Pictures; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.ibatis.annotations.One; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
@ -55,8 +56,12 @@ public class ReportBusinessLineSectionServiceImpl implements ReportBusinessLineS |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private ReportAccountabilityStatsService reportAccountabilityStatsService; |
|
|
|
private ReportAccountabilityStatsService reportAccountabilityStatsService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private NegativeProblemRelationService negativeProblemRelationService; |
|
|
|
private ReportProblemTypeStatsService reportProblemTypeStatsService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public BusinessLineOverviewSection buildBusinessLineOverviewSection(ReportBusinessLineSectionRequestDTO requestDTO) { |
|
|
|
public BusinessLineOverviewSection buildBusinessLineOverviewSection(ReportBusinessLineSectionRequestDTO requestDTO) { |
|
|
|
@ -190,69 +195,41 @@ public class ReportBusinessLineSectionServiceImpl implements ReportBusinessLineS |
|
|
|
// 问责统计
|
|
|
|
// 问责统计
|
|
|
|
ReportAccountabilityStatsRequestDTO statsRequestDTO = new ReportAccountabilityStatsRequestDTO(); |
|
|
|
ReportAccountabilityStatsRequestDTO statsRequestDTO = new ReportAccountabilityStatsRequestDTO(); |
|
|
|
statsRequestDTO.setNegativeQueryVoList(lineList); |
|
|
|
statsRequestDTO.setNegativeQueryVoList(lineList); |
|
|
|
|
|
|
|
statsRequestDTO.setCurrentUser(request.getCurrentUser()); |
|
|
|
ReportAccountabilityStatsResponseDTO accountabilityStats = reportAccountabilityStatsService.calculateAccountabilityStats(statsRequestDTO); |
|
|
|
ReportAccountabilityStatsResponseDTO accountabilityStats = reportAccountabilityStatsService.calculateAccountabilityStats(statsRequestDTO); |
|
|
|
|
|
|
|
section.setAccountabilityNegativeCount(accountabilityStats.getAccountabilityNegativeCount()); |
|
|
|
section.setAccountabilityTotal(accountabilityStats.getTotal()); |
|
|
|
section.setAccountabilityTotal(accountabilityStats.getTotal()); |
|
|
|
section.setAccountabilityRate(accountabilityStats.getAccountabilityNegativeRate()); |
|
|
|
section.setAccountabilityRate(accountabilityStats.getAccountabilityNegativeRate()); |
|
|
|
section.setPersonalAccountabilityCount(accountabilityStats.getPersonal()); |
|
|
|
section.setPersonalAccountabilityCount(accountabilityStats.getPersonal()); |
|
|
|
section.setDepartmentAccountabilityCount(accountabilityStats.getUnit()); |
|
|
|
section.setDepartmentAccountabilityCount(accountabilityStats.getUnit()); |
|
|
|
//问题类型 TOP3
|
|
|
|
//问题类型 TOP3
|
|
|
|
// Set<String> collect = lineList.stream().map(NegativeQueryVo::getId).collect(Collectors.toSet());
|
|
|
|
ReportProblemTypeStatsRequestDTO reportProblemTypeStatsRequestDTO = new ReportProblemTypeStatsRequestDTO(); |
|
|
|
// List<NegativeProblemRelation> negativeProblemRelations = negativeProblemRelationService.list(collect);
|
|
|
|
reportProblemTypeStatsRequestDTO.setNegativeQueryVoList(lineList); |
|
|
|
// // 1. 分组统计,value为所有数据的List
|
|
|
|
ReportProblemTypeStatsResponseDTO reportProblemTypeStatsResponseDTO = reportProblemTypeStatsService.calculateProblemTypeStats(reportProblemTypeStatsRequestDTO); |
|
|
|
// Map<String, List<NegativeProblemRelation>> groupedMap = negativeProblemRelations.stream()
|
|
|
|
section.setTopProblemTypes(reportProblemTypeStatsResponseDTO.getTopProblemTypes()); |
|
|
|
// .collect(Collectors.groupingBy(
|
|
|
|
|
|
|
|
// relation -> relation.getOneLevelContent() +
|
|
|
|
|
|
|
|
// relation.getTwoLevelContent() +
|
|
|
|
|
|
|
|
// relation.getThreeLevelContent()
|
|
|
|
|
|
|
|
// ));
|
|
|
|
|
|
|
|
// // 2. 按List大小(数量)降序排序
|
|
|
|
|
|
|
|
// List<Map.Entry<String, List<NegativeProblemRelation>>> sortedList = groupedMap.entrySet().stream()
|
|
|
|
|
|
|
|
// .sorted((entry1, entry2) -> Integer.compare(entry2.getValue().size(), entry1.getValue().size()))
|
|
|
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
|
|
|
// section.setTopProblemTypes(topProblemTypes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 重点单位 TOP3
|
|
|
|
// 重点单位 TOP3
|
|
|
|
section.setTopUnits(closedStats.getTopUnits().stream().limit(3).toList()); |
|
|
|
section.setTopUnits(closedStats.getTopUnits().stream().limit(3).toList()); |
|
|
|
// 重点人员 TOP3
|
|
|
|
// 重点人员 TOP3
|
|
|
|
section.setTopPersons(accountabilityStats.getTopPersons().stream().limit(3).toList()); |
|
|
|
section.setTopPersons(accountabilityStats.getTopPersons().stream().limit(3).toList()); |
|
|
|
|
|
|
|
BigDecimal currentVerifiedRate = closedStats.getVerifiedRate(); |
|
|
|
|
|
|
|
ClosedStatsCalcRequestDTO momRequestDTO = new ClosedStatsCalcRequestDTO(); |
|
|
|
int currentCount = totalIssued; |
|
|
|
momRequestDTO.setNegativeQueryVoList(momGroup.getOrDefault(fatherBusinessLineName, Collections.emptyList())); |
|
|
|
int momCount = momGroup.getOrDefault(fatherBusinessLineName, Collections.emptyList()).size(); |
|
|
|
ClosedStatsCalcResponseDTO momClosedStats = reportClosedStatsService.calculateClosedStats(momRequestDTO); |
|
|
|
int yoyCount = yoyGroup.getOrDefault(fatherBusinessLineName, Collections.emptyList()).size(); |
|
|
|
ClosedStatsCalcRequestDTO yoyRequestDTO = new ClosedStatsCalcRequestDTO(); |
|
|
|
section.setMomRate(ReportTrendUtil.calcRate(currentCount, momCount)); |
|
|
|
yoyRequestDTO.setNegativeQueryVoList(yoyGroup.getOrDefault(fatherBusinessLineName, Collections.emptyList())); |
|
|
|
section.setMomTrend(ReportTrendUtil.calcTrend(currentCount, momCount)); |
|
|
|
ClosedStatsCalcResponseDTO yoyClosedStats = reportClosedStatsService.calculateClosedStats(yoyRequestDTO); |
|
|
|
section.setYoyRate(ReportTrendUtil.calcRate(currentCount, yoyCount)); |
|
|
|
BigDecimal momVerifiedRate = momClosedStats.getVerifiedRate(); |
|
|
|
section.setYoyTrend(ReportTrendUtil.calcTrend(currentCount, yoyCount)); |
|
|
|
BigDecimal yoyVerifiedRate = yoyClosedStats.getVerifiedRate(); |
|
|
|
|
|
|
|
section.setMomRate(ReportTrendUtil.calcDiff(currentVerifiedRate, momVerifiedRate)); |
|
|
|
|
|
|
|
section.setMomTrend(ReportTrendUtil.calcTrend(currentVerifiedRate, momVerifiedRate)); |
|
|
|
|
|
|
|
section.setYoyRate(ReportTrendUtil.calcDiff(currentVerifiedRate, yoyVerifiedRate)); |
|
|
|
|
|
|
|
section.setYoyTrend(ReportTrendUtil.calcTrend(currentVerifiedRate, yoyVerifiedRate)); |
|
|
|
result.add(section); |
|
|
|
result.add(section); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("条线明细计算结束======================================================================================="); |
|
|
|
log.info("条线明细计算结束======================================================================================="); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据问题名称、数量、占比构建排名项 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private BusinessLineRankItem buildRankItem(String name, Integer count, String rate) { |
|
|
|
|
|
|
|
BusinessLineRankItem item = new BusinessLineRankItem(); |
|
|
|
|
|
|
|
item.setName(name); |
|
|
|
|
|
|
|
item.setCount(count); |
|
|
|
|
|
|
|
item.setRate(new BigDecimal(rate)); |
|
|
|
|
|
|
|
return item; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据人员、单位、身份、数量、占比构建人员排名项 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private BusinessLinePersonRankItem buildPersonRankItem(String personName, String unitName, String identityName, Integer count, String rate) { |
|
|
|
|
|
|
|
BusinessLinePersonRankItem item = new BusinessLinePersonRankItem(); |
|
|
|
|
|
|
|
item.setPersonName(personName); |
|
|
|
|
|
|
|
item.setUnitName(unitName); |
|
|
|
|
|
|
|
item.setIdentityName(identityName); |
|
|
|
|
|
|
|
item.setCount(count); |
|
|
|
|
|
|
|
item.setRate(new BigDecimal(rate)); |
|
|
|
|
|
|
|
return item; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据子级问题来源ID,解析父级业务条线名称 |
|
|
|
* 根据子级问题来源ID,解析父级业务条线名称 |
|
|
|
@ -270,27 +247,6 @@ public class ReportBusinessLineSectionServiceImpl implements ReportBusinessLineS |
|
|
|
: StrUtil.blankToDefault(child.getLabel(), "未归类"); |
|
|
|
: StrUtil.blankToDefault(child.getLabel(), "未归类"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据问题来源ID获取当前节点名称 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String leafProblemLabel(String problemSourceCode, Map<String, DictProblemSourceTree> idMap) { |
|
|
|
|
|
|
|
if (StrUtil.isBlank(problemSourceCode)) { |
|
|
|
|
|
|
|
return "未归类"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DictProblemSourceTree node = idMap.get(problemSourceCode); |
|
|
|
|
|
|
|
if (node == null || StrUtil.isBlank(node.getLabel())) { |
|
|
|
|
|
|
|
return "未归类"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return node.getLabel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 安全计算占比字符串 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String safePercentString(int numerator, int denominator) { |
|
|
|
|
|
|
|
return ReportTrendUtil.percent(numerator, denominator).toPlainString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 阿拉伯数字序号转中文序号 |
|
|
|
* 阿拉伯数字序号转中文序号 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -302,108 +258,8 @@ public class ReportBusinessLineSectionServiceImpl implements ReportBusinessLineS |
|
|
|
return String.valueOf(index); |
|
|
|
return String.valueOf(index); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
private BigDecimal defaultZero(BigDecimal value) { |
|
|
|
* 构建重点人员TOP3 |
|
|
|
return value == null ? BigDecimal.ZERO : value; |
|
|
|
*/ |
|
|
|
|
|
|
|
private List<BusinessLinePersonRankItem> buildTopPersons(List<NegativeQueryVo> lineList, int totalIssued) { |
|
|
|
|
|
|
|
Map<String, PersonAgg> personAggMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (NegativeQueryVo vo : lineList) { |
|
|
|
|
|
|
|
String personName = readStringByGetter(vo, |
|
|
|
|
|
|
|
"getInvolvePersonName", |
|
|
|
|
|
|
|
"getPersonName", |
|
|
|
|
|
|
|
"getPoliceName", |
|
|
|
|
|
|
|
"getHandlePersonName", |
|
|
|
|
|
|
|
"getName"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(personName)) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String unitName = firstNotBlank( |
|
|
|
|
|
|
|
readStringByGetter(vo, "getInvolveDepartName"), |
|
|
|
|
|
|
|
readStringByGetter(vo, "getUnitName"), |
|
|
|
|
|
|
|
readStringByGetter(vo, "getDepartName"), |
|
|
|
|
|
|
|
"未知单位" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String identityName = firstNotBlank( |
|
|
|
|
|
|
|
readStringByGetter(vo, "getIdentityName"), |
|
|
|
|
|
|
|
readStringByGetter(vo, "getInvolveIdentityName"), |
|
|
|
|
|
|
|
readStringByGetter(vo, "getPoliceTypeName"), |
|
|
|
|
|
|
|
readStringByGetter(vo, "getUserTypeName"), |
|
|
|
|
|
|
|
"未知身份" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String key = personName + "||" + unitName + "||" + identityName; |
|
|
|
|
|
|
|
PersonAgg agg = personAggMap.computeIfAbsent(key, k -> { |
|
|
|
|
|
|
|
PersonAgg x = new PersonAgg(); |
|
|
|
|
|
|
|
x.setPersonName(personName); |
|
|
|
|
|
|
|
x.setUnitName(unitName); |
|
|
|
|
|
|
|
x.setIdentityName(identityName); |
|
|
|
|
|
|
|
x.setCount(0); |
|
|
|
|
|
|
|
return x; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
agg.setCount(agg.getCount() + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return personAggMap.values().stream() |
|
|
|
|
|
|
|
.sorted(Comparator.comparing(PersonAgg::getCount).reversed()) |
|
|
|
|
|
|
|
.limit(3) |
|
|
|
|
|
|
|
.map(one -> buildPersonRankItem( |
|
|
|
|
|
|
|
one.getPersonName(), |
|
|
|
|
|
|
|
one.getUnitName(), |
|
|
|
|
|
|
|
one.getIdentityName(), |
|
|
|
|
|
|
|
one.getCount(), |
|
|
|
|
|
|
|
safePercentString(one.getCount(), totalIssued) |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 通过反射按顺序读取字符串属性 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String readStringByGetter(Object target, String... getterNames) { |
|
|
|
|
|
|
|
if (target == null || getterNames == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (String getterName : getterNames) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
java.lang.reflect.Method method = target.getClass().getMethod(getterName); |
|
|
|
|
|
|
|
Object value = method.invoke(target); |
|
|
|
|
|
|
|
if (value instanceof String str && StrUtil.isNotBlank(str)) { |
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 返回第一个非空白字符串 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String firstNotBlank(String... values) { |
|
|
|
|
|
|
|
if (values == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (String value : values) { |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(value)) { |
|
|
|
|
|
|
|
return value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 重点人员聚合对象 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Data |
|
|
|
|
|
|
|
private static class PersonAgg { |
|
|
|
|
|
|
|
private String personName; |
|
|
|
|
|
|
|
private String unitName; |
|
|
|
|
|
|
|
private String identityName; |
|
|
|
|
|
|
|
private int count; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|