diff --git a/file.txt b/file.txt
new file mode 100644
index 0000000..050842e
--- /dev/null
+++ b/file.txt
@@ -0,0 +1,4 @@
+mxhXSDiPYFjYgzRb
+sm4demo123456789
+myhXSDiPUFjYgzRa
+rZMwnHVttsYkBIAy
\ No newline at end of file
diff --git a/psdc-business/lib/dntd-common-1.1-SNAPSHOT.jar b/psdc-business/lib/dntd-common-1.1-SNAPSHOT.jar
new file mode 100644
index 0000000..2859372
Binary files /dev/null and b/psdc-business/lib/dntd-common-1.1-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
deleted file mode 100644
index e69de29..0000000
diff --git a/psdc-business/lib/dntd-model-buildheating-1.1-SNAPSHOT.jar b/psdc-business/lib/dntd-model-buildheating-1.1-SNAPSHOT.jar
new file mode 100644
index 0000000..c3ecf3b
Binary files /dev/null and b/psdc-business/lib/dntd-model-buildheating-1.1-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
deleted file mode 100644
index e69de29..0000000
diff --git a/psdc-business/lib/dntd-model-heatboiler-1.1-SNAPSHOT.jar b/psdc-business/lib/dntd-model-heatboiler-1.1-SNAPSHOT.jar
new file mode 100644
index 0000000..58c30a8
Binary files /dev/null and b/psdc-business/lib/dntd-model-heatboiler-1.1-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
deleted file mode 100644
index e69de29..0000000
diff --git a/psdc-business/lib/dntd-modelI-1.1-SNAPSHOT.jar b/psdc-business/lib/dntd-modelI-1.1-SNAPSHOT.jar
new file mode 100644
index 0000000..9877d25
Binary files /dev/null and b/psdc-business/lib/dntd-modelI-1.1-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
deleted file mode 100644
index e69de29..0000000
diff --git a/psdc-business/lib/dntd-common-1.0-SNAPSHOT.jar b/psdc-business/lib/dntd-tool-1.2-SNAPSHOT.jar
similarity index 100%
rename from psdc-business/lib/dntd-common-1.0-SNAPSHOT.jar
rename to psdc-business/lib/dntd-tool-1.2-SNAPSHOT.jar
diff --git a/psdc-business/pom.xml b/psdc-business/pom.xml
index caae920..d5597e7 100644
--- a/psdc-business/pom.xml
+++ b/psdc-business/pom.xml
@@ -46,7 +46,7 @@
com.dky
dntd-tool
- 1.0-SNAPSHOT
+ 1.2-SNAPSHOT
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 bebec9e..72e64c5 100644
--- a/psdc-business/src/main/java/com/psdc/service/ISecretKeyService.java
+++ b/psdc-business/src/main/java/com/psdc/service/ISecretKeyService.java
@@ -15,6 +15,8 @@ public interface ISecretKeyService {
SecretKey selOne(String key, String date);
+ String getString(String cpuId);
+
SecretKey selOneById(Integer id);
Integer deleteById(Integer id);
diff --git a/psdc-business/src/main/java/com/psdc/service/impl/SecretKeyServiceImpl.java b/psdc-business/src/main/java/com/psdc/service/impl/SecretKeyServiceImpl.java
index a2d0ff6..8b1ac69 100644
--- a/psdc-business/src/main/java/com/psdc/service/impl/SecretKeyServiceImpl.java
+++ b/psdc-business/src/main/java/com/psdc/service/impl/SecretKeyServiceImpl.java
@@ -36,6 +36,12 @@ public class SecretKeyServiceImpl implements ISecretKeyService {
return secretKeyMapper.selOneByKey(key);
}
+ @Override
+ public String getString(String cpuId) {
+ String macK = cpuId.toUpperCase().replace(" ", "");
+ return macK.replace(":", "");
+ }
+
@Override
public SecretKey selOneById(Integer id) {
return secretKeyMapper.selOneById(id);
diff --git a/psdc-business/src/main/java/com/psdc/service/model/impl/BuildHeatingServiceImpl.java b/psdc-business/src/main/java/com/psdc/service/model/impl/BuildHeatingServiceImpl.java
index 09fd16f..73b0a0a 100644
--- a/psdc-business/src/main/java/com/psdc/service/model/impl/BuildHeatingServiceImpl.java
+++ b/psdc-business/src/main/java/com/psdc/service/model/impl/BuildHeatingServiceImpl.java
@@ -2,6 +2,7 @@ package com.psdc.service.model.impl;
import cn.hutool.json.JSONObject;
import com.dky.tool.ModelTool;
+import com.psdc.entity.SysDeviceHeatScene;
import com.psdc.mapper.SysDeviceHeatSceneMapper;
import com.psdc.service.model.IBuildHeatingService;
import org.springframework.stereotype.Service;
@@ -25,11 +26,18 @@ public class BuildHeatingServiceImpl implements IBuildHeatingService {
@Override
public JSONObject exeModel2Report(JSONObject param, String key) {
+ // 创建JSONObject对象用于承接模型方法输出结果。
JSONObject jsonObject = null;
try{
+ // 构建JSONObject对象
JSONObject list = new JSONObject();
- list.put("devSpecList",deviceHeatSceneMapper.selAllDevices());
+ // 查询得到设备列表
+ List sysDeviceHeatScenes = deviceHeatSceneMapper.selAllDevices();
+ // 将设备列表放入JSONObject对象当中并且键为“devSpecList”(键名必须为“devSpecList”)
+ list.put("devSpecList", sysDeviceHeatScenes);
+ // 将这个JSONObject对象list作为入参调用ModelTool的create方法实现产品库初始化。
ModelTool modelTool = ModelTool.create(list);
+ // 调用ModelTool的唯一入口函数exeModel2Report,将场景参数param和密钥key作为入参传进去,得到输出结果电能替代报告。
jsonObject = modelTool.exeModel2Report(param, key);
} catch (Exception e){
diff --git a/psdc-web/src/main/java/com/psdc/controller/key/GenerateKeyController.java b/psdc-web/src/main/java/com/psdc/controller/key/GenerateKeyController.java
index 8b7cd1a..7e089e1 100644
--- a/psdc-web/src/main/java/com/psdc/controller/key/GenerateKeyController.java
+++ b/psdc-web/src/main/java/com/psdc/controller/key/GenerateKeyController.java
@@ -34,6 +34,11 @@ public class GenerateKeyController extends BaseController {
@PostMapping("/getKey")
public AjaxResult getGenerateKey(@RequestBody Map requestBody) {
List cpuIds = (List) requestBody.get("cpuIds");
+ List thisCpuIds = new ArrayList<>();
+ for (String s : cpuIds){
+ thisCpuIds.add(secretKeyService.getString(s));
+ }
+
String expiration = (String) requestBody.get("expiration");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String key = (String) requestBody.get("key");
@@ -41,13 +46,13 @@ public class GenerateKeyController extends BaseController {
Map map = new HashMap();
map.put("companyname", companyName);
map.put("expireTime", expiration);
- map.put("cpuIds", cpuIds.toString());
+ map.put("cpuIds", thisCpuIds.toString());
AjaxResult ajax = AjaxResult.success();
String s = generateKey.generateKey(map, key);
ajax.put("key", s);
SecretKey secretKey = new SecretKey();
secretKey.setKeyValue(s);
- secretKey.setCpuIds(cpuIds.toString());
+ secretKey.setCpuIds(thisCpuIds.toString());
secretKey.setExportDate(expiration);
secretKey.setKeyUnit(companyName);
SecretKey selOne = secretKeyService.selOne(s, expiration);
diff --git a/psdc-web/src/main/java/com/psdc/controller/key/SecretKeyController.java b/psdc-web/src/main/java/com/psdc/controller/key/SecretKeyController.java
index 0b090ad..f564a87 100644
--- a/psdc-web/src/main/java/com/psdc/controller/key/SecretKeyController.java
+++ b/psdc-web/src/main/java/com/psdc/controller/key/SecretKeyController.java
@@ -7,10 +7,7 @@ import com.psdc.service.ISecretKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
/**
* @Author:戴仕崑
@@ -77,6 +74,10 @@ public class SecretKeyController {
@PostMapping("/upKeyData")
public AjaxResult upKeyDate(@RequestBody Map requestBody){
List cpuIds = (List) requestBody.get("cpuIds");
+ List thisCpuIds = new ArrayList<>();
+ for (String s : cpuIds){
+ thisCpuIds.add(secretKeyService.getString(s));
+ }
String expiration = (String) requestBody.get("expiration");
String key = (String) requestBody.get("key");
String companyName = (String) requestBody.get("companyname");
@@ -84,14 +85,14 @@ public class SecretKeyController {
Map map = new HashMap();
map.put("companyname", companyName);
map.put("expireTime", expiration);
- map.put("cpuIds", cpuIds.toString());
+ map.put("cpuIds", thisCpuIds.toString());
AjaxResult ajax = AjaxResult.success();
String s = generateKey.generateKey(map, key);
ajax.put("key", s);
SecretKey secretKey = new SecretKey();
secretKey.setKeyValue(s);
secretKey.setId(id);
- secretKey.setCpuIds(cpuIds.toString());
+ secretKey.setCpuIds(thisCpuIds.toString());
secretKey.setExportDate(expiration);
secretKey.setKeyUnit(companyName);
secretKeyService.updateById(secretKey);