diff --git a/psdc-admin/src/main/resources/application.yml b/psdc-admin/src/main/resources/application.yml
index 90385b2..caf4dfc 100644
--- a/psdc-admin/src/main/resources/application.yml
+++ b/psdc-admin/src/main/resources/application.yml
@@ -1,3 +1,3 @@
spring:
profiles:
- active: prod
\ No newline at end of file
+ active: dev
\ No newline at end of file
diff --git a/psdc-business/lib/dntd-common-1.0-SNAPSHOT.jar b/psdc-business/lib/dntd-common-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..8e7fa26
Binary files /dev/null and b/psdc-business/lib/dntd-common-1.0-SNAPSHOT.jar differ
diff --git a/psdc-business/lib/dntd-model-buildheating-1.0-SNAPSHOT.jar b/psdc-business/lib/dntd-model-buildheating-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..756fecd
Binary files /dev/null and b/psdc-business/lib/dntd-model-buildheating-1.0-SNAPSHOT.jar differ
diff --git a/psdc-business/lib/dntd-model-heatboiler-1.0-SNAPSHOT.jar b/psdc-business/lib/dntd-model-heatboiler-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..d8f0809
Binary files /dev/null and b/psdc-business/lib/dntd-model-heatboiler-1.0-SNAPSHOT.jar differ
diff --git a/psdc-business/lib/dntd-modelI-1.0-SNAPSHOT.jar b/psdc-business/lib/dntd-modelI-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..ed88bd3
Binary files /dev/null and b/psdc-business/lib/dntd-modelI-1.0-SNAPSHOT.jar differ
diff --git a/psdc-business/lib/dntd-tool-1.0-SNAPSHOT.jar b/psdc-business/lib/dntd-tool-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..d87b833
Binary files /dev/null and b/psdc-business/lib/dntd-tool-1.0-SNAPSHOT.jar differ
diff --git a/psdc-business/pom.xml b/psdc-business/pom.xml
index 5458ecb..fa58529 100644
--- a/psdc-business/pom.xml
+++ b/psdc-business/pom.xml
@@ -28,12 +28,49 @@
psdc-framework
0.0.1
+
+
+ cn.hutool
+ hutool-all
+ 5.4.5
+
+
com.psdc
psdc-quartz
0.0.1
+
+ com.dky
+ dntd-common
+ 1.0.0
+
+
+
+ com.dky
+ dntd-modelI
+ 1.0.0
+
+
+
+ com.dky
+ dntd-model-heatboiler
+ 1.0.0
+
+
+
+ com.dky
+ dntd-model-buildheating
+ 1.0.0
+
+
+
+ com.dky
+ dntd-tool
+ 1.0.0
+
+
org.bouncycastle
bcprov-jdk15on
@@ -71,5 +108,15 @@
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/psdc-business/src/main/java/com/psdc/entity/SecretKey.java b/psdc-business/src/main/java/com/psdc/entity/SecretKey.java
index 6c05c9a..3ffd079 100644
--- a/psdc-business/src/main/java/com/psdc/entity/SecretKey.java
+++ b/psdc-business/src/main/java/com/psdc/entity/SecretKey.java
@@ -21,6 +21,10 @@ public class SecretKey {
private Integer id ;
/** 密钥 */
private String keyValue ;
+ /** 密钥cpu_ids */
+ private String cpuIds ;
+ /** 授权单位 */
+ private String keyUnit ;
/** 有效期至 */
private String exportDate ;
/** 创建时间 */
diff --git a/psdc-business/src/main/java/com/psdc/mapper/SecretKeyMapper.java b/psdc-business/src/main/java/com/psdc/mapper/SecretKeyMapper.java
index 2906332..d6c4669 100644
--- a/psdc-business/src/main/java/com/psdc/mapper/SecretKeyMapper.java
+++ b/psdc-business/src/main/java/com/psdc/mapper/SecretKeyMapper.java
@@ -1,9 +1,12 @@
package com.psdc.mapper;
+import com.psdc.entity.PrivateKey;
import com.psdc.entity.SecretKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
/**
* @author 小镇做题家
@@ -27,6 +30,22 @@ public interface SecretKeyMapper {
Integer update(@Param(value = "newKey") String s1,
@Param(value = "oldKey") String s2);
+ Integer updateById(SecretKey secretKey);
+
SecretKey selOneByKey(@Param(value = "key") String s);
+
+ SecretKey selOneById(@Param(value = "id") Integer id);
+
+ Integer deleteById(@Param(value = "id") Integer id);
+
+ List queryAllByLimit(@Param(value = "keyUnit") String keyUnit,
+ @Param(value = "endDateTime") String endDateTime,
+ @Param(value = "startDateTime") String startDateTime,
+ @Param(value = "pageCurrent") Integer pageCurrent,
+ @Param(value = "pageSize") Integer pageSize);
+
+ Long selectCount(@Param(value = "keyUnit") String keyUnit,
+ @Param(value = "endDateTime") String endDateTime,
+ @Param(value = "startDateTime") String startDateTime);
}
diff --git a/psdc-business/src/main/java/com/psdc/service/ISecretKeyService.java b/psdc-business/src/main/java/com/psdc/service/ISecretKeyService.java
index 0687e21..bebec9e 100644
--- a/psdc-business/src/main/java/com/psdc/service/ISecretKeyService.java
+++ b/psdc-business/src/main/java/com/psdc/service/ISecretKeyService.java
@@ -1,5 +1,6 @@
package com.psdc.service;
+import com.psdc.core.domain.AjaxResult;
import com.psdc.entity.SecretKey;
/**
@@ -14,6 +15,14 @@ public interface ISecretKeyService {
SecretKey selOne(String key, String date);
+ SecretKey selOneById(Integer id);
+
+ Integer deleteById(Integer id);
+
+ Integer updateById(SecretKey secretKey);
+
+ AjaxResult queryAllByLimit(String keyUnit, String startDateTime, String endDateTime, Integer pageCurrent, Integer pageSize);
+
Integer insert(SecretKey secretKey);
Integer update(String s1, String s2);
diff --git a/psdc-business/src/main/java/com/psdc/service/impl/GenerateKeyIml.java b/psdc-business/src/main/java/com/psdc/service/impl/GenerateKeyIml.java
index 60e3c7e..132fad4 100644
--- a/psdc-business/src/main/java/com/psdc/service/impl/GenerateKeyIml.java
+++ b/psdc-business/src/main/java/com/psdc/service/impl/GenerateKeyIml.java
@@ -35,12 +35,11 @@ public class GenerateKeyIml implements IGenerateKey {
@Override
public String generateKey(Map map, String sm4) {
String key;
- SM4Util sm4Util = new SM4Util();
try {
- // 解密
- String decryptBySM4ECB = sm4Util.decryptBySM4ECB(sm4, SM4_KEY);
+ // 解密 SM4Util sm4Util = new SM4Util();
+ // String decryptBySM4ECB = sm4Util.decryptBySM4ECB(sm4, SM4_KEY);
Cipher cipher = Cipher.getInstance(ALGORITHM, "BC");
- SecretKeySpec secretKey = new SecretKeySpec(decryptBySM4ECB.getBytes(StandardCharsets.UTF_8), "AES");
+ SecretKeySpec secretKey = new SecretKeySpec(sm4.getBytes(StandardCharsets.UTF_8), "AES");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] encrypted = cipher.doFinal(mapToString(map).getBytes(StandardCharsets.UTF_8));
key = Base64.getEncoder().encodeToString(encrypted);
@@ -51,6 +50,15 @@ public class GenerateKeyIml implements IGenerateKey {
return key;
}
+ public static String encrypt(Map map) throws Exception {
+
+ Cipher cipher = Cipher.getInstance(ALGORITHM, "BC");
+ SecretKeySpec secretKey = new SecretKeySpec(SM4_KEY.getBytes(StandardCharsets.UTF_8), "AES");
+ cipher.init(Cipher.ENCRYPT_MODE, secretKey);
+ byte[] encrypted = cipher.doFinal(mapToString(map).getBytes(StandardCharsets.UTF_8));
+ return Base64.getEncoder().encodeToString(encrypted);
+ }
+
private static String mapToString(Map map) {
StringBuilder sb = new StringBuilder();
for (Map.Entry entry : map.entrySet()) {
diff --git a/psdc-business/src/main/java/com/psdc/service/impl/PrivateKeyServiceImpl.java b/psdc-business/src/main/java/com/psdc/service/impl/PrivateKeyServiceImpl.java
index c5064b1..d6ea894 100644
--- a/psdc-business/src/main/java/com/psdc/service/impl/PrivateKeyServiceImpl.java
+++ b/psdc-business/src/main/java/com/psdc/service/impl/PrivateKeyServiceImpl.java
@@ -72,7 +72,13 @@ public class PrivateKeyServiceImpl implements IPrivateKeyService {
long pageCount = (count/pageSize) + (count%pageSize==0?0:1);
AjaxResult ajax = new AjaxResult();
Map map = new HashMap();
+ SM4Util sm4Util = new SM4Util();
List list = privateKeyMapper.queryAllByLimit(keyUnit, start, pageSize);
+ list.parallelStream().forEach((s)->{
+ // 解密
+ String decryptBySM4ECB = sm4Util.decryptBySM4ECB(s.getKeyValue(), SM4_KEY);
+ s.setKeyValue(decryptBySM4ECB);
+ });
ajax.put("data", list);
map.put("pageCurrent", pageCurrent);
map.put("pageSize", pageSize);
@@ -86,10 +92,13 @@ public class PrivateKeyServiceImpl implements IPrivateKeyService {
public AjaxResult selectAll() {
List