Compare commits

...

5 Commits

Author SHA1 Message Date
魔神煜修罗皇 ff059150fd 2024-03-04 14:02:56 建筑供暖模型接口优化完善 1 year ago
林颖晨 d47245ab74 重构模型算法 1 year ago
林颖晨 470756724a fix: 1 year ago
魔神煜修罗皇 a253c3a9c3 2024-01-30 18:35:06 1 year ago
魔神煜修罗皇 2725199dd2 2024-01-30 18:35:06 1 year ago
  1. 51
      dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java
  2. 3
      dntd-common/src/main/java/com/dky/utils/enums/Code.java
  3. 10
      dntd-common/src/main/java/com/dky/utils/result/MatchedDevice.java
  4. 24
      dntd-model-buildheating/src/main/java/com/dky/calculate/BuildHeatingAdvantage.java
  5. 37
      dntd-model-buildheating/src/main/java/com/dky/calculate/BuildHeatingModel.java
  6. 47
      dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java
  7. 30
      dntd-model-buildheating/src/main/java/com/dky/calculate/CalD.java
  8. 74
      dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java
  9. 149
      dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRating.java
  10. 47
      dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRatingRes.java
  11. 27
      dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java
  12. 147
      dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java
  13. 8
      dntd-model-buildheating/src/main/java/com/dky/entity/HeatingDevice.java
  14. 68
      dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java
  15. 6
      dntd-model-heatboiler/src/main/java/com/dky/calculate/Advantage.java
  16. 5
      dntd-model-heatboiler/src/main/java/com/dky/calculate/HeatBoilerModel.java
  17. 4
      dntd-model-heatboiler/src/main/java/com/dky/entity/HeatboilerSpec.java
  18. 38
      dntd-model-madekiln/pom.xml
  19. 92
      dntd-model-madekiln/src/main/java/com/dky/calculate/Overall.java
  20. 116
      dntd-model-madekiln/src/main/java/com/dky/entity/MadeKiln.java
  21. 52
      dntd-model-madekiln/src/main/java/com/dky/entity/OriginalDevice.java
  22. 6
      dntd-modelI/pom.xml
  23. 6
      dntd-modelI/src/main/java/com/dky/modelI/DntdModelI.java
  24. 63
      dntd-tool/src/main/java/com/dky/Test.java
  25. 199
      dntd-tool/src/main/java/com/dky/generate/BuildHeatingScene.java
  26. 41
      dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java
  27. 35
      dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java
  28. 4
      dntd-tool/src/main/java/com/dky/security/SM4Utils.java
  29. 46
      dntd-tool/src/main/java/com/dky/tool/ModelTool.java
  30. 4
      dntd-tool/src/main/resources/modelCode.properties
  31. 2
      doc/modelCode.properties
  32. 1
      pom.xml

@ -10,13 +10,15 @@ public class SysDeviceHeatScene {
//技术类型
private String devTechType;
//热效率
private Integer heatEfficiency;
private Double heatEfficiency;
//设备功率
private Double devPower;
//设备单价
private Double devPrice;
//电替代设备年人工费用
// 电替代设备年人工费用
private Double devSubstituteLaborCost;
// 原设备的人工费用
private Double laborCost ;
//单台设备可参考供暖面积
private Double devReferenceArea;
//设备使用年限
@ -26,6 +28,47 @@ public class SysDeviceHeatScene {
//备注
private String remark;
public SysDeviceHeatScene(Integer id, String devType, String devSubType, String devTechType, Double heatEfficiency, Double devPower, Double devPrice, Double devSubstituteLaborCost, Double laborCost, Double devReferenceArea, Integer devServiceLife, Integer devAnnualOperationTime, String remark) {
this.id = String.valueOf(id);
this.devType = devType;
this.devSubType = devSubType;
this.devTechType = devTechType;
this.heatEfficiency = heatEfficiency;
this.devPower = devPower;
this.devPrice = devPrice;
this.devSubstituteLaborCost = devSubstituteLaborCost;
this.laborCost = laborCost;
this.devReferenceArea = devReferenceArea;
this.devServiceLife = devServiceLife;
this.devAnnualOperationTime = devAnnualOperationTime;
this.remark = remark;
}
public Double getLaborCost() {
return laborCost;
}
public void setLaborCost(Double laborCost) {
this.laborCost = laborCost;
}
@Override
public String toString() {
return "SysDeviceHeatScene{" +
"id = " + id +
",devType='" + devType + '\'' +
",设备细类: " + devSubType +
",技术类型: " + devTechType +
",热效率 = " + heatEfficiency +
",功率 = " + devPower +
",单价 =" + devPrice +
",电替代设备年人工费用: " + devSubstituteLaborCost +
",原设备的人工费用:" + laborCost +
",单台设备可参考供暖面积 = " + devReferenceArea +
",设备使用年限 = " + devServiceLife +
'}';
}
public String getId() {
return id;
}
@ -58,11 +101,11 @@ public class SysDeviceHeatScene {
this.devTechType = devTechType;
}
public Integer getHeatEfficiency() {
public Double getHeatEfficiency() {
return heatEfficiency;
}
public void setHeatEfficiency(Integer heatEfficiency) {
public void setHeatEfficiency(Double heatEfficiency) {
this.heatEfficiency = heatEfficiency;
}

@ -6,7 +6,8 @@ public enum Code {
SUCCESS(1001, "成功"),
KEY_EXPIRATION(1002, "密钥已过期"),
KEY_UNAUTHORIZED(1003, "密钥本机未授权");
KEY_UNAUTHORIZED(1003, "密钥未在本机授权"),
KEY_CONTEXT_ERROR(1004, "密钥错误");
/**

@ -7,11 +7,19 @@ public class MatchedDevice {
private SysDeviceHeatScene deviceHeatScene;
private int count; // 匹配的设备数量
public MatchedDevice(SysDeviceHeatScene deviceHeatScene, int count) {
public MatchedDevice(int count, SysDeviceHeatScene deviceHeatScene) {
this.deviceHeatScene = deviceHeatScene;
this.count = count;
}
@Override
public String toString() {
return "MatchedDevice{" +
"deviceHeatScene=" + deviceHeatScene +
", count=" + count +
'}';
}
public SysDeviceHeatScene getDeviceHeatScene() {
return deviceHeatScene;
}

@ -0,0 +1,24 @@
package com.dky.calculate;
//方案优势
public class BuildHeatingAdvantage {
//安全性
public static String safety(){
return "精准控温";
}
//经济性
public static 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;
return "本次改造投资回收期为"+hsq+"年,本改造方案相比较原技术节省年运行费用成本"+js+"元。";
}
// 智能性
public static String intelligence() {
return "以电锅炉替代和实现精准控温。";
}
// 环保性
public static String environment(Double yearReduceCarbon) {
return "本次改造方案减排" + yearReduceCarbon + "吨";
}
}

@ -1,8 +1,13 @@
package com.dky.calculate;
public class OverCollHeatAll {
public class BuildHeatingModel {
// 定义常量
private static final double COAL_PRICE_PER_KILOGRAM = 0.9; // 煤炭的平均价格,单位:元/千克
private static final double STANDARD_COAL_CONVERSION_FACTOR = 0.7143; // 千克标准煤/千克
private static final double CO2_CONVERSION_FACTOR = 1.9003; // 千克二氧化碳/千克
private static final double ELECTRICITY_SUBSTITUTION_CONVERSION_FACTOR = 0.1229; // 千克标准煤/千瓦时
/**
* 初次投资费用万元
@ -26,11 +31,11 @@ public class OverCollHeatAll {
* @param laborCost 电替代设备人工费用成本
* @return
*/
public Double getRunCost(Integer deviceNum,
public static Double getRunCost(Integer deviceNum,
Double devicePower,
Integer days,
Double laborCost){
return deviceNum * devicePower * days * 24 * 0.5 + laborCost;
return (deviceNum * devicePower * days * 24 * 0.5) + (laborCost );
}
/**
@ -43,35 +48,41 @@ public class OverCollHeatAll {
* @param laborCost 电替代设备人工费用成本 非表中参数
* @return
*/
public Double getYearCost(Integer deviceNum,
public static Double getYearCost(Integer deviceNum,
Double devicePrice,
Integer useYears,
Double devicePower,
Integer days,
Double laborCost){
double run = deviceNum * devicePower * days * 24 * 0.5 + laborCost;
double run = (deviceNum * devicePower * days * 24 * 0.5) + (laborCost );
return ((deviceNum * devicePrice) / useYears) + run;
}
/**
* 年减碳
* @param lastYearFee 上年运行费用万元
* @param oldDaborCost 原设备的人工费用万元
* @param lastYearFee 上年运行费用
* @param oldLaborCost 原设备的人工费用
* @param deviceNum 电锅炉设备台数
* @param devicePower 单台电锅炉的功率
* @param days 年采暖供冷时间()
* @return
*/
public Double calculateAnnualCarbonReduction(Double lastYearFee,
Double oldDaborCost,
public static Double calculateAnnualCarbonReduction(Double lastYearFee,
Double oldLaborCost,
Integer deviceNum,
Double devicePower,
Integer days){
double d1 = (((lastYearFee - oldDaborCost) / 0.9) * 0.7143);
double d2 = deviceNum * devicePower * days * 24;
return (d1 - (d2 * 0.1229)) * 1.9003;
// 计算煤炭减少的碳排放量
double coalReduction = (lastYearFee - oldLaborCost) / COAL_PRICE_PER_KILOGRAM * STANDARD_COAL_CONVERSION_FACTOR;
// 计算电替代设备增加的碳排放量
double electricityIncrease = getElectric(deviceNum, devicePower, days) * ELECTRICITY_SUBSTITUTION_CONVERSION_FACTOR;
// 计算总的年减碳量
return (coalReduction - electricityIncrease) * CO2_CONVERSION_FACTOR;
}
/**
* 替代电量千瓦时
* @param deviceNum 电锅炉设备台数
@ -79,7 +90,7 @@ public class OverCollHeatAll {
* @param days 年采暖供冷时间()
* @return
*/
public Double getElectric(Integer deviceNum,
public static Double getElectric(Integer deviceNum,
Double devicePower,
Integer days){
return deviceNum * devicePower * days * 24 ;

@ -1,13 +1,54 @@
package com.dky.calculate;
import com.dky.utils.result.MatchedDevice;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CalC {
//投入供热设备总功率计算
public double calTotalPower(List<MatchedDevice> matchedDevices,Double buildArea) {
return floor * heatArea * devPrice;
public static List<Map<String, Double>> getC(List<Map<String, List<List<MatchedDevice>>>> list) {
List<Map<String, Double>> maps = new ArrayList<>();
list.parallelStream().forEach(stringListMap -> {
// 区分热泵、电锅炉
stringListMap.forEach((k,v)->{
// 循环遍历各个方案
final Double[] maxPower = {0.0};
v.parallelStream().forEach((plan)->{
Double power = 0.0;
for (MatchedDevice device : plan){
power = power + (device.getCount() * device.getDeviceHeatScene().getDevPower()) ;
}
if (power >= maxPower[0]){
maxPower[0] = power;
}
});
Map<String, Double> map = new HashMap<>();
map.put(k, maxPower[0]);
maps.add(map);
});
});
return maps;
}
public static Double getC1(List<List<MatchedDevice>> args) {
// 循环遍历各个方案
final Double[] maxPower = {-100.0};
args.parallelStream().forEach(plan -> {
Double power = 0.0;
for (MatchedDevice device : plan){
power = power + (device.getCount() * device.getDeviceHeatScene().getDevPower()) ;
}
if (power >= maxPower[0]){
maxPower[0] = power;
}
});
return maxPower[0];
}
}

@ -0,0 +1,30 @@
package com.dky.calculate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CalD {
/**
* 改造后最大需量
* @param lastYearNeed 上年最大需量
* @param list 设备总功率集合
*/
public static List<Map> getD(Double lastYearNeed, List<Map<String, Double>> list) {
List<Map> maps = new ArrayList<>();
list.parallelStream().forEach((s)->{
Map<String, Double> map = new HashMap<>();
s.forEach((k,v)->{
map.put(k, lastYearNeed + v);
maps.add(map);
});
});
return maps;
}
}

@ -1,33 +1,69 @@
package com.dky.calculate;
import com.dky.utils.entity.SysDeviceHeatScene;
import com.dky.utils.result.MatchedDevice;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
public class Scheme {
public List<MatchedDevice> calSchemeByTechType(Double buildArea, List<SysDeviceHeatScene> deviceList, String techType){
/**
* 根据设备细类筛选出不同技术类型的不同功率设备需要的数量
* List<MatchedDevice> 同一个技术类型下的设备列表以及每个设备所需要的台数
* Map<String, List<List<MatchedDevice>>> 键为设备细类
*
* @param buildArea 建筑面积
* @param sysDeviceHeatSceneList 替代设备列表
* @return
*/
public static List<List<MatchedDevice>> calScheme(Double buildArea, List<SysDeviceHeatScene> sysDeviceHeatSceneList) {
// 根据设备细类筛选出一个以设备细类为键,该细类下设备列表为值的Map
Map<String, List<SysDeviceHeatScene>> groupByDevSubTypeMap = sysDeviceHeatSceneList.stream()
.collect(Collectors.groupingBy(SysDeviceHeatScene::getDevSubType));
List<SysDeviceHeatScene> list = new ArrayList();
for (int i = 0; i < deviceList.size(); i++){
if (deviceList.get(i).getDevTechType().equals(techType)){
list.add(deviceList.get(i));
}
}
//对list按照单台设备可参考供暖面积进行排序
list.sort((o1, o2) -> Double.compare(o2.getDevReferenceArea(),o1.getDevReferenceArea()));
// 区分技术类型
List<List<MatchedDevice>> planList = new ArrayList<>();
groupByDevSubTypeMap.forEach((devSubType, v) -> {
// 该细类下的设备根据技术类型筛选出一个以技术类型为键,该技术类型下设备列表为值的Map
Map<String, List<SysDeviceHeatScene>> groupByDevTechTypeMap = v.stream().collect(Collectors.groupingBy(SysDeviceHeatScene::getDevTechType));
groupByDevTechTypeMap.forEach((devTechType, devList) -> {
List<MatchedDevice> matchedDevices = calSchemeByTechType(buildArea, devList);
planList.add(matchedDevices);
});
});
return planList;
}
/**
* 根据建筑面积和其中一个设备细类-技术类型下的不同功率的设备计算出该技术类型分别需要不同功率的设备的的数量
*
* @param buildArea 建筑面积
* @param sysDeviceHeatSceneList 不同设备细类-技术类型下的设备列表
* @return 不同功率的设备对应所需要的数量
*/
public static List<MatchedDevice> calSchemeByTechType(Double buildArea, List<SysDeviceHeatScene> sysDeviceHeatSceneList) {
// 对技术类型下的设备list按照单台设备可参考供暖面积进行排序
sysDeviceHeatSceneList.sort((o1, o2) -> Double.compare(o2.getDevReferenceArea(), o1.getDevReferenceArea()));
Double remainArea = buildArea;
//遍历设备,根据建筑面积进行匹配设备数量
List<MatchedDevice> matchedDeviceList = new ArrayList();
for (SysDeviceHeatScene deviceHeatScene:list){
if (deviceHeatScene.getDevReferenceArea() <= remainArea){
int count = (int) (buildArea/deviceHeatScene.getDevReferenceArea());
remainArea = remainArea - count*deviceHeatScene.getDevReferenceArea();
matchedDeviceList.add(new MatchedDevice(deviceHeatScene,count));
// 遍历设备,根据建筑面积进行匹配设备数量
List<MatchedDevice> matchedDeviceList = new ArrayList<>();
for (SysDeviceHeatScene deviceHeatScene : sysDeviceHeatSceneList) {
double v = remainArea / deviceHeatScene.getDevReferenceArea();
int count = (int) (v);
if (v < 1) {
count = count + 1;
}
remainArea = remainArea - count * deviceHeatScene.getDevReferenceArea();
matchedDeviceList.add(new MatchedDevice(count, deviceHeatScene));
if (remainArea <= 0) {
break; // 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备
// 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备
break;
}
}
return matchedDeviceList;

@ -0,0 +1,149 @@
package com.dky.calculate;
import com.dky.utils.entity.SysDeviceHeatScene;
import com.dky.utils.result.MatchedDevice;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
public class SchemeRating {
/**
* 计算每一种方案的效率和成本评分
* @param list
* @return
*/
public static Map<String, SchemeRatingRes> getOptimalList(List<List<MatchedDevice>> list,Double costRatio,Double effRatio,Map<String,Double> maxEff,Map<String, Double> minPrice) {
Map<String, SchemeRatingRes> optimalMap = new HashMap<>();
list.forEach(plan->{
String devTechType = plan.get(0).getDeviceHeatScene().getDevTechType();
AtomicReference<Double> rating = new AtomicReference<>(0.0);
String devSubType = plan.get(0).getDeviceHeatScene().getDevSubType();
Double eff = 0.0;
Double cost = 0.0;
for (MatchedDevice device : plan) {
eff = device.getDeviceHeatScene().getHeatEfficiency();
}
for (MatchedDevice device : plan) {
cost = cost + ((device.getCount() * device.getDeviceHeatScene().getDevPrice()) + (device.getCount()) * device.getDeviceHeatScene().getDevSubstituteLaborCost() * device.getDeviceHeatScene().getDevServiceLife());
}
double v1 = (maxEff.get(devSubType) - eff) / maxEff.get(devSubType); // 热效率占比计算
double v = (cost - minPrice.get(devSubType)) / minPrice.get(devSubType); // 成本占比计算
System.out.println("当前方案成本: " + cost + ",当前方案热效率: " + eff + ",技术选型: " + devSubType + ",最小成本Map: " + minPrice + ",最大热效率Map: " + maxEff);
// System.out.println("成本除法运算 = " + v + ",减法运算 = " + (1 - v) + ",乘法运算 = " + (1 -v) * 20 + "。");
// System.out.println("热效率除法运算 = " + v1 + ",减法运算 = " + (1 - v1) + ",乘法运算 = " + (1 -v1) * 80 + "。\n");
// 3、(1-(选择对应设备细类的效率最大的效率值(效率最大值)-当前设备的效率值值)/效率最大值)*100*系数 +(1-(当前成本值-对应设备细类的成本最小值)/对应设备细类的成本最小值)*100*0.2。取最高得分。
rating.set(((1 - v1) * 100 * effRatio) + ((1 - v) * 100 * costRatio));
// 方案评分结果
SchemeRatingRes schemeRatingRes = new SchemeRatingRes(plan, rating.get(), devTechType);
optimalMap.put(devTechType, schemeRatingRes);
System.out.println("方案详情 = ");
for (MatchedDevice matchedDevice : plan){
System.out.println(matchedDevice);
}
System.out.println("当前方案评分: " + rating.get() + "\n");
});
return optimalMap;
}
/**
* 获取最优评分的方案
* @param map
* @return
*/
public static List<MatchedDevice> getOptimalScheme(Map<String, SchemeRatingRes> map) {
final AtomicReference<Double>[] rating = new AtomicReference[]{new AtomicReference<>(-100.0)};
final List<MatchedDevice>[] list = new List[]{new ArrayList<>()};
map.forEach((k,v)->{
if (v.getSchemeRating() > rating[0].get()) {
rating[0].set(v.getSchemeRating());
list[0] = v.getList();
}
});
return list[0];
}
/**
* 获取不同设备细类下的效率最大值
* @param alternateDeviceList 可替代设备列表
* @return 不同设备细类下的效率最大值map
*/
public static Map<String,Double> getMaxEfficiencyGroupByDevSubType( List<SysDeviceHeatScene> alternateDeviceList){
Map<String,Double> map = new HashMap<>();
alternateDeviceList.forEach(alternateDevice ->{
String devSubType = alternateDevice.getDevSubType();
Double v = map.get(devSubType);
if ( v == null){
map.put(devSubType,alternateDevice.getHeatEfficiency());
} else {
if( alternateDevice.getHeatEfficiency() > v){
map.put(devSubType,alternateDevice.getHeatEfficiency());
}
}
});
return map;
}
/**
* 获取不同设备细类下的成本最小值
* @param alternateDeviceList 可替代设备列表
* @return 不同设备细类下的成本最小值
*/
public static Map<String,Double> getMinPriceGroupByDevSubType(List<List<MatchedDevice>> alternateDeviceList){
Map<String,Double> map = new HashMap<>();
alternateDeviceList.forEach(plan -> {
Double thisPlanCost = 0.0;
String devSubType = plan.get(0).getDeviceHeatScene().getDevSubType();
for (MatchedDevice device : plan) {
thisPlanCost = thisPlanCost + ((device.getCount() * device.getDeviceHeatScene().getDevPrice()) + (device.getCount()) * device.getDeviceHeatScene().getDevSubstituteLaborCost() * device.getDeviceHeatScene().getDevServiceLife());
}
Double v = map.get(devSubType);
if ( v == null){
map.put(devSubType, thisPlanCost);
} else {
if(thisPlanCost < v){
map.put(devSubType, thisPlanCost);
}
}
});
return map;
}
public static List<Map<String, Double[]>> getIndex(List<List<MatchedDevice>> list) {
List<Map<String, Double[]>> maps = new ArrayList<>();
final Double[] index = {0.0, Double.MAX_VALUE};
Map<String, Double[]> map = new HashMap<>();
list.parallelStream().forEach((plan) -> {
Double eff = 0.0;
Double cost = 0.0;
for (MatchedDevice device : plan) {
eff = device.getDeviceHeatScene().getHeatEfficiency();
}
for (MatchedDevice device : plan) {
cost = cost + ((device.getCount() * device.getDeviceHeatScene().getDevPrice()) + (device.getCount()) * device.getDeviceHeatScene().getDevSubstituteLaborCost() * device.getDeviceHeatScene().getDevServiceLife());
}
if (eff >= index[0]) {
index[0] = eff;
}
if (cost <= index[1]) {
index[1] = cost;
}
map.put(plan.get(0).getDeviceHeatScene().getDevSubType(), index);
maps.add(map);
});
return maps;
}
}

@ -0,0 +1,47 @@
package com.dky.calculate;
import com.dky.utils.result.MatchedDevice;
import java.util.List;
public class SchemeRatingRes {
List<MatchedDevice> list;
Double schemeRating;
String planName;
public SchemeRatingRes() { }
public SchemeRatingRes(List<MatchedDevice> list, Double schemeRating, String planName) {
this.list = list;
this.schemeRating = schemeRating;
this.planName = planName;
}
public List<MatchedDevice> getList() {
return list;
}
public void setList(List<MatchedDevice> list) {
this.list = list;
}
public Double getSchemeRating() {
return schemeRating;
}
public void setSchemeRating(Double schemeRating) {
this.schemeRating = schemeRating;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
}

@ -1,27 +0,0 @@
package com.dky.entity;
public class Construction {
// 建筑类型(1机关,2医院,3学校,4商业办公楼,5酒店,6其他)
private Integer constrType;
// 建筑面积(平方米)
private Double floor;
public Integer getConstrType() {
return constrType;
}
public void setConstrType(Integer constrType) {
this.constrType = constrType;
}
public Double getFloor() {
return floor;
}
public void setFloor(Double floor) {
this.floor = floor;
}
}

@ -1,147 +0,0 @@
package com.dky.entity;
public class CoolHeat {
// 年采暖时间(天)
private Integer yearGetHeatDays;
// 是否有蒸汽/生活热水需求(1是,2否)
private Integer isHeatWater;
// 每小时最大需求量(吨蒸汽)
private Double hourMaxXqlDZQ;
// 每小时最大需求量(吨热水)
private Double hourMaxXqlDRS;
// 是否有供冷需求(1是,2否)
private Integer isCool;
// 年供冷时间(天)
private Integer yearGetCoolDays;
// 末端形式(1风机盘管,2地暖,3暖气片,4无末端)
private Integer endForm;
// 单台电锅炉的需求功率
private Double needPower;
// 单台电设备参考的可供暖面积
private Double heatArea;
// 单台电设备价格
private Double devPrice;
// 电替代设备人工费用成本
private Double laborCost;
// 电锅炉的使用年限
private Integer useYears;
private OriginalDevice originalDevice;
public Integer getYearGetHeatDays() {
return yearGetHeatDays;
}
public void setYearGetHeatDays(Integer yearGetHeatDays) {
this.yearGetHeatDays = yearGetHeatDays;
}
public Integer getIsHeatWater() {
return isHeatWater;
}
public void setIsHeatWater(Integer isHeatWater) {
this.isHeatWater = isHeatWater;
}
public Double getHourMaxXqlDZQ() {
return hourMaxXqlDZQ;
}
public void setHourMaxXqlDZQ(Double hourMaxXqlDZQ) {
this.hourMaxXqlDZQ = hourMaxXqlDZQ;
}
public Double getHourMaxXqlDRS() {
return hourMaxXqlDRS;
}
public void setHourMaxXqlDRS(Double hourMaxXqlDRS) {
this.hourMaxXqlDRS = hourMaxXqlDRS;
}
public Integer getIsCool() {
return isCool;
}
public void setIsCool(Integer isCool) {
this.isCool = isCool;
}
public Integer getYearGetCoolDays() {
return yearGetCoolDays;
}
public void setYearGetCoolDays(Integer yearGetCoolDays) {
this.yearGetCoolDays = yearGetCoolDays;
}
public Integer getEndForm() {
return endForm;
}
public void setEndForm(Integer endForm) {
this.endForm = endForm;
}
public Double getNeedPower() {
return needPower;
}
public void setNeedPower(Double needPower) {
this.needPower = needPower;
}
public Double getHeatArea() {
return heatArea;
}
public void setHeatArea(Double heatArea) {
this.heatArea = heatArea;
}
public Double getDevPrice() {
return devPrice;
}
public void setDevPrice(Double devPrice) {
this.devPrice = devPrice;
}
public Double getLaborCost() {
return laborCost;
}
public void setLaborCost(Double laborCost) {
this.laborCost = laborCost;
}
public Integer getUseYears() {
return useYears;
}
public void setUseYears(Integer useYears) {
this.useYears = useYears;
}
public OriginalDevice getOriginalDevice() {
return originalDevice;
}
public void setOriginalDevice(OriginalDevice originalDevice) {
this.originalDevice = originalDevice;
}
}

@ -1,8 +0,0 @@
package com.dky.entity;
public class HeatingDevice {
//id
private String id;
//
}

@ -1,68 +0,0 @@
package com.dky.entity;
public class OriginalDevice {
// 设备类型(1锅炉,2市政)
private String deviceType;
// 设备数量(台)
private Integer deviceNum;
// 功能(1供暖,2供冷,3热水)
private Integer deviceFun;
// 设备能源类型(1煤,2油,3气,4汽)
private String deviceEnergyType;
// 上年运行费用(万元)
private Double lastYearFee;
// 原设备的人工费用(万元)
private Double oldDaborCost;
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public Integer getDeviceNum() {
return deviceNum;
}
public void setDeviceNum(Integer deviceNum) {
this.deviceNum = deviceNum;
}
public Integer getDeviceFun() {
return deviceFun;
}
public void setDeviceFun(Integer deviceFun) {
this.deviceFun = deviceFun;
}
public String getDeviceEnergyType() {
return deviceEnergyType;
}
public void setDeviceEnergyType(String deviceEnergyType) {
this.deviceEnergyType = deviceEnergyType;
}
public Double getLastYearFee() {
return lastYearFee;
}
public void setLastYearFee(Double lastYearFee) {
this.lastYearFee = lastYearFee;
}
public Double getOldDaborCost() {
return oldDaborCost;
}
public void setOldDaborCost(Double oldDaborCost) {
this.oldDaborCost = oldDaborCost;
}
}

@ -6,18 +6,18 @@ public class Advantage {
return "无";
}
//经济性
public String economy(Double firstInvestFee,Double yearTotalFee,Double yearRunFee,Double lastYearFee){
public static 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;
return "本次改造投资回收期为"+hsq+"年,本改造方案相比较原技术节省年运行费用成本"+js+"元。";
}
// 智能性
public String intelligence() {
public static String intelligence() {
return "以电锅炉替代和实现精准控温。";
}
// 环保性
public String environment(Double yearReduceCarbon) {
public static String environment(Double yearReduceCarbon) {
return "本次改造方案减排" + yearReduceCarbon + "吨";
}
}

@ -3,7 +3,6 @@ package com.dky.calculate;
import com.dky.entity.Heatboiler;
import com.dky.entity.HeatboilerSpec;
import com.dky.entity.OriginalDevice;
import com.dky.utils.entity.DevSpec;
public class HeatBoilerModel {
@ -22,7 +21,7 @@ public class HeatBoilerModel {
double substituteElectricityDevices = heatboiler.getHotDevicePower() / (heatboiler.getHotDevicePower() * d);
// 计算初次投资费用
return substituteElectricityDevices * heatboilerSpec.getDevModel();
return substituteElectricityDevices * 1;
}
@ -54,7 +53,7 @@ public class HeatBoilerModel {
*/
public static double calculateAnnualTotalCost(HeatboilerSpec heatboilerSpec, Heatboiler heatboiler , OriginalDevice originalDevice ,Integer count) {
//(电替代设备台数*单台电设备价格<A>)/电替代设备的使用年限<A>+年运行费用
return (count * heatboilerSpec.getDevModel()) / heatboilerSpec.getServiceLife() + calculateAnnualOperatingCost( heatboilerSpec, heatboiler , originalDevice,count);
return (count * 1) / heatboilerSpec.getServiceLife() + calculateAnnualOperatingCost( heatboilerSpec, heatboiler , originalDevice,count);
}
/**

@ -1,8 +1,6 @@
package com.dky.entity;
import com.dky.utils.entity.DevSpec;
public class HeatboilerSpec extends DevSpec {
public class HeatboilerSpec {
private double substitutePower; // 电替代设备功率
private double substituteLaborCost; // 电替代设备人工费用

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dntd-model-tools</artifactId>
<groupId>com.dky</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dntd-model-madekiln</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.4.5</version>
</dependency>
<dependency>
<groupId>com.dky</groupId>
<artifactId>dntd-modelI</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.dky</groupId>
<artifactId>dntd-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

@ -1,92 +0,0 @@
package com.dky.calculate;
public class Overall {
/**
* 初次投资费用万元
* @param yearOut 预计年产量
* @param madeHours 单台电设备制造一批产品的周期小时
* @param proOut 单台电设备制造一批产品的产量
* @param runHours 单台设备年运行时间
* @param devicePrice 单台电设备价格
* @return
*/
public Double investment(Double yearOut,
Integer madeHours,
Integer proOut,
Integer runHours,
Double devicePrice){
double d1 = yearOut * madeHours;
double d2 = proOut * runHours;
int remainder = (int)(d1/d2) + (d1%d2==0?0:1);
return remainder * devicePrice;
}
/**
* 年运行费用万元
* @param deviceNum 电设备设备台数
* @param devicePower 单台电设备的功率
* @param days 电设备年运行时间
* @param laborCost 电替代设备人工费用成本
* @return
*/
public Double getRunCost(Integer deviceNum,
Double devicePower,
Integer days,
Double laborCost){
return deviceNum * devicePower * days * 0.5 + laborCost;
}
/**
* 年总费用万元
* @param deviceNum 电设备设备台数
* @param devicePrice 单台电设备价格
* @param useYears 使用年限
* @param devicePower 单台电设备的功率
* @param days 电设备年运行时间()
* @param laborCost 电替代设备人工费用成本
* @return
*/
public Double getYearCost(Integer deviceNum,
Double devicePrice,
Integer useYears,
Double devicePower,
Integer days,
Double laborCost){
double run = deviceNum * devicePower * days * 0.5 + laborCost;
return ((deviceNum * devicePrice) / useYears) + run;
}
/**
* 年减碳
* @param lastYearFee 上年运行费用万元
* @param oldDaborCost 原设备的人工费用万元
* @param deviceNum 电锅炉设备台数
* @param devicePower 单台电锅炉的功率
* @param days 年采暖供冷时间()
* @return
*/
public Double calculateAnnualCarbonReduction(Double lastYearFee,
Double oldDaborCost,
Integer deviceNum,
Double devicePower,
Integer days){
double d1 = (((lastYearFee - oldDaborCost) / 0.9) * 0.7143);
double d2 = deviceNum * devicePower * days ;
return (d1 - (d2 * 0.1229)) * 1.9003;
}
/**
* 替代电量千瓦时
* @param deviceNum 电锅炉设备台数
* @param devicePower 单台电锅炉的功率
* @param days 年采暖供冷时间()
* @return
*/
public Double getElectric(Integer deviceNum,
Double devicePower,
Integer days){
return deviceNum * devicePower * days ;
}
}

@ -1,116 +0,0 @@
package com.dky.entity;
public class MadeKiln {
// 电替代设备的功率
private Double devicePower;
// 单台电设备制造一批产品的周期(小时)
private Integer madeHours;
// 单台电设备制造一批产品的产量
private Integer proOut;
// 单台电设备价格
private Double devPrice;
// 电替代设备人工费用
private Double laborCost;
// 电设备年运行时间
private Double runHours;
// 制造类型(1金属,2陶瓷,3其它)
private Integer madeType;
// 预计年产量(吨)
private Double yearOut;
// 工作容积(升)(合计)
private Double volAge;
// 温度要求(摄氏度)
private Double needTemp;
private OriginalDevice originalDevice;
public Double getDevicePower() {
return devicePower;
}
public void setDevicePower(Double devicePower) {
this.devicePower = devicePower;
}
public Integer getMadeHours() {
return madeHours;
}
public void setMadeHours(Integer madeHours) {
this.madeHours = madeHours;
}
public Integer getProOut() {
return proOut;
}
public void setProOut(Integer proOut) {
this.proOut = proOut;
}
public Double getDevPrice() {
return devPrice;
}
public void setDevPrice(Double devPrice) {
this.devPrice = devPrice;
}
public Double getLaborCost() {
return laborCost;
}
public void setLaborCost(Double laborCost) {
this.laborCost = laborCost;
}
public Double getRunHours() {
return runHours;
}
public void setRunHours(Double runHours) {
this.runHours = runHours;
}
public Integer getMadeType() {
return madeType;
}
public void setMadeType(Integer madeType) {
this.madeType = madeType;
}
public Double getYearOut() {
return yearOut;
}
public void setYearOut(Double yearOut) {
this.yearOut = yearOut;
}
public Double getVolAge() {
return volAge;
}
public void setVolAge(Double volAge) {
this.volAge = volAge;
}
public Double getNeedTemp() {
return needTemp;
}
public void setNeedTemp(Double needTemp) {
this.needTemp = needTemp;
}
public OriginalDevice getOriginalDevice() {
return originalDevice;
}
public void setOriginalDevice(OriginalDevice originalDevice) {
this.originalDevice = originalDevice;
}
}

@ -1,52 +0,0 @@
package com.dky.entity;
public class OriginalDevice {
private int equipmentType; // 设备类型(1锅炉,2窑炉,3灶台)
private int quantity; // 台数(台)
private int energyType; // 能源类型(1煤,2油,3气)
private double previousYearOperatingCost; // 上年运行费用(万元)
private double oldLaborCost; // 原设备的人工费用
public double getOldLaborCost() {
return oldLaborCost;
}
public void setOldLaborCost(double oldLaborCost) {
this.oldLaborCost = oldLaborCost;
}
public int getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(int equipmentType) {
this.equipmentType = equipmentType;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getEnergyType() {
return energyType;
}
public void setEnergyType(int energyType) {
this.energyType = energyType;
}
public double getPreviousYearOperatingCost() {
return previousYearOperatingCost;
}
public void setPreviousYearOperatingCost(double previousYearOperatingCost) {
this.previousYearOperatingCost = previousYearOperatingCost;
}
}

@ -22,6 +22,12 @@
<artifactId>hutool-all</artifactId>
<version>5.4.5</version>
</dependency>
<dependency>
<groupId>com.dky</groupId>
<artifactId>dntd-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

@ -1,7 +1,11 @@
package com.dky.modelI;
import cn.hutool.json.JSONObject;
import com.dky.utils.entity.SysDeviceHeatScene;
import java.util.List;
public interface DntdModelI {
JSONObject createReport(JSONObject jsonObject);
JSONObject createReport(JSONObject jsonObject, List<SysDeviceHeatScene> alternateDeviceList);
}

@ -1,63 +0,0 @@
package com.dky;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.dky.tool.ModelTool;
import com.dky.utils.entity.DevPrice;
import com.dky.utils.entity.DevSpec;
public class Test {
public static void main(String[] args) {
JSONObject list = new JSONObject();
JSONArray devSpecList = new JSONArray();
JSONArray devPriceList = new JSONArray();
DevSpec specObj1 = new DevSpec();
DevSpec specObj2 = new DevSpec();
DevSpec specObj3 = new DevSpec();
specObj1.setId(1L);
specObj1.setTechnologyType("直热式电锅炉");
specObj1.setHeatingArea(1.5);
specObj2.setId(2L);
specObj2.setTechnologyType("直热式电锅炉");
specObj2.setHeatingArea(2.5);
specObj3.setId(3L);
specObj3.setTechnologyType("直热式电锅炉");
specObj3.setHeatingArea(3.0);
devSpecList.add(specObj1);
devSpecList.add(specObj2);
devSpecList.add(specObj3);
list.put("devSpecList",devSpecList);
DevPrice devPrice1 = new DevPrice();
DevPrice devPrice2 = new DevPrice();
DevPrice devPrice3 = new DevPrice();
devPrice1.setId(1);
devPrice1.setDevType("直热式电锅炉");
devPrice1.setDevPrice(0.05);
devPrice2.setId(2);
devPrice2.setDevType("直热式电锅炉");
devPrice2.setDevPrice(0.06);
devPrice3.setId(3);
devPrice3.setDevType("直热式电锅炉");
devPrice3.setDevPrice(0.07);
devPriceList.add(devPrice1);
devPriceList.add(devPrice2);
devPriceList.add(devPrice3);
list.put("devPriceList",devPriceList);
ModelTool modelTool = new ModelTool(list);
JSONObject param = new JSONObject();
param.put("type", "0101");
param.put("exportTemperature", 28);
param.put("hotMedium", "1");
param.put("hotDevicePower", "20.26");
param.put("yearEnergy", "20.26");
param.put("electricityPrice", "20.26");
param.put("originalDevice", new JSONObject()
.put("deviceType", "1")
.put("deviceNum", 2)
.put("deviceEnergyType", "1")
.put("lastYearFee", "76.25"));
String key = "GWnQ4RqqTc8n1Uj59xLoUq0YsJLmzgyVzBvI35uj+DaDjdU0HZoU2fCd33JFsVG+3tWpkuojap/b5eeutSp6d4x4juou3yhCF7yhLBqYs1tdr2DF5QqL8uTsLJuKf1Ys8iufExureFAQw+qjMN+W5UlKE5id39PDi2nsPJGUbwkrvkywf2wqaqwZy+i/QBOl";
JSONObject jsonObject = ModelTool.exeModel2Report(param,key);//exeModel2Report
System.out.println(jsonObject.toString());
}
}

@ -0,0 +1,199 @@
package com.dky.generate;
import cn.hutool.json.JSONObject;
import com.dky.calculate.*;
import com.dky.modelI.DntdModelI;
import com.dky.utils.entity.SysDeviceHeatScene;
import com.dky.utils.result.MatchedDevice;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BuildHeatingScene implements DntdModelI {
DecimalFormat decimalFormat = new DecimalFormat("#.00");
// 首先A=由运行/合同容量折合成kW(x0.9)x85%,
static final Double COEFFICIENT_1 = 0.9;
static final Double COEFFICIENT_2 = 0.85;
@Override
public JSONObject createReport(JSONObject jsonObject,List<SysDeviceHeatScene> alternateDeviceList) {
JSONObject distInfo = new JSONObject();
JSONObject buildInfo = new JSONObject();
JSONObject originalDevInfo = new JSONObject();
try{
distInfo = (JSONObject) jsonObject.get("distInfo");
buildInfo = (JSONObject) jsonObject.get("buildInfo");
originalDevInfo = (JSONObject) jsonObject.get("originalDevInfo");
} catch (Exception e){
e.printStackTrace();
}
// 运行容量
Double runCapacity = Double.parseDouble(distInfo.get("runCapacity").toString());
// 上年最大需量
Double lastYearNeed = Double.parseDouble(distInfo.get("lastYearNeed").toString());
// 建筑面积
Double heatingArea = Double.parseDouble(buildInfo.get("heatingArea").toString());
// 年采暖时间(天)
Integer days = Integer.parseInt(buildInfo.get("days").toString());
// 上年运行费用(万元)
Double lastYearFee = Double.parseDouble(buildInfo.get("lastYearFee").toString());
/*
实际可承载容量A = 运行或合同容量x0.9[将运行容量或合同容量折算成容量]x85%
*/
double A = runCapacity * COEFFICIENT_1 * COEFFICIENT_2;
/*
替代前设备总功率C
*/
Double C = 0.0;
if (originalDevInfo != null) {
// 若存在原设备信息,则获取原设备中设备总功率,累加得出C
} else {
// C=建筑面积(万平方米)x770
C = (heatingArea / 10000) * 770;
}
/*
根据建筑面积计算出不同技术类型下所需要不同功率设备数据
*/
List<List<MatchedDevice>> matchedDeviceGroupList = Scheme.calScheme(heatingArea, alternateDeviceList);
/*
替代后设备总功率C1
*/
double C1 = 0.0;
if (originalDevInfo != null){
//若存在原设备信息,则根据建筑面积计算每个技术类型下需要的不同功率的设备的数量,然后将不同功率及对应的数量进行计算得出总功率C1
C1 = CalC.getC1(matchedDeviceGroupList);
} else {
C1 = C/2.5;
}
/*
改造前最大需量D
*/
double D = lastYearNeed + C;
/*
改造后最大需量D1
*/
double D1 = lastYearNeed + C1;
/*
判断计算占比默认效率0.8成本0.2
*/
double costRatio = 0.2;
double effRatio = 0.8;
try{
double costRatio1 = Double.parseDouble(jsonObject.get("costRatio").toString());
double effRatio1 = Double.parseDouble(jsonObject.get("effRatio").toString());
if(costRatio1 < 1 && costRatio1 + costRatio1 == 1){
costRatio = costRatio1;
effRatio = effRatio1;
}
}catch (Exception e){
e.printStackTrace();
}
List<MatchedDevice> matchedDeviceList ;
Map<String, SchemeRatingRes> listMap ;
/*
根据具体容量与需量判断可使用的技术并计算评分
*/
//计算不同细类下成本最小值与效率最大值
Map<String, Double> maxEffMap = SchemeRating.getMaxEfficiencyGroupByDevSubType(alternateDeviceList);
Map<String, Double> minPrice = SchemeRating.getMinPriceGroupByDevSubType(matchedDeviceGroupList);
String remark = "";
if (D1 < A && A < D) {
// 判断只能用热泵
List<List<MatchedDevice>> heatPumpDevList = new ArrayList<>();
matchedDeviceGroupList.forEach((matchedDevices -> {
MatchedDevice matchedDevice = matchedDevices.get(0);
if (!"供冷/暖电锅炉".equals(matchedDevice.getDeviceHeatScene().getDevSubType())){
heatPumpDevList.add(matchedDevices);
}
}));
listMap = SchemeRating.getOptimalList(heatPumpDevList,costRatio,effRatio,maxEffMap,minPrice);
matchedDeviceList = SchemeRating.getOptimalScheme(listMap);
} else {
// 同时考虑热泵和电锅炉
if ( A < D1){
remark = "本方案存在扩容投资需求,扩容投资不计入初次投资费用";
}
listMap = SchemeRating.getOptimalList(matchedDeviceGroupList,costRatio,effRatio,maxEffMap,minPrice);
matchedDeviceList = SchemeRating.getOptimalScheme(listMap);
}
List<Map<String, Object>> maps = new ArrayList<>();
listMap.forEach((k,v)->{
Map<String, Object> map = new HashMap<>();
map.put("rating", decimalFormat.format(v.getSchemeRating()));
map.put("plan", v.getList());
map.put("planName", v.getPlanName());
maps.add(map);
});
/*
封装返回
*/
JSONObject returnJsonObject = new JSONObject();
Double startCost = 0.0;
Double runCost = 0.0;
Double allCost = 0.0;
Double calculateAnnualCarbon = 0.0;
Double electric = 0.0;
List<HashMap<String,Object>> deviceList = new ArrayList<>();
for (MatchedDevice matchedDevice : matchedDeviceList){
HashMap<String, Object> map = new HashMap<>();
map.put("devSubType",matchedDevice.getDeviceHeatScene().getDevSubType());
map.put("devTechType",matchedDevice.getDeviceHeatScene().getDevTechType());
map.put("devCount",matchedDevice.getCount());
map.put("devPrice",matchedDevice.getDeviceHeatScene().getDevPrice());
deviceList.add(map);
startCost = startCost + (matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getDevPrice());
runCost = runCost + (BuildHeatingModel.getRunCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days, matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost()));
allCost = allCost + (BuildHeatingModel.getYearCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPrice(), matchedDevice.getDeviceHeatScene().getDevServiceLife(), matchedDevice.getDeviceHeatScene().getDevPower(), days, matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost()));
electric = electric + (BuildHeatingModel.getElectric(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days));
calculateAnnualCarbon = calculateAnnualCarbon + (BuildHeatingModel.calculateAnnualCarbonReduction(lastYearFee, matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getLaborCost(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days));
}
//初次投资费用
returnJsonObject.set("startCost", decimalFormat.format(startCost));
// 设备总价
returnJsonObject.set("devCost", decimalFormat.format(startCost));
//年运行费用
returnJsonObject.set("yearRunCost", decimalFormat.format(runCost));
//年总费用
returnJsonObject.set("yearCost", decimalFormat.format(allCost));
//年减碳量
returnJsonObject.set("calculate", decimalFormat.format(calculateAnnualCarbon/1000));
//替代电量
returnJsonObject.set("electric", decimalFormat.format(electric));
//备注
returnJsonObject.set("remark",remark);
//封装需配置设备情况
returnJsonObject.set("deviceList",deviceList);
//封装方案优势
returnJsonObject.set("safety", BuildHeatingAdvantage.safety());
returnJsonObject.set("economy", BuildHeatingAdvantage.economy(startCost, allCost, runCost, lastYearFee));
returnJsonObject.set("intelligence", BuildHeatingAdvantage.intelligence());
returnJsonObject.set("environment", BuildHeatingAdvantage.environment(Double.valueOf(decimalFormat.format(calculateAnnualCarbon))));
//封装方案评分
returnJsonObject.set("matchedDeviceList", maps);
return returnJsonObject;
}
}

@ -1,41 +0,0 @@
package com.dky.generate;
import cn.hutool.json.JSONObject;
import com.dky.calculate.OverCollHeatAll;
import com.dky.entity.Construction;
import com.dky.entity.CoolHeat;
import com.dky.modelI.DntdModelI;
import com.dky.utils.entity.SysCustomerReceiptPower;
public class BuildHeatingSence implements DntdModelI {
@Override
public JSONObject createReport(JSONObject jsonObject) {
//1.运行容量/合同容量折合成kW(x0.9)x85%
Double A = 0.0;
JSONObject jsonObject1 = (JSONObject) jsonObject.get("receiptPower");
SysCustomerReceiptPower receiptPower = jsonObject1.toBean(SysCustomerReceiptPower.class);
if (receiptPower.getContractCapacity()!=null){
A = receiptPower.getContractCapacity()*0.9*0.85;
}else if (receiptPower.getRunCapacity()!=null){
A = receiptPower.getRunCapacity()*0.9*0.85;
}else {
System.out.println("未获取到合同容量或运行容量");
}
//2.冗余容量B=A-上年最大需量
Double B = A-receiptPower.getLastYearNeed();
//3.投入供热设备总功率C
JSONObject jsonReport = new JSONObject();
CoolHeat coolHeat = jsonObject.toBean(CoolHeat.class);
Construction construction = jsonObject.toBean(Construction.class);
OverCollHeatAll overCollHeatAll = new OverCollHeatAll();
overCollHeatAll.investment(construction.getFloor(), coolHeat.getHeatArea(), coolHeat.getDevPrice());
// overCollHeatAll.getRunCost(coolHeat.getOriginalDevice().getQuantity(), coolHeat.getNeedPower(), coolHeat.g)
return null;
}
}

@ -3,29 +3,26 @@ package com.dky.generate;
import cn.hutool.json.JSONObject;
import com.dky.calculate.Advantage;
import com.dky.calculate.Overall;
import com.dky.calculate.RequireDevice;
import com.dky.entity.Heatboiler;
import com.dky.modelI.DntdModelI;
import com.dky.tool.ModelTool;
import com.dky.utils.entity.DevPrice;
import com.dky.utils.entity.DevSpec;
import com.dky.utils.result.MatchedDevice;
import com.dky.utils.result.MatchedDeviceResult;
import com.dky.utils.entity.SysDeviceHeatScene;
import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class HeatBoilerSence implements DntdModelI {
@Override
public JSONObject createReport(JSONObject jsonObject) {
public JSONObject createReport(JSONObject jsonObject, List<SysDeviceHeatScene> alternateDeviceList) {
JSONObject jsonReport = new JSONObject();
Heatboiler heatboiler = jsonObject.toBean(Heatboiler.class);
//生成报告
List<DevSpec> specList = ModelTool.specList;
List<DevPrice> priceList = ModelTool.priceList;
MatchedDeviceResult matchedDeviceResult = RequireDevice.matchDevices(heatboiler.getHotDevicePower(), specList, priceList);
// 生成报告
// List<DevSpec> specList = ModelTool.specList;
// List<DevPrice> priceList = ModelTool.priceList;
// MatchedDeviceResult matchedDeviceResult = RequireDevice.matchDevices(heatboiler.getHotDevicePower(), specList, priceList);
Overall overall = new Overall();
//初次投资费用(万元)
Double firstInvestFee = Math.round(matchedDeviceResult.getTotalPriceInTenThousand()*100.0)/100.0;
// Double firstInvestFee = Math.round(matchedDeviceResult.getTotalPriceInTenThousand()*100.0)/100.0;
//年运行费用(万元)
Double yearRunFee = Math.round(overall.yearRunFee(heatboiler.getYearEnergy(), heatboiler.getElectricityPrice())*100.0)/100.0;
//年总费用(万元)
@ -34,7 +31,7 @@ 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<MatchedDevice> devices = matchedDeviceResult.getMatchedDevices();
// List<MatchedDevice> devices = matchedDeviceResult.getMatchedDevices();
//需配置设备情况
//方案详情
String reportDetail = "用直热式电锅炉替代原设备";
@ -64,8 +61,8 @@ public class HeatBoilerSence implements DntdModelI {
}*/
Advantage advantage = new Advantage();
//总价
String totalPrice = matchedDeviceResult.getTotalPriceInTenThousand()+"万元";
jsonReport.put("firstInvestFee", firstInvestFee);
// String totalPrice = matchedDeviceResult.getTotalPriceInTenThousand()+"万元";
// jsonReport.put("firstInvestFee", firstInvestFee);
jsonReport.put("yearRunFee", yearRunFee);
jsonReport.put("yearTotalFee", yearTotalFee);
jsonReport.put("yearReduceCarbon", yearReduceCarbon);
@ -73,11 +70,11 @@ public class HeatBoilerSence implements DntdModelI {
jsonReport.put("reportDetail", reportDetail);
/*jsonReport.put("deviceType", deviceType);
jsonReport.put("deviceSpec", deviceSpec);*/
jsonReport.put("devices", devices);
// jsonReport.put("devices", devices);
jsonReport.put("unit", unit);
jsonReport.put("totalPrice", totalPrice);
// jsonReport.put("totalPrice", totalPrice);
jsonReport.put("safety", advantage.safety());
jsonReport.put("economy", advantage.economy(firstInvestFee,yearTotalFee,yearRunFee,heatboiler.getOriginalDevice().getLastYearFee()));
// jsonReport.put("economy", advantage.economy(firstInvestFee,yearTotalFee,yearRunFee,heatboiler.getOriginalDevice().getLastYearFee()));
jsonReport.put("intelligence", advantage.intelligence());
jsonReport.put("environment", advantage.environment(yearReduceCarbon));
return jsonReport;

@ -16,7 +16,7 @@ public class SM4Utils {
Security.addProvider(new BouncyCastleProvider());
}
private static final String SM4_KEY = "sm4demo123456789"; // 16 bytes key
private static final String SM4_KEY = "mxhXSDiPYFjYgzRb"; // 16 bytes key
private static final String ALGORITHM = "AES/ECB/PKCS5Padding";
public static String encrypt(Map<String, String> map) throws Exception {
@ -58,7 +58,7 @@ public class SM4Utils {
}
public static void main(String[] args) throws Exception {
Map<String, String> decrypt = decrypt("GWnQ4RqqTc8n1Uj59xLoUq0YsJLmzgyVzBvI35uj+DaDjdU0HZoU2fCd33JFsVG+3tWpkuojap/b5eeutSp6d4x4juou3yhCF7yhLBqYs1tdr2DF5QqL8uTsLJuKf1Ys8iufExureFAQw+qjMN+W5UlKE5id39PDi2nsPJGUbwkrvkywf2wqaqwZy+i/QBOl");
Map<String, String> decrypt = decrypt("GLFIphzZ2SnR6kVx0gz2JBenxKHv3OrkbBPgTEeUcH8dP1vewChAxuWBZI+YsQS3H+Sb5/YEiJ0ub3p0QjXaSgbwTTqD4puEE/UZ7Yd4H8MPXFrtL0VVXoAArSbOj7JH");
System.out.println(decrypt.toString());
}
}

@ -5,32 +5,43 @@ import cn.hutool.json.JSONObject;
import com.dky.modelI.DntdModelI;
import com.dky.security.GetCpuInfo;
import com.dky.utils.ConfigReader;
import com.dky.utils.entity.SysDeviceHeatScene;
import com.dky.utils.enums.Code;
import com.dky.utils.entity.DevSpec;
import com.dky.utils.entity.DevPrice;
import com.dky.utils.result.ResponseUtil;
import org.bouncycastle.math.raw.Mod;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class ModelTool {
public static List<DevSpec> specList = new ArrayList<>();
public static List<DevPrice> priceList = new ArrayList<>();
// 制热锅炉,单功率单价,单位。建缓冲区。List实体。
public ModelTool(JSONObject list) {
public List<SysDeviceHeatScene> specList;
// 私有化构造方法,避免外部实例化
private ModelTool() {
}
public ModelTool(List<SysDeviceHeatScene> specList) {
this.specList = specList;
}
// 创建工具类的静态工厂方法
public static ModelTool create(JSONObject list) {
List<SysDeviceHeatScene> specList = new ArrayList<>();
JSONArray specArray = list.getJSONArray("devSpecList");
for (int i = 0; i < specArray.size(); i++) {
DevSpec devSpec = specArray.getJSONObject(i).toBean(DevSpec.class);
SysDeviceHeatScene devSpec = specArray.getJSONObject(i).toBean(SysDeviceHeatScene.class);
specList.add(devSpec);
}
JSONArray priceArray = list.getJSONArray("devPriceList");
for (int i = 0; i < priceArray.size(); i++) {
DevPrice devPrice = priceArray.getJSONObject(i).toBean(DevPrice.class);
priceList.add(devPrice);
}
return new ModelTool(specList);
}
public static JSONObject exeModel2Report(JSONObject jsonObject, String key) {
public JSONObject exeModel2Report(JSONObject jsonObject, String key) {
JSONObject jsonObjectResult = new JSONObject();
try {
// 根据给定的类名初始化类 加密不需要反实例化new
@ -50,11 +61,11 @@ public class ModelTool {
if (new Date().before(date)){
// 判断模型使用权限
// 根据给定的类名初始化类 加密不需要反实例化new
Class modelI = Class.forName("com.dky"+"."+ ConfigReader.getProperty(jsonObject.getStr("type")));
Class buildHeatingScene = Class.forName("com.dky"+"."+ ConfigReader.getProperty(jsonObject.getStr("type")));
// 实例化这个类
DntdModelI modelI1 = (DntdModelI)modelI.newInstance();
DntdModelI buildHeatingSceneModel = (DntdModelI)buildHeatingScene.newInstance();
// 调用指定方法
jsonObjectResult = modelI1.createReport(jsonObject);
jsonObjectResult = buildHeatingSceneModel.createReport(jsonObject,this.specList);
}else {
jsonObjectResult = ResponseUtil.createResponse(Code.KEY_EXPIRATION.getCode(), Code.KEY_EXPIRATION.getDesc(), null);
}
@ -68,6 +79,7 @@ public class ModelTool {
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
jsonObjectResult = ResponseUtil.createResponse(Code.KEY_CONTEXT_ERROR.getCode(), Code.KEY_CONTEXT_ERROR.getDesc(), null);
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();

@ -1,2 +1,2 @@
0101=generate.HeatBoilerSence
0102=generate.CoolHeatSence
0101=generate.BuildHeatingScene
0102=generate.HeatBoilerSence

@ -1 +1 @@
0101=generate.HeatBoilerSence

@ -14,7 +14,6 @@
<module>dntd-modelI</module>
<module>dntd-common</module>
<module>dntd-model-buildheating</module>
<module>dntd-model-madekiln</module>
</modules>
<properties>

Loading…
Cancel
Save