作者 kgy

bug修改 吨转万吨

package com.synthesize_energy.item.event;
import com.synthesize_energy.item.entity.Synthesize_no_2_1;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
/**
* @author kgy
* @version 1.0
* @date 2020/10/27 16:11
*/
@Data
@AllArgsConstructor
public class No3_1_1GetTypeEvent {
private List<Synthesize_no_2_1> synthesize_no_2_1s;
}
... ...
... ... @@ -30,19 +30,29 @@ public class No2_1SaveListener {
* 对数据进行判断
*/
for (Synthesize_no_2_1 synthesize_no_2_1 : synthesize_no_2_1s) {
boolean flag = false;
Map<String, Object> buildingTypeToIndex = synthesize_no_2_6Service.getBuildingTypeToIndex(synthesize_no_2_1.getBuildingTypeId(), synthesize_no_2_1.getPid());
if (Objects.isNull(synthesize_no_2_1.getDesignElectricLoadIndex())) {
flag = true;
synthesize_no_2_1.setDesignElectricLoadIndex(Double.valueOf(buildingTypeToIndex.get("designElectricLoadIndex").toString()));
}
if (Objects.isNull(synthesize_no_2_1.getDesignHeatLoadIndex())) {
flag = true;
synthesize_no_2_1.setDesignHeatLoadIndex(Double.valueOf(buildingTypeToIndex.get("designHeatLoadIndex").toString()));
}
if (Objects.isNull(synthesize_no_2_1.getDesignCoolingLoadIndex())) {
flag = true;
synthesize_no_2_1.setDesignCoolingLoadIndex(Double.valueOf(buildingTypeToIndex.get("designCoolingLoadIndex").toString()));
}
if (Objects.isNull(synthesize_no_2_1.getHotWaterQuota())) {
flag = true;
synthesize_no_2_1.setHotWaterQuota(Double.valueOf(buildingTypeToIndex.get("hotWaterQuota").toString()));
}
if (flag){
/**
* 进行保存
*/
}
}
}
... ...
package com.synthesize_energy.item.listener;
import com.synthesize_energy.item.entity.Synthesize_no_2_1;
import com.synthesize_energy.item.event.No2_1SaveEvent;
import com.synthesize_energy.item.event.No3_1_1GetTypeEvent;
import com.synthesize_energy.item.mapper.Synthesize_no_2_1Mapper;
import com.synthesize_energy.item.web.service.Synthesize_no_2_1Service;
import com.synthesize_energy.item.web.service.Synthesize_no_2_6Service;
import lombok.AllArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author kgy
* @version 1.0
* @date 2020/10/27 16:11
*/
@Component("defaultNo3_1_1GetTypeListener")
@AllArgsConstructor
public class No3_1_1GetTypeListener {
private final Synthesize_no_2_6Service synthesize_no_2_6Service;
private final Synthesize_no_2_1Service synthesize_no_2_1Service;
@EventListener(No3_1_1GetTypeEvent.class)
public void defaultNo2_1SaveListener(No3_1_1GetTypeEvent event) {
List<Synthesize_no_2_1> synthesize_no_2_1s = event.getSynthesize_no_2_1s();
/**
* 对数据进行判断
*/
for (Synthesize_no_2_1 synthesize_no_2_1 : synthesize_no_2_1s) {
boolean flag = false;
Map<String, Object> buildingTypeToIndex = synthesize_no_2_6Service.getBuildingTypeToIndex(synthesize_no_2_1.getBuildingTypeId(), synthesize_no_2_1.getPid());
if (Objects.isNull(synthesize_no_2_1.getDesignElectricLoadIndex())) {
flag = true;
synthesize_no_2_1.setDesignElectricLoadIndex(Double.valueOf(buildingTypeToIndex.get("designElectricLoadIndex").toString()));
}
if (Objects.isNull(synthesize_no_2_1.getDesignHeatLoadIndex())) {
flag = true;
synthesize_no_2_1.setDesignHeatLoadIndex(Double.valueOf(buildingTypeToIndex.get("designHeatLoadIndex").toString()));
}
if (Objects.isNull(synthesize_no_2_1.getDesignCoolingLoadIndex())) {
flag = true;
synthesize_no_2_1.setDesignCoolingLoadIndex(Double.valueOf(buildingTypeToIndex.get("designCoolingLoadIndex").toString()));
}
if (Objects.isNull(synthesize_no_2_1.getHotWaterQuota())) {
flag = true;
synthesize_no_2_1.setHotWaterQuota(Double.valueOf(buildingTypeToIndex.get("hotWaterQuota").toString()));
}
if (flag){
/**
* 进行保存
*/
synthesize_no_2_1Service.saveOrUpdate(synthesize_no_2_1);
}
}
}
}
... ...
... ... @@ -7,7 +7,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
... ... @@ -18,7 +17,6 @@ import java.util.Map;
*/
@RestController
@RequestMapping("login")
@Slf4j
@Api(value = "登录接口", tags = "登录接口")
@AllArgsConstructor
public class LoginController {
... ...
... ... @@ -67,31 +67,35 @@ public class InformationBaseServiceImpl implements InformationBaseService {
throw new BusinessException(CommonErrorCode.E_100101);
}
CpvAndCfmData cpvAndCfmData = cpvAndCfmDataService.getById(dict.getId());
Map<String, Object> map = new HashMap<>(2);
Map<String, Object> map = new HashMap<>(4);
if (cpvAndCfmData.getNo2() >= num1) {
/**
* 最丰富地区
* 年总辐射量≥6300MJ/m2
*/
map.put("sting1", site + ":年总辐射量≥" + num1 + "MJ/m²,为最丰富地区");
map.put("sting2", "最丰富地区");
} else if (cpvAndCfmData.getNo2() > num2 && cpvAndCfmData.getNo2() < num1) {
/**
* 很丰富地区
* 年总辐射量5040~6300MJ/m2、
*/
map.put("sting1", site + ":年总辐射量" + num2 + "-" + num1 + "MJ/m²,为很丰富地区");
map.put("sting2", "很丰富地区");
} else if (cpvAndCfmData.getNo2() > num3 && cpvAndCfmData.getNo2() < num2) {
/**
* 丰富地区
* 年总辐射量3780~5040MJ/m2
*/
map.put("sting1", site + ":年总辐射量" + num3 + "-" + num2 + "MJ/m²,为较丰富地区");
map.put("sting2", "较丰富地区");
} else if (cpvAndCfmData.getNo2() < num3) {
/**
* 一般地区
* 年总辐射量<3780 MJ/m2
*/
map.put("sting1", site + ":年总辐射量<" + num3 + "MJ/m²,为一般地区");
map.put("sting2", "一般地区");
}
/**
* 一类地区
... ... @@ -112,12 +116,14 @@ public class InformationBaseServiceImpl implements InformationBaseService {
* 内蒙古自治区除赤峰市、通辽市、兴安盟、呼伦贝尔市以外的其他地区、新疆维吾尔自治区乌鲁木齐市、伊犁哈萨克族自治州、昌吉回族自治州、克拉玛依市、石河子市
*/
map.put("sting3", site + ":一类地区");
map.put("sting4", "一类地区");
} else if (Arrays.asList(array2).contains(site)) {
/**
* 二类地区
* 河北省张家口市、承德市;内蒙古自治区赤峰市、通辽市、兴安盟、呼伦贝尔市;甘肃省张掖市、嘉峪关市、酒泉市
*/
map.put("sting3", site + ":二类地区");
map.put("sting4", "二类地区");
} else if (Arrays.asList(array3).contains(site)) {
/**
* 三类地区
... ... @@ -128,12 +134,14 @@ public class InformationBaseServiceImpl implements InformationBaseService {
* 宁夏回族自治区
*/
map.put("sting3", site + ":三类地区");
map.put("sting4", "三类地区");
} else {
/**
* 四类地区
* 除以上地区,其他均为四类
*/
map.put("string3", site + ":四类地区");
map.put("sting4", "四类地区");
}
return map;
}
... ...
... ... @@ -13,6 +13,7 @@ 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.event.No3_1_1GetTypeEvent;
import com.synthesize_energy.item.mapper.*;
import com.synthesize_energy.item.utils.JwtUtil;
import com.synthesize_energy.item.utils.UserContext;
... ... @@ -164,11 +165,11 @@ public class ProjectServiceImpl implements ProjectService {
/**
* 光伏
*/
no_3_1Dto.setPhotovoltaicResources(map.get("sting1").toString());
no_3_1Dto.setPhotovoltaicResources(map.get("sting2").toString());
/**
* 风
*/
no_3_1Dto.setWindResource(map.get("string3").toString());
no_3_1Dto.setWindResource(map.get("sting4").toString());
CityDict dict = cityDictService.getOne(new QueryWrapper<CityDict>().lambda().eq(CityDict::getName, byId.getProjectSite()));
//CpvAndCfmData cfmData = cpvAndCfmDataService.getById(dict.getId());
Synthesize_no_2_6 synthesize_no_2_6 = synthesize_no_2_6Service.getById(id);
... ... @@ -1741,19 +1742,27 @@ public class ProjectServiceImpl implements ProjectService {
if (savingStandardCoal == 0) {
map.put("num1", 0 + "吨");
} else {
map.put("num1", df.format(savingStandardCoal) + "吨");
if (savingStandardCoal >= 10000){
savingStandardCoal = savingStandardCoal / 10000;
map.put("num1", df.format(savingStandardCoal) + "万吨");
}else {
map.put("num1", df.format(savingStandardCoal) + "吨");
}
}
if (co2Reduction == 0) {
map.put("num2", 0 + "吨");
} else {
map.put("num2", df.format(Math.round(co2Reduction)) + "吨");
if (co2Reduction >= 10000){
co2Reduction = co2Reduction / 10000;
map.put("num2", df.format(co2Reduction) + "万吨");
}else {
map.put("num2", df.format(co2Reduction) + "吨");
}
}
return map;
}
/**
* 经济指标 净现值(NPV) 内部收益率(IRR) 静态投资回收期(SPP) 动态投资回收期(DPP)
*
... ... @@ -2299,6 +2308,7 @@ public class ProjectServiceImpl implements ProjectService {
Synthesize_no_1Img synthesize_no_1Img = synthesize_no_1ImgService.getById(id);
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));
if (!synthesize_no_2_1s.isEmpty()) {
applicationContext.publishEvent(new No3_1_1GetTypeEvent(synthesize_no_2_1s));
for (Synthesize_no_2_1 synthesize_no_2_1 : synthesize_no_2_1s) {
CalculateLoad calculateLoad = calculateLoadService.getOne(new LambdaQueryWrapper<CalculateLoad>().eq(CalculateLoad::getId, synthesize_no_2_1.getId()));
if (!StringUtils.isEmpty(calculateLoad)) {
... ...
spring:
profiles:
#开发时使用下面注释
active: dev
# active: dev
# 打包时使用下面注释
# active: prod
active: prod
... ...