| | |
| | | package com.ycl.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.common.base.Result; |
| | | import com.ycl.domain.entity.ProgressPlan; |
| | | import com.ycl.domain.entity.ProjectPlanInfo; |
| | | import com.ycl.domain.entity.ProjectPlanRecord; |
| | | import com.ycl.domain.form.ProgressPlanForm; |
| | | import com.ycl.domain.query.ProgressPlanQuery; |
| | | import com.ycl.domain.vo.ProgressPlanInfoFlag; |
| | | import com.ycl.domain.vo.ProgressPlanInfoResponseVO; |
| | | import com.ycl.domain.vo.ProgressPlanVO; |
| | | import com.ycl.framework.utils.PageUtil; |
| | | import com.ycl.mapper.ProgressPlanMapper; |
| | | import com.ycl.mapper.ProjectPlanInfoMapper; |
| | | import com.ycl.mapper.ProjectPlanRecordMapper; |
| | | import com.ycl.service.ProgressPlanService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | public class ProgressPlanServiceImpl extends ServiceImpl<ProgressPlanMapper, ProgressPlan> implements ProgressPlanService { |
| | | |
| | | private final ProgressPlanMapper progressPlanMapper; |
| | | private final ProjectPlanRecordMapper projectPlanRecordMapper; |
| | | private final ProjectPlanInfoMapper projectPlanInfoMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | |
| | | */ |
| | | @Override |
| | | public Result detail(Integer id) { |
| | | ProgressPlanVO vo = baseMapper.getById(id); |
| | | Assert.notNull(vo, "记录不存在"); |
| | | ProgressPlanInfoResponseVO vo = new ProgressPlanInfoResponseVO(); |
| | | List<ProgressPlanInfoFlag> monthProgress = new ArrayList<>(); |
| | | List<ProgressPlanInfoFlag> seasonProgress = new ArrayList<>(); |
| | | List<ProgressPlanInfoFlag> yearProgress = new ArrayList<>(); |
| | | |
| | | // 查询月度计划项 |
| | | new LambdaQueryChainWrapper<>(projectPlanRecordMapper) |
| | | .eq(ProjectPlanRecord::getProjectInfoId, id) |
| | | .eq(ProjectPlanRecord::getPlanTimeFlag, 0) |
| | | .list() |
| | | .stream().forEach(record -> { |
| | | ProgressPlanInfoFlag progressPlanInfoFlag = new ProgressPlanInfoFlag(); |
| | | progressPlanInfoFlag.setPlanTime(record.getPlanTime()); |
| | | progressPlanInfoFlag.setPlanTimeFlag(record.getPlanTimeFlag()); |
| | | progressPlanInfoFlag.setPlanInfoList( |
| | | new LambdaQueryChainWrapper<>(projectPlanInfoMapper) |
| | | .eq(ProjectPlanInfo::getProjectPlanRecordId, record.getId()) |
| | | .list() |
| | | ); |
| | | monthProgress.add(progressPlanInfoFlag); |
| | | }); |
| | | |
| | | // 查询季度计划项 |
| | | new LambdaQueryChainWrapper<>(projectPlanRecordMapper) |
| | | .eq(ProjectPlanRecord::getProjectInfoId, id) |
| | | .eq(ProjectPlanRecord::getPlanTimeFlag, 1) |
| | | .list() |
| | | .stream().forEach(record -> { |
| | | ProgressPlanInfoFlag progressPlanInfoFlag = new ProgressPlanInfoFlag(); |
| | | progressPlanInfoFlag.setPlanTime(record.getPlanTime()); |
| | | progressPlanInfoFlag.setPlanTimeFlag(record.getPlanTimeFlag()); |
| | | progressPlanInfoFlag.setPlanInfoList( |
| | | new LambdaQueryChainWrapper<>(projectPlanInfoMapper) |
| | | .eq(ProjectPlanInfo::getProjectPlanRecordId, record.getId()) |
| | | .list() |
| | | ); |
| | | seasonProgress.add(progressPlanInfoFlag); |
| | | }); |
| | | |
| | | // 查询年度计划项 |
| | | new LambdaQueryChainWrapper<>(projectPlanRecordMapper) |
| | | .eq(ProjectPlanRecord::getProjectInfoId, id) |
| | | .eq(ProjectPlanRecord::getPlanTimeFlag, 2) |
| | | .list() |
| | | .stream().forEach(record -> { |
| | | ProgressPlanInfoFlag progressPlanInfoFlag = new ProgressPlanInfoFlag(); |
| | | progressPlanInfoFlag.setPlanTime(record.getPlanTime()); |
| | | progressPlanInfoFlag.setPlanTimeFlag(record.getPlanTimeFlag()); |
| | | progressPlanInfoFlag.setPlanInfoList( |
| | | new LambdaQueryChainWrapper<>(projectPlanInfoMapper) |
| | | .eq(ProjectPlanInfo::getProjectPlanRecordId, record.getId()) |
| | | .list() |
| | | ); |
| | | yearProgress.add(progressPlanInfoFlag); |
| | | }); |
| | | |
| | | vo.setMonthProgress(monthProgress); |
| | | vo.setSeasonProgress(seasonProgress); |
| | | vo.setYearProgress(yearProgress); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |