From 137e9fb1f28d213d2608c12e17ece1dd57cec452 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 26 九月 2024 11:50:02 +0800
Subject: [PATCH] update
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
index c6cf8dc..7a56e68 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java
@@ -2,7 +2,6 @@
import cn.lihu.jh.framework.common.util.exception.ExceptionUtils;
import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO;
-import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
import cn.lihu.jh.module.ecg.service.devmanage.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -46,6 +45,19 @@
@Resource
private DeviceService deviceService;
+
+ @PostMapping("/dev-ready")
+ @Operation(summary = "璁惧鍑嗗")
+ @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+ public CommonResult<Long> devReady(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
+ try {
+ return devRentService.readyOperation(createReqVO);
+ } catch ( RuntimeException runtimeException ) {
+ String err = ExceptionUtils.formatException( runtimeException );
+ log.error("devInstall: " + err);
+ return CommonResult.error(DEV_INSTALL_EXCEPTION);
+ }
+ }
@PostMapping("/dev-install")
@Operation(summary = "瑁呮満")
@@ -130,7 +142,16 @@
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<DevRentRespVO> getDevRent(@RequestParam("id") Long id) {
DevRentDO devRent = devRentService.getDevRent(id);
- return CommonResult.success(BeanUtils.toBean(devRent, DevRentRespVO.class));
+
+ DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class);
+
+ DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() );
+ if (null != deviceDO) {
+ devRentRespVO.setCategory(deviceDO.getCategory());
+ devRentRespVO.setBrand(deviceDO.getBrand());
+ devRentRespVO.setModel(deviceDO.getModel());
+ }
+ return CommonResult.success(devRentRespVO);
}
@GetMapping("/page")
@@ -154,13 +175,33 @@
BeanUtils.toBean(list, DevRentRespVO.class));
}
- @GetMapping("/get-dismantle-rent")
+ @GetMapping("/get-ready-rent")
@Operation(summary = "鑾峰彇鎮h�呰澶囩殑鏈�杩戠璧佹儏鍐�")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
- public CommonResult<DevRentRespVO> getLatestRent( @Valid DevRentSearchReqVO searchReqVO )
+ public CommonResult<DevRentRespVO> getReadyRent( @Valid DevRentSearchReqVO searchReqVO )
{
- searchReqVO.setState( DevRentStateEnum.INSTALLED.getState() );
- DevRentDO devRent = devRentService.getDismantleRent( searchReqVO );
+ DevRentDO devRent = devRentService.getReadyOrCancelledRent( searchReqVO );
+ if (null == devRent) {
+ return CommonResult.success(null);
+ }
+
+ DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class);
+
+ DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() );
+ if (null != deviceDO) {
+ devRentRespVO.setCategory(deviceDO.getCategory());
+ devRentRespVO.setBrand(deviceDO.getBrand());
+ devRentRespVO.setModel(deviceDO.getModel());
+ }
+ return CommonResult.success(devRentRespVO);
+ }
+
+ @GetMapping("/get-installed-rent")
+ @Operation(summary = "鑾峰彇鎮h�呰澶囩殑鏈�杩戠璧佹儏鍐�")
+ @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+ public CommonResult<DevRentRespVO> getInstalledRent( @Valid DevRentSearchReqVO searchReqVO )
+ {
+ DevRentDO devRent = devRentService.getInstalledOrCancelledRent( searchReqVO );
if (null == devRent) {
return CommonResult.success(null);
}
--
Gitblit v1.9.3