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 | 84 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 77 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/whyc/controller/ProductController.java b/src/main/java/com/whyc/controller/ProductController.java index 0307b1f..cd96f58 100644 --- a/src/main/java/com/whyc/controller/ProductController.java +++ b/src/main/java/com/whyc/controller/ProductController.java @@ -1,21 +1,91 @@ package com.whyc.controller; import com.whyc.dto.Response; -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.RequestParam; +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 +@RequestMapping("product") public class ProductController { @Autowired private ProductService service; - @ApiOperation(tags = "鐗╂枡绠$悊",value = "鏍规嵁鐗╂枡缂栫爜鏌ヨ鎵�鏈夊寘鍚鐗╂枡鐨勪骇鍝佷俊鎭�",notes = "8.17淇敼鍚庝娇鐢�") - @GetMapping() - public Response getProductByMaterial(@RequestParam String subCode){ - return service.getProductByMaterial(subCode); + @Autowired + private ProductHistoryService historyService; + + @Autowired + private ProductBomService bomService; + + @Autowired + private ProductBomHistoryService bomHistoryService; + + @Autowired + private MaterialService meterService; + + @ApiOperation(value = "寤虹珛鍏宠仈鏃舵煡璇㈡墍鏈夌殑鐗╂枡锛堜笉鍒嗛〉锛�",notes = "8.17淇敼鍚庝娇鐢�") + @GetMapping("getAllMaterialNoLimit") + public Response getAllMaterialNoLimit(){ + return meterService.getAllMaterialNoLimit(); + } + + @ApiOperation(value = "鏌ヨ鍑烘墍鏈夌殑浜у搧淇℃伅(鍒嗛〉鍔犳ā绯婃煡璇�<浜у搧鐨勭紪鐮侊紝鍨嬪彿锛屽悕瀛楋紝瀹氬埗琛ㄧ紪鍙�>)",notes = "8.17淇敼鍚庝娇鐢�") + @GetMapping("getAllProduct") + public Response getAllProduct(@RequestParam(required = false) String parentCode,@RequestParam(required = false) String parentName, @RequestParam(required = false) String parentModel + , @RequestParam(required = false) String customCode, @RequestParam int pageCurr, @RequestParam int pageSize){ + return service.getAllProduct(parentCode,parentName,parentModel,customCode,pageCurr,pageSize); + } + @ApiOperation(value = "浜у搧璇︽儏鏌ョ湅鐗堟湰淇℃伅",notes = "8.17淇敼鍚庝娇鐢�") + @GetMapping("getProductVersion") + public Response getProductVersion( @RequestParam String parentCode, String customCode){ + return historyService.getProductVersion(parentCode,customCode); + } + @ApiOperation(value = "鏍规嵁浜у搧id鍜岀増鏈煡璇㈠瓙浠跺強鍏跺叧鑱旂殑鐗╂枡淇℃伅",notes = "8.17淇敼鍚庝娇鐢�") + @GetMapping("getBomAndMaterial") + 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