From 982e63b981079caaae2be3ad8bb11d29cf9cd97b Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 24 十二月 2024 14:43:36 +0800 Subject: [PATCH] 驳回使用自带驳回,对已完成流程查看流程推进的处理 --- business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java | 102 +++++++++++++++++++++++++++----------------------- 1 files changed, 55 insertions(+), 47 deletions(-) diff --git a/business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java index 1a1384a..36e6537 100644 --- a/business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java +++ b/business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java @@ -5,11 +5,12 @@ import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.ycl.common.base.Result; import com.ycl.common.enums.business.FileTypeEnum; +import com.ycl.common.utils.SecurityUtils; import com.ycl.domain.entity.File; import com.ycl.domain.entity.ProjectPlanExamineRecord; import com.ycl.domain.entity.ProjectPlanInfo; import com.ycl.domain.entity.ProjectPlanProgressReport; -import com.ycl.domain.vo.ProgressReportResponseVO; +import com.ycl.domain.form.ProgressReportResponseForm; import com.ycl.framework.utils.PageUtil; import com.ycl.mapper.FileMapper; import com.ycl.mapper.ProjectPlanExamineRecordMapper; @@ -27,8 +28,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; -import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -57,17 +58,25 @@ */ @Transactional(rollbackFor = Exception.class) @Override - public Result add(ProgressReportResponseVO form) { - ProjectPlanProgressReport projectPlanProgressReport = new ProjectPlanProgressReport(); - projectPlanProgressReport.setProjectPlanInfoId(form.getId().longValue()); - projectPlanProgressReport.setStartTime(form.getActualStartTime()); - projectPlanProgressReport.setEndTime(form.getActualEndTime()); - projectPlanProgressReport.setProgressStatus(form.getProgressStatus()); - projectPlanProgressReport.setActualInvest(form.getActualInvest()); - if (form.getProgressReportId() == null) { - baseMapper.insertOne(projectPlanProgressReport); - }else { - projectPlanProgressReport.setId(form.getProgressReportId()); + public Result add(ProgressReportResponseForm form) { + // 鍒ゆ柇涓婃姤鐘舵�� + if (form.getProgressStatusInt() == 0) { // 鏈紑濮� 涓婃姤杩涘害 + ProjectPlanProgressReport projectPlanProgressReport = new ProjectPlanProgressReport(); + projectPlanProgressReport.setProjectPlanInfoId(form.getId()); + projectPlanProgressReport.setStartTime(form.getActualStartTime()); + projectPlanProgressReport.setEndTime(form.getActualEndTime()); + projectPlanProgressReport.setProgressStatus(form.getProgressStatusStr()); + projectPlanProgressReport.setActualInvest(form.getActualInvest()); + // 鏂板杩涘害涓婃姤鍐呭 + baseMapper.insert(projectPlanProgressReport); + }else if (form.getProgressStatusInt() == 2) { // 宸查┏鍥� 閲嶆柊涓婃姤 + ProjectPlanProgressReport projectPlanProgressReport = baseMapper.selectById(form.getProgressReportId()); + projectPlanProgressReport.setProjectPlanInfoId(form.getId()); + projectPlanProgressReport.setStartTime(form.getActualStartTime()); + projectPlanProgressReport.setEndTime(form.getActualEndTime()); + projectPlanProgressReport.setProgressStatus(form.getProgressStatusStr()); + projectPlanProgressReport.setActualInvest(form.getActualInvest()); + // 鏇存柊杩涘害涓婃姤鍐呭 baseMapper.updateById(projectPlanProgressReport); } @@ -77,27 +86,16 @@ .eq(File::getType, FileTypeEnum.PROJECT_PROGRESS_INFO_REPORT.getType()) .set(File::getDeleted,1) .update(); - if (form.getFileList() != null && form.getFileList().size() > 0) { + if (!CollectionUtils.isEmpty(form.getFileList()) && form.getFileList().size() > 0) { form.getFileList().stream() .forEach(file -> { file.setId(null); - file.setBusId(form.getId().longValue()); + file.setBusId(form.getId()); file.setType(FileTypeEnum.PROJECT_PROGRESS_INFO_REPORT); - file.setGmtCreate(new Date()); - file.setGmtUpdate(new Date()); - file.setDeleted(0); fileMapper.insert(file); }); } - - // 鏇存柊涓婄骇鎵瑰 - new LambdaUpdateChainWrapper<>(projectPlanExamineRecordMapper) - .eq(ProjectPlanExamineRecord::getId, form.getExamineRecordId()) - .set(ProjectPlanExamineRecord::getDepartmentApprovalReply, form.getDepartmentApprovalReply()) - .set(ProjectPlanExamineRecord::getManageApprovalReply, form.getManageApprovalReply()) - .update(); - - // 鏇存柊涓婃姤鐘舵�� + // 鏇存柊璁″垝椤圭殑杩涘害鐘舵�佷负鏈鏍� new LambdaUpdateChainWrapper<>(projectPlanInfoMapper) .eq(ProjectPlanInfo::getId, form.getId()) .set(ProjectPlanInfo::getProgressStatus, 1) @@ -161,10 +159,13 @@ * @return */ @Override - public Result detail(Integer id) { - ProgressReportResponseVO vo = baseMapper.getDetail(id); + public Result detail(Long id) { + ProgressReportResponseForm vo = baseMapper.getDetail(id); if (vo != null) { - vo.setFileList(new LambdaQueryChainWrapper<>(fileMapper).eq(File::getBusId, id).eq(File::getType, FileTypeEnum.PROJECT_PROGRESS_INFO_REPORT).list()); + vo.setFileList(new LambdaQueryChainWrapper<>(fileMapper) + .eq(File::getBusId, id) + .eq(File::getType, FileTypeEnum.PROJECT_PROGRESS_INFO_REPORT) + .list()); } return Result.ok().data(vo); } @@ -183,30 +184,37 @@ } @Override - public Result examine(ProgressReportResponseVO form) { - // 鏇存柊瀹℃壒璁板綍 - ProjectPlanExamineRecord record = new ProjectPlanExamineRecord(); - record.setId(form.getExamineRecordId().longValue()); - record.setDepartmentExamine(form.getDepartmentExamine()); - record.setDepartmentApproval(form.getDepartmentApproval()); - record.setManageExamine(form.getManageExamine()); - record.setManageApproval(form.getManageApproval()); - projectPlanExamineRecordMapper.updateById(record); + public Result examine(ProgressReportResponseForm form) { + // 鑾峰緱瀹℃壒璁板綍鍓湰 + ProjectPlanExamineRecord record = projectPlanExamineRecordMapper.selectById(form.getExamineRecordId()); - // 鏇存柊璁″垝椤圭姸鎬� - if (form.getDepartmentExamine() == 0 && form.getManageExamine() == 0){ + // 鏂板涓�鏉″鎵硅褰� + ProjectPlanExamineRecord newRecord = new ProjectPlanExamineRecord();; + newRecord.setProjectPlanRecordId(record.getProjectPlanRecordId()); + newRecord.setProjectPlanInfoId(record.getProjectPlanInfoId()); + newRecord.setDepartmentUserId(SecurityUtils.getUserId()); + newRecord.setDepartmentExamine(form.getDepartmentExamine()); + newRecord.setDepartmentApproval(form.getDepartmentApproval()); + newRecord.setManagerUserId(SecurityUtils.getUserId()); + newRecord.setManageExamine(form.getManageExamine()); + newRecord.setManageApproval(form.getManageApproval()); + newRecord.setEventType(2); + projectPlanExamineRecordMapper.insert(newRecord); + + // 鍒ゆ柇瀹℃壒缁撴灉 + if (form.getDepartmentExamine() == 0 && form.getManageExamine() == 0) { // 瀹℃壒閫氳繃 + // 璁″垝椤硅繘搴︾姸鎬佹洿鏂颁负宸插畬鎴� new LambdaUpdateChainWrapper<>(projectPlanInfoMapper) - .eq(ProjectPlanInfo::getId, form.getId()) - .set(ProjectPlanInfo::getProgressStatus, 3) - .update(); - }else { + .eq(ProjectPlanInfo::getId, form.getId()) + .set(ProjectPlanInfo::getProgressStatus, 3) + .update(); + }else { // 瀹℃壒涓嶉�氳繃 + // 璁″垝椤硅繘搴︾姸鎬佹洿鏂颁负宸查┏鍥� new LambdaUpdateChainWrapper<>(projectPlanInfoMapper) .eq(ProjectPlanInfo::getId, form.getId()) .set(ProjectPlanInfo::getProgressStatus, 2) .update(); } - - return Result.ok("瀹℃壒鎴愬姛"); } } -- Gitblit v1.8.0