Browse Source

公众参与较上月 上升下降为负数?

dev_shibei_match
jianjun 5 years ago
parent
commit
9361971b47
  1. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java
  3. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml
  6. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java

@ -25,9 +25,9 @@ public class GridUserCountResultDTO implements Serializable {
private Integer partyCount = NumConstant.ZERO;
/**
* 网格ID
* 网格ID 或组织Id
*/
private String gridId;
private String orgId;
/**
* 用户总数

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java

@ -145,7 +145,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
// 1. 网格群众用户数 , 网格党员用户数
if (!CollectionUtils.isEmpty(gridUserCountList)){
gridUserCountList.forEach(count -> {
if (r.getGridId().equals(count.getGridId())){
if (r.getGridId().equals(count.getOrgId())) {
r.setUserCount(count.getUserCount());
r.setPartyCount(count.getPartyCount());
}

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

@ -112,7 +112,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
log.error("抽取【公众参与-人均议题】,获取注册用户数为空");
return;
}
Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getGridId, o -> o));
Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o));
issueTotal.forEach(issue -> {
String gridId = issue.getGridId();
ScreenUserJoinEntity entity = insertMap.get(gridId);
@ -122,7 +122,8 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
log.debug("issue:{}", JSON.toJSONString(issue));
log.debug("user:{}", JSON.toJSONString(user));
if (!user.getRegTotal().equals(0)) {
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED)));
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal())
.divide(new BigDecimal(NumConstant.ONE_HUNDRED)), 4, BigDecimal.ROUND_HALF_UP);
entity.setAvgIssue(avgIssueCount);
}
});
@ -156,9 +157,13 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
if (memberCount == null) {
memberCount = 0;
}
bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount));
if (memberCount != 0) {
bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount));
}
}
if (votedByIssueCount.intValue() != 0) {
entity.setAvgJoin(bigDecimal.divide(votedByIssueCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)));
}
entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)));
}
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()));
}
@ -179,7 +184,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
log.error("抽取【公众参与-人均议题】,获取注册用户数为空");
return;
}
Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getGridId, o -> o));
Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o));
Set<String> agencyIdSet = new HashSet<>();
issueTotal.forEach(issue -> {
String agencyId = issue.getAgencyId();
@ -188,8 +193,11 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
entity.setJoinTotal(issue.getIssueIncr());
GridUserCountResultDTO user = userCountMap.get(agencyId);
//百人人均议题:统计周期内总的议题数/(注册用户数/100)
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED)));
entity.setAvgIssue(avgIssueCount);
if (!user.getRegTotal().equals(0)) {
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal())
.divide(new BigDecimal(NumConstant.ONE_HUNDRED)), 4, BigDecimal.ROUND_HALF_UP);
entity.setAvgIssue(avgIssueCount);
}
});
List<List<String>> partition = ListUtils.partition(new ArrayList<>(agencyIdSet), NumConstant.THIRTY);
@ -224,7 +232,9 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
}
bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / memberCount));
}
entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)));
if (votedByIssueCount.intValue() != 0) {
entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)));
}
}
});
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()));

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml

@ -277,7 +277,7 @@
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
GROUP by ${groupField,jdbcType=VARCHAR}
GROUP by ${groupField}
</select>
<select id="selectGridGroupCount" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml

@ -107,7 +107,7 @@
and CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and MONTH_ID = #{monthId,jdbcType=VARCHAR}
AND ACTION_CODE LIKE 'vote_%'
group by ${groupField,jdbcType=VARCHAR}
group by ${groupField}
</select>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml

@ -15,7 +15,8 @@
SELECT
ID,
CUSTOMER_ID,
AGENCY_ID
AGENCY_ID,
GRID_NAME
FROM
dim_grid
WHERE

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml

@ -119,10 +119,10 @@
SELECT
REG_INCR,
PARTYMEMBER_INCR,
AGENCY_ID,
AGENCY_ID as orgId,
REG_TOTAL
FROM
fact_reg_user_grid_monthly
fact_reg_user_agency_monthly
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml

@ -111,7 +111,7 @@
SELECT
REG_INCR,
PARTYMEMBER_INCR,
GRID_ID,
GRID_ID as orgId,
REG_TOTAL
FROM
fact_reg_user_grid_monthly

Loading…
Cancel
Save