hwj_lyq 1 year ago
parent 7fab05a1f9
commit 338a8fbef0
  1. 78
      dntd-common/src/main/java/com/dky/utils/entity/DevPrice.java
  2. 79
      dntd-common/src/main/java/com/dky/utils/entity/DevSpec.java
  3. 45
      dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptBuildInfomation.java
  4. 64
      dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptPower.java
  5. 124
      dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java
  6. 25
      dntd-common/src/main/java/com/dky/utils/result/MatchedDevice.java
  7. 2
      dntd-model-buildheating/pom.xml
  8. 13
      dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java
  9. 0
      dntd-model-buildheating/src/main/java/com/dky/calculate/OverCollHeatAll.java
  10. 35
      dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java
  11. 0
      dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java
  12. 0
      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. 0
      dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java
  15. 61
      dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java
  16. 2
      dntd-tool/pom.xml
  17. 41
      dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java
  18. 26
      dntd-tool/src/main/java/com/dky/generate/CoolHeatSence.java
  19. 2
      dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java
  20. 1
      dntd-tool/src/main/resources/modelCode.properties
  21. 2
      pom.xml

@ -1,78 +0,0 @@
package com.dky.utils.entity;
public class DevPrice {
private Integer id;
private String devType;
private Double devPrice;
private String priceUnit;
private Double unitVal;
private String unitUnit;
private String heatRange;
private String remark;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDevType() {
return devType;
}
public void setDevType(String devType) {
this.devType = devType;
}
public Double getDevPrice() {
return devPrice;
}
public void setDevPrice(Double devPrice) {
this.devPrice = devPrice;
}
public String getPriceUnit() {
return priceUnit;
}
public void setPriceUnit(String priceUnit) {
this.priceUnit = priceUnit;
}
public Double getUnitVal() {
return unitVal;
}
public void setUnitVal(Double unitVal) {
this.unitVal = unitVal;
}
public String getUnitUnit() {
return unitUnit;
}
public void setUnitUnit(String unitUnit) {
this.unitUnit = unitUnit;
}
public String getHeatRange() {
return heatRange;
}
public void setHeatRange(String heatRange) {
this.heatRange = heatRange;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

@ -1,79 +0,0 @@
package com.dky.utils.entity;
import cn.hutool.json.JSONObject;
public class DevSpec {
//id
private Integer id;
//设备类型
private String devType;
//设备价格
private Double devModel;
//单位
private Double capacity;
//单元单位
private String output;
//制热范围
private String voltage;
//备注
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDevType() {
return devType;
}
public void setDevType(String devType) {
this.devType = devType;
}
public Double getDevModel() {
return devModel;
}
public void setDevModel(Double devModel) {
this.devModel = devModel;
}
public Double getCapacity() {
return capacity;
}
public void setCapacity(Double capacity) {
this.capacity = capacity;
}
public String getOutput() {
return output;
}
public void setOutput(String output) {
this.output = output;
}
public String getVoltage() {
return voltage;
}
public void setVoltage(String voltage) {
this.voltage = voltage;
}
@Override
public String toString() {
return "DevSpec{" +
"id=" + id +
", devType='" + devType + '\'' +
", devModel=" + devModel +
", capacity=" + capacity +
", output='" + output + '\'' +
", voltage='" + voltage + '\'' +
'}';
}
}

@ -0,0 +1,45 @@
package com.dky.utils.entity;
public class SysCustomerReceiptBuildInfomation {
//工业收资ID
private String id;
//客户ID
private String customerId;
//建筑类型
private String buildType;
//建筑面积
private Double buildArea;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getBuildType() {
return buildType;
}
public void setBuildType(String buildType) {
this.buildType = buildType;
}
public Double getBuildArea() {
return buildArea;
}
public void setBuildArea(Double buildArea) {
this.buildArea = buildArea;
}
}

@ -0,0 +1,64 @@
package com.dky.utils.entity;
public class SysCustomerReceiptPower {
//id
private String id;
//客户id
private String customerId;
//电源形式(1.转变 2.公变)
private String powerType;
//合同容量(千伏安)
private Double contractCapacity;
//运行容量(千伏安)
private Double runCapacity;
//上年最大需量(千瓦)
private Double lastYearNeed;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getPowerType() {
return powerType;
}
public void setPowerType(String powerType) {
this.powerType = powerType;
}
public Double getContractCapacity() {
return contractCapacity;
}
public void setContractCapacity(Double contractCapacity) {
this.contractCapacity = contractCapacity;
}
public Double getRunCapacity() {
return runCapacity;
}
public void setRunCapacity(Double runCapacity) {
this.runCapacity = runCapacity;
}
public Double getLastYearNeed() {
return lastYearNeed;
}
public void setLastYearNeed(Double lastYearNeed) {
this.lastYearNeed = lastYearNeed;
}
}

@ -0,0 +1,124 @@
package com.dky.utils.entity;
public class SysDeviceHeatScene {
//设备id
private String id;
//设备类型
private String devType;
//设备细类
private String devSubType;
//技术类型
private String devTechType;
//热效率
private Integer heatEfficiency;
//设备功率
private Double devPower;
//设备单价
private Double devPrice;
//电替代设备年人工费用
private Double devSubstituteLaborCost;
//单台设备可参考供暖面积
private Double devReferenceArea;
//设备使用年限
private Integer devServiceLife;
//设备年运行时长
private Integer devAnnualOperationTime;
//备注
private String remark;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDevType() {
return devType;
}
public void setDevType(String devType) {
this.devType = devType;
}
public String getDevSubType() {
return devSubType;
}
public void setDevSubType(String devSubType) {
this.devSubType = devSubType;
}
public String getDevTechType() {
return devTechType;
}
public void setDevTechType(String devTechType) {
this.devTechType = devTechType;
}
public Integer getHeatEfficiency() {
return heatEfficiency;
}
public void setHeatEfficiency(Integer heatEfficiency) {
this.heatEfficiency = heatEfficiency;
}
public Double getDevPower() {
return devPower;
}
public void setDevPower(Double devPower) {
this.devPower = devPower;
}
public Double getDevPrice() {
return devPrice;
}
public void setDevPrice(Double devPrice) {
this.devPrice = devPrice;
}
public Double getDevSubstituteLaborCost() {
return devSubstituteLaborCost;
}
public void setDevSubstituteLaborCost(Double devSubstituteLaborCost) {
this.devSubstituteLaborCost = devSubstituteLaborCost;
}
public Double getDevReferenceArea() {
return devReferenceArea;
}
public void setDevReferenceArea(Double devReferenceArea) {
this.devReferenceArea = devReferenceArea;
}
public Integer getDevServiceLife() {
return devServiceLife;
}
public void setDevServiceLife(Integer devServiceLife) {
this.devServiceLife = devServiceLife;
}
public Integer getDevAnnualOperationTime() {
return devAnnualOperationTime;
}
public void setDevAnnualOperationTime(Integer devAnnualOperationTime) {
this.devAnnualOperationTime = devAnnualOperationTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

@ -1,22 +1,23 @@
package com.dky.utils.result;
import com.dky.utils.entity.DevSpec;
import com.dky.utils.entity.SysDeviceHeatScene;
public class MatchedDevice {
private DevSpec devSpec;
private SysDeviceHeatScene deviceHeatScene;
private int count; // 匹配的设备数量
public MatchedDevice(DevSpec devSpec, int count) {
this.devSpec = devSpec;
public MatchedDevice(SysDeviceHeatScene deviceHeatScene, int count) {
this.deviceHeatScene = deviceHeatScene;
this.count = count;
}
public DevSpec getDevSpec() {
return devSpec;
public SysDeviceHeatScene getDeviceHeatScene() {
return deviceHeatScene;
}
public void setDevSpec(DevSpec devSpec) {
this.devSpec = devSpec;
public void setDeviceHeatScene(SysDeviceHeatScene deviceHeatScene) {
this.deviceHeatScene = deviceHeatScene;
}
public int getCount() {
@ -26,12 +27,4 @@ public class MatchedDevice {
public void setCount(int count) {
this.count = count;
}
@Override
public String toString() {
return "MatchedDevice{" +
"devSpec=" + devSpec +
", count=" + count +
'}';
}
}

@ -9,7 +9,7 @@
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>dntd-model-coolheat</artifactId>
<artifactId>dntd-model-buildheating</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>

@ -0,0 +1,13 @@
package com.dky.calculate;
import com.dky.utils.result.MatchedDevice;
import java.util.List;
public class CalC {
//投入供热设备总功率计算
public double calTotalPower(List<MatchedDevice> matchedDevices,Double buildArea) {
return floor * heatArea * devPrice;
}
}

@ -0,0 +1,35 @@
package com.dky.calculate;
import com.dky.utils.entity.SysDeviceHeatScene;
import com.dky.utils.result.MatchedDevice;
import java.util.ArrayList;
import java.util.List;
public class Scheme {
public List<MatchedDevice> calSchemeByTechType(Double buildArea, List<SysDeviceHeatScene> deviceList, String techType){
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()));
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));
}
if (remainArea <= 0) {
break; // 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备
}
}
return matchedDeviceList;
}
}

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

@ -1,61 +0,0 @@
package com.dky.calculate;
import com.dky.utils.entity.DevSpec;
import com.dky.utils.entity.DevPrice;
import com.dky.utils.result.MatchedDevice;
import com.dky.utils.result.MatchedDeviceResult;
import java.util.*;
public class RequireDevice {
public static MatchedDeviceResult matchDevices(double demandCapacity,List<DevSpec> deviceList,List<DevPrice> priceList) {
// 对设备按照容量从大到小排序
deviceList.sort((d1, d2) -> Double.compare(d2.getCapacity(), d1.getCapacity()));
double remainingCapacity = demandCapacity;
double totalPrice = 0;
List<MatchedDevice> matchedDevices = new ArrayList<>();
// 遍历设备列表.根据需求容量匹配设备
for (DevSpec spec : deviceList) {
if (spec.getCapacity() <= remainingCapacity) {
int count = (int) Math.floor(remainingCapacity / spec.getCapacity());
remainingCapacity = remainingCapacity - (spec.getCapacity() * count);
matchedDevices.add(new MatchedDevice(spec, count));
if (count > 0) {
DevPrice price = priceList.stream()
.filter(p -> p.getId().equals(spec.getId()))
.findFirst()
.orElse(null);
if (price != null) {
double devicePrice = price.getDevPrice() * count;
totalPrice += devicePrice;
}
}
}else {
for (int i = deviceList.size()-1; i >= 0; i--){
if (deviceList.get(i).getCapacity() >= remainingCapacity){
matchedDevices.add(new MatchedDevice(deviceList.get(i), 1));
int finalI = i;
DevPrice price = priceList.stream()
.filter(p -> p.getId().equals(deviceList.get(finalI).getId()))
.findFirst()
.orElse(null);
if (price != null) {
double devicePrice = price.getDevPrice();
totalPrice += devicePrice;
}
break;
}
}
break;
}
if (remainingCapacity <= 0) {
break; // 当总容量已经满足需求时,跳出循环,不再选择其他设备
}
}
return new MatchedDeviceResult(matchedDevices, Math.round(totalPrice*100.0)/100.0);
}
}

@ -45,7 +45,7 @@
</dependency>
<dependency>
<groupId>com.dky</groupId>
<artifactId>dntd-model-coolheat</artifactId>
<artifactId>dntd-model-buildheating</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

@ -0,0 +1,41 @@
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;
}
}

@ -1,26 +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;
public class CoolHeatSence implements DntdModelI {
@Override
public JSONObject createReport(JSONObject jsonObject) {
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;
}
}

@ -49,7 +49,7 @@ public class HeatBoilerSence implements DntdModelI {
Set<String> devTypeSet = new HashSet<>();
/* for (MatchedDevice : matchedDeviceResult.getMatchedDevices()) {
devTypeSet.add(matchedDevice.getDevSpec().getDevType());
deviceSpec = deviceSpec + matchedDevice.getDevSpec().getDevType() + ":"+matchedDevice.getDevSpec().getCapacity()+"蒸吨、";
deviceSpec = deviceSpec + matchedDevice.getDevSpec().getDevType() + ":"+matchedDevicematchedDevice.getDevSpec().getCapacity()+"蒸吨、";
deviceNum = deviceNum + matchedDevice.getCount() + "台/"+matchedDevice.getDevSpec().getDevType()+";";
int devId = matchedDevice.getDevSpec().getId();
for (DevPrice devPrice : priceList) {

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

@ -13,7 +13,7 @@
<module>dntd-model-heatboiler</module>
<module>dntd-modelI</module>
<module>dntd-common</module>
<module>dntd-model-coolheat</module>
<module>dntd-model-buildheating</module>
<module>dntd-model-madekiln</module>
</modules>

Loading…
Cancel
Save