diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginGroupMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginGroupMainDailyService.java new file mode 100644 index 0000000000..d534871aeb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginGroupMainDailyService.java @@ -0,0 +1,52 @@ +/** + * 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.extract; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; + +import java.util.List; + + +/** + * 业务数据抽取-小组相关 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-21 + */ +public interface FactOriginGroupMainDailyService extends BaseService { + + /** + * @return java.util.List + * @param customerId + * @param userId + * @author yinzuomei + * @description 查询当前用户建了多少个组 + * @Date 2020/9/21 16:12 + **/ + List selectGroupIds(String customerId, String userId); + + /** + * @return java.util.List + * @param groupIdList + * @author yinzuomei + * @description 根据组,查询组里面的成员(去重) + * @Date 2020/9/21 16:13 + **/ + List selectGroupMemberList(List groupIdList); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java index 4296506ab8..595580f363 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java @@ -1,14 +1,11 @@ package com.epmet.service.evaluationindex.extract.impl; -import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; -import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; -import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyDao; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import com.epmet.service.evaluationindex.extract.*; +import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyService; import com.epmet.service.stats.DimCustomerPartymemberService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -35,8 +32,6 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { @Autowired private DimCustomerPartymemberService dimCustomerPartymemberService; @Autowired - private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao; - @Autowired private FactOriginTopicMainDailyService factOriginTopicMainDailyService; @Autowired private FactOriginTopicLogDailyService factOriginTopicLogDailyService; @@ -45,7 +40,9 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { @Autowired private FactOriginProjectMainDailyService factOriginProjectMainDailyService; @Autowired - private FactOriginGroupMainDailyDao factOriginGroupMainDailyDao; + private FactIndexPartyAblityCpcMonthlyService factIndexPartyAblityCpcMonthlyService; + @Autowired + private FactOriginGroupMainDailyService factOriginGroupMainDailyService; /** * @param customerId 客户id @@ -66,7 +63,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { String quarterId= DateUtils.getQuarterId(monthId); String yearId=DateUtils.getYearId(monthId); //2、删除之前统计过的 - deleteFactIndexPartyAblityCpcMonthly(customerId, monthId); + factIndexPartyAblityCpcMonthlyService.deleteFactIndexPartyAblityCpcMonthly(customerId, monthId); //1、党员提出话题数 @@ -132,7 +129,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { //4、分批插入批量插入 List> partition = ListUtils.partition(indexPartyAblityCpcList, IndexCalConstant.INSERT_SIZE); partition.forEach(list -> { - this.saveFactIndexPartyAblityCpcMonthlyEntity(list); + factIndexPartyAblityCpcMonthlyService.saveFactIndexPartyAblityCpcMonthlyEntity(list); }); } @@ -150,7 +147,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { Map> map = new HashMap<>(); for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { //查询当前党员建了多少个组 - List groupIdList = factOriginGroupMainDailyDao.selectGroupIds(customerId, partyMember.getUserId()); + List groupIdList=factOriginGroupMainDailyService.selectGroupIds(customerId,partyMember.getUserId()); if (CollectionUtils.isEmpty(groupIdList)) { map.put(partyMember.getUserId(), new ArrayList<>()); continue; @@ -259,12 +256,14 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { //查询当前党员建了多少个组 List groupIdList = userCreatedGroups.get(partyMember.getUserId()); if (CollectionUtils.isEmpty(groupIdList)) { + log.info("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群群众人数】赋值0"); map.put(partyMember.getUserId(), NumConstant.ZERO); continue; } //去重组里面的成员 - List memberIdList = factOriginGroupMainDailyDao.selectGroupMemberList(groupIdList); + List memberIdList=factOriginGroupMainDailyService.selectGroupMemberList(groupIdList); if (CollectionUtils.isEmpty(memberIdList)) { + //memberIdList肯定不会为空,因为起码会有群主一个人 map.put(partyMember.getUserId(), NumConstant.ZERO); continue; } else { @@ -303,11 +302,12 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { //1、查询当前党员建了多少个组 List groupIdList = userCreatedGroups.get(partyMember.getUserId()); if (CollectionUtils.isEmpty(groupIdList)) { + log.info("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群活跃群众人数】赋值0"); map.put(partyMember.getUserId(), NumConstant.ZERO); continue; } //2、去重组里面的成员 - List memberIdList = factOriginGroupMainDailyDao.selectGroupMemberList(groupIdList); + List memberIdList = factOriginGroupMainDailyService.selectGroupMemberList(groupIdList); if (CollectionUtils.isEmpty(memberIdList)) { map.put(partyMember.getUserId(), NumConstant.ZERO); continue; @@ -404,32 +404,8 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { return map; } - /** - * @param customerId - * @param monthId - * @return void - * @author yinzuomei - * @description 删除这个客户这个月 党员相关-党建能力的数据 - * @Date 2020/9/18 10:20 - **/ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX) - public void deleteFactIndexPartyAblityCpcMonthly(String customerId, String monthId) { - int deleteNum; - do { - deleteNum = factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(customerId, monthId); - } while (deleteNum > NumConstant.ZERO); - } - /** - * @param list - * @return void - * @author yinzuomei - * @description 批量插入党员相关党建能力表 - * @Date 2020/9/18 10:27 - **/ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX) - private void saveFactIndexPartyAblityCpcMonthlyEntity(List list) { - factIndexPartyAblityCpcMonthlyDao.insertBatchEntity(list); - } + + } 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 04dcd9ab0b..0d89e8add8 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 @@ -421,13 +421,13 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { //(1)网格内的注册用户有哪些? List regUserIds=this.getGridRegUserIds(customerId,entity.getGridId()); if(CollectionUtils.isEmpty(regUserIds)){ - log.info(String.format("当前网格%s下没有注册用户,所以网格志愿者占比volunteerRatio赋值0",entity.getGridId())); + log.info(String.format("当前网格%s下没有注册用户,所以【网格志愿者占比】volunteerRatio赋值0",entity.getGridId())); entity.setVolunteerRatio(BigDecimal.ZERO); }else{ //(2)网格内注册用户中,那些人注册了志愿者? volunteerUserIds=this.getGridRegUserVolunteer(regUserIds); if(CollectionUtils.isEmpty(volunteerUserIds)){ - log.info(String.format("当前网格%s下注册用户%s个,其中志愿者为0个,所以网格志愿者占比volunteerRatio赋值0",entity.getGridId(),regUserIds.size())); + log.info(String.format("当前网格%s下注册用户%s个,其中志愿者为0个,所以【网格志愿者占比】volunteerRatio赋值0",entity.getGridId(),regUserIds.size())); entity.setVolunteerRatio(BigDecimal.ZERO); }else{ int volunteerTotal=volunteerUserIds.size(); @@ -439,12 +439,12 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { } //网格党员志愿者率 : 所有志愿者中,同时是党员的占比 if(CollectionUtils.isEmpty(volunteerUserIds)){ - log.info(String.format("当前网格%s下志愿者人数0个,所以网格党员志愿者率partyVolunteerRatio赋值为0",entity.getGridId())); + log.info(String.format("当前网格%s下志愿者人数0个,所以【网格党员志愿者率】partyVolunteerRatio赋值为0",entity.getGridId())); entity.setPartyVolunteerRatio(BigDecimal.ZERO); }else{ List paryUserIds=this.getVolunteerPartyUserIds(volunteerUserIds); if(CollectionUtils.isEmpty(paryUserIds)){ - log.info(String.format("当前网格%s下志愿者%s个,同时是党员的0个,所以网格党员志愿者率partyVolunteerRatio赋值为0",entity.getGridId(),volunteerUserIds.size())); + log.info(String.format("当前网格%s下志愿者%s个,同时是党员的0个,所以【网格党员志愿者率】partyVolunteerRatio赋值为0",entity.getGridId(),volunteerUserIds.size())); entity.setPartyVolunteerRatio(BigDecimal.ZERO); }else{ int volunteerCount=volunteerUserIds.size(); @@ -466,6 +466,15 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { return true; } + /*public static void main(String[] args) { + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.SIX); + int volunteerCount=7; + int partyUserCount=6; + String partyVolunteerRatioStr = numberFormat.format((float) partyUserCount / volunteerCount); + BigDecimal partyVolunteerRatio = new BigDecimal(partyVolunteerRatioStr); + System.out.println(partyVolunteerRatio); + }*/ /** * @return java.util.List diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginGroupMainDailyServiceImpl.java new file mode 100644 index 0000000000..de9d2d2a40 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginGroupMainDailyServiceImpl.java @@ -0,0 +1,65 @@ +/** + * 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.extract.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; +import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; +import com.epmet.service.evaluationindex.extract.FactOriginGroupMainDailyService; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * 业务数据抽取-小组相关 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-21 + */ +@Service +public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl implements FactOriginGroupMainDailyService { + + + /** + * @return java.util.List + * @param customerId + * @param userId + * @author yinzuomei + * @description 查询当前用户建了多少个组 + * @Date 2020/9/21 16:13 + **/ + @Override + public List selectGroupIds(String customerId, String userId) { + List groupIdList = baseDao.selectGroupIds(customerId,userId); + return groupIdList; + } + + /** + * @param groupIdList + * @return java.util.List + * @author yinzuomei + * @description 根据组,查询组里面的成员(去重) + * @Date 2020/9/21 16:13 + **/ + @Override + public List selectGroupMemberList(List groupIdList) { + List memberIdList = baseDao.selectGroupMemberList(groupIdList); + return memberIdList; + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyService.java new file mode 100644 index 0000000000..149ff64cab --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyService.java @@ -0,0 +1,51 @@ +/** + * 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.FactIndexPartyAblityCpcMonthlyEntity; + +import java.util.List; + + +/** + * 党建能力-党员相关的事实表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-21 + */ +public interface FactIndexPartyAblityCpcMonthlyService extends BaseService { + /** + * @return void + * @param customerId + * @param monthId + * @author yinzuomei + * @description 删除这个客户这个月 党员相关-党建能力的数据 + * @Date 2020/9/21 16:01 + **/ + void deleteFactIndexPartyAblityCpcMonthly(String customerId, String monthId); + + /** + * @return void + * @param list + * @author yinzuomei + * @description 批量插入党员相关党建能力表 + * @Date 2020/9/21 16:04 + **/ + void saveFactIndexPartyAblityCpcMonthlyEntity(List list); +} \ 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/FactIndexPartyAblityCpcMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityCpcMonthlyServiceImpl.java new file mode 100644 index 0000000000..78072b7bed --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityCpcMonthlyServiceImpl.java @@ -0,0 +1,70 @@ +/** + * 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.FactIndexPartyAblityCpcMonthlyDao; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; +import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyService; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * 党建能力-党员相关的事实表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-21 + */ +@Service +public class FactIndexPartyAblityCpcMonthlyServiceImpl extends BaseServiceImpl implements FactIndexPartyAblityCpcMonthlyService { + /** + * @param customerId + * @param monthId + * @return void + * @author yinzuomei + * @description 删除这个客户这个月 党员相关-党建能力的数据 + * @Date 2020/9/18 10:20 + **/ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + public void deleteFactIndexPartyAblityCpcMonthly(String customerId, String monthId) { + int deleteNum; + do { + deleteNum = baseDao.deleteFactIndexPartyAblityCpcMonthly(customerId, monthId); + } while (deleteNum > NumConstant.ZERO); + } + + + /** + * @param list + * @return void + * @author yinzuomei + * @description 批量插入党员相关党建能力表 + * @Date 2020/9/18 10:27 + **/ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + public void saveFactIndexPartyAblityCpcMonthlyEntity(List list) { + baseDao.insertBatchEntity(list); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index de03f24dc5..85fe22a61a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -108,7 +108,6 @@ fact_origin_issue_main_daily t1 WHERE t1.DEL_FLAG = '0' --- AND t1.TOPIC_USER_IS_PARTY = '1' AND t1.CUSTOMER_ID = #{customerId} AND t1.MONTH_ID = #{monthId} AND ISNULL(T1.CREATE_TOPIC_USER_ID)=0 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml index bbb25ff3ae..5ef409a772 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml @@ -77,7 +77,6 @@ t1.DEL_FLAG = '0' AND t1.CUSTOMER_ID = #{customerId} AND t1.MONTH_ID = #{monthId} --- AND t1.OPERATE_USER_IS_PARTY = '1' AND t1.ACTION_CODE = 'comment' GROUP BY t1.OPERATE_USER_ID @@ -107,20 +106,21 @@ SELECT COUNT( 1 ) AS TOTAL FROM - fact_origin_topic_main_daily T1 + fact_origin_topic_log_daily T1 WHERE T1.DEL_FLAG = '0' AND T1.CUSTOMER_ID = #{customerId} AND T1.MONTH_ID = #{monthId} AND T1.OPERATE_USER_ID = #{userId} + AND t1.ACTION_CODE = 'comment'