|
|
@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
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.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
@ -31,10 +32,12 @@ import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; |
|
|
|
import com.epmet.dto.screencoll.ScreenCollFormDTO; |
|
|
|
import com.epmet.entity.evaluationindex.screen.*; |
|
|
|
import com.epmet.service.evaluationindex.screen.*; |
|
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
|
import org.apache.commons.lang3.ArrayUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.text.ParseException; |
|
|
@ -219,23 +222,6 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 内部数据入库 |
|
|
|
* @param param |
|
|
|
* @return void |
|
|
|
* @author wangc |
|
|
|
* @date 2021.03.09 11:10 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void collect(ScreenCollFormDTO<ScreenProjectDataDTO> param) { |
|
|
|
//内部数据抽取的逻辑是,不管dateId指定的哪一天,只要在抽取时,目标数据库中没有相应数据
|
|
|
|
//就抽取指定日期及其之前的所有数据,因此在删除时只需对指定日期删除即可,上述情况是因为
|
|
|
|
//库中无数据,范围性删除无意义,只是针对在数据库有历史数据的情况下,保证对同一天进行反
|
|
|
|
//复采集时数不会重复
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 查询是否存在客户的数据 |
|
|
@ -261,4 +247,33 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD |
|
|
|
return baseDao.selectPending(param); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description collect或更新 |
|
|
|
* @param |
|
|
|
* @return void |
|
|
|
* @author wangc |
|
|
|
* @date 2021.03.09 17:36 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void insertOrUpdateBatch(String customerId, String dateId, List<ScreenProjectDataDTO> meta, List<ScreenProjectDataDTO> orient) { |
|
|
|
//内部数据抽取的逻辑是,不管dateId指定的哪一天,只要在抽取时,目标数据库中没有相应数据
|
|
|
|
//就抽取指定日期及其之前的所有数据,因此在删除时只需对指定日期删除即可,上述情况是因为
|
|
|
|
//库中无数据,范围性删除无意义,只是针对在数据库有历史数据的情况下,保证对同一天进行反
|
|
|
|
//复采集时数不会重复
|
|
|
|
if(!CollectionUtils.isEmpty(meta)){ |
|
|
|
int affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId,dateId); |
|
|
|
while (affectedRows > 0) { |
|
|
|
affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId, dateId); |
|
|
|
} |
|
|
|
List<List<ScreenProjectDataDTO>> partition = ListUtils.partition(meta, NumConstant.ONE_HUNDRED); |
|
|
|
partition.forEach(part -> baseDao.insertBatch(part)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(orient)){ |
|
|
|
List<List<ScreenProjectDataDTO>> partition = ListUtils.partition(orient, NumConstant.ONE_HUNDRED); |
|
|
|
partition.forEach(part -> baseDao.updateBatch(part,dateId)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|