|
|
|
|
@ -8,6 +8,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.hw.common.core.constant.SecurityConstants;
|
|
|
|
|
import com.hw.common.core.constant.TdEngineConstants;
|
|
|
|
|
import com.hw.common.core.domain.R;
|
|
|
|
|
@ -19,14 +20,14 @@ import com.hw.ems.base.domain.BaseMonitorInfo;
|
|
|
|
|
import com.hw.ems.base.service.IBaseEnergyTypeService;
|
|
|
|
|
import com.hw.ems.base.service.IBaseMonitorInfoService;
|
|
|
|
|
import com.hw.ems.record.domain.RecordDnbInstant;
|
|
|
|
|
import com.hw.ems.record.domain.vo.RecordDnbInstantDataVo;
|
|
|
|
|
import com.hw.ems.record.mapper.RecordDnbInstantMapper;
|
|
|
|
|
import com.hw.ems.record.service.IRecordDnbInstantService;
|
|
|
|
|
import com.hw.ems.report.domain.ReportPointDnb;
|
|
|
|
|
import com.hw.ems.report.service.IReportPointDnbService;
|
|
|
|
|
import com.hw.tdengine.api.RemoteTdEngineService;
|
|
|
|
|
import com.hw.tdengine.api.domain.TdHistorySelectDto;
|
|
|
|
|
import com.hw.tdengine.api.domain.TdReturnDataVo;
|
|
|
|
|
import com.hw.tdengine.api.domain.TdSuperTableSelectVo;
|
|
|
|
|
import com.hw.tdengine.api.domain.*;
|
|
|
|
|
import com.hw.tdengine.api.domain.ems.TdSuperTableEmsSelectVo;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
@ -81,70 +82,73 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
@Override
|
|
|
|
|
//@DS("#header.poolName")
|
|
|
|
|
// @DataScope(deptAlias = "null")
|
|
|
|
|
public List<RecordDnbInstant> selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant) {
|
|
|
|
|
// todo 调用tde引擎查询实时数据
|
|
|
|
|
public RecordDnbInstantDataVo selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant) {
|
|
|
|
|
RecordDnbInstantDataVo recordDnbInstantDataVo = new RecordDnbInstantDataVo();
|
|
|
|
|
try {
|
|
|
|
|
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
|
|
|
|
Integer pageNum = Integer.valueOf((String) recordDnbInstant.getParams().get("pageNum"));
|
|
|
|
|
Integer pageSize = Integer.valueOf((String) recordDnbInstant.getParams().get("pageSize"));
|
|
|
|
|
Integer offset = (pageNum - 1) * pageSize;
|
|
|
|
|
List<RecordDnbInstant> records = new ArrayList<RecordDnbInstant>();
|
|
|
|
|
List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(new BaseMonitorInfo());
|
|
|
|
|
String stratTime = (String)recordDnbInstant.getParams().get("beginCollectTime");
|
|
|
|
|
String endTime = (String)recordDnbInstant.getParams().get("endCollectTime");
|
|
|
|
|
BaseMonitorInfo queryMonitorInfo = new BaseMonitorInfo();
|
|
|
|
|
queryMonitorInfo.setMonitorId(recordDnbInstant.getMonitorId());
|
|
|
|
|
// List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(queryMonitorInfo);
|
|
|
|
|
String stratTime = (String) recordDnbInstant.getParams().get("beginTime");
|
|
|
|
|
String endTime = (String) recordDnbInstant.getParams().get("endTime");
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
Date dateStrat = sdf.parse(stratTime);
|
|
|
|
|
Date dateEnd = sdf.parse(endTime);
|
|
|
|
|
TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto();
|
|
|
|
|
tdHistorySelectDto.setDatabaseName("db_hwmes");
|
|
|
|
|
/**
|
|
|
|
|
* 先判断是要查询总的电实时数据还是查询单个计量设备的电实时数据
|
|
|
|
|
* */
|
|
|
|
|
// if (recordDnbInstant.getMonitorId()==""||recordDnbInstant.getMonitorId()==null) {
|
|
|
|
|
// TdSuperTableSelectVo tdSuperTableSelectVo = new TdSuperTableSelectVo();
|
|
|
|
|
// tdSuperTableSelectVo.setDatabaseName("db_hwmes");
|
|
|
|
|
// tdSuperTableSelectVo.setSuperTableName("st_electricity");
|
|
|
|
|
// //获取13位的时间戳
|
|
|
|
|
// tdSuperTableSelectVo.setStartTime(dateStrat.getTime());
|
|
|
|
|
// tdSuperTableSelectVo.setEndTime(dateEnd.getTime());
|
|
|
|
|
//// R<List<Map<String, Object>>> latestDataByTags = remoteTdEngineService.getLatestDataByTags(tdSuperTableSelectVo, SecurityConstants.INNER);
|
|
|
|
|
//// List<Map<String, Object>> data = latestDataByTags.getData();
|
|
|
|
|
// return remoteTdEngineService.getLatestDataByTags(tdSuperTableSelectVo, SecurityConstants.INNER).getData();
|
|
|
|
|
// }
|
|
|
|
|
for (BaseMonitorInfo baseMonitorInfo:baseMonitorInfos){
|
|
|
|
|
tdHistorySelectDto.setTableName(TdEngineConstants.getEmsTableName(baseMonitorInfo.getMonitorId()));
|
|
|
|
|
tdHistorySelectDto.setStartTime(dateStrat.getTime());
|
|
|
|
|
tdHistorySelectDto.setEndTime(dateEnd.getTime());
|
|
|
|
|
tdHistorySelectDto.setFirstFieldName("ts");
|
|
|
|
|
// list = (List<Map<String,Object>>)remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER);
|
|
|
|
|
// list.addAll((List<Map<String,Object>>)remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER));
|
|
|
|
|
List<Map<String, Object>> dataList = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER).getData().getDataList();
|
|
|
|
|
for (Map<String, Object> data : dataList){
|
|
|
|
|
RecordDnbInstant recordDnbInstant1 = new RecordDnbInstant();
|
|
|
|
|
recordDnbInstant1.setObjid(baseMonitorInfo.getObjid());
|
|
|
|
|
recordDnbInstant1.setMonitorId(baseMonitorInfo.getMonitorId());
|
|
|
|
|
recordDnbInstant1.setMonitorName(baseMonitorInfo.getMonitorName());
|
|
|
|
|
recordDnbInstant1.setVA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagea")))));
|
|
|
|
|
recordDnbInstant1.setVB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatageb")))));
|
|
|
|
|
recordDnbInstant1.setVC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagec")))));
|
|
|
|
|
recordDnbInstant1.setIA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currenta")))));
|
|
|
|
|
recordDnbInstant1.setIB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentb")))));
|
|
|
|
|
recordDnbInstant1.setIC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentc")))));
|
|
|
|
|
recordDnbInstant1.setGlys(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("glys")))));
|
|
|
|
|
recordDnbInstant1.setZxyg(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("zxyg")))));
|
|
|
|
|
recordDnbInstant1.setActivePower(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("activepower")))));
|
|
|
|
|
recordDnbInstant1.setReactivePower(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("reactivepower")))));
|
|
|
|
|
//调整时间格式
|
|
|
|
|
String substring = String.valueOf(data.get("ts")).replaceAll("T", " ").substring(0, 19);
|
|
|
|
|
recordDnbInstant1.setCollectTime(sdf.parse(substring));
|
|
|
|
|
// recordDnbInstant.setConsumption(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get(0).get("consuption")))));
|
|
|
|
|
recordDnbInstant1.setCollectType(Long.valueOf(String.valueOf(data.get("collecttype"))));
|
|
|
|
|
records.add(recordDnbInstant1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TdSuperTableEmsSelectVo tdSuperTableCommonSelectVo = new TdSuperTableEmsSelectVo();
|
|
|
|
|
tdSuperTableCommonSelectVo.setDatabaseName("db_hwmes");
|
|
|
|
|
tdSuperTableCommonSelectVo.setSuperTableName("st_electricity");
|
|
|
|
|
tdSuperTableCommonSelectVo.setStartTime(dateStrat.getTime());
|
|
|
|
|
tdSuperTableCommonSelectVo.setEndTime(dateEnd.getTime());
|
|
|
|
|
tdSuperTableCommonSelectVo.setFirstFieldName("ts");
|
|
|
|
|
tdSuperTableCommonSelectVo.setOrderByFieldName("ts");
|
|
|
|
|
tdSuperTableCommonSelectVo.setSort("desc");
|
|
|
|
|
tdSuperTableCommonSelectVo.setOffset(offset);
|
|
|
|
|
tdSuperTableCommonSelectVo.setLimit(pageSize);
|
|
|
|
|
|
|
|
|
|
Object monitorObjidValue = recordDnbInstant.getParams().get("monitorObjid");
|
|
|
|
|
if (monitorObjidValue != null) {
|
|
|
|
|
tdSuperTableCommonSelectVo.setMonitorObjid(Long.valueOf(String.valueOf(monitorObjidValue)));
|
|
|
|
|
}
|
|
|
|
|
return records;
|
|
|
|
|
|
|
|
|
|
TdReturnDataVo tdReturnDataVo = remoteTdEngineService.getSuperTableHistoryData(tdSuperTableCommonSelectVo, SecurityConstants.INNER).getData();
|
|
|
|
|
if (tdReturnDataVo == null) {
|
|
|
|
|
return recordDnbInstantDataVo;
|
|
|
|
|
}
|
|
|
|
|
List<Map<String, Object>> dataList = tdReturnDataVo.getDataList();
|
|
|
|
|
|
|
|
|
|
for (Map<String, Object> data : dataList) {
|
|
|
|
|
RecordDnbInstant recordDnbInstant1 = new RecordDnbInstant();
|
|
|
|
|
recordDnbInstant1.setObjid(Long.valueOf(String.valueOf(data.get(TdEngineConstants.ST_TAG_EMS_MONITOROBJID))));
|
|
|
|
|
recordDnbInstant1.setMonitorId(String.valueOf(data.get(TdEngineConstants.ST_TAG_EMS_MONITORID)));
|
|
|
|
|
recordDnbInstant1.setMonitorName(String.valueOf(data.get(TdEngineConstants.ST_TAG_EMS_MONITORNAME)));
|
|
|
|
|
recordDnbInstant1.setVA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagea")))));
|
|
|
|
|
recordDnbInstant1.setVB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatageb")))));
|
|
|
|
|
recordDnbInstant1.setVC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagec")))));
|
|
|
|
|
recordDnbInstant1.setIA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currenta")))));
|
|
|
|
|
recordDnbInstant1.setIB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentb")))));
|
|
|
|
|
recordDnbInstant1.setIC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentc")))));
|
|
|
|
|
recordDnbInstant1.setGlys(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("glys")))));
|
|
|
|
|
recordDnbInstant1.setZxyg(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("zxyg")))));
|
|
|
|
|
recordDnbInstant1.setActivePower(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("activepower")))));
|
|
|
|
|
recordDnbInstant1.setReactivePower(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("reactivepower")))));
|
|
|
|
|
//调整时间格式
|
|
|
|
|
String substring = String.valueOf(data.get("ts")).replaceAll("T", " ").substring(0, 19);
|
|
|
|
|
recordDnbInstant1.setCollectTime(sdf.parse(substring));
|
|
|
|
|
// recordDnbInstant.setConsumption(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("consumption")))));
|
|
|
|
|
recordDnbInstant1.setCollectType(Long.valueOf(String.valueOf(data.get("collecttype"))));
|
|
|
|
|
records.add(recordDnbInstant1);
|
|
|
|
|
}
|
|
|
|
|
recordDnbInstantDataVo.setCount(tdReturnDataVo.getCount());
|
|
|
|
|
recordDnbInstantDataVo.setRecordDnbInstants(records);
|
|
|
|
|
return recordDnbInstantDataVo;
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
List<RecordDnbInstant> lists = new ArrayList<>();
|
|
|
|
|
return lists;
|
|
|
|
|
return recordDnbInstantDataVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -251,7 +255,8 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取最新实时电数据
|
|
|
|
|
* 需要先排序在查询出每个设备的最新数据
|
|
|
|
|
* 需要先排序在查询出每个设备的最新数据
|
|
|
|
|
*
|
|
|
|
|
* @param baseDnbInstant
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ -315,10 +320,10 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
@Override
|
|
|
|
|
//@DS("#header.poolName")
|
|
|
|
|
public List<RecordDnbInstant> voltageCurrentCurve(RecordDnbInstant dnbInstant) {
|
|
|
|
|
if (StringUtils.isEmpty(dnbInstant.getMonitorId())){
|
|
|
|
|
if (StringUtils.isEmpty(dnbInstant.getMonitorId())) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(dnbInstant.getStartTime()) || StringUtils.isEmpty(dnbInstant.getEndTime())){
|
|
|
|
|
if (StringUtils.isEmpty(dnbInstant.getStartTime()) || StringUtils.isEmpty(dnbInstant.getEndTime())) {
|
|
|
|
|
String nowTime = DateUtils.getTime();
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
LocalDateTime modifiedDateTime = LocalDateTime.parse(nowTime, formatter).minusMinutes(30);
|
|
|
|
|
@ -331,7 +336,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 定时任务用:通过定时任务获取电实时数据
|
|
|
|
|
* */
|
|
|
|
|
*/
|
|
|
|
|
//todo 通过tde 将电实时数据存入到电整点数据中
|
|
|
|
|
@Override
|
|
|
|
|
public void getDnbInstantByJob() {
|
|
|
|
|
@ -341,9 +346,9 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
List<BaseEnergyType> baseEnergyTypes = baseEnergyTypeService.selectBaseEnergyTypeList(new BaseEnergyType());
|
|
|
|
|
|
|
|
|
|
//获取当前时间与一小时前时间
|
|
|
|
|
long endTime= System.currentTimeMillis();
|
|
|
|
|
//从一小时前开始,十点的话就是从九点开始,不是九点零一,开始就
|
|
|
|
|
long startTime = System.currentTimeMillis()-60*60*1000-10;
|
|
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
|
|
//从一小时前开始,十点的话就是从九点开始,不是九点零一,开始就
|
|
|
|
|
long startTime = System.currentTimeMillis() - 60 * 60 * 1000 - 10;
|
|
|
|
|
tdHistorySelectDto.setStartTime(startTime);
|
|
|
|
|
tdHistorySelectDto.setEndTime(endTime);
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
@ -353,45 +358,46 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(new BaseMonitorInfo());
|
|
|
|
|
List<ReportPointDnb> reportPoints = new ArrayList<ReportPointDnb>();
|
|
|
|
|
//根据计量设备id获取能源表名称
|
|
|
|
|
if (!baseMonitorInfos.isEmpty()){
|
|
|
|
|
for (BaseMonitorInfo baseMonitorInfo : baseMonitorInfos) {
|
|
|
|
|
try {
|
|
|
|
|
String emsTableName = TdEngineConstants.getEmsTableName(baseMonitorInfo.getMonitorId());
|
|
|
|
|
//获取当前数据以及一小时前的数据
|
|
|
|
|
tdHistorySelectDto.setTableName(emsTableName);
|
|
|
|
|
if (!baseMonitorInfos.isEmpty()) {
|
|
|
|
|
for (BaseMonitorInfo baseMonitorInfo : baseMonitorInfos) {
|
|
|
|
|
try {
|
|
|
|
|
String emsTableName = TdEngineConstants.getEmsTableName(baseMonitorInfo.getObjid());
|
|
|
|
|
//获取当前数据以及一小时前的数据
|
|
|
|
|
tdHistorySelectDto.setTableName(emsTableName);
|
|
|
|
|
// tdHistorySelectDto.setTableName("t_e_ceshi7");
|
|
|
|
|
List<Map<String, Object>> dnbInstant =remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER).getData().getDataList();
|
|
|
|
|
R<TdReturnDataVo> historyData = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER);
|
|
|
|
|
ReportPointDnb report = new ReportPointDnb();
|
|
|
|
|
report.setMonitorId(baseMonitorInfo.getMonitorId());
|
|
|
|
|
report.setMonitorName(baseMonitorInfo.getMonitorName());
|
|
|
|
|
report.setpMonitorId(String.valueOf(baseMonitorInfo.getParentId()));
|
|
|
|
|
report.setAddress(baseMonitorInfo.getMonitorAddr());
|
|
|
|
|
BigDecimal MaxZXYG= BigDecimal.valueOf(Double.valueOf(String.valueOf(dnbInstant.get(dnbInstant.size()-1).get("zxyg"))));
|
|
|
|
|
BigDecimal MinZXYG = BigDecimal.valueOf(Double.valueOf(String.valueOf(dnbInstant.get(0).get("zxyg"))));
|
|
|
|
|
//pt ct值暂时无用,默认为1 需要时从计量设备信息中根据id获取
|
|
|
|
|
int pt = 1;
|
|
|
|
|
int ct = 1;
|
|
|
|
|
//乘ct值和pt值
|
|
|
|
|
/**
|
|
|
|
|
* (MAX(ifnull(t1.zxyg,0)) - MIN(ifnull(t1.zxyg,0))) * ifnull(t2.pt,1) * ifnull(t2.ct,1)as expend,
|
|
|
|
|
* 0 as price,
|
|
|
|
|
* hour(date_sub(@nowDate, interval 1 hour)) as point_time,
|
|
|
|
|
* DATE_FORMAT(date_sub(@nowDate, interval 1 hour),'%Y-%m-%d %H:00:00') as begin_time,
|
|
|
|
|
* DATE_FORMAT(@nowDate,'%Y-%m-%d %H:00:00') as end_time,
|
|
|
|
|
* DATE_FORMAT(date_sub(@nowDate,interval 1 hour),'%Y-%m-%d %H:00:00') as record_time*/
|
|
|
|
|
report.setExpend(MaxZXYG.subtract(MinZXYG).multiply(new BigDecimal(pt)).multiply(new BigDecimal(ct)));
|
|
|
|
|
report.setPrice(new BigDecimal(0));
|
|
|
|
|
report.setPointTime(String.valueOf(hours-1));
|
|
|
|
|
report.setMeterValue(MaxZXYG.subtract(MinZXYG));
|
|
|
|
|
report.setRecordTime(sdf.parse(sdf.format(startTime)));
|
|
|
|
|
report.setBeginTime(sdf.parse(sdf.format(startTime)));
|
|
|
|
|
report.setEndTime(sdf.parse(sdf.format(endTime)));
|
|
|
|
|
reportPoints.add(report);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
List<Map<String, Object>> dnbInstant = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER).getData().getDataList();
|
|
|
|
|
R<TdReturnDataVo> historyData = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER);
|
|
|
|
|
ReportPointDnb report = new ReportPointDnb();
|
|
|
|
|
report.setMonitorId(baseMonitorInfo.getMonitorId());
|
|
|
|
|
report.setMonitorName(baseMonitorInfo.getMonitorName());
|
|
|
|
|
report.setpMonitorId(String.valueOf(baseMonitorInfo.getParentId()));
|
|
|
|
|
report.setAddress(baseMonitorInfo.getMonitorAddr());
|
|
|
|
|
BigDecimal MaxZXYG = BigDecimal.valueOf(Double.valueOf(String.valueOf(dnbInstant.get(dnbInstant.size() - 1).get("zxyg"))));
|
|
|
|
|
BigDecimal MinZXYG = BigDecimal.valueOf(Double.valueOf(String.valueOf(dnbInstant.get(0).get("zxyg"))));
|
|
|
|
|
//pt ct值暂时无用,默认为1 需要时从计量设备信息中根据id获取
|
|
|
|
|
int pt = 1;
|
|
|
|
|
int ct = 1;
|
|
|
|
|
//乘ct值和pt值
|
|
|
|
|
/**
|
|
|
|
|
* (MAX(ifnull(t1.zxyg,0)) - MIN(ifnull(t1.zxyg,0))) * ifnull(t2.pt,1) * ifnull(t2.ct,1)as expend,
|
|
|
|
|
* 0 as price,
|
|
|
|
|
* hour(date_sub(@nowDate, interval 1 hour)) as point_time,
|
|
|
|
|
* DATE_FORMAT(date_sub(@nowDate, interval 1 hour),'%Y-%m-%d %H:00:00') as begin_time,
|
|
|
|
|
* DATE_FORMAT(@nowDate,'%Y-%m-%d %H:00:00') as end_time,
|
|
|
|
|
* DATE_FORMAT(date_sub(@nowDate,interval 1 hour),'%Y-%m-%d %H:00:00') as record_time*/
|
|
|
|
|
report.setExpend(MaxZXYG.subtract(MinZXYG).multiply(new BigDecimal(pt)).multiply(new BigDecimal(ct)));
|
|
|
|
|
report.setPrice(new BigDecimal(0));
|
|
|
|
|
report.setPointTime(String.valueOf(hours - 1));
|
|
|
|
|
report.setMeterValue(MaxZXYG.subtract(MinZXYG));
|
|
|
|
|
report.setRecordTime(sdf.parse(sdf.format(startTime)));
|
|
|
|
|
report.setBeginTime(sdf.parse(sdf.format(startTime)));
|
|
|
|
|
report.setEndTime(sdf.parse(sdf.format(endTime)));
|
|
|
|
|
reportPoints.add(report);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
}
|
|
|
|
|
//将获取到的数据存入到实时数据中
|
|
|
|
|
for (ReportPointDnb p : reportPoints) {
|
|
|
|
|
reportPointDnbService.insertReportPointDnb(p);
|
|
|
|
|
|