物联设备BUG处理
This commit is contained in:
parent
7c527a98ca
commit
9fec315c9e
|
|
@ -1,5 +1,6 @@
|
||||||
package com.nu.modules.manager.controller;
|
package com.nu.modules.manager.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.nu.modules.manager.entity.DeviceBindLog;
|
import com.nu.modules.manager.entity.DeviceBindLog;
|
||||||
|
|
@ -11,16 +12,28 @@ import com.nu.modules.tq.water.entity.WaterMeter;
|
||||||
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.config.JeecgBaseConfig;
|
||||||
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||||
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 设备管理
|
* @Description: 设备管理
|
||||||
|
|
@ -34,7 +47,8 @@ import java.util.Map;
|
||||||
public class DeviceManagerController extends JeecgController<DeviceManager, IDeviceManagerService> {
|
public class DeviceManagerController extends JeecgController<DeviceManager, IDeviceManagerService> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceManagerService service;
|
private IDeviceManagerService service;
|
||||||
|
@Resource
|
||||||
|
private JeecgBaseConfig jeecgBaseConfig;
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
|
|
@ -164,7 +178,47 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/exportXls")
|
@RequestMapping(value = "/exportXls")
|
||||||
public ModelAndView exportXls(HttpServletRequest request, DeviceManager DeviceManager) {
|
public ModelAndView exportXls(HttpServletRequest request, DeviceManager DeviceManager) {
|
||||||
return super.exportXls(request, DeviceManager, DeviceManager.class, "物联设备清单");
|
|
||||||
|
// Step.1 组装查询条件
|
||||||
|
QueryWrapper<DeviceManager> queryWrapper = QueryGenerator.initQueryWrapper(DeviceManager, request.getParameterMap());
|
||||||
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
|
||||||
|
// 过滤选中数据
|
||||||
|
String selections = request.getParameter("selections");
|
||||||
|
if (oConvertUtils.isNotEmpty(selections)) {
|
||||||
|
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||||
|
queryWrapper.in("id",selectionList);
|
||||||
|
}
|
||||||
|
// Step.2 获取导出数据
|
||||||
|
List<DeviceManager> exportList = service.list(queryWrapper);
|
||||||
|
|
||||||
|
// Step.3 AutoPoi 导出Excel
|
||||||
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||||
|
//此处设置的filename无效 ,前端会重更新设置一下
|
||||||
|
mv.addObject(NormalExcelConstants.FILE_NAME, "物联设备清单");
|
||||||
|
mv.addObject(NormalExcelConstants.CLASS, DeviceManager.class);
|
||||||
|
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
||||||
|
ExportParams exportParams=new ExportParams("物联设备清单", "导出人:" + sysUser.getRealname(), "物联设备清单");
|
||||||
|
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
|
||||||
|
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
||||||
|
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
||||||
|
|
||||||
|
Map<String, Integer> result = new HashMap<>();
|
||||||
|
for (DeviceManager device : exportList) {
|
||||||
|
String name = device.getDeviceName();
|
||||||
|
result.put(name, result.getOrDefault(name, 0) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<String, Integer> entry : result.entrySet()) {
|
||||||
|
String deviceName = entry.getKey();
|
||||||
|
Integer count = entry.getValue();
|
||||||
|
DeviceManager dm = new DeviceManager();
|
||||||
|
dm.setDeviceName(deviceName + ", 数量: " + count);
|
||||||
|
exportList.add(dm);
|
||||||
|
}
|
||||||
|
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
||||||
|
return mv;
|
||||||
|
// return super.exportXls(request, DeviceManager, DeviceManager.class, "物联设备清单");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ public class DeviceBindLog implements Serializable {
|
||||||
private String nuId;
|
private String nuId;
|
||||||
private String nuName;
|
private String nuName;
|
||||||
private String dimension;
|
private String dimension;
|
||||||
|
private String deviceName;
|
||||||
@Dict(dicCode = "tplink_device_type")
|
@Dict(dicCode = "tplink_device_type")
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
private String deviceModel;
|
private String deviceModel;
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@
|
||||||
nu_id,
|
nu_id,
|
||||||
nu_name,
|
nu_name,
|
||||||
dimension,
|
dimension,
|
||||||
|
device_name,
|
||||||
device_type,
|
device_type,
|
||||||
device_model,
|
device_model,
|
||||||
sn,
|
sn,
|
||||||
|
|
@ -90,6 +91,17 @@
|
||||||
opt_date,
|
opt_date,
|
||||||
opt_type
|
opt_type
|
||||||
from nu_iot_device_bind_log
|
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>
|
||||||
|
<if test="params.deviceName != null and params.deviceName != ''">
|
||||||
|
AND device_name LIKE concat('%',#{params.deviceName},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
order by factory asc ,device_type asc ,device_model asc ,sn asc,opt_date desc
|
order by factory asc ,device_type asc ,device_model asc ,sn asc,opt_date desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -98,6 +110,7 @@
|
||||||
nu_id,
|
nu_id,
|
||||||
nu_name,
|
nu_name,
|
||||||
dimension,
|
dimension,
|
||||||
|
device_name,
|
||||||
device_type,
|
device_type,
|
||||||
device_model,
|
device_model,
|
||||||
sn,
|
sn,
|
||||||
|
|
@ -109,6 +122,7 @@
|
||||||
#{nuId},
|
#{nuId},
|
||||||
#{nuName},
|
#{nuName},
|
||||||
#{dimension},
|
#{dimension},
|
||||||
|
#{deviceName},
|
||||||
#{deviceType},
|
#{deviceType},
|
||||||
#{deviceModel},
|
#{deviceModel},
|
||||||
#{sn},
|
#{sn},
|
||||||
|
|
|
||||||
|
|
@ -107,32 +107,60 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findAllList" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
<select id="findAllList" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||||
|
-- select a.id,
|
||||||
|
-- device_index as deviceIndex,
|
||||||
|
-- device_name as deviceName,
|
||||||
|
-- device_type as deviceType,
|
||||||
|
-- device_status as deviceStatus,
|
||||||
|
-- device_model as deviceModel,
|
||||||
|
-- ip as ip,
|
||||||
|
-- mac as mac,
|
||||||
|
-- region_id as regionId,
|
||||||
|
-- region_name as regionName,
|
||||||
|
-- parent_id as parentId,
|
||||||
|
-- parent_device_name as parentDeviceName,
|
||||||
|
-- project_id as projectId,
|
||||||
|
-- project_name as projectName,
|
||||||
|
-- firmware_ver as firmwareVer,
|
||||||
|
-- hardware_ver as hardwareVer,
|
||||||
|
-- manager_auth_type as managerAuthType,
|
||||||
|
-- msg_auth_type as msgAuthType,
|
||||||
|
-- sip_code as sipCode,
|
||||||
|
-- location_name as locationName,
|
||||||
|
-- system_type as systemType,
|
||||||
|
-- protocol as protocol,
|
||||||
|
-- record_plan_id as recordPlanId,
|
||||||
|
-- nu_id as nuId,
|
||||||
|
-- a.channel
|
||||||
|
-- from nu_iot_tplink_camera a
|
||||||
select a.id,
|
select a.id,
|
||||||
device_index as deviceIndex,
|
a.device_index as deviceIndex,
|
||||||
device_name as deviceName,
|
b.device_name as deviceName,
|
||||||
device_type as deviceType,
|
b.device_type as deviceType,
|
||||||
device_status as deviceStatus,
|
a.device_status as deviceStatus,
|
||||||
device_model as deviceModel,
|
b.device_model as deviceModel,
|
||||||
ip as ip,
|
a.ip as ip,
|
||||||
mac as mac,
|
a.mac as mac,
|
||||||
region_id as regionId,
|
a.region_id as regionId,
|
||||||
region_name as regionName,
|
a.region_name as regionName,
|
||||||
parent_id as parentId,
|
a.parent_id as parentId,
|
||||||
parent_device_name as parentDeviceName,
|
a.parent_device_name as parentDeviceName,
|
||||||
project_id as projectId,
|
a.project_id as projectId,
|
||||||
project_name as projectName,
|
a.project_name as projectName,
|
||||||
firmware_ver as firmwareVer,
|
a.firmware_ver as firmwareVer,
|
||||||
hardware_ver as hardwareVer,
|
a.hardware_ver as hardwareVer,
|
||||||
manager_auth_type as managerAuthType,
|
a.manager_auth_type as managerAuthType,
|
||||||
msg_auth_type as msgAuthType,
|
a.msg_auth_type as msgAuthType,
|
||||||
sip_code as sipCode,
|
a.sip_code as sipCode,
|
||||||
location_name as locationName,
|
a.location_name as locationName,
|
||||||
system_type as systemType,
|
a.system_type as systemType,
|
||||||
protocol as protocol,
|
a.protocol as protocol,
|
||||||
record_plan_id as recordPlanId,
|
a.record_plan_id as recordPlanId,
|
||||||
nu_id as nuId,
|
b.nu_id as nuId,
|
||||||
a.channel
|
a.channel
|
||||||
from nu_iot_tplink_camera a
|
from nu_iot_tplink_camera a
|
||||||
|
inner join nu_iot_device_preview b on a.mac = b.sn
|
||||||
|
where b.device_status != '损坏'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findNuPage" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
<select id="findNuPage" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||||
|
|
@ -281,48 +309,54 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="previewList" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
<select id="previewList" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||||
select a.*,b.nu_name,b.area_flag
|
select
|
||||||
from (
|
a.id,
|
||||||
select mac as id,nu_id,device_index,mac as sn,device_model,device_type,
|
a.nu_id,
|
||||||
( case device_status when '0' then '离线' when '1' then '在线' end ) as device_status,
|
c.nu_name,
|
||||||
dimension,
|
a.dimension,
|
||||||
maintain_status
|
a.device_name,
|
||||||
|
a.device_type,
|
||||||
|
a.device_model,
|
||||||
|
a.factory,
|
||||||
|
a.sn,
|
||||||
|
a.create_time,
|
||||||
|
a.update_time,
|
||||||
|
a.remarks,
|
||||||
|
t.online_status as deviceStatus
|
||||||
|
from nu_iot_device_preview a
|
||||||
|
inner join nu_base_info c on a.nu_id = c.nu_id
|
||||||
|
inner join (
|
||||||
|
select mac as sn,
|
||||||
|
( case device_status when '0' then '离线' when '1' then '在线' end ) as online_status
|
||||||
from nu_iot_tplink_camera
|
from nu_iot_tplink_camera
|
||||||
union all
|
union all
|
||||||
select sn as id,nu_id,sn as device_index,sn,'' as device_model,'db' as device_type,
|
select sn,
|
||||||
( case relay_state when '0' then '拉闸' else '合闸' end ) as device_status,
|
( case relay_state when '0' then '离线' else '在线' end ) as online_status
|
||||||
dimension,
|
|
||||||
maintain_status
|
|
||||||
from nu_iot_ds_electricity_meter
|
from nu_iot_ds_electricity_meter
|
||||||
union all
|
union all
|
||||||
select cid as id,nu_id,cid as device_index,cid as sn,'' as device_model,'sb' as device_type,
|
select cid as sn,
|
||||||
( case relay_state when '0' then '关阀' else '开阀' end ) as device_status,
|
( case relay_state when '0' then '离线' else '在线' end ) as online_status
|
||||||
dimension,
|
|
||||||
maintain_status
|
|
||||||
from nu_iot_tq_water_meter
|
from nu_iot_tq_water_meter
|
||||||
union all
|
union all
|
||||||
select sn as id,nu_id,sn as device_index,sn,'' as device_model,'wsdj' as device_type,
|
select sn,
|
||||||
( case status when '0' then '在线' else '离线' end ) as device_status,
|
( case status when '0' then '在线' else '离线' end ) as online_status
|
||||||
dimension,
|
|
||||||
maintain_status
|
|
||||||
from nu_iot_yiweilian_humid_device
|
from nu_iot_yiweilian_humid_device
|
||||||
) a
|
) t on a.sn = t.sn
|
||||||
left join nu_base_info b on a.nu_id = b.nu_id
|
where a.sn is not null
|
||||||
<where>
|
and ifnull(a.device_status,'') != '损坏'
|
||||||
|
<if test="params.nuId != null and params.nuId != ''">
|
||||||
|
AND a.nu_id = #{params.nuId}
|
||||||
|
</if>
|
||||||
<if test="params.nuName != null and params.nuName != ''">
|
<if test="params.nuName != null and params.nuName != ''">
|
||||||
and b.nu_name like concat('%',#{params.nuName},'%')
|
AND c.nu_name LIKE concat('%',#{params.nuName},'%')
|
||||||
</if>
|
|
||||||
<if test="params.deviceStatus != null and params.deviceStatus != ''">
|
|
||||||
and a.device_status = #{params.deviceStatus}
|
|
||||||
</if>
|
|
||||||
<if test="params.deviceType != null and params.deviceType != ''">
|
|
||||||
and a.device_type = #{params.deviceType}
|
|
||||||
</if>
|
</if>
|
||||||
<if test="params.dimension != null and params.dimension != ''">
|
<if test="params.dimension != null and params.dimension != ''">
|
||||||
and a.dimension = #{params.dimension}
|
AND a.dimension = #{params.dimension}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
<if test="params.deviceType != null and params.deviceType != ''">
|
||||||
order by a.nu_id,a.device_type,a.sn
|
AND a.device_type = #{params.deviceType}
|
||||||
|
</if>
|
||||||
|
order by a.dimension,a.device_type,a.device_model,a.sn
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="release">
|
<update id="release">
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface HumidDeviceMapper extends BaseMapper<HumidDevice> {
|
public interface HumidDeviceMapper extends BaseMapper<HumidDevice> {
|
||||||
IPage<HumidDevice> findPage(Page<HumidDevice> page, @Param("params") HumidDevice humidDevice);
|
IPage<HumidDevice> findPage(Page<HumidDevice> page, @Param("params") HumidDevice humidDevice);
|
||||||
|
List<HumidDevice> addList();
|
||||||
HumidDevice getHumidDevice(HumidDevice humidDevice);
|
HumidDevice getHumidDevice(HumidDevice humidDevice);
|
||||||
int insertDevice(HumidDevice humidDevice);
|
int insertDevice(HumidDevice humidDevice);
|
||||||
int updateDevice(HumidDevice humidDevice);
|
int updateDevice(HumidDevice humidDevice);
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,37 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="addList" parameterType="com.nu.modules.yiweilian.humid.entity.HumidDevice" resultType="com.nu.modules.yiweilian.humid.entity.HumidDevice">
|
||||||
|
select
|
||||||
|
a.id,
|
||||||
|
a.sn,
|
||||||
|
b.device_name as deviceName,
|
||||||
|
b.device_type as deviceTypes,
|
||||||
|
a.reporting_interval as reportingInterval,
|
||||||
|
a.record_interval as recordInterval,
|
||||||
|
a.history_report_time as historyReportTime,
|
||||||
|
a.history_interval as historyInterval,
|
||||||
|
a.temperature_high as temperatureHigh,
|
||||||
|
a.temperature_low as temperatureLow,
|
||||||
|
a.temperature_buffer as temperatureBuffer,
|
||||||
|
a.humidity_high as humidityHigh,
|
||||||
|
a.humidity_low as humidityLow,
|
||||||
|
a.humidity_buffer as humidityBuffer,
|
||||||
|
a.iz_outages as izOutages,
|
||||||
|
a.iz_low_battery as izLowBattery,
|
||||||
|
a.iz_online as izOnline,
|
||||||
|
a.time_code as timeCode,
|
||||||
|
a.temperature,
|
||||||
|
a.humidity,
|
||||||
|
a.status,
|
||||||
|
a.reporting_time as reportingTime,
|
||||||
|
a.electricity,
|
||||||
|
b.nu_id as nuId
|
||||||
|
from nu_iot_yiweilian_humid_device a
|
||||||
|
inner join nu_iot_device_preview b on a.sn = b.sn
|
||||||
|
where b.device_status != '损坏'
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getHumidDevice" parameterType="com.nu.modules.yiweilian.humid.entity.HumidDevice" resultType="com.nu.modules.yiweilian.humid.entity.HumidDevice">
|
<select id="getHumidDevice" parameterType="com.nu.modules.yiweilian.humid.entity.HumidDevice" resultType="com.nu.modules.yiweilian.humid.entity.HumidDevice">
|
||||||
select
|
select
|
||||||
id,
|
id,
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HumidDeviceEntity> listAll() {
|
public List<HumidDeviceEntity> listAll() {
|
||||||
List<HumidDevice> list = baseMapper.selectList(new QueryWrapper<>());
|
List<HumidDevice> list = baseMapper.addList();
|
||||||
List<HumidDeviceEntity> list2 = BeanUtil.copyToList(list, HumidDeviceEntity.class);
|
List<HumidDeviceEntity> list2 = BeanUtil.copyToList(list, HumidDeviceEntity.class);
|
||||||
return list2;
|
return list2;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,16 +131,16 @@ public class IotSyncBizMQListener {
|
||||||
cameraQw.eq("device_index",iotCameraInfoMQDto.getDeviceIndex());
|
cameraQw.eq("device_index",iotCameraInfoMQDto.getDeviceIndex());
|
||||||
CameraInfo entity = cameraInfoService.getOne(cameraQw);
|
CameraInfo entity = cameraInfoService.getOne(cameraQw);
|
||||||
if(entity!=null){
|
if(entity!=null){
|
||||||
if(entity.getNuId()==null||entity.getNuId().equals("")){
|
// if(entity.getNuId()==null||entity.getNuId().equals("")){
|
||||||
entity.setNuId(iotCameraInfoMQDto.getNuId());
|
// entity.setNuId(iotCameraInfoMQDto.getNuId());
|
||||||
cameraInfoService.updateById(entity);
|
// cameraInfoService.updateById(entity);
|
||||||
}
|
// }
|
||||||
if(iotCameraInfoMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
// if(iotCameraInfoMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
||||||
statusMQDto.setMessage("忽略");
|
statusMQDto.setMessage("忽略");
|
||||||
}else{
|
// }else{
|
||||||
entity.setMaintainStatus(iotCameraInfoMQDto.getMaintainStatus());
|
// entity.setMaintainStatus(iotCameraInfoMQDto.getMaintainStatus());
|
||||||
cameraInfoService.updateById(entity);
|
// cameraInfoService.updateById(entity);
|
||||||
}
|
// }
|
||||||
}else{
|
}else{
|
||||||
CameraInfo cameraInfo = new CameraInfo();
|
CameraInfo cameraInfo = new CameraInfo();
|
||||||
BeanUtils.copyProperties(iotCameraInfoMQDto, cameraInfo);
|
BeanUtils.copyProperties(iotCameraInfoMQDto, cameraInfo);
|
||||||
|
|
@ -209,16 +209,16 @@ public class IotSyncBizMQListener {
|
||||||
electricityQw.eq("sn",iotElectricityMeterMQDto.getSn());
|
electricityQw.eq("sn",iotElectricityMeterMQDto.getSn());
|
||||||
ElectricityMeter entity = electricityMeterService.getOne(electricityQw);
|
ElectricityMeter entity = electricityMeterService.getOne(electricityQw);
|
||||||
if(entity!=null){
|
if(entity!=null){
|
||||||
if(entity.getNuId()==null||entity.getNuId().equals("")){
|
// if(entity.getNuId()==null||entity.getNuId().equals("")){
|
||||||
entity.setNuId(iotElectricityMeterMQDto.getNuId());
|
// entity.setNuId(iotElectricityMeterMQDto.getNuId());
|
||||||
electricityMeterService.updateById(entity);
|
// electricityMeterService.updateById(entity);
|
||||||
}
|
// }
|
||||||
if(iotElectricityMeterMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
// if(iotElectricityMeterMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
||||||
statusMQDto.setMessage("忽略");
|
statusMQDto.setMessage("忽略");
|
||||||
}else{
|
// }else{
|
||||||
entity.setMaintainStatus(iotElectricityMeterMQDto.getMaintainStatus());
|
// entity.setMaintainStatus(iotElectricityMeterMQDto.getMaintainStatus());
|
||||||
electricityMeterService.updateById(entity);
|
// electricityMeterService.updateById(entity);
|
||||||
}
|
// }
|
||||||
}else{
|
}else{
|
||||||
ElectricityMeter electricityMeter = new ElectricityMeter();
|
ElectricityMeter electricityMeter = new ElectricityMeter();
|
||||||
BeanUtils.copyProperties(iotElectricityMeterMQDto, electricityMeter);
|
BeanUtils.copyProperties(iotElectricityMeterMQDto, electricityMeter);
|
||||||
|
|
@ -257,16 +257,16 @@ public class IotSyncBizMQListener {
|
||||||
waterQw.eq("cid",iotWaterMeterMQDto.getCid());
|
waterQw.eq("cid",iotWaterMeterMQDto.getCid());
|
||||||
WaterMeter entity = waterMeterService.getOne(waterQw);
|
WaterMeter entity = waterMeterService.getOne(waterQw);
|
||||||
if(entity!=null){
|
if(entity!=null){
|
||||||
if(entity.getNuId()==null||entity.getNuId().equals("")){
|
// if(entity.getNuId()==null||entity.getNuId().equals("")){
|
||||||
entity.setNuId(iotWaterMeterMQDto.getNuId());
|
// entity.setNuId(iotWaterMeterMQDto.getNuId());
|
||||||
waterMeterService.updateById(entity);
|
// waterMeterService.updateById(entity);
|
||||||
}
|
// }
|
||||||
if(iotWaterMeterMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
// if(iotWaterMeterMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
||||||
statusMQDto.setMessage("忽略");
|
statusMQDto.setMessage("忽略");
|
||||||
}else{
|
// }else{
|
||||||
entity.setMaintainStatus(iotWaterMeterMQDto.getMaintainStatus());
|
// entity.setMaintainStatus(iotWaterMeterMQDto.getMaintainStatus());
|
||||||
waterMeterService.updateById(entity);
|
// waterMeterService.updateById(entity);
|
||||||
}
|
// }
|
||||||
}else{
|
}else{
|
||||||
WaterMeter waterMeter = new WaterMeter();
|
WaterMeter waterMeter = new WaterMeter();
|
||||||
BeanUtils.copyProperties(iotWaterMeterMQDto, waterMeter);
|
BeanUtils.copyProperties(iotWaterMeterMQDto, waterMeter);
|
||||||
|
|
@ -335,16 +335,16 @@ public class IotSyncBizMQListener {
|
||||||
humidQw.eq("sn",iotHumidDeviceMQDto.getSn());
|
humidQw.eq("sn",iotHumidDeviceMQDto.getSn());
|
||||||
HumidDevice entity = humidDeviceService.getOne(humidQw);
|
HumidDevice entity = humidDeviceService.getOne(humidQw);
|
||||||
if(entity!=null){
|
if(entity!=null){
|
||||||
if(entity.getNuId()==null||entity.getNuId().equals("")){
|
// if(entity.getNuId()==null||entity.getNuId().equals("")){
|
||||||
entity.setNuId(iotHumidDeviceMQDto.getNuId());
|
// entity.setNuId(iotHumidDeviceMQDto.getNuId());
|
||||||
humidDeviceService.updateById(entity);
|
// humidDeviceService.updateById(entity);
|
||||||
}
|
// }
|
||||||
if(iotHumidDeviceMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
// if(iotHumidDeviceMQDto.getMaintainStatus().equals(entity.getMaintainStatus())){
|
||||||
statusMQDto.setMessage("忽略");
|
statusMQDto.setMessage("忽略");
|
||||||
}else{
|
// }else{
|
||||||
entity.setMaintainStatus(iotHumidDeviceMQDto.getMaintainStatus());
|
// entity.setMaintainStatus(iotHumidDeviceMQDto.getMaintainStatus());
|
||||||
humidDeviceService.updateById(entity);
|
// humidDeviceService.updateById(entity);
|
||||||
}
|
// }
|
||||||
}else{
|
}else{
|
||||||
HumidDevice humidDevice = new HumidDevice();
|
HumidDevice humidDevice = new HumidDevice();
|
||||||
BeanUtils.copyProperties(iotHumidDeviceMQDto, humidDevice);
|
BeanUtils.copyProperties(iotHumidDeviceMQDto, humidDevice);
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,10 @@ public interface NuBaseInfoMapper extends BaseMapper<NuBaseInfo> {
|
||||||
|
|
||||||
List<NuBaseInfo> queryReadList(@Param("employeesId") String employeesId,@Param("username") String username);
|
List<NuBaseInfo> queryReadList(@Param("employeesId") String employeesId,@Param("username") String username);
|
||||||
|
|
||||||
void updateSbsfTplink(@Param("nuId") String nuId);
|
// void updateSbsfTplink(@Param("nuId") String nuId);
|
||||||
|
// void updateSbsfElectricity(@Param("nuId") String nuId);
|
||||||
void updateSbsfElectricity(@Param("nuId") String nuId);
|
// void updateSbsfWater(@Param("nuId") String nuId);
|
||||||
|
// void updateSbsfHumid(@Param("nuId") String nuId);
|
||||||
void updateSbsfWater(@Param("nuId") String nuId);
|
void addDeviceReleaseLog(@Param("nuId") String nuId);
|
||||||
|
void updateDevice(@Param("nuId") String nuId);
|
||||||
void updateSbsfHumid(@Param("nuId") String nuId);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,28 +86,61 @@
|
||||||
select create_by as empId,nu_id,'pdd' as type,'盘点单' as typeName from nu_invoicing_pdd_main where pdd_type = '1' and create_by = #{username} GROUP BY create_by,nu_id
|
select create_by as empId,nu_id,'pdd' as type,'盘点单' as typeName from nu_invoicing_pdd_main where pdd_type = '1' and create_by = #{username} GROUP BY create_by,nu_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateSbsfTplink">
|
<!-- <update id="updateSbsfTplink">-->
|
||||||
update nu_iot_tplink_camera
|
<!-- update nu_iot_tplink_camera-->
|
||||||
set nu_id = null,
|
<!-- set nu_id = null,-->
|
||||||
dimension = null
|
<!-- dimension = null-->
|
||||||
where nu_id = #{nuId}
|
<!-- where nu_id = #{nuId}-->
|
||||||
</update>
|
<!-- </update>-->
|
||||||
<update id="updateSbsfElectricity">
|
<!-- <update id="updateSbsfElectricity">-->
|
||||||
update nu_iot_ds_electricity_meter
|
<!-- update nu_iot_ds_electricity_meter-->
|
||||||
set nu_id = null,
|
<!-- set nu_id = null,-->
|
||||||
dimension = null
|
<!-- dimension = null-->
|
||||||
where nu_id = #{nuId}
|
<!-- where nu_id = #{nuId}-->
|
||||||
</update>
|
<!-- </update>-->
|
||||||
<update id="updateSbsfWater">
|
<!-- <update id="updateSbsfWater">-->
|
||||||
update nu_iot_tq_water_meter
|
<!-- update nu_iot_tq_water_meter-->
|
||||||
set nu_id = null,
|
<!-- set nu_id = null,-->
|
||||||
dimension = null
|
<!-- dimension = null-->
|
||||||
where nu_id = #{nuId}
|
<!-- where nu_id = #{nuId}-->
|
||||||
</update>
|
<!-- </update>-->
|
||||||
<update id="updateSbsfHumid">
|
<!-- <update id="updateSbsfHumid">-->
|
||||||
update nu_iot_yiweilian_humid_device
|
<!-- update nu_iot_yiweilian_humid_device-->
|
||||||
set nu_id = null,
|
<!-- set nu_id = null,-->
|
||||||
dimension = null
|
<!-- dimension = null-->
|
||||||
|
<!-- where nu_id = #{nuId}-->
|
||||||
|
<!-- </update>-->
|
||||||
|
|
||||||
|
<insert id="addDeviceReleaseLog">
|
||||||
|
insert into nu_iot_device_bind_log(
|
||||||
|
sn,
|
||||||
|
dimension,
|
||||||
|
device_name,
|
||||||
|
device_type,
|
||||||
|
device_model,
|
||||||
|
factory,
|
||||||
|
opt_date,
|
||||||
|
opt_type,
|
||||||
|
remarks
|
||||||
|
)
|
||||||
|
select
|
||||||
|
sn,
|
||||||
|
dimension,
|
||||||
|
device_name,
|
||||||
|
device_type,
|
||||||
|
device_model,
|
||||||
|
factory,
|
||||||
|
now(),
|
||||||
|
'释放',
|
||||||
|
'区域停用'
|
||||||
|
from nu_iot_device_preview a
|
||||||
|
where a.nu_id = #{nuId}
|
||||||
|
and ifnull(a.device_status,'') != '损坏'
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDevice">
|
||||||
|
update nu_iot_device_preview
|
||||||
|
set nu_id = null
|
||||||
where nu_id = #{nuId}
|
where nu_id = #{nuId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,10 +167,12 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSbsf(NuBaseInfo nuBaseInfo) {
|
public void updateSbsf(NuBaseInfo nuBaseInfo) {
|
||||||
baseMapper.updateSbsfTplink(nuBaseInfo.getNuId());// 更新tplink
|
// baseMapper.updateSbsfTplink(nuBaseInfo.getNuId());// 更新tplink
|
||||||
baseMapper.updateSbsfElectricity(nuBaseInfo.getNuId());// 更新电表
|
// baseMapper.updateSbsfElectricity(nuBaseInfo.getNuId());// 更新电表
|
||||||
baseMapper.updateSbsfWater(nuBaseInfo.getNuId());// 更新水表
|
// baseMapper.updateSbsfWater(nuBaseInfo.getNuId());// 更新水表
|
||||||
baseMapper.updateSbsfHumid(nuBaseInfo.getNuId());// 更新湿度计
|
// baseMapper.updateSbsfHumid(nuBaseInfo.getNuId());// 更新湿度计
|
||||||
|
baseMapper.addDeviceReleaseLog(nuBaseInfo.getNuId());// 记录设备释放日志
|
||||||
|
baseMapper.updateDevice(nuBaseInfo.getNuId());// 更新湿度计
|
||||||
// 通知运维平台设防对应设备释放
|
// 通知运维平台设防对应设备释放
|
||||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||||
String orgCode = deptInfo.getString("code");
|
String orgCode = deptInfo.getString("code");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue