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.
133 lines
5.9 KiB
133 lines
5.9 KiB
package com.dky.generate;
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
import com.dky.calculate.*;
|
|
import com.dky.modelI.DntdModelI;
|
|
import com.dky.utils.GetTargetDeviceList;
|
|
import com.dky.utils.entity.SysDeviceHeatScene;
|
|
import com.dky.utils.enums.DeviceSubType;
|
|
import com.dky.utils.result.MatchedDevice;
|
|
|
|
import java.text.DecimalFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public class KitchenCookScene implements DntdModelI {
|
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("#.00");
|
|
|
|
// 首先A=由运行/合同容量折合成kW(x0.9)x85%,
|
|
static final Double COEFFICIENT_1 = 0.9;
|
|
static final Double COEFFICIENT_2 = 0.85;
|
|
|
|
@Override
|
|
public JSONObject createReport(JSONObject jsonObject, List<SysDeviceHeatScene> sceneList) {
|
|
List<SysDeviceHeatScene> alternateDeviceList = GetTargetDeviceList.main(DeviceSubType.Kitchen_Cooking.getDesc(), sceneList);
|
|
|
|
JSONObject distInfo = new JSONObject();
|
|
|
|
try{
|
|
distInfo = (JSONObject) jsonObject.get("distInfo");
|
|
} catch (Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
// 运行容量
|
|
Double runCapacity = Double.parseDouble(distInfo.get("runCapacity").toString());
|
|
// 上年最大需量
|
|
Double lastYearNeed = Double.parseDouble(distInfo.get("lastYearNeed").toString());
|
|
// 上年运行费用(万元)
|
|
Double lastYearFee = Double.parseDouble(jsonObject.get("lastYearFee").toString());
|
|
// 人数
|
|
Integer peopleNum = Integer.parseInt(jsonObject.get("peopleNum").toString());
|
|
|
|
/*
|
|
实际可承载容量A = 运行(或合同容量)x0.9[将运行容量或合同容量折算成容量]x85%
|
|
*/
|
|
double A = runCapacity * COEFFICIENT_1 * COEFFICIENT_2;
|
|
|
|
/*
|
|
根据人数计算出不同技术类型下所需要不同功率设备数据
|
|
*/
|
|
List<MatchedDevice> cookDevices = KitchenCookScheme.getCookDevices(peopleNum, alternateDeviceList);
|
|
/*
|
|
替代后设备总功率C1
|
|
*/
|
|
double C1 = 0.0;
|
|
|
|
for (MatchedDevice matchedDevice : cookDevices){
|
|
C1 = C1 + matchedDevice.getDeviceHeatScene().getDevPower() * matchedDevice.getCount();
|
|
}
|
|
|
|
/*
|
|
改造后最大需量D1
|
|
*/
|
|
double D1 = lastYearNeed + C1;
|
|
|
|
String remark = "";
|
|
if ( A < D1){
|
|
remark = "本方案存在扩容投资需求,扩容投资不计入初次投资费用";
|
|
}
|
|
|
|
|
|
/*
|
|
封装返回
|
|
*/
|
|
JSONObject returnJsonObject = new JSONObject();
|
|
Double startCost = 0.0;
|
|
Double runCost = 0.0;
|
|
Double allCost = 0.0;
|
|
Double calculateAnnualCarbon = 0.0;
|
|
Double laborCost = 0.0;
|
|
Double electric = 0.0;
|
|
List<HashMap<String,Object>> deviceList = new ArrayList<>();
|
|
for (MatchedDevice matchedDevice : cookDevices){
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
map.put("devSubType",matchedDevice.getDeviceHeatScene().getDevSubType());
|
|
map.put("devTechType",matchedDevice.getDeviceHeatScene().getDevTechType());
|
|
map.put("devCount",matchedDevice.getCount());
|
|
map.put("devPrice",matchedDevice.getDeviceHeatScene().getDevPrice());
|
|
deviceList.add(map);
|
|
|
|
startCost = startCost + (matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getDevPrice());
|
|
|
|
runCost = runCost + (KitchenCookModel.calculateAnnualOperatingCost(matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime(), matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost()));
|
|
|
|
allCost = allCost + (KitchenCookModel.calculateTotalAnnualCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPrice(), matchedDevice.getDeviceHeatScene().getDevServiceLife(),
|
|
matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime(), matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost()));
|
|
|
|
electric = electric + (KitchenCookModel.calculateAnnualElectricityConsumption(matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime()));
|
|
|
|
laborCost = laborCost + (matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getLaborCost() / matchedDevice.getDeviceHeatScene().getDevServiceLife());
|
|
|
|
}
|
|
//初次投资费用
|
|
returnJsonObject.set("startCost", decimalFormat.format(startCost));
|
|
// 设备总价
|
|
returnJsonObject.set("devCost", decimalFormat.format(startCost));
|
|
//年运行费用
|
|
returnJsonObject.set("yearRunCost", decimalFormat.format(runCost));
|
|
//年总费用
|
|
returnJsonObject.set("yearCost", decimalFormat.format(allCost));
|
|
//年减碳量
|
|
calculateAnnualCarbon = KitchenCookModel.calculateAnnualCarbonReduction(lastYearFee, laborCost, electric);
|
|
returnJsonObject.set("calculate", decimalFormat.format(calculateAnnualCarbon/1000));
|
|
//替代电量
|
|
returnJsonObject.set("electric", decimalFormat.format(electric));
|
|
//备注
|
|
returnJsonObject.set("remark",remark);
|
|
//封装需配置设备情况
|
|
returnJsonObject.set("deviceList",deviceList);
|
|
|
|
//封装方案优势
|
|
returnJsonObject.set("safety", BuildHeatingAdvantage.safety());
|
|
returnJsonObject.set("economy", Advantage.economy(startCost, runCost, lastYearFee));
|
|
returnJsonObject.set("intelligence", BuildHeatingAdvantage.intelligence());
|
|
returnJsonObject.set("environment", BuildHeatingAdvantage.environment(Double.valueOf(decimalFormat.format(calculateAnnualCarbon/1000))));
|
|
|
|
return returnJsonObject;
|
|
}
|
|
|
|
}
|
|
|