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 594042091f..8093d38d03 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 @@ -9,10 +9,7 @@ import com.epmet.constant.ExtractConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.constant.ProjectEvaluateConstant; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; -import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao; -import com.epmet.dao.heart.ActInfoDao; import com.epmet.dao.partymember.PartyMemberDao; -import com.epmet.dao.user.UserDao; import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; import com.epmet.dto.extract.form.GridIssueCountResultDTO; import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; @@ -21,8 +18,12 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMont import com.epmet.service.evaluationindex.extract.*; import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyService; +import com.epmet.service.heart.ActInfoService; +import com.epmet.service.partymember.PartyMemberService; import com.epmet.service.stats.FactArticlePublishedGridDailyService; import com.epmet.service.stats.user.FactRegUserGridMonthlyService; +import com.epmet.service.user.UserService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -77,13 +78,13 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { @Autowired private FactIndexServiceAbilityGridMonthlyService factIndexServiceAbilityGridMonthlyService; @Autowired - private FactIndexServiceAblityGridMonthlyDao factIndexServiceAblityGridMonthlyDao; + private FactIndexServiceAblityGridMonthlyService factIndexServiceAblityGridMonthlyService; @Autowired - private ActInfoDao actInfoDao; + private ActInfoService actInfoService; @Autowired - private UserDao userDao; + private UserService userService; @Autowired - private PartyMemberDao partyMemberDao; + private PartyMemberService partyMemberService; /** * @Description 计算网格指标党建能力 @@ -408,8 +409,8 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { } String quarterId= DateUtils.getQuarterId(monthId); String yearId=DateUtils.getYearId(monthId); - //各个网格这个月举办的活动 - Map activityCountMap=calActivityCountMap(customerId,monthId); + //各个网格这个月举办的活动 :活动状态已结束并且实际结束时间在评价周期内的 + Map activityCountMap=actInfoService.calActivityCountMap(customerId,monthId); //2、遍历网格,赋值每个网格指标 for(FactIndexServiceAblityGridMonthlyEntity entity:entityList){ entity.setMonthId(monthId); @@ -425,13 +426,13 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { numberFormat.setMaximumFractionDigits(NumConstant.SIX); //网格志愿者占比 : 所有注册用户中,注册了志愿者的用户占比 //(1)网格内的注册用户有哪些? - List regUserIds=this.getGridRegUserIds(customerId,entity.getGridId()); + List regUserIds=userService.getGridRegUserIds(customerId,entity.getGridId()); if(CollectionUtils.isEmpty(regUserIds)){ log.info(String.format("当前网格%s下没有注册用户,所以【网格志愿者占比】volunteerRatio赋值0",entity.getGridId())); entity.setVolunteerRatio(BigDecimal.ZERO); }else{ //(2)网格内注册用户中,那些人注册了志愿者? - volunteerUserIds=this.getGridRegUserVolunteer(regUserIds); + volunteerUserIds=actInfoService.getGridRegUserVolunteer(regUserIds); if(CollectionUtils.isEmpty(volunteerUserIds)){ log.info(String.format("当前网格%s下注册用户%s个,其中志愿者为0个,所以【网格志愿者占比】volunteerRatio赋值0",entity.getGridId(),regUserIds.size())); entity.setVolunteerRatio(BigDecimal.ZERO); @@ -448,7 +449,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { log.info(String.format("当前网格%s下志愿者人数0个,所以【网格党员志愿者率】partyVolunteerRatio赋值为0",entity.getGridId())); entity.setPartyVolunteerRatio(BigDecimal.ZERO); }else{ - List paryUserIds=this.getVolunteerPartyUserIds(volunteerUserIds); + List paryUserIds=partyMemberService.getVolunteerPartyUserIds(volunteerUserIds); if(CollectionUtils.isEmpty(paryUserIds)){ log.info(String.format("当前网格%s下志愿者%s个,同时是党员的0个,所以【网格党员志愿者率】partyVolunteerRatio赋值为0",entity.getGridId(),volunteerUserIds.size())); entity.setPartyVolunteerRatio(BigDecimal.ZERO); @@ -463,7 +464,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { } //3、批量删 - deleteBatchIndexServiceAblityGridMonthly(customerId,monthId); + factIndexServiceAblityGridMonthlyService.deleteBatchIndexServiceAblityGridMonthly(customerId,monthId); //4、批量增 List> partition = ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE); partition.forEach(list -> { @@ -482,78 +483,6 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { System.out.println(partyVolunteerRatio); }*/ - /** - * @return java.util.List - * @param customerId - * @param gridId - * @author yinzuomei - * @description 查询当前网格下,首次注册的用户ids - * @Date 2020/9/21 13:44 - **/ - @DataSource(DataSourceConstant.EPMET_USER) - private List getGridRegUserIds(String customerId, String gridId) { - return userDao.selectGridRegUserIds(customerId,gridId); - } - - /** - * @return java.util.List - * @param regUserIds - * @author yinzuomei - * @description 根据userId,查询用户是否是志愿者,返回是志愿者的用户集合 - * @Date 2020/9/21 13:50 - **/ - @DataSource(DataSourceConstant.EPMET_HEART) - private List getGridRegUserVolunteer(List regUserIds) { - return actInfoDao.selectGridRegUserVolunteer(regUserIds); - } - - /** - * @return java.util.List - * @param volunteerUserIds - * @author yinzuomei - * @description 志愿者中,同时是党员的人数 - * @Date 2020/9/21 14:10 - **/ - @DataSource(DataSourceConstant.PARTY_MEMBER) - private List getVolunteerPartyUserIds(List volunteerUserIds) { - return partyMemberDao.selectVolunteerPartyUserIds(volunteerUserIds); - } - - /** - * @return java.util.Map - * @param customerId - * @param monthId - * @author yinzuomei - * @description 网格活动组织次数 爱心活动 值得是: 活动状态已结束并且实际结束时间在评价周期内的 - * @Date 2020/9/21 10:23 - **/ - @DataSource(DataSourceConstant.EPMET_HEART) - private Map calActivityCountMap(String customerId, String monthId) { - List> mapList = actInfoDao.selectActGroupByGridId(customerId, monthId); - Map resultMap = new HashMap<>(); - for (Map map : mapList) { - for (Map.Entry m : map.entrySet()) { - resultMap.put(m.getKey(), m.getValue()); - } - } - return resultMap; - } - - /** - * @return void - * @param customerId - * @param monthId - * @author yinzuomei - * @description 批量删除网格相关-服务能力指标表 - * @Date 2020/9/21 10:16 - **/ - @DataSource(DataSourceConstant.EVALUATION_INDEX) - private void deleteBatchIndexServiceAblityGridMonthly(String customerId, String monthId) { - int deleteNum; - do { - deleteNum = factIndexServiceAblityGridMonthlyDao.deleteFactIndexServiceAblityGridMonthly(customerId, monthId); - } while (deleteNum > NumConstant.ZERO); - } /** * @param list diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyService.java new file mode 100644 index 0000000000..4075ff2725 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyService.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.indexcoll; + + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity; + + +/** + * 服务能力-网格相关事实表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-21 + */ +public interface FactIndexServiceAblityGridMonthlyService extends BaseService { + /** + * @return void + * @param customerId + * @param monthId + * @author yinzuomei + * @description 批量删除网格相关-服务能力指标表 + * @Date 2020/9/21 16:38 + **/ + void deleteBatchIndexServiceAblityGridMonthly(String customerId, String monthId); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexServiceAblityGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexServiceAblityGridMonthlyServiceImpl.java new file mode 100644 index 0000000000..e9eb00a255 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexServiceAblityGridMonthlyServiceImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.indexcoll.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity; +import com.epmet.service.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyService; +import org.springframework.stereotype.Service; + +/** + * 服务能力-网格相关事实表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-21 + */ +@Service +public class FactIndexServiceAblityGridMonthlyServiceImpl extends BaseServiceImpl implements FactIndexServiceAblityGridMonthlyService { + + /** + * @return void + * @param customerId + * @param monthId + * @author yinzuomei + * @description 批量删除网格相关-服务能力指标表 + * @Date 2020/9/21 10:16 + **/ + @Override + @DataSource(DataSourceConstant.EVALUATION_INDEX) + public void deleteBatchIndexServiceAblityGridMonthly(String customerId, String monthId) { + int deleteNum; + do { + deleteNum = baseDao.deleteFactIndexServiceAblityGridMonthly(customerId, monthId); + } while (deleteNum > NumConstant.ZERO); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java new file mode 100644 index 0000000000..4caa64828f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java @@ -0,0 +1,31 @@ +package com.epmet.service.heart; + +import java.util.List; +import java.util.Map; + +/** + * 活动信息 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/21 16:39 + */ +public interface ActInfoService { + /** + * @return java.util.List + * @param regUserIds + * @author yinzuomei + * @description 根据userId,查询用户是否是志愿者,返回是志愿者的用户集合 + * @Date 2020/9/21 16:41 + **/ + List getGridRegUserVolunteer(List regUserIds); + + /** + * @return java.util.Map + * @param customerId + * @param monthId + * @author yinzuomei + * @description 网格活动组织次数 爱心活动 值得是: 活动状态已结束并且实际结束时间在评价周期内的 + * @Date 2020/9/21 16:43 + **/ + Map calActivityCountMap(String customerId, String monthId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java new file mode 100644 index 0000000000..f56ecc918c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java @@ -0,0 +1,61 @@ +package com.epmet.service.heart.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.heart.ActInfoDao; +import com.epmet.service.heart.ActInfoService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 活动信息 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/21 16:40 + */ +@Slf4j +@Service +@DataSource(DataSourceConstant.EPMET_HEART) +public class ActInfoServiceImpl implements ActInfoService { + @Autowired + private ActInfoDao baseDao; + + /** + * @return java.util.List + * @param regUserIds + * @author yinzuomei + * @description 根据userId,查询用户是否是志愿者,返回是志愿者的用户集合 + * @Date 2020/9/21 13:50 + **/ + @Override + @DataSource(DataSourceConstant.EPMET_HEART) + public List getGridRegUserVolunteer(List regUserIds) { + return baseDao.selectGridRegUserVolunteer(regUserIds); + } + + /** + * @return java.util.Map + * @param customerId + * @param monthId + * @author yinzuomei + * @description 网格活动组织次数 爱心活动 值得是: 活动状态已结束并且实际结束时间在评价周期内的 + * @Date 2020/9/21 10:23 + **/ + @Override + @DataSource(DataSourceConstant.EPMET_HEART) + public Map calActivityCountMap(String customerId, String monthId) { + List> mapList = baseDao.selectActGroupByGridId(customerId, monthId); + Map resultMap = new HashMap<>(); + for (Map map : mapList) { + for (Map.Entry m : map.entrySet()) { + resultMap.put(m.getKey(), m.getValue()); + } + } + return resultMap; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/PartyMemberService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/PartyMemberService.java index aefae23621..df2dd2741e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/PartyMemberService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/PartyMemberService.java @@ -29,4 +29,12 @@ public interface PartyMemberService { */ List getPartyMemberByCustomer(String customerId); + /** + * @return java.util.List + * @param volunteerUserIds + * @author yinzuomei + * @description 志愿者中,同时是党员的人数 + * @Date 2020/9/21 16:46 + **/ + List getVolunteerPartyUserIds(List volunteerUserIds); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/impl/PartyMemberServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/impl/PartyMemberServiceImpl.java index 90f3cff949..88fd54bcc4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/impl/PartyMemberServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/impl/PartyMemberServiceImpl.java @@ -41,4 +41,16 @@ public class PartyMemberServiceImpl implements PartyMemberService { return partyMemberDao.selectPartyMemberByCustomer(customerId); } + /** + * @return java.util.List + * @param volunteerUserIds + * @author yinzuomei + * @description 志愿者中,同时是党员的人数 + * @Date 2020/9/21 14:10 + **/ + @Override + @DataSource(DataSourceConstant.PARTY_MEMBER) + public List getVolunteerPartyUserIds(List volunteerUserIds) { + return partyMemberDao.selectVolunteerPartyUserIds(volunteerUserIds); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 0203780cc8..29521f2f2c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -55,4 +55,14 @@ public interface UserService { * @date 2020.09.20 15:01 **/ List getWarmHeartedByCustomerId(String customerId); + + /** + * @return java.util.List + * @param customerId + * @param gridId + * @author yinzuomei + * @description 查询当前网格下,首次注册的用户ids + * @Date 2020/9/21 16:44 + **/ + List getGridRegUserIds(String customerId, String gridId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 5a8aa7b3f2..12616b584c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -719,4 +719,20 @@ public class UserServiceImpl implements UserService { System.out.println(format.format(calendar.getTime())); System.out.println(format2.format(calendar.getTime())); } + + + /** + * @return java.util.List + * @param customerId + * @param gridId + * @author yinzuomei + * @description 查询当前网格下,首次注册的用户ids + * @Date 2020/9/21 13:44 + **/ + @Override + @DataSource(DataSourceConstant.EPMET_USER) + public List getGridRegUserIds(String customerId, String gridId) { + return userDao.selectGridRegUserIds(customerId,gridId); + } + }