|
|
@ -73,157 +73,155 @@ public class InstantServiceImpl implements InstantService { |
|
|
@LogRecord(type = SYSTEM_INSTANT_TYPE, subType = SYSTEM_INSTANT_CREATE_SUB_TYPE, bizNo = "{{#role.id}}", |
|
|
@LogRecord(type = SYSTEM_INSTANT_TYPE, subType = SYSTEM_INSTANT_CREATE_SUB_TYPE, bizNo = "{{#role.id}}", |
|
|
success = SYSTEM_INSTANT_CREATE_SUCCESS) |
|
|
success = SYSTEM_INSTANT_CREATE_SUCCESS) |
|
|
public List<String> createInstant(InstantSaveReqVO createReqVO, Integer type) throws IOException { |
|
|
public List<String> createInstant(InstantSaveReqVO createReqVO, Integer type) throws IOException { |
|
|
// 1. 校验角色
|
|
|
// 1. 校验角色
|
|
|
// validateRoleDuplicate(createReqVO.getName(), createReqVO.getCode(), null);
|
|
|
// validateRoleDuplicate(createReqVO.getName(), createReqVO.getCode(), null);
|
|
|
|
|
|
//根据modelversionid查询modelversion,录入instantcfg表的modelversion字段
|
|
|
|
|
|
String modelVersion = versionMapper.selectById(createReqVO.getModelVersionId()).getVersion(); |
|
|
|
|
|
createReqVO.setModelVersion(modelVersion); |
|
|
|
|
|
|
|
|
|
|
|
//插入除instantInfo外的所有数据,获取到id
|
|
|
|
|
|
// 2. 插入到数据库-status、visible默认值
|
|
|
|
|
|
InstantTableDO instant = BeanUtils.toBean(createReqVO, InstantTableDO.class) |
|
|
|
|
|
.setInstantStatus(ObjUtil.defaultIfNull(createReqVO.getInstantStatus(), 1L)) |
|
|
|
|
|
.setVisible(ObjUtil.defaultIfNull(createReqVO.getVisible(), 1L)); |
|
|
|
|
|
|
|
|
|
|
|
instantTableMapper.insert(instant); |
|
|
|
|
|
|
|
|
//根据modelversionid查询modelversion,录入instantcfg表的modelversion字段
|
|
|
// 3. 记录操作日志上下文
|
|
|
String modelVersion = versionMapper.selectById(createReqVO.getModelVersionId()).getVersion(); |
|
|
LogRecordContext.putVariable("instant", instant); |
|
|
createReqVO.setModelVersion(modelVersion); |
|
|
|
|
|
|
|
|
|
|
|
//插入除instantInfo外的所有数据,获取到id
|
|
|
Long insertId = instant.getMpId(); |
|
|
// 2. 插入到数据库-status、visible默认值
|
|
|
|
|
|
InstantTableDO instant = BeanUtils.toBean(createReqVO, InstantTableDO.class) |
|
|
|
|
|
.setInstantStatus(ObjUtil.defaultIfNull(createReqVO.getInstantStatus(), 1L)) |
|
|
|
|
|
.setVisible(ObjUtil.defaultIfNull(createReqVO.getVisible(), 1L)); |
|
|
|
|
|
|
|
|
|
|
|
instantTableMapper.insert(instant); |
|
|
//处理数据
|
|
|
|
|
|
|
|
|
// 3. 记录操作日志上下文
|
|
|
|
|
|
LogRecordContext.putVariable("instant", instant); |
|
|
|
|
|
|
|
|
|
|
|
Long insertId = instant.getMpId(); |
|
|
|
|
|
|
|
|
|
|
|
//处理数据
|
|
|
|
|
|
// inputInfo 各种转换
|
|
|
// inputInfo 各种转换
|
|
|
List<pointInfo> pointInfoList = createReqVO.getPointInfo(); |
|
|
List<pointInfo> pointInfoList = createReqVO.getPointInfo(); |
|
|
System.out.println(pointInfoList); |
|
|
System.out.println(pointInfoList); |
|
|
|
|
|
|
|
|
List<String> inputInfoList = new ArrayList<>(); |
|
|
List<String> inputInfoList = new ArrayList<>(); |
|
|
List<String> inputNameList = new ArrayList<>(); |
|
|
List<String> inputNameList = new ArrayList<>(); |
|
|
List<String> unitList = new ArrayList<>(); |
|
|
List<String> unitList = new ArrayList<>(); |
|
|
List<String> outPointInfoList = new ArrayList<>(); |
|
|
List<String> outPointInfoList = new ArrayList<>(); |
|
|
List<String> timePointInfoList = new ArrayList<>(); |
|
|
List<String> timePointInfoList = new ArrayList<>(); |
|
|
List<String> biasPointInfoList = new ArrayList<>(); |
|
|
List<String> biasPointInfoList = new ArrayList<>(); |
|
|
List<String> faultVariablePointList = new ArrayList<>(); |
|
|
List<String> faultVariablePointList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
List<Point> InstantPointList = new ArrayList<>(); |
|
|
List<Point> InstantPointList = new ArrayList<>(); |
|
|
Point point = new Point(); |
|
|
Point point = new Point(); |
|
|
String outpoint = ""; |
|
|
String outpoint = ""; |
|
|
for (Integer i = 0; i < pointInfoList.size(); i++) { |
|
|
for (Integer i = 0; i < pointInfoList.size(); i++) { |
|
|
inputInfoList.add(pointInfoList.get(i).getPointId()); |
|
|
inputInfoList.add(pointInfoList.get(i).getPointId()); |
|
|
inputNameList.add(pointInfoList.get(i).getDescription()); |
|
|
inputNameList.add(pointInfoList.get(i).getDescription()); |
|
|
unitList.add(pointInfoList.get(i).getUnit()); |
|
|
unitList.add(pointInfoList.get(i).getUnit()); |
|
|
if (Objects.isNull(pointInfoList.get(i).getType()) || pointInfoList.get(i).getType().equals("1")) { |
|
|
if (Objects.isNull(pointInfoList.get(i).getType()) || pointInfoList.get(i).getType().equals("1")) { |
|
|
//构建重构值对象
|
|
|
//构建重构值对象
|
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "R"; |
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "R"; |
|
|
point = new Point(); |
|
|
point = new Point(); |
|
|
point.setGroupName("WARN"); |
|
|
point.setGroupName("WARN"); |
|
|
outPointInfoList.add(outpoint); |
|
|
outPointInfoList.add(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_重构值"); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_重构值"); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setItemType(5); |
|
|
point.setItemType(5); |
|
|
InstantPointList.add(point); |
|
|
InstantPointList.add(point); |
|
|
|
|
|
|
|
|
//构建时间值对象
|
|
|
//构建时间值对象
|
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "T"; |
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "T"; |
|
|
point = new Point(); |
|
|
point = new Point(); |
|
|
point.setGroupName("WARN"); |
|
|
point.setGroupName("WARN"); |
|
|
timePointInfoList.add(outpoint); |
|
|
timePointInfoList.add(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_时间值"); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_时间值"); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setItemType(5); |
|
|
point.setItemType(5); |
|
|
InstantPointList.add(point); |
|
|
InstantPointList.add(point); |
|
|
|
|
|
|
|
|
//构建偏差值对象
|
|
|
//构建偏差值对象
|
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "B"; |
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "B"; |
|
|
point = new Point(); |
|
|
point = new Point(); |
|
|
point.setGroupName("WARN"); |
|
|
point.setGroupName("WARN"); |
|
|
biasPointInfoList.add(outpoint); |
|
|
biasPointInfoList.add(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_偏差值"); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_偏差值"); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setItemType(5); |
|
|
point.setItemType(5); |
|
|
InstantPointList.add(point); |
|
|
InstantPointList.add(point); |
|
|
|
|
|
|
|
|
//构建状态值对象
|
|
|
//构建状态值对象
|
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "F"; |
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + String.format("%04d", i + 1) + "F"; |
|
|
point = new Point(); |
|
|
point = new Point(); |
|
|
point.setGroupName("WARN"); |
|
|
point.setGroupName("WARN"); |
|
|
faultVariablePointList.add(outpoint); |
|
|
faultVariablePointList.add(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_状态值"); |
|
|
point.setDescriptor(pointInfoList.get(i).getDescription() + "_状态值"); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setEngUnits(pointInfoList.get(i).getUnit()); |
|
|
point.setItemType(5); |
|
|
point.setItemType(5); |
|
|
InstantPointList.add(point); |
|
|
InstantPointList.add(point); |
|
|
} else { |
|
|
} else { |
|
|
outpoint = ""; |
|
|
outpoint = ""; |
|
|
outPointInfoList.add(outpoint); |
|
|
outPointInfoList.add(outpoint); |
|
|
timePointInfoList.add(outpoint); |
|
|
timePointInfoList.add(outpoint); |
|
|
biasPointInfoList.add(outpoint); |
|
|
biasPointInfoList.add(outpoint); |
|
|
faultVariablePointList.add(outpoint); |
|
|
faultVariablePointList.add(outpoint); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createReqVO.setMpId(insertId); |
|
|
createReqVO.setMpId(insertId); |
|
|
createReqVO.setInstantStatus(instant.getInstantStatus()); |
|
|
createReqVO.setInstantStatus(instant.getInstantStatus()); |
|
|
createReqVO.setVisible(instant.getVisible()); |
|
|
createReqVO.setVisible(instant.getVisible()); |
|
|
createReqVO.setInputInfo(inputInfoList); |
|
|
createReqVO.setInputInfo(inputInfoList); |
|
|
createReqVO.setInputName(inputNameList); |
|
|
createReqVO.setInputName(inputNameList); |
|
|
createReqVO.setUnit(unitList); |
|
|
createReqVO.setUnit(unitList); |
|
|
createReqVO.setOutPointInfo(outPointInfoList); |
|
|
createReqVO.setOutPointInfo(outPointInfoList); |
|
|
createReqVO.setTimePointInfo(timePointInfoList); |
|
|
createReqVO.setTimePointInfo(timePointInfoList); |
|
|
createReqVO.setBiasPointInfo(biasPointInfoList); |
|
|
createReqVO.setBiasPointInfo(biasPointInfoList); |
|
|
createReqVO.setFaultVariablePointInfo(faultVariablePointList); |
|
|
createReqVO.setFaultVariablePointInfo(faultVariablePointList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//构建模型实例ste值-没有unit参数
|
|
|
//构建模型实例ste值-没有unit参数
|
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + "_ste"; |
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + "_ste"; |
|
|
//赋值-createReqVO
|
|
|
//赋值-createReqVO
|
|
|
createReqVO.setModel_state(outpoint); |
|
|
createReqVO.setModel_state(outpoint); |
|
|
point = new Point(); |
|
|
point = new Point(); |
|
|
point.setGroupName("WARN"); |
|
|
point.setGroupName("WARN"); |
|
|
point.setItemName(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setDescriptor(instant.getMpName() + "_残差值"); |
|
|
point.setDescriptor(instant.getMpName() + "_残差值"); |
|
|
point.setItemType(5); |
|
|
point.setItemType(5); |
|
|
InstantPointList.add(point); |
|
|
InstantPointList.add(point); |
|
|
|
|
|
|
|
|
//构建模型实例状态值-没有unit参数
|
|
|
//构建模型实例状态值-没有unit参数
|
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + "_status"; |
|
|
outpoint = HEAD + "M" + String.format("%04d", insertId) + "_status"; |
|
|
//赋值-createReqVO
|
|
|
//赋值-createReqVO
|
|
|
createReqVO.setModel_status(outpoint); |
|
|
createReqVO.setModel_status(outpoint); |
|
|
point = new Point(); |
|
|
point = new Point(); |
|
|
point.setGroupName("WARN"); |
|
|
point.setGroupName("WARN"); |
|
|
point.setItemName(outpoint); |
|
|
point.setItemName(outpoint); |
|
|
point.setDescriptor(instant.getMpName() + "_状态值"); |
|
|
point.setDescriptor(instant.getMpName() + "_状态值"); |
|
|
point.setItemType(5); |
|
|
point.setItemType(5); |
|
|
InstantPointList.add(point); |
|
|
InstantPointList.add(point); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新instantInfo字段
|
|
|
//更新instantInfo字段
|
|
|
InstantSaveReqVO updateReqVO = new InstantSaveReqVO(); |
|
|
InstantSaveReqVO updateReqVO = new InstantSaveReqVO(); |
|
|
updateReqVO.setMpId(instant.getMpId()); |
|
|
updateReqVO.setMpId(instant.getMpId()); |
|
|
updateReqVO.setInstantInfo(JsonUtils.toJsonString(createReqVO)); |
|
|
updateReqVO.setInstantInfo(JsonUtils.toJsonString(createReqVO)); |
|
|
|
|
|
|
|
|
updateInstant(updateReqVO); |
|
|
updateInstant(updateReqVO); |
|
|
List<String> resultList = new ArrayList<String>(); |
|
|
List<String> resultList = new ArrayList<String>(); |
|
|
|
|
|
|
|
|
resultList.add(instant.getMpId().toString()); |
|
|
resultList.add(instant.getMpId().toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Point item : InstantPointList) { |
|
|
for (Point item : InstantPointList) { |
|
|
// 每次循环输出list中的元素
|
|
|
// 每次循环输出list中的元素
|
|
|
System.out.println(item.toString()); |
|
|
System.out.println(item.toString()); |
|
|
//循环加点
|
|
|
//循环加点
|
|
|
String ss = exaUtils.setPoint(EXA_IP, item); |
|
|
String ss = exaUtils.setPoint(EXA_IP, item); |
|
|
resultList.add(ss); |
|
|
resultList.add(ss); |
|
|
} |
|
|
} |
|
|
createWarn1(instant, createReqVO); |
|
|
createWarn1(instant, createReqVO); |
|
|
return resultList; |
|
|
return resultList; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|