From ec9a95eb994018cc1ba28a80946165f795001dea Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 29 十一月 2024 16:49:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 business/src/main/java/com/ycl/controller/ProjectInfoController.java |   76 ++++++++++++++++++++++++++++++++------
 1 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/business/src/main/java/com/ycl/controller/ProjectInfoController.java b/business/src/main/java/com/ycl/controller/ProjectInfoController.java
index d0144ee..b082e4d 100644
--- a/business/src/main/java/com/ycl/controller/ProjectInfoController.java
+++ b/business/src/main/java/com/ycl/controller/ProjectInfoController.java
@@ -3,17 +3,24 @@
 import com.ycl.common.base.Result;
 import com.ycl.common.group.Add;
 import com.ycl.common.group.Update;
+import com.ycl.common.utils.ProjectCodeGenerator;
+import com.ycl.common.utils.excel.OutputExcelUtils;
+import com.ycl.domain.excel.ProjectExcelTemplate;
+import com.ycl.domain.form.DocumentInfoForm;
 import com.ycl.domain.form.ProjectInfoForm;
+import com.ycl.domain.query.ProjectExportQuery;
 import com.ycl.domain.query.ProjectInfoQuery;
 import com.ycl.service.ProjectInfoService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotEmpty;
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -26,57 +33,102 @@
 @RequiredArgsConstructor
 @Api(value = "椤圭洰绠$悊鍩虹淇℃伅琛�", tags = "椤圭洰绠$悊鍩虹淇℃伅琛ㄧ鐞�")
 @RestController
-@RequestMapping("/api/project-info")
+@RequestMapping("/project/info")
 public class ProjectInfoController {
 
     private final ProjectInfoService projectInfoService;
 
     @PostMapping
     @ApiOperation(value = "娣诲姞", notes = "娣诲姞")
-    @PreAuthorize("hasAuthority('projectInfo:add')")
+//    @PreAuthorize("hasAuthority('projectInfo:add')")
     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')")
+//    @PreAuthorize("hasAuthority('projectInfo:edit')")
     public Result update(@RequestBody @Validated(Update.class) ProjectInfoForm form) {
         return projectInfoService.update(form);
     }
 
     @DeleteMapping("/{id}")
     @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎")
-    @PreAuthorize("hasAuthority('projectInfo:del')")
-    public Result removeById(@PathVariable("id") String id) {
+//    @PreAuthorize("hasAuthority('projectInfo:del')")
+    public Result removeById(@PathVariable("id") Long id) {
         return projectInfoService.removeById(id);
     }
 
     @DeleteMapping("/batch")
     @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎")
-    @PreAuthorize("hasAuthority('projectInfo:del:batch')")
+//    @PreAuthorize("hasAuthority('projectInfo:del:batch')")
     public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) {
         return projectInfoService.remove(ids);
     }
 
     @GetMapping("/page")
     @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉")
-    @PreAuthorize("hasAuthority('projectInfo:page')")
+//    @PreAuthorize("hasAuthority('projectInfo:page')")
     public Result page(ProjectInfoQuery query) {
         return projectInfoService.page(query);
     }
 
     @GetMapping("/{id}")
     @ApiOperation(value = "璇︽儏", notes = "璇︽儏")
-    @PreAuthorize("hasAuthority('projectInfo:detail')")
+//    @PreAuthorize("hasAuthority('projectInfo:detail')")
     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')")
+//    @PreAuthorize("hasAuthority('projectInfo:list')")
     @ApiOperation(value = "鍒楄〃", notes = "鍒楄〃")
     public Result list() {
         return projectInfoService.all();
     }
+
+    /**
+     * 鐢熸垚椤圭洰缂栧彿
+     * @return 椤圭洰缂栧彿
+     */
+    @GetMapping("/getProjectCode")
+    public Result generateProjectCode() {
+        return Result.ok().data(ProjectCodeGenerator.generateProjectCode());
+    };
+
+    @GetMapping("/getManagerFlag/{recordId}")
+    public Result getManagerFlag(@PathVariable("recordId") Integer recordId) {
+        return projectInfoService.getManagerFlag(recordId);
+    }
+
+    /**
+     * 瀵煎嚭妯℃澘
+     * @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);
+    }
+
+    /**
+     * 椤圭洰瀵煎嚭
+     * @param response
+     * @throws IOException
+     */
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ProjectExportQuery query) throws IOException {
+        projectInfoService.export(response, query);
+    }
 }

--
Gitblit v1.8.0