From 23b688e436a89845e92d861adb5875e625e90d9f Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期五, 14 三月 2025 11:43:18 +0800
Subject: [PATCH] Merge branch 'dev'

---
 business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java |   97 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 66 insertions(+), 31 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 ae2e7e6..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,18 +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());
-//            baseMapper.updateOne(projectPlanProgressReport);
+    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);
         }
 
@@ -78,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)
@@ -162,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);
     }
@@ -182,4 +182,39 @@
                 .collect(Collectors.toList());
         return Result.ok().data(vos);
     }
+
+    @Override
+    public Result examine(ProgressReportResponseForm form) {
+        // 鑾峰緱瀹℃壒璁板綍鍓湰
+        ProjectPlanExamineRecord record = projectPlanExamineRecordMapper.selectById(form.getExamineRecordId());
+
+        // 鏂板涓�鏉″鎵硅褰�
+        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 { // 瀹℃壒涓嶉�氳繃
+            // 璁″垝椤硅繘搴︾姸鎬佹洿鏂颁负宸查┏鍥�
+            new LambdaUpdateChainWrapper<>(projectPlanInfoMapper)
+                    .eq(ProjectPlanInfo::getId, form.getId())
+                    .set(ProjectPlanInfo::getProgressStatus, 2)
+                    .update();
+        }
+        return Result.ok("瀹℃壒鎴愬姛");
+    }
 }

--
Gitblit v1.8.0