feat:购买流程

This commit is contained in:
dzc committed 2025-04-17 14:25:38 +08:00
1 parent e684fe6bb1
commit 796985f3c6
7 files changed
+120 -12

No files matched your search

@@ -0,0 +1,9 @@
package com.bsd.pjcloud.hard.api.dto;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import lombok.Data;
@Data
public class HardDoorFlowDto extends HardDoorFlowEntity {
}
@@ -1,8 +1,36 @@
package com.bsd.pjcloud.hard.api.vo;
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
import lombok.Data;
import java.util.List;
@Data
public class HardDoorFlowVo extends HardDoorFlowEntity {
public class HardDoorFlowVo extends HardDoorFlowEntity implements BaseHardInterface, BaseUserDeptInterface {
/**
* 设备相关
*/
private String hardName;
private String hardType;
private List<String> hardTypeCodes;
/**
* 用户相关
*/
private String username;
private String userMobile;
private String userAvatar;
private Long userDeptId;
private String userDeptName;
}
@@ -2,16 +2,17 @@ package com.bsd.pjcloud.hard.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
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.HardDoorFlowDto;
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
@@ -31,7 +32,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 智能柜流程
@@ -114,12 +114,12 @@ public class HardDoorFlowController {
return R.ok();
}
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@Operation(summary = "复杂查询", description = "复杂查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')")
public R getHardDoorFlowPage(@ParameterObject Page page, @ParameterObject HardDoorFlowEntity hardDoorFlow) {
LambdaQueryWrapper<HardDoorFlowEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(hardDoorFlowService.page(page, wrapper));
public R pageJoin(@ParameterObject Page page, @ParameterObject HardDoorFlowDto dto) {
DataScope dataScope = null;
return R.ok(hardDoorFlowService.scopePageJoin(page, dto, dataScope));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@@ -1,11 +1,29 @@
package com.bsd.pjcloud.hard.mapper;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface HardDoorFlowMapper extends PjcloudBaseMapper<HardDoorFlowEntity> {
default Page<HardDoorFlowVo> scopePageJoin(Page page, HardDoorFlowDto dto, DataScope dataScope) {
MPJLambdaQueryWrapper<HardDoorFlowEntity> wrapper = new MPJLambdaQueryWrapper<HardDoorFlowEntity>()
.selectAll(HardDoorFlowEntity.class)
.eq(ObjectUtil.isNotEmpty(dto.getUserId()), HardDoorFlowEntity::getUserId, dto.getUserId())
.eq(ObjectUtil.isNotEmpty(dto.getBizType()), HardDoorFlowEntity::getBizType, dto.getBizType())
.eq(ObjectUtil.isNotEmpty(dto.getHardDoorId()), HardDoorFlowEntity::getHardDoorId, dto.getHardDoorId())
.eq(ObjectUtil.isNotEmpty(dto.getCabinetNo()), HardDoorFlowEntity::getCabinetNo, dto.getCabinetNo())
.eq(ObjectUtil.isNotEmpty(dto.getOrderId()), HardDoorFlowEntity::getOrderId, dto.getOrderId())
.eq(ObjectUtil.isNotEmpty(dto.getIsOpen()), HardDoorFlowEntity::getIsOpen, dto.getIsOpen());
return selectJoinPage(page, HardDoorFlowVo.class, wrapper);
}
}
@@ -1,17 +1,24 @@
package com.bsd.pjcloud.hard.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
import com.bsd.pjcloud.thirdparty.dto.door.DoorOpenCallbackDto;
import com.bsd.pjcloud.thirdparty.dto.door.DoorStatusCallbackDto;
import com.bsd.pjcloud.thirdparty.dto.door.DoorStatusDto;
import com.bsd.pjcloud.thirdparty.dto.door.DoorVideoCallbackDto;
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
/**
* 复杂查询
*/
Page<HardDoorFlowVo> scopePageJoin(Page page, HardDoorFlowDto dto, DataScope dataScope);
/**
* 检修开门
@@ -99,7 +99,7 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
// 查询设备信息
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardId(authEntity.getHardId());
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("授权信息不存在");
HardAuthEntity updateObj = HardAuthEntity.builder().id(dto.getAuthId()).authType(dto.getAuthStatus()).authTime(LocalDateTime.now()).build();
HardAuthEntity updateObj = HardAuthEntity.builder().id(dto.getAuthId()).authStatus(dto.getAuthStatus()).authTime(LocalDateTime.now()).build();
baseMapper.updateById(updateObj);
if (ObjectUtil.equals(dto.getAuthStatus(), YesNoEnum.YES.getCode())) {
// 开门
@@ -6,21 +6,33 @@ import cn.hutool.core.util.RandomUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.admin.api.vo.UserVO;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.hard.api.constant.HardDoorFlowEnum;
import com.bsd.pjcloud.hard.api.constant.HardDoorOpenTypeEnum;
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
import com.bsd.pjcloud.hard.api.utils.HardUtil;
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuJoinVo;
import com.bsd.pjcloud.hard.mapper.HardAuthMapper;
import com.bsd.pjcloud.hard.mapper.HardDoorFlowMapper;
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
import com.bsd.pjcloud.hard.service.*;
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdDoorApiService;
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdKsService;
@@ -58,9 +70,21 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
private final HardOrderService hardOrderService;
private final HardAuthMapper hardAuthMapper;
private final HardManagerMapper hardManagerMapper;
private final RemoterThirdDoorApiService thirdDoorApiService;
private final RemoterThirdKsService thirdKsService;
private final RemoteUserService remoteUserService;
/**
* 复杂查询
*/
@Override
public Page<HardDoorFlowVo> scopePageJoin(Page page, HardDoorFlowDto dto, DataScope dataScope) {
Page<HardDoorFlowVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
disposeList(pageList.getRecords(), dto);
return pageList;
}
/**
* 根据旷世识别id查询
@@ -325,6 +349,28 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
}
}
private void disposeList(List<HardDoorFlowVo> list, HardDoorFlowDto dto) {
if (ObjectUtil.isEmpty(list)) return;
// 设备
List<Long> hardIds = list.stream().map(HardDoorFlowVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(hardIds)) {
HardManagerDto hardManagerDto = new HardManagerDto();
hardManagerDto.setIds(hardIds);
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
if (ObjectUtil.isNotEmpty(hardList)) {
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
}
}
// 用户相关
List<Long> userIds = list.stream().map(HardDoorFlowVo::getUserId).distinct().toList();
if (ObjectUtil.isNotEmpty(userIds)) {
R<List<UserVO>> userList = remoteUserService.getUserDeptByIds(new ArrayList<>(userIds));
if (ObjectUtil.isNotEmpty(userList.getData())) {
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList.getData(), UserVO::getUserId));
}
}
}
private HardDoorFlowServiceImpl getSelf() {
return SpringUtil.getBean(getClass());
}