| | |
| | | package com.yssh.service.impl; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.CountDownLatch; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | 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; |
| | | |
| | |
| | | |
| | | @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; |
| | |
| | | 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()); |
| | |
| | | } |
| | | countDownLatch.await(); |
| | | logger.info(lists.size() + "条数据入库完成-----"); |
| | | } |
| | | |
| | | @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 |
| | |
| | | return null; |
| | | } |
| | | |
| | | List<DictRecord> recordList = dictRecordMapper.selectDictRecordList(new DictRecord()); |
| | | /*List<DictRecord> recordList = dictRecordMapper.selectDictRecordList(new DictRecord()); |
| | | |
| | | List<String> tableNames = new ArrayList<String>(); |
| | | for (DictRecord dr : recordList) { |
| | |
| | | } |
| | | } |
| | | |
| | | return suYuanMapper.getMonitorData(tableNames, checkPoint.getX() + "_" + checkPoint.getY() + "_" + checkPoint.getZ()); |
| | | return suYuanMapper.getMonitorData(tableNames, checkPoint.getX() + "_" + checkPoint.getY() + "_" + checkPoint.getZ());*/ |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 23); |
| | | String end = dateFormat.format(calendar.getTime()); |
| | | |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.add(Calendar.DATE, -7); |
| | | String start = dateFormat.format(calendar.getTime()); |
| | | |
| | | return suYuanMapper.getNewMonitorData(checkPoint.getName(), start, end); |
| | | } |
| | | |
| | | @Override |