| | |
| | | @Value("${email.enable}") |
| | | private Boolean enableEmail; |
| | | |
| | | private static boolean flag = false; |
| | | |
| | | private static final Object OBJ = new Object(); |
| | | |
| | | private final static List<String> md5List = new ArrayList<>(); |
| | | |
| | | private final static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH"); |
| | | |
| | | public void corpReserveDataSync() { |
| | | loadVocSync(); |
| | | //loadVocSync(); |
| | | loadCsvSync(); |
| | | } |
| | | |
| | | @Scheduled(cron = "${csv.cron}") |
| | | private void loadCsvSync() { |
| | | synchronized (OBJ) { |
| | | if (flag) return; |
| | | flag = true; |
| | | } |
| | | |
| | | logger.info("***************** 开始执行CSV入库 *****************" + "\n"); |
| | | Calendar calendar = getCalendar(1); |
| | | calendar.add(Calendar.HOUR, -cronMax); |
| | | for (int i = 0; i < cronMax; i++) { |
| | | try { |
| | | calendar.add(Calendar.HOUR, -1); |
| | | calendar.add(Calendar.HOUR, 1); |
| | | String time = format.format(calendar.getTime()); |
| | | String filePath = csvFilePathConfig.getFilePath() + File.separator + time + ".csv"; |
| | | |
| | |
| | | } |
| | | } |
| | | logger.info("***************** CSV入库执行完成 *****************" + "\n"); |
| | | flag = false; |
| | | } |
| | | |
| | | public Calendar getCalendar(int start) { |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "${email.times}") |
| | | //@Scheduled(cron = "${email.times}") |
| | | public void autoCalcData() { |
| | | if (enableEmail) { |
| | | //System.out.println("${email.times}"); |