|
@@ -2,9 +2,15 @@ package com.zskk.task;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
|
+import com.zskk.service.DataService;
|
|
|
+import com.zskk.service.ServiceFactory;
|
|
|
import com.zskk.tools.ExecUtil;
|
|
|
|
|
|
public class CMoveTask implements ITask {
|
|
@@ -12,20 +18,45 @@ public class CMoveTask implements ITask {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// TODO Auto-generated method stub
|
|
|
- Record studyidfind = Db.use("local").findFirst("select * from study where status =1 or status =2 order by createAt desc");
|
|
|
- if (studyidfind == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- studyidfind.set("status", 4);
|
|
|
- Db.use("local").update("study", studyidfind);
|
|
|
- String execCmd = ExecUtil.execCmd("/zskk_system/other/cmove.sh " + studyidfind.getStr("studyuid"));
|
|
|
- if (execCmd.contains("Connection refused") || execCmd.contains("Socket closed")) {
|
|
|
- studyidfind.set("status", 2);
|
|
|
- Db.use("local").update("study", studyidfind);
|
|
|
- return;
|
|
|
+ int flag = 0;
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
+ JSONArray jsonArray = dService.getExamList(50);
|
|
|
+ Record studyidfind = null;
|
|
|
+ while (flag == 0) {
|
|
|
+ studyidfind = Db.use("local").findFirst("select * from study where status =1 or status =2 order by createAt desc");
|
|
|
+ if (studyidfind == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(object.toString());
|
|
|
+ if (jsonObject.getString("studyuid").equals(studyidfind.getStr("STUDYUID"))) {
|
|
|
+ //5cmove前以获取
|
|
|
+ studyidfind.set("status", 5);
|
|
|
+ Db.use("local").update("study", studyidfind);
|
|
|
+ studyidfind = null;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (studyidfind != null) {
|
|
|
+ flag = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (studyidfind != null) {
|
|
|
+ studyidfind.set("status", 4);
|
|
|
+ Db.use("local").update("study", studyidfind);
|
|
|
+ String execCmd = ExecUtil.execCmd("/zskk_system/other/cmove.sh " + studyidfind.getStr("studyuid"));
|
|
|
+ if (execCmd.contains("Connection refused") || execCmd.contains("Socket closed")) {
|
|
|
+ studyidfind.set("status", 2);
|
|
|
+ Db.use("local").update("study", studyidfind);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ studyidfind.set("status", 3);
|
|
|
+ Db.use("local").update("study", studyidfind);
|
|
|
}
|
|
|
- studyidfind.set("status", 3);
|
|
|
- Db.use("local").update("study", studyidfind);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|