|
|
@ -1,13 +1,20 @@ |
|
|
|
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.constant.IndexCalConstant; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.toscreen.PioneerDataExtractService; |
|
|
|
import com.epmet.service.evaluationindex.screen.ScreenPioneerDataService; |
|
|
|
import com.epmet.service.stats.DimCustomerPartymemberService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -20,24 +27,14 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ScreenPioneerDataService screenPioneerDataService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
|
* @param dateId |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 总方法入口 |
|
|
|
* @Date 2020/9/22 14:17 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void extractPioneerData(String customerId, String dateId) { |
|
|
|
extractGridPioneerData(customerId, dateId); |
|
|
|
extractCommunityPioneerData(customerId, dateId); |
|
|
|
extractStreetPioneerData(customerId, dateId); |
|
|
|
extractDistrictPioneerData(customerId, dateId); |
|
|
|
extractCityPioneerData(customerId, dateId); |
|
|
|
extractProvincePioneerData(customerId, dateId); |
|
|
|
} |
|
|
|
@Autowired |
|
|
|
private FactOriginTopicMainDailyService factOriginTopicMainDailyService; |
|
|
|
@Autowired |
|
|
|
private DimCustomerPartymemberService dimCustomerPartymemberService; |
|
|
|
@Autowired |
|
|
|
private FactOriginIssueMainDailyService factOriginIssueMainDailyService; |
|
|
|
@Autowired |
|
|
|
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
@ -50,17 +47,146 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
@Override |
|
|
|
public void extractGridPioneerData(String customerId, String dateId) { |
|
|
|
//查询客户下所有的网格,初始数据值为0
|
|
|
|
List<ScreenPioneerDataEntity> gridList=screenPioneerDataService.initPioneerDataList(customerId,"grid", StrConstant.EPMETY_STR); |
|
|
|
if(CollectionUtils.isEmpty(gridList)){ |
|
|
|
List<ScreenPioneerDataEntity> gridList = screenPioneerDataService.initPioneerDataList(customerId, "grid", StrConstant.EPMETY_STR); |
|
|
|
if (CollectionUtils.isEmpty(gridList)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
gridList.forEach(entity->{ |
|
|
|
gridList.forEach(entity -> { |
|
|
|
entity.setDataEndTime(dateId); |
|
|
|
|
|
|
|
String gridId = entity.getOrgId(); |
|
|
|
//1、党员参与议事 todo
|
|
|
|
entity.setIssueTotal(NumConstant.ZERO); |
|
|
|
//2、党员参与议事占比 todo
|
|
|
|
entity.setIssueRatio(BigDecimal.ZERO); |
|
|
|
|
|
|
|
|
|
|
|
//网格内的党员集合
|
|
|
|
List<String> partyMemberUserIds = dimCustomerPartymemberService.getPartyMemberUserIds(customerId, gridId); |
|
|
|
|
|
|
|
|
|
|
|
//3、党员发布话题:
|
|
|
|
entity.setTopicTotal(getTopicTotal(customerId, partyMemberUserIds)); |
|
|
|
//4、党员发布话题占比: 网格内注册党员发布的话题总数占 网格内话题总数的 比率
|
|
|
|
if (entity.getTopicTotal() == NumConstant.ZERO) { |
|
|
|
entity.setTopicRatio(BigDecimal.ZERO); |
|
|
|
} else { |
|
|
|
//当前网格内所有话题总数
|
|
|
|
int gridTopicTotal = getGridTopicTotal(customerId, gridId); |
|
|
|
entity.setTopicRatio(gridTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / gridTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
//当前网格内所有议题总数
|
|
|
|
int gridIssueTotal = getGridIssueTotal(customerId, gridId); |
|
|
|
if (gridIssueTotal != NumConstant.ZERO) { |
|
|
|
//5、党员发布议题
|
|
|
|
entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, partyMemberUserIds)); |
|
|
|
//6、党员发布议题占比 : 占网格内所有议题的比率
|
|
|
|
if (entity.getPublishIssueTotal() == NumConstant.ZERO) { |
|
|
|
entity.setPublishIssueRatio(BigDecimal.ZERO); |
|
|
|
} |
|
|
|
entity.setPublishIssueRatio(gridIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
|
|
|
|
//7、议题转项目数
|
|
|
|
entity.setShiftProjectTotal(getGridShiftProjectTotal(customerId, gridId)); |
|
|
|
//8、议题转项目占比 : 占网格内议题总数的比率
|
|
|
|
entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 9、已解决项目
|
|
|
|
entity.setResolvedProjectTotal(getGridClosedProjectTotal(customerId,gridId,"resolved")); |
|
|
|
if(entity.getResolvedProjectTotal()==NumConstant.ZERO){ |
|
|
|
entity.setResolvedProjectRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
// 10、占总结项目
|
|
|
|
int closedProjectTotal=getGridClosedProjectTotal(customerId,gridId,null); |
|
|
|
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", dateId, IndexCalConstant.DELETE_SIZE, gridList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return java.lang.Integer |
|
|
|
* @param customerId |
|
|
|
* @param gridId |
|
|
|
* @param closedStatus 结案状态:已解决 resolved,未解决 unresolved |
|
|
|
* @author yinzuomei |
|
|
|
* @description 网格内已解决项目 |
|
|
|
* @Date 2020/9/23 16:24 |
|
|
|
**/ |
|
|
|
private Integer getGridClosedProjectTotal(String customerId, String gridId,String closedStatus) { |
|
|
|
return factOriginProjectMainDailyService.getGridClosedProjectTotal(customerId,gridId,closedStatus); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
|
* @param partyMemberUserIds |
|
|
|
* @return int |
|
|
|
* @author yinzuomei |
|
|
|
* @description 党员发布的话题总数 |
|
|
|
* @Date 2020/9/23 13:44 |
|
|
|
**/ |
|
|
|
private int getTopicTotal(String customerId, List<String> partyMemberUserIds) { |
|
|
|
if (CollectionUtils.isEmpty(partyMemberUserIds)) { |
|
|
|
//如果网格内没有党员,直接返回0
|
|
|
|
return NumConstant.ZERO; |
|
|
|
} |
|
|
|
return factOriginTopicMainDailyService.calPublishedByPartyTopicCount(customerId, partyMemberUserIds); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
|
* @param gridId |
|
|
|
* @return int |
|
|
|
* @author yinzuomei |
|
|
|
* @description 当前网格内,发布的话题总数 |
|
|
|
* @Date 2020/9/23 14:18 |
|
|
|
**/ |
|
|
|
private int getGridTopicTotal(String customerId, String gridId) { |
|
|
|
return factOriginTopicMainDailyService.calGridTopicTotalByGrid(customerId, gridId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
|
* @param partyMemberUserIds |
|
|
|
* @return java.lang.Integer |
|
|
|
* @author yinzuomei |
|
|
|
* @description 党员发布的议题总数 |
|
|
|
* @Date 2020/9/23 14:39 |
|
|
|
**/ |
|
|
|
private int getParyPublishIssueTotal(String customerId, List<String> partyMemberUserIds) { |
|
|
|
if (CollectionUtils.isEmpty(partyMemberUserIds)) { |
|
|
|
return NumConstant.ZERO; |
|
|
|
} |
|
|
|
return factOriginIssueMainDailyService.getParyPublishIssueTotal(customerId, partyMemberUserIds); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
|
* @param gridId |
|
|
|
* @return int |
|
|
|
* @author yinzuomei |
|
|
|
* @description 当前网格内所有议题总数 |
|
|
|
* @Date 2020/9/23 15:21 |
|
|
|
**/ |
|
|
|
private int getGridIssueTotal(String customerId, String gridId) { |
|
|
|
return factOriginIssueMainDailyService.getGridIssueTotalByGrid(customerId, gridId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
|
* @param gridId |
|
|
|
* @return java.lang.Integer |
|
|
|
* @author yinzuomei |
|
|
|
* @description 网格内议题转项目数 |
|
|
|
* @Date 2020/9/23 15:38 |
|
|
|
**/ |
|
|
|
private Integer getGridShiftProjectTotal(String customerId, String gridId) { |
|
|
|
return factOriginIssueMainDailyService.getShiftProjectTotalByGrid(customerId, gridId); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void extractCommunityPioneerData(String customerId, String dateId) { |
|
|
|
|
|
|
|