From b24e024f386e7f25a071b58e9267a2c19f20ba1e Mon Sep 17 00:00:00 2001
From: luohairen <3399054449@qq.com>
Date: 星期二, 10 十二月 2024 18:11:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
index 308304b..afe0041 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -4,6 +4,7 @@
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ZipUtil;
 import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -23,6 +24,7 @@
 import com.ycl.domain.entity.*;
 import com.ycl.domain.excel.ProjectExcelTemplate;
 import com.ycl.domain.form.DocumentInfoForm;
+import com.ycl.domain.form.PlanForm;
 import com.ycl.domain.form.ProjectInfoForm;
 import com.ycl.domain.query.ProjectExportQuery;
 import com.ycl.domain.query.ProjectInfoQuery;
@@ -69,6 +71,7 @@
     private final ProjectUnitRegistrationInfoMapper unitRegistrationInfoMapper;
     private final FileService fileService;
     private final FileMapper fileMapper;
+    private final PlanMapper planMapper;
 
     /**
      * 娣诲姞
@@ -85,6 +88,7 @@
         entity.setCreateBy(userId);
         entity.setUpdateBy(userId);
         baseMapper.insert(entity);
+        addPlan(entity.getId()); //娣诲姞璁″垝琛�
         //娣诲姞鏂囦欢
         List<File> fileList = form.getFileList();
         fileList.forEach(item -> {
@@ -93,6 +97,17 @@
         });
         fileService.saveBatch(fileList);
         return Result.ok("娣诲姞鎴愬姛").data(entity.getId());
+    }
+
+    public void addPlan(Long projectInfoId) {
+        Plan plan = new Plan();
+        plan.setProjectInfoId(projectInfoId);
+        plan.setReportStatus(1);
+        plan.setMonthStatus(1);
+        plan.setSeasonStatus(1);
+        plan.setYearStatus(1);
+        plan.setDeleted(0);
+        planMapper.insert(plan);
     }
 
     /**
@@ -389,6 +404,9 @@
         ProjectInfo projectInfo = baseMapper.selectById(recordId);
         // 鍒ゆ柇褰撳墠鐢ㄦ埛id鏄惁鍦ㄤ富绠″垪琛ㄤ腑
         String competentDepartment = projectInfo.getCompetentDepartment();
+        if (StringUtils.isEmpty(competentDepartment)){
+            return Result.ok().data(false);
+        }
         List<String> list = Arrays.asList(competentDepartment.split(","));
         // 鑾峰緱褰撳墠鐢ㄦ埛id
         Long userId = SecurityUtils.getUserId();
@@ -446,12 +464,12 @@
                                 //瀹℃壒璁″垝涔�
                                 item.setApprovalPlan(file.getOriginalName());
                             }
-                        }else if(FileTypeEnum.DOCUMENT_INFO.equals(file.getType())){
+                        } else if (FileTypeEnum.DOCUMENT_INFO.equals(file.getType())) {
                             if (file.getBusId().equals(item.getId())) {
                                 //鐩稿叧鏂囦功
                                 item.setDocuments(file.getOriginalName());
                             }
-                        }else if(FileTypeEnum.INVEST_POLICY.equals(file.getType())){
+                        } else if (FileTypeEnum.INVEST_POLICY.equals(file.getType())) {
                             if (file.getBusId().equals(item.getPolicyId())) {
                                 //绗﹀悎浜т笟鏀跨瓥闄勪欢
                                 item.setPolicyComplianceAttachment(file.getOriginalName());
@@ -518,4 +536,14 @@
             }
         }
     }
+
+    @Override
+    public Result updateUsedStatus(Integer id, Integer usedStatus) {
+        ProjectInfo entity = baseMapper.selectById(id);
+        // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
+        Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
+        entity.setUsedStatus(usedStatus);
+        baseMapper.updateById(entity);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
 }

--
Gitblit v1.8.0