Browse Source

同步代码块

lmstack 3 years ago
parent
commit
83a962a38f

+ 5 - 5
src/main/java/cn/fastfun/controller/api/ApiAppDeviceLogController.java

@@ -46,7 +46,7 @@ public class ApiAppDeviceLogController {
 
     @ApiOperation(value = "新增入库 单个 or 批次")
     @RequestMapping(value = "instorage", method = RequestMethod.POST)
-    public ApiDTO inStorage(@RequestBody @ApiParam(name = "入库参数", value = "指定sn", required = true) LibraryInFormParam param) {
+    public synchronized ApiDTO inStorage(@RequestBody @ApiParam(name = "入库参数", value = "指定sn", required = true) LibraryInFormParam param) {
         deviceLogService.putInStorage(param);
         return ApiDTO.ok();
     }
@@ -196,7 +196,7 @@ public class ApiAppDeviceLogController {
 
     @ApiOperation(value = "根据sn或batch调拨 ")
     @RequestMapping(value = "transfer", method = RequestMethod.POST)
-    public ApiDTO transfer(@RequestBody @ApiParam(name = "划拨参数", value = "传入json格式", required = true) TransferFormParam param) {
+    public synchronized ApiDTO transfer(@RequestBody @ApiParam(name = "划拨参数", value = "传入json格式", required = true) TransferFormParam param) {
         if (CollectionUtils.isEmpty(param.getBatchNum()) && CollectionUtils.isEmpty(param.getSn()))
             return ApiDTO.error("未设定设备号或sn");
         deviceLogService.transfer(param);
@@ -205,7 +205,7 @@ public class ApiAppDeviceLogController {
 
     @ApiOperation(value = "调回平台 ")
     @RequestMapping(value = "transferBack", method = RequestMethod.POST)
-    public ApiDTO transferBack(@RequestBody @ApiParam(name = "回调参数", value = "输入sn", required = true) TransferFormParam param) {
+    public synchronized ApiDTO transferBack(@RequestBody @ApiParam(name = "回调参数", value = "输入sn", required = true) TransferFormParam param) {
         deviceLogService.transferBack(param);
         return ApiDTO.ok();
     }
@@ -369,7 +369,7 @@ public class ApiAppDeviceLogController {
 
     @ApiOperation(value = "根据sn或batch出库")
     @RequestMapping(value = "outstorage", method = RequestMethod.POST)
-    public ApiDTO outStorage(@RequestBody @ApiParam(name = "出库参数", value = "传入json格式", required = true) LibraryOutFormParam param) {
+    public synchronized ApiDTO outStorage(@RequestBody @ApiParam(name = "出库参数", value = "传入json格式", required = true) LibraryOutFormParam param) {
         deviceLogService.outStorage(param);
         return ApiDTO.ok();
     }
@@ -498,7 +498,7 @@ public class ApiAppDeviceLogController {
 
     @ApiOperation(value = "新增处置")
     @RequestMapping(value = "handle", method = RequestMethod.POST)
-    public ApiDTO handle(@RequestBody @ApiParam(name = "出库参数", value = "传入json格式", required = true) HandelFormParam param) {
+    public synchronized ApiDTO handle(@RequestBody @ApiParam(name = "出库参数", value = "传入json格式", required = true) HandelFormParam param) {
         deviceLogService.handle(param);
         return ApiDTO.ok();
     }

+ 1 - 0
src/main/java/cn/fastfun/service/impl/AppDeviceLogServiceImpl.java

@@ -232,6 +232,7 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
     }
 
     @Override
+    @Transactional
     public void transferBack(TransferFormParam param) {
         AppDevice appDevice = appDeviceService.getOne(QueryParamExp.eq("sn", param.getSn().get(0)));
         // 查询当前操作id的最大值