diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataLogController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataLogController.java new file mode 100644 index 0000000..3a041a4 --- /dev/null +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataLogController.java @@ -0,0 +1,42 @@ +package com.inspur.web.controller.ipc; + +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.ipc.service.IIpcDataLogService; +import com.inspur.ipc.service.IIpcDataShowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据展示界面 + * + * @author inspur + */ +@RestController +@RequestMapping("/ipc/dataLog") +public class IpcDataLogController extends BaseController { + @Autowired + private IIpcDataLogService iIpcDataLogService; + /** + * 查询plc数据记录 + */ + @PreAuthorize("@ss.hasPermi('ipc:dataLog:query')") + @GetMapping(value = "/plc/{part}") + public AjaxResult queryPlcDataLog(@PathVariable String part) + { + return AjaxResult.success(iIpcDataLogService.queryPlcDataLog(part)); + } + /** + * 查询传感器温振数据记录 + */ + @PreAuthorize("@ss.hasPermi('ipc:dataLog:query')") + @GetMapping(value = "/sensor/{part}") + public AjaxResult querySensorDataLog(@PathVariable String part) + { + return AjaxResult.success(iIpcDataLogService.querySensorDataLog(part)); + } +} diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataReceiveController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataReceiveController.java new file mode 100644 index 0000000..4219e1b --- /dev/null +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataReceiveController.java @@ -0,0 +1,32 @@ +package com.inspur.web.controller.ipc; + +import com.inspur.common.core.domain.AjaxResult; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/ipc/dataReceive") +public class IpcDataReceiveController { + /** + * 接收PLC数据 + */ + @PostMapping("/plcData") + public AjaxResult plcData(@RequestBody Map> map) { + System.out.println(map.toString()); + return AjaxResult.success(1); + } + + /** + * 接收温振传感器数据 + */ + @PostMapping("/sensorData") + public AjaxResult sensorData(@RequestBody Map> map) { + System.out.println(map.toString()); + return AjaxResult.success(1); + } +} diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataShowController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataShowController.java new file mode 100644 index 0000000..ff308bb --- /dev/null +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcDataShowController.java @@ -0,0 +1,32 @@ +package com.inspur.web.controller.ipc; + +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.ipc.service.IIpcDataShowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据展示界面 + * + * @author inspur + */ +@RestController +@RequestMapping("ipc/dataShow") +public class IpcDataShowController extends BaseController { + @Autowired + private IIpcDataShowService iIpcDataShowService; + /** + * 获取展示数据 + */ +// @PreAuthorize("@ss.hasPermi('ipc:dataShow:query')") + @GetMapping(value = "/byPart/{parts}") + public AjaxResult getShowData(@PathVariable("parts") String[] parts) + { + return AjaxResult.success(iIpcDataShowService.getShowData(parts)); + } +} diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcFaultTreeConfigController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcFaultTreeConfigController.java new file mode 100644 index 0000000..3d074b7 --- /dev/null +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/ipc/IpcFaultTreeConfigController.java @@ -0,0 +1,112 @@ +package com.inspur.web.controller.ipc; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.ipc.domain.IpcFaultTreeConfig; +import com.inspur.ipc.service.IIpcFaultTreeConfigService; +import com.inspur.common.utils.poi.ExcelUtil; + +/** + * 故障树配置Controller + * + * @author inspur + * @date 2024-04-02 + */ +@RestController +@RequestMapping("/ipc/faultTreeConfig") +public class IpcFaultTreeConfigController extends BaseController +{ + @Autowired + private IIpcFaultTreeConfigService ipcFaultTreeConfigService; + + /** + * 查询故障树配置列表 + */ + @PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:list')") + @GetMapping("/list") + public AjaxResult list(IpcFaultTreeConfig ipcFaultTreeConfig) + { + List list = ipcFaultTreeConfigService.selectIpcFaultTreeConfigList(ipcFaultTreeConfig); + return AjaxResult.success(list); + } + + /** + * 导出故障树配置列表 + */ + @PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:export')") + @Log(title = "故障树配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, IpcFaultTreeConfig ipcFaultTreeConfig) + { + List list = ipcFaultTreeConfigService.selectIpcFaultTreeConfigList(ipcFaultTreeConfig); + ExcelUtil util = new ExcelUtil(IpcFaultTreeConfig.class); + util.exportExcel(response, list, "故障树配置数据"); + } + + /** + * 获取故障树配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:query')") + @GetMapping(value = "/{nodeId}") + public AjaxResult getInfo(@PathVariable("nodeId") Long nodeId) + { + return AjaxResult.success(ipcFaultTreeConfigService.selectIpcFaultTreeConfigByNodeId(nodeId)); + } + + /** + * 校验是否存在子节点 + */ + @PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:query')") + @GetMapping(value = "/hasChild/{nodeId}") + public AjaxResult hasChild(@PathVariable("nodeId") Long nodeId) + { + return AjaxResult.success(ipcFaultTreeConfigService.hasChild(nodeId)); + } + + /** + * 新增故障树配置 + */ + @PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:add')") + @Log(title = "故障树配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody IpcFaultTreeConfig ipcFaultTreeConfig) + { + return toAjax(ipcFaultTreeConfigService.insertIpcFaultTreeConfig(ipcFaultTreeConfig)); + } + + /** + * 修改故障树配置 + */ + @PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:edit')") + @Log(title = "故障树配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody IpcFaultTreeConfig ipcFaultTreeConfig) + { + return toAjax(ipcFaultTreeConfigService.updateIpcFaultTreeConfig(ipcFaultTreeConfig)); + } + + /** + * 删除故障树配置 + */ + @PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:remove')") + @Log(title = "故障树配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{nodeIds}") + public AjaxResult remove(@PathVariable Long[] nodeIds) + { + return toAjax(ipcFaultTreeConfigService.deleteIpcFaultTreeConfigByNodeIds(nodeIds)); + } +} diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java index 15c7941..4c32f53 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCData2SyncThread.java @@ -8,6 +8,7 @@ import com.inspur.ipc.domain.IpcMonitorField; import com.inspur.ipc.service.IIpcAlarmRecordService; import com.inspur.ipc.service.IIpcMonitorFieldService; import com.inspur.ipc.utils.GetBeanUtil; +import com.inspur.ipc.utils.IpcConstant; import com.inspur.ipc.utils.IpcUtil; import com.inspur.system.service.influx.InfluxDBService; import com.serotonin.modbus4j.BatchRead; @@ -73,7 +74,6 @@ public class IPCData2SyncThread implements Runnable { List partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); List sensorList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.SENSOR_MONITOR_PARAMS_KEY); List alarmRecordList = new ArrayList<>(); - String measurement = "tzipc_sensor_monitor_data_list"; // 字典数据列表集合 for (IpcMonitorField part : partList) { Map tags = new TreeMap(); @@ -116,7 +116,7 @@ public class IPCData2SyncThread implements Runnable { InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); // 根据报警规则校验 alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.SENSOR_MONITOR_PARAMS_KEY)); - i.insert(measurement, tags, fields); + i.insert(IpcConstant.SENSOR_MEASUREMENT, tags, fields); } // 批量保存报警数据 if(!alarmRecordList.isEmpty()){ diff --git a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java index 5625c8b..2391c77 100644 --- a/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java +++ b/tzipc-server/tzipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IPCDataSyncThread.java @@ -9,6 +9,7 @@ import com.inspur.ipc.domain.IpcMonitorField; import com.inspur.ipc.service.IIpcAlarmRecordService; import com.inspur.ipc.service.IIpcMonitorFieldService; import com.inspur.ipc.utils.GetBeanUtil; +import com.inspur.ipc.utils.IpcConstant; import com.inspur.ipc.utils.IpcUtil; import com.inspur.system.service.ISysDictDataService; import com.inspur.system.service.influx.InfluxDBService; @@ -77,7 +78,6 @@ public class IPCDataSyncThread implements Runnable { List partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); List plcList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_KEY); List alarmRecordList = new ArrayList<>(); - String measurement = "tzipc_plc_monitor_data_list"; // 字典数据列表集合 for (IpcMonitorField part : partList) { Map tags = new TreeMap(); @@ -120,7 +120,7 @@ public class IPCDataSyncThread implements Runnable { InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); // 根据报警规则校验 alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.PLC_MONITOR_PARAMS_KEY)); - i.insert(measurement, tags, fields); + i.insert(IpcConstant.PLC_MEASUREMENT, tags, fields); } // 批量保存报警数据 if(!alarmRecordList.isEmpty()){ diff --git a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java index 2205df4..d13b4bb 100644 --- a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java +++ b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java @@ -22,7 +22,7 @@ import com.inspur.framework.security.handle.LogoutSuccessHandlerImpl; /** * spring security配置 - * + * * @author inspur */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private UserDetailsService userDetailsService; - + /** * 认证失败处理类 */ @@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 跨域过滤器 */ @@ -110,6 +110,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 .antMatchers("/login", "/register", "/captchaImage").anonymous() + // 数据接收接口,允许匿名访问 + .antMatchers("/ipc/dataReceive/plcData","/ipc/dataReceive/sensorData").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRecord.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRecord.java index 7467b9b..f5f106f 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRecord.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRecord.java @@ -83,6 +83,12 @@ public class IpcAlarmRecord extends BaseEntity { @Excel(name = "报警描述") private String alarmDetail; + /** + * 报警规则id + */ + @Excel(name = "报警规则id") + private Long ruleConfigId; + /** * 状态 0 未处理 1 已处理 */ @@ -199,6 +205,14 @@ public class IpcAlarmRecord extends BaseEntity { return alarmDetail; } + public Long getRuleConfigId() { + return ruleConfigId; + } + + public void setRuleConfigId(Long ruleConfigId) { + this.ruleConfigId = ruleConfigId; + } + public void setAlarmStatus(String alarmStatus) { this.alarmStatus = alarmStatus; } @@ -226,7 +240,7 @@ public class IpcAlarmRecord extends BaseEntity { public IpcAlarmRecord() { } - public IpcAlarmRecord(String id, String partKey, String part, String nameKey, String name, String alarmData, String unit, String alarmLevel, String referenceName, String alarmDetail) { + public IpcAlarmRecord(String id, String partKey, String part, String nameKey, String name, String alarmData, String unit, String alarmLevel, String referenceName, String alarmDetail,Long ruleConfigId) { this.id = id; this.partKey = partKey; this.part = part; @@ -237,6 +251,7 @@ public class IpcAlarmRecord extends BaseEntity { this.alarmLevel = alarmLevel; this.referenceName = referenceName; this.alarmDetail = alarmDetail; + this.ruleConfigId = ruleConfigId; } @Override diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRulesConfig.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRulesConfig.java index df01e4a..9609de3 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRulesConfig.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcAlarmRulesConfig.java @@ -51,8 +51,8 @@ public class IpcAlarmRulesConfig extends BaseEntity @Excel(name = "规则值2(参考标准为区间时需要)") private BigDecimal referenceValue2; - /** 规则值显示 */ - @Excel(name = "规则值显示") + /** 规则描述 */ + @Excel(name = "规则描述") private String referenceName; /** 判断规则 */ diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcFaultTreeConfig.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcFaultTreeConfig.java new file mode 100644 index 0000000..71ec42e --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/domain/IpcFaultTreeConfig.java @@ -0,0 +1,205 @@ +package com.inspur.ipc.domain; + +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.TreeEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 故障树配置对象 ipc_fault_tree_config + * + * @author inspur + * @date 2024-04-02 + */ +public class IpcFaultTreeConfig extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 节点id */ + private Long nodeId; + + /** 部门名称 */ + @Excel(name = "节点名称") + private String nodeName; + + /** 所属部位 */ + @Excel(name = "所属部位") + private String partKey; + + /** 规则id */ + @Excel(name = "规则id") + private Long alarmRuleConfigId; + + /** 规则描述 */ + @Excel(name = "规则描述") + private String alarmRuleConfigDescription; + + /** 节点图标 */ + @Excel(name = "节点图标") + private String iconCls; + + /** 节点形状 */ + @Excel(name = "节点形状") + private String nodeShapeType; + + /** 节点默认颜色 */ + @Excel(name = "节点默认颜色") + private String nodeDefaultColor; + + /** 节点报警颜色 */ + @Excel(name = "节点报警颜色") + private String nodeAlarmColor; + + /** 是否叶子节点 */ + @Excel(name = "是否叶子节点") + private String isLeaf; + + /** 是否报警 */ + @Excel(name = "是否报警") + private String isAlarm; + + /** 节点状态(0正常 1停用) */ + @Excel(name = "节点状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + public void setNodeId(Long nodeId) + { + this.nodeId = nodeId; + } + + public Long getNodeId() + { + return nodeId; + } + public void setNodeName(String nodeName) + { + this.nodeName = nodeName; + } + + public String getNodeName() + { + return nodeName; + } + public void setPartKey(String partKey) + { + this.partKey = partKey; + } + + public String getPartKey() + { + return partKey; + } + public void setIconCls(String iconCls) + { + this.iconCls = iconCls; + } + + public String getIconCls() + { + return iconCls; + } + public void setNodeShapeType(String nodeShapeType) + { + this.nodeShapeType = nodeShapeType; + } + + public String getNodeShapeType() + { + return nodeShapeType; + } + public void setNodeDefaultColor(String nodeDefaultColor) + { + this.nodeDefaultColor = nodeDefaultColor; + } + + public String getNodeDefaultColor() + { + return nodeDefaultColor; + } + public void setNodeAlarmColor(String nodeAlarmColor) + { + this.nodeAlarmColor = nodeAlarmColor; + } + + public String getNodeAlarmColor() + { + return nodeAlarmColor; + } + public void setIsAlarm(String isAlarm) + { + this.isAlarm = isAlarm; + } + + public String getIsAlarm() + { + return isAlarm; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + public Long getAlarmRuleConfigId() { + return alarmRuleConfigId; + } + + public void setAlarmRuleConfigId(Long alarmRuleConfigId) { + this.alarmRuleConfigId = alarmRuleConfigId; + } + + public String getAlarmRuleConfigDescription() { + return alarmRuleConfigDescription; + } + + public void setAlarmRuleConfigDescription(String alarmRuleConfigDescription) { + this.alarmRuleConfigDescription = alarmRuleConfigDescription; + } + + public String getIsLeaf() { + return isLeaf; + } + + public void setIsLeaf(String isLeaf) { + this.isLeaf = isLeaf; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("nodeId", getNodeId()) + .append("parentId", getParentId()) + .append("ancestors", getAncestors()) + .append("nodeName", getNodeName()) + .append("orderNum", getOrderNum()) + .append("partKey", getPartKey()) + .append("iconCls", getIconCls()) + .append("nodeShapeType", getNodeShapeType()) + .append("nodeDefaultColor", getNodeDefaultColor()) + .append("nodeAlarmColor", getNodeAlarmColor()) + .append("isAlarm", getIsAlarm()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/mapper/IpcFaultTreeConfigMapper.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/mapper/IpcFaultTreeConfigMapper.java new file mode 100644 index 0000000..81893a6 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/mapper/IpcFaultTreeConfigMapper.java @@ -0,0 +1,69 @@ +package com.inspur.ipc.mapper; + +import java.util.List; +import com.inspur.ipc.domain.IpcFaultTreeConfig; + +/** + * 故障树配置Mapper接口 + * + * @author inspur + * @date 2024-04-02 + */ +public interface IpcFaultTreeConfigMapper +{ + /** + * 查询故障树配置 + * + * @param nodeId 故障树配置主键 + * @return 故障树配置 + */ + public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId); + + /** + * 校验是否存在子节点 + * + * @param nodeId 故障树配置主键 + * @return 故障树配置 + */ + public int hasChild(Long nodeId); + + /** + * 查询故障树配置列表 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 故障树配置集合 + */ + public List selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig); + + /** + * 新增故障树配置 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 结果 + */ + public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig); + + /** + * 修改故障树配置 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 结果 + */ + public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig); + + /** + * 删除故障树配置 + * + * @param nodeId 故障树配置主键 + * @return 结果 + */ + public int deleteIpcFaultTreeConfigByNodeId(Long nodeId); + + /** + * 批量删除故障树配置 + * + * @param nodeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataLogService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataLogService.java new file mode 100644 index 0000000..99c1913 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataLogService.java @@ -0,0 +1,21 @@ +package com.inspur.ipc.service; + +import java.util.List; +import java.util.Map; + +/** + * 数据展示界面Service接口 + * + * @author inspur + */ +public interface IIpcDataLogService { + /** + * plc数据记录接口 + */ + public List> queryPlcDataLog(String part); + + /** + * 温振传感器数据记录接口 + */ + public List> querySensorDataLog(String part); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataShowService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataShowService.java new file mode 100644 index 0000000..18f26fe --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcDataShowService.java @@ -0,0 +1,15 @@ +package com.inspur.ipc.service; + +import java.util.Map; + +/** + * 数据展示界面Service接口 + * + * @author inspur + */ +public interface IIpcDataShowService { + /** + * 展示数据获取 + */ + public Map getShowData(String [] parts); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcFaultTreeConfigService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcFaultTreeConfigService.java new file mode 100644 index 0000000..8071a6c --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/IIpcFaultTreeConfigService.java @@ -0,0 +1,70 @@ +package com.inspur.ipc.service; + +import java.util.List; +import com.inspur.ipc.domain.IpcFaultTreeConfig; + +/** + * 故障树配置Service接口 + * + * @author inspur + * @date 2024-04-02 + */ +public interface IIpcFaultTreeConfigService +{ + /** + * 查询故障树配置 + * + * @param nodeId 故障树配置主键 + * @return 故障树配置 + */ + public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId); + + + /** + * 校验是否存在子节点 + * + * @param nodeId 故障树配置主键 + * @return 故障树配置 + */ + public boolean hasChild(Long nodeId); + + /** + * 查询故障树配置列表 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 故障树配置集合 + */ + public List selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig); + + /** + * 新增故障树配置 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 结果 + */ + public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig); + + /** + * 修改故障树配置 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 结果 + */ + public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig); + + /** + * 批量删除故障树配置 + * + * @param nodeIds 需要删除的故障树配置主键集合 + * @return 结果 + */ + public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds); + + /** + * 删除故障树配置信息 + * + * @param nodeId 故障树配置主键 + * @return 结果 + */ + public int deleteIpcFaultTreeConfigByNodeId(Long nodeId); +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java new file mode 100644 index 0000000..643f104 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataLogServiceImpl.java @@ -0,0 +1,37 @@ +package com.inspur.ipc.service.impl; + +import com.inspur.ipc.service.IIpcDataLogService; +import com.inspur.ipc.utils.IpcConstant; +import com.inspur.system.service.influx.InfluxDBService; +import org.influxdb.dto.QueryResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class IpcDataLogServiceImpl implements IIpcDataLogService { + @Autowired + private InfluxDBService influxDBService; + + /** + * plc数据记录接口 + */ + @Override + public List> queryPlcDataLog(String part) { + QueryResult query = influxDBService.query("select * from "+ IpcConstant.PLC_MEASUREMENT +" where part = '" + part + "' order by time desc limit 20"); + List> maps = influxDBService.queryResultProcess(query); + return maps; + } + + /** + * 温振传感器数据记录接口 + */ + @Override + public List> querySensorDataLog(String part) { + QueryResult query = influxDBService.query("select * from "+ IpcConstant.SENSOR_MEASUREMENT +" where part = '" + part + "' order by time desc limit 20"); + List> maps = influxDBService.queryResultProcess(query); + return maps; + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java new file mode 100644 index 0000000..60197e3 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcDataShowServiceImpl.java @@ -0,0 +1,234 @@ +package com.inspur.ipc.service.impl; + +import com.inspur.ipc.service.IIpcDataShowService; +import com.inspur.ipc.utils.IpcConstant; +import com.inspur.system.service.influx.InfluxDBService; +import org.influxdb.dto.QueryResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * 数据展示界面Service业务层处理 + * + * @author inspur + */ +@Service +public class IpcDataShowServiceImpl implements IIpcDataShowService { + + @Autowired + private InfluxDBService influxDBService; + + /** + * 展示数据获取 + */ + @Override + public Map getShowData(String[] parts) { + Map dataMap = new HashMap<>(); + CompletableFuture>> plcDataMap = CompletableFuture.supplyAsync(() -> dealPlcData(parts)); + CompletableFuture>> sensorDataMap = CompletableFuture.supplyAsync(() -> dealSensorData(parts)); + try { + plcDataMap.get().get(IpcConstant.OPERATION_NAME).putAll(sensorDataMap.get().get(IpcConstant.OPERATION_NAME)); + plcDataMap.get().get(IpcConstant.DRIVE_NAME).putAll(sensorDataMap.get().get(IpcConstant.DRIVE_NAME)); + dataMap.put(IpcConstant.OPERATION_NAME,plcDataMap.get().get(IpcConstant.OPERATION_NAME)); + dataMap.put(IpcConstant.DRIVE_NAME,plcDataMap.get().get(IpcConstant.DRIVE_NAME)); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + return dataMap; + } + + /** + * plc数据处理 + * @param parts + * @return + */ + private Map> dealPlcData(String[] parts){ + Map> dataMap = new HashMap<>(); + try { + for (String part : parts) { + // 数据获取 + QueryResult plcQuery = influxDBService.query("select * from " + IpcConstant.PLC_MEASUREMENT + " where part = '" + part + "' order by time desc limit 60"); + List> plcMaps = influxDBService.queryResultProcess(plcQuery); + // plc数据处理 + // 横轴时间轴 + List xPlcData = new ArrayList<>(); + //颗粒度4μm + List pz4 = new ArrayList<>(); + //颗粒度6μm + List pz6 = new ArrayList<>(); + //颗粒度14μm + List pz14 = new ArrayList<>(); + //颗粒度21μm + List pz21 = new ArrayList<>(); + //油水含量 + List owc = new ArrayList<>(); + //油品粘度 + List ov = new ArrayList<>(); + //回油温度 + List rot = new ArrayList<>(); + //轴套区温度 + List ssat = new ArrayList<>(); + //进油压力 + List oip = new ArrayList<>(); + //油液密度 + List od = new ArrayList<>(); + for (int i = plcMaps.size() - 1; i > -1; i--) { + System.out.println("1111111111111"); + Map plcObj = plcMaps.get(i); + pz4.add(plcObj.get("pz4") == null ? 0 : plcObj.get("pz4")); + pz6.add(plcObj.get("pz6") == null ? 0 : plcObj.get("pz6")); + pz14.add(plcObj.get("pz14") == null ? 0 : plcObj.get("pz14")); + pz21.add(plcObj.get("pz21") == null ? 0 : plcObj.get("pz21")); + owc.add(plcObj.get("owc") == null ? 0 : plcObj.get("owc")); + ov.add(plcObj.get("ov") == null ? 0 : plcObj.get("ov")); + rot.add(plcObj.get("rot") == null ? 0 : plcObj.get("rot")); + ssat.add(plcObj.get("ssat") == null ? 0 : plcObj.get("ssat")); + oip.add(plcObj.get("oip") == null ? 0 : plcObj.get("oip")); + od.add(plcObj.get("od") == null ? 0 : plcObj.get("od")); + if (plcObj.containsKey("insertTime") && null != plcObj.get("insertTime")) { + xPlcData.add(this.dateTimeDeal(plcObj.get("insertTime"),"minute")); + } + } + Map map = new HashMap<>(); + if (!xPlcData.isEmpty()) { + int plcIndex = xPlcData.size() - 1; + map.put("xPlcData", xPlcData); + map.put("pz4", pz4); + map.put("pz6", pz6); + map.put("pz14", pz14); + map.put("pz21", pz21); + map.put("owc", owc.get(plcIndex)); + map.put("ov", ov.get(plcIndex)); + map.put("rot", rot.get(plcIndex)); + map.put("ssat", ssat.get(plcIndex)); + map.put("oip", oip.get(plcIndex)); + map.put("od", od.get(plcIndex)); + } + // 根据位置处理 + if (part.endsWith(IpcConstant.OPERATION_PROFILE)) { + // 操作侧 + dataMap.put(IpcConstant.OPERATION_NAME, map); + } else if (part.endsWith(IpcConstant.DRIVE_PROFILE)) { + // 传动侧 + dataMap.put(IpcConstant.DRIVE_NAME, map); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return dataMap; + } + /** + * 传感器温振数据处理 + * @param parts + * @return + */ + private Map> dealSensorData(String[] parts){ + Map> dataMap = new HashMap<>(); + try { + for (String part : parts) { + // 数据获取 + QueryResult sensorQuery = influxDBService.query("select * from " + IpcConstant.SENSOR_MEASUREMENT + " where part = '" + part + "' order by time desc limit 60"); + List> sensorMaps = influxDBService.queryResultProcess(sensorQuery); + // 传感器温振数据处理 + // 横轴时间轴 + List xSensorData = new ArrayList<>(); + //振动温度 + List vt = new ArrayList<>(); + //振动x轴 + List vx = new ArrayList<>(); + //振动y轴 + List vy = new ArrayList<>(); + //振动z轴 + List vz = new ArrayList<>(); + for (int i = sensorMaps.size() - 1; i > -1; i--) { + System.out.println("222222222222"); + Map sensorObj = sensorMaps.get(i); + vt.add(sensorObj.get("vt") == null ? 0 : sensorObj.get("vt")); + vx.add(sensorObj.get("vx") == null ? 0 : sensorObj.get("vx")); + vy.add(sensorObj.get("vy") == null ? 0 : sensorObj.get("vy")); + vz.add(sensorObj.get("vz") == null ? 0 : sensorObj.get("vz")); + if (sensorObj.containsKey("insertTime") && null != sensorObj.get("insertTime")) { + xSensorData.add(this.dateTimeDeal(sensorObj.get("insertTime"),"hour")); + } + } + Map map = new HashMap<>(); + if (!xSensorData.isEmpty()) { + int sensorIndex = xSensorData.size() - 1; + map.put("xSensorData", xSensorData); + map.put("vt", vt.get(sensorIndex)); + map.put("vx", vx); + map.put("vy", vy); + map.put("vz", vz); + } + // 根据位置处理 + if (part.endsWith(IpcConstant.OPERATION_PROFILE)) { + // 操作侧 + dataMap.put(IpcConstant.OPERATION_NAME, map); + } else if (part.endsWith(IpcConstant.DRIVE_PROFILE)) { + // 传动侧 + dataMap.put(IpcConstant.DRIVE_NAME, map); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return dataMap; + } + + /** + * 时间格式处理 + * + * @param obj + * @return + */ + private String dateTimeDeal(Object obj, String type) { + String dateTime = ""; + //处理时间 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + Date time = simpleDateFormat.parse(String.valueOf(obj)); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(time); + int y = calendar.get(Calendar.YEAR); + String month = calendar.get(Calendar.MONTH) > 9 ? ""+calendar.get(Calendar.MONTH) : "0"+calendar.get(Calendar.MONTH); + String d = calendar.get(Calendar.DAY_OF_MONTH) > 9 ? ""+calendar.get(Calendar.DAY_OF_MONTH) : "0"+calendar.get(Calendar.DAY_OF_MONTH); + String h = calendar.get(Calendar.HOUR_OF_DAY) > 9 ? ""+calendar.get(Calendar.HOUR_OF_DAY) : "0"+calendar.get(Calendar.HOUR_OF_DAY); + String m = calendar.get(Calendar.MINUTE) > 9 ? ""+calendar.get(Calendar.MINUTE) : "0"+calendar.get(Calendar.MINUTE); + String s = calendar.get(Calendar.SECOND) > 9 ? ""+calendar.get(Calendar.SECOND) : "0"+calendar.get(Calendar.SECOND); + switch (type) { + case "year": + dateTime = y + "-" + month + "-" + d + " " + h + ":" + m + ":" + s; + break; + case "month": + dateTime = month + "-" + d + " " + h + ":" + m + ":" + s; + break; + case "day": + dateTime = d + " " + h + ":" + m + ":" + s; + break; + case "hour": + dateTime = h + ":" + m + ":" + s; + break; + case "minute": + dateTime = m + ":" + s; + break; + default: + dateTime = m + ":" + s; + break; + } + } catch (ParseException e) { + e.printStackTrace(); + } + return dateTime; + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcFaultTreeConfigServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcFaultTreeConfigServiceImpl.java new file mode 100644 index 0000000..acf50c1 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcFaultTreeConfigServiceImpl.java @@ -0,0 +1,105 @@ +package com.inspur.ipc.service.impl; + +import java.util.List; +import com.inspur.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.ipc.mapper.IpcFaultTreeConfigMapper; +import com.inspur.ipc.domain.IpcFaultTreeConfig; +import com.inspur.ipc.service.IIpcFaultTreeConfigService; + +/** + * 故障树配置Service业务层处理 + * + * @author inspur + * @date 2024-04-02 + */ +@Service +public class IpcFaultTreeConfigServiceImpl implements IIpcFaultTreeConfigService +{ + @Autowired + private IpcFaultTreeConfigMapper ipcFaultTreeConfigMapper; + + /** + * 查询故障树配置 + * + * @param nodeId 故障树配置主键 + * @return 故障树配置 + */ + @Override + public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId) + { + return ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigByNodeId(nodeId); + } + /** + * 校验是否存在子节点 + * + * @param nodeId 故障树配置主键 + * @return 故障树配置 + */ + @Override + public boolean hasChild(Long nodeId){ + return ipcFaultTreeConfigMapper.hasChild(nodeId) > 0; + } + /** + * 查询故障树配置列表 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 故障树配置 + */ + @Override + public List selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig) + { + return ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigList(ipcFaultTreeConfig); + } + + /** + * 新增故障树配置 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 结果 + */ + @Override + public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig) + { + ipcFaultTreeConfig.setCreateTime(DateUtils.getNowDate()); + return ipcFaultTreeConfigMapper.insertIpcFaultTreeConfig(ipcFaultTreeConfig); + } + + /** + * 修改故障树配置 + * + * @param ipcFaultTreeConfig 故障树配置 + * @return 结果 + */ + @Override + public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig) + { + ipcFaultTreeConfig.setUpdateTime(DateUtils.getNowDate()); + return ipcFaultTreeConfigMapper.updateIpcFaultTreeConfig(ipcFaultTreeConfig); + } + + /** + * 批量删除故障树配置 + * + * @param nodeIds 需要删除的故障树配置主键 + * @return 结果 + */ + @Override + public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds) + { + return ipcFaultTreeConfigMapper.deleteIpcFaultTreeConfigByNodeIds(nodeIds); + } + + /** + * 删除故障树配置信息 + * + * @param nodeId 故障树配置主键 + * @return 结果 + */ + @Override + public int deleteIpcFaultTreeConfigByNodeId(Long nodeId) + { + return ipcFaultTreeConfigMapper.deleteIpcFaultTreeConfigByNodeId(nodeId); + } +} diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java index 97cb377..acdacbf 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcConstant.java @@ -35,4 +35,29 @@ public class IpcConstant { * 区间外 */ public static final String OUTSIDE_INTERVAL = "区间外"; + + /** + * plc数据表名 + */ + public static final String PLC_MEASUREMENT = "tzipc_plc_monitor_data_list"; + /** + * 温振传感器数据表名 + */ + public static final String SENSOR_MEASUREMENT = "tzipc_sensor_monitor_data_list"; + /** + * 操作侧简写 + */ + public static final String OPERATION_PROFILE = "o"; + /** + * 传动侧简写 + */ + public static final String DRIVE_PROFILE = "d"; + /** + * 操作侧 + */ + public static final String OPERATION_NAME = "operation"; + /** + * 传动侧 + */ + public static final String DRIVE_NAME = "drive"; } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java index 816d957..c89d6ea 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/utils/IpcUtil.java @@ -86,7 +86,7 @@ public class IpcUtil { if (judgeAlarm(map.get(rulesConfig.getNameKey()), rulesConfig.getReferenceValue1(), rulesConfig.getReferenceValue2(), rulesConfig.getReferenceCon())) { // 报警数据 map.put("isAlarm", 1); - IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(IdUtils.fastSimpleUUID(),rulesConfig.getPartKey(), rulesConfig.getPart(), rulesConfig.getNameKey(), rulesConfig.getName(), String.valueOf(map.get(rulesConfig.getNameKey())), rulesConfig.getUnit(), rulesConfig.getAlarmLevel(), rulesConfig.getReferenceName(), rulesConfig.getAlarmDetail()); + IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(IdUtils.fastSimpleUUID(),rulesConfig.getPartKey(), rulesConfig.getPart(), rulesConfig.getNameKey(), rulesConfig.getName(), String.valueOf(map.get(rulesConfig.getNameKey())), rulesConfig.getUnit(), rulesConfig.getAlarmLevel(), rulesConfig.getReferenceName(), rulesConfig.getAlarmDetail(),rulesConfig.getId()); returnList.add(ipcAlarmRecord); } else { // 正常数据 diff --git a/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcAlarmRecordMapper.xml b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcAlarmRecordMapper.xml index 6751384..e53fc86 100644 --- a/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcAlarmRecordMapper.xml +++ b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcAlarmRecordMapper.xml @@ -107,11 +107,11 @@ insert into ipc_alarm_record - (id,part_key,part,name_key,name,alarm_data,unit,alarm_level,alarm_time,reference_name,alarm_detail,alarm_status) + (id,part_key,part,name_key,name,alarm_data,unit,alarm_level,alarm_time,reference_name,alarm_detail,alarm_status,rule_config_id) values (#{item.id}, #{item.partKey}, #{item.part},#{item.nameKey},#{item.name},#{item.alarmData}, #{item.unit}, - #{item.alarmLevel},sysdate(),#{item.referenceName},#{item.alarmDetail},'0') + #{item.alarmLevel},sysdate(),#{item.referenceName},#{item.alarmDetail},'0',#{item.ruleConfigId}) ; diff --git a/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcFaultTreeConfigMapper.xml b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcFaultTreeConfigMapper.xml new file mode 100644 index 0000000..aae1ce1 --- /dev/null +++ b/tzipc-server/tzipc-system/src/main/resources/mapper/ipc/IpcFaultTreeConfigMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select node_id, parent_id, ancestors, node_name, order_num, part_key, icon_cls, node_shape_type, node_default_color, node_alarm_color, is_leaf,is_alarm, status, del_flag, create_by, create_time, update_by, update_time,alarm_rule_config_id,alarm_rule_config_description from ipc_fault_tree_config + + + + + + + + + insert into ipc_fault_tree_config + + parent_id, + ancestors, + node_name, + order_num, + part_key, + icon_cls, + node_shape_type, + node_default_color, + node_alarm_color, + is_leaf, + is_alarm, + status, + del_flag, + create_by, + create_time, + update_by, + update_time, + alarm_rule_config_id, + alarm_rule_config_description, + + + #{parentId}, + #{ancestors}, + #{nodeName}, + #{orderNum}, + #{partKey}, + #{iconCls}, + #{nodeShapeType}, + #{nodeDefaultColor}, + #{nodeAlarmColor}, + #{isLeaf}, + #{isAlarm}, + #{status}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmRuleConfigId}, + #{alarmRuleConfigDescription}, + + + + + update ipc_fault_tree_config + + parent_id = #{parentId}, + ancestors = #{ancestors}, + node_name = #{nodeName}, + order_num = #{orderNum}, + part_key = #{partKey}, + icon_cls = #{iconCls}, + node_shape_type = #{nodeShapeType}, + node_default_color = #{nodeDefaultColor}, + node_alarm_color = #{nodeAlarmColor}, + is_leaf = #{isLeaf}, + is_alarm = #{isAlarm}, + status = #{status}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_rule_config_id = #{alarmRuleConfigId}, + alarm_rule_config_description = #{alarmRuleConfigDescription}, + + where node_id = #{nodeId} + + + + delete from ipc_fault_tree_config where node_id = #{nodeId} + + + + delete from ipc_fault_tree_config where node_id in + + #{nodeId} + + + diff --git a/tzipc-ui/src/api/ipc/dataLog.js b/tzipc-ui/src/api/ipc/dataLog.js new file mode 100644 index 0000000..da30284 --- /dev/null +++ b/tzipc-ui/src/api/ipc/dataLog.js @@ -0,0 +1,17 @@ +import request from "@/utils/request"; + +// 查询plc数据记录 +export function getPlcDataLog(part) { + return request({ + url: "/ipc/dataLog/plc/" + part, + method: "get", + }); +} + +// 查询传感器温振数据记录 +export function getSensorDataLog(part) { + return request({ + url: "/ipc/dataLog/sensor/" + part, + method: "get", + }); +} diff --git a/tzipc-ui/src/api/ipc/dataShow.js b/tzipc-ui/src/api/ipc/dataShow.js new file mode 100644 index 0000000..10a84c5 --- /dev/null +++ b/tzipc-ui/src/api/ipc/dataShow.js @@ -0,0 +1,9 @@ +import request from "@/utils/request"; + +// 根据部位查询展示数据 +export function getShowData(parts) { + return request({ + url: "/ipc/dataShow/byPart/" + parts, + method: "get", + }); +} diff --git a/tzipc-ui/src/api/ipc/faultTreeConfig.js b/tzipc-ui/src/api/ipc/faultTreeConfig.js new file mode 100644 index 0000000..048ee9c --- /dev/null +++ b/tzipc-ui/src/api/ipc/faultTreeConfig.js @@ -0,0 +1,52 @@ +import request from "@/utils/request"; + +// 查询故障树配置列表 +export function listFaultTreeConfig(query) { + return request({ + url: "/ipc/faultTreeConfig/list", + method: "get", + params: query, + }); +} + +// 查询故障树配置详细 +export function getFaultTreeConfig(nodeId) { + return request({ + url: "/ipc/faultTreeConfig/" + nodeId, + method: "get", + }); +} + +// 查询是否有子节点 +export function selectHasChild(nodeId) { + return request({ + url: "/ipc/faultTreeConfig/hasChild/" + nodeId, + method: "get", + }); +} + +// 新增故障树配置 +export function addFaultTreeConfig(data) { + return request({ + url: "/ipc/faultTreeConfig", + method: "post", + data: data, + }); +} + +// 修改故障树配置 +export function updateFaultTreeConfig(data) { + return request({ + url: "/ipc/faultTreeConfig", + method: "put", + data: data, + }); +} + +// 删除故障树配置 +export function delFaultTreeConfig(nodeId) { + return request({ + url: "/ipc/faultTreeConfig/" + nodeId, + method: "delete", + }); +} diff --git a/tzipc-ui/src/views/ipc/alarmRecord/index.vue b/tzipc-ui/src/views/ipc/alarmRecord/index.vue index eea2092..220d727 100644 --- a/tzipc-ui/src/views/ipc/alarmRecord/index.vue +++ b/tzipc-ui/src/views/ipc/alarmRecord/index.vue @@ -677,7 +677,7 @@ export default { \ No newline at end of file + diff --git a/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue b/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue new file mode 100644 index 0000000..3b02320 --- /dev/null +++ b/tzipc-ui/src/views/ipc/dataLog/plcDataLog.vue @@ -0,0 +1,280 @@ + + + + + \ No newline at end of file diff --git a/tzipc-ui/src/views/ipc/dataLog/sensorDataLog.vue b/tzipc-ui/src/views/ipc/dataLog/sensorDataLog.vue new file mode 100644 index 0000000..5648577 --- /dev/null +++ b/tzipc-ui/src/views/ipc/dataLog/sensorDataLog.vue @@ -0,0 +1,238 @@ + + + + + \ No newline at end of file diff --git a/tzipc-ui/src/views/ipc/faultTree/faultTreeConfig.vue b/tzipc-ui/src/views/ipc/faultTree/faultTreeConfig.vue new file mode 100644 index 0000000..c865c80 --- /dev/null +++ b/tzipc-ui/src/views/ipc/faultTree/faultTreeConfig.vue @@ -0,0 +1,771 @@ + + + \ No newline at end of file diff --git a/tzipc-ui/src/views/ipc/faultTree/faultTreeShow.vue b/tzipc-ui/src/views/ipc/faultTree/faultTreeShow.vue new file mode 100644 index 0000000..87f711a --- /dev/null +++ b/tzipc-ui/src/views/ipc/faultTree/faultTreeShow.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/tzipc-ui/src/views/ipc/faultTree/ruleConfigDialog.vue b/tzipc-ui/src/views/ipc/faultTree/ruleConfigDialog.vue new file mode 100644 index 0000000..ab1ed4c --- /dev/null +++ b/tzipc-ui/src/views/ipc/faultTree/ruleConfigDialog.vue @@ -0,0 +1,198 @@ + + + + + \ No newline at end of file diff --git a/tzipc-ui/src/views/ipc/rulesConfig/index.vue b/tzipc-ui/src/views/ipc/rulesConfig/index.vue index 29a5b47..6b49101 100644 --- a/tzipc-ui/src/views/ipc/rulesConfig/index.vue +++ b/tzipc-ui/src/views/ipc/rulesConfig/index.vue @@ -72,63 +72,9 @@ >重置 - - - item.id); - this.single = selection.length !== 1; - this.multiple = !selection.length; - }, /** 新增按钮操作 */ handleAdd() { this.reset(); @@ -637,7 +571,7 @@ export default { /** 修改按钮操作 */ handleUpdate(row) { this.reset(); - const id = row.id || this.ids; + const id = row.id; getConfig(id).then((response) => { this.form = response.data; this.open = true; @@ -673,6 +607,6 @@ export default { width: 100%; } .color-green { - color: greenyellow; + color: green; } - \ No newline at end of file +