From 24820701b09281e03edf2e22db62edab7f4da53b Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期二, 10 三月 2026 16:08:09 +0800
Subject: [PATCH] feat(info): 支持获取并返回下级项目信息

---
 src/main/java/com/ruoyi/projectManagement/service/impl/InfoServiceImpl.java |   99 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 96 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/ruoyi/projectManagement/service/impl/InfoServiceImpl.java b/src/main/java/com/ruoyi/projectManagement/service/impl/InfoServiceImpl.java
index e6bd8c5..8bcfc2b 100644
--- a/src/main/java/com/ruoyi/projectManagement/service/impl/InfoServiceImpl.java
+++ b/src/main/java/com/ruoyi/projectManagement/service/impl/InfoServiceImpl.java
@@ -1,15 +1,32 @@
 package com.ruoyi.projectManagement.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.enums.IsDeleteEnum;
 import com.ruoyi.common.enums.SaleEnum;
+import com.ruoyi.projectManagement.dto.ContractInfoDto;
+import com.ruoyi.projectManagement.dto.SaveInfoDto;
+import com.ruoyi.projectManagement.dto.ShippingAddressDto;
+import com.ruoyi.projectManagement.dto.UpdateStateInfo;
+import com.ruoyi.projectManagement.mapper.InfoMapper;
+import com.ruoyi.projectManagement.pojo.Info;
 import com.ruoyi.projectManagement.service.InfoService;
 import com.ruoyi.projectManagement.service.impl.handle.ContractInfoHandleService;
 import com.ruoyi.projectManagement.service.impl.handle.InfoHandleService;
 import com.ruoyi.projectManagement.service.impl.handle.ShippingAddressHandleService;
+import com.ruoyi.projectManagement.vo.InfoVo;
+import com.ruoyi.projectManagement.vo.ListInfoVo;
 import com.ruoyi.projectManagement.vo.SaveInfoVo;
+import com.ruoyi.projectManagement.vo.SearchInfoVo;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
 import com.ruoyi.sales.service.ISalesLedgerService;
 import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
 
 /**
  * @author buhuazhen
@@ -21,17 +38,93 @@
 @Transactional(readOnly = true)
 public class InfoServiceImpl implements InfoService {
     private final InfoHandleService infoHandleService;
+    private final InfoMapper infoMapper;
     private final ContractInfoHandleService contractInfoHandleService;
     private final ShippingAddressHandleService shippingAddressHandleService;
     private final ISalesLedgerService salesLedgerService;
+
 
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void save(SaveInfoVo saveInfoVo) {
         // 淇濆瓨涓讳俊鎭�
         Long infoId = infoHandleService.save(saveInfoVo.getInfo());
-        shippingAddressHandleService.save(infoId, saveInfoVo.getShippingAddress());
-        contractInfoHandleService.save(infoId, saveInfoVo.getContractInfo());
-        salesLedgerService.handleSalesLedgerProducts(infoId, saveInfoVo.getSalesLedgerProductList(), SaleEnum.MANAGEMENT);
+        if(saveInfoVo.getShippingAddress() != null){
+            shippingAddressHandleService.save(infoId, saveInfoVo.getShippingAddress());
+        }
+        if(saveInfoVo.getContractInfo() != null){
+            contractInfoHandleService.save(infoId, saveInfoVo.getContractInfo());
+        }
+        if(saveInfoVo.getSalesLedgerProductList() != null){
+            salesLedgerService.handleSalesLedgerProducts(infoId, saveInfoVo.getSalesLedgerProductList(), SaleEnum.MANAGEMENT);
+        }
     }
+
+    @Override
+    @Transactional
+    public void updateStatus(UpdateStateInfo updateStateInfo) {
+        Info info = new Info();
+        info.setId(updateStateInfo.getId());
+        // 瀹℃壒鐘舵��
+        if(updateStateInfo.getReviewStatus() != null){
+            info.setReviewStatus(updateStateInfo.getReviewStatus().getCode());
+        }
+
+        // 杩涘害鐘舵��
+        if(updateStateInfo.getStage() != null){
+            info.setStatus(updateStateInfo.getStage().getCode());
+        }
+
+        infoMapper.updateById(info);
+    }
+
+    @Override
+    @Transactional
+    public void deleteInfo(Long id) {
+        LambdaUpdateWrapper<Info> updateWrapper = new LambdaUpdateWrapper<Info>();
+        updateWrapper.eq(Info::getId, id);
+        updateWrapper.set(Info::getIsDelete, IsDeleteEnum.DELETED.getCode());
+
+        // 瀵瑰簲闄勮〃淇℃伅鏄惁鍒犻櫎寰呯‘瀹氾紙鍥犱负鍚庣画鍙兘浼氳繘琛屽紩鐢ㄦ墍浠ュ厛涓嶅垹闄�
+    }
+
+    @Override
+    public Page<ListInfoVo> searchListInfo(SearchInfoVo vo) {
+        Page<ListInfoVo> listInfoVoPage = infoMapper.searchListInfo(vo);
+
+
+        return listInfoVoPage;
+    }
+
+    @Override
+    @SneakyThrows
+    public InfoVo getInfoById(Long id) {
+
+        CompletableFuture<SaveInfoDto> infoFuture = CompletableFuture.supplyAsync(() -> infoHandleService.getInfoById(id));
+        CompletableFuture<ContractInfoDto> contractFuture = CompletableFuture.supplyAsync(() -> contractInfoHandleService.getByInfoId(id));
+        CompletableFuture<ShippingAddressDto> shippingFuture = CompletableFuture.supplyAsync(() -> shippingAddressHandleService.getByInfoId(id));
+        CompletableFuture<List<SalesLedgerProduct>> listCompletableFuture = CompletableFuture.supplyAsync(() -> salesLedgerService.getSalesLedgerProductListByRelateId(id,SaleEnum.MANAGEMENT));
+
+        // 涓嬬骇椤圭洰淇℃伅
+        CompletableFuture<List<SaveInfoDto>> subordinateInfoListFuture = CompletableFuture.supplyAsync(() -> infoHandleService.getSubordinateInfo(id));
+
+        // 鍟嗗搧
+
+        // 绛夊緟鎵�鏈夊紓姝ュ畬鎴�
+        CompletableFuture.allOf(infoFuture, contractFuture, shippingFuture).join();
+
+        SaveInfoDto info = infoFuture.get();
+        ContractInfoDto contract = contractFuture.get();
+        ShippingAddressDto shippingAddress = shippingFuture.get();
+        List<SalesLedgerProduct> salesLedgerProductList = listCompletableFuture.get();
+        List<SaveInfoDto> saveInfoDtos = subordinateInfoListFuture.get();
+        InfoVo vo = new InfoVo();
+        vo.setInfo(info);
+        vo.setContractInfo(contract);
+        vo.setShippingAddress(shippingAddress);
+        vo.setSalesLedgerProductList(salesLedgerProductList);
+        vo.setSubordinateInfoList(saveInfoDtos);
+        return vo;
+    }
+
 }

--
Gitblit v1.9.3