Compare commits

...

2 Commits

Author SHA1 Message Date
姜玉琦 71cb6a0036 提交代码 2025-06-15 11:26:54 +08:00
姜玉琦 d32f40f420 提交代码 2025-06-14 13:53:44 +08:00
69 changed files with 7686 additions and 128 deletions

View File

@ -0,0 +1,14 @@
package com.ruoyi.common.constant;
/**
*
*
* @author ruoyi
*/
public class ApiConstants {
/**
* IOTHOST&&
*/
public static final String IOT_SD_HOST = "https://api.e.v1.i-sada.net";
}

View File

@ -61,6 +61,14 @@ public class BaseController
PageUtils.startPage();
}
/**
*
*/
protected void startPage(Integer pageNum, Integer pageSize)
{
PageUtils.startPage(pageNum,pageSize);
}
/**
*
*/

View File

@ -170,6 +170,28 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return (str == null ? "" : str.trim());
}
/**
*
*
* @param obj1 1
* @param obj2 2
* @return value
*/
public static boolean eqObj(Object obj1, Object obj2)
{
if(obj1==null && obj2==null){
return true;
}else{
if(obj1==null){
return false;
}
if(obj2==null){
return false;
}
return obj1.toString().equals(obj2.toString());
}
}
/**
*
*

View File

@ -0,0 +1,266 @@
package com.ruoyi.quartz.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* dev_iot_config_point
*
* @author yanzhu
* @date 2025-04-04
*/
public class QuartzDevIotConfigPoint extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 配置主键 */
@Excel(name = "配置主键")
private Long cfgId;
/** 公司主键 */
@Excel(name = "公司主键")
private Long comId;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 厂家名称 */
@Excel(name = "厂家名称")
private String factoryName;
/** 联系人 */
@Excel(name = "联系人")
private String contactPerson;
/** 联系人电话 */
@Excel(name = "联系人电话")
private String contactPersonPhone;
/** 配电箱等级 */
@Excel(name = "配电箱等级")
private String levels;
/** 漏电电流 */
@Excel(name = "漏电电流")
private String leakageCurrent;
/** 额定温度 */
@Excel(name = "额定温度")
private String ratedTemperature;
/** 短路电流 */
@Excel(name = "短路电流")
private String shortCircuitCurrent;
/** 额定电流 */
@Excel(name = "额定电流")
private String ratedCurrent;
/** 额定电压 */
@Excel(name = "额定电压")
private String ratedVoltage;
/** 在线状态 */
@Excel(name = "在线状态")
private String onlineStatus;
/** 数据状态 */
@Excel(name = "数据状态")
private String isDel;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setComId(Long comId)
{
this.comId = comId;
}
public Long getComId()
{
return comId;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setDeviceSn(String deviceSn)
{
this.deviceSn = deviceSn;
}
public String getDeviceSn()
{
return deviceSn;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setFactoryName(String factoryName)
{
this.factoryName = factoryName;
}
public String getFactoryName()
{
return factoryName;
}
public void setContactPerson(String contactPerson)
{
this.contactPerson = contactPerson;
}
public String getContactPerson()
{
return contactPerson;
}
public void setContactPersonPhone(String contactPersonPhone)
{
this.contactPersonPhone = contactPersonPhone;
}
public String getContactPersonPhone()
{
return contactPersonPhone;
}
public void setLevels(String levels)
{
this.levels = levels;
}
public String getLevels()
{
return levels;
}
public void setLeakageCurrent(String leakageCurrent)
{
this.leakageCurrent = leakageCurrent;
}
public String getLeakageCurrent()
{
return leakageCurrent;
}
public void setRatedTemperature(String ratedTemperature)
{
this.ratedTemperature = ratedTemperature;
}
public String getRatedTemperature()
{
return ratedTemperature;
}
public void setShortCircuitCurrent(String shortCircuitCurrent)
{
this.shortCircuitCurrent = shortCircuitCurrent;
}
public String getShortCircuitCurrent()
{
return shortCircuitCurrent;
}
public void setRatedCurrent(String ratedCurrent)
{
this.ratedCurrent = ratedCurrent;
}
public String getRatedCurrent()
{
return ratedCurrent;
}
public void setRatedVoltage(String ratedVoltage)
{
this.ratedVoltage = ratedVoltage;
}
public String getRatedVoltage()
{
return ratedVoltage;
}
public void setOnlineStatus(String onlineStatus)
{
this.onlineStatus = onlineStatus;
}
public String getOnlineStatus()
{
return onlineStatus;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("deviceSn", getDeviceSn())
.append("deviceName", getDeviceName())
.append("factoryName", getFactoryName())
.append("contactPerson", getContactPerson())
.append("contactPersonPhone", getContactPersonPhone())
.append("levels", getLevels())
.append("leakageCurrent", getLeakageCurrent())
.append("ratedTemperature", getRatedTemperature())
.append("shortCircuitCurrent", getShortCircuitCurrent())
.append("ratedCurrent", getRatedCurrent())
.append("ratedVoltage", getRatedVoltage())
.append("onlineStatus", getOnlineStatus())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,486 @@
package com.ruoyi.quartz.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* dev_iot_datas
*
* @author yanzhu
* @date 2025-04-04
*/
public class QuartzDevIotDatas extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 配置主键 */
@Excel(name = "配置主键")
private Long cfgId;
/** 点位主键 */
@Excel(name = "点位主键")
private Long pointId;
/** 公司主键 */
@Excel(name = "公司主键")
private Long comId;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
/** 开关位_交流 */
@Excel(name = "开关位_交流")
private String switchesAc;
/** 开关位 */
@Excel(name = "开关位")
private String switchesSwitch;
/** 开关位状态 */
@Excel(name = "开关位状态")
private String switchesSwitches;
/** 开关位安装状态 */
@Excel(name = "开关位安装状态")
private String switchesSwitchstatus;
/** 温度检测数据 */
@Excel(name = "温度检测数据")
private String temperature;
/** 漏电检测数据 */
@Excel(name = "漏电检测数据")
private String leakage;
/** A相电压 */
@Excel(name = "A相电压")
private String voltageA;
/** B相电压 */
@Excel(name = "B相电压")
private String voltageB;
/** C相电压 */
@Excel(name = "C相电压")
private String voltageC;
/** A相与B相之间的电压 */
@Excel(name = "A相与B相之间的电压")
private String voltageAb;
/** B相与C相之间的电压 */
@Excel(name = "B相与C相之间的电压")
private String voltageBc;
/** C相与A相之间的电压 */
@Excel(name = "C相与A相之间的电压")
private String voltageCa;
/** A相电流 */
@Excel(name = "A相电流")
private String currentA;
/** B相电流 */
@Excel(name = "B相电流")
private String currentB;
/** C相电流 */
@Excel(name = "C相电流")
private String currentC;
/** A相功率 */
@Excel(name = "A相功率")
private String powerA;
/** B相功率 */
@Excel(name = "B相功率")
private String powerB;
/** C相功率 */
@Excel(name = "C相功率")
private String powerC;
/** A相累计能量 */
@Excel(name = "A相累计能量")
private String energyA;
/** B相累计能量 */
@Excel(name = "B相累计能量")
private String energyB;
/** C相累计能量 */
@Excel(name = "C相累计能量")
private String energyC;
/** A相功率因数 */
@Excel(name = "A相功率因数")
private String factorA;
/** B相功率因数 */
@Excel(name = "B相功率因数")
private String factorB;
/** C相功率因数 */
@Excel(name = "C相功率因数")
private String factorC;
/** A相频率 */
@Excel(name = "A相频率")
private String frequencyA;
/** B相频率 */
@Excel(name = "B相频率")
private String frequencyB;
/** C相频率 */
@Excel(name = "C相频率")
private String frequencyC;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setPointId(Long pointId)
{
this.pointId = pointId;
}
public Long getPointId()
{
return pointId;
}
public void setComId(Long comId)
{
this.comId = comId;
}
public Long getComId()
{
return comId;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setDeviceSn(String deviceSn)
{
this.deviceSn = deviceSn;
}
public String getDeviceSn()
{
return deviceSn;
}
public void setSwitchesAc(String switchesAc)
{
this.switchesAc = switchesAc;
}
public String getSwitchesAc()
{
return switchesAc;
}
public void setSwitchesSwitch(String switchesSwitch)
{
this.switchesSwitch = switchesSwitch;
}
public String getSwitchesSwitch()
{
return switchesSwitch;
}
public void setSwitchesSwitches(String switchesSwitches)
{
this.switchesSwitches = switchesSwitches;
}
public String getSwitchesSwitches()
{
return switchesSwitches;
}
public void setSwitchesSwitchstatus(String switchesSwitchstatus)
{
this.switchesSwitchstatus = switchesSwitchstatus;
}
public String getSwitchesSwitchstatus()
{
return switchesSwitchstatus;
}
public void setTemperature(String temperature)
{
this.temperature = temperature;
}
public String getTemperature()
{
return temperature;
}
public void setLeakage(String leakage)
{
this.leakage = leakage;
}
public String getLeakage()
{
return leakage;
}
public void setVoltageA(String voltageA)
{
this.voltageA = voltageA;
}
public String getVoltageA()
{
return voltageA;
}
public void setVoltageB(String voltageB)
{
this.voltageB = voltageB;
}
public String getVoltageB()
{
return voltageB;
}
public void setVoltageC(String voltageC)
{
this.voltageC = voltageC;
}
public String getVoltageC()
{
return voltageC;
}
public void setVoltageAb(String voltageAb)
{
this.voltageAb = voltageAb;
}
public String getVoltageAb()
{
return voltageAb;
}
public void setVoltageBc(String voltageBc)
{
this.voltageBc = voltageBc;
}
public String getVoltageBc()
{
return voltageBc;
}
public void setVoltageCa(String voltageCa)
{
this.voltageCa = voltageCa;
}
public String getVoltageCa()
{
return voltageCa;
}
public void setCurrentA(String currentA)
{
this.currentA = currentA;
}
public String getCurrentA()
{
return currentA;
}
public void setCurrentB(String currentB)
{
this.currentB = currentB;
}
public String getCurrentB()
{
return currentB;
}
public void setCurrentC(String currentC)
{
this.currentC = currentC;
}
public String getCurrentC()
{
return currentC;
}
public void setPowerA(String powerA)
{
this.powerA = powerA;
}
public String getPowerA()
{
return powerA;
}
public void setPowerB(String powerB)
{
this.powerB = powerB;
}
public String getPowerB()
{
return powerB;
}
public void setPowerC(String powerC)
{
this.powerC = powerC;
}
public String getPowerC()
{
return powerC;
}
public void setEnergyA(String energyA)
{
this.energyA = energyA;
}
public String getEnergyA()
{
return energyA;
}
public void setEnergyB(String energyB)
{
this.energyB = energyB;
}
public String getEnergyB()
{
return energyB;
}
public void setEnergyC(String energyC)
{
this.energyC = energyC;
}
public String getEnergyC()
{
return energyC;
}
public void setFactorA(String factorA)
{
this.factorA = factorA;
}
public String getFactorA()
{
return factorA;
}
public void setFactorB(String factorB)
{
this.factorB = factorB;
}
public String getFactorB()
{
return factorB;
}
public void setFactorC(String factorC)
{
this.factorC = factorC;
}
public String getFactorC()
{
return factorC;
}
public void setFrequencyA(String frequencyA)
{
this.frequencyA = frequencyA;
}
public String getFrequencyA()
{
return frequencyA;
}
public void setFrequencyB(String frequencyB)
{
this.frequencyB = frequencyB;
}
public String getFrequencyB()
{
return frequencyB;
}
public void setFrequencyC(String frequencyC)
{
this.frequencyC = frequencyC;
}
public String getFrequencyC()
{
return frequencyC;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("pointId", getPointId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("deviceSn", getDeviceSn())
.append("switchesAc", getSwitchesAc())
.append("switchesSwitch", getSwitchesSwitch())
.append("switchesSwitches", getSwitchesSwitches())
.append("switchesSwitchstatus", getSwitchesSwitchstatus())
.append("temperature", getTemperature())
.append("leakage", getLeakage())
.append("voltageA", getVoltageA())
.append("voltageB", getVoltageB())
.append("voltageC", getVoltageC())
.append("voltageAb", getVoltageAb())
.append("voltageBc", getVoltageBc())
.append("voltageCa", getVoltageCa())
.append("currentA", getCurrentA())
.append("currentB", getCurrentB())
.append("currentC", getCurrentC())
.append("powerA", getPowerA())
.append("powerB", getPowerB())
.append("powerC", getPowerC())
.append("energyA", getEnergyA())
.append("energyB", getEnergyB())
.append("energyC", getEnergyC())
.append("factorA", getFactorA())
.append("factorB", getFactorB())
.append("factorC", getFactorC())
.append("frequencyA", getFrequencyA())
.append("frequencyB", getFrequencyB())
.append("frequencyC", getFrequencyC())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,136 @@
package com.ruoyi.quartz.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* dev_iot_warning
*
* @author yanzhu
* @date 2025-04-04
*/
public class QuartzDevIotWarning extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 配置主键 */
@Excel(name = "配置主键")
private Long cfgId;
/** 点位主键 */
@Excel(name = "点位主键")
private Long pointId;
/** 公司主键 */
@Excel(name = "公司主键")
private Long comId;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
/** 预警类型 */
@Excel(name = "预警类型")
private String warningType;
/** 预警内容 */
@Excel(name = "预警内容")
private String warningContent;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setPointId(Long pointId)
{
this.pointId = pointId;
}
public Long getPointId()
{
return pointId;
}
public void setComId(Long comId)
{
this.comId = comId;
}
public Long getComId()
{
return comId;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setDeviceSn(String deviceSn)
{
this.deviceSn = deviceSn;
}
public String getDeviceSn()
{
return deviceSn;
}
public void setWarningType(String warningType)
{
this.warningType = warningType;
}
public String getWarningType()
{
return warningType;
}
public void setWarningContent(String warningContent)
{
this.warningContent = warningContent;
}
public String getWarningContent()
{
return warningContent;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("pointId", getPointId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("deviceSn", getDeviceSn())
.append("warningType", getWarningType())
.append("warningContent", getWarningContent())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,60 @@
package com.ruoyi.quartz.mapper;
import com.ruoyi.quartz.domain.QuartzDevIotConfigPoint;
import com.ruoyi.quartz.domain.QuartzDevIotDatas;
import com.ruoyi.quartz.domain.QuartzDevIotWarning;
import java.util.List;
import java.util.Map;
/**
*
*/
public interface QuartzDevIotMapper {
/**
*
*/
public List<Map<String,Object>> selectDevIotConfigList();
/**
*
*
* @param devIotConfigPoint
* @return
*/
public List<QuartzDevIotConfigPoint> selectDevIotConfigPointList(QuartzDevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int insertDevIotConfigPoint(QuartzDevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int updateDevIotConfigPoint(QuartzDevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotDatas
* @return
*/
public int insertDevIotDatas(QuartzDevIotDatas devIotDatas);
/**
*
*
* @param devIotWarning
* @return
*/
public int insertDevIotWarning(QuartzDevIotWarning devIotWarning);
}

View File

@ -0,0 +1,59 @@
package com.ruoyi.quartz.service;
import com.ruoyi.quartz.domain.QuartzDevIotConfigPoint;
import com.ruoyi.quartz.domain.QuartzDevIotDatas;
import com.ruoyi.quartz.domain.QuartzDevIotWarning;
import java.util.List;
import java.util.Map;
/**
*
*/
public interface IQuartzDevIotService {
/**
*
*/
public List<Map<String,Object>> selectDevIotConfigList();
/**
*
*
* @param devIotConfigPoint
* @return
*/
public List<QuartzDevIotConfigPoint> selectDevIotConfigPointList(QuartzDevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int insertDevIotConfigPoint(QuartzDevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int updateDevIotConfigPoint(QuartzDevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotDatas
* @return
*/
public int insertDevIotDatas(QuartzDevIotDatas devIotDatas);
/**
*
*
* @param devIotWarning
* @return
*/
public int insertDevIotWarning(QuartzDevIotWarning devIotWarning);
}

View File

@ -0,0 +1,95 @@
package com.ruoyi.quartz.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.quartz.domain.QuartzDevIotConfigPoint;
import com.ruoyi.quartz.domain.QuartzDevIotDatas;
import com.ruoyi.quartz.domain.QuartzDevIotWarning;
import com.ruoyi.quartz.mapper.QuartzDevIotMapper;
import com.ruoyi.quartz.service.IQuartzDevIotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
*
*/
@Service
public class QuartzDevIotServiceImpl implements IQuartzDevIotService {
@Autowired
private QuartzDevIotMapper devIotMapper;
/**
*
*/
@Override
public List<Map<String, Object>> selectDevIotConfigList() {
return devIotMapper.selectDevIotConfigList();
}
/**
*
*
* @param devIotConfigPoint
* @return
*/
@Override
public List<QuartzDevIotConfigPoint> selectDevIotConfigPointList(QuartzDevIotConfigPoint devIotConfigPoint){
return devIotMapper.selectDevIotConfigPointList(devIotConfigPoint);
}
/**
*
*
* @param devIotConfigPoint
* @return
*/
@Override
public int insertDevIotConfigPoint(QuartzDevIotConfigPoint devIotConfigPoint)
{
devIotConfigPoint.setCreateTime(DateUtils.getNowDate());
return devIotMapper.insertDevIotConfigPoint(devIotConfigPoint);
}
/**
*
*
* @param devIotConfigPoint
* @return
*/
@Override
public int updateDevIotConfigPoint(QuartzDevIotConfigPoint devIotConfigPoint)
{
devIotConfigPoint.setUpdateTime(DateUtils.getNowDate());
return devIotMapper.updateDevIotConfigPoint(devIotConfigPoint);
}
/**
*
*
* @param devIotDatas
* @return
*/
@Override
public int insertDevIotDatas(QuartzDevIotDatas devIotDatas)
{
devIotDatas.setCreateTime(DateUtils.getNowDate());
return devIotMapper.insertDevIotDatas(devIotDatas);
}
/**
*
*
* @param devIotWarning
* @return
*/
@Override
public int insertDevIotWarning(QuartzDevIotWarning devIotWarning)
{
devIotWarning.setCreateTime(DateUtils.getNowDate());
return devIotMapper.insertDevIotWarning(devIotWarning);
}
}

View File

@ -43,15 +43,15 @@ public class RyTask
*/
public void expiredTowerData()
{
Calendar cal = Calendar.getInstance();
Date date = new Date();
cal.setTime(date);
cal.add(Calendar.DATE,-15);
String dateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,cal.getTime());
Long maxId = taskService.findTowerMaxIdByDate(dateStr);
if(maxId!=null){
taskService.deleteDevTowerDataRunByMaxId(maxId);
}
// Calendar cal = Calendar.getInstance();
// Date date = new Date();
// cal.setTime(date);
// cal.add(Calendar.DATE,-15);
// String dateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,cal.getTime());
// Long maxId = taskService.findTowerMaxIdByDate(dateStr);
// if(maxId!=null){
taskService.deleteDevTowerDataRunByMaxId(0L);
// }
}
/**

View File

@ -0,0 +1,265 @@
package com.ruoyi.quartz.task;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.constant.ApiConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.quartz.domain.QuartzDevIotConfigPoint;
import com.ruoyi.quartz.domain.QuartzDevIotDatas;
import com.ruoyi.quartz.domain.QuartzDevIotWarning;
import com.ruoyi.quartz.service.IQuartzDevIotService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description:
* @Title: SadaHzDataTask
* @Package com.yanzhu.job.task
* @Author: JiangYuQi
* @CreateTime: 2024/10/26 17:05
*/
@Component("sadaHzDataTask")
public class SadaHzDataTask {
@Autowired
private IQuartzDevIotService devIotService;
private static final Logger log = LoggerFactory.getLogger(SadaHzDataTask.class);
/**
*
*/
public void getIotConfigPoint() {
List<Map<String,Object>> configs = devIotService.selectDevIotConfigList();
if(configs.size()>0){
for(Map<String,Object> configMap:configs){
// 判断是萨达设备
if(StringUtils.eqObj(configMap.get("factory_name"),"SD")){
String signalName = Convert.toStr(configMap.get("signal_name"));
String signalCode = Convert.toStr(configMap.get("signal_code"));
String projectName = Convert.toStr(configMap.get("project_name"));
String projectHashId = getSaDaProjectHashIds(signalName,signalCode,projectName);
if(StringUtils.isNotEmpty(projectHashId)){
// 根据项目主键,查询设备信息
findSaDaBoxByProjectHashId(configMap,projectHashId);
}
}
}
}
}
/**
* /
*/
public void getIotPowerDatas() {
QuartzDevIotConfigPoint pointQuery = new QuartzDevIotConfigPoint();
pointQuery.setIsDel("0");
List<QuartzDevIotConfigPoint> configPoints = devIotService.selectDevIotConfigPointList(pointQuery);
if(configPoints.size()>0){
for(QuartzDevIotConfigPoint configPoint:configPoints){
// 判断是萨达设备
if(StringUtils.eqObj(configPoint.getFactoryName(),"SD")){
if(StringUtils.isNotEmpty(configPoint.getDeviceSn())){
String resStr = HttpUtils.sendGet(ApiConstants.IOT_SD_HOST + "/metric/box/"+configPoint.getDeviceSn());
JSONObject result = JSONObject.parseObject(resStr).getJSONObject("result");
// 开关检测数据
JSONObject switches = result.getJSONObject("switches");
// 电能检测数据
JSONObject metric = result.getJSONObject("metric");
// 温度检测数据
JSONArray temperatures = result.getJSONArray("temperatures");
// 漏电检测数据
JSONArray leakages = result.getJSONArray("leakages");
// 智能报警数据
JSONObject ticketStatus = result.getJSONObject("ticketStatus");
QuartzDevIotDatas devIotDatas = new QuartzDevIotDatas();
devIotDatas.setCfgId(configPoint.getCfgId());
devIotDatas.setPointId(configPoint.getId());
devIotDatas.setComId(configPoint.getComId());
devIotDatas.setProjectId(configPoint.getProjectId());
devIotDatas.setDeviceSn(configPoint.getDeviceSn());
try {
devIotDatas.setSwitchesAc(switches.getString("ac"));
devIotDatas.setSwitchesSwitch(switches.getString("switch"));
devIotDatas.setSwitchesSwitches(switches.getString("switches"));
devIotDatas.setSwitchesSwitchstatus(switches.getString("switchStatus"));
devIotDatas.setTemperature(temperatures.getJSONObject(0).getString("temperature"));
double leakageValue = 0.00;
for (int i = 0; i < leakages.size(); i++) {
JSONObject leakage = leakages.getJSONObject(i);
if(Convert.toDouble(leakage.get("leakage"),0.00)>leakageValue){
leakageValue = leakage.getDoubleValue("leakage");
}
}
devIotDatas.setLeakage(Convert.toStr(leakageValue));
devIotDatas.setVoltageA(metric.getString("voltage_a"));
devIotDatas.setVoltageB(metric.getString("voltage_b"));
devIotDatas.setVoltageC(metric.getString("voltage_c"));
devIotDatas.setVoltageAb(metric.getString("voltage_ab"));
devIotDatas.setVoltageBc(metric.getString("voltage_bc"));
devIotDatas.setVoltageCa(metric.getString("voltage_ca"));
devIotDatas.setCurrentA(metric.getString("current_a"));
devIotDatas.setCurrentB(metric.getString("current_b"));
devIotDatas.setCurrentC(metric.getString("current_c"));
devIotDatas.setPowerA(metric.getString("power_a"));
devIotDatas.setPowerB(metric.getString("power_b"));
devIotDatas.setPowerC(metric.getString("power_c"));
devIotDatas.setEnergyA(metric.getString("energy_a"));
devIotDatas.setEnergyB(metric.getString("energy_b"));
devIotDatas.setEnergyC(metric.getString("energy_c"));
devIotDatas.setFactorA(metric.getString("factor_a"));
devIotDatas.setFactorB(metric.getString("factor_b"));
devIotDatas.setFactorC(metric.getString("factor_c"));
devIotDatas.setFrequencyA(metric.getString("frequency_a"));
devIotDatas.setFrequencyB(metric.getString("frequency_b"));
devIotDatas.setFrequencyC(metric.getString("frequency_c"));
devIotService.insertDevIotDatas(devIotDatas);
// 智能预警数据
QuartzDevIotWarning devIotWarning = new QuartzDevIotWarning();
devIotWarning.setCfgId(configPoint.getCfgId());
devIotWarning.setPointId(configPoint.getId());
devIotWarning.setComId(configPoint.getComId());
devIotWarning.setProjectId(configPoint.getProjectId());
devIotWarning.setDeviceSn(devIotDatas.getDeviceSn());
if(ticketStatus.getInteger("is_blackout")>0){
devIotWarning.setWarningType("断电预警");
devIotWarning.setWarningContent("设备触发断电,请排查异常情况");
devIotService.insertDevIotWarning(devIotWarning);
}
if(ticketStatus.getInteger("is_smoke")>0){
devIotWarning.setWarningType("烟感报警");
devIotWarning.setWarningContent("设备烟感报警,请排查异常情况");
devIotService.insertDevIotWarning(devIotWarning);
}
if(ticketStatus.getInteger("is_overload")>0){
devIotWarning.setWarningType("过载报警");
devIotWarning.setWarningContent("设备过载报警,请排查异常情况");
devIotService.insertDevIotWarning(devIotWarning);
}
if(ticketStatus.getInteger("is_disconnect")>0){
devIotWarning.setWarningType("断开报警");
devIotWarning.setWarningContent("设备断开报警,请排查异常情况");
devIotService.insertDevIotWarning(devIotWarning);
}
if(ticketStatus.getInteger("is_overheat")>0){
devIotWarning.setWarningType("高温报警");
devIotWarning.setWarningContent("设备高温报警,请排查异常情况");
devIotService.insertDevIotWarning(devIotWarning);
}
if(ticketStatus.getInteger("is_leakage")>0){
devIotWarning.setWarningType("漏电报警");
devIotWarning.setWarningContent("设备漏电报警,请排查异常情况");
devIotService.insertDevIotWarning(devIotWarning);
}
}catch (Exception e){
e.printStackTrace();
}
}
}
}
}
}
/**
* HashIds
* @param signalName
* @param signalCode
* @param proName
* @return
*/
private static String getSaDaProjectHashIds(String signalName, String signalCode, String proName){
try {
Map<String, Object> params = new HashMap<>();
params.put("username",signalName);
params.put("password",signalCode);
String resStr = HttpUtils.sendPost(ApiConstants.IOT_SD_HOST+"/v2/api-token-auth", JSON.toJSONString(params));
JSONObject result = JSONObject.parseObject(resStr).getJSONObject("result");
JSONObject accountJson = result.getJSONObject("account");
if(StringUtils.isNotEmpty(accountJson.getString("canViewProjects"))){
JSONArray canProjects = accountJson.getJSONArray("canViewProjects");
if(canProjects.size()>0){
// 使用 forEach 和 Lambda 遍历
for(Object item:canProjects){
JSONObject obj = (JSONObject) item;
if(StringUtils.eqObj(obj.getString("name"),proName)){
return obj.getString("hashId");
}
}
return accountJson.getJSONObject("currentProject").getString("hashId");
}else{
return accountJson.getJSONObject("currentProject").getString("hashId");
}
}else{
return accountJson.getJSONObject("currentProject").getString("hashId");
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
/**
*
* @param configMap
* @param proHashId
*/
private void findSaDaBoxByProjectHashId(Map<String,Object> configMap, String proHashId){
try {
Long cfgId = Convert.toLong(configMap.get("id"));
String resStr = HttpUtils.sendGet(ApiConstants.IOT_SD_HOST+"/box/project/"+proHashId);
JSONArray result = JSONObject.parseObject(resStr).getJSONArray("result");
if(result.size()>0){
QuartzDevIotConfigPoint pointQuery = new QuartzDevIotConfigPoint();
pointQuery.setCfgId(cfgId);
List<QuartzDevIotConfigPoint> pointList = devIotService.selectDevIotConfigPointList(pointQuery);
result.forEach(item -> {
JSONObject obj = (JSONObject) item;
List<QuartzDevIotConfigPoint> pointItems = pointList.stream().filter(point -> StringUtils.eqObj(point.getDeviceSn(),obj.getString("hashId"))).collect(Collectors.toList());
if(pointItems.size()>0){
QuartzDevIotConfigPoint devIotConfigPoint = pointItems.get(0);
devIotConfigPoint.setDeviceName(obj.getString("name"));
devIotConfigPoint.setFactoryName(Convert.toStr(configMap.get("factory_name")));
devIotConfigPoint.setLevels(obj.getString("level"));
devIotConfigPoint.setLeakageCurrent(obj.getString("leakageCurrent"));
devIotConfigPoint.setRatedTemperature(obj.getString("ratedTemperature"));
devIotConfigPoint.setShortCircuitCurrent(obj.getString("shortCircuitCurrent"));
devIotConfigPoint.setRatedCurrent(obj.getString("ratedCurrent"));
devIotConfigPoint.setRatedVoltage(obj.getString("ratedVoltage"));
devIotConfigPoint.setOnlineStatus(obj.getJSONObject("device").getString("onlineStatus"));
devIotService.updateDevIotConfigPoint(devIotConfigPoint);
}else{
QuartzDevIotConfigPoint devIotConfigPoint = new QuartzDevIotConfigPoint();
devIotConfigPoint.setCfgId(cfgId);
devIotConfigPoint.setComId(Convert.toLong(configMap.get("com_id")));
devIotConfigPoint.setProjectId(Convert.toLong(configMap.get("project_id")));
devIotConfigPoint.setDeviceSn(obj.getString("hashId"));
devIotConfigPoint.setDeviceName(obj.getString("name"));
devIotConfigPoint.setFactoryName(Convert.toStr(configMap.get("factory_name")));
devIotConfigPoint.setLevels(obj.getString("level"));
devIotConfigPoint.setLeakageCurrent(obj.getString("leakageCurrent"));
devIotConfigPoint.setRatedTemperature(obj.getString("ratedTemperature"));
devIotConfigPoint.setShortCircuitCurrent(obj.getString("shortCircuitCurrent"));
devIotConfigPoint.setRatedCurrent(obj.getString("ratedCurrent"));
devIotConfigPoint.setRatedVoltage(obj.getString("ratedVoltage"));
devIotConfigPoint.setOnlineStatus(obj.getJSONObject("device").getString("onlineStatus"));
devIotService.insertDevIotConfigPoint(devIotConfigPoint);
}
});
}
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,229 @@
<?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.quartz.mapper.QuartzDevIotMapper">
<resultMap type="QuartzDevIotConfigPoint" id="DevIotConfigPointResult">
<result property="id" column="id" />
<result property="cfgId" column="cfg_id" />
<result property="comId" column="com_id" />
<result property="projectId" column="project_id" />
<result property="deviceSn" column="device_sn" />
<result property="deviceName" column="device_name" />
<result property="factoryName" column="factory_name" />
<result property="contactPerson" column="contact_person" />
<result property="contactPersonPhone" column="contact_person_phone" />
<result property="levels" column="levels" />
<result property="leakageCurrent" column="leakage_current" />
<result property="ratedTemperature" column="rated_temperature" />
<result property="shortCircuitCurrent" column="short_circuit_current" />
<result property="ratedCurrent" column="rated_current" />
<result property="ratedVoltage" column="rated_voltage" />
<result property="onlineStatus" column="online_status" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectDevIotConfigPointVo">
select id, cfg_id, com_id, project_id, device_sn, device_name, factory_name, contact_person, contact_person_phone, levels, leakage_current, rated_temperature, short_circuit_current, rated_current, rated_voltage, online_status, is_del, create_by, create_time, update_by, update_time, remark from dev_iot_config_point
</sql>
<select id="selectDevIotConfigPointList" parameterType="QuartzDevIotConfigPoint" resultMap="DevIotConfigPointResult">
<include refid="selectDevIotConfigPointVo"/>
<where>
<if test="cfgId != null "> and cfg_id = #{cfgId}</if>
<if test="comId != null "> and com_id = #{comId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<insert id="insertDevIotConfigPoint" parameterType="QuartzDevIotConfigPoint" useGeneratedKeys="true" keyProperty="id">
insert into dev_iot_config_point
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cfgId != null">cfg_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="deviceSn != null">device_sn,</if>
<if test="deviceName != null">device_name,</if>
<if test="factoryName != null">factory_name,</if>
<if test="contactPerson != null">contact_person,</if>
<if test="contactPersonPhone != null">contact_person_phone,</if>
<if test="levels != null">levels,</if>
<if test="leakageCurrent != null">leakage_current,</if>
<if test="ratedTemperature != null">rated_temperature,</if>
<if test="shortCircuitCurrent != null">short_circuit_current,</if>
<if test="ratedCurrent != null">rated_current,</if>
<if test="ratedVoltage != null">rated_voltage,</if>
<if test="onlineStatus != null">online_status,</if>
<if test="isDel != null">is_del,</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>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cfgId != null">#{cfgId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="deviceSn != null">#{deviceSn},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="factoryName != null">#{factoryName},</if>
<if test="contactPerson != null">#{contactPerson},</if>
<if test="contactPersonPhone != null">#{contactPersonPhone},</if>
<if test="levels != null">#{levels},</if>
<if test="leakageCurrent != null">#{leakageCurrent},</if>
<if test="ratedTemperature != null">#{ratedTemperature},</if>
<if test="shortCircuitCurrent != null">#{shortCircuitCurrent},</if>
<if test="ratedCurrent != null">#{ratedCurrent},</if>
<if test="ratedVoltage != null">#{ratedVoltage},</if>
<if test="onlineStatus != null">#{onlineStatus},</if>
<if test="isDel != null">#{isDel},</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>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateDevIotConfigPoint" parameterType="QuartzDevIotConfigPoint">
update dev_iot_config_point
<trim prefix="SET" suffixOverrides=",">
<if test="cfgId != null">cfg_id = #{cfgId},</if>
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="deviceSn != null">device_sn = #{deviceSn},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="factoryName != null">factory_name = #{factoryName},</if>
<if test="contactPerson != null">contact_person = #{contactPerson},</if>
<if test="contactPersonPhone != null">contact_person_phone = #{contactPersonPhone},</if>
<if test="levels != null">levels = #{levels},</if>
<if test="leakageCurrent != null">leakage_current = #{leakageCurrent},</if>
<if test="ratedTemperature != null">rated_temperature = #{ratedTemperature},</if>
<if test="shortCircuitCurrent != null">short_circuit_current = #{shortCircuitCurrent},</if>
<if test="ratedCurrent != null">rated_current = #{ratedCurrent},</if>
<if test="ratedVoltage != null">rated_voltage = #{ratedVoltage},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
<if test="isDel != null">is_del = #{isDel},</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>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<select id="selectDevIotConfigList" resultType="Map">
select dic.id, dic.com_id, dic.project_id, pi.projectName as project_name, dic.signal_name, dic.signal_code, dic.factory_name
from dev_iot_config dic
left join sur_project pi on pi.id = dic.project_id
where dic.is_del = '0'
</select>
<insert id="insertDevIotDatas" parameterType="QuartzDevIotDatas" useGeneratedKeys="true" keyProperty="id">
insert into dev_iot_datas
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cfgId != null">cfg_id,</if>
<if test="pointId != null">point_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="deviceSn != null">device_sn,</if>
<if test="switchesAc != null">switches_ac,</if>
<if test="switchesSwitch != null">switches_switch,</if>
<if test="switchesSwitches != null">switches_switches,</if>
<if test="switchesSwitchstatus != null">switches_switchStatus,</if>
<if test="temperature != null">temperature,</if>
<if test="leakage != null">leakage,</if>
<if test="voltageA != null">voltage_a,</if>
<if test="voltageB != null">voltage_b,</if>
<if test="voltageC != null">voltage_c,</if>
<if test="voltageAb != null">voltage_ab,</if>
<if test="voltageBc != null">voltage_bc,</if>
<if test="voltageCa != null">voltage_ca,</if>
<if test="currentA != null">current_a,</if>
<if test="currentB != null">current_b,</if>
<if test="currentC != null">current_c,</if>
<if test="powerA != null">power_a,</if>
<if test="powerB != null">power_b,</if>
<if test="powerC != null">power_c,</if>
<if test="energyA != null">energy_a,</if>
<if test="energyB != null">energy_b,</if>
<if test="energyC != null">energy_c,</if>
<if test="factorA != null">factor_a,</if>
<if test="factorB != null">factor_b,</if>
<if test="factorC != null">factor_c,</if>
<if test="frequencyA != null">frequency_a,</if>
<if test="frequencyB != null">frequency_b,</if>
<if test="frequencyC != null">frequency_c,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cfgId != null">#{cfgId},</if>
<if test="pointId != null">#{pointId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="deviceSn != null">#{deviceSn},</if>
<if test="switchesAc != null">#{switchesAc},</if>
<if test="switchesSwitch != null">#{switchesSwitch},</if>
<if test="switchesSwitches != null">#{switchesSwitches},</if>
<if test="switchesSwitchstatus != null">#{switchesSwitchstatus},</if>
<if test="temperature != null">#{temperature},</if>
<if test="leakage != null">#{leakage},</if>
<if test="voltageA != null">#{voltageA},</if>
<if test="voltageB != null">#{voltageB},</if>
<if test="voltageC != null">#{voltageC},</if>
<if test="voltageAb != null">#{voltageAb},</if>
<if test="voltageBc != null">#{voltageBc},</if>
<if test="voltageCa != null">#{voltageCa},</if>
<if test="currentA != null">#{currentA},</if>
<if test="currentB != null">#{currentB},</if>
<if test="currentC != null">#{currentC},</if>
<if test="powerA != null">#{powerA},</if>
<if test="powerB != null">#{powerB},</if>
<if test="powerC != null">#{powerC},</if>
<if test="energyA != null">#{energyA},</if>
<if test="energyB != null">#{energyB},</if>
<if test="energyC != null">#{energyC},</if>
<if test="factorA != null">#{factorA},</if>
<if test="factorB != null">#{factorB},</if>
<if test="factorC != null">#{factorC},</if>
<if test="frequencyA != null">#{frequencyA},</if>
<if test="frequencyB != null">#{frequencyB},</if>
<if test="frequencyC != null">#{frequencyC},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<insert id="insertDevIotWarning" parameterType="QuartzDevIotWarning" useGeneratedKeys="true" keyProperty="id">
insert into dev_iot_warning
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cfgId != null">cfg_id,</if>
<if test="pointId != null">point_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="deviceSn != null">device_sn,</if>
<if test="warningType != null">warning_type,</if>
<if test="warningContent != null">warning_content,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cfgId != null">#{cfgId},</if>
<if test="pointId != null">#{pointId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="deviceSn != null">#{deviceSn},</if>
<if test="warningType != null">#{warningType},</if>
<if test="warningContent != null">#{warningContent},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
</mapper>

View File

@ -150,7 +150,7 @@
</select>
<delete id="deleteDevTowerDataRunByMaxId" parameterType="Long">
delete from dev_tower_data_run where id <![CDATA[ < ]]> #{id} and
delete from dev_tower_data_run where create_time <![CDATA[ < ]]> CURDATE() - INTERVAL 15 DAY;
</delete>
<select id="findAllTowerMaxId" resultType="Map">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 441 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询配电箱配置列表
export function listIotConfig(query) {
return request({
url: '/device/iotConfig/list',
method: 'get',
params: query
})
}
// 查询配电箱配置详细
export function getIotConfig(id) {
return request({
url: '/device/iotConfig/' + id,
method: 'get'
})
}
// 配电箱配的点位信息
export function findIotConfigPoint(id) {
return request({
url: '/device/iotConfig/findIotConfigPoint/' + id,
method: 'get'
})
}
// 新增配电箱配置
export function addIotConfig(data) {
return request({
url: '/device/iotConfig',
method: 'post',
data: data
})
}
// 修改配电箱配置
export function updateIotConfig(data) {
return request({
url: '/device/iotConfig',
method: 'put',
data: data
})
}
// 删除配电箱配置
export function delIotConfig(id) {
return request({
url: '/device/iotConfig/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询配电箱配置列表
export function listIotConfigPoint(query) {
return request({
url: '/device/iotConfigPoint/list',
method: 'get',
params: query
})
}
// 查询配电箱配置详细
export function getIotConfigPoint(id) {
return request({
url: '/device/iotConfigPoint/' + id,
method: 'get'
})
}
// 新增配电箱配置
export function addIotConfigPoint(data) {
return request({
url: '/device/iotConfigPoint',
method: 'post',
data: data
})
}
// 修改配电箱配置
export function updateIotConfigPoint(data) {
return request({
url: '/device/iotConfigPoint',
method: 'put',
data: data
})
}
// 删除配电箱配置
export function delIotConfigPoint(id) {
return request({
url: '/device/iotConfigPoint/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询配电箱数据列表
export function listIotDatas(query) {
return request({
url: '/device/iotDatas/list',
method: 'get',
params: query
})
}
// 查询配电箱数据详细
export function getIotDatas(id) {
return request({
url: '/device/iotDatas/' + id,
method: 'get'
})
}
// 新增配电箱数据
export function addIotDatas(data) {
return request({
url: '/device/iotDatas',
method: 'post',
data: data
})
}
// 修改配电箱数据
export function updateIotDatas(data) {
return request({
url: '/device/iotDatas',
method: 'put',
data: data
})
}
// 删除配电箱数据
export function delIotDatas(id) {
return request({
url: '/device/iotDatas/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询配电箱预警列表
export function listIotWarning(query) {
return request({
url: '/device/iotWarning/list',
method: 'get',
params: query
})
}
// 查询配电箱预警详细
export function getIotWarning(id) {
return request({
url: '/device/iotWarning/' + id,
method: 'get'
})
}
// 新增配电箱预警
export function addIotWarning(data) {
return request({
url: '/device/iotWarning',
method: 'post',
data: data
})
}
// 修改配电箱预警
export function updateIotWarning(data) {
return request({
url: '/device/iotWarning',
method: 'put',
data: data
})
}
// 删除配电箱预警
export function delIotWarning(id) {
return request({
url: '/device/iotWarning/' + id,
method: 'delete'
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 441 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 460 KiB

View File

@ -1,5 +1,6 @@
import hasRole from './permission/hasRole'
import hasPermi from './permission/hasPermi'
import notHasPermi from './permission/notHasPermi'
import dialogDrag from './dialog/drag'
import dialogDragWidth from './dialog/dragWidth'
import dialogDragHeight from './dialog/dragHeight'
@ -9,6 +10,7 @@ import Move from './move'
const install = function(Vue) {
Vue.directive('hasRole', hasRole)
Vue.directive('hasPermi', hasPermi)
Vue.directive('notHasPermi', notHasPermi)
Vue.directive('clipboard', clipboard)
Vue.directive('dialogDrag', dialogDrag)
Vue.directive('dialogDragWidth', dialogDragWidth)
@ -19,7 +21,8 @@ const install = function(Vue) {
if (window.Vue) {
window['hasRole'] = hasRole
window['hasPermi'] = hasPermi
window['hasPermi'] = hasPermi
window['notHasPermi'] = hasPermi
Vue.use(install); // eslint-disable-line
}

View File

@ -0,0 +1,28 @@
/**
* v-hasPermi 操作权限处理
* Copyright (c) 2019 ruoyi
*/
import useUserStore from '@/store/modules/user'
export default {
mounted(el, binding, vnode) {
const { value } = binding
const all_permission = "*:*:*";
const permissions = useUserStore().permissions
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value
const hasPermissions = permissions.some(permission => {
return !(all_permission === permission || permissionFlag.includes(permission))
})
if (!hasPermissions) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(`请设置操作权限标签值`)
}
}
}

View File

@ -86,7 +86,6 @@ export default {
},
methods: {
goBigScreen(){
//window.open("//szgc.jhncidg.com:808/jhbs/")
window.open("/jhbs/")
},
toggleSideBar() {

View File

@ -2,16 +2,12 @@
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img src="@/assets/logo/logo_min.png" class="sidebar-logo" style="width: 80%;margin-top: 10px;"/>
<!--
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
-->
<img src="@/assets/logo/logo_min.png" class="sidebar-logo" style="width: 80%;margin-top: 6px;"/>
<!-- <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1> -->
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img src="@/assets/logo/logo.png" class="sidebar-logo" style="width: 80%;margin-top: 10px;"/>
<!--
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
-->
<img src="@/assets/logo/logo.png" class="sidebar-logo" style="width: 80%;margin-top: 6px;"/>
<!-- <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1> -->
</router-link>
</transition>
</div>

View File

@ -0,0 +1,456 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryRef"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备厂商" prop="factoryName">
<el-select
v-model="queryParams.factoryName"
placeholder="请选择设备厂商"
clearable
>
<el-option
v-for="dict in dict.type.iot_factory_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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="['manage:iotConfig: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="['manage:towerDataWarning: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="['manage:iotConfig: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="['manage:iotConfig:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-refresh"
size="mini"
:disabled="single"
@click="handleRefreshPoint"
v-hasPermi="['manage:iotConfig:edit']"
>刷新设备</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-alert title="配置说明" type="success">
<template slot="default">
<div>1新增的配置自动刷新设备</div>
<div>2修改配置后手动刷新设备或等待设备心跳后更新点位</div>
<div>3初始化失败的配置常见原因为通信账号通信密码不匹配</div>
</template>
</el-alert>
<el-table
v-loading="loading"
:data="iotConfigList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="总包单位" align="center" prop="comName" />
<el-table-column label="通信账号" align="center" prop="signalName" />
<el-table-column label="通信密码" align="center" prop="signalCode" />
<el-table-column label="设备厂商" align="center" prop="factoryName" width="120">
<template slot-scope="scope">
<dict-tag
:options="dict.type.iot_factory_type"
:value="scope.row.factoryName"
/>
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="120"
v-hasPermi="['manage:iotConfig:edit']"
>
<template slot-scope="scope">
<el-tooltip
v-if="scope.row.isDel != '99'"
:content="scope.row.isDel == '0' ? '启用' : '停用'"
placement="top"
>
<el-switch
active-value="0"
inactive-value="1"
v-model="scope.row.isDel"
@change="setStatus($event, scope.row)"
/>
</el-tooltip>
<el-button v-else type="danger" link disabled>初始化失败</el-button>
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="120"
v-notHasPermi="['manage:iotConfig:edit']"
>
<template slot-scope="scope">
<dict-tag
v-if="scope.row.isDel != '99'"
:options="dict.type.sys_normal_disable"
:value="scope.row.isDel"
/>
<el-button v-else type="danger" link disabled>初始化失败</el-button>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</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="['manage:iotConfig:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['manage:iotConfig:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改配电箱配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
<el-form ref="iotConfigRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="所属项目" prop="projectId">
<el-select v-model="form.projectId" placeholder="请选择所属项目" style="width:100%">
<el-option
v-for="(item, index) in projectOptions"
:key="index"
:label="item.projectName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="通信账号" prop="signalName">
<el-input
v-model="form.signalName"
placeholder="请输入通信账号"
maxlength="64"
show-word-limit
/>
</el-form-item>
<el-form-item label="通信密码" prop="signalCode">
<el-input
v-model="form.signalCode"
placeholder="请输入通信密码"
maxlength="64"
show-word-limit
/>
</el-form-item>
<el-form-item label="设备厂商" prop="factoryName">
<el-select
v-model="form.factoryName"
placeholder="请选择设备厂商"
style="width: 100%"
>
<el-option
v-for="dict in dict.type.iot_factory_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form>
<template slot="footer">
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script>
import {
listIotConfig,
getIotConfig,
delIotConfig,
addIotConfig,
updateIotConfig,
findIotConfigPoint,
} from "@/api/device/iotConfig";
export default {
name: "IotConfig",
dicts: ["sys_normal_disable", "iot_factory_type"],
data() {
return {
iotConfigList: [],
open: false,
loading: true,
showSearch: true,
ids: [],
single: true,
multiple: true,
total: 0,
title: "",
form: {
id: null,
comId: null,
projectId: null,
signalName: null,
signalCode: null,
factoryName: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
},
queryParams: {
pageNum: 1,
pageSize: 10,
comId: null,
projectId: null,
signalName: null,
signalCode: null,
factoryName: null,
isDel: null,
},
rules: {
projectId: [{ required: true, message: "所属项目不能为空", trigger: "change" }],
signalName: [{ required: true, message: "通信账号不能为空", trigger: "blur" }],
signalCode: [{ required: true, message: "通信密码不能为空", trigger: "blur" }],
factoryName: [{ required: true, message: "设备厂商不能为空", trigger: "change" }],
},
projectOptions: [],
};
},
created() {
this.$api.publics.getMyProjectList({}).then((response) => {
this.projectOptions = response.rows;
});
this.getList();
},
methods: {
/** 查询配电箱配置列表 */
getList() {
this.loading = true;
listIotConfig(this.queryParams).then((response) => {
this.iotConfigList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
comId: null,
projectId: null,
signalName: null,
signalCode: null,
factoryName: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
};
this.$refs.iotConfigRef && this.$refs.iotConfigRef.resetFields();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.$refs.queryRef && this.$refs.queryRef.resetFields();
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;
getIotConfig(_id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改配电箱配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs.iotConfigRef.validate((valid) => {
if (valid) {
if (this.form.id !== null) {
updateIotConfig(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addIotConfig(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getIotConfigPoint(response.data.id);
});
}
}
});
},
/** 状态滑块控制 */
setStatus(val, row) {
this.$modal
.confirm(`是否确认${val === "0" ? "启用" : "停用"}当前数据项?`)
.then(() => {
const _data = { id: row.id, isDel: val };
return updateIotConfig(_data);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("修改成功");
})
.catch(() => {
//
if (val === "0") {
row.isDel = "1";
} else {
row.isDel = "0";
}
});
},
/** 配电箱配的点位 */
getIotConfigPoint(id) {
findIotConfigPoint(id).then((res) => {
this.getList();
if (res.code === 200) {
this.$modal.msgSuccess("初始化配置点位成功!!!");
}
});
},
/** 刷新点位操作 */
handleRefreshPoint() {
this.getIotConfigPoint(this.ids);
},
/** 删除按钮操作 */
handleDelete(row) {
const _ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除配电箱配置编号为"' + _ids + '"的数据项?')
.then(() => {
return delIotConfig(_ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"manage/iotConfig/export",
{
...this.queryParams,
},
`iotConfig_${new Date().getTime()}.xlsx`
);
},
},
};
</script>

View File

@ -0,0 +1,590 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryRef"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="queryParams.deviceSn"
placeholder="请输入设备编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备厂商" prop="factoryName">
<el-select
v-model="queryParams.factoryName"
placeholder="请选择设备厂商"
clearable
>
<el-option
v-for="dict in dict.type.iot_factory_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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="['manage:iotConfigPoint: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="['manage:iotConfigPoint: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="['manage:iotConfigPoint: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="['manage:iotConfigPoint:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-alert title="配置点位说明" type="success">
<template slot="default">
<div>1配电箱点位依赖于配电箱配置</div>
<div>2手动新增的设备可能获取不到数据</div>
<div>3配电箱点位每小时获取设备心跳获取不到心跳则设备自动离线</div>
</template>
</el-alert>
<el-table
v-loading="loading"
:data="iotConfigPointList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="设备编号" align="center" prop="deviceSn" />
<el-table-column label="设备名称" align="center" prop="deviceName" width="100" />
<el-table-column label="设备厂商" align="center" prop="factoryName" width="88">
<template slot-scope="scope">
<dict-tag
:options="dict.type.iot_factory_type"
:value="scope.row.factoryName"
/>
</template>
</el-table-column>
<el-table-column label="联系人" align="center" prop="contactPerson" width="120">
<template slot-scope="scope">
<div>{{ scope.row.contactPerson }}</div>
<div>{{ scope.row.contactPersonPhone }}</div>
</template>
</el-table-column>
<el-table-column label="配电箱等级" align="center" prop="levels" width="120" />
<el-table-column label="漏电电流" align="center" prop="leakageCurrent" width="88" />
<el-table-column
label="额定温度"
align="center"
prop="ratedTemperature"
width="88"
/>
<el-table-column
label="短路电流"
align="center"
prop="shortCircuitCurrent"
width="88"
/>
<el-table-column label="额定电流" align="center" prop="ratedCurrent" width="88" />
<el-table-column label="额定电压" align="center" prop="ratedVoltage" width="88" />
<el-table-column label="设备状态" align="center" prop="onlineStatus" width="88">
<template slot-scope="scope">
<dict-tag
:options="dict.type.iot_online_status"
:value="scope.row.onlineStatus"
/>
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="100"
v-hasPermi="['manage:iotConfig:edit']"
>
<template slot-scope="scope">
<el-tooltip :content="scope.row.isDel == '0' ? '启用' : '停用'" placement="top">
<el-switch
active-value="0"
inactive-value="1"
v-model="scope.row.isDel"
@change="setStatus($event, scope.row)"
/>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="100"
v-notHasPermi="['manage:iotConfig:edit']"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.isDel" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="130">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</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="['manage:iotConfigPoint:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['manage:iotConfigPoint:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改配电箱配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
<el-form ref="iotConfigPointRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="项目名称" v-if="form.projectId">
<el-tag effect="plain">{{ form.projectName }}</el-tag>
</el-form-item>
<el-form-item label="所属配置" prop="cfgId">
<el-select
v-model="form.cfgId"
placeholder="请选择所属配置"
style="width: 100%"
>
<el-option
v-for="cfg in cfgList"
:key="cfg.id"
:label="cfg.signalName"
:value="cfg.id"
/>
</el-select>
</el-form-item>
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="form.deviceSn"
placeholder="请输入设备编号"
maxlength="32"
show-word-limit
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="form.deviceName"
placeholder="请输入设备名称"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="设备厂商" prop="factoryName">
<el-select
v-model="form.factoryName"
placeholder="请选择设备厂商"
style="width: 100%"
>
<el-option
v-for="dict in dict.type.iot_factory_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input
v-model="form.contactPerson"
placeholder="请输入联系人"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="联系人电话" prop="contactPersonPhone">
<el-input
v-model="form.contactPersonPhone"
placeholder="请输入联系人电话"
maxlength="11"
show-word-limit
/>
</el-form-item>
<el-form-item label="配电箱等级" prop="levels">
<el-select
v-model="form.levels"
placeholder="请选择配电箱等级"
style="width: 100%"
>
<el-option
v-for="dict in dict.type.dev_iot_levels"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="漏电电流" prop="leakageCurrent">
<el-input
v-model="form.leakageCurrent"
placeholder="请输入漏电电流"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="额定温度" prop="ratedTemperature">
<el-input
v-model="form.ratedTemperature"
placeholder="请输入额定温度"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="短路电流" prop="shortCircuitCurrent">
<el-input
v-model="form.shortCircuitCurrent"
placeholder="请输入短路电流"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="额定电流" prop="ratedCurrent">
<el-input
v-model="form.ratedCurrent"
placeholder="请输入额定电流"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="额定电压" prop="ratedVoltage">
<el-input
v-model="form.ratedVoltage"
placeholder="请输入额定电压"
maxlength="16"
show-word-limit
/>
</el-form-item>
</el-form>
<template slot="footer">
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script>
import { listIotConfig } from "@/api/device/iotConfig";
import {
listIotConfigPoint,
getIotConfigPoint,
delIotConfigPoint,
addIotConfigPoint,
updateIotConfigPoint,
} from "@/api/device/iotConfigPoint";
export default {
name: "IotConfigPoint",
dicts: [
"sys_normal_disable",
"iot_factory_type",
"dev_iot_levels",
"iot_online_status",
],
data() {
return {
iotConfigPointList: [],
open: false,
loading: true,
showSearch: true,
ids: [],
single: true,
multiple: true,
total: 0,
title: "",
cfgList: [],
form: {
id: null,
cfgId: null,
comId: null,
projectId: null,
deviceSn: null,
deviceName: null,
factoryName: null,
contactPerson: null,
contactPersonPhone: null,
levels: null,
leakageCurrent: null,
ratedTemperature: null,
shortCircuitCurrent: null,
ratedCurrent: null,
ratedVoltage: null,
onlineStatus: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
},
queryParams: {
pageNum: 1,
pageSize: 10,
cfgId: null,
comId: null,
projectId: null,
deviceSn: null,
deviceName: null,
factoryName: null,
onlineStatus: null,
isDel: null,
},
rules: {
cfgId: [{ required: true, message: "所属配置不能为空", trigger: "change" }],
deviceSn: [{ required: true, message: "设备编号不能为空", trigger: "blur" }],
deviceName: [{ required: true, message: "设备名称不能为空", trigger: "blur" }],
factoryName: [{ required: true, message: "设备厂商不能为空", trigger: "change" }],
contactPerson: [{ required: false, message: "联系人不能为空", trigger: "blur" }],
contactPersonPhone: [
{ required: false, message: "联系人电话不能为空", trigger: "blur" },
],
levels: [{ required: true, message: "配电箱等级不能为空", trigger: "change" }],
leakageCurrent: [
{ required: true, message: "漏电电流不能为空", trigger: "blur" },
],
ratedTemperature: [
{ required: true, message: "额定温度不能为空", trigger: "blur" },
],
shortCircuitCurrent: [
{ required: true, message: "短路电流不能为空", trigger: "blur" },
],
ratedCurrent: [{ required: true, message: "额定电流不能为空", trigger: "blur" }],
ratedVoltage: [{ required: true, message: "额定电压不能为空", trigger: "blur" }],
},
};
},
created() {
this.init();
this.getList();
},
methods: {
/** 查询配电箱配置点位列表 */
getList() {
this.loading = true;
listIotConfigPoint(this.queryParams).then((response) => {
this.iotConfigPointList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
cfgId: null,
comId: null,
projectId: null,
deviceSn: null,
deviceName: null,
factoryName: null,
contactPerson: null,
contactPersonPhone: null,
levels: null,
leakageCurrent: null,
ratedTemperature: null,
shortCircuitCurrent: null,
ratedCurrent: null,
ratedVoltage: null,
onlineStatus: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
};
this.$refs.iotConfigPointRef && this.$refs.iotConfigPointRef.resetFields();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.$refs.queryRef && this.$refs.queryRef.resetFields();
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;
getIotConfigPoint(_id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改配电箱点位";
});
},
/** 提交按钮 */
submitForm() {
this.$refs.iotConfigPointRef.validate((valid) => {
if (valid) {
if (this.form.id !== null) {
updateIotConfigPoint(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addIotConfigPoint(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 状态滑块控制 */
setStatus(val, row) {
this.$modal
.confirm(`是否确认${val === "0" ? "启用" : "停用"}当前数据项?`)
.then(() => {
const _data = { id: row.id, isDel: val };
return updateIotConfigPoint(_data);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("修改成功");
})
.catch(() => {
//
if (val === "0") {
row.isDel = "1";
} else {
row.isDel = "0";
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const _ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除配电箱配置编号为"' + _ids + '"的数据项?')
.then(() => {
return delIotConfigPoint(_ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"manage/iotConfigPoint/export",
{
...this.queryParams,
},
`iotConfigPoint_${new Date().getTime()}.xlsx`
);
},
/** 初始化获取配置列表 */
init() {
const _param = { pageNum: 1, pageSize: 10 };
listIotConfig(_param).then((res) => {
this.cfgList = res.rows;
});
},
},
};
</script>

View File

@ -0,0 +1,444 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="queryParams.deviceSn"
placeholder="请输入设备编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="上报时间">
<el-date-picker
v-model="daterangeCreateTime"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</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 v-if="false" :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['manage:iotDatas: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="['manage:iotDatas: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="['manage:iotDatas: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="['manage:iotDatas:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="iotDatasList">
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="设备编号" align="center" prop="deviceSn" width="88"/>
<el-table-column label="实时温度" align="center" prop="temperature" width="88"/>
<el-table-column label="漏电监测" align="center" prop="leakage" width="88"/>
<el-table-column label="A相电压" align="center" prop="voltageA" width="100" />
<el-table-column label="B相电压" align="center" prop="voltageB" width="100" />
<el-table-column label="C相电压" align="center" prop="voltageC" width="100" />
<el-table-column label="A相电流" align="center" prop="currentA" width="98" />
<el-table-column label="B相电流" align="center" prop="currentB" width="98" />
<el-table-column label="C相电流" align="center" prop="currentC" width="98" />
<el-table-column label="A相功率" align="center" prop="powerA" width="88" />
<el-table-column label="B相功率" align="center" prop="powerB" width="88" />
<el-table-column label="C相功率" align="center" prop="powerC" width="88" />
<el-table-column label="A相频率" align="center" prop="frequencyA" width="88" v-if="false"/>
<el-table-column label="B相频率" align="center" prop="frequencyB" width="88" v-if="false"/>
<el-table-column label="C相频率" align="center" prop="frequencyC" width="88" v-if="false"/>
<el-table-column label="上报时间" align="center" prop="createTime" width="150">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-if="false"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['manage:iotDatas:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['manage:iotDatas:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改配电箱数据对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="iotDatasRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="配置主键" prop="cfgId">
<el-input v-model="form.cfgId" placeholder="请输入配置主键" />
</el-form-item>
<el-form-item label="点位主键" prop="pointId">
<el-input v-model="form.pointId" placeholder="请输入点位主键" />
</el-form-item>
<el-form-item label="公司主键" prop="comId">
<el-input v-model="form.comId" placeholder="请输入公司主键" />
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
</el-form-item>
<el-form-item label="设备序列号" prop="deviceSn">
<el-input v-model="form.deviceSn" placeholder="请输入设备序列号" />
</el-form-item>
<el-form-item label="开关位_交流" prop="switchesAc">
<el-input v-model="form.switchesAc" placeholder="请输入开关位_交流" />
</el-form-item>
<el-form-item label="开关位" prop="switchesSwitch">
<el-input v-model="form.switchesSwitch" placeholder="请输入开关位" />
</el-form-item>
<el-form-item label="开关位状态" prop="switchesSwitches">
<el-input v-model="form.switchesSwitches" placeholder="请输入开关位状态" />
</el-form-item>
<el-form-item label="温度监测数据" prop="temperature">
<el-input v-model="form.temperature" placeholder="请输入温度监测数据" />
</el-form-item>
<el-form-item label="漏电监测数据" prop="leakage">
<el-input v-model="form.leakage" placeholder="请输入漏电监测数据" />
</el-form-item>
<el-form-item label="A相电压" prop="voltageA">
<el-input v-model="form.voltageA" placeholder="请输入A相电压" />
</el-form-item>
<el-form-item label="B相电压" prop="voltageB">
<el-input v-model="form.voltageB" placeholder="请输入B相电压" />
</el-form-item>
<el-form-item label="C相电压" prop="voltageC">
<el-input v-model="form.voltageC" placeholder="请输入C相电压" />
</el-form-item>
<el-form-item label="A相与B相之间的电压" prop="voltageAb">
<el-input v-model="form.voltageAb" placeholder="请输入A相与B相之间的电压" />
</el-form-item>
<el-form-item label="B相与C相之间的电压" prop="voltageBc">
<el-input v-model="form.voltageBc" placeholder="请输入B相与C相之间的电压" />
</el-form-item>
<el-form-item label="C相与A相之间的电压" prop="voltageCa">
<el-input v-model="form.voltageCa" placeholder="请输入C相与A相之间的电压" />
</el-form-item>
<el-form-item label="A相电流" prop="currentA">
<el-input v-model="form.currentA" placeholder="请输入A相电流" />
</el-form-item>
<el-form-item label="B相电流" prop="currentB">
<el-input v-model="form.currentB" placeholder="请输入B相电流" />
</el-form-item>
<el-form-item label="C相电流" prop="currentC">
<el-input v-model="form.currentC" placeholder="请输入C相电流" />
</el-form-item>
<el-form-item label="A相功率" prop="powerA">
<el-input v-model="form.powerA" placeholder="请输入A相功率" />
</el-form-item>
<el-form-item label="B相功率" prop="powerB">
<el-input v-model="form.powerB" placeholder="请输入B相功率" />
</el-form-item>
<el-form-item label="C相功率" prop="powerC">
<el-input v-model="form.powerC" placeholder="请输入C相功率" />
</el-form-item>
<el-form-item label="A相累计能量" prop="energyA">
<el-input v-model="form.energyA" placeholder="请输入A相累计能量" />
</el-form-item>
<el-form-item label="B相累计能量" prop="energyB">
<el-input v-model="form.energyB" placeholder="请输入B相累计能量" />
</el-form-item>
<el-form-item label="C相累计能量" prop="energyC">
<el-input v-model="form.energyC" placeholder="请输入C相累计能量" />
</el-form-item>
<el-form-item label="A相功率因数" prop="factorA">
<el-input v-model="form.factorA" placeholder="请输入A相功率因数" />
</el-form-item>
<el-form-item label="B相功率因数" prop="factorB">
<el-input v-model="form.factorB" placeholder="请输入B相功率因数" />
</el-form-item>
<el-form-item label="C相功率因数" prop="factorC">
<el-input v-model="form.factorC" placeholder="请输入C相功率因数" />
</el-form-item>
<el-form-item label="A相频率" prop="frequencyA">
<el-input v-model="form.frequencyA" placeholder="请输入A相频率" />
</el-form-item>
<el-form-item label="B相频率" prop="frequencyB">
<el-input v-model="form.frequencyB" placeholder="请输入B相频率" />
</el-form-item>
<el-form-item label="C相频率" prop="frequencyC">
<el-input v-model="form.frequencyC" placeholder="请输入C相频率" />
</el-form-item>
</el-form>
<template slot="footer">
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script>
import {
listIotDatas, getIotDatas, delIotDatas, addIotDatas, updateIotDatas
} from "@/api/device/iotDatas";
export default {
name: "IotDatas",
data() {
return {
iotDatasList: [],
open: false,
loading: true,
showSearch: true,
ids: [],
single: true,
multiple: true,
total: 0,
title: "",
daterangeCreateTime: [],
form: {
id: null,
cfgId: null,
pointId: null,
comId: null,
projectId: null,
deviceSn: null,
switchesAc: null,
switchesSwitch: null,
switchesSwitches: null,
switchesSwitchstatus: null,
temperature: null,
leakage: null,
voltageA: null,
voltageB: null,
voltageC: null,
voltageAb: null,
voltageBc: null,
voltageCa: null,
currentA: null,
currentB: null,
currentC: null,
powerA: null,
powerB: null,
powerC: null,
energyA: null,
energyB: null,
energyC: null,
factorA: null,
factorB: null,
factorC: null,
frequencyA: null,
frequencyB: null,
frequencyC: null,
createTime: null
},
queryParams: {
pageNum: 1,
pageSize: 10,
cfgId: null,
pointId: null,
comId: null,
projectId: null,
deviceSn: null,
createTime: null
},
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询配电箱数据列表 */
getList() {
this.loading = true;
const params = {};
if (this.daterangeCreateTime && this.daterangeCreateTime.length > 0) {
params["beginCreateTime"] = this.daterangeCreateTime[0];
params["endCreateTime"] = this.daterangeCreateTime[1];
}
this.queryParams.params = params;
listIotDatas(this.queryParams).then(response => {
this.iotDatasList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
cfgId: null,
pointId: null,
comId: null,
projectId: null,
deviceSn: null,
switchesAc: null,
switchesSwitch: null,
switchesSwitches: null,
switchesSwitchstatus: null,
temperature: null,
leakage: null,
voltageA: null,
voltageB: null,
voltageC: null,
voltageAb: null,
voltageBc: null,
voltageCa: null,
currentA: null,
currentB: null,
currentC: null,
powerA: null,
powerB: null,
powerC: null,
energyA: null,
energyB: null,
energyC: null,
factorA: null,
factorB: null,
factorC: null,
frequencyA: null,
frequencyB: null,
frequencyC: null,
createTime: null
};
this.$refs.iotDatasRef && this.$refs.iotDatasRef.resetFields();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeCreateTime = [];
this.$refs.queryRef && this.$refs.queryRef.resetFields();
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;
getIotDatas(_id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改配电箱数据";
});
},
/** 提交按钮 */
submitForm() {
this.$refs.iotDatasRef.validate(valid => {
if (valid) {
if (this.form.id !== null) {
updateIotDatas(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addIotDatas(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const _ids = row.id || this.ids;
this.$modal.confirm('是否确认删除配电箱数据编号为"' + _ids + '"的数据项?').then(() => {
return delIotDatas(_ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('manage/iotDatas/export', {
...this.queryParams
}, `iotDatas_${new Date().getTime()}.xlsx`);
}
}
};
</script>

View File

@ -0,0 +1,303 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="queryParams.deviceSn"
placeholder="请输入设备编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="预警时间">
<el-date-picker
v-model="daterangeCreateTime"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</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 v-if="false" :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['manage:iotWarning: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="['manage:iotWarning: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="['manage:iotWarning: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="['manage:iotWarning:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="iotWarningList">
<el-table-column label="预警编号" align="center" prop="id" width="88"/>
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="设备编号" align="center" prop="deviceSn" width="100"/>
<el-table-column label="预警类型" align="center" prop="warningType" />
<el-table-column label="预警内容" align="center" prop="warningContent" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-if="false"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['manage:iotWarning:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['manage:iotWarning:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改配电箱预警对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="iotWarningRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="配置主键" prop="cfgId">
<el-input v-model="form.cfgId" placeholder="请输入配置主键" />
</el-form-item>
<el-form-item label="点位主键" prop="pointId">
<el-input v-model="form.pointId" placeholder="请输入点位主键" />
</el-form-item>
<el-form-item label="公司主键" prop="comId">
<el-input v-model="form.comId" placeholder="请输入公司主键" />
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
</el-form-item>
<el-form-item label="设备序列号" prop="deviceSn">
<el-input v-model="form.deviceSn" placeholder="请输入设备序列号" />
</el-form-item>
<el-form-item label="预警内容">
<editor v-model="form.warningContent" :min-height="192"/>
</el-form-item>
</el-form>
<template slot="footer">
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script>
import {
listIotWarning, getIotWarning, delIotWarning, addIotWarning, updateIotWarning
} from "@/api/device/iotWarning";
export default {
name: "IotWarning",
data() {
return {
iotWarningList: [],
open: false,
loading: true,
showSearch: true,
ids: [],
single: true,
multiple: true,
total: 0,
title: "",
daterangeCreateTime: [],
form: {
id: null,
cfgId: null,
pointId: null,
comId: null,
projectId: null,
deviceSn: null,
warningType: null,
warningContent: null,
createTime: null
},
queryParams: {
pageNum: 1,
pageSize: 10,
cfgId: null,
pointId: null,
comId: null,
projectId: null,
deviceSn: null,
warningType: null,
warningContent: null
},
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询配电箱预警列表 */
getList() {
this.loading = true;
const params = {};
if (this.daterangeCreateTime && this.daterangeCreateTime.length > 0) {
params["beginCreateTime"] = this.daterangeCreateTime[0];
params["endCreateTime"] = this.daterangeCreateTime[1];
}
this.queryParams.params = params;
listIotWarning(this.queryParams).then(response => {
this.iotWarningList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
cfgId: null,
pointId: null,
comId: null,
projectId: null,
deviceSn: null,
warningType: null,
warningContent: null,
createTime: null
};
this.$refs.iotWarningRef && this.$refs.iotWarningRef.resetFields();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.$refs.queryRef && this.$refs.queryRef.resetFields();
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;
getIotWarning(_id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改配电箱预警";
});
},
/** 提交按钮 */
submitForm() {
this.$refs.iotWarningRef.validate(valid => {
if (valid) {
if (this.form.id !== null) {
updateIotWarning(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addIotWarning(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const _ids = row.id || this.ids;
this.$modal.confirm('是否确认删除配电箱预警编号为"' + _ids + '"的数据项?').then(() => {
return delIotWarning(_ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('manage/iotWarning/export', {
...this.queryParams
}, `iotWarning_${new Date().getTime()}.xlsx`);
}
}
};
</script>

View File

@ -9,14 +9,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单位名称" prop="deptName">
<el-input
v-model="queryParams.deptName"
placeholder="请输入单位名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="daterangeCreateTime"
@ -82,26 +74,11 @@
<el-table v-loading="loading" :data="towerDataWarningList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="总包单位" align="center" prop="deptName" />
<el-table-column label="设备序列号" align="center" prop="deviceKey" />
<el-table-column label="设备来源" align="center" prop="deviceSource" />
<el-table-column label="塔机编号" align="center" prop="towerId" />
<el-table-column label="预警类型" align="center" prop="warnType" />
<el-table-column label="预警名称" align="center" prop="warnName" />
<el-table-column label="项目名称" align="center" prop="projectName" width="200"/>
<el-table-column label="总包单位" align="center" prop="deptName" width="200"/>
<el-table-column label="设备序列号" align="center" prop="deviceKey" width="180"/>
<el-table-column label="预警内容" align="center" prop="warnNote" />
<el-table-column label="预警值" align="center" prop="warnData" />
<el-table-column label="实际值" align="center" prop="realData" />
<el-table-column label="是否有效" align="center" prop="isDel">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_common_isdel" :value="scope.row.isDel"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100" fixed="right">
<template slot-scope="scope">
<!-- <el-button

View File

@ -34,7 +34,7 @@ module.exports = {
open: true,
proxy: {
[process.env.VUE_APP_BASE_API]: {
target: `http://106.55.153.13:8888/jhapi/`,
target: `http://106.55.153.13/prod-api/`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
@ -42,7 +42,7 @@ module.exports = {
},
'/profile':{
//target: `http://szgc.jhncidg.com/jhapi/profile`,
target: `http://62.234.3.186/profile/`,
target: `http://106.55.153.13/profile/`,
changeOrigin: true,
pathRewrite: {
'^/profile':'/'

View File

@ -8,6 +8,7 @@ import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.PublicStateEnum;
import com.yanzhu.jh.device.domain.DevTowerDataLimit;
import com.yanzhu.jh.device.domain.DevTowerDataRun;
import com.yanzhu.jh.device.domain.DevTowerDataWarning;
import com.yanzhu.jh.device.domain.DevTowerProjectConfig;
import com.yanzhu.jh.device.service.*;
import org.springframework.beans.factory.annotation.Autowired;
@ -47,6 +48,9 @@ public class TowerCraneController extends BaseController {
@Autowired
private IDevTowerDataCollideService devTowerDataCollideService;
@Autowired
private IDevTowerDataWarningService devTowerDataWarningService;
@Autowired
private IDevTowerProjectConfigService devTowerProjectConfigService;
@ -54,7 +58,7 @@ public class TowerCraneController extends BaseController {
*
*/
@GetMapping("/findTowerConfigGroupOnline")
public AjaxResult findTowerConfigGroupOnline(String deptId, String projectId)
public AjaxResult findTowerConfigGroupOnline(String projectId)
{
String key = "bgscreen.tower.findtowerConfigGroupOnline."+projectId;
Object obj=redisCache.getCacheObject(key);
@ -72,7 +76,7 @@ public class TowerCraneController extends BaseController {
*
*/
@GetMapping("/findTowerConfigListByProjectId")
public AjaxResult findTowerConfigListByProjectId(String deptId, String projectId)
public AjaxResult findTowerConfigListByProjectId(String projectId)
{
String key = "bgscreen.tower.findtowerConfigListByProjectId."+projectId;
Object obj=redisCache.getCacheObject(key);
@ -109,7 +113,7 @@ public class TowerCraneController extends BaseController {
@GetMapping("/selectDevTowerDataLimitList")
public AjaxResult selectDevTowerDataLimitList(DevTowerDataLimit devTowerDataLimit)
{
startPage();
startPage(1,1);
List<DevTowerDataLimit> list = devTowerDataLimitService.selectDevTowerDataLimitList(devTowerDataLimit);
return success(list);
}
@ -120,8 +124,19 @@ public class TowerCraneController extends BaseController {
@GetMapping("/selectDevTowerDataRunList")
public AjaxResult selectDevTowerDataRunList(DevTowerDataRun devTowerDataRun)
{
startPage();
startPage(1,10);
List<DevTowerDataRun> list = devTowerDataRunService.selectDevTowerDataRunList(devTowerDataRun);
return success(list);
}
/**
*
*/
@GetMapping("/findDevTowerDataWarningDatas")
public AjaxResult findDevTowerDataWarningDatas(DevTowerDataWarning devTowerDataWarning)
{
startPage(1,10);
List<DevTowerDataWarning> list = devTowerDataWarningService.selectDevTowerDataWarningList(devTowerDataWarning);
return success(list);
}
}

View File

@ -1,7 +1,5 @@
package com.ruoyi.api;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.annotation.RateLimiter;
import com.ruoyi.common.constant.CacheConstants;
@ -13,6 +11,9 @@ import com.ruoyi.common.enums.LimitType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.TowerReqVo;
import com.ruoyi.domain.vo.TyTowerRoundReqVO;
import com.ruoyi.domain.vo.TyTowerRunReqVO;
import com.ruoyi.domain.vo.TyTowerWarningReqVO;
import com.ruoyi.emuns.TowerTypeEnums;
import com.yanzhu.jh.device.domain.*;
import com.yanzhu.jh.device.service.*;
@ -25,7 +26,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -58,9 +61,19 @@ public class TowerCraneApiController {
@Autowired
private IDevTowerDataCollideService devTowerDataCollideService;
@Autowired
private IDevTowerDataWarningService devTowerDataWarningService;
@Autowired
private IDevTowerProjectConfigService devTowerProjectConfigService;
private String YANZHU_DEVICE_TOWER = "device.tower_cfg:";
/**
*
*/
private Map<String, DevTowerDataLimit> staticLimitMap = new HashMap<>();
/**
* ++
* [6010IP]
@ -116,7 +129,7 @@ public class TowerCraneApiController {
*
* @param req
*/
private static void pushRunData(DevTowerProjectConfig config,TowerReqVo req){
private void pushRunData(DevTowerProjectConfig config,TowerReqVo req){
DevTowerDataRun devTowerDataRun = new DevTowerDataRun();
Map<String, Object> dataContent = req.getContent().getDataContent();
devTowerDataRun.setCfgId(config.getId());
@ -142,26 +155,18 @@ public class TowerCraneApiController {
devTowerDataRun.setRangeSensorState(Convert.toStr(dataContent.get("rangeSensorState")));
devTowerDataRun.setHeightSensorState(Convert.toStr(dataContent.get("heightSensorState")));
devTowerDataRun.setBrakingStatus(Convert.toStr(dataContent.get("brakingStatus")));
if(dataContent.get("warnings")!=null){
List<String> warnings = (List<String>)dataContent.get("warnings");
if (dataContent.get("warnings") != null) {
List<String> warnings = (List<String>) dataContent.get("warnings");
devTowerDataRun.setWarnings(String.join(",", warnings));
for(String warning:warnings){
for (String warning : warnings) {
pushWarningData(config, warning, devTowerDataRun);
Integer alarm = Convert.toInt(warning);
if(alarm>100 && alarm<120){
if (alarm > 100 && alarm < 120) {
devTowerDataRun.setIsAlarm(1L);
}
}
}
System.out.println(devTowerDataRun);
//devTowerDataRunService.insertDevTowerDataRun(devTowerDataRun);
}
public static void main(String[] args) {
String str = "{\"type\":111,\"content\":{\"time\":1496263304,\"dataType\":113001,\"deviceKey\":\"jycw6\",\"dataContent\":{\"height\":\"4.1\",\"range\": \"21.9\",\"rotation\": \"171.0\",\"load\": \"0.0\",\"windSpeed\": \"0.0\",\"leanAngleX\":\"0.5\",\"leanAngley\":\"0.0\",\"loadPercent\":\"0\", \"mome ntPercent\":\"0\",\"windSpeedPercent\":\"0\",\"leanAnglePercent\": \"0\", \"warnings\": [\"0\"],\"rate\":\"2\",\"rotationSensorState\":\"1\",\"loadSensorState\": \"1\",\"windSpeedSensorState\": \"1\",\"leanAngleSensorState\":\"1\",\"rangeSensorState\":\"1\",\"heightSensorState\":\"1\",\"bra kingStatus\":\"0\"}}}";
TowerReqVo req = JSON.parseObject(str,TowerReqVo.class);
System.out.println(req);
DevTowerProjectConfig config = new DevTowerProjectConfig();
pushRunData(config,req);
devTowerDataRunService.insertDevTowerDataRun(devTowerDataRun);
}
/**
@ -200,15 +205,16 @@ public class TowerCraneApiController {
devTowerDataRound.setEndLeanAngleX(Convert.toStr(dataContent.get("endLeanAngleX")));
devTowerDataRound.setStartLeanAngleY(Convert.toStr(dataContent.get("startleanAngleY")));
devTowerDataRound.setEndLeanAngleY(Convert.toStr(dataContent.get("endLeanAngleY")));
if(dataContent.get("warning")!=null){
List<String> warnings = (List<String>)dataContent.get("warning");
if (dataContent.get("warning") != null) {
List<String> warnings = (List<String>) dataContent.get("warning");
devTowerDataRound.setWarnings(String.join(",", warnings));
for(String warning:warnings){
for (String warning : warnings) {
pushWarningData(config, warning,null);
Integer alarm = Convert.toInt(warning);
if(alarm>6 && alarm<10){
if (alarm > 6 && alarm < 10) {
devTowerDataRound.setIsOverload(1L);
}
if(alarm>100 && alarm<120){
if (alarm > 100 && alarm < 120) {
devTowerDataRound.setIsAlarm(1L);
}
}
@ -216,6 +222,35 @@ public class TowerCraneApiController {
devTowerDataRoundService.insertDevTowerDataRound(devTowerDataRound);
}
/**
*
*
* @param config
* @param warning
*/
private void pushWarningData(DevTowerProjectConfig config, Object warning, DevTowerDataRun devTowerDataRun) {
DevTowerDataWarning devTowerDataWarning = new DevTowerDataWarning();
devTowerDataWarning.setCfgId(config.getId());
devTowerDataWarning.setProjectId(config.getProjectId());
devTowerDataWarning.setDeviceKey(config.getDeviceSn());
devTowerDataWarning.setWarnType(Convert.toLong(warning));
if(devTowerDataRun!=null){
devTowerDataWarning.setHeight(devTowerDataRun.getHeight());
devTowerDataWarning.setRange(devTowerDataRun.getRange());
devTowerDataWarning.setRotation(devTowerDataRun.getRotation());
devTowerDataWarning.setLoad(devTowerDataRun.getLoad());
devTowerDataWarning.setWindSpeed(devTowerDataRun.getWindSpeed());
devTowerDataWarning.setLeanAngleX(devTowerDataRun.getLeanAngleX());
devTowerDataWarning.setLeanAngleY(devTowerDataRun.getLeanAngleY());
devTowerDataWarning.setMomentPercent(devTowerDataRun.getMomentPercent());
devTowerDataWarning.setRate(devTowerDataRun.getRate());
}
if(devTowerDataWarning.getWarnType()>100){
devTowerDataWarning.setAlarmed(1L);
}
devTowerDataWarningService.insertDevTowerDataWarning(devTowerDataWarning);
}
/**
*
* @param req
@ -344,4 +379,320 @@ public class TowerCraneApiController {
devTowerDataLocalService.insertDevTowerDataLocal(devTowerDataLocal);
}
/**
* ++
* [6010IP]
*
* @param req
* @author JiangYuQi
* @date 2024-01-13
*/
@ApiOperation(value = "山东探越-塔吊监测-实时数据")
@RateLimiter(count = 10, limitType = LimitType.IP)
@PostMapping("/v2_ty/run/push")
public AjaxResult tyPushRunData(@RequestBody @Valid TyTowerRunReqVO req) {
log.info("desApi.towerCrane.v2_ty.run.push...{}",req.getEid());
DevTowerProjectConfig config = redisCache.getCacheObject(YANZHU_DEVICE_TOWER + req.getEid());
if (config == null) {
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
}
String deviceKey = req.getEid().toString();
DevTowerDataLimit devTowerDataLimit = staticLimitMap.get(deviceKey);
if(devTowerDataLimit==null){
DevTowerDataLimit devTowerDataLimitQuery = new DevTowerDataLimit();
devTowerDataLimitQuery.setDeviceKey(deviceKey);
devTowerDataLimitQuery.setProjectId(config.getProjectId());
List<DevTowerDataLimit> limitList = devTowerDataLimitService.selectDevTowerDataLimitList(devTowerDataLimitQuery);
if(limitList.size()>0){
devTowerDataLimit = limitList.get(0);
staticLimitMap.put(deviceKey,devTowerDataLimit);
}else{
devTowerDataLimit = new DevTowerDataLimit();
}
}
DevTowerDataRun devTowerDataRun = new DevTowerDataRun();
devTowerDataRun.setCfgId(config.getId());
devTowerDataRun.setProjectId(config.getProjectId());
devTowerDataRun.setDeviceKey(config.getDeviceSn());
devTowerDataRun.setHeight(Convert.toStr(req.getHeight()));
devTowerDataRun.setRange(Convert.toStr(req.getRange()));
devTowerDataRun.setRotation(Convert.toStr(req.getRotation_angle()));
devTowerDataRun.setLoad(String.format("%.2f", req.getLifting_weight()/1000));
Double limitLoad = Convert.toDouble(devTowerDataLimit.getLoadAlarm(),50.0);
devTowerDataRun.setLoadPercent(String.format("%.2f", (req.getLifting_weight()/10)/limitLoad));
devTowerDataRun.setWindSpeed(Convert.toStr(req.getWind_speed()));
devTowerDataRun.setLeanAngleX(Convert.toStr(req.getAnteversion_x()));
devTowerDataRun.setLeanAngleY(Convert.toStr(req.getAnteversion_y()));
devTowerDataRun.setMomentPercent(Convert.toStr(req.getForce_distance()));
devTowerDataRun.setRate(Convert.toStr(req.getMagnification()));
devTowerDataRunService.insertDevTowerDataRun(devTowerDataRun);
return AjaxResult.success();
}
/**
* ++
* [6010IP]
*
* @param req
* @author JiangYuQi
* @date 2024-01-13
*/
@ApiOperation(value = "山东探越-塔吊监测-循环数据")
@RateLimiter(count = 10, limitType = LimitType.IP)
@PostMapping("/v2_ty/round/push")
public AjaxResult tyPushRoundData(@RequestBody @Valid TyTowerRoundReqVO req) {
log.info("desApi.towerCrane.v2_ty.round.push...{}",req.getEid());
DevTowerProjectConfig config = redisCache.getCacheObject(YANZHU_DEVICE_TOWER + req.getEid());
if (config == null) {
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
}
DevTowerDataRound devTowerDataRound = new DevTowerDataRound();
devTowerDataRound.setCfgId(config.getId());
devTowerDataRound.setProjectId(config.getProjectId());
devTowerDataRound.setDeviceKey(config.getDeviceSn());
devTowerDataRound.setWorkStartTime(Convert.toStr(req.getStart_time()));
devTowerDataRound.setWorkEndTime(Convert.toStr(req.getEnd_time()));
devTowerDataRound.setMinHeight(Convert.toStr(req.getStart_height()));
devTowerDataRound.setMaxHeight(Convert.toStr(req.getEnd_height()));
devTowerDataRound.setMinRange(Convert.toStr(req.getStart_range()));
devTowerDataRound.setMaxRange(Convert.toStr(req.getEnd_range()));
devTowerDataRound.setStartHeight(Convert.toStr(req.getStart_height()));
devTowerDataRound.setEndHeight(Convert.toStr(req.getEnd_height()));
devTowerDataRound.setStartRange(Convert.toStr(req.getStart_range()));
devTowerDataRound.setEndRange(Convert.toStr(req.getEnd_range()));
devTowerDataRound.setStartRotation(Convert.toStr(req.getStart_rotation_angle()));
devTowerDataRound.setEndRotation(Convert.toStr(req.getEnd_rotation_angle()));
devTowerDataRound.setMaxLoad(String.format("%.2f", req.getWeight()/1000));
devTowerDataRound.setMaxMomentPercent(Convert.toStr(req.getMoment_percent()));
devTowerDataRoundService.insertDevTowerDataRound(devTowerDataRound);
return AjaxResult.success();
}
/**
* ++
* [6010IP]
*
* @param req
* @author JiangYuQi
* @date 2024-01-13
*/
@ApiOperation(value = "山东探越-塔吊监测-预警数据")
@RateLimiter(count = 10, limitType = LimitType.IP)
@PostMapping("/v2_ty/warning/push")
public AjaxResult tyPushWarningData(@RequestBody @Valid TyTowerWarningReqVO req) {
log.info("desApi.towerCrane.v2_ty.warning.push...{}",req.getEid());
DevTowerProjectConfig config = redisCache.getCacheObject(YANZHU_DEVICE_TOWER + req.getEid());
if (config == null) {
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
}
DevTowerDataWarning devTowerDataWarning = new DevTowerDataWarning();
devTowerDataWarning.setCfgId(config.getId());
devTowerDataWarning.setProjectId(config.getProjectId());
devTowerDataWarning.setDeviceKey(config.getDeviceSn());
String warningType = convertTyTowerWarningType(req.getType_id().toString());
devTowerDataWarning.setWarnType(Convert.toLong(warningType));
devTowerDataWarning.setWarnNote(req.getType());
devTowerDataWarning.setHeight(Convert.toStr(req.getHeight()));
devTowerDataWarning.setRange(Convert.toStr(req.getRange()));
devTowerDataWarning.setRotation(Convert.toStr(req.getRotation()));
devTowerDataWarning.setLoad(String.format("%.2f", req.getLifting_weight()/1000));
devTowerDataWarning.setWindSpeed(Convert.toStr(req.getWind_speed()));
devTowerDataWarning.setLeanAngleX(Convert.toStr(req.getAnteversion_x()));
devTowerDataWarning.setLeanAngleY(Convert.toStr(req.getAnteversion_y()));
devTowerDataWarning.setMomentPercent(Convert.toStr(req.getForce_distance()));
devTowerDataWarning.setRate(Convert.toStr(req.getMagnification()));
if(devTowerDataWarning.getWarnType()>100){
devTowerDataWarning.setAlarmed(1L);
}
devTowerDataWarningService.insertDevTowerDataWarning(devTowerDataWarning);
return AjaxResult.success();
}
/**
*
*
* @param warningType
* @return
*/
private String convertTyTowerWarningType(String warningType) {
String warningTypeEs;
switch (warningType) {
case "1":
warningTypeEs = "5";
break;
case "2":
warningTypeEs = "6";
break;
case "3":
case "43":
warningTypeEs = "1";
break;
case "4":
warningTypeEs = "2";
break;
case "5":
warningTypeEs = "3";
break;
case "6":
warningTypeEs = "4";
break;
case "7":
warningTypeEs = "10";
break;
case "8":
warningTypeEs = "13";
break;
case "9":
case "30":
case "36":
case "48":
warningTypeEs = "104";
break;
case "10":
case "29":
case "49":
warningTypeEs = "105";
break;
case "11":
case "12":
warningTypeEs = "101";
break;
case "13":
warningTypeEs = "102";
break;
case "14":
warningTypeEs = "103";
break;
case "15":
case "44":
warningTypeEs = "107";
break;
case "16":
warningTypeEs = "108";
break;
case "21":
warningTypeEs = "88";
break;
case "27":
case "33":
warningTypeEs = "188";
break;
case "17":
case "18":
case "19":
case "20":
case "23":
case "24":
case "45":
warningTypeEs = "15";
break;
case "25":
warningTypeEs = "89";
break;
case "26":
warningTypeEs = "90";
break;
case "31":
case "37":
warningTypeEs = "189";
break;
case "32":
case "38":
warningTypeEs = "190";
break;
case "40":
case "50":
warningTypeEs = "106";
break;
case "41":
case "42":
case "47":
warningTypeEs = "109";
break;
case "46":
warningTypeEs = "108";
break;
case "51":
case "52":
case "53":
case "54":
warningTypeEs = "14";
break;
default:
warningTypeEs = warningType;
break;
}
return warningTypeEs;
}
/**
* Linux
*
* @param warningType
* @return
*/
private String convertTyTowerLinuxWarningType(String warningType) {
String warningTypeEs;
switch (warningType) {
case "1":
warningTypeEs = "1";
break;
case "2":
warningTypeEs = "101";
break;
case "3":
warningTypeEs = "4";
break;
case "4":
warningTypeEs = "103";
break;
case "5":
warningTypeEs = "3";
break;
case "6":
warningTypeEs = "102";
break;
case "7":
warningTypeEs = "7";
break;
case "8":
warningTypeEs = "106";
break;
case "9":
warningTypeEs = "10";
break;
case "10":
warningTypeEs = "107";
break;
case "11":
warningTypeEs = "13";
break;
case "12":
warningTypeEs = "108";
break;
case "13":
warningTypeEs = "5";
break;
case "14":
warningTypeEs = "104";
break;
case "15":
warningTypeEs = "6";
break;
case "16":
warningTypeEs = "105";
break;
case "17":
warningTypeEs = "14";
break;
case "18":
warningTypeEs = "109";
break;
default:
warningTypeEs = "0";
break;
}
return warningTypeEs;
}
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* -Linux
*/
@Data
public class TyTowerLinuxRoundReqVO {
/** 设备ID */
@NotNull
private Integer eid;
/** 开始高度 */
private Float start_height;
/** 开始幅度 */
private Float start_range;
/** 开始回转角度 */
private Float start_rotation_angle;
/** 结束高度 */
private Float end_height;
/** 结束幅度 */
private Float end_range;
/** 结束回转角度 */
private Float end_rotation_angle;
/** 重量 */
private Float weight;
/** 力矩百分比 */
private Float moment_percent;
/** 开始时间 */
private String start_time;
/** 结束时间 */
private String end_time;
}

View File

@ -0,0 +1,36 @@
package com.ruoyi.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* -Linux
*/
@Data
public class TyTowerLinuxRunReqVO {
/** 设备ID */
@NotNull
private Integer eid;
/** 高度(米) */
private Float height;
/** 重量(kg) */
private Float weight;
/** 回转(°) */
private Float round;
/** 幅度(°) */
private Float amplitude;
/** 风速(米/秒) */
private Float wind_speed;
/** 力矩 */
private Float moment;
/** 力矩百分比(%) */
private Float moment_percent;
/** 倍率(正整数) */
private Integer override;
/** 倾角X(°) */
private Float angle_x;
/** 倾角Y(°) */
private Float angle_y;
}

View File

@ -0,0 +1,39 @@
package com.ruoyi.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* -Linux
*/
@Data
public class TyTowerLinuxWarningReqVO {
/** 设备ID */
@NotNull
private Integer eid;
/** 高度 */
private Float height;
/** 重量 */
private Float weight;
/** 回转 */
private Float round;
/** 幅度 */
private Float amplitude;
/** 风速 */
private Float wind_speed;
/** 力矩 */
private Float moment;
/** 力矩百分比 */
private Float moment_percent;
/** 倍率 */
private Integer override;
/** 倾角X */
private Float angle_x;
/** 倾角Y */
private Float angle_y;
/** 报警type,报警内容由报警编号决定 */
private Integer alarm_type;
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* -Android
*/
@Data
public class TyTowerRoundReqVO {
/** 设备ID */
@NotNull
private Integer eid;
/** 开始高度 */
private Float start_height;
/** 开始幅度 */
private Float start_range;
/** 开始回转角度 */
private Float start_rotation_angle;
/** 结束高度 */
private Float end_height;
/** 结束幅度 */
private Float end_range;
/** 结束回转角度 */
private Float end_rotation_angle;
/** 重量 */
private Float weight;
/** 力矩百分比 */
private Float moment_percent;
/** 开始时间 */
private String start_time;
/** 结束时间 */
private String end_time;
}

View File

@ -0,0 +1,36 @@
package com.ruoyi.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* -Android
*/
@Data
public class TyTowerRunReqVO {
/** 设备ID */
@NotNull
private Integer eid;
/** 高度 */
private Float height;
/** 幅度 */
private Float range;
/** 回转角度 */
private Float rotation_angle;
/** 吊重 */
private Float lifting_weight;
/** 力距 */
private Float force;
/** 力距百分比 */
private Float force_distance;
/** 风速 */
private Float wind_speed;
/** 倍率 */
private String magnification;
/** 倾角X */
private Float anteversion_x;
/** 倾角Y */
private Float anteversion_y;
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* -Android
*/
@Data
public class TyTowerWarningReqVO {
/** 设备ID */
@NotNull
private Integer eid;
/** 报警内容 */
private String type;
/** 报警编号 */
private Integer type_id;
/** 高度 */
private Float height;
/** 幅度 */
private Float range;
/** 回转角度 */
private Float rotation;
/** 吊重 */
private Float lifting_weight;
/** 力距 */
private Float force;
/** 力距百分比 */
private Float force_distance;
/** 风速 */
private Float wind_speed;
/** 倍率 */
private String magnification;
/** 倾角X */
private Float anteversion_x;
/** 倾角Y */
private Float anteversion_y;
}

View File

@ -0,0 +1,228 @@
package com.yanzhu.jh.device.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.ApiConstants;
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.enums.ShiFouEnum;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.yanzhu.jh.device.domain.DevIotConfig;
import com.yanzhu.jh.device.domain.DevIotConfigPoint;
import com.yanzhu.jh.device.service.IDevIotConfigPointService;
import com.yanzhu.jh.device.service.IDevIotConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Controller
*
* @author yanzhu
* @date 2025-04-04
*/
@RestController
@RequestMapping("/device/iotConfig")
public class DevIotConfigController extends BaseController
{
@Autowired
private IDevIotConfigService devIotConfigService;
@Autowired
private IDevIotConfigPointService devIotConfigPointService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfig:list')")
@GetMapping("/list")
public TableDataInfo list(DevIotConfig devIotConfig)
{
startPage();
List<DevIotConfig> list = devIotConfigService.selectDevIotConfigList(devIotConfig);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfig:export')")
@Log(title = "配电箱配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DevIotConfig devIotConfig)
{
List<DevIotConfig> list = devIotConfigService.selectDevIotConfigList(devIotConfig);
ExcelUtil<DevIotConfig> util = new ExcelUtil<DevIotConfig>(DevIotConfig.class);
util.exportExcel(response, list, "配电箱配置数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfig:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(devIotConfigService.selectDevIotConfigById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfig:add')")
@Log(title = "配电箱配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DevIotConfig devIotConfig)
{
int res = devIotConfigService.insertDevIotConfig(devIotConfig);
if(res>0){
return success(devIotConfig);
}else{
return error();
}
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfig:edit')")
@Log(title = "配电箱配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DevIotConfig devIotConfig)
{
return toAjax(devIotConfigService.updateDevIotConfig(devIotConfig));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfig:remove')")
@Log(title = "配电箱配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(devIotConfigService.deleteDevIotConfigByIds(ids));
}
/**
*
* @return
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfig:query')")
@GetMapping(value = "/findIotConfigPoint/{id}")
public AjaxResult findIotConfigPoint(@PathVariable("id") Long id) {
DevIotConfig devIotConfig = devIotConfigService.selectDevIotConfigById(id);
String projectHashId = getSaDaProjectHashIds(devIotConfig.getSignalName(),devIotConfig.getSignalCode(), devIotConfig.getProjectName());
if(StringUtils.isNotEmpty(projectHashId)){
devIotConfig.setIsDel(ShiFouEnum.FOU.getCode());
devIotConfigService.updateDevIotConfig(devIotConfig);
// 根据项目主键,查询设备信息
findSaDaBoxByProjectHashId(devIotConfig,projectHashId);
return success();
}else{
return error();
}
}
/**
* HashIds
* @param signalName
* @param signalCode
* @param proName
* @return
*/
private static String getSaDaProjectHashIds(String signalName, String signalCode, String proName){
try {
Map<String, Object> params = new HashMap<>();
params.put("username",signalName);
params.put("password",signalCode);
String resStr = HttpUtils.sendPost(ApiConstants.IOT_SD_HOST+"/v2/api-token-auth", JSON.toJSONString(params));
JSONObject result = JSONObject.parseObject(resStr).getJSONObject("result");
JSONObject accountJson = result.getJSONObject("account");
if(StringUtils.isNotEmpty(accountJson.getString("canViewProjects"))){
JSONArray canProjects = accountJson.getJSONArray("canViewProjects");
if(canProjects.size()>0){
// 使用 forEach 和 Lambda 遍历
for(Object item:canProjects){
JSONObject obj = (JSONObject) item;
if(StringUtils.eqObj(obj.getString("name"),proName)){
return obj.getString("hashId");
}
}
return accountJson.getJSONObject("currentProject").getString("hashId");
}else{
return accountJson.getJSONObject("currentProject").getString("hashId");
}
}else{
return accountJson.getJSONObject("currentProject").getString("hashId");
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
/**
*
* @param devIotConfig
* @param proHashId
*/
private void findSaDaBoxByProjectHashId(DevIotConfig devIotConfig, String proHashId){
try {
String resStr = HttpUtils.sendGet(ApiConstants.IOT_SD_HOST+"/box/project/"+proHashId);
JSONArray result = JSONObject.parseObject(resStr).getJSONArray("result");
if(result.size()>0){
DevIotConfigPoint pointQuery = new DevIotConfigPoint();
pointQuery.setCfgId(devIotConfig.getId());
List<DevIotConfigPoint> pointList = devIotConfigPointService.selectDevIotConfigPointList(pointQuery);
result.forEach(item -> {
JSONObject obj = (JSONObject) item;
List<DevIotConfigPoint> pointItems = pointList.stream().filter(point -> StringUtils.eqObj(point.getDeviceSn(),obj.getString("hashId"))).collect(Collectors.toList());
if(pointItems.size()>0){
DevIotConfigPoint devIotConfigPoint = pointItems.get(0);
devIotConfigPoint.setDeviceName(obj.getString("name"));
devIotConfigPoint.setFactoryName(devIotConfig.getFactoryName());
devIotConfigPoint.setLevels(obj.getString("level"));
devIotConfigPoint.setLeakageCurrent(obj.getString("leakageCurrent"));
devIotConfigPoint.setRatedTemperature(obj.getString("ratedTemperature"));
devIotConfigPoint.setShortCircuitCurrent(obj.getString("shortCircuitCurrent"));
devIotConfigPoint.setRatedCurrent(obj.getString("ratedCurrent"));
devIotConfigPoint.setRatedVoltage(obj.getString("ratedVoltage"));
devIotConfigPoint.setOnlineStatus(obj.getJSONObject("device").getString("onlineStatus"));
devIotConfigPointService.updateDevIotConfigPoint(devIotConfigPoint);
}else{
DevIotConfigPoint devIotConfigPoint = new DevIotConfigPoint();
devIotConfigPoint.setCfgId(devIotConfig.getId());
devIotConfigPoint.setComId(devIotConfig.getComId());
devIotConfigPoint.setProjectId(devIotConfig.getProjectId());
devIotConfigPoint.setDeviceSn(obj.getString("hashId"));
devIotConfigPoint.setDeviceName(obj.getString("name"));
devIotConfigPoint.setFactoryName(devIotConfig.getFactoryName());
devIotConfigPoint.setLevels(obj.getString("level"));
devIotConfigPoint.setLeakageCurrent(obj.getString("leakageCurrent"));
devIotConfigPoint.setRatedTemperature(obj.getString("ratedTemperature"));
devIotConfigPoint.setShortCircuitCurrent(obj.getString("shortCircuitCurrent"));
devIotConfigPoint.setRatedCurrent(obj.getString("ratedCurrent"));
devIotConfigPoint.setRatedVoltage(obj.getString("ratedVoltage"));
devIotConfigPoint.setOnlineStatus(obj.getJSONObject("device").getString("onlineStatus"));
devIotConfigPointService.insertDevIotConfigPoint(devIotConfigPoint);
}
});
}
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,113 @@
package com.yanzhu.jh.device.controller;
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.enums.ShiFouEnum;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.yanzhu.jh.device.domain.DevIotConfigPoint;
import com.yanzhu.jh.device.service.IDevIotConfigPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author yanzhu
* @date 2025-04-04
*/
@RestController
@RequestMapping("/device/iotConfigPoint")
public class DevIotConfigPointController extends BaseController
{
@Autowired
private IDevIotConfigPointService devIotConfigPointService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfigPoint:list')")
@GetMapping("/list")
public TableDataInfo list(DevIotConfigPoint devIotConfigPoint)
{
startPage();
List<DevIotConfigPoint> list = devIotConfigPointService.selectDevIotConfigPointList(devIotConfigPoint);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfigPoint:export')")
@Log(title = "配电箱配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DevIotConfigPoint devIotConfigPoint)
{
List<DevIotConfigPoint> list = devIotConfigPointService.selectDevIotConfigPointList(devIotConfigPoint);
ExcelUtil<DevIotConfigPoint> util = new ExcelUtil<DevIotConfigPoint>(DevIotConfigPoint.class);
util.exportExcel(response, list, "配电箱配置数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfigPoint:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(devIotConfigPointService.selectDevIotConfigPointById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfigPoint:add')")
@Log(title = "配电箱配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DevIotConfigPoint devIotConfigPoint)
{
return toAjax(devIotConfigPointService.insertDevIotConfigPoint(devIotConfigPoint));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfigPoint:edit')")
@Log(title = "配电箱配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DevIotConfigPoint devIotConfigPoint)
{
return toAjax(devIotConfigPointService.updateDevIotConfigPoint(devIotConfigPoint));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotConfigPoint:remove')")
@Log(title = "配电箱配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(devIotConfigPointService.deleteDevIotConfigPointByIds(ids));
}
/**
*
*/
@GetMapping("/findProAllConfigPoint/{proId}")
public AjaxResult findProAllConfigPoint(@PathVariable("proId") Long proId)
{
DevIotConfigPoint configPointQuery = new DevIotConfigPoint();
configPointQuery.setProjectId(proId);
configPointQuery.setIsDel(ShiFouEnum.FOU.getCode());
List<DevIotConfigPoint> list = devIotConfigPointService.selectDevIotConfigPointList(configPointQuery);
return success(list);
}
}

View File

@ -0,0 +1,121 @@
package com.yanzhu.jh.device.controller;
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.yanzhu.jh.device.domain.DevIotDatas;
import com.yanzhu.jh.device.service.IDevIotDatasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Controller
*
* @author yanzhu
* @date 2025-04-04
*/
@RestController
@RequestMapping("/device/iotDatas")
public class DevIotDatasController extends BaseController
{
@Autowired
private IDevIotDatasService devIotDatasService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotDatas:list')")
@GetMapping("/list")
public TableDataInfo list(DevIotDatas devIotDatas)
{
startPage();
List<DevIotDatas> list = devIotDatasService.selectDevIotDatasList(devIotDatas);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotDatas:export')")
@Log(title = "配电箱数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DevIotDatas devIotDatas)
{
List<DevIotDatas> list = devIotDatasService.selectDevIotDatasList(devIotDatas);
ExcelUtil<DevIotDatas> util = new ExcelUtil<DevIotDatas>(DevIotDatas.class);
util.exportExcel(response, list, "配电箱数据数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotDatas:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(devIotDatasService.selectDevIotDatasById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotDatas:add')")
@Log(title = "配电箱数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DevIotDatas devIotDatas)
{
return toAjax(devIotDatasService.insertDevIotDatas(devIotDatas));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotDatas:edit')")
@Log(title = "配电箱数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DevIotDatas devIotDatas)
{
return toAjax(devIotDatasService.updateDevIotDatas(devIotDatas));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotDatas:remove')")
@Log(title = "配电箱数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(devIotDatasService.deleteDevIotDatasByIds(ids));
}
/**
*
*/
@GetMapping("/findIotDatasMonitor/{proId}")
public AjaxResult findProAllConfigPoint(@PathVariable("proId") Long proId, Long pointId, Integer date)
{
// 获取当前日期
LocalDate today = LocalDate.now();
// 获取最近${X}天的日期
LocalDate todayAgo = today.minusDays(date);
DevIotDatas datasQuery = new DevIotDatas();
datasQuery.setPointId(pointId);
datasQuery.setProjectId(proId);
Map<String, Object> params = new HashMap<>();
params.put("beginCreateTime",today);
params.put("endCreateTime",todayAgo);
List<DevIotDatas> list = devIotDatasService.selectDevIotDatasList(datasQuery);
return success(list);
}
}

View File

@ -0,0 +1,112 @@
package com.yanzhu.jh.device.controller;
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.yanzhu.jh.device.domain.DevIotWarning;
import com.yanzhu.jh.device.service.IDevIotWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author yanzhu
* @date 2025-04-04
*/
@RestController
@RequestMapping("/device/iotWarning")
public class DevIotWarningController extends BaseController
{
@Autowired
private IDevIotWarningService devIotWarningService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotWarning:list')")
@GetMapping("/list")
public TableDataInfo list(DevIotWarning devIotWarning)
{
startPage();
List<DevIotWarning> list = devIotWarningService.selectDevIotWarningList(devIotWarning);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotWarning:export')")
@Log(title = "配电箱预警", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DevIotWarning devIotWarning)
{
List<DevIotWarning> list = devIotWarningService.selectDevIotWarningList(devIotWarning);
ExcelUtil<DevIotWarning> util = new ExcelUtil<DevIotWarning>(DevIotWarning.class);
util.exportExcel(response, list, "配电箱预警数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotWarning:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(devIotWarningService.selectDevIotWarningById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotWarning:add')")
@Log(title = "配电箱预警", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DevIotWarning devIotWarning)
{
return toAjax(devIotWarningService.insertDevIotWarning(devIotWarning));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotWarning:edit')")
@Log(title = "配电箱预警", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DevIotWarning devIotWarning)
{
return toAjax(devIotWarningService.updateDevIotWarning(devIotWarning));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('manage:iotWarning:remove')")
@Log(title = "配电箱预警", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(devIotWarningService.deleteDevIotWarningByIds(ids));
}
/**
*
*/
@GetMapping("/findIotWarnings/{proId}")
public AjaxResult findIotWarnings(@PathVariable("proId") Long proId, Long pointId)
{
startPage(1,20);
DevIotWarning warningQuery = new DevIotWarning();
warningQuery.setPointId(pointId);
warningQuery.setProjectId(proId);
List<DevIotWarning> list = devIotWarningService.selectDevIotWarningList(warningQuery);
return success(list);
}
}

View File

@ -0,0 +1,148 @@
package com.yanzhu.jh.device.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* dev_iot_config
*
* @author yanzhu
* @date 2025-04-04
*/
public class DevIotConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 公司主键 */
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 通信账号 */
@Excel(name = "通信账号")
private String signalName;
/** 通信密码 */
@Excel(name = "通信密码")
private String signalCode;
/** 厂家名称 */
@Excel(name = "厂家名称")
private String factoryName;
/** 数据状态 */
@Excel(name = "数据状态")
private String isDel;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setComId(Long comId)
{
this.comId = comId;
}
public Long getComId()
{
return comId;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setSignalName(String signalName)
{
this.signalName = signalName;
}
public String getSignalName()
{
return signalName;
}
public void setSignalCode(String signalCode)
{
this.signalCode = signalCode;
}
public String getSignalCode()
{
return signalCode;
}
public void setFactoryName(String factoryName)
{
this.factoryName = factoryName;
}
public String getFactoryName()
{
return factoryName;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("signalName", getSignalName())
.append("signalCode", getSignalCode())
.append("factoryName", getFactoryName())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,288 @@
package com.yanzhu.jh.device.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* dev_iot_config_point
*
* @author yanzhu
* @date 2025-04-04
*/
public class DevIotConfigPoint extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 配置主键 */
@Excel(name = "配置主键")
private Long cfgId;
/** 公司主键 */
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 厂家名称 */
@Excel(name = "厂家名称")
private String factoryName;
/** 联系人 */
@Excel(name = "联系人")
private String contactPerson;
/** 联系人电话 */
@Excel(name = "联系人电话")
private String contactPersonPhone;
/** 配电箱等级 */
@Excel(name = "配电箱等级")
private String levels;
/** 漏电电流 */
@Excel(name = "漏电电流")
private String leakageCurrent;
/** 额定温度 */
@Excel(name = "额定温度")
private String ratedTemperature;
/** 短路电流 */
@Excel(name = "短路电流")
private String shortCircuitCurrent;
/** 额定电流 */
@Excel(name = "额定电流")
private String ratedCurrent;
/** 额定电压 */
@Excel(name = "额定电压")
private String ratedVoltage;
/** 在线状态 */
@Excel(name = "在线状态")
private String onlineStatus;
/** 数据状态 */
@Excel(name = "数据状态")
private String isDel;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setComId(Long comId)
{
this.comId = comId;
}
public Long getComId()
{
return comId;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setDeviceSn(String deviceSn)
{
this.deviceSn = deviceSn;
}
public String getDeviceSn()
{
return deviceSn;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setFactoryName(String factoryName)
{
this.factoryName = factoryName;
}
public String getFactoryName()
{
return factoryName;
}
public void setContactPerson(String contactPerson)
{
this.contactPerson = contactPerson;
}
public String getContactPerson()
{
return contactPerson;
}
public void setContactPersonPhone(String contactPersonPhone)
{
this.contactPersonPhone = contactPersonPhone;
}
public String getContactPersonPhone()
{
return contactPersonPhone;
}
public void setLevels(String levels)
{
this.levels = levels;
}
public String getLevels()
{
return levels;
}
public void setLeakageCurrent(String leakageCurrent)
{
this.leakageCurrent = leakageCurrent;
}
public String getLeakageCurrent()
{
return leakageCurrent;
}
public void setRatedTemperature(String ratedTemperature)
{
this.ratedTemperature = ratedTemperature;
}
public String getRatedTemperature()
{
return ratedTemperature;
}
public void setShortCircuitCurrent(String shortCircuitCurrent)
{
this.shortCircuitCurrent = shortCircuitCurrent;
}
public String getShortCircuitCurrent()
{
return shortCircuitCurrent;
}
public void setRatedCurrent(String ratedCurrent)
{
this.ratedCurrent = ratedCurrent;
}
public String getRatedCurrent()
{
return ratedCurrent;
}
public void setRatedVoltage(String ratedVoltage)
{
this.ratedVoltage = ratedVoltage;
}
public String getRatedVoltage()
{
return ratedVoltage;
}
public void setOnlineStatus(String onlineStatus)
{
this.onlineStatus = onlineStatus;
}
public String getOnlineStatus()
{
return onlineStatus;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("deviceSn", getDeviceSn())
.append("deviceName", getDeviceName())
.append("factoryName", getFactoryName())
.append("contactPerson", getContactPerson())
.append("contactPersonPhone", getContactPersonPhone())
.append("levels", getLevels())
.append("leakageCurrent", getLeakageCurrent())
.append("ratedTemperature", getRatedTemperature())
.append("shortCircuitCurrent", getShortCircuitCurrent())
.append("ratedCurrent", getRatedCurrent())
.append("ratedVoltage", getRatedVoltage())
.append("onlineStatus", getOnlineStatus())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,525 @@
package com.yanzhu.jh.device.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* dev_iot_datas
*
* @author yanzhu
* @date 2025-04-04
*/
public class DevIotDatas extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 配置主键 */
@Excel(name = "配置主键")
private Long cfgId;
/** 点位主键 */
@Excel(name = "点位主键")
private Long pointId;
/** 公司主键 */
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
/** 开关位_交流 */
@Excel(name = "开关位_交流")
private String switchesAc;
/** 开关位 */
@Excel(name = "开关位")
private String switchesSwitch;
/** 开关位状态 */
@Excel(name = "开关位状态")
private String switchesSwitches;
/** 开关位安装状态 */
@Excel(name = "开关位安装状态")
private String switchesSwitchstatus;
/** 温度检测数据 */
@Excel(name = "温度检测数据")
private String temperature;
/** 漏电检测数据 */
@Excel(name = "漏电检测数据")
private String leakage;
/** A相电压 */
@Excel(name = "A相电压")
private String voltageA;
/** B相电压 */
@Excel(name = "B相电压")
private String voltageB;
/** C相电压 */
@Excel(name = "C相电压")
private String voltageC;
/** A相与B相之间的电压 */
@Excel(name = "A相与B相之间的电压")
private String voltageAb;
/** B相与C相之间的电压 */
@Excel(name = "B相与C相之间的电压")
private String voltageBc;
/** C相与A相之间的电压 */
@Excel(name = "C相与A相之间的电压")
private String voltageCa;
/** A相电流 */
@Excel(name = "A相电流")
private String currentA;
/** B相电流 */
@Excel(name = "B相电流")
private String currentB;
/** C相电流 */
@Excel(name = "C相电流")
private String currentC;
/** A相功率 */
@Excel(name = "A相功率")
private String powerA;
/** B相功率 */
@Excel(name = "B相功率")
private String powerB;
/** C相功率 */
@Excel(name = "C相功率")
private String powerC;
/** A相累计能量 */
@Excel(name = "A相累计能量")
private String energyA;
/** B相累计能量 */
@Excel(name = "B相累计能量")
private String energyB;
/** C相累计能量 */
@Excel(name = "C相累计能量")
private String energyC;
/** A相功率因数 */
@Excel(name = "A相功率因数")
private String factorA;
/** B相功率因数 */
@Excel(name = "B相功率因数")
private String factorB;
/** C相功率因数 */
@Excel(name = "C相功率因数")
private String factorC;
/** A相频率 */
@Excel(name = "A相频率")
private String frequencyA;
/** B相频率 */
@Excel(name = "B相频率")
private String frequencyB;
/** C相频率 */
@Excel(name = "C相频率")
private String frequencyC;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setPointId(Long pointId)
{
this.pointId = pointId;
}
public Long getPointId()
{
return pointId;
}
public void setComId(Long comId)
{
this.comId = comId;
}
public Long getComId()
{
return comId;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setDeviceSn(String deviceSn)
{
this.deviceSn = deviceSn;
}
public String getDeviceSn()
{
return deviceSn;
}
public void setSwitchesAc(String switchesAc)
{
this.switchesAc = switchesAc;
}
public String getSwitchesAc()
{
return switchesAc;
}
public void setSwitchesSwitch(String switchesSwitch)
{
this.switchesSwitch = switchesSwitch;
}
public String getSwitchesSwitch()
{
return switchesSwitch;
}
public void setSwitchesSwitches(String switchesSwitches)
{
this.switchesSwitches = switchesSwitches;
}
public String getSwitchesSwitches()
{
return switchesSwitches;
}
public void setSwitchesSwitchstatus(String switchesSwitchstatus)
{
this.switchesSwitchstatus = switchesSwitchstatus;
}
public String getSwitchesSwitchstatus()
{
return switchesSwitchstatus;
}
public void setTemperature(String temperature)
{
this.temperature = temperature;
}
public String getTemperature()
{
return temperature;
}
public void setLeakage(String leakage)
{
this.leakage = leakage;
}
public String getLeakage()
{
return leakage;
}
public void setVoltageA(String voltageA)
{
this.voltageA = voltageA;
}
public String getVoltageA()
{
return voltageA;
}
public void setVoltageB(String voltageB)
{
this.voltageB = voltageB;
}
public String getVoltageB()
{
return voltageB;
}
public void setVoltageC(String voltageC)
{
this.voltageC = voltageC;
}
public String getVoltageC()
{
return voltageC;
}
public void setVoltageAb(String voltageAb)
{
this.voltageAb = voltageAb;
}
public String getVoltageAb()
{
return voltageAb;
}
public void setVoltageBc(String voltageBc)
{
this.voltageBc = voltageBc;
}
public String getVoltageBc()
{
return voltageBc;
}
public void setVoltageCa(String voltageCa)
{
this.voltageCa = voltageCa;
}
public String getVoltageCa()
{
return voltageCa;
}
public void setCurrentA(String currentA)
{
this.currentA = currentA;
}
public String getCurrentA()
{
return currentA;
}
public void setCurrentB(String currentB)
{
this.currentB = currentB;
}
public String getCurrentB()
{
return currentB;
}
public void setCurrentC(String currentC)
{
this.currentC = currentC;
}
public String getCurrentC()
{
return currentC;
}
public void setPowerA(String powerA)
{
this.powerA = powerA;
}
public String getPowerA()
{
return powerA;
}
public void setPowerB(String powerB)
{
this.powerB = powerB;
}
public String getPowerB()
{
return powerB;
}
public void setPowerC(String powerC)
{
this.powerC = powerC;
}
public String getPowerC()
{
return powerC;
}
public void setEnergyA(String energyA)
{
this.energyA = energyA;
}
public String getEnergyA()
{
return energyA;
}
public void setEnergyB(String energyB)
{
this.energyB = energyB;
}
public String getEnergyB()
{
return energyB;
}
public void setEnergyC(String energyC)
{
this.energyC = energyC;
}
public String getEnergyC()
{
return energyC;
}
public void setFactorA(String factorA)
{
this.factorA = factorA;
}
public String getFactorA()
{
return factorA;
}
public void setFactorB(String factorB)
{
this.factorB = factorB;
}
public String getFactorB()
{
return factorB;
}
public void setFactorC(String factorC)
{
this.factorC = factorC;
}
public String getFactorC()
{
return factorC;
}
public void setFrequencyA(String frequencyA)
{
this.frequencyA = frequencyA;
}
public String getFrequencyA()
{
return frequencyA;
}
public void setFrequencyB(String frequencyB)
{
this.frequencyB = frequencyB;
}
public String getFrequencyB()
{
return frequencyB;
}
public void setFrequencyC(String frequencyC)
{
this.frequencyC = frequencyC;
}
public String getFrequencyC()
{
return frequencyC;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("pointId", getPointId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("deviceSn", getDeviceSn())
.append("switchesAc", getSwitchesAc())
.append("switchesSwitch", getSwitchesSwitch())
.append("switchesSwitches", getSwitchesSwitches())
.append("switchesSwitchstatus", getSwitchesSwitchstatus())
.append("temperature", getTemperature())
.append("leakage", getLeakage())
.append("voltageA", getVoltageA())
.append("voltageB", getVoltageB())
.append("voltageC", getVoltageC())
.append("voltageAb", getVoltageAb())
.append("voltageBc", getVoltageBc())
.append("voltageCa", getVoltageCa())
.append("currentA", getCurrentA())
.append("currentB", getCurrentB())
.append("currentC", getCurrentC())
.append("powerA", getPowerA())
.append("powerB", getPowerB())
.append("powerC", getPowerC())
.append("energyA", getEnergyA())
.append("energyB", getEnergyB())
.append("energyC", getEnergyC())
.append("factorA", getFactorA())
.append("factorB", getFactorB())
.append("factorC", getFactorC())
.append("frequencyA", getFrequencyA())
.append("frequencyB", getFrequencyB())
.append("frequencyC", getFrequencyC())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,158 @@
package com.yanzhu.jh.device.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* dev_iot_warning
*
* @author yanzhu
* @date 2025-04-04
*/
public class DevIotWarning extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 配置主键 */
@Excel(name = "配置主键")
private Long cfgId;
/** 点位主键 */
@Excel(name = "点位主键")
private Long pointId;
/** 公司主键 */
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
/** 预警类型 */
@Excel(name = "预警类型")
private String warningType;
/** 预警内容 */
@Excel(name = "预警内容")
private String warningContent;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setPointId(Long pointId)
{
this.pointId = pointId;
}
public Long getPointId()
{
return pointId;
}
public void setComId(Long comId)
{
this.comId = comId;
}
public Long getComId()
{
return comId;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setDeviceSn(String deviceSn)
{
this.deviceSn = deviceSn;
}
public String getDeviceSn()
{
return deviceSn;
}
public void setWarningType(String warningType)
{
this.warningType = warningType;
}
public String getWarningType()
{
return warningType;
}
public void setWarningContent(String warningContent)
{
this.warningContent = warningContent;
}
public String getWarningContent()
{
return warningContent;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("pointId", getPointId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("deviceSn", getDeviceSn())
.append("warningType", getWarningType())
.append("warningContent", getWarningContent())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -59,13 +59,45 @@ public class DevTowerDataWarning extends BaseEntity
@Excel(name = "预警内容")
private String warnNote;
/** 预警值 */
@Excel(name = "预警值")
private String warnData;
/** 当前高度 */
@Excel(name = "当前高度")
private String height;
/** 实际值 */
@Excel(name = "实际值")
private String realData;
/** 当前幅度 */
@Excel(name = "当前幅度")
private String range;
/** 回转 */
@Excel(name = "回转")
private String rotation;
/** 当前吊重 */
@Excel(name = "当前吊重")
private String load;
/** 风速 */
@Excel(name = "风速")
private String windSpeed;
/** 水平倾角 */
@Excel(name = "水平倾角")
private String leanAngleX;
/** 垂直倾角 */
@Excel(name = "垂直倾角")
private String leanAngleY;
/** 力矩百分比 */
@Excel(name = "力矩百分比")
private String momentPercent;
/** 报警标识 */
@Excel(name = "报警标识")
private Long alarmed;
/** 倍率 */
@Excel(name = "倍率")
private String rate;
/** 是否有效 */
@Excel(name = "是否有效")
@ -161,24 +193,7 @@ public class DevTowerDataWarning extends BaseEntity
{
return warnNote;
}
public void setWarnData(String warnData)
{
this.warnData = warnData;
}
public String getWarnData()
{
return warnData;
}
public void setRealData(String realData)
{
this.realData = realData;
}
public String getRealData()
{
return realData;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
@ -205,6 +220,86 @@ public class DevTowerDataWarning extends BaseEntity
this.deptName = deptName;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getRange() {
return range;
}
public void setRange(String range) {
this.range = range;
}
public String getRotation() {
return rotation;
}
public void setRotation(String rotation) {
this.rotation = rotation;
}
public String getLoad() {
return load;
}
public void setLoad(String load) {
this.load = load;
}
public String getWindSpeed() {
return windSpeed;
}
public void setWindSpeed(String windSpeed) {
this.windSpeed = windSpeed;
}
public String getLeanAngleX() {
return leanAngleX;
}
public void setLeanAngleX(String leanAngleX) {
this.leanAngleX = leanAngleX;
}
public String getLeanAngleY() {
return leanAngleY;
}
public void setLeanAngleY(String leanAngleY) {
this.leanAngleY = leanAngleY;
}
public String getMomentPercent() {
return momentPercent;
}
public void setMomentPercent(String momentPercent) {
this.momentPercent = momentPercent;
}
public Long getAlarmed() {
return alarmed;
}
public void setAlarmed(Long alarmed) {
this.alarmed = alarmed;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -217,8 +312,6 @@ public class DevTowerDataWarning extends BaseEntity
.append("warnType", getWarnType())
.append("warnName", getWarnName())
.append("warnNote", getWarnNote())
.append("warnData", getWarnData())
.append("realData", getRealData())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.mapper;
import com.yanzhu.jh.device.domain.DevIotConfig;
import java.util.List;
/**
* Mapper
*
* @author yanzhu
* @date 2025-04-04
*/
public interface DevIotConfigMapper
{
/**
*
*
* @param id
* @return
*/
public DevIotConfig selectDevIotConfigById(Long id);
/**
*
*
* @param devIotConfig
* @return
*/
public List<DevIotConfig> selectDevIotConfigList(DevIotConfig devIotConfig);
/**
*
*
* @param devIotConfig
* @return
*/
public int insertDevIotConfig(DevIotConfig devIotConfig);
/**
*
*
* @param devIotConfig
* @return
*/
public int updateDevIotConfig(DevIotConfig devIotConfig);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotConfigById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotConfigByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.mapper;
import com.yanzhu.jh.device.domain.DevIotConfigPoint;
import java.util.List;
/**
* Mapper
*
* @author yanzhu
* @date 2025-04-04
*/
public interface DevIotConfigPointMapper
{
/**
*
*
* @param id
* @return
*/
public DevIotConfigPoint selectDevIotConfigPointById(Long id);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public List<DevIotConfigPoint> selectDevIotConfigPointList(DevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int insertDevIotConfigPoint(DevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int updateDevIotConfigPoint(DevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotConfigPointById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotConfigPointByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.mapper;
import com.yanzhu.jh.device.domain.DevIotDatas;
import java.util.List;
/**
* Mapper
*
* @author yanzhu
* @date 2025-04-04
*/
public interface DevIotDatasMapper
{
/**
*
*
* @param id
* @return
*/
public DevIotDatas selectDevIotDatasById(Long id);
/**
*
*
* @param devIotDatas
* @return
*/
public List<DevIotDatas> selectDevIotDatasList(DevIotDatas devIotDatas);
/**
*
*
* @param devIotDatas
* @return
*/
public int insertDevIotDatas(DevIotDatas devIotDatas);
/**
*
*
* @param devIotDatas
* @return
*/
public int updateDevIotDatas(DevIotDatas devIotDatas);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotDatasById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotDatasByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.mapper;
import com.yanzhu.jh.device.domain.DevIotWarning;
import java.util.List;
/**
* Mapper
*
* @author yanzhu
* @date 2025-04-04
*/
public interface DevIotWarningMapper
{
/**
*
*
* @param id
* @return
*/
public DevIotWarning selectDevIotWarningById(Long id);
/**
*
*
* @param devIotWarning
* @return
*/
public List<DevIotWarning> selectDevIotWarningList(DevIotWarning devIotWarning);
/**
*
*
* @param devIotWarning
* @return
*/
public int insertDevIotWarning(DevIotWarning devIotWarning);
/**
*
*
* @param devIotWarning
* @return
*/
public int updateDevIotWarning(DevIotWarning devIotWarning);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotWarningById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotWarningByIds(Long[] ids);
}

View File

@ -58,4 +58,20 @@ public interface DevTowerDataWarningMapper
* @return
*/
public int deleteDevTowerDataWarningByIds(Long[] ids);
/**
*
*
* @param devTowerDataWarning
* @return
*/
public int findWarningCountByDeviceKey(DevTowerDataWarning devTowerDataWarning);
/**
*
*
* @param devTowerDataWarning
* @return
*/
public int findOverloadWarningCountByDeviceKey(DevTowerDataWarning devTowerDataWarning);
}

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.service;
import com.yanzhu.jh.device.domain.DevIotConfigPoint;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
public interface IDevIotConfigPointService
{
/**
*
*
* @param id
* @return
*/
public DevIotConfigPoint selectDevIotConfigPointById(Long id);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public List<DevIotConfigPoint> selectDevIotConfigPointList(DevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int insertDevIotConfigPoint(DevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param devIotConfigPoint
* @return
*/
public int updateDevIotConfigPoint(DevIotConfigPoint devIotConfigPoint);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotConfigPointByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotConfigPointById(Long id);
}

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.service;
import com.yanzhu.jh.device.domain.DevIotConfig;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
public interface IDevIotConfigService
{
/**
*
*
* @param id
* @return
*/
public DevIotConfig selectDevIotConfigById(Long id);
/**
*
*
* @param devIotConfig
* @return
*/
public List<DevIotConfig> selectDevIotConfigList(DevIotConfig devIotConfig);
/**
*
*
* @param devIotConfig
* @return
*/
public int insertDevIotConfig(DevIotConfig devIotConfig);
/**
*
*
* @param devIotConfig
* @return
*/
public int updateDevIotConfig(DevIotConfig devIotConfig);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotConfigByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotConfigById(Long id);
}

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.service;
import com.yanzhu.jh.device.domain.DevIotDatas;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
public interface IDevIotDatasService
{
/**
*
*
* @param id
* @return
*/
public DevIotDatas selectDevIotDatasById(Long id);
/**
*
*
* @param devIotDatas
* @return
*/
public List<DevIotDatas> selectDevIotDatasList(DevIotDatas devIotDatas);
/**
*
*
* @param devIotDatas
* @return
*/
public int insertDevIotDatas(DevIotDatas devIotDatas);
/**
*
*
* @param devIotDatas
* @return
*/
public int updateDevIotDatas(DevIotDatas devIotDatas);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotDatasByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotDatasById(Long id);
}

View File

@ -0,0 +1,62 @@
package com.yanzhu.jh.device.service;
import com.yanzhu.jh.device.domain.DevIotWarning;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
public interface IDevIotWarningService
{
/**
*
*
* @param id
* @return
*/
public DevIotWarning selectDevIotWarningById(Long id);
/**
*
*
* @param devIotWarning
* @return
*/
public List<DevIotWarning> selectDevIotWarningList(DevIotWarning devIotWarning);
/**
*
*
* @param devIotWarning
* @return
*/
public int insertDevIotWarning(DevIotWarning devIotWarning);
/**
*
*
* @param devIotWarning
* @return
*/
public int updateDevIotWarning(DevIotWarning devIotWarning);
/**
*
*
* @param ids
* @return
*/
public int deleteDevIotWarningByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteDevIotWarningById(Long id);
}

View File

@ -0,0 +1,100 @@
package com.yanzhu.jh.device.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.yanzhu.jh.device.domain.DevIotConfigPoint;
import com.yanzhu.jh.device.mapper.DevIotConfigPointMapper;
import com.yanzhu.jh.device.service.IDevIotConfigPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
@Service
public class DevIotConfigPointServiceImpl implements IDevIotConfigPointService
{
@Autowired
private DevIotConfigPointMapper devIotConfigPointMapper;
/**
*
*
* @param id
* @return
*/
@Override
public DevIotConfigPoint selectDevIotConfigPointById(Long id)
{
return devIotConfigPointMapper.selectDevIotConfigPointById(id);
}
/**
*
*
* @param devIotConfigPoint
* @return
*/
@Override
public List<DevIotConfigPoint> selectDevIotConfigPointList(DevIotConfigPoint devIotConfigPoint)
{
return devIotConfigPointMapper.selectDevIotConfigPointList(devIotConfigPoint);
}
/**
*
*
* @param devIotConfigPoint
* @return
*/
@Override
public int insertDevIotConfigPoint(DevIotConfigPoint devIotConfigPoint)
{
devIotConfigPoint.setCreateBy(SecurityUtils.getUsername());
devIotConfigPoint.setCreateTime(DateUtils.getNowDate());
return devIotConfigPointMapper.insertDevIotConfigPoint(devIotConfigPoint);
}
/**
*
*
* @param devIotConfigPoint
* @return
*/
@Override
public int updateDevIotConfigPoint(DevIotConfigPoint devIotConfigPoint)
{
devIotConfigPoint.setUpdateBy(SecurityUtils.getUsername());
devIotConfigPoint.setUpdateTime(DateUtils.getNowDate());
return devIotConfigPointMapper.updateDevIotConfigPoint(devIotConfigPoint);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteDevIotConfigPointByIds(Long[] ids)
{
return devIotConfigPointMapper.deleteDevIotConfigPointByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteDevIotConfigPointById(Long id)
{
return devIotConfigPointMapper.deleteDevIotConfigPointById(id);
}
}

View File

@ -0,0 +1,130 @@
package com.yanzhu.jh.device.service.impl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.yanzhu.jh.device.domain.DevIotConfig;
import com.yanzhu.jh.device.mapper.DevIotConfigMapper;
import com.yanzhu.jh.device.service.IDevIotConfigService;
import com.yanzhu.jh.project.domain.SurProject;
import com.yanzhu.jh.project.mapper.SurProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
@Service
public class DevIotConfigServiceImpl implements IDevIotConfigService
{
@Autowired
private SurProjectMapper surProjectMapper;
@Autowired
private DevIotConfigMapper devIotConfigMapper;
/**
*
*
* @param id
* @return
*/
@Override
public DevIotConfig selectDevIotConfigById(Long id)
{
return devIotConfigMapper.selectDevIotConfigById(id);
}
/**
*
*
* @param devIotConfig
* @return
*/
@Override
public List<DevIotConfig> selectDevIotConfigList(DevIotConfig devIotConfig)
{
return devIotConfigMapper.selectDevIotConfigList(devIotConfig);
}
/**
*
*
* @param devIotConfig
* @return
*/
@Override
public int insertDevIotConfig(DevIotConfig devIotConfig)
{
// 判断设备是否重复
DevIotConfig configQuery = new DevIotConfig();
configQuery.setProjectId(devIotConfig.getProjectId());
configQuery.setSignalName(devIotConfig.getSignalName());
configQuery.setSignalCode(devIotConfig.getSignalCode());
List<DevIotConfig> list = devIotConfigMapper.selectDevIotConfigList(configQuery);
if(list.size()>0){
throw new ServiceException("配置信息重复添加!");
}
SurProject surProject = surProjectMapper.selectSurProjectById(devIotConfig.getProjectId());
devIotConfig.setComId(surProject.getDeptId());
devIotConfig.setIsDel("99");
devIotConfig.setCreateBy(SecurityUtils.getUsername());
devIotConfig.setCreateTime(DateUtils.getNowDate());
return devIotConfigMapper.insertDevIotConfig(devIotConfig);
}
/**
*
*
* @param devIotConfig
* @return
*/
@Override
public int updateDevIotConfig(DevIotConfig devIotConfig)
{
// 判断设备是否重复
if(StringUtils.isNotEmpty(devIotConfig.getSignalName()) && StringUtils.isNotEmpty(devIotConfig.getSignalCode())){
DevIotConfig configQuery = new DevIotConfig();
configQuery.setProjectId(devIotConfig.getProjectId());
configQuery.setSignalName(devIotConfig.getSignalName());
configQuery.setSignalCode(devIotConfig.getSignalCode());
List<DevIotConfig> list = devIotConfigMapper.selectDevIotConfigList(configQuery);
if(list.size()>0 && list.get(0).getId()!=devIotConfig.getId()){
throw new ServiceException("配置信息重复添加!");
}
}
devIotConfig.setUpdateBy(SecurityUtils.getUsername());
devIotConfig.setUpdateTime(DateUtils.getNowDate());
return devIotConfigMapper.updateDevIotConfig(devIotConfig);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteDevIotConfigByIds(Long[] ids)
{
return devIotConfigMapper.deleteDevIotConfigByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteDevIotConfigById(Long id)
{
return devIotConfigMapper.deleteDevIotConfigById(id);
}
}

View File

@ -0,0 +1,96 @@
package com.yanzhu.jh.device.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.yanzhu.jh.device.domain.DevIotDatas;
import com.yanzhu.jh.device.mapper.DevIotDatasMapper;
import com.yanzhu.jh.device.service.IDevIotDatasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
@Service
public class DevIotDatasServiceImpl implements IDevIotDatasService
{
@Autowired
private DevIotDatasMapper devIotDatasMapper;
/**
*
*
* @param id
* @return
*/
@Override
public DevIotDatas selectDevIotDatasById(Long id)
{
return devIotDatasMapper.selectDevIotDatasById(id);
}
/**
*
*
* @param devIotDatas
* @return
*/
@Override
public List<DevIotDatas> selectDevIotDatasList(DevIotDatas devIotDatas)
{
return devIotDatasMapper.selectDevIotDatasList(devIotDatas);
}
/**
*
*
* @param devIotDatas
* @return
*/
@Override
public int insertDevIotDatas(DevIotDatas devIotDatas)
{
devIotDatas.setCreateTime(DateUtils.getNowDate());
return devIotDatasMapper.insertDevIotDatas(devIotDatas);
}
/**
*
*
* @param devIotDatas
* @return
*/
@Override
public int updateDevIotDatas(DevIotDatas devIotDatas)
{
return devIotDatasMapper.updateDevIotDatas(devIotDatas);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteDevIotDatasByIds(Long[] ids)
{
return devIotDatasMapper.deleteDevIotDatasByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteDevIotDatasById(Long id)
{
return devIotDatasMapper.deleteDevIotDatasById(id);
}
}

View File

@ -0,0 +1,97 @@
package com.yanzhu.jh.device.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.yanzhu.jh.device.domain.DevIotWarning;
import com.yanzhu.jh.device.mapper.DevIotWarningMapper;
import com.yanzhu.jh.device.service.IDevIotWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author yanzhu
* @date 2025-04-04
*/
@Service
public class DevIotWarningServiceImpl implements IDevIotWarningService
{
@Autowired
private DevIotWarningMapper devIotWarningMapper;
/**
*
*
* @param id
* @return
*/
@Override
public DevIotWarning selectDevIotWarningById(Long id)
{
return devIotWarningMapper.selectDevIotWarningById(id);
}
/**
*
*
* @param devIotWarning
* @return
*/
@Override
public List<DevIotWarning> selectDevIotWarningList(DevIotWarning devIotWarning)
{
return devIotWarningMapper.selectDevIotWarningList(devIotWarning);
}
/**
*
*
* @param devIotWarning
* @return
*/
@Override
public int insertDevIotWarning(DevIotWarning devIotWarning)
{
devIotWarning.setCreateTime(DateUtils.getNowDate());
return devIotWarningMapper.insertDevIotWarning(devIotWarning);
}
/**
*
*
* @param devIotWarning
* @return
*/
@Override
public int updateDevIotWarning(DevIotWarning devIotWarning)
{
return devIotWarningMapper.updateDevIotWarning(devIotWarning);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteDevIotWarningByIds(Long[] ids)
{
return devIotWarningMapper.deleteDevIotWarningByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteDevIotWarningById(Long id)
{
return devIotWarningMapper.deleteDevIotWarningById(id);
}
}

View File

@ -5,8 +5,10 @@ import java.util.*;
import com.ruoyi.common.utils.DateUtils;
import com.yanzhu.jh.device.domain.DevTowerDataRound;
import com.yanzhu.jh.device.domain.DevTowerDataWarning;
import com.yanzhu.jh.device.mapper.DevTowerDataCollideMapper;
import com.yanzhu.jh.device.mapper.DevTowerDataRoundMapper;
import com.yanzhu.jh.device.mapper.DevTowerDataWarningMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.device.mapper.DevTowerDataRunMapper;
@ -31,6 +33,9 @@ public class DevTowerDataRunServiceImpl implements IDevTowerDataRunService
@Autowired
private DevTowerDataCollideMapper devTowerDataCollideMapper;
@Autowired
private DevTowerDataWarningMapper devTowerDataWarningMapper;
/**
*
*
@ -118,13 +123,11 @@ public class DevTowerDataRunServiceImpl implements IDevTowerDataRunService
devTowerDataRound.setDeviceKey(deviceSn);
int a0 = devTowerDataRoundMapper.findRoundCountByDeviceKey(devTowerDataRound);
dataMap.put("a0",a0);
devTowerDataRound.setActiveName("cz");
int b0 = devTowerDataRoundMapper.findRoundCountByDeviceKey(devTowerDataRound);
DevTowerDataWarning devTowerDataWarning = new DevTowerDataWarning();
devTowerDataWarning.setDeviceKey(deviceSn);
int b0 = devTowerDataWarningMapper.findOverloadWarningCountByDeviceKey(devTowerDataWarning);
dataMap.put("b0",b0);
devTowerDataRound.setActiveName("gj");
int c0 = devTowerDataRunMapper.findRunCountByDeviceKey(devTowerDataRound);
//int d0 = devTowerDataRoundMapper.findRoundCountByDeviceKey(devTowerDataRound);
//int e0 = devTowerDataCollideMapper.findCollideCountByDeviceKey(devTowerDataRound);
int c0 = devTowerDataWarningMapper.findWarningCountByDeviceKey(devTowerDataWarning);
dataMap.put("c0",c0);
Calendar cale = Calendar.getInstance();
// 获取当月第一天和最后一天
@ -145,15 +148,12 @@ public class DevTowerDataRunServiceImpl implements IDevTowerDataRunService
params.put("beginCreateTime",firstDay);
params.put("endCreateTime",lastDay);
devTowerDataRound.setParams(params);
devTowerDataWarning.setParams(params);
int a1 = devTowerDataRoundMapper.findRoundCountByDeviceKey(devTowerDataRound);
dataMap.put("a1",a1);
devTowerDataRound.setActiveName("cz");
int b1 = devTowerDataRoundMapper.findRoundCountByDeviceKey(devTowerDataRound);
int b1 = devTowerDataWarningMapper.findOverloadWarningCountByDeviceKey(devTowerDataWarning);
dataMap.put("b1",b1);
devTowerDataRound.setActiveName("gj");
int c1 = devTowerDataRunMapper.findRunCountByDeviceKey(devTowerDataRound);
//int d1 = devTowerDataRoundMapper.findRoundCountByDeviceKey(devTowerDataRound);
//int e1 = devTowerDataCollideMapper.findCollideCountByDeviceKey(devTowerDataRound);
int c1 = devTowerDataWarningMapper.findWarningCountByDeviceKey(devTowerDataWarning);
dataMap.put("c1",c1);
return dataMap;
}

View File

@ -122,13 +122,15 @@ PublicsController extends BaseController {
@GetMapping("/findMyProjectList")
public TableDataInfo findMyProjectList(SurProject surProject)
{
surProject.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(surProject.getNowRole())){
surProject.setNowDept(Convert.toStr(deptService.getZGSDeptId(getDeptId())));
}else{
surProject.setNowDept(Convert.toStr(getDeptId()));
if(SysUser.isAdmin(SecurityUtils.getUserId())){
surProject.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(surProject.getNowRole())){
surProject.setNowDept(Convert.toStr(deptService.getZGSDeptId(getDeptId())));
}else{
surProject.setNowDept(Convert.toStr(getDeptId()));
}
surProject.setNowUser(Convert.toStr(getUserId()));
}
surProject.setNowUser(Convert.toStr(getUserId()));
List<SurProject> list = surProjectService.selectSurProjectList(surProject);
return getDataTable(list);
}

View File

@ -0,0 +1,107 @@
<?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.yanzhu.jh.device.mapper.DevIotConfigMapper">
<resultMap type="DevIotConfig" id="DevIotConfigResult">
<result property="id" column="id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="signalName" column="signal_name" />
<result property="signalCode" column="signal_code" />
<result property="factoryName" column="factory_name" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectDevIotConfigVo">
select dic.id, dic.com_id, dic.project_id, sd.dept_name as com_name, pi.projectName as project_name, dic.signal_name, dic.signal_code, dic.factory_name, dic.is_del, dic.create_by, dic.create_time, dic.update_by, dic.update_time, dic.remark from dev_iot_config dic
left join sur_project pi on pi.id = dic.project_id
left join sys_dept sd on sd.dept_id = dic.com_id
</sql>
<select id="selectDevIotConfigList" parameterType="DevIotConfig" resultMap="DevIotConfigResult">
<include refid="selectDevIotConfigVo"/>
<where>
<if test="comId != null "> and dic.com_id = #{comId}</if>
<if test="projectId != null "> and dic.project_id = #{projectId}</if>
<if test="signalName != null and signalName != ''"> and dic.signal_name = #{signalName}</if>
<if test="signalCode != null and signalCode != ''"> and dic.signal_code = #{signalCode}</if>
<if test="factoryName != null and factoryName != ''"> and dic.factory_name = #{factoryName}</if>
<if test="isDel != null and isDel != ''"> and dic.is_del = #{isDel}</if>
and dic.is_del != '2'
</where>
order by dic.id desc
</select>
<select id="selectDevIotConfigById" parameterType="Long" resultMap="DevIotConfigResult">
<include refid="selectDevIotConfigVo"/>
where dic.id = #{id}
</select>
<insert id="insertDevIotConfig" parameterType="DevIotConfig" useGeneratedKeys="true" keyProperty="id">
insert into dev_iot_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="signalName != null">signal_name,</if>
<if test="signalCode != null">signal_code,</if>
<if test="factoryName != null">factory_name,</if>
<if test="isDel != null">is_del,</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>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="signalName != null">#{signalName},</if>
<if test="signalCode != null">#{signalCode},</if>
<if test="factoryName != null">#{factoryName},</if>
<if test="isDel != null">#{isDel},</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>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateDevIotConfig" parameterType="DevIotConfig">
update dev_iot_config
<trim prefix="SET" suffixOverrides=",">
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="signalName != null">signal_name = #{signalName},</if>
<if test="signalCode != null">signal_code = #{signalCode},</if>
<if test="factoryName != null">factory_name = #{factoryName},</if>
<if test="isDel != null">is_del = #{isDel},</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>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<update id="deleteDevIotConfigById" parameterType="Long">
update dev_iot_config set is_del = '2' where id = #{id}
</update>
<update id="deleteDevIotConfigByIds" parameterType="String">
update dev_iot_config set is_del = '2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,150 @@
<?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.yanzhu.jh.device.mapper.DevIotConfigPointMapper">
<resultMap type="DevIotConfigPoint" id="DevIotConfigPointResult">
<result property="id" column="id" />
<result property="cfgId" column="cfg_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="deviceSn" column="device_sn" />
<result property="deviceName" column="device_name" />
<result property="factoryName" column="factory_name" />
<result property="contactPerson" column="contact_person" />
<result property="contactPersonPhone" column="contact_person_phone" />
<result property="levels" column="levels" />
<result property="leakageCurrent" column="leakage_current" />
<result property="ratedTemperature" column="rated_temperature" />
<result property="shortCircuitCurrent" column="short_circuit_current" />
<result property="ratedCurrent" column="rated_current" />
<result property="ratedVoltage" column="rated_voltage" />
<result property="onlineStatus" column="online_status" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectDevIotConfigPointVo">
select dicp.id, dicp.cfg_id, dicp.com_id, dicp.project_id, sd.dept_name as com_name, pi.projectName as project_name, dicp.device_sn, dicp.device_name, dicp.factory_name, dicp.contact_person, dicp.contact_person_phone, dicp.levels, dicp.leakage_current, dicp.rated_temperature,
dicp.short_circuit_current, dicp.rated_current, dicp.rated_voltage, dicp.online_status, dicp.is_del, dicp.create_by, dicp.create_time, dicp.update_by, dicp.update_time, dicp.remark from dev_iot_config_point dicp
left join sur_project pi on pi.id = dicp.project_id
left join sys_dept sd on sd.dept_id = dicp.com_id
</sql>
<select id="selectDevIotConfigPointList" parameterType="DevIotConfigPoint" resultMap="DevIotConfigPointResult">
<include refid="selectDevIotConfigPointVo"/>
<where>
<if test="cfgId != null "> and dicp.cfg_id = #{cfgId}</if>
<if test="comId != null "> and dicp.com_id = #{comId}</if>
<if test="projectId != null "> and dicp.project_id = #{projectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and dicp.device_sn = #{deviceSn}</if>
<if test="deviceName != null and deviceName != ''"> and dicp.device_name like concat('%', #{deviceName}, '%')</if>
<if test="factoryName != null and factoryName != ''"> and dicp.factory_name = #{factoryName}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and dicp.online_status = #{onlineStatus}</if>
<if test="isDel != null and isDel != ''"> and dicp.is_del = #{isDel}</if>
and dicp.is_del != '2'
</where>
order by dicp.id desc
</select>
<select id="selectDevIotConfigPointById" parameterType="Long" resultMap="DevIotConfigPointResult">
<include refid="selectDevIotConfigPointVo"/>
where dicp.id = #{id}
</select>
<insert id="insertDevIotConfigPoint" parameterType="DevIotConfigPoint" useGeneratedKeys="true" keyProperty="id">
insert into dev_iot_config_point
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cfgId != null">cfg_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="deviceSn != null">device_sn,</if>
<if test="deviceName != null">device_name,</if>
<if test="factoryName != null">factory_name,</if>
<if test="contactPerson != null">contact_person,</if>
<if test="contactPersonPhone != null">contact_person_phone,</if>
<if test="levels != null">levels,</if>
<if test="leakageCurrent != null">leakage_current,</if>
<if test="ratedTemperature != null">rated_temperature,</if>
<if test="shortCircuitCurrent != null">short_circuit_current,</if>
<if test="ratedCurrent != null">rated_current,</if>
<if test="ratedVoltage != null">rated_voltage,</if>
<if test="onlineStatus != null">online_status,</if>
<if test="isDel != null">is_del,</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>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cfgId != null">#{cfgId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="deviceSn != null">#{deviceSn},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="factoryName != null">#{factoryName},</if>
<if test="contactPerson != null">#{contactPerson},</if>
<if test="contactPersonPhone != null">#{contactPersonPhone},</if>
<if test="levels != null">#{levels},</if>
<if test="leakageCurrent != null">#{leakageCurrent},</if>
<if test="ratedTemperature != null">#{ratedTemperature},</if>
<if test="shortCircuitCurrent != null">#{shortCircuitCurrent},</if>
<if test="ratedCurrent != null">#{ratedCurrent},</if>
<if test="ratedVoltage != null">#{ratedVoltage},</if>
<if test="onlineStatus != null">#{onlineStatus},</if>
<if test="isDel != null">#{isDel},</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>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateDevIotConfigPoint" parameterType="DevIotConfigPoint">
update dev_iot_config_point
<trim prefix="SET" suffixOverrides=",">
<if test="cfgId != null">cfg_id = #{cfgId},</if>
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="deviceSn != null">device_sn = #{deviceSn},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="factoryName != null">factory_name = #{factoryName},</if>
<if test="contactPerson != null">contact_person = #{contactPerson},</if>
<if test="contactPersonPhone != null">contact_person_phone = #{contactPersonPhone},</if>
<if test="levels != null">levels = #{levels},</if>
<if test="leakageCurrent != null">leakage_current = #{leakageCurrent},</if>
<if test="ratedTemperature != null">rated_temperature = #{ratedTemperature},</if>
<if test="shortCircuitCurrent != null">short_circuit_current = #{shortCircuitCurrent},</if>
<if test="ratedCurrent != null">rated_current = #{ratedCurrent},</if>
<if test="ratedVoltage != null">rated_voltage = #{ratedVoltage},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
<if test="isDel != null">is_del = #{isDel},</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>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<update id="deleteDevIotConfigPointById" parameterType="Long">
update dev_iot_config_point set is_del = '2' where id = #{id}
</update>
<update id="deleteDevIotConfigPointByIds" parameterType="String">
update dev_iot_config_point set is_del = '2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,195 @@
<?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.yanzhu.jh.device.mapper.DevIotDatasMapper">
<resultMap type="DevIotDatas" id="DevIotDatasResult">
<result property="id" column="id" />
<result property="cfgId" column="cfg_id" />
<result property="pointId" column="point_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="deviceSn" column="device_sn" />
<result property="switchesAc" column="switches_ac" />
<result property="switchesSwitch" column="switches_switch" />
<result property="switchesSwitches" column="switches_switches" />
<result property="switchesSwitchstatus" column="switches_switchStatus" />
<result property="temperature" column="temperature" />
<result property="leakage" column="leakage" />
<result property="voltageA" column="voltage_a" />
<result property="voltageB" column="voltage_b" />
<result property="voltageC" column="voltage_c" />
<result property="voltageAb" column="voltage_ab" />
<result property="voltageBc" column="voltage_bc" />
<result property="voltageCa" column="voltage_ca" />
<result property="currentA" column="current_a" />
<result property="currentB" column="current_b" />
<result property="currentC" column="current_c" />
<result property="powerA" column="power_a" />
<result property="powerB" column="power_b" />
<result property="powerC" column="power_c" />
<result property="energyA" column="energy_a" />
<result property="energyB" column="energy_b" />
<result property="energyC" column="energy_c" />
<result property="factorA" column="factor_a" />
<result property="factorB" column="factor_b" />
<result property="factorC" column="factor_c" />
<result property="frequencyA" column="frequency_a" />
<result property="frequencyB" column="frequency_b" />
<result property="frequencyC" column="frequency_c" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectDevIotDatasVo">
select did.id, did.cfg_id, did.point_id, did.com_id, did.project_id, sd.dept_name as com_name, pi.projectName as project_name, did.device_sn, did.switches_ac, did.switches_switch, did.switches_switches, did.switches_switchStatus, did.temperature, did.leakage, did.voltage_a, did.voltage_b, did.voltage_c, did.voltage_ab, did.voltage_bc, did.voltage_ca, did.current_a, did.current_b, did.current_c, did.power_a, power_b, power_c,
did.energy_a, did.energy_b, did.energy_c, did.factor_a, did.factor_b, did.factor_c, did.frequency_a, did.frequency_b, did.frequency_c, did.create_time from dev_iot_datas did
left join sur_project pi on pi.id = did.project_id
left join sys_dept sd on sd.dept_id = did.com_id
</sql>
<select id="selectDevIotDatasList" parameterType="DevIotDatas" resultMap="DevIotDatasResult">
<include refid="selectDevIotDatasVo"/>
<where>
<if test="cfgId != null "> and did.cfg_id = #{cfgId}</if>
<if test="pointId != null "> and did.point_id = #{pointId}</if>
<if test="comId != null "> and did.com_id = #{comId}</if>
<if test="projectId != null "> and did.project_id = #{projectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and did.device_sn = #{deviceSn}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and did.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
order by did.id desc
</select>
<select id="selectDevIotDatasById" parameterType="Long" resultMap="DevIotDatasResult">
<include refid="selectDevIotDatasVo"/>
where did.id = #{id}
</select>
<insert id="insertDevIotDatas" parameterType="DevIotDatas" useGeneratedKeys="true" keyProperty="id">
insert into dev_iot_datas
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cfgId != null">cfg_id,</if>
<if test="pointId != null">point_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="deviceSn != null">device_sn,</if>
<if test="switchesAc != null">switches_ac,</if>
<if test="switchesSwitch != null">switches_switch,</if>
<if test="switchesSwitches != null">switches_switches,</if>
<if test="switchesSwitchstatus != null">switches_switchStatus,</if>
<if test="temperature != null">temperature,</if>
<if test="leakage != null">leakage,</if>
<if test="voltageA != null">voltage_a,</if>
<if test="voltageB != null">voltage_b,</if>
<if test="voltageC != null">voltage_c,</if>
<if test="voltageAb != null">voltage_ab,</if>
<if test="voltageBc != null">voltage_bc,</if>
<if test="voltageCa != null">voltage_ca,</if>
<if test="currentA != null">current_a,</if>
<if test="currentB != null">current_b,</if>
<if test="currentC != null">current_c,</if>
<if test="powerA != null">power_a,</if>
<if test="powerB != null">power_b,</if>
<if test="powerC != null">power_c,</if>
<if test="energyA != null">energy_a,</if>
<if test="energyB != null">energy_b,</if>
<if test="energyC != null">energy_c,</if>
<if test="factorA != null">factor_a,</if>
<if test="factorB != null">factor_b,</if>
<if test="factorC != null">factor_c,</if>
<if test="frequencyA != null">frequency_a,</if>
<if test="frequencyB != null">frequency_b,</if>
<if test="frequencyC != null">frequency_c,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cfgId != null">#{cfgId},</if>
<if test="pointId != null">#{pointId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="deviceSn != null">#{deviceSn},</if>
<if test="switchesAc != null">#{switchesAc},</if>
<if test="switchesSwitch != null">#{switchesSwitch},</if>
<if test="switchesSwitches != null">#{switchesSwitches},</if>
<if test="switchesSwitchstatus != null">#{switchesSwitchstatus},</if>
<if test="temperature != null">#{temperature},</if>
<if test="leakage != null">#{leakage},</if>
<if test="voltageA != null">#{voltageA},</if>
<if test="voltageB != null">#{voltageB},</if>
<if test="voltageC != null">#{voltageC},</if>
<if test="voltageAb != null">#{voltageAb},</if>
<if test="voltageBc != null">#{voltageBc},</if>
<if test="voltageCa != null">#{voltageCa},</if>
<if test="currentA != null">#{currentA},</if>
<if test="currentB != null">#{currentB},</if>
<if test="currentC != null">#{currentC},</if>
<if test="powerA != null">#{powerA},</if>
<if test="powerB != null">#{powerB},</if>
<if test="powerC != null">#{powerC},</if>
<if test="energyA != null">#{energyA},</if>
<if test="energyB != null">#{energyB},</if>
<if test="energyC != null">#{energyC},</if>
<if test="factorA != null">#{factorA},</if>
<if test="factorB != null">#{factorB},</if>
<if test="factorC != null">#{factorC},</if>
<if test="frequencyA != null">#{frequencyA},</if>
<if test="frequencyB != null">#{frequencyB},</if>
<if test="frequencyC != null">#{frequencyC},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDevIotDatas" parameterType="DevIotDatas">
update dev_iot_datas
<trim prefix="SET" suffixOverrides=",">
<if test="cfgId != null">cfg_id = #{cfgId},</if>
<if test="pointId != null">point_id = #{pointId},</if>
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="deviceSn != null">device_sn = #{deviceSn},</if>
<if test="switchesAc != null">switches_ac = #{switchesAc},</if>
<if test="switchesSwitch != null">switches_switch = #{switchesSwitch},</if>
<if test="switchesSwitches != null">switches_switches = #{switchesSwitches},</if>
<if test="switchesSwitchstatus != null">switches_switchStatus = #{switchesSwitchstatus},</if>
<if test="temperature != null">temperature = #{temperature},</if>
<if test="leakage != null">leakage = #{leakage},</if>
<if test="voltageA != null">voltage_a = #{voltageA},</if>
<if test="voltageB != null">voltage_b = #{voltageB},</if>
<if test="voltageC != null">voltage_c = #{voltageC},</if>
<if test="voltageAb != null">voltage_ab = #{voltageAb},</if>
<if test="voltageBc != null">voltage_bc = #{voltageBc},</if>
<if test="voltageCa != null">voltage_ca = #{voltageCa},</if>
<if test="currentA != null">current_a = #{currentA},</if>
<if test="currentB != null">current_b = #{currentB},</if>
<if test="currentC != null">current_c = #{currentC},</if>
<if test="powerA != null">power_a = #{powerA},</if>
<if test="powerB != null">power_b = #{powerB},</if>
<if test="powerC != null">power_c = #{powerC},</if>
<if test="energyA != null">energy_a = #{energyA},</if>
<if test="energyB != null">energy_b = #{energyB},</if>
<if test="energyC != null">energy_c = #{energyC},</if>
<if test="factorA != null">factor_a = #{factorA},</if>
<if test="factorB != null">factor_b = #{factorB},</if>
<if test="factorC != null">factor_c = #{factorC},</if>
<if test="frequencyA != null">frequency_a = #{frequencyA},</if>
<if test="frequencyB != null">frequency_b = #{frequencyB},</if>
<if test="frequencyC != null">frequency_c = #{frequencyC},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDevIotDatasById" parameterType="Long">
delete from dev_iot_datas where id = #{id}
</delete>
<delete id="deleteDevIotDatasByIds" parameterType="String">
delete from dev_iot_datas where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,96 @@
<?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.yanzhu.jh.device.mapper.DevIotWarningMapper">
<resultMap type="DevIotWarning" id="DevIotWarningResult">
<result property="id" column="id" />
<result property="cfgId" column="cfg_id" />
<result property="pointId" column="point_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="deviceSn" column="device_sn" />
<result property="warningType" column="warning_type" />
<result property="warningContent" column="warning_content" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectDevIotWarningVo">
select diw.id, diw.cfg_id, diw.point_id, diw.com_id, diw.project_id, sd.dept_name as com_name, pi.projectName as project_name, diw.device_sn, diw.warning_type, diw.warning_content, diw.create_time from dev_iot_warning diw
left join sur_project pi on pi.id = diw.project_id
left join sys_dept sd on sd.dept_id = diw.com_id
</sql>
<select id="selectDevIotWarningList" parameterType="DevIotWarning" resultMap="DevIotWarningResult">
<include refid="selectDevIotWarningVo"/>
<where>
<if test="cfgId != null "> and diw.cfg_id = #{cfgId}</if>
<if test="pointId != null "> and diw.point_id = #{pointId}</if>
<if test="comId != null "> and diw.com_id = #{comId}</if>
<if test="projectId != null "> and diw.project_id = #{projectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and diw.device_sn = #{deviceSn}</if>
<if test="warningType != null and warningType != ''"> and diw.warning_type = #{warningType}</if>
<if test="warningContent != null and warningContent != ''"> and diw.warning_content = #{warningContent}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and diw.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
order by diw.id desc
</select>
<select id="selectDevIotWarningById" parameterType="Long" resultMap="DevIotWarningResult">
<include refid="selectDevIotWarningVo"/>
where diw.id = #{id}
</select>
<insert id="insertDevIotWarning" parameterType="DevIotWarning" useGeneratedKeys="true" keyProperty="id">
insert into dev_iot_warning
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cfgId != null">cfg_id,</if>
<if test="pointId != null">point_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="deviceSn != null">device_sn,</if>
<if test="warningType != null">warning_type,</if>
<if test="warningContent != null">warning_content,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cfgId != null">#{cfgId},</if>
<if test="pointId != null">#{pointId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="deviceSn != null">#{deviceSn},</if>
<if test="warningType != null">#{warningType},</if>
<if test="warningContent != null">#{warningContent},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDevIotWarning" parameterType="DevIotWarning">
update dev_iot_warning
<trim prefix="SET" suffixOverrides=",">
<if test="cfgId != null">cfg_id = #{cfgId},</if>
<if test="pointId != null">point_id = #{pointId},</if>
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="deviceSn != null">device_sn = #{deviceSn},</if>
<if test="warningType != null">warning_type = #{warningType},</if>
<if test="warningContent != null">warning_content = #{warningContent},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDevIotWarningById" parameterType="Long">
delete from dev_iot_warning where id = #{id}
</delete>
<delete id="deleteDevIotWarningByIds" parameterType="String">
delete from dev_iot_warning where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -17,8 +17,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="warnType" column="warn_type" />
<result property="warnName" column="warn_name" />
<result property="warnNote" column="warn_note" />
<result property="warnData" column="warn_data" />
<result property="realData" column="real_data" />
<result property="height" column="height" />
<result property="range" column="range" />
<result property="rotation" column="rotation" />
<result property="load" column="load" />
<result property="windSpeed" column="wind_speed" />
<result property="leanAngleX" column="lean_angle_x" />
<result property="leanAngleY" column="lean_angle_y" />
<result property="momentPercent" column="moment_percent" />
<result property="rate" column="rate" />
<result property="alarmed" column="alarmed" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -28,9 +36,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDevTowerDataWarningVo">
select dtdw.id, dtdw.cfg_id, dtdw.project_id, dtdw.dept_id, sp.projectName, sd.dept_name, dtdw.device_key, dtdw.device_source, dtdw.tower_id, dtdw.warn_type, dtdw.warn_name, dtdw.warn_note, dtdw.warn_data, dtdw.real_data, dtdw.is_del, dtdw.create_by, dtdw.create_time, dtdw.update_by, dtdw.update_time, dtdw.remark from dev_tower_data_warning dtdw
select dtdw.id, dtdw.cfg_id, dtdw.project_id, dtdw.dept_id, sp.projectName, sd.dept_name,
dtdw.device_key,
dtdw.device_source,
dtdw.tower_id,
dtdw.warn_type,
dtdw.warn_name,
IFNULL(dtdw.warn_note,sdd.dict_label) as warn_note,
dtdw.height,
dtdw.range,
dtdw.rotation,
dtdw.load,
dtdw.wind_speed,
dtdw.lean_angle_x,
dtdw.lean_angle_y,
dtdw.moment_percent,
dtdw.rate,
dtdw.alarmed,
dtdw.is_del,
dtdw.create_by,
dtdw.create_time,
dtdw.update_by,
dtdw.update_time,
dtdw.remark
from dev_tower_data_warning dtdw
left join sur_project sp on sp.id = dtdw.project_id
left join sys_dept sd on sd.dept_id = dtdw.dept_id
left join sys_dict_data sdd on sdd.dict_value = dtdw.warn_type and sdd.dict_type = 'device_tower_warning'
</sql>
<select id="selectDevTowerDataWarningList" parameterType="DevTowerDataWarning" resultMap="DevTowerDataWarningResult">
@ -46,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="towerId != null and towerId != ''"> and dtdw.tower_id = #{towerId}</if>
<if test="warnType != null "> and dtdw.warn_type = #{warnType}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and dtdw.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
and dtdw.is_del=0
</where>
order by dtdw.id desc
</select>
@ -67,8 +100,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warnType != null">warn_type,</if>
<if test="warnName != null">warn_name,</if>
<if test="warnNote != null">warn_note,</if>
<if test="warnData != null">warn_data,</if>
<if test="realData != null">real_data,</if>
<if test="height != null">height,</if>
<if test="range != null">`range`,</if>
<if test="rotation != null">rotation,</if>
<if test="load != null">`load`,</if>
<if test="windSpeed != null">wind_speed,</if>
<if test="leanAngleX != null">lean_angle_x,</if>
<if test="leanAngleY != null">lean_angle_y,</if>
<if test="momentPercent != null">moment_percent,</if>
<if test="rate != null">rate,</if>
<if test="alarmed != null">alarmed,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -86,8 +127,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warnType != null">#{warnType},</if>
<if test="warnName != null">#{warnName},</if>
<if test="warnNote != null">#{warnNote},</if>
<if test="warnData != null">#{warnData},</if>
<if test="realData != null">#{realData},</if>
<if test="height != null">#{height},</if>
<if test="range != null">#{range},</if>
<if test="rotation != null">#{rotation},</if>
<if test="load != null">#{load},</if>
<if test="windSpeed != null">#{windSpeed},</if>
<if test="leanAngleX != null">#{leanAngleX},</if>
<if test="leanAngleY != null">#{leanAngleY},</if>
<if test="momentPercent != null">#{momentPercent},</if>
<if test="rate != null">#{rate},</if>
<if test="alarmed != null">#{alarmed},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -109,8 +158,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warnType != null">warn_type = #{warnType},</if>
<if test="warnName != null">warn_name = #{warnName},</if>
<if test="warnNote != null">warn_note = #{warnNote},</if>
<if test="warnData != null">warn_data = #{warnData},</if>
<if test="realData != null">real_data = #{realData},</if>
<if test="height != null">height = #{height},</if>
<if test="range != null">`range` = #{range},</if>
<if test="rotation != null">rotation = #{rotation},</if>
<if test="load != null">`load` = #{load},</if>
<if test="windSpeed != null">wind_speed = #{windSpeed},</if>
<if test="leanAngleX != null">lean_angle_x = #{leanAngleX},</if>
<if test="leanAngleY != null">lean_angle_y = #{leanAngleY},</if>
<if test="momentPercent != null">moment_percent = #{momentPercent},</if>
<if test="rate != null">rate = #{rate},</if>
<if test="alarmed != null">alarmed = #{alarmed},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@ -131,4 +188,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="findWarningCountByDeviceKey" parameterType="DevTowerDataWarning" resultType="Int">
select count(1) as total from dev_tower_data_warning
<where>
<if test="deviceKey != null and deviceKey != ''">and device_key = #{deviceKey}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and date(create_time) between #{params.beginCreateTime} and #{params.endCreateTime}</if>
and is_del=0
</where>
</select>
<select id="findOverloadWarningCountByDeviceKey" parameterType="DevTowerDataWarning" resultType="Int">
select count(1) as total from dev_tower_data_warning
<where>
<if test="deviceKey != null and deviceKey != ''">and device_key = #{deviceKey}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and date(create_time) between #{params.beginCreateTime} and #{params.endCreateTime}</if>
and warn_type in (7,8,9,106) and is_del=0
</where>
</select>
</mapper>

View File

@ -78,7 +78,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> left join sur_project_userinfo spu on spu.project_id = sp.id</if>
<where>
sp.isDel = 0
<if test="deptId != null "> and sp.deptId like concat('%', #{deptId}, '%')</if>
<if test="projectName != null and projectName != ''"> and sp.projectName like concat('%', #{projectName}, '%')</if>
<if test="projectCode != null and projectCode != ''"> and sp.projectCode = #{projectCode}</if>
@ -125,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> and spu.user_id = #{nowUser} and spu.is_del=0</if>
and sp.isDel = 0
</where>
order by sp.projectSort ASC,sp.projectName
</select>