Kaynağa Gözat

根据文档调整

codingliang 2 yıl önce
ebeveyn
işleme
4ade59ce7d

+ 17 - 3
src/main/java/com/sqx/modules/errand/controller/TbIndentController.java

@@ -2,19 +2,23 @@ package com.sqx.modules.errand.controller;
 
 import com.sqx.common.utils.DateUtils;
 import com.sqx.common.utils.Result;
-import com.sqx.modules.app.annotation.Login;
 import com.sqx.modules.app.entity.UserEntity;
 import com.sqx.modules.app.service.UserService;
 import com.sqx.modules.common.entity.CommonInfo;
 import com.sqx.modules.common.service.CommonInfoService;
 import com.sqx.modules.errand.entity.TbIndent;
 import com.sqx.modules.errand.service.TbIndentService;
+import com.sqx.modules.order.entity.TbOrder;
+import com.sqx.modules.order.service.AppOrderService;
 import com.sqx.modules.utils.SenInfoCheckUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -31,6 +35,8 @@ public class TbIndentController {
     private UserService userService;
     @Autowired
     private CommonInfoService commonInfoService;
+    @Autowired
+    private AppOrderService appOrderService;
 
     @ApiOperation("查看所有派单任务")
     @GetMapping(value = "findallIndent")
@@ -113,6 +119,14 @@ public class TbIndentController {
     @ApiOperation("转单")
     @PostMapping("/transferOfOrder")
     public Result transferOfOrder(Long indentId,Long riderUserId){
+        TbIndent indent = tbIndentService.getById(indentId);
+        if("5".equals(indent.getIndentType())){
+            TbOrder tbOrder = appOrderService.getById(indent.getOrderId());
+            if(tbOrder.getAutoSendOrder()!=null && tbOrder.getAutoSendOrder()==1){
+                return Result.error("商家配送不允许转单!");
+            }
+        }
+
         UserEntity userEntity = userService.selectUserById(riderUserId);
         CommonInfo one1 = commonInfoService.findOne(273);
         Double cashDeposit = Double.parseDouble(one1.getValue());
@@ -122,7 +136,7 @@ public class TbIndentController {
         if(!"1".equals(userEntity.getCheckCertification())){
             return Result.error("骑手未进行实名认证!");
         }
-        TbIndent indent = tbIndentService.getById(indentId);
+
         if(indent.getRiderUserId()!=null && userEntity.getUserId().equals(indent.getRiderUserId())){
             return Result.error("不能选择相同的骑手!");
         }