From a9bfa2051eba0f8f1d1a8430292a89113f62b35f Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期五, 20 九月 2024 17:49:38 +0800
Subject: [PATCH]  拆机界面 设备详情显示

---
 jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java                   |   28 ++++++++++++++++------------
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java  |    9 +++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java |   18 ++++++++++++++++--
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java         |    5 ++---
 4 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
index df34a44..f8ccfd3 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -13,27 +13,31 @@
 
     ErrorCode APPOINTMENT_NOT_EXISTS = new ErrorCode(1_010_001_000, "棰勭害涓嶅瓨鍦�");
     ErrorCode APPOINTMENT_NOT_TODAY = new ErrorCode(1_010_001_001, "涓嶆槸褰撳ぉ棰勭害");
+
     ErrorCode ROOM_NOT_EXISTS = new ErrorCode(1_010_002_000, "璇婂鍜岃瘖鐤楀簥涓嶅瓨鍦�");
     ErrorCode ROOM_NOT_SIT = new ErrorCode(1_010_002_001, "璇烽噸鏂板氨搴�");
     ErrorCode ROOM_INVALID_STATUS = new ErrorCode(1_010_002_001, "璇婂鍜岃瘖鐤楀簥鐘舵�佸紓甯�");
+
     ErrorCode QUEUE_NOT_EXISTS = new ErrorCode(1_010_003_000, "鎺掗槦涓嶅瓨鍦�");
     ErrorCode QUEUE_BED_NOT_EXIST = new ErrorCode(1_010_003_001, "宸ヤ綅闃熷垪涓嶅瓨鍦�");
-    ErrorCode QUEUE_BED_EXIST = new ErrorCode(1_010_003_001, "宸ヤ綅闃熷垪宸插瓨鍦�");
-    ErrorCode QUEUE_HAVE_PATIENT = new ErrorCode(1_010_003_002, "闃熷垪涓湁鎮h��");
-    ErrorCode QUEUE_NOT_READY_PATIENT = new ErrorCode(1_010_003_003, "娌℃湁鍑嗗涓殑鎮h��");
+    ErrorCode QUEUE_BED_EXIST = new ErrorCode(1_010_003_002, "宸ヤ綅闃熷垪宸插瓨鍦�");
+    ErrorCode QUEUE_HAVE_PATIENT = new ErrorCode(1_010_003_003, "闃熷垪涓湁鎮h��");
+    ErrorCode QUEUE_NOT_READY_PATIENT = new ErrorCode(1_010_003_004, "娌℃湁鍑嗗涓殑鎮h��");
+
     ErrorCode PATIENT_NOT_EXISTS = new ErrorCode(1_010_004_000, "鎮h�呬笉瀛樺湪");
 
     ErrorCode DEV_MODEL_NOT_EXISTS = new ErrorCode(1_010_005_000, "璁惧鍨嬪彿涓嶅瓨鍦�");
     ErrorCode DEVICE_NOT_EXISTS = new ErrorCode(1_010_005_001,  "璁惧涓嶅瓨鍦�");
-    ErrorCode DEV_RENT_NOT_EXISTS = new ErrorCode(1_010_005_002, "绉熷�熶笉瀛樺湪");
-    ErrorCode DEV_INSTALL_EXCEPTION = new ErrorCode(1_010_005_003, "瑁呮満鍐呴儴閿欒");
-    ErrorCode DEV_DISMANTLE_EXCEPTION = new ErrorCode(1_010_005_004, "鎷嗘満鍐呴儴閿欒");
-    ErrorCode DEV_CANCEL_EXCEPTION = new ErrorCode(1_010_005_005, "鎷嗘満鍐呴儴閿欒");
-    ErrorCode DEV_LOSE_EXCEPTION = new ErrorCode(1_010_005_005, "閬楀け鍐呴儴閿欒");
-    ErrorCode DEV_INSTALL_EXIST = new ErrorCode(1_010_005_006, "褰撳ぉ宸叉湁瑁呮満");
-    ErrorCode DEV_DISMANTLE_EXIST = new ErrorCode(1_010_005_006, "褰撳ぉ宸叉湁鎷嗘満");
 
-    ErrorCode JOB_RECORD_NOT_EXISTS = new ErrorCode(1_010_006_000, "宸ヤ綔璁板綍涓嶅瓨鍦�");
+    ErrorCode DEV_INSTALL_NOT_EXISTS = new ErrorCode(1_010_006_000, "瑁呮満涓嶅瓨鍦�");
+    ErrorCode DEV_INSTALL_EXCEPTION = new ErrorCode(1_010_006_001, "瑁呮満鍐呴儴閿欒");
+    ErrorCode DEV_DISMANTLE_EXCEPTION = new ErrorCode(1_010_006_002, "鎷嗘満鍐呴儴閿欒");
+    ErrorCode DEV_CANCEL_EXCEPTION = new ErrorCode(1_010_006_003, "鍙栨秷瑁呮満鍐呴儴閿欒");
+    ErrorCode DEV_LOSE_EXCEPTION = new ErrorCode(1_010_006_004, "閬楀け鍐呴儴閿欒");
+    ErrorCode DEV_INSTALL_EXIST = new ErrorCode(1_010_006_005, "褰撳ぉ宸叉湁瑁呮満");
+    ErrorCode DEV_DISMANTLE_EXIST = new ErrorCode(1_010_006_006, "褰撳ぉ宸叉湁鎷嗘満");
 
-    ErrorCode CALL_NOT_EXISTS = new ErrorCode(1_010_007_000, "鍙彿涓嶅瓨鍦�");
+    ErrorCode JOB_RECORD_NOT_EXISTS = new ErrorCode(1_010_007_000, "宸ヤ綔璁板綍涓嶅瓨鍦�");
+
+    ErrorCode CALL_NOT_EXISTS = new ErrorCode(1_010_008_000, "鍙彿涓嶅瓨鍦�");
 }
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 f153b61..ede8494 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
@@ -1,6 +1,8 @@
 package cn.lihu.jh.module.ecg.controller.admin.devrent;
 
 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.service.devmanage.DeviceService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
@@ -21,7 +23,6 @@
 
 import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog;
 import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*;
-import static cn.lihu.jh.framework.common.util.exception.ExceptionUtils.formatException;
 import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
 
 import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
@@ -41,6 +42,9 @@
 
     @Resource
     private DevRentService devRentService;
+
+    @Resource
+    private DeviceService deviceService;
 
     @PostMapping("/dev-install")
     @Operation(summary = "瑁呮満")
@@ -155,6 +159,16 @@
     public CommonResult<DevRentRespVO> getLatestRent( @Valid DevRentSearchReqVO searchReqVO )
     {
         DevRentDO devRent = devRentService.getLatestRent( searchReqVO );
-        return CommonResult.success(BeanUtils.toBean(devRent, DevRentRespVO.class));
+        if (null == devRent) {
+            return CommonResult.success(null);
+        }
+
+        DeviceDO deviceDO = deviceService.getDevice( devRent.getDevId() );
+
+        DevRentRespVO devRentRespVO = BeanUtils.toBean(devRent, DevRentRespVO.class);
+        devRentRespVO.setCategory( deviceDO.getCategory() );
+        devRentRespVO.setBrand( deviceDO.getBrand() );
+        devRentRespVO.setModel( deviceDO.getModel() );
+        return CommonResult.success(devRentRespVO);
     }
 }
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java
index c24c19a..d57c0ba 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java
@@ -64,4 +64,13 @@
     @ExcelProperty("鍒涘缓鏃堕棿")
     private LocalDateTime createTime;
 
+
+    @Schema(description = "鍒嗙被鍚�")
+    private String category;
+
+    @Schema(description = "鍝佺墝")
+    private String brand;
+
+    @Schema(description = "鍨嬪彿")
+    private String model;
 }
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
index 441c3c4..b37420b 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -12,11 +12,10 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
-import java.util.*;
+
 import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
 import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
 import cn.lihu.jh.framework.common.pojo.PageResult;
-import cn.lihu.jh.framework.common.pojo.PageParam;
 import cn.lihu.jh.framework.common.util.object.BeanUtils;
 
 import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper;
@@ -267,7 +266,7 @@
 
     private void validateDevRentExists(Long id) {
         if (devRentMapper.selectById(id) == null) {
-            throw exception(DEV_RENT_NOT_EXISTS);
+            throw exception(DEV_INSTALL_NOT_EXISTS);
         }
     }
 

--
Gitblit v1.9.3