liyg 2 年之前
父節點
當前提交
22fe9e3410
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/main/java/com/steerinfo/dil/controller/BackgroundProcessingController.java

+ 6 - 1
src/main/java/com/steerinfo/dil/controller/BackgroundProcessingController.java

@@ -8,6 +8,7 @@ import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.framework.controller.RESTfulResult;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -92,10 +93,14 @@ public class BackgroundProcessingController extends BaseRESTfulController {
 
     @ApiOperation(value = "更新运输订单状态接口")
     @PostMapping("updateOrderStatus")
-    public RESTfulResult updateOrderStatus(@RequestBody(required = false) Map<String,Object> map) {
+    @Transactional(rollbackFor = Exception.class)
+    public RESTfulResult updateOrderStatus(@RequestBody(required = false) Map<String,Object> map) throws Exception{
         if (map.get("orderNumber") != null) {
             if (DataChange.dataToBigDecimal(map.get("orderStatus")).intValue() != 2) {
                 int i = backgroundProcessingMapper.updateOrderStatus(map);
+                if(i > 1){
+                    throw new Exception("该订单号有多个运单,不允许修改,请去数据库手动修改订单状态!");
+                }
                 return success(i);
             }
         }