From 9ddc38c82866653987733935c380496a79d70945 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期五, 13 九月 2024 15:26:03 +0800
Subject: [PATCH] 设备遗失功能完成
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 13 +++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java | 10 +++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java | 3 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java | 8 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 78 +++++++++++++++++++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java | 7 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java | 7 ++
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 1
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java | 8 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 13 ++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java | 3 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java | 1
16 files changed, 162 insertions(+), 6 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 96dbf7f..429bdf9 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
@@ -29,6 +29,7 @@
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, "褰撳ぉ宸叉湁鎷嗘満");
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java
index 7b3ae93..d5c3ddf 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DevicePageReqVO.java
@@ -37,4 +37,11 @@
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
+ @Schema(description = "閬楀け")
+ private Integer lost;
+
+ @Schema(description = "閬楀け鏃ユ湡")
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+ private LocalDate loseDate[];
+
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java
index 6f9e245..8c0a3d0 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceRespVO.java
@@ -42,4 +42,11 @@
@ExcelProperty("鍒涘缓鏃堕棿")
private LocalDateTime createTime;
+ @Schema(description = "閬楀け")
+ @ExcelProperty("鏄惁閬楀け")
+ private Integer lost;
+
+ @Schema(description = "閬楀け鏃ユ湡")
+ @ExcelProperty("閬楀け鏃ユ湡")
+ private LocalDate loseDate;
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java
index 1934255..90fadea 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/vo/DeviceSaveReqVO.java
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.controller.admin.devmanage.vo;
+import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
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 622fe67..f153b61 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
@@ -82,6 +82,19 @@
}
}
+ @PostMapping("/dev-lose")
+ @Operation(summary = "閬楀け")
+ @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+ public CommonResult<Long> devLose(@Valid @RequestBody DevRentSaveReqVO loseReqVO) {
+ try {
+ return devRentService.loseOperation(loseReqVO);
+ } catch ( RuntimeException runtimeException ) {
+ String err = ExceptionUtils.formatException( runtimeException );
+ log.error("devLose: " + err);
+ return CommonResult.error(DEV_LOSE_EXCEPTION);
+ }
+ }
+
@PostMapping("/create")
@Operation(summary = "鍒涘缓瑁呮満鎷嗘満")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java
index ff4aa83..275e74f 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.controller.admin.devrent.vo;
+import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -47,6 +48,9 @@
@Schema(description = "鍙栨秷瀹夎")
private Integer cancelled;
+ @Schema(description = "閬楀け")
+ private Integer lost;
+
@Schema(description = "鍒涘缓鏃堕棿")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
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 7ab2796..c24c19a 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
@@ -56,6 +56,10 @@
@ExcelProperty("鍙栨秷瀹夎")
private Integer cancelled;
+ @Schema(description = "閬楀け")
+ @ExcelProperty("鏄惁閬楀け")
+ private Integer lost;
+
@Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鍒涘缓鏃堕棿")
private LocalDateTime createTime;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
index c83c0e0..3d938ae 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java
@@ -1,5 +1,6 @@
package cn.lihu.jh.module.ecg.controller.admin.devrent.vo;
+import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@@ -46,4 +47,6 @@
@Schema(description = "鍙栨秷瀹夎")
private Integer cancelled;
+ @Schema(description = "閬楀け")
+ private Integer lost;
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java
index a303e05..8d02275 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSearchReqVO.java
@@ -1,6 +1,7 @@
package cn.lihu.jh.module.ecg.controller.admin.devrent.vo;
import cn.lihu.jh.framework.common.pojo.PageParam;
+import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -28,4 +29,7 @@
@Schema(description = "鍙栨秷瀹夎")
private Integer cancelled;
+
+ @Schema(description = "閬楀け")
+ private Integer lost;
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
index 23a4ac0..2ff11b4 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordRespVO.java
@@ -56,6 +56,10 @@
@ExcelProperty("鍙栨秷瀹夎")
private Integer cancelled;
+ @Schema(description = "閬楀け")
+ @ExcelProperty("鏄惁閬楀け")
+ private Integer lost;
+
@Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鍒涘缓鏃堕棿")
private LocalDateTime createTime;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java
index 7ae3155..e63d7c3 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordSaveReqVO.java
@@ -48,4 +48,7 @@
@Schema(description = "鍙栨秷瀹夎")
private Integer cancelled;
+
+ @Schema(description = "閬楀け")
+ private Integer lost;
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java
index 454b115..ebe11b9 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devmanage/DeviceDO.java
@@ -50,4 +50,12 @@
*/
private LocalDate purchaseDate;
-}
\ No newline at end of file
+ /**
+ * 閬楀け
+ */
+ private Integer lost;
+ /**
+ * 閬楀け鏃ユ湡
+ */
+ private LocalDate loseDate;
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java
index eeca1de..8533c86 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java
@@ -66,5 +66,13 @@
*/
private String remark;
+ /**
+ * 鏀惧純瀹夎
+ */
private Integer cancelled;
+
+ /**
+ * 閬楀け
+ */
+ private Integer lost;
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java
index 04278be..022a36a 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordDO.java
@@ -65,9 +65,17 @@
*/
private String remark;
+ /**
+ * 鏀惧純瀹夎
+ */
private Integer cancelled;
/**
+ * 閬楀け
+ */
+ private Integer lost;
+
+ /**
* 瀵瑰簲绉熻祦缂栧彿
*/
private Long rentId;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java
index 61676ab..e6258d6 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java
@@ -1,12 +1,9 @@
package cn.lihu.jh.module.ecg.service.devrent;
-import java.util.*;
-
import cn.lihu.jh.framework.common.pojo.CommonResult;
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 javax.validation.Valid;
@@ -36,10 +33,18 @@
/**
* 瑁呮満
*
+ * @param cancelReqVO 鍒涘缓淇℃伅
+ * @return 缂栧彿
+ */
+ CommonResult<Long> cancelOperation(@Valid DevCancelReqVO cancelReqVO);
+
+ /**
+ * 閬楀け
+ *
* @param createReqVO 鍒涘缓淇℃伅
* @return 缂栧彿
*/
- CommonResult<Long> cancelOperation(@Valid DevCancelReqVO createReqVO);
+ CommonResult<Long> loseOperation(@Valid DevRentSaveReqVO createReqVO);
/**
* 鍒涘缓瑁呮満鎷嗘満
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 43026b5..f3bf2aa 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
@@ -3,7 +3,9 @@
import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils;
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.JobRecordSaveReqVO;
+import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
+import cn.lihu.jh.module.ecg.dal.mysql.devmanage.DeviceMapper;
import cn.lihu.jh.module.ecg.dal.mysql.jobrecord.JobRecordMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -38,6 +40,9 @@
@Resource
private JobRecordMapper jobRecordMapper;
+
+ @Resource
+ DeviceMapper deviceMapper;
@Override
@Transactional
@@ -93,6 +98,9 @@
@Override
@Transactional
public Long dismantleOperation(DevRentSaveReqVO updateReqVO) {
+ // 鍙栨秷閬楀け鏍囪
+ updateReqVO.setLost(0);
+
updateDevRent( updateReqVO );
Long userId = SecurityFrameworkUtils.getLoginUserId();
@@ -114,6 +122,12 @@
JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
jobRecordMapper.insert(jobRecord);
} else {
+ // 璁惧閬楀け鏃�, 闇�鎭㈠鍒版甯�
+ resumeDevLost( updateReqVO );
+
+ // 鍙栨秷閬楀け鏍囪
+ jobRecordDO.setLost(0);
+
jobRecordDO.setJobTime( updateReqVO.getReturnTime() );
jobRecordDO.setRemark( updateReqVO.getRemark() );
jobRecordDO.setSummary( updateReqVO.getInterference() + " " + updateReqVO.getBaseline() + " " + updateReqVO.getDetachment() );
@@ -121,10 +135,11 @@
jobRecordDO.setUpdateTime( LocalDateTime.now() );
jobRecordMapper.updateById(jobRecordDO);
}
- return 0L;
+ return updateReqVO.getId();
}
@Override
+ @Transactional
public CommonResult<Long> cancelOperation(DevCancelReqVO cancelReqVO) {
DevRentSaveReqVO createReqVO = BeanUtils.toBean(cancelReqVO, DevRentSaveReqVO.class);
Long userId = SecurityFrameworkUtils.getLoginUserId();
@@ -176,6 +191,47 @@
}
@Override
+ @Transactional
+ public CommonResult<Long> loseOperation(DevRentSaveReqVO updateReqVO) {
+ updateReqVO.setLost(1);
+ updateDevRent( updateReqVO );
+
+ Long userId = SecurityFrameworkUtils.getLoginUserId();
+ String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
+
+ JobRecordDO jobRecordDO = jobRecordMapper.selectByRentIdJobTypeDocId(updateReqVO.getId(), 1, userId);
+ if (jobRecordDO == null) {
+ JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
+ jobRecordSaveReqVO.setRentId( updateReqVO.getId() );
+ jobRecordSaveReqVO.setDevId( updateReqVO.getDevId() );
+ jobRecordSaveReqVO.setDocId( userId );
+ jobRecordSaveReqVO.setDocName( userNickname );
+ jobRecordSaveReqVO.setPatId( updateReqVO.getPatId() );
+ jobRecordSaveReqVO.setPatName( updateReqVO.getPatName() );
+ jobRecordSaveReqVO.setJobTime( updateReqVO.getReturnTime() );
+ jobRecordSaveReqVO.setJobType( 1 );
+ jobRecordSaveReqVO.setLost( updateReqVO.getLost() );
+ jobRecordSaveReqVO.setRemark( updateReqVO.getRemark() );
+ jobRecordSaveReqVO.setSummary( updateReqVO.getInterference() + " " + updateReqVO.getBaseline() + " " + updateReqVO.getDetachment() );
+ JobRecordDO jobRecord = BeanUtils.toBean(jobRecordSaveReqVO, JobRecordDO.class);
+ jobRecordMapper.insert(jobRecord);
+ } else {
+ jobRecordDO.setLost( updateReqVO.getLost() );
+ jobRecordDO.setJobTime( updateReqVO.getReturnTime() );
+ jobRecordDO.setRemark( updateReqVO.getRemark() );
+ jobRecordDO.setSummary( updateReqVO.getInterference() + " " + updateReqVO.getBaseline() + " " + updateReqVO.getDetachment() );
+ jobRecordDO.setUpdater( String.valueOf(userId) );
+ jobRecordDO.setUpdateTime( LocalDateTime.now() );
+ jobRecordMapper.updateById(jobRecordDO);
+ }
+
+ // 璁惧閬楀け鏃�, 鏍囨敞閬楀け
+ markDevLost( updateReqVO );
+
+ return CommonResult.success(updateReqVO.getId());
+ }
+
+ @Override
public Long createDevRent(DevRentSaveReqVO createReqVO) {
//
@@ -224,4 +280,24 @@
return devRentMapper.getLatestRent(searchReqVO);
}
+ private void markDevLost(DevRentSaveReqVO createReqVO) {
+ // 璁惧鏍囨敞閬楀け
+ DeviceDO deviveDO = deviceMapper.selectById(createReqVO.getDevId());
+ if (null != deviveDO) {
+ deviveDO.setLost(1);
+ deviveDO.setLoseDate( createReqVO.getReturnTime().toLocalDate() );
+ deviceMapper.updateById(deviveDO);
+ }
+ }
+
+ private void resumeDevLost(DevRentSaveReqVO createReqVO) {
+ // 璁惧鏍囨敞閬楀け 鎭㈠涓烘甯�
+ DeviceDO deviveDO = deviceMapper.selectById(createReqVO.getDevId());
+ if (null != deviveDO) {
+ deviveDO.setLost(0);
+ deviveDO.setLoseDate( null );
+ deviceMapper.updateById(deviveDO);
+ }
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.3