25 changed files with 3717 additions and 54 deletions
@ -0,0 +1,3 @@ |
|||
{ |
|||
"lockfileVersion": 1 |
|||
} |
@ -0,0 +1,104 @@ |
|||
package com.ruoyi.web.controller.device; |
|||
|
|||
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.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
import com.ruoyi.web.domain.po.OnenetConfig; |
|||
import com.ruoyi.web.service.IOnenetConfigService; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* onenet参数Controller |
|||
* |
|||
* @author lijunjie |
|||
* @date 2023-01-06 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/device/config") |
|||
public class OnenetConfigController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IOnenetConfigService onenetConfigService; |
|||
|
|||
/** |
|||
* 查询onenet参数列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:config:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(OnenetConfig onenetConfig) |
|||
{ |
|||
startPage(); |
|||
List<OnenetConfig> list = onenetConfigService.selectOnenetConfigList(onenetConfig); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出onenet参数列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:config:export')") |
|||
@Log(title = "onenet参数", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, OnenetConfig onenetConfig) |
|||
{ |
|||
List<OnenetConfig> list = onenetConfigService.selectOnenetConfigList(onenetConfig); |
|||
ExcelUtil<OnenetConfig> util = new ExcelUtil<OnenetConfig>(OnenetConfig.class); |
|||
util.exportExcel(response, list, "onenet参数数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取onenet参数详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:config:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Integer id) |
|||
{ |
|||
return success(onenetConfigService.selectOnenetConfigById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增onenet参数 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:config:add')") |
|||
@Log(title = "onenet参数", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody OnenetConfig onenetConfig) |
|||
{ |
|||
return toAjax(onenetConfigService.insertOnenetConfig(onenetConfig)); |
|||
} |
|||
|
|||
/** |
|||
* 修改onenet参数 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:config:edit')") |
|||
@Log(title = "onenet参数", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody OnenetConfig onenetConfig) |
|||
{ |
|||
return toAjax(onenetConfigService.updateOnenetConfig(onenetConfig)); |
|||
} |
|||
|
|||
/** |
|||
* 删除onenet参数 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:config:remove')") |
|||
@Log(title = "onenet参数", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Integer[] ids) |
|||
{ |
|||
return toAjax(onenetConfigService.deleteOnenetConfigByIds(ids)); |
|||
} |
|||
} |
@ -0,0 +1,110 @@ |
|||
package com.ruoyi.web.controller.device; |
|||
|
|||
import com.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.web.domain.dto.OnenetEquipDto; |
|||
import com.ruoyi.web.domain.po.OnenetConfig; |
|||
import com.ruoyi.web.domain.po.OnenetEquip; |
|||
import com.ruoyi.web.domain.vo.OnenetEquipVo; |
|||
import com.ruoyi.web.service.IOnenetConfigService; |
|||
import com.ruoyi.web.service.IOnenetEquipService; |
|||
import com.ruoyi.web.service.IOnenetEquipService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.annotation.Resource; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* onenet参数Controller |
|||
* |
|||
* @author lijunjie |
|||
* @date 2023-01-06 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/device/equip") |
|||
public class OnenetEquipController extends BaseController |
|||
{ |
|||
@Resource |
|||
private IOnenetEquipService onenetEquipService; |
|||
@Resource |
|||
private IOnenetConfigService onenetConfigService; |
|||
|
|||
/** |
|||
* 查询onenet参数列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:equip:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(OnenetEquip onenetConfig) |
|||
{ |
|||
startPage(); |
|||
List<OnenetEquipVo.EquipList> list = onenetEquipService.selectOnenetEquipList(onenetConfig); |
|||
|
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 查询 |
|||
* @return |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:equip:list')") |
|||
@GetMapping("/getApiKey") |
|||
public AjaxResult getApiKey() |
|||
{ |
|||
String onenetApiKey = onenetConfigService.selectOnenetConfigByKey("onenet_api_key"); |
|||
|
|||
return success(onenetApiKey); |
|||
} |
|||
|
|||
/** |
|||
* 导出onenet参数列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:equip:export')") |
|||
@Log(title = "onenet参数", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, OnenetEquip onenetConfig) |
|||
{ |
|||
List<OnenetEquipVo.EquipList> list = onenetEquipService.selectOnenetEquipList(onenetConfig); |
|||
ExcelUtil<OnenetEquipVo.EquipList> util = new ExcelUtil<OnenetEquipVo.EquipList>(OnenetEquipVo.EquipList.class); |
|||
util.exportExcel(response, list, "onenet参数数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取onenet参数详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('device:equip:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Integer id) |
|||
{ |
|||
return success(onenetEquipService.selectOnenetEquipById(id)); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 写缓存命令 |
|||
*/ |
|||
@PostMapping("/writeCommand") |
|||
public AjaxResult writeCommand(@RequestBody OnenetEquipDto.InsertDto InsertDto) |
|||
{ |
|||
return success(onenetEquipService.writeCommand(InsertDto)); |
|||
} |
|||
|
|||
/** |
|||
* 查询设备数据 |
|||
*/ |
|||
@GetMapping("/equipData") |
|||
public TableDataInfo equipData(OnenetEquipDto.EquipDataParam equipDataParam) |
|||
{ |
|||
startPage(); |
|||
List<OnenetEquipVo.EquipData> equipDatas = onenetEquipService.selectEquipDatas(equipDataParam); |
|||
|
|||
return getDataTable(equipDatas); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
package com.ruoyi.web.domain.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotEmpty; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author lijunjie |
|||
* @date 2023-01-09 10:56 |
|||
*/ |
|||
@Data |
|||
public class OnenetEquipDto { |
|||
|
|||
@ApiModel("OnenetEquipDto - InsertDto") |
|||
@Data |
|||
public static class InsertDto{ |
|||
@ApiModelProperty("") |
|||
private String imei; |
|||
@ApiModelProperty("") |
|||
private String obj_id; |
|||
@ApiModelProperty("") |
|||
private String obj_inst_id; |
|||
@ApiModelProperty("") |
|||
private String mode; |
|||
@ApiModelProperty("") |
|||
private String expired_time; |
|||
@ApiModelProperty("") |
|||
private String trigger_msg; |
|||
@ApiModelProperty("") |
|||
private String res_id; |
|||
@ApiModelProperty("") |
|||
private String command; |
|||
} |
|||
|
|||
@ApiModel("OnenetEquipDto - EquipDataParam") |
|||
@Data |
|||
public static class EquipDataParam{ |
|||
@ApiModelProperty("设备id") |
|||
private String obj_id; |
|||
@ApiModelProperty("开始时间") |
|||
private String start; |
|||
@ApiModelProperty("结束时间") |
|||
private String end; |
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.ruoyi.web.domain.po; |
|||
|
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* onenet参数对象 onenet_config |
|||
* |
|||
* @author lijunjie |
|||
* @date 2023-01-06 |
|||
*/ |
|||
public class OnenetConfig extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** */ |
|||
private Integer id; |
|||
|
|||
/** 建 */ |
|||
@Excel(name = "建") |
|||
private String configKey; |
|||
|
|||
/** 值 */ |
|||
@Excel(name = "值") |
|||
private String configValue; |
|||
|
|||
public void setId(Integer id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public Integer getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setConfigKey(String configKey) |
|||
{ |
|||
this.configKey = configKey; |
|||
} |
|||
|
|||
public String getConfigKey() |
|||
{ |
|||
return configKey; |
|||
} |
|||
public void setConfigValue(String configValue) |
|||
{ |
|||
this.configValue = configValue; |
|||
} |
|||
|
|||
public String getConfigValue() |
|||
{ |
|||
return configValue; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("configKey", getConfigKey()) |
|||
.append("configValue", getConfigValue()) |
|||
.append("createBy", getCreateBy()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("updateBy", getUpdateBy()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,150 @@ |
|||
package com.ruoyi.web.domain.po; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
public class OnenetEquip implements Serializable { |
|||
private Integer id; |
|||
|
|||
private String title; |
|||
|
|||
private Byte online; |
|||
|
|||
private String tags; |
|||
|
|||
private String protocol; |
|||
|
|||
private String location; |
|||
|
|||
private String authInfo; |
|||
|
|||
private String otherInfo; |
|||
|
|||
private String createBy; |
|||
|
|||
private Date createTime; |
|||
|
|||
private String updateBy; |
|||
|
|||
private Date updateTime; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title == null ? null : title.trim(); |
|||
} |
|||
|
|||
public Byte getOnline() { |
|||
return online; |
|||
} |
|||
|
|||
public void setOnline(Byte online) { |
|||
this.online = online; |
|||
} |
|||
|
|||
public String getTags() { |
|||
return tags; |
|||
} |
|||
|
|||
public void setTags(String tags) { |
|||
this.tags = tags == null ? null : tags.trim(); |
|||
} |
|||
|
|||
public String getProtocol() { |
|||
return protocol; |
|||
} |
|||
|
|||
public void setProtocol(String protocol) { |
|||
this.protocol = protocol == null ? null : protocol.trim(); |
|||
} |
|||
|
|||
public String getLocation() { |
|||
return location; |
|||
} |
|||
|
|||
public void setLocation(String location) { |
|||
this.location = location == null ? null : location.trim(); |
|||
} |
|||
|
|||
public String getAuthInfo() { |
|||
return authInfo; |
|||
} |
|||
|
|||
public void setAuthInfo(String authInfo) { |
|||
this.authInfo = authInfo == null ? null : authInfo.trim(); |
|||
} |
|||
|
|||
public String getOtherInfo() { |
|||
return otherInfo; |
|||
} |
|||
|
|||
public void setOtherInfo(String otherInfo) { |
|||
this.otherInfo = otherInfo == null ? null : otherInfo.trim(); |
|||
} |
|||
|
|||
public String getCreateBy() { |
|||
return createBy; |
|||
} |
|||
|
|||
public void setCreateBy(String createBy) { |
|||
this.createBy = createBy == null ? null : createBy.trim(); |
|||
} |
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getUpdateBy() { |
|||
return updateBy; |
|||
} |
|||
|
|||
public void setUpdateBy(String updateBy) { |
|||
this.updateBy = updateBy == null ? null : updateBy.trim(); |
|||
} |
|||
|
|||
public Date getUpdateTime() { |
|||
return updateTime; |
|||
} |
|||
|
|||
public void setUpdateTime(Date updateTime) { |
|||
this.updateTime = updateTime; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
StringBuilder sb = new StringBuilder(); |
|||
sb.append(getClass().getSimpleName()); |
|||
sb.append(" ["); |
|||
sb.append("Hash = ").append(hashCode()); |
|||
sb.append(", id=").append(id); |
|||
sb.append(", title=").append(title); |
|||
sb.append(", online=").append(online); |
|||
sb.append(", tags=").append(tags); |
|||
sb.append(", protocol=").append(protocol); |
|||
sb.append(", location=").append(location); |
|||
sb.append(", authInfo=").append(authInfo); |
|||
sb.append(", otherInfo=").append(otherInfo); |
|||
sb.append(", createBy=").append(createBy); |
|||
sb.append(", createTime=").append(createTime); |
|||
sb.append(", updateBy=").append(updateBy); |
|||
sb.append(", updateTime=").append(updateTime); |
|||
sb.append("]"); |
|||
return sb.toString(); |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,94 @@ |
|||
package com.ruoyi.web.domain.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Author: lijunjie |
|||
* @date: 2023/01/07 09:37 |
|||
* @Version: 1.0 |
|||
*/ |
|||
public class OnenetEquipVo { |
|||
@Data |
|||
@ApiModel("DcsDeviceValVo-二氧化硫温度") |
|||
public static class EquipList { |
|||
private Integer id; |
|||
|
|||
private String title; |
|||
|
|||
private String online; |
|||
|
|||
private String tags; |
|||
|
|||
private String protocol; |
|||
|
|||
private String location; |
|||
|
|||
private String authInfo; |
|||
|
|||
private String otherInfo; |
|||
|
|||
private String createBy; |
|||
|
|||
private Date createTime; |
|||
|
|||
private String updateBy; |
|||
|
|||
private Date updateTime; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("DcsDeviceValVo-二氧化硫温度") |
|||
public static class EquipData { |
|||
@ApiModelProperty("原始数据") |
|||
private String deviceData; |
|||
@ApiModelProperty("数据时间") |
|||
private String dataTime; |
|||
@ApiModelProperty("阀门状态") |
|||
private String valveStatus1; |
|||
private String valveStatus2; |
|||
private String valveStatus3; |
|||
private String valveStatus4; |
|||
private String valveStatus5; |
|||
private String valveStatus6; |
|||
private String valveStatus7; |
|||
private String valveStatus8; |
|||
@ApiModelProperty("设定开度") |
|||
private String setOpening; |
|||
@ApiModelProperty("实际开度") |
|||
private String actualOpening; |
|||
@ApiModelProperty("进水温度") |
|||
private String waterInletTemperature; |
|||
@ApiModelProperty("回水温度") |
|||
private String waterReturnTemperature; |
|||
@ApiModelProperty("电池电量") |
|||
private String batteryPower; |
|||
@ApiModelProperty("加速度X Y Z轴") |
|||
private String acceleratedX; |
|||
@ApiModelProperty("") |
|||
private String acceleratedY; |
|||
@ApiModelProperty("") |
|||
private String acceleratedZ; |
|||
@ApiModelProperty("信号强度") |
|||
private String signalStrength; |
|||
@ApiModelProperty("阀门时间") |
|||
private String valveTime; |
|||
@ApiModelProperty("上报间隔") |
|||
private String reportingInterval; |
|||
@ApiModelProperty("间隔单位") |
|||
private String intervalUnit; |
|||
@ApiModelProperty("上报有效时长") |
|||
private String effectiveTime; |
|||
@ApiModelProperty("总上报次数") |
|||
private String totalNumberReports; |
|||
@ApiModelProperty("其他") |
|||
private String other; |
|||
@ApiModelProperty("累加校验和") |
|||
private String check; |
|||
@ApiModelProperty("结束符") |
|||
private String finish; |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.ruoyi.web.persist.mapper; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.web.domain.po.OnenetConfig; |
|||
|
|||
/** |
|||
* onenet参数Mapper接口 |
|||
* |
|||
* @author lijunjie |
|||
* @date 2023-01-06 |
|||
*/ |
|||
public interface OnenetConfigMapper |
|||
{ |
|||
/** |
|||
* 查询onenet参数 |
|||
* |
|||
* @param id onenet参数主键 |
|||
* @return onenet参数 |
|||
*/ |
|||
public OnenetConfig selectOnenetConfigById(Integer id); |
|||
|
|||
/** |
|||
* 查询onenet参数列表 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return onenet参数集合 |
|||
*/ |
|||
public List<OnenetConfig> selectOnenetConfigList(OnenetConfig onenetConfig); |
|||
|
|||
/** |
|||
* 新增onenet参数 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertOnenetConfig(OnenetConfig onenetConfig); |
|||
|
|||
/** |
|||
* 修改onenet参数 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateOnenetConfig(OnenetConfig onenetConfig); |
|||
|
|||
/** |
|||
* 删除onenet参数 |
|||
* |
|||
* @param id onenet参数主键 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteOnenetConfigById(Integer id); |
|||
|
|||
/** |
|||
* 批量删除onenet参数 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteOnenetConfigByIds(Integer[] ids); |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.ruoyi.web.persist.mapper; |
|||
|
|||
import com.ruoyi.web.domain.po.OnenetEquip; |
|||
import com.ruoyi.web.domain.po.OnenetEquipExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface OnenetEquipMapper { |
|||
long countByExample(OnenetEquipExample example); |
|||
|
|||
int deleteByExample(OnenetEquipExample example); |
|||
|
|||
int deleteByPrimaryKey(Integer id); |
|||
|
|||
int insert(OnenetEquip record); |
|||
|
|||
int insertSelective(OnenetEquip record); |
|||
|
|||
List<OnenetEquip> selectByExample(OnenetEquipExample example); |
|||
|
|||
OnenetEquip selectByPrimaryKey(Integer id); |
|||
|
|||
int updateByExampleSelective(@Param("record") OnenetEquip record, @Param("example") OnenetEquipExample example); |
|||
|
|||
int updateByExample(@Param("record") OnenetEquip record, @Param("example") OnenetEquipExample example); |
|||
|
|||
int updateByPrimaryKeySelective(OnenetEquip record); |
|||
|
|||
int updateByPrimaryKey(OnenetEquip record); |
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.ruoyi.web.service; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.web.domain.po.OnenetConfig; |
|||
|
|||
/** |
|||
* onenet参数Service接口 |
|||
* |
|||
* @author lijunjie |
|||
* @date 2023-01-06 |
|||
*/ |
|||
public interface IOnenetConfigService |
|||
{ |
|||
/** |
|||
* 查询onenet参数 |
|||
* |
|||
*/ |
|||
public String selectOnenetConfigByKey(String configKey); |
|||
|
|||
/** |
|||
* 查询onenet参数 |
|||
* |
|||
* @param id onenet参数主键 |
|||
* @return onenet参数 |
|||
*/ |
|||
public OnenetConfig selectOnenetConfigById(Integer id); |
|||
|
|||
/** |
|||
* 查询onenet参数列表 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return onenet参数集合 |
|||
*/ |
|||
public List<OnenetConfig> selectOnenetConfigList(OnenetConfig onenetConfig); |
|||
|
|||
/** |
|||
* 新增onenet参数 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertOnenetConfig(OnenetConfig onenetConfig); |
|||
|
|||
/** |
|||
* 修改onenet参数 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateOnenetConfig(OnenetConfig onenetConfig); |
|||
|
|||
/** |
|||
* 批量删除onenet参数 |
|||
* |
|||
* @param ids 需要删除的onenet参数主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteOnenetConfigByIds(Integer[] ids); |
|||
|
|||
/** |
|||
* 删除onenet参数信息 |
|||
* |
|||
* @param id onenet参数主键 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteOnenetConfigById(Integer id); |
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.ruoyi.web.service; |
|||
|
|||
import com.ruoyi.web.domain.dto.OnenetEquipDto; |
|||
import com.ruoyi.web.domain.po.OnenetEquip; |
|||
import com.ruoyi.web.domain.vo.OnenetEquipVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 设备Service接口 |
|||
* |
|||
* @author lijunjie |
|||
* @date 2023-01-06 |
|||
*/ |
|||
public interface IOnenetEquipService |
|||
{ |
|||
/** |
|||
* 查询设备 |
|||
* |
|||
* @param id 设备主键 |
|||
* @return 设备 |
|||
*/ |
|||
public OnenetEquip selectOnenetEquipById(Integer id); |
|||
|
|||
/** |
|||
* 查询设备列表 |
|||
* |
|||
* @param onenetEquip 设备 |
|||
* @return 设备集合 |
|||
*/ |
|||
public List<OnenetEquipVo.EquipList> selectOnenetEquipList(OnenetEquip onenetEquip); |
|||
|
|||
/** |
|||
* 写缓存命令 |
|||
* @param InsertDto |
|||
* @return |
|||
*/ |
|||
public boolean writeCommand(OnenetEquipDto.InsertDto InsertDto); |
|||
|
|||
/** |
|||
* 查询设备数据 |
|||
* @param equipDataParam |
|||
* @return |
|||
*/ |
|||
public List<OnenetEquipVo.EquipData> selectEquipDatas(OnenetEquipDto.EquipDataParam equipDataParam); |
|||
} |
@ -0,0 +1,116 @@ |
|||
package com.ruoyi.web.service.impl; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import com.ruoyi.web.domain.po.OnenetConfig; |
|||
import com.ruoyi.web.persist.mapper.OnenetConfigMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import com.ruoyi.web.service.IOnenetConfigService; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* onenet参数Service业务层处理 |
|||
* |
|||
* @author lijunjie |
|||
* @date 2023-01-06 |
|||
*/ |
|||
@Service |
|||
public class OnenetConfigServiceImpl implements IOnenetConfigService |
|||
{ |
|||
@Resource |
|||
private OnenetConfigMapper onenetConfigMapper; |
|||
|
|||
/** |
|||
* 查询onenet参数 |
|||
*/ |
|||
@Override |
|||
public String selectOnenetConfigByKey(String configKey) |
|||
{ |
|||
OnenetConfig onenetConfigExample = new OnenetConfig(); |
|||
onenetConfigExample.setConfigKey("onenet_api_key"); |
|||
|
|||
List<OnenetConfig> onenetConfigs = onenetConfigMapper.selectOnenetConfigList(onenetConfigExample); |
|||
String configValue = null; |
|||
if (onenetConfigs.size() > 0){ |
|||
configValue = onenetConfigs.get(0).getConfigValue(); |
|||
} |
|||
|
|||
return configValue; |
|||
} |
|||
|
|||
/** |
|||
* 查询onenet参数 |
|||
* |
|||
* @param id onenet参数主键 |
|||
* @return onenet参数 |
|||
*/ |
|||
@Override |
|||
public OnenetConfig selectOnenetConfigById(Integer id) |
|||
{ |
|||
return onenetConfigMapper.selectOnenetConfigById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询onenet参数列表 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return onenet参数 |
|||
*/ |
|||
@Override |
|||
public List<OnenetConfig> selectOnenetConfigList(OnenetConfig onenetConfig) |
|||
{ |
|||
return onenetConfigMapper.selectOnenetConfigList(onenetConfig); |
|||
} |
|||
|
|||
/** |
|||
* 新增onenet参数 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertOnenetConfig(OnenetConfig onenetConfig) |
|||
{ |
|||
onenetConfig.setCreateTime(DateUtils.getNowDate()); |
|||
return onenetConfigMapper.insertOnenetConfig(onenetConfig); |
|||
} |
|||
|
|||
/** |
|||
* 修改onenet参数 |
|||
* |
|||
* @param onenetConfig onenet参数 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateOnenetConfig(OnenetConfig onenetConfig) |
|||
{ |
|||
onenetConfig.setUpdateTime(DateUtils.getNowDate()); |
|||
return onenetConfigMapper.updateOnenetConfig(onenetConfig); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除onenet参数 |
|||
* |
|||
* @param ids 需要删除的onenet参数主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteOnenetConfigByIds(Integer[] ids) |
|||
{ |
|||
return onenetConfigMapper.deleteOnenetConfigByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除onenet参数信息 |
|||
* |
|||
* @param id onenet参数主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteOnenetConfigById(Integer id) |
|||
{ |
|||
return onenetConfigMapper.deleteOnenetConfigById(id); |
|||
} |
|||
} |
@ -0,0 +1,287 @@ |
|||
package com.ruoyi.web.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateTime; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.HexUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.http.HttpRequest; |
|||
import cn.hutool.http.HttpUtil; |
|||
import com.alibaba.druid.util.HexBin; |
|||
import com.alibaba.fastjson2.JSON; |
|||
import com.alibaba.fastjson2.JSONArray; |
|||
import com.alibaba.fastjson2.JSONObject; |
|||
import com.ruoyi.web.domain.dto.OnenetEquipDto; |
|||
import com.ruoyi.web.domain.po.OnenetConfig; |
|||
import com.ruoyi.web.domain.po.OnenetEquip; |
|||
import com.ruoyi.web.domain.vo.OnenetEquipVo; |
|||
import com.ruoyi.web.persist.mapper.OnenetConfigMapper; |
|||
import com.ruoyi.web.service.IOnenetEquipService; |
|||
import org.apache.poi.ss.formula.functions.Hex2Dec; |
|||
import org.springframework.http.*; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.MultiValueMap; |
|||
import org.springframework.util.unit.DataUnit; |
|||
import org.springframework.web.client.RestTemplate; |
|||
import org.springframework.web.util.UriBuilder; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.net.URI; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @Author: lijunjie |
|||
* @date: 2023/01/06 15:32 |
|||
* @Version: 1.0 |
|||
*/ |
|||
@Service |
|||
public class OnenetEquipServiceImpl implements IOnenetEquipService { |
|||
@Resource |
|||
private OnenetConfigMapper onenetConfigMapper; |
|||
|
|||
@Override |
|||
public OnenetEquip selectOnenetEquipById(Integer id) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public List<OnenetEquipVo.EquipList> selectOnenetEquipList(OnenetEquip onenetEquip) { |
|||
OnenetConfig onenetConfigExample = new OnenetConfig(); |
|||
onenetConfigExample.setConfigKey("onenet_api_key"); |
|||
|
|||
List<OnenetConfig> onenetConfigs = onenetConfigMapper.selectOnenetConfigList(onenetConfigExample); |
|||
List<OnenetEquipVo.EquipList> list = new ArrayList<>(); |
|||
if (onenetConfigs.size() > 0){ |
|||
OnenetConfig onenetConfig = onenetConfigs.get(0); |
|||
|
|||
String url = "http://api.heclouds.com/devices"; |
|||
|
|||
HttpHeaders headers = new HttpHeaders(); |
|||
headers.set("api-key", onenetConfig.getConfigValue()); |
|||
|
|||
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<MultiValueMap<String, Object>>(null,headers); |
|||
|
|||
HashMap<String, String> paramMap = new HashMap<>(); |
|||
paramMap.put("page", "1"); |
|||
paramMap.put("per_page", "10"); |
|||
|
|||
RestTemplate restTemplate = new RestTemplate(); |
|||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, String.class, paramMap); |
|||
|
|||
String body = response.getBody(); |
|||
JSONObject json1 = JSON.parseObject(body); |
|||
JSONObject json2 = json1.getJSONObject("data"); |
|||
JSONArray devices = json2.getJSONArray("devices"); |
|||
|
|||
if (devices.size() > 0){ |
|||
for (int i = 0; i < devices.size(); i++) { |
|||
JSONObject device = devices.getJSONObject(i); |
|||
|
|||
OnenetEquipVo.EquipList onenetEquipData = new OnenetEquipVo.EquipList(); |
|||
onenetEquipData.setId(Integer.parseInt(device.get("id").toString())); |
|||
onenetEquipData.setTitle(device.get("title").toString()); |
|||
onenetEquipData.setOnline((boolean) device.get("online") == true ? "正常" : "离线"); |
|||
onenetEquipData.setTags(device.get("tags").toString()); |
|||
onenetEquipData.setProtocol(device.get("protocol").toString()); |
|||
onenetEquipData.setLocation(device.get("location").toString()); |
|||
onenetEquipData.setAuthInfo(device.get("auth_info").toString()); |
|||
onenetEquipData.setCreateTime(DateUtil.parse(device.get("create_time").toString())); |
|||
|
|||
list.add(onenetEquipData); |
|||
} |
|||
// list = JSON.parseArray(devices.toJSONString(),OnenetEquip.class);
|
|||
|
|||
return list; |
|||
} |
|||
} |
|||
|
|||
return list; |
|||
} |
|||
|
|||
/** |
|||
* 写缓存命令 |
|||
* @param InsertDto |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public boolean writeCommand(OnenetEquipDto.InsertDto InsertDto) { |
|||
OnenetConfig onenetConfigExample = new OnenetConfig(); |
|||
onenetConfigExample.setConfigKey("onenet_api_key"); |
|||
|
|||
List<OnenetConfig> onenetConfigs = onenetConfigMapper.selectOnenetConfigList(onenetConfigExample); |
|||
List<OnenetEquipVo.EquipList> list = new ArrayList<>(); |
|||
if (onenetConfigs.size() > 0) { |
|||
HashMap<String, String> uriParams = new HashMap<>(); |
|||
uriParams.put("imei", InsertDto.getImei()); |
|||
uriParams.put("obj_id", InsertDto.getObj_id()); |
|||
uriParams.put("obj_inst_id", InsertDto.getObj_inst_id()); |
|||
uriParams.put("mode", InsertDto.getMode()); |
|||
uriParams.put("expired_time", "2023-01-10T09:35:03"); |
|||
uriParams.put("trigger_msg", InsertDto.getTrigger_msg()); |
|||
|
|||
String uriParam = HttpUtil.toParams(uriParams); |
|||
|
|||
|
|||
String url = "http://api.heclouds.com/nbiot/offline?" + uriParam; |
|||
// String url = "http://api.heclouds.com/nbiot/offline?imei=866472059908495&obj_id=1024242896&obj_inst_id=0&mode=1&expired_time=2023-01-10T09%3A45%3A07&trigger_msg=4";
|
|||
|
|||
HttpHeaders headers = new HttpHeaders(); |
|||
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); |
|||
headers.setContentType(type); |
|||
headers.add("Accept", MediaType.APPLICATION_JSON.toString()); |
|||
|
|||
OnenetConfig onenetConfig = onenetConfigs.get(0); |
|||
headers.set("api-key", onenetConfig.getConfigValue()); |
|||
|
|||
JSONObject json1 = new JSONObject(); |
|||
json1.put("res_id", InsertDto.getRes_id()); |
|||
json1.put("val", InsertDto.getCommand()); |
|||
JSONArray jsonArray = new JSONArray(); |
|||
jsonArray.set(0, json1); |
|||
JSONObject json = new JSONObject(); |
|||
json.put("data", jsonArray); |
|||
|
|||
HttpEntity<String> formEntity = new HttpEntity<String>(json.toString(), headers); |
|||
|
|||
RestTemplate restTemplate = new RestTemplate(); |
|||
String response= restTemplate.postForEntity(url,formEntity,String.class).getBody(); |
|||
// String response= "{\"errno\":0,\"error\":\"succ\",\"data\":{\"uuid\":\"75841c59-a3f8-5524-ba39-f319a36259ee\"}}";
|
|||
|
|||
JSONObject responseJson = JSON.parseObject(response); |
|||
Integer errno = responseJson.getObject("errno", Integer.class); |
|||
if (errno == 0){ |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
|
|||
return false; |
|||
} |
|||
|
|||
/** |
|||
* 查询设备数据 |
|||
* @param equipDataParam |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<OnenetEquipVo.EquipData> selectEquipDatas(OnenetEquipDto.EquipDataParam equipDataParam) { |
|||
OnenetConfig onenetConfigExample = new OnenetConfig(); |
|||
onenetConfigExample.setConfigKey("onenet_api_key"); |
|||
|
|||
List<OnenetConfig> onenetConfigs = onenetConfigMapper.selectOnenetConfigList(onenetConfigExample); |
|||
List<OnenetEquipVo.EquipData> onenetEquipVoList = new ArrayList<>(); |
|||
|
|||
if (onenetConfigs.size() > 0) { |
|||
HashMap<String, String> uriParams = new HashMap<>(); |
|||
if (!StrUtil.hasEmpty(equipDataParam.getStart())){ |
|||
uriParams.put("start", equipDataParam.getStart()); |
|||
} |
|||
if (!StrUtil.hasEmpty(equipDataParam.getEnd())){ |
|||
uriParams.put("end", equipDataParam.getEnd()); |
|||
} |
|||
|
|||
String uriParam = HttpUtil.toParams(uriParams); |
|||
|
|||
String url = "http://api.heclouds.com/devices/" + equipDataParam.getObj_id() +"/datapoints?" + uriParam; |
|||
|
|||
OnenetConfig onenetConfig = onenetConfigs.get(0); |
|||
// String response = HttpRequest.get(url).header("api-key", onenetConfig.getConfigValue()).execute().body();
|
|||
|
|||
String response = "{\"errno\":0,\"data\":{\"count\":1,\"datastreams\":[{\"datapoints\":[{\"at\":\"2023-01-09 17:47:15.969\",\"value\":\"68C00866472059908495852F015100FFFE0A6464220901002310010014731641646400000065014E000000000000182301091747150503000002015116\"}, {\"at\":\"2023-01-09 17:47:15.969\",\"value\":\"68C00866472059908495852F015100FFFE0A6464220901002310010014731641646400000065014E000000000000182301091747150503000002015116\"}],\"id\":\"3200_0_5750\"}]},\"error\":\"succ\"}"; |
|||
|
|||
JSONObject responseJson = JSON.parseObject(response); |
|||
|
|||
Integer errno = responseJson.getObject("errno", Integer.class); |
|||
if (errno == 0){ |
|||
JSONObject dataJson = responseJson.getJSONObject("data"); |
|||
JSONArray dataArray = dataJson.getJSONArray("datastreams"); |
|||
JSONArray datapoints = dataArray.getJSONObject(0).getJSONArray("datapoints"); |
|||
|
|||
|
|||
for (int i = 0; i < datapoints.size(); i++) { |
|||
JSONObject datapoint = datapoints.getJSONObject(i); |
|||
String equipData = datapoint.getString("value"); |
|||
// String equipData = "68C00866472059908495852F015100FFFE0A6464220901002310010014731641646400000065014E000000000000182301091747150503000002015116";
|
|||
|
|||
String statusInfo = equipData.substring(62); |
|||
OnenetEquipVo.EquipData equipDataVo = new OnenetEquipVo.EquipData(); |
|||
equipDataVo.setDeviceData(equipData); |
|||
equipDataVo.setDataTime(datapoint.getString("at")); |
|||
|
|||
//阀门状态
|
|||
String valveStatus = statusInfo.substring(0, 2); |
|||
|
|||
valveStatus = String.format("%08d", Integer.valueOf(hexToBin(valveStatus))); |
|||
|
|||
equipDataVo.setValveStatus8(valveStatus.substring(0, 1).equals("1") ? "角度存在偏差" : "角度正常"); |
|||
equipDataVo.setValveStatus7(valveStatus.substring(1, 2).equals("1") ? "加速度传感器异常" : "加速度传感器正常"); |
|||
equipDataVo.setValveStatus6(valveStatus.substring(2, 3).equals("1") ? "回水传感器异常" : "回水传感器正常"); |
|||
equipDataVo.setValveStatus5(valveStatus.substring(3, 4).equals("1") ? "电池电量低" : "电池电量正常"); |
|||
equipDataVo.setValveStatus4(valveStatus.substring(4, 5).equals("1") ? "电位器异常" : "电位器正常"); |
|||
equipDataVo.setValveStatus3(valveStatus.substring(5, 6).equals("1") ? "行程开关异常" : "行程开关正常"); |
|||
equipDataVo.setValveStatus2(valveStatus.substring(6, 7).equals("1") ? "阀门堵转" : "阀门动作正常"); |
|||
equipDataVo.setValveStatus1(valveStatus.substring(7, 8).equals("1") ? "阀开" : "阀关"); |
|||
//设定开度
|
|||
equipDataVo.setSetOpening(Integer.valueOf(statusInfo.substring(2, 4), 16) + "%"); |
|||
//实际开度
|
|||
equipDataVo.setActualOpening(Integer.valueOf(statusInfo.substring(4, 6), 16) + "%"); |
|||
//进水温度
|
|||
equipDataVo.setWaterInletTemperature(Integer.valueOf(statusInfo.substring(6, 10), 16) / 100.0 + "度"); |
|||
//回水温度
|
|||
equipDataVo.setWaterReturnTemperature(Integer.valueOf(statusInfo.substring(10, 14), 16) / 100.0 + "度"); |
|||
//电池电量
|
|||
equipDataVo.setBatteryPower(Integer.valueOf(statusInfo.substring(14, 18), 16) / 100.0 + "V"); |
|||
//加速度X Y Z轴
|
|||
equipDataVo.setAcceleratedX(statusInfo.substring(18, 22)); |
|||
equipDataVo.setAcceleratedY(statusInfo.substring(22, 26)); |
|||
equipDataVo.setAcceleratedZ(statusInfo.substring(26, 30)); |
|||
//信号强度
|
|||
equipDataVo.setSignalStrength(statusInfo.substring(30, 32)); |
|||
//阀门时间
|
|||
DateTime dateTime = new DateTime("20" + statusInfo.substring(32, 44)); |
|||
equipDataVo.setValveTime(dateTime.toString()); |
|||
// $valve_time = substr($status_info, 32, 12);
|
|||
// $re['valve_time'] = date('Y-m-d H:i:s', strtotime('20'.$valve_time));
|
|||
//上报间隔
|
|||
equipDataVo.setReportingInterval(statusInfo.substring(44, 46)); |
|||
//间隔单位
|
|||
String intervalUnit = statusInfo.substring(46, 48); |
|||
switch (intervalUnit){ |
|||
case "01": |
|||
equipDataVo.setIntervalUnit("分钟"); |
|||
break; |
|||
case "02": |
|||
equipDataVo.setIntervalUnit("小时"); |
|||
break; |
|||
case "03": |
|||
equipDataVo.setIntervalUnit("天"); |
|||
break; |
|||
} |
|||
//上报有效时长
|
|||
equipDataVo.setEffectiveTime(statusInfo.substring(48, 50)); |
|||
//总上报次数
|
|||
equipDataVo.setTotalNumberReports(Integer.valueOf(statusInfo.substring(50, 54), 16).toString()); |
|||
//其他
|
|||
equipDataVo.setOther(statusInfo.substring(54, 56)); |
|||
//累加校验和
|
|||
equipDataVo.setCheck(statusInfo.substring(56, 58)); |
|||
//结束符
|
|||
equipDataVo.setFinish(statusInfo.substring(58, 60)); |
|||
|
|||
onenetEquipVoList.add(equipDataVo); |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
return onenetEquipVoList; |
|||
} |
|||
|
|||
public String hexToBin(String hexS){ |
|||
//字符串形式十进制--作为桥梁!
|
|||
int sint = Integer.valueOf(hexS, 16); |
|||
//十进制在转换成二进制的字符串形式输出!
|
|||
String bin = Integer.toBinaryString(sint); |
|||
|
|||
return bin; |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
<?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.ruoyi.web.persist.mapper.OnenetConfigMapper"> |
|||
|
|||
<resultMap type="OnenetConfig" id="OnenetConfigResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="configKey" column="config_key" /> |
|||
<result property="configValue" column="config_value" /> |
|||
<result property="createBy" column="create_by" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updateBy" column="update_by" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectOnenetConfigVo"> |
|||
select id, config_key, config_value, create_by, create_time, update_by, update_time from onenet_config |
|||
</sql> |
|||
|
|||
<select id="selectOnenetConfigList" parameterType="OnenetConfig" resultMap="OnenetConfigResult"> |
|||
<include refid="selectOnenetConfigVo"/> |
|||
<where> |
|||
<if test="configKey != null and configKey != ''"> and config_key = #{configKey}</if> |
|||
<if test="configValue != null and configValue != ''"> and config_value = #{configValue}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectOnenetConfigById" parameterType="Integer" resultMap="OnenetConfigResult"> |
|||
<include refid="selectOnenetConfigVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertOnenetConfig" parameterType="OnenetConfig" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into onenet_config |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="configKey != null and configKey != ''">config_key,</if> |
|||
<if test="configValue != null and configValue != ''">config_value,</if> |
|||
<if test="createBy != null">create_by,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateBy != null">update_by,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="configKey != null and configKey != ''">#{configKey},</if> |
|||
<if test="configValue != null and configValue != ''">#{configValue},</if> |
|||
<if test="createBy != null">#{createBy},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateBy != null">#{updateBy},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateOnenetConfig" parameterType="OnenetConfig"> |
|||
update onenet_config |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if> |
|||
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if> |
|||
<if test="createBy != null">create_by = #{createBy},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateBy != null">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteOnenetConfigById" parameterType="Integer"> |
|||
delete from onenet_config where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteOnenetConfigByIds" parameterType="String"> |
|||
delete from onenet_config where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,323 @@ |
|||
<?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.ruoyi.web.persist.mapper.OnenetEquipMapper"> |
|||
<resultMap id="BaseResultMap" type="com.ruoyi.web.domain.po.OnenetEquip"> |
|||
<id column="id" jdbcType="INTEGER" property="id" /> |
|||
<result column="title" jdbcType="VARCHAR" property="title" /> |
|||
<result column="online" jdbcType="TINYINT" property="online" /> |
|||
<result column="tags" jdbcType="VARCHAR" property="tags" /> |
|||
<result column="protocol" jdbcType="VARCHAR" property="protocol" /> |
|||
<result column="location" jdbcType="VARCHAR" property="location" /> |
|||
<result column="auth_info" jdbcType="VARCHAR" property="authInfo" /> |
|||
<result column="other_info" jdbcType="VARCHAR" property="otherInfo" /> |
|||
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> |
|||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
|||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" /> |
|||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |
|||
</resultMap> |
|||
<sql id="Example_Where_Clause"> |
|||
<where> |
|||
<foreach collection="oredCriteria" item="criteria" separator="or"> |
|||
<if test="criteria.valid"> |
|||
<trim prefix="(" prefixOverrides="and" suffix=")"> |
|||
<foreach collection="criteria.criteria" item="criterion"> |
|||
<choose> |
|||
<when test="criterion.noValue"> |
|||
and ${criterion.condition} |
|||
</when> |
|||
<when test="criterion.singleValue"> |
|||
and ${criterion.condition} #{criterion.value} |
|||
</when> |
|||
<when test="criterion.betweenValue"> |
|||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
|||
</when> |
|||
<when test="criterion.listValue"> |
|||
and ${criterion.condition} |
|||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
</when> |
|||
</choose> |
|||
</foreach> |
|||
</trim> |
|||
</if> |
|||
</foreach> |
|||
</where> |
|||
</sql> |
|||
<sql id="Update_By_Example_Where_Clause"> |
|||
<where> |
|||
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
|||
<if test="criteria.valid"> |
|||
<trim prefix="(" prefixOverrides="and" suffix=")"> |
|||
<foreach collection="criteria.criteria" item="criterion"> |
|||
<choose> |
|||
<when test="criterion.noValue"> |
|||
and ${criterion.condition} |
|||
</when> |
|||
<when test="criterion.singleValue"> |
|||
and ${criterion.condition} #{criterion.value} |
|||
</when> |
|||
<when test="criterion.betweenValue"> |
|||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
|||
</when> |
|||
<when test="criterion.listValue"> |
|||
and ${criterion.condition} |
|||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
</when> |
|||
</choose> |
|||
</foreach> |
|||
</trim> |
|||
</if> |
|||
</foreach> |
|||
</where> |
|||
</sql> |
|||
<sql id="Base_Column_List"> |
|||
id, title, online, tags, protocol, location, auth_info, other_info, create_by, create_time, |
|||
update_by, update_time |
|||
</sql> |
|||
<select id="selectByExample" parameterType="com.ruoyi.web.domain.po.OnenetEquipExample" resultMap="BaseResultMap"> |
|||
select |
|||
<if test="distinct"> |
|||
distinct |
|||
</if> |
|||
<include refid="Base_Column_List" /> |
|||
from onenet_equip |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
<if test="orderByClause != null"> |
|||
order by ${orderByClause} |
|||
</if> |
|||
</select> |
|||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
|||
select |
|||
<include refid="Base_Column_List" /> |
|||
from onenet_equip |
|||
where id = #{id,jdbcType=INTEGER} |
|||
</select> |
|||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |
|||
delete from onenet_equip |
|||
where id = #{id,jdbcType=INTEGER} |
|||
</delete> |
|||
<delete id="deleteByExample" parameterType="com.ruoyi.web.domain.po.OnenetEquipExample"> |
|||
delete from onenet_equip |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</delete> |
|||
<insert id="insert" parameterType="com.ruoyi.web.domain.po.OnenetEquip"> |
|||
insert into onenet_equip (id, title, online, |
|||
tags, protocol, location, |
|||
auth_info, other_info, create_by, |
|||
create_time, update_by, update_time |
|||
) |
|||
values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{online,jdbcType=TINYINT}, |
|||
#{tags,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{location,jdbcType=VARCHAR}, |
|||
#{authInfo,jdbcType=VARCHAR}, #{otherInfo,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, |
|||
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP} |
|||
) |
|||
</insert> |
|||
<insert id="insertSelective" parameterType="com.ruoyi.web.domain.po.OnenetEquip"> |
|||
insert into onenet_equip |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="id != null"> |
|||
id, |
|||
</if> |
|||
<if test="title != null"> |
|||
title, |
|||
</if> |
|||
<if test="online != null"> |
|||
online, |
|||
</if> |
|||
<if test="tags != null"> |
|||
tags, |
|||
</if> |
|||
<if test="protocol != null"> |
|||
protocol, |
|||
</if> |
|||
<if test="location != null"> |
|||
location, |
|||
</if> |
|||
<if test="authInfo != null"> |
|||
auth_info, |
|||
</if> |
|||
<if test="otherInfo != null"> |
|||
other_info, |
|||
</if> |
|||
<if test="createBy != null"> |
|||
create_by, |
|||
</if> |
|||
<if test="createTime != null"> |
|||
create_time, |
|||
</if> |
|||
<if test="updateBy != null"> |
|||
update_by, |
|||
</if> |
|||
<if test="updateTime != null"> |
|||
update_time, |
|||
</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="id != null"> |
|||
#{id,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="title != null"> |
|||
#{title,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="online != null"> |
|||
#{online,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="tags != null"> |
|||
#{tags,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="protocol != null"> |
|||
#{protocol,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="location != null"> |
|||
#{location,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authInfo != null"> |
|||
#{authInfo,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="otherInfo != null"> |
|||
#{otherInfo,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="createBy != null"> |
|||
#{createBy,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="createTime != null"> |
|||
#{createTime,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="updateBy != null"> |
|||
#{updateBy,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="updateTime != null"> |
|||
#{updateTime,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
</trim> |
|||
</insert> |
|||
<select id="countByExample" parameterType="com.ruoyi.web.domain.po.OnenetEquipExample" resultType="java.lang.Long"> |
|||
select count(*) from onenet_equip |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</select> |
|||
<update id="updateByExampleSelective" parameterType="map"> |
|||
update onenet_equip |
|||
<set> |
|||
<if test="record.id != null"> |
|||
id = #{record.id,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="record.title != null"> |
|||
title = #{record.title,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.online != null"> |
|||
online = #{record.online,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="record.tags != null"> |
|||
tags = #{record.tags,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.protocol != null"> |
|||
protocol = #{record.protocol,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.location != null"> |
|||
location = #{record.location,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.authInfo != null"> |
|||
auth_info = #{record.authInfo,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.otherInfo != null"> |
|||
other_info = #{record.otherInfo,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.createBy != null"> |
|||
create_by = #{record.createBy,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.createTime != null"> |
|||
create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="record.updateBy != null"> |
|||
update_by = #{record.updateBy,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.updateTime != null"> |
|||
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
</set> |
|||
<if test="_parameter != null"> |
|||
<include refid="Update_By_Example_Where_Clause" /> |
|||
</if> |
|||
</update> |
|||
<update id="updateByExample" parameterType="map"> |
|||
update onenet_equip |
|||
set id = #{record.id,jdbcType=INTEGER}, |
|||
title = #{record.title,jdbcType=VARCHAR}, |
|||
online = #{record.online,jdbcType=TINYINT}, |
|||
tags = #{record.tags,jdbcType=VARCHAR}, |
|||
protocol = #{record.protocol,jdbcType=VARCHAR}, |
|||
location = #{record.location,jdbcType=VARCHAR}, |
|||
auth_info = #{record.authInfo,jdbcType=VARCHAR}, |
|||
other_info = #{record.otherInfo,jdbcType=VARCHAR}, |
|||
create_by = #{record.createBy,jdbcType=VARCHAR}, |
|||
create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
|||
update_by = #{record.updateBy,jdbcType=VARCHAR}, |
|||
update_time = #{record.updateTime,jdbcType=TIMESTAMP} |
|||
<if test="_parameter != null"> |
|||
<include refid="Update_By_Example_Where_Clause" /> |
|||
</if> |
|||
</update> |
|||
<update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.web.domain.po.OnenetEquip"> |
|||
update onenet_equip |
|||
<set> |
|||
<if test="title != null"> |
|||
title = #{title,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="online != null"> |
|||
online = #{online,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="tags != null"> |
|||
tags = #{tags,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="protocol != null"> |
|||
protocol = #{protocol,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="location != null"> |
|||
location = #{location,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authInfo != null"> |
|||
auth_info = #{authInfo,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="otherInfo != null"> |
|||
other_info = #{otherInfo,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="createBy != null"> |
|||
create_by = #{createBy,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="createTime != null"> |
|||
create_time = #{createTime,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="updateBy != null"> |
|||
update_by = #{updateBy,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="updateTime != null"> |
|||
update_time = #{updateTime,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
</set> |
|||
where id = #{id,jdbcType=INTEGER} |
|||
</update> |
|||
<update id="updateByPrimaryKey" parameterType="com.ruoyi.web.domain.po.OnenetEquip"> |
|||
update onenet_equip |
|||
set title = #{title,jdbcType=VARCHAR}, |
|||
online = #{online,jdbcType=TINYINT}, |
|||
tags = #{tags,jdbcType=VARCHAR}, |
|||
protocol = #{protocol,jdbcType=VARCHAR}, |
|||
location = #{location,jdbcType=VARCHAR}, |
|||
auth_info = #{authInfo,jdbcType=VARCHAR}, |
|||
other_info = #{otherInfo,jdbcType=VARCHAR}, |
|||
create_by = #{createBy,jdbcType=VARCHAR}, |
|||
create_time = #{createTime,jdbcType=TIMESTAMP}, |
|||
update_by = #{updateBy,jdbcType=VARCHAR}, |
|||
update_time = #{updateTime,jdbcType=TIMESTAMP} |
|||
where id = #{id,jdbcType=INTEGER} |
|||
</update> |
|||
</mapper> |
@ -1,40 +1,67 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<artifactId>ruoyi</artifactId> |
|||
<groupId>com.ruoyi</groupId> |
|||
<version>3.8.5</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>ruoyi-generator</artifactId> |
|||
|
|||
<description> |
|||
generator代码生成 |
|||
</description> |
|||
|
|||
<dependencies> |
|||
|
|||
<!--velocity代码生成使用模板 --> |
|||
<dependency> |
|||
<groupId>org.apache.velocity</groupId> |
|||
<artifactId>velocity-engine-core</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- collections工具类 --> |
|||
<dependency> |
|||
<groupId>commons-collections</groupId> |
|||
<artifactId>commons-collections</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- 通用工具--> |
|||
<dependency> |
|||
<groupId>com.ruoyi</groupId> |
|||
<artifactId>ruoyi-common</artifactId> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
</project> |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<artifactId>ruoyi</artifactId> |
|||
<groupId>com.ruoyi</groupId> |
|||
<version>3.8.5</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>ruoyi-generator</artifactId> |
|||
|
|||
<description> |
|||
generator代码生成 |
|||
</description> |
|||
|
|||
<dependencies> |
|||
|
|||
<!--velocity代码生成使用模板 --> |
|||
<dependency> |
|||
<groupId>org.apache.velocity</groupId> |
|||
<artifactId>velocity-engine-core</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- collections工具类 --> |
|||
<dependency> |
|||
<groupId>commons-collections</groupId> |
|||
<artifactId>commons-collections</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- 通用工具--> |
|||
<dependency> |
|||
<groupId>com.ruoyi</groupId> |
|||
<artifactId>ruoyi-common</artifactId> |
|||
</dependency> |
|||
|
|||
<!--mybatis generator包--> |
|||
<dependency> |
|||
<groupId>org.mybatis.generator</groupId> |
|||
<artifactId>mybatis-generator-core</artifactId> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.mybatis.generator</groupId> |
|||
<artifactId>mybatis-generator-maven-plugin</artifactId> |
|||
<version>1.3.7</version> |
|||
<configuration> |
|||
<configurationFile>${basedir}/src/main/resources/mbg.xml</configurationFile> |
|||
<overwrite>true</overwrite> |
|||
</configuration> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<version>8.0.23</version> |
|||
</dependency> |
|||
</dependencies> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</project> |
|||
|
@ -0,0 +1,72 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE generatorConfiguration |
|||
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> |
|||
|
|||
<generatorConfiguration> |
|||
<context id="MySQL" targetRuntime="MyBatis3"> |
|||
<!-- 为生成的Java模型创建一个toString方法 --> |
|||
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/> |
|||
|
|||
<!-- 自定义的序列化 类文件 插件 --> |
|||
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/> |
|||
|
|||
<!-- 重新生成xml文件,而不是追加 --> |
|||
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin"/> |
|||
|
|||
<commentGenerator> |
|||
<!-- 是否去除自动生成的注释 true:是 : false:否 --> |
|||
<property name="suppressAllComments" value="true"/> |
|||
</commentGenerator> |
|||
|
|||
<!-- 数据库连接的信息:驱动类、连接地址、用户名、密码 --> |
|||
<!-- <jdbcConnection driverClass="com.mysql.jdbc.Driver"--> |
|||
<!-- connectionURL="jdbc:mysql://127.0.0.1:3306/iacdv2-cloud?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&tinyInt1isBit=false"--> |
|||
<!-- userId="root"--> |
|||
<!-- password="111111">--> |
|||
<!-- </jdbcConnection>--> |
|||
|
|||
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" |
|||
connectionURL="jdbc:mysql://localhost:3306/onenet_admin?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&tinyInt1isBit=false" |
|||
userId="root" |
|||
password="root"> |
|||
</jdbcConnection> |
|||
|
|||
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 |
|||
NUMERIC 类型解析为java.math.BigDecimal --> |
|||
<javaTypeResolver> |
|||
<property name="forceBigDecimals" value="true"/> |
|||
</javaTypeResolver> |
|||
|
|||
<!-- targetProject:生成PO类的位置 --> |
|||
<javaModelGenerator targetPackage="com.ruoyi.web.domain.po" |
|||
targetProject="..\ruoyi-admin\src\main\java"> |
|||
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
|||
<property name="enableSubPackages" value="false"/> |
|||
<!-- 从数据库返回的值被清理前后的空格 --> |
|||
<property name="trimStrings" value="true"/> |
|||
</javaModelGenerator> |
|||
|
|||
<!-- targetProject:mapper映射文件生成的位置 --> |
|||
<sqlMapGenerator targetPackage="mapper.device" |
|||
targetProject="..\ruoyi-admin\src\main\resources"> |
|||
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
|||
<property name="enableSubPackages" value="false"/> |
|||
</sqlMapGenerator> |
|||
|
|||
<!-- targetPackage:mapper接口生成的位置 --> |
|||
<javaClientGenerator type="XMLMAPPER" |
|||
targetPackage="com.ruoyi.web.persist.mapper" |
|||
targetProject="..\ruoyi-admin\src\main\java"> |
|||
<!-- enableSubPackages:是否让schema作为包的后缀 --> |
|||
<property name="enableSubPackages" value="false"/> |
|||
</javaClientGenerator> |
|||
|
|||
<table tableName="onenet_equip" domainObjectName="OnenetEquip"/> |
|||
|
|||
<!-- 有些表的字段需要指定java类型 |
|||
<table schema="" tableName=""> |
|||
<columnOverride column="" javaType="" /> |
|||
</table> --> |
|||
</context> |
|||
</generatorConfiguration> |
@ -0,0 +1,44 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 查询onenet参数列表
|
|||
export function listConfig(query) { |
|||
return request({ |
|||
url: '/device/config/list', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
|||
|
|||
// 查询onenet参数详细
|
|||
export function getConfig(id) { |
|||
return request({ |
|||
url: '/device/config/' + id, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 新增onenet参数
|
|||
export function addConfig(data) { |
|||
return request({ |
|||
url: '/device/config', |
|||
method: 'post', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 修改onenet参数
|
|||
export function updateConfig(data) { |
|||
return request({ |
|||
url: '/device/config', |
|||
method: 'put', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 删除onenet参数
|
|||
export function delConfig(id) { |
|||
return request({ |
|||
url: '/device/config/' + id, |
|||
method: 'delete' |
|||
}) |
|||
} |
@ -0,0 +1,54 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 查询设备列表
|
|||
export function getApiKey() { |
|||
return request({ |
|||
url: '/device/equip/getApiKey', |
|||
method: 'get', |
|||
}) |
|||
} |
|||
|
|||
// 查询设备列表
|
|||
export function listEquips(query) { |
|||
return request({ |
|||
url: '/device/equip/list', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
|||
|
|||
// 查询设备列表
|
|||
export function listEquipDatas(query) { |
|||
return request({ |
|||
url: '/device/equip/equipData', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
|||
|
|||
// 查询设备详细
|
|||
export function getEquips(id) { |
|||
return request({ |
|||
url: '/device/equip/' + id, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 写缓存命令
|
|||
export function writeCommand(data) { |
|||
return request({ |
|||
url: '/device/equip/writeCommand', |
|||
method: 'post', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
|
|||
|
|||
// 删除设备
|
|||
export function delEquips(id) { |
|||
return request({ |
|||
url: '/device/equip/' + id, |
|||
method: 'delete' |
|||
}) |
|||
} |
@ -0,0 +1,269 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
|||
<el-form-item label="建" prop="configKey"> |
|||
<el-input |
|||
v-model="queryParams.configKey" |
|||
placeholder="请输入建" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="值" prop="configValue"> |
|||
<el-input |
|||
v-model="queryParams.configValue" |
|||
placeholder="请输入值" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
|||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-row :gutter="10" class="mb8"> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="primary" |
|||
plain |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
@click="handleAdd" |
|||
v-hasPermi="['device:config:add']" |
|||
>新增</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="success" |
|||
plain |
|||
icon="el-icon-edit" |
|||
size="mini" |
|||
:disabled="single" |
|||
@click="handleUpdate" |
|||
v-hasPermi="['device:config:edit']" |
|||
>修改</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="danger" |
|||
plain |
|||
icon="el-icon-delete" |
|||
size="mini" |
|||
:disabled="multiple" |
|||
@click="handleDelete" |
|||
v-hasPermi="['device:config:remove']" |
|||
>删除</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="warning" |
|||
plain |
|||
icon="el-icon-download" |
|||
size="mini" |
|||
@click="handleExport" |
|||
v-hasPermi="['device:config:export']" |
|||
>导出</el-button> |
|||
</el-col> |
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
|||
</el-row> |
|||
|
|||
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" width="55" align="center" /> |
|||
<el-table-column label="" align="center" prop="id" /> |
|||
<el-table-column label="建" align="center" prop="configKey" /> |
|||
<el-table-column label="值" align="center" prop="configValue" /> |
|||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-edit" |
|||
@click="handleUpdate(scope.row)" |
|||
v-hasPermi="['device:config:edit']" |
|||
>修改</el-button> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-delete" |
|||
@click="handleDelete(scope.row)" |
|||
v-hasPermi="['device:config:remove']" |
|||
>删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<pagination |
|||
v-show="total>0" |
|||
:total="total" |
|||
:page.sync="queryParams.pageNum" |
|||
:limit.sync="queryParams.pageSize" |
|||
@pagination="getList" |
|||
/> |
|||
|
|||
<!-- 添加或修改onenet参数对话框 --> |
|||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
|||
<el-form-item label="建" prop="configKey"> |
|||
<el-input v-model="form.configKey" placeholder="请输入建" /> |
|||
</el-form-item> |
|||
<el-form-item label="值" prop="configValue"> |
|||
<el-input v-model="form.configValue" placeholder="请输入值" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="cancel">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { listConfig, getConfig, delConfig, addConfig, updateConfig } from "@/api/device/config"; |
|||
|
|||
export default { |
|||
name: "Config", |
|||
data() { |
|||
return { |
|||
// 遮罩层 |
|||
loading: true, |
|||
// 选中数组 |
|||
ids: [], |
|||
// 非单个禁用 |
|||
single: true, |
|||
// 非多个禁用 |
|||
multiple: true, |
|||
// 显示搜索条件 |
|||
showSearch: true, |
|||
// 总条数 |
|||
total: 0, |
|||
// onenet参数表格数据 |
|||
configList: [], |
|||
// 弹出层标题 |
|||
title: "", |
|||
// 是否显示弹出层 |
|||
open: false, |
|||
// 查询参数 |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
configKey: null, |
|||
configValue: null, |
|||
}, |
|||
// 表单参数 |
|||
form: {}, |
|||
// 表单校验 |
|||
rules: { |
|||
configKey: [ |
|||
{ required: true, message: "建不能为空", trigger: "blur" } |
|||
], |
|||
configValue: [ |
|||
{ required: true, message: "值不能为空", trigger: "blur" } |
|||
], |
|||
} |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
}, |
|||
methods: { |
|||
/** 查询onenet参数列表 */ |
|||
getList() { |
|||
this.loading = true; |
|||
listConfig(this.queryParams).then(response => { |
|||
this.configList = response.rows; |
|||
this.total = response.total; |
|||
this.loading = false; |
|||
}); |
|||
}, |
|||
// 取消按钮 |
|||
cancel() { |
|||
this.open = false; |
|||
this.reset(); |
|||
}, |
|||
// 表单重置 |
|||
reset() { |
|||
this.form = { |
|||
id: null, |
|||
configKey: null, |
|||
configValue: null, |
|||
createBy: null, |
|||
createTime: null, |
|||
updateBy: null, |
|||
updateTime: null |
|||
}; |
|||
this.resetForm("form"); |
|||
}, |
|||
/** 搜索按钮操作 */ |
|||
handleQuery() { |
|||
this.queryParams.pageNum = 1; |
|||
this.getList(); |
|||
}, |
|||
/** 重置按钮操作 */ |
|||
resetQuery() { |
|||
this.resetForm("queryForm"); |
|||
this.handleQuery(); |
|||
}, |
|||
// 多选框选中数据 |
|||
handleSelectionChange(selection) { |
|||
this.ids = selection.map(item => item.id) |
|||
this.single = selection.length!==1 |
|||
this.multiple = !selection.length |
|||
}, |
|||
/** 新增按钮操作 */ |
|||
handleAdd() { |
|||
this.reset(); |
|||
this.open = true; |
|||
this.title = "添加onenet参数"; |
|||
}, |
|||
/** 修改按钮操作 */ |
|||
handleUpdate(row) { |
|||
this.reset(); |
|||
const id = row.id || this.ids |
|||
getConfig(id).then(response => { |
|||
this.form = response.data; |
|||
this.open = true; |
|||
this.title = "修改onenet参数"; |
|||
}); |
|||
}, |
|||
/** 提交按钮 */ |
|||
submitForm() { |
|||
this.$refs["form"].validate(valid => { |
|||
if (valid) { |
|||
if (this.form.id != null) { |
|||
updateConfig(this.form).then(response => { |
|||
this.$modal.msgSuccess("修改成功"); |
|||
this.open = false; |
|||
this.getList(); |
|||
}); |
|||
} else { |
|||
addConfig(this.form).then(response => { |
|||
this.$modal.msgSuccess("新增成功"); |
|||
this.open = false; |
|||
this.getList(); |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
/** 删除按钮操作 */ |
|||
handleDelete(row) { |
|||
const ids = row.id || this.ids; |
|||
this.$modal.confirm('是否确认删除onenet参数编号为"' + ids + '"的数据项?').then(function() { |
|||
return delConfig(ids); |
|||
}).then(() => { |
|||
this.getList(); |
|||
this.$modal.msgSuccess("删除成功"); |
|||
}).catch(() => {}); |
|||
}, |
|||
/** 导出按钮操作 */ |
|||
handleExport() { |
|||
this.download('device/config/export', { |
|||
...this.queryParams |
|||
}, `config_${new Date().getTime()}.xlsx`) |
|||
} |
|||
} |
|||
}; |
|||
</script> |
@ -0,0 +1,583 @@ |
|||
<style> |
|||
.el-input-group__append{ |
|||
color: #FFFFFF; |
|||
background-color: #1890ff; |
|||
} |
|||
|
|||
</style> |
|||
<template> |
|||
<div class="app-container"> |
|||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
|||
<el-form-item label="设备名称" prop="title"> |
|||
<el-input |
|||
v-model="queryParams.title" |
|||
placeholder="请输入设备名称" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="是否在线" prop="online"> |
|||
<el-input |
|||
v-model="queryParams.online" |
|||
placeholder="请输入是否在线" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="设备标签" prop="tags"> |
|||
<el-input |
|||
v-model="queryParams.tags" |
|||
placeholder="请输入设备标签" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="接入协议 " prop="protocol"> |
|||
<el-input |
|||
v-model="queryParams.protocol" |
|||
placeholder="请输入接入协议 " |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="位置" prop="location"> |
|||
<el-input |
|||
v-model="queryParams.location" |
|||
placeholder="请输入位置" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="NBIOT设备" prop="authInfo"> |
|||
<el-input |
|||
v-model="queryParams.authInfo" |
|||
placeholder="请输入NBIOT设备" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="其他信息" prop="otherInfo"> |
|||
<el-input |
|||
v-model="queryParams.otherInfo" |
|||
placeholder="请输入其他信息" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
|||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-row :gutter="10" class="mb8"> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="primary" |
|||
plain |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
@click="handleAdd" |
|||
v-hasPermi="['device:equips:add']" |
|||
>新增</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="success" |
|||
plain |
|||
icon="el-icon-edit" |
|||
size="mini" |
|||
:disabled="single" |
|||
@click="handleUpdate" |
|||
v-hasPermi="['device:equips:edit']" |
|||
>修改</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="danger" |
|||
plain |
|||
icon="el-icon-delete" |
|||
size="mini" |
|||
:disabled="multiple" |
|||
@click="handleDelete" |
|||
v-hasPermi="['device:equips:remove']" |
|||
>删除</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="warning" |
|||
plain |
|||
icon="el-icon-download" |
|||
size="mini" |
|||
@click="handleExport" |
|||
v-hasPermi="['device:equips:export']" |
|||
>导出</el-button> |
|||
</el-col> |
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
|||
</el-row> |
|||
|
|||
<el-table v-loading="loading" :data="equipsList" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" width="55" align="center" /> |
|||
<el-table-column label="主键" align="center" prop="id" /> |
|||
<el-table-column label="设备名称" align="center" prop="title" /> |
|||
<el-table-column label="是否在线" align="center" prop="online" /> |
|||
<el-table-column label="设备标签" align="center" prop="tags" /> |
|||
<el-table-column label="接入协议 " align="center" prop="protocol" /> |
|||
<el-table-column label="位置" align="center" prop="location" /> |
|||
<el-table-column label="NBIOT设备" align="center" prop="authInfo" /> |
|||
<el-table-column label="其他信息" align="center" prop="otherInfo" /> |
|||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-edit" |
|||
@click="handleDeviceResource(scope.row)" |
|||
v-hasPermi="['device:equips:edit']" |
|||
>写设备资源</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-edit" |
|||
@click="getEquipDatas(scope.row)" |
|||
v-hasPermi="['device:equips:edit']" |
|||
>设备数据点</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-edit" |
|||
@click="handleUpdate(scope.row)" |
|||
v-hasPermi="['device:equips:edit']" |
|||
>修改</el-button> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-delete" |
|||
@click="handleDelete(scope.row)" |
|||
v-hasPermi="['device:equips:remove']" |
|||
>删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<pagination |
|||
v-show="total>0" |
|||
:total="total" |
|||
:page.sync="queryParams.pageNum" |
|||
:limit.sync="queryParams.pageSize" |
|||
@pagination="getList" |
|||
/> |
|||
|
|||
<!-- 写设备资源 --> |
|||
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="300px"> |
|||
<el-form-item label="Imei" prop="imei" required> |
|||
<el-input v-model="form.imei" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备Id" prop="obj_id" required> |
|||
<el-input v-model="form.obj_id" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="Obj Inst Id" prop="obj_inst_id" required> |
|||
<el-input v-model="form.obj_inst_id" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="Write的写模式,只能是1或者2" prop="mode" required> |
|||
<el-input v-model="form.mode" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="命令过期时间戳,必填且大于Valid Time " prop="expired_time" required> |
|||
<el-date-picker |
|||
v-model="form.expired_time" |
|||
type="datetime" |
|||
placeholder="选择日期时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item label="命令触发的上行消息类型[1,7]" prop="trigger_msg" required> |
|||
<el-input v-model="form.trigger_msg" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="Api-Key" prop="api_key" required> |
|||
<el-input v-model="form.api_key" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="Res Id" prop="res_id" required> |
|||
<el-input v-model="form.res_id" placeholder="" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="起始符" prop="" required> |
|||
<el-input v-model="verifyForm.param1" :disabled="true" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备类型" prop="" required> |
|||
<el-input v-model="verifyForm.param2" :disabled="true" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备号" prop="" required> |
|||
<el-input v-model="verifyForm.param3" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="控制码" prop="" required> |
|||
<el-radio v-model="verifyForm.param4" label="01" border>01</el-radio> |
|||
<el-radio v-model="verifyForm.param4" label="02" border>02</el-radio> |
|||
</el-form-item> |
|||
<el-form-item label="数据长度" prop="" required> |
|||
<el-radio v-model="verifyForm.param5" label="09" border>09</el-radio> |
|||
<el-radio v-model="verifyForm.param5" label="0B" border>0B</el-radio> |
|||
</el-form-item> |
|||
<el-form-item label="指令标识" prop="" required> |
|||
<el-input v-model="verifyForm.param6" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="数据" prop="" required> |
|||
<el-input v-model="verifyForm.param7" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="命令方式" prop="" required> |
|||
<el-radio v-model="verifyForm.param8" label="00" border>00</el-radio> |
|||
<el-radio v-model="verifyForm.param8" label="11" border>11</el-radio> |
|||
</el-form-item> |
|||
<el-form-item label="自定义数组" prop="" required> |
|||
<el-input v-model="verifyForm.param9" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="固定字节" prop="" required> |
|||
<el-input v-model="verifyForm.param10" :disabled="true" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="累加和校验" prop="" required> |
|||
<el-input v-model="verifyForm.param11" :disabled="true" placeholder=""> |
|||
<el-button slot="append" type="primary" @click="getCheckCode">生成校验码</el-button> |
|||
</el-input> |
|||
|
|||
</el-form-item> |
|||
<el-form-item label="结束符" prop="" required> |
|||
<el-input v-model="verifyForm.param12" :disabled="true" placeholder="" /> |
|||
</el-form-item> |
|||
<el-form-item label="缓存命令Val" prop="command" required> |
|||
<el-input v-model="form.command" placeholder="" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="cancel">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
<!-- 设备数据点--> |
|||
<el-dialog title="设备数据点" :visible.sync="equipDataOpen" width="80%"> |
|||
<el-table v-loading="loading" :data="equipDataList"> |
|||
<el-table-column label="阀开关" align="center" prop="valveStatus1" fixed /> |
|||
<el-table-column label="阀门状态" align="center"> |
|||
<el-table-column label="阀门动作" align="center" prop="valveStatus2" /> |
|||
<el-table-column label="行程开关" align="center" prop="valveStatus3" /> |
|||
<el-table-column label="电位器" align="center" prop="valveStatus4" /> |
|||
<el-table-column label="电池电量" align="center" prop="valveStatus5" /> |
|||
<el-table-column label="回水传感器" align="center" prop="valveStatus6" /> |
|||
<el-table-column label="加速度传感器" align="center" prop="valveStatus7" /> |
|||
<el-table-column label="角度" align="center" prop="valveStatus8" /> |
|||
</el-table-column> |
|||
<el-table-column label="设定开度" align="center" prop="setOpening" /> |
|||
<el-table-column label="实际开度" align="center" prop="actualOpening" /> |
|||
<el-table-column label="进水温度" align="center" prop="waterInletTemperature" /> |
|||
<el-table-column label="回水温度" align="center" prop="waterReturnTemperature" /> |
|||
<el-table-column label="电池电量" align="center" prop="batteryPower" /> |
|||
<el-table-column label="加速度X轴" align="center" prop="acceleratedX" /> |
|||
<el-table-column label="加速度Y轴" align="center" prop="acceleratedY" /> |
|||
<el-table-column label="加速度Z轴" align="center" prop="acceleratedZ" /> |
|||
<el-table-column label="信号强度" align="center" prop="signalStrength" /> |
|||
<el-table-column label="阀门时间" align="center" prop="valveTime" /> |
|||
<el-table-column label="上报间隔" align="center" prop="reportingInterval" /> |
|||
<el-table-column label="间隔单位" align="center" prop="intervalUnit" /> |
|||
<el-table-column label="上报有效时长" align="center" prop="effectiveTime" /> |
|||
<el-table-column label="总上报次数" align="center" prop="totalNumberReports" /> |
|||
<el-table-column label="其他" align="center" prop="other" /> |
|||
<el-table-column label="累加校验和" align="center" prop="check" /> |
|||
<el-table-column label="结束符" align="center" prop="finish" /> |
|||
<el-table-column label="原始数据" align="center" prop="deviceData" width="1000" /> |
|||
<el-table-column label="时间" align="center" prop="dataTime" fixed="right" /> |
|||
</el-table> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
listEquips, |
|||
getEquips, |
|||
delEquips, |
|||
addEquips, |
|||
updateEquips, |
|||
getApiKey, |
|||
writeCommand, listEquipDatas |
|||
} from "@/api/device/equips"; |
|||
|
|||
|
|||
var time = new Date() |
|||
time.setDate(time.getDate() + 1); |
|||
|
|||
export default { |
|||
name: "Equips", |
|||
data() { |
|||
return { |
|||
// 遮罩层 |
|||
loading: true, |
|||
// 选中数组 |
|||
ids: [], |
|||
// 非单个禁用 |
|||
single: true, |
|||
// 非多个禁用 |
|||
multiple: true, |
|||
// 显示搜索条件 |
|||
showSearch: true, |
|||
// 总条数 |
|||
total: 0, |
|||
// 设备表格数据 |
|||
equipsList: [], |
|||
equipDataList: [], |
|||
apiKey:null, |
|||
// 弹出层标题 |
|||
title: "", |
|||
// 是否显示弹出层 |
|||
open: false, |
|||
equipDataOpen:false, |
|||
// 查询参数 |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
title: null, |
|||
online: null, |
|||
tags: null, |
|||
protocol: null, |
|||
location: null, |
|||
authInfo: null, |
|||
otherInfo: null, |
|||
|
|||
imei:null, |
|||
obj_id:null, |
|||
obj_inst_id:null, |
|||
mode:1, |
|||
expired_time:null, |
|||
trigger_msg:4, |
|||
api_key:null, |
|||
res_id:5750, |
|||
}, |
|||
// 表单参数 |
|||
form: { |
|||
imei:null, |
|||
obj_id:null, |
|||
obj_inst_id:null, |
|||
mode:null, |
|||
expired_time:null, |
|||
trigger_msg:null, |
|||
api_key:null, |
|||
res_id:null, |
|||
command:null, |
|||
}, |
|||
verifyForm:{ |
|||
param1: null, |
|||
param2: null, |
|||
param3: null, |
|||
param4: null, |
|||
param5: null, |
|||
param6: null, |
|||
param7: null, |
|||
param8: null, |
|||
param9: null, |
|||
param10: null, |
|||
param11: null, |
|||
param12: null, |
|||
}, |
|||
// 表单校验 |
|||
rules: { |
|||
obj_id:[{ required: true, message: '请输入 设备Id'}], |
|||
mode:[{ required: true, message: '请输入 Write的写模式'}], |
|||
expired_time:[{ required: true, message: '请输入 命令过期时间'}], |
|||
trigger_msg:[{ required: true, message: '请输入 消息类型'}], |
|||
command:[{ required: true, message: '请输入 缓存命令Val'}], |
|||
} |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getApiKey(); |
|||
this.getList(); |
|||
}, |
|||
methods: { |
|||
//查询onenet参数 |
|||
getApiKey(){ |
|||
getApiKey().then(response => { |
|||
this.apiKey = response.msg |
|||
}); |
|||
}, |
|||
/** 查询设备列表 */ |
|||
getList() { |
|||
this.loading = true; |
|||
listEquips(this.queryParams).then(response => { |
|||
this.equipsList = response.rows; |
|||
this.total = response.total; |
|||
this.loading = false; |
|||
}); |
|||
}, |
|||
/** 查询设备数据点 */ |
|||
getEquipDatas(row) { |
|||
console.log(row) |
|||
this.equipDataOpen = true; |
|||
this.title = "查询设备数据点"; |
|||
this.loading = true; |
|||
let param = { |
|||
obj_id:row.id |
|||
} |
|||
listEquipDatas(param).then(response => { |
|||
this.equipDataList = response.rows; |
|||
// this.total = response.total; |
|||
this.loading = false; |
|||
}); |
|||
}, |
|||
// 取消按钮 |
|||
cancel() { |
|||
this.open = false; |
|||
this.reset(); |
|||
}, |
|||
// 表单重置 |
|||
reset() { |
|||
this.form = { |
|||
imei:null, |
|||
obj_id:null, |
|||
obj_inst_id:0, |
|||
mode:1, |
|||
expired_time: time, |
|||
trigger_msg:4, |
|||
api_key:this.apiKey, |
|||
res_id:5750, |
|||
command:null, |
|||
}; |
|||
this.verifyForm = { |
|||
param1:68, |
|||
param2:"C0", |
|||
param3:0, |
|||
param4:"01", |
|||
param5:"09", |
|||
param6:'0111', |
|||
param7:"00", |
|||
param8:"00", |
|||
param9:'00000000', |
|||
param10:'01', |
|||
param11:'', |
|||
param12:'16', |
|||
} |
|||
this.resetForm("form"); |
|||
}, |
|||
/** 搜索按钮操作 */ |
|||
handleQuery() { |
|||
this.queryParams.pageNum = 1; |
|||
this.getList(); |
|||
}, |
|||
/** 重置按钮操作 */ |
|||
resetQuery() { |
|||
this.resetForm("queryForm"); |
|||
this.handleQuery(); |
|||
}, |
|||
// 多选框选中数据 |
|||
handleSelectionChange(selection) { |
|||
this.ids = selection.map(item => item.id) |
|||
this.single = selection.length!==1 |
|||
this.multiple = !selection.length |
|||
}, |
|||
/** 新增按钮操作 */ |
|||
handleAdd() { |
|||
this.reset(); |
|||
this.open = true; |
|||
this.title = "添加设备"; |
|||
}, |
|||
/** 修改按钮操作 */ |
|||
handleUpdate(row) { |
|||
this.reset(); |
|||
const id = row.id || this.ids |
|||
getEquips(id).then(response => { |
|||
this.form = response.data; |
|||
this.open = true; |
|||
this.title = "修改设备"; |
|||
}); |
|||
}, |
|||
/** 写设备资源 */ |
|||
handleDeviceResource(row) { |
|||
this.reset(); |
|||
this.form.imei = Object.keys(JSON.parse(row.authInfo))[0] |
|||
this.form.obj_id = row.id |
|||
|
|||
this.verifyForm.param3 = this.form.imei.padStart(16, '0'); |
|||
|
|||
this.open = true; |
|||
this.title = "写设备资源"; |
|||
}, |
|||
//生成校验码 |
|||
getCheckCode(){ |
|||
for(var i = 1; i <= 10 ; i++) { |
|||
if (eval('this.verifyForm.param' + i + '=== ""')){ |
|||
alert('有未填项') |
|||
return; |
|||
} |
|||
} |
|||
this.verifyForm.param4 = this.verifyForm.param4 == 0 ? '01' : '02'; |
|||
this.verifyForm.param5 = this.verifyForm.param5 == 0 ? '09' : '0B'; |
|||
this.verifyForm.param8 = this.verifyForm.param8 == 0 ? '00' : '11'; |
|||
|
|||
let str = this.verifyForm.param1 + this.verifyForm.param2 + this.verifyForm.param3 + this.verifyForm.param4 + this.verifyForm.param5 + this.verifyForm.param6 + this.verifyForm.param7 + this.verifyForm.param8 + this.verifyForm.param9 + this.verifyForm.param10 |
|||
|
|||
let itotal=0,len = str.length,num = 0; |
|||
while(num<len){ |
|||
let s = str.substring(num,num+2); |
|||
|
|||
itotal += parseInt(s,16) |
|||
num=num+2; |
|||
} |
|||
let mode = itotal%256; |
|||
let shex = mode.toString(16) |
|||
|
|||
let res =shex.substr(-2).toUpperCase(); |
|||
|
|||
this.verifyForm.param11 = res; |
|||
this.form.command = str + res + this.verifyForm.param12; |
|||
}, |
|||
/** 提交按钮 */ |
|||
submitForm() { |
|||
this.$refs["form"].validate( async valid => { |
|||
let res = null; |
|||
if (valid) { |
|||
if (this.form.command != null) { |
|||
await writeCommand(this.form).then(response => { |
|||
if (response.data == true){ |
|||
|
|||
this.$modal.msgSuccess("添加成功"); |
|||
res = response; |
|||
this.open = false; |
|||
this.getList(); |
|||
} else { |
|||
this.$modal.msgError("添加失败"); |
|||
} |
|||
return; |
|||
}); |
|||
} |
|||
} |
|||
if (res == null){ |
|||
this.$modal.msgError("请填写全部"); |
|||
} |
|||
}); |
|||
}, |
|||
/** 删除按钮操作 */ |
|||
handleDelete(row) { |
|||
const ids = row.id || this.ids; |
|||
this.$modal.confirm('是否确认删除设备编号为"' + ids + '"的数据项?').then(function() { |
|||
return delEquips(ids); |
|||
}).then(() => { |
|||
this.getList(); |
|||
this.$modal.msgSuccess("删除成功"); |
|||
}).catch(() => {}); |
|||
}, |
|||
/** 导出按钮操作 */ |
|||
handleExport() { |
|||
this.download('device/equips/export', { |
|||
...this.queryParams |
|||
}, `equips_${new Date().getTime()}.xlsx`) |
|||
} |
|||
} |
|||
}; |
|||
</script> |
Loading…
Reference in new issue