|
@ -2,13 +2,19 @@ package com.epmet.service.evaluationindex.indexcoll.impl; |
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao; |
|
|
|
|
|
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; |
|
|
|
|
|
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO; |
|
|
|
|
|
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; |
|
|
import com.epmet.dto.indexcollect.ScreenPyHistoryScoreDetailDTO; |
|
|
import com.epmet.dto.indexcollect.ScreenPyHistoryScoreDetailDTO; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; |
|
@ -28,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.NumberFormat; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
@ -47,6 +54,8 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ |
|
|
private ScreenPyHistoryScoreDetailServiceImpl screenPyHistoryScoreDetailServiceImpl; |
|
|
private ScreenPyHistoryScoreDetailServiceImpl screenPyHistoryScoreDetailServiceImpl; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao; |
|
|
private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DataAggregatorOpenFeignClient dataAggregatorOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -130,14 +139,35 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ |
|
|
@Override |
|
|
@Override |
|
|
public HistoryScoreComputeResultDTO computeScore(HistoryScoreComputeFormDTO formDTO) { |
|
|
public HistoryScoreComputeResultDTO computeScore(HistoryScoreComputeFormDTO formDTO) { |
|
|
HistoryScoreComputeResultDTO resultDTO = new HistoryScoreComputeResultDTO(); |
|
|
HistoryScoreComputeResultDTO resultDTO = new HistoryScoreComputeResultDTO(); |
|
|
|
|
|
resultDTO.setAgencyId(formDTO.getAgencyId()); |
|
|
|
|
|
//计算百分比使用,保留小数点后两位
|
|
|
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.TWO); |
|
|
if ("grid".equals(formDTO.getType())) { |
|
|
if ("grid".equals(formDTO.getType())) { |
|
|
//网格活跃度每周得分=(活跃网格数/本街镇网格数)x100+(正常网格数/本街镇网格数)x80
|
|
|
/** |
|
|
//本街镇网格数基于本街镇基础网格总数进行计算,不包含专属网格
|
|
|
* 网格活跃度每周得分=(活跃网格数/本街镇网格数)x100+(正常网格数/本街镇网格数)x80 |
|
|
|
|
|
* 1周内每个末级网格有五天及五天以上上传事件或开展例行工作的为活跃网格;有2天及2天以上,5天以下上传事件或开展例行工作的为正常运行网格;只有1天上传事件或开展例行工作的为僵尸网格 |
|
|
|
|
|
* 本街镇网格数基于本街镇基础网格总数进行计算,不包含专属网格 |
|
|
|
|
|
*/ |
|
|
|
|
|
//1.获取街道下时间区间内的网格活跃度数据
|
|
|
|
|
|
GridLivelyFormDTO form = ConvertUtils.sourceToTarget(formDTO, GridLivelyFormDTO.class); |
|
|
|
|
|
form.setType("historyScore"); |
|
|
|
|
|
Result<List<GridLivelyResultDTO>> result = dataAggregatorOpenFeignClient.grdiLively(form); |
|
|
|
|
|
if (!result.success() || result.getData() == null) { |
|
|
|
|
|
throw new RenException("统计街道下网格活跃度数据失败"); |
|
|
|
|
|
} |
|
|
|
|
|
GridLivelyResultDTO gridLively = result.getData().get(NumConstant.ZERO); |
|
|
|
|
|
String score = (gridLively.getGridSumNum() <= 0) ? "0" : numberFormat.format(((float) gridLively.getGridLivelyNum() / (float) gridLively.getGridSumNum()) * 100 + (gridLively.getGridOrdinaryNum() / gridLively.getGridSumNum()) * 80); |
|
|
|
|
|
resultDTO.setScore(score); |
|
|
} else if ("event".equals(formDTO.getType())) { |
|
|
} else if ("event".equals(formDTO.getType())) { |
|
|
//事件赋分每周得分=(活跃网格数/末级网格数)x100+(正常运行网格数/末级网格数)x80
|
|
|
/** |
|
|
//1周内每个末级网格有五天及五天以上上传事件或开展例行工作的为活跃网格;有2天及2天以上,5天以下上传事件或开展例行工作的为正常运行网格;只有1天上传事件或开展例行工作的为僵尸网格
|
|
|
* 事件赋分= 街道下末级网格上报事件数量乘以对应的每项事件分值的累加和除以街道下有效未离职状态的网格员总数 |
|
|
|
|
|
* 加上街道下末级网格例行工作数量乘以对应的每项事件分值的累加和除以街道下有效未离职状态的网格员总数 |
|
|
|
|
|
*/ |
|
|
|
|
|
//TODO
|
|
|
} |
|
|
} |
|
|
return resultDTO; |
|
|
return resultDTO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|