Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_java_monomer
This commit is contained in:
commit
6a7762f2d0
|
@ -650,6 +650,38 @@ public class DateUtils extends PropertyEditorSupport {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String dateDiff(Long startMillis, Long endMillis) {
|
||||||
|
|
||||||
|
long millisDiff = endMillis - startMillis;
|
||||||
|
String secondStr = "00";
|
||||||
|
int second = (int) (millisDiff / SECOND_IN_MILLIS);
|
||||||
|
second = second % 60;
|
||||||
|
if(second>=10){
|
||||||
|
secondStr = ""+second;
|
||||||
|
}else{
|
||||||
|
secondStr = "0"+second;
|
||||||
|
}
|
||||||
|
|
||||||
|
String minuteStr = "00";
|
||||||
|
int minute = (int) (millisDiff / MINUTE_IN_MILLIS);
|
||||||
|
minute = minute % 60;
|
||||||
|
if(minute>=10){
|
||||||
|
minuteStr = ""+minute;
|
||||||
|
}else{
|
||||||
|
minuteStr = "0"+minute;
|
||||||
|
}
|
||||||
|
|
||||||
|
String hourStr = "00";
|
||||||
|
int hour = (int) (millisDiff / HOUR_IN_MILLIS);
|
||||||
|
hour = hour % 60;
|
||||||
|
if(hour>=10){
|
||||||
|
hourStr = ""+hour;
|
||||||
|
}else{
|
||||||
|
hourStr = "0"+hour;
|
||||||
|
}
|
||||||
|
return hourStr+":"+minuteStr+":"+secondStr;
|
||||||
|
}
|
||||||
|
|
||||||
public static Long getCurrentTimestamp() {
|
public static Long getCurrentTimestamp() {
|
||||||
return Long.valueOf(DateUtils.yyyymmddhhmmss.get().format(new Date()));
|
return Long.valueOf(DateUtils.yyyymmddhhmmss.get().format(new Date()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,12 @@
|
||||||
<artifactId>weixin4j</artifactId>
|
<artifactId>weixin4j</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tplink.ignite.libs</groupId>
|
||||||
|
<artifactId>tums-auth</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,187 @@
|
||||||
|
package com.nu.modules.tplink.alarm.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import com.nu.modules.tplink.alarm.entity.AlarmLog;
|
||||||
|
import com.nu.modules.tplink.alarm.service.IAlarmLogService;
|
||||||
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||||
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||||
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK告警日志信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-23
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags="护理单元-物联管理-TPLINK告警日志信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/iot/alarmLog")
|
||||||
|
@Slf4j
|
||||||
|
public class AlarmLogController extends JeecgController<AlarmLog, IAlarmLogService> {
|
||||||
|
@Autowired
|
||||||
|
private IAlarmLogService alarmLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param alarmLog
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "护理单元-物联管理-TPLINK告警日志信息-分页列表查询")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK告警日志信息-分页列表查询", notes="护理单元-物联管理-TPLINK告警日志信息-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<AlarmLog>> queryPageList(AlarmLog alarmLog,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
// 自定义查询规则
|
||||||
|
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||||
|
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||||
|
customeRuleMap.put("alarmDeviceType", QueryRuleEnum.LIKE_WITH_OR);
|
||||||
|
customeRuleMap.put("alarmType", QueryRuleEnum.LIKE_WITH_OR);
|
||||||
|
customeRuleMap.put("alarmLevel", QueryRuleEnum.LIKE_WITH_OR);
|
||||||
|
customeRuleMap.put("readMark", QueryRuleEnum.LIKE_WITH_OR);
|
||||||
|
QueryWrapper<AlarmLog> queryWrapper = QueryGenerator.initQueryWrapper(alarmLog, req.getParameterMap(),customeRuleMap);
|
||||||
|
Page<AlarmLog> page = new Page<AlarmLog>(pageNo, pageSize);
|
||||||
|
IPage<AlarmLog> pageList = alarmLogService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @param alarmLog
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "护理单元-物联管理-TPLINK告警日志信息-添加")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK告警日志信息-添加", notes="护理单元-物联管理-TPLINK告警日志信息-添加")
|
||||||
|
@RequiresPermissions("iot:nu_iot_tplink_alarm_log:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody AlarmLog alarmLog) {
|
||||||
|
alarmLogService.save(alarmLog);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param alarmLog
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "护理单元-物联管理-TPLINK告警日志信息-编辑")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK告警日志信息-编辑", notes="护理单元-物联管理-TPLINK告警日志信息-编辑")
|
||||||
|
@RequiresPermissions("iot:nu_iot_tplink_alarm_log:edit")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody AlarmLog alarmLog) {
|
||||||
|
alarmLogService.updateById(alarmLog);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "护理单元-物联管理-TPLINK告警日志信息-通过id删除")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK告警日志信息-通过id删除", notes="护理单元-物联管理-TPLINK告警日志信息-通过id删除")
|
||||||
|
@RequiresPermissions("iot:nu_iot_tplink_alarm_log:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||||
|
alarmLogService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "护理单元-物联管理-TPLINK告警日志信息-批量删除")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK告警日志信息-批量删除", notes="护理单元-物联管理-TPLINK告警日志信息-批量删除")
|
||||||
|
@RequiresPermissions("iot:nu_iot_tplink_alarm_log:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||||
|
this.alarmLogService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "护理单元-物联管理-TPLINK告警日志信息-通过id查询")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK告警日志信息-通过id查询", notes="护理单元-物联管理-TPLINK告警日志信息-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<AlarmLog> queryById(@RequestParam(name="id",required=true) String id) {
|
||||||
|
AlarmLog alarmLog = alarmLogService.getById(id);
|
||||||
|
if(alarmLog==null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(alarmLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param alarmLog
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("iot:nu_iot_tplink_alarm_log:exportXls")
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, AlarmLog alarmLog) {
|
||||||
|
return super.exportXls(request, alarmLog, AlarmLog.class, "护理单元-物联管理-TPLINK告警日志信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过excel导入数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("iot:nu_iot_tplink_alarm_log:importExcel")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, AlarmLog.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
package com.nu.modules.tplink.alarm.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import org.jeecg.common.constant.ProvinceCityArea;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK告警日志信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-23
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("nu_iot_tplink_alarm_log")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="nu_iot_tplink_alarm_log对象", description="护理单元-物联管理-TPLINK告警日志信息")
|
||||||
|
public class AlarmLog implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**ID*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private Integer id;
|
||||||
|
/**消息ID*/
|
||||||
|
@Excel(name = "消息ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "消息ID")
|
||||||
|
private String logId;
|
||||||
|
/**告警时间*/
|
||||||
|
@Excel(name = "告警时间", width = 15)
|
||||||
|
@ApiModelProperty(value = "告警时间")
|
||||||
|
private Long logTime;
|
||||||
|
/**告警时间*/
|
||||||
|
@Excel(name = "告警时间", width = 15)
|
||||||
|
@ApiModelProperty(value = "告警时间")
|
||||||
|
private String logTimeFm;
|
||||||
|
/**告警内容*/
|
||||||
|
@Excel(name = "告警内容", width = 15)
|
||||||
|
@ApiModelProperty(value = "告警内容")
|
||||||
|
private String content;
|
||||||
|
/**报警设备名称*/
|
||||||
|
@Excel(name = "报警设备名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "报警设备名称")
|
||||||
|
private String alarmDeviceName;
|
||||||
|
/**报警设备类型*/
|
||||||
|
@Excel(name = "报警设备类型", width = 15, dicCode = "tplink_alarm_device_type")
|
||||||
|
@Dict(dicCode = "tplink_alarm_device_type")
|
||||||
|
@ApiModelProperty(value = "报警设备类型")
|
||||||
|
private Integer alarmDeviceType;
|
||||||
|
/**报警名称*/
|
||||||
|
@Excel(name = "报警名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "报警名称")
|
||||||
|
private String alarmName;
|
||||||
|
/**消息类型*/
|
||||||
|
@Excel(name = "消息类型", width = 15, dicCode = "tplink_alarm_type")
|
||||||
|
@Dict(dicCode = "tplink_alarm_type")
|
||||||
|
@ApiModelProperty(value = "消息类型")
|
||||||
|
private Integer alarmType;
|
||||||
|
/**设备源类型*/
|
||||||
|
@Excel(name = "设备源类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备源类型")
|
||||||
|
private String alarmSourceType;
|
||||||
|
/**报警等级*/
|
||||||
|
@Excel(name = "报警等级", width = 15, dicCode = "tplink_alarm_level")
|
||||||
|
@Dict(dicCode = "tplink_alarm_level")
|
||||||
|
@ApiModelProperty(value = "报警等级")
|
||||||
|
private Integer alarmLevel;
|
||||||
|
/**企业ID*/
|
||||||
|
@Excel(name = "企业ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "企业ID")
|
||||||
|
private Integer enterpriseId;
|
||||||
|
/**项目ID*/
|
||||||
|
@Excel(name = "项目ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目ID")
|
||||||
|
private Integer projectId;
|
||||||
|
/**项目名称*/
|
||||||
|
@Excel(name = "项目名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目名称")
|
||||||
|
private String projectName;
|
||||||
|
/**分组ID*/
|
||||||
|
@Excel(name = "分组ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "分组ID")
|
||||||
|
private Integer regionId;
|
||||||
|
/**分组名称*/
|
||||||
|
@Excel(name = "分组名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "分组名称")
|
||||||
|
private String regionName;
|
||||||
|
/**报警设备ID*/
|
||||||
|
@Excel(name = "报警设备ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "报警设备ID")
|
||||||
|
private String sourceId;
|
||||||
|
/**网页提醒 0关闭,1开启*/
|
||||||
|
@Excel(name = "网页提醒 0关闭,1开启", width = 15)
|
||||||
|
@ApiModelProperty(value = "网页提醒 0关闭,1开启")
|
||||||
|
private Integer screenWarningMark;
|
||||||
|
/**是否已读 0未读,1已读*/
|
||||||
|
@Excel(name = "是否已读 0未读,1已读", width = 15, dicCode = "tplink_read_mark")
|
||||||
|
@Dict(dicCode = "tplink_read_mark")
|
||||||
|
@ApiModelProperty(value = "是否已读 0未读,1已读")
|
||||||
|
private Integer readMark;
|
||||||
|
/**录像标记 0无录像,1有录像*/
|
||||||
|
@Excel(name = "录像标记 0无录像,1有录像", width = 15)
|
||||||
|
@ApiModelProperty(value = "录像标记 0无录像,1有录像")
|
||||||
|
private Integer videoMark;
|
||||||
|
/**系统类型 “”,“客控”,“网络”,“监控”中的一个*/
|
||||||
|
@Excel(name = "系统类型 “”,“客控”,“网络”,“监控”中的一个", width = 15)
|
||||||
|
@ApiModelProperty(value = "系统类型 “”,“客控”,“网络”,“监控”中的一个")
|
||||||
|
private String systemType;
|
||||||
|
/**设备MAC地址*/
|
||||||
|
@Excel(name = "设备MAC地址", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备MAC地址")
|
||||||
|
private String macAddr;
|
||||||
|
/**设备IP地址*/
|
||||||
|
@Excel(name = "设备IP地址", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备IP地址")
|
||||||
|
private String ipAddr;
|
||||||
|
/**联动设备ID*/
|
||||||
|
@Excel(name = "联动设备ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "联动设备ID")
|
||||||
|
private String unionDevId;
|
||||||
|
/**RAID报警的阵列信息*/
|
||||||
|
@Excel(name = "RAID报警的阵列信息", width = 15)
|
||||||
|
@ApiModelProperty(value = "RAID报警的阵列信息")
|
||||||
|
private String extend;
|
||||||
|
/**消息提示音 0表示无消息音、1表示普通、2表示重要、3表示紧急*/
|
||||||
|
@Excel(name = "消息提示音 0表示无消息音、1表示普通、2表示重要、3表示紧急", width = 15)
|
||||||
|
@ApiModelProperty(value = "消息提示音 0表示无消息音、1表示普通、2表示重要、3表示紧急")
|
||||||
|
private Integer promptAudio;
|
||||||
|
/**消息弹窗标记 0表示已处理,1表示需要弹窗*/
|
||||||
|
@Excel(name = "消息弹窗标记 0表示已处理,1表示需要弹窗", width = 15)
|
||||||
|
@ApiModelProperty(value = "消息弹窗标记 0表示已处理,1表示需要弹窗")
|
||||||
|
private Integer popUpAlarmMark;
|
||||||
|
/**消息中携带的其他参数*/
|
||||||
|
@Excel(name = "消息中携带的其他参数", width = 15)
|
||||||
|
@ApiModelProperty(value = "消息中携带的其他参数")
|
||||||
|
private String alarmParams;
|
||||||
|
/**联动大屏消息标记 0否,1是*/
|
||||||
|
@Excel(name = "联动大屏消息标记 0否,1是", width = 15)
|
||||||
|
@ApiModelProperty(value = "联动大屏消息标记 0否,1是")
|
||||||
|
private Integer linkageScreenMark;
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.nu.modules.tplink.alarm.job;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.nu.modules.tplink.alarm.entity.AlarmLog;
|
||||||
|
import com.nu.modules.tplink.alarm.service.IAlarmLogService;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class AlarmLogSyncJob implements Job {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IAlarmLogService service;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
Long logTime = service.getMaxLogTime(null);
|
||||||
|
// String jsonRequest = "{\n" +
|
||||||
|
// " \"start\": 0,\n" +
|
||||||
|
// " \"limit\": 1000,\n" +
|
||||||
|
// " \"filterAnd\": {\n"+
|
||||||
|
// " \"logTimeGe\": "+logTime+"\n"+
|
||||||
|
// " },\n"+
|
||||||
|
// " \"sort\": [{\n"+
|
||||||
|
// " \"key\": \"logTime\",\n"+
|
||||||
|
// " \"value\": \"asc\"\n"+
|
||||||
|
// " }]\n"+
|
||||||
|
// "}";
|
||||||
|
// System.out.println(jsonRequest);
|
||||||
|
// String jsonResponse = tumsApi.getAlarmLog(jsonRequest);
|
||||||
|
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("{");
|
||||||
|
sb.append("\"start\"").append(":").append(0).append(",");
|
||||||
|
sb.append("\"limit\"").append(":").append(1000).append(",");
|
||||||
|
if(logTime!=null){
|
||||||
|
sb.append("\"filterAnd\"").append(":").append("{");
|
||||||
|
sb.append("\"logTimeGe\"").append(":").append(logTime);
|
||||||
|
sb.append("}").append(",");
|
||||||
|
}
|
||||||
|
sb.append("\"sort\"").append(":").append("[{");
|
||||||
|
sb.append("\"key\"").append(":").append("\"logTime\"").append(",");
|
||||||
|
sb.append("\"value\"").append(":").append("\"asc\"");
|
||||||
|
sb.append("}]");
|
||||||
|
sb.append("}");
|
||||||
|
// System.out.println(sb.toString());
|
||||||
|
String jsonResponse = tumsApi.getAlarmLog(sb.toString());
|
||||||
|
if(jsonResponse!=null&&!jsonResponse.equals("")){
|
||||||
|
service.sync(jsonResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.nu.modules.tplink.alarm.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.nu.modules.tplink.alarm.entity.AlarmLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK告警日志信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-23
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface AlarmLogMapper extends BaseMapper<AlarmLog> {
|
||||||
|
Long getMaxLogTime(AlarmLog alarmLog);
|
||||||
|
AlarmLog getByAlarmLogId(AlarmLog alarmLog);
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.nu.modules.tplink.alarm.mapper.AlarmLogMapper">
|
||||||
|
<select id="getByAlarmLogId" parameterType="com.nu.modules.tplink.alarm.entity.AlarmLog" resultType="com.nu.modules.tplink.alarm.entity.AlarmLog">
|
||||||
|
select id,
|
||||||
|
log_id as logId,
|
||||||
|
log_time as logTime,
|
||||||
|
log_time_fm as logTimeFm,
|
||||||
|
content as content,
|
||||||
|
alarm_device_name as alarmDeviceName,
|
||||||
|
alarm_device_type as alarmDeviceType,
|
||||||
|
alarm_name as alarmName,
|
||||||
|
alarm_type as alarmType,
|
||||||
|
alarm_source_type as alarmSourceType,
|
||||||
|
alarm_level as alarmLevel,
|
||||||
|
enterprise_id as enterpriseId,
|
||||||
|
project_id as projectId,
|
||||||
|
project_name as projectName,
|
||||||
|
region_id as regionId,
|
||||||
|
region_name as regionName,
|
||||||
|
source_id as sourceId,
|
||||||
|
screen_warning_mark as screenWarningMark,
|
||||||
|
read_mark as readMark,
|
||||||
|
video_mark as videoMark,
|
||||||
|
system_type as systemType,
|
||||||
|
mac_addr as macAddr,
|
||||||
|
ip_addr as ipAddr,
|
||||||
|
union_dev_id as unionDevId,
|
||||||
|
extend as extend,
|
||||||
|
prompt_audio as promptAudio,
|
||||||
|
pop_up_alarm_mark as popUpAlarmMark,
|
||||||
|
alarm_params as alarmParams,
|
||||||
|
linkage_screen_mark as linkageScreenMark
|
||||||
|
from nu_iot_tplink_alarm_log
|
||||||
|
where log_id = #{logId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getMaxLogTime" parameterType="com.nu.modules.tplink.alarm.entity.AlarmLog" resultType="Long">
|
||||||
|
select max(log_time) as logTime
|
||||||
|
from nu_iot_tplink_alarm_log
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.nu.modules.tplink.alarm.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.nu.modules.tplink.alarm.entity.AlarmLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK告警日志信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-23
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IAlarmLogService extends IService<AlarmLog> {
|
||||||
|
Long getMaxLogTime(AlarmLog alarmLog);
|
||||||
|
void sync(String jsonResponse);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.nu.modules.tplink.alarm.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.nu.modules.tplink.alarm.entity.AlarmLog;
|
||||||
|
import com.nu.modules.tplink.alarm.mapper.AlarmLogMapper;
|
||||||
|
import com.nu.modules.tplink.alarm.service.IAlarmLogService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK告警日志信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-23
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> implements IAlarmLogService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getMaxLogTime(AlarmLog alarmLog){
|
||||||
|
return baseMapper.getMaxLogTime(alarmLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sync(String jsonResponse){
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
if(jsonObject.getInt("error_code").equals(0)){
|
||||||
|
JSONObject result = (JSONObject)jsonObject.get("result");
|
||||||
|
if(result.getInt("total")>0){
|
||||||
|
JSONArray list = result.getJSONArray("list");
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
String jsonString = list.get(i).toString();
|
||||||
|
try {
|
||||||
|
AlarmLog alarmLog = mapper.readValue(jsonString, AlarmLog.class);
|
||||||
|
long timestamp = alarmLog.getLogTime();
|
||||||
|
Date date = new Date(timestamp); // 将时间戳转换为Date对象
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 定义日期格式
|
||||||
|
String formattedDate = sdf.format(date); // 格式化日期
|
||||||
|
alarmLog.setLogTimeFm(formattedDate);
|
||||||
|
AlarmLog entity = baseMapper.getByAlarmLogId(alarmLog);
|
||||||
|
if(entity==null){
|
||||||
|
//新增
|
||||||
|
baseMapper.insert(alarmLog);
|
||||||
|
}else{
|
||||||
|
//修改
|
||||||
|
alarmLog.setId(entity.getId());
|
||||||
|
baseMapper.updateById(alarmLog);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,424 @@
|
||||||
|
/**
|
||||||
|
* Version:v1.0.0 ,
|
||||||
|
* Description:TP-LINK厂家摄像头相关操作
|
||||||
|
* CreateDate:2025-01-17 09:00:00
|
||||||
|
* Author:曹磊
|
||||||
|
*
|
||||||
|
* ModifyDate:2025-02-19 14:00:00
|
||||||
|
* ModifyMode:新增
|
||||||
|
* ModifyFunction:getUploadToServerProcess
|
||||||
|
* ModifyDescription:获取转存MP4上传任务进度
|
||||||
|
*/
|
||||||
|
package com.nu.modules.tplink.camera.controller;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
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.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-摄像头信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags="护理单元-物联管理-摄像头信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/iot/cameraInfo")
|
||||||
|
@Slf4j
|
||||||
|
public class CameraInfoController extends JeecgController<CameraInfo, ICameraInfoService> {
|
||||||
|
@Autowired
|
||||||
|
private ICameraInfoService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param CameraInfo
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "护理单元-物联管理-摄像头信息-分页列表查询")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-摄像头信息-分页列表查询", notes="护理单元-物联管理-摄像头信息-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<CameraInfo>> queryPageList(CameraInfo CameraInfo,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
Page<CameraInfo> page = new Page<CameraInfo>(pageNo, pageSize);
|
||||||
|
IPage<CameraInfo> pageList = service.findPage(page, CameraInfo);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value="护理单元分页列表查询", notes="护理单元分页列表查询")
|
||||||
|
@GetMapping(value = "/nuList")
|
||||||
|
public Result<IPage<CameraInfo>> queryNuPageList(CameraInfo CameraInfo,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
Page<CameraInfo> page = new Page<CameraInfo>(pageNo, pageSize);
|
||||||
|
IPage<CameraInfo> pageList = service.findNuPage(page, CameraInfo);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "护理单元-物联管理-摄像头信息-编辑")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-摄像头信息-编辑", notes="护理单元-物联管理-摄像头信息-编辑")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody CameraInfo cameraInfo) {
|
||||||
|
service.edit(cameraInfo);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改摄像头信息
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/rebootDevice", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||||
|
public Result<String> rebootDevice(@RequestBody CameraInfo cameraInfo) {
|
||||||
|
service.rebootDevice(cameraInfo);
|
||||||
|
return Result.OK("重启成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取IPC设备能力集
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getIpcCapability")
|
||||||
|
public Result<JSONObject> getIpcCapability(CameraInfo cameraInfo) {
|
||||||
|
return service.getIpcCapability(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取画面基本信息
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getImageCommon")
|
||||||
|
public Result<JSONObject> getImageCommon(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getImageCommon(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置画面基本信息
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/setImageCommon")
|
||||||
|
public Result setImageCommon(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.setImageCommon(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取OSD能力集
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getOsdCapability")
|
||||||
|
public Result<JSONObject> getOsdCapability(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getOsdCapability(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取OSD参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getOsd")
|
||||||
|
public Result<JSONObject> getOsd(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getOsd(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置OSD参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/setOsd")
|
||||||
|
public Result<String> setOsd(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.setOsd(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取码率参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getVideoParams")
|
||||||
|
public Result<JSONObject> getVideoParams(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getVideoParams(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置码率参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/setVideoParams")
|
||||||
|
public Result setVideoParams(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.setVideoParams(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 恢复画面默认值
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/configRecovery")
|
||||||
|
public Result configRecovery(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.configRecovery(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取摄像头实时播放地址
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getPreviewUrl")
|
||||||
|
public Result<Map<String,String>> getPreviewUrl(CameraInfo cameraInfo) {
|
||||||
|
return service.getPreviewUrl(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取录像配置--暂无用
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getRecordCfgs")
|
||||||
|
public Result getRecordCfgs(CameraInfo cameraInfo) throws Exception{
|
||||||
|
return service.getRecordCfgs(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置录像计划--暂无用
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/setRecordCfgs")
|
||||||
|
public Result setRecordCfgs(CameraInfo cameraInfo) throws Exception{
|
||||||
|
return service.setRecordCfgs(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取批量操作录像计划进度--暂无用
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getBatchProgress")
|
||||||
|
public Result getBatchProgress(CameraInfo cameraInfo) throws Exception{
|
||||||
|
return service.getBatchProgress(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取镜头遮挡参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getTamperDet")
|
||||||
|
public Result<JSONObject> getTamperDet(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getTamperDet(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置镜头遮挡参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/setTamperDet")
|
||||||
|
public Result<String> setTamperDet(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.setTamperDet(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取镜头遮挡处理方式
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getTamperNotif")
|
||||||
|
public Result<JSONObject> getTamperNotif(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getTamperNotif(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置镜头遮挡处理方式
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/setTamperNotif")
|
||||||
|
public Result setTamperNotif(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.setTamperNotif(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警声音试听
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/testAudio")
|
||||||
|
public Result testAudio(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.testAudio(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取白光/声音告警参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getAlarmInfo")
|
||||||
|
public Result<JSONObject> getAlarmInfo(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getAlarmInfo(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置白光/声音告警参数
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/setAlarmInfo")
|
||||||
|
public Result<String> setAlarmInfo(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.setAlarmInfo(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取白光/声音告警布防时间
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/getAlarmPlan")
|
||||||
|
public Result<JSONObject> getAlarmPlan(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.getAlarmPlan(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置白光/声音告警布防时间
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/setAlarmPlan")
|
||||||
|
public Result setAlarmPlan(@RequestBody Map<String,Object> map) {
|
||||||
|
return service.setAlarmPlan(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索某天的录像数据
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/searchVideo")
|
||||||
|
public Result<IPage<CameraInfo>> searchVideo(CameraInfo cameraInfo,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
return service.searchVideo(pageNo, pageSize, cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取摄像头录像回放地址
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getPlaybackUrlList")
|
||||||
|
public Result<Map<String,Object>> getPlaybackUrlList(CameraInfo cameraInfo) {
|
||||||
|
return service.getPlaybackUrlList(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除回放通道
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/deletePlaybackChn")
|
||||||
|
public Result<String> deletePlaybackChn(CameraInfo cameraInfo) {
|
||||||
|
return service.deletePlaybackChn(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取摄像头录像回放地址
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getMultitransUrl")
|
||||||
|
public Result<Map<String,Object>> getMultitransUrl(CameraInfo cameraInfo) throws Exception{
|
||||||
|
return service.getMultitransUrl(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回放视频转mp4上传
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/uploadToServer")
|
||||||
|
public Result uploadToServer(CameraInfo cameraInfo) throws Exception{
|
||||||
|
return service.uploadToServer(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止转存MP4上传任务
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/stopUploadToServer")
|
||||||
|
public Result<String> stopUploadToServer(CameraInfo cameraInfo) throws Exception{
|
||||||
|
return service.stopUploadToServer(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取转存MP4上传任务进度
|
||||||
|
*
|
||||||
|
* @param cameraInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getUploadToServerProcess")
|
||||||
|
public Result getUploadToServerProcess(CameraInfo cameraInfo) throws Exception{
|
||||||
|
return service.getUploadToServerProcess(cameraInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,281 @@
|
||||||
|
package com.nu.modules.tplink.camera.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK摄像头信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("nu_iot_tplink_camera")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="nu_iot_tplink_camera对象", description="护理单元-物联管理-TPLINK摄像头信息")
|
||||||
|
public class CameraInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**ID*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private Integer id;
|
||||||
|
/**设备序号*/
|
||||||
|
@Excel(name = "设备序号", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备序号")
|
||||||
|
private String deviceIndex;
|
||||||
|
/**设备名称*/
|
||||||
|
@Excel(name = "设备名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
/**设备类型*/
|
||||||
|
@Excel(name = "设备类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备类型")
|
||||||
|
private String deviceType;
|
||||||
|
/**设备状态 0 离线 1 在线 2 重启中 3 升级中 4 配置中 5 同步中*/
|
||||||
|
@Excel(name = "设备状态 0 离线 1 在线 2 重启中 3 升级中 4 配置中 5 同步中", width = 15, dicCode = "tplink_status")
|
||||||
|
@Dict(dicCode = "tplink_status")
|
||||||
|
@ApiModelProperty(value = "设备状态 0 离线 1 在线 2 重启中 3 升级中 4 配置中 5 同步中")
|
||||||
|
private String deviceStatus;
|
||||||
|
/**设备型号*/
|
||||||
|
@Excel(name = "设备型号", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备型号")
|
||||||
|
private String deviceModel;
|
||||||
|
/**IP地址*/
|
||||||
|
@Excel(name = "IP地址", width = 15)
|
||||||
|
@ApiModelProperty(value = "IP地址")
|
||||||
|
private String ip;
|
||||||
|
/**MAC地址*/
|
||||||
|
@Excel(name = "MAC地址", width = 15)
|
||||||
|
@ApiModelProperty(value = "MAC地址")
|
||||||
|
private String mac;
|
||||||
|
/**分组ID*/
|
||||||
|
@Excel(name = "分组ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "分组ID")
|
||||||
|
private String regionId;
|
||||||
|
/**分组名称*/
|
||||||
|
@Excel(name = "分组名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "分组名称")
|
||||||
|
private String regionName;
|
||||||
|
/**父设备ID*/
|
||||||
|
@Excel(name = "父设备ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "父设备ID")
|
||||||
|
private String parentId;
|
||||||
|
/**父设备名称*/
|
||||||
|
@Excel(name = "父设备名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "父设备名称")
|
||||||
|
private String parentDeviceName;
|
||||||
|
/**项目ID*/
|
||||||
|
@Excel(name = "项目ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目ID")
|
||||||
|
private String projectId;
|
||||||
|
/**项目名称*/
|
||||||
|
@Excel(name = "项目名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目名称")
|
||||||
|
private String projectName;
|
||||||
|
/**软件版本*/
|
||||||
|
@Excel(name = "软件版本", width = 15)
|
||||||
|
@ApiModelProperty(value = "软件版本")
|
||||||
|
private String firmwareVer;
|
||||||
|
/**硬件版本*/
|
||||||
|
@Excel(name = "硬件版本", width = 15)
|
||||||
|
@ApiModelProperty(value = "硬件版本")
|
||||||
|
private String hardwareVer;
|
||||||
|
/**用户权限类型 -1 无权限 0 可读 1 可控制 2 可配置 3 可控制/配置 4 所有*/
|
||||||
|
@Excel(name = "用户权限类型 -1 无权限 0 可读 1 可控制 2 可配置 3 可控制/配置 4 所有", width = 15, dicCode = "tplink_manager_auth_type")
|
||||||
|
@Dict(dicCode = "tplink_manager_auth_type")
|
||||||
|
@ApiModelProperty(value = "用户权限类型 -1 无权限 0 可读 1 可控制 2 可配置 3 可控制/配置 4 所有")
|
||||||
|
private String managerAuthType;
|
||||||
|
/**告警消息权限 1 有权限 -1 无权限*/
|
||||||
|
@Excel(name = "告警消息权限 1 有权限 -1 无权限", width = 15, dicCode = "tplink_msg_auth_type")
|
||||||
|
@Dict(dicCode = "tplink_msg_auth_type")
|
||||||
|
@ApiModelProperty(value = "告警消息权限 1 有权限 -1 无权限")
|
||||||
|
private String msgAuthType;
|
||||||
|
/**扩展信息*/
|
||||||
|
@Excel(name = "扩展信息", width = 15)
|
||||||
|
@ApiModelProperty(value = "扩展信息")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private JSONObject extend;
|
||||||
|
/**国标编码*/
|
||||||
|
@Excel(name = "国标编码", width = 15)
|
||||||
|
@ApiModelProperty(value = "国标编码")
|
||||||
|
private String sipCode;
|
||||||
|
/**位置名称*/
|
||||||
|
@Excel(name = "位置名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "位置名称")
|
||||||
|
private String locationName;
|
||||||
|
/**系统类型 public 通用 vms 监控 nms 网络 evcs 新能源充电桩 rms 客控 nbs 音箱 bas 楼控 ams 门禁 smart_agriculture 智慧农业 vps 停车管理 aaa 认证计费*/
|
||||||
|
@Excel(name = "系统类型 public 通用 vms 监控 nms 网络 evcs 新能源充电桩 rms 客控 nbs 音箱 bas 楼控 ams 门禁 smart_agriculture 智慧农业 vps 停车管理 aaa 认证计费", width = 15, dicCode = "tplink_system_type")
|
||||||
|
@Dict(dicCode = "tplink_system_type")
|
||||||
|
@ApiModelProperty(value = "系统类型 public 通用 vms 监控 nms 网络 evcs 新能源充电桩 rms 客控 nbs 音箱 bas 楼控 ams 门禁 smart_agriculture 智慧农业 vps 停车管理 aaa 认证计费")
|
||||||
|
private String systemType;
|
||||||
|
/**协议类型*/
|
||||||
|
@Excel(name = "协议类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "协议类型")
|
||||||
|
private String protocol;
|
||||||
|
/**置顶的时间*/
|
||||||
|
@Excel(name = "用户设置置顶的时间,毫秒级时间戳", width = 15)
|
||||||
|
@ApiModelProperty(value = "用户设置置顶的时间,毫秒级时间戳")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String topTime;
|
||||||
|
/**护理单元*/
|
||||||
|
@ApiModelProperty(value = "护理单元ID")
|
||||||
|
@Dict(dictTable ="nu_base_info",dicText = "name",dicCode = "id")
|
||||||
|
private String nuId;
|
||||||
|
/**护理单元*/
|
||||||
|
@ApiModelProperty(value = "护理单元")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String nuName;
|
||||||
|
@ApiModelProperty(value = "码流类型 0 代表主码流,1 代码子码流")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private int streamType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 能力集属性 ==>
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "运动检测")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String motionDetection;
|
||||||
|
@ApiModelProperty(value = "视频封面")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String videoCover;
|
||||||
|
@ApiModelProperty(value = "云台")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String ptz;
|
||||||
|
@ApiModelProperty(value = "motor")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String motor;
|
||||||
|
@ApiModelProperty(value = "smartCode")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String smartCode;
|
||||||
|
@ApiModelProperty(value = "强制在H.264编码过程中生成IDR帧的函数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String forceIdrFrame;
|
||||||
|
@ApiModelProperty(value = "音频")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String audio;
|
||||||
|
@ApiModelProperty(value = "本地存储")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String localStorage;
|
||||||
|
@ApiModelProperty(value = "回放API本版")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String playbackApiVersionTwo;
|
||||||
|
@ApiModelProperty(value = "多变性")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String multitrans;
|
||||||
|
@ApiModelProperty(value = "客流")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String passengerFlow;
|
||||||
|
@ApiModelProperty(value = "获取预览缩略图")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String getPreviewThumbnail;
|
||||||
|
@ApiModelProperty(value = "JPG预览缩略图")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String previewThumbnailJpeg;
|
||||||
|
@ApiModelProperty(value = "走廊")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String corridorMod;
|
||||||
|
@ApiModelProperty(value = "背光共存")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String backlightCoexistence;
|
||||||
|
/**
|
||||||
|
* <== 能力集属性
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "查询日期")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dataDate;
|
||||||
|
@ApiModelProperty(value = "设备索引")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String videoDevId;
|
||||||
|
@ApiModelProperty(value = "存储设备ID")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String storageDevId;
|
||||||
|
@ApiModelProperty(value = "存储设备名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String storageDevName;
|
||||||
|
@ApiModelProperty(value = "双摄IPC通道ID,双摄IPC的全景摄像头,其值为0.双摄IPC的特写摄像头,其值为1")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String channelId;
|
||||||
|
@ApiModelProperty(value = "当录像存在存储池中, 录像所属的nvs的ID")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String nvsIdInPoolList;
|
||||||
|
@ApiModelProperty(value = "录像开始时间. GMT时间,即1970.1.1零时至今的秒数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String startTime;
|
||||||
|
@ApiModelProperty(value = "录像结束时间. GMT时间,即1970.1.1零时至今的秒数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String endTime;
|
||||||
|
@ApiModelProperty(value = "录像开始时间,YYYY-MM-DD HH:MI:SS")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String startTimeFt;
|
||||||
|
@ApiModelProperty(value = "录像结束时间,YYYY-MM-DD HH:MI:SS")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String endTimeFt;
|
||||||
|
@ApiModelProperty(value = "录像时长,HH:MI:SS")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String duration;
|
||||||
|
@ApiModelProperty(value = "回放录像类型。1: 定时录像; 2: 移动侦测等")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String videoType;
|
||||||
|
@ApiModelProperty(value = "录像片段大小,单位字节")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String size;
|
||||||
|
@ApiModelProperty(value = "错误码")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String errorCode;
|
||||||
|
@ApiModelProperty(value = "错误描述")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String errorMsg;
|
||||||
|
@ApiModelProperty(value = "录像存储设备类型 -1:未找到,0:ipc,1:nvr,2:nvs:3:server,4:vcs,5:storagePool")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String storageType;
|
||||||
|
@ApiModelProperty(value = "预览/回放url")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String url;
|
||||||
|
@ApiModelProperty(value = "预览/回放备用url")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String backupUrl;
|
||||||
|
@ApiModelProperty(value = "ws连接传输视频地址")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String wsUrl;
|
||||||
|
@ApiModelProperty(value = "wss接传输视频地址")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String wssUrl;
|
||||||
|
@ApiModelProperty(value = "预览/回放通道对应的sessionId")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String sessionId;
|
||||||
|
@ApiModelProperty(value = "双摄IPC通道ID")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String videoChannelId;
|
||||||
|
@ApiModelProperty(value = "回放速率")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String scale;
|
||||||
|
@ApiModelProperty(value = "回放api访问前缀")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String queryAddress;
|
||||||
|
@ApiModelProperty(value = "录像开关;枚举:[0:表示关,1:表示开]")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String recordSwitch;
|
||||||
|
@ApiModelProperty(value = "任务taskId")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String taskId;
|
||||||
|
@ApiModelProperty(value = "上传mp4文件名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String fileName;
|
||||||
|
@ApiModelProperty(value = "上传进度")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String process;
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.nu.modules.tplink.camera.job;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.util.DateUtils;
|
||||||
|
import com.nu.modules.tplink.camera.entity.CameraInfo;
|
||||||
|
import com.nu.modules.tplink.camera.service.ICameraInfoService;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头能力集同步
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class CameraCapabilitySyncJob implements Job {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ICameraInfoService service;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
List<CameraInfo> list = service.findAllList();
|
||||||
|
if(list!=null&&list.size()>0){
|
||||||
|
for(int i=0;i< list.size();i++){
|
||||||
|
CameraInfo cameraInfo = list.get(i);
|
||||||
|
String id = cameraInfo.getDeviceIndex();
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("{");
|
||||||
|
sb.append("\"devId\"").append(":").append("\"").append(id).append("\"");
|
||||||
|
sb.append("}");
|
||||||
|
String jsonResponse = tumsApi.getIpcCapability(sb.toString());
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
service.syncCapability(id,jsonResponse);
|
||||||
|
}else{
|
||||||
|
log.error("CameraCapabilitySyncJob:{}-{}", DateUtils.now(),"devId:"+id+","+jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.nu.modules.tplink.camera.job;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.util.DateUtils;
|
||||||
|
import com.nu.modules.tplink.camera.service.ICameraInfoService;
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.nu.modules.tplink.project.service.IProjectInfoService;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头设备信息同步
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class CameraDeviceSyncJob implements Job {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ICameraInfoService service;
|
||||||
|
@Autowired
|
||||||
|
IProjectInfoService pService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
ProjectInfo pi = new ProjectInfo();
|
||||||
|
pi.setStatus(1);//正常状态
|
||||||
|
List<ProjectInfo> projectList = pService.findList(pi);
|
||||||
|
if(projectList!=null&&projectList.size()>0){
|
||||||
|
for(int i=0;i< projectList.size();i++){
|
||||||
|
ProjectInfo projectInfo = projectList.get(i);
|
||||||
|
String jsonRequest = "{\n" +
|
||||||
|
" \"start\": 0,\n" +
|
||||||
|
" \"limit\": 1000,\n" +
|
||||||
|
" \"filterAnd\": {\n"+
|
||||||
|
" \"projectId\": \""+projectInfo.getProjectId()+"\",\n"+
|
||||||
|
" \"deviceTypeList\": [\"SURVEILLANCECAMERA\"]\n"+
|
||||||
|
" },\n"+
|
||||||
|
" \"sort\": [{\n"+
|
||||||
|
" \"key\": \"deviceIndex\",\n"+
|
||||||
|
" \"value\": \"asc\"\n"+
|
||||||
|
" }]\n"+
|
||||||
|
"}";
|
||||||
|
// System.out.println(jsonRequest);
|
||||||
|
String jsonResponse = tumsApi.getDeviceList(jsonRequest);
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
service.sync(jsonResponse);
|
||||||
|
}else{
|
||||||
|
log.error("CameraDeviceSyncJob:{}-{}", DateUtils.now(),jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.nu.modules.tplink.camera.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.nu.modules.tplink.camera.entity.CameraInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-摄像头信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CameraInfoMapper extends BaseMapper<CameraInfo> {
|
||||||
|
IPage<CameraInfo> findPage(Page<CameraInfo> page, @Param("params") CameraInfo cameraInfo);
|
||||||
|
List<CameraInfo> findAllList();
|
||||||
|
IPage<CameraInfo> findNuPage(Page<CameraInfo> page, @Param("params") CameraInfo cameraInfo);
|
||||||
|
CameraInfo getByDeviceId(CameraInfo cameraInfo);
|
||||||
|
CameraInfo getCapabilityByDeviceId(CameraInfo cameraInfo);
|
||||||
|
void insertCapability(CameraInfo cameraInfo);
|
||||||
|
void updateCapabilityById(CameraInfo cameraInfo);
|
||||||
|
}
|
|
@ -0,0 +1,217 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.nu.modules.tplink.camera.mapper.CameraInfoMapper">
|
||||||
|
|
||||||
|
<select id="findPage" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||||
|
select a.id,
|
||||||
|
a.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,
|
||||||
|
b.name as nuName,
|
||||||
|
ifnull(c.multitrans,0) as multitrans
|
||||||
|
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.id
|
||||||
|
left join nu_iot_tplink_camera_capability c on a.device_index = c.device_index
|
||||||
|
<where>
|
||||||
|
<if test="params.deviceIndex != null and params.deviceIndex != ''">
|
||||||
|
AND a.device_index = #{params.deviceIndex}
|
||||||
|
</if>
|
||||||
|
<if test="params.deviceStatus != null and params.deviceStatus != ''">
|
||||||
|
AND a.device_status = #{params.deviceStatus}
|
||||||
|
</if>
|
||||||
|
<if test="params.deviceName != null and params.deviceName != ''">
|
||||||
|
AND a.device_name = #{params.deviceName}
|
||||||
|
</if>
|
||||||
|
<if test="params.projectName != null and params.projectName != ''">
|
||||||
|
AND a.project_name LIKE concat('%',#{params.projectName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="params.regionName != null and params.regionName != ''">
|
||||||
|
AND a.region_name LIKE concat('%',#{params.regionName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="params.nuName != null and params.nuName != ''">
|
||||||
|
AND b.name LIKE concat('%',#{params.nuName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="params.projectId != null and params.projectId != ''">
|
||||||
|
AND a.project_id = #{params.projectId}
|
||||||
|
</if>
|
||||||
|
<if test="params.regionId != null and params.regionId != ''">
|
||||||
|
AND a.region_id = #{params.regionId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findAllList" 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,
|
||||||
|
nu_id as nuId
|
||||||
|
from nu_iot_tplink_camera a
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNuPage" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||||
|
select
|
||||||
|
id as nuId,
|
||||||
|
name as nuName
|
||||||
|
from nu_base_info b
|
||||||
|
<where>
|
||||||
|
<if test="params.nuId != null and params.nuId != ''">
|
||||||
|
AND b.id = #{params.nuId}
|
||||||
|
</if>
|
||||||
|
<if test="params.nuName != null and params.nuName != ''">
|
||||||
|
AND b.name LIKE concat('%',#{params.nuName},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getByDeviceId" 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,
|
||||||
|
nu_id as nuId,
|
||||||
|
b.id as nuName
|
||||||
|
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.id
|
||||||
|
where device_index = #{deviceIndex}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getCapabilityByDeviceId" parameterType="com.nu.modules.tplink.camera.entity.CameraInfo" resultType="com.nu.modules.tplink.camera.entity.CameraInfo">
|
||||||
|
select a.id,
|
||||||
|
device_index as deviceIndex,
|
||||||
|
motion_detection as motionDetection,
|
||||||
|
video_cover as videoCover,
|
||||||
|
ptz,
|
||||||
|
motor,
|
||||||
|
smart_code as smartCode,
|
||||||
|
force_idr_frame as forceIdrFrame,
|
||||||
|
audio,
|
||||||
|
local_storage as localStorage,
|
||||||
|
playback_api_version_two as playbackApiVersionTwo,
|
||||||
|
multitrans,
|
||||||
|
passenger_flow as passengerFlow,
|
||||||
|
get_preview_thumbnail as getPreviewThumbnail,
|
||||||
|
preview_thumbnail_jpeg as previewThumbnailJpeg,
|
||||||
|
corridor_mod as corridorMod,
|
||||||
|
backlight_coexistence as backlightCoexistence
|
||||||
|
from nu_iot_tplink_camera_capability a
|
||||||
|
where device_index = #{deviceIndex}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertCapability">
|
||||||
|
insert into nu_iot_tplink_camera_capability (
|
||||||
|
id,
|
||||||
|
device_index,
|
||||||
|
motion_detection,
|
||||||
|
video_cover,
|
||||||
|
ptz,
|
||||||
|
motor,
|
||||||
|
smart_code,
|
||||||
|
force_idr_frame,
|
||||||
|
audio,
|
||||||
|
local_storage,
|
||||||
|
playback_api_version_two,
|
||||||
|
multitrans,
|
||||||
|
passenger_flow,
|
||||||
|
get_preview_thumbnail,
|
||||||
|
preview_thumbnail_jpeg,
|
||||||
|
corridor_mod,
|
||||||
|
backlight_coexistence
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
#{id},
|
||||||
|
#{deviceIndex},
|
||||||
|
#{motionDetection},
|
||||||
|
#{videoCover},
|
||||||
|
#{ptz},
|
||||||
|
#{motor},
|
||||||
|
#{smartCode},
|
||||||
|
#{forceIdrFrame},
|
||||||
|
#{audio},
|
||||||
|
#{localStorage},
|
||||||
|
#{playbackApiVersionTwo},
|
||||||
|
#{multitrans},
|
||||||
|
#{passengerFlow},
|
||||||
|
#{getPreviewThumbnail},
|
||||||
|
#{previewThumbnailJpeg},
|
||||||
|
#{corridorMod},
|
||||||
|
#{backlightCoexistence}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateCapabilityById">
|
||||||
|
UPDATE nu_iot_tplink_camera_capability
|
||||||
|
SET
|
||||||
|
device_index = #{deviceIndex},
|
||||||
|
motion_detection = #{motionDetection},
|
||||||
|
video_cover = #{videoCover},
|
||||||
|
ptz = #{ptz},
|
||||||
|
motor = #{motor},
|
||||||
|
smart_code = #{smartCode},
|
||||||
|
force_idr_frame = #{forceIdrFrame},
|
||||||
|
audio = #{audio},
|
||||||
|
local_storage = #{localStorage},
|
||||||
|
playback_api_version_two = #{playbackApiVersionTwo},
|
||||||
|
multitrans = #{multitrans},
|
||||||
|
passenger_flow = #{passengerFlow},
|
||||||
|
get_preview_thumbnail = #{getPreviewThumbnail},
|
||||||
|
preview_thumbnail_jpeg = #{previewThumbnailJpeg},
|
||||||
|
corridor_mod = #{corridorMod},
|
||||||
|
backlight_coexistence = #{backlightCoexistence}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.nu.modules.tplink.camera.service;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.nu.modules.tplink.camera.entity.CameraInfo;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-摄像头信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface ICameraInfoService extends IService<CameraInfo> {
|
||||||
|
IPage<CameraInfo> findPage(Page<CameraInfo> page, CameraInfo cameraInfo);
|
||||||
|
List<CameraInfo> findAllList();
|
||||||
|
IPage<CameraInfo> findNuPage(Page<CameraInfo> page, CameraInfo cameraInfo);
|
||||||
|
void edit(CameraInfo cameraInfo);
|
||||||
|
void rebootDevice(CameraInfo cameraInfo);
|
||||||
|
void sync(String jsonResponse);
|
||||||
|
void syncCapability(String deviceIndex,String jsonResponse);
|
||||||
|
Result<JSONObject> getIpcCapability(CameraInfo cameraInfo);
|
||||||
|
Result<JSONObject> getImageCommon(Map<String,Object> map);
|
||||||
|
Result setImageCommon(Map<String,Object> map);
|
||||||
|
Result<JSONObject> getOsdCapability(Map<String,Object> map);
|
||||||
|
Result<JSONObject> getOsd(Map<String,Object> map);
|
||||||
|
Result<String> setOsd(Map<String,Object> map);
|
||||||
|
Result<JSONObject> getVideoParams(Map<String,Object> map);
|
||||||
|
Result setVideoParams(Map<String,Object> map);
|
||||||
|
Result configRecovery(Map<String,Object> map);
|
||||||
|
Result<Map<String,String>> getPreviewUrl(CameraInfo cameraInfo);
|
||||||
|
Result getRecordCfgs(CameraInfo cameraInfo) throws Exception;
|
||||||
|
Result setRecordCfgs(CameraInfo cameraInfo) throws Exception;
|
||||||
|
Result getBatchProgress(CameraInfo cameraInfo) throws Exception;
|
||||||
|
Result<JSONObject> getTamperDet(Map<String,Object> map);
|
||||||
|
Result<String> setTamperDet(Map<String,Object> map);
|
||||||
|
Result<JSONObject> getTamperNotif(Map<String,Object> map);
|
||||||
|
Result setTamperNotif(Map<String,Object> map);
|
||||||
|
Result testAudio(Map<String,Object> map);
|
||||||
|
Result<JSONObject> getAlarmInfo(Map<String,Object> map);
|
||||||
|
Result<String> setAlarmInfo(Map<String,Object> map);
|
||||||
|
Result<JSONObject> getAlarmPlan(Map<String,Object> map);
|
||||||
|
Result setAlarmPlan(Map<String,Object> map);
|
||||||
|
Result<IPage<CameraInfo>> searchVideo(Integer pageNo, Integer pageSize, CameraInfo cameraInfo);
|
||||||
|
Result<Map<String,Object>> getPlaybackUrlList(CameraInfo cameraInfo);
|
||||||
|
Result<String> deletePlaybackChn(CameraInfo cameraInfo);
|
||||||
|
Result<Map<String,Object>> getMultitransUrl(CameraInfo cameraInfo) throws Exception;
|
||||||
|
Result uploadToServer(CameraInfo cameraInfo);
|
||||||
|
Result<String> stopUploadToServer(CameraInfo cameraInfo);
|
||||||
|
Result getUploadToServerProcess(CameraInfo cameraInfo);
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,52 @@
|
||||||
|
package com.nu.modules.tplink.common.controller;
|
||||||
|
|
||||||
|
import com.tplink.ignite.libs.developersdk.api.TumsClient;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import com.nu.modules.tplink.utils.TumsConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/iot/tplink")
|
||||||
|
@Slf4j
|
||||||
|
public class TpLinkController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
@Resource
|
||||||
|
TumsConfig tumsConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录图门系统
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/login")
|
||||||
|
public Result<Map<String,String>> login() {
|
||||||
|
Map<String,String> map = new HashMap<>();
|
||||||
|
map.put("cookie","");
|
||||||
|
map.put("serverUrl",tumsConfig.getUrl());
|
||||||
|
TumsClient tc = tumsApi.createTumsClient();
|
||||||
|
if(tc!=null){
|
||||||
|
map.put("cookie",tc.getCookie());
|
||||||
|
}
|
||||||
|
return Result.OK(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登出图门系统
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/logout")
|
||||||
|
public Result<Map> logout() {
|
||||||
|
tumsApi.destroyTumsClient();
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.nu.modules.tplink.common.entity;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK错误码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-10
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("nu_iot_tplink_error_code")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="nu_iot_tplink_error_code对象", description="护理单元-物联管理-TPLINK错误码")
|
||||||
|
public class ErrorCode implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**错误码*/
|
||||||
|
@Excel(name = "错误码", width = 15)
|
||||||
|
@ApiModelProperty(value = "错误码")
|
||||||
|
private String errorCode;
|
||||||
|
/**错误描述*/
|
||||||
|
@Excel(name = "错误描述", width = 15)
|
||||||
|
@ApiModelProperty(value = "错误描述")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.nu.modules.tplink.common.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.nu.modules.tplink.common.entity.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-错误码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-10
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ErrorCodeMapper extends BaseMapper<ErrorCode> {
|
||||||
|
ErrorCode getByCode(String errorCode);
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.nu.modules.tplink.common.mapper.ErrorCodeMapper">
|
||||||
|
|
||||||
|
<select id="getByCode" parameterType="String" resultType="com.nu.modules.tplink.common.entity.ErrorCode">
|
||||||
|
select
|
||||||
|
error_code as errorCode,
|
||||||
|
error_msg as errorMsg
|
||||||
|
from nu_iot_tplink_error_code
|
||||||
|
where error_code = #{errorCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.nu.modules.tplink.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.nu.modules.tplink.common.entity.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-错误码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-10
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IErrorCodeService extends IService<ErrorCode> {
|
||||||
|
ErrorCode getByCode(String errorCode);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.nu.modules.tplink.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.nu.modules.tplink.common.entity.ErrorCode;
|
||||||
|
import com.nu.modules.tplink.common.mapper.ErrorCodeMapper;
|
||||||
|
import com.nu.modules.tplink.common.service.IErrorCodeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-错误码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-10
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ErrorCodeServiceImpl extends ServiceImpl<ErrorCodeMapper, ErrorCode> implements IErrorCodeService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErrorCode getByCode(String errorCode){
|
||||||
|
return baseMapper.getByCode(errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.nu.modules.tplink.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口枚举类
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum ApiEnum {
|
||||||
|
//前缀对应相应设备的API,无前缀则是公用API
|
||||||
|
//IPC 视频
|
||||||
|
//NVS 存储服务器
|
||||||
|
//AUDIO 音箱
|
||||||
|
//ROUTER 路由器
|
||||||
|
//SWITCH 交换机
|
||||||
|
//AP 无线路由器
|
||||||
|
//AC ⽆线控制器
|
||||||
|
|
||||||
|
GET_ENCRYPT_KEY_FOR_LOGIN("/tums/account/v1/getEncryptKeyForLogin","获取登录公钥"),
|
||||||
|
LOGIN("/tums/account/v2/login","登录"),
|
||||||
|
LOGOUT("/tums/account/v1/logout","注销"),
|
||||||
|
SET_CURRENT_PROJECT("/tums/resource/v2/setCurrentProject","设置当前项目"),
|
||||||
|
GET_ALL_PROJECT_INFO("/tums/resource/v2/getAllProjectInfo","获取所有项目信息"),
|
||||||
|
GET_ROOT_REGIONS("/tums/resource/v2/getRootRegions","获取区域列表"),
|
||||||
|
GET_DEVICE_LIST("/tums/deviceManager/v2/getDeviceList","获取设备列表"),
|
||||||
|
MODIFY_DEVICE_DETAILS("/tums/deviceManager/v1/modifyDeviceDetails","修改设备信息"),
|
||||||
|
REBOOT_DEVICE_LIST("/tums/deviceManager/v2/rebootDeviceList","重启设备"),
|
||||||
|
QUERY_ALARM_LOG("/tums/logManager/v2/queryAlarmLog","查询告警日志列表"),
|
||||||
|
QUERY_UNREAD_ALARM_MSG("/tums/logManager/v2/queryUnreadAlarmMsg","查询未读告警日志列表"),
|
||||||
|
IPC_GET_IPC_CAPABILITY("/tums/deviceManager/v1/getIpcCapability","获取ipc能力集"),
|
||||||
|
IPC_PASSTHROUGH("/tums/devConfig/v1/passthrough","设备配置信息"),
|
||||||
|
|
||||||
|
IPC_ADD_PREVIEW_CHN("/tums/preview/v1/addPreviewChn","添加预览通道"),
|
||||||
|
IPC_GET_PREVIEW_URL("/tums/preview/v1/getPreviewUrl","获取预览通道的url"),
|
||||||
|
IPC_SEARCH_YEAR("/tums/playback/v1/searchYear","搜索存在回放录像的日期"),
|
||||||
|
IPC_GET_PLAYBACK_URL("/tums/playback/v1/getPlaybackUrl","获取回放通道的url"),
|
||||||
|
IPC_SUSPEND_PLAYBACK("/tums/playback/v1/suspendPlayback","暂停通道回放"),
|
||||||
|
IPC_DELETE_PLAYBACK_CHN("/tums/playback/v1/deletePlaybackChn","删除回放通道"),
|
||||||
|
IPC_GET_STORAGES_BY_ID("/tums/playback/v1/getStoragesById","获取指定监控点的存储设备列表"),
|
||||||
|
IPC_SEARCH_VIDEO("/tums/playback/v3/searchVideo","搜索当天的录像数据V3"),
|
||||||
|
IPC_ADD_PLAYBACK_CHN("/tums/playback/v2/addPlaybackChn","添加回放通道V2"),
|
||||||
|
IPC_GET_MULTITRANS_URL("/tums/playback/v1/getMultitransUrl","获取nvmp设备双向通信URL"),
|
||||||
|
IPC_GET_RECORD_CFGS("/tums/record/v1/getRecordCfgs","获取录像配置"),
|
||||||
|
IPC_SET_RECORD_CFGS("/tums/record/v1/setRecordCfgs","设置录像计划"),
|
||||||
|
IPC_GET_BATCH_PROGRESS("/tums/record/v1/getBatchProgress","获取批量操作录像计划进度"),
|
||||||
|
IPC_MOTION_CTRL("/tums/ptz/v1/motionCtrl","高速球机移动方向控制"),
|
||||||
|
IPC_GET_ALL_PRESETS("/tums/ptz/v1/getAllPresets","获取高速球机的所有预置点"),
|
||||||
|
IPC_OPERATE_PRESET("/tums/ptz/v1/operatePreset","操作高速球机的预置点"),
|
||||||
|
IPC_GET_ALL_TOURS("/tums/ptz/v1/getAllTours","获取高速球机的所有巡航列表"),
|
||||||
|
IPC_GET_TOURS_INFO("/tums/ptz/v1/getToursInfo","获取高速球机的巡航信息"),
|
||||||
|
IPC_ADD_NEW_TOUR("/tums/ptz/v1/addNewTour","高速球机新增巡航点"),
|
||||||
|
IPC_MODIFY_TOUR("/tums/ptz/v1/modifyTour","修改高速球机的巡航点配置"),
|
||||||
|
IPC_EXECUTE_TOUR("/tums/ptz/v1/executeTour","操作高速球机的巡航点"),
|
||||||
|
IPC_DELETE_TOUR("/tums/ptz/v1/deleteTour","删除高速球机巡航点"),
|
||||||
|
IPC_UPLOAD_TO_SERVER("/tums/playback/v1/uploadToServer","回放视频转mp4上传"),
|
||||||
|
IPC_STOP_UPLOAD_TO_SERVER("/tums/preview/v1/stopUploadToServer","停止转存MP4上传任务"),
|
||||||
|
IPC_GET_UPLOAD_TO_SERVER_PROCESS("/tums/preview/v1/getUploadToServerProcess","获取转存MP4上传任务进度");
|
||||||
|
|
||||||
|
private final String value;//自定义属性,枚举值,获取:如ApiEnum.GET_ENCRYPT_KEY_FOR_LOGIN.getValue();
|
||||||
|
private final String remark;//自定义属性,枚举描述,获取:如ApiEnum.GET_ENCRYPT_KEY_FOR_LOGIN.getRemark();
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
/**
|
||||||
|
* Version:v1.0.0 ,
|
||||||
|
* Description:TP-LINK厂家项目信息相关操作
|
||||||
|
* CreateDate:2025-01-22 09:00:00
|
||||||
|
* Author:曹磊
|
||||||
|
*/
|
||||||
|
package com.nu.modules.tplink.project.controller;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.nu.modules.tplink.project.model.ProjectTreeModel;
|
||||||
|
import com.nu.modules.tplink.project.service.IProjectInfoService;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK项目信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-22
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags="护理单元-物联管理-TPLINK项目信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/iot/projectInfo")
|
||||||
|
@Slf4j
|
||||||
|
public class ProjectInfoController extends JeecgController<ProjectInfo, IProjectInfoService> {
|
||||||
|
@Autowired
|
||||||
|
private IProjectInfoService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param projectInfo
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "护理单元-物联管理-TPLINK项目信息-分页列表查询")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK项目信息-分页列表查询", notes="护理单元-物联管理-TPLINK项目信息-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<ProjectInfo>> queryPageList(ProjectInfo projectInfo,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
Page<ProjectInfo> page = new Page<ProjectInfo>(pageNo, pageSize);
|
||||||
|
IPage<ProjectInfo> pageList = service.findPage(page, projectInfo);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步项目信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/sync")
|
||||||
|
public Result getUploadToServerProcess()throws Exception{
|
||||||
|
return service.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步查询项目list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryRegionTreeSync", method = RequestMethod.GET)
|
||||||
|
public Result<List<ProjectTreeModel>> queryDepartTreeSync() {
|
||||||
|
Result<List<ProjectTreeModel>> result = new Result<>();
|
||||||
|
try {
|
||||||
|
List<ProjectTreeModel> list = service.queryTreeList();
|
||||||
|
result.setResult(list);
|
||||||
|
result.setSuccess(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
result.setSuccess(false);
|
||||||
|
result.setMessage("查询失败");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.nu.modules.tplink.project.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import org.jeecg.common.constant.ProvinceCityArea;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK项目信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-22
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("nu_iot_tplink_project")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="nu_iot_tplink_project对象", description="护理单元-物联管理-TPLINK项目信息")
|
||||||
|
public class ProjectInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**ID*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private Integer id;
|
||||||
|
/**项目ID*/
|
||||||
|
@Excel(name = "项目ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目ID")
|
||||||
|
private String projectId;
|
||||||
|
/**项目名称*/
|
||||||
|
@Excel(name = "项目名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目名称")
|
||||||
|
private String projectName;
|
||||||
|
/**创建时间戳,单位秒*/
|
||||||
|
@ApiModelProperty(value = "创建时间戳,单位秒")
|
||||||
|
private String createTime;
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "创建时间,年月日时分秒")
|
||||||
|
private String createTimeStr;
|
||||||
|
/**设备数量*/
|
||||||
|
@Excel(name = "设备数量", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备数量")
|
||||||
|
private Integer deviceNum;
|
||||||
|
/**消息数量*/
|
||||||
|
@Excel(name = "消息数量", width = 15)
|
||||||
|
@ApiModelProperty(value = "消息数量")
|
||||||
|
private Integer messageNum;
|
||||||
|
/**项目次序*/
|
||||||
|
@Excel(name = "项目次序", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目次序")
|
||||||
|
private Integer sort;
|
||||||
|
/**项目次序,接口对应字段,在数据库中是关键字,数据库中用sort代替order*/
|
||||||
|
@ApiModelProperty(value = "项目次序")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String order;
|
||||||
|
/** 离线设备数*/
|
||||||
|
@Excel(name = "离线设备数", width = 15)
|
||||||
|
@ApiModelProperty(value = "离线设备数")
|
||||||
|
private Integer offlineNum;
|
||||||
|
/**异常设备数*/
|
||||||
|
@Excel(name = "异常设备数", width = 15)
|
||||||
|
@ApiModelProperty(value = "异常设备数")
|
||||||
|
private Integer abnormalNum;
|
||||||
|
/**未读消息数*/
|
||||||
|
@Excel(name = "未读消息数", width = 15)
|
||||||
|
@ApiModelProperty(value = "未读消息数")
|
||||||
|
private Integer unreadMessageNum;
|
||||||
|
/**nms设备总数*/
|
||||||
|
@Excel(name = "nms设备总数", width = 15)
|
||||||
|
@ApiModelProperty(value = "nms设备总数")
|
||||||
|
private Integer totalNmsDevNum;
|
||||||
|
/**vms设备总数*/
|
||||||
|
@Excel(name = "vms设备总数", width = 15)
|
||||||
|
@ApiModelProperty(value = "vms设备总数")
|
||||||
|
private Integer totalVmsDevNum;
|
||||||
|
/**nbs设备总数*/
|
||||||
|
@Excel(name = "nbs设备总数", width = 15)
|
||||||
|
@ApiModelProperty(value = "nbs设备总数")
|
||||||
|
private Integer totalNbsDevNum;
|
||||||
|
/**离线nms设备总数*/
|
||||||
|
@Excel(name = "离线nms设备总数", width = 15)
|
||||||
|
@ApiModelProperty(value = "离线nms设备总数")
|
||||||
|
private Integer offlineNmsDevNum;
|
||||||
|
/**离线vms设备总数*/
|
||||||
|
@Excel(name = "离线vms设备总数", width = 15)
|
||||||
|
@ApiModelProperty(value = "离线vms设备总数")
|
||||||
|
private Integer offlineVmsDevNum;
|
||||||
|
/**离线nbs设备总数*/
|
||||||
|
@Excel(name = "离线nbs设备总数", width = 15)
|
||||||
|
@ApiModelProperty(value = "离线nbs设备总数")
|
||||||
|
private Integer offlineNbsDevNum;
|
||||||
|
/**运行时间,单位s*/
|
||||||
|
@Excel(name = "运行时间,单位s", width = 15)
|
||||||
|
@ApiModelProperty(value = "运行时间,单位s")
|
||||||
|
private Integer runningTime;
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "运行天数")
|
||||||
|
private String runningTimeStr;
|
||||||
|
/**状态1正常 2冻结*/
|
||||||
|
@Excel(name = "状态1正常 2冻结", width = 15)
|
||||||
|
@ApiModelProperty(value = "状态1正常 2冻结")
|
||||||
|
private Integer status;
|
||||||
|
/**是否有叶子节点: 1是0否*/
|
||||||
|
@Excel(name = "是否有叶子节点: 1是0否", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否有叶子节点: 1是0否")
|
||||||
|
private Integer izLeaf;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.nu.modules.tplink.project.job;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.util.DateUtils;
|
||||||
|
import com.nu.modules.tplink.common.entity.ErrorCode;
|
||||||
|
import com.nu.modules.tplink.common.service.IErrorCodeService;
|
||||||
|
import com.nu.modules.tplink.project.service.IProjectInfoService;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ProjectSyncJob implements Job {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IProjectInfoService service;
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
String jsonRequest = "{\n" +
|
||||||
|
" \"start\": 0,\n" +
|
||||||
|
" \"limit\": 1000\n" +
|
||||||
|
"}";
|
||||||
|
String jsonResponse = tumsApi.getAllProjectInfo(jsonRequest);
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
service.sync(jsonResponse);
|
||||||
|
}else{
|
||||||
|
log.error("ProjectSyncJob:{}-{}", DateUtils.now(),jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.nu.modules.tplink.project.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK项目信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-22
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
|
||||||
|
ProjectInfo getByProjectId(Map<String, String> map);
|
||||||
|
List<ProjectInfo> findList(ProjectInfo projectInfo);
|
||||||
|
IPage<ProjectInfo> findPage(Page<ProjectInfo> page, @Param("params") ProjectInfo projectInfo);
|
||||||
|
int add(Map<String, String> map);
|
||||||
|
int updateById(Map<String, String> map);
|
||||||
|
int updateLeafByPId(Map<String, String> map);
|
||||||
|
List<ProjectInfo> queryTreeList();
|
||||||
|
}
|
|
@ -0,0 +1,175 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.nu.modules.tplink.project.mapper.ProjectInfoMapper">
|
||||||
|
|
||||||
|
<select id="getByProjectId" parameterType="java.util.Map" resultType="com.nu.modules.tplink.project.entity.ProjectInfo">
|
||||||
|
select id,
|
||||||
|
project_id as projectId,
|
||||||
|
project_name as projectName,
|
||||||
|
create_time as createTime,
|
||||||
|
device_num as deviceNum,
|
||||||
|
message_num as messageNum,
|
||||||
|
sort as sort,
|
||||||
|
offline_num as offlineNum,
|
||||||
|
abnormal_num as abnormalNum,
|
||||||
|
unread_message_num as unreadMessageNum,
|
||||||
|
total_nms_dev_num as totalNmsDevNum,
|
||||||
|
total_vms_dev_num as totalVmsDevNum,
|
||||||
|
total_nbs_dev_num as totalNbsDevNum,
|
||||||
|
offline_nms_dev_num as offlineNmsDevNum,
|
||||||
|
offline_vms_dev_num as offlineVmsDevNum,
|
||||||
|
offline_nbs_dev_num as offlineNbsDevNum,
|
||||||
|
running_time as runningTime
|
||||||
|
from nu_iot_tplink_project
|
||||||
|
where project_id = #{projectId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findList" parameterType="com.nu.modules.tplink.project.entity.ProjectInfo" resultType="com.nu.modules.tplink.project.entity.ProjectInfo">
|
||||||
|
select id,
|
||||||
|
project_id as projectId,
|
||||||
|
project_name as projectName,
|
||||||
|
create_time as createTime,
|
||||||
|
device_num as deviceNum,
|
||||||
|
message_num as messageNum,
|
||||||
|
sort as sort,
|
||||||
|
offline_num as offlineNum,
|
||||||
|
abnormal_num as abnormalNum,
|
||||||
|
unread_message_num as unreadMessageNum,
|
||||||
|
total_nms_dev_num as totalNmsDevNum,
|
||||||
|
total_vms_dev_num as totalVmsDevNum,
|
||||||
|
total_nbs_dev_num as totalNbsDevNum,
|
||||||
|
offline_nms_dev_num as offlineNmsDevNum,
|
||||||
|
offline_vms_dev_num as offlineVmsDevNum,
|
||||||
|
offline_nbs_dev_num as offlineNbsDevNum,
|
||||||
|
running_time as runningTime,
|
||||||
|
status
|
||||||
|
from nu_iot_tplink_project
|
||||||
|
<where>
|
||||||
|
<if test="status!=null">
|
||||||
|
and status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findPage" parameterType="com.nu.modules.tplink.project.entity.ProjectInfo" resultType="com.nu.modules.tplink.project.entity.ProjectInfo">
|
||||||
|
select id,
|
||||||
|
project_id as projectId,
|
||||||
|
project_name as projectName,
|
||||||
|
create_time as createTime,
|
||||||
|
DATE_FORMAT(FROM_UNIXTIME(create_time),'%Y-%m-%d %H:%i:%s') as createTimeStr,
|
||||||
|
device_num as deviceNum,
|
||||||
|
message_num as messageNum,
|
||||||
|
sort as sort,
|
||||||
|
offline_num as offlineNum,
|
||||||
|
abnormal_num as abnormalNum,
|
||||||
|
running_time as runningTime,
|
||||||
|
running_time DIV 86400 AS runningTimeStr,
|
||||||
|
status
|
||||||
|
from nu_iot_tplink_project
|
||||||
|
<where>
|
||||||
|
<if test="params.status!=null">
|
||||||
|
and status = #{params.status}
|
||||||
|
</if>
|
||||||
|
<if test="params.projectName != null and params.projectName != ''">
|
||||||
|
AND project_name LIKE concat('%',#{params.projectName},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="add">
|
||||||
|
insert into nu_iot_tplink_project(
|
||||||
|
project_id,
|
||||||
|
project_name,
|
||||||
|
create_time,
|
||||||
|
device_num,
|
||||||
|
message_num,
|
||||||
|
sort,
|
||||||
|
offline_num,
|
||||||
|
abnormal_num,
|
||||||
|
unread_message_num,
|
||||||
|
total_nms_dev_num,
|
||||||
|
total_vms_dev_num,
|
||||||
|
total_nbs_dev_num,
|
||||||
|
offline_nms_dev_num,
|
||||||
|
offline_vms_dev_num,
|
||||||
|
offline_nbs_dev_num,
|
||||||
|
running_time,
|
||||||
|
status,
|
||||||
|
iz_leaf
|
||||||
|
)
|
||||||
|
values(
|
||||||
|
#{projectId},
|
||||||
|
#{projectName},
|
||||||
|
#{createTime},
|
||||||
|
#{deviceNum},
|
||||||
|
#{messageNum},
|
||||||
|
#{sort},
|
||||||
|
#{offlineNum},
|
||||||
|
#{abnormalNum},
|
||||||
|
#{unreadMessageNum},
|
||||||
|
#{totalNmsDevNum},
|
||||||
|
#{totalVmsDevNum},
|
||||||
|
#{totalNbsDevNum},
|
||||||
|
#{offlineNmsDevNum},
|
||||||
|
#{offlineVmsDevNum},
|
||||||
|
#{offlineNbsDevNum},
|
||||||
|
#{runningTime},
|
||||||
|
#{status},
|
||||||
|
1
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateById">
|
||||||
|
update nu_iot_tplink_project
|
||||||
|
set
|
||||||
|
project_id = #{projectId},
|
||||||
|
project_name = #{projectName},
|
||||||
|
create_time = #{createTime},
|
||||||
|
device_num = #{deviceNum},
|
||||||
|
message_num = #{messageNum},
|
||||||
|
sort = #{sort},
|
||||||
|
offline_num = #{offlineNum},
|
||||||
|
abnormal_num = #{abnormalNum},
|
||||||
|
unread_message_num = #{unreadMessageNum},
|
||||||
|
total_nms_dev_num = #{totalNmsDevNum},
|
||||||
|
total_vms_dev_num = #{totalVmsDevNum},
|
||||||
|
total_nbs_dev_num = #{totalNbsDevNum},
|
||||||
|
offline_nms_dev_num = #{offlineNmsDevNum},
|
||||||
|
offline_vms_dev_num = #{offlineVmsDevNum},
|
||||||
|
offline_nbs_dev_num = #{offlineNbsDevNum},
|
||||||
|
running_time = #{runningTime}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateLeafByPId">
|
||||||
|
update nu_iot_tplink_project
|
||||||
|
set iz_leaf = #{izLeaf}
|
||||||
|
where project_id = #{projectId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="queryTreeList" parameterType="com.nu.modules.tplink.project.entity.ProjectInfo" resultType="com.nu.modules.tplink.project.entity.ProjectInfo">
|
||||||
|
select id,
|
||||||
|
project_id as projectId,
|
||||||
|
project_name as projectName,
|
||||||
|
create_time as createTime,
|
||||||
|
device_num as deviceNum,
|
||||||
|
message_num as messageNum,
|
||||||
|
sort as sort,
|
||||||
|
offline_num as offlineNum,
|
||||||
|
abnormal_num as abnormalNum,
|
||||||
|
unread_message_num as unreadMessageNum,
|
||||||
|
total_nms_dev_num as totalNmsDevNum,
|
||||||
|
total_vms_dev_num as totalVmsDevNum,
|
||||||
|
total_nbs_dev_num as totalNbsDevNum,
|
||||||
|
offline_nms_dev_num as offlineNmsDevNum,
|
||||||
|
offline_vms_dev_num as offlineVmsDevNum,
|
||||||
|
offline_nbs_dev_num as offlineNbsDevNum,
|
||||||
|
running_time as runningTime,
|
||||||
|
status,
|
||||||
|
iz_leaf as izLeaf
|
||||||
|
from nu_iot_tplink_project
|
||||||
|
where status = 1
|
||||||
|
order by sort
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,193 @@
|
||||||
|
package com.nu.modules.tplink.project.model;
|
||||||
|
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.nu.modules.tplink.region.model.RegionTreeModel;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 项目表 存储项目结构数据的实体类
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @Author 曹磊
|
||||||
|
* @Since 2025-02-27
|
||||||
|
*/
|
||||||
|
public class ProjectTreeModel implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 对应ProjectInfo中的projectId字段,前端数据树中的key*/
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
/** 对应ProjectInfo中的projectId字段,前端数据树中的value*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/** 对应ProjectInfo中的projectName字段,前端数据树中的title*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private boolean isLeaf;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
// 以下所有字段均与ProjectInfo相同
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
private String order;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private List<RegionTreeModel> children = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将ProjectInfo对象转换成ProjectTreeModel对象
|
||||||
|
* @param projectInfo
|
||||||
|
*/
|
||||||
|
public ProjectTreeModel(ProjectInfo projectInfo) {
|
||||||
|
this.key = projectInfo.getProjectId();
|
||||||
|
this.value = projectInfo.getProjectId();
|
||||||
|
this.title = projectInfo.getProjectName();
|
||||||
|
this.type = "project";
|
||||||
|
this.id = "0";
|
||||||
|
this.projectId = projectInfo.getProjectId();
|
||||||
|
this.projectName = projectInfo.getProjectName();
|
||||||
|
this.order = projectInfo.getOrder();
|
||||||
|
this.sort = projectInfo.getSort();
|
||||||
|
if(0 == projectInfo.getIzLeaf()){
|
||||||
|
this.isLeaf = false;
|
||||||
|
}else{
|
||||||
|
this.isLeaf = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsLeaf() {
|
||||||
|
return isLeaf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsLeaf(boolean isleaf) {
|
||||||
|
this.isLeaf = isleaf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RegionTreeModel> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<RegionTreeModel> children) {
|
||||||
|
if (children==null){
|
||||||
|
this.isLeaf=true;
|
||||||
|
}
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProjectId() {
|
||||||
|
return projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectId(String projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getSerialVersionUID() {
|
||||||
|
return serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProjectName() {
|
||||||
|
return projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectName(String projectName) {
|
||||||
|
this.projectName = projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(String order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写equals方法
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ProjectTreeModel model = (ProjectTreeModel) o;
|
||||||
|
return Objects.equals(id, model.id) &&
|
||||||
|
Objects.equals(projectId, model.projectId) &&
|
||||||
|
Objects.equals(projectName, model.projectName) &&
|
||||||
|
Objects.equals(order, model.order) &&
|
||||||
|
Objects.equals(sort, model.sort) &&
|
||||||
|
Objects.equals(children, model.children);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写hashCode方法
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, projectId, projectName, order, sort, children);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.nu.modules.tplink.project.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.nu.modules.tplink.project.model.ProjectTreeModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK项目信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-22
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IProjectInfoService extends IService<ProjectInfo> {
|
||||||
|
Result sync();
|
||||||
|
void sync(String jsonResponse);
|
||||||
|
List<ProjectInfo> findList(ProjectInfo projectInfo);
|
||||||
|
IPage<ProjectInfo> findPage(Page<ProjectInfo> page, ProjectInfo projectInfo);
|
||||||
|
List<ProjectTreeModel> queryTreeList();
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
package com.nu.modules.tplink.project.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.nu.modules.tplink.project.mapper.ProjectInfoMapper;
|
||||||
|
import com.nu.modules.tplink.project.model.ProjectTreeModel;
|
||||||
|
import com.nu.modules.tplink.project.service.IProjectInfoService;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK项目信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-22
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo> implements IProjectInfoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步项目信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result sync(){
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("{");
|
||||||
|
sb.append("\"start\"").append(":0,");
|
||||||
|
sb.append("\"limit\"").append(":1000");
|
||||||
|
sb.append("}");
|
||||||
|
String jsonResponse = tumsApi.getAllProjectInfo(sb.toString());
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
sync(jsonResponse);
|
||||||
|
return Result.OK("同步项目成功!");
|
||||||
|
}else{
|
||||||
|
return Result.error(jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口返回数据同步入库
|
||||||
|
* @param jsonResponse
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sync(String jsonResponse){
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
if(jsonObject.getInt("error_code").equals(0)){
|
||||||
|
JSONObject result = (JSONObject)jsonObject.get("result");
|
||||||
|
if(result.getInt("total")>0){
|
||||||
|
JSONArray list = result.getJSONArray("list");
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
JSONObject voObject = (JSONObject)list.get(i);
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
for (String key : voObject.keySet()) {
|
||||||
|
map.put(key, voObject.getStr(key));
|
||||||
|
}
|
||||||
|
map.put("sort", map.get("order"));
|
||||||
|
ProjectInfo entity = baseMapper.getByProjectId(map);
|
||||||
|
if(entity==null){
|
||||||
|
//新增
|
||||||
|
map.put("status","1");
|
||||||
|
baseMapper.add(map);
|
||||||
|
}else{
|
||||||
|
//修改
|
||||||
|
map.put("id",String.valueOf(entity.getId()));
|
||||||
|
baseMapper.updateById(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TPLINK项目信息列表查询
|
||||||
|
*
|
||||||
|
* @param projectInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ProjectInfo> findList(ProjectInfo projectInfo){
|
||||||
|
return baseMapper.findList(projectInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TPLINK项目信息分页列表查询
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param projectInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<ProjectInfo> findPage(Page<ProjectInfo> page,ProjectInfo projectInfo){
|
||||||
|
return baseMapper.findPage(page,projectInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目treeList
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ProjectTreeModel> queryTreeList(){
|
||||||
|
List<ProjectTreeModel> records = new ArrayList<>();
|
||||||
|
List<ProjectInfo> list = baseMapper.queryTreeList();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
ProjectInfo project = list.get(i);
|
||||||
|
ProjectTreeModel treeModel = new ProjectTreeModel(project);
|
||||||
|
records.add(treeModel);
|
||||||
|
}
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
/**
|
||||||
|
* Version:v1.0.0 ,
|
||||||
|
* Description:TP-LINK厂家区域信息相关操作
|
||||||
|
* CreateDate:2025-02-20 09:00:00
|
||||||
|
* Author:曹磊
|
||||||
|
*/
|
||||||
|
package com.nu.modules.tplink.region.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import com.nu.modules.tplink.region.entity.RegionInfo;
|
||||||
|
import com.nu.modules.tplink.region.model.RegionTreeModel;
|
||||||
|
import com.nu.modules.tplink.region.service.IRegionInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK区域信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-20
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags="护理单元-物联管理-TPLINK区域信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/iot/regionInfo")
|
||||||
|
@Slf4j
|
||||||
|
public class RegionInfoController extends JeecgController<RegionInfo, IRegionInfoService> {
|
||||||
|
@Autowired
|
||||||
|
private IRegionInfoService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param regionInfo
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "护理单元-物联管理-TPLINK项目信息-分页列表查询")
|
||||||
|
@ApiOperation(value="护理单元-物联管理-TPLINK项目信息-分页列表查询", notes="护理单元-物联管理-TPLINK项目信息-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<RegionInfo>> queryPageList(RegionInfo regionInfo,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
Page<RegionInfo> page = new Page<RegionInfo>(pageNo, pageSize);
|
||||||
|
IPage<RegionInfo> pageList = service.findPage(page, regionInfo);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步区域信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/sync")
|
||||||
|
public Result getUploadToServerProcess(RegionInfo regionInfo)throws Exception{
|
||||||
|
return service.sync(regionInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步查询区域list
|
||||||
|
* @param parentId 父节点 异步加载时传递
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryRegionTreeSync", method = RequestMethod.GET)
|
||||||
|
public Result<List<RegionTreeModel>> queryDepartTreeSync(@RequestParam(name = "parentId", required = false) String parentId, @RequestParam(name = "projectId", required = false) String projectId) {
|
||||||
|
Result<List<RegionTreeModel>> result = new Result<>();
|
||||||
|
try {
|
||||||
|
List<RegionTreeModel> list = service.queryTreeListByPid(parentId,projectId);
|
||||||
|
result.setResult(list);
|
||||||
|
result.setSuccess(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
result.setSuccess(false);
|
||||||
|
result.setMessage("查询失败");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package com.nu.modules.tplink.region.entity;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK区域信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-20
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("nu_iot_tplink_region")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="nu_iot_tplink_region对象", description="护理单元-物联管理-TPLINK区域信息")
|
||||||
|
public class RegionInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**ID*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private Integer id;
|
||||||
|
/**区域ID*/
|
||||||
|
@Excel(name = "区域ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "区域ID")
|
||||||
|
private String regionId;
|
||||||
|
/**区域名称*/
|
||||||
|
@Excel(name = "区域名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "区域名称")
|
||||||
|
private String regionName;
|
||||||
|
/**区域层级*/
|
||||||
|
@Excel(name = "区域层级", width = 15)
|
||||||
|
@ApiModelProperty(value = "区域层级")
|
||||||
|
private String regionLevel;
|
||||||
|
/**区域次序,接口对应字段,在数据库中是关键字,数据库中用sort代替order*/
|
||||||
|
@ApiModelProperty(value = "项目次序")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String order;
|
||||||
|
/**项目次序*/
|
||||||
|
@Excel(name = "项目次序", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目次序")
|
||||||
|
private Integer sort;
|
||||||
|
/**父区域ID*/
|
||||||
|
@Excel(name = "父区域ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "父区域ID")
|
||||||
|
private String parentId;
|
||||||
|
/**父区域ID*/
|
||||||
|
@Excel(name = "父区域", width = 15)
|
||||||
|
@ApiModelProperty(value = "父区域")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String parentName;
|
||||||
|
/**项目ID*/
|
||||||
|
@Excel(name = "项目ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目ID")
|
||||||
|
private String projectId;
|
||||||
|
/**项目名称*/
|
||||||
|
@Excel(name = "项目名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String projectName;
|
||||||
|
/**系统类型*/
|
||||||
|
@Excel(name = "系统类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "系统类型")
|
||||||
|
private String sysType;
|
||||||
|
/**流道*/
|
||||||
|
@Excel(name = "流道", width = 15)
|
||||||
|
@ApiModelProperty(value = "流道")
|
||||||
|
private String streamWay;
|
||||||
|
/**是否有子区域*/
|
||||||
|
@Excel(name = "是否有子区域", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否有子区域 0无 1有")
|
||||||
|
private String hasChildren;
|
||||||
|
/**区域类型*/
|
||||||
|
@Excel(name = "区域类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "区域类型")
|
||||||
|
private String regionType;
|
||||||
|
/**更新时间*/
|
||||||
|
@Excel(name = "更新时间", width = 15)
|
||||||
|
@ApiModelProperty(value = "更新时间,年月日时分秒")
|
||||||
|
private String updateTime;
|
||||||
|
/**流媒体服务器ID*/
|
||||||
|
@Excel(name = "流媒体服务器ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "流媒体服务器ID")
|
||||||
|
private String mediaServerId;
|
||||||
|
/**备用流媒体服务器ID*/
|
||||||
|
@Excel(name = "备用流媒体服务器ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "备用流媒体服务器ID")
|
||||||
|
private String backupMediaServerId;
|
||||||
|
/**绑定类型*/
|
||||||
|
@Excel(name = "绑定类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "绑定类型 0:设备直接取流/流媒体转发模式,1: 自动模式")
|
||||||
|
private String bindType;
|
||||||
|
/**是否有叶子节点: 1是0否*/
|
||||||
|
@Excel(name = "是否有叶子节点: 1是0否", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否有叶子节点: 1是0否")
|
||||||
|
private Integer izLeaf;
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.nu.modules.tplink.region.job;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.util.DateUtils;
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.nu.modules.tplink.project.service.IProjectInfoService;
|
||||||
|
import com.nu.modules.tplink.region.service.IRegionInfoService;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域信息同步
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class RegionSyncJob implements Job {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IRegionInfoService service;
|
||||||
|
@Autowired
|
||||||
|
IProjectInfoService pService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
ProjectInfo pi = new ProjectInfo();
|
||||||
|
pi.setStatus(1);//正常状态
|
||||||
|
List<ProjectInfo> projectList = pService.findList(pi);
|
||||||
|
if(projectList!=null&&projectList.size()>0){
|
||||||
|
for(int i=0;i< projectList.size();i++){
|
||||||
|
ProjectInfo projectInfo = projectList.get(i);
|
||||||
|
String jsonRequest = "{\n" +
|
||||||
|
" \"projectId\": \""+projectInfo.getProjectId()+"\",\n"+
|
||||||
|
" \"sysType\": 3\n"+
|
||||||
|
"}";
|
||||||
|
// System.out.println(jsonRequest);
|
||||||
|
String jsonResponse = tumsApi.getRootRegions(jsonRequest);
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
service.sync(jsonResponse);
|
||||||
|
}else{
|
||||||
|
log.error("RegionSyncJob:{}-{}", DateUtils.now(),jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.nu.modules.tplink.region.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.nu.modules.tplink.region.entity.RegionInfo;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK区域信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-20
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface RegionInfoMapper extends BaseMapper<RegionInfo> {
|
||||||
|
RegionInfo getByRegionId(Map<String, String> map);
|
||||||
|
List<RegionInfo> findList(RegionInfo regionInfo);
|
||||||
|
IPage<RegionInfo> findPage(Page<RegionInfo> page, @Param("params") RegionInfo regionInfo);
|
||||||
|
int add(Map<String, String> map);
|
||||||
|
int updateById(Map<String, String> map);
|
||||||
|
List<RegionInfo> queryTreeListByPid(String parentId,String projectId);
|
||||||
|
}
|
|
@ -0,0 +1,156 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.nu.modules.tplink.region.mapper.RegionInfoMapper">
|
||||||
|
|
||||||
|
<select id="getByRegionId" parameterType="java.util.Map" resultType="com.nu.modules.tplink.region.entity.RegionInfo">
|
||||||
|
select id,
|
||||||
|
region_id as regionId,
|
||||||
|
region_name as regionName,
|
||||||
|
region_level as regionLevel,
|
||||||
|
sort,
|
||||||
|
parent_id as parentId,
|
||||||
|
project_id as projectId,
|
||||||
|
sys_type as sysType,
|
||||||
|
stream_way as streamWay,
|
||||||
|
has_children as hasChildren,
|
||||||
|
region_type as regionType,
|
||||||
|
update_time as updateTime,
|
||||||
|
media_server_id as mediaServerId,
|
||||||
|
backup_media_server_id as backupMediaServerId,
|
||||||
|
bind_type as bindType
|
||||||
|
from nu_iot_tplink_region
|
||||||
|
where region_id = #{regionId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findList" parameterType="com.nu.modules.tplink.region.entity.RegionInfo" resultType="com.nu.modules.tplink.region.entity.RegionInfo">
|
||||||
|
select a.id,
|
||||||
|
a.region_id as regionId,
|
||||||
|
a.region_name as regionName,
|
||||||
|
a.region_level as regionLevel,
|
||||||
|
a.sort,
|
||||||
|
a.parent_id as parentId,
|
||||||
|
b.project_name as projectName,
|
||||||
|
a.project_id as projectId,
|
||||||
|
a.sys_type as sysType,
|
||||||
|
a.stream_way as streamWay,
|
||||||
|
a.has_children as hasChildren,
|
||||||
|
a.region_type as regionType,
|
||||||
|
a.update_time as updateTime,
|
||||||
|
a.media_server_id as mediaServerId,
|
||||||
|
a.backup_media_server_id as backupMediaServerId,
|
||||||
|
a.bind_type as bindType
|
||||||
|
from nu_iot_tplink_region a
|
||||||
|
left join nu_iot_tplink_project b on a.project_id = b.project_id
|
||||||
|
<where>
|
||||||
|
<if test="projectId != null and projectId != ''">
|
||||||
|
and a.project_id = #{projectId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findPage" parameterType="com.nu.modules.tplink.region.entity.RegionInfo" resultType="com.nu.modules.tplink.region.entity.RegionInfo">
|
||||||
|
select a.id,
|
||||||
|
a.region_id as regionId,
|
||||||
|
a.region_name as regionName,
|
||||||
|
a.region_level as regionLevel,
|
||||||
|
a.sort,
|
||||||
|
a.parent_id as parentId,
|
||||||
|
b.project_name as projectName,
|
||||||
|
a.project_id as projectId,
|
||||||
|
a.sys_type as sysType,
|
||||||
|
a.stream_way as streamWay,
|
||||||
|
a.has_children as hasChildren,
|
||||||
|
a.region_type as regionType,
|
||||||
|
DATE_FORMAT(FROM_UNIXTIME(a.update_time/1000),'%Y-%m-%d %H:%i:%s') as updateTime,
|
||||||
|
a.media_server_id as mediaServerId,
|
||||||
|
a.backup_media_server_id as backupMediaServerId,
|
||||||
|
a.bind_type as bindType
|
||||||
|
from nu_iot_tplink_region a
|
||||||
|
left join nu_iot_tplink_project b on a.project_id = b.project_id
|
||||||
|
<where>
|
||||||
|
<if test="params.projectId != null and params.projectId != ''">
|
||||||
|
and a.project_id = #{params.projectId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="add">
|
||||||
|
insert into nu_iot_tplink_region(
|
||||||
|
region_id,
|
||||||
|
region_name,
|
||||||
|
region_level,
|
||||||
|
sort,
|
||||||
|
parent_id,
|
||||||
|
project_id,
|
||||||
|
sys_type,
|
||||||
|
stream_way,
|
||||||
|
has_children,
|
||||||
|
region_type,
|
||||||
|
update_time,
|
||||||
|
media_server_id,
|
||||||
|
backup_media_server_id,
|
||||||
|
bind_type
|
||||||
|
)
|
||||||
|
values(
|
||||||
|
#{regionId},
|
||||||
|
#{regionName},
|
||||||
|
#{regionLevel},
|
||||||
|
#{sort},
|
||||||
|
#{parentId},
|
||||||
|
#{projectId},
|
||||||
|
#{sysType},
|
||||||
|
#{streamWay},
|
||||||
|
#{hasChildren},
|
||||||
|
#{regionType},
|
||||||
|
#{updateTime},
|
||||||
|
#{mediaServerId},
|
||||||
|
#{backupMediaServerId},
|
||||||
|
#{bindType}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateById">
|
||||||
|
update nu_iot_tplink_region
|
||||||
|
set
|
||||||
|
region_id = #{regionId},
|
||||||
|
region_name = #{regionName},
|
||||||
|
region_level = #{regionLevel},
|
||||||
|
sort = #{sort},
|
||||||
|
parent_id = #{parentId},
|
||||||
|
project_id = #{projectId},
|
||||||
|
sys_type = #{sysType},
|
||||||
|
stream_way = #{streamWay},
|
||||||
|
has_children = #{hasChildren},
|
||||||
|
region_type = #{regionType},
|
||||||
|
update_time = #{updateTime},
|
||||||
|
media_server_id = #{mediaServerId},
|
||||||
|
backup_media_server_id = #{backupMediaServerId},
|
||||||
|
bind_type = #{bindType}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="queryTreeListByPid" parameterType="com.nu.modules.tplink.region.entity.RegionInfo" resultType="com.nu.modules.tplink.region.entity.RegionInfo">
|
||||||
|
select a.id,
|
||||||
|
a.region_id as regionId,
|
||||||
|
a.region_name as regionName,
|
||||||
|
a.region_level as regionLevel,
|
||||||
|
a.sort,
|
||||||
|
a.parent_id as parentId,
|
||||||
|
b.project_name as projectName,
|
||||||
|
a.project_id as projectId,
|
||||||
|
a.sys_type as sysType,
|
||||||
|
a.stream_way as streamWay,
|
||||||
|
a.has_children as hasChildren,
|
||||||
|
a.region_type as regionType,
|
||||||
|
a.update_time as updateTime,
|
||||||
|
a.media_server_id as mediaServerId,
|
||||||
|
a.backup_media_server_id as backupMediaServerId,
|
||||||
|
a.bind_type as bindType,
|
||||||
|
a.iz_leaf as izLeaf
|
||||||
|
from nu_iot_tplink_region a
|
||||||
|
left join nu_iot_tplink_project b on a.project_id = b.project_id
|
||||||
|
where a.parent_id = #{parentId}
|
||||||
|
and a.project_id = #{projectId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,352 @@
|
||||||
|
package com.nu.modules.tplink.region.model;
|
||||||
|
|
||||||
|
import com.nu.modules.tplink.region.entity.RegionInfo;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 区域表 存储区域结构数据的实体类
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @Author 曹磊
|
||||||
|
* @Since 2025-02-27
|
||||||
|
*/
|
||||||
|
public class RegionTreeModel implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 对应SysDepart中的id字段,前端数据树中的key*/
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
/** 对应SysDepart中的id字段,前端数据树中的value*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/** 对应depart_name字段,前端数据树中的title*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private boolean isLeaf;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
// 以下所有字段均与RegionInfo相同
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String regionId;
|
||||||
|
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
private String regionLevel;
|
||||||
|
|
||||||
|
private String order;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
private String sysType;
|
||||||
|
|
||||||
|
private String streamWay;
|
||||||
|
|
||||||
|
private String hasChildren;
|
||||||
|
|
||||||
|
private String regionType;
|
||||||
|
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
private String mediaServerId;
|
||||||
|
|
||||||
|
private String backupMediaServerId;
|
||||||
|
|
||||||
|
private String bindType;
|
||||||
|
|
||||||
|
private List<RegionTreeModel> children = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将RegionInfo对象转换成RegionTreeModel对象
|
||||||
|
* @param regionInfo
|
||||||
|
*/
|
||||||
|
public RegionTreeModel(RegionInfo regionInfo) {
|
||||||
|
this.key = regionInfo.getRegionId();
|
||||||
|
this.value = regionInfo.getRegionId();
|
||||||
|
this.title = regionInfo.getRegionName();
|
||||||
|
this.type = "region";
|
||||||
|
this.id = regionInfo.getRegionId();
|
||||||
|
this.regionId = regionInfo.getRegionId();
|
||||||
|
this.regionName = regionInfo.getRegionName();
|
||||||
|
this.regionLevel = regionInfo.getRegionLevel();
|
||||||
|
this.order = regionInfo.getOrder();
|
||||||
|
this.sort = regionInfo.getSort();
|
||||||
|
this.parentId = regionInfo.getParentId();
|
||||||
|
this.parentName = regionInfo.getParentName();
|
||||||
|
this.projectId = regionInfo.getProjectId();
|
||||||
|
this.projectName = regionInfo.getProjectName();
|
||||||
|
this.sysType = regionInfo.getSysType();
|
||||||
|
this.streamWay = regionInfo.getStreamWay();
|
||||||
|
this.hasChildren = regionInfo.getHasChildren();
|
||||||
|
this.regionType = regionInfo.getRegionType();
|
||||||
|
this.updateTime = regionInfo.getUpdateTime();
|
||||||
|
this.mediaServerId = regionInfo.getMediaServerId();
|
||||||
|
this.backupMediaServerId = regionInfo.getBackupMediaServerId();
|
||||||
|
this.bindType = regionInfo.getBindType();
|
||||||
|
if(0 == regionInfo.getIzLeaf()){
|
||||||
|
this.isLeaf = false;
|
||||||
|
}else{
|
||||||
|
this.isLeaf = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsLeaf() {
|
||||||
|
return isLeaf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsLeaf(boolean isleaf) {
|
||||||
|
this.isLeaf = isleaf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RegionTreeModel> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<RegionTreeModel> children) {
|
||||||
|
if (children==null){
|
||||||
|
this.isLeaf=true;
|
||||||
|
}
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegionId() {
|
||||||
|
return regionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionId(String regionId) {
|
||||||
|
this.regionId = regionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getSerialVersionUID() {
|
||||||
|
return serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegionName() {
|
||||||
|
return regionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionName(String regionName) {
|
||||||
|
this.regionName = regionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegionLevel() {
|
||||||
|
return regionLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionLevel(String regionLevel) {
|
||||||
|
this.regionLevel = regionLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(String order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(String parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentName() {
|
||||||
|
return parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentName(String parentName) {
|
||||||
|
this.parentName = parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProjectId() {
|
||||||
|
return projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectId(String projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProjectName() {
|
||||||
|
return projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectName(String projectName) {
|
||||||
|
this.projectName = projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSysType() {
|
||||||
|
return sysType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSysType(String sysType) {
|
||||||
|
this.sysType = sysType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStreamWay() {
|
||||||
|
return streamWay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreamWay(String streamWay) {
|
||||||
|
this.streamWay = streamWay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHasChildren() {
|
||||||
|
return hasChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasChildren(String hasChildren) {
|
||||||
|
this.hasChildren = hasChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegionType() {
|
||||||
|
return regionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionType(String regionType) {
|
||||||
|
this.regionType = regionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(String updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMediaServerId() {
|
||||||
|
return mediaServerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaServerId(String mediaServerId) {
|
||||||
|
this.mediaServerId = mediaServerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackupMediaServerId() {
|
||||||
|
return backupMediaServerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackupMediaServerId(String backupMediaServerId) {
|
||||||
|
this.backupMediaServerId = backupMediaServerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBindType() {
|
||||||
|
return bindType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBindType(String bindType) {
|
||||||
|
this.bindType = bindType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写equals方法
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
RegionTreeModel model = (RegionTreeModel) o;
|
||||||
|
return Objects.equals(id, model.id) &&
|
||||||
|
Objects.equals(regionId, model.regionId) &&
|
||||||
|
Objects.equals(regionName, model.regionName) &&
|
||||||
|
Objects.equals(regionLevel, model.regionLevel) &&
|
||||||
|
Objects.equals(order, model.order) &&
|
||||||
|
Objects.equals(sort, model.sort) &&
|
||||||
|
Objects.equals(parentId, model.parentId) &&
|
||||||
|
Objects.equals(parentName, model.parentName) &&
|
||||||
|
Objects.equals(projectId, model.projectId) &&
|
||||||
|
Objects.equals(projectName, model.projectName) &&
|
||||||
|
Objects.equals(sysType, model.sysType) &&
|
||||||
|
Objects.equals(streamWay, model.streamWay) &&
|
||||||
|
Objects.equals(hasChildren, model.hasChildren) &&
|
||||||
|
Objects.equals(regionType, model.regionType) &&
|
||||||
|
Objects.equals(updateTime, model.updateTime) &&
|
||||||
|
Objects.equals(mediaServerId, model.mediaServerId) &&
|
||||||
|
Objects.equals(backupMediaServerId, model.backupMediaServerId) &&
|
||||||
|
Objects.equals(bindType, model.bindType) &&
|
||||||
|
Objects.equals(children, model.children);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写hashCode方法
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
|
||||||
|
return Objects.hash(id, regionId, regionName, regionLevel, order,
|
||||||
|
sort, parentId, parentName, projectId, projectName, sysType, streamWay, hasChildren,
|
||||||
|
regionType, updateTime, mediaServerId, backupMediaServerId, bindType,
|
||||||
|
children);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.nu.modules.tplink.region.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.nu.modules.tplink.region.entity.RegionInfo;
|
||||||
|
import com.nu.modules.tplink.region.model.RegionTreeModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK区域信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-01-22
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IRegionInfoService extends IService<RegionInfo> {
|
||||||
|
Result sync(RegionInfo regionInfo);
|
||||||
|
void sync(String jsonResponse);
|
||||||
|
List<RegionInfo> findList(RegionInfo regionInfo);
|
||||||
|
IPage<RegionInfo> findPage(Page<RegionInfo> page, RegionInfo regionInfo);
|
||||||
|
List<RegionTreeModel> queryTreeListByPid(String parentId,String projectId);
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
package com.nu.modules.tplink.region.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import com.nu.modules.tplink.project.entity.ProjectInfo;
|
||||||
|
import com.nu.modules.tplink.project.mapper.ProjectInfoMapper;
|
||||||
|
import com.nu.modules.tplink.project.model.ProjectTreeModel;
|
||||||
|
import com.nu.modules.tplink.region.entity.RegionInfo;
|
||||||
|
import com.nu.modules.tplink.region.mapper.RegionInfoMapper;
|
||||||
|
import com.nu.modules.tplink.region.model.RegionTreeModel;
|
||||||
|
import com.nu.modules.tplink.region.service.IRegionInfoService;
|
||||||
|
import com.nu.modules.tplink.utils.TumsApi;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元-物联管理-TPLINK区域信息
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-20
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class RegionInfoServiceImpl extends ServiceImpl<RegionInfoMapper, RegionInfo> implements IRegionInfoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
@Autowired
|
||||||
|
private ProjectInfoMapper projectInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步区域信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result sync(RegionInfo regionInfo){
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("{");
|
||||||
|
sb.append("\"projectId\"").append(":").append("\"").append(regionInfo.getProjectId()).append("\",");
|
||||||
|
sb.append("\"sysType\"").append(":3");
|
||||||
|
sb.append("}");
|
||||||
|
String jsonResponse = tumsApi.getRootRegions(sb.toString());
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
String errorCode = jsonObject.getStr("error_code");
|
||||||
|
if(errorCode.equals("0")){
|
||||||
|
sync(jsonResponse);
|
||||||
|
return Result.OK("同步区域成功!");
|
||||||
|
}else{
|
||||||
|
return Result.error(jsonObject.getStr("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口返回数据同步入库
|
||||||
|
* @param jsonResponse
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sync(String jsonResponse){
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||||
|
if(jsonObject.getInt("error_code").equals(0)){
|
||||||
|
JSONArray list = jsonObject.getJSONArray("result");
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
JSONObject voObject = (JSONObject)list.get(i);
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
for (String key : voObject.keySet()) {
|
||||||
|
map.put(key, voObject.getStr(key));
|
||||||
|
}
|
||||||
|
map.put("sort", map.get("order"));
|
||||||
|
String hasChildren = map.get("hasChildren");
|
||||||
|
if(hasChildren.equals("0")){
|
||||||
|
map.put("izLeaf", "1");
|
||||||
|
}else{
|
||||||
|
map.put("izLeaf", "0");
|
||||||
|
}
|
||||||
|
RegionInfo entity = baseMapper.getByRegionId(map);
|
||||||
|
if(entity==null){
|
||||||
|
//新增
|
||||||
|
baseMapper.add(map);
|
||||||
|
}else{
|
||||||
|
//修改
|
||||||
|
map.put("id",String.valueOf(entity.getId()));
|
||||||
|
baseMapper.updateById(map);
|
||||||
|
}
|
||||||
|
String projectId = map.get("projectId");
|
||||||
|
if(projectId!=null&&!("").equals(projectId)){
|
||||||
|
Map<String, String> projectMap = new HashMap<>();
|
||||||
|
projectMap.put("projectId", map.get("projectId"));
|
||||||
|
projectMap.put("izLeaf", "0");
|
||||||
|
projectInfoMapper.updateLeafByPId(projectMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TPLINK项目信息列表查询
|
||||||
|
*
|
||||||
|
* @param regionInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RegionInfo> findList(RegionInfo regionInfo){
|
||||||
|
return baseMapper.findList(regionInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TPLINK项目信息分页列表查询
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param regionInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<RegionInfo> findPage(Page<RegionInfo> page,RegionInfo regionInfo){
|
||||||
|
return baseMapper.findPage(page,regionInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询区域treeList
|
||||||
|
*
|
||||||
|
* @param parentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RegionTreeModel> queryTreeListByPid(String parentId,String projectId){
|
||||||
|
List<RegionTreeModel> records = new ArrayList<>();
|
||||||
|
List<RegionInfo> list = baseMapper.queryTreeListByPid(parentId,projectId);
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
RegionInfo region = list.get(i);
|
||||||
|
RegionTreeModel treeModel = new RegionTreeModel(region);
|
||||||
|
records.add(treeModel);
|
||||||
|
}
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.nu.modules.tplink.utils;
|
||||||
|
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/iot/test")
|
||||||
|
public class TestUtil {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TumsApi tumsApi;
|
||||||
|
|
||||||
|
@GetMapping(value = "/login")
|
||||||
|
public Result login() {
|
||||||
|
tumsApi.login();
|
||||||
|
tumsApi.logout();
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,368 @@
|
||||||
|
package com.nu.modules.tplink.utils;
|
||||||
|
|
||||||
|
import com.tplink.ignite.libs.developersdk.api.TumsClient;
|
||||||
|
import com.tplink.ignite.libs.developersdk.vo.ResultVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.nu.modules.tplink.enums.ApiEnum;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class TumsApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
TumsConfig tumsConfig;
|
||||||
|
|
||||||
|
TumsClient tumsClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建tumsClient
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TumsClient createTumsClient(){
|
||||||
|
if(this.tumsClient==null){
|
||||||
|
login();
|
||||||
|
}
|
||||||
|
return this.tumsClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销毁tumsClient
|
||||||
|
*/
|
||||||
|
public void destroyTumsClient(){
|
||||||
|
if(this.tumsClient!=null){
|
||||||
|
logout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void login(){
|
||||||
|
|
||||||
|
TumsClient tc = new TumsClient(tumsConfig.getUsername(), tumsConfig.getPassword(), tumsConfig.getUrl());
|
||||||
|
ResultVO loginResult = tc.login();
|
||||||
|
// 判断是否登录成功
|
||||||
|
if (loginResult.getErrorCode() != 0) {
|
||||||
|
log.error("login fail, fail message:[{}]", loginResult.getMsg());
|
||||||
|
tumsClient = null;
|
||||||
|
} else {
|
||||||
|
log.info("login success");
|
||||||
|
String cookie = tc.getCookie();
|
||||||
|
String rsaKey = tc.getRsaKey();
|
||||||
|
log.info("cookie",cookie);
|
||||||
|
log.info("rsaKey",rsaKey);
|
||||||
|
tumsClient = tc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注销
|
||||||
|
*/
|
||||||
|
public void logout(){
|
||||||
|
ResultVO logoutResult = tumsClient.logout();
|
||||||
|
if (logoutResult.getErrorCode() != 0) {
|
||||||
|
log.error("logout fail, errorCode:{}", logoutResult.getErrorCode());
|
||||||
|
} else {
|
||||||
|
log.info("logout success");
|
||||||
|
tumsClient = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置当前项目
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String setCurrentProject(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.SET_CURRENT_PROJECT.getValue());
|
||||||
|
// log.info("setCurrentProject:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有项目信息
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getAllProjectInfo(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.GET_ALL_PROJECT_INFO.getValue());
|
||||||
|
// log.info("getAllProjectInfo:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取区域列表
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRootRegions(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.GET_ROOT_REGIONS.getValue());
|
||||||
|
log.info("getAllProjectInfo:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备列表
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getDeviceList(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.GET_DEVICE_LIST.getValue());
|
||||||
|
// log.info("getDeviceList:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备信息
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String modifyDeviceDetails(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.MODIFY_DEVICE_DETAILS.getValue());
|
||||||
|
// log.info("modifyDeviceDetails:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重启设备
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String rebootDeviceList(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.REBOOT_DEVICE_LIST.getValue());
|
||||||
|
// log.info("rebootDeviceList:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取告警列表
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getAlarmLog(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.QUERY_ALARM_LOG.getValue());
|
||||||
|
// log.info("getAlarmLog:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取ipc能力集
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getIpcCapability(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_IPC_CAPABILITY.getValue());
|
||||||
|
// log.info("getIpcCapability:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置信息
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String passthrough(String jsonRequest){
|
||||||
|
log.info("passthrough:request:{}",jsonRequest);
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_PASSTHROUGH.getValue());
|
||||||
|
log.info("passthrough:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加预览通道
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String addPreviewChn(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_ADD_PREVIEW_CHN.getValue());
|
||||||
|
// log.info("addPreviewChn:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预览通道的url
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getPreviewUrl(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_PREVIEW_URL.getValue());
|
||||||
|
// log.info("getPreviewUrl:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索存在回放录像的日期
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String searchYear(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_SEARCH_YEAR.getValue());
|
||||||
|
// log.info("searchYear:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索当天的录像数据
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String searchVideo(String jsonRequest){
|
||||||
|
log.info("searchVideo:request:{}",jsonRequest);
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_SEARCH_VIDEO.getValue());
|
||||||
|
log.info("searchVideo:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定监控点的存储设备列表
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getStoragesById(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_STORAGES_BY_ID.getValue());
|
||||||
|
log.info("getStoragesById:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加回放通道V2
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String addPlaybackChn(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
log.info("addPlaybackChn:request:{}",jsonRequest);
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_ADD_PLAYBACK_CHN.getValue());
|
||||||
|
log.info("addPlaybackChn:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取回放通道的url
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getPlaybackUrl(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_PLAYBACK_URL.getValue());
|
||||||
|
log.info("getPlaybackUrl:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除回放通道
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String deletePlaybackChn(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_DELETE_PLAYBACK_CHN.getValue());
|
||||||
|
log.info("deletePlaybackChn:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取nvmp设备双向通信URL
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getMultitransUrl(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_MULTITRANS_URL.getValue());
|
||||||
|
log.info("getMultitransUrl:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取录像配置
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRecordCfgs(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_RECORD_CFGS.getValue());
|
||||||
|
log.info("getRecordCfgs:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置录像计划
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String setRecordCfgs(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_SET_RECORD_CFGS.getValue());
|
||||||
|
log.info("setRecordCfgs:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取批量操作录像计划进度
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getBatchProgress(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_BATCH_PROGRESS.getValue());
|
||||||
|
log.info("getBatchProgress:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回放视频转mp4上传
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String uploadToServer(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
log.info("uploadToServer:request:{}",jsonRequest);
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_UPLOAD_TO_SERVER.getValue());
|
||||||
|
log.info("uploadToServer:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止转存MP4上传任务
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String stopUploadToServer(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
log.info("stopUploadToServer:request:{}",jsonRequest);
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_STOP_UPLOAD_TO_SERVER.getValue());
|
||||||
|
log.info("stopUploadToServer:response:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取转存MP4上传任务进度
|
||||||
|
* @param jsonRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getUploadToServerProcess(String jsonRequest){
|
||||||
|
this.createTumsClient();
|
||||||
|
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_UPLOAD_TO_SERVER_PROCESS.getValue());
|
||||||
|
log.info("getUploadToServerProcess:{}",jsonResponse);
|
||||||
|
return jsonResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.nu.modules.tplink.utils;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Data
|
||||||
|
public class TumsConfig {
|
||||||
|
|
||||||
|
@Value("${tplink.tums.url}")
|
||||||
|
private String url; //获取图门系统地址
|
||||||
|
@Value("${tplink.tums.username}")
|
||||||
|
private String username; // 获取图门系统用户
|
||||||
|
@Value("${tplink.tums.password}")
|
||||||
|
private String password; //获取图门系统密码
|
||||||
|
|
||||||
|
@Value("${tplink.ftp.ip}")
|
||||||
|
private String ftpIp; //回放视频转FTP上传IP
|
||||||
|
@Value("${tplink.ftp.port}")
|
||||||
|
private String ftpPort; //回放视频转FTP上传端口
|
||||||
|
@Value("${tplink.ftp.username}")
|
||||||
|
private String ftpUsername; //回放视频转FTP上传用户
|
||||||
|
@Value("${tplink.ftp.password}")
|
||||||
|
private String ftpPassword; //回放视频转FTP上传密码
|
||||||
|
@Value("${tplink.ftp.uploadpath}")
|
||||||
|
private String ftpUploadpath; //回放视频转FTP上传路径
|
||||||
|
|
||||||
|
}
|
|
@ -337,3 +337,15 @@ justauth:
|
||||||
type: default
|
type: default
|
||||||
prefix: 'demo::'
|
prefix: 'demo::'
|
||||||
timeout: 1h
|
timeout: 1h
|
||||||
|
#tplink登录信息
|
||||||
|
tplink:
|
||||||
|
tums:
|
||||||
|
url: https://121.36.88.64:8888
|
||||||
|
username: admin
|
||||||
|
password: Bl20230518
|
||||||
|
ftp:
|
||||||
|
ip: 1.92.152.160
|
||||||
|
port: 21
|
||||||
|
username: administrator
|
||||||
|
password: Root@123..
|
||||||
|
uploadpath: /
|
Loading…
Reference in New Issue