Browse Source

网格相关-服务能力V0.4

master
yinzuomei 5 years ago
parent
commit
ed00811041
  1. 99
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java
  2. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyService.java
  3. 54
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexServiceAblityGridMonthlyServiceImpl.java
  4. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java
  5. 61
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java
  6. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/PartyMemberService.java
  7. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/impl/PartyMemberServiceImpl.java
  8. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  9. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java

99
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<String,Integer> activityCountMap=calActivityCountMap(customerId,monthId);
//各个网格这个月举办的活动 :活动状态已结束并且实际结束时间在评价周期内的
Map<String,Integer> 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<String> regUserIds=this.getGridRegUserIds(customerId,entity.getGridId());
List<String> 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<String> paryUserIds=this.getVolunteerPartyUserIds(volunteerUserIds);
List<String> 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<List<FactIndexServiceAblityGridMonthlyEntity>> 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<java.lang.String>
* @param customerId
* @param gridId
* @author yinzuomei
* @description 查询当前网格下首次注册的用户ids
* @Date 2020/9/21 13:44
**/
@DataSource(DataSourceConstant.EPMET_USER)
private List<String> getGridRegUserIds(String customerId, String gridId) {
return userDao.selectGridRegUserIds(customerId,gridId);
}
/**
* @return java.util.List<java.lang.String>
* @param regUserIds
* @author yinzuomei
* @description 根据userId,查询用户是否是志愿者返回是志愿者的用户集合
* @Date 2020/9/21 13:50
**/
@DataSource(DataSourceConstant.EPMET_HEART)
private List<String> getGridRegUserVolunteer(List<String> regUserIds) {
return actInfoDao.selectGridRegUserVolunteer(regUserIds);
}
/**
* @return java.util.List<java.lang.String>
* @param volunteerUserIds
* @author yinzuomei
* @description 志愿者中同时是党员的人数
* @Date 2020/9/21 14:10
**/
@DataSource(DataSourceConstant.PARTY_MEMBER)
private List<String> getVolunteerPartyUserIds(List<String> volunteerUserIds) {
return partyMemberDao.selectVolunteerPartyUserIds(volunteerUserIds);
}
/**
* @return java.util.Map<java.lang.String,java.lang.Integer>
* @param customerId
* @param monthId
* @author yinzuomei
* @description 网格活动组织次数 爱心活动 值得是 活动状态已结束并且实际结束时间在评价周期内的
* @Date 2020/9/21 10:23
**/
@DataSource(DataSourceConstant.EPMET_HEART)
private Map<String, Integer> calActivityCountMap(String customerId, String monthId) {
List<Map<String, Integer>> mapList = actInfoDao.selectActGroupByGridId(customerId, monthId);
Map<String, Integer> resultMap = new HashMap<>();
for (Map<String, Integer> map : mapList) {
for (Map.Entry<String, Integer> 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

41
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
* <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.FactIndexServiceAblityGridMonthlyEntity;
/**
* 服务能力-网格相关事实表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-21
*/
public interface FactIndexServiceAblityGridMonthlyService extends BaseService<FactIndexServiceAblityGridMonthlyEntity> {
/**
* @return void
* @param customerId
* @param monthId
* @author yinzuomei
* @description 批量删除网格相关-服务能力指标表
* @Date 2020/9/21 16:38
**/
void deleteBatchIndexServiceAblityGridMonthly(String customerId, String monthId);
}

54
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
* <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.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<FactIndexServiceAblityGridMonthlyDao, FactIndexServiceAblityGridMonthlyEntity> 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);
}
}

31
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<java.lang.String>
* @param regUserIds
* @author yinzuomei
* @description 根据userId,查询用户是否是志愿者返回是志愿者的用户集合
* @Date 2020/9/21 16:41
**/
List<String> getGridRegUserVolunteer(List<String> regUserIds);
/**
* @return java.util.Map<java.lang.String,java.lang.Integer>
* @param customerId
* @param monthId
* @author yinzuomei
* @description 网格活动组织次数 爱心活动 值得是 活动状态已结束并且实际结束时间在评价周期内的
* @Date 2020/9/21 16:43
**/
Map<String, Integer> calActivityCountMap(String customerId, String monthId);
}

61
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<java.lang.String>
* @param regUserIds
* @author yinzuomei
* @description 根据userId,查询用户是否是志愿者返回是志愿者的用户集合
* @Date 2020/9/21 13:50
**/
@Override
@DataSource(DataSourceConstant.EPMET_HEART)
public List<String> getGridRegUserVolunteer(List<String> regUserIds) {
return baseDao.selectGridRegUserVolunteer(regUserIds);
}
/**
* @return java.util.Map<java.lang.String,java.lang.Integer>
* @param customerId
* @param monthId
* @author yinzuomei
* @description 网格活动组织次数 爱心活动 值得是 活动状态已结束并且实际结束时间在评价周期内的
* @Date 2020/9/21 10:23
**/
@Override
@DataSource(DataSourceConstant.EPMET_HEART)
public Map<String, Integer> calActivityCountMap(String customerId, String monthId) {
List<Map<String, Integer>> mapList = baseDao.selectActGroupByGridId(customerId, monthId);
Map<String, Integer> resultMap = new HashMap<>();
for (Map<String, Integer> map : mapList) {
for (Map.Entry<String, Integer> m : map.entrySet()) {
resultMap.put(m.getKey(), m.getValue());
}
}
return resultMap;
}
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/partymember/PartyMemberService.java

@ -29,4 +29,12 @@ public interface PartyMemberService {
*/
List<PartyMemberDTO> getPartyMemberByCustomer(String customerId);
/**
* @return java.util.List<java.lang.String>
* @param volunteerUserIds
* @author yinzuomei
* @description 志愿者中同时是党员的人数
* @Date 2020/9/21 16:46
**/
List<String> getVolunteerPartyUserIds(List<String> volunteerUserIds);
}

12
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<java.lang.String>
* @param volunteerUserIds
* @author yinzuomei
* @description 志愿者中同时是党员的人数
* @Date 2020/9/21 14:10
**/
@Override
@DataSource(DataSourceConstant.PARTY_MEMBER)
public List<String> getVolunteerPartyUserIds(List<String> volunteerUserIds) {
return partyMemberDao.selectVolunteerPartyUserIds(volunteerUserIds);
}
}

10
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<GridHeartedFormDTO> getWarmHeartedByCustomerId(String customerId);
/**
* @return java.util.List<java.lang.String>
* @param customerId
* @param gridId
* @author yinzuomei
* @description 查询当前网格下首次注册的用户ids
* @Date 2020/9/21 16:44
**/
List<String> getGridRegUserIds(String customerId, String gridId);
}

16
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<java.lang.String>
* @param customerId
* @param gridId
* @author yinzuomei
* @description 查询当前网格下首次注册的用户ids
* @Date 2020/9/21 13:44
**/
@Override
@DataSource(DataSourceConstant.EPMET_USER)
public List<String> getGridRegUserIds(String customerId, String gridId) {
return userDao.selectGridRegUserIds(customerId,gridId);
}
}

Loading…
Cancel
Save