Browse Source

Merge remote-tracking branch 'origin/dev_screen_data_2.0' into dev_screen_data_2.0

dev_shibei_match
jianjun 5 years ago
parent
commit
4f90dfaf8f
  1. 6
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java
  2. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  3. 8
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java
  5. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  6. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  7. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java
  9. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java
  10. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml

6
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java

@ -21,13 +21,15 @@ public class IndexScoreFormDTO implements Serializable {
private String orgId; private String orgId;
/** /**
* 类型组织agency 网格grid * 类型组织agency 网格grid
* 大屏接口此字段值为空
*/ */
@NotBlank(message = "数据类型不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class}) //@NotBlank(message = "数据类型不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String orgType; private String orgType;
/** /**
* 月份Id eg202009 * 月份Id eg202009
* 大屏接口此字段值为空
*/ */
@NotBlank(message = "月份Id不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class}) //@NotBlank(message = "月份Id不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String monthId; private String monthId;
public interface AddUserInternalGroup {} public interface AddUserInternalGroup {}

9
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
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.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao;
@ -268,13 +269,17 @@ public class IndexServiceImpl implements IndexService {
@Override @Override
public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) { public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) {
//screen_index_data_monthly 根据组织id和月份获取月度指标得分 //screen_index_data_monthly 根据组织id和月份获取月度指标得分
//1.根据组织或网格Id以及月份Id查询各项月度指数得分 //1.大屏接口 orgType和monthId字段不传值,默认查询上一个月数据
if(null==formDTO.getMonthId()||"".equals(formDTO.getMonthId())){
formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
}
//2.根据组织或网格Id以及月份Id查询各项月度指数得分
IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO); IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO);
if (null == resultDTO) { if (null == resultDTO) {
return resultDTO; return resultDTO;
} }
//2.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比 //3.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比
NumberFormat nf = NumberFormat.getPercentInstance(); NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1); nf.setMaximumFractionDigits(1);

8
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -176,18 +176,20 @@
<select id="selectMonthData" resultType="com.epmet.evaluationindex.screen.dto.result.IndexScoreResultDTO"> <select id="selectMonthData" resultType="com.epmet.evaluationindex.screen.dto.result.IndexScoreResultDTO">
SELECT SELECT
index_total AS "total", index_total AS "total",
party_dev_ablity AS "party", (party_dev_ablity * party_dev_weight) AS "party",
party_dev_weight AS "partyDevAbilityWeight", party_dev_weight AS "partyDevAbilityWeight",
govern_ablity AS "govern", (govern_ablity * govern_ablity_weight) AS "govern",
govern_ablity_weight AS "governAbilityWeight", govern_ablity_weight AS "governAbilityWeight",
service_ablity AS "service", (service_ablity * service_ablity_weight) AS "service",
service_ablity_weight AS "serviceAbilityWeight" service_ablity_weight AS "serviceAbilityWeight"
FROM FROM
screen_index_data_monthly screen_index_data_monthly
WHERE WHERE
del_flag = '0' del_flag = '0'
AND org_id = #{orgId} AND org_id = #{orgId}
<if test="orgType != null and orgType != '' ">
AND org_type = #{orgType} AND org_type = #{orgType}
</if>
AND month_id = #{monthId} AND month_id = #{monthId}
</select> </select>

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java

@ -52,7 +52,7 @@ public interface ScreenPartyUserRankDataDao extends BaseDao<ScreenPartyUserRankD
* @author wangc * @author wangc
* @date 2020.09.27 11:19 * @date 2020.09.27 11:19
*/ */
Integer deleteBatchByCustomerIdAndDateId(@Param("customerId") String customerId,@Param("dateId") String dateId); Integer deleteBatchByCustomerIdAndDateId(@Param("customerId") String customerId);
/** /**
* 9党建引领|基层治理-居民党员积分排行榜 * 9党建引领|基层治理-居民党员积分排行榜

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java

@ -96,7 +96,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
List<DimGridEntity> orgList = dimGridService.getGridListByCustomerId(formDTO.getCustomerId()); List<DimGridEntity> orgList = dimGridService.getGridListByCustomerId(formDTO.getCustomerId());
if (CollectionUtils.isEmpty(orgList)) { if (CollectionUtils.isEmpty(orgList)) {
log.warn("抽取【公众参与-人均议题】,获取组织数据失败"); log.warn("抽取【公众参与-人均议题】,获取组织数据失败");
throw new RenException("抽取【公众参与-人均议题】,获取组织数据失败"); return;
} }
//构建组织数据 //构建组织数据
Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(); Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>();
@ -172,7 +172,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
List<DimAgencyEntity> orgList = dimAgencyService.getAgencyListByCustomerId(formDTO.getCustomerId()); List<DimAgencyEntity> orgList = dimAgencyService.getAgencyListByCustomerId(formDTO.getCustomerId());
if (CollectionUtils.isEmpty(orgList)) { if (CollectionUtils.isEmpty(orgList)) {
log.warn("抽取【公众参与-人均议题】,获取组织数据失败"); log.warn("抽取【公众参与-人均议题】,获取组织数据失败");
throw new RenException("抽取【公众参与-人均议题】,获取组织数据失败"); return;
} }
//构建组织数据 //构建组织数据
Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(); Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>();

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java

@ -233,13 +233,15 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
}catch (Exception e){ }catch (Exception e){
log.error("党建引领抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); log.error("党建引领抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e);
} }
try {
//基层治理 - 热心市民 screen_party_user_rank_data //基层治理 - 热心市民 screen_party_user_rank_data
ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO();
param.setCustomerId(customerId); param.setCustomerId(customerId);
param.setDateId(monthId); param.setDateId(monthId);
screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param); screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param);
}catch(Exception e){
log.error("大屏热心市民/党员得分数据写入失败,参数为:{}",JSON.toJSONString(formDTO));
}
//此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量 //此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量
ExecutorService pool = Executors.newSingleThreadExecutor(); ExecutorService pool = Executors.newSingleThreadExecutor();
pool.submit(() -> { pool.submit(() -> {

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java

@ -122,7 +122,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
} }
//6.存入数据库 //6.存入数据库
screenPartyUserRankDataService.dataClean(registeredUsers,param.getCustomerId(),dateId); //不按照时间删除,每次插入之前将该客户下的所有历史数据清空
screenPartyUserRankDataService.dataClean(registeredUsers,param.getCustomerId());
} }
/** /**

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java

@ -39,6 +39,6 @@ public interface ScreenPartyUserRankDataService extends BaseService<ScreenPartyU
* @author wangc * @author wangc
* @date 2020.09.27 09:44 * @date 2020.09.27 09:44
**/ **/
void dataClean(List<ScreenPartyUserRankDataEntity> dataList,String customerId,String dateId); void dataClean(List<ScreenPartyUserRankDataEntity> dataList,String customerId);
} }

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java

@ -55,11 +55,11 @@ public class ScreenPartyUserRankDataServiceImpl extends BaseServiceImpl<ScreenPa
**/ **/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void dataClean(List<ScreenPartyUserRankDataEntity> dataList, String customerId, String dateId) { public void dataClean(List<ScreenPartyUserRankDataEntity> dataList, String customerId) {
if(!CollectionUtils.isEmpty(dataList)) { if(!CollectionUtils.isEmpty(dataList)) {
int affectedRows; int affectedRows;
do { do {
affectedRows = baseDao.deleteBatchByCustomerIdAndDateId(customerId, dateId); affectedRows = baseDao.deleteBatchByCustomerIdAndDateId(customerId);
} while (affectedRows > NumConstant.ZERO); } while (affectedRows > NumConstant.ZERO);
baseDao.insertBatch(dataList); baseDao.insertBatch(dataList);
} }

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml

@ -12,7 +12,6 @@
<delete id="deleteBatchByCustomerIdAndDateId"> <delete id="deleteBatchByCustomerIdAndDateId">
delete from screen_party_user_rank_data delete from screen_party_user_rank_data
where CUSTOMER_ID = #{customerId} where CUSTOMER_ID = #{customerId}
AND DATA_END_TIME = #{dateId}
limit 1000; limit 1000;
</delete> </delete>

Loading…
Cancel
Save