fix:适配双门智能柜

This commit is contained in:
dzc committed 2025-04-18 16:52:00 +08:00
1 parent 85a2d734d8
commit 76ee59386a
8 files changed
+46 -13

No files matched your search

@@ -81,7 +81,7 @@ public class HardDoorManagerController {
hardDoorManagerService.changeVolume(dto);
return R.ok();
}
@Operation(summary = "柜门下拉查询", description = "柜门下拉查询")
@GetMapping("/select-cabinet")
public R<Page<HardDoorCabinetVo>> selectCabinet(@ParameterObject Page page, @ParameterObject HardDoorCabinetDto dto) {
@@ -115,7 +115,7 @@ public class HardDoorManagerController {
@GetMapping("/get-by-hard-id")
@PreAuthorize("@pms.hasPermission('hard_hardDoorManager_view')")
public R<HardDoorManagerVo> getByHardId(@RequestParam Long hardId) {
return R.ok(hardDoorManagerService.getByHardDoorId(hardId));
return R.ok(hardDoorManagerService.getByHardId(hardId));
}
@Operation(summary = "通过id删除智能柜设置", description = "通过id删除智能柜设置")
@@ -14,5 +14,7 @@ public interface HardDoorManagerMapper extends PjcloudBaseMapper<HardDoorManager
Page<HardDoorManagerVo> scopePageJoin(Page page, @Param("dto") HardDoorManagerDto dto, DataScope dataScope);
HardDoorManagerVo pageJoin(@Param("hardId") Long hardId);
HardDoorManagerVo pageJoinByHardDoorId(@Param("hardDoorId") Long hardDoorId);
HardDoorManagerVo pageJoinByHardId(@Param("hardId") Long hardId);
}
@@ -14,15 +14,20 @@ public interface HardDoorManagerService extends IService<HardDoorManagerEntity>
Page<HardDoorManagerVo> scopePageJoin(Page page, HardDoorManagerDto dto, DataScope dataScope);
/**
/**
* 柜门下拉查询
*/
Page<HardDoorCabinetVo> selectCabinet(Page page, HardDoorCabinetDto dto);
/**
* 根据智能硬件id查询详情
*/
HardDoorManagerVo getByHardDoorId(Long hardDoorId);
/**
* 根据硬件id查询详情
*/
HardDoorManagerVo getByHardDoorId(Long hardId);
HardDoorManagerVo getByHardId(Long hardId);
/**
* 根据硬件设备编号查询详情
@@ -44,7 +44,7 @@ public interface HardSpuService extends IService<HardSpuEntity> {
/**
* 根据 hardwareId 和 cabinetNo 查询商品
*/
List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long hardId, String cabinetNo);
List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long Long, String cabinetNo);
/**
* 查询货柜补货商品列表
@@ -98,7 +98,7 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
HardAuthEntity authEntity = baseMapper.selectById(dto.getAuthId());
if (ObjectUtil.isEmpty(authEntity)) throw new RuntimeException("授权信息不存在");
// 查询设备信息
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardDoorId(authEntity.getHardId());
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardId(authEntity.getHardId());
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("授权信息不存在");
HardAuthEntity updateObj = HardAuthEntity.builder().id(dto.getAuthId()).authStatus(dto.getAuthStatus()).authTime(LocalDateTime.now()).build();
baseMapper.updateById(updateObj);
@@ -70,8 +70,23 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
* 根据硬件id查询详情
*/
@Override
public HardDoorManagerVo getByHardDoorId(Long hardId) {
HardDoorManagerVo hardDoor = baseMapper.pageJoin(hardId);
public HardDoorManagerVo getByHardDoorId(Long hardDoorId) {
HardDoorManagerVo hardDoor = baseMapper.pageJoinByHardDoorId(hardDoorId);
if (ObjectUtil.isNotEmpty(hardDoor)) {
List<HardDoorCabinetEntity> cabinetList = hardDoorCabinetService.getListByHardDoorId(hardDoor.getId());
if (ObjectUtil.isNotEmpty(cabinetList)) {
hardDoor.setCabinetList(cabinetList);
}
}
return hardDoor;
}
/**
* 根据硬件id查询详情
*/
@Override
public HardDoorManagerVo getByHardId(Long hardId) {
HardDoorManagerVo hardDoor = baseMapper.pageJoinByHardId(hardId);
if (ObjectUtil.isNotEmpty(hardDoor)) {
List<HardDoorCabinetEntity> cabinetList = hardDoorCabinetService.getListByHardDoorId(hardDoor.getId());
if (ObjectUtil.isNotEmpty(cabinetList)) {
@@ -122,9 +122,9 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
public List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long hardId, String cabinetNo) {
List<Map<Integer, List<HardSpuJoinVo>>> result = new LinkedList<>();
// 查询设备
HardDoorManagerVo doorManagerVo = hardDoorManagerService.getByHardDoorId(hardId);
HardDoorManagerVo doorManagerVo = hardDoorManagerService.getByHardId(hardId);
if (ObjectUtil.isEmpty(doorManagerVo)) return result;
int doorCount = 6;
int doorCount = 5;
int storeySpuMaxCount = 10;
if (ObjectUtil.isNotEmpty(doorCount)) {
doorCount = doorManagerVo.getDoorCount().intValue();
@@ -184,7 +184,11 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
// 校验商品
HardSpuEntity spuDetail = validateSpu(dto.getHardSpuId());
// 判断这一层是否重复
long doorCount = hardSpuJoinService.count(new LambdaUpdateWrapper<HardSpuJoinEntity>().eq(HardSpuJoinEntity::getSpuId, spuDetail.getId()));
long doorCount = hardSpuJoinService.count(new LambdaUpdateWrapper<HardSpuJoinEntity>()
.eq(HardSpuJoinEntity::getHardDoorId, spuJoinDetail.getHardDoorId())
.eq(HardSpuJoinEntity::getCabinetNo, spuJoinDetail.getCabinetNo())
.eq(HardSpuJoinEntity::getSpuId, spuDetail.getId())
);
if (doorCount > 0) throw new RuntimeException("该货柜已有相同商品");
LambdaUpdateWrapper<HardSpuJoinEntity> updateObj = new LambdaUpdateWrapper<HardSpuJoinEntity>()
.set(HardSpuJoinEntity::getSpuId, spuDetail.getId())
@@ -94,7 +94,14 @@
order by a.create_time desc , a.id desc
</select>
<select id="pageJoin" resultType="com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo">
<select id="pageJoinByHardDoorId" resultType="com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo">
<include refid="selectPage"/>
<where>
a.id = #{hardDoorId}
</where>
</select>
<select id="pageJoinByHardId" resultType="com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo">
<include refid="selectPage"/>
<where>
a.hard_id = #{hardId}