opt:增加返回点功能。
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.agv.service.impl;
|
package org.nl.agv.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.StopWatch;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
@@ -37,6 +37,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@@ -58,6 +59,10 @@ import static org.nl.common.utils.LangUtils.getLanguage;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
public class TaskServiceServiceImpl implements TaskService {
|
public class TaskServiceServiceImpl implements TaskService {
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String isProd;
|
||||||
|
|
||||||
public static JSONObject pointJson = new JSONObject();
|
public static JSONObject pointJson = new JSONObject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,31 +73,68 @@ public class TaskServiceServiceImpl implements TaskService {
|
|||||||
JSONObject returnjo = new JSONObject();
|
JSONObject returnjo = new JSONObject();
|
||||||
try {
|
try {
|
||||||
String rest_pointcode = "";
|
String rest_pointcode = "";
|
||||||
ServiceResponse response = sendToAgvUtil.send("GetStationFloorIndexTable");
|
|
||||||
String result_info = JSONObject.parseObject(response.toString()).getString("ROS_String_Output");
|
|
||||||
if (StringUtils.isBlank(result_info)) {
|
|
||||||
returnjo.put("code", "1");
|
|
||||||
returnjo.put("result", null);
|
|
||||||
return returnjo;
|
|
||||||
}
|
|
||||||
String[] split = result_info.split("\\n");
|
|
||||||
for (int i = 0; i < split.length; i++) {
|
|
||||||
String row = split[i];
|
|
||||||
String[] rowArr = row.split("\\s+");
|
|
||||||
pointJson.put(rowArr[3], rowArr[4].contains("<") ? "" : rowArr[4]);
|
|
||||||
}
|
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
for (Object key : pointJson.keySet()) {
|
if ("prod".equals(isProd)) {
|
||||||
String value = (String) pointJson.get(key);
|
ServiceResponse response = sendToAgvUtil.send("GetStationFloorIndexTable");
|
||||||
System.out.println("Key = " + key + ", Value = " + value);
|
String result_info = JSONObject.parseObject(response.toString()).getString("ROS_String_Output");
|
||||||
JSONObject row = new JSONObject();
|
if (StringUtils.isBlank(result_info)) {
|
||||||
row.put("point_code", key);
|
returnjo.put("code", "1");
|
||||||
row.put("point_name", value);
|
returnjo.put("result", null);
|
||||||
row.put("code_name", key + "-" + value);
|
return returnjo;
|
||||||
if (StrUtil.equals("休息", value)) {
|
|
||||||
rest_pointcode = (String) key;
|
|
||||||
}
|
}
|
||||||
|
String[] split = result_info.split("\\n");
|
||||||
|
for (String row : split) {
|
||||||
|
String[] rowArr = row.split("\\s+");
|
||||||
|
pointJson.put(rowArr[3], rowArr[4].contains("<") ? "" : rowArr[4]);
|
||||||
|
}
|
||||||
|
for (String key : pointJson.keySet()) {
|
||||||
|
String value = (String) pointJson.get(key);
|
||||||
|
//System.out.println("Key = " + key + ", Value = " + value);
|
||||||
|
JSONObject row = new JSONObject();
|
||||||
|
row.put("point_code", key);
|
||||||
|
row.put("point_name", value);
|
||||||
|
row.put("code_name", key + "-" + value);
|
||||||
|
if (StrUtil.equals("休息", value)) {
|
||||||
|
rest_pointcode = key;
|
||||||
|
}
|
||||||
|
arr.add(row);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JSONObject row = new JSONObject();
|
||||||
|
row.put("point_code", "1");
|
||||||
|
row.put("point_name", "点位1");
|
||||||
|
row.put("code_name", "点位1");
|
||||||
|
JSONObject row1 = new JSONObject();
|
||||||
|
row1.put("point_code", "2");
|
||||||
|
row1.put("point_name", "点位2");
|
||||||
|
row1.put("code_name", "点位2");
|
||||||
|
JSONObject row2 = new JSONObject();
|
||||||
|
row2.put("point_code", "3");
|
||||||
|
row2.put("point_name", "点位3");
|
||||||
|
row2.put("code_name", "点位3");
|
||||||
|
JSONObject row3 = new JSONObject();
|
||||||
|
row3.put("point_code", "4");
|
||||||
|
row3.put("point_name", "点位4");
|
||||||
|
row3.put("code_name", "点位4");
|
||||||
|
JSONObject row4 = new JSONObject();
|
||||||
|
row4.put("point_code", "5");
|
||||||
|
row4.put("point_name", "二楼中间层休息点位与茶水间的充电桩交叉点1");
|
||||||
|
row4.put("code_name", "二楼中间层休息点位与茶水间的充电桩交叉点1");
|
||||||
|
JSONObject row5 = new JSONObject();
|
||||||
|
row5.put("point_code", "6");
|
||||||
|
row5.put("point_name", "二楼中间层休息点位充电桩1");
|
||||||
|
row5.put("code_name", "二楼中间层休息点位充电桩1");
|
||||||
|
JSONObject row6 = new JSONObject();
|
||||||
|
row6.put("point_code", "7");
|
||||||
|
row6.put("point_name", "一楼休息点位充电桩2");
|
||||||
|
row6.put("code_name", "一楼休息点位充电桩2");
|
||||||
arr.add(row);
|
arr.add(row);
|
||||||
|
arr.add(row1);
|
||||||
|
arr.add(row2);
|
||||||
|
arr.add(row3);
|
||||||
|
arr.add(row4);
|
||||||
|
arr.add(row5);
|
||||||
|
arr.add(row6);
|
||||||
}
|
}
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
returnjo.put("desc", LangUtils.getMsgLanguage("QuerySuccess", null));
|
returnjo.put("desc", LangUtils.getMsgLanguage("QuerySuccess", null));
|
||||||
@@ -176,7 +218,7 @@ public class TaskServiceServiceImpl implements TaskService {
|
|||||||
if (ObjectUtil.isNotEmpty(taskrow)) {
|
if (ObjectUtil.isNotEmpty(taskrow)) {
|
||||||
seq_num = taskrow.getInteger("seq_num") + 1;
|
seq_num = taskrow.getInteger("seq_num") + 1;
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(jsonObject.get("next_point_code"))) {
|
if (StringUtils.isNotBlank(jsonObject.get("next_point_code"))) {
|
||||||
taskjo.put("next_point_code2", jsonObject.get("next_point_code"));
|
taskjo.put("next_point_code2", jsonObject.get("next_point_code"));
|
||||||
}
|
}
|
||||||
taskjo.put("task_type", type);
|
taskjo.put("task_type", type);
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ public class SendHomeWebSocketServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Session getSession() {
|
public Session getSession() {
|
||||||
Integer d = 1;
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
// 发送消息,在定时任务中会调用此方法
|
// 发送消息,在定时任务中会调用此方法
|
||||||
|
|||||||
@@ -1527,13 +1527,11 @@ public class WQLObject implements Serializable, Cloneable {
|
|||||||
this.wo.addParam(whereArgNames.get(i), whereArgs[i]);
|
this.wo.addParam(whereArgNames.get(i), whereArgs[i]);
|
||||||
}
|
}
|
||||||
rb = this.wo.process();
|
rb = this.wo.process();
|
||||||
|
|
||||||
} catch (WDKException e) {
|
} catch (WDKException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new WDKException("wqlobject delete exception", e);
|
throw new WDKException("wqlobject delete exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rb;
|
return rb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user