|
@@ -13,6 +13,8 @@ import tech.powerjob.work.mapper.waterPassengerTransport.HMDataServiceMapper;
|
|
|
import tech.powerjob.work.service.waterPassengerTransport.HMDataShareService;
|
|
|
import tech.powerjob.work.util.ApiUtils;
|
|
|
import tech.powerjob.work.util.DateUtils;
|
|
|
+import tech.powerjob.work.util.HttpClientUtils;
|
|
|
+import tech.powerjob.work.util.ReturnMsg;
|
|
|
import tech.powerjob.worker.core.processor.ProcessResult;
|
|
|
|
|
|
import java.util.HashMap;
|
|
@@ -32,6 +34,8 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
|
|
|
@Value("${preGhjgWebService}")
|
|
|
private String preGhjgWebService;
|
|
|
+ @Value("${hmService}")
|
|
|
+ private String hmService;
|
|
|
|
|
|
@Autowired
|
|
|
HMDataServiceMapper mapper;
|
|
@@ -92,26 +96,59 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
* }
|
|
|
*/
|
|
|
// 获取token
|
|
|
+
|
|
|
public String getToken() {
|
|
|
- try {
|
|
|
- Map<String, String> headers = new HashMap();
|
|
|
- String url = preGhjgWebService + "hdsp/CheckToken"; //资源url地址
|
|
|
- log.info("getToken开始调用");
|
|
|
- String result = ApiUtils.post(url, headers, ""); //post请求
|
|
|
- log.info("getToken 返回结果:" + result);
|
|
|
- String token = "";
|
|
|
- if (StringUtils.isBlank(result)) {
|
|
|
- log.info("CheckToken 返回结果为空");
|
|
|
- } else {
|
|
|
- if (result.indexOf("checkToken异常") == -1) {
|
|
|
- token = result.replace("\r\n", "");
|
|
|
+ try{
|
|
|
+ String url = preGhjgWebService + "Validate/GetToken";
|
|
|
+ Map<String,String> header = new HashMap<>();
|
|
|
+ Map<String,String> param = new HashMap<>();
|
|
|
+ param.put("userId","chengdi");
|
|
|
+ param.put("password","chengdi@147");
|
|
|
+ String result = HttpClientUtils.doGet(url,header,param,20000);
|
|
|
+ log.info(result);
|
|
|
+ String returnMsg = "";
|
|
|
+ JSONObject object = JSONObject.parseObject(result);
|
|
|
+ if((Boolean) object.get("Success")){
|
|
|
+ JSONObject data = JSONObject.parseObject(String.valueOf(object.get("Data")));
|
|
|
+ if(data!=null){
|
|
|
+ returnMsg = String.valueOf(data.get("token"));
|
|
|
}
|
|
|
+ }else{
|
|
|
+ returnMsg = object.get("Message").toString();
|
|
|
}
|
|
|
- return token;
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- log.info(e.getMessage());
|
|
|
- return "";
|
|
|
+ return returnMsg;
|
|
|
+ }catch (Exception err){
|
|
|
+ log.info("checkToken异常:"+err.getMessage());
|
|
|
+ return ReturnMsg.returnErrorMsgNew("checkToken异常:"+err.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getHMService(Map<String, String> map){
|
|
|
+ try{
|
|
|
+ log.info("getHMService接收到参数:"+map.toString());
|
|
|
+ log.info("hwToken:"+map.get("token"));
|
|
|
+ if(StringUtils.isBlank(map.get("token"))){
|
|
|
+ log.info("hwToken为空!");
|
|
|
+ return "token不能为空!";
|
|
|
+ }
|
|
|
+
|
|
|
+ String url = hmService + map.get("method").toString();
|
|
|
+ Map<String,String> header = new HashMap<>();
|
|
|
+ Map<String,String> param = new HashMap<>();
|
|
|
+
|
|
|
+ param.put("token", map.get("token"));
|
|
|
+ for(String key:map.keySet()){
|
|
|
+ if(!"method".equals(key)){
|
|
|
+ param.put(key,map.get(key));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String result = HttpClientUtils.doGet(url,header,param,20000);
|
|
|
+ log.info(result);
|
|
|
+ return result;
|
|
|
+ }catch (Exception err){
|
|
|
+ err.getStackTrace();
|
|
|
+ log.info("getHMService异常:"+err.getMessage());
|
|
|
+ return ReturnMsg.returnErrorMsgNew("getHMService异常:"+err.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -122,16 +159,15 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
headers.put("method", method);
|
|
|
headers.put("startTime", startTime);
|
|
|
headers.put("endTime", endTime);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"startTime\":\"" + startTime + "\",\"endTime\":\"" + endTime + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("Schedule/Query开始调用 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("Schedule/Query 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("Schedule/Query 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
List<HmScheduleTicket> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmScheduleTicket.class);
|
|
|
if (list.size() > 0) {
|
|
|
// list.sort((o1, o2) -> {
|
|
@@ -150,8 +186,8 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
}
|
|
|
}
|
|
|
log.info("Schedule/Query 执行完毕 数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("Schedule/Query:" + object.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -167,16 +203,15 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
headers.put("method", method);
|
|
|
headers.put("dockCode", "");
|
|
|
headers.put("dayTime", dayTime);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"dockCode\":\"\",\"dayTime\":\"" + dayTime + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("Schedule/TotalQuery 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("Schedule/TotalQuery 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("Schedule/TotalQuery 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
HmTotalInfo data = JSONObject.parseObject(String.valueOf(object.get("Data")), HmTotalInfo.class);
|
|
|
if (data != null) {
|
|
|
data.setDockCode("0");
|
|
@@ -184,12 +219,13 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
mapper.SaveOrUpdateTotalInfo(data);
|
|
|
}
|
|
|
log.info("Schedule/TotalQuery 执行完毕!");
|
|
|
- } else {
|
|
|
- log.info("Schedule/TotalQuery:" + object.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ log.info("getTotalInfo异常"+e);
|
|
|
log.info(e.getMessage());
|
|
|
}
|
|
|
}
|
|
@@ -199,16 +235,15 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
String method = "CommonInfo/Company";
|
|
|
Map<String, String> headers = new HashMap();
|
|
|
headers.put("method", method);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("CommonInfo/Company 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("CommonInfo/Company 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("CommonInfo/Company 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
List<HmCompanyInfo> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmCompanyInfo.class);
|
|
|
if (list.size() > 0) {
|
|
|
for (HmCompanyInfo item : list) {
|
|
@@ -216,8 +251,8 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
}
|
|
|
}
|
|
|
log.info("CommonInfo/Company 执行完毕!数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("CommonInfo/Company:" + object.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -232,16 +267,15 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
String method = "CommonInfo/Ship";
|
|
|
Map<String, String> headers = new HashMap();
|
|
|
headers.put("method", method);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("CommonInfo/Ship 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("CommonInfo/Ship 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("CommonInfo/Ship 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
List<HmShipInfo> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmShipInfo.class);
|
|
|
if (list.size() > 0) {
|
|
|
for (HmShipInfo item : list) {
|
|
@@ -249,8 +283,8 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
}
|
|
|
}
|
|
|
log.info("CommonInfo/Ship 执行完毕!数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("CommonInfo/Ship:" + object.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -260,40 +294,39 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void getScheduleInfo(String startTime, String endTime, String token) {
|
|
|
- try {
|
|
|
- String method = "CommonInfo/Schedule";
|
|
|
- Map<String, String> headers = new HashMap();
|
|
|
- headers.put("method", method);
|
|
|
- headers.put("startTime", startTime);
|
|
|
- headers.put("endTime", endTime);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"startTime\":\"" + startTime + "\",\"endTime\":\"" + endTime + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("CommonInfo/Schedule 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
- log.info("CommonInfo/Schedule 返回结果:" + result);
|
|
|
- if (StringUtils.isBlank(result)) {
|
|
|
- log.info("CommonInfo/Schedule 返回结果为空");
|
|
|
- } else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
- List<HmScheduleTicket> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmScheduleTicket.class);
|
|
|
- if (list.size() > 0) {
|
|
|
- for (HmScheduleTicket item : list) {
|
|
|
- mapper.SaveOrUpdateScheduleTicket(item);
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("CommonInfo/Schedule 执行完毕!数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("CommonInfo/Schedule:" + object.get("Message").toString());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- log.info(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
+// private void getScheduleInfo(String startTime, String endTime, String token) {
|
|
|
+// try {
|
|
|
+// String method = "CommonInfo/Schedule";
|
|
|
+// Map<String, String> headers = new HashMap();
|
|
|
+// headers.put("method", method);
|
|
|
+// headers.put("startTime", startTime);
|
|
|
+// headers.put("endTime", endTime);
|
|
|
+// headers.put("token", token);
|
|
|
+// String result = getHMService(headers);
|
|
|
+// log.info("CommonInfo/Schedule 返回结果:" + result);
|
|
|
+// if (StringUtils.isBlank(result)) {
|
|
|
+// log.info("CommonInfo/Schedule 返回结果为空");
|
|
|
+// } else {
|
|
|
+// boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+// JSONObject object = new JSONObject(isTrue);
|
|
|
+// if (isTrue) {
|
|
|
+// List<HmScheduleTicket> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmScheduleTicket.class);
|
|
|
+// if (list.size() > 0) {
|
|
|
+// for (HmScheduleTicket item : list) {
|
|
|
+// mapper.SaveOrUpdateScheduleTicket(item);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// log.info("CommonInfo/Schedule 执行完毕!数据总数:" + list.size());
|
|
|
+// }else {
|
|
|
+// log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// log.info(e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
public void getDaylyLYKYInfo(String startTime, String endTime, String token) {
|
|
|
try {
|
|
@@ -302,16 +335,15 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
headers.put("method", method);
|
|
|
headers.put("startTime", startTime);
|
|
|
headers.put("endTime", endTime);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"startTime\":\"" + startTime + "\",\"endTime\":\"" + endTime + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("CommonInfo/Passenger 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("CommonInfo/Passenger 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("CommonInfo/Passenger 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
List<HmScheduleTicket> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmScheduleTicket.class);
|
|
|
if (list.size() > 0) {
|
|
|
for (HmScheduleTicket item : list) {
|
|
@@ -319,8 +351,8 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
}
|
|
|
}
|
|
|
log.info("CommonInfo/Passenger 执行完毕!数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("CommonInfo/Passenger:" + object.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -337,16 +369,15 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
headers.put("method", method);
|
|
|
headers.put("startTime", startTime);
|
|
|
headers.put("endTime", endTime);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"startTime\":\"" + startTime + "\",\"endTime\":\"" + endTime + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("CommonInfo/TotalPassenger 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("CommonInfo/TotalPassenger 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("CommonInfo/TotalPassenger 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
JSONArray array = JSONObject.parseArray(String.valueOf(object.get("Data")));
|
|
|
if (array.size() > 0) {
|
|
|
for (Object item : array) {
|
|
@@ -354,8 +385,8 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
}
|
|
|
}
|
|
|
log.info("CommonInfo/TotalPassenger 执行完毕!数据总数:" + array.size());
|
|
|
- } else {
|
|
|
- log.info("CommonInfo/TotalPassenger:" + object.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -370,25 +401,24 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
String method = "Schedule/GetPierBerthInfo";
|
|
|
Map<String, String> headers = new HashMap();
|
|
|
headers.put("method", method);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("Schedule/GetPierBerthInfo 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("Schedule/GetPierBerthInfo 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("Schedule/GetPierBerthInfo 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
List<HmPierBerthInfo> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmPierBerthInfo.class);
|
|
|
if (list.size() > 0) {
|
|
|
for (HmPierBerthInfo item : list) {
|
|
|
mapper.SaveOrUpdatePierBerthInfo(item);
|
|
|
}
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
log.info("Schedule/GetPierBerthInfo 执行完毕!数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("Schedule/GetPierBerthInfo:" + object.get("Message").toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -403,16 +433,15 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
String method = "Schedule/GetScheduleTypeInfo";
|
|
|
Map<String, String> headers = new HashMap();
|
|
|
headers.put("method", method);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("Schedule/GetScheduleTypeInfo 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("Schedule/GetScheduleTypeInfo 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("Schedule/GetScheduleTypeInfo 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) object.get("Success")) {
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
List<HmScheduleTypeInfo> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmScheduleTypeInfo.class);
|
|
|
if (list.size() > 0) {
|
|
|
for (HmScheduleTypeInfo item : list) {
|
|
@@ -420,8 +449,8 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
}
|
|
|
}
|
|
|
log.info("Schedule/GetScheduleTypeInfo 执行完毕!数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("Schedule/GetScheduleTypeInfo:" + object.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -437,25 +466,24 @@ public class HMDataServiceImpl implements HMDataShareService {
|
|
|
String method = "CommonInfo/BerthStatus";
|
|
|
Map<String, String> headers = new HashMap();
|
|
|
headers.put("method", method);
|
|
|
- String url = preGhjgWebService + "hdsp/GetHMService"; //资源url地址
|
|
|
- String json = "{\"method\":\"" + method + "\",\"token\":\"" + token + "\"}";
|
|
|
- log.info("CommonInfo/BerthStatus 参数:" + json);
|
|
|
- String result = ApiUtils.post(url, headers, json); //post请求
|
|
|
+ headers.put("token", token);
|
|
|
+ String result = getHMService(headers);
|
|
|
log.info("CommonInfo/BerthStatus 返回结果:" + result);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("CommonInfo/BerthStatus 返回结果为空");
|
|
|
} else {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
- if ((Boolean) jsonObject.get("Success")) {
|
|
|
- List<HmScheduleBerthStatus> list = JSONObject.parseArray(String.valueOf(jsonObject.get("Data")), HmScheduleBerthStatus.class);
|
|
|
+ boolean isTrue = Boolean.parseBoolean(result);
|
|
|
+ JSONObject object = new JSONObject(isTrue);
|
|
|
+ if (isTrue) {
|
|
|
+ List<HmScheduleBerthStatus> list = JSONObject.parseArray(String.valueOf(object.get("Data")), HmScheduleBerthStatus.class);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (HmScheduleBerthStatus hmScheduleBerthStatus : list) {
|
|
|
mapper.SaveOrUpdateBerthStatus(hmScheduleBerthStatus);
|
|
|
}
|
|
|
}
|
|
|
log.info("Schedule/GetScheduleTypeInfo 执行完毕!数据总数:" + list.size());
|
|
|
- } else {
|
|
|
- log.info("Schedule/GetScheduleTypeInfo:" + jsonObject.get("Message").toString());
|
|
|
+ }else {
|
|
|
+ log.info("CommonInfo/BerthStatus 执行失败!"+result);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|