buhuazhen
8 天以前 90faa5303c948210cc12795cdb68f3a16ebd17a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.ruoyi.projectManagement.service.impl;
 
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.projectManagement.mapper.PlanMapper;
import com.ruoyi.projectManagement.pojo.Plan;
import com.ruoyi.projectManagement.service.PlanService;
import com.ruoyi.projectManagement.vo.PlanVo;
import com.ruoyi.projectManagement.vo.SavePlanVo;
import com.ruoyi.projectManagement.vo.SearchPlanVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.Collections;
import java.util.Optional;
 
/**
 * @author buhuazhen
 * @description 项目管理计划的实现
 * @createDate 2026-03-06 15:29:26
 */
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class PlanServiceImpl implements PlanService {
 
    private final PlanMapper planMapper;
 
    private final CustomerFollowUpFileService customerFollowUpFileService;
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void savePlan(SavePlanVo savePlanVo) {
        Plan plan = BeanUtil.copyProperties(savePlanVo, Plan.class);
        // 附件处理 , 拼接
        String attachments = String.join(",", Optional.ofNullable(savePlanVo.getAttachmentIds()).orElse(Collections.emptyList()));
        plan.setAttachment(attachments);
 
 
        if (savePlanVo.getId() == null) {
            planMapper.insert(plan);
        } else {
            planMapper.updateById(plan);
        }
 
        // todo@ 节点保存
 
 
    }
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deletePlan(Long id) {
        planMapper.update(null,
                new LambdaUpdateWrapper<Plan>()
                        .eq(Plan::getId, id)
                        .set(Plan::getIsDelete, 1));
        // todo@ 对应节点全部删除
 
 
    }
 
    @Override
    public IPage<PlanVo> searchPlan(SearchPlanVo searchPlanVo) {
        IPage<Plan> planIPage = planMapper.selectPlanPage(searchPlanVo);
        IPage<PlanVo> resultPage = planIPage.convert(plan -> BeanUtil.copyProperties(plan, PlanVo.class));
        // 文件获取
        customerFollowUpFileService.fillAttachment(resultPage.getRecords(), PlanVo::getAttachment, PlanVo::setAttachmentList);
        // todo@ node 节点获取
 
        return resultPage;
    }
 
}