|
|
@ -5,11 +5,17 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
|
import com.epmet.constant.ExtractConstant; |
|
|
|
import com.epmet.constant.ProjectEvaluateConstant; |
|
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; |
|
|
|
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; |
|
|
|
import com.epmet.dto.extract.form.GridIssueCountResultDTO; |
|
|
|
import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; |
|
|
|
import com.epmet.dto.extract.result.GridProjectCountResultDTO; |
|
|
|
import com.epmet.dto.extract.result.NotReturnProjectResultDTO; |
|
|
|
import com.epmet.dto.extract.result.ProjectEvaluateResultDTO; |
|
|
|
import com.epmet.service.evaluationindex.extract.CalGridIndexService; |
|
|
|
import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.IssueExtractService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
@ -18,7 +24,11 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author zxc |
|
|
@ -33,6 +43,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
private IssueExtractService issueExtractService; |
|
|
|
@Autowired |
|
|
|
private FactIndexGovrnAblityGridMonthlyDao governAbilityDao; |
|
|
|
@Autowired |
|
|
|
private FactOriginProjectMainDailyService projectMainService; |
|
|
|
@Autowired |
|
|
|
private FactOriginProjectLogDailyService projectLogService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 计算网格指标党建能力 |
|
|
@ -65,6 +79,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
//网格总项目数
|
|
|
|
List<GridProjectCountResultDTO> gridProjectTotalList = issueExtractService.selectGridProjectCount(customerId, monthId, ExtractConstant.SHIFT_PROJECT); |
|
|
|
//网格议题转项目率
|
|
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList) && !CollectionUtils.isEmpty(gridProjectTotalList)) { |
|
|
|
gridProjectTotalList.forEach(project -> { |
|
|
|
gridIssueTotalList.forEach(issue -> { |
|
|
|
if (project.getGridId().equals(issue.getGridId())) { |
|
|
@ -72,15 +87,55 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//网格自治项目数
|
|
|
|
} |
|
|
|
//网格自治项目数 从议题创建到项目关闭,包括处理人,自始至终没有出过议题所属网格
|
|
|
|
|
|
|
|
//网格办结项目数
|
|
|
|
|
|
|
|
//网格吹哨部门准确率
|
|
|
|
|
|
|
|
List<GridProjectClosedTotalResultDTO> gridProjectClosedTotalList = projectMainService.selectGridClosedProject(customerId, monthId, ExtractConstant.CLOSED); |
|
|
|
//网格吹哨部门准确率 【没被退回的项目数/项目总数 】
|
|
|
|
List<NotReturnProjectResultDTO> notReturnProjectList = projectLogService.selectNotReturnProject(customerId, monthId, ExtractConstant.RETURN_ACTION_CODE, ExtractConstant.GRID_ORG_TYPE); |
|
|
|
if (!CollectionUtils.isEmpty(gridProjectTotalList) && !CollectionUtils.isEmpty(notReturnProjectList)){ |
|
|
|
notReturnProjectList.forEach(not -> { |
|
|
|
gridProjectTotalList.forEach(total -> { |
|
|
|
if (not.getGridId().equals(total.getGridId())){ |
|
|
|
not.setTransferRightRatio(getRound(new BigDecimal(not.getNotReturnProject()/total.getProjectTotal()))); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
//网格内解决的项目的满意度
|
|
|
|
|
|
|
|
//组织内党员的参与议事能力考评分(平均值)
|
|
|
|
//项目评价(分值定义下非常满意100,满意80,不满意(一般)60)的人数的平均分(每个项目的参加人数的分数和/评论人数=一个项目的平均分)+其他项目得分/已关闭项目总数
|
|
|
|
List<ProjectEvaluateResultDTO> projectEvaluateList = projectLogService.selectProjectEvaluate(customerId, monthId); |
|
|
|
Map<String,BigDecimal> resultSatisfactionScore = new HashMap<>(16); |
|
|
|
if (!CollectionUtils.isEmpty(projectEvaluateList)){ |
|
|
|
Map<String, List<ProjectEvaluateResultDTO>> groupByGrid = projectEvaluateList.stream().collect(Collectors.groupingBy(ProjectEvaluateResultDTO::getGridId)); |
|
|
|
groupByGrid.forEach((gridId,projectEvaluateInfoList) -> { |
|
|
|
Map<String,Integer> scoreMap = new HashMap<>(16); |
|
|
|
Map<String, List<ProjectEvaluateResultDTO>> groupByProject = projectEvaluateInfoList.stream().collect(Collectors.groupingBy(ProjectEvaluateResultDTO::getProjectId)); |
|
|
|
groupByProject.forEach((projectId,projectList) -> { |
|
|
|
projectList.forEach(project -> { |
|
|
|
switch (project.getActionCode()){ |
|
|
|
case ExtractConstant.EVALUATE_BAD: |
|
|
|
project.setScore(ProjectEvaluateConstant.BAD); |
|
|
|
break; |
|
|
|
case ExtractConstant.EVALUATE_GOOD: |
|
|
|
project.setScore(ProjectEvaluateConstant.GOOD); |
|
|
|
break; |
|
|
|
case ExtractConstant.EVALUATE_PERFECT: |
|
|
|
project.setScore(ProjectEvaluateConstant.PERFECT); |
|
|
|
break; |
|
|
|
} |
|
|
|
}); |
|
|
|
Integer projectAllScore = projectList.stream().collect(Collectors.summingInt(ProjectEvaluateResultDTO::getScore)); |
|
|
|
scoreMap.put(projectId,projectAllScore/projectList.size()); |
|
|
|
}); |
|
|
|
AtomicReference<Integer> allScore = new AtomicReference<>(0); |
|
|
|
scoreMap.forEach((k,v) -> { |
|
|
|
allScore.set(++v); |
|
|
|
}); |
|
|
|
resultSatisfactionScore.put(gridId,getRound(new BigDecimal(allScore.get()/scoreMap.size()))); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
result.forEach(r -> { |
|
|
|
// 1. 网格总议题数目,网格人均议题数目
|
|
|
@ -100,23 +155,32 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 3. 网格办结项目数
|
|
|
|
if (!CollectionUtils.isEmpty(gridProjectClosedTotalList)){ |
|
|
|
gridProjectClosedTotalList.forEach(closed -> { |
|
|
|
if (r.getGridId().equals(closed.getGridId())){ |
|
|
|
r.setResolveProjectCount(closed.getResolveProjectCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 4. 网格吹哨部门准确率
|
|
|
|
if (!CollectionUtils.isEmpty(notReturnProjectList)){ |
|
|
|
notReturnProjectList.forEach(not -> { |
|
|
|
if (r.getGridId().equals(not.getGridId())){ |
|
|
|
r.setTransferRightRatio(not.getTransferRightRatio()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 5. 网格内解决的项目的满意度
|
|
|
|
if (null != resultSatisfactionScore){ |
|
|
|
resultSatisfactionScore.forEach((k,v) -> { |
|
|
|
if (r.getGridId().equals(k)){ |
|
|
|
r.setSatisfactionRatio(v); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 6. 网格自治项目数
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|