物联设备去掉设备维度,损坏改成更换设备
This commit is contained in:
parent
adb3848b52
commit
ac8507ca37
|
|
@ -12,7 +12,6 @@ public class DevicePreviewMqDto {
|
|||
private String nuId;
|
||||
private String nuName;
|
||||
private String batchNo;
|
||||
private String dimension;
|
||||
private String sn;
|
||||
private String deviceName;
|
||||
private String deviceType;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ public class DeviceBindLog implements Serializable {
|
|||
private Integer id;
|
||||
private String nuId;
|
||||
private String nuName;
|
||||
private String dimension;
|
||||
private String deviceName;
|
||||
@Dict(dicCode = "tplink_device_type")
|
||||
private String deviceType;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,13 @@ public class DeviceManager implements Serializable {
|
|||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Integer id;
|
||||
private String nuId;
|
||||
@Excel(name = "批次", width = 15)
|
||||
private String batchNo;//批次号
|
||||
@Excel(name = "区域编码", width = 15)
|
||||
private String nuId;
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "区域名称", width = 15)
|
||||
private String nuName;
|
||||
@Excel(name = "设备名称", width = 15)
|
||||
private String deviceName;
|
||||
@Excel(name = "设备类型", width = 15, dicCode = "tplink_device_type")
|
||||
|
|
@ -35,13 +39,8 @@ public class DeviceManager implements Serializable {
|
|||
private String deviceModel;
|
||||
@Excel(name = "生产厂家", width = 15)
|
||||
private String factory;
|
||||
@Excel(name = "设备维度", width = 15)
|
||||
private String dimension;
|
||||
@Excel(name = "设备标识", width = 15)
|
||||
private String sn;
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "区域", width = 15)
|
||||
private String nuName;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ public class DeviceManagerHz implements Serializable {
|
|||
private String deviceModel;
|
||||
@Excel(name = "生产厂家", width = 15)
|
||||
private String factory;
|
||||
@Excel(name = "设备维度", width = 15)
|
||||
private String dimension;
|
||||
private String sn;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
a.batch_no,
|
||||
a.nu_id,
|
||||
c.nu_name,
|
||||
a.dimension,
|
||||
a.device_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
|
|
@ -54,19 +53,19 @@
|
|||
<if test="params.nuName != null and params.nuName != ''">
|
||||
AND (
|
||||
c.nu_name LIKE concat('%',#{params.nuName},'%')
|
||||
or a.dimension LIKE concat('%',#{params.nuName},'%')
|
||||
or a.batch_no LIKE concat('%',#{params.nuName},'%')
|
||||
or dict.item_text LIKE concat('%',#{params.nuName},'%')
|
||||
)
|
||||
</if>
|
||||
order by a.create_time desc,a.dimension asc,a.device_type asc ,a.device_model asc ,a.sn asc
|
||||
order by a.create_time desc,a.device_type asc ,a.device_model asc ,a.sn asc
|
||||
</select>
|
||||
|
||||
<select id="findAllPage" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.manager.entity.DeviceManager">
|
||||
select
|
||||
a.id,
|
||||
a.nu_id,
|
||||
c.nu_name,
|
||||
a.batch_no,
|
||||
a.dimension,
|
||||
a.device_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
|
|
@ -78,24 +77,21 @@
|
|||
a.device_status,
|
||||
a.yw_id
|
||||
from nu_iot_device_preview a
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
where ifnull(a.device_status,'') != '损坏'
|
||||
<if test="params.dimension != null and params.dimension != ''">
|
||||
AND a.dimension = #{params.dimension}
|
||||
</if>
|
||||
<if test="params.deviceType != null and params.deviceType != ''">
|
||||
AND a.device_type = #{params.deviceType}
|
||||
</if>
|
||||
<if test="params.batchNo != null and params.batchNo != ''">
|
||||
AND a.batch_no = #{params.batchNo}
|
||||
</if>
|
||||
order by a.create_time desc,a.dimension asc,a.device_type asc ,a.device_model asc ,a.sn asc
|
||||
order by a.create_time desc,a.device_type asc ,a.device_model asc ,a.sn asc
|
||||
</select>
|
||||
|
||||
<select id="findBySn" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.manager.entity.DeviceManager">
|
||||
select
|
||||
a.id,
|
||||
a.batch_no,
|
||||
a.dimension,
|
||||
a.device_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
|
|
@ -114,7 +110,6 @@
|
|||
select
|
||||
a.id,
|
||||
a.batch_no,
|
||||
a.dimension,
|
||||
a.device_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
|
|
@ -136,7 +131,6 @@
|
|||
id,
|
||||
nu_id,
|
||||
nu_name,
|
||||
dimension,
|
||||
device_name,
|
||||
device_type,
|
||||
device_model,
|
||||
|
|
@ -147,9 +141,6 @@
|
|||
remarks
|
||||
from nu_iot_device_bind_log
|
||||
<where>
|
||||
<if test="params.dimension != null and params.dimension != ''">
|
||||
AND dimension = #{params.dimension}
|
||||
</if>
|
||||
<if test="params.deviceType != null and params.deviceType != ''">
|
||||
AND device_type = #{params.deviceType}
|
||||
</if>
|
||||
|
|
@ -164,7 +155,6 @@
|
|||
insert into nu_iot_device_bind_log(
|
||||
nu_id,
|
||||
nu_name,
|
||||
dimension,
|
||||
device_name,
|
||||
device_type,
|
||||
device_model,
|
||||
|
|
@ -176,7 +166,6 @@
|
|||
)values(
|
||||
#{nuId},
|
||||
#{nuName},
|
||||
#{dimension},
|
||||
#{deviceName},
|
||||
#{deviceType},
|
||||
#{deviceModel},
|
||||
|
|
@ -196,23 +185,23 @@
|
|||
</select>
|
||||
|
||||
<select id="exportDeviceExcel" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.manager.entity.DeviceManager">
|
||||
select a.batch_no,a.device_name,a.device_type,a.device_model,a.factory,a.dimension,a.sn,c.nu_name,a.remarks
|
||||
select a.batch_no,a.device_name,a.device_type,a.device_model,a.factory,a.sn,a.nu_id,c.nu_name,a.remarks
|
||||
from nu_iot_device_preview a
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
where ifnull(a.device_status,'') != '损坏'
|
||||
order by a.batch_no,a.dimension,a.device_name
|
||||
order by a.batch_no,a.device_name
|
||||
</select>
|
||||
|
||||
<select id="exportDeviceHzExcel" parameterType="com.nu.modules.manager.entity.DeviceManagerHz" resultType="com.nu.modules.manager.entity.DeviceManagerHz">
|
||||
select batch_no,device_name,device_type,device_model,factory,dimension,count(*) as hz
|
||||
select batch_no,device_name,device_type,device_model,factory,count(*) as hz
|
||||
from nu_iot_device_preview
|
||||
where ifnull(device_status,'') != '损坏'
|
||||
group by batch_no,device_name,device_type,device_model,factory,dimension
|
||||
order by batch_no,dimension,factory,device_type,device_model,device_name
|
||||
group by batch_no,device_name,device_type,device_model,factory
|
||||
order by batch_no,factory,device_type,device_model,device_name
|
||||
</select>
|
||||
|
||||
<select id="cameraInfoList" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
select a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.device_status,b.device_index
|
||||
select a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.device_status,b.device_index
|
||||
from nu_iot_device_preview a
|
||||
inner join nu_iot_tplink_camera b on a.sn = b.mac
|
||||
where a.nu_id = #{nuId}
|
||||
|
|
@ -221,7 +210,7 @@
|
|||
</select>
|
||||
|
||||
<select id="findCameraInfoUnbindPage" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
select a.id,a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.device_status,b.device_index
|
||||
select a.id,a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.device_status,b.device_index
|
||||
from nu_iot_device_preview a
|
||||
left join nu_iot_tplink_camera b on a.sn = b.mac
|
||||
where a.nu_id is null
|
||||
|
|
@ -230,7 +219,7 @@
|
|||
</select>
|
||||
|
||||
<select id="waterMeterList" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.tq.water.entity.WaterMeter">
|
||||
select a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.cid,b.address,b.water_value
|
||||
select a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.cid,b.address,b.water_value
|
||||
from nu_iot_device_preview a
|
||||
inner join nu_iot_tq_water_meter b on a.sn = b.cid
|
||||
where a.nu_id = #{nuId}
|
||||
|
|
@ -239,7 +228,7 @@
|
|||
</select>
|
||||
|
||||
<select id="findWaterMeterUnbindPage" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.tq.water.entity.WaterMeter">
|
||||
select a.id,a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.cid,b.address,b.water_value
|
||||
select a.id,a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.cid,b.address,b.water_value
|
||||
from nu_iot_device_preview a
|
||||
left join nu_iot_tq_water_meter b on a.sn = b.cid
|
||||
where a.nu_id is null
|
||||
|
|
@ -248,7 +237,7 @@
|
|||
</select>
|
||||
|
||||
<select id="electricityMeterList" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.tq.electricity.entity.ElectricityMeter">
|
||||
select a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.ele_value
|
||||
select a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.ele_value
|
||||
from nu_iot_device_preview a
|
||||
inner join nu_iot_ds_electricity_meter b on a.sn = b.sn
|
||||
where a.nu_id = #{nuId}
|
||||
|
|
@ -257,7 +246,7 @@
|
|||
</select>
|
||||
|
||||
<select id="findElectricityMeterUnbindPage" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.tq.electricity.entity.ElectricityMeter">
|
||||
select a.id,a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.ele_value
|
||||
select a.id,a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.relay_state,b.ele_value
|
||||
from nu_iot_device_preview a
|
||||
left join nu_iot_ds_electricity_meter b on a.sn = b.sn
|
||||
where a.nu_id is null
|
||||
|
|
@ -266,7 +255,7 @@
|
|||
</select>
|
||||
|
||||
<select id="humidDeviceList" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.yiweilian.humid.entity.HumidDevice">
|
||||
select a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.status,b.temperature,b.humidity
|
||||
select a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.status,b.temperature,b.humidity
|
||||
from nu_iot_device_preview a
|
||||
inner join nu_iot_yiweilian_humid_device b on a.sn = b.sn
|
||||
where a.nu_id = #{nuId}
|
||||
|
|
@ -275,7 +264,7 @@
|
|||
</select>
|
||||
|
||||
<select id="findHumidDeviceUnbindPage" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.yiweilian.humid.entity.HumidDevice">
|
||||
select a.id,a.batch_no,a.nu_id,a.dimension,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.status,b.temperature,b.humidity
|
||||
select a.id,a.batch_no,a.nu_id,a.sn,a.device_type,a.device_model,a.device_status as maintainStatus,b.status,b.temperature,b.humidity
|
||||
from nu_iot_device_preview a
|
||||
left join nu_iot_yiweilian_humid_device b on a.sn = b.sn
|
||||
where a.nu_id is null
|
||||
|
|
@ -300,7 +289,6 @@
|
|||
select
|
||||
a.id,
|
||||
a.batch_no,
|
||||
a.dimension,
|
||||
a.device_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
|
|
@ -338,9 +326,6 @@
|
|||
where a.sn is not null
|
||||
and a.nu_id is null
|
||||
and ifnull(a.device_status,'') != '损坏'
|
||||
<if test="params.dimension != null and params.dimension != ''">
|
||||
AND a.dimension = #{params.dimension}
|
||||
</if>
|
||||
<if test="params.deviceType != null and params.deviceType != ''">
|
||||
AND a.device_type = #{params.deviceType}
|
||||
</if>
|
||||
|
|
@ -350,7 +335,7 @@
|
|||
<if test="params.id != null and params.id != ''">
|
||||
AND a.id != #{params.id}
|
||||
</if>
|
||||
order by a.batch_no,a.dimension,a.device_type,a.device_model,a.sn
|
||||
order by a.batch_no,a.device_type,a.device_model,a.sn
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
if(!deviceBindLog.getOptType().equals("损坏")){
|
||||
deviceManager.setDeviceStatus("已绑定");
|
||||
}
|
||||
if(deviceBindLog.getDimension().equals("区域维度")){
|
||||
deviceManager.setNuId(deviceBindLog.getNuId());
|
||||
}
|
||||
baseMapper.updateById(deviceManager);
|
||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||
String orgCode = deptInfo.getString("code");
|
||||
|
|
@ -102,16 +100,12 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
if(deviceBindLog.getOptType().equals("损坏")){
|
||||
if(deviceBindLog.getNewId()!=null){
|
||||
//更新新数据状态为绑定,如区域维度给定nuId
|
||||
if(deviceBindLog.getDimension().equals("区域维度")){
|
||||
deviceManager.setNuId(deviceBindLog.getNuId());
|
||||
}
|
||||
QueryWrapper<DeviceManager> qw = new QueryWrapper<>();
|
||||
qw.eq("id",deviceBindLog.getNewId());
|
||||
DeviceManager entity = this.getOne(qw);
|
||||
if(deviceBindLog.getDimension().equals("区域维度")){
|
||||
entity.setNuId(deviceBindLog.getNuId());
|
||||
entity.setNuName(deviceBindLog.getNuName());
|
||||
}
|
||||
entity.setDeviceStatus("已绑定");
|
||||
baseMapper.updateById(entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -157,18 +157,12 @@ public class IotSyncBizMQListener {
|
|||
DeviceManager dm = deviceManagerService.findBySn(deviceManager);
|
||||
if(dm!=null){
|
||||
deviceManager.setDeviceStatus("未绑定");
|
||||
if(dm.getDimension().equals("机构维度")){
|
||||
deviceManager.setDeviceStatus("已绑定");
|
||||
}
|
||||
deviceManagerService.editPreviewStatusBySn(deviceManager);
|
||||
}else{
|
||||
DeviceManager snEmpty = deviceManagerService.findOneByType(deviceManager);
|
||||
if(snEmpty!=null){
|
||||
deviceManager.setId(snEmpty.getId());
|
||||
deviceManager.setDeviceStatus("未绑定");
|
||||
if(snEmpty.getDimension().equals("机构维度")){
|
||||
deviceManager.setDeviceStatus("已绑定");
|
||||
}
|
||||
deviceManagerService.updateById(deviceManager);
|
||||
|
||||
deviceManager.setYwId(snEmpty.getYwId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue