master
林颖晨 11 months ago
parent db95bc948e
commit f7ebe41e60
  1. 2
      dntd-common/src/main/java/com/dky/utils/GetTargetDeviceList.java
  2. 4
      dntd-model-buildheating/src/main/java/com/dky/generate/BuildHeatingScene.java
  3. 2
      dntd-model-heatboiler/src/main/java/com/dky/calculate/HeatCalC.java
  4. 6
      dntd-model-heatboiler/src/main/java/com/dky/generate/HeatBoilerScene.java
  5. 2
      dntd-model-kitchencooking/src/main/java/com/dky/generate/KitchenCookScene.java
  6. 4
      dntd-model-materialkiln/src/main/java/com/dky/generate/MaterialKilnScene.java
  7. 31
      dntd-tool/src/main/java/com/dky/tool/ModelTool.java

@ -8,7 +8,7 @@ import java.util.List;
public class GetTargetDeviceList {
public static List<SysDeviceHeatScene> main(String args, List<SysDeviceHeatScene> alternateDeviceList) {
public static List<SysDeviceHeatScene> screeningInstallation(String args, List<SysDeviceHeatScene> alternateDeviceList) {
List<SysDeviceHeatScene> ary = new ArrayList<>();
alternateDeviceList.forEach((device) -> {

@ -28,8 +28,8 @@ public class BuildHeatingScene implements DntdModelI {
@Override
public JSONObject createReport(JSONObject jsonObject,List<SysDeviceHeatScene> sceneList) {
List<SysDeviceHeatScene> list1 = GetTargetDeviceList.main(DeviceSubType.Cooling_Heating.getDesc(), sceneList);
List<SysDeviceHeatScene> list2 = GetTargetDeviceList.main(DeviceSubType.Cooling_Heating_Electric_Boiler.getDesc(), sceneList);
List<SysDeviceHeatScene> list1 = GetTargetDeviceList.screeningInstallation(DeviceSubType.Cooling_Heating.getDesc(), sceneList);
List<SysDeviceHeatScene> list2 = GetTargetDeviceList.screeningInstallation(DeviceSubType.Cooling_Heating_Electric_Boiler.getDesc(), sceneList);
List<SysDeviceHeatScene> alternateDeviceList = new ArrayList<>(list1);
alternateDeviceList.addAll(list2);

@ -9,7 +9,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CalC {
public class HeatCalC {
public static List<Map<String, Double>> getC(List<Map<String, List<List<MatchedDevice>>>> list) {
List<Map<String, Double>> maps = new ArrayList<>();

@ -30,7 +30,7 @@ public class HeatBoilerScene implements DntdModelI {
@Override
public JSONObject createReport(JSONObject jsonObject, List<SysDeviceHeatScene> list) {
List<SysDeviceHeatScene> alternateDeviceList = GetTargetDeviceList.main(DeviceSubType.Boiler_Heating.getDesc(), list);
List<SysDeviceHeatScene> alternateDeviceList = GetTargetDeviceList.screeningInstallation(DeviceSubType.Boiler_Heating.getDesc(), list);
// System.out.println("工业锅炉供热: " + alternateDeviceList + "\n");
JSONObject distInfo = new JSONObject();
@ -38,7 +38,7 @@ public class HeatBoilerScene implements DntdModelI {
JSONObject originalDevInfo = new JSONObject();
HeatBoilerScheme scheme = new HeatBoilerScheme();
CalC calC = new CalC();
HeatCalC heatCalC = new HeatCalC();
HeatSchemeRating schemeRating = new HeatSchemeRating();
HeatAdvantage advantage = new HeatAdvantage();
HeatBoilerModel model = new HeatBoilerModel();
@ -107,7 +107,7 @@ public class HeatBoilerScene implements DntdModelI {
// 实际可承载容量A = 运行(或合同容量)x0.9 [将运行容量或合同容量折算成容量] x85%
double A = runCapacity * COEFFICIENT_1 * COEFFICIENT_2;
// 根据供热需量设备功率计算每个技术类型下需要的不同功率的设备的数量,然后将不同功率及对应的数量进行计算得出总功率C1,取最大
Double C1 = calC.getC1(matchedDeviceGroupList);
Double C1 = heatCalC.getC1(matchedDeviceGroupList);
// 改造后最大需量
double D1 = lastYearNeed + C1;

@ -28,7 +28,7 @@ public class KitchenCookScene implements DntdModelI {
@Override
public JSONObject createReport(JSONObject jsonObject, List<SysDeviceHeatScene> sceneList) {
List<SysDeviceHeatScene> alternateDeviceList = GetTargetDeviceList.main(DeviceSubType.Kitchen_Cooking.getDesc(), sceneList);
List<SysDeviceHeatScene> alternateDeviceList = GetTargetDeviceList.screeningInstallation(DeviceSubType.Kitchen_Cooking.getDesc(), sceneList);
JSONObject distInfo = new JSONObject();
JSONObject originalDevInfo = new JSONObject();

@ -30,8 +30,8 @@ public class MaterialKilnScene implements DntdModelI {
@Override
public JSONObject createReport(JSONObject jsonObject, List<SysDeviceHeatScene> list) {
List<SysDeviceHeatScene> list1 = GetTargetDeviceList.main(DeviceSubType.Material_Kiln.getDesc(), list);
List<SysDeviceHeatScene> list2 = GetTargetDeviceList.main(DeviceSubType.Metal_Kiln.getDesc(), list);
List<SysDeviceHeatScene> list1 = GetTargetDeviceList.screeningInstallation(DeviceSubType.Material_Kiln.getDesc(), list);
List<SysDeviceHeatScene> list2 = GetTargetDeviceList.screeningInstallation(DeviceSubType.Metal_Kiln.getDesc(), list);
List<SysDeviceHeatScene> alternateDeviceList = new ArrayList<>(list1);
alternateDeviceList.addAll(list2);

@ -3,6 +3,7 @@ package com.dky.tool;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.dky.modelI.DntdModelI;
import com.dky.security.SM4Utils;
import com.dky.stirtpar.StirparModelCalculate;
import com.dky.utils.ConfigReader;
import com.dky.utils.entity.SysDeviceHeatScene;
@ -57,13 +58,16 @@ public class ModelTool {
return ResponseUtil.createResponse(Code.KEY_CONTEXT_ERROR.getCode(), Code.KEY_CONTEXT_ERROR.getDesc(), null);
}
try {
// 根据给定的类名初始化类 加密不需要反实例化new
Class<?> sm4UtilsClass = Class.forName("com.dky.security.SM4Utils");
// 实例化类
Object obj = sm4UtilsClass.getDeclaredConstructor().newInstance();
// 获取方法并调用
Method decryptMethod = sm4UtilsClass.getMethod("sm2DecryptBase64", String.class);
String invoke = (String) decryptMethod.invoke(obj, key);
// // 根据给定的类名初始化类 加密不需要反实例化new
// Class<?> sm4UtilsClass = Class.forName("com.dky.security.SM4Utils");
// // 实例化类
// Object obj = sm4UtilsClass.getDeclaredConstructor().newInstance();
// // 获取方法并调用
// Method decryptMethod = sm4UtilsClass.getMethod("sm2DecryptBase64", String.class);
// String invoke = (String) decryptMethod.invoke(obj, key);
//尝试不使用反射,看中能会不会报错
String invoke = SM4Utils.sm2DecryptBase64(key);
Map<String, String> map = new HashMap<>();
String[] keyValuePairs = invoke.split("&");
for (String keyValuePair : keyValuePairs) {
@ -137,14 +141,17 @@ public class ModelTool {
} else {
jsonObjectResult = ResponseUtil.createResponse(Code.KEY_UNAUTHORIZED.getCode(), Code.KEY_UNAUTHORIZED.getDesc(), null);
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
NoSuchMethodException | SecurityException e) {
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| SecurityException e) {
// 异常处理
e.printStackTrace();
System.err.println("反射调用过程中发生异常: " + e.getMessage());
} catch (InvocationTargetException e) {
jsonObjectResult = ResponseUtil.createResponse(Code.KEY_CONTEXT_ERROR.getCode(), Code.KEY_CONTEXT_ERROR.getDesc(), null);
e.printStackTrace();
// } catch (NoSuchMethodException e) {
// e.printStackTrace();
// System.err.println("反射调用过程中发生异常: " + e.getMessage());
// } catch (InvocationTargetException e) {
// jsonObjectResult = ResponseUtil.createResponse(Code.KEY_CONTEXT_ERROR.getCode(), Code.KEY_CONTEXT_ERROR.getDesc(), null);
// e.printStackTrace();
} catch (Exception e) {
throw new RuntimeException(e);
}

Loading…
Cancel
Save