From e8a75a44bdc130e8b162351c3c94c01f3d8ada5e Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 10 八月 2023 17:58:00 +0800
Subject: [PATCH] 入库+发货
---
sale-server/src/main/java/com/yuanchu/mom/controller/SaleController.java | 28 ++++++++++------------------
1 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/sale-server/src/main/java/com/yuanchu/mom/controller/SaleController.java b/sale-server/src/main/java/com/yuanchu/mom/controller/SaleController.java
index 7a59c70..97fa896 100644
--- a/sale-server/src/main/java/com/yuanchu/mom/controller/SaleController.java
+++ b/sale-server/src/main/java/com/yuanchu/mom/controller/SaleController.java
@@ -18,10 +18,8 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.lang.reflect.Array;
+import java.util.*;
/**
* <p>
@@ -82,12 +80,9 @@
@ApiImplicitParam(name = "id", value = "閿�鍞崟id", dataTypeClass = Integer.class, required = true)
})
@PostMapping("/updateSaleById")
- public Result updateSaleById(@RequestHeader("token") String token, Integer id, @RequestBody SaleVo saleVo) throws JSONException {
- Map<String, String> map = jwt.readJWT(token);
- String data = map.get("data");
- JSONObject jsonObject = new JSONObject(data);
- String saleman = jsonObject.getString("name");
- saleService.updateSaleById(saleman,id, saleVo);
+ public Result updateSaleById(@RequestHeader("token") String token, Integer id, @RequestBody SaleVo saleVo) throws Exception {
+ Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class);
+ saleService.updateSaleById(data.get("name").replaceAll("\"", ""),id, saleVo);
return Result.success("淇敼鎴愬姛!");
}
@@ -103,10 +98,10 @@
@ApiOperation(value = "鎵归噺鍒犻櫎")
@ApiImplicitParams(value = {
- @ApiImplicitParam(name = "ids", value = "閿�鍞崟id", dataTypeClass = String.class, dataType = "List", required = true)
+ @ApiImplicitParam(name = "ids", value = "ids", dataTypeClass = Integer.class, dataType = "List",required = true)
})
@PostMapping("/delAllSale")
- public Result delAllSale( List<Integer> ids) {
+ public Result delAllSale( @RequestParam("ids") List<Integer> ids) {
saleService.delAllSale(ids);
return Result.success();
}
@@ -117,12 +112,9 @@
@ApiImplicitParam(name = "type", value = "鐘舵��", dataTypeClass = Integer.class, required = true)
})
@PostMapping("/check")
- public Result check(@RequestHeader("token") String token,Integer id,Integer type) throws JSONException {
- Map<String, String> map = jwt.readJWT(token);
- String data = map.get("data");
- JSONObject jsonObject = new JSONObject(data);
- String checkname = jsonObject.getString("name");
- saleService.check(checkname,id,type);
+ public Result check(@RequestHeader("token") String token,Integer id,Integer type) throws Exception {
+ Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class);
+ saleService.check(data.get("name").replaceAll("\"", ""),id,type);
return Result.success("瀹℃牳鎴愬姛");
}
--
Gitblit v1.9.3