From 648a88e5ffa09ac935e1b910c9ff076ed4f4ed1a Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期一, 16 六月 2025 14:50:19 +0800 Subject: [PATCH] 导出修改 --- src/main/java/com/whyc/controller/WorksheetMainController.java | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 150 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/whyc/controller/WorksheetMainController.java b/src/main/java/com/whyc/controller/WorksheetMainController.java index 3167b58..045f4a1 100644 --- a/src/main/java/com/whyc/controller/WorksheetMainController.java +++ b/src/main/java/com/whyc/controller/WorksheetMainController.java @@ -1,8 +1,12 @@ package com.whyc.controller; +import com.github.pagehelper.PageInfo; +import com.whyc.config.EnumWorksheetType; import com.whyc.dto.Response; import com.whyc.dto.WorksheetMainDTO; +import com.whyc.dto.WorksheetMainDTO2; import com.whyc.pojo.DocUser; +import com.whyc.pojo.ProcedureDocApproving; import com.whyc.pojo.WorksheetMain; import com.whyc.service.WorksheetMainService; import com.whyc.util.ActionUtil; @@ -10,8 +14,11 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; -import java.util.List; +import javax.mail.MessagingException; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.Map; @RestController @@ -24,9 +31,9 @@ @PostMapping("submit") @ApiOperation("浜у搧鍥剧焊鍙奲om鎻愪氦") - public Response submit(@RequestBody WorksheetMainDTO mainDTO){ + public Response submit(@RequestBody WorksheetMain main) throws IOException { DocUser user = ActionUtil.getUser(); - boolean res = service.submit(mainDTO,user); + boolean res = service.submit(main,user); if(res) { return new Response().set(1,true, "鎻愪氦瀹屾垚"); }else{ @@ -34,12 +41,104 @@ } } - @GetMapping("list") - @ApiOperation("鑾峰彇宸ヤ綔娴�-鍚勮鑹茬敤鎴峰搴旂殑宸ヤ綔鍙版暟鎹垎绫�") - public Response getList(){ + @PostMapping("materialRelatedSubmit") + @ApiOperation(value="鐗╂枡-浜у搧瀹℃壒鎻愪氦") + public Response materialProductSubmit(@RequestBody WorksheetMainDTO mainDTO){ DocUser user = ActionUtil.getUser(); - Map<String,List<WorksheetMain>> map = service.getList(user); - return new Response().set(1,map); + boolean res = service.MaterialProductSubmit(mainDTO,user); + if(res) { + return new Response().set(1,true, "鎻愪氦瀹屾垚"); + }else{ + return new Response().set(1,false,"瑙掕壊鏃犳硶鎻愪氦瀹℃壒"); + } + } + + /**鍓嶇鏈紶閫掕繃鏉ョ墿鏂欐枃浠舵墍鍦ㄨ矾寰�,瀛樺湪闂 TODO*/ + @PostMapping("materialSubmit") + @ApiOperation(value="鐗╂枡瀹℃壒鎻愪氦") + public Response materialSubmit(@RequestBody WorksheetMain main){ + Response<Object> response = new Response<>(); + DocUser user = ActionUtil.getUser(); + Response res = service.materialSubmit(main,user); + if(res.getCode()==1) { + response.set(1,true, "鎻愪氦瀹屾垚"); + }else if(res.getCode()==3){ + response.set(1,false,"瑙掕壊鏃犳硶鎻愪氦瀹℃壒"); + }else{ + //閲嶅鎻愪氦 + Object existCAList = res.getData(); + Object existMaterialList = res.getData2(); + response.setCode(1); + response.setData(false); + response.setData2(existCAList); + response.setData3(existMaterialList); + if(res.getCode()==21){ + response.setMsg("閲嶅鎻愪氦:鐜版湁鐗╂枡鍙婃鍦ㄨ繘琛屽鎵圭殑鐗╂枡涓�,瀛樺湪褰撳墠鎻愪氦涓婁紶鐨勬暎瑁呬欢"); + }else if(res.getCode()==22){ + response.setMsg("閲嶅鎻愪氦:姝e湪杩涜瀹℃壒鐨勭墿鏂欎腑,瀛樺湪褰撳墠鎻愪氦涓婁紶鐨勭墿鏂�"); + }else{ + response.setMsg("閲嶅鎻愪氦:鐜版湁鐗╂枡涓�,瀛樺湪褰撳墠鎻愪氦涓婁紶鐨勭墿鏂�"); + } + } + return response; + } + + @PostMapping("productSoftwareSubmit") + @ApiOperation(value="浜у搧杞欢瀹℃壒鎻愪氦") + public Response productSoftwareSubmit(@RequestParam MultipartFile multipartFile,@RequestParam String mainDTOString) throws IOException { + DocUser user = ActionUtil.getUser(); + WorksheetMainDTO2 mainDTO = ActionUtil.getGson().fromJson(mainDTOString, WorksheetMainDTO2.class); + return service.productSoftwareSubmit(multipartFile,mainDTO,user); + } + + @GetMapping("statusStatistic") + @ApiOperation("鑾峰彇宸ヤ綔娴�-鍚勮鑹茬敤鎴峰搴旂殑宸ヤ綔鍙版暟鎹垎绫荤粺璁�") + public Response<Map<String,Integer>> getStatusStatistic(){ + DocUser user = ActionUtil.getUser(); + Map<String,Integer> map = service.getStatusStatistic(user); + return new Response<Map<String,Integer>>().set(1,map); + } + + /* + ======寰呭鐞�/宸插鐞�/灞炰簬鑷繁-瀹℃壒涓�/宸查┏鍥�/宸插鎵�====== + + //灞炰簬鑷繁-瀹℃壒涓�/宸查┏鍥�/宸插鎵� + //寰呭鐞�/宸插鐞� + */ + + @GetMapping("approvingListPage") + @ApiOperation("鏌ョ湅鍒嗛〉-瀹℃壒涓�") + public Response<PageInfo<WorksheetMain>> getApprovingListPage(@RequestParam int pageNum,@RequestParam int pageSize){ + DocUser user = ActionUtil.getUser(); + return service.getApprovingListPage(user,pageNum,pageSize); + } + + @GetMapping("rejectedListPage") + @ApiOperation("鏌ョ湅鍒嗛〉-宸查┏鍥�") + public Response<PageInfo<WorksheetMain>> getRejectedListPage(@RequestParam int pageNum,@RequestParam int pageSize){ + DocUser user = ActionUtil.getUser(); + return service.getRejectedListPage(user,pageNum,pageSize); + } + + @GetMapping("approvedListPage") + @ApiOperation("鏌ョ湅鍒嗛〉-宸插鎵�") + public Response<PageInfo<WorksheetMain>> getApprovedListPage(@RequestParam int pageNum, @RequestParam int pageSize){ + DocUser user = ActionUtil.getUser(); + return service.getApprovedListPage(user,pageNum,pageSize); + } + + @GetMapping("handlingListPage") + @ApiOperation(tags = "娴佺▼鍗″拰SOP",value = "鏌ョ湅鍒嗛〉-寰呭鐞�") + public Response<PageInfo<WorksheetMain>> getHandlingListPage(@RequestParam int pageNum, @RequestParam int pageSize){ + DocUser user = ActionUtil.getUser(); + return service.getHandlingListPage(user,pageNum,pageSize); + } + + @GetMapping("handledListPage") + @ApiOperation(tags = "娴佺▼鍗″拰SOP",value = "鏌ョ湅鍒嗛〉-宸插鐞�") + public Response<PageInfo<WorksheetMain>> getHandledListPage(@RequestParam int pageNum, @RequestParam int pageSize){ + DocUser user = ActionUtil.getUser(); + return service.getHandledListPage(user,pageNum,pageSize); } @GetMapping("linkInfo") @@ -49,4 +148,47 @@ return new Response().set(1,main); } + @PostMapping("info") + @ApiOperation("鏌ヨ宸ヤ綔娴佺殑鏍囬鍙婃弿杩�") + public Response getInfo(@RequestParam int id){ + WorksheetMain main = service.getInfo(id); + return new Response().set(1,main); + } + + @GetMapping("myListPage") + @ApiOperation(tags = "娴佺▼鍗″拰SOP",value = "鎴戠殑宸ュ崟") + public Response<PageInfo<WorksheetMain>> getMyList(@RequestParam int pageNum,@RequestParam int pageSize){ + DocUser user = ActionUtil.getUser(); + return service.getMyList(pageNum,pageSize,user); + } + + /** + * {@link EnumWorksheetType#getType()} + * @param approving + * @return + * @throws IOException + * @throws MessagingException + */ + @PostMapping("productProcedureAndSOP") + @ApiOperation(tags = "娴佺▼鍗″拰SOP",value = "纭杩囩▼-浜у搧娴佺▼鍗″強SOP鎻愪氦",notes = "type:1-娴佺▼鍗�,2-SOP") + public Response addProductProcedureAndSOP(@RequestBody ProcedureDocApproving approving) throws IOException, MessagingException { + DocUser user = ActionUtil.getUser(); + return service.addProductProcedureAndSOP(approving,user); + } + + @GetMapping("procedurePreview") + @ApiOperation(tags = "娴佺▼鍗″拰SOP",value = "纭杩囩▼-棰勮pdf",notes = "") + public Response procedurePreview(HttpServletResponse response,@RequestParam int mainId) throws IOException { + return service.procedurePreview(response,mainId); + } + + /** + * 璇㈡墍鏈夌殑宸ュ崟,鎵�鏈変汉鍙 + */ + @PostMapping("getAllPage") + @ApiOperation(value = "璇㈡墍鏈夌殑宸ュ崟,鎵�鏈変汉鍙") + public Response getAllPage(@RequestBody WorksheetMain param) { + return service.getAllPage(param); + } + } -- Gitblit v1.9.1