From b848451e8889fea12ce40b7818c1b8d84b50ea02 Mon Sep 17 00:00:00 2001 From: lxw <810412026@qq.com> Date: 星期四, 01 九月 2022 13:41:07 +0800 Subject: [PATCH] 权限管理组合操作 --- src/main/java/com/whyc/controller/ProductController.java | 64 +++++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/whyc/controller/ProductController.java b/src/main/java/com/whyc/controller/ProductController.java index 1a88729..cd96f58 100644 --- a/src/main/java/com/whyc/controller/ProductController.java +++ b/src/main/java/com/whyc/controller/ProductController.java @@ -1,18 +1,18 @@ package com.whyc.controller; import com.whyc.dto.Response; -import com.whyc.pojo.ProductHistory; -import com.whyc.service.MaterialService; -import com.whyc.service.ProductBomService; -import com.whyc.service.ProductHistoryService; -import com.whyc.service.ProductService; +import com.whyc.pojo.Product; +import com.whyc.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; @Api(tags = "浜у搧绠$悊") @RestController @@ -26,6 +26,9 @@ @Autowired private ProductBomService bomService; + + @Autowired + private ProductBomHistoryService bomHistoryService; @Autowired private MaterialService meterService; @@ -44,12 +47,45 @@ } @ApiOperation(value = "浜у搧璇︽儏鏌ョ湅鐗堟湰淇℃伅",notes = "8.17淇敼鍚庝娇鐢�") @GetMapping("getProductVersion") - public Response getProductVersion( @RequestParam String parentModel, String customCode){ - return historyService.getProductVersion(parentModel,customCode); + public Response getProductVersion( @RequestParam String parentCode, String customCode){ + return historyService.getProductVersion(parentCode,customCode); } - @ApiOperation(value = "鏍规嵁浜у搧id鏌ヨ瀛愪欢鍙婂叾鍏宠仈鐨勭墿鏂欎俊鎭�",notes = "8.17淇敼鍚庝娇鐢�") + @ApiOperation(value = "鏍规嵁浜у搧id鍜岀増鏈煡璇㈠瓙浠跺強鍏跺叧鑱旂殑鐗╂枡淇℃伅",notes = "8.17淇敼鍚庝娇鐢�") @GetMapping("getBomAndMaterial") - public Response getBomAndMaterial( @RequestParam int productId){ - return bomService.getBomAndMaterial(productId); + public Response getBomAndMaterial( @RequestParam int productId, @RequestParam int version){ + return bomService.getBomAndMaterial(productId,version); + } + @ApiOperation(value = "浜у搧涓嬭浇(浜у搧id鍜岀増鏈�<褰撳墠鏈�鏂扮増鏈�>)",notes = "8.17淇敼鍚庝娇鐢�") + @GetMapping("downloadProduct") + public void downloadProduct(HttpServletRequest req, HttpServletResponse resp, @RequestParam int productId, @RequestParam int version){ + bomService.downloadProduct(req,resp,productId,version); + } + + @ApiOperation(value = "鍘嗗彶浜у搧淇℃伅鏌ョ湅锛堟牴鎹巻鍙蹭骇鍝佷骇鍝乮d鍜岀増鏈煡璇㈠瓙浠跺強鍏跺叧鑱旂殑鐗╂枡淇℃伅锛�",notes = "8.17淇敼鍚庝娇鐢�") + @GetMapping("getBomHistoryAndMaterial") + public Response getBomHistoryAndMaterial( @RequestParam int productId, @RequestParam int version){ + return bomHistoryService.getBomHistoryAndMaterial(productId,version); + } + @ApiOperation(value = "鍘嗗彶浜у搧涓嬭浇(浜у搧id鍜岀増鏈�<涓嬭浇鐨勭増鏈�>)",notes = "8.17淇敼鍚庝娇鐢�") + @GetMapping("downloadProductHistory") + public void downloadProductHistory(HttpServletRequest req, HttpServletResponse resp, @RequestParam int productId, @RequestParam int version){ + bomHistoryService.downloadProductHistory(req,resp,productId,version); + } + + @ApiOperation(value = "鍘嗗彶鐗堟湰鍙敤鎬ц瀹�",notes = "8.31淇敼鍚庝娇鐢�") + @GetMapping("setpHistoryEnable") + public Response setpHistoryEnable( @RequestParam String parentCode, @RequestParam String customCode, @RequestParam int version,@RequestParam int enabled) { + return historyService.setpHistoryEnable(parentCode, customCode, version, enabled); + } + @PostMapping("zipParse") + @ApiOperation("zip瑙f瀽") + public Response zipParse(@RequestParam("file") MultipartFile file) throws IOException, InvalidFormatException { + return service.zipParse(file); + } + + @PostMapping + @ApiOperation(value = "鏂板",notes = "瑙f瀽鏃惰繑鍥炵殑缁濆璺緞,闇�瑕佸洖浼犲埌瀛楁fileUrl") + public Response add(@RequestBody Product product){ + return service.add(product); } } -- Gitblit v1.9.1