2024-01-30 18:35:06

master
魔神煜修罗皇 1 year ago
parent e6c3164bb0
commit 2725199dd2
  1. 49
      dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java
  2. 10
      dntd-common/src/main/java/com/dky/utils/result/MatchedDevice.java
  3. 19
      dntd-model-buildheating/src/main/java/com/dky/calculate/BuildHeatingModel.java
  4. 34
      dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java
  5. 30
      dntd-model-buildheating/src/main/java/com/dky/calculate/CalD.java
  6. 60
      dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java
  7. 93
      dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRating.java
  8. 27
      dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java
  9. 147
      dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java
  10. 8
      dntd-model-buildheating/src/main/java/com/dky/entity/HeatingDevice.java
  11. 68
      dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java
  12. 6
      dntd-model-heatboiler/src/main/java/com/dky/calculate/Advantage.java
  13. 5
      dntd-model-heatboiler/src/main/java/com/dky/calculate/HeatBoilerModel.java
  14. 4
      dntd-model-heatboiler/src/main/java/com/dky/entity/HeatboilerSpec.java
  15. 38
      dntd-model-madekiln/pom.xml
  16. 92
      dntd-model-madekiln/src/main/java/com/dky/calculate/Overall.java
  17. 116
      dntd-model-madekiln/src/main/java/com/dky/entity/MadeKiln.java
  18. 52
      dntd-model-madekiln/src/main/java/com/dky/entity/OriginalDevice.java
  19. 63
      dntd-tool/src/main/java/com/dky/Test.java
  20. 126
      dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java
  21. 31
      dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java
  22. 2
      dntd-tool/src/main/java/com/dky/security/SM4Utils.java
  23. 26
      dntd-tool/src/main/java/com/dky/tool/ModelTool.java
  24. 4
      dntd-tool/src/main/resources/modelCode.properties
  25. 2
      doc/modelCode.properties
  26. 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,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;
}

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

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

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

@ -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,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<MatchedDevice> calSchemeByTechType(Double buildArea, List<SysDeviceHeatScene> deviceList, String techType){
public static List<Map<String, List<List<MatchedDevice>>>> calScheme(Double buildArea, List<SysDeviceHeatScene> list) {
// 区分电锅炉、热泵
Map<String, List<SysDeviceHeatScene>> grouped = list.stream()
.collect(Collectors.groupingBy(SysDeviceHeatScene::getDevSubType));
List<Map<String, List<List<MatchedDevice>>>> maps = new ArrayList<>();
// 区分技术类型
grouped.forEach((k, v) -> {
Map<String, List<List<MatchedDevice>>> map = new HashMap<>();
List<List<MatchedDevice>> planList = new ArrayList<>();
Map<String, List<SysDeviceHeatScene>> collect = v.stream().collect(Collectors.groupingBy(SysDeviceHeatScene::getDevTechType));
collect.forEach((k2, v2) -> {
List<MatchedDevice> matchedDevices = calSchemeByTechType(buildArea, v2);
planList.add(matchedDevices);
});
map.put(k, planList);
maps.add(map);
});
return maps;
}
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()));
public static List<MatchedDevice> calSchemeByTechType(Double buildArea, List<SysDeviceHeatScene> list) {
// 对List按照单台设备可参考供暖面积进行排序
list.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 : 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;
}
}

@ -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<Double, List<MatchedDevice>> getOptimalList(List<Map<String, List<List<MatchedDevice>>>> list) {
Map<Double, List<MatchedDevice>> optimalMap = new HashMap<>();
list.parallelStream().forEach(stringListMap -> {
// 区分热泵、电锅炉
stringListMap.forEach((k,v)->{
// 循环遍历各个方案
v.parallelStream().forEach((plan)->{
AtomicReference<Double> rating = new AtomicReference<>(0.0);
List<Map<String, Double[]>> maps = getIndex(list);
for (Map<String, Double[]> 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<MatchedDevice> getOptimalScheme(Map<Double, List<MatchedDevice>> map) {
Set<Double> keySet = map.keySet();
Double maxValue = keySet.iterator().next();
for (Iterator<Double> iterator = keySet.iterator(); iterator.hasNext(); ) {
Double value = iterator.next();
if (value > maxValue) {
maxValue = value;
}
}
return map.get(maxValue);
}
public static List<Map<String, Double[]>> getIndex(List<Map<String, List<List<MatchedDevice>>>> list) {
List<Map<String, Double[]>> 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<String, Double[]> map = new HashMap<>();
map.put(k, index);
maps.add(map);
});
});
return maps;
}
}

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

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

@ -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<SysDeviceHeatScene> 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<Double> C = new AtomicReference<>();
AtomicReference<Double> C1 = new AtomicReference<>();
List<Map<String, List<List<MatchedDevice>>>> calScheme = Scheme.calScheme(heatingArea, list);
List<Map<String, Double>> mapsC = CalC.getC(calScheme);
for (Map<String, Double> 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<MatchedDevice> matchedDeviceList = new ArrayList<>();
// 判断只能用热泵
if (D1 < A && A < D) {
List<SysDeviceHeatScene> 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<String> planInfos = new AtomicReference<>();
AtomicReference<String> devTechType = new AtomicReference<>();
AtomicReference<String> devSubType = new AtomicReference<>();
AtomicReference<String> devCount = new AtomicReference<>();
AtomicReference<String> devPrice = new AtomicReference<>();
AtomicReference<Double> startCost = new AtomicReference<>(0.0);
AtomicReference<Double> runCost = new AtomicReference<>(0.0);
AtomicReference<Double> allCost = new AtomicReference<>(0.0);
AtomicReference<Double> calculateAnnualCarbon = new AtomicReference<>(0.0);
AtomicReference<Double> 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;
}
}

@ -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<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 +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<MatchedDevice> devices = matchedDeviceResult.getMatchedDevices();
// List<MatchedDevice> 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;

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

@ -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<DevSpec> specList = new ArrayList<>();
public static List<DevPrice> priceList = new ArrayList<>();
public static List<SysDeviceHeatScene> specList = new ArrayList<>();
// public static List<DevPrice> 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();

@ -1,2 +1,2 @@
0101=generate.HeatBoilerSence
0102=generate.CoolHeatSence
0101=generate.BuildHeatingSence
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