|
|
|
@ -85,6 +85,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
public RecordDnbInstantDataVo selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant) {
|
|
|
|
|
RecordDnbInstantDataVo recordDnbInstantDataVo = new RecordDnbInstantDataVo();
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
Integer pageNum = Integer.valueOf((String) recordDnbInstant.getParams().get("pageNum"));
|
|
|
|
|
Integer pageSize = Integer.valueOf((String) recordDnbInstant.getParams().get("pageSize"));
|
|
|
|
|
Integer offset = (pageNum - 1) * pageSize;
|
|
|
|
@ -95,6 +96,15 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
String stratTime = (String) recordDnbInstant.getParams().get("beginTime");
|
|
|
|
|
String endTime = (String) recordDnbInstant.getParams().get("endTime");
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
//todo 因为手动补录采集时间默认为空,且手动补录页面初始化需要展示出所有的历史数据
|
|
|
|
|
if (stratTime==null){
|
|
|
|
|
//开始事件设置的足够远,确保可以查询到所有数据
|
|
|
|
|
stratTime ="2023-01-01 00:00:00";
|
|
|
|
|
}
|
|
|
|
|
if (endTime==null){
|
|
|
|
|
//结束事件设置为当前时间
|
|
|
|
|
endTime = sdf.format(new Date(System.currentTimeMillis()));
|
|
|
|
|
}
|
|
|
|
|
Date dateStrat = sdf.parse(stratTime);
|
|
|
|
|
Date dateEnd = sdf.parse(endTime);
|
|
|
|
|
|
|
|
|
@ -125,21 +135,44 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
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")))));
|
|
|
|
|
if (data.get("volatagea")!=null ){
|
|
|
|
|
recordDnbInstant1.setVA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagea")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("volatageb")!=null ){
|
|
|
|
|
recordDnbInstant1.setVB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatageb")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("volatagec")!=null ){
|
|
|
|
|
recordDnbInstant1.setVC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("volatagec")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("currenta")!=null ){
|
|
|
|
|
recordDnbInstant1.setIA(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currenta")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("currentb")!=null ){
|
|
|
|
|
recordDnbInstant1.setIB(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentb")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("currentc")!=null ){
|
|
|
|
|
recordDnbInstant1.setIC(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("currentc")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("glys")!=null ){
|
|
|
|
|
recordDnbInstant1.setGlys(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("glys")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("zxyg")!=null ){
|
|
|
|
|
recordDnbInstant1.setZxyg(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("zxyg")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("activepower")!=null ){
|
|
|
|
|
recordDnbInstant1.setActivePower(BigDecimal.valueOf(Double.valueOf(String.valueOf(data.get("activepower")))));
|
|
|
|
|
}
|
|
|
|
|
if (data.get("reactivepower")!=null ){
|
|
|
|
|
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"))));
|
|
|
|
|
if (data.get("reactivepower")!=null ){
|
|
|
|
|
recordDnbInstant1.setCollectType(Long.valueOf(String.valueOf(data.get("collecttype"))));
|
|
|
|
|
}
|
|
|
|
|
records.add(recordDnbInstant1);
|
|
|
|
|
}
|
|
|
|
|
recordDnbInstantDataVo.setCount(tdReturnDataVo.getCount());
|
|
|
|
@ -172,9 +205,49 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
recordDnbInstant.setRecordTime(new Date());
|
|
|
|
|
recordDnbInstant.setCollectType(0L);
|
|
|
|
|
return recordDnbInstantMapper.insertRecordDnbInstant(recordDnbInstant);
|
|
|
|
|
BaseMonitorInfo baseMonitorInfo = new BaseMonitorInfo();
|
|
|
|
|
baseMonitorInfo.setMonitorId(recordDnbInstant.getMonitorId());
|
|
|
|
|
List<BaseMonitorInfo> baseMonitorInfos = baseMonitorInfoService.selectBaseMonitorInfoList(baseMonitorInfo);
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
Date collectTime = recordDnbInstant.getCollectTime();
|
|
|
|
|
TdTableVo tdTableVo = new TdTableVo();
|
|
|
|
|
tdTableVo.setDatabaseName("db_hwmes");
|
|
|
|
|
tdTableVo.setSuperTableName("st_electricity");
|
|
|
|
|
tdTableVo.setTableName("t_e_"+baseMonitorInfos.get(0).getObjid());
|
|
|
|
|
List<TdField> fields = new ArrayList<TdField>();
|
|
|
|
|
List<TdField> field2s = new ArrayList<TdField>();
|
|
|
|
|
TdField field = new TdField();
|
|
|
|
|
TdField field2 = new TdField();
|
|
|
|
|
TdField field3 = new TdField();
|
|
|
|
|
TdField field4 = new TdField();
|
|
|
|
|
field.setFieldName(TdEngineConstants.ST_TAG_EMS_BUILDID);
|
|
|
|
|
field.setFieldValue(baseMonitorInfos.get(0).getBuildId());
|
|
|
|
|
field2.setFieldName(TdEngineConstants.ST_TAG_EMS_MONITORNAME);
|
|
|
|
|
field2.setFieldValue(baseMonitorInfos.get(0).getMonitorName());
|
|
|
|
|
field3.setFieldName(TdEngineConstants.ST_TAG_EMS_MONITOROBJID);
|
|
|
|
|
field3.setFieldValue(baseMonitorInfos.get(0).getObjid());
|
|
|
|
|
field4.setFieldName(TdEngineConstants.ST_TAG_EMS_MONITORID);
|
|
|
|
|
field4.setFieldValue(baseMonitorInfos.get(0).getMonitorId());
|
|
|
|
|
fields.add(field);
|
|
|
|
|
fields.add(field2);
|
|
|
|
|
fields.add(field3);
|
|
|
|
|
fields.add(field4);
|
|
|
|
|
tdTableVo.setTagsFieldValues(fields);
|
|
|
|
|
TdField field5 = new TdField();
|
|
|
|
|
TdField field6 = new TdField();
|
|
|
|
|
field5.setFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
|
|
|
|
|
|
|
|
|
|
field5.setFieldValue(sdf.format(collectTime));
|
|
|
|
|
field6.setFieldName("zxyg");
|
|
|
|
|
field6.setFieldValue(recordDnbInstant.getZxyg());
|
|
|
|
|
field2s.add(field5);
|
|
|
|
|
field2s.add(field6);
|
|
|
|
|
tdTableVo.setSchemaFields(field2s);
|
|
|
|
|
R<?> r = remoteTdEngineService.insertTable(tdTableVo, SecurityConstants.INNER);
|
|
|
|
|
// recordDnbInstant.setRecordTime(new Date());
|
|
|
|
|
// recordDnbInstant.setCollectType(0L);
|
|
|
|
|
// return recordDnbInstantMapper.insertRecordDnbInstant(recordDnbInstant);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|