diff --git a/dntd-common/src/main/java/com/dky/utils/entity/DevPrice.java b/dntd-common/src/main/java/com/dky/utils/entity/DevPrice.java deleted file mode 100644 index 2cdd125..0000000 --- a/dntd-common/src/main/java/com/dky/utils/entity/DevPrice.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-common/src/main/java/com/dky/utils/entity/DevSpec.java b/dntd-common/src/main/java/com/dky/utils/entity/DevSpec.java deleted file mode 100644 index 7ab2011..0000000 --- a/dntd-common/src/main/java/com/dky/utils/entity/DevSpec.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptBuildInfomation.java b/dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptBuildInfomation.java new file mode 100644 index 0000000..1a83978 --- /dev/null +++ b/dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptBuildInfomation.java @@ -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; + } +} diff --git a/dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptPower.java b/dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptPower.java new file mode 100644 index 0000000..eb8d6a1 --- /dev/null +++ b/dntd-common/src/main/java/com/dky/utils/entity/SysCustomerReceiptPower.java @@ -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; + } +} 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 new file mode 100644 index 0000000..5d054de --- /dev/null +++ b/dntd-common/src/main/java/com/dky/utils/entity/SysDeviceHeatScene.java @@ -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; + } +} 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 5a75a68..067cc10 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 @@ -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 + - '}'; - } } diff --git a/dntd-model-coolheat/pom.xml b/dntd-model-buildheating/pom.xml similarity index 95% rename from dntd-model-coolheat/pom.xml rename to dntd-model-buildheating/pom.xml index 030f427..536bb29 100644 --- a/dntd-model-coolheat/pom.xml +++ b/dntd-model-buildheating/pom.xml @@ -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> 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 new file mode 100644 index 0000000..242feea --- /dev/null +++ b/dntd-model-buildheating/src/main/java/com/dky/calculate/CalC.java @@ -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; + } +} diff --git a/dntd-model-coolheat/src/main/java/com/dky/calculate/OverCollHeatAll.java b/dntd-model-buildheating/src/main/java/com/dky/calculate/OverCollHeatAll.java similarity index 100% rename from dntd-model-coolheat/src/main/java/com/dky/calculate/OverCollHeatAll.java rename to dntd-model-buildheating/src/main/java/com/dky/calculate/OverCollHeatAll.java 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 new file mode 100644 index 0000000..7e30c6c --- /dev/null +++ b/dntd-model-buildheating/src/main/java/com/dky/calculate/Scheme.java @@ -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; + } +} diff --git a/dntd-model-coolheat/src/main/java/com/dky/entity/Construction.java b/dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java similarity index 100% rename from dntd-model-coolheat/src/main/java/com/dky/entity/Construction.java rename to dntd-model-buildheating/src/main/java/com/dky/entity/Construction.java diff --git a/dntd-model-coolheat/src/main/java/com/dky/entity/CoolHeat.java b/dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java similarity index 100% rename from dntd-model-coolheat/src/main/java/com/dky/entity/CoolHeat.java rename to dntd-model-buildheating/src/main/java/com/dky/entity/CoolHeat.java 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 new file mode 100644 index 0000000..13fca61 --- /dev/null +++ b/dntd-model-buildheating/src/main/java/com/dky/entity/HeatingDevice.java @@ -0,0 +1,8 @@ +package com.dky.entity; + +public class HeatingDevice { + + //id + private String id; + // +} diff --git a/dntd-model-coolheat/src/main/java/com/dky/entity/OriginalDevice.java b/dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java similarity index 100% rename from dntd-model-coolheat/src/main/java/com/dky/entity/OriginalDevice.java rename to dntd-model-buildheating/src/main/java/com/dky/entity/OriginalDevice.java diff --git a/dntd-model-coolheat/src/main/java/com/dky/calculate/CalC.java b/dntd-model-coolheat/src/main/java/com/dky/calculate/CalC.java deleted file mode 100644 index 65c6f40..0000000 --- a/dntd-model-coolheat/src/main/java/com/dky/calculate/CalC.java +++ /dev/null @@ -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; - } - - - - -} diff --git a/dntd-model-coolheat/src/main/java/com/dky/calculate/CalD.java b/dntd-model-coolheat/src/main/java/com/dky/calculate/CalD.java deleted file mode 100644 index 7c339a0..0000000 --- a/dntd-model-coolheat/src/main/java/com/dky/calculate/CalD.java +++ /dev/null @@ -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; - } - - - -} diff --git a/dntd-model-coolheat/src/main/java/com/dky/calculate/Scheme.java b/dntd-model-coolheat/src/main/java/com/dky/calculate/Scheme.java deleted file mode 100644 index 998d70b..0000000 --- a/dntd-model-coolheat/src/main/java/com/dky/calculate/Scheme.java +++ /dev/null @@ -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; - } - - - -} diff --git a/dntd-model-coolheat/src/main/java/com/dky/calculate/SchemeRating.java b/dntd-model-coolheat/src/main/java/com/dky/calculate/SchemeRating.java deleted file mode 100644 index d658aec..0000000 --- a/dntd-model-coolheat/src/main/java/com/dky/calculate/SchemeRating.java +++ /dev/null @@ -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; - } - - - - -} diff --git a/dntd-model-coolheat/src/main/java/com/dky/entity/MatchedDevice.java b/dntd-model-coolheat/src/main/java/com/dky/entity/MatchedDevice.java deleted file mode 100644 index c6a9e86..0000000 --- a/dntd-model-coolheat/src/main/java/com/dky/entity/MatchedDevice.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-model-coolheat/src/main/java/com/dky/entity/SysDeviceHeatScene.java b/dntd-model-coolheat/src/main/java/com/dky/entity/SysDeviceHeatScene.java deleted file mode 100644 index cc9ffeb..0000000 --- a/dntd-model-coolheat/src/main/java/com/dky/entity/SysDeviceHeatScene.java +++ /dev/null @@ -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; - } -} diff --git a/dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java b/dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java deleted file mode 100644 index 3599f39..0000000 --- a/dntd-model-heatboiler/src/main/java/com/dky/calculate/RequireDevice.java +++ /dev/null @@ -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); - } -} diff --git a/dntd-tool/pom.xml b/dntd-tool/pom.xml index 13c7095..d98c4eb 100644 --- a/dntd-tool/pom.xml +++ b/dntd-tool/pom.xml @@ -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> diff --git a/dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java b/dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java new file mode 100644 index 0000000..b505a3e --- /dev/null +++ b/dntd-tool/src/main/java/com/dky/generate/BuildHeatingSence.java @@ -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; + } + +} diff --git a/dntd-tool/src/main/java/com/dky/generate/CoolHeatSence.java b/dntd-tool/src/main/java/com/dky/generate/CoolHeatSence.java deleted file mode 100644 index 3892556..0000000 --- a/dntd-tool/src/main/java/com/dky/generate/CoolHeatSence.java +++ /dev/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; - } - -} 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 0fcc5bc..5202043 100644 --- a/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java +++ b/dntd-tool/src/main/java/com/dky/generate/HeatBoilerSence.java @@ -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) { diff --git a/dntd-tool/src/main/resources/modelCode.properties b/dntd-tool/src/main/resources/modelCode.properties index 25eebae..39fd7ab 100644 --- a/dntd-tool/src/main/resources/modelCode.properties +++ b/dntd-tool/src/main/resources/modelCode.properties @@ -1 +1,2 @@ 0101=generate.HeatBoilerSence +0102=generate.CoolHeatSence diff --git a/pom.xml b/pom.xml index a961625..3c2f9fd 100644 --- a/pom.xml +++ b/pom.xml @@ -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>