Browse Source

先进模范数据抽取到大屏表screen_pioneer_dataV0.5 louti

master
yinzuomei 5 years ago
parent
commit
d6831e5815
  1. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java
  2. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java
  3. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPioneerDataDao.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java
  8. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginTopicMainDailyServiceImpl.java
  9. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PioneerDataExtractService.java
  10. 189
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java
  11. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  12. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPioneerDataService.java
  13. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java
  14. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java
  15. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java
  16. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml
  17. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml
  18. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml
  19. 10
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java

@ -128,7 +128,10 @@ public interface FactOriginIssueMainDailyDao extends BaseDao<FactOriginIssueMain
* @description 根据党员ids, 查询党员发布议题数 * @description 根据党员ids, 查询党员发布议题数
* @Date 2020/9/23 15:13 * @Date 2020/9/23 15:13
**/ **/
int getParyPublishIssueTotal(@Param("customerId") String customerId, @Param("list")List<String> partyMemberUserIds); int getParyPublishIssueTotal(@Param("customerId") String customerId,
@Param("list")List<String> partyMemberUserIds,
@Param("gridId")String gridId,
@Param("agencyId")String agencyId);
/** /**
* @param customerId * @param customerId

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java

@ -85,7 +85,10 @@ public interface FactOriginTopicMainDailyDao extends BaseDao<FactOriginTopicMain
* @description 党员提出的话题总数 * @description 党员提出的话题总数
* @Date 2020/9/23 13:46 * @Date 2020/9/23 13:46
**/ **/
int selectPublishedByPartyTopicCount(@Param("customerId") String customerId, @Param("list") List<String> partyMemberUserIds); int selectPublishedByPartyTopicCount(@Param("customerId") String customerId,
@Param("list") List<String> partyMemberUserIds,
@Param("gridId")String gridId,
@Param("agencyId")String agencyId);
/** /**
* @param customerId * @param customerId

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPioneerDataDao.java

@ -34,9 +34,6 @@ import java.util.List;
@Mapper @Mapper
public interface ScreenPioneerDataDao extends BaseDao<ScreenPioneerDataEntity> { public interface ScreenPioneerDataDao extends BaseDao<ScreenPioneerDataEntity> {
Integer deletePioneerDataByCustomerId(@Param("customerId") String customerId,
@Param("deleteSize") Integer deleteSize);
/** /**
* 10党建引领-先锋模范数据 * 10党建引领-先锋模范数据
* 1) 根据CUSTOMER_ID进行查询如果有数据则先进行物理删除, 一次删除1000条 * 1) 根据CUSTOMER_ID进行查询如果有数据则先进行物理删除, 一次删除1000条
@ -46,9 +43,22 @@ public interface ScreenPioneerDataDao extends BaseDao<ScreenPioneerDataEntity> {
* @Author zhangyong * @Author zhangyong
* @Date 10:52 2020-08-18 * @Date 10:52 2020-08-18
**/ **/
Integer deletePioneerDataByCustomerId(@Param("customerId") String customerId,
@Param("deleteSize") Integer deleteSize);
/**
* @return java.lang.Integer
* @param customerId
* @param orgType
* @param deleteSize
* @param orgIds
* @author yinzuomei
* @description 产品客户采集用删除方法
* @Date 2020/9/24 14:59
**/
Integer deletePioneerData(@Param("customerId") String customerId, Integer deletePioneerData(@Param("customerId") String customerId,
@Param("orgType") String orgType, @Param("orgType") String orgType,
@Param("dataEndTime")String dataEndTime,
@Param("deleteSize") Integer deleteSize, @Param("deleteSize") Integer deleteSize,
@Param("orgIds")List<String> orgIds); @Param("orgIds")List<String> orgIds);

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java

@ -90,4 +90,14 @@ public interface DimCustomerPartymemberDao extends BaseDao<DimCustomerPartymembe
* @Date 2020/9/24 10:22 * @Date 2020/9/24 10:22
**/ **/
List<String> selectCommunityPartyMemberUserIds(@Param("customerId") String customerId, @Param("communityId")String communityId); List<String> selectCommunityPartyMemberUserIds(@Param("customerId") String customerId, @Param("communityId")String communityId);
/**
* @return java.util.List<java.lang.String>
* @param customerId
* @param pids
* @author yinzuomei
* @description 根据pids查询党员
* @Date 2020/9/24 14:31
**/
List<String> selectPartyMemberUserIdsByPids(@Param("customerId") String customerId, @Param("pids")String pids);
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java

@ -38,7 +38,7 @@ public interface FactOriginIssueMainDailyService extends BaseService<FactOriginI
* @description 根据党员ids,查询党员发布议题数 * @description 根据党员ids,查询党员发布议题数
* @Date 2020/9/23 15:11 * @Date 2020/9/23 15:11
**/ **/
int getParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds); int getParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds,String gridId,String agencyId);
/** /**
* @return java.lang.Integer * @return java.lang.Integer

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginTopicMainDailyService.java

@ -70,7 +70,7 @@ public interface FactOriginTopicMainDailyService extends BaseService<FactOriginT
* @description 党员提出的话题总数 * @description 党员提出的话题总数
* @Date 2020/9/23 13:36 * @Date 2020/9/23 13:36
**/ **/
int calPublishedByPartyTopicCount(String customerId,List<String> partyMemberUserIds); int calPublishedByPartyTopicCount(String customerId,List<String> partyMemberUserIds,String gridId,String agencyId);
/** /**
* @return int * @return int
* @param customerId * @param customerId

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

@ -51,11 +51,11 @@ public class FactOriginIssueMainDailyServiceImpl extends BaseServiceImpl<FactOri
* @Date 2020/9/23 15:11 * @Date 2020/9/23 15:11
**/ **/
@Override @Override
public int getParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds) { public int getParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds,String gridId,String agencyId) {
if(CollectionUtils.isEmpty(partyMemberUserIds)){ if(CollectionUtils.isEmpty(partyMemberUserIds)){
return NumConstant.ZERO; return NumConstant.ZERO;
} }
return baseDao.getParyPublishIssueTotal(customerId,partyMemberUserIds); return baseDao.getParyPublishIssueTotal(customerId,partyMemberUserIds,gridId,agencyId);
} }
/** /**

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

@ -284,11 +284,11 @@ public class FactOriginTopicMainDailyServiceImpl extends BaseServiceImpl<FactOri
* @Date 2020/9/23 13:36 * @Date 2020/9/23 13:36
**/ **/
@Override @Override
public int calPublishedByPartyTopicCount(String customerId,List<String> partyMemberUserIds) { public int calPublishedByPartyTopicCount(String customerId,List<String> partyMemberUserIds,String gridId,String agencyId) {
if(CollectionUtils.isEmpty(partyMemberUserIds)){ if(CollectionUtils.isEmpty(partyMemberUserIds)){
return NumConstant.ZERO; return NumConstant.ZERO;
} }
return baseDao.selectPublishedByPartyTopicCount(customerId,partyMemberUserIds); return baseDao.selectPublishedByPartyTopicCount(customerId,partyMemberUserIds,gridId,agencyId);
} }
/** /**

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

@ -26,9 +26,5 @@ public interface PioneerDataExtractService {
// 社区、街道、区县、市级别、省级 // 社区、街道、区县、市级别、省级
void extractCommunityPioneerData(String customerId, String dateId); void extractCommunityPioneerData(String customerId, String dateId);
void extractexceptCommunityPioneerData(String customerId, String dateId); void extractExceptCommunityPioneerData(String customerId, String dateId);
/*void extractStreetPioneerData(String customerId, String dateId);
void extractDistrictPioneerData(String customerId, String dateId);
void extractCityPioneerData(String customerId, String dateId);
void extractProvincePioneerData(String customerId, String dateId);*/
} }

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

@ -13,6 +13,7 @@ import com.epmet.service.stats.DimCustomerPartymemberService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
@ -49,7 +50,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
@Override @Override
public void extractGridPioneerData(String customerId, String dateId) { public void extractGridPioneerData(String customerId, String dateId) {
//查询客户下所有的网格,初始数据值为0 //查询客户下所有的网格,初始数据值为0
List<ScreenPioneerDataEntity> gridList = screenPioneerDataService.initPioneerDataList(customerId, "grid", StrConstant.EPMETY_STR); List<ScreenPioneerDataEntity> gridList = screenPioneerDataService.initPioneerDataList(customerId, "grid");
if (CollectionUtils.isEmpty(gridList)) { if (CollectionUtils.isEmpty(gridList)) {
return; return;
} }
@ -63,25 +64,25 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
//网格内的党员集合 //网格内的党员集合
List<String> partyMemberUserIds = dimCustomerPartymemberService.getPartyMemberUserIds(customerId, "grid",gridId); List<String> partyMemberUserIds = dimCustomerPartymemberService.getPartyMemberUserIds(customerId, "grid", gridId);
//3、党员发布话题: //3、党员发布话题:
entity.setTopicTotal(getTopicTotal(customerId, partyMemberUserIds)); entity.setTopicTotal(getTopicTotal(customerId, partyMemberUserIds, gridId, null));
//4、党员发布话题占比: 网格内注册党员发布的话题总数占 网格内话题总数的 比率 //4、党员发布话题占比: 网格内注册党员发布的话题总数占 网格内话题总数的 比率
if (entity.getTopicTotal() == NumConstant.ZERO) { if (entity.getTopicTotal() == NumConstant.ZERO) {
entity.setTopicRatio(BigDecimal.ZERO); entity.setTopicRatio(BigDecimal.ZERO);
} else { } else {
//当前网格内所有话题总数 //当前网格内所有话题总数
int gridTopicTotal = getGridOrCommunityTopicTotal(customerId, gridId,null); int gridTopicTotal = getGridOrCommunityTopicTotal(customerId, gridId, null);
entity.setTopicRatio(gridTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / gridTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setTopicRatio(gridTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / gridTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
} }
//当前网格内所有议题总数 //当前网格内所有议题总数
int gridIssueTotal = getGridOrCommunityIssueTotal(customerId, gridId,null); int gridIssueTotal = getGridOrCommunityIssueTotal(customerId, gridId, null);
if (gridIssueTotal != NumConstant.ZERO) { if (gridIssueTotal != NumConstant.ZERO) {
//5、党员发布议题 //5、党员发布议题
entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, partyMemberUserIds)); entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, partyMemberUserIds, gridId, null));
//6、党员发布议题占比 : 占网格内所有议题的比率 //6、党员发布议题占比 : 占网格内所有议题的比率
if (entity.getPublishIssueTotal() == NumConstant.ZERO) { if (entity.getPublishIssueTotal() == NumConstant.ZERO) {
entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO);
@ -89,29 +90,29 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
entity.setPublishIssueRatio(gridIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setPublishIssueRatio(gridIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
//7、议题转项目数 //7、议题转项目数
entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId,null)); entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId, null));
//8、议题转项目占比 : 占网格内议题总数的比率 //8、议题转项目占比 : 占网格内议题总数的比率
entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
} }
// 9、已解决项目 // 9、已解决项目
entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId,gridId,null,"resolved")); entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, gridId, null, "resolved"));
if(entity.getResolvedProjectTotal()==NumConstant.ZERO){ if (entity.getResolvedProjectTotal() == NumConstant.ZERO) {
entity.setResolvedProjectRatio(BigDecimal.ZERO); entity.setResolvedProjectRatio(BigDecimal.ZERO);
}else{ } else {
// 10、占总结项目 // 10、占总结项目
int closedProjectTotal=getGridOrCommunityClosedProjectTotal(customerId,gridId,null,null); int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, gridId, null, null);
entity.setResolvedProjectRatio(closedProjectTotal==NumConstant.ZERO?BigDecimal.ZERO:new BigDecimal(entity.getResolvedProjectTotal()/closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
} }
}); });
screenPioneerDataService.delAndSavePioneerData(customerId, "grid", dateId, IndexCalConstant.DELETE_SIZE, gridList); screenPioneerDataService.delAndSavePioneerData(customerId, "grid", IndexCalConstant.DELETE_SIZE, gridList);
} }
@Override @Override
public void extractCommunityPioneerData(String customerId, String dateId) { public void extractCommunityPioneerData(String customerId, String dateId) {
//查询客户下所有的社区,初始数据值为0 //查询客户下所有的社区,初始数据值为0
List<ScreenPioneerDataEntity> communityList = screenPioneerDataService.initPioneerDataList(customerId, "agency", "community"); List<ScreenPioneerDataEntity> communityList = screenPioneerDataService.initPioneerDataList(customerId, "community");
if (CollectionUtils.isEmpty(communityList)) { if (CollectionUtils.isEmpty(communityList)) {
return; return;
} }
@ -124,25 +125,25 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
entity.setIssueRatio(BigDecimal.ZERO); entity.setIssueRatio(BigDecimal.ZERO);
//社区内的党员集合 //社区内的党员集合
List<String> partyMemberUserIds = dimCustomerPartymemberService.getPartyMemberUserIds(customerId, "community",communityId); List<String> partyMemberUserIds = dimCustomerPartymemberService.getPartyMemberUserIds(customerId, "community", communityId);
//3、党员发布话题: //3、党员发布话题:
entity.setTopicTotal(getTopicTotal(customerId, partyMemberUserIds)); entity.setTopicTotal(getTopicTotal(customerId, partyMemberUserIds, null, communityId));
//4、党员发布话题占比: 网格内注册党员发布的话题总数占 网格内话题总数的 比率 //4、党员发布话题占比: 社区内注册党员发布的话题总数占 社区内话题总数的 比率
if (entity.getTopicTotal() == NumConstant.ZERO) { if (entity.getTopicTotal() == NumConstant.ZERO) {
entity.setTopicRatio(BigDecimal.ZERO); entity.setTopicRatio(BigDecimal.ZERO);
} else { } else {
//当前社区内所有话题总数 //当前社区内所有话题总数
int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null,communityId); int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null, communityId);
entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / communityTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / communityTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
} }
//当前社区内所有议题总数 //当前社区内所有议题总数
int communityIssueTotal = getGridOrCommunityIssueTotal(customerId, null,communityId); int communityIssueTotal = getGridOrCommunityIssueTotal(customerId, null, communityId);
if (communityIssueTotal != NumConstant.ZERO) { if (communityIssueTotal != NumConstant.ZERO) {
//5、党员发布议题 //5、党员发布议题
entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, partyMemberUserIds)); entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, partyMemberUserIds, null, communityId));
//6、党员发布议题占比 : 占社区内所有议题的比率 //6、党员发布议题占比 : 占社区内所有议题的比率
if (entity.getPublishIssueTotal() == NumConstant.ZERO) { if (entity.getPublishIssueTotal() == NumConstant.ZERO) {
entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO);
@ -150,42 +151,135 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
//7、议题转项目数 //7、议题转项目数
entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId,null, communityId)); entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId));
//8、议题转项目占比 : 占网格内议题总数的比率 //8、议题转项目占比 : 占社区内议题总数的比率
entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
} }
// 9、已解决项目 // 9、已解决项目
entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId,null,communityId,"resolved")); entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, null, communityId, "resolved"));
if(entity.getResolvedProjectTotal()==NumConstant.ZERO){ if (entity.getResolvedProjectTotal() == NumConstant.ZERO) {
entity.setResolvedProjectRatio(BigDecimal.ZERO); entity.setResolvedProjectRatio(BigDecimal.ZERO);
}else{ } else {
// 10、占总结项目 // 10、占总结项目
int closedProjectTotal=getGridOrCommunityClosedProjectTotal(customerId,null,communityId,null); int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null);
entity.setResolvedProjectRatio(closedProjectTotal==NumConstant.ZERO?BigDecimal.ZERO:new BigDecimal(entity.getResolvedProjectTotal()/closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
} }
}); });
screenPioneerDataService.delAndSavePioneerData(customerId, "agency", dateId, IndexCalConstant.DELETE_SIZE, communityList); screenPioneerDataService.delAndSavePioneerData(customerId, "agency", IndexCalConstant.DELETE_SIZE, communityList);
} }
@Override @Override
public void extractexceptCommunityPioneerData(String customerId, String dateId) { public void extractExceptCommunityPioneerData(String customerId, String dateId) {
//查询客户下所有的社区,初始数据值为0
List<ScreenPioneerDataEntity> agencyList = screenPioneerDataService.initPioneerDataList(customerId, "agency");
if (CollectionUtils.isEmpty(agencyList)) {
return;
}
agencyList.forEach(entity -> {
entity.setDataEndTime(dateId);
String agencyId = entity.getOrgId();
//1、党员参与议事 todo
entity.setIssueTotal(NumConstant.ZERO);
//2、党员参与议事占比 todo
entity.setIssueRatio(BigDecimal.ZERO);
if (StringUtils.isEmpty(entity.getPid()) || NumConstant.ZERO_STR.equals(entity.getPid())) {
entity.setAgencyPath(entity.getOrgId());
} else {
entity.setAgencyPath(entity.getAgencyPids().concat(StrConstant.COLON).concat(entity.getOrgId()));
}
//组织内党员集合
List<String> partyMemberUserIds = dimCustomerPartymemberService.getPartyMemberUserIds(customerId, "agency", entity.getAgencyPath());
//3、党员发布话题:
entity.setTopicTotal(getAgencyPartyTopicTotal(customerId, partyMemberUserIds, entity.getAgencyPath()));
//4、党员发布话题占比: 组织内注册党员发布的话题总数占 组织内话题总数的 比率
if (entity.getTopicTotal() == NumConstant.ZERO) {
entity.setTopicRatio(BigDecimal.ZERO);
} else {
//当前组织内所有话题总数
int agencyTopicTotal = getAgencyTopicTotal(customerId, entity.getAgencyPath());
entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / agencyTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
}
//当前组织内所有议题总数
int agencyIssueTotal = getAgencyIssueTotal(customerId, entity.getAgencyPath());
if (agencyIssueTotal != NumConstant.ZERO) {
//5、党员发布议题
entity.setPublishIssueTotal(getAgencyParyPublishIssueTotal(customerId, partyMemberUserIds, entity.getAgencyPath()));
//6、党员发布议题占比 : 占社区内所有议题的比率
if (entity.getPublishIssueTotal() == NumConstant.ZERO) {
entity.setPublishIssueRatio(BigDecimal.ZERO);
}
entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
//7、议题转项目数
entity.setShiftProjectTotal(getAgencyShiftProjectTotal(customerId, entity.getAgencyPath()));
//8、议题转项目占比 : 占网格内议题总数的比率
entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
}
// 9、已解决项目
entity.setResolvedProjectTotal(getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), "resolved"));
if (entity.getResolvedProjectTotal() == NumConstant.ZERO) {
entity.setResolvedProjectRatio(BigDecimal.ZERO);
} else {
// 10、占总结项目
int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null);
entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP));
}
});
screenPioneerDataService.delAndSavePioneerData(customerId, "agency", IndexCalConstant.DELETE_SIZE, agencyList);
}
private int getAgencyClosedProjectTotal(String customerId, String agencyPath, String resolved) {
//todo //todo
return 0;
} }
private Integer getAgencyShiftProjectTotal(String customerId, String agencyPath) {
//todo
return 0;
}
private Integer getAgencyParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds, String agencyPath) {
//todo
return 0;
}
private int getAgencyIssueTotal(String customerId, String agencyPath) {
//todo
return 0;
}
private int getAgencyTopicTotal(String customerId, String agencyPath) {
//todo
return 0;
}
private Integer getAgencyPartyTopicTotal(String customerId, List<String> partyMemberUserIds, String agencyPath) {
//todo
return 0;
}
/** /**
* @return java.lang.Integer
* @param customerId * @param customerId
* @param gridId * @param gridId
* @param communityId * @param communityId
* @param closedStatus 结案状态已解决 resolved未解决 unresolved * @param closedStatus 结案状态已解决 resolved未解决 unresolved
* @return java.lang.Integer
* @author yinzuomei * @author yinzuomei
* @description 网格内已解决项目 * @description 网格内已解决项目
* @Date 2020/9/23 16:24 * @Date 2020/9/23 16:24
**/ **/
private Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId,String communityId,String closedStatus) { private Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId, String communityId, String closedStatus) {
return factOriginProjectMainDailyService.getGridOrCommunityClosedProjectTotal(customerId,gridId,communityId,closedStatus); return factOriginProjectMainDailyService.getGridOrCommunityClosedProjectTotal(customerId, gridId, communityId, closedStatus);
} }
/** /**
@ -196,12 +290,12 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
* @description 党员发布的话题总数 * @description 党员发布的话题总数
* @Date 2020/9/23 13:44 * @Date 2020/9/23 13:44
**/ **/
private int getTopicTotal(String customerId, List<String> partyMemberUserIds) { private int getTopicTotal(String customerId, List<String> partyMemberUserIds, String gridId, String agencyId) {
if (CollectionUtils.isEmpty(partyMemberUserIds)) { if (CollectionUtils.isEmpty(partyMemberUserIds)) {
//如果网格内没有党员,直接返回0 //如果网格内没有党员,直接返回0
return NumConstant.ZERO; return NumConstant.ZERO;
} }
return factOriginTopicMainDailyService.calPublishedByPartyTopicCount(customerId, partyMemberUserIds); return factOriginTopicMainDailyService.calPublishedByPartyTopicCount(customerId, partyMemberUserIds, gridId, agencyId);
} }
/** /**
@ -212,11 +306,11 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
* @description 党员发布的议题总数 * @description 党员发布的议题总数
* @Date 2020/9/23 14:39 * @Date 2020/9/23 14:39
**/ **/
private int getParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds) { private int getParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds, String gridId, String agencyId) {
if (CollectionUtils.isEmpty(partyMemberUserIds)) { if (CollectionUtils.isEmpty(partyMemberUserIds)) {
return NumConstant.ZERO; return NumConstant.ZERO;
} }
return factOriginIssueMainDailyService.getParyPublishIssueTotal(customerId, partyMemberUserIds); return factOriginIssueMainDailyService.getParyPublishIssueTotal(customerId, partyMemberUserIds, gridId, agencyId);
} }
/** /**
@ -232,18 +326,16 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
} }
/** /**
* @return int
* @param customerId * @param customerId
* @param communityId * @param communityId
* @return int
* @author yinzuomei * @author yinzuomei
* @description * @description
* @Date 2020/9/24 10:44 * @Date 2020/9/24 10:44
**/ **/
private int getGridOrCommunityIssueTotal(String customerId, String gridId,String communityId) { private int getGridOrCommunityIssueTotal(String customerId, String gridId, String communityId) {
return factOriginIssueMainDailyService.getGridOrCommunityIssueTotal(customerId, gridId,communityId); return factOriginIssueMainDailyService.getGridOrCommunityIssueTotal(customerId, gridId, communityId);
} }
/** /**
@ -258,19 +350,4 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
return factOriginTopicMainDailyService.calGridOrCommunityTopicTotal(customerId, gridId, communityId); return factOriginTopicMainDailyService.calGridOrCommunityTopicTotal(customerId, gridId, communityId);
} }
/*@Override
public void extractStreetPioneerData(String customerId, String dateId) {
}
@Override
public void extractDistrictPioneerData(String customerId, String dateId) {
}
@Override
public void extractCityPioneerData(String customerId, String dateId) {
}
@Override
public void extractProvincePioneerData(String customerId, String dateId) {
}*/
} }

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

@ -77,9 +77,6 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId,dateId); partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId,dateId);
pioneerDataExtractService.extractGridPioneerData(customerId,dateId); pioneerDataExtractService.extractGridPioneerData(customerId,dateId);
pioneerDataExtractService.extractCommunityPioneerData(customerId,dateId); pioneerDataExtractService.extractCommunityPioneerData(customerId,dateId);
pioneerDataExtractService.extractStreetPioneerData(customerId,dateId); pioneerDataExtractService.extractExceptCommunityPioneerData(customerId,dateId);
pioneerDataExtractService.extractDistrictPioneerData(customerId,dateId);
pioneerDataExtractService.extractCityPioneerData(customerId,dateId);
pioneerDataExtractService.extractProvincePioneerData(customerId,dateId);
} }
} }

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPioneerDataService.java

@ -34,23 +34,21 @@ public interface ScreenPioneerDataService extends BaseService<ScreenPioneerDataE
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity> * @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity>
* @param customerId * @param customerId
* @param orgType grid,agency * @param orgType grid,agency
* @param agencyLevel : 机关级别社区级community 街道:street,区县级: district,市级: city 省级:province
* @author yinzuomei * @author yinzuomei
* @description 构造screen_pioneer_data 初始数据先赋值为0 * @description 构造screen_pioneer_data 初始数据先赋值为0
* @Date 2020/9/22 14:41 * @Date 2020/9/22 14:41
**/ **/
List<ScreenPioneerDataEntity> initPioneerDataList(String customerId, String orgType,String agencyLevel); List<ScreenPioneerDataEntity> initPioneerDataList(String customerId, String orgType);
/** /**
* @return void * @return void
* @param customerId * @param customerId
* @param orgType grid, agency * @param orgType grid, agency
* @param dataEndTime
* @param deleteSize * @param deleteSize
* @param entityList 待插入的数据 * @param entityList 待插入的数据
* @author yinzuomei * @author yinzuomei
* @description 保存抽取结果 * @description 保存抽取结果
* @Date 2020/9/22 15:54 * @Date 2020/9/22 15:54
**/ **/
void delAndSavePioneerData(String customerId, String orgType, String dataEndTime, Integer deleteSize, List<ScreenPioneerDataEntity> entityList); void delAndSavePioneerData(String customerId, String orgType, Integer deleteSize, List<ScreenPioneerDataEntity> entityList);
} }

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

@ -48,8 +48,7 @@ public class ScreenPioneerDataServiceImpl extends BaseServiceImpl<ScreenPioneerD
/** /**
* @param customerId * @param customerId
* @param orgType grid,agency * @param orgType grid,agency 机关级别社区级community 街道:street,区县级: district,市级: city 省级:province
* @param agencyLevel : 机关级别社区级community 街道:street,区县级: district,市级: city 省级:province
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity> * @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity>
* @author yinzuomei * @author yinzuomei
* @description 构造screen_pioneer_data 初始数据先赋值为0 * @description 构造screen_pioneer_data 初始数据先赋值为0
@ -57,12 +56,16 @@ public class ScreenPioneerDataServiceImpl extends BaseServiceImpl<ScreenPioneerD
**/ **/
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)
@Override @Override
public List<ScreenPioneerDataEntity> initPioneerDataList(String customerId, String orgType, String agencyLevel) { public List<ScreenPioneerDataEntity> initPioneerDataList(String customerId, String orgType) {
List<ScreenPioneerDataEntity> list = new ArrayList<>(); List<ScreenPioneerDataEntity> list = new ArrayList<>();
if ("grid".equals(orgType)) { if ("grid".equals(orgType)) {
//按网格构造
list = baseDao.initGridPioneerDataList(customerId); list = baseDao.initGridPioneerDataList(customerId);
} else if ("agency".equals(orgType)) { } else if ("community".equals(orgType)) {
list = baseDao.initAgencyPioneerDataList(customerId, agencyLevel); //按社构造
list = baseDao.initCommunityPioneerDataList(customerId);
}else if("agency".equals(orgType)){
list = baseDao.initExceptCommunityPioneerDataList(customerId);
} }
return list; return list;
} }
@ -71,7 +74,6 @@ public class ScreenPioneerDataServiceImpl extends BaseServiceImpl<ScreenPioneerD
/** /**
* @param customerId * @param customerId
* @param orgType grid, agency * @param orgType grid, agency
* @param dataEndTime
* @param deleteSize * @param deleteSize
* @param entityList 待插入的数据 * @param entityList 待插入的数据
* @return void * @return void
@ -82,7 +84,7 @@ public class ScreenPioneerDataServiceImpl extends BaseServiceImpl<ScreenPioneerD
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)
@Override @Override
public void delAndSavePioneerData(String customerId, String orgType, String dataEndTime, Integer deleteSize, List<ScreenPioneerDataEntity> entityList) { public void delAndSavePioneerData(String customerId, String orgType, Integer deleteSize, List<ScreenPioneerDataEntity> entityList) {
if(CollectionUtils.isEmpty(entityList)){ if(CollectionUtils.isEmpty(entityList)){
return; return;
} }
@ -92,7 +94,7 @@ public class ScreenPioneerDataServiceImpl extends BaseServiceImpl<ScreenPioneerD
} }
int deleteNum; int deleteNum;
do { do {
deleteNum = baseDao.deletePioneerData(customerId, orgType, dataEndTime, deleteSize,orgIds); deleteNum = baseDao.deletePioneerData(customerId, orgType, deleteSize,orgIds);
} while (deleteNum != NumConstant.ZERO); } while (deleteNum != NumConstant.ZERO);
List<List<ScreenPioneerDataEntity>> partition = ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE); List<List<ScreenPioneerDataEntity>> partition = ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE);

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java

@ -124,11 +124,11 @@ public interface DimCustomerPartymemberService extends BaseService<DimCustomerPa
/** /**
* @return java.util.List<java.lang.String> * @return java.util.List<java.lang.String>
* @param customerId * @param customerId
* @param gridId * @param orgId 网格id 或者社区id
* @type grid,community, agency * @type grid,community
* @author yinzuomei * @author yinzuomei
* @description 查询在本网格注册的党员id * @description 查询在本网格或者社区注册 或者 组织下 的党员id
* @Date 2020/9/23 14:18 * @Date 2020/9/23 14:18
**/ **/
List<String> getPartyMemberUserIds(String customerId, String type,String gridId); List<String> getPartyMemberUserIds(String customerId, String type,String orgId);
} }

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java

@ -212,10 +212,10 @@ public class DimCustomerPartymemberServiceImpl extends BaseServiceImpl<DimCustom
/** /**
* @param customerId * @param customerId
* @param orgId : 可能是gridId, 也可能是communityId, 也有可能是 pids * @param orgId : 可能是gridId, 也可能是communityId, 也有可能是 pids
* @param type : grid,community, agency * @param type : grid,community
* @return java.util.List<java.lang.String> * @return java.util.List<java.lang.String>
* @author yinzuomei * @author yinzuomei
* @description 查询在本网格注册的党员id * @description 查询在本网格注册的党员id或者社区下的党员 或者组织下的
* @Date 2020/9/23 14:18 * @Date 2020/9/23 14:18
**/ **/
@DataSource(value = DataSourceConstant.STATS) @DataSource(value = DataSourceConstant.STATS)
@ -226,9 +226,8 @@ public class DimCustomerPartymemberServiceImpl extends BaseServiceImpl<DimCustom
partyMemberUserIds = baseDao.selectGridPartyMemberUserIds(customerId, orgId); partyMemberUserIds = baseDao.selectGridPartyMemberUserIds(customerId, orgId);
} else if ("community".equals(type)) { } else if ("community".equals(type)) {
partyMemberUserIds = baseDao.selectCommunityPartyMemberUserIds(customerId, orgId); partyMemberUserIds = baseDao.selectCommunityPartyMemberUserIds(customerId, orgId);
} else if ("agency".equals(type)) { } else if("agency".equals(type)){
//TODO partyMemberUserIds = baseDao.selectPartyMemberUserIdsByPids(customerId, orgId);
} }
return partyMemberUserIds; return partyMemberUserIds;
} }

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml

@ -185,6 +185,12 @@
WHERE WHERE
t1.DEL_FLAG = '0' t1.DEL_FLAG = '0'
AND t1.CUSTOMER_ID = #{customerId} AND t1.CUSTOMER_ID = #{customerId}
<if test='null != gridId and ""!=gridId'>
and t1.GRID_ID=#{gridId}
</if>
<if test='null != agencyId and ""!=agencyId'>
and t1.AGENCY_ID=#{agencyId}
</if>
AND AND
<foreach collection="list" item="userId" separator="or" open="(" close=")"> <foreach collection="list" item="userId" separator="or" open="(" close=")">
t1.CREATE_TOPIC_USER_ID=#{userId} t1.CREATE_TOPIC_USER_ID=#{userId}

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml

@ -106,6 +106,12 @@
WHERE WHERE
T1.DEL_FLAG = '0' T1.DEL_FLAG = '0'
AND T1.CUSTOMER_ID = #{customerId} AND T1.CUSTOMER_ID = #{customerId}
<if test='null != gridId and "" !=gridId'>
AND T1.GRID_ID=#{gridId}
</if>
<if test='null != agencyId and "" !=agencyId'>
AND T1.AGENCY_ID=#{agencyId}
</if>
AND AND
<foreach collection="list" item="userId" separator="or" open="(" close=")"> <foreach collection="list" item="userId" separator="or" open="(" close=")">
T1.CREATE_TOPIC_USER_ID=#{userId} T1.CREATE_TOPIC_USER_ID=#{userId}

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml

@ -15,9 +15,6 @@
<if test='null != orgType and "" != orgType'> <if test='null != orgType and "" != orgType'>
and ORG_TYPE=#{orgType} and ORG_TYPE=#{orgType}
</if> </if>
<if test='null != dataEndTime and "" != dataEndTime'>
and DATA_END_TIME=#{dataEndTime}
</if>
<if test='null!=orgIds and orgIds.size()>0'> <if test='null!=orgIds and orgIds.size()>0'>
and and
( (

10
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

@ -136,4 +136,14 @@
AND dcp.CUSTOMER_ID =#{customerId} AND dcp.CUSTOMER_ID =#{customerId}
and dcp.AGENCY_ID=#{communityId} and dcp.AGENCY_ID=#{communityId}
</select> </select>
<select id="selectPartyMemberUserIdsByPids" parameterType="map" resultType="java.lang.String">
select dcp.USER_ID
FROM
dim_customer_partymember dcp
WHERE
dcp.DEL_FLAG = '0'
AND dcp.CUSTOMER_ID =#{customerId}
and dcp.PIDS LIKE CONCAT(#{pids},'%')
</select>
</mapper> </mapper>
Loading…
Cancel
Save