| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /**
- * Copyright
- * All right reserved.
- * 项目名称:
- * 创建日期:2022/5/22
- */
- package org.springblade.etl;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import lombok.extern.slf4j.Slf4j;
- import org.springblade.etl.entity.EtlMvAttStBaseEntity;
- import org.springblade.etl.service.IEtlMvAttStBaseService;
- import org.springblade.modules.baseinfo.stbase.entity.MvAttStBaseEntity;
- import org.springblade.modules.baseinfo.stbase.service.IMvAttStBaseService;
- import java.util.Date;
- import java.util.List;
- import java.util.concurrent.Callable;
- /***
- * Date:2022/5/22
- * Title: 测站基础数据
- * Description:
- * @author swp
- * @version 1.0
- * Remark:认为有必要的其他信息
- */
- @Slf4j
- public class EtlMvAttStBaseDataTask implements Callable<Integer> {
- private IEtlMvAttStBaseService etlMvAttStBaseService;
- private IMvAttStBaseService mvAttStBaseService;
- EtlMvAttStBaseDataTask(IEtlMvAttStBaseService etlMvAttStBaseService, IMvAttStBaseService mvAttStBaseService) {
- this.etlMvAttStBaseService = etlMvAttStBaseService;
- this.mvAttStBaseService = mvAttStBaseService;
- }
- @Override
- public Integer call() {
- try {
- log.info("测站数据抽取开始**************");
- List<EtlMvAttStBaseEntity> list = etlMvAttStBaseService.selectList();
- if (list != null && list.size() > 0) {
- for (int i = 0; i < list.size(); i++) {
- EtlMvAttStBaseEntity entity = list.get(i);
- LambdaQueryWrapper<MvAttStBaseEntity> dataWrapper = Wrappers.<MvAttStBaseEntity>query().lambda();
- dataWrapper.eq(MvAttStBaseEntity::getStCode, entity.getStCode());
- MvAttStBaseEntity baseEntity = mvAttStBaseService.getOne(dataWrapper);
- if (null == baseEntity) {
- baseEntity = new MvAttStBaseEntity();
- baseEntity.setCreateTime(new Date());
- baseEntity.setUpdateTime(new Date());
- baseEntity.setStatus(1);
- baseEntity.setIsDeleted(0);
- }
- baseEntity.setStCode(entity.getStCode());
- baseEntity.setStName(entity.getStName());
- baseEntity.setAdCode(entity.getAdCode());
- baseEntity.setAdName(entity.getAdName());
- baseEntity.setRvCode(entity.getRvCode());
- baseEntity.setRvName(entity.getRvName());
- baseEntity.setStLong(entity.getStLong());
- baseEntity.setStLat(entity.getStLat());
- baseEntity.setIsRain(entity.getIsRain());
- baseEntity.setIsRiver(entity.getIsRiver());
- baseEntity.setIsRes(entity.getIsRes());
- baseEntity.setRainStType(entity.getRainStType());
- baseEntity.setUpdateTime(new Date());
- mvAttStBaseService.saveOrUpdate(baseEntity);
- }
- }
- } catch (Exception e) {
- log.error("实时数据统计任务异常 {}", e.getMessage());
- }
- return 0;
- }
- }
|