From 01a81beea99c0298a3b6178c7796f4c27b30c6c7 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 15 四月 2025 14:27:50 +0800
Subject: [PATCH] pat detail.  新增 appontment_id

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java |   36 ++++++++++++++++++++++++++++--------
 1 files changed, 28 insertions(+), 8 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 924cf0d..5ffdbc1 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,12 +1,10 @@
 package cn.lihu.jh.module.ecg.controller.admin.devrent;
 
-import cn.lihu.jh.framework.common.util.exception.ExceptionUtils;
 import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils;
 import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO;
 import cn.lihu.jh.module.ecg.enums.DevStateEnum;
 import cn.lihu.jh.module.ecg.service.devmanage.DeviceService;
 import cn.lihu.jh.module.ecg.service.queue.QueueService;
-import io.swagger.v3.oas.models.security.SecurityScheme;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
@@ -27,7 +25,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.module.ecg.enums.ErrorCodeConstants.*;
 
 import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*;
 import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO;
@@ -55,18 +52,38 @@
 
     // 甯歌妫�鏌� 瀹屾垚
     @PostMapping("/routine-finish")
-    @Operation(summary = "")
+    @Operation(summary = "甯歌妫�鏌ュ畬鎴�")
     @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
     public CommonResult<Long> routineFinish(@Valid @RequestBody RoutineFinishReqVO routineFinishReqVO) {
         CommonResult<Long> result = devRentService.routineFinishOperation(routineFinishReqVO);
+
+        try {
+            String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
+            String userHisId = SecurityFrameworkUtils.getLoginUserHisId();
+            Long rentId = routineFinishReqVO.getId();
+            devRentService.feeConfirm(rentId, userHisId, userNickname, true);  // 鏁呮剰 涓嶆鏌ヨ繑鍥炲��
+        } catch (Exception e) {
+            log.error("甯歌妫�鏌ュ畬鎴�, 鑷姩纭垂澶辫触", e);
+        }
+
         return result;
     }
 
     @PostMapping("/dev-ready")
-    @Operation(summary = "璁惧棰嗙敤")
+    @Operation(summary = "璁惧棰嗙敤瀹屾垚")
     @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
     public CommonResult<Long> devReady(@Valid @RequestBody DevRentSaveReqVO createReqVO) {
         CommonResult<Long> result = devRentService.readyOperation(createReqVO);
+
+        try {
+            String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
+            String userHisId = SecurityFrameworkUtils.getLoginUserHisId();
+            Long rentId = createReqVO.getId();
+            devRentService.feeConfirm(rentId, userHisId, userNickname, true);  // 鏁呮剰 涓嶆鏌ヨ繑鍥炲��
+        } catch (Exception e) {
+            log.error("璁惧棰嗙敤瀹屾垚, 鑷姩纭垂澶辫触", e);
+        }
+
         return result;
     }
 
@@ -168,6 +185,7 @@
             devRentRespVO.setCategory(deviceDO.getCategory());
             devRentRespVO.setBrand(deviceDO.getBrand());
             devRentRespVO.setModel(deviceDO.getModel());
+            devRentRespVO.setDevState(deviceDO.getState());
         }
         return CommonResult.success(devRentRespVO);
     }
@@ -224,16 +242,17 @@
             devRentRespVO.setCategory(deviceDO.getCategory());
             devRentRespVO.setBrand(deviceDO.getBrand());
             devRentRespVO.setModel(deviceDO.getModel());
+            devRentRespVO.setDevState(deviceDO.getState());
         }
         return CommonResult.success(devRentRespVO);
     }
 
-    @GetMapping("/get-installed-rent")
-    @Operation(summary = "鑾峰彇宸插畨瑁呯璧佹儏鍐�")
+    @GetMapping("/get-existing-rent")
+    @Operation(summary = "鑾峰彇宸插畨瑁呫�佸凡棰嗙敤鐨勭璧佹儏鍐�")
     @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
     public CommonResult<DevRentRespVO> getInstalledRent( @Valid DevRentSearchReqVO searchReqVO )
     {
-        DevRentDO devRent = devRentService.getInstalledOrCancelledRent( searchReqVO );
+        DevRentDO devRent = devRentService.getExistingRent( searchReqVO );
         if (null == devRent) {
             return CommonResult.success(null);
         }
@@ -244,6 +263,7 @@
         devRentRespVO.setCategory( deviceDO.getCategory() );
         devRentRespVO.setBrand( deviceDO.getBrand() );
         devRentRespVO.setModel( deviceDO.getModel() );
+        devRentRespVO.setDevState( devRent.getState() );
         return CommonResult.success(devRentRespVO);
     }
 

--
Gitblit v1.9.3