|
|
@ -20,12 +20,16 @@ package com.epmet.service.evaluationindex.screen.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.constant.IndexCalConstant; |
|
|
|
import com.epmet.dao.evaluationindex.screen.ScreenPioneerDataDao; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity; |
|
|
|
import com.epmet.service.evaluationindex.screen.ScreenPioneerDataService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
@ -53,12 +57,40 @@ public class ScreenPioneerDataServiceImpl extends BaseServiceImpl<ScreenPioneerD |
|
|
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
|
|
|
@Override |
|
|
|
public List<ScreenPioneerDataEntity> initPioneerDataList(String customerId, String orgType, String agencyLevel) { |
|
|
|
List<ScreenPioneerDataEntity> list=new ArrayList<>(); |
|
|
|
if("grid".equals(orgType)){ |
|
|
|
list=baseDao.initGridPioneerDataList(customerId); |
|
|
|
}else if("agency".equals(orgType)){ |
|
|
|
list=baseDao.initAgencyPioneerDataList(customerId,agencyLevel); |
|
|
|
List<ScreenPioneerDataEntity> list = new ArrayList<>(); |
|
|
|
if ("grid".equals(orgType)) { |
|
|
|
list = baseDao.initGridPioneerDataList(customerId); |
|
|
|
} else if ("agency".equals(orgType)) { |
|
|
|
list = baseDao.initAgencyPioneerDataList(customerId, agencyLevel); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param customerId |
|
|
|
* @param orgType grid, agency |
|
|
|
* @param dataEndTime |
|
|
|
* @param deleteSize |
|
|
|
* @param entityList 待插入的数据 |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 保存抽取结果 |
|
|
|
* @Date 2020/9/22 15:54 |
|
|
|
**/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
|
|
|
@Override |
|
|
|
public void delAndSavePioneerData(String customerId, String orgType, String dataEndTime, Integer deleteSize, List<ScreenPioneerDataEntity> entityList) { |
|
|
|
int deleteNum; |
|
|
|
do { |
|
|
|
deleteNum = baseDao.deletePioneerData(customerId, orgType, dataEndTime, deleteSize); |
|
|
|
} while (deleteNum != NumConstant.ZERO); |
|
|
|
|
|
|
|
List<List<ScreenPioneerDataEntity>> partition = ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE); |
|
|
|
partition.forEach(list -> { |
|
|
|
baseDao.insertBatchEntity(list); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |