update
This commit is contained in:
@@ -125,12 +125,12 @@ public class SsoService {
|
||||
|
||||
//用身份证号查询用户 用户类型(01:个人,02:企业)
|
||||
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||
String userType = userJson.getString("userType");
|
||||
userType = "01".equals(userType) ? "1" : "0";
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, userType);
|
||||
String isCompanyUser = userJson.getString("userType");
|
||||
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
||||
if (appUser == null) {
|
||||
//用户不存在,则先保存用户
|
||||
appUser = saveAppUser(userJson, userType);
|
||||
appUser = saveAppUser(userJson, isCompanyUser);
|
||||
}
|
||||
//用户存在,生成本系统用户的token
|
||||
String token = loginAppUser(appUser, userJson.getString("userName"));
|
||||
@@ -176,12 +176,12 @@ public class SsoService {
|
||||
|
||||
//用身份证号查询用户 用户类型(01:个人,02:企业)
|
||||
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||
String userType = userJson.getString("userType");
|
||||
userType = "01".equals(userType) ? "1" : "0";
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, userType);
|
||||
String isCompanyUser = userJson.getString("userType");
|
||||
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
||||
if (appUser == null) {
|
||||
//用户不存在,则先保存用户
|
||||
appUser = saveAppUser(userJson, userType);
|
||||
appUser = saveAppUser(userJson, isCompanyUser);
|
||||
}
|
||||
//用户存在,生成本系统用户的token
|
||||
String token = loginAppUser(appUser, userJson.getString("userName"));
|
||||
@@ -236,12 +236,12 @@ public class SsoService {
|
||||
//用身份证号查询用户 用户类型(01:个人,02:企业)
|
||||
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||
//userType对应appuser的isCompanyUser
|
||||
String userType = userJson.getString("userType");
|
||||
userType = "01".equals(userType) ? "1" : "0";
|
||||
String isCompanyUser = userJson.getString("userType");
|
||||
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
||||
//1.先查appuser,不存在,则新增
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, userType);
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
||||
if (appUser == null) {
|
||||
appUser = saveAppUser(userJson, userType);
|
||||
appUser = saveAppUser(userJson, isCompanyUser);
|
||||
}
|
||||
//2.再查sysuser,不存在,则新增
|
||||
SysUser sysUser = sysUserService.selectUserByIdCard(personCardNo);
|
||||
@@ -301,24 +301,24 @@ public class SsoService {
|
||||
//用身份证号查询用户 用户类型(01:个人,02:企业)
|
||||
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||
//取角色判断是网格员2,还是内部工作者3
|
||||
String userType = null;
|
||||
String isCompanyUser = null;
|
||||
if(userJson.containsKey("roles")) {
|
||||
JSONObject role = userJson.getJSONArray("roles").getJSONObject(0);
|
||||
if (role != null && role.containsKey("roleId")) {
|
||||
/*1101(求职者)、1102(招聘者)、1103(网格员)、1104(内部工作者)*/
|
||||
Long roleId = role.getLong("roleId");
|
||||
if (roleId != null && roleId.equals(1103L)) {
|
||||
userType = "2";//2网格员
|
||||
isCompanyUser = "2";//2网格员
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Long appUserId = null;
|
||||
if (StringUtils.isNotEmpty(userType) && "2".equals(userType)) {
|
||||
if (StringUtils.isNotEmpty(isCompanyUser) && "2".equals(isCompanyUser)) {
|
||||
//1.先查appuser,不存在,则新增
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, userType);
|
||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
||||
if (appUser == null) {
|
||||
appUser = saveAppUser(userJson, userType);
|
||||
appUser = saveAppUser(userJson, isCompanyUser);
|
||||
appUserId = appUser.getUserId();
|
||||
}
|
||||
}
|
||||
@@ -402,6 +402,7 @@ public class SsoService {
|
||||
//保存appuser用户
|
||||
private AppUser saveAppUser(JSONObject userJson, String isCompanyUser) {
|
||||
JSONObject info = userJson.containsKey("info") ? userJson.getJSONObject("info") : null;
|
||||
System.out.println("userId===========" + userJson.getLong("userId"));
|
||||
AppUser appUser = new AppUser();
|
||||
//app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||
appUser.setIsCompanyUser(isCompanyUser);
|
||||
@@ -439,7 +440,7 @@ public class SsoService {
|
||||
appUser.setPhone(phone);
|
||||
}
|
||||
|
||||
AppUser checkUser = appUserService.selectAppUserByUserId(appUser.getUserId());
|
||||
AppUser checkUser = appUserService.selectAppUserByUserId(userJson.getLong("userId"));
|
||||
if (checkUser != null) {
|
||||
appUserService.updateAppUser(appUser);
|
||||
} else {
|
||||
@@ -456,6 +457,7 @@ public class SsoService {
|
||||
*/
|
||||
private SysUser saveSysUser(JSONObject userJson, Long appUserId) {
|
||||
JSONObject info = userJson.containsKey("info") ? userJson.getJSONObject("info") : null;
|
||||
System.out.println("sysuserId==========" + userJson.getLong("userId"));
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setAppUserId(appUserId);
|
||||
sysUser.setUserId(userJson.getLong("userId"));
|
||||
@@ -493,7 +495,7 @@ public class SsoService {
|
||||
sysUser.setDeptId(deptId);
|
||||
}
|
||||
|
||||
SysUser checkUser = sysUserService.selectUserById(sysUser.getUserId());
|
||||
SysUser checkUser = sysUserService.selectUserById(userJson.getLong("userId"));
|
||||
if (checkUser != null) {
|
||||
sysUserService.updateUser(sysUser);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user