feat:检修关门
This commit is contained in:
1 parent
a0b620d7db
commit
c73dd6a583
3 files changed
+36
-5
No files matched your search
+11
@@ -56,6 +56,17 @@ public class HardDoorFlowController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "检修关门", description = "检修关门")
|
||||
@PostMapping("/close-access")
|
||||
public R closeAccess(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setFlowType(HardDoorFlowEnum.ACCESS_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.MAINTENANCE_LOCK);
|
||||
dto.setUserId(user.getId());
|
||||
hardDoorFlowService.closeAccess(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')")
|
||||
|
||||
+4
-4
@@ -7,16 +7,16 @@ import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
|
||||
public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
|
||||
|
||||
/**
|
||||
* 开门
|
||||
*/
|
||||
void openDoor(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorVo);
|
||||
|
||||
/**
|
||||
* 检修开门
|
||||
*/
|
||||
void openDoorAccess(HardDoorFlowOpenDto dto);
|
||||
|
||||
/**
|
||||
* 检修关门
|
||||
*/
|
||||
void closeAccess(HardDoorFlowOpenDto dto);
|
||||
|
||||
/**
|
||||
* 购买开门
|
||||
|
||||
+21
-1
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -41,7 +42,6 @@ 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.getFlowType().getType()).isOpen(YesNoEnum.NO.getCode()).build();
|
||||
@@ -60,6 +60,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检修开门
|
||||
*/
|
||||
@@ -71,6 +72,25 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
getSelf().openDoor(dto, doorDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检修关门
|
||||
*/
|
||||
@Override
|
||||
public void closeAccess(HardDoorFlowOpenDto dto) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
// 请求关门
|
||||
DoorOpenDto openDto = BeanUtil.toBean(dto, DoorOpenDto.class);
|
||||
openDto.setOutOpenNo(doorDetail.getDeviceCode());
|
||||
openDto.setOutOpenNo(dto.getCabinetNo());
|
||||
openDto.setDeviceCode(RandomUtil.randomString(32));
|
||||
openDto.setEventType(Integer.valueOf(dto.getOpenType().getType()));
|
||||
DoorOpenVo openVo = thirdDoorApiService.open(openDto).getData();
|
||||
if (ObjectUtil.isEmpty(openVo) || !openVo.isSuccess()) {
|
||||
throw new RuntimeException("关门失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买开门
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user