2024-03-14 17:36:29 私钥格式优化

master
魔神煜修罗皇 1 year ago
parent 3fbe8ac490
commit 76622371f2
  1. 4
      file.txt
  2. BIN
      psdc-business/lib/dntd-common-1.1-SNAPSHOT.jar
  3. 0
      psdc-business/lib/dntd-model-buildheating-1.0-SNAPSHOT.jar
  4. BIN
      psdc-business/lib/dntd-model-buildheating-1.1-SNAPSHOT.jar
  5. 0
      psdc-business/lib/dntd-model-heatboiler-1.0-SNAPSHOT.jar
  6. BIN
      psdc-business/lib/dntd-model-heatboiler-1.1-SNAPSHOT.jar
  7. 0
      psdc-business/lib/dntd-modelI-1.0-SNAPSHOT.jar
  8. BIN
      psdc-business/lib/dntd-modelI-1.1-SNAPSHOT.jar
  9. 0
      psdc-business/lib/dntd-tool-1.0-SNAPSHOT.jar
  10. 0
      psdc-business/lib/dntd-tool-1.2-SNAPSHOT.jar
  11. 2
      psdc-business/pom.xml
  12. 2
      psdc-business/src/main/java/com/psdc/service/ISecretKeyService.java
  13. 6
      psdc-business/src/main/java/com/psdc/service/impl/SecretKeyServiceImpl.java
  14. 10
      psdc-business/src/main/java/com/psdc/service/model/impl/BuildHeatingServiceImpl.java
  15. 9
      psdc-web/src/main/java/com/psdc/controller/key/GenerateKeyController.java
  16. 13
      psdc-web/src/main/java/com/psdc/controller/key/SecretKeyController.java

@ -0,0 +1,4 @@
mxhXSDiPYFjYgzRb
sm4demo123456789
myhXSDiPUFjYgzRa
rZMwnHVttsYkBIAy

@ -46,7 +46,7 @@
<dependency>
<groupId>com.dky</groupId>
<artifactId>dntd-tool</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.2-SNAPSHOT</version>
</dependency>

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

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

@ -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<SysDeviceHeatScene> 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){

@ -34,6 +34,11 @@ public class GenerateKeyController extends BaseController {
@PostMapping("/getKey")
public AjaxResult getGenerateKey(@RequestBody Map<String, Object> requestBody) {
List<String> cpuIds = (List<String>) requestBody.get("cpuIds");
List<String> 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);

@ -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<String, Object> requestBody){
List<String> cpuIds = (List<String>) requestBody.get("cpuIds");
List<String> 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);

Loading…
Cancel
Save