Commit f93f15b5 authored by jichao's avatar jichao

项目管理--能耗分布,项目评估:能耗数值修改

parent eaea87aa
......@@ -43,12 +43,17 @@ public class ProjectEvaluateServiceImpl implements ProjectEvaluateService {
maps.forEach(map -> {
// 得到节能潜力
BigDecimal energy = new BigDecimal(map.get("energy").toString());
// 保留两位小数
energy = energy.setScale(2, BigDecimal.ROUND_HALF_UP);
map.put("energy", energy);
BigDecimal energyPotential = new BigDecimal(map.get("energyPotential") == null ? "0" : map.get("energyPotential").toString());
/* 不需要平均值
// 根据proId,查询月份的数量
String proId = (String) map.get("PRO_ID");
BigDecimal monthCount = projectEvaluateRepository.countMonth(proId, month);
energy = energy.divide(monthCount).setScale(2, BigDecimal.ROUND_HALF_UP);
map.put("energy", energy);
*/
// 如果减去节能潜力的结果,大于0,赋值,如果小于0,赋值0
energyPotential = energy.subtract(energyPotential);
if (energyPotential.compareTo(zero) > 0)
......
......@@ -19,7 +19,7 @@ import java.util.List;
public interface MainteDistributedRepository {
@Select("<script>select b.PRO_ID,b.PRO_NM,b.BLD_COORDINATE,b.BLD_AREA, " +
"CONVERT(sum((if(e.WATER_MONEY is null, 0, e.WATER_MONEY)+if(e.ELEC_MONEY is null, 0, e.ELEC_MONEY)+if(e.GAS_MONEY is null, 0, e.GAS_MONEY))*12/b.BLD_AREA),DECIMAL(10,2)) MONEY " +
"CONVERT(sum((if(e.WATER_MONEY is null, 0, e.WATER_MONEY)+if(e.ELEC_MONEY is null, 0, e.ELEC_MONEY)+if(e.GAS_MONEY is null, 0, e.GAS_MONEY))/b.BLD_AREA),DECIMAL(10,2)) MONEY " +
/*"sum(if(e.WATER_MONEY is null, 0, e.WATER_MONEY)) WATER_MONEY, " +
"sum(if(e.ELEC_MONEY is null, 0, e.ELEC_MONEY)) ELEC_MONEY, " +
"sum(if(e.GAS_MONEY is null, 0, e.GAS_MONEY)) GAS_MONEY " +*/
......@@ -32,7 +32,7 @@ public interface MainteDistributedRepository {
@Select("<script>" +
"select t.BLD_TP_NM,e.MON," +
"CONVERT(sum((if(e.WATER_MONEY is null, 0, e.WATER_MONEY)+if(e.ELEC_MONEY is null, 0, e.ELEC_MONEY)+if(e.GAS_MONEY is null, 0, e.GAS_MONEY))*12/b.BLD_AREA),DECIMAL(10,2)) MONEY " +
"CONVERT(sum((if(e.WATER_MONEY is null, 0, e.WATER_MONEY)+if(e.ELEC_MONEY is null, 0, e.ELEC_MONEY)+if(e.GAS_MONEY is null, 0, e.GAS_MONEY))/b.BLD_AREA),DECIMAL(10,2)) MONEY " +
"from energy_count_m e,bus_project b,bus_build_tp t " +
"where e.PRO_ID=b.PRO_ID and b.BLD_TP_ID=t.BLD_TP_ID and e.`YEAR`=#{year} and e.`MON` &lt; #{month} and b.BLD_ZONE_ID=#{bldZoneId} " +
"group by e.PRO_ID,t.BLD_TP_NM,e.MON order by t.BLD_TP_NM,e.MON" +
......@@ -44,19 +44,19 @@ public interface MainteDistributedRepository {
@Select("<script>select b.PRO_NM,t.BLD_TP_NM,date_format(b.BLD_YEAR, '%Y') `YEAR`," +
"convert(sum((if(e.WATER_MONEY is null, 0, e.WATER_MONEY)+if(e.ELEC_MONEY is null, 0, e.ELEC_MONEY)+if(e.GAS_MONEY is null, 0, e.GAS_MONEY))/b.BLD_AREA),decimal(10,2)) MONEY " +
"from energy_count_m e,bus_project b,bus_build_tp t " +
"where e.PRO_ID=b.PRO_ID and b.BLD_TP_ID=t.BLD_TP_ID " +
"where e.PRO_ID=b.PRO_ID and b.BLD_TP_ID=t.BLD_TP_ID and e.MON &lt; ${month} " +
"group by e.PRO_ID,b.PRO_NM,t.BLD_TP_NM,date_format(b.BLD_YEAR, '%Y') " +
"order by t.BLD_TP_NM</script>")
@ResultMap(value = "BuildingAge")
List<BuildingAge> queryBuildingAge();
List<BuildingAge> queryBuildingAge(@Param("month") Integer month);
@Select("<script>select b.PRO_NM,t.BLD_TP_NM,date_format(b.DEVICE_YEAR, '%Y') `YEAR`," +
"convert(sum((if(e.WATER_MONEY is null, 0, e.WATER_MONEY)+if(e.ELEC_MONEY is null, 0, e.ELEC_MONEY)+if(e.GAS_MONEY is null, 0, e.GAS_MONEY))/b.BLD_AREA),decimal(10,2)) MONEY " +
"from energy_count_m e,bus_project b,bus_build_tp t " +
"where e.PRO_ID=b.PRO_ID and b.BLD_TP_ID=t.BLD_TP_ID " +
"where e.PRO_ID=b.PRO_ID and b.BLD_TP_ID=t.BLD_TP_ID and e.MON &lt; ${month} " +
"group by e.PRO_ID,b.PRO_NM,t.BLD_TP_NM,date_format(b.DEVICE_YEAR, '%Y') " +
"order by t.BLD_TP_NM</script>")
@ResultMap(value = "DeviceAge")
List<DeviceAge> queryDeviceAge();
List<DeviceAge> queryDeviceAge(@Param("month") Integer month);
}
......@@ -49,13 +49,14 @@ public class MainteDistributedServiceImpl implements MainteDistributedService {
value.add(Float.parseFloat(coordinate[1]));
//值
// 如果是全年的,需要查询项目的月份数量,算平均值
if (StringUtils.isEmpty(month)) {
String proId = energyDistributed.getProId();
BigDecimal monthCount = projectEvaluateRepository.countMonth(proId, year_month);
value.add(energyDistributed.getMoney().divide(monthCount).setScale(2));
} else {
// if (StringUtils.isEmpty(month)) {
// String proId = energyDistributed.getProId();
// BigDecimal monthCount = projectEvaluateRepository.countMonth(proId, year_month);
// value.add(energyDistributed.getMoney().divide(monthCount).setScale(2));
// } else {
// 全年的求和
value.add(energyDistributed.getMoney());
}
// }
/* value.add(new BigDecimal(0)
.add(energyDistributed.getWaterMoney())
.add(energyDistributed.getElecMoney())
......@@ -112,12 +113,14 @@ public class MainteDistributedServiceImpl implements MainteDistributedService {
@Override
public BuildingAgeVo queryBuildingAge() {
// 不包括当前月份
int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
//标题集
List<Object> title = new ArrayList<>();
//返回集
List<BuildingAgeVo.BuildingAgeResult> resultList = new ArrayList<>();
//结果集
List<BuildingAge> list = mainteDistributedRepository.queryBuildingAge();
List<BuildingAge> list = mainteDistributedRepository.queryBuildingAge(month);
list.forEach(b -> {
String bldTPNm = b.getBldTPNm();
if (!title.contains(bldTPNm)) {
......@@ -137,6 +140,8 @@ public class MainteDistributedServiceImpl implements MainteDistributedService {
@Override
public DeviceAgeVo queryDeviceAge() {
// 不包括当前月份
int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
//获得当前年份
int year = Calendar.getInstance().get(Calendar.YEAR);
//标题集
......@@ -144,7 +149,7 @@ public class MainteDistributedServiceImpl implements MainteDistributedService {
//返回集
List<DeviceAgeVo.DeviceAgeResult> resultList = new ArrayList<>();
//结果集
List<DeviceAge> list = mainteDistributedRepository.queryDeviceAge();
List<DeviceAge> list = mainteDistributedRepository.queryDeviceAge(month);
list.forEach(d -> {
String bldTPNm = d.getBldTPNm();
if (!title.contains(bldTPNm)) {
......
......@@ -9,7 +9,7 @@
BLD_LOCAL,
bbt.BLD_TP_NM,
bp.BLD_AREA,
sum(if(WATER_MONEY is null, 0, WATER_MONEY) + if(ELEC_MONEY is null, 0, ELEC_MONEY) + if(GAS_MONEY is null, 0, GAS_MONEY)) * 12 / bp.BLD_AREA AS energy,
sum(if(WATER_MONEY is null, 0, WATER_MONEY) + if(ELEC_MONEY is null, 0, ELEC_MONEY) + if(GAS_MONEY is null, 0, GAS_MONEY)) / bp.BLD_AREA AS energy,
bp.ENERGY_POTENTIAL as energyPotential,
ecm.YEAR
FROM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment