feat(sis):
- 新增访客管理相关接口和数据结构 - 实现访客登记和二维码生成功能
This commit is contained in:
@@ -135,4 +135,10 @@ public class SisElevatorInfo extends TenantEntity {
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 是否允许控制
|
||||
*/
|
||||
private Boolean isControl;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -143,6 +143,11 @@ public class SisElevatorInfoBo extends BaseEntity {
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 是否允许控制
|
||||
*/
|
||||
private Boolean isControl;
|
||||
|
||||
/**
|
||||
* 绑定的远程呼梯设备
|
||||
*/
|
||||
|
@@ -29,10 +29,10 @@ public class SisPersonLibImgBo extends BaseEntity {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 人员库编码
|
||||
* 人员标签
|
||||
*/
|
||||
@NotEmpty(message = "人像库id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Collection<Long> libIds;
|
||||
@NotNull(message = "人员标签不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer rosterType;
|
||||
|
||||
/**
|
||||
* 人像名称
|
||||
@@ -90,10 +90,4 @@ public class SisPersonLibImgBo extends BaseEntity {
|
||||
* 图片MD5
|
||||
*/
|
||||
private String imgMd5Value;
|
||||
|
||||
/**
|
||||
* 人员标签
|
||||
*/
|
||||
private Integer rosterType;
|
||||
|
||||
}
|
||||
|
@@ -56,16 +56,6 @@ public class SisDeviceManageVo implements Serializable {
|
||||
@ExcelProperty(value = "设备")
|
||||
private String deviceMac;
|
||||
|
||||
/**
|
||||
* 设备账号
|
||||
*/
|
||||
private String deviceAccount;
|
||||
|
||||
/**
|
||||
* 设备密码
|
||||
*/
|
||||
private String devicePwd;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
|
@@ -156,6 +156,11 @@ public class SisElevatorInfoVo implements Serializable {
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 是否允许控制
|
||||
*/
|
||||
private Boolean isControl;
|
||||
|
||||
/**
|
||||
* 呼梯摄像头
|
||||
*/
|
||||
|
@@ -85,12 +85,6 @@ public class SisPersonLibImgVo implements Serializable {
|
||||
@ExcelProperty(value = "远程库图像ID")
|
||||
private Long remoteHWId;
|
||||
|
||||
/**
|
||||
* 人像库id
|
||||
*/
|
||||
@ExcelProperty(value = "人像库id")
|
||||
private Collection<Long> libIds;
|
||||
|
||||
/**
|
||||
* 入驻员工id
|
||||
*/
|
||||
|
@@ -9,8 +9,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.property.api.domain.vo.RemoteFloorVo;
|
||||
import org.dromara.sis.domain.bo.SisDeviceManageBo;
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.domain.vo.SisElevatorInfoVo;
|
||||
import org.dromara.sis.sdk.hik.HikApiService;
|
||||
import org.dromara.sis.sdk.hik.calback.HikAlarmCallBack;
|
||||
@@ -78,7 +77,7 @@ public class HikDeviceApplicationRunner implements ApplicationRunner {
|
||||
|
||||
@Async
|
||||
public void hikNetCameraLogin() {
|
||||
List<SisDeviceManageVo> deviceList = deviceManageService.queryList(new SisDeviceManageBo());
|
||||
List<SisDeviceManage> deviceList = deviceManageService.queryHikDevices();
|
||||
if (CollUtil.isEmpty(deviceList)) {
|
||||
log.info("没有查询到摄像设备信息,不执行登录");
|
||||
return;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package org.dromara.sis.sdk.e8;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.sdk.e8.domain.QueryDto;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.CustomerAuthAddReq;
|
||||
@@ -20,6 +19,8 @@ import org.dromara.sis.sdk.e8.domain.door.res.DoorDeviceFindRes;
|
||||
import org.dromara.sis.sdk.e8.domain.lift.req.LiftAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.lift.req.LiftUpdateReq;
|
||||
import org.dromara.sis.sdk.e8.domain.lift.res.LiftFindRes;
|
||||
import org.dromara.sis.sdk.e8.domain.visitors.req.VisitorAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.visitors.res.VisitorAddRes;
|
||||
import org.dromara.sis.sdk.e8.domain.voucher.req.ChangeCardReq;
|
||||
import org.dromara.sis.sdk.e8.domain.voucher.req.IssueVoucherReq;
|
||||
import org.dromara.sis.sdk.e8.domain.voucher.req.OperateVoucherReq;
|
||||
@@ -34,6 +35,7 @@ import java.util.List;
|
||||
public interface E8PlatformApi {
|
||||
|
||||
//***************************************客户信息接口*******************************************/
|
||||
|
||||
/**
|
||||
* 查询单个人员信息
|
||||
*
|
||||
@@ -46,9 +48,9 @@ public interface E8PlatformApi {
|
||||
* 人员信息分页查询
|
||||
*
|
||||
* @param dto 传参
|
||||
* @return IPage<CustomFindRes>
|
||||
* @return TableDataInfo<CustomFindRes>
|
||||
*/
|
||||
IPage<CustomFindRes> findCustomerList(QueryDto dto);
|
||||
TableDataInfo<CustomFindRes> findCustomerList(QueryDto dto);
|
||||
|
||||
/**
|
||||
* 新增人员信息
|
||||
@@ -75,6 +77,7 @@ public interface E8PlatformApi {
|
||||
Boolean deleteCustomer(Long id);
|
||||
|
||||
//***************************************门禁信息接口*******************************************
|
||||
|
||||
/**
|
||||
* 查询门禁信息
|
||||
*
|
||||
@@ -156,13 +159,14 @@ public interface E8PlatformApi {
|
||||
TableDataInfo<CustomerAuthFindRes> getPageCustomerAuth(QueryDto dto);
|
||||
|
||||
//***************************************电梯信息接口*******************************************
|
||||
|
||||
/**
|
||||
* 电梯信息分页查询
|
||||
*
|
||||
* @param dto 传参
|
||||
* @return IPage<LiftFindRes>
|
||||
* @return TableDataInfo<LiftFindRes>
|
||||
*/
|
||||
IPage<LiftFindRes> getPageList(QueryDto dto);
|
||||
TableDataInfo<LiftFindRes> getPageList(QueryDto dto);
|
||||
|
||||
/**
|
||||
* 查询电梯楼层
|
||||
@@ -197,6 +201,7 @@ public interface E8PlatformApi {
|
||||
Boolean deleteLift(Integer id);
|
||||
|
||||
//***************************************凭证信息接口*******************************************
|
||||
|
||||
/**
|
||||
* 发行凭证
|
||||
*
|
||||
@@ -228,4 +233,22 @@ public interface E8PlatformApi {
|
||||
* @return imageUrl 人脸图片地址
|
||||
*/
|
||||
String uploadFace(byte[] imageByte);
|
||||
|
||||
//***************************************访客信息接口*******************************************
|
||||
|
||||
/**
|
||||
* 新增访客登记
|
||||
*
|
||||
* @param req 入参
|
||||
* @return VisitorAddRes
|
||||
*/
|
||||
VisitorAddRes addVisitor(VisitorAddReq req);
|
||||
|
||||
/**
|
||||
* 获取访客二维码
|
||||
*
|
||||
* @param ids 访客ids
|
||||
* @return VisitorAddRes
|
||||
*/
|
||||
VisitorAddRes getVisitorQrCode(List<Long> ids);
|
||||
}
|
||||
|
@@ -2,9 +2,6 @@ package org.dromara.sis.sdk.e8.domain.custom.res;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.sis.sdk.e8.domain.enums.AreaTypeEnum;
|
||||
import org.dromara.sis.sdk.e8.domain.enums.UserTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -467,16 +464,6 @@ public class CustomFindRes {
|
||||
*/
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private UserTypeEnum userType;
|
||||
|
||||
/**
|
||||
* 区域类型
|
||||
*/
|
||||
private AreaTypeEnum areaType;
|
||||
|
||||
/**
|
||||
* 区域类型描述
|
||||
*/
|
||||
|
@@ -1,45 +0,0 @@
|
||||
package org.dromara.sis.sdk.e8.domain.enums;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote AreaTypeEnum
|
||||
* @since 2025/5/26 21:22
|
||||
*/
|
||||
public enum AreaTypeEnum {
|
||||
// 枚举值,括号中是对应的编号和描述
|
||||
REGION(0, "区域"),
|
||||
BUILDING(1, "楼栋"),
|
||||
HOUSE(2, "房屋"),
|
||||
DOOR(3, "门"),
|
||||
FLOOR(4, "楼层");
|
||||
|
||||
// 定义私有变量,用于存储编号和描述
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
// 构造方法,用于初始化每个枚举值的编号和描述
|
||||
AreaTypeEnum(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
// 获取编号的方法
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
// 获取描述的方法
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
// 根据编号获取对应的枚举值
|
||||
public static AreaTypeEnum getByCode(int code) {
|
||||
for (AreaTypeEnum areaType : AreaTypeEnum.values()) {
|
||||
if (areaType.getCode() == code) {
|
||||
return areaType;
|
||||
}
|
||||
}
|
||||
return null; // 如果没有找到匹配的编号,返回 null
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
package org.dromara.sis.sdk.e8.domain.enums;
|
||||
|
||||
/**
|
||||
* @author zcxlsm
|
||||
* @apiNote UserEnumType
|
||||
* @since 2025/5/26 21:16
|
||||
*/
|
||||
public enum UserTypeEnum {
|
||||
// 枚举值,括号中是对应的编号和描述
|
||||
OWNER(0, "业主"),
|
||||
FAMILY_MEMBER(1, "家属"),
|
||||
TENANT(2, "租客"),
|
||||
EMPLOYEE(3, "员工"),
|
||||
BUSINESS_OWNER(4, "企业主"),
|
||||
STAFF(11, "职员"),
|
||||
TEMPORARY_PERSONNEL(12, "临时人员"),
|
||||
HOUSEHOLD_HEAD(13, "户主"),
|
||||
EXTERNAL_PERSONNEL(14, "外部人员"),
|
||||
OTHER_PERSONNEL(100, "其他人员");
|
||||
|
||||
// 定义私有变量,用于存储编号和描述
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
// 构造方法,用于初始化每个枚举值的编号和描述
|
||||
UserTypeEnum(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
// 获取编号的方法
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
// 获取描述的方法
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
// 根据编号获取对应的枚举值
|
||||
public static UserTypeEnum getByCode(int code) {
|
||||
for (UserTypeEnum userType : UserTypeEnum.values()) {
|
||||
if (userType.getCode() == code) {
|
||||
return userType;
|
||||
}
|
||||
}
|
||||
return null; // 如果没有找到匹配的编号,返回 null
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
package org.dromara.sis.sdk.e8.domain.visitors.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote VisitorAddReq
|
||||
* @since 2025/8/12
|
||||
*/
|
||||
@Data
|
||||
public class VisitorAddReq {
|
||||
|
||||
/**
|
||||
* 访客名称
|
||||
*/
|
||||
private String visitorName;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String mobilePhone;
|
||||
|
||||
/**
|
||||
* 被访人手机号
|
||||
*/
|
||||
private String intervieweeMobile;
|
||||
|
||||
/**
|
||||
* 授权开始时间
|
||||
*/
|
||||
private String visitorStartTime;
|
||||
|
||||
/**
|
||||
* 授权结束时间
|
||||
*/
|
||||
private String vistorEndTime;
|
||||
|
||||
/**
|
||||
* 访客登记类型 0:登记 1:邀请 2:预约
|
||||
*/
|
||||
private Integer visitorRegisterType = 1;
|
||||
|
||||
/**
|
||||
* 访客登记来源 0:E8平台 1:访客机 2:小程序
|
||||
*/
|
||||
private Integer reservedField1 = 0;
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package org.dromara.sis.sdk.e8.domain.visitors.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote VisitorAddRes
|
||||
* @since 2025/8/12
|
||||
*/
|
||||
@Data
|
||||
public class VisitorAddRes {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 访客Id
|
||||
*/
|
||||
private Long visitorId;
|
||||
|
||||
/**
|
||||
* 访客编号
|
||||
*/
|
||||
private String visitorNo;
|
||||
|
||||
/**
|
||||
* 访客姓名
|
||||
*/
|
||||
private String visitorName;
|
||||
|
||||
/**
|
||||
* 被访人
|
||||
*/
|
||||
private String intervieweeName;
|
||||
|
||||
/**
|
||||
* 授权门名称(多个以;分隔) 用于打印二维码显示用
|
||||
*/
|
||||
private String itemNames;
|
||||
|
||||
/**
|
||||
* 授权门名称(多个以;分隔) 用于打印二维码显示用
|
||||
*/
|
||||
private String areaNames;
|
||||
|
||||
/**
|
||||
* 二维码加密字符串
|
||||
*/
|
||||
private String qrCodeStr;
|
||||
}
|
@@ -3,8 +3,6 @@ package org.dromara.sis.sdk.e8.service;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -32,6 +30,8 @@ import org.dromara.sis.sdk.e8.domain.lift.req.LiftAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.lift.req.LiftFindReq;
|
||||
import org.dromara.sis.sdk.e8.domain.lift.req.LiftUpdateReq;
|
||||
import org.dromara.sis.sdk.e8.domain.lift.res.LiftFindRes;
|
||||
import org.dromara.sis.sdk.e8.domain.visitors.req.VisitorAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.visitors.res.VisitorAddRes;
|
||||
import org.dromara.sis.sdk.e8.domain.voucher.req.ChangeCardReq;
|
||||
import org.dromara.sis.sdk.e8.domain.voucher.req.IssueVoucherReq;
|
||||
import org.dromara.sis.sdk.e8.domain.voucher.req.OperateVoucherReq;
|
||||
@@ -94,7 +94,7 @@ public class E8PlatformApiService implements E8PlatformApi {
|
||||
* @return IPage<CustomerInfo>
|
||||
*/
|
||||
@Override
|
||||
public IPage<CustomFindRes> findCustomerList(QueryDto dto) {
|
||||
public TableDataInfo<CustomFindRes> findCustomerList(QueryDto dto) {
|
||||
// 创建参数映射,用于存储HTTP请求的参数
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
// 添加分页参数:当前页码和最大结果数量
|
||||
@@ -117,14 +117,14 @@ public class E8PlatformApiService implements E8PlatformApi {
|
||||
Map<String, Object> result = JSONUtil.toBean(JSONUtil.toJsonStr(apiResp.getResult()), new TypeReference<>() {
|
||||
}, false);
|
||||
// 创建一个分页对象,用于存储客户信息列表和分页数据
|
||||
IPage<CustomFindRes> pageInfo = new Page<>(dto.getPageIndex(), dto.getMaxResultCount());
|
||||
TableDataInfo<CustomFindRes> tableDataInfo = new TableDataInfo<>();
|
||||
// 设置总记录数
|
||||
pageInfo.setTotal(Long.parseLong(result.get("total").toString()));
|
||||
tableDataInfo.setTotal(Long.parseLong(result.get("total").toString()));
|
||||
// 将API响应结果中的客户信息列表转换为CustomFindRes对象列表,并设置到分页对象中
|
||||
pageInfo.setRecords(JSONUtil.toList(JSONUtil.toJsonStr(result.get("item")), CustomFindRes.class));
|
||||
tableDataInfo.setRows(JSONUtil.toList(JSONUtil.toJsonStr(result.get("item")), CustomFindRes.class));
|
||||
|
||||
// 返回分页对象
|
||||
return pageInfo;
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -494,10 +494,10 @@ public class E8PlatformApiService implements E8PlatformApi {
|
||||
* 电梯信息分页查询
|
||||
*
|
||||
* @param dto 传参
|
||||
* @return IPage<LiftFindRes>
|
||||
* @return TableDataInfo<LiftFindRes>
|
||||
*/
|
||||
@Override
|
||||
public IPage<LiftFindRes> getPageList(QueryDto dto) {
|
||||
public TableDataInfo<LiftFindRes> getPageList(QueryDto dto) {
|
||||
// 创建一个参数映射,用于存储API请求所需的参数
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
// 将分页索引和最大结果数放入参数映射中
|
||||
@@ -517,14 +517,14 @@ public class E8PlatformApiService implements E8PlatformApi {
|
||||
Map<String, Object> result = JSONUtil.toBean(JSONUtil.toJsonStr(apiResp.getResult()), new TypeReference<>() {
|
||||
}, false);
|
||||
// 创建一个分页对象,传入分页索引和最大结果数
|
||||
IPage<LiftFindRes> page = new Page<>(dto.getPageIndex(), dto.getMaxResultCount());
|
||||
TableDataInfo<LiftFindRes> tableDataInfo = new TableDataInfo<>();
|
||||
// 设置分页对象的总记录数
|
||||
page.setTotal(Long.parseLong(result.get("total").toString()));
|
||||
tableDataInfo.setTotal(Long.parseLong(result.get("total").toString()));
|
||||
// 将结果中的项转换为LiftFindRes列表,并设置为分页对象的记录
|
||||
page.setRecords(JSONUtil.toList(JSONUtil.toJsonStr(result.get("item")), LiftFindRes.class));
|
||||
tableDataInfo.setRows(JSONUtil.toList(JSONUtil.toJsonStr(result.get("item")), LiftFindRes.class));
|
||||
|
||||
// 返回填充了数据的分页对象
|
||||
return page;
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -694,4 +694,59 @@ public class E8PlatformApiService implements E8PlatformApi {
|
||||
|
||||
return apiResp.getMessage();
|
||||
}
|
||||
|
||||
//***************************************电梯信息接口*******************************************
|
||||
private static final String VISITOR_CREATE = "/api/E8Door/visitor-registration";
|
||||
private static final String VISITOR_QRCODE = "/api/E8Door/visitor-registration/get-visitor-print-content";
|
||||
|
||||
/**
|
||||
* 新增访客登记
|
||||
*
|
||||
* @param req 入参
|
||||
* @return VisitorAddRes
|
||||
*/
|
||||
@Override
|
||||
public VisitorAddRes addVisitor(VisitorAddReq req) {
|
||||
// 将添加请求对象转换为Map对象,以便后续API调用
|
||||
Map<String, Object> params = BeanUtil.beanToMap(req);
|
||||
|
||||
// 执行客户创建API调用,并获取API响应对象
|
||||
ApiResp apiResp = e8ApiUtil.doPost(params, VISITOR_CREATE);
|
||||
|
||||
// 检查API调用是否成功
|
||||
if (!apiResp.getSuccess()) {
|
||||
log.error("E8新增访客信息失败 errorMsg:{}", apiResp);
|
||||
// 如果API调用失败,返回null
|
||||
return null;
|
||||
}
|
||||
|
||||
// 返回API调用是否成功的标志
|
||||
return JSONUtil.toBean(JSONUtil.toJsonStr(apiResp.getResult()), VisitorAddRes.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取访客二维码
|
||||
*
|
||||
* @param ids 访客ids
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public VisitorAddRes getVisitorQrCode(List<Long> ids) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("ids", ids);
|
||||
|
||||
// 执行客户创建API调用,并获取API响应对象
|
||||
ApiResp apiResp = e8ApiUtil.doPost(params, VISITOR_QRCODE);
|
||||
|
||||
// 检查API调用是否成功
|
||||
if (!apiResp.getSuccess()) {
|
||||
log.error("E8获取访客二维码失败 errorMsg:{}", apiResp);
|
||||
// 如果API调用失败,返回null
|
||||
return null;
|
||||
}
|
||||
|
||||
// 返回API调用是否成功的标志
|
||||
return JSONUtil.toList(JSONUtil.toJsonStr(apiResp.getResult()), VisitorAddRes.class).get(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.sis.sdk.e8.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
@@ -58,10 +59,8 @@ public class E8ApiUtil {
|
||||
jsonBody = JSONUtil.toJsonStr(params);
|
||||
}
|
||||
|
||||
// url
|
||||
String url = BASE_URL + api;
|
||||
|
||||
|
||||
// 对请求体进行Base64加密,指定UTF-8编码,避免乱码
|
||||
String base64Body = Base64.getEncoder().encodeToString(jsonBody.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
@@ -156,8 +155,14 @@ public class E8ApiUtil {
|
||||
*/
|
||||
public String getPostSign(Map<String, Object> params, String api, String timestamp) {
|
||||
String url = BASE_URL + api;
|
||||
|
||||
// one&two
|
||||
String paramsUrl = buildUrlWithParams(url, params) + "×tamp=" + timestamp;
|
||||
String paramsUrl;
|
||||
if (StrUtil.equals(url, buildUrlWithParams(url, params))){
|
||||
paramsUrl = url + "timestamp=" + timestamp;
|
||||
}else {
|
||||
paramsUrl = buildUrlWithParams(url, params) + "×tamp=" + timestamp;
|
||||
}
|
||||
// three
|
||||
String upperUrl = paramsUrl.toUpperCase();
|
||||
// four
|
||||
|
@@ -280,10 +280,9 @@ public class HikAlarmCallBack implements HCNetSDK.FMSGCallBack_V31 {
|
||||
buffers1.get(bigImg);
|
||||
//设备ip
|
||||
String sAlarmInfo = new String(pAlarmer.sDeviceIP).trim();
|
||||
log.info("海康设备告警信息上传,设备={}, 人脸图片大小={}, 背景图片大小={}", sAlarmInfo, smallImg.length, bigImg.length);
|
||||
|
||||
SisDeviceManage device = sisDeviceManageService.queryByDeviceIp(sAlarmInfo);
|
||||
if (!device.getIsComparison()) {
|
||||
log.info("海康设备告警信息上传,设备={}, 人脸图片大小={}, 背景图片大小={}", sAlarmInfo, smallImg.length, bigImg.length);
|
||||
zeroSensationPassageService.pass(sAlarmInfo, smallImg, bigImg);
|
||||
}
|
||||
}
|
||||
@@ -321,7 +320,7 @@ public class HikAlarmCallBack implements HCNetSDK.FMSGCallBack_V31 {
|
||||
|
||||
log.info("比对结果:{},相似度:{},人员:{},id:{}", compareResults, similarity, name, pid);
|
||||
log.info("处理前置人脸比对结果,耗时:{}", interval.interval());
|
||||
zeroSensationPassageService.handleEleOut(new String(pAlarmer.sDeviceIP).trim(), interval);
|
||||
zeroSensationPassageService.handleEleOut(new String(pAlarmer.sDeviceIP).trim());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -203,7 +203,6 @@ public class ElevatorControlTcpUtil {
|
||||
|
||||
// 设置100ms超时
|
||||
clientSocket.setSoTimeout(100);
|
||||
|
||||
byte[] response = new byte[FRAME_LENGTH];
|
||||
int bytesRead = 0;
|
||||
while (bytesRead < FRAME_LENGTH) {
|
||||
@@ -266,17 +265,25 @@ public class ElevatorControlTcpUtil {
|
||||
}
|
||||
|
||||
private byte[] buildFrame(byte command, byte[] floorData) {
|
||||
byte[] frame = new byte[FRAME_LENGTH];
|
||||
if (floorData.length != 7) {
|
||||
throw new IllegalArgumentException("楼层数据必须为7字节");
|
||||
}
|
||||
|
||||
byte[] frame = new byte[10]; // 10字节帧
|
||||
// 帧头
|
||||
frame[0] = command;
|
||||
// 地址
|
||||
frame[1] = FIXED_ADDRESS;
|
||||
// 数据部分(7字节)
|
||||
System.arraycopy(floorData, 0, frame, 2, 7);
|
||||
|
||||
// 计算校验和(从帧头到数据结束)
|
||||
byte checksum = 0;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int i = 0; i < 9; i++) { // 前9字节求和
|
||||
checksum = (byte) (checksum + frame[i]);
|
||||
}
|
||||
// 帧尾(校验和)
|
||||
frame[9] = checksum;
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,6 @@ public interface IZeroSensationPassageService {
|
||||
*
|
||||
* @param deviceIp 设备ip
|
||||
*/
|
||||
void handleEleOut(String deviceIp, TimeInterval interval);
|
||||
void handleEleOut(String deviceIp);
|
||||
|
||||
}
|
||||
|
@@ -13,7 +13,6 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.sis.domain.SisPersonLibImg;
|
||||
import org.dromara.sis.domain.bo.SisLibImgRefBo;
|
||||
import org.dromara.sis.domain.bo.SisPersonLibImgBo;
|
||||
import org.dromara.sis.domain.vo.*;
|
||||
import org.dromara.sis.mapper.SisPersonLibImgMapper;
|
||||
@@ -38,7 +37,6 @@ public class SisPersonLibImgServiceImpl implements ISisPersonLibImgService {
|
||||
private final SisPersonLibImgMapper baseMapper;
|
||||
|
||||
private final HuaWeiBoxApi huaWeiBoxApi;
|
||||
private final ISisLibImgRefService sisLibImgRefService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
@@ -51,15 +49,7 @@ public class SisPersonLibImgServiceImpl implements ISisPersonLibImgService {
|
||||
*/
|
||||
@Override
|
||||
public SisPersonLibImgVo queryById(Long id) {
|
||||
SisLibImgRefBo refBo = new SisLibImgRefBo();
|
||||
refBo.setImgId(id);
|
||||
List<SisLibImgRefVo> refs = sisLibImgRefService.queryList(refBo);
|
||||
Collection<Long> refIds = refs.stream().map(SisLibImgRefVo::getId).toList();
|
||||
|
||||
SisPersonLibImgVo vo = new SisPersonLibImgVo();
|
||||
vo.setLibIds(refIds);
|
||||
|
||||
return vo;
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.sis.service.impl;
|
||||
|
||||
import cn.dev33.satoken.context.mock.SaTokenContextMockUtil;
|
||||
import cn.hutool.core.codec.Base64Encoder;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
@@ -10,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.property.api.domain.vo.RemoteFloorVo;
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.domain.enums.ControlTypeEnum;
|
||||
import org.dromara.sis.domain.enums.RosterTypeEnum;
|
||||
import org.dromara.sis.domain.vo.*;
|
||||
@@ -121,7 +121,7 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
} else if (item.getControlType().equals(ControlTypeEnum.ELEVATOR_OUT_CONTROL.getCode())) { // 电梯外面面板权限
|
||||
handleEle(item.getBindId(), r.getAuthGroupId(), ControlTypeEnum.ELEVATOR_OUT_CONTROL.getCode(), item.getDeviceFloorId());
|
||||
} else if (item.getControlType().equals(ControlTypeEnum.ELEVATOR_IN_CONTROL.getCode())) { // 电梯里面的面板
|
||||
handleEle(item.getBindId(), r.getAuthGroupId(), ControlTypeEnum.ELEVATOR_IN_CONTROL.getCode(), item.getDeviceFloorId());
|
||||
handleEle(item.getBindId(), r.getAuthGroupId(), ControlTypeEnum.ELEVATOR_IN_CONTROL.getCode(), 0L);
|
||||
} else {
|
||||
log.info("设备绑定了未知的控制类型[{}],不处理", item.getControlType());
|
||||
}
|
||||
@@ -135,7 +135,8 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
* @param deviceIp 设备ip
|
||||
*/
|
||||
@Override
|
||||
public void handleEleOut(String deviceIp, TimeInterval interval) {
|
||||
public void handleEleOut(String deviceIp) {
|
||||
TimeInterval interval = new TimeInterval();
|
||||
// 获取当前设备的绑定设备信息
|
||||
List<SisDeviceBindRefVo> bindRefList = deviceBindRefService.queryByDeviceIp(deviceIp);
|
||||
List<SisDeviceBindRefVo> outRefList = bindRefList.stream().filter(item -> Objects.equals(item.getControlType(), ControlTypeEnum.ELEVATOR_OUT_CONTROL.getCode())).toList();
|
||||
@@ -193,17 +194,20 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
|
||||
// 获取当前电梯信息
|
||||
SisElevatorInfoVo ele = elevatorInfoService.queryById(deviceId);
|
||||
// 当前电梯不允许控制
|
||||
if (!ele.getIsControl()) return;
|
||||
|
||||
|
||||
// 获取权限组下电梯⇄楼层关联信息
|
||||
List<SisElevatorFloorRefVo> groupRef = elevatorFloorRefService.queryByAuthGroupId(groupId);
|
||||
if (ObjectUtil.isEmpty(groupRef)) return;
|
||||
if (CollUtil.isEmpty(groupRef)) return;
|
||||
|
||||
// 取出当前电梯的楼层授权信息
|
||||
List<SisElevatorFloorRefVo> eleRef = groupRef.stream().filter(o -> Objects.equals(o.getElevatorId(), deviceId)).toList();
|
||||
if (ObjectUtil.isEmpty(eleRef)) return;
|
||||
|
||||
if (Objects.equals(controlType, ControlTypeEnum.ELEVATOR_IN_CONTROL.getCode())) {
|
||||
log.info("开始下发里面版梯控权限....");
|
||||
if (Objects.equals(controlType, ControlTypeEnum.ELEVATOR_OUT_CONTROL.getCode())) {
|
||||
log.info("开始下发外部面板梯控权限....");
|
||||
for (SisElevatorFloorRefVo ref : eleRef) {
|
||||
if (ref.getUpChannel() != null && Objects.equals(ref.getFloorId(), deviceFloorId)) {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), ref.getUpChannel().intValue(), 2);
|
||||
@@ -213,14 +217,14 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), ref.getDownChannel().intValue(), 2);
|
||||
}
|
||||
}
|
||||
cleanLiftAuthRocketProducer.sendMessage(deviceId, groupId, deviceFloorId, "清除电梯" + deviceId + "梯控权限", 3);
|
||||
}
|
||||
|
||||
|
||||
// 获取当前电梯所在建筑的楼层
|
||||
List<RemoteFloorVo> floorList = remoteFloorService.queryByBuildingId(ele.getBuildingId());
|
||||
// 模拟上下文
|
||||
List<RemoteFloorVo> floorList = SaTokenContextMockUtil.setMockContext(() -> remoteFloorService.queryByBuildingId(ele.getBuildingId()));
|
||||
if (CollUtil.isEmpty(floorList)) return;
|
||||
|
||||
if (Objects.equals(controlType, ControlTypeEnum.ELEVATOR_OUT_CONTROL.getCode())) {
|
||||
if (Objects.equals(controlType, ControlTypeEnum.ELEVATOR_IN_CONTROL.getCode())) {
|
||||
SisElevatorFloorRefVo vo;
|
||||
List<Integer> num = new ArrayList<>();
|
||||
for (int i = 1; i < floorList.size(); i++) {
|
||||
@@ -234,14 +238,8 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
|
||||
}
|
||||
if (CollUtil.isEmpty(num)) return;
|
||||
|
||||
if (!ElevatorControlTcpUtil.getInstance().isClientConnected()) {
|
||||
log.info("梯控模块未连接,请检查梯控模块是否启动");
|
||||
return;
|
||||
}
|
||||
ElevatorControlTcpUtil.getInstance().sendManualCommand(num);
|
||||
}
|
||||
log.info("梯控下发权限完成");
|
||||
|
||||
cleanLiftAuthRocketProducer.sendMessage(deviceId, groupId, deviceFloorId, "清除电梯" + deviceId + "梯控权限", 3);
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
LEFT JOIN sis_auth_record c
|
||||
ON c.target_id = b.id
|
||||
AND c.group_id = b.auth_group_id
|
||||
WHERE a.remote_img_id = #{personId};
|
||||
WHERE a.remote_hw_id = #{personId};
|
||||
</select>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user