diff --git a/.idea/misc.xml b/.idea/misc.xml
index ce85f4e..f20ecff 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,3 +1,4 @@
+
@@ -13,7 +14,7 @@
-
+
\ No newline at end of file
diff --git a/dntd-common/src/main/java/com/dky/utils/ConfigReader.java b/dntd-common/src/main/java/com/dky/utils/ConfigReader.java
index a40bca6..bbfe9bd 100644
--- a/dntd-common/src/main/java/com/dky/utils/ConfigReader.java
+++ b/dntd-common/src/main/java/com/dky/utils/ConfigReader.java
@@ -12,6 +12,7 @@ public class ConfigReader {
try {
prop.load(input);
} catch (IOException e) {
+ System.out.println("未找到场景配置文件");
throw new RuntimeException(e);
}
}else {
@@ -19,4 +20,5 @@ public class ConfigReader {
}
return prop.getProperty(key);
}
+
}
\ No newline at end of file
diff --git a/dntd-model-heatboiler/src/main/java/com/dky/calculate/Advantage.java b/dntd-model-heatboiler/src/main/java/com/dky/calculate/Advantage.java
index ed07686..af4c1ab 100644
--- a/dntd-model-heatboiler/src/main/java/com/dky/calculate/Advantage.java
+++ b/dntd-model-heatboiler/src/main/java/com/dky/calculate/Advantage.java
@@ -8,7 +8,7 @@ public class Advantage {
//经济性
public String economy(Double firstInvestFee,Double yearTotalFee,Double yearRunFee,Double lastYearFee){
Double hsq = Math.round(firstInvestFee/yearTotalFee*100.0)/100.0;
- double js = Math.round(lastYearFee - yearRunFee*100.0)/100.0;
+ double js = Math.round((lastYearFee - yearRunFee)*100.0)/100.0;
return "本次改造投资回收期为"+hsq+"年,本改造方案相比较原技术节省年运行费用成本"+js+"元。";
}
//智能性
diff --git a/dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java b/dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java
index 42eeac8..f77b282 100644
--- a/dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java
+++ b/dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java
@@ -56,6 +56,6 @@ public class RequireDevice {
}
}
- return new MatchedDeviceResult(matchedDevices, totalPrice);
+ return new MatchedDeviceResult(matchedDevices, Math.round(totalPrice*100.0)/100.0);
}
}
diff --git a/dntd-tool/pom.xml b/dntd-tool/pom.xml
index 78c2090..67d4846 100644
--- a/dntd-tool/pom.xml
+++ b/dntd-tool/pom.xml
@@ -43,11 +43,6 @@
dntd-common
1.0-SNAPSHOT
-
- com.dky
- dntd-model-buildsence
- 1.0-SNAPSHOT
-
diff --git a/dntd-tool/src/main/java/com/dky/Test.java b/dntd-tool/src/main/java/com/dky/Test.java
index cfb14c9..2df4b9f 100644
--- a/dntd-tool/src/main/java/com/dky/Test.java
+++ b/dntd-tool/src/main/java/com/dky/Test.java
@@ -56,7 +56,7 @@ public class Test {
.put("deviceNum", 2)
.put("deviceEnergyType", "1")
.put("lastYearFee", "76.25"));
- String key = "vcH5hprSR9VkzneCzkBI3pD0D8plBBmLc927UW8/CY+NmfEi5e0zRH2iU6E8l1HCS/c+EVOzQeOGmgNshVgOpYUFUV5VUaECpWy6O2mE6fLeaeydA5tuGebX9kKp4UH6Oo5TeMC/mjQNpo8d1aho82+eIcOIE1CkVm9Ec875YrijyNz7P7hd9EYlnzJwVsf1Ks4Gzcnl0XRx2n3PN/tvCA==";
+ String key = "GWnQ4RqqTc8n1Uj59xLoUq0YsJLmzgyVzBvI35uj+DaDjdU0HZoU2fCd33JFsVG+3tWpkuojap/b5eeutSp6d4x4juou3yhCF7yhLBqYs1tdr2DF5QqL8uTsLJuKf1Ys8iufExureFAQw+qjMN+W5UlKE5id39PDi2nsPJGUbwkrvkywf2wqaqwZy+i/QBOl";
JSONObject jsonObject = modelTool.exeModel2Report(param,key);//exeModel2Report
System.out.println(jsonObject.toString());
}
diff --git a/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java b/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java
index faaf5e2..3809025 100644
--- a/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java
+++ b/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java
@@ -34,19 +34,20 @@ public class HeatBoilerSence implements DntdModelI {
Double yearReduceCarbon = Math.round(overall.yearReduceCarbon(heatboiler.getYearEnergy())*100.0)/100.0;
//替代电量
Double replaceEnergy = Math.round(overall.replaceEnergy(heatboiler.getYearEnergy())*100.0)/100.0;
+ List devices = matchedDeviceResult.getMatchedDevices();
//需配置设备情况
//方案详情
String reportDetail = "用直热式电锅炉替代原设备";
- //设备类型
+ /*//设备类型
String deviceType = "";
//设备规格
String deviceSpec = "";
//设备数量
- String deviceNum = "";
+ String deviceNum = "";*/
//单位(元/台、元/套)
String unit = "";
Set devTypeSet = new HashSet<>();
- for (MatchedDevice matchedDevice : matchedDeviceResult.getMatchedDevices()) {
+ /* for (MatchedDevice matchedDevice : matchedDeviceResult.getMatchedDevices()) {
devTypeSet.add(matchedDevice.getDevSpec().getDevType());
deviceSpec = deviceSpec + matchedDevice.getDevSpec().getDevType() + ":"+matchedDevice.getDevSpec().getCapacity()+"蒸吨、";
deviceNum = deviceNum + matchedDevice.getCount() + "台/"+matchedDevice.getDevSpec().getDevType()+";";
@@ -57,10 +58,10 @@ public class HeatBoilerSence implements DntdModelI {
break;
}
}
- }
- for (String s : devTypeSet) {
+ }*/
+ /* for (String s : devTypeSet) {
deviceType = deviceType + s + "、";
- }
+ }*/
Advantage advantage = new Advantage();
//总价
String totalPrice = matchedDeviceResult.getTotalPriceInTenThousand()+"万元";
@@ -70,9 +71,9 @@ public class HeatBoilerSence implements DntdModelI {
jsonReport.put("yearReduceCarbon", yearReduceCarbon);
jsonReport.put("replaceEnergy", replaceEnergy);
jsonReport.put("reportDetail", reportDetail);
- jsonReport.put("deviceType", deviceType);
- jsonReport.put("deviceSpec", deviceSpec);
- jsonReport.put("deviceNum", deviceNum);
+ /*jsonReport.put("deviceType", deviceType);
+ jsonReport.put("deviceSpec", deviceSpec);*/
+ jsonReport.put("devices", devices);
jsonReport.put("unit", unit);
jsonReport.put("totalPrice", totalPrice);
jsonReport.put("safety", advantage.safety());
diff --git a/dntd-tool/src/main/java/com/dky/security/GetCpuInfo.java b/dntd-tool/src/main/java/com/dky/security/GetCpuInfo.java
index 3ad24f7..5689b24 100644
--- a/dntd-tool/src/main/java/com/dky/security/GetCpuInfo.java
+++ b/dntd-tool/src/main/java/com/dky/security/GetCpuInfo.java
@@ -14,11 +14,11 @@ public class GetCpuInfo {
// 获取当前操作系统名称
String os = System.getProperty("os.name");
os = os.toUpperCase();
-
+ System.out.println("当前操作系统:"+os);
// linux系统用Runtime.getRuntime().exec()执行 dmidecode -t processor 查询cpu序列
// windows系统用 wmic cpu get ProcessorId 查看cpu序列
if ("LINUX".equals(os)) {
- cpuId = getLinuxCpuId("dmidecode -t processor | grep 'ID'", "ID", ":");
+ cpuId = getLinuxCpuId("dmidecode -t processor | grep 'ID' | head -n 1", "ID", ":");
} else {
cpuId = getWindowsCpuId();
}
@@ -31,6 +31,7 @@ public class GetCpuInfo {
*/
public static String getLinuxCpuId(String cmd, String record, String symbol) throws Exception {
String execResult = executeLinuxCmd(cmd);
+ System.out.println("获取命令执行结果:"+execResult);
String[] infos = execResult.split("\n");
for (String info : infos) {
info = info.trim();
@@ -43,20 +44,31 @@ public class GetCpuInfo {
return null;
}
- public static String executeLinuxCmd(String cmd) throws Exception {
- Runtime run = Runtime.getRuntime();
- Process process;
- process = run.exec(cmd);
- InputStream in = process.getInputStream();
- BufferedReader bs = new BufferedReader(new InputStreamReader(in));
- StringBuffer out = new StringBuffer();
- byte[] b = new byte[8192];
- for (int n; (n = in.read(b)) != -1; ) {
- out.append(new String(b, 0, n));
+ public static String executeLinuxCmd(String cmd){
+ try {
+ Runtime run = Runtime.getRuntime();
+ Process process = null;
+ process = run.exec(cmd);
+ System.out.println(process.toString());
+ if (process == null){
+ System.out.println("未获取到执行结果");
+ }else {
+ System.out.println("读取执行结果");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ System.out.println(line); // 打印每一行输出
+ break;
+ }
+ reader.close();
+ process.destroy();
+ return line;
+ }
+
+ }catch (Exception e) {
+ e.printStackTrace();
}
- in.close();
- process.destroy();
- return out.toString();
+ return null;
}
/**
diff --git a/dntd-tool/src/main/java/com/dky/security/SM4Utils.java b/dntd-tool/src/main/java/com/dky/security/SM4Utils.java
index 0771fbb..36f0cac 100644
--- a/dntd-tool/src/main/java/com/dky/security/SM4Utils.java
+++ b/dntd-tool/src/main/java/com/dky/security/SM4Utils.java
@@ -30,7 +30,7 @@ public class SM4Utils {
public static Map decrypt(String encrypted) throws Exception {
Cipher cipher = Cipher.getInstance(ALGORITHM, "BC");
- SecretKeySpec secretKey = new SecretKeySpec(SM4_KEY.getBytes(StandardCharsets.UTF_8), "SM4");
+ SecretKeySpec secretKey = new SecretKeySpec(SM4_KEY.getBytes(StandardCharsets.UTF_8), "AES");
cipher.init(Cipher.DECRYPT_MODE, secretKey);
byte[] decoded = Base64.getDecoder().decode(encrypted);
byte[] decrypted = cipher.doFinal(decoded);
@@ -58,17 +58,7 @@ public class SM4Utils {
}
public static void main(String[] args) throws Exception {
- Map map = new HashMap<>();
- ArrayList cpuIds = new ArrayList<>();
- cpuIds.add("duahduejdiejidi");
- cpuIds.add("ddnfjuufhurhffr");
- cpuIds.add("frfrjfirjfirjfir");
- cpuIds.add("BFEBFBFF000506E3");
- cpuIds.add("BFEBFBFF000806EA");
- map.put("name", "模型1工具");
- map.put("cpuIds", cpuIds.toString());
- map.put("expireTime","2024-12-16 00:00:00");
- String encrypted = encrypt(map);
- System.out.println(encrypted);
+ Map decrypt = decrypt("GWnQ4RqqTc8n1Uj59xLoUq0YsJLmzgyVzBvI35uj+DaDjdU0HZoU2fCd33JFsVG+3tWpkuojap/b5eeutSp6d4x4juou3yhCF7yhLBqYs1tdr2DF5QqL8uTsLJuKf1Ys8iufExureFAQw+qjMN+W5UlKE5id39PDi2nsPJGUbwkrvkywf2wqaqwZy+i/QBOl");
+ System.out.println(decrypt.toString());
}
}
\ No newline at end of file
diff --git a/doc/modelCode.properties b/doc/modelCode.properties
new file mode 100644
index 0000000..25eebae
--- /dev/null
+++ b/doc/modelCode.properties
@@ -0,0 +1 @@
+0101=generate.HeatBoilerSence