|
|
@ -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 |
|
|
|