| | |
| | | package com.ycl.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ycl.common.base.Result; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.ycl.common.utils.SecurityUtils; |
| | | import com.ycl.domain.entity.ProjectPlanExamineRecord; |
| | | import com.ycl.framework.utils.PageUtil; |
| | | import com.ycl.domain.entity.ProjectPlanInfo; |
| | | import com.ycl.domain.entity.ProjectPlanRecord; |
| | | import com.ycl.domain.vo.DepartmentApprovalResponseVO; |
| | | import com.ycl.domain.vo.ProjectProcessToDoVo; |
| | | import com.ycl.mapper.ProjectPlanExamineRecordMapper; |
| | | import com.ycl.mapper.ProjectPlanInfoMapper; |
| | | import com.ycl.mapper.ProjectPlanRecordMapper; |
| | | import com.ycl.service.ProjectPlanExamineRecordService; |
| | | |
| | | import com.ycl.common.base.Result; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.domain.form.ProjectPlanExamineRecordForm; |
| | | import com.ycl.domain.vo.ProjectPlanExamineRecordVO; |
| | | import com.ycl.domain.query.ProjectPlanExamineRecordQuery; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | import com.ycl.framework.utils.PageUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | public class ProjectPlanExamineRecordServiceImpl extends ServiceImpl<ProjectPlanExamineRecordMapper, ProjectPlanExamineRecord> implements ProjectPlanExamineRecordService { |
| | | |
| | | private final ProjectPlanExamineRecordMapper projectPlanExamineRecordMapper; |
| | | private final ProjectPlanRecordMapper projectPlanRecordMapper; |
| | | private final ProjectPlanInfoMapper projectPlanInfoMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | |
| | | @Override |
| | | public Result departmentApproval(Integer projectPlanRecordId) { |
| | | List<DepartmentApprovalResponseVO> vo = baseMapper.selectInfo(projectPlanRecordId); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | @Override |
| | | public Result planLog(Integer projectPlanRecordId) { |
| | | List<DepartmentApprovalResponseVO> vo = baseMapper.getPlanLog(projectPlanRecordId); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | /** |
| | | * 回复审批事项 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result replyExamine(ProjectPlanExamineRecordForm form) { |
| | | ProjectPlanExamineRecord projectPlanExamineRecord = ProjectPlanExamineRecordForm.getEntityByForm(form, null); |
| | | projectPlanExamineRecord.setId(form.getId().longValue()); |
| | | projectPlanExamineRecord.setDepartmentUserId(SecurityUtils.getUserId()); |
| | | projectPlanExamineRecord.setManagerUserId(SecurityUtils.getUserId()); |
| | | baseMapper.updateById(projectPlanExamineRecord); |
| | | return Result.ok("回复成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result saveExamine(ProjectPlanExamineRecordForm form) { |
| | | // 更新审批记录 |
| | | ProjectPlanExamineRecord item = ProjectPlanExamineRecordForm.getEntityByForm(form, null); |
| | | item.setId(form.getId().longValue()); |
| | | item.setDepartmentUserId(SecurityUtils.getUserId()); |
| | | item.setManagerUserId(SecurityUtils.getUserId()); |
| | | baseMapper.updateById(item); |
| | | Long projectPlanRecordId = baseMapper.selectById(item.getId()).getProjectPlanRecordId(); |
| | | // 如果同意,计划项状态为已通过,并且新增一条项目进度审核记录,否则为已驳回 |
| | | if (null != form.getDepartmentExamine() && null != form.getManageExamine() && form.getDepartmentExamine() == 0 && form.getManageExamine() == 0) { |
| | | new LambdaUpdateChainWrapper<>(projectPlanInfoMapper) |
| | | .eq(ProjectPlanInfo::getId, form.getProjectPlanInfoId()) |
| | | .set(ProjectPlanInfo::getPlanStatus, 2) |
| | | .update(); |
| | | // 新增项目进度审核记录 |
| | | ProjectPlanExamineRecord newItem = new ProjectPlanExamineRecord(); |
| | | newItem.setProjectPlanRecordId(projectPlanRecordId); // 项目计划记录ID |
| | | newItem.setProjectPlanInfoId(item.getProjectPlanInfoId()); // 项目计划项ID |
| | | newItem.setEventType(2); // 进度上报 |
| | | newItem.setDeleted(0); // 未删除 |
| | | baseMapper.insert(newItem); |
| | | }else{ |
| | | new LambdaUpdateChainWrapper<>(projectPlanInfoMapper) |
| | | .eq(ProjectPlanInfo::getId, form.getProjectPlanInfoId()) |
| | | .set(ProjectPlanInfo::getPlanStatus, 1) |
| | | .update(); |
| | | } |
| | | return Result.ok("审批成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result todoList(Long userId, ProjectPlanExamineRecordQuery query) { |
| | | |
| | | IPage<ProjectProcessToDoVo> page = PageUtil.getPage(query, ProjectProcessToDoVo.class); |
| | | |
| | | baseMapper.todoList(page, query, userId); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | } |