iot相关代码调整
This commit is contained in:
parent
24bad7bbd6
commit
679ad04c8d
|
|
@ -0,0 +1,147 @@
|
|||
package com.nu.modules.institution.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
import com.nu.modules.institution.model.InstitutionAreaTreeModel;
|
||||
import com.nu.modules.institution.service.IInstitutionAreaService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构表 前端控制器
|
||||
* <p>
|
||||
*
|
||||
* @Author: 曹磊 @Since: 2025-03-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/institutionArea")
|
||||
@Slf4j
|
||||
public class InstitutionAreaController {
|
||||
|
||||
@Autowired
|
||||
private IInstitutionAreaService service;
|
||||
|
||||
/**
|
||||
* 异步查询机构list
|
||||
* @param parentId 父节点 异步加载时传递
|
||||
* @param primaryKey 主键字段(id或者orgCode)
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryTreeSync", method = RequestMethod.GET)
|
||||
public Result<List<InstitutionAreaTreeModel>> queryTreeSync(@RequestParam(name = "pid", required = false) String parentId, @RequestParam(name = "primaryKey", required = false) String primaryKey) {
|
||||
Result<List<InstitutionAreaTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<InstitutionAreaTreeModel> list = service.queryTreeListByPid(parentId,primaryKey);
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.setSuccess(false);
|
||||
result.setMessage("查询失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加新数据 添加用户新建的机构对象数据,并保存到数据库
|
||||
*
|
||||
* @param InstitutionArea
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<InstitutionArea> add(@RequestBody InstitutionArea InstitutionArea, HttpServletRequest request) {
|
||||
Result<InstitutionArea> result = new Result<InstitutionArea>();
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
try {
|
||||
InstitutionArea.setCreateBy(username);
|
||||
service.saveInstData(InstitutionArea, username);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据 编辑机构的部分数据,并保存到数据库
|
||||
*
|
||||
* @param InstitutionArea
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<InstitutionArea> edit(@RequestBody InstitutionArea InstitutionArea, HttpServletRequest request) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
InstitutionArea.setUpdateBy(username);
|
||||
Result<InstitutionArea> result = new Result<InstitutionArea>();
|
||||
InstitutionArea InstitutionAreaEntity = service.getById(InstitutionArea.getId());
|
||||
if (InstitutionAreaEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = service.updateInstDataById(InstitutionArea, username);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param institutionArea
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestBody InstitutionArea institutionArea){
|
||||
InstitutionArea entity = service.getById(institutionArea.getId());
|
||||
if(entity==null) {
|
||||
return Result.error("未找到对应实体");
|
||||
}else {
|
||||
return service.deleteInst(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构搜索功能方法,根据关键字模糊搜索相关机构
|
||||
* </p>
|
||||
*
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/searchBy", method = RequestMethod.GET)
|
||||
public Result<List<InstitutionAreaTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord) {
|
||||
Result<List<InstitutionAreaTreeModel>> result = new Result<List<InstitutionAreaTreeModel>>();
|
||||
List<InstitutionAreaTreeModel> treeList = this.service.searchByKeyWord(keyWord);
|
||||
if (treeList == null || treeList.size() == 0) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("未查询匹配数据!");
|
||||
return result;
|
||||
}
|
||||
result.setResult(treeList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有子区域信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("queryChildrenByParentId")
|
||||
public Result<List<InstitutionArea>> queryChildrenByParentId(@RequestParam(name = "pid", required = false) String parentId) {
|
||||
Result<List<InstitutionArea>> result = new Result<>();
|
||||
LambdaQueryWrapper<InstitutionArea> query = new LambdaQueryWrapper<InstitutionArea>();
|
||||
query.orderByAsc(InstitutionArea::getInstName);
|
||||
query.eq(InstitutionArea::getParentId,parentId);
|
||||
List<InstitutionArea> ls = this.service.list(query);
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.nu.modules.institution.entity;
|
||||
|
||||
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构区域表
|
||||
* <p>
|
||||
*
|
||||
* @Author 曹磊
|
||||
* @Since 2025-03-25
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_admin_institution_area")
|
||||
public class InstitutionArea implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**父机构ID*/
|
||||
private String parentId;
|
||||
/**机构/部门名称*/
|
||||
@Excel(name="机构/区域名称",width=15)
|
||||
private String instName;
|
||||
/**英文名*/
|
||||
@Excel(name="英文名",width=15)
|
||||
private String instNameEn;
|
||||
/**缩写*/
|
||||
private String instNameAbbr;
|
||||
/**排序*/
|
||||
@Excel(name="排序",width=15)
|
||||
private Integer instOrder;
|
||||
/**描述*/
|
||||
@Excel(name="描述",width=15)
|
||||
private String description;
|
||||
/**机构类别 1=机构,2=区域*/
|
||||
@Excel(name="机构区域类别",width=15,dicCode="inst_category")
|
||||
private String orgCategory;
|
||||
/**机构类型 1一级部门 2子部门*/
|
||||
private String orgType;
|
||||
/**机构编码*/
|
||||
@Excel(name="机构编码",width=15)
|
||||
private String orgCode;
|
||||
/**手机号*/
|
||||
@Excel(name="手机号",width=15)
|
||||
private String mobile;
|
||||
/**地址*/
|
||||
@Excel(name="地址",width=15)
|
||||
private String address;
|
||||
/**状态(1启用,0不启用)*/
|
||||
@Dict(dicCode = "depart_status")
|
||||
private String status;
|
||||
/**删除状态(0,正常,1已删除)*/
|
||||
@Dict(dicCode = "del_flag")
|
||||
private String delFlag;
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**租户ID*/
|
||||
private Integer tenantId;
|
||||
/**是否有叶子节点: 1是0否*/
|
||||
private Integer izLeaf;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.nu.modules.institution.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构 Mapper 接口
|
||||
* <p>
|
||||
*
|
||||
* @Author: 曹磊
|
||||
* @Since: 2025-03-25
|
||||
*/
|
||||
public interface InstitutionAreaMapper extends BaseMapper<InstitutionArea> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据parent_id查询下级区域
|
||||
* @param parentId 父id
|
||||
* @return List<InstitutionArea>
|
||||
*/
|
||||
List<InstitutionArea> queryTreeListByPid(@Param("parentId") String parentId);
|
||||
|
||||
/**
|
||||
* 根据id下级区域数量
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT count(*) FROM nu_admin_institution_area where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
|
||||
Integer queryCountByPid(@Param("parentId")String parentId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
@Select("SELECT * FROM nu_admin_institution_area where id = #{id,jdbcType=VARCHAR}")
|
||||
InstitutionArea getInstById(@Param("id") String id);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
List<InstitutionArea> getMaxCodeInst(@Param("page") Page<InstitutionArea> page, @Param("parentId") String parentId);
|
||||
|
||||
/**
|
||||
* 修改部门状态字段: 是否子节点
|
||||
* @param id 部门id
|
||||
* @param leaf 叶子节点
|
||||
* @return int
|
||||
*/
|
||||
@Update("UPDATE nu_admin_institution_area SET iz_leaf=#{leaf} WHERE id = #{id}")
|
||||
int setMainLeaf(@Param("id") String id, @Param("leaf") Integer leaf);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?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.institution.mapper.InstitutionAreaMapper">
|
||||
|
||||
<!--根据parent_id查询下级区域-->
|
||||
<select id="queryTreeListByPid" parameterType="Object" resultType="com.nu.modules.institution.entity.InstitutionArea">
|
||||
SELECT * FROM nu_admin_institution_area where del_flag = '0'
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
AND parent_id = #{parentId,jdbcType=VARCHAR}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND parent_id is null or parent_id=''
|
||||
</otherwise>
|
||||
</choose>
|
||||
order by inst_order
|
||||
</select>
|
||||
|
||||
<!--获取机构orgCode最大值的机构信息-->
|
||||
<select id="getMaxCodeInst" resultType="com.nu.modules.institution.entity.InstitutionArea">
|
||||
SELECT * FROM nu_admin_institution_area
|
||||
WHERE
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
parent_id = #{parentId}
|
||||
</when>
|
||||
<otherwise>
|
||||
parent_id IS NULL OR parent_id=''
|
||||
</otherwise>
|
||||
</choose>
|
||||
ORDER BY org_code DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.nu.modules.institution.model;
|
||||
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构表 封装树结构的机构的名称的实体类
|
||||
* <p>
|
||||
*
|
||||
* @Author Steve
|
||||
* @Since 2019-01-22
|
||||
*
|
||||
*/
|
||||
public class InstitutionAreaIdModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 机构名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
List<InstitutionAreaIdModel> children = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 将SysDepartTreeModel的部分数据放在该对象当中
|
||||
* @param treeModel
|
||||
* @return
|
||||
*/
|
||||
public InstitutionAreaIdModel convert(InstitutionAreaTreeModel treeModel) {
|
||||
this.key = treeModel.getId();
|
||||
this.value = treeModel.getId();
|
||||
this.title = treeModel.getInstName();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 该方法为用户机构的实现类所使用
|
||||
* @param inst
|
||||
* @return
|
||||
*/
|
||||
public InstitutionAreaIdModel convertByUserDepart(InstitutionArea inst) {
|
||||
this.key = inst.getId();
|
||||
this.value = inst.getId();
|
||||
this.title = inst.getInstName();
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<InstitutionAreaIdModel> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<InstitutionAreaIdModel> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,357 @@
|
|||
package com.nu.modules.institution.model;
|
||||
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构表 存储树结构数据的实体类
|
||||
* <p>
|
||||
*
|
||||
* @Author 曹磊
|
||||
* @Since 2025-03-25
|
||||
*/
|
||||
public class InstitutionAreaTreeModel implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 对应InstitutionArea中的id字段,前端数据树中的key*/
|
||||
private String key;
|
||||
|
||||
/** 对应InstitutionArea中的id字段,前端数据树中的value*/
|
||||
private String value;
|
||||
|
||||
/** 对应inst_name字段,前端数据树中的title*/
|
||||
private String title;
|
||||
|
||||
|
||||
private boolean isLeaf;
|
||||
// 以下所有字段均与InstitutionArea相同
|
||||
|
||||
private String id;
|
||||
|
||||
private String parentId;
|
||||
|
||||
private String instName;
|
||||
|
||||
private String instNameEn;
|
||||
|
||||
private String instNameAbbr;
|
||||
|
||||
private Integer instOrder;
|
||||
|
||||
private String description;
|
||||
|
||||
private String orgCategory;
|
||||
|
||||
private String orgType;
|
||||
|
||||
private String orgCode;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String address;
|
||||
|
||||
private String status;
|
||||
|
||||
private String delFlag;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
//update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段部门负责人ids
|
||||
/**部门负责人ids*/
|
||||
private String directorUserIds;
|
||||
//update-end---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段部门负责人ids
|
||||
|
||||
private List<InstitutionAreaTreeModel> children = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
* 将InstitutionArea对象转换成InstitutionAreaTreeModel对象
|
||||
* @param inst
|
||||
*/
|
||||
public InstitutionAreaTreeModel(InstitutionArea inst) {
|
||||
this.key = inst.getId();
|
||||
this.value = inst.getId();
|
||||
this.title = inst.getInstName();
|
||||
this.id = inst.getId();
|
||||
this.parentId = inst.getParentId();
|
||||
this.instName = inst.getInstName();
|
||||
this.instNameEn = inst.getInstNameEn();
|
||||
this.instNameAbbr = inst.getInstNameAbbr();
|
||||
this.instOrder = inst.getInstOrder();
|
||||
this.description = inst.getDescription();
|
||||
this.orgCategory = inst.getOrgCategory();
|
||||
this.orgType = inst.getOrgType();
|
||||
this.orgCode = inst.getOrgCode();
|
||||
this.mobile = inst.getMobile();
|
||||
this.address = inst.getAddress();
|
||||
this.status = inst.getStatus();
|
||||
this.delFlag = inst.getDelFlag();
|
||||
this.createBy = inst.getCreateBy();
|
||||
this.createTime = inst.getCreateTime();
|
||||
this.updateBy = inst.getUpdateBy();
|
||||
this.updateTime = inst.getUpdateTime();
|
||||
if(0 == inst.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 getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<InstitutionAreaTreeModel> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<InstitutionAreaTreeModel> children) {
|
||||
if (children==null){
|
||||
this.isLeaf=true;
|
||||
}
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getInstName() {
|
||||
return instName;
|
||||
}
|
||||
|
||||
public void setInstName(String instName) {
|
||||
this.instName = instName;
|
||||
}
|
||||
|
||||
public String getOrgCategory() {
|
||||
return orgCategory;
|
||||
}
|
||||
|
||||
public void setOrgCategory(String orgCategory) {
|
||||
this.orgCategory = orgCategory;
|
||||
}
|
||||
|
||||
public String getOrgType() {
|
||||
return orgType;
|
||||
}
|
||||
|
||||
public void setOrgType(String orgType) {
|
||||
this.orgType = orgType;
|
||||
}
|
||||
|
||||
public String getOrgCode() {
|
||||
return orgCode;
|
||||
}
|
||||
|
||||
public void setOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getInstNameEn() {
|
||||
return instNameEn;
|
||||
}
|
||||
|
||||
public void setInstNameEn(String instNameEn) {
|
||||
this.instNameEn = instNameEn;
|
||||
}
|
||||
|
||||
public String getInstNameAbbr() {
|
||||
return instNameAbbr;
|
||||
}
|
||||
|
||||
public void setInstNameAbbr(String instNameAbbr) {
|
||||
this.instNameAbbr = instNameAbbr;
|
||||
}
|
||||
|
||||
public Integer getInstOrder() {
|
||||
return instOrder;
|
||||
}
|
||||
|
||||
public void setInstOrder(Integer instOrder) {
|
||||
this.instOrder = instOrder;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public InstitutionAreaTreeModel() { }
|
||||
|
||||
/**
|
||||
* 重写equals方法
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
InstitutionAreaTreeModel model = (InstitutionAreaTreeModel) o;
|
||||
return Objects.equals(id, model.id) &&
|
||||
Objects.equals(parentId, model.parentId) &&
|
||||
Objects.equals(instName, model.instName) &&
|
||||
Objects.equals(instNameEn, model.instNameEn) &&
|
||||
Objects.equals(instNameAbbr, model.instNameAbbr) &&
|
||||
Objects.equals(instOrder, model.instOrder) &&
|
||||
Objects.equals(description, model.description) &&
|
||||
Objects.equals(orgCategory, model.orgCategory) &&
|
||||
Objects.equals(orgType, model.orgType) &&
|
||||
Objects.equals(orgCode, model.orgCode) &&
|
||||
Objects.equals(mobile, model.mobile) &&
|
||||
Objects.equals(address, model.address) &&
|
||||
Objects.equals(status, model.status) &&
|
||||
Objects.equals(delFlag, model.delFlag) &&
|
||||
Objects.equals(createBy, model.createBy) &&
|
||||
Objects.equals(createTime, model.createTime) &&
|
||||
Objects.equals(updateBy, model.updateBy) &&
|
||||
Objects.equals(updateTime, model.updateTime) &&
|
||||
Objects.equals(children, model.children);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写hashCode方法
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
return Objects.hash(id, parentId, instName, instNameEn, instNameAbbr,
|
||||
instOrder, description, orgCategory, orgType, orgCode, mobile, address,
|
||||
status, delFlag, createBy, createTime, updateBy, updateTime,
|
||||
children);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.nu.modules.institution.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
import com.nu.modules.institution.model.InstitutionAreaTreeModel;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构表 服务实现类
|
||||
* <p>
|
||||
*
|
||||
* @Author 曹磊
|
||||
* @Since 2025-03-25
|
||||
*/
|
||||
public interface IInstitutionAreaService extends IService<InstitutionArea>{
|
||||
|
||||
/**
|
||||
* 保存部门数据
|
||||
* @param InstitutionArea
|
||||
* @param username 用户名
|
||||
*/
|
||||
void saveInstData(InstitutionArea InstitutionArea,String username);
|
||||
|
||||
/**
|
||||
* 更新Inst数据
|
||||
* @param InstitutionArea
|
||||
* @param username 用户名
|
||||
* @return
|
||||
*/
|
||||
Boolean updateInstDataById(InstitutionArea InstitutionArea,String username);
|
||||
|
||||
/**
|
||||
* 根据关键字搜索相关的部门数据
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
List<InstitutionAreaTreeModel> searchByKeyWord(String keyWord);
|
||||
|
||||
/**
|
||||
* 根据部门id删除并删除其可能存在的子级部门
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean delete(String id);
|
||||
|
||||
/**
|
||||
* 获取我的部门下级所有部门
|
||||
* @param parentId 父id
|
||||
* @param primaryKey 主键字段(id或者orgCode)
|
||||
* @return
|
||||
*/
|
||||
List<InstitutionAreaTreeModel> queryTreeListByPid(String parentId,String primaryKey);
|
||||
|
||||
/**
|
||||
* 根据id查询机构信息
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
IPage<InstitutionArea> getMaxCodeInst(Page<InstitutionArea> page, String parentId);
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
* @param id
|
||||
*/
|
||||
Result<String> deleteInst(InstitutionArea institutionArea);
|
||||
|
||||
/**
|
||||
* 根据id查询部门信息
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
InstitutionArea getInstById(String parentId);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
package com.nu.modules.institution.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
import com.nu.modules.institution.mapper.InstitutionAreaMapper;
|
||||
import com.nu.modules.institution.model.InstitutionAreaTreeModel;
|
||||
import com.nu.modules.institution.service.IInstitutionAreaService;
|
||||
import com.nu.modules.institution.utils.OrgCodeRule;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机构表 服务实现类
|
||||
* <p>
|
||||
*
|
||||
* @Author 曹磊
|
||||
* @Since 2025-03-25
|
||||
*/
|
||||
@Service
|
||||
public class InstitutionAreaServiceImpl extends ServiceImpl<InstitutionAreaMapper, InstitutionArea> implements IInstitutionAreaService {
|
||||
|
||||
/**
|
||||
* 根据parentId查询机构树
|
||||
* @param parentId
|
||||
* @param primaryKey 主键字段(id或者orgCode)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<InstitutionAreaTreeModel> queryTreeListByPid(String parentId,String primaryKey) {
|
||||
Consumer<LambdaQueryWrapper<InstitutionArea>> square = i -> {
|
||||
if(oConvertUtils.isEmpty(parentId)){
|
||||
i.and(q->q.isNull(true,InstitutionArea::getParentId).or().eq(true,InstitutionArea::getParentId,""));
|
||||
}else{
|
||||
i.eq(true,InstitutionArea::getParentId,parentId);
|
||||
}
|
||||
};
|
||||
LambdaQueryWrapper<InstitutionArea> lqw=new LambdaQueryWrapper<>();
|
||||
lqw.eq(true,InstitutionArea::getDelFlag,CommonConstant.DEL_FLAG_0.toString());
|
||||
lqw.func(square);
|
||||
lqw.orderByAsc(InstitutionArea::getInstOrder);
|
||||
List<InstitutionArea> list = list(lqw);
|
||||
List<InstitutionAreaTreeModel> records = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
InstitutionArea inst = list.get(i);
|
||||
InstitutionAreaTreeModel treeModel = new InstitutionAreaTreeModel(inst);
|
||||
records.add(treeModel);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询机构信息
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<InstitutionArea> getMaxCodeInst(Page<InstitutionArea> page, String parentId) {
|
||||
return page.setRecords(baseMapper.getMaxCodeInst(page,parentId));
|
||||
}
|
||||
/**
|
||||
* saveInstData 对应 add 保存用户在页面添加的新的机构对象数据
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveInstData(InstitutionArea institutionArea, String username) {
|
||||
if (institutionArea != null && username != null) {
|
||||
//给机构表加个是否有子节点------------
|
||||
if (oConvertUtils.isEmpty(institutionArea.getParentId())) {
|
||||
institutionArea.setParentId("");
|
||||
}else{
|
||||
//将父机构的设成不是叶子结点
|
||||
baseMapper.setMainLeaf(institutionArea.getParentId(),CommonConstant.NOT_LEAF);
|
||||
}
|
||||
//给机构表加个是否有子节点------------
|
||||
institutionArea.setId(IdWorker.getIdStr(institutionArea));
|
||||
// 先判断该对象有无父级ID,有则意味着不是最高级,否则意味着是最高级
|
||||
// 获取父级ID
|
||||
String parentId = institutionArea.getParentId();
|
||||
//begin--机构编码规则生成器做成公用配置
|
||||
JSONObject formData = new JSONObject();
|
||||
formData.put("parentId",parentId);
|
||||
String[] codeArray = OrgCodeRule.getOrgCode(formData);
|
||||
//end--机构编码规则生成器做成公用配置
|
||||
institutionArea.setOrgCode(codeArray[0]);
|
||||
String orgType = codeArray[1];
|
||||
institutionArea.setOrgType(String.valueOf(orgType));
|
||||
institutionArea.setCreateTime(new Date());
|
||||
institutionArea.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
//新添加的机构是叶子节点
|
||||
institutionArea.setIzLeaf(CommonConstant.IS_LEAF);
|
||||
if (oConvertUtils.isEmpty(institutionArea.getOrgCategory())) {
|
||||
if (oConvertUtils.isEmpty(institutionArea.getParentId())) {
|
||||
institutionArea.setOrgCategory("1");
|
||||
} else {
|
||||
institutionArea.setOrgCategory("2");
|
||||
}
|
||||
}
|
||||
this.save(institutionArea);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updateInstDataById 对应 edit 根据机构主键来更新对应的机构数据
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateInstDataById(InstitutionArea institutionArea, String username) {
|
||||
if (institutionArea != null && username != null) {
|
||||
institutionArea.setUpdateTime(new Date());
|
||||
institutionArea.setUpdateBy(username);
|
||||
this.updateById(institutionArea);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 根据关键字搜索相关的机构数据
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public List<InstitutionAreaTreeModel> searchByKeyWord(String keyWord) {
|
||||
LambdaQueryWrapper<InstitutionArea> query = new LambdaQueryWrapper<InstitutionArea>();
|
||||
List<InstitutionAreaTreeModel> newList = new ArrayList<>();
|
||||
query.like(InstitutionArea::getInstName, keyWord);
|
||||
InstitutionAreaTreeModel model = new InstitutionAreaTreeModel();
|
||||
List<InstitutionArea> instList = this.list(query);
|
||||
if(instList.size() > 0) {
|
||||
for(InstitutionArea inst : instList) {
|
||||
model = new InstitutionAreaTreeModel(inst);
|
||||
model.setChildren(null);
|
||||
newList.add(model);
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InstitutionArea getInstById(String id) {
|
||||
return baseMapper.getInstById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> deleteInst(InstitutionArea institutionArea) {
|
||||
//判断是否有字节点
|
||||
int childrenCount = baseMapper.queryCountByPid(institutionArea.getId());
|
||||
if(childrenCount>0){
|
||||
if(institutionArea.getOrgCategory().equals("1")){
|
||||
return Result.error("此机构存在子区域,请将子区域全部删除后再来删除此机构!");
|
||||
}else{
|
||||
return Result.error("此区域存在子区域,请将子区域全部删除后再来删除此区域!");
|
||||
}
|
||||
}
|
||||
//删除机构设置父级的叶子结点
|
||||
this.setIzLeaf(institutionArea.getId());
|
||||
this.delete(institutionArea.getId());
|
||||
return Result.OK("机构删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置父级节点是否存在叶子结点
|
||||
* @param id
|
||||
*/
|
||||
private void setIzLeaf(String id) {
|
||||
InstitutionArea inst = this.getInstById(id);
|
||||
String parentId = inst.getParentId();
|
||||
if(oConvertUtils.isNotEmpty(parentId)){
|
||||
Long count = this.count(new QueryWrapper<InstitutionArea>().lambda().eq(InstitutionArea::getParentId, parentId));
|
||||
if(count == 1){
|
||||
//若父节点无其他子节点,则该父节点是叶子节点
|
||||
baseMapper.setMainLeaf(parentId, CommonConstant.IS_LEAF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机构id删除并且删除其可能存在的子级任何机构
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean delete(String id) {
|
||||
boolean ok = this.removeById(id);
|
||||
return ok;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
package com.nu.modules.institution.utils;
|
||||
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
* 流水号生成规则(按默认规则递增,数字从1-999开始递增,数字到999,递增字母;位数不够增加位数)
|
||||
* A001
|
||||
* A001A002
|
||||
* @Author 曹磊
|
||||
*
|
||||
*/
|
||||
public class FindOrgCodeUtil {
|
||||
|
||||
// 数字位数(默认生成3位的数字)
|
||||
|
||||
/**代表数字位数*/
|
||||
private static final int NUM_LENGTH = 3;
|
||||
|
||||
public static final int ZHANWEI_LENGTH = 1+ NUM_LENGTH;
|
||||
|
||||
public static final char LETTER= 'Z';
|
||||
|
||||
/**
|
||||
* 根据前一个code,获取同级下一个code
|
||||
* 例如:当前最大code为A001A004,下一个code为:A001A005
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String getNextOrgCode(String code) {
|
||||
String newcode = "";
|
||||
if (oConvertUtils.isEmpty(code)) {
|
||||
String zimu = "A";
|
||||
String num = getStrNum(1);
|
||||
newcode = zimu + num;
|
||||
} else {
|
||||
String beforeCode = code.substring(0, code.length() - 1- NUM_LENGTH);
|
||||
String afterCode = code.substring(code.length() - 1 - NUM_LENGTH,code.length());
|
||||
char afterCodeZimu = afterCode.substring(0, 1).charAt(0);
|
||||
Integer afterCodeNum = Integer.parseInt(afterCode.substring(1));
|
||||
|
||||
String nextNum = "";
|
||||
char nextZimu = 'A';
|
||||
// 先判断数字等于999*,则计数从1重新开始,递增
|
||||
if (afterCodeNum == getMaxNumByLength(NUM_LENGTH)) {
|
||||
nextNum = getNextStrNum(0);
|
||||
} else {
|
||||
nextNum = getNextStrNum(afterCodeNum);
|
||||
}
|
||||
// 先判断数字等于999*,则字母从A重新开始,递增
|
||||
if(afterCodeNum == getMaxNumByLength(NUM_LENGTH)) {
|
||||
nextZimu = getNextZiMu(afterCodeZimu);
|
||||
}else{
|
||||
nextZimu = afterCodeZimu;
|
||||
}
|
||||
|
||||
// 例如Z99,下一个code就是Z99A01
|
||||
if (LETTER == afterCodeZimu && getMaxNumByLength(NUM_LENGTH) == afterCodeNum) {
|
||||
newcode = code + (nextZimu + nextNum);
|
||||
} else {
|
||||
newcode = beforeCode + (nextZimu + nextNum);
|
||||
}
|
||||
}
|
||||
return newcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父亲code,获取下级的下一个code
|
||||
*
|
||||
* 例如:父亲CODE:A001
|
||||
* 当前CODE:A001B003
|
||||
* 获取的code:A001B004
|
||||
*
|
||||
* @param parentCode 上级code
|
||||
* @param localCode 同级code
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String getSubOrgCode(String parentCode,String localCode) {
|
||||
if(localCode!=null && localCode!=""){
|
||||
|
||||
return getNextOrgCode(localCode);
|
||||
|
||||
}else{
|
||||
parentCode = parentCode + "A"+ getNextStrNum(0);
|
||||
}
|
||||
return parentCode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将数字前面位数补零
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static String getNextStrNum(int num) {
|
||||
return getStrNum(getNextNum(num));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数字前面位数补零
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static String getStrNum(int num) {
|
||||
String s = String.format("%0" + NUM_LENGTH + "d", num);
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递增获取下个数字
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static int getNextNum(int num) {
|
||||
num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递增获取下个字母
|
||||
*
|
||||
* @param zimu
|
||||
* @return
|
||||
*/
|
||||
private static char getNextZiMu(char zimu) {
|
||||
if (zimu == LETTER) {
|
||||
return 'A';
|
||||
}
|
||||
zimu++;
|
||||
return zimu;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数字位数获取最大值
|
||||
* @param length
|
||||
* @return
|
||||
*/
|
||||
private static int getMaxNumByLength(int length){
|
||||
if(length==0){
|
||||
return 0;
|
||||
}
|
||||
StringBuilder maxNum = new StringBuilder();
|
||||
for (int i=0;i<length;i++){
|
||||
maxNum.append("9");
|
||||
}
|
||||
return Integer.parseInt(maxNum.toString());
|
||||
}
|
||||
|
||||
public static String[] cutOrgCode(String code){
|
||||
if(code==null || StringUtil.isNullOrEmpty(code)){
|
||||
return null;
|
||||
}else{
|
||||
//获取标准长度为numLength+1,截取的数量为code.length/numLength+1
|
||||
int c = code.length()/(NUM_LENGTH +1);
|
||||
String[] cutcode = new String[c];
|
||||
for(int i =0 ; i <c;i++){
|
||||
cutcode[i] = code.substring(0,(i+1)*(NUM_LENGTH +1));
|
||||
}
|
||||
return cutcode;
|
||||
}
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// String s = getNextOrgCode("A001A002");
|
||||
// System.out.println(s);
|
||||
// char c1 = getNextZiMu('C');
|
||||
// int n = getNextNum(8);
|
||||
// String[] ss = cutOrgCode("C099A001B001");
|
||||
// System.out.println(c1);
|
||||
// System.out.println(n);
|
||||
// for(int i=0;i<ss.length;i++){
|
||||
// System.out.println(ss[i]);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.nu.modules.institution.utils;
|
||||
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
import com.nu.modules.institution.model.InstitutionAreaIdModel;
|
||||
import com.nu.modules.institution.model.InstitutionAreaTreeModel;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <P>
|
||||
* 对应机构的表,处理并查找树级数据
|
||||
* <P>
|
||||
*
|
||||
* @Author: 曹磊
|
||||
* @Date: 2025-03-25
|
||||
*/
|
||||
public class FindsInstChildrenUtil {
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法 ====1=====
|
||||
* 该方法是s将InstitutionArea类型的list集合转换成InstitutionAreaTreeModel类型的集合
|
||||
*/
|
||||
public static List<InstitutionAreaTreeModel> wrapTreeDataToTreeList(List<InstitutionArea> recordList) {
|
||||
List<InstitutionAreaIdModel> idList = new ArrayList<InstitutionAreaIdModel>();
|
||||
List<InstitutionAreaTreeModel> records = new ArrayList<>();
|
||||
for (int i = 0; i < recordList.size(); i++) {
|
||||
InstitutionArea inst = recordList.get(i);
|
||||
records.add(new InstitutionAreaTreeModel(inst));
|
||||
}
|
||||
List<InstitutionAreaTreeModel> tree = findChildren(records, idList);
|
||||
setEmptyChildrenAsNull(tree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 InstitutionAreaIdModel
|
||||
* @param recordList
|
||||
* @return
|
||||
*/
|
||||
public static List<InstitutionAreaIdModel> wrapTreeDataToInstIdTreeList(List<InstitutionArea> recordList) {
|
||||
List<InstitutionAreaIdModel> idList = new ArrayList<InstitutionAreaIdModel>();
|
||||
List<InstitutionAreaTreeModel> records = new ArrayList<>();
|
||||
for (int i = 0; i < recordList.size(); i++) {
|
||||
InstitutionArea inst = recordList.get(i);
|
||||
records.add(new InstitutionAreaTreeModel(inst));
|
||||
}
|
||||
findChildren(records, idList);
|
||||
return idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法 ====2=====
|
||||
* 该方法是找到并封装顶级父类的节点到TreeList集合
|
||||
*/
|
||||
private static List<InstitutionAreaTreeModel> findChildren(List<InstitutionAreaTreeModel> recordList, List<InstitutionAreaIdModel> instIdList) {
|
||||
List<InstitutionAreaTreeModel> treeList = new ArrayList<>();
|
||||
for (int i = 0; i < recordList.size(); i++) {
|
||||
InstitutionAreaTreeModel branch = recordList.get(i);
|
||||
if (oConvertUtils.isEmpty(branch.getParentId())) {
|
||||
treeList.add(branch);
|
||||
InstitutionAreaIdModel InstitutionAreaIdModel = new InstitutionAreaIdModel().convert(branch);
|
||||
instIdList.add(InstitutionAreaIdModel);
|
||||
}
|
||||
}
|
||||
getGrandChildren(treeList,recordList,instIdList);
|
||||
return treeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法====3====
|
||||
*该方法是找到顶级父类下的所有子节点集合并封装到TreeList集合
|
||||
*/
|
||||
private static void getGrandChildren(List<InstitutionAreaTreeModel> treeList,List<InstitutionAreaTreeModel> recordList,List<InstitutionAreaIdModel> idList) {
|
||||
for (int i = 0; i < treeList.size(); i++) {
|
||||
InstitutionAreaTreeModel model = treeList.get(i);
|
||||
InstitutionAreaIdModel idModel = idList.get(i);
|
||||
for (int i1 = 0; i1 < recordList.size(); i1++) {
|
||||
InstitutionAreaTreeModel m = recordList.get(i1);
|
||||
if (m.getParentId()!=null && m.getParentId().equals(model.getId())) {
|
||||
model.getChildren().add(m);
|
||||
InstitutionAreaIdModel dim = new InstitutionAreaIdModel().convert(m);
|
||||
idModel.getChildren().add(dim);
|
||||
}
|
||||
}
|
||||
getGrandChildren(treeList.get(i).getChildren(), recordList, idList.get(i).getChildren());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法 ====4====
|
||||
* 该方法是将子节点为空的List集合设置为Null值
|
||||
*/
|
||||
private static void setEmptyChildrenAsNull(List<InstitutionAreaTreeModel> treeList) {
|
||||
|
||||
for (int i = 0; i < treeList.size(); i++) {
|
||||
InstitutionAreaTreeModel model = treeList.get(i);
|
||||
if (model.getChildren().size() == 0) {
|
||||
model.setChildren(null);
|
||||
model.setIsLeaf(true);
|
||||
}else{
|
||||
setEmptyChildrenAsNull(model.getChildren());
|
||||
model.setIsLeaf(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.nu.modules.institution.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nu.modules.institution.entity.InstitutionArea;
|
||||
import com.nu.modules.institution.service.impl.InstitutionAreaServiceImpl;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author scott
|
||||
* @Date 2019/12/9 11:33
|
||||
* @Description: 机构编码生成规则
|
||||
*/
|
||||
public class OrgCodeRule{
|
||||
|
||||
public static String[] getOrgCode(JSONObject params) {
|
||||
InstitutionAreaServiceImpl institutionAreaService = (InstitutionAreaServiceImpl) SpringContextUtils.getBean("institutionAreaServiceImpl");
|
||||
|
||||
String[] strArray = new String[2];
|
||||
//定义机构类型
|
||||
String orgType = "";
|
||||
// 定义新编码字符串
|
||||
String newOrgCode = "";
|
||||
// 定义旧编码字符串
|
||||
String oldOrgCode = "";
|
||||
String parentId = null;
|
||||
Object obj = params.get("parentId");
|
||||
if (obj != null) {
|
||||
parentId = obj.toString();
|
||||
}
|
||||
//如果是最高级,则查询出同级的org_code, 调用工具类生成编码并返回
|
||||
if (StringUtil.isNullOrEmpty(parentId)) {
|
||||
// 线判断数据库中的表是否为空,空则直接返回初始编码
|
||||
//获取最大值code的机构信息
|
||||
Page<InstitutionArea> page = new Page<>(1,1);
|
||||
IPage<InstitutionArea> pageList = institutionAreaService.getMaxCodeInst(page,"");
|
||||
List<InstitutionArea> records = pageList.getRecords();
|
||||
if (null==records || records.size()==0) {
|
||||
strArray[0] = FindOrgCodeUtil.getNextOrgCode(null);
|
||||
strArray[1] = "1";
|
||||
return strArray;
|
||||
} else {
|
||||
InstitutionArea depart = records.get(0);
|
||||
oldOrgCode = depart.getOrgCode();
|
||||
orgType = depart.getOrgType();
|
||||
newOrgCode = FindOrgCodeUtil.getNextOrgCode(oldOrgCode);
|
||||
}
|
||||
} else {//反之则查询出所有同级的机构,获取结果后有两种情况,有同级和没有同级
|
||||
//获取自己机构最大值orgCode机构信息
|
||||
Page<InstitutionArea> page = new Page<>(1,1);
|
||||
IPage<InstitutionArea> pageList = institutionAreaService.getMaxCodeInst(page,parentId);
|
||||
List<InstitutionArea> records = pageList.getRecords();
|
||||
// 查询出父级机构
|
||||
InstitutionArea depart = institutionAreaService.getInstById(parentId);
|
||||
// 获取父级机构的Code
|
||||
String parentCode = depart.getOrgCode();
|
||||
// 根据父级机构类型算出当前机构的类型
|
||||
orgType = String.valueOf(Integer.valueOf(depart.getOrgType()) + 1);
|
||||
// 处理同级机构为null的情况
|
||||
if (null == records || records.size()==0) {
|
||||
// 直接生成当前的机构编码并返回
|
||||
newOrgCode = FindOrgCodeUtil.getSubOrgCode(parentCode, null);
|
||||
} else { //处理有同级机构的情况
|
||||
// 获取同级机构的编码,利用工具类
|
||||
String subCode = records.get(0).getOrgCode();
|
||||
// 返回生成的当前机构编码
|
||||
newOrgCode = FindOrgCodeUtil.getSubOrgCode(parentCode, subCode);
|
||||
}
|
||||
}
|
||||
// 返回最终封装了机构编码和机构类型的数组
|
||||
strArray[0] = newOrgCode;
|
||||
strArray[1] = orgType;
|
||||
return strArray;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,424 +0,0 @@
|
|||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,281 +0,0 @@
|
|||
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 = "nu_name",dicCode = "nu_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;
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
<?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.nu_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.nu_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.nu_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
|
||||
nu_id as nuId,
|
||||
nu_name as nuName
|
||||
from nu_base_info b
|
||||
<where>
|
||||
<if test="params.nuId != null and params.nuId != ''">
|
||||
AND b.nu_id = #{params.nuId}
|
||||
</if>
|
||||
<if test="params.nuName != null and params.nuName != ''">
|
||||
AND b.nu_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,
|
||||
a.nu_id as nuId,
|
||||
b.nu_name as nuName
|
||||
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_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>
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
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
|
|
@ -1,52 +0,0 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
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,33 @@
|
|||
package com.nu.modules.tplink.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元-物联管理-TPLINK图门系统配置信息
|
||||
* @Author: caolei
|
||||
* @Date: 2025-03-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_iot_tplink_tums_base")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_iot_tplink_tums_base", description="护理单元-物联管理-TPLINK图门系统配置信息")
|
||||
public class TumsConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String tumsUrl; //获取图门系统地址
|
||||
private String tumsUsername; // 获取图门系统用户
|
||||
private String tumsPassword; //获取图门系统密码
|
||||
private String ftpIp; //回放视频转FTP上传IP
|
||||
private String ftpPort; //回放视频转FTP上传端口
|
||||
private String ftpUsername; //回放视频转FTP上传用户
|
||||
private String ftpPassword; //回放视频转FTP上传密码
|
||||
private String ftpUploadpath; //回放视频转FTP上传路径
|
||||
private String orgCode; //机构编码
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package com.nu.modules.tplink.common.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.nu.modules.tplink.common.entity.ErrorCode;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元-物联管理-错误码
|
||||
|
|
@ -12,6 +12,6 @@ import com.nu.modules.tplink.common.entity.ErrorCode;
|
|||
*/
|
||||
|
||||
@Mapper
|
||||
public interface ErrorCodeMapper extends BaseMapper<ErrorCode> {
|
||||
ErrorCode getByCode(String errorCode);
|
||||
public interface TumsConfigMapper extends BaseMapper<TumsConfig> {
|
||||
TumsConfig getByCode(String orgCode);
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?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,30 @@
|
|||
<?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.TumsConfigMapper">
|
||||
|
||||
<select id="getByCode" parameterType="String" resultType="com.nu.modules.tplink.common.entity.TumsConfig">
|
||||
select
|
||||
id,
|
||||
tums_url as tumsUrl,
|
||||
tums_username as tumsUsername,
|
||||
tums_password as tumsPassword,
|
||||
ftp_ip as ftpIp,
|
||||
ftp_port as ftpPort,
|
||||
ftp_username as ftpUsername,
|
||||
ftp_password as ftpPassword,
|
||||
ftp_uploadpath as ftpUploadpath,
|
||||
org_code as orgCode
|
||||
from nu_iot_tplink_tums_base
|
||||
<where>
|
||||
<if test="orgCode != null and orgCode != ''">
|
||||
AND org_code = #{orgCode}
|
||||
</if>
|
||||
<if test="orgCode == null or orgCode == ''">
|
||||
AND ifnull(org_code,'') = ''
|
||||
</if>
|
||||
</where>
|
||||
order by id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
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,14 @@
|
|||
package com.nu.modules.tplink.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元-物联管理-图门系统配置
|
||||
* @Author: jeecg-boot
|
||||
* @Date: caolei
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ITumsConfigService extends IService<TumsConfig> {
|
||||
TumsConfig getByCode(String orgCode);
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
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,23 @@
|
|||
package com.nu.modules.tplink.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
import com.nu.modules.tplink.common.mapper.TumsConfigMapper;
|
||||
import com.nu.modules.tplink.common.service.ITumsConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元-物联管理-图门系统配置
|
||||
* @Author: caolei
|
||||
* @Date: 2025-03-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class TumsConfigServiceImpl extends ServiceImpl<TumsConfigMapper, TumsConfig> implements ITumsConfigService {
|
||||
|
||||
@Override
|
||||
public TumsConfig getByCode(String orgCode){
|
||||
return baseMapper.getByCode(orgCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
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","获取所有项目信息"),
|
||||
ADD_PROJECT("/tums/resource/v2/addProject","添加项目信息"),
|
||||
EDIT_PROJECT("/tums/resource/v2/editProject","修改项目信息"),
|
||||
DELETE_PROJECT("/tums/resource/v2/deleteProject","删除项目信息"),
|
||||
ADD_REGION("/tums/resource/v2/addRegion","添加区域信息"),
|
||||
EDIT_REGION("/tums/resource/v2/editRegion","修改区域信息"),
|
||||
SWITCH_REGION_ORDER("/tums/resource/v2/switchRegionOrder","移动区域信息"),
|
||||
DELETE_REGION("/tums/resource/v2/deleteRegion","删除区域信息"),
|
||||
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();
|
||||
}
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
/**
|
||||
* 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.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.aspect.annotation.AutoLog;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param projectInfo
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "护理单元-物联管理-TPLINK机构信息-添加")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK机构信息-添加", notes="护理单元-物联管理-TPLINK机构信息-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ProjectInfo projectInfo) {
|
||||
return service.addProject(projectInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param projectInfo
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "护理单元-物联管理-TPLINK机构信息-编辑")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK机构信息-编辑", notes="护理单元-物联管理-TPLINK机构信息-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<String> edit(@RequestBody ProjectInfo projectInfo) {
|
||||
return service.editProject(projectInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param projectInfo
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "护理单元-物联管理-TPLINK机构信息-编辑")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK机构信息-通过id删除", notes="护理单元-物联管理-TPLINK机构信息-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<String> deleteProject(@RequestBody ProjectInfo projectInfo) {
|
||||
return service.deleteProject(projectInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "护理单元-物联管理-TPLINK机构信息-通过id查询")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK机构信息-通过id查询", notes="护理单元-物联管理-TPLINK机构信息-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ProjectInfo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ProjectInfo projectInfo = service.getById(id);
|
||||
if(projectInfo==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(projectInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
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;
|
||||
/**机构ID*/
|
||||
@Excel(name = "机构ID", width = 15)
|
||||
@ApiModelProperty(value = "机构ID")
|
||||
@Dict(dicCode = "id" , dictTable = "sys_depart" , dicText = "depart_name")
|
||||
private String institutionalId;
|
||||
/**创建时间戳,单位秒*/
|
||||
@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;
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
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 deleteByProjectId(String projectId);
|
||||
int updateLeafByPId(Map<String, String> map);
|
||||
List<ProjectInfo> queryTreeList();
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
<?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,
|
||||
institutional_id as institutionalId,
|
||||
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,
|
||||
institutional_id as institutionalId,
|
||||
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,
|
||||
institutional_id as institutionalId,
|
||||
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,
|
||||
institutional_id,
|
||||
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},
|
||||
#{institutionalId},
|
||||
#{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},
|
||||
institutional_id = #{institutionalId},
|
||||
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="deleteByProjectId">
|
||||
delete
|
||||
from nu_iot_tplink_project
|
||||
where project_id = #{projectId}
|
||||
</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,
|
||||
institutional_id as institutionalId,
|
||||
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>
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
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();
|
||||
|
||||
Result<String> addProject(ProjectInfo projectInfo);
|
||||
Result<String> editProject(ProjectInfo projectInfo);
|
||||
Result<String> deleteProject(ProjectInfo projectInfo);
|
||||
|
||||
}
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Result<String> addProject(ProjectInfo projectInfo){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"enterpriseId\"").append(":").append("\"0\"").append(",");
|
||||
sb.append("\"projectName\"").append(":").append("\"").append(projectInfo.getProjectName()).append("\"");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.addProject(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")){
|
||||
sync();
|
||||
return Result.OK("项目添加成功!");
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Result<String> editProject(ProjectInfo projectInfo){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"projectId\"").append(":").append("\"").append(projectInfo.getProjectId()).append("\",");
|
||||
sb.append("\"projectName\"").append(":").append("\"").append(projectInfo.getProjectName()).append("\"");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.editProject(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")){
|
||||
sync();
|
||||
return Result.OK("项目编辑成功!");
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Result<String> deleteProject(ProjectInfo projectInfo){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"projectId\"").append(":").append("\"").append(projectInfo.getProjectId()).append("\"");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.deleteProject(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")||errorCode.equals("-82401")){
|
||||
baseMapper.deleteByProjectId(projectInfo.getProjectId());
|
||||
return Result.OK("项目删除成功!");
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param regionInfo
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "护理单元-物联管理-TPLINK区域信息-添加")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK区域信息-添加", notes="护理单元-物联管理-TPLINK区域信息-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody RegionInfo regionInfo) {
|
||||
return service.addRegion(regionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param regionInfo
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "护理单元-物联管理-TPLINK区域信息-编辑")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK区域信息-编辑", notes="护理单元-物联管理-TPLINK区域信息-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<String> edit(@RequestBody RegionInfo regionInfo) {
|
||||
return service.editRegion(regionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param regionInfo
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "护理单元-物联管理-TPLINK区域信息-编辑")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK区域信息-通过id删除", notes="护理单元-物联管理-TPLINK区域信息-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<String> deleteRegion(@RequestBody RegionInfo regionInfo) {
|
||||
return service.deleteRegion(regionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "护理单元-物联管理-TPLINK区域信息-通过id查询")
|
||||
@ApiOperation(value="护理单元-物联管理-TPLINK区域信息-通过id查询", notes="护理单元-物联管理-TPLINK区域信息-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<RegionInfo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
RegionInfo regionInfo = service.getById(id);
|
||||
if(regionInfo==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(regionInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
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);
|
||||
int deleteByRegionId(String regionId);
|
||||
List<RegionInfo> queryTreeListByPid(String parentId,String projectId);
|
||||
}
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
<?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 a.id,
|
||||
a.region_id as regionId,
|
||||
a.region_name as regionName,
|
||||
a.region_level as regionLevel,
|
||||
a.sort,
|
||||
a.parent_id as parentId,
|
||||
ifnull(p.region_name,'无') as parentName,
|
||||
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_region p on a.parent_id = p.region_id
|
||||
where a.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,
|
||||
ifnull(p.region_name,'无') as parentName,
|
||||
a.project_id as projectId,
|
||||
b.project_name as projectName,
|
||||
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
|
||||
left join nu_iot_tplink_region p on a.parent_id = p.region_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,
|
||||
ifnull(p.region_name,'无') as parentName,
|
||||
a.project_id as projectId,
|
||||
b.project_name as projectName,
|
||||
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
|
||||
left join nu_iot_tplink_region p on a.parent_id = p.region_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>
|
||||
|
||||
<update id="deleteByRegionId">
|
||||
delete from nu_iot_tplink_region where region_id = #{regionId}
|
||||
</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>
|
||||
|
|
@ -1,352 +0,0 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
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);
|
||||
|
||||
Result<String> addRegion(RegionInfo regionInfo);
|
||||
Result<String> editRegion(RegionInfo regionInfo);
|
||||
Result<String> deleteRegion(RegionInfo regionInfo);
|
||||
}
|
||||
|
|
@ -1,211 +0,0 @@
|
|||
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.mapper.ProjectInfoMapper;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Result<String> addRegion(RegionInfo regionInfo){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"projectId\"").append(":").append("\"").append(regionInfo.getProjectId()).append("\",");
|
||||
sb.append("\"parentId\"").append(":").append("\"").append(regionInfo.getParentId()).append("\",");
|
||||
sb.append("\"regionName\"").append(":").append("\"").append(regionInfo.getRegionName()).append("\",");
|
||||
sb.append("\"sysType\"").append(":").append("3");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.addRegion(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")){
|
||||
sync(regionInfo);
|
||||
return Result.OK("区域添加成功!");
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Result<String> editRegion(RegionInfo regionInfo){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"regionId\"").append(":").append("\"").append(regionInfo.getRegionId()).append("\",");
|
||||
sb.append("\"regionName\"").append(":").append("\"").append(regionInfo.getRegionName()).append("\"");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.editRegion(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")){
|
||||
sync(regionInfo);
|
||||
return Result.OK("区域编辑成功!");
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Result<String> deleteRegion(RegionInfo regionInfo){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"regionId\"").append(":").append("\"").append(regionInfo.getRegionId()).append("\"");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.deleteRegion(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")||errorCode.equals("-82401")){
|
||||
baseMapper.deleteByRegionId(regionInfo.getRegionId());
|
||||
return Result.OK("区域删除成功!");
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,461 +0,0 @@
|
|||
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 addProject(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("addProject:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.ADD_PROJECT.getValue());
|
||||
log.info("addProject:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目信息
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String editProject(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("editProject:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.EDIT_PROJECT.getValue());
|
||||
log.info("editProject:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目信息
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String deleteProject(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("deleteProject:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.DELETE_PROJECT.getValue());
|
||||
log.info("deleteProject:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加区域信息
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String addRegion(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("addRegion:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.ADD_REGION.getValue());
|
||||
log.info("addRegion:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改区域信息
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String editRegion(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("editRegion:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.EDIT_REGION.getValue());
|
||||
log.info("editRegion:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动区域信息
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String switchRegionOrder(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("switchRegionOrder:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.SWITCH_REGION_ORDER.getValue());
|
||||
log.info("switchRegionOrder:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除区域信息
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String deleteRegion(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("deleteRegion:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.DELETE_REGION.getValue());
|
||||
log.info("deleteRegion:response:{}",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();
|
||||
log.info("getPlaybackUrl:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_PLAYBACK_URL.getValue());
|
||||
log.info("getPlaybackUrl:response:{}",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();
|
||||
log.info("getMultitransUrl:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.IPC_GET_MULTITRANS_URL.getValue());
|
||||
log.info("getMultitransUrl:response:{}",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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
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上传路径
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue