8 changed files with 250 additions and 1 deletions
@ -0,0 +1,19 @@ |
|||||
|
package com.epmet.service.evaluationindex.extract; |
||||
|
|
||||
|
/** |
||||
|
* 党员相关 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2020/9/17 14:05 |
||||
|
*/ |
||||
|
public interface CalCpcIndexService { |
||||
|
/** |
||||
|
* @return void |
||||
|
* @param customerId 客户id |
||||
|
* @param monthId yyyyMM |
||||
|
* @author yinzuomei |
||||
|
* @description 党员相关-党建能力 |
||||
|
* @Date 2020/9/17 14:08 |
||||
|
**/ |
||||
|
void calCpcPartyAbility(String customerId, String monthId); |
||||
|
} |
@ -0,0 +1,97 @@ |
|||||
|
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.constant.DataSourceConstant; |
||||
|
import com.epmet.constant.IndexCalConstant; |
||||
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyDao; |
||||
|
import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; |
||||
|
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; |
||||
|
import com.epmet.service.evaluationindex.extract.CalCpcIndexService; |
||||
|
import com.epmet.service.stats.DimCustomerPartymemberService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections4.ListUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 党员相关 |
||||
|
* |
||||
|
* @author yinzuomei@elink-cn.com |
||||
|
* @date 2020/9/17 14:06 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class CalCpcIndexServiceImpl implements CalCpcIndexService { |
||||
|
@Autowired |
||||
|
private DimCustomerPartymemberService dimCustomerPartymemberService; |
||||
|
@Autowired |
||||
|
private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao; |
||||
|
|
||||
|
/** |
||||
|
* @param customerId 客户id |
||||
|
* @param monthId yyyyMM |
||||
|
* @return void |
||||
|
* @author yinzuomei |
||||
|
* @description 党员相关-党建能力 |
||||
|
* @Date 2020/9/17 14:08 |
||||
|
**/ |
||||
|
@Override |
||||
|
public void calCpcPartyAbility(String customerId, String monthId) { |
||||
|
//1、构造初始值
|
||||
|
List<FactIndexPartyAblityCpcMonthlyEntity> indexPartyAblityCpcList = dimCustomerPartymemberService.selectPartyMemberList(customerId); |
||||
|
//2、删除之前统计过的
|
||||
|
deleteFactIndexPartyAblityCpcMonthly(customerId, monthId); |
||||
|
//3、计算实际值,更新
|
||||
|
for (FactIndexPartyAblityCpcMonthlyEntity indexPartyAblityCpcEntity : indexPartyAblityCpcList) { |
||||
|
//TODO
|
||||
|
//党员提出话题数
|
||||
|
//党员参与话题数(支持、反对、评论、浏览)
|
||||
|
//党员提出的话题转议题数
|
||||
|
//党员提出的议题转项目数
|
||||
|
//参加“三会一课”次数
|
||||
|
//党员自建群群众人数
|
||||
|
//党员自建群活跃群众人数
|
||||
|
//党员自建群活跃度——话题数
|
||||
|
//自建群活跃度——议题转项目率
|
||||
|
} |
||||
|
//4、分批插入
|
||||
|
//批量插入
|
||||
|
List<List<FactIndexPartyAblityCpcMonthlyEntity>> partition = ListUtils.partition(indexPartyAblityCpcList, IndexCalConstant.INSERT_SIZE); |
||||
|
partition.forEach(list -> { |
||||
|
this.FactIndexPartyAblityCpcMonthlyEntity(list); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @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 FactIndexPartyAblityCpcMonthlyEntity(List<FactIndexPartyAblityCpcMonthlyEntity> list) { |
||||
|
factIndexPartyAblityCpcMonthlyDao.insertBatchEntity(list); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue