T copyProperties(Object src, JavaType type) throws Exception {
+
return JSON.parseObject(JSON.toJSONString(src), type);
}
diff --git a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/SpringContextHolder.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/SpringContextHolder.java
similarity index 100%
rename from xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/SpringContextHolder.java
rename to xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/SpringContextHolder.java
diff --git a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/Base64Utils.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/Base64Utils.java
similarity index 99%
rename from xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/Base64Utils.java
rename to xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/Base64Utils.java
index a832c907..35cb29a4 100644
--- a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/Base64Utils.java
+++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/Base64Utils.java
@@ -5,7 +5,9 @@ import com.ruoyi.common.core.utils.sign.Base64;
import java.io.*;
-/** */
+/**
+ *
+ */
/**
*
@@ -38,6 +40,7 @@ public class Base64Utils {
* @throws Exception
*/
public static byte[] decode(String base64) throws Exception {
+
return Base64.decode(base64);
}
@@ -52,6 +55,7 @@ public class Base64Utils {
* @throws Exception
*/
public static String encode(byte[] bytes) throws Exception {
+
return new String(Base64.encode(bytes));
}
@@ -69,6 +73,7 @@ public class Base64Utils {
* @throws Exception
*/
public static String encodeFile(String filePath) throws Exception {
+
byte[] bytes = fileToByte(filePath);
return encode(bytes);
}
@@ -84,6 +89,7 @@ public class Base64Utils {
* @throws Exception
*/
public static void decodeToFile(String filePath, String base64) throws Exception {
+
byte[] bytes = decode(base64);
byteArrayToFile(bytes, filePath);
}
@@ -99,6 +105,7 @@ public class Base64Utils {
* @throws Exception
*/
public static byte[] fileToByte(String filePath) throws Exception {
+
byte[] data = new byte[0];
File file = new File(filePath);
if (file.exists()) {
@@ -127,6 +134,7 @@ public class Base64Utils {
* @param filePath 文件生成目录
*/
public static void byteArrayToFile(byte[] bytes, String filePath) throws Exception {
+
InputStream in = new ByteArrayInputStream(bytes);
File destFile = new File(filePath);
if (!destFile.getParentFile().exists()) {
diff --git a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/CRCCalculator.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CRCCalculator.java
similarity index 95%
rename from xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/CRCCalculator.java
rename to xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CRCCalculator.java
index aaac2d98..6d21b0b3 100644
--- a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/CRCCalculator.java
+++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CRCCalculator.java
@@ -5,6 +5,7 @@ import java.util.Arrays;
public class CRCCalculator {
public static String ModbusCRC(byte[] pData) {
+
int crc = 0xFFFF;
for (byte pDatum : pData) {
crc ^= (int) pDatum & 0xFF; // XOR byte into least sig. byte of crc
@@ -22,11 +23,13 @@ public class CRCCalculator {
}
public static String calcCrc(byte[] data) {
- byte[] data2 = Arrays.copyOfRange(data, 2, data.length-2);
+
+ byte[] data2 = Arrays.copyOfRange(data, 2, data.length - 2);
return CRCCalculator.ModbusCRC(data2);
}
public static String calcCrc(String msg) {
+
byte[] data = HexUtils.toBytes(msg);
assert data != null;
byte[] data2 = Arrays.copyOfRange(data, 2, data.length);
@@ -34,6 +37,7 @@ public class CRCCalculator {
}
public static int byteArrayToInt(byte[] b) {
+
return b[3] & 0xFF |
(b[2] & 0xFF) << 8 |
(b[1] & 0xFF) << 16 |
@@ -41,6 +45,7 @@ public class CRCCalculator {
}
public static byte[] intToByteArray(int a) {
+
return new byte[]{
(byte) ((a >> 24) & 0xFF),
(byte) ((a >> 16) & 0xFF),
diff --git a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/DES.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/DES.java
similarity index 100%
rename from xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/DES.java
rename to xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/DES.java
diff --git a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/HexUtils.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/HexUtils.java
similarity index 100%
rename from xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/HexUtils.java
rename to xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/HexUtils.java
diff --git a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/MD5.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/MD5.java
similarity index 96%
rename from xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/MD5.java
rename to xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/MD5.java
index da68c268..d0200191 100644
--- a/xhpc-modules/xhpc-power-pole/src/main/java/com/xhpc/pp/utils/security/MD5.java
+++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/MD5.java
@@ -17,23 +17,26 @@ public class MD5 {
* @return 签名结果
*/
public static String sign(String text, String key, String input_charset) {
+
text = text + key;
return DigestUtils.md5Hex(getContentBytes(text, input_charset));
}
public static String sign(String text, String key) {
+
return sign(text, key, "utf-8").toUpperCase();
}
/**
* 签名字符串
*
- * @param text 需要签名的字符串
- * @param sign 签名结果
- * @param key 密钥
+ * @param text 需要签名的字符串
+ * @param sign 签名结果
+ * @param key 密钥
* @return 签名结果
*/
public static boolean verify(String text, String sign, String key) {
+
text = text + key;
String mysign = DigestUtils.md5Hex(getContentBytes(text, "UTF-8"));
if (mysign.equals(sign)) {
@@ -51,6 +54,7 @@ public class MD5 {
* @throws UnsupportedEncodingException
*/
private static byte[] getContentBytes(String content, String charset) {
+
if (charset == null || "".equals(charset)) {
return content.getBytes();
}
diff --git a/xhpc-modules/xhpc-power-pole/src/main/resources/banner.txt b/xhpc-modules/xhpc-power-pile/src/main/resources/banner.txt
similarity index 100%
rename from xhpc-modules/xhpc-power-pole/src/main/resources/banner.txt
rename to xhpc-modules/xhpc-power-pile/src/main/resources/banner.txt
diff --git a/xhpc-modules/xhpc-power-pole/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml
similarity index 95%
rename from xhpc-modules/xhpc-power-pole/src/main/resources/bootstrap.yml
rename to xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml
index 24c288c0..8f5496ea 100644
--- a/xhpc-modules/xhpc-power-pole/src/main/resources/bootstrap.yml
+++ b/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml
@@ -10,7 +10,7 @@ server:
spring:
application:
# 应用名称
- name: xhpc-power-pole
+ name: xhpc-power-pile
profiles:
# 环境配置
active: dev
diff --git a/xhpc-modules/xhpc-power-pile/src/main/resources/logback.xml b/xhpc-modules/xhpc-power-pile/src/main/resources/logback.xml
new file mode 100644
index 00000000..83ed4f2d
--- /dev/null
+++ b/xhpc-modules/xhpc-power-pile/src/main/resources/logback.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+ ${log.pattern}
+
+
+
+
+
+ ${log.path}/info.log
+
+
+
+ ${log.path}/info.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern}
+
+
+
+ INFO
+
+ ACCEPT
+
+ DENY
+
+
+
+
+ ${log.path}/error.log
+
+
+
+ ${log.path}/error.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern}
+
+
+
+ ERROR
+
+ ACCEPT
+
+ DENY
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xhpc-modules/xhpc-power-pole/src/main/resources/mapper/ServiceFieldMapper.xml b/xhpc-modules/xhpc-power-pile/src/main/resources/mapper/ServiceFieldMapper.xml
similarity index 100%
rename from xhpc-modules/xhpc-power-pole/src/main/resources/mapper/ServiceFieldMapper.xml
rename to xhpc-modules/xhpc-power-pile/src/main/resources/mapper/ServiceFieldMapper.xml
diff --git a/xhpc-modules/xhpc-power-pole/src/main/resources/svcmainlogic.xml b/xhpc-modules/xhpc-power-pile/src/main/resources/svcmainlogic.xml
similarity index 91%
rename from xhpc-modules/xhpc-power-pole/src/main/resources/svcmainlogic.xml
rename to xhpc-modules/xhpc-power-pile/src/main/resources/svcmainlogic.xml
index 476477b6..9aee48b3 100644
--- a/xhpc-modules/xhpc-power-pole/src/main/resources/svcmainlogic.xml
+++ b/xhpc-modules/xhpc-power-pile/src/main/resources/svcmainlogic.xml
@@ -11,5 +11,6 @@
+
diff --git a/xhpc-modules/xhpc-power-pole/src/main/resources/logback.xml b/xhpc-modules/xhpc-power-pole/src/main/resources/logback.xml
deleted file mode 100644
index 7161a262..00000000
--- a/xhpc-modules/xhpc-power-pole/src/main/resources/logback.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- ${log.pattern}
-
-
-
-
-
- ${log.path}/info.log
-
-
-
- ${log.path}/info.%d{yyyy-MM-dd}.log
-
- 60
-
-
- ${log.pattern}
-
-
-
- INFO
-
- ACCEPT
-
- DENY
-
-
-
-
- ${log.path}/error.log
-
-
-
- ${log.path}/error.%d{yyyy-MM-dd}.log
-
- 60
-
-
- ${log.pattern}
-
-
-
- ERROR
-
- ACCEPT
-
- DENY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-