|
|
@@ -79,8 +79,14 @@ public class sso extends Basic {
|
|
|
if (users.isNotEmpty()) {
|
|
|
Row user = users.get(0);
|
|
|
String status = user.getString("status");
|
|
|
+ long userid = user.getLong("userid");
|
|
|
if (status.equalsIgnoreCase("ACTIVE")) {
|
|
|
- passwordVerificationPassed = true;
|
|
|
+ Rows br_hrRows = new DBConnect("CRM").runSqlQuery("select fagent_num,phone,name from br_hr where hrid='" + accountno + "' and fagent_num!='meida'");
|
|
|
+ if (br_hrRows.isNotEmpty()) {
|
|
|
+ String phone = br_hrRows.get(0).getString("phone");
|
|
|
+ String name = br_hrRows.get(0).getString("name");
|
|
|
+ passwordVerificationPassed = updateAgentUser(connect, userid, accountno);//检查更新账号权限
|
|
|
+ }
|
|
|
} else if (status.equalsIgnoreCase("INACTIVE")) {
|
|
|
errmsg = "账号已被锁定";
|
|
|
} else {
|
|
|
@@ -238,4 +244,50 @@ public class sso extends Basic {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ private boolean updateAgentUser(DBConnect dbConnect, Long userid, String accountno) {
|
|
|
+ try {
|
|
|
+ HashMap<String, Long> roleidMapping = new HashMap<>();
|
|
|
+ roleidMapping.put("agentBoss", 4097L);//经销商主账号权限组
|
|
|
+ roleidMapping.put("agentAssistant", 4098L);//站点老板助理
|
|
|
+ roleidMapping.put("agentRemodelBoss", 4097L);//家装老板
|
|
|
+ roleidMapping.put("agentRemodelAssistant", 4098L);//家装老板助理
|
|
|
+ roleidMapping.put("agentOnlineBoss", 4097L);//网销老板
|
|
|
+ roleidMapping.put("agentOnlineAssistant", 4098L);//网销老板助理
|
|
|
+ roleidMapping.put("shpjsb", 5210L);//售后配件申报
|
|
|
+ roleidMapping.put("assigner", 5211L);//工单派单员
|
|
|
+ roleidMapping.put("serviceStaff", 5211L);//客服人员
|
|
|
+ roleidMapping.put("installer", 5206L);//安装师傅
|
|
|
+
|
|
|
+ Rows crm_roles = new DBConnect("CRM").runSqlQuery("select t1.uid,t1.hrid,t2.role_id,t3.role,t3.description,t3.sys from sys_user_info t1\n" + "inner join sys_user_role t2 on t1.uid=t2.uid\n" + "inner join sys_role t3 on t2.role_id=t3.id\n" + "where hrid='" + accountno + "'");
|
|
|
+ ArrayList<Long> roleids = new ArrayList<>();
|
|
|
+ for (Row crm_role : crm_roles) {
|
|
|
+ String role = crm_role.getString("role");
|
|
|
+ if (roleidMapping.containsKey(role)) {
|
|
|
+ roleids.add(roleidMapping.get(role));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String siteid = "MD";
|
|
|
+ SQLDump sqlDump = new SQLDump();
|
|
|
+
|
|
|
+ DeleteSQL sysUserrole = SQLFactory.createDeleteSQL(dbConnect, "sys_userrole");
|
|
|
+ sysUserrole.setWhere("userid", userid);
|
|
|
+ sysUserrole.setWhere("siteid", siteid);
|
|
|
+ sysUserrole.setWhere("roleid", roleidMapping.values().toArray(new Long[]{}));
|
|
|
+ sqlDump.add(sysUserrole);
|
|
|
+ if (!roleids.isEmpty()) {
|
|
|
+ for (long roleid : roleids) {
|
|
|
+ InsertSQL adduserrole = SQLFactory.createInsertSQL(dbConnect, "sys_userrole");
|
|
|
+ adduserrole.setValue("userid", userid);
|
|
|
+ adduserrole.setValue("roleid", roleid);
|
|
|
+ adduserrole.setValue("siteid", siteid);
|
|
|
+ sqlDump.add(adduserrole);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sqlDump.commit(dbConnect);
|
|
|
+ return true;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|