摄像头同步
This commit is contained in:
parent
d89db5bd19
commit
74e70bd5cd
|
@ -11,12 +11,10 @@
|
|||
*/
|
||||
package com.nu.modules.tplink.camera.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nu.modules.tplink.camera.entity.NuBaseInfo;
|
||||
import com.nu.modules.tplink.camera.model.CameraTreeModel;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -27,7 +25,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import com.nu.modules.tplink.camera.service.ICameraInfoService;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import com.nu.modules.tplink.camera.entity.CameraInfo;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -563,4 +560,110 @@ public class CameraInfoController extends JeecgController<CameraInfo, ICameraInf
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 摄像头源数据查询
|
||||
*
|
||||
* @param cameraInfo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/sourceList")
|
||||
public Result<IPage<CameraInfo>> sourceList(CameraInfo cameraInfo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Page<CameraInfo> page = new Page<CameraInfo>(pageNo, pageSize);
|
||||
IPage<CameraInfo> pageList = service.findSourcePage(page, cameraInfo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 摄像头数据中机构列表查询
|
||||
*
|
||||
* @param cameraInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/departList")
|
||||
public Result<List<CameraInfo>> departList(CameraInfo cameraInfo) {
|
||||
List<CameraInfo> list = service.findDepartList(cameraInfo);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 摄像头数据中区域列表查询
|
||||
*
|
||||
* @param cameraInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/departNuList")
|
||||
public Result<List<CameraInfo>> departNuList(CameraInfo cameraInfo) {
|
||||
List<CameraInfo> list = service.findNuList(cameraInfo);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 摄像头数据中已同步列表查询
|
||||
*
|
||||
* @param cameraInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/businessList")
|
||||
public Result<IPage<CameraInfo>> businessList(CameraInfo cameraInfo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Page<CameraInfo> page = new Page<CameraInfo>(pageNo, pageSize);
|
||||
IPage<CameraInfo> pageList = service.findBusinessPage(page,cameraInfo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以设备维度同步摄像头到业务
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/syncDevices")
|
||||
public Result<String> syncDevices(@RequestBody List<CameraInfo> list) {
|
||||
String result = service.syncDevices(list);
|
||||
if(StringUtils.equals(result,"0")){
|
||||
return Result.OK("操作成功!");
|
||||
}else if (StringUtils.equals(result,"1")){
|
||||
return Result.error("参数为空!");
|
||||
}else if (StringUtils.equals(result,"2")){
|
||||
return Result.error("设备ID为空!");
|
||||
}else{
|
||||
return Result.error("其他错误,请联系管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 摄像头同步日志列表查询
|
||||
*
|
||||
* @param cameraInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/syncLogList")
|
||||
public Result<IPage<CameraInfo>> syncLogList(CameraInfo cameraInfo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Page<CameraInfo> page = new Page<CameraInfo>(pageNo, pageSize);
|
||||
IPage<CameraInfo> pageList = service.findSyncLogPage(page, cameraInfo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定完摄像头的区域列表查询
|
||||
*
|
||||
* @param cameraInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/nuSyncList")
|
||||
public Result<IPage<CameraInfo>> nuSyncList(CameraInfo cameraInfo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Page<CameraInfo> page = new Page<CameraInfo>(pageNo, pageSize);
|
||||
IPage<CameraInfo> pageList = service.findNuSyncPage(page, cameraInfo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.nu.modules.tplink.camera.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
@ -137,7 +138,6 @@ public class CameraInfo implements Serializable {
|
|||
private String nuId;
|
||||
/**护理单元*/
|
||||
@ApiModelProperty(value = "护理单元")
|
||||
@TableField(exist = false)
|
||||
private String nuName;
|
||||
@ApiModelProperty(value = "码流类型 0 代表主码流,1 代码子码流")
|
||||
@TableField(exist = false)
|
||||
|
@ -308,7 +308,6 @@ public class CameraInfo implements Serializable {
|
|||
private String ftpPassword; //回放视频转FTP上传密码
|
||||
private String ftpUploadpath; //回放视频转FTP上传路径
|
||||
|
||||
|
||||
private String departId;//机构ID
|
||||
private String departName;//机构名称
|
||||
private String departServerUrl;//机构服务地址
|
||||
|
@ -320,4 +319,30 @@ public class CameraInfo implements Serializable {
|
|||
|
||||
@TableField(exist = false)
|
||||
private String checkType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String actionType;//操作类型
|
||||
@Dict(dicCode = "nu_type")
|
||||
@TableField(exist = false)
|
||||
private String areaFlag;//区域标签
|
||||
private Integer deviceNum;//已绑定设备数
|
||||
@TableField(exist = false)
|
||||
private String orgCode;//机构编码
|
||||
@TableField(exist = false)
|
||||
private String oldOrgCode;//原机构编码
|
||||
@TableField(exist = false)
|
||||
private String viewType;//选择,未选择 用于设备同步功能
|
||||
@TableField(exist = false)
|
||||
private String dataType;//数据类型
|
||||
@TableField(exist = false)
|
||||
private String status;//状态
|
||||
@TableField(exist = false)
|
||||
private String sn;//设备号
|
||||
@TableField(exist = false)
|
||||
private String serverType;//服务类型
|
||||
@TableField(exist = false)
|
||||
private String oldNuId;//原护理单元ID
|
||||
@TableField(exist = false)
|
||||
private String createTime;//时间
|
||||
private List<CameraInfo> seedList;//子列表
|
||||
}
|
||||
|
|
|
@ -28,9 +28,21 @@ public interface CameraInfoMapper extends BaseMapper<CameraInfo> {
|
|||
CameraInfo getCapabilityByDeviceId(CameraInfo cameraInfo);
|
||||
void insertCapability(CameraInfo cameraInfo);
|
||||
void updateCapabilityById(CameraInfo cameraInfo);
|
||||
void deleteCapabilityById(CameraInfo cameraInfo);
|
||||
void updatePlanByDevId(CameraInfo cameraInfo);
|
||||
|
||||
IPage<NuBaseInfo> getNuBaseList(Page<NuBaseInfo> page, @Param("params") NuBaseInfo nuBaseInfo);
|
||||
|
||||
void updateDepartById(@Param("params") CameraInfo cameraInfo);
|
||||
|
||||
CameraInfo getCameraInfo(CameraInfo cameraInfo);
|
||||
void deleteCameraInfo(CameraInfo cameraInfo);
|
||||
void updateSync(CameraInfo cameraInfo);
|
||||
IPage<CameraInfo> findSourcePage(Page<CameraInfo> page, @Param("params") CameraInfo cameraInfo);
|
||||
List<CameraInfo> findDepartList(CameraInfo cameraInfo);
|
||||
List<CameraInfo> findNuList(CameraInfo cameraInfo);
|
||||
IPage<CameraInfo> findBusinessPage(Page<CameraInfo> page,@Param("params") CameraInfo cameraInfo);
|
||||
IPage<CameraInfo> findSyncLogMainPage(Page<CameraInfo> page,@Param("params") CameraInfo cameraInfo);
|
||||
List<CameraInfo> findSyncLogSeedList(CameraInfo cameraInfo);
|
||||
IPage<CameraInfo> findNuSyncPage(Page<CameraInfo> page,@Param("params") CameraInfo cameraInfo);
|
||||
}
|
||||
|
|
|
@ -288,13 +288,16 @@
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCapabilityById">
|
||||
DELETE FROM nu_iot_tplink_camera_capability WHERE device_index = #{deviceIndex}
|
||||
</delete>
|
||||
|
||||
<update id="updatePlanByDevId">
|
||||
UPDATE nu_iot_tplink_camera
|
||||
SET record_plan_id = #{recordPlanId}
|
||||
where device_index = #{deviceIndex}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getNuBaseList" parameterType="com.nu.modules.tplink.camera.entity.NuBaseInfo" resultType="com.nu.modules.tplink.camera.entity.NuBaseInfo">
|
||||
select * from nu_base_info where del_flag = '0'
|
||||
</select>
|
||||
|
@ -302,4 +305,275 @@
|
|||
<update id="updateDepartById" parameterType="com.nu.modules.tplink.camera.entity.NuBaseInfo" >
|
||||
update nu_iot_tplink_camera set nu_id = null,nu_name = null,depart_id = null,depart_name = null,depart_server_url=null where id = #{params.id}
|
||||
</update>
|
||||
|
||||
<select id="getCameraInfo" 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,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.ftp_ip as ftpIp,
|
||||
a.ftp_port as ftpPort,
|
||||
a.ftp_username as ftpUsername,
|
||||
a.ftp_password as ftpPassword,
|
||||
a.ftp_uploadpath as ftpUploadpath
|
||||
from nu_iot_tplink_camera a
|
||||
where device_index = #{deviceIndex}
|
||||
</select>
|
||||
|
||||
<delete id="deleteCameraInfo">
|
||||
DELETE FROM nu_iot_tplink_camera WHERE device_index = #{deviceIndex}
|
||||
</delete>
|
||||
|
||||
<update id="updateSync" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
update nu_iot_tplink_camera
|
||||
set
|
||||
sync_type = #{syncType},
|
||||
nu_id = #{nuId},
|
||||
nu_name = #{nuName},
|
||||
depart_server_url = #{departServerUrl},
|
||||
depart_id = #{departId},
|
||||
depart_name = #{departName},
|
||||
old_server_url = #{oldServerUrl},
|
||||
old_depart_id = #{oldDepartId},
|
||||
old_depart_name = #{oldDepartName}
|
||||
where device_index = #{deviceIndex}
|
||||
</update>
|
||||
|
||||
<select id="findSourcePage" 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,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.ftp_ip as ftpIp,
|
||||
a.ftp_port as ftpPort,
|
||||
a.ftp_username as ftpUsername,
|
||||
a.ftp_password as ftpPassword,
|
||||
a.ftp_uploadpath as ftpUploadpath,
|
||||
a.depart_id as departId,
|
||||
a.depart_name as departName,
|
||||
a.depart_server_url as departServerUrl,
|
||||
a.old_server_url as oldServerUrl,
|
||||
a.old_depart_id as oldDepartId,
|
||||
a.old_depart_name as oldDepartName,
|
||||
c.area_flag as areaFlag
|
||||
from nu_iot_tplink_camera a
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
<where>
|
||||
<if test="params.deviceIndex != null and params.deviceIndex != ''">
|
||||
AND a.device_index = #{params.deviceIndex}
|
||||
</if>
|
||||
<if test="params.mac != null and params.mac != ''">
|
||||
AND a.mac LIKE concat('%',#{params.mac},'%')
|
||||
</if>
|
||||
<if test="params.viewType != null and params.viewType == 'unselected'">
|
||||
AND ifnull(a.nu_id,'') = ''
|
||||
</if>
|
||||
<if test="params.viewType != null and params.viewType == 'selected'">
|
||||
AND ifnull(a.nu_id,'') != ''
|
||||
<if test="params.nuId != null and params.nuId != ''">
|
||||
AND a.nu_id = #{params.nuId}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.depart_id = #{params.departId}
|
||||
</if>
|
||||
<if test="params.status != null and params.status != ''">
|
||||
AND c.del_flag = #{params.status}
|
||||
</if>
|
||||
<if test="params.departServerUrl != null and params.departServerUrl != ''">
|
||||
AND a.depart_server_url != #{params.departServerUrl}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="findDepartList" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
select distinct
|
||||
depart_id as departId,
|
||||
depart_name as departName
|
||||
from nu_iot_tplink_camera
|
||||
where depart_id is not null
|
||||
<if test="departServerUrl != null and departServerUrl != ''">
|
||||
<if test="dataType != null and dataType == 'source'">
|
||||
AND depart_server_url != #{departServerUrl}
|
||||
</if>
|
||||
<if test="dataType != null and dataType == 'business'">
|
||||
AND depart_server_url = #{departServerUrl}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findNuList" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
select distinct
|
||||
nu_id as nuId,
|
||||
nu_name as nuName
|
||||
from nu_iot_tplink_camera
|
||||
where nu_id is not null
|
||||
<if test="departId != null and departId != ''">
|
||||
AND depart_id = #{departId}
|
||||
</if>
|
||||
<if test="departServerUrl != null and departServerUrl != ''">
|
||||
<if test="dataType != null and dataType == 'source'">
|
||||
AND depart_server_url != #{departServerUrl}
|
||||
</if>
|
||||
<if test="dataType != null and dataType == 'business'">
|
||||
AND depart_server_url = #{departServerUrl}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findBusinessPage" 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,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.ftp_ip as ftpIp,
|
||||
a.ftp_port as ftpPort,
|
||||
a.ftp_username as ftpUsername,
|
||||
a.ftp_password as ftpPassword,
|
||||
a.ftp_uploadpath as ftpUploadpath,
|
||||
a.depart_id as departId,
|
||||
a.depart_name as departName,
|
||||
a.depart_server_url as departServerUrl,
|
||||
a.old_server_url as oldServerUrl,
|
||||
a.old_depart_id as oldDepartId,
|
||||
a.old_depart_name as oldDepartName,
|
||||
c.area_flag as areaFlag
|
||||
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}
|
||||
<if test="params.deviceIndex != null and params.deviceIndex != ''">
|
||||
AND a.device_index = #{params.deviceIndex}
|
||||
</if>
|
||||
<if test="params.mac != null and params.mac != ''">
|
||||
AND a.mac LIKE concat('%',#{params.mac},'%')
|
||||
</if>
|
||||
<if test="params.nuId != null and params.nuId != ''">
|
||||
AND a.nu_id = #{params.nuId}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.depart_id = #{params.departId}
|
||||
</if>
|
||||
<if test="params.status != null and params.status != ''">
|
||||
AND c.del_flag = #{params.status}
|
||||
</if>
|
||||
order by a.nu_id
|
||||
</select>
|
||||
|
||||
<select id="findSyncLogMainPage" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
select
|
||||
main_id as sn,
|
||||
main_name as deviceName,
|
||||
server_type as serverType,
|
||||
max(create_time) as createTime
|
||||
from nu_iot_sync_log
|
||||
where server_type = '摄像头'
|
||||
and (org_code = #{params.departServerUrl} or new_org_code = #{params.departServerUrl})
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.main_id = #{params.sn}
|
||||
</if>
|
||||
<if test="params.deviceName != null and params.deviceName != ''">
|
||||
AND a.main_name LIKE concat('%',#{params.deviceName},'%')
|
||||
</if>
|
||||
group by main_id,main_name,server_type
|
||||
order by createTime desc
|
||||
</select>
|
||||
|
||||
<select id="findSyncLogSeedList" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
select main_id as sn,
|
||||
main_name as deviceName,
|
||||
sync_type as syncType,
|
||||
server_type as serverType,
|
||||
status,
|
||||
org_id as oldDepartId,
|
||||
org_name as oldDepartName,
|
||||
org_code as oldServerUrl,
|
||||
nu_id as oldNuId,
|
||||
new_org_id as departId,
|
||||
new_org_name as departName,
|
||||
new_org_code as departServerUrl,
|
||||
new_nu_id as nuId,
|
||||
create_time as createTime
|
||||
from nu_iot_sync_log
|
||||
where server_type = '摄像头'
|
||||
AND main_id = #{sn}
|
||||
order by createTime desc
|
||||
</select>
|
||||
|
||||
<select id="findNuSyncPage" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||
select
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.area_flag as areaFlag,
|
||||
(select count(*) from nu_iot_tplink_camera m where a.nu_id = m.nu_id) as deviceNum
|
||||
from nu_base_info a
|
||||
where a.del_flag = '0'
|
||||
and a.iz_sync = '0'
|
||||
<if test="params.orgCode != null and params.orgCode != ''">
|
||||
and a.sys_org_code = #{params.orgCode}
|
||||
</if>
|
||||
order by a.nu_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -66,4 +66,12 @@ public interface ICameraInfoService extends IService<CameraInfo> {
|
|||
IPage<NuBaseInfo> getNuBaseList(String dataSourceCode,Page<NuBaseInfo> page, NuBaseInfo nuBaseInfo);
|
||||
|
||||
String syncCameraList(Map<String, Object> cameraList);
|
||||
|
||||
IPage<CameraInfo> findSourcePage(Page<CameraInfo> page, CameraInfo cameraInfo);
|
||||
List<CameraInfo> findDepartList(CameraInfo cameraInfo);
|
||||
List<CameraInfo> findNuList(CameraInfo cameraInfo);
|
||||
IPage<CameraInfo> findBusinessPage(Page<CameraInfo> page,CameraInfo cameraInfo);
|
||||
String syncDevices(List<CameraInfo> list);
|
||||
IPage<CameraInfo> findSyncLogPage(Page<CameraInfo> page,CameraInfo cameraInfo);
|
||||
IPage<CameraInfo> findNuSyncPage(Page<CameraInfo> page,CameraInfo cameraInfo);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.nu.modules.tplink.region.entity.RegionInfo;
|
|||
import com.nu.modules.tplink.region.mapper.RegionInfoMapper;
|
||||
import com.nu.modules.tq.electricity.entity.ElectricityMeter;
|
||||
import com.nu.modules.tq.electricity.service.impl.ElectricityMeterServiceImpl;
|
||||
import com.nu.modules.tq.water.entity.WaterMeter;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
@ -2758,6 +2759,299 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CameraInfo> findSourcePage(Page<CameraInfo> page, CameraInfo cameraInfo){
|
||||
return baseMapper.findSourcePage(page,cameraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CameraInfo> findDepartList(CameraInfo cameraInfo){
|
||||
return baseMapper.findDepartList(cameraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CameraInfo> findNuList(CameraInfo cameraInfo){
|
||||
return baseMapper.findNuList(cameraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CameraInfo> findBusinessPage(Page<CameraInfo> page, CameraInfo cameraInfo){
|
||||
return baseMapper.findBusinessPage(page,cameraInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以设备维度同步摄像头到业务
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String syncDevices(List<CameraInfo> list){
|
||||
|
||||
for (CameraInfo cameraInfo : list) {
|
||||
CameraInfo entityInfo = baseMapper.getCameraInfo(cameraInfo);
|
||||
CameraInfo capabilityInfo = baseMapper.getCapabilityByDeviceId(cameraInfo);
|
||||
String actionType = cameraInfo.getActionType();//操作类型
|
||||
if(actionType.equals("添加")){
|
||||
String orgCode = cameraInfo.getOrgCode();
|
||||
if(!StringUtils.isNotBlank(orgCode)){
|
||||
return "1";
|
||||
}
|
||||
entityInfo.setSyncType("1");
|
||||
entityInfo.setNuId(cameraInfo.getNuId());
|
||||
entityInfo.setNuName(cameraInfo.getNuName());
|
||||
entityInfo.setDepartServerUrl(orgCode);
|
||||
entityInfo.setDepartId(cameraInfo.getDepartId());
|
||||
entityInfo.setDepartName(cameraInfo.getDepartName());
|
||||
entityInfo.setOldServerUrl(null);
|
||||
entityInfo.setOldDepartId(null);
|
||||
entityInfo.setOldDepartName(null);
|
||||
|
||||
boolean flag = syncImpl.syncDevice(orgCode,"更新",entityInfo,capabilityInfo);
|
||||
SyncLog syncLog = new SyncLog();
|
||||
syncLog.setId(null);
|
||||
syncLog.setMainId(cameraInfo.getDeviceIndex());
|
||||
syncLog.setMainName(cameraInfo.getDeviceName());
|
||||
syncLog.setSyncType("添加");
|
||||
syncLog.setNewOrgId(cameraInfo.getDepartId());
|
||||
syncLog.setNewOrgCode(orgCode);
|
||||
syncLog.setNewOrgName(cameraInfo.getDepartName());
|
||||
if(flag){
|
||||
syncLog.setStatus("成功");
|
||||
}else{
|
||||
syncLog.setStatus("失败");
|
||||
}
|
||||
syncLog.setContent("添加业务机构摄像头数据");
|
||||
syncLog.setServerType("摄像头");
|
||||
syncLog.setNewNuId(cameraInfo.getNuId());
|
||||
nuIotTqElectricitySyncLogService.save(syncLog);
|
||||
if(flag){
|
||||
//更新同步
|
||||
baseMapper.updateSync(entityInfo);
|
||||
}
|
||||
}
|
||||
if(actionType.equals("删除")){
|
||||
String oldOrgCode = cameraInfo.getOldOrgCode();
|
||||
if(!StringUtils.isNotBlank(oldOrgCode)){
|
||||
return "1";
|
||||
}
|
||||
entityInfo.setSyncType("1");
|
||||
entityInfo.setNuId(null);
|
||||
entityInfo.setNuName(null);
|
||||
entityInfo.setDepartServerUrl(null);
|
||||
entityInfo.setDepartId(null);
|
||||
entityInfo.setDepartName(null);
|
||||
entityInfo.setOldServerUrl(oldOrgCode);
|
||||
entityInfo.setOldDepartId(cameraInfo.getOldDepartId());
|
||||
entityInfo.setOldDepartName(cameraInfo.getOldDepartName());
|
||||
|
||||
boolean flag = syncImpl.syncDevice(oldOrgCode,"删除",entityInfo,capabilityInfo);
|
||||
SyncLog syncLog = new SyncLog();
|
||||
syncLog.setId(null);
|
||||
syncLog.setMainId(cameraInfo.getDeviceIndex());
|
||||
syncLog.setMainName(cameraInfo.getDeviceName());
|
||||
syncLog.setSyncType("删除");
|
||||
syncLog.setOrgId(cameraInfo.getOldDepartId());
|
||||
syncLog.setOrgCode(oldOrgCode);
|
||||
syncLog.setOrgName(cameraInfo.getOldDepartName());
|
||||
if(flag){
|
||||
syncLog.setStatus("成功");
|
||||
}else{
|
||||
syncLog.setStatus("失败");
|
||||
}
|
||||
syncLog.setContent("删除原来业务机构摄像头数据");
|
||||
syncLog.setServerType("摄像头");
|
||||
syncLog.setNuId(cameraInfo.getNuId());
|
||||
nuIotTqElectricitySyncLogService.save(syncLog);
|
||||
if(flag){
|
||||
//更新同步
|
||||
baseMapper.updateSync(entityInfo);
|
||||
}
|
||||
}
|
||||
if(actionType.equals("调整")){
|
||||
String oldNuId = entityInfo.getNuId();//原护理单元ID
|
||||
String nuId = cameraInfo.getNuId();//新护理单元ID
|
||||
if(!oldNuId.equals(nuId)){
|
||||
String oldOrgCode = cameraInfo.getOldOrgCode();
|
||||
entityInfo.setNuId(cameraInfo.getNuId());
|
||||
entityInfo.setNuName(cameraInfo.getNuName());
|
||||
entityInfo.setDepartServerUrl(oldOrgCode);
|
||||
entityInfo.setDepartId(cameraInfo.getOldDepartId());
|
||||
entityInfo.setDepartName(cameraInfo.getOldDepartName());
|
||||
entityInfo.setOldServerUrl(null);
|
||||
entityInfo.setOldDepartId(null);
|
||||
entityInfo.setOldDepartName(null);
|
||||
boolean flag = syncImpl.syncDevice(oldOrgCode,"更新",entityInfo,capabilityInfo);
|
||||
SyncLog syncLog = new SyncLog();
|
||||
syncLog.setId(null);
|
||||
syncLog.setMainId(cameraInfo.getDeviceIndex());
|
||||
syncLog.setMainName(cameraInfo.getDeviceName());
|
||||
syncLog.setSyncType("调整");
|
||||
syncLog.setNewOrgId(cameraInfo.getOldDepartId());
|
||||
syncLog.setNewOrgCode(oldOrgCode);
|
||||
syncLog.setNewOrgName(cameraInfo.getOldDepartName());
|
||||
if(flag){
|
||||
syncLog.setStatus("成功");
|
||||
}else{
|
||||
syncLog.setStatus("失败");
|
||||
}
|
||||
syncLog.setContent("调整业务机构摄像头数据");
|
||||
syncLog.setServerType("摄像头");
|
||||
syncLog.setNewNuId(nuId);
|
||||
syncLog.setNuId(oldNuId);
|
||||
nuIotTqElectricitySyncLogService.save(syncLog);
|
||||
if(flag){
|
||||
//更新同步
|
||||
baseMapper.updateSync(entityInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(actionType.equals("变更")){
|
||||
String oldOrgCode = cameraInfo.getOldOrgCode();
|
||||
String orgCode = cameraInfo.getOrgCode();
|
||||
String oldNuId = entityInfo.getNuId();//原护理单元ID
|
||||
if(!StringUtils.isNotBlank(oldOrgCode)){
|
||||
return "1";
|
||||
}
|
||||
if(!StringUtils.isNotBlank(orgCode)){
|
||||
return "1";
|
||||
}
|
||||
|
||||
boolean flag = syncImpl.syncDevice(oldOrgCode,"删除",entityInfo,capabilityInfo);
|
||||
if(!flag){
|
||||
SyncLog syncLog = new SyncLog();
|
||||
syncLog.setId(null);
|
||||
syncLog.setMainId(cameraInfo.getDeviceIndex());
|
||||
syncLog.setMainName(cameraInfo.getDeviceName());
|
||||
syncLog.setSyncType("删除");
|
||||
syncLog.setOrgId(cameraInfo.getOldDepartId());
|
||||
syncLog.setOrgCode(oldOrgCode);
|
||||
syncLog.setOrgName(cameraInfo.getOldDepartName());
|
||||
syncLog.setStatus("失败");
|
||||
syncLog.setContent("删除业务机构摄像头数据");
|
||||
syncLog.setServerType("摄像头");
|
||||
syncLog.setNuId(oldNuId);
|
||||
nuIotTqElectricitySyncLogService.save(syncLog);
|
||||
}
|
||||
boolean flag2 = false;
|
||||
if(flag){
|
||||
entityInfo.setSyncType("1");
|
||||
entityInfo.setNuId(cameraInfo.getNuId());
|
||||
entityInfo.setNuName(cameraInfo.getNuName());
|
||||
entityInfo.setDepartServerUrl(orgCode);
|
||||
entityInfo.setDepartId(cameraInfo.getDepartId());
|
||||
entityInfo.setDepartName(cameraInfo.getDepartName());
|
||||
entityInfo.setOldServerUrl(null);
|
||||
entityInfo.setOldDepartId(null);
|
||||
entityInfo.setOldDepartName(null);
|
||||
flag2 = syncImpl.syncDevice(orgCode,"更新",entityInfo,capabilityInfo);
|
||||
|
||||
SyncLog syncLog = new SyncLog();
|
||||
syncLog.setId(null);
|
||||
syncLog.setMainId(cameraInfo.getDeviceIndex());
|
||||
syncLog.setMainName(cameraInfo.getDeviceName());
|
||||
syncLog.setSyncType("更新");
|
||||
syncLog.setOrgId(cameraInfo.getOldDepartId());
|
||||
syncLog.setOrgCode(oldOrgCode);
|
||||
syncLog.setOrgName(cameraInfo.getOldDepartName());
|
||||
syncLog.setNewOrgId(cameraInfo.getDepartId());
|
||||
syncLog.setNewOrgCode(orgCode);
|
||||
syncLog.setNewOrgName(cameraInfo.getDepartName());
|
||||
if(flag2){
|
||||
syncLog.setStatus("成功");
|
||||
}else{
|
||||
syncLog.setStatus("失败");
|
||||
}
|
||||
syncLog.setContent("更新业务机构摄像头数据");
|
||||
syncLog.setServerType("摄像头");
|
||||
syncLog.setNewNuId(entityInfo.getNuId());
|
||||
syncLog.setNuId(oldNuId);
|
||||
nuIotTqElectricitySyncLogService.save(syncLog);
|
||||
}
|
||||
if(flag2){
|
||||
//更新同步
|
||||
entityInfo.setSyncType("1");
|
||||
entityInfo.setNuId(cameraInfo.getNuId());
|
||||
entityInfo.setNuName(cameraInfo.getNuName());
|
||||
entityInfo.setDepartServerUrl(orgCode);
|
||||
entityInfo.setDepartId(cameraInfo.getDepartId());
|
||||
entityInfo.setDepartName(cameraInfo.getDepartName());
|
||||
entityInfo.setOldServerUrl(oldOrgCode);
|
||||
entityInfo.setOldDepartId(cameraInfo.getOldDepartId());
|
||||
entityInfo.setOldDepartName(cameraInfo.getOldDepartName());
|
||||
baseMapper.updateSync(entityInfo);
|
||||
}else{
|
||||
if(flag){
|
||||
//更新同步
|
||||
entityInfo.setSyncType("1");
|
||||
entityInfo.setNuId(null);
|
||||
entityInfo.setNuName(null);
|
||||
entityInfo.setDepartServerUrl(null);
|
||||
entityInfo.setDepartId(null);
|
||||
entityInfo.setDepartName(null);
|
||||
entityInfo.setOldServerUrl(oldOrgCode);
|
||||
entityInfo.setOldDepartId(cameraInfo.getOldDepartId());
|
||||
entityInfo.setOldDepartName(cameraInfo.getOldDepartName());
|
||||
baseMapper.updateSync(entityInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
//业务系统保存或者修改命令
|
||||
@DS("#dataSourceCode")
|
||||
public boolean syncDevice(String dataSourceCode,String type,CameraInfo cameraInfo,CameraInfo capabilityInfo) {
|
||||
try {
|
||||
CameraInfo oldCamera = baseMapper.getCameraInfo(cameraInfo);
|
||||
if(type.equals("更新")){
|
||||
if(oldCamera == null){
|
||||
baseMapper.insert(cameraInfo);
|
||||
CameraInfo oldCapability = baseMapper.getCapabilityByDeviceId(capabilityInfo);
|
||||
if(oldCapability == null){
|
||||
baseMapper.insertCapability(capabilityInfo);
|
||||
}else{
|
||||
capabilityInfo.setId(oldCapability.getId());
|
||||
baseMapper.updateCapabilityById(cameraInfo);
|
||||
}
|
||||
}else{
|
||||
cameraInfo.setId(oldCamera.getId());
|
||||
baseMapper.updateById(cameraInfo);
|
||||
CameraInfo oldCapability = baseMapper.getCapabilityByDeviceId(capabilityInfo);
|
||||
if(oldCapability == null){
|
||||
baseMapper.insertCapability(capabilityInfo);
|
||||
}else{
|
||||
capabilityInfo.setId(oldCapability.getId());
|
||||
baseMapper.updateCapabilityById(cameraInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(type.equals("删除")){
|
||||
baseMapper.deleteCameraInfo(cameraInfo);
|
||||
baseMapper.deleteCapabilityById(cameraInfo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CameraInfo> findSyncLogPage(Page<CameraInfo> page, CameraInfo cameraInfo){
|
||||
IPage<CameraInfo> mainPage = baseMapper.findSyncLogMainPage(page,cameraInfo);
|
||||
List<CameraInfo> records = mainPage.getRecords();
|
||||
for(int i=0;i<records.size();i++){
|
||||
CameraInfo record = records.get(i);
|
||||
List<CameraInfo> seedList = baseMapper.findSyncLogSeedList(record);
|
||||
record.setSeedList(seedList);
|
||||
}
|
||||
return mainPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CameraInfo> findNuSyncPage(Page<CameraInfo> page, CameraInfo cameraInfo){
|
||||
return baseMapper.findNuSyncPage(page,cameraInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@
|
|||
</select>
|
||||
|
||||
<select id="findDepartList" parameterType="com.nu.modules.tq.water.entity.WaterMeter" resultType="com.nu.modules.tq.water.entity.WaterMeter">
|
||||
select
|
||||
select distinct
|
||||
depart_id as departId,
|
||||
depart_name as departName
|
||||
from nu_iot_tq_water_meter
|
||||
|
@ -228,7 +228,7 @@
|
|||
</select>
|
||||
|
||||
<select id="findNuList" parameterType="com.nu.modules.tq.water.entity.WaterMeter" resultType="com.nu.modules.tq.water.entity.WaterMeter">
|
||||
select
|
||||
select distinct
|
||||
nu_id as nuId,
|
||||
nu_name as nuName
|
||||
from nu_iot_tq_water_meter
|
||||
|
|
|
@ -867,6 +867,9 @@ public class WaterMeterServiceImpl extends ServiceImpl<WaterMeterMapper, WaterMe
|
|||
waterInfo.setDepartServerUrl(orgCode);
|
||||
waterInfo.setDepartId(waterMeter.getDepartId());
|
||||
waterInfo.setDepartName(waterMeter.getDepartName());
|
||||
waterInfo.setOldServerUrl(null);
|
||||
waterInfo.setOldDepartId(null);
|
||||
waterInfo.setOldDepartName(null);
|
||||
flag2 = syncImpl.syncDevice(orgCode,"更新",waterInfo);
|
||||
|
||||
SyncLog syncLog = new SyncLog();
|
||||
|
|
Loading…
Reference in New Issue