|
|
@ -4,11 +4,13 @@ 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.FactOriginIssueLogDailyService; |
|
|
|
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 lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
@ -24,6 +26,7 @@ import java.util.List; |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @date 2020/9/22 11:25 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class PioneerDataExtractServiceImpl implements PioneerDataExtractService { |
|
|
|
|
|
|
@ -35,6 +38,9 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
private FactOriginIssueMainDailyService factOriginIssueMainDailyService; |
|
|
|
@Autowired |
|
|
|
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|
|
|
@Autowired |
|
|
|
private FactOriginIssueLogDailyService factOriginIssueLogDailyService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
@ -54,11 +60,15 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
gridList.forEach(entity -> { |
|
|
|
entity.setDataEndTime(dateId); |
|
|
|
String gridId = entity.getOrgId(); |
|
|
|
//1、党员参与议事 todo
|
|
|
|
entity.setIssueTotal(NumConstant.ZERO); |
|
|
|
//2、党员参与议事占比 todo
|
|
|
|
entity.setIssueRatio(BigDecimal.ZERO); |
|
|
|
|
|
|
|
//1、党员参与议事
|
|
|
|
entity.setIssueTotal(calPartyPartiIssueTotal(customerId,gridId,null,null,NumConstant.ONE_STR)); |
|
|
|
if(entity.getIssueTotal()==0){ |
|
|
|
entity.setIssueRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
//2、党员参与议事占比
|
|
|
|
int issueTotal=calPartyPartiIssueTotal(customerId,gridId,null,null,null); |
|
|
|
entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
//3、党员发布话题:
|
|
|
|
entity.setTopicTotal(getTopicTotal(customerId, gridId, null)); |
|
|
@ -86,6 +96,12 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId, null)); |
|
|
|
//8、议题转项目占比 : 占网格内议题总数的比率
|
|
|
|
entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
}else{ |
|
|
|
// log.info("当前网格内所有议题总数="+gridIssueTotal);
|
|
|
|
entity.setPublishIssueTotal(NumConstant.ZERO); |
|
|
|
entity.setPublishIssueRatio(BigDecimal.ZERO); |
|
|
|
entity.setShiftProjectTotal(NumConstant.ZERO); |
|
|
|
entity.setShiftProjectRatio(BigDecimal.ZERO); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -102,6 +118,25 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
screenPioneerDataService.delAndSavePioneerData(customerId, "grid", IndexCalConstant.DELETE_SIZE, gridList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return int |
|
|
|
* @param customerId |
|
|
|
* @param gridId 网格id |
|
|
|
* @param communityId 社区的id |
|
|
|
* @param agencyPath 组织的pids包含自己 |
|
|
|
* @param isParty 1党员 |
|
|
|
* @author yinzuomei |
|
|
|
* @description |
|
|
|
* @Date 2020/9/26 17:41 |
|
|
|
**/ |
|
|
|
private int calPartyPartiIssueTotal(String customerId, |
|
|
|
String gridId, |
|
|
|
String communityId, |
|
|
|
String agencyPath, |
|
|
|
String isParty) { |
|
|
|
return factOriginIssueLogDailyService.calPartyPartiIssueTotal(customerId,gridId,communityId,agencyPath,isParty); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void extractCommunityPioneerData(String customerId, String dateId) { |
|
|
|
//查询客户下所有的社区,初始数据值为0
|
|
|
@ -112,11 +147,15 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
communityList.forEach(entity -> { |
|
|
|
entity.setDataEndTime(dateId); |
|
|
|
String communityId = entity.getOrgId(); |
|
|
|
//1、党员参与议事 todo
|
|
|
|
entity.setIssueTotal(NumConstant.ZERO); |
|
|
|
//2、党员参与议事占比 todo
|
|
|
|
entity.setIssueRatio(BigDecimal.ZERO); |
|
|
|
|
|
|
|
//1、党员参与议事
|
|
|
|
entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,communityId,null,NumConstant.ONE_STR)); |
|
|
|
if(entity.getIssueTotal()==0){ |
|
|
|
entity.setIssueRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
//2、党员参与议事占比
|
|
|
|
int issueTotal=calPartyPartiIssueTotal(customerId,null,communityId,null,null); |
|
|
|
entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
//3、党员发布话题:
|
|
|
|
entity.setTopicTotal(getTopicTotal(customerId, null, communityId)); |
|
|
@ -144,6 +183,12 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId)); |
|
|
|
//8、议题转项目占比 : 占社区内议题总数的比率
|
|
|
|
entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
}else{ |
|
|
|
// log.info("当前社区内所有议题总数="+communityIssueTotal);
|
|
|
|
entity.setPublishIssueTotal(NumConstant.ZERO); |
|
|
|
entity.setPublishIssueRatio(BigDecimal.ZERO); |
|
|
|
entity.setShiftProjectTotal(NumConstant.ZERO); |
|
|
|
entity.setShiftProjectRatio(BigDecimal.ZERO); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -170,17 +215,20 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
} |
|
|
|
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())); |
|
|
|
} |
|
|
|
|
|
|
|
//1、党员参与议事
|
|
|
|
entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),NumConstant.ONE_STR)); |
|
|
|
if(entity.getIssueTotal()==0){ |
|
|
|
entity.setIssueRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
//2、党员参与议事占比
|
|
|
|
int issueTotal=calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),null); |
|
|
|
entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
//3、党员发布话题:
|
|
|
|
entity.setTopicTotal(getAgencyTopicTotal(customerId, entity.getAgencyPath(),NumConstant.ONE_STR)); |
|
|
@ -208,6 +256,12 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService |
|
|
|
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)); |
|
|
|
}else{ |
|
|
|
// log.info("当前组织内所有议题总数="+agencyIssueTotal);
|
|
|
|
entity.setPublishIssueTotal(NumConstant.ZERO); |
|
|
|
entity.setPublishIssueRatio(BigDecimal.ZERO); |
|
|
|
entity.setShiftProjectTotal(NumConstant.ZERO); |
|
|
|
entity.setShiftProjectRatio(BigDecimal.ZERO); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|