diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index da39652186..d67cded1db 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -35,10 +35,7 @@ import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollCommunityS import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollStreetService; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; -import com.epmet.service.evaluationindex.extract.toscreen.GovernRankDataExtractService; -import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService; -import com.epmet.service.evaluationindex.extract.toscreen.PartyGuideService; -import com.epmet.service.evaluationindex.extract.toscreen.ScreenCentralZoneDataAbsorptionService; +import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerPartymemberService; @@ -655,7 +652,7 @@ public class DemoController { @PostMapping("zxczxc") public Result getZxcZxc(@RequestBody CustomerIdAndDateIdFormDTO formDTO){ - partyGuideService.partyGuideExtract(formDTO.getCustomerId(),formDTO.getDateId()); +// partyGuideService.partyGuideExtract(formDTO.getCustomerId(),formDTO.getDateId()); return new Result(); } @@ -672,4 +669,28 @@ public class DemoController { governRankDataExtractService.extractStreetData(formDTO.getCustomerId(), formDTO.getDateId()); return new Result(); } + + @Autowired + private PioneerDataExtractService pioneerDataExtractService; + + @PostMapping("insertScreenPioneerData") + public Result insertScreenPioneerData(@RequestParam("customerId") String customerId, @RequestParam("dateId") String dateId) { + if (StringUtils.isNotBlank(customerId) && StringUtils.isNotBlank(dateId)) { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } else { + QueryWrapper customerEntityQueryWrapper = new QueryWrapper<>(); + List customerEntityList = dimCustomerDao.selectList(customerEntityQueryWrapper); + for (DimCustomerEntity customerEntity : customerEntityList) { + pioneerDataExtractService.extractGridPioneerData(customerEntity.getId(), "20200926"); + pioneerDataExtractService.extractCommunityPioneerData(customerEntity.getId(), "20200926"); + pioneerDataExtractService.extractExceptCommunityPioneerData(customerEntity.getId(), "20200926"); + } + } + return new Result(); + } + + + } 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 1e4ab97477..9ac027b1fa 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 @@ -72,4 +72,21 @@ public interface FactOriginIssueLogDailyDao extends BaseDao selectPartyActiveIssueVote(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("isParty") Integer isParty); + + /** + * @return int + * @param customerId + * @param gridId + * @param communityId + * @param agencyPath + * @param isParty + * @author yinzuomei + * @description 党员参与议事:支持或者反对的次数 + * @Date 2020/9/26 18:05 + **/ + int calPartyPartiIssueTotal(@Param("customerId")String customerId, + @Param("gridId")String gridId, + @Param("communityId")String communityId, + @Param("agencyPath")String agencyPath, + @Param("isParty")String isParty); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java index 4cda82f06a..32cbbaf408 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java @@ -1,6 +1,7 @@ package com.epmet.dao.heart; import com.epmet.dto.extract.result.JoinUserCountResultDTO; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -9,6 +10,7 @@ import java.util.List; * @Author zxc * @DateTime 2020/9/25 5:21 下午 */ +@Mapper public interface ActUserRelationDao { /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index 625804fff9..671888fb14 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -28,4 +28,16 @@ import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; */ public interface FactOriginIssueLogDailyService extends BaseService { + /** + * @return int + * @param customerId + * @param gridId + * @param communityId + * @param agencyPath + * @param isParty + * @author yinzuomei + * @description 党员参与议事:支持或者反对的次数 + * @Date 2020/9/26 17:57 + **/ + int calPartyPartiIssueTotal(String customerId, String gridId, String communityId, String agencyPath, String 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/todata/impl/FactOriginIssueLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java index df81cee703..af081dfef5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java @@ -36,4 +36,19 @@ import org.springframework.stereotype.Service; public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl implements FactOriginIssueLogDailyService { + /** + * @param customerId + * @param gridId + * @param communityId + * @param agencyPath + * @param isParty + * @return int + * @author yinzuomei + * @description 党员参与议事:支持或者反对的次数 + * @Date 2020/9/26 17:57 + **/ + @Override + public int calPartyPartiIssueTotal(String customerId, String gridId, String communityId, String agencyPath, String isParty) { + return baseDao.calPartyPartiIssueTotal(customerId,gridId,communityId,agencyPath,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/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index df9d7ab3c8..c4b5964404 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -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); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 088ec91608..9c8b73e49e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -74,7 +74,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { * @date 2020/9/24 10:16 上午 */ public void extractDaily(String customerId,String dateId){ - partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId,dateId); +// partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId,dateId); pioneerDataExtractService.extractGridPioneerData(customerId,dateId); pioneerDataExtractService.extractCommunityPioneerData(customerId,dateId); pioneerDataExtractService.extractExceptCommunityPioneerData(customerId,dateId); 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 23659b879a..734f088d09 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 @@ -93,4 +93,30 @@ AND CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml index 31b2bc1772..4e6dd8a925 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml @@ -106,7 +106,7 @@ WHERE T1.DEL_FLAG = '0' AND T1.CUSTOMER_ID = #{customerId} - AND m.CREATE_TOPIC_USER_IS_PARTY='1' + AND t1.CREATE_TOPIC_USER_IS_PARTY='1' AND T1.GRID_ID=#{gridId}