摄像头、温湿度计、水表页面优化
This commit is contained in:
parent
c9e1bef6ae
commit
b952a0cf36
|
|
@ -325,6 +325,7 @@ public class CameraInfo implements Serializable {
|
|||
private String reserveDepartName;//预留机构名称
|
||||
private String remarks;//备注
|
||||
private String izAllocate;//是否分配
|
||||
private String dimension;//设备维度
|
||||
|
||||
@TableField(exist = false)
|
||||
private String routeType;//camera监控设备 network网络设备
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@
|
|||
a.sn,
|
||||
a.maintain_status,
|
||||
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
|
||||
left join nu_iot_tplink_camera_capability c on a.device_index = c.device_index
|
||||
<where>
|
||||
|
|
@ -124,7 +125,8 @@
|
|||
a.ftp_password as ftpPassword,
|
||||
a.ftp_uploadpath as ftpUploadpath,
|
||||
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
|
||||
<where>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
|
|
@ -170,7 +172,8 @@
|
|||
ftp_password as ftpPassword,
|
||||
ftp_uploadpath as ftpUploadpath,
|
||||
a.remarks,
|
||||
a.iz_allocate
|
||||
a.iz_allocate,
|
||||
a.dimension
|
||||
from nu_iot_tplink_camera a
|
||||
<where>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
|
|
@ -225,7 +228,8 @@
|
|||
a.ftp_password as ftpPassword,
|
||||
a.ftp_uploadpath as ftpUploadpath,
|
||||
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
|
||||
where device_index = #{deviceIndex}
|
||||
</select>
|
||||
|
|
@ -371,7 +375,8 @@
|
|||
a.ftp_password as ftpPassword,
|
||||
a.ftp_uploadpath as ftpUploadpath,
|
||||
a.remarks,
|
||||
a.iz_allocate
|
||||
a.iz_allocate,
|
||||
a.dimension
|
||||
from nu_iot_tplink_camera a
|
||||
where device_index = #{deviceIndex}
|
||||
</select>
|
||||
|
|
@ -433,7 +438,8 @@
|
|||
a.old_depart_name as oldDepartName,
|
||||
c.area_flag as areaFlag,
|
||||
a.remarks,
|
||||
a.iz_allocate
|
||||
a.iz_allocate,
|
||||
a.dimension
|
||||
from nu_iot_tplink_camera a
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
<where>
|
||||
|
|
@ -538,7 +544,8 @@
|
|||
a.old_depart_name as oldDepartName,
|
||||
c.area_flag as areaFlag,
|
||||
a.remarks,
|
||||
a.iz_allocate
|
||||
a.iz_allocate,
|
||||
a.dimension
|
||||
from nu_iot_tplink_camera a
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
where a.depart_server_url = #{params.departServerUrl}
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
if(entity==null){
|
||||
//新增
|
||||
cameraInfo.setIzAllocate("N");
|
||||
cameraInfo.setDimension("机构维度");
|
||||
if(cameraInfo.getDeviceType().equals("SURVEILLANCECAMERA")) {
|
||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
||||
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
||||
|
|
@ -203,6 +204,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
||||
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
||||
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
||||
cameraInfo.setDimension("区域维度");
|
||||
}
|
||||
baseMapper.insert(cameraInfo);
|
||||
}else{
|
||||
|
|
@ -424,6 +426,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
if(entity==null){
|
||||
//新增
|
||||
cameraInfo.setIzAllocate("N");
|
||||
cameraInfo.setDimension("机构维度");
|
||||
if(cameraInfo.getDeviceType().equals("SURVEILLANCECAMERA")){
|
||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
||||
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
||||
|
|
@ -431,6 +434,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
||||
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
||||
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
||||
cameraInfo.setDimension("区域维度");
|
||||
}
|
||||
baseMapper.insert(cameraInfo);
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ public class WaterMeter implements Serializable {
|
|||
@Excel(name = "描述", width = 15)
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String remark;
|
||||
private String izAllocate;//是否分配
|
||||
private String dimension;//设备维度
|
||||
|
||||
private String nuId;//护理单元ID
|
||||
private String nuName;//护理单元
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@
|
|||
a.depart_server_url as departServerUrl,
|
||||
a.old_server_url as oldServerUrl,
|
||||
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
|
||||
left join nu_iot_tq_collector b on a.cid = b.cid
|
||||
<where>
|
||||
|
|
@ -57,6 +59,9 @@
|
|||
<if test="params.checkType != null and params.checkType != '' and params.checkType == 0">
|
||||
AND a.nu_id is null
|
||||
</if>
|
||||
<if test="params.izAllocate != null and params.izAllocate != ''">
|
||||
AND a.iz_allocate = #{params.izAllocate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -69,7 +74,9 @@
|
|||
relay_state as relayState,
|
||||
battery_state as batteryState,
|
||||
read_time as readTime,
|
||||
remark
|
||||
remark,
|
||||
iz_allocate,
|
||||
dimension
|
||||
from nu_iot_tq_water_meter
|
||||
</select>
|
||||
|
||||
|
|
@ -90,7 +97,9 @@
|
|||
depart_server_url as departServerUrl,
|
||||
old_server_url as oldServerUrl,
|
||||
old_depart_id as oldDepartId,
|
||||
old_depart_name as oldDepartName
|
||||
old_depart_name as oldDepartName,
|
||||
iz_allocate,
|
||||
dimension
|
||||
from nu_iot_tq_water_meter
|
||||
<where>
|
||||
<if test="address != null and address != ''">
|
||||
|
|
@ -109,6 +118,8 @@
|
|||
relay_state,
|
||||
battery_state,
|
||||
remark,
|
||||
iz_allocate,
|
||||
dimension,
|
||||
create_time
|
||||
)
|
||||
values(
|
||||
|
|
@ -117,6 +128,8 @@
|
|||
#{relayState},
|
||||
#{batteryState},
|
||||
#{remark},
|
||||
'N',
|
||||
'区域维度',
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
|
@ -210,7 +223,9 @@
|
|||
a.old_server_url as oldServerUrl,
|
||||
a.old_depart_id as oldDepartId,
|
||||
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
|
||||
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
|
||||
|
|
@ -296,7 +311,9 @@
|
|||
a.old_server_url as oldServerUrl,
|
||||
a.old_depart_id as oldDepartId,
|
||||
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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -114,6 +114,20 @@ public class HumidDeviceController extends JeecgController<HumidDevice, IHumidDe
|
|||
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)
|
||||
private String oldOrgCode;//原机构编码
|
||||
private String delFlag;//停用标识 0正常 1停用
|
||||
private String izAllocate;//是否分配
|
||||
private String dimension;//设备维度
|
||||
|
||||
@TableField(exist = false)
|
||||
private String checkType;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
old_server_url as oldServerUrl,
|
||||
sync_type,
|
||||
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
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
<where>
|
||||
|
|
@ -56,7 +58,17 @@
|
|||
<if test="params.checkType != null and params.checkType != '' and params.checkType == 0">
|
||||
AND a.nu_id is null
|
||||
</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>
|
||||
order by id
|
||||
</select>
|
||||
|
||||
<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,
|
||||
sync_type,
|
||||
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
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
<where>
|
||||
|
|
@ -111,6 +125,7 @@
|
|||
sn,
|
||||
time_code,
|
||||
device_name,
|
||||
dimension,
|
||||
del_flag,
|
||||
create_time
|
||||
)
|
||||
|
|
@ -118,6 +133,7 @@
|
|||
#{sn},
|
||||
#{timeCode},
|
||||
#{deviceName},
|
||||
'区域维度',
|
||||
'0',
|
||||
now()
|
||||
)
|
||||
|
|
@ -391,7 +407,9 @@
|
|||
old_depart_name as oldDepartName,
|
||||
old_server_url as oldServerUrl,
|
||||
sync_type,
|
||||
del_flag as delFlag
|
||||
del_flag as delFlag,
|
||||
iz_allocate,
|
||||
a.dimension
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
where sn = #{sn}
|
||||
</select>
|
||||
|
|
@ -445,7 +463,9 @@
|
|||
a.old_depart_name as oldDepartName,
|
||||
a.old_server_url as oldServerUrl,
|
||||
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
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
where a.del_flag = '0'
|
||||
|
|
@ -544,6 +564,8 @@
|
|||
a.old_server_url as oldServerUrl,
|
||||
sync_type as syncType,
|
||||
c.area_flag as areaFlag
|
||||
a.iz_allocate,
|
||||
a.dimension
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
where a.depart_server_url = #{params.departServerUrl}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public interface IHumidDeviceService extends IService<HumidDevice> {
|
|||
Result<String> insertDevice(HumidDevice humidDevice);
|
||||
String updateDeviceParameters(HumidDevice humidDevice,String type);
|
||||
String updateDeviceRealTime(HumidDevice humidDevice);
|
||||
String syncDevicesStatus();
|
||||
Result<String> updateDevice(HumidDevice humidDevice);
|
||||
void updateValue(HumidDevice humidDevice);
|
||||
Result<String> delFlagDevice(HumidDevice humidDevice);
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
*/
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
* @param humidDevice
|
||||
* @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<>();
|
||||
params.put("rows", limit);
|
||||
params.put("page", page);
|
||||
|
|
@ -193,7 +193,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
baseMapper.insertLog(dh);
|
||||
}
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -210,7 +210,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
*/
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
* @param humidDevice
|
||||
* @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<>();
|
||||
params.put("rows", limit);
|
||||
params.put("page", page);
|
||||
|
|
@ -311,7 +311,7 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
syncStatusMq(dh);
|
||||
}
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -320,6 +320,95 @@ public class HumidDeviceServiceImpl extends ServiceImpl<HumidDeviceMapper, Humid
|
|||
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("温湿度计");
|
||||
logService.addLog(log);
|
||||
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("")) {
|
||||
return Result.error("请指定设备SN号");
|
||||
}
|
||||
Map<String, Object> params = getParmas(0, 1, humidDevice);
|
||||
Map<String, Object> params = getParams(0, 1, humidDevice);
|
||||
HumidDevice deviceParameters = getDeviceConfigs(params);
|
||||
if (deviceParameters != null) {
|
||||
return Result.OK(deviceParameters);
|
||||
|
|
|
|||
Loading…
Reference in New Issue