Commit f370d292 authored by jichao's avatar jichao

系统--接口,定时任务获取城市24小时的气温

parent cd46fefc
...@@ -44,4 +44,9 @@ public class AdaptiveController { ...@@ -44,4 +44,9 @@ public class AdaptiveController {
public Result buildingAdaptation(@RequestParam String proId, @RequestParam String year, @RequestParam String month, @RequestParam String day) { public Result buildingAdaptation(@RequestParam String proId, @RequestParam String year, @RequestParam String month, @RequestParam String day) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, adaptiveServiceImpl.buildingAdaptation(proId, year, month, day)); return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, adaptiveServiceImpl.buildingAdaptation(proId, year, month, day));
} }
// @RequestMapping("/tem")
// public Result tem(){
// return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, adaptiveServiceImpl.temperature());
// }
} }
package org.rcisoft.business.mainte.adaptive.dao; package org.rcisoft.business.mainte.adaptive.dao;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.mainte.adaptive.entity.BusTemperature; import org.rcisoft.business.mainte.adaptive.entity.BusTemperature;
import org.rcisoft.business.mainte.adaptive.entity.TotalSensor;
import org.rcisoft.business.mainte.adaptive.vo.Params; import org.rcisoft.business.mainte.adaptive.vo.Params;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -25,4 +26,15 @@ public interface BusTemperatureRepository { ...@@ -25,4 +26,15 @@ public interface BusTemperatureRepository {
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BusTemperature> queryBusTemperatureList(Params params); List<BusTemperature> queryBusTemperatureList(Params params);
/**
* 批量添加每天24小时的温度
* @param list
* @return
*/
@Insert("<script><foreach collection=\"list\" item=\"item\" open=\"\" close=\"\" separator=\";\">" +
"insert into bus_temperature(TM,TEMPERATURE,CODE) values(#{item.tm},#{item.temperature},#{item.code})" +
"</foreach></script>")
@ResultType(Integer.class)
Integer batchSaveBusTemperature(List<BusTemperature> list);
} }
...@@ -2,6 +2,10 @@ package org.rcisoft.business.mainte.adaptive.service; ...@@ -2,6 +2,10 @@ package org.rcisoft.business.mainte.adaptive.service;
import org.rcisoft.business.mainte.adaptive.vo.BuildingAdaptation; import org.rcisoft.business.mainte.adaptive.vo.BuildingAdaptation;
import org.rcisoft.business.mainte.adaptive.vo.ClimateAdaptation; import org.rcisoft.business.mainte.adaptive.vo.ClimateAdaptation;
import org.rcisoft.business.mainte.adaptive.vo.Params;
import org.rcisoft.core.model.PersistModel;
import java.util.List;
/** /**
* Created by JiChao on 2018/4/28. * Created by JiChao on 2018/4/28.
...@@ -28,4 +32,17 @@ public interface AdaptiveService { ...@@ -28,4 +32,17 @@ public interface AdaptiveService {
*/ */
BuildingAdaptation buildingAdaptation(String proId, String year, String month, String day); BuildingAdaptation buildingAdaptation(String proId, String year, String month, String day);
/**
* 逐时负荷
* @param params
* @return
*/
List<Object> buildingList(Params params);
/**
* 定时任务,查询城市24小时温度
* @return
*/
PersistModel temperature();
} }
package org.rcisoft.business.mainte.adaptive.service.impl; package org.rcisoft.business.mainte.adaptive.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.mainte.adaptive.dao.BusParamReferRepository; import org.rcisoft.business.mainte.adaptive.dao.BusParamReferRepository;
import org.rcisoft.business.mainte.adaptive.dao.BusTemperatureRepository; import org.rcisoft.business.mainte.adaptive.dao.BusTemperatureRepository;
...@@ -15,14 +17,18 @@ import org.rcisoft.business.mainte.adaptive.vo.ClimateAdaptation; ...@@ -15,14 +17,18 @@ import org.rcisoft.business.mainte.adaptive.vo.ClimateAdaptation;
import org.rcisoft.business.mainte.adaptive.vo.Params; import org.rcisoft.business.mainte.adaptive.vo.Params;
import org.rcisoft.business.overview.dao.BusProjectRepository; import org.rcisoft.business.overview.dao.BusProjectRepository;
import org.rcisoft.business.overview.entity.BusProject; import org.rcisoft.business.overview.entity.BusProject;
import org.rcisoft.core.model.PersistModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.net.URL;
import java.util.Calendar; import java.net.URLConnection;
import java.util.Iterator; import java.text.SimpleDateFormat;
import java.util.List; import java.util.*;
/** /**
* Created by JiChao on 2018/4/28. * Created by JiChao on 2018/4/28.
...@@ -51,6 +57,42 @@ public class AdaptiveServiceImpl implements AdaptiveService { ...@@ -51,6 +57,42 @@ public class AdaptiveServiceImpl implements AdaptiveService {
return busProject.getCode(); return busProject.getCode();
} }
@Override
public List<Object> buildingList(Params params) {
Calendar cal = Calendar.getInstance();
//查询建筑负荷:供水温度,回水温度,水流量
String[] code_array = new String[]{"", "", ""};
List<BusParamRefer> busParamRefer = busParamReferRepository.queryOtherParam(params);
busParamRefer.forEach(b -> {
if(StringUtils.equals(b.getOwnParam(), ProEnum.gswd.toString())) code_array[0] = b.getOtherParam();
if(StringUtils.equals(b.getOwnParam(), ProEnum.hswd.toString())) code_array[1] = b.getOtherParam();
if(StringUtils.equals(b.getOwnParam(), ProEnum.sll.toString())) code_array[2] = b.getOtherParam();
});
//从sensor表查询对应日期的所有记录
List<TotalSensor> totalSensorList = totalSensorRepository.queryTotalSensorList(params);
List<Object> buildingList = Arrays.asList(new Object[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
totalSensorList.forEach(totalSensor -> {
cal.setTime(totalSensor.getTm());
//整点数据
if (cal.get(Calendar.MINUTE) == 0) {
//得到小时
int hour = cal.get(Calendar.HOUR_OF_DAY);
//得到json对象
JSONObject json = JSONObject.parseObject(totalSensor.getSensorJson());
//供水温度
BigDecimal gswd = (BigDecimal) json.get(code_array[0]);
//回水温度
BigDecimal hswd = (BigDecimal) json.get(code_array[1]);
//水流量
BigDecimal sll = (BigDecimal) json.get(code_array[2]);
//公式计算
Float building = Math.abs(gswd.subtract(hswd).multiply(sll).multiply(new BigDecimal(4.12)).divide(new BigDecimal(3.6), 1, BigDecimal.ROUND_HALF_UP).floatValue());
buildingList.set(hour, building);
}
});
return buildingList;
}
@Override @Override
public ClimateAdaptation climateAdaptation(String proId, String year, String month, String day) { public ClimateAdaptation climateAdaptation(String proId, String year, String month, String day) {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
...@@ -130,37 +172,64 @@ public class AdaptiveServiceImpl implements AdaptiveService { ...@@ -130,37 +172,64 @@ public class AdaptiveServiceImpl implements AdaptiveService {
BigDecimal temperature = busTemperature.getTemperature(); BigDecimal temperature = busTemperature.getTemperature();
temperatureList.set(hour, temperature); temperatureList.set(hour, temperature);
}); });
//查询建筑负荷:供水温度,回水温度,水流量 List<Object> buildingList = this.buildingList(params);
String[] code_array = new String[]{"", "", ""}; return new BuildingAdaptation(buildingList, temperatureList);
List<BusParamRefer> busParamRefer = busParamReferRepository.queryOtherParam(params); }
busParamRefer.forEach(b -> {
if(StringUtils.equals(b.getOwnParam(), ProEnum.gswd.toString())) code_array[0] = b.getOtherParam(); @Transactional
if(StringUtils.equals(b.getOwnParam(), ProEnum.hswd.toString())) code_array[1] = b.getOtherParam(); @Override
if(StringUtils.equals(b.getOwnParam(), ProEnum.sll.toString())) code_array[2] = b.getOtherParam(); public PersistModel temperature() {
List<BusTemperature> saveList = new ArrayList<>();
//1.查询所有项目的城市code,去重复
List<String> cityCodeList = busProjectRepository.allCityCode();
//2.根据项目code,查询24小时的温度json
cityCodeList.forEach(s -> {
saveList.addAll(this.fromWeather(s));
}); });
//从sensor表查询对应日期的所有记录 //3.将所有的结果插入bus_temperature表(批量)
List<TotalSensor> totalSensorList = totalSensorRepository.queryTotalSensorList(params); Integer i = busTemperatureRepository.batchSaveBusTemperature(saveList);
List<Object> buildingList = Arrays.asList(new Object[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}); return new PersistModel(i);
totalSensorList.forEach(totalSensor -> { }
cal.setTime(totalSensor.getTm());
//整点数据 private List<BusTemperature> fromWeather(String code) {
if (cal.get(Calendar.MINUTE) == 0) { List<BusTemperature> resultList = new ArrayList<>();
//得到小时 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int hour = cal.get(Calendar.HOUR_OF_DAY); String apiUrl = String.format("http://tj.nineton.cn/Heart/index/future24h/?city=%s", code);
//得到json对象 URL url = null;
JSONObject json = JSONObject.parseObject(totalSensor.getSensorJson()); URLConnection open = null;
//供水温度 InputStream input = null;
BigDecimal gswd = (BigDecimal) json.get(code_array[0]); try {
//回水温度 //开始请求
BigDecimal hswd = (BigDecimal) json.get(code_array[1]); url = new URL(apiUrl);
//水流量 open = url.openConnection();
BigDecimal sll = (BigDecimal) json.get(code_array[2]); input = open.getInputStream();
//公式计算 //变成string
Float building = Math.abs(gswd.subtract(hswd).multiply(sll).multiply(new BigDecimal(4.12)).divide(new BigDecimal(3.6), 1, BigDecimal.ROUND_HALF_UP).floatValue()); String result = IOUtils.toString(input);
buildingList.set(hour, building); JSONObject jsonResult = JSONObject.parseObject(result);
JSONArray jsonArray = (JSONArray) jsonResult.get("hourly");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
String time = (String) jsonObject.get("time");
time = time.replaceAll("\\+08:00", "").replaceAll("T", " ");
BigDecimal temperature = new BigDecimal((String) jsonObject.get("temperature"));
//新建需要保存的对象
BusTemperature b = new BusTemperature();
b.setCode(code);
b.setTm(sdf.parse(time));
b.setTemperature(temperature);
//存到list
resultList.add(b);
} }
}); } catch (Exception e) {
return new BuildingAdaptation(buildingList, temperatureList); e.printStackTrace();
} finally {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultList;
} }
} }
package org.rcisoft.business.mainte.adaptive.task; package org.rcisoft.business.mainte.adaptive.task;
import org.rcisoft.business.mainte.adaptive.service.AdaptiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -9,12 +11,15 @@ import org.springframework.stereotype.Component; ...@@ -9,12 +11,15 @@ import org.springframework.stereotype.Component;
@Component @Component
public class AdaptiveTask { public class AdaptiveTask {
@Autowired
private AdaptiveService adaptiveServiceImpl;
/** /**
* 每天0点5分执行,查询所有项目中存在的城市,未来24小时的温度 * 每天0点5分执行,查询所有项目中存在的城市,未来24小时的温度
*/ */
@Scheduled(cron = "0 5 0 * * ?") @Scheduled(cron = "0 5 0 * * ?")
public void temperature () { public void temperature () {
adaptiveServiceImpl.temperature();
} }
} }
package org.rcisoft.business.overview.dao; package org.rcisoft.business.overview.dao;
import org.apache.ibatis.annotations.ResultType;
import org.rcisoft.business.overview.entity.BusProject; import org.rcisoft.business.overview.entity.BusProject;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
...@@ -22,5 +23,9 @@ public interface BusProjectRepository extends BaseMapper<BusProject> { ...@@ -22,5 +23,9 @@ public interface BusProjectRepository extends BaseMapper<BusProject> {
@Select("<script>select * from bus_project</script>") @Select("<script>select * from bus_project</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BusProject> queryBusProjects(); List<BusProject> queryBusProjects();
@Select("<script>select distinct code from bus_project</script>")
@ResultType(String.class)
List<String> allCityCode();
} }
...@@ -147,4 +147,14 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -147,4 +147,14 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanDay(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> statEnergyPlanDay(EnergyCountMVo energyCountMVo);
/**
* 能源消耗
* @param energyCountMVo
* @return
*/
@Select("<script>select e.`HOUR`,sum(if(e.WATER is null,0,e.WATER))+sum(if(e.ELEC is null,0,e.ELEC))+sum(if(e.GAS is null,0,e.GAS)) ENERGY " +
"from energy_count_m e where e.PRO_ID=#{proId} and date_format(e.CREATE_TIME, '%Y-%c-%e')=#{time} group by e.`HOUR`+0 asc</script>")
@ResultMap("resultMapVo")
List<EnergyCountMVo> energyConsume(EnergyCountMVo energyCountMVo);
} }
...@@ -36,6 +36,8 @@ public class EnergyCountMVo extends EnergyCountM { ...@@ -36,6 +36,8 @@ public class EnergyCountMVo extends EnergyCountM {
//日期,今日昨日 //日期,今日昨日
private Integer date; private Integer date;
private String time;
//------------能耗拆分返回值--------------- //------------能耗拆分返回值---------------
private String name; private String name;
...@@ -43,4 +45,5 @@ public class EnergyCountMVo extends EnergyCountM { ...@@ -43,4 +45,5 @@ public class EnergyCountMVo extends EnergyCountM {
private String percent; private String percent;
} }
package org.rcisoft.business.system.controller;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.system.service.SystemService;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by JiChao on 2018/5/2.
* 系统模块
*/
@RestController
@RequestMapping("system")
public class SystemController {
@Autowired
private SystemService systemServiceImpl;
@ApiOperation(value="气候自适应统计", notes="气候自适应统计")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/statClimate")
public Result statClimate(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.statClimate(proId));
}
@ApiOperation(value="能源消耗", notes="能源消耗")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/energyConsume")
public Result energyConsume(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.energyConsume(proId));
}
@ApiOperation(value="逐时负荷", notes="逐时负荷")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/burdenHour")
public Result burdenHour(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.burdenHour(proId));
}
}
package org.rcisoft.business.system.service;
import org.rcisoft.business.system.vo.ClimateStatistics;
import java.util.List;
/**
* Created by JiChao on 2018/5/2.
*/
public interface SystemService {
/**
* 气候自适应统计
* @param proId
* @return
*/
ClimateStatistics statClimate(String proId);
/**
* 能源消耗
* @param proId
* @return
*/
List<Object> energyConsume(String proId);
/**
* 逐时负荷
* @param proId
* @return
*/
List<Object> burdenHour(String proId);
}
package org.rcisoft.business.system.service.impl;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.mainte.adaptive.dao.BusParamReferRepository;
import org.rcisoft.business.mainte.adaptive.dao.BusTemperatureRepository;
import org.rcisoft.business.mainte.adaptive.dao.TotalSensorRepository;
import org.rcisoft.business.mainte.adaptive.entity.BusParamRefer;
import org.rcisoft.business.mainte.adaptive.entity.BusTemperature;
import org.rcisoft.business.mainte.adaptive.entity.TotalSensor;
import org.rcisoft.business.mainte.adaptive.proenum.ProEnum;
import org.rcisoft.business.mainte.adaptive.service.AdaptiveService;
import org.rcisoft.business.mainte.adaptive.vo.Params;
import org.rcisoft.business.overview.dao.BusProjectRepository;
import org.rcisoft.business.overview.dao.EnergyCountMRepository;
import org.rcisoft.business.overview.entity.BusProject;
import org.rcisoft.business.overview.vo.EnergyCountMVo;
import org.rcisoft.business.system.service.SystemService;
import org.rcisoft.business.system.vo.ClimateStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
/**
* Created by JiChao on 2018/5/2.
*/
@Service
public class SystemServiceImpl implements SystemService {
@Autowired
private BusParamReferRepository busParamReferRepository;
@Autowired
private TotalSensorRepository totalSensorRepository;
@Autowired
private BusTemperatureRepository busTemperatureRepository;
@Autowired
private BusProjectRepository busProjectRepository;
@Autowired
private EnergyCountMRepository energyCountMRepository;
@Autowired
private AdaptiveService adaptiveServiceImpl;
private String getCode(String proId) {
BusProject b = new BusProject();
b.setProId(proId);
BusProject busProject = busProjectRepository.selectOne(b);
return busProject.getCode();
}
@Override
public ClimateStatistics statClimate(String proId) {
Calendar cal = Calendar.getInstance();
String time = cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DAY_OF_MONTH);
//当前时间
int nowHour = cal.get(Calendar.HOUR_OF_DAY);
Params params = new Params(proId, time, this.getCode(proId));
//查询当天气温
List<BusTemperature> busTemperaturesList = busTemperatureRepository.queryBusTemperatureList(params);
List<Object> outsideList = Arrays.asList(new Object[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
busTemperaturesList.forEach(busTemperature -> {
cal.setTime(busTemperature.getTm());
int hour = cal.get(Calendar.HOUR_OF_DAY);
if (hour > nowHour) return;
outsideList.set(hour, busTemperature.getTemperature());
});
//查询 供水温度,回水温度 code
String[] code_array = new String[2];
List<BusParamRefer> busParamRefer = busParamReferRepository.queryOtherParam(params);
busParamRefer.forEach(b -> {
if(StringUtils.equals(b.getOwnParam(), ProEnum.gswd.toString())) code_array[0] = b.getOtherParam();
if(StringUtils.equals(b.getOwnParam(), ProEnum.hswd.toString())) code_array[1] = b.getOtherParam();
});
//查询供回水温度
List<TotalSensor> totalSensorList = totalSensorRepository.queryTotalSensorList(params);
List<Object> gswdList = Arrays.asList(new Object[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
List<Object> hswdList = Arrays.asList(new Object[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
totalSensorList.forEach(totalSensor -> {
cal.setTime(totalSensor.getTm());
int hour = cal.get(Calendar.HOUR_OF_DAY);
if (hour > nowHour) return;
//得到json对象
JSONObject json = JSONObject.parseObject(totalSensor.getSensorJson());
//供水温度
BigDecimal gswd = (BigDecimal) json.get(code_array[0]);
//回水温度
BigDecimal hswd = (BigDecimal) json.get(code_array[1]);
gswdList.set(hour, gswd);
hswdList.set(hour, hswd);
});
return new ClimateStatistics(outsideList, gswdList, hswdList);
}
@Override
public List<Object> energyConsume(String proId) {
Calendar cal = Calendar.getInstance();
// cal.set(2018, 3, 28);
String time = cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DAY_OF_MONTH);
EnergyCountMVo e = new EnergyCountMVo();
e.setProId(proId);
e.setTime(time);
List<EnergyCountMVo> energyList = energyCountMRepository.energyConsume(e);
List<Object> energyResultList = Arrays.asList(new Object[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
energyList.forEach(energyCountMVo -> {
int hour = Integer.parseInt(energyCountMVo.getHour());
BigDecimal energy = energyCountMVo.getEnergy();
energyResultList.set(hour, energy);
});
return energyResultList;
}
@Override
public List<Object> burdenHour(String proId) {
Calendar cal = Calendar.getInstance();
// cal.set(2018, 3, 28);
String time = cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DAY_OF_MONTH);
Params params = new Params(proId, time, this.getCode(proId));
return adaptiveServiceImpl.buildingList(params);
}
}
package org.rcisoft.business.system.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* Created by JiChao on 2018/5/2.
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ClimateStatistics {
private List<Object> outside;
private List<Object> gswd;
private List<Object> hswd;
}
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