| | |
| | | @Slf4j |
| | | public class TransferTableDataJob implements Job { |
| | | |
| | | /** |
| | | * 若参数变量名修改 QuartzJobController中也需对应修改 迁移时间 例: 30 |
| | | */ |
| | | private String parameter; |
| | | |
| | | public void setParameter(String parameter) { |
| | | this.parameter = parameter; |
| | | } |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | |
| | | if (byJobClassName != null && !byJobClassName.isEmpty()) { |
| | | quartzLog.setJobId(byJobClassName.get(0).getId()); |
| | | } |
| | | quartzLog.setParams(this.parameter); |
| | | log.info("数据迁移任务 TransferTableDataJob start! 时间:" + DateUtils.getNow()); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | |
| | | Equipment info = new Equipment(); |
| | | info.setSavetablename("EquipmentLog"); |
| | | list.add(info); |
| | | String day = DateUtils.format(DateUtils.plusTime(DateUtils.getNow(), -30), DateUtils.STR_DATE_TIME_SMALL); |
| | | int dayNum = 30; |
| | | if (StringUtils.isNotBlank(this.parameter)) { |
| | | try { |
| | | dayNum = Integer.parseInt(this.parameter); |
| | | } catch (Exception e) { |
| | | log.error("参数格式不对", e); |
| | | } |
| | | } |
| | | String day = DateUtils.format(DateUtils.plusTime(DateUtils.getNow(), -dayNum), DateUtils.STR_DATE_TIME_SMALL); |
| | | for (Equipment equipment : list) { |
| | | if (StringUtils.isNotBlank(equipment.getSavetablename())) { |
| | | String tableName = equipmentService.checkTableExists(equipment.getSavetablename()); |