给接口增加swagger描述

This commit is contained in:
季圣华
2021-11-08 23:14:21 +08:00
parent 744691d916
commit a923700c0e
30 changed files with 383 additions and 12 deletions

View File

@@ -13,6 +13,8 @@ import com.jsh.erp.service.material.MaterialService;
import com.jsh.erp.service.redis.RedisService;
import com.jsh.erp.service.unit.UnitService;
import com.jsh.erp.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jxl.Sheet;
import jxl.Workbook;
import org.slf4j.Logger;
@@ -34,6 +36,7 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
*/
@RestController
@RequestMapping(value = "/material")
@Api(tags = {"商品管理"})
public class MaterialController {
private Logger logger = LoggerFactory.getLogger(MaterialController.class);
@@ -52,7 +55,25 @@ public class MaterialController {
@Resource
private RedisService redisService;
/**
* 检查商品是否存在
* @param id
* @param name
* @param model
* @param color
* @param standard
* @param mfrs
* @param otherField1
* @param otherField2
* @param otherField3
* @param unit
* @param unitId
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/checkIsExist")
@ApiOperation(value = "检查商品是否存在")
public String checkIsExist(@RequestParam("id") Long id, @RequestParam("name") String name,
@RequestParam("model") String model, @RequestParam("color") String color,
@RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs,
@@ -79,6 +100,7 @@ public class MaterialController {
* @throws Exception
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态-启用或者禁用")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
@@ -99,6 +121,7 @@ public class MaterialController {
* @return
*/
@GetMapping(value = "/findById")
@ApiOperation(value = "根据id来查询商品名称")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -120,6 +143,7 @@ public class MaterialController {
* @return
*/
@GetMapping(value = "/findByIdWithBarCode")
@ApiOperation(value = "根据meId来查询商品名称")
public BaseResponseInfo findByIdWithBarCode(@RequestParam("meId") Long meId,
@RequestParam("mpList") String mpList,
HttpServletRequest request) throws Exception{
@@ -164,6 +188,7 @@ public class MaterialController {
* @return
*/
@GetMapping(value = "/findBySelect")
@ApiOperation(value = "查找商品信息")
public JSONObject findBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "q", required = false) String q,
@RequestParam("mpList") String mpList,
@@ -251,6 +276,7 @@ public class MaterialController {
* @throws Exception
*/
@GetMapping(value = "/getMaterialByMeId")
@ApiOperation(value = "根据商品id查找商品信息")
public JSONObject getMaterialByMeId(@RequestParam(value = "meId", required = false) Long meId,
@RequestParam("mpList") String mpList,
HttpServletRequest request) throws Exception{
@@ -317,6 +343,7 @@ public class MaterialController {
* @param response
*/
@GetMapping(value = "/exportExcel")
@ApiOperation(value = "生成excel表格")
public void exportExcel(@RequestParam("categoryId") String categoryId,
@RequestParam("barCode") String barCode,
@RequestParam("name") String name,
@@ -361,6 +388,7 @@ public class MaterialController {
* @return
*/
@PostMapping(value = "/importExcel")
@ApiOperation(value = "excel表格导入产品")
public BaseResponseInfo importExcel(MultipartFile file,
HttpServletRequest request, HttpServletResponse response) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
@@ -387,7 +415,19 @@ public class MaterialController {
return null;
}
}
/**
* 获取商品序列号
* @param q
* @param currentPage
* @param pageSize
* @param request
* @param response
* @return
* @throws Exception
*/
@GetMapping(value = "/getMaterialEnableSerialNumberList")
@ApiOperation(value = "获取商品序列号")
public JSONObject getMaterialEnableSerialNumberList(
@RequestParam(value = "q", required = false) String q,
@RequestParam("page") Integer currentPage,
@@ -406,7 +446,13 @@ public class MaterialController {
return object;
}
/**
* 获取最大条码
* @return
* @throws Exception
*/
@GetMapping(value = "/getMaxBarCode")
@ApiOperation(value = "获取最大条码")
public BaseResponseInfo getMaxBarCode() throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
@@ -423,6 +469,7 @@ public class MaterialController {
* @throws Exception
*/
@GetMapping(value = "/getMaterialNameList")
@ApiOperation(value = "商品名称模糊匹配")
public JSONArray getMaterialNameList() throws Exception {
JSONArray arr = new JSONArray();
try {
@@ -445,6 +492,7 @@ public class MaterialController {
* @throws Exception
*/
@GetMapping(value = "/getMaterialByBarCode")
@ApiOperation(value = "根据条码查询商品信息")
public BaseResponseInfo getMaterialByBarCode(@RequestParam("barCode") String barCode,
@RequestParam("mpList") String mpList,
@RequestParam(required = false, value = "prefixNo") String prefixNo,
@@ -541,6 +589,7 @@ public class MaterialController {
* @throws Exception
*/
@GetMapping(value = "/getListWithStock")
@ApiOperation(value = "商品库存查询")
public BaseResponseInfo getListWithStock(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("depotId") Long depotId,
@@ -585,6 +634,7 @@ public class MaterialController {
* @throws Exception
*/
@PostMapping(value = "/batchSetMaterialCurrentStock")
@ApiOperation(value = "批量设置商品当前的实时库存(按每个仓库)")
public String batchSetMaterialCurrentStock(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
String ids = jsonObject.getString("ids");