| | |
| | | import java.lang.reflect.Method; |
| | | import java.time.Instant; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.Date; |
| | |
| | | LocalDate endOfYear = LocalDate.of(year, 12, 31); |
| | | LocalDate now = LocalDate.now(); |
| | | for (LocalDate tmp = startOfYear; endOfYear.compareTo(tmp) > 0 && now.compareTo(tmp) > 0; tmp = tmp.plus(1, ChronoUnit.DAYS)) { |
| | | Instant instant = tmp.atTime(LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()).toInstant(); |
| | | // Instant instant = tmp.atTime(LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()).toInstant(); |
| | | // threadPool.submit(new ZyytTask(Date.from(instant), zyytService, "shkdrbTasks")); |
| | | ZyytTask shkdrbTasks = new ZyytTask(Date.from(instant), zyytService, "shkdrbTasks"); |
| | | shkdrbTasks.call(); |
| | | zyytService.shkdrbTasks(tmp); |
| | | } |
| | | return "后台执行中 ,请不要重复请求"; |
| | | |
| | |
| | | LocalDate endOfYear = LocalDate.of(year, 12, 31); |
| | | LocalDate now = LocalDate.now(); |
| | | for (LocalDate tmp = startOfYear; endOfYear.compareTo(tmp) > 0 && now.compareTo(tmp) > 0; tmp = tmp.plus(1, ChronoUnit.DAYS)) { |
| | | Instant instant = tmp.atTime(LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()).toInstant(); |
| | | // Instant instant = tmp.atTime(LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()).toInstant(); |
| | | // threadPool.submit(new ZyytTask(Date.from(instant), zyytService, "djtjbTasks")); |
| | | ZyytTask djtjbTasks = new ZyytTask(Date.from(instant), zyytService, "djtjbTasks"); |
| | | djtjbTasks.call(); |
| | | zyytService.djtjbTasks(tmp); |
| | | } |
| | | return "123"; |
| | | } |
| | |
| | | package com.integrated.zyyt.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.integrated.zyyt.enetity.StationInfo; |
| | | import com.integrated.zyyt.enetity.YyztTDjtjb; |
| | | import com.integrated.zyyt.enetity.YyztTShkdrb; |
| | |
| | | Long totalSize = 0L; |
| | | |
| | | int pageNum = 0; |
| | | int pageSize = 2000; |
| | | int pageSize = 1000; |
| | | |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | |
| | | int fromIndex = i * batchSize; |
| | | // 结束位置 |
| | | int toIndex = (i + 1) * batchSize < length ? (i + 1) * batchSize : length; |
| | | if (fromIndex == batchSize) { |
| | | if (fromIndex == length) { |
| | | continue; |
| | | } |
| | | System.out.println(fromIndex + " === " + toIndex); |
| | |
| | | @Override |
| | | public void setValues(PreparedStatement ps, int i) throws SQLException { |
| | | StationInfo stationInfo = stationInfoListCopy.get(i); |
| | | log.info("stationInfo==> {}", JSON.toJSONString(stationInfo)); |
| | | // log.info("stationInfo==> {}", JSON.toJSONString(stationInfo)); |
| | | |
| | | ps.setObject(1, stationInfo.getVJgbh()); |
| | | |
| | |
| | | } |
| | | }); |
| | | } catch (Exception e) { |
| | | log.error("设置参数值报错了"); |
| | | e.printStackTrace(); |
| | | log.error(e.getMessage()); |
| | | //手工回滚异常 |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | int pageNum = 0; |
| | | int pageSize = 500; |
| | | int pageSize = 1000; |
| | | |
| | | String batchInsertSql = "INSERT INTO YYZT_T_SHKDRB (\"V_SFDM\",\"V_SFMC\",\"V_DSDM\",\"V_DSMC\",\"V_QXDM\",\"V_XSMC\",\"V_TDJGBH\",\"V_TDJGMC\",\"V_JGBH\",\"V_JGMC\",\"D_RBRQ\",\"N_ZGYZLJS\",\"N_ZGYZQJS\",\"N_SHKDLJS\",\"N_SHKDQJS\",\"N_ZTLJS\",\"N_ZTQJS\",\"N_YTLJS\",\"N_YTQJS\",\"N_STLJS\",\"N_STQJS\",\"N_BSLJS\",\"N_BSQJS\",\"N_YDLJS\",\"N_YDQJS\",\"N_YFLJS\",\"N_YFQJS\",\"N_JDLJS\",\"N_JDQJS\",\"N_JTLJS\",\"N_JTQJS\",\"N_TTLJS\",\"N_TTQJS\",\"N_DBLJS\",\"N_DBQJS\",\"N_DNLJS\",\"N_DNQJS\",\"N_FWLJS\",\"N_FWQJS\",\"N_YSLJS\",\"N_YSQJS\",\"N_QTLJS\",\"N_QTQJS\",\"RESERVED1\",\"RESERVED2\",\"RESERVED3\",\"RESERVED4\",\"BATCH_NO\") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; |
| | | |
| | |
| | | int fromIndex = i * batchSize; |
| | | // 结束位置 |
| | | int toIndex = (i + 1) * batchSize < length ? (i + 1) * batchSize : length; |
| | | if (fromIndex == batchSize) { |
| | | if (fromIndex == length) { |
| | | continue; |
| | | } |
| | | List<YyztTShkdrb> yyztTShkdrbs = stationInfoList.subList(fromIndex, toIndex); |
| | |
| | | |
| | | try { |
| | | int pageNum = 0; |
| | | int pageSize = 500; |
| | | int pageSize = 1000; |
| | | |
| | | String batchInsertSql = "INSERT INTO YYZT_T_DJTJB (\"V_SFDM\", \"V_SFMC\", \"V_DSDM\", \"V_DSMC\", \"V_QXDM\", \"V_XSMC\", \"V_TDJGBH\", \"V_JGBH\", \"V_JGMC\", \"D_RBRQ\", \"V_YLGZDID\", \"V_YLGZDMC\", \"N_SJYWL\", \"N_TKYWL\", \"N_BKYEL\", \"N_SJZJE\", \"N_TKSR\", \"N_BKSR\", \"BATCH_NO\") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
| | | // 查询总数 |
| | |
| | | int fromIndex = i * batchSize; |
| | | // 结束位置 |
| | | int toIndex = (i + 1) * batchSize < length ? (i + 1) * batchSize : length; |
| | | if (fromIndex == batchSize) { |
| | | if (fromIndex == length) { |
| | | continue; |
| | | } |
| | | System.out.println(fromIndex + " === " + toIndex); |
| | |
| | | |
| | | public static Zyyt getBusinessEntity(String tableName, LocalDate date) { |
| | | if ("STATIONINFO".equalsIgnoreCase(tableName)) { |
| | | new ZyytStationInfo( |
| | | return new ZyytStationInfo( |
| | | ZyytConstant.URL_AUTHON, |
| | | ZyytConstant.URL_STATIONINFO_QUERY, |
| | | false, |
| | |
| | | server: |
| | | port: 9529 |
| | | servlet: |
| | | context-path: / |
| | | context-path: /schedule |
| | | spring: |
| | | # 出现错误时, 直接抛出异常(便于异常统一处理,否则捕获不到404) |
| | | mvc: |
| | |
| | | mvc: |
| | | static-path-pattern: /static # 设置静态文件路径,js,css等 |
| | | profiles: |
| | | active: prod |
| | | active: dev |
| | | http: |
| | | encoding: |
| | | charset: UTF-8 |