From 99a3c99d3e3bc046b3fcb0f23051d91a0c2edba0 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 09 十二月 2024 12:12:32 +0800
Subject: [PATCH] 项目库添加“使用状态”字段

---
 business/src/main/java/com/ycl/domain/form/ProjectInfoForm.java         |    3 +++
 business/src/main/java/com/ycl/domain/entity/ProjectInfo.java           |    4 +++-
 business/src/main/java/com/ycl/controller/ProjectInfoController.java    |   20 ++++++++++++++++++--
 business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java |   14 ++++++++++++--
 business/src/main/java/com/ycl/service/ProjectInfoService.java          |    2 ++
 5 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/business/src/main/java/com/ycl/controller/ProjectInfoController.java b/business/src/main/java/com/ycl/controller/ProjectInfoController.java
index b082e4d..963dfee 100644
--- a/business/src/main/java/com/ycl/controller/ProjectInfoController.java
+++ b/business/src/main/java/com/ycl/controller/ProjectInfoController.java
@@ -44,12 +44,14 @@
     public Result add(@RequestBody @Validated(Add.class) ProjectInfoForm form) {
         return projectInfoService.add(form);
     }
+
     @PostMapping("/document")
     @ApiOperation(value = "娣诲姞鐩稿叧鏂囦欢", notes = "娣诲姞鐩稿叧鏂囦欢")
 //    @PreAuthorize("hasAuthority('projectInfo:add')")
     public Result addDoc(@RequestBody @Validated(Add.class) DocumentInfoForm form) {
         return projectInfoService.addDoc(form);
     }
+
     @PutMapping
     @ApiOperation(value = "淇敼", notes = "淇敼")
 //    @PreAuthorize("hasAuthority('projectInfo:edit')")
@@ -84,12 +86,14 @@
     public Result detail(@PathVariable("id") Integer id) {
         return projectInfoService.detail(id);
     }
+
     @GetMapping("/document/{id}")
     @ApiOperation(value = "鐩稿叧鏂囦欢璇︽儏", notes = "鐩稿叧鏂囦欢璇︽儏")
 //    @PreAuthorize("hasAuthority('projectInfo:detail')")
     public Result docDetail(@PathVariable("id") Integer id) {
         return projectInfoService.docDetail(id);
     }
+
     @GetMapping("/list")
 //    @PreAuthorize("hasAuthority('projectInfo:list')")
     @ApiOperation(value = "鍒楄〃", notes = "鍒楄〃")
@@ -99,12 +103,15 @@
 
     /**
      * 鐢熸垚椤圭洰缂栧彿
+     *
      * @return 椤圭洰缂栧彿
      */
     @GetMapping("/getProjectCode")
     public Result generateProjectCode() {
         return Result.ok().data(ProjectCodeGenerator.generateProjectCode());
-    };
+    }
+
+    ;
 
     @GetMapping("/getManagerFlag/{recordId}")
     public Result getManagerFlag(@PathVariable("recordId") Integer recordId) {
@@ -113,17 +120,19 @@
 
     /**
      * 瀵煎嚭妯℃澘
+     *
      * @param response
      * @return
      */
     @PostMapping("/export/template")
     public void exportTemplate(HttpServletResponse response) throws IOException {
         List<String> fieldList = new ArrayList<>();
-        OutputExcelUtils.export(response, "瀵煎叆妯℃澘", "椤圭洰淇℃伅", null, ProjectExcelTemplate.class ,fieldList);
+        OutputExcelUtils.export(response, "瀵煎叆妯℃澘", "椤圭洰淇℃伅", null, ProjectExcelTemplate.class, fieldList);
     }
 
     /**
      * 椤圭洰瀵煎嚭
+     *
      * @param response
      * @throws IOException
      */
@@ -131,4 +140,11 @@
     public void export(HttpServletResponse response, ProjectExportQuery query) throws IOException {
         projectInfoService.export(response, query);
     }
+
+    @PutMapping("usedStatus/{id}/{usedStatus}")
+    @ApiOperation(value = "淇敼浣跨敤鐘舵��", notes = "淇敼浣跨敤鐘舵��")
+//    @PreAuthorize("hasAuthority('projectInfo:edit')")
+    public Result updateUsedStatus(@PathVariable Integer id, @PathVariable Integer usedStatus) {
+        return projectInfoService.updateUsedStatus(id, usedStatus);
+    }
 }
diff --git a/business/src/main/java/com/ycl/domain/entity/ProjectInfo.java b/business/src/main/java/com/ycl/domain/entity/ProjectInfo.java
index 2029fa3..ce65b79 100644
--- a/business/src/main/java/com/ycl/domain/entity/ProjectInfo.java
+++ b/business/src/main/java/com/ycl/domain/entity/ProjectInfo.java
@@ -141,5 +141,7 @@
     /** 鍒涘缓浜� */
     private Long createBy;
 
-
+    @TableField("used_status")
+    /** 浣跨敤鐘舵�侊紙0锛氳崏绋匡紝1锛氭彁浜�,2:瀹℃牳閫氳繃锛�-1锛氶┏鍥烇級 */
+    private Integer usedStatus;
 }
diff --git a/business/src/main/java/com/ycl/domain/form/ProjectInfoForm.java b/business/src/main/java/com/ycl/domain/form/ProjectInfoForm.java
index 644de14..ac5a053 100644
--- a/business/src/main/java/com/ycl/domain/form/ProjectInfoForm.java
+++ b/business/src/main/java/com/ycl/domain/form/ProjectInfoForm.java
@@ -121,6 +121,9 @@
     @ApiModelProperty("鑱旂郴鏂瑰紡")
     private String contact;
 
+    @ApiModelProperty("浣跨敤鐘舵��")
+    private Integer usedStatus;
+
     public static ProjectInfo getEntityByForm(@NonNull ProjectInfoForm form, ProjectInfo entity) {
         if(entity == null) {
           entity = new ProjectInfo();
diff --git a/business/src/main/java/com/ycl/service/ProjectInfoService.java b/business/src/main/java/com/ycl/service/ProjectInfoService.java
index e92b8b3..41fac95 100644
--- a/business/src/main/java/com/ycl/service/ProjectInfoService.java
+++ b/business/src/main/java/com/ycl/service/ProjectInfoService.java
@@ -82,4 +82,6 @@
     Result getManagerFlag(Integer recordId);
 
     void export(HttpServletResponse response, ProjectExportQuery query) throws IOException;
+
+    Result updateUsedStatus(Integer id, Integer usedStatus);
 }
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 c9b5b18..21740bb 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -447,12 +447,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());
@@ -519,4 +519,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