...
|
...
|
@@ -12,7 +12,10 @@ import com.synthesize_energy.common.domain.CommonErrorCode; |
|
|
import com.synthesize_energy.item.algorithm.NpvData;
|
|
|
import com.synthesize_energy.item.dto.*;
|
|
|
import com.synthesize_energy.item.entity.*;
|
|
|
import com.synthesize_energy.item.event.No2_1SaveEvent;
|
|
|
import com.synthesize_energy.item.mapper.*;
|
|
|
import com.synthesize_energy.item.utils.JwtUtil;
|
|
|
import com.synthesize_energy.item.utils.UserContext;
|
|
|
import com.synthesize_energy.item.vo.CalculateLoadVo;
|
|
|
import com.synthesize_energy.item.vo.EnergyEquipmentVo;
|
|
|
import com.synthesize_energy.item.vo.LoadParameterVo;
|
...
|
...
|
@@ -23,6 +26,7 @@ import net.sf.jsqlparser.expression.LongValue; |
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.Assert;
|
...
|
...
|
@@ -32,6 +36,7 @@ import java.math.BigDecimal; |
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author kgy
|
...
|
...
|
@@ -273,16 +278,16 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
String[] split = byId.getEnergyType().split(",");// 1供电 2供热 3供冷 4热水
|
|
|
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, byId.getProjectSite()));//城市
|
|
|
Synthesize_no_2_6 synthesizeNo26ServiceById = synthesize_no_2_6Service.getById(id);// 典型值
|
|
|
CpvAndCfmData cfmData = cpvAndCfmDataService.getById(dict.getId());// 光伏相关数据调用表原始表 风电相关数据调用表原始表
|
|
|
//CpvAndCfmData cfmData = cpvAndCfmDataService.getById(dict.getId());// 光伏相关数据调用表原始表 风电相关数据调用表原始表
|
|
|
Synthesize_no_2_3 synthesize_no_2_3 = synthesize_no_2_3Service.getById(id);//能源设备 供电 供热 供冷 热水
|
|
|
List<No_3_1_1Dto> list = new ArrayList<>();
|
|
|
String[] array = new String[]{"供电系统", "供热系统", "供冷系统", "热水系统"};
|
|
|
String[] array2 = new String[]{"电网", "光伏发电", "风电", "储能", "电锅炉", "空气源热泵(制热型)", "空气源热泵(双工况)", "燃气锅炉", "空气源热泵(制冷型)", "空气源热泵(双工况)", "冷水机组", "太阳能集热器", "空气源热泵(热水型)", "多联机中央空调", "蓄热", "双蓄", "蓄冷", "地源热泵", "水源热泵"};
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1s = synthesize_no_2_1Service.list(new QueryWrapper<Synthesize_no_2_1>().lambda().eq(Synthesize_no_2_1::getPid, id));//建筑
|
|
|
|
|
|
applicationContext.publishEvent(new No2_1SaveEvent(synthesize_no_2_1s));
|
|
|
//Electrovalence electrovalence = electrovalenceMapper.selectById(dict.getId());//电价
|
|
|
Synthesize_no_2_5 synthesize_no_2_5 = synthesize_no_2_5Service.getById(id);//经济参数
|
|
|
EnergySources energySources = energySourcesMapper.selectById(dict.getId()); // 能源价格
|
|
|
//EnergySources energySources = energySourcesMapper.selectById(dict.getId()); // 能源价格
|
|
|
Synthesize_no_3_6 synthesize_no_3_6 = new Synthesize_no_3_6();//经济指标 保存
|
|
|
synthesize_no_3_6.setNo225(0.0D);
|
|
|
synthesize_no_3_6.setNo226(0.0D);
|
...
|
...
|
@@ -1952,6 +1957,10 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
return (double) Math.round(d * 10000) / 10000;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private ApplicationContext applicationContext;
|
|
|
|
|
|
/**
|
|
|
* 建筑类型 保存
|
|
|
*
|
...
|
...
|
@@ -1965,20 +1974,29 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
synthesize_no_2_1Service.remove(new QueryWrapper<Synthesize_no_2_1>().lambda().eq(Synthesize_no_2_1::getPid, synthesize_no_2_1s.get(0).getPid()));
|
|
|
//calculateLoadService.remove(new QueryWrapper<CalculateLoad>().lambda().eq(CalculateLoad::getCid, synthesize_no_2_1s.get(0).getPid()));
|
|
|
//CalculateLoad serviceOne = calculateLoadService.getOne(new LambdaQueryWrapper<CalculateLoad>().eq(CalculateLoad::getCid, synthesize_no_2_1s.get(0).getPid()));
|
|
|
for (Synthesize_no_2_1New synthesize_no_2_1 : synthesize_no_2_1s) {
|
|
|
/**
|
|
|
* 判断 新加的指标是否存在 不存在进行调用
|
|
|
*/
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1s2 = synthesize_no_2_1s.stream().map(synthesize_no_2_1New -> {
|
|
|
Synthesize_no_2_1 synthesizeNo21 = new Synthesize_no_2_1();
|
|
|
BeanUtils.copyProperties(synthesize_no_2_1, synthesizeNo21);
|
|
|
id = synthesizeNo21.getPid();
|
|
|
synthesize_no_2_1Service.saveOrUpdate(synthesizeNo21);
|
|
|
BeanUtils.copyProperties(synthesize_no_2_1New, synthesizeNo21);
|
|
|
return synthesizeNo21;
|
|
|
}).collect(Collectors.toList());
|
|
|
applicationContext.publishEvent(new No2_1SaveEvent(synthesize_no_2_1s2));
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_1 : synthesize_no_2_1s2) {
|
|
|
/* Synthesize_no_2_1 synthesizeNo21 = new Synthesize_no_2_1();
|
|
|
BeanUtils.copyProperties(synthesize_no_2_1, synthesizeNo21);*/
|
|
|
id = synthesize_no_2_1.getPid();
|
|
|
synthesize_no_2_1Service.saveOrUpdate(synthesize_no_2_1);
|
|
|
/* List<CalculateLoad> list = calculateLoadService.list(new QueryWrapper<CalculateLoad>()
|
|
|
.lambda()
|
|
|
.eq(CalculateLoad::getAid, synthesizeNo21.getBuildingTypeId())
|
|
|
.eq(CalculateLoad::getCid, synthesizeNo21.getPid()));
|
|
|
if (!list.isEmpty()) {*/
|
|
|
CalculateLoad calculateLoad = new CalculateLoad();
|
|
|
Synthesize_no_1 synthesize_no_1 = no_1Service.getById(synthesizeNo21.getPid());
|
|
|
Synthesize_no_1 synthesize_no_1 = no_1Service.getById(synthesize_no_2_1.getPid());
|
|
|
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, synthesize_no_1.getProjectSite()));//城市
|
|
|
Sort sort = sortMapper.selectById(synthesizeNo21.getBuildingTypeId());
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_1.getBuildingTypeId());
|
|
|
if (!StringUtils.isEmpty(dict) && !StringUtils.isEmpty(sort)) {
|
|
|
String[] split = synthesize_no_1.getEnergyType().split(",");
|
|
|
double annualTotalElectricityDemand = 0.0;
|
...
|
...
|
@@ -1996,7 +2014,7 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
* 年总需电量
|
|
|
* =10*365*建筑面积面积*设计电负荷*0.8/1000
|
|
|
*/
|
|
|
annualTotalElectricityDemand = synthesizeNo21.getPowerSupplyDays() * synthesizeNo21.getHoursOfPowerSupplyPerDay() * synthesizeNo21.getArchitectureArea() * synthesizeNo21.getDesignElectricLoadIndex() * 0.8 / 1000;
|
|
|
annualTotalElectricityDemand = synthesize_no_2_1.getPowerSupplyDays() * synthesize_no_2_1.getHoursOfPowerSupplyPerDay() * synthesize_no_2_1.getArchitectureArea() * synthesize_no_2_1.getDesignElectricLoadIndex() * 0.8 / 1000;
|
|
|
|
|
|
} else if ("2".equals(s)) {
|
|
|
/**
|
...
|
...
|
@@ -2005,32 +2023,32 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
* 年总需热量= 12*供热天数*供热面积*设计热负荷*0.7/1000
|
|
|
*/
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
Assert.notNull(synthesizeNo21.getHeatEnd(), "末端形式选择出错了");
|
|
|
Assert.notNull(synthesize_no_2_1.getHeatEnd(), "末端形式选择出错了");
|
|
|
Double hotLoadAll = 0.0;
|
|
|
if ("1".equals(synthesizeNo21.getHeatEnd())) {
|
|
|
if ("1".equals(synthesize_no_2_1.getHeatEnd())) {
|
|
|
/**
|
|
|
* 散热器 数据库里面的值
|
|
|
*/
|
|
|
//hotLoadAll = (double) hotLoadDataMapper.queryName(zd_name, dict.getId());
|
|
|
hotLoadAll = synthesizeNo21.getDesignHeatLoadIndex();
|
|
|
} else if ("2".equals(synthesizeNo21.getHeatEnd())) {
|
|
|
hotLoadAll = synthesize_no_2_1.getDesignHeatLoadIndex();
|
|
|
} else if ("2".equals(synthesize_no_2_1.getHeatEnd())) {
|
|
|
/**
|
|
|
* 地暖
|
|
|
* * 0.9
|
|
|
*/
|
|
|
hotLoadAll = synthesizeNo21.getDesignHeatLoadIndex() * 0.9;
|
|
|
} else if ("3".equals(synthesizeNo21.getHeatEnd())) {
|
|
|
hotLoadAll = synthesize_no_2_1.getDesignHeatLoadIndex() * 0.9;
|
|
|
} else if ("3".equals(synthesize_no_2_1.getHeatEnd())) {
|
|
|
/**
|
|
|
* 等级盘管
|
|
|
* * 2
|
|
|
*/
|
|
|
hotLoadAll = synthesizeNo21.getDesignHeatLoadIndex() * 2;
|
|
|
hotLoadAll = synthesize_no_2_1.getDesignHeatLoadIndex() * 2;
|
|
|
}
|
|
|
Assert.notNull(synthesizeNo21.getHeatDay(), "供热天数为空了");
|
|
|
Assert.notNull(synthesize_no_2_1.getHeatDay(), "供热天数为空了");
|
|
|
Integer di = calculatedTemperatureInHeatingRoomMapper.queryName(zd_name, dict.getId());
|
|
|
HeatIngData heatIngData = heatIngDataMapper.selectById(dict.getId());
|
|
|
Double num = (di - heatIngData.getNo2()) / (di - heatIngData.getNo1());
|
|
|
annualTotalHeatRequirement = synthesizeNo21.getHeatingHoursPerDay() * synthesizeNo21.getHeatDay() * synthesizeNo21.getHeatArea() * hotLoadAll * num / 1000;
|
|
|
annualTotalHeatRequirement = synthesize_no_2_1.getHeatingHoursPerDay() * synthesize_no_2_1.getHeatDay() * synthesize_no_2_1.getHeatArea() * hotLoadAll * num / 1000;
|
|
|
|
|
|
} else if ("3".equals(s)) {
|
|
|
/**
|
...
|
...
|
@@ -2040,9 +2058,9 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
*/
|
|
|
//String zd_name = "no_" + sort.getId();
|
|
|
//int coldLoadAll = coldLoadDataMapper.queryName(zd_name, dict.getId());
|
|
|
Double coldLoadAll = synthesizeNo21.getDesignCoolingLoadIndex();
|
|
|
Assert.notNull(synthesizeNo21.getColdDay(), "供冷天数为空了");
|
|
|
annualTotalCoolingDemand = synthesizeNo21.getCoolingHoursPerDay() * synthesizeNo21.getColdDay() * synthesizeNo21.getColdArea() * coldLoadAll * 0.75 / 1000;
|
|
|
Double coldLoadAll = synthesize_no_2_1.getDesignCoolingLoadIndex();
|
|
|
Assert.notNull(synthesize_no_2_1.getColdDay(), "供冷天数为空了");
|
|
|
annualTotalCoolingDemand = synthesize_no_2_1.getCoolingHoursPerDay() * synthesize_no_2_1.getColdDay() * synthesize_no_2_1.getColdArea() * coldLoadAll * 0.75 / 1000;
|
|
|
} else if ("4".equals(s)) {
|
|
|
/**
|
|
|
* 年总需热水总量
|
...
|
...
|
@@ -2050,29 +2068,29 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
* 年总需热水总量= 热水定额*人数*供热水天数/1000
|
|
|
*/
|
|
|
//String zd_name = "no_" + sort.getId();
|
|
|
Double electricity = synthesizeNo21.getHotWaterQuota();
|
|
|
Double electricity = synthesize_no_2_1.getHotWaterQuota();
|
|
|
//Double electricity = hotWaterDataMapper.queryName(zd_name, dict.getId());
|
|
|
Assert.notNull(synthesizeNo21.getWaterDayNum(), "供热水天数为空了");
|
|
|
totalAnnualTotalHotWaterRequirement = electricity * synthesizeNo21.getWaterPersonNum() * synthesizeNo21.getWaterDayNum() / 1000;
|
|
|
Assert.notNull(synthesize_no_2_1.getWaterDayNum(), "供热水天数为空了");
|
|
|
totalAnnualTotalHotWaterRequirement = electricity * synthesize_no_2_1.getWaterPersonNum() * synthesize_no_2_1.getWaterDayNum() / 1000;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//CalculateLoad serviceOne = calculateLoadService.getById(synthesizeNo21.getId());
|
|
|
CalculateLoad serviceOne = calculateLoadService.getById(synthesizeNo21.getId());
|
|
|
CalculateLoad serviceOne = calculateLoadService.getById(synthesize_no_2_1.getId());
|
|
|
if (!StringUtils.isEmpty(serviceOne)) {
|
|
|
serviceOne.setNo1(Double.valueOf(df.format(annualTotalElectricityDemand)));
|
|
|
serviceOne.setNo2(Double.valueOf(df.format(annualTotalHeatRequirement)));
|
|
|
serviceOne.setNo3(Double.valueOf(df.format(annualTotalCoolingDemand)));
|
|
|
serviceOne.setNo4(Double.valueOf(df.format(totalAnnualTotalHotWaterRequirement)));
|
|
|
serviceOne.setCid(synthesizeNo21.getPid());
|
|
|
serviceOne.setAid(synthesizeNo21.getBuildingTypeId());
|
|
|
serviceOne.setCid(synthesize_no_2_1.getPid());
|
|
|
serviceOne.setAid(synthesize_no_2_1.getBuildingTypeId());
|
|
|
serviceOne.setNo11(serviceOne.getNo11());
|
|
|
serviceOne.setNo22(serviceOne.getNo22());
|
|
|
serviceOne.setNo33(serviceOne.getNo33());
|
|
|
serviceOne.setNo44(serviceOne.getNo44());
|
|
|
calculateLoadService.updateById(serviceOne);
|
|
|
} else {
|
|
|
calculateLoad.setId(synthesizeNo21.getId());
|
|
|
calculateLoad.setId(synthesize_no_2_1.getId());
|
|
|
calculateLoad.setNo1(Double.valueOf(df.format(annualTotalElectricityDemand)));
|
|
|
calculateLoad.setNo11(Double.valueOf(df.format(annualTotalElectricityDemand)));
|
|
|
calculateLoad.setNo2(Double.valueOf(df.format(annualTotalHeatRequirement)));
|
...
|
...
|
@@ -2081,8 +2099,8 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
calculateLoad.setNo33(Double.valueOf(df.format(annualTotalCoolingDemand)));
|
|
|
calculateLoad.setNo4(Double.valueOf(df.format(totalAnnualTotalHotWaterRequirement)));
|
|
|
calculateLoad.setNo44(Double.valueOf(df.format(totalAnnualTotalHotWaterRequirement)));
|
|
|
calculateLoad.setCid(synthesizeNo21.getPid());
|
|
|
calculateLoad.setAid(synthesizeNo21.getBuildingTypeId());
|
|
|
calculateLoad.setCid(synthesize_no_2_1.getPid());
|
|
|
calculateLoad.setAid(synthesize_no_2_1.getBuildingTypeId());
|
|
|
calculateLoadService.saveOrUpdate(calculateLoad);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -4293,4 +4311,671 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
equipmentCapacityVo.setList(list);
|
|
|
return equipmentCapacityVo;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void saveProject(Synthesize_no_1 synthesize_no_1, String synthesize_no_2_1, Double electricityAh, Double photovoltaicArea, Double windAh, Synthesize_no_1Img synthesize_no_1Img, Synthesize_no_2_2 synthesize_no_2_2, Synthesize_no_2_3 synthesize_no_2_3, Synthesize_no_2_5 synthesize_no_2_5, HotMsgDto hotMsgDto, ColdMsgDto coldMsgDto, HotWaterDto hotWaterDto) {
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_1.getId())) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_1.getProjectSite())) {
|
|
|
synthesize_no_1.setType("1");
|
|
|
synthesize_no_1.setTime(new Date());
|
|
|
synthesize_no_1.setDeleteState("3");
|
|
|
synthesize_no_1.setCountState("0");
|
|
|
synthesize_no_1.setUserId(UserContext.get().getId());
|
|
|
synthesize_no_1.setNewTime(new Date());
|
|
|
} /*else {
|
|
|
synthesize_no_1.setType("1");
|
|
|
synthesize_no_1.setTime(new Date());
|
|
|
synthesize_no_1.setDeleteState("3");
|
|
|
synthesize_no_1.setCountState("0");
|
|
|
synthesize_no_1.setUserId(JwtUtil.getUserId(request.getHeader("token")));
|
|
|
synthesize_no_1.setNewTime(new Date());
|
|
|
}*/
|
|
|
} else {
|
|
|
/**
|
|
|
* 修改 对条件设置的参数修正 热水定额 冷水初始温度 修改
|
|
|
*/
|
|
|
Synthesize_no_1 synthesizeNo1 = no_1Service.getById(synthesize_no_1.getId());
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_1.getProjectSite())) {
|
|
|
String site = synthesize_no_1.getProjectSite();
|
|
|
Synthesize_no_2_6 byId = synthesize_no_2_6Service.getById(synthesize_no_1.getId());
|
|
|
if (org.springframework.util.StringUtils.isEmpty(byId)) {
|
|
|
byId = synthesize_no_2_6Service.getById("1");
|
|
|
}
|
|
|
CityDict cityDict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, site));
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1s = synthesize_no_2_1Service.list(new QueryWrapper<Synthesize_no_2_1>().lambda().eq(Synthesize_no_2_1::getPid, synthesize_no_1.getId()));//建筑
|
|
|
double electricity = 0.0;
|
|
|
double tall = 0.0;
|
|
|
double flat = 0.0;
|
|
|
double floor = 0.0;
|
|
|
if (!synthesize_no_2_1s.isEmpty()) {
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_11 : synthesize_no_2_1s) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_2_11.getBuildingTypeId())) {
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_11.getBuildingTypeId());
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
CalculateLoad calculateLoad = calculateLoadService.getById(synthesize_no_2_11.getId());
|
|
|
Electrovalence electrovalence = electrovalenceMapper.selectById(cityDict.getId());
|
|
|
if ("住宅".equals(sort.getName()) || "托幼".equals(sort.getName()) || "学校".equals(sort.getName())) {
|
|
|
tall += electrovalence.getNo1();
|
|
|
flat += electrovalence.getNo2();
|
|
|
floor += electrovalence.getNo3();
|
|
|
} else {
|
|
|
tall += electrovalence.getNo11();
|
|
|
flat += electrovalence.getNo22();
|
|
|
floor += electrovalence.getNo33();
|
|
|
}
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(calculateLoad)) {
|
|
|
if (calculateLoad.getNo4().equals(calculateLoad.getNo44())) {
|
|
|
electricity += hotWaterDataMapper.queryName(zd_name, cityDict.getId());
|
|
|
} else {
|
|
|
/**
|
|
|
* 年总需热水总量(调整值)*1000/(人数*365*0.9)
|
|
|
*/
|
|
|
electricity += calculateLoad.getNo44() * 1000 / (synthesize_no_2_11.getWaterPersonNum() * 365 * 0.9);
|
|
|
}
|
|
|
}
|
|
|
/*electricity += hotWaterDataMapper.queryName(zd_name, cityDict.getId());*/
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!synthesizeNo1.getProjectSite().equals(synthesize_no_1.getProjectSite())) {
|
|
|
byId.setId(synthesize_no_1.getId());
|
|
|
byId.setNo50(electricity);
|
|
|
byId.setNo51(Double.valueOf(coldWaterDataMapper.selectById(cityDict.getId()).getNo1()));
|
|
|
byId.setNo54(cpvAndCfmDataService.getById(cityDict.getId()).getNo7()); // 太阳能保证率
|
|
|
byId.setNo115(cpvAndCfmDataService.getById(cityDict.getId()).getNo6()); // 年平均太阳辐照量
|
|
|
byId.setNo122(cpvAndCfmDataService.getById(cityDict.getId()).getNo2()); // 太阳辐照度
|
|
|
byId.setNo123(cpvAndCfmDataService.getById(cityDict.getId()).getNo3());//年总光伏利用小时数
|
|
|
byId.setNo124(cpvAndCfmDataService.getById(cityDict.getId()).getNo5()); // 年总风机利用小时数
|
|
|
byId.setNo128(energySourcesMapper.selectById(cityDict.getId()).getNo2()); // 天然气价格
|
|
|
byId.setNo129(energySourcesMapper.selectById(cityDict.getId()).getNo1()); // 自来水价格
|
|
|
|
|
|
byId.setNo125(tall); // 高峰电价
|
|
|
byId.setNo126(flat); // 平时电价
|
|
|
byId.setNo127(floor); // 低谷电价
|
|
|
synthesize_no_2_6Service.saveOrUpdate(byId);
|
|
|
}
|
|
|
synthesize_no_1.setType(synthesizeNo1.getType());
|
|
|
synthesize_no_1.setDeleteState(synthesizeNo1.getDeleteState());
|
|
|
synthesize_no_1.setCountState(synthesizeNo1.getCountState());
|
|
|
synthesize_no_1.setUserId(synthesizeNo1.getUserId());
|
|
|
synthesize_no_1.setPtState(synthesizeNo1.getPtState());
|
|
|
synthesize_no_1.setAdminState(synthesizeNo1.getAdminState());
|
|
|
synthesize_no_1.setSuperAdminState(synthesizeNo1.getAdminState());
|
|
|
}
|
|
|
}
|
|
|
no_1Service.saveOrUpdate(synthesize_no_1);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_1.getId())) {
|
|
|
synthesize_no_1ImgService.saveOrUpdate(synthesize_no_1Img);
|
|
|
}
|
|
|
/**
|
|
|
* 建筑类型保存
|
|
|
*/
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_2_1))
|
|
|
no2_1Save(synthesize_no_2_1, electricityAh);
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(synthesize_no_2_2.getId())) {
|
|
|
synthesize_no_2_2Service.saveOrUpdate(synthesize_no_2_2);
|
|
|
}
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(synthesize_no_2_3.getId())) {
|
|
|
String s1 = JSON.toJSONString(hotMsgDto);
|
|
|
String s2 = JSON.toJSONString(coldMsgDto);
|
|
|
String s3 = JSON.toJSONString(hotWaterDto);
|
|
|
synthesize_no_2_3.setHotMsg(s1);
|
|
|
synthesize_no_2_3.setColdMsg(s2);
|
|
|
synthesize_no_2_3.setHotWaterMsg(s3);
|
|
|
synthesize_no_2_3Service.saveOrUpdate(synthesize_no_2_3);
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_2_4Service.getById(synthesize_no_2_3.getId()))) {
|
|
|
Synthesize_no_2_4 synthesize_no_2_4 = new Synthesize_no_2_4();
|
|
|
synthesize_no_2_4.setId(synthesize_no_2_3.getId());
|
|
|
synthesize_no_2_4.setWindAh(windAh);
|
|
|
synthesize_no_2_4.setPhotovoltaicArea(photovoltaicArea);
|
|
|
synthesize_no_2_4Service.saveOrUpdate(synthesize_no_2_4);
|
|
|
} else {
|
|
|
Synthesize_no_2_4 synthesize_no_2_4 = synthesize_no_2_4Service.getById(synthesize_no_2_3.getId());
|
|
|
synthesize_no_2_4.setWindAh(windAh);
|
|
|
synthesize_no_2_4.setPhotovoltaicArea(photovoltaicArea);
|
|
|
synthesize_no_2_4Service.saveOrUpdate(synthesize_no_2_4);
|
|
|
}
|
|
|
}
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(synthesize_no_2_5.getId()))
|
|
|
synthesize_no_2_5Service.saveOrUpdate(synthesize_no_2_5);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void no3_1GetTypeSave(String id, String synthesize_no_2_1, Synthesize_no_1Img synthesize_no_1Img, Synthesize_no_2_2 synthesize_no_2_2, Synthesize_no_2_3 synthesize_no_2_3, Double electricityAh, Double photovoltaicArea, Double windAh, Synthesize_no_2_5 synthesize_no_2_5, HotMsgDto hotMsgDto, ColdMsgDto coldMsgDto, HotWaterDto hotWaterDto) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_1Img.getId())) {
|
|
|
synthesize_no_1ImgService.saveOrUpdate(synthesize_no_1Img);
|
|
|
}
|
|
|
/**
|
|
|
* 建筑类型保存
|
|
|
*/
|
|
|
no2_1Save(synthesize_no_2_1, electricityAh);
|
|
|
Synthesize_no_1 synthesize_no_1 = no_1Service.getById(id);
|
|
|
String projectType = synthesize_no_1.getProjectType();
|
|
|
if ("2".equals(projectType))
|
|
|
synthesize_no_2_2Service.saveOrUpdate(synthesize_no_2_2);
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(synthesize_no_2_3.getId())) {
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1List = synthesize_no_2_1Service.list(new QueryWrapper<Synthesize_no_2_1>().lambda().eq(Synthesize_no_2_1::getPid, synthesize_no_1.getId()));
|
|
|
String[] split = synthesize_no_1.getEnergyType().split(",");
|
|
|
for (String s : split) {
|
|
|
if ("2".equals(s)) {
|
|
|
/**
|
|
|
* 供热比例计算
|
|
|
*/
|
|
|
double hotPercentage = hotMsgDto.getHotA() + hotMsgDto.getHotB() + hotMsgDto.getHotC() + hotMsgDto.getHotD() + hotMsgDto.getHotE();
|
|
|
if (hotPercentage != 100) {
|
|
|
throw new BusinessException(CommonErrorCode.E_99999);
|
|
|
}
|
|
|
/**
|
|
|
* 计算 蓄热时间
|
|
|
* @description 0<蓄热时间 < 年供热量 * 1 0 0 0 / ( 供热面积 * 设计热负荷 ) / 1 3 0
|
|
|
*/
|
|
|
Double annualHeatSupply = 0.0; // 年供热量
|
|
|
Double heatingArea = 0.0; // 供热面积
|
|
|
Double designHeatLoad = 0.0; // 设计热负荷
|
|
|
Assert.notEmpty(synthesize_no_2_1List, "建筑类型出错了!");
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_ : synthesize_no_2_1List) {
|
|
|
CalculateLoad calculateLoad = calculateLoadService.getById(synthesize_no_2_.getId());
|
|
|
annualHeatSupply += calculateLoad.getNo22();
|
|
|
heatingArea += synthesize_no_2_.getHeatArea();
|
|
|
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, synthesize_no_1.getProjectSite()));//城市
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_.getBuildingTypeId());
|
|
|
Assert.notNull(synthesize_no_2_.getHeatEnd(), "末端形式选择出错了");
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
if ("1".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 散热器 数据库里面的值
|
|
|
*/
|
|
|
designHeatLoad += (double) hotLoadDataMapper.queryName(zd_name, dict.getId());
|
|
|
} else if ("2".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 地暖
|
|
|
* * 0.9
|
|
|
*/
|
|
|
designHeatLoad += hotLoadDataMapper.queryName(zd_name, dict.getId()) * 0.9;
|
|
|
} else if ("3".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 等级盘管
|
|
|
* * 2
|
|
|
*/
|
|
|
designHeatLoad += (double) (hotLoadDataMapper.queryName(zd_name, dict.getId()) * 2);
|
|
|
}
|
|
|
}
|
|
|
double v = annualHeatSupply * 1000 / (heatingArea * designHeatLoad) / 130;
|
|
|
log.info("蓄热时间范围 V {}", v);
|
|
|
if (Double.isNaN(v)) {
|
|
|
v = 0;
|
|
|
}
|
|
|
Assert.notNull(hotMsgDto.getHotF(), "蓄热出错");
|
|
|
if (hotMsgDto.getHotF() < 0 || hotMsgDto.getHotF() > v) {
|
|
|
throw new IllegalArgumentException("蓄热时间填写错误,范围应该在0 - " + v);
|
|
|
}
|
|
|
/**
|
|
|
* 蓄热做一个限制,出水温度不能低于进水温度
|
|
|
*/
|
|
|
Synthesize_no_2_6 synthesize_no_2_6 = synthesize_no_2_6Service.getById(synthesize_no_2_3.getId());
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_2_6)) {
|
|
|
Synthesize_no_2_6 synthesize_no_2_61 = synthesize_no_2_6Service.getById("1");
|
|
|
if (synthesize_no_2_61.getNo52() <= hotMsgDto.getHotG()) {
|
|
|
throw new IllegalArgumentException("供热温度填写有误,范围不得大于等于" + synthesize_no_2_61.getNo52());
|
|
|
}
|
|
|
} else {
|
|
|
if (synthesize_no_2_6.getNo52() <= hotMsgDto.getHotG()) {
|
|
|
throw new IllegalArgumentException("供热温度填写有误,范围不得大于等于" + synthesize_no_2_6.getNo52());
|
|
|
}
|
|
|
}
|
|
|
} else if ("3".equals(s)) {
|
|
|
/**
|
|
|
* 供冷比例计算
|
|
|
*/
|
|
|
double coldPercentage = coldMsgDto.getColdA() + coldMsgDto.getColdB() + coldMsgDto.getColdC() + coldMsgDto.getColdD();
|
|
|
if (coldPercentage != 100) {
|
|
|
throw new BusinessException(CommonErrorCode.E_99999);
|
|
|
}
|
|
|
/**
|
|
|
* 计算 蓄冷时间
|
|
|
* @description 0<蓄冷时间 < 年供冷量 * 1 0 0 0 / ( 供冷面积 * 设计冷负荷 ) / 1 5 0
|
|
|
*/
|
|
|
Double annualCoolingCapacity = 0.0; // 年供热量
|
|
|
Double coolingArea = 0.0; // 供热面积
|
|
|
Double designCoolingLoad = 0.0; // 设计热负荷
|
|
|
Assert.notEmpty(synthesize_no_2_1List, "建筑类型出错了!");
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_ : synthesize_no_2_1List) {
|
|
|
CalculateLoad calculateLoad = calculateLoadService.getById(synthesize_no_2_.getId());
|
|
|
annualCoolingCapacity += calculateLoad.getNo22();
|
|
|
coolingArea += synthesize_no_2_.getHeatArea();
|
|
|
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, synthesize_no_1.getProjectSite()));//城市
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_.getBuildingTypeId());
|
|
|
Assert.notNull(synthesize_no_2_.getHeatEnd(), "末端形式选择出错了");
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
if ("1".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 散热器 数据库里面的值
|
|
|
*/
|
|
|
designCoolingLoad += (double) hotLoadDataMapper.queryName(zd_name, dict.getId());
|
|
|
} else if ("2".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 地暖
|
|
|
* * 0.9
|
|
|
*/
|
|
|
designCoolingLoad += hotLoadDataMapper.queryName(zd_name, dict.getId()) * 0.9;
|
|
|
} else if ("3".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 等级盘管
|
|
|
* * 2
|
|
|
*/
|
|
|
designCoolingLoad += (double) (hotLoadDataMapper.queryName(zd_name, dict.getId()) * 2);
|
|
|
}
|
|
|
}
|
|
|
double v = annualCoolingCapacity * 1000 / (coolingArea * designCoolingLoad) / 150;
|
|
|
log.info("蓄冷时间范围 V {}", v);
|
|
|
if (Double.isNaN(v)) {
|
|
|
v = 0;
|
|
|
}
|
|
|
Assert.notNull(coldMsgDto.getColdE(), "蓄冷时间出错");
|
|
|
if (coldMsgDto.getColdE() < 0 || coldMsgDto.getColdE() > v) {
|
|
|
throw new IllegalArgumentException("蓄冷时间填写错误,范围应该在0 - " + v);
|
|
|
}
|
|
|
/**
|
|
|
* 蓄冷这做一个限制,供冷温度不能高于冷水温度
|
|
|
*/
|
|
|
Synthesize_no_2_6 synthesize_no_2_6 = synthesize_no_2_6Service.getById(synthesize_no_2_3.getId());
|
|
|
String site = synthesize_no_1.getProjectSite();
|
|
|
CityDict cityDict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, site));
|
|
|
Integer no1 = coldWaterDataMapper.selectById(cityDict.getId()).getNo1();
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_2_6)) {
|
|
|
if (no1 <= coldMsgDto.getColdF()) {
|
|
|
throw new IllegalArgumentException("供冷温度填写有误,范围不得大于等于" + no1);
|
|
|
}
|
|
|
} else {
|
|
|
if (org.springframework.util.StringUtils.isEmpty(coldMsgDto.getColdF())) {
|
|
|
coldMsgDto.setColdF(0.0);
|
|
|
}
|
|
|
if (synthesize_no_2_6.getNo51() <= coldMsgDto.getColdF()) {
|
|
|
throw new IllegalArgumentException("供冷温度填写有误,范围不得大于等于" + synthesize_no_2_6.getNo51());
|
|
|
}
|
|
|
}
|
|
|
} else if ("4".equals(s)) {
|
|
|
/**
|
|
|
* 热水比例计算
|
|
|
*/
|
|
|
double hotWaterRatio = hotWaterDto.getHotWaterA() + hotWaterDto.getHotWaterB() + hotWaterDto.getHotWaterC();
|
|
|
if (hotWaterRatio != 100) {
|
|
|
throw new BusinessException(CommonErrorCode.E_99999);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
String s1 = JSON.toJSONString(hotMsgDto);
|
|
|
String s2 = JSON.toJSONString(coldMsgDto);
|
|
|
String s3 = JSON.toJSONString(hotWaterDto);
|
|
|
synthesize_no_2_3.setHotMsg(s1);
|
|
|
synthesize_no_2_3.setColdMsg(s2);
|
|
|
synthesize_no_2_3.setHotWaterMsg(s3);
|
|
|
synthesize_no_2_3Service.saveOrUpdate(synthesize_no_2_3);
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_2_4Service.getById(synthesize_no_2_3.getId()))) {
|
|
|
Synthesize_no_2_4 synthesize_no_2_4 = new Synthesize_no_2_4();
|
|
|
synthesize_no_2_4.setId(synthesize_no_2_3.getId());
|
|
|
synthesize_no_2_4.setWindAh(windAh);
|
|
|
synthesize_no_2_4.setPhotovoltaicArea(photovoltaicArea);
|
|
|
synthesize_no_2_4Service.saveOrUpdate(synthesize_no_2_4);
|
|
|
} else {
|
|
|
Synthesize_no_2_4 synthesize_no_2_4 = synthesize_no_2_4Service.getById(synthesize_no_2_3.getId());
|
|
|
synthesize_no_2_4.setWindAh(windAh);
|
|
|
synthesize_no_2_4.setPhotovoltaicArea(photovoltaicArea);
|
|
|
synthesize_no_2_4Service.saveOrUpdate(synthesize_no_2_4);
|
|
|
}
|
|
|
}
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(synthesize_no_2_5.getId()))
|
|
|
synthesize_no_2_5Service.saveOrUpdate(synthesize_no_2_5);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Boolean no2_6ResetType(String id) {
|
|
|
Synthesize_no_2_6 byId = synthesize_no_2_6Service.getById("1");
|
|
|
/**
|
|
|
* 修改 对条件设置的参数修正 热水定额 冷水初始温度 修改
|
|
|
*/
|
|
|
Synthesize_no_1 synthesize_no_1 = no_1Service.getById(id);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_1.getProjectSite())) {
|
|
|
String site = synthesize_no_1.getProjectSite();
|
|
|
CityDict cityDict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, site));
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1s = synthesize_no_2_1Service.list(new QueryWrapper<Synthesize_no_2_1>().lambda().eq(Synthesize_no_2_1::getPid, synthesize_no_1.getId()));//建筑
|
|
|
double electricity = 0.0;
|
|
|
double tall = 0.0;
|
|
|
double flat = 0.0;
|
|
|
double floor = 0.0;
|
|
|
if (!synthesize_no_2_1s.isEmpty()) {
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_11 : synthesize_no_2_1s) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_2_11.getBuildingTypeId())) {
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_11.getBuildingTypeId());
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
CalculateLoad calculateLoad = calculateLoadService.getOne(new QueryWrapper<CalculateLoad>().lambda().eq(CalculateLoad::getCid, synthesize_no_1.getId()).eq(CalculateLoad::getAid, sort.getId()));
|
|
|
Electrovalence electrovalence = electrovalenceMapper.selectById(cityDict.getId());
|
|
|
if ("住宅".equals(sort.getName()) || "托幼".equals(sort.getName()) || "学校".equals(sort.getName())) {
|
|
|
tall += electrovalence.getNo1();
|
|
|
flat += electrovalence.getNo2();
|
|
|
floor += electrovalence.getNo3();
|
|
|
} else {
|
|
|
tall += electrovalence.getNo11();
|
|
|
flat += electrovalence.getNo22();
|
|
|
floor += electrovalence.getNo33();
|
|
|
}
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(calculateLoad)) {
|
|
|
if (calculateLoad.getNo4().equals(calculateLoad.getNo44())) {
|
|
|
electricity += hotWaterDataMapper.queryName(zd_name, cityDict.getId());
|
|
|
} else {
|
|
|
/**
|
|
|
* 年总需热水总量(调整值)*1000/(人数*365*0.9)
|
|
|
*/
|
|
|
electricity += calculateLoad.getNo44() * 1000 / (synthesize_no_2_11.getWaterPersonNum() * 365 * 0.9);
|
|
|
}
|
|
|
}
|
|
|
/*electricity += hotWaterDataMapper.queryName(zd_name, cityDict.getId());*/
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
byId.setNo50(electricity);
|
|
|
byId.setNo51(Double.valueOf(coldWaterDataMapper.selectById(cityDict.getId()).getNo1()));// 冷水初始温度
|
|
|
byId.setNo54(cpvAndCfmDataService.getById(cityDict.getId()).getNo7()); // 太阳能保证率
|
|
|
byId.setNo115(cpvAndCfmDataService.getById(cityDict.getId()).getNo6()); // 年平均太阳辐照量
|
|
|
byId.setNo122(cpvAndCfmDataService.getById(cityDict.getId()).getNo2()); // 太阳辐照度
|
|
|
byId.setNo123(cpvAndCfmDataService.getById(cityDict.getId()).getNo3());//年总光伏利用小时数
|
|
|
byId.setNo124(cpvAndCfmDataService.getById(cityDict.getId()).getNo5()); // 年总风机利用小时数
|
|
|
byId.setNo125(tall); // 高峰电价
|
|
|
byId.setNo126(flat); // 平时电价
|
|
|
byId.setNo127(floor); // 低谷电价
|
|
|
byId.setNo128(energySourcesMapper.selectById(cityDict.getId()).getNo2()); // 天然气价格
|
|
|
byId.setNo129(energySourcesMapper.selectById(cityDict.getId()).getNo1()); // 自来水价格
|
|
|
byId.setId(id);
|
|
|
}
|
|
|
return synthesize_no_2_6Service.updateById(byId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Boolean no2_3Save(Synthesize_no_2_3 synthesize_no_2_3, Double photovoltaicArea, Double windAh, HotMsgDto hotMsgDto, ColdMsgDto coldMsgDto, HotWaterDto hotWaterDto) {
|
|
|
/**
|
|
|
* 光伏可利用面积 风电装机容量
|
|
|
*/
|
|
|
Synthesize_no_2_4 synthesize_no_2_4 = new Synthesize_no_2_4();
|
|
|
synthesize_no_2_4.setId(synthesize_no_2_3.getId());
|
|
|
synthesize_no_2_4.setPhotovoltaicArea(photovoltaicArea);
|
|
|
synthesize_no_2_4.setWindAh(windAh);
|
|
|
synthesize_no_2_4Service.saveOrUpdate(synthesize_no_2_4);
|
|
|
Synthesize_no_1 synthesize_no_1 = no_1Service.getById(synthesize_no_2_3.getId());
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1List = synthesize_no_2_1Service.list(new QueryWrapper<Synthesize_no_2_1>().lambda().eq(Synthesize_no_2_1::getPid, synthesize_no_1.getId()));
|
|
|
String[] split = synthesize_no_1.getEnergyType().split(",");
|
|
|
for (String s : split) {
|
|
|
if ("2".equals(s)) {
|
|
|
/**
|
|
|
* 供热比例计算
|
|
|
*/
|
|
|
double hotPercentage = hotMsgDto.getHotA() + hotMsgDto.getHotB() + hotMsgDto.getHotC() + hotMsgDto.getHotD() + hotMsgDto.getHotE();
|
|
|
if (hotPercentage != 100) {
|
|
|
throw new BusinessException(CommonErrorCode.E_99999);
|
|
|
}
|
|
|
/**
|
|
|
* 计算 蓄热时间
|
|
|
* @description 0<蓄热时间 < 年供热量 * 1 0 0 0 / ( 供热面积 * 设计热负荷 ) / 1 3 0
|
|
|
*/
|
|
|
Double annualHeatSupply = 0.0; // 年供热量
|
|
|
Double heatingArea = 0.0; // 供热面积
|
|
|
Double designHeatLoad = 0.0; // 设计热负荷
|
|
|
Assert.notEmpty(synthesize_no_2_1List, "建筑类型出错了!");
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_ : synthesize_no_2_1List) {
|
|
|
CalculateLoad calculateLoad = calculateLoadService.getById(synthesize_no_2_.getId());
|
|
|
annualHeatSupply += calculateLoad.getNo22();
|
|
|
heatingArea += synthesize_no_2_.getHeatArea();
|
|
|
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, synthesize_no_1.getProjectSite()));//城市
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_.getBuildingTypeId());
|
|
|
Assert.notNull(synthesize_no_2_.getHeatEnd(), "末端形式选择出错了");
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
if ("1".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 散热器 数据库里面的值
|
|
|
*/
|
|
|
designHeatLoad += (double) hotLoadDataMapper.queryName(zd_name, dict.getId());
|
|
|
} else if ("2".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 地暖
|
|
|
* * 0.9
|
|
|
*/
|
|
|
designHeatLoad += hotLoadDataMapper.queryName(zd_name, dict.getId()) * 0.9;
|
|
|
} else if ("3".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 等级盘管
|
|
|
* * 2
|
|
|
*/
|
|
|
designHeatLoad += (double) (hotLoadDataMapper.queryName(zd_name, dict.getId()) * 2);
|
|
|
}
|
|
|
}
|
|
|
double v = annualHeatSupply * 1000 / (heatingArea * designHeatLoad) / 130;
|
|
|
log.info("蓄热时间 范围 v {}", v);
|
|
|
if (Double.isNaN(v)) {
|
|
|
v = 0;
|
|
|
}
|
|
|
Assert.notNull(hotMsgDto.getHotF(), "蓄热出错");
|
|
|
if (hotMsgDto.getHotF() < 0 || hotMsgDto.getHotF() > v) {
|
|
|
throw new IllegalArgumentException("蓄热时间填写错误,范围应该在0 - " + v);
|
|
|
}
|
|
|
/**
|
|
|
* 蓄热做一个限制,出水温度不能低于进水温度
|
|
|
*/
|
|
|
Synthesize_no_2_6 synthesize_no_2_6 = synthesize_no_2_6Service.getById(synthesize_no_2_3.getId());
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_2_6)) {
|
|
|
Synthesize_no_2_6 synthesize_no_2_61 = synthesize_no_2_6Service.getById("1");
|
|
|
if (synthesize_no_2_61.getNo52() <= hotMsgDto.getHotG()) {
|
|
|
throw new IllegalArgumentException("供热温度填写有误,范围不得大于等于" + synthesize_no_2_61.getNo52());
|
|
|
}
|
|
|
} else {
|
|
|
if (synthesize_no_2_6.getNo52() <= hotMsgDto.getHotG()) {
|
|
|
throw new IllegalArgumentException("供热温度填写有误,范围不得大于等于" + synthesize_no_2_6.getNo52());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} else if ("3".equals(s)) {
|
|
|
/**
|
|
|
* 供冷比例计算
|
|
|
*/
|
|
|
double coldPercentage = coldMsgDto.getColdA() + coldMsgDto.getColdB() + coldMsgDto.getColdC() + coldMsgDto.getColdD();
|
|
|
if (coldPercentage != 100) {
|
|
|
throw new BusinessException(CommonErrorCode.E_99999);
|
|
|
}
|
|
|
/**
|
|
|
* 计算 蓄冷时间
|
|
|
* @description 0<蓄冷时间 < 年供冷量 * 1 0 0 0 / ( 供冷面积 * 设计冷负荷 ) / 1 5 0
|
|
|
*/
|
|
|
Double annualCoolingCapacity = 0.0; // 年供热量
|
|
|
Double coolingArea = 0.0; // 供热面积
|
|
|
Double designCoolingLoad = 0.0; // 设计热负荷
|
|
|
Assert.notEmpty(synthesize_no_2_1List, "建筑类型出错了!");
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_ : synthesize_no_2_1List) {
|
|
|
CalculateLoad calculateLoad = calculateLoadService.getById(synthesize_no_2_.getId());
|
|
|
annualCoolingCapacity += calculateLoad.getNo22();
|
|
|
coolingArea += synthesize_no_2_.getHeatArea();
|
|
|
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, synthesize_no_1.getProjectSite()));//城市
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_.getBuildingTypeId());
|
|
|
Assert.notNull(synthesize_no_2_.getHeatEnd(), "末端形式选择出错了");
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
if ("1".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 散热器 数据库里面的值
|
|
|
*/
|
|
|
designCoolingLoad += (double) hotLoadDataMapper.queryName(zd_name, dict.getId());
|
|
|
} else if ("2".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 地暖
|
|
|
* * 0.9
|
|
|
*/
|
|
|
designCoolingLoad += hotLoadDataMapper.queryName(zd_name, dict.getId()) * 0.9;
|
|
|
} else if ("3".equals(synthesize_no_2_.getHeatEnd())) {
|
|
|
/**
|
|
|
* 等级盘管
|
|
|
* * 2
|
|
|
*/
|
|
|
designCoolingLoad += (double) (hotLoadDataMapper.queryName(zd_name, dict.getId()) * 2);
|
|
|
}
|
|
|
}
|
|
|
double v = annualCoolingCapacity * 1000 / (coolingArea * designCoolingLoad) / 150;
|
|
|
log.info("蓄冷时间 范围 v {}", v);
|
|
|
if (Double.isNaN(v)) {
|
|
|
v = 0;
|
|
|
}
|
|
|
Assert.notNull(coldMsgDto.getColdE(), "蓄冷时间出错");
|
|
|
if (coldMsgDto.getColdE() < 0 || coldMsgDto.getColdE() > v) {
|
|
|
throw new IllegalArgumentException("蓄冷时间填写错误,范围应该在0 - " + v);
|
|
|
}
|
|
|
/**
|
|
|
* 蓄冷这做一个限制,供冷温度不能高于冷水温度
|
|
|
*/
|
|
|
Synthesize_no_2_6 synthesize_no_2_6 = synthesize_no_2_6Service.getById(synthesize_no_2_3.getId());
|
|
|
String site = synthesize_no_1.getProjectSite();
|
|
|
CityDict cityDict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, site));
|
|
|
Integer no1 = coldWaterDataMapper.selectById(cityDict.getId()).getNo1();
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_2_6)) {
|
|
|
if (no1 <= coldMsgDto.getColdF()) {
|
|
|
throw new IllegalArgumentException("供冷温度填写有误,范围不得大于等于" + no1);
|
|
|
}
|
|
|
} else {
|
|
|
if (org.springframework.util.StringUtils.isEmpty(coldMsgDto.getColdF())) {
|
|
|
coldMsgDto.setColdF(0.0);
|
|
|
}
|
|
|
if (synthesize_no_2_6.getNo51() <= coldMsgDto.getColdF()) {
|
|
|
throw new IllegalArgumentException("供冷温度填写有误,范围不得大于等于" + synthesize_no_2_6.getNo51());
|
|
|
}
|
|
|
}
|
|
|
} else if ("4".equals(s)) {
|
|
|
/**
|
|
|
* 热水比例计算
|
|
|
*/
|
|
|
double hotWaterRatio = hotWaterDto.getHotWaterA() + hotWaterDto.getHotWaterB() + hotWaterDto.getHotWaterC();
|
|
|
if (hotWaterRatio != 100) {
|
|
|
throw new BusinessException(CommonErrorCode.E_99999);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
String s1 = JSON.toJSONString(hotMsgDto);
|
|
|
String s2 = JSON.toJSONString(coldMsgDto);
|
|
|
String s3 = JSON.toJSONString(hotWaterDto);
|
|
|
synthesize_no_2_3.setHotMsg(s1);
|
|
|
synthesize_no_2_3.setColdMsg(s2);
|
|
|
synthesize_no_2_3.setHotWaterMsg(s3);
|
|
|
return synthesize_no_2_3Service.saveOrUpdate(synthesize_no_2_3);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<ClientNameDto> no1getName(String name) {
|
|
|
String userId = UserContext.get().getId();
|
|
|
List<Synthesize_no_1ClientName> list = synthesize_no_1ClientNameService.list(new LambdaQueryWrapper<Synthesize_no_1ClientName>().eq(Synthesize_no_1ClientName::getUserId, userId).ne(Synthesize_no_1ClientName::getDeleteState, "1")
|
|
|
.orderByDesc(Synthesize_no_1ClientName::getNewTime).like(org.apache.commons.lang3.StringUtils.isNotBlank(name), Synthesize_no_1ClientName::getName, name));
|
|
|
List<ClientNameDto> names = new ArrayList<>();
|
|
|
for (Synthesize_no_1ClientName synthesize_no_1ClientName : list) {
|
|
|
ClientNameDto clientNameDto = new ClientNameDto();
|
|
|
clientNameDto.setId(synthesize_no_1ClientName.getId());
|
|
|
clientNameDto.setName(synthesize_no_1ClientName.getName());
|
|
|
names.add(clientNameDto);
|
|
|
}
|
|
|
return names;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String no1Save(Synthesize_no_1 synthesize_no_1) {
|
|
|
if (org.springframework.util.StringUtils.isEmpty(synthesize_no_1.getId())) {
|
|
|
synthesize_no_1.setType("1");
|
|
|
synthesize_no_1.setTime(new Date());
|
|
|
synthesize_no_1.setDeleteState("3");
|
|
|
synthesize_no_1.setCountState("0");
|
|
|
synthesize_no_1.setUserId(UserContext.get().getId());
|
|
|
synthesize_no_1.setNewTime(new Date());
|
|
|
synthesize_no_1.setFlagCalculate("2");
|
|
|
} else {
|
|
|
/**
|
|
|
* 修改 对条件设置的参数修正 热水定额 冷水初始温度 修改
|
|
|
*/
|
|
|
Synthesize_no_1 synthesizeNo1 = no_1Service.getById(synthesize_no_1.getId());
|
|
|
/**
|
|
|
* 判断 两次选择的地区是否一样 不一样就行修改取最新
|
|
|
*/
|
|
|
if (!synthesize_no_1.getProjectSite().equals(synthesizeNo1.getProjectSite())) {
|
|
|
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, synthesize_no_1.getProjectSite()));//城市
|
|
|
HeatIngData heatIngData = heatIngDataMapper.selectById(dict.getId());
|
|
|
/**
|
|
|
* 在次判断 synthesize_no_2_1 是否存在
|
|
|
*/
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1s = synthesize_no_2_1Service.list(new LambdaQueryWrapper<Synthesize_no_2_1>().eq(Synthesize_no_2_1::getPid, synthesize_no_1.getId()));
|
|
|
if (!synthesize_no_2_1s.isEmpty()) {
|
|
|
for (Synthesize_no_2_1 synthesize_no_2_1 : synthesize_no_2_1s) {
|
|
|
/**
|
|
|
* 修改供热天数
|
|
|
*/
|
|
|
synthesize_no_2_1.setHeatDay(Double.valueOf(heatIngData.getNo3()));
|
|
|
synthesize_no_2_1Service.updateById(synthesize_no_2_1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(synthesize_no_1.getProjectSite())) {
|
|
|
String site = synthesize_no_1.getProjectSite();
|
|
|
Synthesize_no_2_6 byId = synthesize_no_2_6Service.getById(synthesize_no_1.getId());
|
|
|
if (org.springframework.util.StringUtils.isEmpty(byId)) {
|
|
|
byId = synthesize_no_2_6Service.getById("1");
|
|
|
}
|
|
|
CityDict cityDict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, site));
|
|
|
List<Synthesize_no_2_1> synthesize_no_2_1s = synthesize_no_2_1Service.list(new QueryWrapper<Synthesize_no_2_1>().lambda().eq(Synthesize_no_2_1::getPid, synthesize_no_1.getId()));//建筑
|
|
|
double electricity = 0.0;
|
|
|
double tall = 0.0;
|
|
|
double flat = 0.0;
|
|
|
double floor = 0.0;
|
|
|
if (!synthesize_no_2_1s.isEmpty()) {
|
|
|
for (int i = 0; i < synthesize_no_2_1s.size(); i++) {
|
|
|
Sort sort = sortMapper.selectById(synthesize_no_2_1s.get(i).getBuildingTypeId());
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(sort)) {
|
|
|
String zd_name = "no_" + sort.getId();
|
|
|
CalculateLoad calculateLoad = calculateLoadService.getById(synthesize_no_2_1s.get(i).getId());
|
|
|
Electrovalence electrovalence = electrovalenceMapper.selectById(cityDict.getId());
|
|
|
if ("住宅".equals(sort.getName()) || "托幼".equals(sort.getName()) || "学校".equals(sort.getName())) {
|
|
|
tall += electrovalence.getNo1();
|
|
|
flat += electrovalence.getNo2();
|
|
|
floor += electrovalence.getNo3();
|
|
|
} else {
|
|
|
tall += electrovalence.getNo11();
|
|
|
flat += electrovalence.getNo22();
|
|
|
floor += electrovalence.getNo33();
|
|
|
}
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(calculateLoad)) {
|
|
|
if (calculateLoad.getNo4().equals(calculateLoad.getNo44())) {
|
|
|
electricity += hotWaterDataMapper.queryName(zd_name, cityDict.getId());
|
|
|
} else {
|
|
|
/**
|
|
|
* 年总需热水总量(调整值)*1000/(人数*365*0.9)
|
|
|
*
|
|
|
*/
|
|
|
electricity += calculateLoad.getNo44() * 1000 / (synthesize_no_2_1s.get(i).getWaterPersonNum() * 365 * 0.9);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
byId.setId(synthesize_no_1.getId());
|
|
|
byId.setNo50(electricity);// 热水定额
|
|
|
byId.setNo51(Double.valueOf(coldWaterDataMapper.selectById(cityDict.getId()).getNo1()));// 冷水初始温度
|
|
|
byId.setNo54(cpvAndCfmDataService.getById(cityDict.getId()).getNo7()); // 太阳能保证率
|
|
|
byId.setNo115(cpvAndCfmDataService.getById(cityDict.getId()).getNo6()); // 年平均太阳辐照量
|
|
|
byId.setNo122(cpvAndCfmDataService.getById(cityDict.getId()).getNo2()); // 太阳辐照度
|
|
|
byId.setNo123(cpvAndCfmDataService.getById(cityDict.getId()).getNo3());//年总光伏利用小时数
|
|
|
byId.setNo124(cpvAndCfmDataService.getById(cityDict.getId()).getNo5()); // 年总风机利用小时数
|
|
|
byId.setNo125(tall); // 高峰电价
|
|
|
byId.setNo126(flat); // 平时电价
|
|
|
byId.setNo127(floor); // 低谷电价
|
|
|
byId.setNo128(energySourcesMapper.selectById(cityDict.getId()).getNo2()); // 天然气价格
|
|
|
byId.setNo129(energySourcesMapper.selectById(cityDict.getId()).getNo1()); // 自来水价格
|
|
|
synthesize_no_1.setType(synthesizeNo1.getType());
|
|
|
synthesize_no_1.setDeleteState(synthesizeNo1.getDeleteState());
|
|
|
synthesize_no_1.setCountState(synthesizeNo1.getCountState());
|
|
|
synthesize_no_1.setUserId(synthesizeNo1.getUserId());
|
|
|
synthesize_no_1.setPtState(synthesizeNo1.getPtState());
|
|
|
synthesize_no_1.setAdminState(synthesizeNo1.getAdminState());
|
|
|
synthesize_no_1.setSuperAdminState(synthesizeNo1.getAdminState());
|
|
|
synthesize_no_2_6Service.saveOrUpdate(byId);
|
|
|
}
|
|
|
}
|
|
|
return no_1Service.saveOrUpdate(synthesize_no_1) ? synthesize_no_1.getId() : "保存失败";
|
|
|
}
|
|
|
} |
...
|
...
|
|