feat:智能柜流程修改
This commit is contained in:
1 parent
c1485e7058
commit
a0b620d7db
9 files changed
+111
-30
No files matched your search
@@ -82,19 +82,29 @@ CREATE TABLE hard_door_flow
|
||||
biz_type varchar(32) NOT NULL COMMENT '业务类型',
|
||||
order_id bigint DEFAULT NULL COMMENT '订单编号',
|
||||
auth_id bigint DEFAULT NULL COMMENT '授权编号',
|
||||
open_event_id varchar(32) DEFAULT NULL COMMENT '开门事件编号',
|
||||
open_out_open_no varchar(32) DEFAULT NULL COMMENT '商户自定义开门请求号',
|
||||
# 请求开门
|
||||
request_open_dto varchar(512) DEFAULT NULL COMMENT '请求开门参数',
|
||||
request_open_vo varchar(512) DEFAULT NULL COMMENT '请求开门返回',
|
||||
request_open_time datetime DEFAULT NULL COMMENT '请求开门时间',
|
||||
open_callback_res varchar(512) DEFAULT NULL COMMENT '开门回调结果',
|
||||
# 请求开门回调
|
||||
is_open varchar(32) DEFAULT NULL COMMENT '是否开门',
|
||||
open_callback_time datetime DEFAULT NULL COMMENT '开门回调时间',
|
||||
video_callback_res varchar(512) DEFAULT NULL COMMENT '视频回调结果',
|
||||
open_callback_vo varchar(512) DEFAULT NULL COMMENT '开门回调结果',
|
||||
# 视频回调
|
||||
video_callback_vo varchar(512) DEFAULT NULL COMMENT '视频回调结果',
|
||||
video_callback_time datetime DEFAULT NULL COMMENT '视频回调时间',
|
||||
sku_ks_recog_id varchar(32) DEFAULT NULL COMMENT '识别任务唯一ID,用于结果获取,重新发起售后识别',
|
||||
# sku识别
|
||||
sku_submit_dto varchar(512) DEFAULT NULL COMMENT 'sku识别提交参数',
|
||||
sku_submit_vo varchar(512) DEFAULT NULL COMMENT 'sku识别提交结果',
|
||||
sku_submit_time datetime DEFAULT NULL COMMENT 'sku识别提交时间',
|
||||
sku_callback_res varchar(512) DEFAULT NULL COMMENT 'sku识别回调结果',
|
||||
# sku识别回调
|
||||
sku_callback_vo varchar(512) DEFAULT NULL COMMENT 'sku识别回调结果',
|
||||
sku_callback_time datetime DEFAULT NULL COMMENT 'sku识别回调时间',
|
||||
sku_driving_res varchar(512) DEFAULT NULL COMMENT 'sku识别主动获取结果',
|
||||
# sku主动获取
|
||||
sku_driving_dto varchar(512) DEFAULT NULL COMMENT 'sku识别主动获取参数',
|
||||
sku_driving_vo varchar(512) DEFAULT NULL COMMENT 'sku识别主动获取结果',
|
||||
sku_driving_time datetime DEFAULT NULL COMMENT 'sku识别主动获取时间',
|
||||
# 其他字段
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.hard.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 开门类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardDoorOpenTypeEnum {
|
||||
RECORD_VIDEO("1", "录制视频"),
|
||||
NO_RECORD_VIDEO("4", "不录制视频"),
|
||||
MAINTENANCE_UNLOCK("5", "检修开锁"),
|
||||
MAINTENANCE_LOCK("6", "检修关锁");;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static HardDoorOpenTypeEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.constant.HardDoorFlowEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardDoorOpenTypeEnum;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -20,10 +21,15 @@ public class HardDoorFlowOpenDto {
|
||||
@NotEmpty(message = "货柜编号不能为空")
|
||||
private String cabinetNo;
|
||||
|
||||
/**
|
||||
* 流程类型
|
||||
*/
|
||||
private HardDoorFlowEnum flowType;
|
||||
|
||||
/**
|
||||
* 开门操作类型
|
||||
*/
|
||||
private HardDoorFlowEnum type;
|
||||
private HardDoorOpenTypeEnum openType;
|
||||
|
||||
/**
|
||||
* 开门用户id
|
||||
|
||||
+33
-16
@@ -24,7 +24,6 @@ import java.time.LocalDateTime;
|
||||
@Schema(description = "智能柜流程")
|
||||
public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@@ -57,16 +56,16 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
private Long authId;
|
||||
|
||||
/**
|
||||
* 开门事件编号
|
||||
* 请求开门参数
|
||||
*/
|
||||
@Schema(description = "开门事件编号")
|
||||
private String openEventId;
|
||||
@Schema(description = "请求开门参数")
|
||||
private String requestOpenDto;
|
||||
|
||||
/**
|
||||
* 商户自定义开门请求号
|
||||
* 请求开门返回
|
||||
*/
|
||||
@Schema(description = "商户自定义开门请求号")
|
||||
private String openOutOpenNo;
|
||||
@Schema(description = "请求开门返回")
|
||||
private String requestOpenVo;
|
||||
|
||||
/**
|
||||
* 请求开门时间
|
||||
@@ -75,10 +74,10 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
private LocalDateTime requestOpenTime;
|
||||
|
||||
/**
|
||||
* 开门回调结果
|
||||
* 是否开门
|
||||
*/
|
||||
@Schema(description = "开门回调结果")
|
||||
private String openCallbackRes;
|
||||
@Schema(description = "是否开门")
|
||||
private String isOpen;
|
||||
|
||||
/**
|
||||
* 开门回调时间
|
||||
@@ -86,11 +85,17 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
@Schema(description = "开门回调时间")
|
||||
private LocalDateTime openCallbackTime;
|
||||
|
||||
/**
|
||||
* 开门回调结果
|
||||
*/
|
||||
@Schema(description = "开门回调结果")
|
||||
private String openCallbackVo;
|
||||
|
||||
/**
|
||||
* 视频回调结果
|
||||
*/
|
||||
@Schema(description = "视频回调结果")
|
||||
private String videoCallbackRes;
|
||||
private String videoCallbackVo;
|
||||
|
||||
/**
|
||||
* 视频回调时间
|
||||
@@ -99,10 +104,16 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
private LocalDateTime videoCallbackTime;
|
||||
|
||||
/**
|
||||
* 识别任务唯一ID,用于结果获取,重新发起售后识别
|
||||
* sku识别提交参数
|
||||
*/
|
||||
@Schema(description = "识别任务唯一ID,用于结果获取,重新发起售后识别")
|
||||
private String skuKsRecogId;
|
||||
@Schema(description = "sku识别提交参数")
|
||||
private String skuSubmitDto;
|
||||
|
||||
/**
|
||||
* sku识别提交结果
|
||||
*/
|
||||
@Schema(description = "sku识别提交结果")
|
||||
private String skuSubmitVo;
|
||||
|
||||
/**
|
||||
* sku识别提交时间
|
||||
@@ -114,7 +125,7 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
* sku识别回调结果
|
||||
*/
|
||||
@Schema(description = "sku识别回调结果")
|
||||
private String skuCallbackRes;
|
||||
private String skuCallbackVo;
|
||||
|
||||
/**
|
||||
* sku识别回调时间
|
||||
@@ -122,11 +133,17 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
@Schema(description = "sku识别回调时间")
|
||||
private LocalDateTime skuCallbackTime;
|
||||
|
||||
/**
|
||||
* sku识别主动获取参数
|
||||
*/
|
||||
@Schema(description = "sku识别主动获取参数")
|
||||
private String skuDrivingDto;
|
||||
|
||||
/**
|
||||
* sku识别主动获取结果
|
||||
*/
|
||||
@Schema(description = "sku识别主动获取结果")
|
||||
private String skuDrivingRes;
|
||||
private String skuDrivingVo;
|
||||
|
||||
/**
|
||||
* sku识别主动获取时间
|
||||
|
||||
+3
-1
@@ -10,6 +10,7 @@ import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardDoorFlowEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardDoorOpenTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
|
||||
@@ -48,7 +49,8 @@ public class HardDoorFlowController {
|
||||
@PostMapping("/open-access")
|
||||
public R openAccess(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setType(HardDoorFlowEnum.ACCESS_OPEN);
|
||||
dto.setFlowType(HardDoorFlowEnum.ACCESS_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.MAINTENANCE_UNLOCK);
|
||||
dto.setUserId(user.getId());
|
||||
hardDoorFlowService.openDoorAccess(dto);
|
||||
return R.ok();
|
||||
|
||||
+6
-2
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
@@ -43,16 +44,19 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void openDoor(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorVo) {
|
||||
HardDoorFlowEntity saveObj = HardDoorFlowEntity.builder().userId(dto.getUserId()).bizType(dto.getType().getType()).build();
|
||||
HardDoorFlowEntity saveObj = HardDoorFlowEntity.builder().userId(dto.getUserId()).bizType(dto.getFlowType().getType()).isOpen(YesNoEnum.NO.getCode()).build();
|
||||
baseMapper.insert(saveObj);
|
||||
// 请求开门
|
||||
DoorOpenDto openDto = BeanUtil.toBean(dto, DoorOpenDto.class);
|
||||
openDto.setOutOpenNo(hardDoorVo.getDeviceCode());
|
||||
openDto.setOutOpenNo(dto.getCabinetNo());
|
||||
openDto.setDeviceCode(String.valueOf(saveObj.getId()));
|
||||
openDto.setEventType(Integer.valueOf(dto.getOpenType().getType()));
|
||||
DoorOpenVo openVo = thirdDoorApiService.open(openDto).getData();
|
||||
if (ObjectUtil.isEmpty(openVo) || !openVo.isSuccess()) throw new RuntimeException("开门失败");
|
||||
HardDoorFlowEntity updateObj = HardDoorFlowEntity.builder().id(saveObj.getId()).openEventId(openVo.getEventId()).openOutOpenNo(openVo.getOutOpenNo()).requestOpenTime(LocalDateTime.now()).build();
|
||||
HardDoorFlowEntity updateObj = HardDoorFlowEntity.builder().id(saveObj.getId()).requestOpenDto(JSONUtil.toJsonStr(openDto)).requestOpenVo(JSONUtil.toJsonStr(openVo)).requestOpenTime(LocalDateTime.now()).build();
|
||||
// 是否开门成功
|
||||
updateObj.setIsOpen(YesNoEnum.YES.getCode());
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -15,5 +15,18 @@ public class DoorConfig {
|
||||
|
||||
private String appKey;
|
||||
|
||||
private String selfBaseUrl;
|
||||
/**
|
||||
* 回调基础url
|
||||
*/
|
||||
private String callbackBaseUrl;
|
||||
|
||||
/**
|
||||
* 开锁回调url
|
||||
*/
|
||||
private String callbackLockUrl;
|
||||
|
||||
/**
|
||||
* 视频回调url
|
||||
*/
|
||||
private String callbackVideoUrl;
|
||||
}
|
||||
+2
@@ -212,6 +212,8 @@ public class ThirdDoorApiServiceImpl implements ThirdDoorApiService {
|
||||
ThirdDoorLogEntity logEntity = api.getInitLogEntity();
|
||||
logEntity.setReq(JSONUtil.toJsonStr(dto));
|
||||
try {
|
||||
dto.setLockNotifyUrl(doorConfig.getCallbackBaseUrl() + doorConfig.getCallbackLockUrl());
|
||||
dto.setVideoNotifyUrl(doorConfig.getCallbackBaseUrl() + doorConfig.getCallbackVideoUrl());
|
||||
String body = JSONUtil.toJsonStr(dto);
|
||||
String res = api.getHttpRequest().header(apiCountersign(body)).body(body).execute().body();
|
||||
if (ObjectUtil.isEmpty(res)) throw new RuntimeException("response响应为空");
|
||||
|
||||
+3
-2
@@ -75,8 +75,9 @@ door:
|
||||
base-url: https://www.365e-life.net:8443/bkopenapi
|
||||
app-id: 2025040991646569
|
||||
app-key: 2800650617d44e0d8b31ad5287431179
|
||||
|
||||
self-base-url:
|
||||
callback-base-url: http://h1yzkslmyx.ny.takin.cc
|
||||
callback-lock-url: /third/third-door/callback/open
|
||||
callback-video-url: /third/third-door/callback/video
|
||||
|
||||
# 旷世识别
|
||||
ks-discern:
|
||||
|
||||
Reference in new issue
Block a user