网关信息更新

This commit is contained in:
zhangjunwen 2024-09-18 10:10:30 +08:00
parent c6d082dbe5
commit f16b89180f
8 changed files with 130 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Ka1采集卡
* @Author zhangjunwen * @Author zhangjunwen
* @create 2024/9/4 * @create 2024/9/4
*/ */
@ -24,7 +25,7 @@ public class Channel1DataProcess implements Runnable{
private void process() { private void process() {
String measurement = "gateway_channel_current_data"; String measurement = "gateway_channel_current_data";
String equid = "2e3d0190e63eda526da89d6c751f08f3"; String equid = "2e3d0190e63eda526da89d6c751f08f3";//修改为网关
InfluxDBService influxDBService = SpringUtils.getBean(InfluxDBService.class); InfluxDBService influxDBService = SpringUtils.getBean(InfluxDBService.class);
AlarmRulesApi alarmRulesApi = SpringUtils.getBean(AlarmRulesApi.class); AlarmRulesApi alarmRulesApi = SpringUtils.getBean(AlarmRulesApi.class);

View File

@ -20,4 +20,9 @@ public class GatewayInfoPageReqVO extends PageParam {
@Schema(description = "状态0正常1异常2停机", example = "2") @Schema(description = "状态0正常1异常2停机", example = "2")
private Integer status; private Integer status;
@Schema(description = "设备id")
private String equipId;
@Schema(description = "机床网关编号")
private String gatewayCode;
} }

View File

@ -59,4 +59,23 @@ public class GatewayInfoRespVO {
@ExcelProperty("网关图片路径") @ExcelProperty("网关图片路径")
private String gatewayPicPath; private String gatewayPicPath;
@Schema(description = "设备id")
@ExcelProperty("设备id")
private String equipId;
@Schema(description = "机床网关编号")
@ExcelProperty("机床网关编号")
private String gatewayCode;
@Schema(description = "客户名称")
@ExcelProperty("客户名称")
private String customerName;
@Schema(description = "设备编号")
@ExcelProperty("设备编号")
private String equipNo;
@Schema(description = "机床型号")
@ExcelProperty("机床型号")
private String modelName;
} }

View File

@ -44,4 +44,9 @@ public class GatewayInfoSaveReqVO {
@Schema(description = "网关图片路径") @Schema(description = "网关图片路径")
private String gatewayPicPath; private String gatewayPicPath;
@Schema(description = "设备id")
private String equipId;
@Schema(description = "机床网关编号")
private String gatewayCode;
} }

View File

@ -1,5 +1,6 @@
package com.inspur.module.system.dal.dataobject.gatewayinfo; package com.inspur.module.system.dal.dataobject.gatewayinfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
@ -67,4 +68,28 @@ public class GatewayInfoDO extends BaseDO {
*/ */
private String gatewayPicPath; private String gatewayPicPath;
/**
* 设备id
*/
private String equipId;
/**
* 网关编号
*/
private String gatewayCode;
/**
* 客户名称
*/
private String customerName;
/**
* 设备编号
*/
private String equipNo;
/**
* 机床型号
*/
private String modelName;
} }

View File

@ -2,12 +2,16 @@ package com.inspur.module.system.dal.mysql.gatewayinfo;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX; import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.module.system.controller.admin.alarm.vo.EquipAlarmDataPageReqVO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*; import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
import org.apache.ibatis.annotations.Param;
/** /**
* 机床网关信息 Mapper * 机床网关信息 Mapper
@ -25,4 +29,13 @@ public interface GatewayInfoMapper extends BaseMapperX<GatewayInfoDO> {
.orderByDesc(GatewayInfoDO::getGatewayId)); .orderByDesc(GatewayInfoDO::getGatewayId));
} }
/**
* 查询网关信息列表
*/
public IPage<GatewayInfoDO> selectGatewayList(IPage<GatewayInfoDO> page, @Param("reqVO") GatewayInfoPageReqVO reqVO);
/**
* 根据id查询网关信息
*/
public GatewayInfoDO selectGatewayById(@Param("id") String id);
} }

View File

@ -1,6 +1,9 @@
package com.inspur.module.system.service.gatewayinfo; package com.inspur.module.system.service.gatewayinfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inspur.framework.tenant.core.aop.TenantIgnore; import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -65,7 +68,7 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
@TenantIgnore @TenantIgnore
private void validateGatewayInfoExists(String id) { private void validateGatewayInfoExists(String id) {
if (gatewayInfoMapper.selectById(id) == null) { if (gatewayInfoMapper.selectGatewayById(id) == null) {
throw exception(GATEWAY_INFO_NOT_EXISTS); throw exception(GATEWAY_INFO_NOT_EXISTS);
} }
} }
@ -73,13 +76,15 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
@Override @Override
@TenantIgnore @TenantIgnore
public GatewayInfoDO getGatewayInfo(String id) { public GatewayInfoDO getGatewayInfo(String id) {
return gatewayInfoMapper.selectById(id); return gatewayInfoMapper.selectGatewayById(id);
} }
@Override @Override
@TenantIgnore @TenantIgnore
public PageResult<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) { public PageResult<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) {
return gatewayInfoMapper.selectPage(pageReqVO); IPage<GatewayInfoDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
gatewayInfoMapper.selectGatewayList(page, pageReqVO);
return new PageResult<>(page.getRecords(), page.getTotal());
} }
} }

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.module.system.dal.mysql.gatewayinfo.GatewayInfoMapper">
<resultMap type="com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO" id="GatewayInfoResult">
<result property="gatewayId" column="gateway_id" />
<result property="equipId" column="equip_id" />
<result property="gatewayName" column="gateway_name" />
<result property="gatewayModel" column="gateway_model" />
<result property="gatewayCode" column="gateway_code" />
<result property="gatewayMfg" column="gateway_mfg" />
<result property="gatewayLocation" column="gateway_location" />
<result property="firmwareVersion" column="firmware_version" />
<result property="ipAddress" column="ip_address" />
<result property="gatewaySpn" column="gateway_spn" />
<result property="status" column="status" />
<result property="gatewayPicPath" column="gateway_pic_path" />
<result property="remark" column="remark" />
<result property="customerName" column="customer_name" />
<result property="equipNo" column="equip_no" />
<result property="modelName" column="model_name" />
</resultMap>
<sql id="selectGatewayInfoVo">
select igi.gateway_id,igi.equip_id,igi.gateway_name,igi.gateway_model,igi.gateway_code,igi.gateway_mfg,igi.gateway_location,igi.firmware_version,igi.ip_address,igi.gateway_spn,igi.status,igi.gateway_pic_path,igi.remark,iei.equip_no,imi.model_name,ic.customer_name FROM `imt_gateway_info` igi
left join imt_equip_info iei on igi.equip_id = iei.equip_id
left join imt_model_info imi on iei.model_id = imi.model_id
left join imt_customer_info ic on iei.customer_id = ic.customer_id
</sql>
<select id="selectGatewayList" resultMap="GatewayInfoResult">
<include refid="selectGatewayInfoVo"/>
where igi.deleted = '0'
and igi.status = 0
<if test="reqVO.equipId != null and reqVO.equipId != ''"> and igi.equip_id = #{reqVO.equipId}</if>
<if test="reqVO.gatewayName != null and reqVO.gatewayName != ''"> and igi.gateway_name like concat('%', #{reqVO.gatewayName}, '%')</if>
<if test="reqVO.gatewayModel != null and reqVO.gatewayModel != ''"> and igi.gateway_model like concat('%', #{reqVO.gatewayModel}, '%')</if>
<if test="reqVO.gatewayCode != null and reqVO.gatewayCode != ''"> and igi.gateway_code like concat('%', #{reqVO.gatewayCode}, '%')</if>
<if test="reqVO.status != null and reqVO.status != ''"> and igi.status = #{reqVO.status}</if>
</select>
<select id="selectGatewayById" parameterType="String" resultMap="GatewayInfoResult">
<include refid="selectGatewayInfoVo"/>
where igi.gateway_id = #{id} and igi.deleted = '0'
</select>
<!-- <select id="selectAlarmDataByRulesId" parameterType="String" resultMap="AlarmDataResult">-->
<!-- <include refid="selectAlarmDataVo"/>-->
<!-- where ad.alarm_rules_id = #{alarmRulesId}-->
<!-- and ad.status = 0-->
<!-- and ad.deleted = '0'-->
<!-- </select>-->
</mapper>