From 2725199dd2aedbbfd44e6ec7e2fd7463e25c3890 Mon Sep 17 00:00:00 2001 From: XMnhwj_BackTechnologyDevelopment <3512363680@qq.com> Date: Mon, 5 Feb 2024 19:03:10 +0800 Subject: [PATCH] 2024-01-30 18:35:06 --- .../dky/utils/entity/SysDeviceHeatScene.java | 49 +++++- .../com/dky/utils/result/MatchedDevice.java | 10 +- ...ollHeatAll.java => BuildHeatingModel.java} | 19 +-- .../src/main/java/com/dky/calculate/CalC.java | 34 +++- .../src/main/java/com/dky/calculate/CalD.java | 30 ++++ .../main/java/com/dky/calculate/Scheme.java | 60 ++++--- .../java/com/dky/calculate/SchemeRating.java | 93 +++++++++++ .../java/com/dky/entity/Construction.java | 27 ---- .../main/java/com/dky/entity/CoolHeat.java | 147 ------------------ .../java/com/dky/entity/HeatingDevice.java | 8 - .../java/com/dky/entity/OriginalDevice.java | 68 -------- .../java/com/dky/calculate/Advantage.java | 6 +- .../com/dky/calculate/HeatBoilerModel.java | 5 +- .../java/com/dky/entity/HeatboilerSpec.java | 4 +- dntd-model-madekiln/pom.xml | 38 ----- .../main/java/com/dky/calculate/Overall.java | 92 ----------- .../main/java/com/dky/entity/MadeKiln.java | 116 -------------- .../java/com/dky/entity/OriginalDevice.java | 52 ------- dntd-tool/src/main/java/com/dky/Test.java | 63 -------- .../com/dky/generate/BuildHeatingSence.java | 126 +++++++++++---- .../com/dky/generate/HeatBoilerSence.java | 31 ++-- .../main/java/com/dky/security/SM4Utils.java | 2 +- .../src/main/java/com/dky/tool/ModelTool.java | 26 ++-- .../src/main/resources/modelCode.properties | 4 +- doc/modelCode.properties | 2 +- pom.xml | 1 - 26 files changed, 395 insertions(+), 718 deletions(-) rename dntd-model-buildheating/src/main/java/com/dky/calculate/{OverCollHeatAll.java => BuildHeatingModel.java} (82%) create mode 100644 dntd-model-buildheating/src/main/java/com/dky/calculate/CalD.java create mode 100644 dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRating.java delete mode 100644 dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java delete mode 100644 dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java delete mode 100644 dntd-model-buildheating/src/main/java/com/dky/entity/HeatingDevice.java delete mode 100644 dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java delete mode 100644 dntd-model-madekiln/pom.xml delete mode 100644 dntd-model-madekiln/src/main/java/com/dky/calculate/Overall.java delete mode 100644 dntd-model-madekiln/src/main/java/com/dky/entity/MadeKiln.java delete mode 100644 dntd-model-madekiln/src/main/java/com/dky/entity/OriginalDevice.java delete mode 100644 dntd-tool/src/main/java/com/dky/Test.java diff --git a/dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java b/dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java index 5d054de..e324aa6 100644 --- a/dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java +++ b/dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java @@ -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,45 @@ 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 + '\'' + + ", devSubType='" + devSubType + '\'' + + ", devTechType='" + devTechType + '\'' + + ", heatEfficiency=" + heatEfficiency + + ", devPower=" + devPower + + ", devPrice=" + devPrice + + ", devSubstituteLaborCost=" + devSubstituteLaborCost + + ", devReferenceArea=" + devReferenceArea + + ", devServiceLife=" + devServiceLife + + '}'; + } + public String getId() { return id; } @@ -58,11 +99,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; } diff --git a/dntd-common/src/main/java/com/dky/utils/result/MatchedDevice.java b/dntd-common/src/main/java/com/dky/utils/result/MatchedDevice.java index 067cc10..8be5346 100644 --- a/dntd-common/src/main/java/com/dky/utils/result/MatchedDevice.java +++ b/dntd-common/src/main/java/com/dky/utils/result/MatchedDevice.java @@ -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; } diff --git a/dntd-model-buildheating/src/main/java/com/dky/calculate/OverCollHeatAll.java b/dntd-model-buildheating/src/main/java/com/dky/calculate/BuildHeatingModel.java similarity index 82% rename from dntd-model-buildheating/src/main/java/com/dky/calculate/OverCollHeatAll.java rename to dntd-model-buildheating/src/main/java/com/dky/calculate/BuildHeatingModel.java index 5c618c7..ac3e06d 100644 --- a/dntd-model-buildheating/src/main/java/com/dky/calculate/OverCollHeatAll.java +++ b/dntd-model-buildheating/src/main/java/com/dky/calculate/BuildHeatingModel.java @@ -1,7 +1,7 @@ package com.dky.calculate; -public class OverCollHeatAll { +public class BuildHeatingModel { /** @@ -26,11 +26,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 * deviceNum); } /** @@ -43,26 +43,26 @@ 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 * deviceNum);; return ((deviceNum * devicePrice) / useYears) + run; } /** * 年减碳 - * @param lastYearFee 上年运行费用(万元) - * @param oldDaborCost 原设备的人工费用(万元) + * @param lastYearFee 上年运行费用 + * @param oldDaborCost 原设备的人工费用 * @param deviceNum 电锅炉设备台数 * @param devicePower 单台电锅炉的功率 * @param days 年采暖(供冷)时间(天) * @return */ - public Double calculateAnnualCarbonReduction(Double lastYearFee, + public static Double calculateAnnualCarbonReduction(Double lastYearFee, Double oldDaborCost, Integer deviceNum, Double devicePower, @@ -72,6 +72,7 @@ public class OverCollHeatAll { return (d1 - (d2 * 0.1229)) * 1.9003; } + /** * 替代电量(千瓦时) * @param deviceNum 电锅炉设备台数 @@ -79,7 +80,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 ; diff --git a/dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java b/dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java index 242feea..e5d2500 100644 --- a/dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java +++ b/dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java @@ -1,13 +1,41 @@ 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 matchedDevices,Double buildArea) { - return floor * heatArea * devPrice; + public static List> getC(List>>> list) { + List> 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 map = new HashMap<>(); + map.put(k, maxPower[0]); + maps.add(map); + }); + }); + return maps; } + + + + } diff --git a/dntd-model-buildheating/src/main/java/com/dky/calculate/CalD.java b/dntd-model-buildheating/src/main/java/com/dky/calculate/CalD.java new file mode 100644 index 0000000..7c339a0 --- /dev/null +++ b/dntd-model-buildheating/src/main/java/com/dky/calculate/CalD.java @@ -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 getD(Double lastYearNeed, List> list) { + List maps = new ArrayList<>(); + list.parallelStream().forEach((s)->{ + Map map = new HashMap<>(); + s.forEach((k,v)->{ + map.put(k, lastYearNeed + v); + maps.add(map); + }); + }); + return maps; + } + + + +} diff --git a/dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java b/dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java index 7e30c6c..b2bac5c 100644 --- a/dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java +++ b/dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java @@ -1,35 +1,59 @@ package com.dky.calculate; + import com.dky.utils.entity.SysDeviceHeatScene; import com.dky.utils.result.MatchedDevice; + import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; public class Scheme { - public List calSchemeByTechType(Double buildArea, List deviceList, String techType){ + public static List>>> calScheme(Double buildArea, List list) { + // 区分电锅炉、热泵 + Map> grouped = list.stream() + .collect(Collectors.groupingBy(SysDeviceHeatScene::getDevSubType)); + List>>> maps = new ArrayList<>(); + // 区分技术类型 + grouped.forEach((k, v) -> { + Map>> map = new HashMap<>(); + List> planList = new ArrayList<>(); + Map> collect = v.stream().collect(Collectors.groupingBy(SysDeviceHeatScene::getDevTechType)); + collect.forEach((k2, v2) -> { + List matchedDevices = calSchemeByTechType(buildArea, v2); + planList.add(matchedDevices); + }); + map.put(k, planList); + maps.add(map); + }); + return maps; + } - List 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())); + public static List calSchemeByTechType(Double buildArea, List list) { + // 对List按照单台设备可参考供暖面积进行排序 + list.sort((o1, o2) -> Double.compare(o2.getDevReferenceArea(), o1.getDevReferenceArea())); Double remainArea = buildArea; - //遍历设备,根据建筑面积进行匹配设备数量 - List 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 matchedDeviceList = new ArrayList<>(); + for (SysDeviceHeatScene deviceHeatScene : list) { + double v = remainArea / deviceHeatScene.getDevReferenceArea(); + int count = (int) (v); + if (v < 1){ + count = count + 1; } - if (remainArea <= 0) { - break; // 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备 + remainArea = remainArea - count * deviceHeatScene.getDevReferenceArea(); + matchedDeviceList.add(new MatchedDevice(count, deviceHeatScene)); + if (remainArea <= 0){ + // 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备 + break; } } return matchedDeviceList; } + + + } diff --git a/dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRating.java b/dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRating.java new file mode 100644 index 0000000..a657aad --- /dev/null +++ b/dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRating.java @@ -0,0 +1,93 @@ +package com.dky.calculate; + + +import com.dky.utils.result.MatchedDevice; + +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; + +public class SchemeRating { + + + public static Map> getOptimalList(List>>> list) { + Map> optimalMap = new HashMap<>(); + list.parallelStream().forEach(stringListMap -> { + // 区分热泵、电锅炉 + stringListMap.forEach((k,v)->{ + // 循环遍历各个方案 + v.parallelStream().forEach((plan)->{ + AtomicReference rating = new AtomicReference<>(0.0); + List> maps = getIndex(list); + for (Map map : maps) { + map.forEach((k1, v1) -> { + if (k1.equals(k)){ + 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()); + } + rating.set(((1 - ((v1[0] - eff) / v1[0])) * 100 * 0.8) + ((1 - ((cost - v1[1]) / v1[1])) * 100 * 0.2)); + System.out.println("方案: " + plan + ",评分 = " + rating + "\n"); + + optimalMap.put(rating.get(), plan); + } + }); + } + }); + }); + }); + return optimalMap; + } + + public static List getOptimalScheme(Map> map) { + Set keySet = map.keySet(); + Double maxValue = keySet.iterator().next(); + for (Iterator iterator = keySet.iterator(); iterator.hasNext(); ) { + Double value = iterator.next(); + if (value > maxValue) { + maxValue = value; + } + } + return map.get(maxValue); + } + + public static List> getIndex(List>>> list) { + List> maps = new ArrayList<>(); + list.parallelStream().forEach(stringListMap -> { + // 区分热泵、电锅炉 + stringListMap.forEach((k, v) -> { + // 循环遍历各个方案 + // 热效率、成本 + final Double[] index = {0.0, Double.MAX_VALUE}; + v.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 map = new HashMap<>(); + map.put(k, index); + maps.add(map); + }); + }); + + return maps; + } + + + + +} diff --git a/dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java b/dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java deleted file mode 100644 index 747e4f6..0000000 --- a/dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java b/dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java deleted file mode 100644 index 8590c5c..0000000 --- a/dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-model-buildheating/src/main/java/com/dky/entity/HeatingDevice.java b/dntd-model-buildheating/src/main/java/com/dky/entity/HeatingDevice.java deleted file mode 100644 index 13fca61..0000000 --- a/dntd-model-buildheating/src/main/java/com/dky/entity/HeatingDevice.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.dky.entity; - -public class HeatingDevice { - - //id - private String id; - // -} diff --git a/dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java b/dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java deleted file mode 100644 index 57ca7c2..0000000 --- a/dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java +++ /dev/null @@ -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; - } -} 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 6db79ba..8f5021f 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 @@ -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 + "吨"; } } diff --git a/dntd-model-heatboiler/src/main/java/com/dky/calculate/HeatBoilerModel.java b/dntd-model-heatboiler/src/main/java/com/dky/calculate/HeatBoilerModel.java index 595cc0b..f29617b 100644 --- a/dntd-model-heatboiler/src/main/java/com/dky/calculate/HeatBoilerModel.java +++ b/dntd-model-heatboiler/src/main/java/com/dky/calculate/HeatBoilerModel.java @@ -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) { //(电替代设备台数*单台电设备价格)/电替代设备的使用年限+年运行费用 - return (count * heatboilerSpec.getDevModel()) / heatboilerSpec.getServiceLife() + calculateAnnualOperatingCost( heatboilerSpec, heatboiler , originalDevice,count); + return (count * 1) / heatboilerSpec.getServiceLife() + calculateAnnualOperatingCost( heatboilerSpec, heatboiler , originalDevice,count); } /** diff --git a/dntd-model-heatboiler/src/main/java/com/dky/entity/HeatboilerSpec.java b/dntd-model-heatboiler/src/main/java/com/dky/entity/HeatboilerSpec.java index b299978..f104756 100644 --- a/dntd-model-heatboiler/src/main/java/com/dky/entity/HeatboilerSpec.java +++ b/dntd-model-heatboiler/src/main/java/com/dky/entity/HeatboilerSpec.java @@ -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; // 电替代设备人工费用 diff --git a/dntd-model-madekiln/pom.xml b/dntd-model-madekiln/pom.xml deleted file mode 100644 index 0195baf..0000000 --- a/dntd-model-madekiln/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - dntd-model-tools - com.dky - 1.0-SNAPSHOT - - 4.0.0 - - dntd-model-madekiln - - - 8 - 8 - UTF-8 - - - - - cn.hutool - hutool-all - 5.4.5 - - - com.dky - dntd-modelI - 1.0-SNAPSHOT - - - com.dky - dntd-common - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/dntd-model-madekiln/src/main/java/com/dky/calculate/Overall.java b/dntd-model-madekiln/src/main/java/com/dky/calculate/Overall.java deleted file mode 100644 index fc603eb..0000000 --- a/dntd-model-madekiln/src/main/java/com/dky/calculate/Overall.java +++ /dev/null @@ -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 ; - } -} diff --git a/dntd-model-madekiln/src/main/java/com/dky/entity/MadeKiln.java b/dntd-model-madekiln/src/main/java/com/dky/entity/MadeKiln.java deleted file mode 100644 index d2dbc1d..0000000 --- a/dntd-model-madekiln/src/main/java/com/dky/entity/MadeKiln.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-model-madekiln/src/main/java/com/dky/entity/OriginalDevice.java b/dntd-model-madekiln/src/main/java/com/dky/entity/OriginalDevice.java deleted file mode 100644 index b60a47e..0000000 --- a/dntd-model-madekiln/src/main/java/com/dky/entity/OriginalDevice.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-tool/src/main/java/com/dky/Test.java b/dntd-tool/src/main/java/com/dky/Test.java deleted file mode 100644 index c305de6..0000000 --- a/dntd-tool/src/main/java/com/dky/Test.java +++ /dev/null @@ -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()); - } -} diff --git a/dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java b/dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java index b505a3e..a2427fe 100644 --- a/dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java +++ b/dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java @@ -2,40 +2,108 @@ 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.calculate.*; import com.dky.modelI.DntdModelI; -import com.dky.utils.entity.SysCustomerReceiptPower; +import com.dky.tool.ModelTool; +import com.dky.utils.entity.SysDeviceHeatScene; +import com.dky.utils.result.MatchedDevice; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; public class BuildHeatingSence implements DntdModelI { + DecimalFormat decimalFormat = new DecimalFormat("#.00"); + @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("未获取到合同容量或运行容量"); + public JSONObject createReport(JSONObject jsonObject2) { + List list = ModelTool.specList; + JSONObject distInfo = (JSONObject) jsonObject2.get("distInfo"); + JSONObject buildInfo = (JSONObject) jsonObject2.get("buildInfo"); + // 运行容量 + Double runCapacity = (Double) distInfo.get("runCapacity"); + // 上年最大需量 + Double lastYearNeed = (Double) distInfo.get("lastYearNeed"); + // 建筑面积 + Double heatingArea = (Double) buildInfo.get("heatingArea"); + // 年采暖时间(天) + Integer days = (Integer) buildInfo.get("days"); + // 上年运行费用(万元) + Double lastYearFee = (Double) buildInfo.get("lastYearFee"); + + Double A = runCapacity * 0.9 * 0.85; + // 冗余容量 + Double B = A - lastYearNeed; + AtomicReference C = new AtomicReference<>(); + AtomicReference C1 = new AtomicReference<>(); + List>>> calScheme = Scheme.calScheme(heatingArea, list); + List> mapsC = CalC.getC(calScheme); + for (Map map : mapsC) { + map.forEach((k, v) -> { + if (k.contains("电锅炉")) { + C.set(v); + } else { + C1.set(v); + } + }); } - //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; - } + Double D = lastYearNeed + C.get(); + Double D1 = lastYearNeed + C1.get(); + List matchedDeviceList = new ArrayList<>(); + // 判断只能用热泵 + if (D1 < A && A < D) { + List deviceList = new ArrayList<>(); + list.parallelStream().forEach((sysDeviceHeatScene -> { + if (!sysDeviceHeatScene.getDevTechType().contains("电锅炉")) { + deviceList.add(sysDeviceHeatScene); + } + })); + matchedDeviceList = SchemeRating.getOptimalScheme(SchemeRating.getOptimalList(Scheme.calScheme(heatingArea, deviceList))); + } else { + matchedDeviceList = SchemeRating.getOptimalScheme(SchemeRating.getOptimalList(calScheme)); + } + + JSONObject jsonObject = new JSONObject(); + AtomicReference planInfos = new AtomicReference<>(); + AtomicReference devTechType = new AtomicReference<>(); + AtomicReference devSubType = new AtomicReference<>(); + AtomicReference devCount = new AtomicReference<>(); + AtomicReference devPrice = new AtomicReference<>(); + AtomicReference startCost = new AtomicReference<>(0.0); + AtomicReference runCost = new AtomicReference<>(0.0); + AtomicReference allCost = new AtomicReference<>(0.0); + AtomicReference calculateAnnualCarbon = new AtomicReference<>(0.0); + AtomicReference electric = new AtomicReference<>(0.0); + matchedDeviceList.parallelStream().forEach((matchedDevice -> { + planInfos.set(planInfos.get() + "设备: " + matchedDevice.getDeviceHeatScene().getDevType() + ",技术: " + matchedDevice.getDeviceHeatScene().getDevTechType() + ",数量 = " + matchedDevice.getCount() + "。"); + devTechType.set(devTechType.get() + "设备: " + matchedDevice.getDeviceHeatScene().getDevType() + ",技术: " + matchedDevice.getDeviceHeatScene().getDevTechType() + "。"); + devSubType.set(devSubType.get() + "设备: " + matchedDevice.getDeviceHeatScene().getDevType() + ",设备细类: " + matchedDevice.getDeviceHeatScene().getDevSubType() + "。"); + devCount.set(devCount.get() + "设备: " + matchedDevice.getDeviceHeatScene().getDevType() + ",数量 = " + matchedDevice.getCount() + "。"); + devPrice.set(devPrice.get() + "设备: " + matchedDevice.getDeviceHeatScene().getDevType() + ",单价 = " + matchedDevice.getDeviceHeatScene().getDevPrice() + "。"); + startCost.set(startCost.get() + (matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getDevPrice())); + runCost.set(runCost.get() + (BuildHeatingModel.getRunCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days, matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost()))); + allCost.set(allCost.get() + (BuildHeatingModel.getYearCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPrice(), matchedDevice.getDeviceHeatScene().getDevServiceLife(), matchedDevice.getDeviceHeatScene().getDevPower(), days, matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost()))); + calculateAnnualCarbon.set(calculateAnnualCarbon.get() + (BuildHeatingModel.calculateAnnualCarbonReduction(lastYearFee, matchedDevice.getDeviceHeatScene().getLaborCost(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days))); + electric.set(electric.get() + (BuildHeatingModel.getElectric(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days))); + })); + jsonObject.put("startCost", decimalFormat.format(startCost.get())); + jsonObject.put("yearRunCost", decimalFormat.format(runCost.get())); + jsonObject.put("yearCost", decimalFormat.format(allCost.get())); + jsonObject.put("calculate", decimalFormat.format(calculateAnnualCarbon.get())); + jsonObject.put("electric", decimalFormat.format(electric.get())); + jsonObject.put("planInfos", planInfos.get().replace("null","")); + jsonObject.put("devTechType", devTechType.get().replace("null","")); + jsonObject.put("devSubType", devSubType.get().replace("null","")); + jsonObject.put("devCount", devCount.get().replace("null","")); + jsonObject.put("devPrice", devPrice.get().replace("null","")); + jsonObject.put("devCost", decimalFormat.format(startCost.get())); + jsonObject.put("economy", Advantage.economy(startCost.get(), allCost.get(), runCost.get(), lastYearFee)); + jsonObject.put("intelligence", Advantage.intelligence()); + jsonObject.put("environment", Advantage.environment(Double.valueOf(decimalFormat.format(calculateAnnualCarbon.get())))); + return jsonObject; + } } 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 5202043..ab8ae67 100644 --- a/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java +++ b/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java @@ -3,29 +3,24 @@ 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 java.util.*; +import java.util.HashSet; +import java.util.Set; public class HeatBoilerSence implements DntdModelI { @Override public JSONObject createReport(JSONObject jsonObject) { JSONObject jsonReport = new JSONObject(); Heatboiler heatboiler = jsonObject.toBean(Heatboiler.class); - //生成报告 - List specList = ModelTool.specList; - List priceList = ModelTool.priceList; - MatchedDeviceResult matchedDeviceResult = RequireDevice.matchDevices(heatboiler.getHotDevicePower(), specList, priceList); + // 生成报告 + // List specList = ModelTool.specList; + // List 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 +29,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 devices = matchedDeviceResult.getMatchedDevices(); + // List devices = matchedDeviceResult.getMatchedDevices(); //需配置设备情况 //方案详情 String reportDetail = "用直热式电锅炉替代原设备"; @@ -64,8 +59,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 +68,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; 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 36f0cac..4780630 100644 --- a/dntd-tool/src/main/java/com/dky/security/SM4Utils.java +++ b/dntd-tool/src/main/java/com/dky/security/SM4Utils.java @@ -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 map) throws Exception { diff --git a/dntd-tool/src/main/java/com/dky/tool/ModelTool.java b/dntd-tool/src/main/java/com/dky/tool/ModelTool.java index c5c839b..7bf67cc 100644 --- a/dntd-tool/src/main/java/com/dky/tool/ModelTool.java +++ b/dntd-tool/src/main/java/com/dky/tool/ModelTool.java @@ -5,30 +5,34 @@ 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 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 specList = new ArrayList<>(); - public static List priceList = new ArrayList<>(); + + public static List specList = new ArrayList<>(); +// public static List priceList = new ArrayList<>(); // 制热锅炉,单功率单价,单位。建缓冲区。List实体。 public ModelTool(JSONObject list) { 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); - } +// JSONArray priceArray = list.getJSONArray("devPriceList"); +// for (int i = 0; i < priceArray.size(); i++) { +// DevPrice devPrice = priceArray.getJSONObject(i).toBean(DevPrice.class); +// priceList.add(devPrice); +// } } public static JSONObject exeModel2Report(JSONObject jsonObject, String key) { JSONObject jsonObjectResult = new JSONObject(); diff --git a/dntd-tool/src/main/resources/modelCode.properties b/dntd-tool/src/main/resources/modelCode.properties index 39fd7ab..dce7ac9 100644 --- a/dntd-tool/src/main/resources/modelCode.properties +++ b/dntd-tool/src/main/resources/modelCode.properties @@ -1,2 +1,2 @@ -0101=generate.HeatBoilerSence -0102=generate.CoolHeatSence +0101=generate.BuildHeatingSence +0102=generate.HeatBoilerSence \ No newline at end of file diff --git a/doc/modelCode.properties b/doc/modelCode.properties index 25eebae..8b13789 100644 --- a/doc/modelCode.properties +++ b/doc/modelCode.properties @@ -1 +1 @@ -0101=generate.HeatBoilerSence + diff --git a/pom.xml b/pom.xml index 3c2f9fd..b73797e 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,6 @@ dntd-modelI dntd-common dntd-model-buildheating - dntd-model-madekiln