Commit 33c4bddc authored by 吴卿华's avatar 吴卿华

增加 报警信息管理 下级设备信息查询 下级设备信息添加

parent 94583016
...@@ -7,7 +7,9 @@ import com.zehong.common.core.domain.AjaxResult; ...@@ -7,7 +7,9 @@ import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo; import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType; import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil; import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.EquipmentForm;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TDeviceInformation;
import com.zehong.system.domain.vo.DeviceInfoVo; import com.zehong.system.domain.vo.DeviceInfoVo;
import com.zehong.system.service.ITDeviceInfoService; import com.zehong.system.service.ITDeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -25,8 +27,7 @@ import java.util.Map; ...@@ -25,8 +27,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("/device/deviceInfo") @RequestMapping("/device/deviceInfo")
public class TDeviceInfoController extends BaseController public class TDeviceInfoController extends BaseController {
{
@Autowired @Autowired
private ITDeviceInfoService tDeviceInfoService; private ITDeviceInfoService tDeviceInfoService;
...@@ -35,8 +36,7 @@ public class TDeviceInfoController extends BaseController ...@@ -35,8 +36,7 @@ public class TDeviceInfoController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('device:deviceInfo:list')") @PreAuthorize("@ss.hasPermi('device:deviceInfo:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(TDeviceInfo tDeviceInfo) public TableDataInfo list(TDeviceInfo tDeviceInfo) {
{
startPage(); startPage();
PageInfo<DeviceInfoVo> page = tDeviceInfoService.selectTDeviceInfoPage(tDeviceInfo); PageInfo<DeviceInfoVo> page = tDeviceInfoService.selectTDeviceInfoPage(tDeviceInfo);
return getDataTable(page); return getDataTable(page);
...@@ -44,11 +44,12 @@ public class TDeviceInfoController extends BaseController ...@@ -44,11 +44,12 @@ public class TDeviceInfoController extends BaseController
/** /**
* 获取所有设备信息 * 获取所有设备信息
*
* @param tDeviceInfo * @param tDeviceInfo
* @return * @return
*/ */
@GetMapping("/deviceListInfo") @GetMapping("/deviceListInfo")
public AjaxResult deviceListInfo(TDeviceInfo tDeviceInfo){ public AjaxResult deviceListInfo(TDeviceInfo tDeviceInfo) {
return AjaxResult.success(tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo)); return AjaxResult.success(tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo));
} }
...@@ -56,8 +57,7 @@ public class TDeviceInfoController extends BaseController ...@@ -56,8 +57,7 @@ public class TDeviceInfoController extends BaseController
* 获取设备下拉树列表 * 获取设备下拉树列表
*/ */
@PutMapping("/deviceTree") @PutMapping("/deviceTree")
public AjaxResult deviceTree(@RequestBody Map<Object, List> param) public AjaxResult deviceTree(@RequestBody Map<Object, List> param) {
{
return AjaxResult.success(tDeviceInfoService.buildDeviceTreeSelect(param)); return AjaxResult.success(tDeviceInfoService.buildDeviceTreeSelect(param));
} }
...@@ -65,8 +65,7 @@ public class TDeviceInfoController extends BaseController ...@@ -65,8 +65,7 @@ public class TDeviceInfoController extends BaseController
* 获取设备树 * 获取设备树
*/ */
@GetMapping("/deviceNodeTree") @GetMapping("/deviceNodeTree")
public AjaxResult deviceNodeTree() throws Exception public AjaxResult deviceNodeTree() throws Exception {
{
List<Map<Object, Object>> list = null; List<Map<Object, Object>> list = null;
try { try {
list = tDeviceInfoService.buildDeviceTree(); list = tDeviceInfoService.buildDeviceTree();
...@@ -84,8 +83,7 @@ public class TDeviceInfoController extends BaseController ...@@ -84,8 +83,7 @@ public class TDeviceInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('device:deviceInfo:export')") @PreAuthorize("@ss.hasPermi('device:deviceInfo:export')")
@Log(title = "设备信息", businessType = BusinessType.EXPORT) @Log(title = "设备信息", businessType = BusinessType.EXPORT)
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(TDeviceInfo tDeviceInfo) public AjaxResult export(TDeviceInfo tDeviceInfo) {
{
List<DeviceInfoVo> list = tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo); List<DeviceInfoVo> list = tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo);
ExcelUtil<DeviceInfoVo> util = new ExcelUtil<DeviceInfoVo>(DeviceInfoVo.class); ExcelUtil<DeviceInfoVo> util = new ExcelUtil<DeviceInfoVo>(DeviceInfoVo.class);
return util.exportExcel(list, "设备信息数据"); return util.exportExcel(list, "设备信息数据");
...@@ -96,8 +94,7 @@ public class TDeviceInfoController extends BaseController ...@@ -96,8 +94,7 @@ public class TDeviceInfoController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('device:deviceInfo:query')") @PreAuthorize("@ss.hasPermi('device:deviceInfo:query')")
@GetMapping(value = "/{deviceId}") @GetMapping(value = "/{deviceId}")
public AjaxResult getInfo(@PathVariable("deviceId") int deviceId) public AjaxResult getInfo(@PathVariable("deviceId") int deviceId) {
{
return AjaxResult.success(tDeviceInfoService.selectTDeviceInfoById(deviceId)); return AjaxResult.success(tDeviceInfoService.selectTDeviceInfoById(deviceId));
} }
...@@ -107,10 +104,10 @@ public class TDeviceInfoController extends BaseController ...@@ -107,10 +104,10 @@ public class TDeviceInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('device:deviceInfo:add')") @PreAuthorize("@ss.hasPermi('device:deviceInfo:add')")
@Log(title = "设备信息", businessType = BusinessType.INSERT) @Log(title = "设备信息", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody TDeviceInfo tDeviceInfo) public AjaxResult add(@RequestBody TDeviceInfo tDeviceInfo) {
{ System.out.println(tDeviceInfo.getEquipmentList());
int result = tDeviceInfoService.insertTDeviceInfo(tDeviceInfo); int result = tDeviceInfoService.insertTDeviceInfo(tDeviceInfo);
if(result<=0){ if (result <= 0) {
new Exception("设备信息插入失败"); new Exception("设备信息插入失败");
} }
return AjaxResult.success(tDeviceInfo.getDeviceId()); return AjaxResult.success(tDeviceInfo.getDeviceId());
...@@ -122,8 +119,15 @@ public class TDeviceInfoController extends BaseController ...@@ -122,8 +119,15 @@ public class TDeviceInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('device:deviceInfo:edit')") @PreAuthorize("@ss.hasPermi('device:deviceInfo:edit')")
@Log(title = "设备信息", businessType = BusinessType.UPDATE) @Log(title = "设备信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody TDeviceInfo tDeviceInfo) public AjaxResult edit(@RequestBody TDeviceInfo tDeviceInfo) {
{ /**
* 先执行删除 在执行添加 不能删除任何一个
*/
/**删除下级设备信息*/
tDeviceInfoService.deleteEquipmentList(tDeviceInfo.getEquipmentList(),tDeviceInfo.getDeviceId());
/**新增下级设备信息*/
tDeviceInfoService.insertEquipmentList(tDeviceInfo.getEquipmentList(),tDeviceInfo.getDeviceId());
return toAjax(tDeviceInfoService.updateTDeviceInfo(tDeviceInfo)); return toAjax(tDeviceInfoService.updateTDeviceInfo(tDeviceInfo));
} }
...@@ -133,8 +137,7 @@ public class TDeviceInfoController extends BaseController ...@@ -133,8 +137,7 @@ public class TDeviceInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('device:deviceInfo:remove')") @PreAuthorize("@ss.hasPermi('device:deviceInfo:remove')")
@Log(title = "设备信息", businessType = BusinessType.DELETE) @Log(title = "设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceIds}") @DeleteMapping("/{deviceIds}")
public AjaxResult remove(@PathVariable int[] deviceIds) public AjaxResult remove(@PathVariable int[] deviceIds) {
{
return toAjax(tDeviceInfoService.deleteTDeviceInfoByIds(deviceIds)); return toAjax(tDeviceInfoService.deleteTDeviceInfoByIds(deviceIds));
} }
...@@ -143,14 +146,36 @@ public class TDeviceInfoController extends BaseController ...@@ -143,14 +146,36 @@ public class TDeviceInfoController extends BaseController
*/ */
//@PreAuthorize("@ss.hasPermi('device:deviceInfo:countDeviceByType')") //@PreAuthorize("@ss.hasPermi('device:deviceInfo:countDeviceByType')")
@GetMapping("/countDeviceByType") @GetMapping("/countDeviceByType")
public AjaxResult countDeviceByType() public AjaxResult countDeviceByType() {
{
List<Map<Object, Object>> list = tDeviceInfoService.countDeviceByType(); List<Map<Object, Object>> list = tDeviceInfoService.countDeviceByType();
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@PutMapping("/devicefeed") @PutMapping("/devicefeed")
public AjaxResult devicefeed(@RequestBody Map<String, Object> param) public AjaxResult devicefeed(@RequestBody Map<String, Object> param) {
{
return AjaxResult.success(tDeviceInfoService.devicefeed(param)); return AjaxResult.success(tDeviceInfoService.devicefeed(param));
} }
/**
* 查询下级设备所有信息
* @return
*/
@GetMapping("/selectDevice")
public AjaxResult selectDevice(Integer id) {
return AjaxResult.success(tDeviceInfoService.selectDevice(id));
}
/**
* 根据设备id查询最新的设备信息数据
* @param deviceId
* @return
*/
@GetMapping("/getInformation")
public AjaxResult getInformation(Integer deviceId){
return AjaxResult.success(tDeviceInfoService.getInformations(deviceId));
}
} }
package com.zehong.system.domain;
import java.util.Date;
public class EquipmentForm {
/**
* 主键
*/
private Integer relationId;
/**
* 关联设备id
*/
private Integer relationDeviceId;
/**
* 设备名称
*/
private String deviceNames;
/**
* 设备编号
*/
private String deviceCodes;
/**
* 创建时间
* @return
*/
private Date createTime;
public Integer getRelationId() {
return relationId;
}
public void setRelationId(Integer relationId) {
this.relationId = relationId;
}
public Integer getRelationDeviceId() {
return relationDeviceId;
}
public void setRelationDeviceId(Integer relationDeviceId) {
this.relationDeviceId = relationDeviceId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getDeviceNames() {
return deviceNames;
}
public void setDeviceNames(String deviceNames) {
this.deviceNames = deviceNames;
}
public String getDeviceCodes() {
return deviceCodes;
}
public void setDeviceCodes(String deviceCodes) {
this.deviceCodes = deviceCodes;
}
@Override
public String toString() {
return "EquipmentForm{" +
"relationId=" + relationId +
", relationDeviceId=" + relationDeviceId +
", deviceNames='" + deviceNames + '\'' +
", deviceCodes='" + deviceCodes + '\'' +
", createTime=" + createTime +
'}';
}
}
...@@ -2,6 +2,8 @@ package com.zehong.system.domain; ...@@ -2,6 +2,8 @@ package com.zehong.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -91,6 +93,23 @@ public class TDeviceInfo extends BaseEntity ...@@ -91,6 +93,23 @@ public class TDeviceInfo extends BaseEntity
@Excel(name = "备注") @Excel(name = "备注")
private String remarks; private String remarks;
/**
* 下级设备
*/
private List<EquipmentForm> equipmentList;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public List<EquipmentForm> getEquipmentList() {
return equipmentList;
}
public void setEquipmentList(List<EquipmentForm> equipmentList) {
this.equipmentList = equipmentList;
}
public void setDeviceId(Integer deviceId) public void setDeviceId(Integer deviceId)
{ {
this.deviceId = deviceId; this.deviceId = deviceId;
...@@ -256,24 +275,26 @@ public class TDeviceInfo extends BaseEntity ...@@ -256,24 +275,26 @@ public class TDeviceInfo extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return "TDeviceInfo{" +
.append("deviceId", getDeviceId()) "deviceId=" + deviceId +
.append("enterpriseId", getEnterpriseId()) ", enterpriseId=" + enterpriseId +
.append("pipeCode", getPipeId()) ", pipeId=" + pipeId +
.append("deviceName", getDeviceName()) ", deviceName='" + deviceName + '\'' +
.append("deviceCode", getDeviceCode()) ", deviceCode='" + deviceCode + '\'' +
.append("deviceAddr", getDeviceAddr()) ", deviceAddr='" + deviceAddr + '\'' +
.append("deviceModel", getDeviceModel()) ", deviceModel='" + deviceModel + '\'' +
.append("deviceType", getDeviceType()) ", deviceType='" + deviceType + '\'' +
.append("longitude", getLongitude()) ", longitude=" + longitude +
.append("latitude", getLatitude()) ", latitude=" + latitude +
.append("iotNo", getIotNo()) ", iotNo='" + iotNo + '\'' +
.append("iconUrl", getIconUrl()) ", iconUrl='" + iconUrl + '\'' +
.append("linkman", getLinkman()) ", linkman='" + linkman + '\'' +
.append("phone", getPhone()) ", phone='" + phone + '\'' +
.append("installationTime", getInstallationTime()) ", installationTime=" + installationTime +
.append("inspectionTime", getInspectionTime()) ", inspectionTime=" + inspectionTime +
.append("remarks", getRemarks()) ", isDel='" + isDel + '\'' +
.toString(); ", remarks='" + remarks + '\'' +
", equipmentList=" + equipmentList +
'}';
} }
} }
package com.zehong.system.domain;
import org.springframework.security.core.parameters.P;
import java.util.Date;
/**
* 下级设备信息
*/
public class TDeviceInformation {
/**
* 设备名称
*/
private String deviceName;
/**
* 设备编号
*/
private String deviceCode;
/**
* 设备状态
*/
private Integer status;
/**
* 设备浓度
*/
private String potency;
/**
* 创建时间
* @return
*/
private Date createTime;
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getPotency() {
return potency;
}
public void setPotency(String potency) {
this.potency = potency;
}
@Override
public String toString() {
return "TDeviceInformation{" +
"deviceName='" + deviceName + '\'' +
", deviceCode='" + deviceCode + '\'' +
", status=" + status +
", potency='" + potency + '\'' +
", createTime=" + createTime +
'}';
}
}
...@@ -3,10 +3,14 @@ package com.zehong.system.mapper; ...@@ -3,10 +3,14 @@ package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.zehong.system.domain.EquipmentForm;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TDeviceInformation;
import org.apache.commons.math3.analysis.function.Add; import org.apache.commons.math3.analysis.function.Add;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import javax.validation.Valid;
/** /**
* 设备信息Mapper接口 * 设备信息Mapper接口
* *
...@@ -83,4 +87,30 @@ public interface TDeviceInfoMapper ...@@ -83,4 +87,30 @@ public interface TDeviceInfoMapper
List<Map<String,Object>> selectdevicefeed(@Param("orderId") String orderId, List<Map<String,Object>> selectdevicefeed(@Param("orderId") String orderId,
@Param("ids") List<Integer> ids, @Param("ids") List<Integer> ids,
@Param("ids2") List<Integer> ids2); @Param("ids2") List<Integer> ids2);
/**
* 添加下级设备
* @param equipmentList
*/
void insertTrelation(List<EquipmentForm> equipmentList);
/**
* 查询下级设备所有信息
* @return
*/
List<EquipmentForm> selectDevice(int relationDeviceId);
/**
* 删除下级设备信息
* @param equipmentList
*/
void deleteEquipmentList(@Param("list") List<EquipmentForm> equipmentList, @Param("devids") int devid);
/**
* 根据设备id查询最新的设备信息数据
* @param deviceId
* @return
*/
List<TDeviceInformation> getInformation(int deviceId);
} }
...@@ -4,7 +4,9 @@ import java.util.List; ...@@ -4,7 +4,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.zehong.system.domain.EquipmentForm;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TDeviceInformation;
import com.zehong.system.domain.vo.DeviceInfoVo; import com.zehong.system.domain.vo.DeviceInfoVo;
/** /**
...@@ -98,4 +100,29 @@ public interface ITDeviceInfoService ...@@ -98,4 +100,29 @@ public interface ITDeviceInfoService
* @return * @return
*/ */
public List<Map<String,Object>> devicefeed(Map<String, Object> param); public List<Map<String,Object>> devicefeed(Map<String, Object> param);
/**
* 查询下级设备所有信息
* @param relationDeviceId
* @return
*/
List<EquipmentForm> selectDevice(int relationDeviceId);
/**
* 新增下级设备信息
* @param equipmentList
*/
void insertEquipmentList(List<EquipmentForm> equipmentList,int devid);
/**
* 删除下级设备信息
* @param equipmentList
*/
void deleteEquipmentList(List<EquipmentForm> equipmentList,int devid);
/**
* 根据设备id查询最新的设备信息数据
* @param deviceId
*/
List<TDeviceInformation> getInformations(int deviceId);
} }
...@@ -3,7 +3,9 @@ package com.zehong.system.service.impl; ...@@ -3,7 +3,9 @@ package com.zehong.system.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.zehong.common.utils.PageInfoUtil; import com.zehong.common.utils.PageInfoUtil;
import com.zehong.system.domain.EquipmentForm;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TDeviceInformation;
import com.zehong.system.domain.TPipe; import com.zehong.system.domain.TPipe;
import com.zehong.system.domain.vo.DeviceInfoVo; import com.zehong.system.domain.vo.DeviceInfoVo;
import com.zehong.system.mapper.TDeviceInfoMapper; import com.zehong.system.mapper.TDeviceInfoMapper;
...@@ -13,10 +15,7 @@ import org.springframework.beans.BeanUtils; ...@@ -13,10 +15,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 设备信息Service业务层处理 * 设备信息Service业务层处理
...@@ -132,6 +131,53 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -132,6 +131,53 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
} }
return list; return list;
} }
/**
* 查询下级设备所有信息
* @param relationDeviceId
* @return
*/
@Override
public List<EquipmentForm> selectDevice(int relationDeviceId) {
return tDeviceInfoMapper.selectDevice(relationDeviceId);
}
/**
* 新增下级设备信息
* @param equipmentList
*/
@Override
public void insertEquipmentList(List<EquipmentForm> equipmentList,int devId) {
List<EquipmentForm> equipmentForms=new ArrayList<>();
for (int i=0;i<equipmentList.size();i++){
if (equipmentList.get(i).getRelationDeviceId()==null){
equipmentList.get(i).setRelationDeviceId(devId);
equipmentList.get(i).setCreateTime(new Date());
equipmentForms.add(equipmentList.get(i));
}
}
if (equipmentForms.size()!=0){
tDeviceInfoMapper.insertTrelation(equipmentForms);
}
}
/**
* 删除下级设备信息
* @param equipmentList
*/
@Override
public void deleteEquipmentList(List<EquipmentForm> equipmentList,int devid) {
ArrayList<EquipmentForm> equipmentLists=new ArrayList<EquipmentForm>();
for (int i=0;i<equipmentList.size();i++){
if (equipmentList.get(i).getRelationId()!=null){
equipmentLists.add(equipmentList.get(i));
}
}
tDeviceInfoMapper.deleteEquipmentList(equipmentLists,devid);
}
/** /**
* 构建前端所需要下拉树结构 * 构建前端所需要下拉树结构
* *
...@@ -271,7 +317,16 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -271,7 +317,16 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
@Override @Override
public int insertTDeviceInfo(TDeviceInfo tDeviceInfo) public int insertTDeviceInfo(TDeviceInfo tDeviceInfo)
{ {
return tDeviceInfoMapper.insertTDeviceInfo(tDeviceInfo); int deviceId = tDeviceInfoMapper.insertTDeviceInfo(tDeviceInfo);
for (int i=0;i<tDeviceInfo.getEquipmentList().size();i++){
tDeviceInfo.getEquipmentList().get(i).setCreateTime(new Date());
tDeviceInfo.getEquipmentList().get(i).setRelationDeviceId(tDeviceInfo.getDeviceId());
}
/*添加下级设备*/
tDeviceInfoMapper.insertTrelation(tDeviceInfo.getEquipmentList());
/**添加*/
System.out.println(tDeviceInfo.getDeviceId());
return deviceId;
} }
/** /**
...@@ -309,4 +364,14 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -309,4 +364,14 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
{ {
return tDeviceInfoMapper.deleteTDeviceInfoById(deviceId); return tDeviceInfoMapper.deleteTDeviceInfoById(deviceId);
} }
/**
* 根据设备id查询最新的设备信息数据
* @param deviceId
* @return
*/
@Override
public List<TDeviceInformation> getInformations(int deviceId) {
return tDeviceInfoMapper.getInformation(deviceId);
}
} }
...@@ -25,6 +25,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -25,6 +25,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks" />
</resultMap> </resultMap>
<resultMap type="EquipmentForm" id="EquipmentFormResult">
<result property="relationId" column="relation_id" />
<result property="relationDeviceId" column="relation_device_id" />
<result property="deviceNames" column="device_name" />
<result property="deviceCodes" column="device_code" />
<result property="createTime" column="create_time" />
<result property="status" column="status" />
<result property="potency" column="potency" />
</resultMap>
<resultMap type="TDeviceInformation" id="TDeviceInformationResult">
<result property="deviceName" column="device_name" />
<result property="deviceCode" column="device_code" />
<result property="createTime" column="create_time" />
<result property="status" column="status" />
<result property="potency" column="potency" />
</resultMap>
<sql id="selectTDeviceInfoVo"> <sql id="selectTDeviceInfoVo">
select device_id, enterprise_id, pipe_id, device_name, device_code, device_addr, device_model, device_type, longitude, latitude, iot_no, icon_url, linkman, phone, installation_time, inspection_time, is_del, remarks from t_device_info select device_id, enterprise_id, pipe_id, device_name, device_code, device_addr, device_model, device_type, longitude, latitude, iot_no, icon_url, linkman, phone, installation_time, inspection_time, is_del, remarks from t_device_info
</sql> </sql>
...@@ -168,4 +187,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -168,4 +187,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by p.pipe_id group by p.pipe_id
</if> </if>
</select> </select>
<!--添加下级设备-->
<insert id="insertTrelation" parameterType="java.util.List">
insert into t_relation_device_info (relation_device_id,device_name,device_code,create_time) values
<foreach collection="list" item="equipmentList" index="index" separator=",">
(
#{equipmentList.relationDeviceId},
#{equipmentList.deviceNames},
#{equipmentList.deviceCodes},
#{equipmentList.createTime})
</foreach>
</insert>
<!--查询下级设备所有信息-->
<select id="selectDevice" parameterType="int" resultMap="EquipmentFormResult" >
select relation_id,relation_device_id,device_name,device_code,create_time from t_relation_device_info where relation_device_id=#{relationDeviceId} and is_del='0'
</select>
<!--删除下级设备信息-->
<delete id="deleteEquipmentList" parameterType="java.util.List">
delete from t_relation_device_info where relation_device_id=#{devids}
<if test="list.size()!=0">
and relation_id not in
<foreach collection="list" item="list" index="index" separator=",">
( #{list.relationId} )
</foreach>
</if>
</delete>
<!--根据设备id查询最新的设备信息数据-->
<select id="getInformation" parameterType="int" resultMap="TDeviceInformationResult">
select * from(
select a.device_name,b.status,b.potency,b.create_time,b.device_code from t_relation_device_info a left join t_relation_device_data b on a.device_code=b.device_code
where a.relation_device_id=#{deviceId} order by b.create_time desc LIMIT 100000)b group by b.device_code
</select>
</mapper> </mapper>
...@@ -86,3 +86,18 @@ export function deviceNodeTree() { ...@@ -86,3 +86,18 @@ export function deviceNodeTree() {
}) })
} }
// 查询设备信息
export function getDevice(query) {
return request({
url: '/device/deviceInfo/selectDevice?id='+query,
method: 'get',
})
}
// 根据设备id查询最新的设备信息数据
export function getInformation(query) {
return request({
url: '/device/deviceInfo/getInformation?deviceId='+query,
method: 'get',
})
}
...@@ -72,6 +72,56 @@ ...@@ -72,6 +72,56 @@
</el-col> </el-col>
</el-row> </el-row>
<el-divider></el-divider> <el-divider></el-divider>
<el-row v-if="this.deviceType=='调压阀'||this.deviceType=='阀门井'" style="width: 100%;height: 45px;margin-top: -15px;">
<el-col :span="14" style="margin-bottom: -10px;">
<div style="color: #31EAEA;">
<ul><li>下级设备信息</li></ul>
</div>
</el-col>
</el-row>
<el-row v-if="this.deviceType=='调压阀'||this.deviceType=='阀门井'">
<el-col :span="36" style="padding: 20px;width: 100%;">
<div style="width: 100%;float: left;height: 100%;" v-if="form.deviceType != '管道'">
<el-table :data="deviceInfoList" style="width: 100%">
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编号" align="center" prop="deviceCode" />
<el-table-column label="浓度" align="center" prop="potency" />
<el-table-column label="设备状态" align="center" prop="deviceType" >
<template slot-scope="scope">
<span v-if="scope.row.status == 0">预热</span>
<span v-if="scope.row.status == 1">正常</span>
<span v-if="scope.row.status == 2">错误</span>
<span v-if="scope.row.status == 3">传感器故障</span>
<span v-if="scope.row.status == 4">报警</span>
<span v-if="scope.row.status == 5">低报</span>
<span v-if="scope.row.status == 6">高报</span>
<span v-if="scope.row.status == 7">通信故障</span>
<span v-if="scope.row.status == 8">通信故障</span>
<span v-if="scope.row.status == 9">离线</span>
<span v-if="scope.row.status == 10">电量低</span>
<span v-if="scope.row.status == 11">主电故障</span>
<span v-if="scope.row.status == 12">备电故障</span>
<span v-if="scope.row.status == 13">无此节点</span>
<span v-if="scope.row.status == 14">低电压</span>
<span v-if="scope.row.status == 15">故障</span>
<span v-if="scope.row.status == 16">报警联动</span>
<span v-if="scope.row.status == 17">低低报</span>
<span v-if="scope.row.status == 18">高高报</span>
<span v-if="scope.row.status == 19">水位淹没报警</span>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
</el-row>
<el-row style="width: 100%;height: 45px;margin-top: -15px;"> <el-row style="width: 100%;height: 45px;margin-top: -15px;">
<el-col :span="24" style="margin-bottom: -10px;"> <el-col :span="24" style="margin-bottom: -10px;">
<div style="color: #31EAEA;"> <div style="color: #31EAEA;">
...@@ -158,6 +208,7 @@ ...@@ -158,6 +208,7 @@
</el-col> </el-col>
</el-row> </el-row>
<template v-if="$route.query.deviceType!='管道' && form.deviceType != '管道'"> <template v-if="$route.query.deviceType!='管道' && form.deviceType != '管道'">
<el-row v-if="form.deviceType != '压力表'"> <el-row v-if="form.deviceType != '压力表'">
<el-col :span="12" style="padding: 10px;"> <el-col :span="12" style="padding: 10px;">
...@@ -252,7 +303,7 @@ ...@@ -252,7 +303,7 @@
<script> <script>
import { getDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm"; import { getDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm";
import { deviceTree } from "@/api/device/deviceInfo"; import { deviceTree,getInformation } from "@/api/device/deviceInfo";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo"; import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import gaodeMap from "utils/gaodeMap.js"; import gaodeMap from "utils/gaodeMap.js";
import { map, DEVICE_TYPE } from "utils/gaodeMap.js"; import { map, DEVICE_TYPE } from "utils/gaodeMap.js";
...@@ -269,7 +320,10 @@ export default { ...@@ -269,7 +320,10 @@ export default {
return { return {
dialogVisible: false, dialogVisible: false,
dataListdetail: [], dataListdetail: [],
// 设备信息表格数据
deviceInfoList: [],
alarmId:'', alarmId:'',
deviceType:'',
// 折线图标题 // 折线图标题
title: "", title: "",
open: false, open: false,
...@@ -687,6 +741,11 @@ export default { ...@@ -687,6 +741,11 @@ export default {
getDetail (){ getDetail (){
getDeviceAlarm(this.alarmId).then(response =>{ getDeviceAlarm(this.alarmId).then(response =>{
this.form = response.data; this.form = response.data;
this.deviceType=this.form.deviceType;
getInformation(this.form.deviceId).then(response =>{
this.deviceInfoList=response.data;
})
console.log("this.form", this.form); console.log("this.form", this.form);
if(this.form.pipeList != null){ if(this.form.pipeList != null){
......
...@@ -270,9 +270,66 @@ ...@@ -270,9 +270,66 @@
</el-col> </el-col>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button v-if="form.deviceType==1||form.deviceType==2" type="primary" @click="addDevice">添加设备</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog>
<!--新增设备列表-->
<el-dialog title="新增设备" :visible.sync="dialogFormVisible">
<el-table v-loading="loading" :data="equipmentList" @selection-change="handleSelectionChange">
<el-table-column label="设备名称" align="center" prop="deviceNames" />
<el-table-column label="设备编号" align="center" prop="deviceCodes" />
<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-delete"
@click="equipmentDelete(scope.$index)"
v-hasPermi="['device:deviceInfo:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="equipment = true">新增</el-button>
<el-button type="primary" @click="dialogFormVisible=false">确 定</el-button>
</div>
</el-dialog>
<!--新增设备添加-->
<el-dialog title="新增设备" :visible.sync="equipment">
<el-form ref="form" :model="equipmentForm" :rules="rules" label-width="135px">
<el-col :span="12">
<el-form-item label="设备名称" >
<el-input
v-model="equipmentForm.deviceNames"
placeholder="请输入设备名称"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编号" >
<el-input
v-model="equipmentForm.deviceCodes"
placeholder="请输入设备编号"
/>
</el-form-item>
</el-col>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitEquipment">确 定</el-button>
<el-button @click="equipment=false">取 消</el-button>
</div>
</el-dialog> </el-dialog>
<Mapdialog <Mapdialog
...@@ -287,7 +344,7 @@ ...@@ -287,7 +344,7 @@
</template> </template>
<script> <script>
import { listDeviceInfo, getDeviceInfo, addDeviceInfo, updateDeviceInfo, exportDeviceInfo } from "@/api/device/deviceInfo"; import { listDeviceInfo, getDeviceInfo, addDeviceInfo, updateDeviceInfo, exportDeviceInfo,getDevice } from "@/api/device/deviceInfo";
import { pipeAllInfoList } from "@/api/device/pipe"; import { pipeAllInfoList } from "@/api/device/pipe";
import MyFileUpload from '@/components/MyFileUpload'; import MyFileUpload from '@/components/MyFileUpload';
import Mapdialog from "@/components/mapDialog/checkDeviceLoaction.vue"; import Mapdialog from "@/components/mapDialog/checkDeviceLoaction.vue";
...@@ -300,6 +357,14 @@ ...@@ -300,6 +357,14 @@
}, },
data() { data() {
return { return {
dynamicValidateForm: {
domains: [{
value: ''
}],
email: ''
},
dialogFormVisible: false,
equipment:false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 导出遮罩层 // 导出遮罩层
...@@ -316,6 +381,8 @@ ...@@ -316,6 +381,8 @@
total: 0, total: 0,
// 设备信息表格数据 // 设备信息表格数据
deviceInfoList: [], deviceInfoList: [],
//下级绑定设备数据
equipmentList:[],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
...@@ -351,6 +418,7 @@ ...@@ -351,6 +418,7 @@
}, },
// 表单参数 // 表单参数
form: {}, form: {},
equipmentForm:{},
// 表单校验 // 表单校验
rules: { rules: {
pipeId: [ pipeId: [
...@@ -400,6 +468,28 @@ ...@@ -400,6 +468,28 @@
}); });
}, },
methods: { methods: {
/**添加设备*/
addDevice(){
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.deviceId != null) {
const id=this.form.deviceId
getDevice(id).then(response => {
this.equipmentList=response.data
});
console.log('有值')
} else {
console.log('没值')
}
}
});
this.dialogFormVisible=true;
},
/** 查询设备信息列表 */ /** 查询设备信息列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -453,7 +543,8 @@ ...@@ -453,7 +543,8 @@
phone: null, phone: null,
installationTime: null, installationTime: null,
inspectionTime: null, inspectionTime: null,
remarks: null remarks: null,
equipmentList:[],
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -500,18 +591,27 @@ ...@@ -500,18 +591,27 @@
this.title = "修改设备信息"; this.title = "修改设备信息";
}); });
}, },
/*提交*/
submitEquipment(){
this.equipmentList.push(this.equipmentForm)
this.equipmentForm={}
this.equipment = false;
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
this.form.equipmentList=this.equipmentList;
this.equipmentList=[];
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
console.log(this.form, "this.form"); this.form.equipmentList=this.equipmentList;
this.equipmentList=[];
addDeviceInfo(this.form).then(response => { addDeviceInfo(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
...@@ -521,6 +621,11 @@ ...@@ -521,6 +621,11 @@
} }
}); });
}, },
/**设备删除*/
equipmentDelete(row){
this.equipmentList.splice(row,1);
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
row.isDel = "1"; row.isDel = "1";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment