| | |
| | | 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.ProjectPlanExamineRecord; |
| | | import com.ycl.domain.entity.ProjectPlanInfo; |
| | | import com.ycl.domain.entity.ProjectPlanRecord; |
| | | import com.ycl.domain.form.ProjectPlanInfoForm; |
| | |
| | | import com.ycl.domain.vo.ProjectPlanInfoResponseVO; |
| | | import com.ycl.domain.vo.ProjectPlanInfoVO; |
| | | import com.ycl.framework.utils.PageUtil; |
| | | import com.ycl.mapper.ProjectPlanExamineRecordMapper; |
| | | import com.ycl.mapper.ProjectPlanInfoMapper; |
| | | import com.ycl.mapper.ProjectPlanRecordMapper; |
| | | import com.ycl.service.ProjectPlanInfoService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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; |
| | | |
| | |
| | | |
| | | private final ProjectPlanInfoMapper projectPlanInfoMapper; |
| | | private final ProjectPlanRecordMapper projectPlanRecordMapper; |
| | | private final ProjectPlanExamineRecordMapper projectPlanExamineRecordMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | |
| | | return Result.ok().data(vos); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Result addPlanInfo(ProjectPlanInfoRequest request) { |
| | | if (request.getAddList() == null || request.getAddList().isEmpty()) {{ |
| | | return Result.error("请选择要添加的计划项"); |
| | | }} |
| | | // 删除原有记录 |
| | | new LambdaUpdateChainWrapper<>(baseMapper).eq(ProjectPlanInfo::getProjectPlanRecordId, request.getProjectPlanRecordId()).remove(); |
| | | new LambdaUpdateChainWrapper<>(baseMapper) |
| | | .eq(ProjectPlanInfo::getProjectPlanRecordId, request.getProjectPlanRecordId()) |
| | | .set(ProjectPlanInfo::getDeleted, 1) |
| | | .update(); |
| | | // 批量插入新记录 |
| | | List<ProjectPlanInfo> list = new ArrayList<>(); |
| | | request.getAddList().forEach(item -> { |
| | |
| | | projectPlanInfo.setProgressStatus(0); |
| | | projectPlanInfo.setStartTime(item.getStartTime()); |
| | | projectPlanInfo.setEndTime(item.getEndTime()); |
| | | projectPlanInfo.setDeleted(0); |
| | | list.add(projectPlanInfo); |
| | | }); |
| | | baseMapper.batchInsert(list); |
| | | list.stream().forEach(i -> { |
| | | baseMapper.insert(i); |
| | | }); |
| | | // 更新计划记录的投资,以及上报状态 |
| | | new LambdaUpdateChainWrapper<>(projectPlanRecordMapper) |
| | | .eq(ProjectPlanRecord::getId, request.getProjectPlanRecordId()) |
| | | .set(ProjectPlanRecord::getActualInvest, request.getActualInvest()) |
| | | .set(ProjectPlanRecord::getReportStatus, 0) |
| | | .update(); |
| | | |
| | | // 新增一条审核记录 |
| | | ProjectPlanExamineRecord item = new ProjectPlanExamineRecord(); |
| | | item.setProjectPlanRecordId(request.getProjectPlanRecordId().longValue()); |
| | | item.setEventType(0); |
| | | item.setGmtCreate(new Date()); |
| | | item.setDeleted(0); |
| | | list.stream().forEach(i -> { |
| | | item.setProjectPlanInfoId(i.getId().longValue()); |
| | | projectPlanExamineRecordMapper.insertOne(item); |
| | | // projectPlanExamineRecordMapper.insertOne(item); |
| | | }); |
| | | return Result.ok("添加成功"); |
| | | } |
| | | |
| | |
| | | } |
| | | return Result.ok("保存成功"); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Result delayPlanInfo(ProjectPlanInfoForm request) { |
| | | // 更改计划项时间 |
| | | new LambdaUpdateChainWrapper<>(baseMapper) |
| | | .eq(ProjectPlanInfo::getId, request.getId()) |
| | | .set(ProjectPlanInfo::getStartTime, request.getStartTime()) |
| | | .set(ProjectPlanInfo::getEndTime, request.getEndTime()) |
| | | .update(); |
| | | // 新增一条审核记录 |
| | | ProjectPlanExamineRecord item = new ProjectPlanExamineRecord(); |
| | | item.setProjectPlanRecordId(request.getProjectPlanRecordId().longValue()); |
| | | item.setProjectPlanInfoId(request.getId().longValue()); |
| | | item.setEventType(1); |
| | | item.setDelayStartTime(request.getStartTime()); |
| | | item.setDelayEndTime(request.getEndTime()); |
| | | item.setGmtCreate(new Date()); |
| | | item.setDeleted(0); |
| | | projectPlanExamineRecordMapper.insertOne(item); |
| | | return Result.ok("延期成功"); |
| | | } |
| | | } |