Browse Source

党员相关-党建能力计算V0.5 不测不知道一测吓一跳

master
yinzuomei 5 years ago
parent
commit
ffbe2e8c3d
  1. 52
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginGroupMainDailyService.java
  2. 52
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java
  3. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java
  4. 65
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginGroupMainDailyServiceImpl.java
  5. 51
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyService.java
  6. 70
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityCpcMonthlyServiceImpl.java
  7. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml
  8. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml
  9. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

52
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<FactOriginGroupMainDailyEntity> {
/**
* @return java.util.List<java.lang.String>
* @param customerId
* @param userId
* @author yinzuomei
* @description 查询当前用户建了多少个组
* @Date 2020/9/21 16:12
**/
List<String> selectGroupIds(String customerId, String userId);
/**
* @return java.util.List<java.lang.String>
* @param groupIdList
* @author yinzuomei
* @description 根据组查询组里面的成员去重
* @Date 2020/9/21 16:13
**/
List<String> selectGroupMemberList(List<String> groupIdList);
}

52
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<List<FactIndexPartyAblityCpcMonthlyEntity>> 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<String, List<String>> map = new HashMap<>();
for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) {
//查询当前党员建了多少个组
List<String> groupIdList = factOriginGroupMainDailyDao.selectGroupIds(customerId, partyMember.getUserId());
List<String> 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<String> groupIdList = userCreatedGroups.get(partyMember.getUserId());
if (CollectionUtils.isEmpty(groupIdList)) {
log.info("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群群众人数】赋值0");
map.put(partyMember.getUserId(), NumConstant.ZERO);
continue;
}
//去重组里面的成员
List<String> memberIdList = factOriginGroupMainDailyDao.selectGroupMemberList(groupIdList);
List<String> 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<String> groupIdList = userCreatedGroups.get(partyMember.getUserId());
if (CollectionUtils.isEmpty(groupIdList)) {
log.info("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群活跃群众人数】赋值0");
map.put(partyMember.getUserId(), NumConstant.ZERO);
continue;
}
//2、去重组里面的成员
List<String> memberIdList = factOriginGroupMainDailyDao.selectGroupMemberList(groupIdList);
List<String> 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<FactIndexPartyAblityCpcMonthlyEntity> list) {
factIndexPartyAblityCpcMonthlyDao.insertBatchEntity(list);
}
}

17
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<String> 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<String> 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<java.lang.String>

65
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<FactOriginGroupMainDailyDao, FactOriginGroupMainDailyEntity> implements FactOriginGroupMainDailyService {
/**
* @return java.util.List<java.lang.String>
* @param customerId
* @param userId
* @author yinzuomei
* @description 查询当前用户建了多少个组
* @Date 2020/9/21 16:13
**/
@Override
public List<String> selectGroupIds(String customerId, String userId) {
List<String> groupIdList = baseDao.selectGroupIds(customerId,userId);
return groupIdList;
}
/**
* @param groupIdList
* @return java.util.List<java.lang.String>
* @author yinzuomei
* @description 根据组查询组里面的成员去重
* @Date 2020/9/21 16:13
**/
@Override
public List<String> selectGroupMemberList(List<String> groupIdList) {
List<String> memberIdList = baseDao.selectGroupMemberList(groupIdList);
return memberIdList;
}
}

51
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<FactIndexPartyAblityCpcMonthlyEntity> {
/**
* @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<FactIndexPartyAblityCpcMonthlyEntity> list);
}

70
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<FactIndexPartyAblityCpcMonthlyDao, FactIndexPartyAblityCpcMonthlyEntity> 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<FactIndexPartyAblityCpcMonthlyEntity> list) {
baseDao.insertBatchEntity(list);
}
}

1
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

8
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'
</select>
<!-- 组内的所有话题id -->
<select id="selectTopicIds" parameterType="map" resultType="java.lang.String">
SELECT
T1.TOPIC_ID
T1.ID AS TOPIC_ID
FROM
fact_origin_topic_log_daily T1
fact_origin_topic_main_daily T1
WHERE
T1.DEL_FLAG = '0'
AND

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml

@ -72,7 +72,6 @@
fact_origin_topic_main_daily t1
WHERE
t1.DEL_FLAG = '0'
-- AND t1.CREATE_TOPIC_USER_IS_PARTY = '1'
and t1.MONTH_ID=#{monthId}
and t1.CUSTOMER_ID=#{customerId}
GROUP BY

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

@ -76,7 +76,7 @@
0 as JOIN_TOPIC_COUNT,
0 as SHIFT_ISSUE_COUNT,
0 as SHIFT_PROJECT_COUNT,
0 as OIN_THREE_MEETS_COUNT,
0 as JOIN_THREE_MEETS_COUNT,
0 as GROUP_USER_COUNT,
0 as GROUP_ACTIVE_USER_COUNT,
0 as GROUP_TOPIC_COUNT,

Loading…
Cancel
Save