diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyActiveResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyActiveResultDTO.java new file mode 100644 index 0000000000..53bc3f2658 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyActiveResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/9/21 9:35 上午 + */ +@Data +public class PartyActiveResultDTO implements Serializable { + + private static final long serialVersionUID = 4694666116463447613L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 动作操作用户ID + */ + private String userId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index b7d86e4353..1e4ab97477 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.IssueLogDailyFormDTO; +import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -61,4 +62,14 @@ public interface FactOriginIssueLogDailyDao extends BaseDao selectPartyActiveIssueVote(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("isParty") Integer isParty); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java index ab43a21b2e..198625b577 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -93,4 +94,14 @@ public interface FactOriginTopicLogDailyDao extends BaseDao selectTopicIds(@Param("list") List groupIdList); + + /** + * @Description 查询 话题评论【党员/群众】 + * @param customerId + * @param monthId + * @param isParty + * @author zxc + * @date 2020/9/21 9:37 上午 + */ + List selectPartyActiveTopic(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("isParty") Integer isParty); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java index f5eb32bd09..3946572305 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java @@ -19,6 +19,7 @@ package com.epmet.service.evaluationindex.extract; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; import java.util.List; @@ -71,4 +72,14 @@ public interface FactOriginTopicLogDailyService extends BaseService selectTopicIds(List groupIdList); + + /** + * @Description 查询 话题评论【党员/群众】 + * @param customerId + * @param monthId + * @param isParty + * @author zxc + * @date 2020/9/21 9:37 上午 + */ + List selectPartyActiveTopic(String customerId, String monthId,Integer isParty); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java index 0b7ec04c48..45f9c1ff0a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java @@ -3,6 +3,7 @@ package com.epmet.service.evaluationindex.extract; import com.epmet.dto.extract.form.ExtractFormDTO; import com.epmet.dto.extract.form.GridIssueCountResultDTO; import com.epmet.dto.extract.result.GridProjectCountResultDTO; +import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.dto.extract.result.ShiftProjectCountResultDTO; import java.util.List; @@ -90,4 +91,14 @@ public interface IssueExtractService { * @Date 2020/9/20 22:50 **/ Integer selectIssueTotalTwoMonth(List topicIdList); + + /** + * @Description 查询 议题表决【党员/群众】 + * @param customerId + * @param monthId + * @param isParty + * @author zxc + * @date 2020/9/21 9:37 上午 + */ + List selectPartyActiveIssueVote(String customerId, String monthId, Integer isParty); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java index 9fea4c2476..aa240d30aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java @@ -33,7 +33,6 @@ import java.util.stream.Collectors; */ @Service @Slf4j -//@DataSource(DataSourceConstant.EVALUATION_INDEX) public class CalGridIndexServiceImpl implements CalGridIndexService { @Autowired @@ -56,6 +55,8 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { private FactArticlePublishedGridDailyService articlePublishedGridDailyService; @Autowired private GroupExtractService groupExtractService; + @Autowired + private FactOriginTopicLogDailyService topicLogService; /** * @Description 计算网格指标党建能力 @@ -88,6 +89,32 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { List gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueTotalList, gridProjectTotalList); // 建群党员数 List partyCreateGroupCountList = groupExtractService.selectPartyCreateGroupCount(customerId, monthId); + //结合目前产品,数据来源:话题评论、议题表决 + //网格活跃群众用户数 + Map gridMassActiveMap = new HashMap<>(16); + List massActiveList = topicLogService.selectPartyActiveTopic(customerId, monthId, NumConstant.ZERO); + List massActiveIssueVote = issueExtractService.selectPartyActiveIssueVote(customerId, monthId, NumConstant.ZERO); + massActiveList.addAll(massActiveIssueVote); + if (!CollectionUtils.isEmpty(massActiveList)) { + Map> collectMap = massActiveList.stream().collect(Collectors.groupingBy(PartyActiveResultDTO::getGridId)); + collectMap.forEach((gridId, massActive) -> { + List userIds = massActive.stream().map(mass -> mass.getUserId()).distinct().collect(Collectors.toList()); + gridMassActiveMap.put(gridId, userIds.size()); + }); + } + //网格活跃党员用户数 + Map gridPartyActiveMap = new HashMap<>(16); + List partyActiveList = topicLogService.selectPartyActiveTopic(customerId, monthId, NumConstant.ONE); + List partyActiveIssueVote = issueExtractService.selectPartyActiveIssueVote(customerId, monthId, NumConstant.ONE); + partyActiveList.addAll(partyActiveIssueVote); + if (!CollectionUtils.isEmpty(partyActiveList)){ + Map> collectMap = massActiveList.stream().collect(Collectors.groupingBy(PartyActiveResultDTO::getGridId)); + collectMap.forEach((gridId, partyActive) -> { + List userIds = partyActive.stream().map(party -> party.getUserId()).distinct().collect(Collectors.toList()); + gridPartyActiveMap.put(gridId, userIds.size()); + }); + } + String quarterId = DateUtils.getQuarterId(monthId); String yearId = DateUtils.getYearId(monthId); result.forEach(r -> { @@ -158,6 +185,22 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { } }); } + // 9. 网格活跃群众用户数 + if (null != gridMassActiveMap){ + gridMassActiveMap.forEach((k,v) -> { + if (r.getGridId().equals(k)){ + r.setActiveUserCount(v); + } + }); + } + // 10. 网格活跃党员用户数 + if (null != gridPartyActiveMap){ + gridPartyActiveMap.forEach((k,v) -> { + if (r.getGridId().equals(k)){ + r.setActivePartyCount(v); + } + }); + } }); delAndInsertPartyAbility(result,customerId,monthId); return true; @@ -323,7 +366,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { } /** - * @Description 小数四舍五入 + * @Description 小数四舍五入【保留六位小数】 * @param d * @author zxc * @date 2020/9/18 2:01 下午 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java index d1f1ed681a..e2f4b39e16 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java @@ -21,6 +21,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.extract.FactOriginTopicLogDailyDao; +import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; import com.epmet.service.evaluationindex.extract.FactOriginTopicLogDailyService; import org.springframework.stereotype.Service; @@ -96,4 +97,17 @@ public class FactOriginTopicLogDailyServiceImpl extends BaseServiceImpl selectPartyActiveTopic(String customerId, String monthId, Integer isParty) { + return baseDao.selectPartyActiveTopic(customerId, monthId, isParty); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java index 78bb8a187c..2c6414b910 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java @@ -324,4 +324,17 @@ public class IssueExtractServiceImpl implements IssueExtractService { public Integer selectIssueTotalTwoMonth(List topicIdList) { return issueMainDailyDao.selectIssueTotalTwoMonth(topicIdList); } + + /** + * @Description 查询 议题表决【党员/群众】 + * @param customerId + * @param monthId + * @param isParty + * @author zxc + * @date 2020/9/21 9:37 上午 + */ + @Override + public List selectPartyActiveIssueVote(String customerId, String monthId, Integer isParty) { + return issueLogDailyDao.selectPartyActiveIssueVote(customerId, monthId, isParty); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 862f0488c5..1f62f10256 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -78,4 +78,17 @@ T1.ACTION_CODE = 'vote_support' OR T1.ACTION_CODE = 'vote_opposition') + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml index 848a0d733a..bbb25ff3ae 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml @@ -128,4 +128,17 @@ T1.GROUP_ID =#{groupId} + + + \ No newline at end of file