From 1948a5ff0581e7596249fb8d299559a17c977141 Mon Sep 17 00:00:00 2001
From: luohairen <3399054449@qq.com>
Date: 星期四, 05 十二月 2024 17:08:16 +0800
Subject: [PATCH] 分角色展示项目计划,实现不同角色的功能

---
 business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java |   64 +++++++++++++++++---------------
 1 files changed, 34 insertions(+), 30 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..58300ba 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java
@@ -5,6 +5,7 @@
 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;
@@ -62,12 +63,15 @@
         projectPlanProgressReport.setProjectPlanInfoId(form.getId().longValue());
         projectPlanProgressReport.setStartTime(form.getActualStartTime());
         projectPlanProgressReport.setEndTime(form.getActualEndTime());
-        projectPlanProgressReport.setProgressStatus(form.getProgressStatus());
+        projectPlanProgressReport.setProgressStatus(form.getProgressStatusStr());
         projectPlanProgressReport.setActualInvest(form.getActualInvest());
-        if (form.getProgressReportId() == null) {
-            baseMapper.insertOne(projectPlanProgressReport);
-        }else {
-            projectPlanProgressReport.setId(form.getProgressReportId());
+
+        // 鍒ゆ柇涓婃姤鐘舵��
+        if (form.getProgressStatusInt() == 0) { // 鏈紑濮�  涓婃姤杩涘害
+            // 鏂板杩涘害涓婃姤鍐呭
+            baseMapper.insert(projectPlanProgressReport);
+        }else if (form.getProgressStatusInt() == 2) { // 宸查┏鍥�  閲嶆柊涓婃姤
+            // 鏇存柊杩涘害涓婃姤鍐呭
             baseMapper.updateById(projectPlanProgressReport);
         }
 
@@ -89,15 +93,7 @@
                         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)
@@ -184,29 +180,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);
+        // 鑾峰緱瀹℃壒璁板綍鍓湰
+        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);
+        newRecord.setDeleted(0);
+        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