摄像头、温湿度计、水表页面优化
This commit is contained in:
parent
c9e1bef6ae
commit
b952a0cf36
|
|
@ -325,6 +325,7 @@ public class CameraInfo implements Serializable {
|
||||||
private String reserveDepartName;//预留机构名称
|
private String reserveDepartName;//预留机构名称
|
||||||
private String remarks;//备注
|
private String remarks;//备注
|
||||||
private String izAllocate;//是否分配
|
private String izAllocate;//是否分配
|
||||||
|
private String dimension;//设备维度
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String routeType;//camera监控设备 network网络设备
|
private String routeType;//camera监控设备 network网络设备
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@
|
||||||
a.sn,
|
a.sn,
|
||||||
a.maintain_status,
|
a.maintain_status,
|
||||||
a.remarks,
|
a.remarks,
|
||||||
a.iz_allocate
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_id
|
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_id
|
||||||
left join nu_iot_tplink_camera_capability c on a.device_index = c.device_index
|
left join nu_iot_tplink_camera_capability c on a.device_index = c.device_index
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -124,7 +125,8 @@
|
||||||
a.ftp_password as ftpPassword,
|
a.ftp_password as ftpPassword,
|
||||||
a.ftp_uploadpath as ftpUploadpath,
|
a.ftp_uploadpath as ftpUploadpath,
|
||||||
a.remarks,
|
a.remarks,
|
||||||
a.iz_allocate
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_id
|
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_id
|
||||||
<where>
|
<where>
|
||||||
<if test="projectId != null and projectId != ''">
|
<if test="projectId != null and projectId != ''">
|
||||||
|
|
@ -170,7 +172,8 @@
|
||||||
ftp_password as ftpPassword,
|
ftp_password as ftpPassword,
|
||||||
ftp_uploadpath as ftpUploadpath,
|
ftp_uploadpath as ftpUploadpath,
|
||||||
a.remarks,
|
a.remarks,
|
||||||
a.iz_allocate
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tplink_camera a
|
from nu_iot_tplink_camera a
|
||||||
<where>
|
<where>
|
||||||
<if test="deviceType != null and deviceType != ''">
|
<if test="deviceType != null and deviceType != ''">
|
||||||
|
|
@ -225,7 +228,8 @@
|
||||||
a.ftp_password as ftpPassword,
|
a.ftp_password as ftpPassword,
|
||||||
a.ftp_uploadpath as ftpUploadpath,
|
a.ftp_uploadpath as ftpUploadpath,
|
||||||
a.remarks,
|
a.remarks,
|
||||||
a.iz_allocate
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.id
|
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.id
|
||||||
where device_index = #{deviceIndex}
|
where device_index = #{deviceIndex}
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -371,7 +375,8 @@
|
||||||
a.ftp_password as ftpPassword,
|
a.ftp_password as ftpPassword,
|
||||||
a.ftp_uploadpath as ftpUploadpath,
|
a.ftp_uploadpath as ftpUploadpath,
|
||||||
a.remarks,
|
a.remarks,
|
||||||
a.iz_allocate
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tplink_camera a
|
from nu_iot_tplink_camera a
|
||||||
where device_index = #{deviceIndex}
|
where device_index = #{deviceIndex}
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -433,7 +438,8 @@
|
||||||
a.old_depart_name as oldDepartName,
|
a.old_depart_name as oldDepartName,
|
||||||
c.area_flag as areaFlag,
|
c.area_flag as areaFlag,
|
||||||
a.remarks,
|
a.remarks,
|
||||||
a.iz_allocate
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tplink_camera a
|
from nu_iot_tplink_camera a
|
||||||
left join nu_base_info c on a.nu_id = c.nu_id
|
left join nu_base_info c on a.nu_id = c.nu_id
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -538,7 +544,8 @@
|
||||||
a.old_depart_name as oldDepartName,
|
a.old_depart_name as oldDepartName,
|
||||||
c.area_flag as areaFlag,
|
c.area_flag as areaFlag,
|
||||||
a.remarks,
|
a.remarks,
|
||||||
a.iz_allocate
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tplink_camera a
|
from nu_iot_tplink_camera a
|
||||||
left join nu_base_info c on a.nu_id = c.nu_id
|
left join nu_base_info c on a.nu_id = c.nu_id
|
||||||
where a.depart_server_url = #{params.departServerUrl}
|
where a.depart_server_url = #{params.departServerUrl}
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
if(entity==null){
|
if(entity==null){
|
||||||
//新增
|
//新增
|
||||||
cameraInfo.setIzAllocate("N");
|
cameraInfo.setIzAllocate("N");
|
||||||
|
cameraInfo.setDimension("机构维度");
|
||||||
if(cameraInfo.getDeviceType().equals("SURVEILLANCECAMERA")) {
|
if(cameraInfo.getDeviceType().equals("SURVEILLANCECAMERA")) {
|
||||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
||||||
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
||||||
|
|
@ -203,6 +204,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
||||||
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
||||||
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
||||||
|
cameraInfo.setDimension("区域维度");
|
||||||
}
|
}
|
||||||
baseMapper.insert(cameraInfo);
|
baseMapper.insert(cameraInfo);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -424,6 +426,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
if(entity==null){
|
if(entity==null){
|
||||||
//新增
|
//新增
|
||||||
cameraInfo.setIzAllocate("N");
|
cameraInfo.setIzAllocate("N");
|
||||||
|
cameraInfo.setDimension("机构维度");
|
||||||
if(cameraInfo.getDeviceType().equals("SURVEILLANCECAMERA")){
|
if(cameraInfo.getDeviceType().equals("SURVEILLANCECAMERA")){
|
||||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
||||||
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
||||||
|
|
@ -431,6 +434,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
||||||
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
||||||
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
||||||
|
cameraInfo.setDimension("区域维度");
|
||||||
}
|
}
|
||||||
baseMapper.insert(cameraInfo);
|
baseMapper.insert(cameraInfo);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ public class WaterMeter implements Serializable {
|
||||||
@Excel(name = "描述", width = 15)
|
@Excel(name = "描述", width = 15)
|
||||||
@ApiModelProperty(value = "描述")
|
@ApiModelProperty(value = "描述")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
private String izAllocate;//是否分配
|
||||||
|
private String dimension;//设备维度
|
||||||
|
|
||||||
private String nuId;//护理单元ID
|
private String nuId;//护理单元ID
|
||||||
private String nuName;//护理单元
|
private String nuName;//护理单元
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@
|
||||||
a.depart_server_url as departServerUrl,
|
a.depart_server_url as departServerUrl,
|
||||||
a.old_server_url as oldServerUrl,
|
a.old_server_url as oldServerUrl,
|
||||||
a.old_depart_id as oldDepartId,
|
a.old_depart_id as oldDepartId,
|
||||||
a.old_depart_name as oldDepartName
|
a.old_depart_name as oldDepartName,
|
||||||
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tq_water_meter a
|
from nu_iot_tq_water_meter a
|
||||||
left join nu_iot_tq_collector b on a.cid = b.cid
|
left join nu_iot_tq_collector b on a.cid = b.cid
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -57,6 +59,9 @@
|
||||||
<if test="params.checkType != null and params.checkType != '' and params.checkType == 0">
|
<if test="params.checkType != null and params.checkType != '' and params.checkType == 0">
|
||||||
AND a.nu_id is null
|
AND a.nu_id is null
|
||||||
</if>
|
</if>
|
||||||
|
<if test="params.izAllocate != null and params.izAllocate != ''">
|
||||||
|
AND a.iz_allocate = #{params.izAllocate}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -69,7 +74,9 @@
|
||||||
relay_state as relayState,
|
relay_state as relayState,
|
||||||
battery_state as batteryState,
|
battery_state as batteryState,
|
||||||
read_time as readTime,
|
read_time as readTime,
|
||||||
remark
|
remark,
|
||||||
|
iz_allocate,
|
||||||
|
dimension
|
||||||
from nu_iot_tq_water_meter
|
from nu_iot_tq_water_meter
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -90,7 +97,9 @@
|
||||||
depart_server_url as departServerUrl,
|
depart_server_url as departServerUrl,
|
||||||
old_server_url as oldServerUrl,
|
old_server_url as oldServerUrl,
|
||||||
old_depart_id as oldDepartId,
|
old_depart_id as oldDepartId,
|
||||||
old_depart_name as oldDepartName
|
old_depart_name as oldDepartName,
|
||||||
|
iz_allocate,
|
||||||
|
dimension
|
||||||
from nu_iot_tq_water_meter
|
from nu_iot_tq_water_meter
|
||||||
<where>
|
<where>
|
||||||
<if test="address != null and address != ''">
|
<if test="address != null and address != ''">
|
||||||
|
|
@ -109,6 +118,8 @@
|
||||||
relay_state,
|
relay_state,
|
||||||
battery_state,
|
battery_state,
|
||||||
remark,
|
remark,
|
||||||
|
iz_allocate,
|
||||||
|
dimension,
|
||||||
create_time
|
create_time
|
||||||
)
|
)
|
||||||
values(
|
values(
|
||||||
|
|
@ -117,6 +128,8 @@
|
||||||
#{relayState},
|
#{relayState},
|
||||||
#{batteryState},
|
#{batteryState},
|
||||||
#{remark},
|
#{remark},
|
||||||
|
'N',
|
||||||
|
'区域维度',
|
||||||
now()
|
now()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
@ -210,7 +223,9 @@
|
||||||
a.old_server_url as oldServerUrl,
|
a.old_server_url as oldServerUrl,
|
||||||
a.old_depart_id as oldDepartId,
|
a.old_depart_id as oldDepartId,
|
||||||
a.old_depart_name as oldDepartName,
|
a.old_depart_name as oldDepartName,
|
||||||
c.area_flag as areaFlag
|
c.area_flag as areaFlag,
|
||||||
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tq_water_meter a
|
from nu_iot_tq_water_meter a
|
||||||
left join nu_iot_tq_collector b on a.cid = b.cid
|
left join nu_iot_tq_collector b on a.cid = b.cid
|
||||||
left join nu_base_info c on a.nu_id = c.nu_id
|
left join nu_base_info c on a.nu_id = c.nu_id
|
||||||
|
|
@ -296,7 +311,9 @@
|
||||||
a.old_server_url as oldServerUrl,
|
a.old_server_url as oldServerUrl,
|
||||||
a.old_depart_id as oldDepartId,
|
a.old_depart_id as oldDepartId,
|
||||||
a.old_depart_name as oldDepartName,
|
a.old_depart_name as oldDepartName,
|
||||||
c.area_flag as areaFlag
|
c.area_flag as areaFlag,
|
||||||
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_tq_water_meter a
|
from nu_iot_tq_water_meter a
|
||||||
left join nu_iot_tq_collector b on a.cid = b.cid
|
left join nu_iot_tq_collector b on a.cid = b.cid
|
||||||
left join nu_base_info c on a.nu_id = c.nu_id
|
left join nu_base_info c on a.nu_id = c.nu_id
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,20 @@ public class HumidDeviceController extends JeecgController<HumidDevice, IHumidDe
|
||||||
return Result.OK("抄表成功");
|
return Result.OK("抄表成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步设备在线状态
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/syncDevicesStatus")
|
||||||
|
public Result<String> syncDevicesStatus() {
|
||||||
|
String result = service.syncDevicesStatus();
|
||||||
|
if(!result.equals("")){
|
||||||
|
return Result.error("同步失败:"+result);
|
||||||
|
}
|
||||||
|
return Result.OK("同步成功");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志分页列表查询
|
* 操作日志分页列表查询
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,8 @@ public class HumidDevice implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String oldOrgCode;//原机构编码
|
private String oldOrgCode;//原机构编码
|
||||||
private String delFlag;//停用标识 0正常 1停用
|
private String delFlag;//停用标识 0正常 1停用
|
||||||
|
private String izAllocate;//是否分配
|
||||||
|
private String dimension;//设备维度
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String checkType;
|
private String checkType;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@
|
||||||
old_server_url as oldServerUrl,
|
old_server_url as oldServerUrl,
|
||||||
sync_type,
|
sync_type,
|
||||||
del_flag as delFlag,
|
del_flag as delFlag,
|
||||||
|
iz_allocate,
|
||||||
|
a.dimension,
|
||||||
(select count(*) from nu_iot_yiweilian_humid_alarm b where a.sn = b.sn and b.status = '0') as alarmCn
|
(select count(*) from nu_iot_yiweilian_humid_alarm b where a.sn = b.sn and b.status = '0') as alarmCn
|
||||||
from nu_iot_yiweilian_humid_device a
|
from nu_iot_yiweilian_humid_device a
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -56,7 +58,17 @@
|
||||||
<if test="params.checkType != null and params.checkType != '' and params.checkType == 0">
|
<if test="params.checkType != null and params.checkType != '' and params.checkType == 0">
|
||||||
AND a.nu_id is null
|
AND a.nu_id is null
|
||||||
</if>
|
</if>
|
||||||
|
<if test="params.delFlag != null and params.delFlag != ''">
|
||||||
|
AND a.del_flag = #{params.delFlag}
|
||||||
|
</if>
|
||||||
|
<if test="params.maintainStatus != null and params.maintainStatus != ''">
|
||||||
|
AND a.maintain_status = #{params.maintainStatus}
|
||||||
|
</if>
|
||||||
|
<if test="params.izAllocate != null and params.izAllocate != ''">
|
||||||
|
AND a.iz_allocate = #{params.izAllocate}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by id
|
||||||
</select>
|
</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">
|
||||||
|
|
@ -94,6 +106,8 @@
|
||||||
old_server_url as oldServerUrl,
|
old_server_url as oldServerUrl,
|
||||||
sync_type,
|
sync_type,
|
||||||
del_flag as delFlag,
|
del_flag as delFlag,
|
||||||
|
iz_allocate,
|
||||||
|
a.dimension,
|
||||||
(select count(*) from nu_iot_yiweilian_humid_alarm b where a.sn = b.sn and b.status = '0') as alarmCn
|
(select count(*) from nu_iot_yiweilian_humid_alarm b where a.sn = b.sn and b.status = '0') as alarmCn
|
||||||
from nu_iot_yiweilian_humid_device a
|
from nu_iot_yiweilian_humid_device a
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -111,6 +125,7 @@
|
||||||
sn,
|
sn,
|
||||||
time_code,
|
time_code,
|
||||||
device_name,
|
device_name,
|
||||||
|
dimension,
|
||||||
del_flag,
|
del_flag,
|
||||||
create_time
|
create_time
|
||||||
)
|
)
|
||||||
|
|
@ -118,6 +133,7 @@
|
||||||
#{sn},
|
#{sn},
|
||||||
#{timeCode},
|
#{timeCode},
|
||||||
#{deviceName},
|
#{deviceName},
|
||||||
|
'区域维度',
|
||||||
'0',
|
'0',
|
||||||
now()
|
now()
|
||||||
)
|
)
|
||||||
|
|
@ -391,7 +407,9 @@
|
||||||
old_depart_name as oldDepartName,
|
old_depart_name as oldDepartName,
|
||||||
old_server_url as oldServerUrl,
|
old_server_url as oldServerUrl,
|
||||||
sync_type,
|
sync_type,
|
||||||
del_flag as delFlag
|
del_flag as delFlag,
|
||||||
|
iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_yiweilian_humid_device a
|
from nu_iot_yiweilian_humid_device a
|
||||||
where sn = #{sn}
|
where sn = #{sn}
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -445,7 +463,9 @@
|
||||||
a.old_depart_name as oldDepartName,
|
a.old_depart_name as oldDepartName,
|
||||||
a.old_server_url as oldServerUrl,
|
a.old_server_url as oldServerUrl,
|
||||||
sync_type as syncType,
|
sync_type as syncType,
|
||||||
c.area_flag as areaFlag
|
c.area_flag as areaFlag,
|
||||||
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_yiweilian_humid_device a
|
from nu_iot_yiweilian_humid_device a
|
||||||
left join nu_base_info c on a.nu_id = c.nu_id
|
left join nu_base_info c on a.nu_id = c.nu_id
|
||||||
where a.del_flag = '0'
|
where a.del_flag = '0'
|
||||||
|
|
@ -544,6 +564,8 @@
|
||||||
a.old_server_url as oldServerUrl,
|
a.old_server_url as oldServerUrl,
|
||||||
sync_type as syncType,
|
sync_type as syncType,
|
||||||
c.area_flag as areaFlag
|
c.area_flag as areaFlag
|
||||||
|
a.iz_allocate,
|
||||||
|
a.dimension
|
||||||
from nu_iot_yiweilian_humid_device a
|
from nu_iot_yiweilian_humid_device a
|
||||||
left join nu_base_info c on a.nu_id = c.nu_id
|
left join nu_base_info c on a.nu_id = c.nu_id
|
||||||
where a.depart_server_url = #{params.departServerUrl}
|
where a.depart_server_url = #{params.departServerUrl}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ public interface IHumidDeviceService extends IService<HumidDevice> {
|
||||||
Result<String> insertDevice(HumidDevice humidDevice);
|
Result<String> insertDevice(HumidDevice humidDevice);
|
||||||
String updateDeviceParameters(HumidDevice humidDevice,String type);
|
String updateDeviceParameters(HumidDevice humidDevice,String type);
|
||||||
String updateDeviceRealTime(HumidDevice humidDevice);
|
String updateDeviceRealTime(HumidDevice humidDevice);
|
||||||
|
String syncDevicesStatus();
|
||||||
Result<String> updateDevice(HumidDevice humidDevice);
|
Result<String> updateDevice(HumidDevice humidDevice);
|
||||||
void updateValue(HumidDevice humidDevice);
|
void updateValue(HumidDevice humidDevice);
|
||||||
Result<String> delFlagDevice(HumidDevice humidDevice);
|
Result<String> delFlagDevice(HumidDevice humidDevice);
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String updateDeviceParameters(HumidDevice humidDevice, String type) {
|
public String updateDeviceParameters(HumidDevice humidDevice, String type) {
|
||||||
Map<String, Object> params = getParmas(0, 100, humidDevice);
|
Map<String, Object> params = getParams(0, 100, humidDevice);
|
||||||
return updateDeviceConfigs(params, humidDevice, type);
|
return updateDeviceConfigs(params, humidDevice, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getParmas(int page, int limit, HumidDevice humidDevice) {
|
private Map<String, Object> getParams(int page, int limit, HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("rows", limit);
|
params.put("rows", limit);
|
||||||
params.put("page", page);
|
params.put("page", page);
|
||||||
|
|
@ -193,7 +193,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
baseMapper.insertLog(dh);
|
baseMapper.insertLog(dh);
|
||||||
}
|
}
|
||||||
if ((page + 1) * limit < count) {
|
if ((page + 1) * limit < count) {
|
||||||
Map<String, Object> params = getParmas(page + 1, limit, humidDevice);
|
Map<String, Object> params = getParams(page + 1, limit, humidDevice);
|
||||||
errorMsg += updateDeviceConfigs(params, humidDevice, type);
|
errorMsg += updateDeviceConfigs(params, humidDevice, type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -210,7 +210,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String updateDeviceRealTime(HumidDevice humidDevice) {
|
public String updateDeviceRealTime(HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = getRealTimeParmas(0, 50, humidDevice);
|
Map<String, Object> params = getRealTimeParams(0, 50, humidDevice);
|
||||||
return updateDeviceRealTimeData(params, humidDevice);
|
return updateDeviceRealTimeData(params, humidDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
* @param humidDevice
|
* @param humidDevice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getRealTimeParmas(int page, int limit, HumidDevice humidDevice) {
|
private Map<String, Object> getRealTimeParams(int page, int limit, HumidDevice humidDevice) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("rows", limit);
|
params.put("rows", limit);
|
||||||
params.put("page", page);
|
params.put("page", page);
|
||||||
|
|
@ -311,7 +311,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
syncStatusMq(dh);
|
syncStatusMq(dh);
|
||||||
}
|
}
|
||||||
if ((page + 1) * limit < count) {
|
if ((page + 1) * limit < count) {
|
||||||
Map<String, Object> params = getParmas(page + 1, limit, humidDevice);
|
Map<String, Object> params = getParams(page + 1, limit, humidDevice);
|
||||||
errorMsg += updateDeviceRealTimeData(params, humidDevice);
|
errorMsg += updateDeviceRealTimeData(params, humidDevice);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -320,6 +320,95 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
return errorMsg;
|
return errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备在线状态
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String syncDevicesStatus(){
|
||||||
|
return getSyncStatusParams(1,50);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSyncStatusParams(int pageNo, int limit){
|
||||||
|
String errorMsg = "";
|
||||||
|
Page<HumidDevice> page = new Page<HumidDevice>(pageNo, limit);
|
||||||
|
HumidDevice humidDevice = new HumidDevice();
|
||||||
|
humidDevice.setDelFlag("0");
|
||||||
|
humidDevice.setMaintainStatus("0");
|
||||||
|
IPage<HumidDevice> pageList = baseMapper.findPage(page,humidDevice);
|
||||||
|
List<HumidDevice> list = pageList.getRecords();
|
||||||
|
if(list!=null&&list.size()>0){
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("rows", list.size());
|
||||||
|
params.put("page", pageNo-1);
|
||||||
|
String[] str = new String[list.size()];
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
HumidDevice entity = list.get(i);
|
||||||
|
String sn = entity.getSn();
|
||||||
|
str[i] = sn;
|
||||||
|
}
|
||||||
|
params.put("snList", str);
|
||||||
|
errorMsg += updateDeviceSyncStatus(params);
|
||||||
|
errorMsg += getSyncStatusParams(pageNo+1,limit);
|
||||||
|
}
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String updateDeviceSyncStatus(Map<String, Object> map) {
|
||||||
|
String errorMsg = "";
|
||||||
|
String responseStr = yiweilianApi.getRealTime(map);
|
||||||
|
JSONObject jsonObject = new JSONObject(responseStr);
|
||||||
|
Integer responseCode = jsonObject.getInt("code");
|
||||||
|
if (responseCode.equals(0)) {
|
||||||
|
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||||
|
JSONArray dataArr = dataObj.getJSONArray("dataList");
|
||||||
|
if (dataArr.size() > 0) {
|
||||||
|
for (int i = 0; i < dataArr.size(); i++) {
|
||||||
|
HumidDevice dh = new HumidDevice();
|
||||||
|
JSONObject json = (JSONObject) dataArr.get(i);
|
||||||
|
String sn = json.getStr("sn");
|
||||||
|
String status = json.getStr("status");
|
||||||
|
String electricity = json.getStr("electricity");
|
||||||
|
String temperature = json.getStr("temperature");
|
||||||
|
String humidity = json.getStr("humidity");
|
||||||
|
String reportingTime = json.getStr("date");
|
||||||
|
dh.setStatus(status);
|
||||||
|
Date reportingDate = DateUtil.parse(reportingTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
Calendar ca = Calendar.getInstance();
|
||||||
|
ca.add(Calendar.MINUTE, -5);
|
||||||
|
Date currentDate = ca.getTime();
|
||||||
|
if (reportingDate.getTime() <= currentDate.getTime()) {
|
||||||
|
dh.setStatus("1");
|
||||||
|
}
|
||||||
|
dh.setSn(sn);
|
||||||
|
dh.setElectricity(electricity);
|
||||||
|
dh.setTemperature(temperature);
|
||||||
|
dh.setHumidity(humidity);
|
||||||
|
dh.setReportingTime(reportingTime);
|
||||||
|
baseMapper.updateValue(dh);
|
||||||
|
dh.setOptType("read");
|
||||||
|
try {
|
||||||
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
if (sysUser != null) {
|
||||||
|
dh.setOptBy(sysUser.getUsername());
|
||||||
|
} else {
|
||||||
|
dh.setOptBy("system_scheduler");
|
||||||
|
}
|
||||||
|
} catch (UnavailableSecurityManagerException e) {
|
||||||
|
// 定时任务线程,使用系统用户
|
||||||
|
dh.setOptBy("system_scheduler");
|
||||||
|
log.debug("Using system user for scheduled task");
|
||||||
|
}
|
||||||
|
baseMapper.insertLog(dh);
|
||||||
|
syncStatusMq(dh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errorMsg = jsonObject.getStr("msg");
|
||||||
|
}
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步到业务系统
|
* 同步到业务系统
|
||||||
*
|
*
|
||||||
|
|
@ -342,7 +431,9 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
log.setServerType("温湿度计");
|
log.setServerType("温湿度计");
|
||||||
logService.addLog(log);
|
logService.addLog(log);
|
||||||
ihd.setLogId(logId);
|
ihd.setLogId(logId);
|
||||||
rabbitMQUtil.sendToExchange("hldy.iotDeviceValues", entity.getDepartServerUrl() + ".ywIotHumid.status.async", ihd);
|
if(entity.getDepartServerUrl()!=null&&!entity.getDepartServerUrl().equals("")){
|
||||||
|
rabbitMQUtil.sendToExchange("hldy.iotDeviceValues", entity.getDepartServerUrl() + ".ywIotHumid.status.async", ihd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -437,7 +528,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
||||||
if (humidDevice.getSn() == null || humidDevice.getSn().equals("")) {
|
if (humidDevice.getSn() == null || humidDevice.getSn().equals("")) {
|
||||||
return Result.error("请指定设备SN号");
|
return Result.error("请指定设备SN号");
|
||||||
}
|
}
|
||||||
Map<String, Object> params = getParmas(0, 1, humidDevice);
|
Map<String, Object> params = getParams(0, 1, humidDevice);
|
||||||
HumidDevice deviceParameters = getDeviceConfigs(params);
|
HumidDevice deviceParameters = getDeviceConfigs(params);
|
||||||
if (deviceParameters != null) {
|
if (deviceParameters != null) {
|
||||||
return Result.OK(deviceParameters);
|
return Result.OK(deviceParameters);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue