Compare commits
2 Commits
099079f890
...
5718b856fc
Author | SHA1 | Date |
---|---|---|
|
5718b856fc | |
|
e7c3ade238 |
|
@ -133,7 +133,7 @@ public class CameraInfo implements Serializable {
|
||||||
private String topTime;
|
private String topTime;
|
||||||
/**护理单元*/
|
/**护理单元*/
|
||||||
@ApiModelProperty(value = "护理单元ID")
|
@ApiModelProperty(value = "护理单元ID")
|
||||||
@Dict(dictTable ="nu_base_info",dicText = "name",dicCode = "id")
|
@Dict(dictTable ="nu_base_info",dicText = "nu_name",dicCode = "nu_id")
|
||||||
private String nuId;
|
private String nuId;
|
||||||
/**护理单元*/
|
/**护理单元*/
|
||||||
@ApiModelProperty(value = "护理单元")
|
@ApiModelProperty(value = "护理单元")
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
system_type as systemType,
|
system_type as systemType,
|
||||||
protocol as protocol,
|
protocol as protocol,
|
||||||
a.nu_id as nuId,
|
a.nu_id as nuId,
|
||||||
b.name as nuName,
|
b.nu_name as nuName,
|
||||||
ifnull(c.multitrans,0) as multitrans
|
ifnull(c.multitrans,0) as multitrans
|
||||||
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.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>
|
||||||
<if test="params.deviceIndex != null and params.deviceIndex != ''">
|
<if test="params.deviceIndex != null and params.deviceIndex != ''">
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
AND a.region_name LIKE concat('%',#{params.regionName},'%')
|
AND a.region_name LIKE concat('%',#{params.regionName},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.nuName != null and params.nuName != ''">
|
<if test="params.nuName != null and params.nuName != ''">
|
||||||
AND b.name LIKE concat('%',#{params.nuName},'%')
|
AND b.nu_name LIKE concat('%',#{params.nuName},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.projectId != null and params.projectId != ''">
|
<if test="params.projectId != null and params.projectId != ''">
|
||||||
AND a.project_id = #{params.projectId}
|
AND a.project_id = #{params.projectId}
|
||||||
|
@ -87,15 +87,15 @@
|
||||||
|
|
||||||
<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">
|
||||||
select
|
select
|
||||||
id as nuId,
|
nu_id as nuId,
|
||||||
name as nuName
|
nu_name as nuName
|
||||||
from nu_base_info b
|
from nu_base_info b
|
||||||
<where>
|
<where>
|
||||||
<if test="params.nuId != null and params.nuId != ''">
|
<if test="params.nuId != null and params.nuId != ''">
|
||||||
AND b.id = #{params.nuId}
|
AND b.nu_id = #{params.nuId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.nuName != null and params.nuName != ''">
|
<if test="params.nuName != null and params.nuName != ''">
|
||||||
AND b.name LIKE concat('%',#{params.nuName},'%')
|
AND b.nu_name LIKE concat('%',#{params.nuName},'%')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
@ -123,9 +123,9 @@
|
||||||
location_name as locationName,
|
location_name as locationName,
|
||||||
system_type as systemType,
|
system_type as systemType,
|
||||||
protocol as protocol,
|
protocol as protocol,
|
||||||
nu_id as nuId,
|
a.nu_id as nuId,
|
||||||
b.id as nuName
|
b.nu_name as nuName
|
||||||
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.nu_id
|
||||||
where device_index = #{deviceIndex}
|
where device_index = #{deviceIndex}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -1694,8 +1694,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
sb.append("{");
|
sb.append("{");
|
||||||
sb.append("\"id\"").append(":").append("[{");
|
sb.append("\"id\"").append(":").append("[{");
|
||||||
sb.append("\"videoDevId\"").append(":").append("\"").append(cameraInfo.getVideoDevId()).append("\",");
|
sb.append("\"videoDevId\"").append(":").append("\"").append(cameraInfo.getVideoDevId()).append("\",");
|
||||||
sb.append("\"storageDevId\"").append(":").append("\"").append(cameraInfo.getStorageDevId()).append("\",");
|
sb.append("\"storageDevId\"").append(":").append("\"").append(cameraInfo.getStorageDevId()).append("\"");
|
||||||
sb.append("\"storageType\"").append(":").append(cameraInfo.getStorageType());
|
|
||||||
sb.append("}],");
|
sb.append("}],");
|
||||||
sb.append("\"videoType\"").append(":").append("[").append(cameraInfo.getVideoType()).append("],");
|
sb.append("\"videoType\"").append(":").append("[").append(cameraInfo.getVideoType()).append("],");
|
||||||
sb.append("\"scale\"").append(":\"").append(cameraInfo.getScale()).append("/1").append("\",");
|
sb.append("\"scale\"").append(":\"").append(cameraInfo.getScale()).append("/1").append("\",");
|
||||||
|
@ -1720,7 +1719,6 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
entity.setSessionId(sessionId);
|
entity.setSessionId(sessionId);
|
||||||
entity.setErrorCode(errCode);
|
entity.setErrorCode(errCode);
|
||||||
entity.setStorageDevId(cameraInfo.getStorageDevId());
|
entity.setStorageDevId(cameraInfo.getStorageDevId());
|
||||||
entity.setStorageType(cameraInfo.getStorageType());
|
|
||||||
entity.setVideoType(cameraInfo.getVideoType());
|
entity.setVideoType(cameraInfo.getVideoType());
|
||||||
entity.setStartTime(cameraInfo.getStartTime());
|
entity.setStartTime(cameraInfo.getStartTime());
|
||||||
entity.setEndTime(cameraInfo.getEndTime());
|
entity.setEndTime(cameraInfo.getEndTime());
|
||||||
|
@ -1748,10 +1746,8 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
sb.append("\"id\"").append(":").append("[{");
|
sb.append("\"id\"").append(":").append("[{");
|
||||||
sb.append("\"videoDevId\"").append(":").append("\"").append(cameraInfo.getVideoDevId()).append("\",");
|
sb.append("\"videoDevId\"").append(":").append("\"").append(cameraInfo.getVideoDevId()).append("\",");
|
||||||
sb.append("\"storageDevId\"").append(":").append("\"").append(cameraInfo.getStorageDevId()).append("\",");
|
sb.append("\"storageDevId\"").append(":").append("\"").append(cameraInfo.getStorageDevId()).append("\",");
|
||||||
sb.append("\"storageType\"").append(":").append(cameraInfo.getStorageType()).append(",");
|
|
||||||
sb.append("\"sessionId\"").append(":").append("\"").append(cameraInfo.getSessionId()).append("\"");
|
sb.append("\"sessionId\"").append(":").append("\"").append(cameraInfo.getSessionId()).append("\"");
|
||||||
sb.append("}],");
|
sb.append("}],");
|
||||||
sb.append("\"videoType\"").append(":").append("[").append(cameraInfo.getVideoType()).append("],");
|
|
||||||
sb.append("\"scale\"").append(":\"").append(cameraInfo.getScale()).append("/1").append("\",");
|
sb.append("\"scale\"").append(":\"").append(cameraInfo.getScale()).append("/1").append("\",");
|
||||||
sb.append("\"startTime\"").append(":").append(cameraInfo.getStartTime()).append(",");
|
sb.append("\"startTime\"").append(":").append(cameraInfo.getStartTime()).append(",");
|
||||||
sb.append("\"endTime\"").append(":").append(cameraInfo.getEndTime());
|
sb.append("\"endTime\"").append(":").append(cameraInfo.getEndTime());
|
||||||
|
@ -1832,49 +1828,35 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
Map<String,Object> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
String errorMsgs = "";
|
String errorMsgs = "";
|
||||||
List<CameraInfo> dataList = Lists.newArrayList();
|
List<CameraInfo> dataList = Lists.newArrayList();
|
||||||
Map<String,Object> storageMap = getStoragesById(cameraInfo);
|
Map<String,Object> chnMap = addPlaybackChn(cameraInfo);
|
||||||
String error = storageMap.get("error").toString();
|
String chnError = chnMap.get("error").toString();
|
||||||
if(error.equals("0")){
|
if(chnError.equals("0")){
|
||||||
List<CameraInfo> storageList = (List)storageMap.get("data");
|
List<CameraInfo> chnList = (List)chnMap.get("data");
|
||||||
if(storageList!=null&&storageList.size()>0){
|
if(chnList!=null&&chnList.size()>0){
|
||||||
for(int i=0;i<storageList.size();i++){
|
for(int j=0;j<chnList.size();j++){
|
||||||
CameraInfo storage = storageList.get(i);
|
CameraInfo chn = chnList.get(j);
|
||||||
Map<String,Object> chnMap = addPlaybackChn(storage);
|
Map<String,Object> playbackMap = getPlaybackUrl(chn,1);
|
||||||
String chnError = chnMap.get("error").toString();
|
String pbError = playbackMap.get("error").toString();
|
||||||
if(chnError.equals("0")){
|
if(pbError.equals("0")){
|
||||||
List<CameraInfo> chnList = (List)chnMap.get("data");
|
List<CameraInfo> pbList = (List)playbackMap.get("data");
|
||||||
if(chnList!=null&&chnList.size()>0){
|
if(pbList!=null&&pbList.size()>0){
|
||||||
for(int j=0;j<chnList.size();j++){
|
for(int k=0;k<pbList.size();k++){
|
||||||
CameraInfo chn = chnList.get(j);
|
CameraInfo pb = pbList.get(k);
|
||||||
Map<String,Object> playbackMap = getPlaybackUrl(chn,1);
|
pb.setQueryAddress(tumsConfig.getUrl());
|
||||||
String pbError = playbackMap.get("error").toString();
|
dataList.add(pb);
|
||||||
if(pbError.equals("0")){
|
|
||||||
List<CameraInfo> pbList = (List)playbackMap.get("data");
|
|
||||||
if(pbList!=null&&pbList.size()>0){
|
|
||||||
for(int k=0;k<pbList.size();k++){
|
|
||||||
CameraInfo pb = pbList.get(k);
|
|
||||||
pb.setQueryAddress(tumsConfig.getUrl());
|
|
||||||
dataList.add(pb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
ErrorCode errVo = errorCodeService.getByCode(pbError);
|
|
||||||
String errMsg = errVo.getErrorMsg();
|
|
||||||
errorMsgs = errorMsgs+ "<div>获取回放通道时:"+errMsg+"</div>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
ErrorCode errVo = errorCodeService.getByCode(chnError);
|
ErrorCode errVo = errorCodeService.getByCode(pbError);
|
||||||
String errMsg = errVo.getErrorMsg();
|
String errMsg = errVo.getErrorMsg();
|
||||||
errorMsgs = errorMsgs+ "<div>添加回放通道时:"+errMsg+"</div>";
|
errorMsgs = errorMsgs+ "<div>获取回放通道时:"+errMsg+"</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
ErrorCode errVo = errorCodeService.getByCode(error);
|
ErrorCode errVo = errorCodeService.getByCode(chnError);
|
||||||
String errMsg = errVo.getErrorMsg();
|
String errMsg = errVo.getErrorMsg();
|
||||||
errorMsgs = errorMsgs+ "<div>获取指定监控点的存储设备列表时:"+errMsg+"</div>";
|
errorMsgs = errorMsgs+ "<div>添加回放通道时:"+errMsg+"</div>";
|
||||||
}
|
}
|
||||||
map.put("error",errorMsgs);
|
map.put("error",errorMsgs);
|
||||||
map.put("data",dataList);
|
map.put("data",dataList);
|
||||||
|
@ -2000,12 +1982,6 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
entity.setUrl(url);
|
entity.setUrl(url);
|
||||||
entity.setWsUrl(wsUrl);
|
entity.setWsUrl(wsUrl);
|
||||||
entity.setWssUrl(wssUrl);
|
entity.setWssUrl(wssUrl);
|
||||||
entity.setStorageDevId(cameraInfo.getStorageDevId());
|
|
||||||
entity.setStorageType(cameraInfo.getStorageType());
|
|
||||||
entity.setVideoType(cameraInfo.getVideoType());
|
|
||||||
entity.setStartTime(cameraInfo.getStartTime());
|
|
||||||
entity.setEndTime(cameraInfo.getEndTime());
|
|
||||||
entity.setScale(cameraInfo.getScale());
|
|
||||||
map.put("data",entity);
|
map.put("data",entity);
|
||||||
}else if(errorCode == -80703){
|
}else if(errorCode == -80703){
|
||||||
try {
|
try {
|
||||||
|
@ -2032,39 +2008,17 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result getMultitransUrl(CameraInfo cameraInfo) throws Exception{
|
public Result getMultitransUrl(CameraInfo cameraInfo) throws Exception{
|
||||||
// Map<String,Object> map = new HashMap<>();
|
|
||||||
String errorMsgs = "";
|
String errorMsgs = "";
|
||||||
List<CameraInfo> dataList = Lists.newArrayList();
|
Map<String,Object> multitransMap = getMultitransUrl(cameraInfo,1);
|
||||||
Map<String,Object> storageMap = getStoragesById(cameraInfo);
|
String multitransError = multitransMap.get("error").toString();
|
||||||
String error = storageMap.get("error").toString();
|
if(multitransError.equals("0")){
|
||||||
if(error.equals("0")){
|
CameraInfo entity = (CameraInfo)multitransMap.get("data");
|
||||||
List<CameraInfo> storageList = (List)storageMap.get("data");
|
entity.setQueryAddress(tumsConfig.getUrl());
|
||||||
if(storageList!=null&&storageList.size()>0){
|
return Result.OK(entity);
|
||||||
for(int i=0;i<storageList.size();i++){
|
|
||||||
CameraInfo storage = storageList.get(i);
|
|
||||||
Map<String,Object> multitransMap = getMultitransUrl(storage,1);
|
|
||||||
String multitransError = multitransMap.get("error").toString();
|
|
||||||
if(multitransError.equals("0")){
|
|
||||||
CameraInfo entity = (CameraInfo)multitransMap.get("data");
|
|
||||||
entity.setQueryAddress(tumsConfig.getUrl());
|
|
||||||
dataList.add(entity);
|
|
||||||
}else{
|
|
||||||
ErrorCode errVo = errorCodeService.getByCode(multitransError);
|
|
||||||
String errMsg = errVo.getErrorMsg();
|
|
||||||
errorMsgs = errorMsgs+ "<div>获取nvmp设备双向通信URL:"+errMsg+"</div>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
ErrorCode errVo = errorCodeService.getByCode(error);
|
ErrorCode errVo = errorCodeService.getByCode(multitransError);
|
||||||
String errMsg = errVo.getErrorMsg();
|
String errMsg = errVo.getErrorMsg();
|
||||||
errorMsgs = errorMsgs+ "<div>获取指定监控点的存储设备列表时:"+errMsg+"</div>";
|
errorMsgs = errorMsgs+ "<div>获取nvmp设备双向通信URL:"+errMsg+"</div>";
|
||||||
}
|
|
||||||
// map.put("error",errorMsgs);
|
|
||||||
// map.put("data",dataList);
|
|
||||||
if(errorMsgs.equals("")){
|
|
||||||
return Result.OK(dataList);
|
|
||||||
}else {
|
|
||||||
return Result.error(errorMsgs);
|
return Result.error(errorMsgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@ public enum ApiEnum {
|
||||||
LOGOUT("/tums/account/v1/logout","注销"),
|
LOGOUT("/tums/account/v1/logout","注销"),
|
||||||
SET_CURRENT_PROJECT("/tums/resource/v2/setCurrentProject","设置当前项目"),
|
SET_CURRENT_PROJECT("/tums/resource/v2/setCurrentProject","设置当前项目"),
|
||||||
GET_ALL_PROJECT_INFO("/tums/resource/v2/getAllProjectInfo","获取所有项目信息"),
|
GET_ALL_PROJECT_INFO("/tums/resource/v2/getAllProjectInfo","获取所有项目信息"),
|
||||||
|
ADD_PROJECT("/tums/resource/v2/addProject","添加项目信息"),
|
||||||
|
EDIT_PROJECT("/tums/resource/v2/editProject","修改项目信息"),
|
||||||
|
DELETE_PROJECT("/tums/resource/v2/deleteProject","删除项目信息"),
|
||||||
GET_ROOT_REGIONS("/tums/resource/v2/getRootRegions","获取区域列表"),
|
GET_ROOT_REGIONS("/tums/resource/v2/getRootRegions","获取区域列表"),
|
||||||
GET_DEVICE_LIST("/tums/deviceManager/v2/getDeviceList","获取设备列表"),
|
GET_DEVICE_LIST("/tums/deviceManager/v2/getDeviceList","获取设备列表"),
|
||||||
MODIFY_DEVICE_DETAILS("/tums/deviceManager/v1/modifyDeviceDetails","修改设备信息"),
|
MODIFY_DEVICE_DETAILS("/tums/deviceManager/v1/modifyDeviceDetails","修改设备信息"),
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
package com.nu.modules.tplink.project.controller;
|
package com.nu.modules.tplink.project.controller;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.nu.modules.tplink.alarm.entity.AlarmLog;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
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;
|
||||||
|
@ -14,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
import com.nu.modules.tplink.project.model.ProjectTreeModel;
|
import com.nu.modules.tplink.project.model.ProjectTreeModel;
|
||||||
import com.nu.modules.tplink.project.service.IProjectInfoService;
|
import com.nu.modules.tplink.project.service.IProjectInfoService;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
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.*;
|
||||||
|
@ -85,4 +89,61 @@ public class ProjectInfoController extends JeecgController<ProjectInfo, IProject
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @param projectInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// @AutoLog(value = "护理单元-物联管理-TPLINK项目信息-添加")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK项目信息-添加", notes="护理单元-物联管理-TPLINK项目信息-添加")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody ProjectInfo projectInfo) {
|
||||||
|
return service.addProject(projectInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param projectInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// @AutoLog(value = "护理单元-物联管理-TPLINK项目信息-编辑")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK项目信息-编辑", notes="护理单元-物联管理-TPLINK项目信息-编辑")
|
||||||
|
@PostMapping(value = "/edit")
|
||||||
|
public Result<String> edit(@RequestBody ProjectInfo projectInfo) {
|
||||||
|
return service.editProject(projectInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param projectInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// @AutoLog(value = "护理单元-物联管理-TPLINK项目信息-编辑")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK项目信息-通过id删除", notes="护理单元-物联管理-TPLINK项目信息-通过id删除")
|
||||||
|
@PostMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestBody ProjectInfo projectInfo) {
|
||||||
|
return service.deleteProject(projectInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "护理单元-物联管理-TPLINK项目信息-通过id查询")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK项目信息-通过id查询", notes="护理单元-物联管理-TPLINK项目信息-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<ProjectInfo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||||
|
ProjectInfo projectInfo = service.getById(id);
|
||||||
|
if(projectInfo==null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(projectInfo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
|
||||||
IPage<ProjectInfo> findPage(Page<ProjectInfo> page, @Param("params") ProjectInfo projectInfo);
|
IPage<ProjectInfo> findPage(Page<ProjectInfo> page, @Param("params") ProjectInfo projectInfo);
|
||||||
int add(Map<String, String> map);
|
int add(Map<String, String> map);
|
||||||
int updateById(Map<String, String> map);
|
int updateById(Map<String, String> map);
|
||||||
|
int deleteByProjectId(String projectId);
|
||||||
int updateLeafByPId(Map<String, String> map);
|
int updateLeafByPId(Map<String, String> map);
|
||||||
List<ProjectInfo> queryTreeList();
|
List<ProjectInfo> queryTreeList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,10 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteByProjectId">
|
||||||
|
delete from nu_iot_tplink_project where project_id = #{projectId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateLeafByPId">
|
<update id="updateLeafByPId">
|
||||||
update nu_iot_tplink_project
|
update nu_iot_tplink_project
|
||||||
set iz_leaf = #{izLeaf}
|
set iz_leaf = #{izLeaf}
|
||||||
|
|
|
@ -21,4 +21,9 @@ public interface IProjectInfoService extends IService<ProjectInfo> {
|
||||||
List<ProjectInfo> findList(ProjectInfo projectInfo);
|
List<ProjectInfo> findList(ProjectInfo projectInfo);
|
||||||
IPage<ProjectInfo> findPage(Page<ProjectInfo> page, ProjectInfo projectInfo);
|
IPage<ProjectInfo> findPage(Page<ProjectInfo> page, ProjectInfo projectInfo);
|
||||||
List<ProjectTreeModel> queryTreeList();
|
List<ProjectTreeModel> queryTreeList();
|
||||||
|
|
||||||
|
Result<String> addProject(ProjectInfo projectInfo);
|
||||||
|
Result<String> editProject(ProjectInfo projectInfo);
|
||||||
|
Result<String> deleteProject(ProjectInfo projectInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,4 +128,69 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> addProject(ProjectInfo projectInfo){
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("{");
|
||||||
|
sb.append("\"enterpriseId\"").append(":").append("\"0\"").append(",");
|
||||||
|
sb.append("\"projectName\"").append(":").append("\"").append(projectInfo.getProjectName()).append("\"");
|
||||||
|
sb.append("}");
|
||||||
|
String jsonResponse = tumsApi.addProject(sb.toString());
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
sync();
|
||||||
|
return Result.OK("项目添加成功!");
|
||||||
|
}else{
|
||||||
|
return Result.error(jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> editProject(ProjectInfo projectInfo){
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("{");
|
||||||
|
sb.append("\"projectId\"").append(":").append("\"").append(projectInfo.getProjectId()).append("\",");
|
||||||
|
sb.append("\"projectName\"").append(":").append("\"").append(projectInfo.getProjectName()).append("\"");
|
||||||
|
sb.append("}");
|
||||||
|
String jsonResponse = tumsApi.editProject(sb.toString());
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
sync();
|
||||||
|
return Result.OK("项目编辑成功!");
|
||||||
|
}else{
|
||||||
|
return Result.error(jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> deleteProject(ProjectInfo projectInfo){
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("{");
|
||||||
|
sb.append("\"projectId\"").append(":").append("\"").append(projectInfo.getProjectId()).append("\"");
|
||||||
|
sb.append("}");
|
||||||
|
String jsonResponse = tumsApi.deleteProject(sb.toString());
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")||errorCode.equals("-82401")){
|
||||||
|
baseMapper.deleteByProjectId(projectInfo.getProjectId());
|
||||||
|
return Result.OK("项目删除成功!");
|
||||||
|
}else{
|
||||||
|
return Result.error(jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,45 @@ public class TumsApi {
|
||||||
return jsonResponse;
|
return jsonResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加项目信息
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String addProject(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
log.info("addProject:request:{}",jsonRequest);
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.ADD_PROJECT.getValue());
|
||||||
|
log.info("addProject:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目信息
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String editProject(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
log.info("editProject:request:{}",jsonRequest);
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.EDIT_PROJECT.getValue());
|
||||||
|
log.info("editProject:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目信息
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String deleteProject(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
log.info("deleteProject:request:{}",jsonRequest);
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.DELETE_PROJECT.getValue());
|
||||||
|
log.info("deleteProject:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取区域列表
|
* 获取区域列表
|
||||||
* @param jsonRequest
|
* @param jsonRequest
|
||||||
|
@ -262,8 +301,9 @@ public class TumsApi {
|
||||||
*/
|
*/
|
||||||
public String getPlaybackUrl(String jsonRequest){
|
public String getPlaybackUrl(String jsonRequest){
|
||||||
this.createTumsClient();
|
this.createTumsClient();
|
||||||
|
log.info("getPlaybackUrl:request:{}",jsonRequest);
|
||||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_PLAYBACK_URL.getValue());
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_PLAYBACK_URL.getValue());
|
||||||
log.info("getPlaybackUrl:{}",jsonResponse);
|
log.info("getPlaybackUrl:response:{}",jsonResponse);
|
||||||
return jsonResponse;
|
return jsonResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,8 +326,9 @@ public class TumsApi {
|
||||||
*/
|
*/
|
||||||
public String getMultitransUrl(String jsonRequest){
|
public String getMultitransUrl(String jsonRequest){
|
||||||
this.createTumsClient();
|
this.createTumsClient();
|
||||||
|
log.info("getMultitransUrl:request:{}",jsonRequest);
|
||||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_MULTITRANS_URL.getValue());
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_MULTITRANS_URL.getValue());
|
||||||
log.info("getMultitransUrl:{}",jsonResponse);
|
log.info("getMultitransUrl:response:{}",jsonResponse);
|
||||||
return jsonResponse;
|
return jsonResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue