feat:智能柜流程修改

This commit is contained in:
dzc committed 2025-04-14 19:12:34 +08:00
1 parent c1485e7058
commit a0b620d7db
9 files changed
+111 -30

No files matched your search

@@ -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();
}
}
@@ -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
@@ -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识别主动获取时间
@@ -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();
@@ -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);
}