| | |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.yssh.dao.VocValsMapper; |
| | | import com.yssh.entity.VocCoords; |
| | | import com.yssh.entity.VocVals; |
| | | 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; |
| | | |
| | |
| | | @Resource |
| | | VocValsMapper vocValsMapper; |
| | | |
| | | protected final Log logger = LogFactory.getLog(this.getClass()); |
| | | protected final Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | @Override |
| | | public List<VocVals> selectByTime(String time, Double startVal) { |
| | | return vocValsMapper.selectByTime(time, startVal); |
| | | public List<VocVals> selectByTime(String time) { |
| | | return vocValsMapper.selectByTime(time); |
| | | } |
| | | |
| | | @Override |
| | | public int countByTime(String time) { |
| | | return vocValsMapper.countByTime(time); |
| | | } |
| | | |
| | | @Override |
| | | public List<VocCoords> selectCoords(Integer x, Integer y) { |
| | | return vocValsMapper.selectCoords(x, y); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Async("threadPoolTaskExecutor") |
| | | public int insertVocVals(List<VocVals> list) throws InterruptedException { |
| | | public void insertVocVals(List<VocVals> list) throws InterruptedException { |
| | | List<List<VocVals>> lists = Lists.partition(list, IAsyncService.BATCH_INSERT_500); |
| | | |
| | | CountDownLatch countDownLatch = new CountDownLatch(list.size()); |
| | |
| | | |
| | | countDownLatch.await(); |
| | | logger.info("------ VOC.csv," + lists.size() + " 条数据已入库 ------"); |
| | | |
| | | return list.size(); |
| | | } |
| | | |
| | | private void executeAsync(List<VocVals> corpList, CountDownLatch countDownLatch) { |