燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-06-16 5b17ccbbe08971f861ff097c62241d2b79e4b5f6
src/main/java/com/yssh/service/impl/SuYuanServiceImpl.java
@@ -8,8 +8,8 @@
import com.yssh.dao.QxshMapper;
import com.yssh.entity.*;
import com.yssh.utils.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -25,8 +25,7 @@
@Service
public class SuYuanServiceImpl implements ISuYuanService {
   protected final Log logger = LogFactory.getLog(this.getClass());
   protected final Logger logger = LoggerFactory.getLogger(this.getClass());
   @Resource
   private SuYuanMapper suYuanMapper;
@@ -49,9 +48,9 @@
   private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH");
   //@Transactional
   @Override
   //@Override
   @Async("threadPoolTaskExecutor")
   public void insertSuYuanDatas(List<SuYuan> lists, String time) throws Exception {
   public void insertSuYuanDatasAsync(List<SuYuan> lists, String time) throws Exception {
      //插入数据
      List<List<SuYuan>> list = Lists.partition(lists, IAsyncService.BATCH_INSERT_NUMBER);
      CountDownLatch countDownLatch = new CountDownLatch(list.size());
@@ -63,6 +62,16 @@
   }
   @Override
   public void insertSuYuanDatas(List<SuYuan> lists, String time) {
      List<List<SuYuan>> subLists = Lists.partition(lists, IAsyncService.BATCH_INSERT_NUMBER);
      for (List<SuYuan> sub : subLists) {
         suYuanMapper.batchInsert(TableStrategy.getTableStrategy(time), sub);
      }
      logger.info("------ " + time + ".csv," + lists.size() + " 条数据已入库 ------");
   }
   @Override
   public Integer isTableExists(String tableName) {
      return suYuanMapper.isTableExists(tableName);
   }