From b0c345d2a74f47e5c34617051bcd61becde11b96 Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 15 八月 2025 14:09:59 +0800
Subject: [PATCH] 业务流程修改

---
 src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java |   66 +++++++-------------------------
 1 files changed, 15 insertions(+), 51 deletions(-)

diff --git a/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java b/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
index 314be51..21d76d4 100644
--- a/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
+++ b/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
@@ -36,6 +36,7 @@
 */
 @Service
 @Slf4j
+@Transactional(rollbackFor = Exception.class)
 public class WarehouseGoodsShelvesServiceImpl extends ServiceImpl<WarehouseGoodsShelvesMapper, WarehouseGoodsShelves>
     implements WarehouseGoodsShelvesService {
     @Autowired
@@ -54,17 +55,12 @@
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public boolean add(WarehouseGoodsShelves warehouseGoodsShelves) {
         WarehouseGoodsShelves one = warehouseGoodsShelvesMapper.selectOne(new LambdaQueryWrapper<WarehouseGoodsShelves>().eq(WarehouseGoodsShelves::getId, warehouseGoodsShelves.getId()));
         // 1. 妫�鏌ヨ揣鏋跺悕绉版槸鍚﹀凡瀛樺湪
         if (one == null) {
-            log.error("璐ф灦ID涓嶅瓨鍦�");
             int insert = warehouseGoodsShelvesMapper.insert(warehouseGoodsShelves);
-            if (insert <= 0) {
-                log.error("璐ф灦涓昏褰曟坊鍔犲け璐�");
-                return false;
-            }
+            if (insert <= 0) return false;
         }
 
         Long shelvesId = warehouseGoodsShelves.getId();
@@ -86,16 +82,10 @@
                 // 浣跨敤鎵归噺鎻掑叆鏂规硶鏇夸唬寰幆鍗曟潯鎻掑叆
                 warehouseGoodsShelvesRowcolService.saveBatch(rowcolList);
             } catch (Exception e) {
-                log.error("璐ф灦[{}]鐨勮鍒楄褰曟壒閲忔坊鍔犲け璐�", shelvesId, e);
                 // 鎶涘嚭寮傚父瑙﹀彂浜嬪姟鍥炴粴
                 throw e;
             }
         }
-
-        log.info("璐ф灦[{}]娣诲姞鎴愬姛锛屽眰鏁�:{}锛屾帓鏁�:{}",
-                warehouseGoodsShelves.getGoodsShelvesName(),
-                warehouseGoodsShelves.getStorey(),
-                warehouseGoodsShelves.getArrange());
         return true;
     }
     /**
@@ -104,7 +94,6 @@
      * @return 鏄惁鏇存柊鎴愬姛
      */
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public boolean updateRowcolById(WarehouseGoodsShelves warehouseGoodsShelves) {
         Long shelvesId = warehouseGoodsShelves.getId();
 
@@ -120,25 +109,14 @@
         Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
                 .in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
         List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
-        if (!documentations.isEmpty()) {
-            log.error("璐ф灦[ID:{}]涓婂瓨鍦ㄥ晢鍝侊紝绂佹鏇存柊", shelvesId);
-            return false;
-        }
+        if (!documentations.isEmpty()) return false;
+
         // 鍏堟洿鏂拌揣鏋朵富淇℃伅
-        boolean isShelvesUpdated = updateById(warehouseGoodsShelves);
-        if (!isShelvesUpdated) {
-            log.warn("璐ф灦[{}]涓讳俊鎭洿鏂板け璐�", shelvesId);
-            return false;
-        }
+        updateById(warehouseGoodsShelves);
         // 鍒犻櫎鏃х殑琛屽垪璁板綍
-        boolean isOldRowcolRemoved = warehouseGoodsShelvesRowcolService.removeByIds(rowcolIds);
-        if (!isOldRowcolRemoved) {
-            log.error("璐ф灦[{}]鐨勬棫琛屽垪璁板綍鍒犻櫎澶辫触", shelvesId);
-            return false;
-        }
+        warehouseGoodsShelvesRowcolService.removeByIds(rowcolIds);
         // 娣诲姞鏂扮殑琛屽垪璁板綍
         add(warehouseGoodsShelves);
-        log.info("璐ф灦[{}]鐨勮鍒椾俊鎭洿鏂版垚鍔�", shelvesId);
         return true;
     }
     /**
@@ -147,14 +125,9 @@
      * @return 鏄惁鍒犻櫎鎴愬姛
      */
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public boolean deleteByIds(List<Long> ids) {
         // 1. 鍏堟煡璇㈡墍鏈夎鍒犻櫎鐨勮揣鏋朵俊鎭�
         List<WarehouseGoodsShelves> shelvesList = warehouseGoodsShelvesMapper.selectBatchIds(ids);
-        if (CollectionUtils.isEmpty(shelvesList)) {
-            log.info("鏈煡璇㈠埌闇�鍒犻櫎鐨勮揣鏋讹紝ID鍒楄〃锛歿}", ids);
-            return true; // 鏃犳暟鎹彲鍒狅紝瑙嗕负鎴愬姛
-        }
 
         // 2. 妫�鏌ユ墍鏈夎揣鏋舵槸鍚﹀瓨鍦ㄥ晢鍝侊紙鏈夊晢鍝佸垯涓嶅厑璁稿垹闄わ級
         for (WarehouseGoodsShelves shelves : shelvesList) {
@@ -175,20 +148,13 @@
             Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
                     .in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
             List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
-            if (!documentations.isEmpty()) {
-                log.error("璐ф灦[ID:{}]涓婂瓨鍦ㄥ晢鍝侊紝绂佹鍒犻櫎", shelvesId);
-                return false; // 浠讳竴璐ф灦鏈夊晢鍝佸垯缁堟鍒犻櫎
-            }
+            if (!documentations.isEmpty()) return false; // 浠讳竴璐ф灦鏈夊晢鍝佸垯缁堟鍒犻櫎
         }
 
         // 3. 鍏堝垹闄よ揣鏋朵富璁板綍
-        boolean isShelvesDeleted = removeByIds(ids);
-        if (!isShelvesDeleted) {
-            log.error("璐ф灦涓昏褰曞垹闄ゅけ璐ワ紝ID鍒楄〃锛歿}", ids);
-            return false;
-        }
+        warehouseGoodsShelvesMapper.deleteBatchIds(ids);
 
-        // 4. 鎵归噺鍒犻櫎鎵�鏈夊叧鑱旂殑琛屽垪璁板綍
+        // 4. 鎵归噺鍒犻櫎鎵�鏈夎鍒楄褰�
         List<Long> allShelvesIds = shelvesList.stream()
                 .map(WarehouseGoodsShelves::getId)
                 .collect(Collectors.toList());
@@ -196,17 +162,15 @@
         // 鏋勫缓鎵归噺鍒犻櫎鏉′欢
         Wrapper<WarehouseGoodsShelvesRowcol> deleteWrapper = new LambdaQueryWrapper<WarehouseGoodsShelvesRowcol>()
                 .in(WarehouseGoodsShelvesRowcol::getWarehouseGoodsShelvesId, allShelvesIds);
-
-        boolean isRowcolDeleted = warehouseGoodsShelvesRowcolService.remove(deleteWrapper);
-        if (!isRowcolDeleted) {
-            log.warn("璐ф灦鍏宠仈鐨勮鍒楄褰曞垹闄ゅけ璐ワ紝璐ф灦ID鍒楄〃锛歿}", allShelvesIds);
-            // 姝ゅ鍙牴鎹笟鍔¢渶姹傚喅瀹氭槸鍚﹀洖婊氳揣鏋跺垹闄ゆ搷浣�
-        }
-
-        log.info("璐ф灦鎵归噺鍒犻櫎鎴愬姛锛孖D鍒楄〃锛歿}", ids);
+        warehouseGoodsShelvesRowcolService.remove(deleteWrapper);
         return true;
     }
 
+    @Override
+    public List<WarehouseGoodsShelves> list(WarehouseGoodsShelves warehouseGoodsShelves) {
+        return warehouseGoodsShelvesMapper.list(warehouseGoodsShelves);
+    }
+
 }
 
 

--
Gitblit v1.9.3