| | |
| | | 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.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.common.base.Result; |
| | | import com.ycl.domain.entity.ProgressPlan; |
| | | import com.ycl.common.enums.business.FileTypeEnum; |
| | | import com.ycl.domain.entity.*; |
| | | 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.domain.vo.ProjectProgressFileListsRequest; |
| | | import com.ycl.framework.utils.PageUtil; |
| | | import com.ycl.mapper.ProgressPlanMapper; |
| | | import com.ycl.mapper.*; |
| | | import com.ycl.service.ProgressPlanService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | 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; |
| | | private final PlanMapper planMapper; |
| | | private final FileMapper fileMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | |
| | | /** |
| | | * 列表 |
| | |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result saveProjectProgressFileLists(ProjectProgressFileListsRequest request) { |
| | | new LambdaUpdateChainWrapper<>(fileMapper) |
| | | .eq(File::getBusId, request.getProjectReportId()) |
| | | .eq(File::getType, FileTypeEnum.PROJECT_SITUATION_DESCRIPTION.getType()) |
| | | .set(File::getDeleted,1) |
| | | .update(); |
| | | |
| | | request.getSituationDescriptionFileList().stream() |
| | | .forEach(file -> { |
| | | file.setId(null); |
| | | file.setBusId(request.getProjectReportId().longValue()); |
| | | file.setType(FileTypeEnum.PROJECT_SITUATION_DESCRIPTION); |
| | | file.setGmtCreate(new Date()); |
| | | file.setGmtUpdate(new Date()); |
| | | file.setDeleted(0); |
| | | fileMapper.insert(file); |
| | | }); |
| | | |
| | | new LambdaUpdateChainWrapper<>(fileMapper) |
| | | .eq(File::getBusId, request.getProjectReportId()) |
| | | .eq(File::getType, FileTypeEnum.PROJECT_COMPLETE_REPORT.getType()) |
| | | .set(File::getDeleted,1) |
| | | .update(); |
| | | |
| | | request.getCompletedReportFileList().stream() |
| | | .forEach(file -> { |
| | | file.setId(null); |
| | | file.setBusId(request.getProjectReportId().longValue()); |
| | | file.setType(FileTypeEnum.PROJECT_COMPLETE_REPORT); |
| | | file.setGmtCreate(new Date()); |
| | | file.setGmtUpdate(new Date()); |
| | | file.setDeleted(0); |
| | | fileMapper.insert(file); |
| | | }); |
| | | return Result.ok("保存成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result getProjectProgressForm(Integer id) { |
| | | ProjectProgressFileListsRequest result = new ProjectProgressFileListsRequest(); |
| | | result.setProjectReportId(id); |
| | | result.setCompletedReportFileList(new LambdaQueryChainWrapper<>(fileMapper) |
| | | .eq(File::getBusId, id) |
| | | .eq(File::getType, FileTypeEnum.PROJECT_COMPLETE_REPORT) |
| | | .eq(File::getDeleted, 0) |
| | | .list()); |
| | | result.setSituationDescriptionFileList(new LambdaQueryChainWrapper<>(fileMapper) |
| | | .eq(File::getBusId, id) |
| | | .eq(File::getType, FileTypeEnum.PROJECT_SITUATION_DESCRIPTION) |
| | | .eq(File::getDeleted, 0) |
| | | .list()); |
| | | return Result.ok().data(result); |
| | | } |
| | | } |