# Conflicts: # dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java # dntd-model-buildheating/src/main/java/com/dky/calculate/CalD.java # dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java # dntd-model-buildheating/src/main/java/com/dky/calculate/SchemeRating.java # dntd-model-buildheating/src/main/java/com/dky/entity/MatchedDevice.java # dntd-model-buildheating/src/main/java/com/dky/entity/SysDeviceHeatScene.javamaster
commit
e6c3164bb0
@ -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,195 +0,0 @@ |
||||
package com.dky.utils.entity; |
||||
|
||||
public class DevSpec { |
||||
|
||||
/** 序号 */ |
||||
private Long id ; |
||||
/** 设备类型 */ |
||||
private String deviceType ; |
||||
/** 设备细类 */ |
||||
private String deviceSubType ; |
||||
/** 技术类型 */ |
||||
private String technologyType ; |
||||
/** 设备功率(kW) */ |
||||
private Double devicePower ; |
||||
/** 设备加热方式 */ |
||||
private String heatingMethod ; |
||||
/** 热效率 */ |
||||
private String heatingEffciency ; |
||||
/** 设备单价(万元) */ |
||||
private Double devicePrice ; |
||||
/** 设备操作人数 */ |
||||
private Integer deviceOperators ; |
||||
/** 电替代设备年人工费用(万元) */ |
||||
private Double artificialCost ; |
||||
/** 原设备的人工费用(万元) */ |
||||
private Double laborCost ; |
||||
/** 设备使用年限(年) */ |
||||
private Integer deviceLife ; |
||||
/** 设备年运行时长(小时) */ |
||||
private Integer deviceRunHours ; |
||||
/** 单台电设备参考的可供暖面积(平方米) */ |
||||
private Double heatingArea ; |
||||
/** 单台电设备制造一批产品的周期(小时) */ |
||||
private Integer manufacturingCycle ; |
||||
/** 工作容积(立方米) */ |
||||
private Double workingVolume ; |
||||
/** 产品的密度 */ |
||||
private String productDensity ; |
||||
/** 单台电设备制造一批产品的产量 */ |
||||
private String productQuality ; |
||||
/** 备注 */ |
||||
private String remarkInfo ; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getDeviceType() { |
||||
return deviceType; |
||||
} |
||||
|
||||
public void setDeviceType(String deviceType) { |
||||
this.deviceType = deviceType; |
||||
} |
||||
|
||||
public String getDeviceSubType() { |
||||
return deviceSubType; |
||||
} |
||||
|
||||
public void setDeviceSubType(String deviceSubType) { |
||||
this.deviceSubType = deviceSubType; |
||||
} |
||||
|
||||
public String getTechnologyType() { |
||||
return technologyType; |
||||
} |
||||
|
||||
public void setTechnologyType(String technologyType) { |
||||
this.technologyType = technologyType; |
||||
} |
||||
|
||||
public Double getDevicePower() { |
||||
return devicePower; |
||||
} |
||||
|
||||
public void setDevicePower(Double devicePower) { |
||||
this.devicePower = devicePower; |
||||
} |
||||
|
||||
public String getHeatingMethod() { |
||||
return heatingMethod; |
||||
} |
||||
|
||||
public void setHeatingMethod(String heatingMethod) { |
||||
this.heatingMethod = heatingMethod; |
||||
} |
||||
|
||||
public String getHeatingEffciency() { |
||||
return heatingEffciency; |
||||
} |
||||
|
||||
public void setHeatingEffciency(String heatingEffciency) { |
||||
this.heatingEffciency = heatingEffciency; |
||||
} |
||||
|
||||
public Double getDevicePrice() { |
||||
return devicePrice; |
||||
} |
||||
|
||||
public void setDevicePrice(Double devicePrice) { |
||||
this.devicePrice = devicePrice; |
||||
} |
||||
|
||||
public Integer getDeviceOperators() { |
||||
return deviceOperators; |
||||
} |
||||
|
||||
public void setDeviceOperators(Integer deviceOperators) { |
||||
this.deviceOperators = deviceOperators; |
||||
} |
||||
|
||||
public Double getArtificialCost() { |
||||
return artificialCost; |
||||
} |
||||
|
||||
public void setArtificialCost(Double artificialCost) { |
||||
this.artificialCost = artificialCost; |
||||
} |
||||
|
||||
public Double getLaborCost() { |
||||
return laborCost; |
||||
} |
||||
|
||||
public void setLaborCost(Double laborCost) { |
||||
this.laborCost = laborCost; |
||||
} |
||||
|
||||
public Integer getDeviceLife() { |
||||
return deviceLife; |
||||
} |
||||
|
||||
public void setDeviceLife(Integer deviceLife) { |
||||
this.deviceLife = deviceLife; |
||||
} |
||||
|
||||
public Integer getDeviceRunHours() { |
||||
return deviceRunHours; |
||||
} |
||||
|
||||
public void setDeviceRunHours(Integer deviceRunHours) { |
||||
this.deviceRunHours = deviceRunHours; |
||||
} |
||||
|
||||
public Double getHeatingArea() { |
||||
return heatingArea; |
||||
} |
||||
|
||||
public void setHeatingArea(Double heatingArea) { |
||||
this.heatingArea = heatingArea; |
||||
} |
||||
|
||||
public Integer getManufacturingCycle() { |
||||
return manufacturingCycle; |
||||
} |
||||
|
||||
public void setManufacturingCycle(Integer manufacturingCycle) { |
||||
this.manufacturingCycle = manufacturingCycle; |
||||
} |
||||
|
||||
public Double getWorkingVolume() { |
||||
return workingVolume; |
||||
} |
||||
|
||||
public void setWorkingVolume(Double workingVolume) { |
||||
this.workingVolume = workingVolume; |
||||
} |
||||
|
||||
public String getProductDensity() { |
||||
return productDensity; |
||||
} |
||||
|
||||
public void setProductDensity(String productDensity) { |
||||
this.productDensity = productDensity; |
||||
} |
||||
|
||||
public String getProductQuality() { |
||||
return productQuality; |
||||
} |
||||
|
||||
public void setProductQuality(String productQuality) { |
||||
this.productQuality = productQuality; |
||||
} |
||||
|
||||
public String getRemarkInfo() { |
||||
return remarkInfo; |
||||
} |
||||
|
||||
public void setRemarkInfo(String remarkInfo) { |
||||
this.remarkInfo = remarkInfo; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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,40 +0,0 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
import com.dky.entity.MatchedDevice; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public class CalC { |
||||
|
||||
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.getDevice().getDevicePower()) ; |
||||
} |
||||
if (power >= maxPower[0]){ |
||||
maxPower[0] = power; |
||||
} |
||||
}); |
||||
Map<String, Double> map = new HashMap<>(); |
||||
map.put(k, maxPower[0]); |
||||
maps.add(map); |
||||
}); |
||||
}); |
||||
return maps; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -1,30 +0,0 @@ |
||||
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,59 +0,0 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
import com.dky.entity.MatchedDevice; |
||||
import com.dky.entity.SysDeviceHeatScene; |
||||
|
||||
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 static List<Map<String, List<List<MatchedDevice>>>> calScheme(Double buildArea, List<SysDeviceHeatScene> list) { |
||||
// 区分电锅炉、热泵
|
||||
Map<String, List<SysDeviceHeatScene>> grouped = list.stream() |
||||
.collect(Collectors.groupingBy(SysDeviceHeatScene::getDeviceSubType)); |
||||
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::getTechnologyType)); |
||||
collect.forEach((k2, v2) -> { |
||||
List<MatchedDevice> matchedDevices = calSchemeByTechType(buildArea, v2); |
||||
planList.add(matchedDevices); |
||||
}); |
||||
map.put(k, planList); |
||||
maps.add(map); |
||||
}); |
||||
return maps; |
||||
} |
||||
|
||||
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) { |
||||
double v = remainArea / deviceHeatScene.getDevReferenceArea(); |
||||
int count = (int) (v); |
||||
if (v < 1){ |
||||
count = count + 1; |
||||
} |
||||
remainArea = remainArea - count * deviceHeatScene.getDevReferenceArea(); |
||||
matchedDeviceList.add(new MatchedDevice(count, deviceHeatScene)); |
||||
if (remainArea <= 0){ |
||||
// 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备
|
||||
break; |
||||
} |
||||
} |
||||
return matchedDeviceList; |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -1,83 +0,0 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
import com.dky.entity.MatchedDevice; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.concurrent.atomic.AtomicReference; |
||||
|
||||
public class SchemeRating { |
||||
|
||||
|
||||
public static void getOptimalScheme(List<Map<String, List<List<MatchedDevice>>>> list) { |
||||
list.parallelStream().forEach(stringListMap -> { |
||||
// 区分热泵、电锅炉
|
||||
stringListMap.forEach((k,v)->{ |
||||
// 循环遍历各个方案
|
||||
final Double[] maxRating = {0.0}; |
||||
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.getDevice().getHeatingEffciency(); |
||||
} |
||||
for (MatchedDevice device : plan) { |
||||
cost = cost + ((device.getCount() * device.getDevice().getDevicePrice()) + (device.getCount()) * device.getDevice().getArtificialCost() * device.getDevice().getDeviceLife()); |
||||
} |
||||
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"); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
}); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
|
||||
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.getDevice().getHeatingEffciency(); |
||||
} |
||||
for (MatchedDevice device : plan) { |
||||
cost = cost + ((device.getCount() * device.getDevice().getDevicePrice()) + (device.getCount()) * device.getDevice().getArtificialCost() * device.getDevice().getDeviceLife()); |
||||
} |
||||
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,40 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
|
||||
public class MatchedDevice { |
||||
|
||||
private Integer count; |
||||
|
||||
private SysDeviceHeatScene device; |
||||
|
||||
public MatchedDevice() { } |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "MatchedDevice{" + |
||||
"count=" + count + |
||||
", device=" + device + |
||||
'}'; |
||||
} |
||||
|
||||
public MatchedDevice(Integer count, SysDeviceHeatScene device) { |
||||
this.count = count; |
||||
this.device = device; |
||||
} |
||||
|
||||
public Integer getCount() { |
||||
return count; |
||||
} |
||||
|
||||
public void setCount(Integer count) { |
||||
this.count = count; |
||||
} |
||||
|
||||
public SysDeviceHeatScene getDevice() { |
||||
return device; |
||||
} |
||||
|
||||
public void setDevice(SysDeviceHeatScene device) { |
||||
this.device = device; |
||||
} |
||||
} |
@ -1,166 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
|
||||
public class SysDeviceHeatScene { |
||||
|
||||
/** 序号 */ |
||||
private Integer id ; |
||||
/** 设备类型 */ |
||||
private String deviceType ; |
||||
/** 设备细类 */ |
||||
private String deviceSubType ; |
||||
/** 技术类型 */ |
||||
private String technologyType ; |
||||
/** 热效率 */ |
||||
private Double heatingEffciency ; |
||||
/** 设备功率(kW) */ |
||||
private Double devicePower ; |
||||
/** 设备单价(万元) */ |
||||
private Double devicePrice ; |
||||
/** 电替代设备年人工费用(万元) */ |
||||
private Double artificialCost ; |
||||
/** 原设备的人工费用(万元) */ |
||||
private Double laborCost ; |
||||
/** 单台电设备参考的可供暖面积(万平方米) */ |
||||
private Double devReferenceArea ; |
||||
/** 设备使用年限(年) */ |
||||
private Integer deviceLife ; |
||||
/** 设备年运行时长(小时) */ |
||||
private Integer deviceRunHours ; |
||||
/** 备注 */ |
||||
private String remarkInfo ; |
||||
|
||||
|
||||
public SysDeviceHeatScene(Integer id, String deviceType, String deviceSubType, String technologyType, Double heatingEffciency, Double devicePower, Double devicePrice, Double artificialCost, Double laborCost, Double devReferenceArea, Integer deviceLife, Integer deviceRunHours, String remarkInfo) { |
||||
this.id = id; |
||||
this.deviceType = deviceType; |
||||
this.deviceSubType = deviceSubType; |
||||
this.technologyType = technologyType; |
||||
this.heatingEffciency = heatingEffciency; |
||||
this.devicePower = devicePower; |
||||
this.devicePrice = devicePrice; |
||||
this.artificialCost = artificialCost; |
||||
this.laborCost = laborCost; |
||||
this.devReferenceArea = devReferenceArea; |
||||
this.deviceLife = deviceLife; |
||||
this.deviceRunHours = deviceRunHours; |
||||
this.remarkInfo = remarkInfo; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "SysDeviceHeatScene{" + |
||||
"id=" + id + |
||||
", deviceSubType='" + deviceSubType + '\'' + |
||||
", technologyType='" + technologyType + '\'' + |
||||
", heatingEffciency=" + heatingEffciency + |
||||
", devicePrice=" + devicePrice + |
||||
", laborCost=" + laborCost + |
||||
", deviceLife=" + deviceLife + |
||||
'}'; |
||||
} |
||||
|
||||
public Integer getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Integer id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getDeviceType() { |
||||
return deviceType; |
||||
} |
||||
|
||||
public void setDeviceType(String deviceType) { |
||||
this.deviceType = deviceType; |
||||
} |
||||
|
||||
public String getDeviceSubType() { |
||||
return deviceSubType; |
||||
} |
||||
|
||||
public void setDeviceSubType(String deviceSubType) { |
||||
this.deviceSubType = deviceSubType; |
||||
} |
||||
|
||||
public String getTechnologyType() { |
||||
return technologyType; |
||||
} |
||||
|
||||
public void setTechnologyType(String technologyType) { |
||||
this.technologyType = technologyType; |
||||
} |
||||
|
||||
public Double getHeatingEffciency() { |
||||
return heatingEffciency; |
||||
} |
||||
|
||||
public void setHeatingEffciency(Double heatingEffciency) { |
||||
this.heatingEffciency = heatingEffciency; |
||||
} |
||||
|
||||
public Double getDevicePower() { |
||||
return devicePower; |
||||
} |
||||
|
||||
public void setDevicePower(Double devicePower) { |
||||
this.devicePower = devicePower; |
||||
} |
||||
|
||||
public Double getDevicePrice() { |
||||
return devicePrice; |
||||
} |
||||
|
||||
public void setDevicePrice(Double devicePrice) { |
||||
this.devicePrice = devicePrice; |
||||
} |
||||
|
||||
public Double getArtificialCost() { |
||||
return artificialCost; |
||||
} |
||||
|
||||
public void setArtificialCost(Double artificialCost) { |
||||
this.artificialCost = artificialCost; |
||||
} |
||||
|
||||
public Double getLaborCost() { |
||||
return laborCost; |
||||
} |
||||
|
||||
public void setLaborCost(Double laborCost) { |
||||
this.laborCost = laborCost; |
||||
} |
||||
|
||||
public Double getDevReferenceArea() { |
||||
return devReferenceArea; |
||||
} |
||||
|
||||
public void setDevReferenceArea(Double devReferenceArea) { |
||||
this.devReferenceArea = devReferenceArea; |
||||
} |
||||
|
||||
public Integer getDeviceLife() { |
||||
return deviceLife; |
||||
} |
||||
|
||||
public void setDeviceLife(Integer deviceLife) { |
||||
this.deviceLife = deviceLife; |
||||
} |
||||
|
||||
public Integer getDeviceRunHours() { |
||||
return deviceRunHours; |
||||
} |
||||
|
||||
public void setDeviceRunHours(Integer deviceRunHours) { |
||||
this.deviceRunHours = deviceRunHours; |
||||
} |
||||
|
||||
public String getRemarkInfo() { |
||||
return remarkInfo; |
||||
} |
||||
|
||||
public void setRemarkInfo(String remarkInfo) { |
||||
this.remarkInfo = remarkInfo; |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
|
||||
} |
@ -1 +1,2 @@ |
||||
0101=generate.HeatBoilerSence |
||||
0102=generate.CoolHeatSence |
||||
|
Loading…
Reference in new issue