From 53e7dce8d55487cbac64e4374ec9aa1b52a6c6ed Mon Sep 17 00:00:00 2001
From: SZH <szh_hello@163.com>
Date: Thu, 09 Mar 2023 21:16:43 +0800
Subject: [PATCH] 解决npe问题
---
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java
index 619a9e5..bc58e55 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/SafeMaterialDetailController.java
@@ -1,6 +1,7 @@
package com.gkhy.safePlatform.equipment.controller;
import com.alibaba.fastjson.JSONObject;
+import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
@@ -46,15 +47,7 @@
public ResultVO update(Authentication authentication,@Validated @RequestBody SafeMaterialDetailReq req){
return safeMaterialDetailService.update(req);
}
- /**
- * 单独出入库
- * @param authentication
- * @return
- */
- @PostMapping(value = "/single/delivery0rReceipt")
- public ResultVO singleDdelivery0rReceipt(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){
- return safeMaterialDetailService.singleDdelivery0rReceipt(req);
- }
+
/**
* 单独出库
@@ -63,7 +56,9 @@
*/
@PostMapping(value = "/single/delivery")
public ResultVO singleDelivery(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){
- return safeMaterialDetailService.singleDelivery(req);
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ safeMaterialDetailService.singleDelivery(currentUser,req);
+ return new ResultVO(ResultCodes.OK);
}
/**
@@ -73,8 +68,10 @@
*/
@PostMapping(value = "/single/receipt")
public ResultVO singleReceipt(Authentication authentication,@RequestBody JSONObject jsonObject){
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
Long id = jsonObject.getLong("id");
- return safeMaterialDetailService.singleReceipt(id);
+ safeMaterialDetailService.singleReceipt(id,currentUser);
+ return new ResultVO(ResultCodes.OK);
}
/**
* 批量出库 - 根据ids
@@ -83,8 +80,9 @@
*/
@PostMapping(value = "/batch/delivery/ids")
public ResultVO deliveryBatchByIds(Authentication authentication, @Validated @RequestBody MterialDeliveryReq req){
-
- return safeMaterialDetailService.deliveryBatchByIds(req);
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ safeMaterialDetailService.deliveryBatchByIds(req,currentUser);
+ return new ResultVO(ResultCodes.OK);
}
/**
* 批量出库
@@ -93,7 +91,9 @@
*/
@PostMapping(value = "/batch/delivery/random")
public ResultVO deliveryBatchRandom(Authentication authentication,@Validated @RequestBody MterialRandomDeliveryReq req){
- return safeMaterialDetailService.deliveryBatchRandom(req);
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ safeMaterialDetailService.deliveryBatchBySmId(req,currentUser);
+ return new ResultVO(ResultCodes.OK);
}
/**
@@ -101,6 +101,7 @@
*/
@PostMapping(value = "/batch/receipt")
public ResultVO receiptBatch(Authentication authentication ,@Validated @RequestBody ParamForm paramForm){
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
return safeMaterialDetailService.receiptBatch(paramForm);
}
/**
@@ -121,7 +122,8 @@
*/
@PostMapping(value = "/deleteBatch")
public ResultVO deleteBatch(Authentication authentication,@Validated @RequestBody ParamForm paramForm){
- return safeMaterialDetailService.deleteBatch(paramForm);
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ return safeMaterialDetailService.deleteBatch(currentUser,paramForm);
}
@@ -132,7 +134,8 @@
*/
@PostMapping(value = "/page/list")
public SearchResultVO<List<SafeMaterialDetailDto>> listByPage(Authentication authentication, @RequestBody PageQuery<SafeMatetrialDetailQuery> pageQuery){
- return safeMaterialDetailService.listByPage(pageQuery);
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ return safeMaterialDetailService.listByPage(currentUser,pageQuery);
}
/**
@@ -155,7 +158,7 @@
safeMaterialDetailService.deliveryBatchSpw(req);
return new ResultVO<>(ResultCodes.OK);
}
- /* *//**
+ /**
* 根据rfid获去数据
* @param authentication
* @return
--
Gitblit v1.9.2