From 24679b74b46479acf248151f70a3768a9588249b Mon Sep 17 00:00:00 2001
From: zhaoxiaohao <279049017@qq.com>
Date: Thu, 15 Oct 2020 16:58:55 +0800
Subject: [PATCH] 修改  h端添加的用户不能在h端登录的问题

---
 kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysOrganizationServiceImpl.java |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysOrganizationServiceImpl.java b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysOrganizationServiceImpl.java
index 622341f..3d06eac 100644
--- a/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysOrganizationServiceImpl.java
+++ b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysOrganizationServiceImpl.java
@@ -6,6 +6,7 @@
 import com.kidgrow.common.model.ResultBody;
 import com.kidgrow.common.model.SysOrganization;
 import com.kidgrow.common.service.impl.SuperServiceImpl;
+import com.kidgrow.common.utils.StringUtils;
 import com.kidgrow.redis.util.RedisConstant;
 import com.kidgrow.redis.util.RedisUtils;
 import com.kidgrow.usercenter.mapper.SysOrganizationMapper;
@@ -151,7 +152,7 @@
     @Override
     public int deleteByUserId(Long userId) {
         Map<String, Object> params = new HashMap<>();
-        params.put("userId", userId);
+        params.put("user_id", userId);
         return sysUserOrgMapper.deleteByMap(params);
     }
 
@@ -241,16 +242,19 @@
                 SysOrganization sysOrganizationLast = list.get(list.size() - 1);
                 if (sysOrganizationLast.getOrgLevel() >= 2) {
                     String orgCodeLast = sysOrganizationLast.getOrgCode();
-                    //取前部分
-                    String orgCodeLastQianZhui = orgCodeLast.substring(0, orgCodeLast.length() - 3);
-                    //取后部分
-                    Integer codenum = Integer.valueOf(orgCodeLast.substring(orgCodeLast.length() - 3));
-                    String str = "00";
-                    str += (codenum + 1);
-                    String substring = str.substring(str.length() - 3);
-                    return orgCodeLastQianZhui + substring;
+                    if (StringUtils.isNotBlank(orgCodeLast)) {
+                        //取前部分
+                        String orgCodeLastQianZhui = orgCodeLast.substring(0, orgCodeLast.length() - 3);
+                        //取后部分
+                        Integer codenum = Integer.valueOf(orgCodeLast.substring(orgCodeLast.length() - 3));
+                        String str = "00";
+                        str += (codenum + 1);
+                        String substring = str.substring(str.length() - 3);
+                        return orgCodeLastQianZhui + substring;
+                    }
                 } else {
                     String orgCodeLast = sysOrganizationLast.getOrgCode();
+                    if (StringUtils.isNotBlank(orgCodeLast)) {
                     //取前部分
                     String orgCodeLastQianZhui = orgCodeLast.substring(0, orgCodeLast.length() - 7);
                     //取后部分
@@ -259,6 +263,7 @@
                     str += (codenum + 1);
                     String substring = str.substring(str.length() - 7);
                     return orgCodeLastQianZhui + substring;
+                    }
                 }
             } else {
                 String fucode = sysOrg.getOrgCode();

--
Gitblit v1.8.0