|
@@ -1,12 +1,35 @@
|
|
package com.zskk.task;
|
|
package com.zskk.task;
|
|
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+import com.jfinal.kit.PropKit;
|
|
|
|
+import com.jfinal.plugin.activerecord.Db;
|
|
|
|
+import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
|
|
+import com.zskk.service.DataService;
|
|
|
|
+import com.zskk.service.ServiceFactory;
|
|
|
|
|
|
public class UpdateTask implements ITask {
|
|
public class UpdateTask implements ITask {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
|
|
+ List<Record> records = Db.use("connected").find("select * from reportinfo where REPORTDATE>?",parseStringToDate());
|
|
|
|
+ for (Record record : records) {
|
|
|
|
+ Map<String, String> annex_params = new HashMap<>();
|
|
|
|
+ annex_params.put("institution_id", PropKit.get("institution_id"));
|
|
|
|
+ annex_params.put("type", "4");
|
|
|
|
+ annex_params.put("code", record.getStr("STUDYUID"));
|
|
|
|
+ //附件类型1.mp4 2.pdf 3.jpeg
|
|
|
|
+ annex_params.put("annex_class_code", "2");
|
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
|
+ dService.saveAnnex(annex_params, record.getStr("PDF"));
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -15,5 +38,20 @@ public class UpdateTask implements ITask {
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 日期字符串格式转换
|
|
|
|
+ * @param dateStr
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String parseStringToDate() {
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ String timeString = null;
|
|
|
|
+ timeString = sdf.format(new Date(date.getTime()-3600000));
|
|
|
|
+ return timeString;
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|