物联设备BUG处理
This commit is contained in:
parent
23e1a0003d
commit
8fdd37fdac
|
|
@ -127,8 +127,7 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
|||
*/
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DeviceManager deviceManager) {
|
||||
service.updateManager(deviceManager);
|
||||
return Result.OK("编辑成功!");
|
||||
return service.updateManager(deviceManager);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -52,5 +52,7 @@ public class DeviceManager implements Serializable {
|
|||
private String onlineStatus;//在线状态
|
||||
private String deviceStatus;//设备状态
|
||||
private Integer ywId;//运维ID
|
||||
@TableField(exist = false)
|
||||
private String deviceIndex;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
|||
public interface DeviceManagerMapper extends BaseMapper<DeviceManager> {
|
||||
IPage<DeviceManager> findPage(Page<DeviceManager> page, @Param("params") DeviceManager deviceManager);
|
||||
IPage<DeviceManager> findAllPage(Page<DeviceManager> page, @Param("params") DeviceManager deviceManager);
|
||||
DeviceManager findBySn(DeviceManager deviceManager);
|
||||
IPage<DeviceBindLog> findBingLogPage(Page<DeviceBindLog> page, @Param("params") DeviceBindLog deviceBindLog);
|
||||
void addLog(DeviceBindLog deviceBindLog);
|
||||
List<DeviceManager> queryNuList(DeviceManager deviceManager);
|
||||
|
|
|
|||
|
|
@ -18,24 +18,29 @@
|
|||
a.remarks,
|
||||
a.device_status,
|
||||
ifnull(t.online_status,'待集成') as online_status,
|
||||
a.yw_id
|
||||
a.yw_id,
|
||||
t.device_index
|
||||
from nu_iot_device_preview a
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
left join (
|
||||
select mac as sn,
|
||||
( case device_status when '0' then '离线' when '1' then '在线' end ) as online_status
|
||||
( case device_status when '0' then '离线' when '1' then '在线' end ) as online_status,
|
||||
device_index
|
||||
from nu_iot_tplink_camera
|
||||
union all
|
||||
select sn,
|
||||
( case relay_state when '0' then '离线' else '在线' end ) as online_status
|
||||
( case relay_state when '0' then '离线' else '在线' end ) as online_status,
|
||||
'' as device_index
|
||||
from nu_iot_ds_electricity_meter
|
||||
union all
|
||||
select cid as sn,
|
||||
( case relay_state when '0' then '离线' else '在线' end ) as online_status
|
||||
( case relay_state when '0' then '离线' else '在线' end ) as online_status,
|
||||
'' as device_index
|
||||
from nu_iot_tq_water_meter
|
||||
union all
|
||||
select sn,
|
||||
( case status when '0' then '在线' else '离线' end ) as online_status
|
||||
( case status when '0' then '在线' else '离线' end ) as online_status,
|
||||
'' as device_index
|
||||
from nu_iot_yiweilian_humid_device
|
||||
) t on a.sn = t.sn
|
||||
where a.sn is not null
|
||||
|
|
@ -77,6 +82,24 @@
|
|||
order by a.dimension,a.device_type,a.device_model,a.sn
|
||||
</select>
|
||||
|
||||
<select id="findBySn" parameterType="com.nu.modules.manager.entity.DeviceManager" resultType="com.nu.modules.manager.entity.DeviceManager">
|
||||
select
|
||||
a.id,
|
||||
a.dimension,
|
||||
a.device_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
a.factory,
|
||||
a.sn,
|
||||
a.create_time,
|
||||
a.update_time,
|
||||
a.remarks,
|
||||
a.device_status,
|
||||
a.yw_id
|
||||
from nu_iot_device_preview a
|
||||
where a.sn = #{sn}
|
||||
</select>
|
||||
|
||||
<select id="findBingLogPage" parameterType="com.nu.modules.manager.entity.DeviceBindLog" resultType="com.nu.modules.manager.entity.DeviceBindLog">
|
||||
select
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.nu.modules.tplink.camera.entity.CameraInfo;
|
|||
import com.nu.modules.tq.electricity.entity.ElectricityMeter;
|
||||
import com.nu.modules.tq.water.entity.WaterMeter;
|
||||
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -23,7 +24,7 @@ public interface IDeviceManagerService extends IService<DeviceManager> {
|
|||
IPage<DeviceManager> findPage(Page<DeviceManager> page, DeviceManager deviceManager);
|
||||
IPage<DeviceManager> findAllPage(Page<DeviceManager> page, DeviceManager deviceManager);
|
||||
IPage<DeviceBindLog> findBingLogPage(Page<DeviceBindLog> page, DeviceBindLog deviceBindLog);
|
||||
void updateManager(DeviceManager deviceManager);
|
||||
Result<String> updateManager(DeviceManager deviceManager);
|
||||
void addLog(DeviceBindLog deviceBindLog);
|
||||
List<DeviceManager> queryNuList(DeviceManager deviceManager);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.nu.modules.tq.water.entity.WaterMeter;
|
|||
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -56,12 +57,17 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateManager(DeviceManager deviceManager){
|
||||
public Result<String> updateManager(DeviceManager deviceManager){
|
||||
DeviceManager entity = baseMapper.findBySn(deviceManager);
|
||||
if(entity!=null){
|
||||
return Result.error("编辑失败,设备标识已存在!");
|
||||
}
|
||||
baseMapper.updateById(deviceManager);
|
||||
//同步给运维平台
|
||||
DevicePreviewMqDto dto = new DevicePreviewMqDto();
|
||||
BeanUtils.copyProperties(deviceManager, dto);
|
||||
rabbitMQUtil.sendToExchange("hldy.iotsyncbiz", "iotsyncbiz.editpreviewsn", dto);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue