diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/utils/GetIpAndPort.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/utils/GetIpAndPort.java index 7f498f48..53873604 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/utils/GetIpAndPort.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/utils/GetIpAndPort.java @@ -1,5 +1,7 @@ package com.xhpc.common.core.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -13,6 +15,7 @@ import java.util.Enumeration; public class GetIpAndPort { private static String ip; + private static final Logger log = LoggerFactory.getLogger(GetIpAndPort.class); //获取ip public static String getLocalIP() { @@ -22,9 +25,10 @@ public class GetIpAndPort { OK: for (Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements(); ) { NetworkInterface networkInterface = interfaces.nextElement(); - if (networkInterface.isLoopback() || networkInterface.isVirtual() || !networkInterface.isUp()) { + if (!networkInterface.getName().equals("eth0") || networkInterface.isLoopback() || networkInterface.isVirtual() || !networkInterface.isUp()) { continue; } + log.info(networkInterface.getName()); Enumeration addresses = networkInterface.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress address = addresses.nextElement(); diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java index 8659c322..27be550b 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/pp/utils/HexUtils.java @@ -68,7 +68,8 @@ public class HexUtils { if (data == null || data.length < end) return 0; - return Integer.decode("0x" + toHex(data, start, end)); + String s = toHex(data, start, end); + return Integer.decode("0x".concat(s)); } public static byte[] toBytes(String hex) { @@ -213,10 +214,11 @@ public class HexUtils { // System.out.println(reverseHexInt("FF00")); // byte[] data1 = toBytes(reverseHex("10270000")); // System.out.println(toInteger(data1, 0, 4)); - System.out.println(reverseHexInt("EA600000")); - System.out.println(reverseHexInt("000060EA")); - System.out.println(reverseHexInt("5D000000")); - System.out.println(toHexInt(82)); + System.out.println(Integer.MAX_VALUE); + System.out.println(reverseHexInt("C350E900")); + System.out.println(reverseHexInt("B2900007")); + System.out.println(reverseHexInt("CB08")); + System.out.println(reverseHexInt("070090B2")); // System.out.println(toHexInt(3800)); // System.out.println(toHexInt(100000)); // System.out.println(toBits("1000")); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index b451a6f0..ad445cef 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -136,7 +136,7 @@ public class XhpcHistoryOrderController extends BaseController { * 日期统计\场站统计\终端统计 */ @GetMapping("/test1") - @Scheduled(cron = "0 0/2 * * * ?") +// @Scheduled(cron = "0 0/2 * * * ?") public void test1(){ add(3000,1); } @@ -426,7 +426,7 @@ public class XhpcHistoryOrderController extends BaseController { * 小时统计 */ @GetMapping("/test") - @Scheduled(cron = "0 0/2 * * * ?") +// @Scheduled(cron = "0 0/2 * * * ?") public void test(){ logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>"); //小时统计 @@ -889,7 +889,7 @@ public class XhpcHistoryOrderController extends BaseController { * 24小时异常订单自动结算 */ @GetMapping("/test4") - @Scheduled(cron = "0 0/5 * * * ?") +// @Scheduled(cron = "0 0/5 * * * ?") public void test4(){ //获取异常的订单 24小时之外的异常订单 List> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2); @@ -916,13 +916,13 @@ public class XhpcHistoryOrderController extends BaseController { * @param */ @GetMapping("/test5") - @Scheduled(cron = "0 0/5 * * * ?") +// @Scheduled(cron = "0 0/5 * * * ?") public void test5(){ logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>"); chargeOrderService.updateStatus(); } - @Scheduled(cron = "0 0/1 * * * ?") +// @Scheduled(cron = "0 0/1 * * * ?") @GetMapping("/getInvoiceInfo") public void getInvoiceInfo(){ logger.info("++++++++++++每1分钟,扫描一次,异常订单,自动生成工单++++++++++++++++"); @@ -946,7 +946,7 @@ public class XhpcHistoryOrderController extends BaseController { //检查统计没有入库的订单(小时) - @Scheduled(cron = "0 5 * * * ?") +// @Scheduled(cron = "0 5 * * * ?") @GetMapping("/getInvoTime") public void getNoStatisticsOrderTime(){ List list = xhpcHistoryOrderService.getNoStatisticsOrderTime(3000); @@ -1011,7 +1011,7 @@ public class XhpcHistoryOrderController extends BaseController { } } //检查统计没有入库的订单(日期、电站) - @Scheduled(cron = "0 30 * * * ?") +// @Scheduled(cron = "0 30 * * * ?") @GetMapping("/getInvoDay") public void getInvoDay(){ List listOrder = xhpcHistoryOrderService.getNoStatisticsOrderDay(500); diff --git a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml index a45f7112..70e117f3 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml @@ -1,6 +1,6 @@ # Tomcat server: - port: 8885 + port: 3885 # Spring spring: @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 172.31.183.135:8848 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 172.31.183.135:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java index 4d7aad20..0396b6a9 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java @@ -78,7 +78,8 @@ public class ChargingPileServer { public static void disconnPileNGuns(String pileNo) { ClientHandler handler = handlerMap.remove(pileNo); - handler.closeConnection(); + if(handler!=null) + handler.closeConnection(); log.debug("handler [{}] for ({}) close connection", handler.getName(), pileNo); String pkey = "pile:".concat(pileNo); Map cachePile = REDIS.getCacheMap(pkey); diff --git a/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml index 9503d966..224d1f2e 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml @@ -4,7 +4,7 @@ ppsvc: # Tomcat server: - port: 1300 + port: 1301 # Spring spring: @@ -18,10 +18,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8858 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: 127.0.0.1:8858 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置