123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package com.hb.proj.gather.process;
- import org.apache.commons.lang3.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import com.hb.proj.gather.model.LiquidPO;
- import com.hb.proj.gather.rep.GatherDataRepService;
- import com.hb.proj.gather.rep.WellConfigService;
- import com.hb.xframework.util.ApplicationContextUtils;
- public class DataTransRepLiquidTask implements Runnable {
- private final static Logger logger = LoggerFactory.getLogger(DataTransRepLiquidTask.class);
-
- private LiquidPO po;
-
- public DataTransRepLiquidTask(LiquidPO po) {
- this.po=po;
- }
-
- @Override
- public void run() {
- logger.info("开始动液面数据转换处理{}",po.getDevSerial());
- try {
- WellConfigService configService=ApplicationContextUtils.getBean("wellConfigService", WellConfigService.class);
- String wellId=configService.getWellIdByDev(po.getDevSerial());
- if(StringUtils.isBlank(wellId)) {
- logger.warn("动液面设备{}未找到对应井,取消入库",po.getDevSerial());
- return;
- }
- po.setWellId(wellId);
-
- GatherDataRepService repService=ApplicationContextUtils.getBean("gatherDataRepService", GatherDataRepService.class);
- repService.save(po);
- logger.info("动液面数据入库完成{}",po.getDevSerial());
- }
- catch(Exception e) {
- e.printStackTrace();
- logger.error("动液面数据转换、入库任务执行出现异常:{}",e.getMessage());
- }
- }
- }
|