ems
增加计量设备时在创建tdengine子表时如果异常抛出回滚事务
1.3.5
xins 11 months ago
parent 0f20bd8189
commit a0a4ff75b2

@ -113,6 +113,8 @@ public class BaseMonitorInfo1ServiceImpl implements IBaseMonitorInfo1Service {
//创建TDEngine子表 //创建TDEngine子表
this.createEmsTbale(baseMonitorInfo.getMonitorId(), baseMonitorInfo.getBuildId(), baseMonitorInfo.getMonitorName(), baseMonitorInfo.getObjid()); this.createEmsTbale(baseMonitorInfo.getMonitorId(), baseMonitorInfo.getBuildId(), baseMonitorInfo.getMonitorName(), baseMonitorInfo.getObjid());
return result; return result;
} catch (Exception e) { } catch (Exception e) {
System.out.println("新增计量设备信息异常1111:" + e.getMessage()); System.out.println("新增计量设备信息异常1111:" + e.getMessage());
@ -149,8 +151,10 @@ public class BaseMonitorInfo1ServiceImpl implements IBaseMonitorInfo1Service {
fields.add(field3); fields.add(field3);
fields.add(field4); fields.add(field4);
tableVo.setTagsFieldValues(fields); tableVo.setTagsFieldValues(fields);
remoteTdEngineService.createTable(tableVo, SecurityConstants.INNER); R<?> tdReturnMsg = remoteTdEngineService.createTable(tableVo, SecurityConstants.INNER);
if (tdReturnMsg.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
throw new RuntimeException(tdReturnMsg.getMsg());
}
} }
/** /**
@ -289,7 +293,7 @@ public class BaseMonitorInfo1ServiceImpl implements IBaseMonitorInfo1Service {
alterTagVo.setDatabaseName(databaseName); alterTagVo.setDatabaseName(databaseName);
alterTagVo.setTableName(tableName); alterTagVo.setTableName(tableName);
alterTagVo.setTagName(TdEngineConstants.ST_TAG_EMS_BUILDID); alterTagVo.setTagName(TdEngineConstants.ST_TAG_EMS_BUILDID);
alterTagVo.setTagValue("'" +baseMonitorInfo.getBuildId()+ "'"); alterTagVo.setTagValue("'" + baseMonitorInfo.getBuildId() + "'");
alterTagVos.add(alterTagVo); alterTagVos.add(alterTagVo);
} }

Loading…
Cancel
Save