| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.cache.Cache; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.PlatformTransactionManager; |
| | | import org.springframework.transaction.TransactionStatus; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.support.DefaultTransactionDefinition; |
| | | import org.springframework.transaction.support.TransactionTemplate; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | /** |
| | | * 单次sql的最多导入数量 |
| | | */ |
| | | @Value("${import.maxNum}") |
| | | @Value("${batchadd.single_maxnum:500}") |
| | | private Integer MAX_IMPORT_NUM; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private FormulaServiceImpl formulaService; |
| | | |
| | | |
| | | /** |
| | | * 对omd中提供的feign接口进行调用,以及处理相关逻辑 |
| | | */ |
| | | @Autowired |
| | | ICodeReferBtmTypeService codeReferBtmTypeService; |
| | | |
| | | |
| | | /** |
| | | * 相似项查询规则 |
| | |
| | | void bactchExecuteInsert(String tableName, List<Map<String, String>> maps) throws ServiceException{ |
| | | ExecutorService executor = Executors.newFixedThreadPool(10); // 创建一个固定大小的线程池 |
| | | List<Map<String, String>> threadSafeMaps = new CopyOnWriteArrayList<>(maps); |
| | | |
| | | for (int i = 0; i < threadSafeMaps.size(); i += MAX_IMPORT_NUM) { |
| | | final int startIndex = i; |
| | | final int endIndex = Math.min(i + MAX_IMPORT_NUM, maps.size()); |
| | |
| | | commonsMapper.insertByBaseModel(tableName, threadSafeMaps.get(0), subList); |
| | | }); |
| | | } |
| | | |
| | | // 关闭线程池 |
| | | executor.shutdown(); |
| | | try { |