From c128ed33c2447e8daea89d70795098748bd5b2af Mon Sep 17 00:00:00 2001
From: zhangfeng <1603559716@qq.com>
Date: 星期五, 06 一月 2023 10:53:27 +0800
Subject: [PATCH] 补充查询单条领取记录接口

---
 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java
index b7d8a20..a1d9930 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/MaterialReceiveRecordsServiceImpl.java
@@ -27,6 +27,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
 
 import java.time.LocalDateTime;
 import java.util.ArrayList;
@@ -216,4 +217,29 @@
         return list;
     }
 
+    @Override
+    public MaterialReceiveRecordsBaseDto queryById(ContextCacheUser currentUser, Long id) {
+        if(ObjectUtils.isEmpty(id)){
+            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL,"领取总记录主键不可为空!");
+        }
+        MaterialReceiveRecordsBaseInfo receiveRecordsBaseInfo = recordsBaseInfoService.queryById(id);
+        List<MaterialReceiveRecordsInfo> receiveRecordsInfoList = receiveRecordsInfoService.listByReceiveBaseId(id);
+        MaterialReceiveRecordsBaseDto materialReceiveRecordsBaseDto = new MaterialReceiveRecordsBaseDto();
+        if(!ObjectUtils.isEmpty(receiveRecordsBaseInfo)){
+            BeanUtils.copyProperties(receiveRecordsBaseInfo,materialReceiveRecordsBaseDto);
+            List<MaterialReceiveRecordsDto> receiveRecordsDtoList = new ArrayList<>();
+            for(MaterialReceiveRecordsInfo receiveRecordsInfo:receiveRecordsInfoList){
+                MaterialReceiveRecordsDto receiveRecordsDto = new MaterialReceiveRecordsDto();
+                BeanUtils.copyProperties(receiveRecordsInfo,receiveRecordsDto);
+                receiveRecordsDto.setMaterialStatusName(MaterialStatusEnum.getByCode(receiveRecordsInfo.getMaterialStatus()).getValue());
+                receiveRecordsDto.setRevertStatusName(MaterialRevertStatusEnum.getByCode(receiveRecordsInfo.getRevertStatus()).getValue());
+                receiveRecordsDtoList.add(receiveRecordsDto);
+            }
+            materialReceiveRecordsBaseDto.setMaterialList(receiveRecordsDtoList);
+            return materialReceiveRecordsBaseDto;
+        }
+
+       return null;
+    }
+
 }

--
Gitblit v1.9.2