Jelajahi Sumber

部门下用户添加主账号
子账户认证关联订单状态

liangpeile 1 tahun lalu
induk
melakukan
97fca6c8d6

+ 11 - 0
crmeb-admin/src/main/java/com/zbkj/admin/controller/platform/NewPlatformApi.java

@@ -219,6 +219,17 @@ public class NewPlatformApi {
             String department = userBypassAccount.getDepartment();
             userBypassAccount.setDepartment(department);
 
+            LambdaQueryWrapper<Order> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            orderLambdaQueryWrapper.in(Order::getStatus, 0, 1, 3, 4);
+            orderLambdaQueryWrapper.in(Order::getRefundStatus, 0, 1, 2);
+            orderLambdaQueryWrapper.eq(Order::getIsDel, false);
+            orderLambdaQueryWrapper.eq(Order::getIsEnterpriseUser, 1);
+            orderLambdaQueryWrapper.eq(Order::getUid, byId.getId());
+            List<Order> orderList = orderService.list(orderLambdaQueryWrapper);
+            if (null != orderList && orderList.size() > 0) {
+                return CommonResult.failed("该用户存在未完成订单,请完成订单后进行认证");
+            }
+
 
             LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(UserBypassAccount::getUserId, userBypassAccount.getUserId());

+ 11 - 46
crmeb-front/src/main/java/com/zbkj/front/controller/NewFrontApi.java

@@ -256,7 +256,7 @@ public class NewFrontApi {
         LambdaQueryWrapper<UserBypassAccount> queryWrapper2 = new LambdaQueryWrapper<>();
         //获取登录账号信息
         User user = userService.getInfo();
-        Integer enterpriseId1 =0;
+        Integer enterpriseId1 = 0;
         if (null != user.getIsAllOrders()) {
             if (3 == user.getIsEnterpriseUser() && 1 == user.getIsAllOrders()) {
                 LambdaQueryWrapper<UserBypassAccount> queryWrapper3 = new LambdaQueryWrapper<>();
@@ -271,7 +271,7 @@ public class NewFrontApi {
             }
         }
 
-       queryWrapper2.eq(UserBypassAccount::getEnterpriseId, id);
+        queryWrapper2.eq(UserBypassAccount::getEnterpriseId, id);
 
         if (!department.equals("")) {
             String[] departments = department.split(",");
@@ -289,7 +289,6 @@ public class NewFrontApi {
         ids.add(enterpriseId1);
 
 
-
         return CommonResult.success(CommonPage.restPage(frontOrderService.list2(isRemit, status, pageRequest, ids,
                 Integer.valueOf(id), department
                 , name)));
@@ -383,12 +382,12 @@ public class NewFrontApi {
 //                    .map(Integer::parseInt)
 //                    .collect(Collectors.toList());
             List<CartMerchantResponse> list2 = cartService.getList2(jsonIds);
-            Integer isInvalid=0;
+            Integer isInvalid = 0;
             for (CartMerchantResponse cartMerchantResponse : list2) {
-                 isInvalid = cartMerchantResponse.getIsInvalid();
-                 if(1==isInvalid){
-                     isInvalid=1;
-                 }
+                isInvalid = cartMerchantResponse.getIsInvalid();
+                if (1 == isInvalid) {
+                    isInvalid = 1;
+                }
             }
             CartShareMerchantResponse cartShareMerchantResponse = new CartShareMerchantResponse();
             cartShareMerchantResponse.setCartInfoList(list2);
@@ -538,44 +537,10 @@ public class NewFrontApi {
     @ApiOperation(value = "查看部门下用户")
     @RequestMapping(value = "departUser", method = RequestMethod.GET)
     public CommonResult<?> departUser(@RequestParam(name = "departmentId", required = false) String departmentId,
-                                      @RequestParam(name = "organizationId", required = false) String organizationId
-    ) {
-        if (StringUtils.isNotBlank(departmentId)) {
-            List<UserBypassAccount> list = new ArrayList<>();
-            String[] split = departmentId.split(",");
-            LambdaQueryWrapper<OrganizationDepartment> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.in(OrganizationDepartment::getId, split);
-            List<OrganizationDepartment> departmentList = organizationDepartmentService.list(queryWrapper);
-            for (OrganizationDepartment organizationDepartment : departmentList) {
-                String organizationId1 = organizationDepartment.getOrganizationId();
-                String name = organizationDepartment.getName();
-                LambdaQueryWrapper<UserEnterprise> queryWrapper2 = new LambdaQueryWrapper<>();
-                queryWrapper2.eq(UserEnterprise::getOrganizationId, organizationId1);
-                UserEnterprise userEnterprise2 = userEnterpriseService.getOne(queryWrapper2);
-                Integer id2 = userEnterprise2.getId();
-                LambdaQueryWrapper<UserBypassAccount> queryWrapper3 = new LambdaQueryWrapper<>();
-                queryWrapper3.eq(UserBypassAccount::getEnterpriseId, id2);
-                queryWrapper3.eq(UserBypassAccount::getDepartment, name);
-                queryWrapper3.eq(UserBypassAccount::getIsDelete, 0);
-                List<UserBypassAccount> list1 = userBypassAccountService.list(queryWrapper3);
-                for (UserBypassAccount userBypassAccount : list1) {
-                    list.add(userBypassAccount);
-                }
-            }
-            return CommonResult.success(list);
-        }
-        else if (StringUtils.isNotBlank(organizationId)) {
-            LambdaQueryWrapper<UserEnterprise> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(UserEnterprise::getOrganizationId, organizationId);
-            UserEnterprise userEnterprise = userEnterpriseService.getOne(queryWrapper);
-            Integer id = userEnterprise.getId();
-            LambdaQueryWrapper<UserBypassAccount> queryWrapper2 = new LambdaQueryWrapper<>();
-            queryWrapper2.eq(UserBypassAccount::getEnterpriseId, id);
-            queryWrapper2.eq(UserBypassAccount::getIsDelete, 0);
-            List<UserBypassAccount> list1 = userBypassAccountService.list(queryWrapper2);
-            return CommonResult.success(list1);
-        }
-        return CommonResult.success("部门下用户为空");
+                                      @RequestParam(name = "organizationId", required = false) String organizationId) {
+
+        return organizationDepartmentService.departUser(departmentId,organizationId);
+
     }
 
     @ApiOperation(value = "专项额度提示")

+ 1 - 0
crmeb-front/src/main/java/com/zbkj/front/service/impl/LoginServiceImpl.java

@@ -271,6 +271,7 @@ public class LoginServiceImpl implements LoginService {
             user.setPhone(request.getPhone());
             user.setAccount(request.getPhone());
             user.setSpreadUid(0);
+            user.setIsEnterpriseUser(1);
             user.setPwd(CommonUtil.createPwd(request.getPhone()));
             user.setNickname(randomChar(4));
             user.setAvatar(systemConfigService.getValueByKey(SysConfigConstants.USER_DEFAULT_AVATAR_CONFIG_KEY));

+ 2 - 0
crmeb-service/src/main/java/com/zbkj/service/service/OrganizationDepartmentService.java

@@ -7,6 +7,7 @@ import com.zbkj.common.model.organization.OrganizationDepartment;
 import com.zbkj.common.model.organization.OrganizationDepartmentUser;
 import com.zbkj.common.model.organization.VO.OrganizationDepartmentVO;
 import com.zbkj.common.model.organization.VO.OrganizationVO;
+import com.zbkj.common.result.CommonResult;
 
 import java.util.List;
 
@@ -20,4 +21,5 @@ public interface OrganizationDepartmentService extends IService<OrganizationDepa
 
     void organizationDepartEdit(OrganizationDepartment request);
 
+    CommonResult<?> departUser(String departmentId, String organizationId);
 }

+ 81 - 0
crmeb-service/src/main/java/com/zbkj/service/service/impl/OrganizationDepartmentServiceImpl.java

@@ -3,6 +3,7 @@ package com.zbkj.service.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
 import com.zbkj.common.model.organization.OrganizationDepartment;
@@ -10,6 +11,7 @@ import com.zbkj.common.model.organization.OrganizationDepartment;
 import com.zbkj.common.model.organization.VO.OrganizationDepartmentVO;
 import com.zbkj.common.model.user.UserBypassAccount;
 import com.zbkj.common.model.user.UserEnterprise;
+import com.zbkj.common.result.CommonResult;
 import com.zbkj.service.dao.OrganizationDeparementDao;
 import com.zbkj.service.dao.UserBypassAccountDao;
 import com.zbkj.service.dao.UserEnterpriseDao;
@@ -20,6 +22,7 @@ import com.zbkj.service.service.UserEnterpriseService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 
 
@@ -70,5 +73,83 @@ public class OrganizationDepartmentServiceImpl extends ServiceImpl<OrganizationD
             }
         }
     }
+
+    @Override
+    public CommonResult<?> departUser(String departmentId, String organizationId) {
+        if (StringUtils.isNotBlank(departmentId)) {
+            List<UserBypassAccount> list = new ArrayList<>();
+            String[] split = departmentId.split(",");
+            LambdaQueryWrapper<OrganizationDepartment> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.in(OrganizationDepartment::getId, split);
+
+            List<OrganizationDepartment> departmentList = this.list(queryWrapper);
+            for (OrganizationDepartment organizationDepartment : departmentList) {
+
+                String organizationId1 = organizationDepartment.getOrganizationId();
+                String name = organizationDepartment.getName();
+
+                LambdaQueryWrapper<UserEnterprise> queryWrapper2 = new LambdaQueryWrapper<>();
+                queryWrapper2.eq(UserEnterprise::getOrganizationId, organizationId1);
+                UserEnterprise userEnterprise2 = userEnterpriseService.getOne(queryWrapper2);
+                Integer id2 = userEnterprise2.getId();
+
+                LambdaQueryWrapper<UserBypassAccount> queryWrapper3 = new LambdaQueryWrapper<>();
+                queryWrapper3.eq(UserBypassAccount::getEnterpriseId, id2);
+                queryWrapper3.eq(UserBypassAccount::getDepartment, name);
+                queryWrapper3.eq(UserBypassAccount::getIsDelete, 0);
+                List<UserBypassAccount> list1 = userBypassAccountService.list(queryWrapper3);
+                for (UserBypassAccount userBypassAccount : list1) {
+                    list.add(userBypassAccount);
+                }
+                if (null == list || list.size() == 0) {
+                    LambdaQueryWrapper<UserEnterprise> queryWrapper4 = new LambdaQueryWrapper<>();
+                    queryWrapper4.eq(UserEnterprise::getOrganizationId, organizationId);
+                    UserEnterprise userEnterprise4 = userEnterpriseService.getOne(queryWrapper4);
+                    UserBypassAccount userBypassAccount = new UserBypassAccount();
+                    userBypassAccount.setId(userEnterprise4.getId());
+                    userBypassAccount.setEnterpriseId(userEnterprise4.getId());
+                    userBypassAccount.setUserId(userEnterprise4.getUserId());
+                    userBypassAccount.setRealName(userEnterprise4.getRealName());
+                    userBypassAccount.setNickname(userEnterprise4.getNickname());
+                    userBypassAccount.setPhone(userEnterprise4.getPhone());
+                    userBypassAccount.setAvatar(userEnterprise4.getAvatar());
+                    userBypassAccount.setIsDelete(userEnterprise4.getIsDelete());
+                    userBypassAccount.setDepartment(userEnterprise4.getDepartment());
+                    userBypassAccount.setDepartmentId(departmentId);
+                    list.add(userBypassAccount);
+                }
+            }
+            return CommonResult.success(list);
+        } else if (StringUtils.isNotBlank(organizationId)) {
+            LambdaQueryWrapper<UserEnterprise> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(UserEnterprise::getOrganizationId, organizationId);
+            UserEnterprise userEnterprise = userEnterpriseService.getOne(queryWrapper);
+            Integer id = userEnterprise.getId();
+            LambdaQueryWrapper<UserBypassAccount> queryWrapper2 = new LambdaQueryWrapper<>();
+            queryWrapper2.eq(UserBypassAccount::getEnterpriseId, id);
+            queryWrapper2.eq(UserBypassAccount::getIsDelete, 0);
+            List<UserBypassAccount> list1 = userBypassAccountService.list(queryWrapper2);
+
+
+            LambdaQueryWrapper<UserEnterprise> queryWrapper4 = new LambdaQueryWrapper<>();
+            queryWrapper4.eq(UserEnterprise::getOrganizationId, organizationId);
+            UserEnterprise userEnterprise4 = userEnterpriseService.getOne(queryWrapper4);
+            UserBypassAccount userBypassAccount = new UserBypassAccount();
+            userBypassAccount.setId(userEnterprise4.getId());
+            userBypassAccount.setEnterpriseId(userEnterprise4.getId());
+            userBypassAccount.setUserId(userEnterprise4.getUserId());
+            userBypassAccount.setRealName(userEnterprise4.getRealName());
+            userBypassAccount.setNickname(userEnterprise4.getNickname());
+            userBypassAccount.setPhone(userEnterprise4.getPhone());
+            userBypassAccount.setAvatar(userEnterprise4.getAvatar());
+            userBypassAccount.setIsDelete(userEnterprise4.getIsDelete());
+            userBypassAccount.setDepartment(userEnterprise4.getDepartment());
+            userBypassAccount.setDepartmentId(departmentId);
+            list1.add(userBypassAccount);
+
+            return CommonResult.success(list1);
+        }
+        return CommonResult.success("部门下用户为空");
+    }
 }
 

+ 1 - 0
crmeb-service/src/main/java/com/zbkj/service/service/impl/UserEnterpriseServiceImpl.java

@@ -79,6 +79,7 @@ public class UserEnterpriseServiceImpl extends ServiceImpl<UserEnterpriseDao, Us
 
             LambdaQueryWrapper<Order> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
             orderLambdaQueryWrapper.in(Order::getStatus, 0, 1, 3, 4);
+            orderLambdaQueryWrapper.in(Order::getRefundStatus, 0, 1, 2);
             orderLambdaQueryWrapper.eq(Order::getIsDel, false);
             orderLambdaQueryWrapper.eq(Order::getIsEnterpriseUser, 1);
             orderLambdaQueryWrapper.eq(Order::getUid, byId.getId());