嘉兴访客
This commit is contained in:
1 parent
82641f15c3
commit
4d3903e0f5
9 files changed
+651
-3
No files matched your search
@@ -0,0 +1,11 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="嘉兴访客" type="Multirun" separateTabs="false" reuseTabsWithFailures="false" startOneByOne="true" markFailedProcess="true" hideSuccessProcess="false" delayTime="0.0">
|
||||
<runConfiguration name="PjcloudNacosApplication" type="Spring Boot" />
|
||||
<runConfiguration name="PjcloudAdminApplication" type="Spring Boot" />
|
||||
<runConfiguration name="PjcloudAuthApplication" type="Spring Boot" />
|
||||
<runConfiguration name="PjcloudGatewayApplication" type="Spring Boot" />
|
||||
<runConfiguration name="ThirdPartyApp" type="Spring Boot" />
|
||||
<runConfiguration name="IntegratedApp" type="Spring Boot" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,12 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="批量启动" type="Multirun" separateTabs="false" reuseTabsWithFailures="false" startOneByOne="true" markFailedProcess="true" hideSuccessProcess="false" delayTime="0.0">
|
||||
<runConfiguration name="PjcloudGatewayApplication" type="Spring Boot" />
|
||||
<runConfiguration name="PjcloudAuthApplication" type="Spring Boot" />
|
||||
<runConfiguration name="PjcloudAdminApplication" type="Spring Boot" />
|
||||
<runConfiguration name="PjcloudCodeGenApplication" type="Spring Boot" />
|
||||
<runConfiguration name="CanteenApp" type="Spring Boot" />
|
||||
<runConfiguration name="ThirdPartyApp" type="Spring Boot" />
|
||||
<runConfiguration name="PjcloudAppApplication" type="Spring Boot" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
+21
-3
@@ -39,10 +39,12 @@ import com.bsd.pjcloud.integrated.vo.visitor.app.VisitorsPeopleAppVo;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterVisitorService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.AppointmentInfo;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.VisitorObjectResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.QueryAppointmentRecordsRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.RegisterAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.VisitorAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.VisitorInfo;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.AppointmentData;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.QueryAppointmentRecordsResponse;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -220,11 +222,27 @@ public class VisitorsServiceImpl extends ServiceImpl<VisitorsMapper, VisitorsEnt
|
||||
VisitorsAppVo bean = BeanUtils.toBean(visitors, VisitorsAppVo.class);
|
||||
|
||||
// 只有当审核状态为审核通过(check_status=2)时,才携带qrcode相关信息
|
||||
// if (!TaskCheckStatusEnum.RESULT.getCode().equals(visitors.getCheckStatus())|| !TaskCheckStatusEnum.HAVE_VISIT.getCode().equals(visitors.getCheckStatus())) {
|
||||
// 清除qrcode相关字段
|
||||
if (TaskCheckStatusEnum.RESULT.getCode().equals(visitors.getCheckStatus())|| TaskCheckStatusEnum.HAVE_VISIT.getCode().equals(visitors.getCheckStatus())) {
|
||||
// 清除qrcode相关字段
|
||||
// bean.setQrcode(null);
|
||||
//调用查询二维码的接口
|
||||
QueryAppointmentRecordsRequest queryAppointmentRecordsRequest = new QueryAppointmentRecordsRequest();
|
||||
queryAppointmentRecordsRequest.setPageNo(1);
|
||||
queryAppointmentRecordsRequest.setPageSize(1);
|
||||
queryAppointmentRecordsRequest.setOrderId(visitors.getOrderId());
|
||||
queryAppointmentRecordsRequest.setVerificationCode(visitors.getVerificationCode());
|
||||
R<QueryAppointmentRecordsResponse> queryAppointmentRecordsResponseR = remoterVisitorService.queryAppointmentRecords(queryAppointmentRecordsRequest);
|
||||
QueryAppointmentRecordsResponse queryAppointmentRecordsResponse = queryAppointmentRecordsResponseR.getData();
|
||||
QueryAppointmentRecordsResponse.QueryRecordsData queryRecordsData = queryAppointmentRecordsResponse.getData();
|
||||
List<QueryAppointmentRecordsResponse.AppointmentRecord> list = queryRecordsData.getList();
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
QueryAppointmentRecordsResponse.AppointmentRecord appointmentRecord = list.get(0);
|
||||
bean.setQrcode(appointmentRecord.getQRCode());
|
||||
}else {
|
||||
throw new ServiceException("二维码接口获取失败");
|
||||
}
|
||||
// bean.setVerificationCode(null);
|
||||
// }
|
||||
}
|
||||
|
||||
List<VisitorsCarEntity> visitorsCarEntities =
|
||||
visitorsCarMapper.selectList(new LambdaQueryWrapper<VisitorsCarEntity>().eq(VisitorsCarEntity::getVisitorsId, visitors.getId()));
|
||||
|
||||
+10
@@ -23,9 +23,11 @@ import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.VisitorObjectResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.CheckOutRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.QueryAppointmentRecordsRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.RegisterAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.VisitorAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.AppointmentData;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.QueryAppointmentRecordsResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.RegisterAppointmentResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.person.AddPersonRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.person.AddPersonResponse;
|
||||
@@ -66,6 +68,14 @@ public interface RemoterVisitorService {
|
||||
@PostMapping("/visitors/appointment")
|
||||
VisitorObjectResponse<AppointmentData> createVisitorAppointment(@Valid @RequestBody VisitorAppointmentRequest request);
|
||||
|
||||
/**
|
||||
* 查询访客预约记录v2
|
||||
* @param request 查询访客预约记录请求参数
|
||||
* @return 查询访客预约记录响应结果
|
||||
*/
|
||||
@PostMapping("/visitors/appointment/records")
|
||||
@Operation(summary = "查询访客预约记录v2", description = "根据查询条件查询预约记录")
|
||||
R<QueryAppointmentRecordsResponse> queryAppointmentRecords(@Valid @RequestBody QueryAppointmentRecordsRequest request);
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.visitor.request.make;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询访客预约记录v2请求参数
|
||||
* API路径:/api/visitor/v2/appointment/records
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询访客预约记录v2请求参数")
|
||||
public class QueryAppointmentRecordsRequest {
|
||||
|
||||
/**
|
||||
* 被访人唯一标识(可选)
|
||||
* 查询人员列表v2接口获取返回报文中的personId字段
|
||||
*/
|
||||
@Schema(description = "被访人唯一标识")
|
||||
private String receptionistId;
|
||||
|
||||
/**
|
||||
* 访客姓名(可选)
|
||||
* 长度不超过32,支持中英文字符,不能包含 ' / \ : * ? " < >
|
||||
*/
|
||||
@Size(max = 32, message = "访客姓名长度不超过32个字符")
|
||||
@Pattern(regexp = "^[^'/\\\\:*?\"<>]*$", message = "访客姓名包含非法字符")
|
||||
@Schema(description = "访客姓名")
|
||||
private String visitorName;
|
||||
|
||||
/**
|
||||
* 联系电话(可选)
|
||||
* 建议填写手机号码
|
||||
*/
|
||||
@Schema(description = "联系电话")
|
||||
private String phoneNo;
|
||||
|
||||
/**
|
||||
* 预计来访时间范围-开始(可选)
|
||||
* 时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区
|
||||
* 例如北京时间:2018-07-26T15:00:00+08:00
|
||||
*/
|
||||
@Schema(description = "预计来访时间范围-开始", example = "2018-07-26T15:00:00+08:00")
|
||||
private String visitStartTimeBegin;
|
||||
|
||||
/**
|
||||
* 预计来访时间范围-结束(可选)
|
||||
* 时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区
|
||||
* 例如北京时间:2018-07-26T15:00:00+08:00
|
||||
*/
|
||||
@Schema(description = "预计来访时间范围-结束", example = "2018-07-26T15:00:00+08:00")
|
||||
private String visitStartTimeEnd;
|
||||
|
||||
/**
|
||||
* 预计离开时间范围-开始(可选)
|
||||
* 时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区
|
||||
* 例如北京时间:2018-07-26T15:00:00+08:00
|
||||
*/
|
||||
@Schema(description = "预计离开时间范围-开始", example = "2018-07-26T15:00:00+08:00")
|
||||
private String visitEndTimeBegin;
|
||||
|
||||
/**
|
||||
* 预计离开时间范围-结束(可选)
|
||||
* 时间参数需满足ISO8601格式:yyyy-MM-ddTHH:mm:ss+当前时区
|
||||
* 例如北京时间:2018-07-26T15:00:00+08:00
|
||||
*/
|
||||
@Schema(description = "预计离开时间范围-结束", example = "2018-07-26T15:00:00+08:00")
|
||||
private String visitEndTimeEnd;
|
||||
|
||||
/**
|
||||
* 页码(必填)
|
||||
* pageNo要求大于0不超过2147483647
|
||||
*/
|
||||
@NotNull(message = "页码不能为空")
|
||||
@Min(value = 1, message = "页码必须大于0")
|
||||
@Max(value = 2147483647, message = "页码不能超过2147483647")
|
||||
@Schema(description = "页码", required = true)
|
||||
private Integer pageNo;
|
||||
|
||||
/**
|
||||
* 页大小(必填)
|
||||
* pageSize要求大于0且不超过1000
|
||||
*/
|
||||
@NotNull(message = "页大小不能为空")
|
||||
@Min(value = 1, message = "页大小必须大于0")
|
||||
@Max(value = 1000, message = "页大小不能超过1000")
|
||||
@Schema(description = "页大小", required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 访客验证码(可选)
|
||||
* 为访客管理组件提供,用于访客在访客机登记的凭证
|
||||
*/
|
||||
@Schema(description = "访客验证码")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 访客状态(可选)
|
||||
* 0:待审核(预约待审批)
|
||||
* 1:正常(预约成功或预约审批成功后<未登记>:当前时间未超过预计来访时间)
|
||||
* 2:迟到(预约成功或预约审批成功后<未登记>:当前时间超过预计来访时间,但未超过预计离开时间)
|
||||
* 3:失效(预约成功或预约审批成功后<未登记>:当前时间已超过预计离开时间)
|
||||
* 4:审核退回(预约待审批,审批人员审批退回)
|
||||
* 5:超期自动签离(超期未签离记录访客,由后台任务定时处理签离)
|
||||
* 6:已签离(访客签离)
|
||||
* 7:超期未签离(访客登记,当前时间已超过预计离开时间,还未进行签离)
|
||||
* 8:已到达(访客登记,当前时间未超过预计离开时间)
|
||||
* 9:审核失效(预约待审批,一直到当前时间超过预计离开时间,还未审批通过)
|
||||
* 10:邀约中(员工发起邀约,访客还未应邀)
|
||||
* 11:邀约失效(员工发起邀约,一直到当前时间超过预计离开时间,访客还未应邀)
|
||||
*/
|
||||
@Min(value = 0, message = "访客状态值无效")
|
||||
@Max(value = 11, message = "访客状态值无效")
|
||||
@Schema(description = "访客状态")
|
||||
private Integer visitorStatus;
|
||||
|
||||
/**
|
||||
* 访客二维码内容(可选)
|
||||
* 支持动态二维码或者静态二维码
|
||||
*/
|
||||
@Schema(description = "访客二维码内容")
|
||||
private String QRCode;
|
||||
|
||||
/**
|
||||
* 预约记录ID(可选)
|
||||
* 访客预约v2接口获取返回报文中的orderId字段
|
||||
*/
|
||||
@Schema(description = "预约记录ID")
|
||||
private String orderId;
|
||||
}
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
package com.bsd.pjcloud.thirdparty.dto.visitor.response.make;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询访客预约记录v2响应参数
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询访客预约记录v2响应参数")
|
||||
public class QueryAppointmentRecordsResponse {
|
||||
|
||||
/**
|
||||
* 返回码,0 – 成功,其他- 失败
|
||||
*/
|
||||
@Schema(description = "返回码,0 – 成功,其他- 失败")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 返回描述
|
||||
*/
|
||||
@Schema(description = "返回描述")
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 访客预约记录
|
||||
*/
|
||||
@Schema(description = "访客预约记录")
|
||||
private QueryRecordsData data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "访客预约记录数据")
|
||||
public static class QueryRecordsData {
|
||||
|
||||
/**
|
||||
* 记录总数
|
||||
*/
|
||||
@Schema(description = "记录总数")
|
||||
private Integer total;
|
||||
|
||||
/**
|
||||
* 页码
|
||||
*/
|
||||
@Schema(description = "页码")
|
||||
private Integer pageNo;
|
||||
|
||||
/**
|
||||
* 页大小
|
||||
*/
|
||||
@Schema(description = "页大小")
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 预约记录列表
|
||||
*/
|
||||
@Schema(description = "预约记录列表")
|
||||
private List<AppointmentRecord> list;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Schema(description = "预约记录详情")
|
||||
public static class AppointmentRecord {
|
||||
|
||||
/**
|
||||
* 预约记录ID,可作为修改预约的依据
|
||||
*/
|
||||
@Schema(description = "预约记录ID")
|
||||
private String appointRecordId;
|
||||
|
||||
/**
|
||||
* 被访人唯一标识
|
||||
*/
|
||||
@Schema(description = "被访人唯一标识")
|
||||
private String receptionistId;
|
||||
|
||||
/**
|
||||
* 被访人姓名
|
||||
*/
|
||||
@Schema(description = "被访人姓名")
|
||||
private String receptionistName;
|
||||
|
||||
/**
|
||||
* 被访人所属组织编码
|
||||
*/
|
||||
@Schema(description = "被访人所属组织编码")
|
||||
private String receptionistCode;
|
||||
|
||||
/**
|
||||
* 预计来访时间
|
||||
*/
|
||||
@Schema(description = "预计来访时间", example = "2018-07-26T15:00:00+08:00")
|
||||
private String visitStartTime;
|
||||
|
||||
/**
|
||||
* 预计离开时间
|
||||
*/
|
||||
@Schema(description = "预计离开时间", example = "2018-07-26T19:00:00+08:00")
|
||||
private String visitEndTime;
|
||||
|
||||
/**
|
||||
* 来访事由
|
||||
*/
|
||||
@Schema(description = "来访事由")
|
||||
private String visitPurpose;
|
||||
|
||||
/**
|
||||
* 访客姓名
|
||||
*/
|
||||
@Schema(description = "访客姓名")
|
||||
private String visitorName;
|
||||
|
||||
/**
|
||||
* 来访单位
|
||||
*/
|
||||
@Schema(description = "来访单位")
|
||||
private String visitorWorkUnit;
|
||||
|
||||
/**
|
||||
* 访客住址
|
||||
*/
|
||||
@Schema(description = "访客住址")
|
||||
private String visitorAddress;
|
||||
|
||||
/**
|
||||
* 访客Id
|
||||
*/
|
||||
@Schema(description = "访客Id")
|
||||
private String visitorId;
|
||||
|
||||
/**
|
||||
* 访客验证码
|
||||
*/
|
||||
@Schema(description = "访客验证码")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 动态二维码
|
||||
*/
|
||||
@Schema(description = "动态二维码")
|
||||
private String QRCode;
|
||||
|
||||
/**
|
||||
* 性别,1-男,2-女
|
||||
*/
|
||||
@Schema(description = "性别,1-男,2-女")
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Schema(description = "联系电话")
|
||||
private String phoneNo;
|
||||
|
||||
/**
|
||||
* 访客车牌号
|
||||
*/
|
||||
@Schema(description = "访客车牌号")
|
||||
private String plateNo;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
*/
|
||||
@Schema(description = "证件类型")
|
||||
private Integer certificateType;
|
||||
|
||||
/**
|
||||
* 证件号
|
||||
*/
|
||||
@Schema(description = "证件号")
|
||||
private String certificateNo;
|
||||
|
||||
/**
|
||||
* 图片的相对Uri
|
||||
*/
|
||||
@Schema(description = "图片的相对Uri")
|
||||
private String picUri;
|
||||
|
||||
/**
|
||||
* 图片服务器索引码
|
||||
*/
|
||||
@Schema(description = "图片服务器索引码")
|
||||
private String svrIndexCode;
|
||||
|
||||
/**
|
||||
* 访客状态
|
||||
*/
|
||||
@Schema(description = "访客状态")
|
||||
private Integer visitorStatus;
|
||||
|
||||
/**
|
||||
* 证件地址
|
||||
*/
|
||||
@Schema(description = "证件地址")
|
||||
private String certAddr;
|
||||
|
||||
/**
|
||||
* 发证机关
|
||||
*/
|
||||
@Schema(description = "发证机关")
|
||||
private String certIssuer;
|
||||
|
||||
/**
|
||||
* 民族
|
||||
*/
|
||||
@Schema(description = "民族")
|
||||
private Integer nation;
|
||||
|
||||
/**
|
||||
* 籍贯
|
||||
*/
|
||||
@Schema(description = "籍贯")
|
||||
private String birthplace;
|
||||
|
||||
/**
|
||||
* 访客记录唯一标识
|
||||
*/
|
||||
@Schema(description = "访客记录唯一标识")
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 权限下发指定的资源点集合
|
||||
*/
|
||||
@Schema(description = "权限下发指定的资源点集合")
|
||||
private DesignatedResources designatedResources;
|
||||
|
||||
/**
|
||||
* 权限组名称集合
|
||||
*/
|
||||
@Schema(description = "权限组名称集合")
|
||||
private List<String> privilegeGroupNames;
|
||||
|
||||
/**
|
||||
* 证件照相对URL
|
||||
*/
|
||||
@Schema(description = "证件照相对URL")
|
||||
private String identityUri;
|
||||
|
||||
/**
|
||||
* 证件照对应图片服务器serviceNodes
|
||||
*/
|
||||
@Schema(description = "证件照对应图片服务器serviceNodes")
|
||||
private String identitySvrCode;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Schema(description = "权限下发指定的资源点集合")
|
||||
public static class DesignatedResources {
|
||||
|
||||
/**
|
||||
* 参数类型
|
||||
* 门禁点1,梯控楼层2,门口机3,围墙机4,停车库5
|
||||
*/
|
||||
@Schema(description = "参数类型")
|
||||
private String paramKey;
|
||||
|
||||
/**
|
||||
* 设备的indexCode集合
|
||||
*/
|
||||
@Schema(description = "设备的indexCode集合")
|
||||
private List<String> paramValues;
|
||||
}
|
||||
}
|
||||
+17
@@ -4,10 +4,12 @@ package com.bsd.pjcloud.thirdparty.controller;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.VisitorObjectResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.CheckOutRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.QueryAppointmentRecordsRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.RegisterAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.VisitorAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.VisitorInfo;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.AppointmentData;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.QueryAppointmentRecordsResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.RegisterAppointmentResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.person.AddPersonRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.person.AddPersonResponse;
|
||||
@@ -78,6 +80,21 @@ public class VisitorController {
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询访客预约记录v2
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "查询访客预约记录v2", description = "根据查询条件查询预约记录")
|
||||
@PostMapping("/appointment/records")
|
||||
public R<QueryAppointmentRecordsResponse> queryAppointmentRecords(@Valid @RequestBody QueryAppointmentRecordsRequest request) {
|
||||
try {
|
||||
QueryAppointmentRecordsResponse response = visitorService.queryAppointmentRecords(request);
|
||||
return R.ok(response);
|
||||
} catch (Exception e) {
|
||||
return R.failed("查询访客预约记录失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
|
||||
+185
@@ -7,11 +7,13 @@ import com.bsd.pjcloud.thirdparty.config.HikvisionProperties;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.AppointmentInfo;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.VisitorObjectResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.CheckOutRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.QueryAppointmentRecordsRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.RegisterAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.request.make.VisitorAppointmentRequest;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.AppointmentData;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.CancelAppointmentResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.CheckOutResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.QueryAppointmentRecordsResponse;
|
||||
import com.bsd.pjcloud.thirdparty.dto.visitor.response.make.RegisterAppointmentResponse;
|
||||
import com.bsd.pjcloud.thirdparty.exception.HikvisionException;
|
||||
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
||||
@@ -1119,4 +1121,187 @@ public class VisitorService extends BaseHikvisionService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询访客预约记录v2
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public QueryAppointmentRecordsResponse queryAppointmentRecords(QueryAppointmentRecordsRequest request) {
|
||||
try {
|
||||
JSONObject body = convertQueryAppointmentRecordsRequestToJSON(request);
|
||||
String responseJson = sendPostRequest("visitor-appointment-records", body);
|
||||
|
||||
log.info("查询访客预约记录响应: {}", responseJson);
|
||||
|
||||
QueryAppointmentRecordsResponse response = parseQueryAppointmentRecordsResponse(responseJson);
|
||||
|
||||
// 检查响应码
|
||||
if (!"0".equals(response.getCode())) {
|
||||
log.error("查询访客预约记录失败,错误码: {}, 错误信息: {}", response.getCode(), response.getMsg());
|
||||
throw new ServiceException("查询访客预约记录失败: " + response.getMsg());
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("查询访客预约记录异常", e);
|
||||
if (e instanceof ServiceException) {
|
||||
throw e;
|
||||
}
|
||||
throw new ServiceException("查询访客预约记录失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换查询访客预约记录请求为JSON
|
||||
*/
|
||||
private JSONObject convertQueryAppointmentRecordsRequestToJSON(QueryAppointmentRecordsRequest request) {
|
||||
JSONObject json = new JSONObject();
|
||||
|
||||
// 添加所有可选参数,只有非空时才添加
|
||||
if (StringUtils.isNotBlank(request.getReceptionistId())) {
|
||||
json.put("receptionistId", request.getReceptionistId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getVisitorName())) {
|
||||
json.put("visitorName", request.getVisitorName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getPhoneNo())) {
|
||||
json.put("phoneNo", request.getPhoneNo());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getVisitStartTimeBegin())) {
|
||||
json.put("visitStartTimeBegin", request.getVisitStartTimeBegin());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getVisitStartTimeEnd())) {
|
||||
json.put("visitStartTimeEnd", request.getVisitStartTimeEnd());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getVisitEndTimeBegin())) {
|
||||
json.put("visitEndTimeBegin", request.getVisitEndTimeBegin());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getVisitEndTimeEnd())) {
|
||||
json.put("visitEndTimeEnd", request.getVisitEndTimeEnd());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getVerificationCode())) {
|
||||
json.put("verificationCode", request.getVerificationCode());
|
||||
}
|
||||
if (request.getVisitorStatus() != null) {
|
||||
json.put("visitorStatus", request.getVisitorStatus());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getQRCode())) {
|
||||
json.put("QRCode", request.getQRCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getOrderId())) {
|
||||
json.put("orderId", request.getOrderId());
|
||||
}
|
||||
|
||||
// 必填参数
|
||||
json.put("pageNo", request.getPageNo());
|
||||
json.put("pageSize", request.getPageSize());
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析查询访客预约记录响应
|
||||
*/
|
||||
private QueryAppointmentRecordsResponse parseQueryAppointmentRecordsResponse(String json) {
|
||||
try {
|
||||
JSONObject jsonObject = JSON.parseObject(json);
|
||||
|
||||
QueryAppointmentRecordsResponse response = new QueryAppointmentRecordsResponse();
|
||||
response.setCode(jsonObject.getString("code"));
|
||||
response.setMsg(jsonObject.getString("msg"));
|
||||
|
||||
// 解析data部分
|
||||
JSONObject dataObj = jsonObject.getJSONObject("data");
|
||||
if (dataObj != null) {
|
||||
QueryAppointmentRecordsResponse.QueryRecordsData data = new QueryAppointmentRecordsResponse.QueryRecordsData();
|
||||
data.setTotal(dataObj.getInteger("total"));
|
||||
data.setPageNo(dataObj.getInteger("pageNo"));
|
||||
data.setPageSize(dataObj.getInteger("pageSize"));
|
||||
|
||||
// 解析预约记录列表
|
||||
JSONArray listArray = dataObj.getJSONArray("list");
|
||||
if (listArray != null) {
|
||||
List<QueryAppointmentRecordsResponse.AppointmentRecord> records = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < listArray.size(); i++) {
|
||||
JSONObject recordObj = listArray.getJSONObject(i);
|
||||
QueryAppointmentRecordsResponse.AppointmentRecord record = new QueryAppointmentRecordsResponse.AppointmentRecord();
|
||||
|
||||
// 映射所有字段
|
||||
record.setAppointRecordId(recordObj.getString("appointRecordId"));
|
||||
record.setReceptionistId(recordObj.getString("receptionistId"));
|
||||
record.setReceptionistName(recordObj.getString("receptionistName"));
|
||||
record.setReceptionistCode(recordObj.getString("receptionistCode"));
|
||||
record.setVisitStartTime(recordObj.getString("visitStartTime"));
|
||||
record.setVisitEndTime(recordObj.getString("visitEndTime"));
|
||||
record.setVisitPurpose(recordObj.getString("visitPurpose"));
|
||||
record.setVisitorName(recordObj.getString("visitorName"));
|
||||
record.setVisitorWorkUnit(recordObj.getString("visitorWorkUnit"));
|
||||
record.setVisitorAddress(recordObj.getString("visitorAddress"));
|
||||
record.setVisitorId(recordObj.getString("visitorId"));
|
||||
record.setVerificationCode(recordObj.getString("verificationCode"));
|
||||
record.setQRCode(recordObj.getString("QRCode"));
|
||||
record.setGender(recordObj.getInteger("gender"));
|
||||
record.setPhoneNo(recordObj.getString("phoneNo"));
|
||||
record.setPlateNo(recordObj.getString("plateNo"));
|
||||
record.setCertificateType(recordObj.getInteger("certificateType"));
|
||||
record.setCertificateNo(recordObj.getString("certificateNo"));
|
||||
record.setPicUri(recordObj.getString("picUri"));
|
||||
record.setSvrIndexCode(recordObj.getString("svrIndexCode"));
|
||||
record.setVisitorStatus(recordObj.getInteger("visitorStatus"));
|
||||
record.setCertAddr(recordObj.getString("certAddr"));
|
||||
record.setCertIssuer(recordObj.getString("certIssuer"));
|
||||
record.setNation(recordObj.getInteger("nation"));
|
||||
record.setBirthplace(recordObj.getString("birthplace"));
|
||||
record.setOrderId(recordObj.getString("orderId"));
|
||||
record.setIdentityUri(recordObj.getString("identityUri"));
|
||||
record.setIdentitySvrCode(recordObj.getString("identitySvrCode"));
|
||||
|
||||
// 解析权限下发指定的资源点集合
|
||||
JSONObject designatedResourcesObj = recordObj.getJSONObject("designatedResources");
|
||||
if (designatedResourcesObj != null) {
|
||||
QueryAppointmentRecordsResponse.DesignatedResources designatedResources = new QueryAppointmentRecordsResponse.DesignatedResources();
|
||||
designatedResources.setParamKey(designatedResourcesObj.getString("paramKey"));
|
||||
|
||||
JSONArray paramValuesArray = designatedResourcesObj.getJSONArray("paramValues");
|
||||
if (paramValuesArray != null) {
|
||||
List<String> paramValues = new ArrayList<>();
|
||||
for (int j = 0; j < paramValuesArray.size(); j++) {
|
||||
paramValues.add(paramValuesArray.getString(j));
|
||||
}
|
||||
designatedResources.setParamValues(paramValues);
|
||||
}
|
||||
|
||||
record.setDesignatedResources(designatedResources);
|
||||
}
|
||||
|
||||
// 解析权限组名称集合
|
||||
JSONArray privilegeGroupNamesArray = recordObj.getJSONArray("privilegeGroupNames");
|
||||
if (privilegeGroupNamesArray != null) {
|
||||
List<String> privilegeGroupNames = new ArrayList<>();
|
||||
for (int j = 0; j < privilegeGroupNamesArray.size(); j++) {
|
||||
privilegeGroupNames.add(privilegeGroupNamesArray.getString(j));
|
||||
}
|
||||
record.setPrivilegeGroupNames(privilegeGroupNames);
|
||||
}
|
||||
|
||||
records.add(record);
|
||||
}
|
||||
|
||||
data.setList(records);
|
||||
}
|
||||
|
||||
response.setData(data);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
} catch (JSONException e) {
|
||||
log.error("解析查询访客预约记录响应JSON失败: {}", json, e);
|
||||
throw new ServiceException("查询访客预约记录响应解析失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -132,6 +132,7 @@ hikvision:
|
||||
apis:
|
||||
person-list: /api/resource/v2/person/personList # 新增人员列表接口
|
||||
visitor-appointment: /api/visitor/v2/appointment # 新增访客预约接口
|
||||
visitor-appointment-records: /api/visitor/v2/appointment/records # 查询访客预约记录v2接口
|
||||
person-detail: /api/resource/v1/person/condition/personInfo # 新增人员详情接口
|
||||
cancel-appointment: /api/visitor/v1/appointment/cancel # 新增取消预约接口
|
||||
register-appointment: /api/visitor/v1/order/register # 新增登记接口
|
||||
|
||||
Reference in new issue
Block a user