Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
fb8c9a04
Commit
fb8c9a04
authored
Jul 08, 2025
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
e0d779c3
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
340 additions
and
284 deletions
+340
-284
pom.xml
amos-boot-biz-common/pom.xml
+4
-0
DynamicEnumUtil.java
...m/yeejoin/amos/boot/biz/common/utils/DynamicEnumUtil.java
+133
-133
pom.xml
amos-boot-data/amos-boot-data-alarm/pom.xml
+6
-2
pom.xml
amos-boot-data/amos-boot-data-equip/pom.xml
+6
-2
pom.xml
amos-boot-data/amos-boot-data-housepvapi/pom.xml
+57
-53
pom.xml
amos-boot-system-jxiop/amos-boot-module-hygf-api/pom.xml
+34
-29
RSASignUtils.java
.../yeejoin/amos/boot/module/hygf/api/util/RSASignUtils.java
+31
-32
pom.xml
amos-boot-system-jxiop/amos-boot-module-hygf-biz/pom.xml
+8
-8
HygfIcbcServiceImpl.java
...oot/module/hygf/biz/service/impl/HygfIcbcServiceImpl.java
+47
-23
StatisticsHomepageServiceImpl.java
.../hygf/biz/service/impl/StatisticsHomepageServiceImpl.java
+0
-1
application-kingbase8.properties
...f-biz/src/main/resources/application-kingbase8.properties
+3
-0
pom.xml
...t-system-jxiop/amos-boot-module-jxiop-monitor-biz/pom.xml
+1
-0
pom.xml
pom.xml
+10
-1
No files found.
amos-boot-biz-common/pom.xml
View file @
fb8c9a04
...
...
@@ -56,6 +56,10 @@
<artifactId>
*
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
</exclusion>
<exclusion>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
</exclusion>
...
...
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DynamicEnumUtil.java
View file @
fb8c9a04
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
import
sun.reflect.ConstructorAccessor
;
import
sun.reflect.FieldAccessor
;
import
sun.reflect.ReflectionFactory
;
import
java.lang.reflect.AccessibleObject
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* 动态枚举工具类
*
* @author DELL
*/
public
class
DynamicEnumUtil
{
private
static
ReflectionFactory
reflectionFactory
=
ReflectionFactory
.
getReflectionFactory
();
private
static
void
setFailsafeFieldValue
(
Field
field
,
Object
target
,
Object
value
)
throws
NoSuchFieldException
,
IllegalAccessException
{
// 反射访问私有变量
field
.
setAccessible
(
true
);
/**
* 接下来,我们将字段实例中的修饰符更改为不再是final,
* 从而使反射允许我们修改静态final字段。
*/
Field
modifiersField
=
Field
.
class
.
getDeclaredField
(
"modifiers"
);
modifiersField
.
setAccessible
(
true
);
int
modifiers
=
modifiersField
.
getInt
(
field
);
// 去掉修饰符int中的最后一位
modifiers
&=
~
Modifier
.
FINAL
;
modifiersField
.
setInt
(
field
,
modifiers
);
FieldAccessor
fa
=
reflectionFactory
.
newFieldAccessor
(
field
,
false
);
fa
.
set
(
target
,
value
);
}
private
static
void
blankField
(
Class
<?>
enumClass
,
String
fieldName
)
throws
NoSuchFieldException
,
IllegalAccessException
{
for
(
Field
field
:
Class
.
class
.
getDeclaredFields
())
{
if
(
field
.
getName
().
contains
(
fieldName
))
{
AccessibleObject
.
setAccessible
(
new
Field
[]{
field
},
true
);
setFailsafeFieldValue
(
field
,
enumClass
,
null
);
break
;
}
}
}
private
static
void
cleanEnumCache
(
Class
<?>
enumClass
)
throws
NoSuchFieldException
,
IllegalAccessException
{
// Sun (Oracle?!?) JDK 1.5/6
blankField
(
enumClass
,
"enumConstantDirectory"
);
// IBM JDK
blankField
(
enumClass
,
"enumConstants"
);
}
private
static
ConstructorAccessor
getConstructorAccessor
(
Class
<?>
enumClass
,
Class
<?>[]
additionalParameterTypes
)
throws
NoSuchMethodException
{
Class
<?>[]
parameterTypes
=
new
Class
[
additionalParameterTypes
.
length
+
2
];
parameterTypes
[
0
]
=
String
.
class
;
parameterTypes
[
1
]
=
int
.
class
;
System
.
arraycopy
(
additionalParameterTypes
,
0
,
parameterTypes
,
2
,
additionalParameterTypes
.
length
);
return
reflectionFactory
.
newConstructorAccessor
(
enumClass
.
getDeclaredConstructor
(
parameterTypes
));
}
private
static
Object
makeEnum
(
Class
<?>
enumClass
,
String
value
,
int
ordinal
,
Class
<?>[]
additionalTypes
,
Object
[]
additionalValues
)
throws
Exception
{
Object
[]
params
=
new
Object
[
additionalValues
.
length
+
2
];
params
[
0
]
=
value
;
params
[
1
]
=
Integer
.
valueOf
(
ordinal
);
System
.
arraycopy
(
additionalValues
,
0
,
params
,
2
,
additionalValues
.
length
);
return
enumClass
.
cast
(
getConstructorAccessor
(
enumClass
,
additionalTypes
).
newInstance
(
params
));
}
/**
* 将枚举实例添加到作为参数提供的枚举类中
*
* @param <T>
* @param enumType 要修改的枚举类型
* @param enumName 添加的枚举类型名字
* @param additionalTypes 枚举类型参数类型列表
* @param additionalValues 枚举类型参数值列表
* @return
*/
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
extends
Enum
<?>>
T
addEnum
(
Class
<
T
>
enumType
,
String
enumName
,
Class
<?>[]
additionalTypes
,
Object
[]
additionalValues
)
{
// 0. 检查类型
if
(!
Enum
.
class
.
isAssignableFrom
(
enumType
))
{
throw
new
RuntimeException
(
"class "
+
enumType
+
" is not an instance of Enum"
);
}
// 1. 在枚举类中查找“$values”持有者并获取以前的枚举实例
Field
valuesField
=
null
;
Field
[]
fields
=
enumType
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
if
(
field
.
getName
().
contains
(
"$VALUES"
))
{
valuesField
=
field
;
break
;
}
}
AccessibleObject
.
setAccessible
(
new
Field
[]{
valuesField
},
true
);
try
{
// 2. 将他拷贝到数组
T
[]
previousValues
=
(
T
[])
valuesField
.
get
(
enumType
);
List
<
T
>
values
=
new
ArrayList
<
T
>(
Arrays
.
asList
(
previousValues
));
// 3. 创建新的枚举项
T
newValue
=
(
T
)
makeEnum
(
enumType
,
enumName
,
values
.
size
(),
additionalTypes
,
additionalValues
);
// 4. 添加新的枚举项
values
.
add
(
newValue
);
// 5. 设定拷贝的数组,到枚举类型
setFailsafeFieldValue
(
valuesField
,
null
,
values
.
toArray
((
T
[])
Array
.
newInstance
(
enumType
,
0
)));
// 6. 清楚枚举的缓存
cleanEnumCache
(
enumType
);
return
newValue
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
.
getMessage
(),
e
);
}
}
}
\ No newline at end of file
//package com.yeejoin.amos.boot.biz.common.utils;
//
//import sun.reflect.ConstructorAccessor;
//import sun.reflect.FieldAccessor;
//import sun.reflect.ReflectionFactory;
//
//import java.lang.reflect.AccessibleObject;
//import java.lang.reflect.Array;
//import java.lang.reflect.Field;
//import java.lang.reflect.Modifier;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//
///**
// * 动态枚举工具类
// *
// * @author DELL
// */
//public class DynamicEnumUtil {
// private static ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
//
// private static void setFailsafeFieldValue(Field field, Object target, Object value) throws NoSuchFieldException,
// IllegalAccessException {
//
// // 反射访问私有变量
// field.setAccessible(true);
//
// /**
// * 接下来,我们将字段实例中的修饰符更改为不再是final,
// * 从而使反射允许我们修改静态final字段。
// */
// Field modifiersField = Field.class.getDeclaredField("modifiers");
// modifiersField.setAccessible(true);
// int modifiers = modifiersField.getInt(field);
//
// // 去掉修饰符int中的最后一位
// modifiers &= ~Modifier.FINAL;
// modifiersField.setInt(field, modifiers);
//
// FieldAccessor fa = reflectionFactory.newFieldAccessor(field, false);
// fa.set(target, value);
// }
//
// private static void blankField(Class<?> enumClass, String fieldName) throws NoSuchFieldException,
// IllegalAccessException {
// for (Field field : Class.class.getDeclaredFields()) {
// if (field.getName().contains(fieldName)) {
// AccessibleObject.setAccessible(new Field[]{field}, true);
// setFailsafeFieldValue(field, enumClass, null);
// break;
// }
// }
// }
//
// private static void cleanEnumCache(Class<?> enumClass) throws NoSuchFieldException, IllegalAccessException {
// // Sun (Oracle?!?) JDK 1.5/6
// blankField(enumClass, "enumConstantDirectory");
// // IBM JDK
// blankField(enumClass, "enumConstants");
// }
//
// private static ConstructorAccessor getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes)
// throws NoSuchMethodException {
// Class<?>[] parameterTypes = new Class[additionalParameterTypes.length + 2];
// parameterTypes[0] = String.class;
// parameterTypes[1] = int.class;
// System.arraycopy(additionalParameterTypes, 0, parameterTypes, 2, additionalParameterTypes.length);
// return reflectionFactory.newConstructorAccessor(enumClass.getDeclaredConstructor(parameterTypes));
// }
//
// private static Object makeEnum(Class<?> enumClass, String value, int ordinal, Class<?>[] additionalTypes,
// Object[] additionalValues) throws Exception {
// Object[] params = new Object[additionalValues.length + 2];
// params[0] = value;
// params[1] = Integer.valueOf(ordinal);
// System.arraycopy(additionalValues, 0, params, 2, additionalValues.length);
// return enumClass.cast(getConstructorAccessor(enumClass, additionalTypes).newInstance(params));
// }
//
// /**
// * 将枚举实例添加到作为参数提供的枚举类中
// *
// * @param <T>
// * @param enumType 要修改的枚举类型
// * @param enumName 添加的枚举类型名字
// * @param additionalTypes 枚举类型参数类型列表
// * @param additionalValues 枚举类型参数值列表
// * @return
// */
// @SuppressWarnings("unchecked")
// public static <T extends Enum<?>> T addEnum(Class<T> enumType, String enumName, Class<?>[] additionalTypes,
// Object[] additionalValues) {
//
// // 0. 检查类型
// if (!Enum.class.isAssignableFrom(enumType)) {
// throw new RuntimeException("class " + enumType + " is not an instance of Enum");
// }
//
// // 1. 在枚举类中查找“$values”持有者并获取以前的枚举实例
// Field valuesField = null;
// Field[] fields = enumType.getDeclaredFields();
// for (Field field : fields) {
// if (field.getName().contains("$VALUES")) {
// valuesField = field;
// break;
// }
// }
// AccessibleObject.setAccessible(new Field[]{valuesField}, true);
//
// try {
// // 2. 将他拷贝到数组
// T[] previousValues = (T[]) valuesField.get(enumType);
// List<T> values = new ArrayList<T>(Arrays.asList(previousValues));
//
// // 3. 创建新的枚举项
// T newValue = (T) makeEnum(enumType, enumName, values.size(), additionalTypes, additionalValues);
//
// // 4. 添加新的枚举项
// values.add(newValue);
//
// // 5. 设定拷贝的数组,到枚举类型
// setFailsafeFieldValue(valuesField, null, values.toArray((T[]) Array.newInstance(enumType, 0)));
//
// // 6. 清楚枚举的缓存
// cleanEnumCache(enumType);
// return newValue;
// } catch (Exception e) {
// throw new RuntimeException(e.getMessage(), e);
// }
// }
//}
\ No newline at end of file
amos-boot-data/amos-boot-data-alarm/pom.xml
View file @
fb8c9a04
...
...
@@ -14,10 +14,10 @@
<dependencies>
<dependency>
<
!--<
dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependency>
-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -39,6 +39,10 @@
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
...
...
amos-boot-data/amos-boot-data-equip/pom.xml
View file @
fb8c9a04
...
...
@@ -13,10 +13,10 @@
<name>
amos-boot-data-equip
</name>
<dependencies>
<dependency>
<
!--<
dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependency>
-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -43,6 +43,10 @@
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
</exclusion>
</exclusions>
</dependency>
...
...
amos-boot-data/amos-boot-data-housepvapi/pom.xml
View file @
fb8c9a04
...
...
@@ -15,62 +15,66 @@
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency
>
<!--
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>--
>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-foundation
</artifactId>
<version>
${tyboot-version}
</version>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-foundation
</artifactId>
<version>
${tyboot-version}
</version>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-restful
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-auth
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-emq
</artifactId>
<version>
${tyboot-version}
</version>
</dependency>
<!--
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-event</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-restful
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-auth
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-emq
</artifactId>
<version>
${tyboot-version}
</version>
</dependency>
<!--
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-event</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-opendata
</artifactId>
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/pom.xml
View file @
fb8c9a04
...
...
@@ -24,36 +24,41 @@
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
3.2.4
</version>
</dependency>
<!-- <dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
</dependency>-->
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk1
5on
</artifactId>
<version>
1.
70
</version>
<!-- 请根据需要选择最新版本 --
>
<artifactId>
bcprov-jdk1
6
</artifactId>
<version>
1.
46
</version
>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcpkix-jdk15on
</artifactId>
<version>
1.70
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-mock
</artifactId>
<version>
2.0.8
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-mock
</artifactId>
<version>
2.0.8
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk15on
</artifactId>
<version>
1.70
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcpkix-jdk15on
</artifactId>
<version>
1.70
</version>
</dependency>
</dependencies>
</dependencyManagement
>
</project>
<!--
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
</dependency>
</dependencies>
</dependencyManagement>--
>
</project>
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/util/RSASignUtils.java
View file @
fb8c9a04
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
util
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
import
java.security.KeyFactory
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.Signature
;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.X509Certificate
;
import
java.security.interfaces.RSAPublicKey
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
import
org.apache.commons.codec.binary.Base64
;
import
org.bouncycastle.asn1.DERNull
;
import
org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers
;
import
org.bouncycastle.asn1.pkcs.PrivateKeyInfo
;
import
org.bouncycastle.asn1.pkcs.RSAPrivateKey
;
import
org.bouncycastle.asn1.x509.AlgorithmIdentifier
;
import
org.bouncycastle.util.io.pem.PemObject
;
import
org.bouncycastle.util.io.pem.PemReader
;
import
org.springframework.core.io.ClassPathResource
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
import
java.security.KeyFactory
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.Signature
;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.X509Certificate
;
import
java.security.interfaces.RSAPublicKey
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
import
org.apache.commons.codec.binary.Base64
;
import
org.bouncycastle.asn1.DERNull
;
import
org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers
;
import
org.bouncycastle.asn1.pkcs.PrivateKeyInfo
;
import
org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure
;
import
org.bouncycastle.asn1.x509.AlgorithmIdentifier
;
import
org.bouncycastle.util.io.pem.PemObject
;
import
org.bouncycastle.util.io.pem.PemReader
;
import
org.springframework.core.io.ClassPathResource
;
/**
* SHA256WithRSA签名、验签工具
...
...
@@ -74,10 +73,9 @@ public class RSASignUtils {
}
private
static
byte
[]
convertPKCS1ToPKCS8
(
byte
[]
pkcs1Bytes
)
throws
Exception
{
// 使用 BouncyCastle 库解析 PKCS#1 格式的私钥
RSAPrivateKey
pkcs1PrivKey
=
RSAPrivateKey
.
getInstance
(
pkcs1Bytes
);
RSAPrivateKey
Structure
pkcs1PrivKey
=
RSAPrivateKeyStructure
.
getInstance
(
pkcs1Bytes
);
// 构建 AlgorithmIdentifier,指定了 rsaEncryption OID 和空参数
AlgorithmIdentifier
algId
=
new
AlgorithmIdentifier
(
...
...
@@ -86,7 +84,7 @@ public class RSASignUtils {
);
// 构建 PKCS#8 格式的私钥信息
PrivateKeyInfo
pkcs8PrivKeyInfo
=
new
PrivateKeyInfo
(
algId
,
pkcs1PrivKey
.
toASN1
Primitive
());
PrivateKeyInfo
pkcs8PrivKeyInfo
=
new
PrivateKeyInfo
(
algId
,
pkcs1PrivKey
.
toASN1
Object
());
// 返回 PKCS#8 格式的编码字节数组
return
pkcs8PrivKeyInfo
.
getEncoded
();
...
...
@@ -123,7 +121,7 @@ public class RSASignUtils {
byte
[]
signbyte
=
(
signBytes
);
return
signatureTool
.
verify
(
signbyte
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
return
false
;
}
...
...
@@ -141,6 +139,7 @@ public class RSASignUtils {
}
return
false
;
}
/**
* 加载 pkcs8 格式私钥
*
...
...
@@ -210,11 +209,12 @@ public class RSASignUtils {
throw
new
Exception
(
"Unexpected error while loading private key from file: "
+
path
,
e
);
}
}
/**
* 从文件加载 PKCS8 格式的 RSA 公钥
*/
public
static
RSAPublicKey
readPublicKeyFromFile
(
String
path
)
throws
Exception
{
String
publicKeyPEM
=
"-----BEGIN PUBLIC KEY-----\n"
+
String
publicKeyPEM
=
"-----BEGIN PUBLIC KEY-----\n"
+
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwFgHD4kzEVPdOj03ctKM7KV+1\n"
+
"6bWZ5BMNgvEeuEQwfQYkRVwI9HFOGkwNTMn5hiJXHnlXYCX+zp5r6R52MY0O7BsT\n"
+
"CLT7aHaxsANsvI9ABGx3OaTVlPB59M6GPbJh0uXvio0m1r/lTW3Z60RU6Q3oid/r\n"
+
...
...
@@ -238,9 +238,8 @@ public class RSASignUtils {
// RSASignUtils .loadPrivateKey("/Users/cyzx-mengxr/Downloads/private.pem")));
//String signSrc = RSAUtil.byte2Hex(FileUtils.toByteArray("/Users/cyzx-mengxr/Downloads/00008_0202202280000000579_0200003309088104357_001_20220930_acc_1_1.sign"));
//String signSrc = RSAUtil(FileUtils.toByteArray("/Users/cyzx-mengxr/Downloads/00008_0202202280000000579_0200003309088104357_001_20220930_acc_1_1.sign"));
//String signSrc = RSAUtil.byte2Hex(FileUtils.toByteArray("/Users/cyzx-mengxr/Downloads/00008_0202202280000000579_0200003309088104357_001_20220930_acc_1_1.sign"));
//String signSrc = RSAUtil(FileUtils.toByteArray("/Users/cyzx-mengxr/Downloads/00008_0202202280000000579_0200003309088104357_001_20220930_acc_1_1.sign"));
/*验证网关文件*/
// System.out.println( RSASignUtils.checkSignWithBytes(
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/pom.xml
View file @
fb8c9a04
...
...
@@ -24,18 +24,12 @@
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-module-common-biz</artifactId>-->
<!-- <version>${amos-biz-boot.version}</version>-->
<!-- </dependency>
-->
<!-- </dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.codec</artifactId>
<version>1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk15on
</artifactId>
<version>
1.70
</version>
</dependency>
</dependency>-->
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-emq
</artifactId>
...
...
@@ -128,6 +122,12 @@
</dependency>
<dependency>
<groupId>
com.icbc.tool
</groupId>
<artifactId>
SM2
</artifactId>
<version>
1.0
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
4.1.2
</version>
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/HygfIcbcServiceImpl.java
View file @
fb8c9a04
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
service
.
impl
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
...
...
@@ -28,6 +29,8 @@ import javax.servlet.http.HttpServletResponse;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.csii.pp.icbc.util.SM4Utils
;
import
com.csii.pp.icbc.util.UtilIcbc
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.icbc.api.request.*
;
...
...
@@ -37,6 +40,7 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationEngineeringInfo
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationEngineeringInfoMapper
;
import
com.yeejoin.amos.boot.module.hygf.biz.config.SM2Utils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
...
...
@@ -108,6 +112,10 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
private
String
OUT_VENDOR_ID
;
@Value
(
"${hygf.icbc.projectId}"
)
private
String
PROJECT_ID
;
@Value
(
"${hygf.icbc.sm2PublicKey}"
)
private
String
SM2_PUBLIC_KEY
;
@Value
(
"${hygf.icbc.sm2PrivateKey}"
)
private
String
SM2_PRIVATE_KEY
;
/**
* 协议总限额
*/
...
...
@@ -697,16 +705,16 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
}
public
Object
signVerifyCode
(
String
phone
,
String
mediumId
)
{
//
PeasantHousehold peasantHousehold=peasantHouseholdService
//
.getOne(new LambdaQueryWrapper<PeasantHousehold>().eq(PeasantHousehold::getTelephone,phone).last("LIMIT 1"));
//
if(peasantHousehold==null)
//
{
//
return "农户不存在";
//
}
PeasantHousehold
peasantHousehold
=
new
PeasantHousehold
();
peasantHousehold
.
setAmosUserId
(
"890728"
);
peasantHousehold
.
setOwnersName
(
"吴江"
);
peasantHousehold
.
setIdCard
(
"61010319890728203X"
);
PeasantHousehold
peasantHousehold
=
peasantHouseholdService
.
getOne
(
new
LambdaQueryWrapper
<
PeasantHousehold
>().
eq
(
PeasantHousehold:
:
getTelephone
,
phone
).
last
(
"LIMIT 1"
));
if
(
peasantHousehold
==
null
)
{
return
"农户不存在"
;
}
//
PeasantHousehold peasantHousehold = new PeasantHousehold();
//
peasantHousehold.setAmosUserId("890728");
//
peasantHousehold.setOwnersName("吴江");
//
peasantHousehold.setIdCard("61010319890728203X");
String
apiUrl
=
serviceUrl
+
"/api/jft/api/user/entrust/send/verify/code/V1"
;
DefaultIcbcClient
client
=
new
DefaultIcbcClient
(
APP_ID
,
IcbcConstants
.
SIGN_TYPE_RSA2
,
MY_PRIVATE_KEY
,
IcbcConstants
.
CHARSET_UTF8
,
IcbcConstants
.
FORMAT_JSON
,
APIGW_PUBLIC_KEY
,
IcbcConstants
.
ENCRYPT_TYPE_AES
,
...
...
@@ -754,16 +762,16 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
}
public
Object
signProtocol
(
HygfIcbcSignProtocolDTO
hygfIcbcSignProtocolDTO
)
{
//
PeasantHousehold peasantHousehold=peasantHouseholdService
//
.getOne(new LambdaQueryWrapper<PeasantHousehold>().eq(PeasantHousehold::getTelephone,hygfIcbcSignProtocolDTO.getPhone()).last("LIMIT 1"));
//
if(peasantHousehold==null)
//
{
//
return "农户不存在";
//
}
PeasantHousehold
peasantHousehold
=
new
PeasantHousehold
();
peasantHousehold
.
setAmosUserId
(
"890728"
);
peasantHousehold
.
setOwnersName
(
"吴江"
);
peasantHousehold
.
setIdCard
(
"61010319890728203X"
);
PeasantHousehold
peasantHousehold
=
peasantHouseholdService
.
getOne
(
new
LambdaQueryWrapper
<
PeasantHousehold
>().
eq
(
PeasantHousehold:
:
getTelephone
,
hygfIcbcSignProtocolDTO
.
getPhone
()).
last
(
"LIMIT 1"
));
if
(
peasantHousehold
==
null
)
{
return
"农户不存在"
;
}
//
PeasantHousehold peasantHousehold = new PeasantHousehold();
//
peasantHousehold.setAmosUserId("890728");
//
peasantHousehold.setOwnersName("吴江");
//
peasantHousehold.setIdCard("61010319890728203X");
DefaultIcbcClient
client
=
new
DefaultIcbcClient
(
APP_ID
,
IcbcConstants
.
SIGN_TYPE_RSA2
,
MY_PRIVATE_KEY
,
IcbcConstants
.
CHARSET_UTF8
,
IcbcConstants
.
FORMAT_JSON
,
APIGW_PUBLIC_KEY
,
IcbcConstants
.
ENCRYPT_TYPE_AES
,
AES_Key
,
""
,
""
);
...
...
@@ -921,12 +929,28 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
bizContent
.
setCorpSerno
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
//合作方交易单号
bizContent
.
setCorpDate
(
formattedDate
);
//合作方工作日期
bizContent
.
setOutServiceCode
(
"querybalance"
);
//外部服务代码
bizContent
.
setMediumId
(
mediumId
);
//工行联名卡号
bizContent
.
setCcy
(
1
);
//市种
//bizContent.setSecretKey("h8zujhDntpKRohwFmGXcnXygNjJHRObyUVG3183u0dXI2fRgCXeDED9z0w5d02JucVy7vZ190d7CSUxI2/sVon6dPklVoaquVElgKRUPlr6D/cqLu25K7h]3Pt/u0nx4gF/ykm0/IB2gs0rs/sp0Zw==");
//String encodedString = Base64.getEncoder().encodeToString(mediumId.getBytes());
//生成sm4密钥
String
origSecretKey
=
UtilIcbc
.
getNonceStr
(
16
);
String
secretKey
=
UtilIcbc
.
getHexString
(
origSecretKey
.
getBytes
());
SM4Utils
.
secretKey
=
secretKey
;
SM4Utils
.
hexString
=
true
;
SM4Utils
.
iv
=
"00000000000000000000000000000000"
;
//生成sm2加密后的sm4公钥
String
sm4SecretKey
=
null
;
try
{
sm4SecretKey
=
SM2Utils
.
encrypt
(
UtilIcbc
.
hexToByte
(
SM2_PUBLIC_KEY
),
origSecretKey
.
getBytes
());
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
//涉密信息如身份证号,姓名,卡号都需要用sm4密钥进行加密
bizContent
.
setMediumId
(
SM4Utils
.
encryptData_CBC
(
mediumId
));
//工行联名卡号
bizContent
.
setCcy
(
1
);
//币种,1
bizContent
.
setSecretKey
(
sm4SecretKey
);
// sm4对称密钥(对敏感信息加密时必送)
request
.
setBizContent
(
bizContent
);
SettlementAccountBalanceQueryResponseV1
response
=
null
;
try
{
log
.
info
(
"工行卡查询余额, 入参 => {}"
,
JSON
.
toJSONString
(
request
));
response
=
client
.
execute
(
request
,
"msgId"
);
if
(
response
.
isSuccess
()
&&
response
.
getReturnCode
()
==
0
)
{
//业务成功处理
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/StatisticsHomepageServiceImpl.java
View file @
fb8c9a04
...
...
@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.map.MapBuilder
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.sun.org.apache.bcel.internal.generic.SWITCH
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.CommonEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.StatisicsHomePageEnum
;
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/resources/application-kingbase8.properties
View file @
fb8c9a04
...
...
@@ -272,6 +272,9 @@ hygf.icbc.camsPublicKey=655CE8706E6ED9A30B92E57D8D645ADDE8C541C27C5C5AFD529C610C
hygf.icbc.apigwPublicKey
=
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB
hygf.icbc.outVendorId
=
gxjr
hygf.icbc.projectId
=
PJ140014023565102203
hygf.icbc.sm2PublicKey
=
04724755085cda47d161e4e1db0b4699521dcc0411fd34957457e9175b193ae6bf339e4c7a27e96d448f59073130c80efe1c6c0722c0f8c996567b31ead9f0f06e
hygf.icbc.sm2PrivateKey
=
807e5dcea2bb31f7846aa2bcc5211ed5903bfb718f4817abab3590058a71a915
icbc.Withhold.projectId
=
PJ140014023565102203
icbc.Withhold.corpCis
=
211590000183323
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/pom.xml
View file @
fb8c9a04
...
...
@@ -48,6 +48,7 @@
<artifactId>
hutool-all
</artifactId>
<version>
5.7.22
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk15to18
</artifactId>
...
...
pom.xml
View file @
fb8c9a04
...
...
@@ -42,6 +42,16 @@
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-server
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcpkix-jdk15on
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -319,7 +329,6 @@
<name>
thirdparty
</name>
<url>
http://47.92.103.240:8081/nexus/content/repositories/thirdparty/
</url>
</repository>
</repositories>
<distributionManagement>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment