Browse Source

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

dev_shibei_match
wangchao 5 years ago
parent
commit
f19fee09ff
  1. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  2. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  3. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java

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

@ -2,7 +2,6 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.OrgTypeConstant; import com.epmet.constant.OrgTypeConstant;
@ -73,8 +72,8 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
* targetscreen_user_join * targetscreen_user_join
* 总参与统计周期内议题表决(虽然可以评价 但是只有表决的人可以评价 所以按表决人数算)的人数 * 总参与统计周期内议题表决(虽然可以评价 但是只有表决的人可以评价 所以按表决人数算)的人数
* 百人人均议题统计周期内总的议题数/注册用户数/100 * 百人人均议题统计周期内总的议题数/注册用户数/100
* 百人平均参与度每个议题的实际参与数/应参与数 的平均值每个议题的实际参与数/应参与数的和/被表决的议题数 来源 获取issue_vote_statistical_daily中 monthId的数据 * 百人平均参与度每个议题的实际参与数/应参与数 的平均值每个议题的实际参与/应参与的和/被表决的议题数 来源 获取issue_vote_statistical_daily中 monthId的数据
* * <p>
* 不考虑市北人均议题统计周期内议题总数/发过议题的人数 参与度各个行为(表决)的总数/发生行为的人数 * 不考虑市北人均议题统计周期内议题总数/发过议题的人数 参与度各个行为(表决)的总数/发生行为的人数
* *
* @return java.lang.Boolean * @return java.lang.Boolean
@ -123,7 +122,8 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
log.debug("user:{}", JSON.toJSONString(user)); log.debug("user:{}", JSON.toJSONString(user));
if (!user.getRegTotal().equals(0)) { if (!user.getRegTotal().equals(0)) {
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()) BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal())
.divide(new BigDecimal(NumConstant.ONE_HUNDRED)), 4, BigDecimal.ROUND_HALF_UP); .divide(new BigDecimal(NumConstant.ONE_HUNDRED)), 4, BigDecimal.ROUND_HALF_UP)
.multiply(new BigDecimal(NumConstant.ONE_HUNDRED));
entity.setAvgIssue(avgIssueCount); entity.setAvgIssue(avgIssueCount);
} }
}); });
@ -136,7 +136,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
//获取每个网格的应表决人数 //获取每个网格的应表决人数
List<GridGroupUserCountResultDTO> memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); List<GridGroupUserCountResultDTO> memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID);
if (CollectionUtils.isEmpty(memberCountList)) { if (CollectionUtils.isEmpty(memberCountList)) {
log.error("抽取【公众参与-人均议题】,获取应表决人数为空"); log.warn("抽取【公众参与-人均议题】,获取应表决人数为空");
return; return;
} }
gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount()));
@ -209,7 +209,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
//获取每个网格的应表决人数 //获取每个网格的应表决人数
List<GridGroupUserCountResultDTO> memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); List<GridGroupUserCountResultDTO> memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID);
if (CollectionUtils.isEmpty(memberCountList)) { if (CollectionUtils.isEmpty(memberCountList)) {
log.error("抽取【公众参与-人均议题】,获取应表决人数为空"); log.warn("抽取【公众参与-人均议题】,获取应表决人数为空");
return; return;
} }
orgMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); orgMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount()));

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java

@ -91,9 +91,10 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
private Boolean calulateCustomerIndexScore(CalculateCommonFormDTO formDTO) { private Boolean calulateCustomerIndexScore(CalculateCommonFormDTO formDTO) {
try { try {
String customerId = formDTO.getCustomerId(); String customerId = formDTO.getCustomerId();
Boolean flag = false; Boolean insertFlag = true;
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
try { try {
Boolean flag = false;
//校验是否含有组织数据 //校验是否含有组织数据
int agencyCount = screenCustomerAgencyDao.selectCountByCustomerId(formDTO.getCustomerId()); int agencyCount = screenCustomerAgencyDao.selectCountByCustomerId(formDTO.getCustomerId());
if (agencyCount < 1) { if (agencyCount < 1) {
@ -148,27 +149,28 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
//计算全区 //计算全区
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); flag = indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId());
log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calDistrictAll exception", e); log.error("indexCalculate calDistrictAll exception", e);
} }
} catch (RenException e) { } catch (RenException e) {
flag = false; insertFlag = false;
} }
//计算完毕后 将结果插入大屏相关数据表 //计算完毕后 将结果插入大屏相关数据表 计算当月的数据时 及时有错也插入
if (flag) { String currentMonthId = DimIdGenerator.getMonthDimId(new Date());
if (insertFlag || currentMonthId.equals(formDTO.getMonthId())) {
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId()); factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId());
log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000); log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e); log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e);
flag = false; insertFlag = false;
} }
} }
return flag; return insertFlag;
} catch (Exception e) { } catch (Exception e) {
log.error("calulateCustomerIndexScore exception", e); log.error("calulateCustomerIndexScore exception", e);
} finally { } finally {

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

@ -50,20 +50,23 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl<ScreenDiffi
public DifficultyIfExistedResultDTO selectExistedInfo(String customerId) { public DifficultyIfExistedResultDTO selectExistedInfo(String customerId) {
int count = baseDao.selectCountByCustomerId(customerId); int count = baseDao.selectCountByCustomerId(customerId);
DifficultyIfExistedResultDTO existedMap = new DifficultyIfExistedResultDTO(); DifficultyIfExistedResultDTO existedMap = new DifficultyIfExistedResultDTO();
if(count <= NumConstant.ZERO) {existedMap.setIfExisted(true);} if (count <= NumConstant.ZERO) {
else{existedMap.setClosedIds(baseDao.selectClosedProjectId(customerId));} existedMap.setIfExisted(true);
} else {
existedMap.setClosedIds(baseDao.selectClosedProjectId(customerId));
}
return existedMap; return existedMap;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void dataClean(String customerId,List<ScreenDifficultyDataEntity> difficulties,List<ScreenDifficultyImgDataEntity> imgs) { public void dataClean(String customerId, List<ScreenDifficultyDataEntity> difficulties, List<ScreenDifficultyImgDataEntity> imgs) {
if(!CollectionUtils.isEmpty(difficulties)){ if (!CollectionUtils.isEmpty(difficulties)) {
baseDao.deleteBatchDifficulty(customerId,difficulties.stream().map(ScreenDifficultyDataEntity :: getEventId).distinct().collect(Collectors.toList())); baseDao.deleteBatchDifficulty(customerId, difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()));
baseDao.insertBatch(difficulties); baseDao.insertBatch(difficulties);
} }
if(!CollectionUtils.isEmpty(imgs)){ if (!CollectionUtils.isEmpty(imgs)) {
baseDao.deleteBatchDifficultyImg(imgs.stream().map(ScreenDifficultyImgDataEntity::getEventId).distinct().collect(Collectors.toList())); baseDao.deleteBatchDifficultyImg(imgs.stream().map(ScreenDifficultyImgDataEntity::getEventId).distinct().collect(Collectors.toList()));
baseDao.insertBatchImg(imgs); baseDao.insertBatchImg(imgs);
} }

Loading…
Cancel
Save