You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
6.6 KiB
109 lines
6.6 KiB
package com.dky.generate;
|
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
import com.dky.calculate.*;
|
|
import com.dky.modelI.DntdModelI;
|
|
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 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);
|
|
}
|
|
});
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
|