Browse Source

企业组织机构修改

liangpeile 1 year ago
parent
commit
d1511d2409

+ 9 - 13
crmeb-service/src/main/java/com/zbkj/service/service/impl/OrganizationDepartmentServiceImpl.java

@@ -53,26 +53,22 @@ public class OrganizationDepartmentServiceImpl extends ServiceImpl<OrganizationD
         String id = request.getId();
         LambdaQueryWrapper<UserEnterprise> enterpriseLambdaQueryWrapper = new LambdaQueryWrapper<>();
         enterpriseLambdaQueryWrapper.eq(UserEnterprise::getOrganizationId,request.getOrganizationId());
-        enterpriseLambdaQueryWrapper.eq(UserEnterprise::getIsDelete,0);
         UserEnterprise userEnterprise = userEnterpriseService.getOne(enterpriseLambdaQueryWrapper);
         if (null!=userEnterprise){
             userEnterprise.setDepartment(request.getName());
             userEnterpriseService.updateById(userEnterprise);
-        }
 
-        LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(UserBypassAccount::getDepartmentId,id);
-        queryWrapper.eq(UserBypassAccount::getEnterpriseId,userEnterprise.getId());
-        List<UserBypassAccount> list = userBypassAccountService.list(queryWrapper);
-        if (null!=list&&list.size()>0){
-            for (UserBypassAccount userBypassAccount : list) {
-                userBypassAccount.setDepartment(request.getName());
-                userBypassAccountService.updateById(userBypassAccount);
+            LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(UserBypassAccount::getDepartmentId,id);
+            queryWrapper.eq(UserBypassAccount::getEnterpriseId,userEnterprise.getId());
+            List<UserBypassAccount> list = userBypassAccountService.list(queryWrapper);
+            if (null!=list&&list.size()>0){
+                for (UserBypassAccount userBypassAccount : list) {
+                    userBypassAccount.setDepartment(request.getName());
+                    userBypassAccountService.updateById(userBypassAccount);
+                }
             }
         }
-
-
-
     }
 }
 

+ 18 - 5
crmeb-service/src/main/java/com/zbkj/service/service/impl/UserServiceImpl.java

@@ -311,6 +311,17 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
     @Override
     public Boolean editUser(UserEditInfoRequest request) {
         User user = getInfo();
+        //修改昵称后  修改企业账户信息
+        LambdaQueryWrapper<UserEnterprise> enterpriseLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        enterpriseLambdaQueryWrapper.eq(UserEnterprise::getUserId,user.getId());
+        List<UserEnterprise> list = userEnterpriseService.list(enterpriseLambdaQueryWrapper);
+        if (null!=list&&list.size()>0){
+            for (UserEnterprise userEnterprise : list) {
+                userEnterprise.setNickname(request.getNickname());
+                userEnterpriseService.updateById(userEnterprise);
+            }
+        }
+
         LambdaUpdateWrapper<User> wrapper = Wrappers.lambdaUpdate();
         wrapper.set(User::getNickname, request.getNickname());
         wrapper.set(User::getAvatar, systemAttachmentService.clearPrefix(request.getAvatar()));
@@ -1161,11 +1172,14 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
         LambdaQueryWrapper<UserEnterprise> enterpriseLambdaQueryWrapper = new LambdaQueryWrapper<>();
         enterpriseLambdaQueryWrapper.eq(UserEnterprise::getUserId, user.getId());
         UserEnterprise one = userEnterpriseService.getOne(enterpriseLambdaQueryWrapper);
-        BigDecimal usedLineOfCredit = one.getUsedLineOfCredit();
-        int i = usedLineOfCredit.compareTo(BigDecimal.valueOf(0));
-        if (i > 0) {
-            return false;
+        if (null!=one){
+            BigDecimal usedLineOfCredit = one.getUsedLineOfCredit();
+            int i = usedLineOfCredit.compareTo(BigDecimal.valueOf(0));
+            if (i > 0) {
+                return false;
+            }
         }
+
         userEnterpriseService.remove(enterpriseLambdaQueryWrapper);
         if (null != one) {
             LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
@@ -1175,7 +1189,6 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
         //注销企业子用户
         LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(UserBypassAccount::getUserId, user.getId());
-        queryWrapper.eq(UserBypassAccount::getIsDelete, 1);
         userBypassAccountService.remove(queryWrapper);