|
@ -1,20 +1,26 @@ |
|
|
package com.epmet.service.evaluationindex.extract.impl; |
|
|
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.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
import com.epmet.constant.ExtractConstant; |
|
|
import com.epmet.constant.ExtractConstant; |
|
|
|
|
|
import com.epmet.constant.IndexCalConstant; |
|
|
import com.epmet.constant.ProjectEvaluateConstant; |
|
|
import com.epmet.constant.ProjectEvaluateConstant; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; |
|
|
|
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao; |
|
|
|
|
|
import com.epmet.dao.heart.ActInfoDao; |
|
|
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; |
|
|
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; |
|
|
import com.epmet.dto.extract.form.GridIssueCountResultDTO; |
|
|
import com.epmet.dto.extract.form.GridIssueCountResultDTO; |
|
|
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; |
|
|
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; |
|
|
import com.epmet.dto.extract.result.*; |
|
|
import com.epmet.dto.extract.result.*; |
|
|
|
|
|
import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity; |
|
|
import com.epmet.service.evaluationindex.extract.*; |
|
|
import com.epmet.service.evaluationindex.extract.*; |
|
|
import com.epmet.service.stats.FactArticlePublishedGridDailyService; |
|
|
import com.epmet.service.stats.FactArticlePublishedGridDailyService; |
|
|
import com.epmet.service.stats.user.FactRegUserGridMonthlyService; |
|
|
import com.epmet.service.stats.user.FactRegUserGridMonthlyService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -58,6 +64,12 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FactOriginTopicLogDailyService topicLogService; |
|
|
private FactOriginTopicLogDailyService topicLogService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private FactIndexServiceAbilityGridMonthlyService factIndexServiceAbilityGridMonthlyService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private FactIndexServiceAblityGridMonthlyDao factIndexServiceAblityGridMonthlyDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ActInfoDao actInfoDao; |
|
|
/** |
|
|
/** |
|
|
* @Description 计算网格指标党建能力 |
|
|
* @Description 计算网格指标党建能力 |
|
|
* @param customerId |
|
|
* @param customerId |
|
@ -125,7 +137,8 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
if (!CollectionUtils.isEmpty(gridUserCountList)){ |
|
|
if (!CollectionUtils.isEmpty(gridUserCountList)){ |
|
|
gridUserCountList.forEach(count -> { |
|
|
gridUserCountList.forEach(count -> { |
|
|
if (r.getGridId().equals(count.getGridId())){ |
|
|
if (r.getGridId().equals(count.getGridId())){ |
|
|
BeanUtils.copyProperties(count,r); |
|
|
r.setUserCount(count.getUserCount()); |
|
|
|
|
|
r.setPartyCount(count.getPartyCount()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -307,7 +320,8 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList)) { |
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList)) { |
|
|
gridIssueTotalList.forEach(total -> { |
|
|
gridIssueTotalList.forEach(total -> { |
|
|
if (r.getGridId().equals(total.getGridId())) { |
|
|
if (r.getGridId().equals(total.getGridId())) { |
|
|
BeanUtils.copyProperties(total, r); |
|
|
r.setIssueTotal(total.getIssueTotal()); |
|
|
|
|
|
r.setAvgIssueCount(total.getAvgIssueCount()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -362,7 +376,86 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public Boolean calGridIndexServiceAbility(String customerId, String monthId) { |
|
|
public Boolean calGridIndexServiceAbility(String customerId, String monthId) { |
|
|
return null; |
|
|
//1、构造好初始数据,各指标赋值0
|
|
|
|
|
|
List<FactIndexServiceAblityGridMonthlyEntity> entityList=factIndexServiceAbilityGridMonthlyService.initAllGridList(customerId); |
|
|
|
|
|
if(CollectionUtils.isEmpty(entityList)){ |
|
|
|
|
|
log.info("screen_customer_grid do not any records"); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
String quarterId= DateUtils.getQuarterId(monthId); |
|
|
|
|
|
String yearId=DateUtils.getYearId(monthId); |
|
|
|
|
|
//各个网格这个月举办的活动
|
|
|
|
|
|
Map<String,Integer> activityCountMap=calActivityCountMap(customerId,monthId); |
|
|
|
|
|
//2、遍历网格,赋值每个网格指标
|
|
|
|
|
|
for(FactIndexServiceAblityGridMonthlyEntity entity:entityList){ |
|
|
|
|
|
entity.setMonthId(monthId); |
|
|
|
|
|
entity.setQuarterId(quarterId); |
|
|
|
|
|
entity.setYearId(yearId); |
|
|
|
|
|
//网格活动组织次数 爱心活动
|
|
|
|
|
|
if(activityCountMap.containsKey(entity.getGridId())){ |
|
|
|
|
|
entity.setActivityCount(activityCountMap.get(entity.getGridId())); |
|
|
|
|
|
} |
|
|
|
|
|
//网格志愿者占比 todo
|
|
|
|
|
|
// entity.setVolunteerRatio();
|
|
|
|
|
|
//网格党员志愿者率 todo
|
|
|
|
|
|
// entity.setPartyVolunteerRatio();
|
|
|
|
|
|
} |
|
|
|
|
|
//3、批量删
|
|
|
|
|
|
deleteBatchIndexServiceAblityGridMonthly(customerId,monthId); |
|
|
|
|
|
//4、批量增
|
|
|
|
|
|
List<List<FactIndexServiceAblityGridMonthlyEntity>> partition = ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE); |
|
|
|
|
|
partition.forEach(list -> { |
|
|
|
|
|
this.saveFactIndexServiceAblityGridMonthlyEntity(list); |
|
|
|
|
|
}); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @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 |
|
|
|
|
|
* @return void |
|
|
|
|
|
* @author yinzuomei |
|
|
|
|
|
* @description 批量插入网格相关-服务能力指标表 |
|
|
|
|
|
* @Date 2020/9/21 10:04 |
|
|
|
|
|
**/ |
|
|
|
|
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
|
|
|
|
|
private void saveFactIndexServiceAblityGridMonthlyEntity(List<FactIndexServiceAblityGridMonthlyEntity> list) { |
|
|
|
|
|
factIndexServiceAbilityGridMonthlyService.insertBatchEntity(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|