separation

This commit is contained in:
ZZ 2022-10-09 14:36:41 +08:00
parent 1543490364
commit 731ab343b5
6 changed files with 27 additions and 20 deletions

View File

@ -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<NetworkInterface> 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<InetAddress> addresses = networkInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress address = addresses.nextElement();

View File

@ -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"));

View File

@ -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<Map<String,Object>> 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<XhpcChargeHistoryOrder> 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<XhpcChargeHistoryOrder> listOrder = xhpcHistoryOrderService.getNoStatisticsOrderDay(500);

View File

@ -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
# 共享配置

View File

@ -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<String, Object> cachePile = REDIS.getCacheMap(pkey);

View File

@ -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
# 共享配置