package com.xcgl.middleware.task; import java.util.Date; import org.jeecgframework.core.util.ApplicationContextUtil; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.stereotype.Service; import com.xcgl.sensorrecord.service.SensorRecordServiceI; @Service("sensorRecordUploadTask") public class SensorReocrdsUploadTask implements Job{ @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { uploadData(); } public void uploadData() { long start = System.currentTimeMillis(); org.jeecgframework.core.util.LogUtil.info("===================中间件平台上传传感器数据定时任务开始==================="); try { org.jeecgframework.core.util.LogUtil.info("===================中间件平台上传传感器数据定时任务开始"+new Date()); SensorRecordServiceI recordService = ApplicationContextUtil.getContext().getBean(SensorRecordServiceI.class); recordService.uploadSensorRecord(); org.jeecgframework.core.util.LogUtil.info("===================中间件平台上传传感器数据定时任务结束"+new Date()); } catch (Exception e) { e.printStackTrace(); } org.jeecgframework.core.util.LogUtil.info("===================中间件平台上传传感器数据定时任务结束==================="); long end = System.currentTimeMillis(); long times = end - start; org.jeecgframework.core.util.LogUtil.info("总耗时"+times+"毫秒"); } }