From 8512de3e8e887ad13c941e60fbb9a3b48a43e9b1 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期三, 11 三月 2026 11:44:17 +0800
Subject: [PATCH] feat(projectManagement): 增加项目阶段相关功能及接口支持

---
 src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoHandleService.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoHandleService.java b/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoHandleService.java
index 74c392d..84715f9 100644
--- a/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoHandleService.java
+++ b/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoHandleService.java
@@ -4,16 +4,18 @@
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.google.common.collect.Lists;
+import com.ruoyi.basic.service.CustomerFollowUpFileService;
 import com.ruoyi.common.enums.PlanStageEnum;
 import com.ruoyi.common.enums.ReviewStatusEnum;
-import com.ruoyi.common.utils.EnumUtil;
+import com.ruoyi.projectManagement.dto.InfoStageDto;
 import com.ruoyi.projectManagement.dto.PlanStageDto;
 import com.ruoyi.projectManagement.dto.SaveInfoDto;
 import com.ruoyi.projectManagement.mapper.InfoMapper;
 import com.ruoyi.projectManagement.pojo.Info;
 import com.ruoyi.projectManagement.pojo.PlanNode;
 import com.ruoyi.projectManagement.service.PlanService;
-import com.ruoyi.projectManagement.service.impl.PlanServiceImpl;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -31,7 +33,7 @@
  */
 @Component
 @RequiredArgsConstructor
-@Transactional(rollbackFor = Exception.class,readOnly = true)
+@Transactional(rollbackFor = Exception.class, readOnly = true)
 public class InfoHandleService {
 
     private static final String GENERATE_SERIAL_NUMBER_PREFIX = "XM";
@@ -40,8 +42,10 @@
 
     private final PlanService planService;
 
+    private final CustomerFollowUpFileService customerFollowUpFileService;
+
     @Transactional(rollbackFor = Exception.class)
-    public Long save(@NotNull SaveInfoDto saveInfoDto){
+    public Long save(@NotNull SaveInfoDto saveInfoDto) {
         Info info = BeanUtil.copyProperties(saveInfoDto, Info.class);
 
         // 闄勪欢鐗规畩澶勭悊
@@ -49,32 +53,66 @@
         info.setAttachment(attachmentIds);
 
         // 鐢熸垚搴忓彿 (濡傛灉闇�瑕佽嚜鍔ㄧ敓鎴愮殑璇�)
-        if(StrUtil.isBlank(info.getNo())){
+        if (StrUtil.isBlank(info.getNo())) {
             info.setNo(generateSerialNumber());
         }
         info.setTeam(saveInfoDto.getTeamList());
-        if(info.getId() == null){
+        if (info.getId() == null) {
             // 鐢熸垚瀵瑰簲鐨勯樁娈靛叧绯绘暟鎹�
             info.setPlanStage(getPlanStageList(info.getProjectManagementPlanId()));
             // 鎻掑叆榛樿鐘舵��
             info.setStatus(PlanStageEnum.TO_BEGIN.getCode());
             info.setReviewStatus(ReviewStatusEnum.PENDING_REVIEW.getCode());
             infoMapper.insert(info);
-        }else {
+        } else {
             infoMapper.updateById(info);
         }
         return info.getId();
     }
 
+    @Transactional
+    public void updateById(@NotNull Info info){
+        infoMapper.updateById(info);
+    }
+
+    public SaveInfoDto getInfoById(@NotNull Long id) {
+        Info info = infoMapper.selectById(id);
+        return convert(info);
+    }
+
+    private SaveInfoDto convert(Info info) {
+        SaveInfoDto saveInfoDto = BeanUtil.copyProperties(info, SaveInfoDto.class);
+        // 闄勪欢澶勭悊
+        saveInfoDto.setTeamList(info.getTeam());
+        customerFollowUpFileService.fillAttachment(Lists.newArrayList(saveInfoDto), SaveInfoDto::getAttachment, SaveInfoDto::setAttachmentList);
+        return saveInfoDto;
+
+    }
+
+    /**
+     * 鑾峰彇鏀筰d涓嬪瓙椤圭洰淇℃伅
+     *
+     * @param id
+     * @return
+     */
+    public List<SaveInfoDto> getSubordinateInfo(@NotNull Long id) {
+        LambdaQueryWrapper<Info> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(Info::getProjectManagementInfoParentId, id);
+        queryWrapper.orderByAsc(Info::getCreateTime);
+        List<Info> infoList = infoMapper.selectList(queryWrapper);
+        return infoList.stream().map(this::convert).collect(Collectors.toList());
+    }
+
 
     private List<PlanStageDto> getPlanStageList(@NotNull Long planId) {
         List<PlanNode> planNodeByPlanId = planService.getPlanNodeByPlanId(planId);
-        return planNodeByPlanId.stream().map(it-> new PlanStageDto(it.getId(), it.getName(), PlanStageEnum.TO_BEGIN)).collect(Collectors.toList());
+        return planNodeByPlanId.stream().map(it -> new PlanStageDto(it.getId(), it.getName(), PlanStageEnum.TO_BEGIN, it.getSort(), it.getEstimatedDuration())).collect(Collectors.toList());
     }
 
 
     /**
      * 鐢熸垚椤圭洰缂栧彿
+     *
      * @return
      */
     private String generateSerialNumber() {

--
Gitblit v1.9.3