Browse Source

:poop: 铲屎,铲除创建订单时重复判断后设置错误的企业id的逻辑

Twelve615 1 year ago
parent
commit
c1e0ba8805

+ 7 - 5
crmeb-front/src/main/java/com/zbkj/front/service/impl/FrontOrderServiceImpl.java

@@ -319,9 +319,9 @@ public class FrontOrderServiceImpl implements FrontOrderService {
     @Override
     public OrderNoResponse createOrder(CreateOrderRequest orderRequest) {
         User user = userService.getInfo();
-        //if (user ==null) {
-        //    throw new CrmebException("获取用户信息失败无法创建订单");
-        //}
+        if (user ==null) {
+            throw new CrmebException("获取用户信息失败无法创建订单");
+        }
         //if(Strings.isNullOrEmpty(user.getPhone())){
         //    throw new CrmebException("请添加手机号");
         //}
@@ -408,6 +408,7 @@ public class FrontOrderServiceImpl implements FrontOrderService {
                 UserEnterprise userEnterprise = userEnterpriseService.getOne(enterpriseLambdaQueryWrapper);
                 if (null != userEnterprise) {
                     order.setProcureUnit(userEnterprise.getEnterpriseName());
+                    order.setEnterpriseId(userEnterprise.getId());
                 }
 
             } else if (3 == isEnterpriseUser) {
@@ -419,6 +420,7 @@ public class FrontOrderServiceImpl implements FrontOrderService {
                     Integer enterpriseId = userBypassAccount.getEnterpriseId();
                     UserEnterprise userEnterprise = userEnterpriseService.getById(enterpriseId);
                     order.setProcureUnit(userEnterprise.getEnterpriseName());
+                    order.setEnterpriseId(enterpriseId);
                 } else {
                     order.setProcureUnit("");
                 }
@@ -431,7 +433,7 @@ public class FrontOrderServiceImpl implements FrontOrderService {
         }
 
         //企业子账户只能看自己企业的订单
-        if (2 == user.getIsEnterpriseUser() || 3 == user.getIsEnterpriseUser()) {
+/*        if (2 == user.getIsEnterpriseUser() || 3 == user.getIsEnterpriseUser()) {
             LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(UserBypassAccount::getUserId, user.getId());
             queryWrapper.eq(UserBypassAccount::getIsDelete, 0);
@@ -449,7 +451,7 @@ public class FrontOrderServiceImpl implements FrontOrderService {
                     order.setEnterpriseId(enterpriseId);
                 }
             }
-        }
+        }*/
 
         // 商户订单
         List<Integer> couponIdList = CollUtil.newArrayList();