update
This commit is contained in:
@@ -128,7 +128,7 @@ public class SsoService {
|
|||||||
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||||
String isCompanyUser = userJson.getString("userType");
|
String isCompanyUser = userJson.getString("userType");
|
||||||
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
||||||
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser, webAppId, webAppSecret);
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginAppUser(appUser, userJson.getString("userName"));
|
String token = loginAppUser(appUser, userJson.getString("userName"));
|
||||||
JSONObject backJson = new JSONObject();
|
JSONObject backJson = new JSONObject();
|
||||||
@@ -161,7 +161,7 @@ public class SsoService {
|
|||||||
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
// 转换成本地:app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||||
String isCompanyUser = userJson.getString("userType");
|
String isCompanyUser = userJson.getString("userType");
|
||||||
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
||||||
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser, webAppId, webAppSecret);
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginAppUser(appUser, userJson.getString("userName"));
|
String token = loginAppUser(appUser, userJson.getString("userName"));
|
||||||
JSONObject backJson = new JSONObject();
|
JSONObject backJson = new JSONObject();
|
||||||
@@ -229,9 +229,9 @@ public class SsoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//1.先查appuser,不存在,则新增
|
//1.先查appuser,不存在,则新增
|
||||||
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser, webAppId, webAppSecret);
|
||||||
//2.再查sysuser,不存在,则新增
|
//2.再查sysuser,不存在,则新增
|
||||||
SysUser sysUser = saveSysUser(userJson, appUser.getUserId(), isCompanyUser);
|
SysUser sysUser = saveSysUser(userJson, appUser.getUserId(), isCompanyUser, webAppId, webAppSecret);
|
||||||
|
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
||||||
@@ -307,14 +307,14 @@ public class SsoService {
|
|||||||
Long appUserId = null;
|
Long appUserId = null;
|
||||||
if (StringUtils.isNotEmpty(isCompanyUser) && "2".equals(isCompanyUser)) {
|
if (StringUtils.isNotEmpty(isCompanyUser) && "2".equals(isCompanyUser)) {
|
||||||
//1.先查appuser,不存在,则新增
|
//1.先查appuser,不存在,则新增
|
||||||
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser, cmsAppId, cmsAppSecret);
|
||||||
appUserId = appUser.getUserId();
|
appUserId = appUser.getUserId();
|
||||||
} /*else {
|
} /*else {
|
||||||
throw new RuntimeException("非网格员不允许执行此操作");
|
throw new RuntimeException("非网格员不允许执行此操作");
|
||||||
}*/
|
}*/
|
||||||
//2.再查sysuser,不存在,则新增
|
//2.再查sysuser,不存在,则新增
|
||||||
//身份证为空则查userId
|
//身份证为空则查userId
|
||||||
SysUser sysUser = saveSysUser(userJson, appUserId, isCompanyUser);
|
SysUser sysUser = saveSysUser(userJson, appUserId, isCompanyUser, cmsAppId, cmsAppSecret);
|
||||||
|
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
||||||
@@ -394,7 +394,7 @@ public class SsoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//保存appuser用户
|
//保存appuser用户
|
||||||
private AppUser saveAppUser(JSONObject userJson, String isCompanyUser) {
|
private AppUser saveAppUser(JSONObject userJson, String isCompanyUser, String appId, String appSecret) {
|
||||||
JSONObject info = userJson.containsKey("info") ? userJson.getJSONObject("info") : null;
|
JSONObject info = userJson.containsKey("info") ? userJson.getJSONObject("info") : null;
|
||||||
System.out.println("userId===========" + userJson.getLong("userId"));
|
System.out.println("userId===========" + userJson.getLong("userId"));
|
||||||
System.out.println("userJson===========" + JSONObject.toJSONString(userJson));
|
System.out.println("userJson===========" + JSONObject.toJSONString(userJson));
|
||||||
@@ -422,7 +422,7 @@ public class SsoService {
|
|||||||
String phone = info.getString("entAdminPhone");
|
String phone = info.getString("entAdminPhone");
|
||||||
//解密电话号码
|
//解密电话号码
|
||||||
if (StringUtils.isNotEmpty(phone)) {
|
if (StringUtils.isNotEmpty(phone)) {
|
||||||
phone = EncryptUtil.decryptByAppIdAndSecret(phone, cmsAppId, cmsAppSecret);
|
phone = EncryptUtil.decryptByAppIdAndSecret(phone, appId, appSecret);
|
||||||
appUser.setPhone(phone);
|
appUser.setPhone(phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,12 +438,12 @@ public class SsoService {
|
|||||||
appUser.setDomicileAddress(info.getString("householdAddress"));
|
appUser.setDomicileAddress(info.getString("householdAddress"));
|
||||||
//证件号
|
//证件号
|
||||||
personCardNo = info != null && info.containsKey("personCardNo") ? info.getString("personCardNo") : userJson.getString("idCardNo");
|
personCardNo = info != null && info.containsKey("personCardNo") ? info.getString("personCardNo") : userJson.getString("idCardNo");
|
||||||
personCardNo = EncryptUtil.decryptByAppIdAndSecret(personCardNo, webAppId, webAppSecret);
|
personCardNo = EncryptUtil.decryptByAppIdAndSecret(personCardNo, appId, appSecret);
|
||||||
appUser.setAge(StringUtil.getAgeByIdNumber(personCardNo));
|
appUser.setAge(StringUtil.getAgeByIdNumber(personCardNo));
|
||||||
String phone = info != null ? info.getString("personPhone") : userJson.getString("phonenumber");
|
String phone = info != null ? info.getString("personPhone") : userJson.getString("phonenumber");
|
||||||
//解密电话号码
|
//解密电话号码
|
||||||
if (StringUtils.isNotEmpty(phone)) {
|
if (StringUtils.isNotEmpty(phone)) {
|
||||||
phone = EncryptUtil.decryptByAppIdAndSecret(phone, webAppId, webAppSecret);
|
phone = EncryptUtil.decryptByAppIdAndSecret(phone, appId, appSecret);
|
||||||
appUser.setPhone(phone);
|
appUser.setPhone(phone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,7 @@ public class SsoService {
|
|||||||
* @param userJson
|
* @param userJson
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private SysUser saveSysUser(JSONObject userJson, Long appUserId, String isCompanyUser) {
|
private SysUser saveSysUser(JSONObject userJson, Long appUserId, String isCompanyUser, String appId, String appSecret) {
|
||||||
JSONObject info = userJson.containsKey("info") ? userJson.getJSONObject("info") : null;
|
JSONObject info = userJson.containsKey("info") ? userJson.getJSONObject("info") : null;
|
||||||
System.out.println("sysuserId==========" + userJson.getLong("userId"));
|
System.out.println("sysuserId==========" + userJson.getLong("userId"));
|
||||||
System.out.println("userJson==========" + JSONObject.toJSONString(userJson));
|
System.out.println("userJson==========" + JSONObject.toJSONString(userJson));
|
||||||
@@ -494,16 +494,16 @@ public class SsoService {
|
|||||||
String phone = info.getString("entAdminPhone");
|
String phone = info.getString("entAdminPhone");
|
||||||
//解密电话号码
|
//解密电话号码
|
||||||
if (StringUtils.isNotEmpty(phone)) {
|
if (StringUtils.isNotEmpty(phone)) {
|
||||||
phone = EncryptUtil.decryptByAppIdAndSecret(phone, cmsAppId, cmsAppSecret);
|
phone = EncryptUtil.decryptByAppIdAndSecret(phone, appId, appSecret);
|
||||||
sysUser.setPhonenumber(phone);
|
sysUser.setPhonenumber(phone);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
personCardNo = info != null && info.containsKey("personCardNo") ? info.getString("personCardNo") : userJson.getString("idCardNo");
|
personCardNo = info != null && info.containsKey("personCardNo") ? info.getString("personCardNo") : userJson.getString("idCardNo");
|
||||||
personCardNo = EncryptUtil.decryptByAppIdAndSecret(personCardNo, webAppId, webAppSecret);
|
personCardNo = EncryptUtil.decryptByAppIdAndSecret(personCardNo, appId, appSecret);
|
||||||
String phone = info != null && info.containsKey("personPhone") ? info.getString("personPhone") : userJson.getString("phonenumber");
|
String phone = info != null && info.containsKey("personPhone") ? info.getString("personPhone") : userJson.getString("phonenumber");
|
||||||
//解密电话号码
|
//解密电话号码
|
||||||
if (StringUtils.isNotEmpty(phone)) {
|
if (StringUtils.isNotEmpty(phone)) {
|
||||||
phone = EncryptUtil.decryptByAppIdAndSecret(phone, webAppId, webAppSecret);
|
phone = EncryptUtil.decryptByAppIdAndSecret(phone, appId, appSecret);
|
||||||
sysUser.setPhonenumber(phone);
|
sysUser.setPhonenumber(phone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user