|
@@ -10,12 +10,16 @@
|
|
|
//import com.shanghaigeography.entity.ResultMsg;
|
|
|
//import com.shanghaigeography.eum.ResultState;
|
|
|
//import com.shcd.entity.ShorePowerBerthInfo;
|
|
|
+//import com.shcd.entity.ShorePowerBerthInfoNew;
|
|
|
//import com.shcd.entity.ShorePowerBlberthmonthuse;
|
|
|
//import com.shcd.entity.ShorePowerChdevicefbo;
|
|
|
//import com.shcd.entity.ShorePowerConnRecordInfo;
|
|
|
+//import com.shcd.entity.ShorePowerConnectorInfo;
|
|
|
//import com.shcd.entity.ShorePowerDeviceInfo;
|
|
|
+//import com.shcd.entity.ShorePowerDeviceInfoNew;
|
|
|
//import com.shcd.entity.ShorePowerDeviceStatusInfo;
|
|
|
//import com.shcd.entity.ShorePowerPortInfo;
|
|
|
+//import com.shcd.entity.ShorePowerPortInfoNew;
|
|
|
//import com.shcd.enums.GhjgPortThreeUrl;
|
|
|
//import com.shcd.service.*;
|
|
|
//import com.shcd.utils.secret.Encodes;
|
|
@@ -28,15 +32,16 @@
|
|
|
//import java.util.HashMap;
|
|
|
//import java.util.List;
|
|
|
//import java.util.Map;
|
|
|
+//import java.util.Optional;
|
|
|
//import java.util.concurrent.ExecutorService;
|
|
|
//import java.util.concurrent.Executors;
|
|
|
-//import javax.annotation.PostConstruct;
|
|
|
//import javax.annotation.Resource;
|
|
|
//import lombok.extern.slf4j.Slf4j;
|
|
|
//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
//import org.springframework.scheduling.annotation.Scheduled;
|
|
|
//import org.springframework.stereotype.Component;
|
|
|
//import org.springframework.util.CollectionUtils;
|
|
|
+//import org.springframework.web.bind.annotation.PostMapping;
|
|
|
//import org.springframework.web.bind.annotation.RequestBody;
|
|
|
//
|
|
|
//@Component
|
|
@@ -64,14 +69,31 @@
|
|
|
// @Resource
|
|
|
// ShorePowerChdevicefboService shorePowerChdevicefboService;
|
|
|
//
|
|
|
+// @Resource
|
|
|
+// IShorePowerPortInfoNewService portInfoNewService;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// IShorePowerBerthInfoNewService berthInfoNewService;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// IShorePowerDeviceInfoNewService deviceInfoNewService;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// IShorePowerConnectorInfoService shorePowerConnectorInfoService;
|
|
|
+//
|
|
|
// ExecutorService service = Executors.newFixedThreadPool(2);
|
|
|
//
|
|
|
-//// @Scheduled(cron = "0 0 0/1 * * ? ")
|
|
|
-//// @Scheduled(cron = "0 0/1 * * * ?")
|
|
|
+// @Scheduled(cron = "0 0 0/1 * * ? ")
|
|
|
+//// @Scheduled(cron = "0 0/1 * * * ? ")
|
|
|
// public void executeShorePowerScheduler() {
|
|
|
// try {
|
|
|
// service.execute(this::getConnRecordInfo);
|
|
|
// service.execute(this::getUserBerthRecordInfo);
|
|
|
+// service.execute(this::getPortInfoNew);
|
|
|
+// service.execute(this::getBerthInfoNew);
|
|
|
+// service.execute(this::getDeviceInfoNew);
|
|
|
+// service.execute(this::getDeviceConnectorInfo);
|
|
|
+// service.execute(this::getConnectorStatusInfo);
|
|
|
// } catch (Exception e) {
|
|
|
// log.error("执行出错,原因=====>{}", e.getMessage());
|
|
|
// }
|
|
@@ -112,6 +134,404 @@
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
+// public String getConnectorStatusInfo() {
|
|
|
+// try {
|
|
|
+//// String portId = (String) map.get("portId");
|
|
|
+//// String deviceId = (String) map.get("deviceId");
|
|
|
+//// String platformId = (String) map.get("platformId");
|
|
|
+//// String operatorId = (String) map.get("operatorId");
|
|
|
+//// String page = (String) map.get("current");
|
|
|
+//// String limit = (String) map.get("size");
|
|
|
+// String portId = "";
|
|
|
+// String deviceId = "";
|
|
|
+// String platformId = "";
|
|
|
+// String operatorId = "";
|
|
|
+// String page = "1";
|
|
|
+// String limit = "500";
|
|
|
+// String result = executeConnectorStatusInfoUrl(portId, deviceId, platformId, operatorId, page,
|
|
|
+// limit);
|
|
|
+// log.info("岸电设备接口状态信息查询接口调用成功! ===>返回结果:{}",
|
|
|
+// JSONObject.toJSONString(result));
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+// if (0 == ((int) jsonObject.get("Ret"))) {
|
|
|
+// String lightData = (String) jsonObject.get("Data");
|
|
|
+// String data = new String(Encodes.aesDecrypt(
|
|
|
+// Encodes.decodeBase64(lightData),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()), StandardCharsets.UTF_8);
|
|
|
+// log.info("==============> 业务数据:{}", JSONObject.toJSONString(data));
|
|
|
+// JSONObject dataJsonObject = (JSONObject) JSONObject.parse(data.toLowerCase());
|
|
|
+// JSONArray records = (JSONArray) dataJsonObject.get("records");
|
|
|
+// log.info("records ====>{}", records);
|
|
|
+// String arrayJSON = JSONObject.toJSONString(records, SerializerFeature.WriteClassName);
|
|
|
+// List<JSONObject> JSONObjectList = JSONObject.parseArray(arrayJSON,
|
|
|
+// JSONObject.class);
|
|
|
+// List<ShorePowerDeviceStatusInfo> deviceStatusInfos = new ArrayList<>();
|
|
|
+// JSONObjectList.forEach(x -> {
|
|
|
+// ShorePowerDeviceStatusInfo deviceStatusInfo = JSONObject.parseObject(JSON.toJSONString(x),
|
|
|
+// ShorePowerDeviceStatusInfo.class);
|
|
|
+// deviceStatusInfos.add(deviceStatusInfo);
|
|
|
+// });
|
|
|
+// log.info("==============> 业务转换为港航数据:{}",
|
|
|
+// JSONObject.toJSONString(deviceStatusInfos));
|
|
|
+//// deviceStatusInfos.forEach(x -> deviceStatusInfoService.saveOrUpdate(x));
|
|
|
+//// deviceStatusInfoService.saveOrUpdateBatch(deviceStatusInfos);
|
|
|
+// for (ShorePowerDeviceStatusInfo deviceStatusInfo : deviceStatusInfos) {
|
|
|
+// deviceStatusInfoService.saveOrUpdate(deviceStatusInfo);
|
|
|
+// }
|
|
|
+// log.info("操作完成,共有{}条数据", deviceStatusInfos.size());
|
|
|
+//// deviceStatusInfoService.saveBatch(deviceStatusInfos);
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return new ResultMsg<String>().setCode(ResultState.SUCCESS).setMsg("调用成功")
|
|
|
+// .setData(JSON.toJSONString(null)).toJSON();
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// public void getDeviceConnectorInfo() {
|
|
|
+// try {
|
|
|
+//// String portId = (String) map.get("portId");
|
|
|
+//// String platformId = (String) map.get("platformId");
|
|
|
+//// String operatorId = (String) map.get("operatorId");
|
|
|
+//// String deviceId = (String) map.get("deviceId");
|
|
|
+//// String page = (String) map.get("current");
|
|
|
+//// String limit = (String) map.get("size");
|
|
|
+// String portId = "";
|
|
|
+// String platformId = "";
|
|
|
+// String operatorId = "";
|
|
|
+// String deviceId = "";
|
|
|
+// String page = "1";
|
|
|
+// String limit = "500";
|
|
|
+// String result = executeDeviceConnectorInfoUrl(portId, platformId, operatorId, deviceId, page,
|
|
|
+// limit);
|
|
|
+// log.info("岸电设备接口信息查询接口调用成功! ===>返回结果:{}",
|
|
|
+// JSONObject.toJSONString(result));
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+// if (0 == ((int) jsonObject.get("Ret"))) {
|
|
|
+// String lightData = (String) jsonObject.get("Data");
|
|
|
+// String data = new String(Encodes.aesDecrypt(
|
|
|
+// Encodes.decodeBase64(lightData),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()), StandardCharsets.UTF_8);
|
|
|
+// log.info("==============> 业务数据:{}", JSONObject.toJSONString(data));
|
|
|
+// JSONObject dataJsonObject = (JSONObject) JSONObject.parse(data.toLowerCase());
|
|
|
+// JSONArray records = (JSONArray) dataJsonObject.get("records");
|
|
|
+// log.info("records ====>{}", records);
|
|
|
+// String arrayJSON = JSONObject.toJSONString(records, SerializerFeature.WriteClassName);
|
|
|
+// List<JSONObject> JSONObjectList = JSONObject.parseArray(arrayJSON,
|
|
|
+// JSONObject.class);
|
|
|
+// List<ShorePowerConnectorInfo> shorePowerConnectorInfos = new ArrayList<>();
|
|
|
+// JSONObjectList.forEach(x -> {
|
|
|
+// ShorePowerConnectorInfo connRecordInfo = JSONObject.parseObject(JSON.toJSONString(x),
|
|
|
+// ShorePowerConnectorInfo.class);
|
|
|
+// connRecordInfo.setCurrent1(Optional.of(connRecordInfo.getCurrent()).orElse(null));
|
|
|
+// shorePowerConnectorInfos.add(connRecordInfo);
|
|
|
+// });
|
|
|
+// log.info("==============> 业务转换为港航数据:{}",
|
|
|
+// JSONObject.toJSONString(shorePowerConnectorInfos));
|
|
|
+// for (ShorePowerConnectorInfo shorePowerConnectorInfo : shorePowerConnectorInfos) {
|
|
|
+// shorePowerConnectorInfoService.saveOrUpdate(shorePowerConnectorInfo);
|
|
|
+// }
|
|
|
+// log.info("操作完成,共有{}条数据", shorePowerConnectorInfos.size());
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// private String executeDeviceConnectorInfoUrl(String portId, String platformId, String operatorId,
|
|
|
+// String deviceId, String page,
|
|
|
+// String limit) {
|
|
|
+// JSONObject tokenJsonObject = JSONObject.parseObject(getToken());
|
|
|
+// JSONObject tokenData = JSONObject.parseObject((String) tokenJsonObject.get("data"));
|
|
|
+// String accessToken = (String) tokenData.get("AccessToken");
|
|
|
+// String platformID = (String) tokenData.get("PlatformID");
|
|
|
+// JSONObject data = new JSONObject();
|
|
|
+// JSONObject berthInfo = new JSONObject();
|
|
|
+// berthInfo.put("portId", portId);
|
|
|
+// berthInfo.put("platformId", platformId);
|
|
|
+// berthInfo.put("operatorId", operatorId);
|
|
|
+// berthInfo.put("deviceId", deviceId);
|
|
|
+// berthInfo.put("page", page);
|
|
|
+// berthInfo.put("limit", limit);
|
|
|
+// LocalDateTime now = LocalDateTime.now();
|
|
|
+// LocalDateTime oneHourAgo = now.minusHours(24);
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
|
|
|
+// berthInfo.put("updateDate", formatter.format(oneHourAgo));
|
|
|
+// data.put("connectorInfo", berthInfo);
|
|
|
+// JSONObject deviceRequest = new JSONObject();
|
|
|
+// deviceRequest.put("PlatformID", platformID);
|
|
|
+// deviceRequest.put("TimeStamp", String.valueOf(System.currentTimeMillis()));
|
|
|
+// deviceRequest.put("Seq", "0001");
|
|
|
+// deviceRequest.put("Data", data);
|
|
|
+// JSONObject sss = (JSONObject) deviceRequest.get("Data");
|
|
|
+// String mvData = Encodes.encodeBase64(
|
|
|
+// Encodes.aesEncrypt(sss.toString().getBytes(StandardCharsets.UTF_8),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()));
|
|
|
+// deviceRequest.put("Data", mvData);
|
|
|
+// Map<String, String> param = Maps.newLinkedHashMap();
|
|
|
+// param.put("PlatformID", deviceRequest.getString("PlatformID"));
|
|
|
+// param.put("Data", deviceRequest.getString("Data"));
|
|
|
+// param.put("TimeStamp", deviceRequest.getString("TimeStamp"));
|
|
|
+// param.put("Seq", deviceRequest.getString("Seq"));
|
|
|
+// String reqSign = Encodes.sign(param, GhjgPortThreeUrl.TOKEN_KEY.getUrl());
|
|
|
+// param.put("Sig", reqSign);
|
|
|
+// log.info("=====> 入参:{}", JSONObject.toJSONString(param));
|
|
|
+// HttpRequest post = HttpUtil.createPost(GhjgPortThreeUrl.PROXY_QUERY_CONNECTOR_INFO.getUrl());
|
|
|
+// Map<String, String> headers = new HashMap<>();
|
|
|
+// headers.put("Authorization", "Bearer" + " " + accessToken);
|
|
|
+// headers.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+// post.addHeaders(headers);
|
|
|
+// return post.body(JSONObject.toJSONString(param)).setReadTimeout(3600000).execute().body();
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// public void getDeviceInfoNew() {
|
|
|
+// try {
|
|
|
+//// String portId = (String) map.get("portId");
|
|
|
+//// String platformId = (String) map.get("platformId");
|
|
|
+//// String operatorId = (String) map.get("operatorId");
|
|
|
+//// String deviceId = (String) map.get("deviceId");
|
|
|
+//// String page = (String) map.get("current");
|
|
|
+//// String limit = (String) map.get("size");
|
|
|
+// String portId = "";
|
|
|
+// String platformId = "";
|
|
|
+// String operatorId = "";
|
|
|
+// String deviceId = "";
|
|
|
+// String page = "1";
|
|
|
+// String limit = "500";
|
|
|
+// String result = executeDeviceInfoNewUrl(portId, platformId, operatorId, deviceId, page,
|
|
|
+// limit);
|
|
|
+// log.info("长航 - 设备信息设备查询接口调用成功! ===>返回结果:{}",
|
|
|
+// JSONObject.toJSONString(result));
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+// if (0 == ((int) jsonObject.get("Ret"))) {
|
|
|
+// String lightData = (String) jsonObject.get("Data");
|
|
|
+// String data = new String(Encodes.aesDecrypt(
|
|
|
+// Encodes.decodeBase64(lightData),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()), StandardCharsets.UTF_8);
|
|
|
+// log.info("==============> 业务数据:{}", JSONObject.toJSONString(data).toLowerCase());
|
|
|
+// JSONObject dataJsonObject = (JSONObject) JSONObject.parse(data.toLowerCase());
|
|
|
+// JSONArray records = (JSONArray) dataJsonObject.get("records");
|
|
|
+// log.info("records ====>{}", records);
|
|
|
+// String arrayJSON = JSONObject.toJSONString(records, SerializerFeature.WriteClassName);
|
|
|
+// List<JSONObject> JSONObjectList = JSONObject.parseArray(arrayJSON,
|
|
|
+// JSONObject.class);
|
|
|
+// List<ShorePowerDeviceInfoNew> deviceInfoList = new ArrayList<>();
|
|
|
+// JSONObjectList.forEach(x -> {
|
|
|
+// ShorePowerDeviceInfoNew deviceInfo = JSONObject.parseObject(JSON.toJSONString(x),
|
|
|
+// ShorePowerDeviceInfoNew.class);
|
|
|
+// deviceInfoList.add(deviceInfo);
|
|
|
+// });
|
|
|
+// log.info("==============> 业务转换为港航数据:{}",
|
|
|
+// JSONObject.toJSONString(deviceInfoList));
|
|
|
+// deviceInfoList.forEach(x -> deviceInfoNewService.saveOrUpdate(x));
|
|
|
+// log.info("操作完成,共有{}条数据", deviceInfoList.size());
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private String executeDeviceInfoNewUrl(String portId, String platformId, String operatorId,
|
|
|
+// String deviceId, String page, String limit) {
|
|
|
+// JSONObject tokenJsonObject = JSONObject.parseObject(getToken());
|
|
|
+// JSONObject tokenData = JSONObject.parseObject((String) tokenJsonObject.get("data"));
|
|
|
+// String accessToken = (String) tokenData.get("AccessToken");
|
|
|
+// String platformID = (String) tokenData.get("PlatformID");
|
|
|
+// JSONObject data = new JSONObject();
|
|
|
+// JSONObject berthInfo = new JSONObject();
|
|
|
+// berthInfo.put("portId", portId);
|
|
|
+// berthInfo.put("platformId", platformId);
|
|
|
+// berthInfo.put("operatorId", operatorId);
|
|
|
+// berthInfo.put("deviceId", deviceId);
|
|
|
+// berthInfo.put("page", page);
|
|
|
+// berthInfo.put("limit", limit);
|
|
|
+// LocalDateTime now = LocalDateTime.now();
|
|
|
+// LocalDateTime oneHourAgo = now.minusHours(24);
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
|
|
|
+// berthInfo.put("updateDate", formatter.format(oneHourAgo));
|
|
|
+// data.put("deviceInfo", berthInfo);
|
|
|
+// JSONObject deviceRequest = new JSONObject();
|
|
|
+// deviceRequest.put("PlatformID", platformID);
|
|
|
+// deviceRequest.put("TimeStamp", String.valueOf(System.currentTimeMillis()));
|
|
|
+// deviceRequest.put("Seq", "0001");
|
|
|
+// deviceRequest.put("Data", data);
|
|
|
+// JSONObject sss = (JSONObject) deviceRequest.get("Data");
|
|
|
+// String mvData = Encodes.encodeBase64(
|
|
|
+// Encodes.aesEncrypt(sss.toString().getBytes(StandardCharsets.UTF_8),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()));
|
|
|
+// deviceRequest.put("Data", mvData);
|
|
|
+// Map<String, String> param = Maps.newLinkedHashMap();
|
|
|
+// param.put("PlatformID", deviceRequest.getString("PlatformID"));
|
|
|
+// param.put("Data", deviceRequest.getString("Data"));
|
|
|
+// param.put("TimeStamp", deviceRequest.getString("TimeStamp"));
|
|
|
+// param.put("Seq", deviceRequest.getString("Seq"));
|
|
|
+// String reqSign = Encodes.sign(param, GhjgPortThreeUrl.TOKEN_KEY.getUrl());
|
|
|
+// param.put("Sig", reqSign);
|
|
|
+// log.info("=====> 入参:{}", JSONObject.toJSONString(param));
|
|
|
+// HttpRequest post = HttpUtil.createPost(GhjgPortThreeUrl.PROXY_DEVICE_INFO.getUrl());
|
|
|
+// Map<String, String> headers = new HashMap<>();
|
|
|
+// headers.put("Authorization", "Bearer" + " " + accessToken);
|
|
|
+// headers.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+// post.addHeaders(headers);
|
|
|
+// return post.body(JSONObject.toJSONString(param)).setReadTimeout(3600000).execute().body();
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// public void getBerthInfoNew() {
|
|
|
+// try {
|
|
|
+//// String portId = (String) map.get("portId");
|
|
|
+//// String berthId = (String) map.get("berthId");
|
|
|
+//// String berthName = (String) map.get("berthName");
|
|
|
+//// String berthType = (String) map.get("berthType");
|
|
|
+//// String page = (String) map.get("current");
|
|
|
+//// String limit = (String) map.get("size");
|
|
|
+// String portId = "";
|
|
|
+// String berthId = "";
|
|
|
+// String berthName = "";
|
|
|
+// String berthType = "";
|
|
|
+// String page = "1";
|
|
|
+// String limit = "500";
|
|
|
+// String result = executeBerthInfoNewUrl(portId, berthId, berthName, berthType, page, limit);
|
|
|
+// log.info("泊位信息设备查询接口调用成功! ===>返回结果:{}",
|
|
|
+// JSONObject.toJSONString(result));
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+// if (0 == ((int) jsonObject.get("Ret"))) {
|
|
|
+// String lightData = (String) jsonObject.get("Data");
|
|
|
+// String data = new String(Encodes.aesDecrypt(
|
|
|
+// Encodes.decodeBase64(lightData),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()), StandardCharsets.UTF_8);
|
|
|
+// log.info("==============> 业务数据:{}", JSONObject.toJSONString(data).toLowerCase());
|
|
|
+// JSONObject dataJsonObject = (JSONObject) JSONObject.parse(data.toLowerCase());
|
|
|
+// JSONArray records = (JSONArray) dataJsonObject.get("records");
|
|
|
+// log.info("records ====>{}", records);
|
|
|
+// String arrayJSON = JSONObject.toJSONString(records, SerializerFeature.WriteClassName);
|
|
|
+// List<JSONObject> JSONObjectList = JSONObject.parseArray(arrayJSON,
|
|
|
+// JSONObject.class);
|
|
|
+// List<ShorePowerBerthInfoNew> berthInfoList = new ArrayList<>();
|
|
|
+// JSONObjectList.forEach(x -> {
|
|
|
+// ShorePowerBerthInfoNew deviceInfo = JSONObject.parseObject(JSON.toJSONString(x),
|
|
|
+// ShorePowerBerthInfoNew.class);
|
|
|
+// berthInfoList.add(deviceInfo);
|
|
|
+// });
|
|
|
+// log.info("==============> 业务转换为港航数据:{}",
|
|
|
+// JSONObject.toJSONString(berthInfoList));
|
|
|
+// berthInfoList.forEach(x -> berthInfoNewService.saveOrUpdate(x));
|
|
|
+// log.info("操作完成,共有{}条数据", berthInfoList.size());
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// private String executeBerthInfoNewUrl(String portId, String berthId, String berthName,
|
|
|
+// String berthType, String page, String limit) {
|
|
|
+// JSONObject tokenJsonObject = JSONObject.parseObject(getToken());
|
|
|
+// JSONObject tokenData = JSONObject.parseObject((String) tokenJsonObject.get("data"));
|
|
|
+// String accessToken = (String) tokenData.get("AccessToken");
|
|
|
+// String platformID = (String) tokenData.get("PlatformID");
|
|
|
+// JSONObject data = new JSONObject();
|
|
|
+// JSONObject berthInfo = new JSONObject();
|
|
|
+// berthInfo.put("portId", portId);
|
|
|
+// berthInfo.put("berthId", berthId);
|
|
|
+// berthInfo.put("berthName", berthName);
|
|
|
+// berthInfo.put("berthType", berthType);
|
|
|
+// berthInfo.put("page", page);
|
|
|
+// berthInfo.put("limit", limit);
|
|
|
+// LocalDateTime now = LocalDateTime.now();
|
|
|
+// LocalDateTime oneHourAgo = now.minusHours(24);
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
|
|
|
+// berthInfo.put("updateDate", formatter.format(oneHourAgo));
|
|
|
+// data.put("berthInfo", berthInfo);
|
|
|
+// JSONObject deviceRequest = new JSONObject();
|
|
|
+// deviceRequest.put("PlatformID", platformID);
|
|
|
+// deviceRequest.put("TimeStamp", String.valueOf(System.currentTimeMillis()));
|
|
|
+// deviceRequest.put("Seq", "0001");
|
|
|
+// deviceRequest.put("Data", data);
|
|
|
+// JSONObject sss = (JSONObject) deviceRequest.get("Data");
|
|
|
+// String mvData = Encodes.encodeBase64(
|
|
|
+// Encodes.aesEncrypt(sss.toString().getBytes(StandardCharsets.UTF_8),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()));
|
|
|
+// deviceRequest.put("Data", mvData);
|
|
|
+// Map<String, String> param = Maps.newLinkedHashMap();
|
|
|
+// param.put("PlatformID", deviceRequest.getString("PlatformID"));
|
|
|
+// param.put("Data", deviceRequest.getString("Data"));
|
|
|
+// param.put("TimeStamp", deviceRequest.getString("TimeStamp"));
|
|
|
+// param.put("Seq", deviceRequest.getString("Seq"));
|
|
|
+// String reqSign = Encodes.sign(param, GhjgPortThreeUrl.TOKEN_KEY.getUrl());
|
|
|
+// param.put("Sig", reqSign);
|
|
|
+// log.info("=====> 入参:{}", JSONObject.toJSONString(param));
|
|
|
+// HttpRequest post = HttpUtil.createPost(GhjgPortThreeUrl.PROXY_BERTH_INFO.getUrl());
|
|
|
+// Map<String, String> headers = new HashMap<>();
|
|
|
+// headers.put("Authorization", "Bearer" + " " + accessToken);
|
|
|
+// headers.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+// post.addHeaders(headers);
|
|
|
+// return post.body(JSONObject.toJSONString(param)).setReadTimeout(3600000).execute().body();
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// public void getPortInfoNew() {
|
|
|
+// try {
|
|
|
+//// String platformId = (String) map.get("platformId");
|
|
|
+//// String portName = (String) map.get("portName");
|
|
|
+//// String operatorName = (String) map.get("operatorName");
|
|
|
+//// String enterprisesName = (String) map.get("enterprisesName");
|
|
|
+//// String page = (String) map.get("current");
|
|
|
+//// String limit = (String) map.get("size");
|
|
|
+// String platformId = "";
|
|
|
+// String portName = "";
|
|
|
+// String operatorName = "";
|
|
|
+// String enterprisesName = "";
|
|
|
+// String page = "1";
|
|
|
+// String limit = "500";
|
|
|
+// String result = executePortInfoNewUrl(platformId, portName, operatorName, enterprisesName,
|
|
|
+// page, limit);
|
|
|
+// log.info("港口信息设备查询接口调用成功! ===>返回结果:{}",
|
|
|
+// JSONObject.toJSONString(result));
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+// if (0 == ((int) jsonObject.get("Ret"))) {
|
|
|
+// String lightData = (String) jsonObject.get("Data");
|
|
|
+// String data = new String(Encodes.aesDecrypt(
|
|
|
+// Encodes.decodeBase64(lightData),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()), StandardCharsets.UTF_8);
|
|
|
+// log.info("==============> 业务数据:{}", JSONObject.toJSONString(data));
|
|
|
+// JSONObject dataJsonObject = (JSONObject) JSONObject.parse(data.toLowerCase());
|
|
|
+// JSONArray records = (JSONArray) dataJsonObject.get("records");
|
|
|
+// log.info("records ====>{}", records);
|
|
|
+// String arrayJSON = JSONObject.toJSONString(records, SerializerFeature.WriteClassName);
|
|
|
+// List<JSONObject> JSONObjectList = JSONObject.parseArray(arrayJSON,
|
|
|
+// JSONObject.class);
|
|
|
+// List<ShorePowerPortInfoNew> portInfoList = new ArrayList<>();
|
|
|
+// JSONObjectList.forEach(x -> {
|
|
|
+// ShorePowerPortInfoNew portInfo = JSONObject.parseObject(JSON.toJSONString(x),
|
|
|
+// ShorePowerPortInfoNew.class);
|
|
|
+// portInfoList.add(portInfo);
|
|
|
+// });
|
|
|
+// log.info("==============> 业务转换为港航数据:{}",
|
|
|
+// JSONObject.toJSONString(portInfoList));
|
|
|
+// for (ShorePowerPortInfoNew portInfo : portInfoList) {
|
|
|
+// portInfoNewService.saveOrUpdate(portInfo);
|
|
|
+// }
|
|
|
+// log.info("操作完成,共有{}条数据", portInfoList.size());
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
// public void getUserBerthRecordInfo() {
|
|
|
// try {
|
|
|
//// String realName = (String) map.get("realName");
|
|
@@ -163,7 +583,6 @@
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
-// // @Scheduled(cron = "0 0 0/1 * * ? ")
|
|
|
// public void getConnRecordInfo() {
|
|
|
// try {
|
|
|
//// JSONObject map = JSONObject.parseObject(params);
|
|
@@ -480,6 +899,10 @@
|
|
|
// berthInfo.put("operatorId", operatorId);
|
|
|
// berthInfo.put("page", page);
|
|
|
// berthInfo.put("limit", limit);
|
|
|
+// LocalDateTime now = LocalDateTime.now();
|
|
|
+// LocalDateTime oneHourAgo = now.minusHours(24);
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
|
|
|
+// berthInfo.put("updateDate", formatter.format(oneHourAgo));
|
|
|
// data.put("connectorStatusInfo", berthInfo);
|
|
|
// JSONObject deviceRequest = new JSONObject();
|
|
|
// deviceRequest.put("PlatformID", platformID);
|
|
@@ -500,7 +923,7 @@
|
|
|
// String reqSign = Encodes.sign(param, GhjgPortThreeUrl.TOKEN_KEY.getUrl());
|
|
|
// param.put("Sig", reqSign);
|
|
|
// log.info("=====> 入参:{}", JSONObject.toJSONString(param));
|
|
|
-// HttpRequest post = HttpUtil.createPost(GhjgPortThreeUrl.QUERY_CONNECTOR_STATUS_INFO.getUrl());
|
|
|
+// HttpRequest post = HttpUtil.createPost(GhjgPortThreeUrl.PROXY_QUERY_CONNECTOR_STATUS_INFO.getUrl());
|
|
|
// Map<String, String> headers = new HashMap<>();
|
|
|
// headers.put("Authorization", "Bearer" + " " + accessToken);
|
|
|
// headers.put("Content-Type", "application/json;charset=utf-8");
|
|
@@ -668,6 +1091,53 @@
|
|
|
// return post.body(JSONObject.toJSONString(param)).setReadTimeout(3600000).execute().body();
|
|
|
// }
|
|
|
//
|
|
|
+// private String executePortInfoNewUrl(String platformId, String portName, String operatorName,
|
|
|
+// String enterprisesName, String page, String limit) {
|
|
|
+//
|
|
|
+// JSONObject tokenJsonObject = JSONObject.parseObject(getToken());
|
|
|
+// JSONObject tokenData = JSONObject.parseObject((String) tokenJsonObject.get("data"));
|
|
|
+// String accessToken = (String) tokenData.get("AccessToken");
|
|
|
+// String platformID = (String) tokenData.get("PlatformID");
|
|
|
+// JSONObject data = new JSONObject();
|
|
|
+// JSONObject berthInfo = new JSONObject();
|
|
|
+// berthInfo.put("platformId", platformId);
|
|
|
+// berthInfo.put("portName", portName);
|
|
|
+// berthInfo.put("operatorName", operatorName);
|
|
|
+// berthInfo.put("enterprisesName", enterprisesName);
|
|
|
+// berthInfo.put("page", page);
|
|
|
+// berthInfo.put("limit", limit);
|
|
|
+// LocalDateTime now = LocalDateTime.now();
|
|
|
+// LocalDateTime oneHourAgo = now.minusHours(24);
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
|
|
|
+// berthInfo.put("updateDate", formatter.format(oneHourAgo));
|
|
|
+// data.put("portInfo", berthInfo);
|
|
|
+// JSONObject portRequest = new JSONObject();
|
|
|
+// portRequest.put("PlatformID", platformID);
|
|
|
+// portRequest.put("TimeStamp", String.valueOf(System.currentTimeMillis()));
|
|
|
+// portRequest.put("Seq", "0001");
|
|
|
+// portRequest.put("Data", data);
|
|
|
+// JSONObject sss = (JSONObject) portRequest.get("Data");
|
|
|
+// String mvData = Encodes.encodeBase64(
|
|
|
+// Encodes.aesEncrypt(sss.toString().getBytes(StandardCharsets.UTF_8),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes(),
|
|
|
+// GhjgPortThreeUrl.TOKEN_KEY.getUrl().getBytes()));
|
|
|
+// portRequest.put("Data", mvData);
|
|
|
+// Map<String, String> param = Maps.newLinkedHashMap();
|
|
|
+// param.put("PlatformID", portRequest.getString("PlatformID"));
|
|
|
+// param.put("Data", portRequest.getString("Data"));
|
|
|
+// param.put("TimeStamp", portRequest.getString("TimeStamp"));
|
|
|
+// param.put("Seq", portRequest.getString("Seq"));
|
|
|
+// String reqSign = Encodes.sign(param, GhjgPortThreeUrl.TOKEN_KEY.getUrl());
|
|
|
+// param.put("Sig", reqSign);
|
|
|
+// log.info("=====> 入参:{}", JSONObject.toJSONString(param));
|
|
|
+// HttpRequest post = HttpUtil.createPost(GhjgPortThreeUrl.PORT_INFO.getUrl());
|
|
|
+// Map<String, String> headers = new HashMap<>();
|
|
|
+// headers.put("Authorization", "Bearer" + " " + accessToken);
|
|
|
+// headers.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+// post.addHeaders(headers);
|
|
|
+// return post.body(JSONObject.toJSONString(param)).setReadTimeout(3600000).execute().body();
|
|
|
+// }
|
|
|
+//
|
|
|
//
|
|
|
// public static void main(String[] args) {
|
|
|
// JSONObject data = new JSONObject();
|