update
This commit is contained in:
@@ -329,6 +329,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|||||||
CompanyContact contact=new CompanyContact();
|
CompanyContact contact=new CompanyContact();
|
||||||
contact.setCompanyId(companyResult.getCompanyId());
|
contact.setCompanyId(companyResult.getCompanyId());
|
||||||
List<CompanyContact> contacts=companyContactMapper.getSelectList(contact);
|
List<CompanyContact> contacts=companyContactMapper.getSelectList(contact);
|
||||||
|
companyResult.setCompanyContactList(contacts);
|
||||||
}
|
}
|
||||||
return companyResult;
|
return companyResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,11 +142,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 = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
||||||
if (appUser == null) {
|
|
||||||
//用户不存在,则先保存用户
|
|
||||||
appUser = saveAppUser(userJson, isCompanyUser);
|
|
||||||
}
|
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginAppUser(appUser, userJson.getString("userName"));
|
String token = loginAppUser(appUser, userJson.getString("userName"));
|
||||||
JSONObject backJson = new JSONObject();
|
JSONObject backJson = new JSONObject();
|
||||||
@@ -193,11 +189,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 = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
||||||
if (appUser == null) {
|
|
||||||
//用户不存在,则先保存用户
|
|
||||||
appUser = saveAppUser(userJson, isCompanyUser);
|
|
||||||
}
|
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginAppUser(appUser, userJson.getString("userName"));
|
String token = loginAppUser(appUser, userJson.getString("userName"));
|
||||||
JSONObject backJson = new JSONObject();
|
JSONObject backJson = new JSONObject();
|
||||||
@@ -277,15 +269,9 @@ public class SsoService {
|
|||||||
String isCompanyUser = userJson.getString("userType");
|
String isCompanyUser = userJson.getString("userType");
|
||||||
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
isCompanyUser = "01".equals(isCompanyUser) ? "1" : "0";
|
||||||
//1.先查appuser,不存在,则新增
|
//1.先查appuser,不存在,则新增
|
||||||
AppUser appUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
||||||
if (appUser == null) {
|
|
||||||
appUser = saveAppUser(userJson, isCompanyUser);
|
|
||||||
}
|
|
||||||
//2.再查sysuser,不存在,则新增
|
//2.再查sysuser,不存在,则新增
|
||||||
SysUser sysUser = sysUserService.selectUserByIdCard(personCardNo);
|
SysUser sysUser = saveSysUser(userJson, appUser.getUserId(), isCompanyUser);
|
||||||
if (sysUser == null) {
|
|
||||||
sysUser = saveSysUser(userJson, appUser.getUserId(),isCompanyUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
||||||
@@ -369,24 +355,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 = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
AppUser appUser = saveAppUser(userJson, isCompanyUser);
|
||||||
if (appUser == null) {
|
|
||||||
appUser = saveAppUser(userJson, isCompanyUser);
|
|
||||||
appUserId = appUser.getUserId();
|
appUserId = appUser.getUserId();
|
||||||
}
|
} else {
|
||||||
|
throw new RuntimeException("非网格员不允许执行此操作");
|
||||||
}
|
}
|
||||||
//2.再查sysuser,不存在,则新增
|
//2.再查sysuser,不存在,则新增
|
||||||
//身份证为空则查userId
|
//身份证为空则查userId
|
||||||
SysUser sysUser = null;
|
SysUser sysUser = saveSysUser(userJson, appUserId, isCompanyUser);
|
||||||
if (StringUtils.isNotEmpty(personCardNo)) {
|
|
||||||
sysUser = sysUserService.selectUserByIdCard(personCardNo);
|
|
||||||
} else {
|
|
||||||
sysUser = sysUserService.selectUserById(userJson.getLong("userId"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sysUser == null) {
|
|
||||||
sysUser = saveSysUser(userJson, appUserId,isCompanyUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
//用户存在,生成本系统用户的token
|
//用户存在,生成本系统用户的token
|
||||||
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
String token = loginSysUser(sysUser, userJson.getString("userName"));
|
||||||
@@ -472,18 +448,8 @@ public class SsoService {
|
|||||||
AppUser appUser = new AppUser();
|
AppUser appUser = new AppUser();
|
||||||
//app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
//app角色:0企业,1求职者,2网格员 3内部政府人员 4其他(浪潮用)
|
||||||
appUser.setIsCompanyUser(isCompanyUser);
|
appUser.setIsCompanyUser(isCompanyUser);
|
||||||
appUser.setUserId(userJson.getLong("userId"));
|
// appUser.setUserId(userJson.getLong("userId"));
|
||||||
appUser.setName(info != null ? info.getString("personName") : userJson.getString("nickName"));
|
|
||||||
appUser.setSex(info != null ? info.getString("personSex") : userJson.getString("sex"));
|
|
||||||
if (info != null) {
|
|
||||||
appUser.setBirthDate(info.getString("personBirthday"));
|
|
||||||
appUser.setEducation(StringUtil.convertEducation(info.getString("personEducation")));
|
|
||||||
appUser.setPoliticalAffiliation(info.getString("personPolitical"));
|
|
||||||
appUser.setAddress(info.getString("liveAddress"));
|
|
||||||
appUser.setWorkExperience(StringUtil.convertExp(info.getInteger("personYearsWorking")));
|
|
||||||
appUser.setNation(info.getString("personNation"));
|
|
||||||
appUser.setDomicileAddress(info.getString("householdAddress"));
|
|
||||||
}
|
|
||||||
String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
|
String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
|
||||||
appUser.setCreateTime(date);
|
appUser.setCreateTime(date);
|
||||||
appUser.setUpdateTime(date);
|
appUser.setUpdateTime(date);
|
||||||
@@ -492,22 +458,44 @@ public class SsoService {
|
|||||||
appUser.setLoginIp(IpUtils.getIpAddr());
|
appUser.setLoginIp(IpUtils.getIpAddr());
|
||||||
|
|
||||||
//获取身份证,再获取年龄
|
//获取身份证,再获取年龄
|
||||||
String personCardNo = info != null ? info.getString("personCardNo") : userJson.getString("idCardNo");
|
String personCardNo = null;
|
||||||
//解密处理
|
//1.求职者 2.网格员
|
||||||
if (StringUtils.isNotEmpty(personCardNo)) {
|
if("1".equals(isCompanyUser) || "2".equals(isCompanyUser)){
|
||||||
|
appUser.setName(info != null ? info.getString("personName") : userJson.getString("nickName"));
|
||||||
|
appUser.setSex(info != null ? info.getString("personSex") : userJson.getString("sex"));
|
||||||
|
appUser.setBirthDate(info.getString("personBirthday"));
|
||||||
|
appUser.setEducation(StringUtil.convertEducation(info.getString("personEducation")));
|
||||||
|
appUser.setPoliticalAffiliation(info.getString("personPolitical"));
|
||||||
|
appUser.setAddress(info.getString("liveAddress"));
|
||||||
|
appUser.setWorkExperience(StringUtil.convertExp(info.getInteger("personYearsWorking")));
|
||||||
|
appUser.setNation(info.getString("personNation"));
|
||||||
|
appUser.setDomicileAddress(info.getString("householdAddress"));
|
||||||
|
//证件号
|
||||||
|
personCardNo = info != null && info.containsKey("personCardNo") ? info.getString("personCardNo") : userJson.getString("idCardNo");
|
||||||
personCardNo = EncryptUtil.decryptByAppIdAndSecret(personCardNo, webAppId, webAppSecret);
|
personCardNo = EncryptUtil.decryptByAppIdAndSecret(personCardNo, webAppId, webAppSecret);
|
||||||
appUser.setAge(StringUtil.getAgeByIdNumber(personCardNo));
|
appUser.setAge(StringUtil.getAgeByIdNumber(personCardNo));
|
||||||
appUser.setIdCard(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, webAppId, webAppSecret);
|
||||||
appUser.setPhone(phone);
|
appUser.setPhone(phone);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
personCardNo = info.getString("entCreditCode");
|
||||||
|
appUser.setAddress(info.getString("entRegisteredAddress"));
|
||||||
|
String phone = info.getString("entAdminPhone");
|
||||||
|
//解密电话号码
|
||||||
|
if (StringUtils.isNotEmpty(phone)) {
|
||||||
|
phone = EncryptUtil.decryptByAppIdAndSecret(phone, webAppId, webAppSecret);
|
||||||
|
appUser.setPhone(phone);
|
||||||
|
}
|
||||||
|
|
||||||
AppUser checkUser = appUserService.selectAppUserByUserId(userJson.getLong("userId"));
|
}
|
||||||
|
appUser.setIdCard(personCardNo);
|
||||||
|
|
||||||
|
AppUser checkUser = appUserService.selectAppuserByIdcardAndUserType(personCardNo, isCompanyUser);
|
||||||
if (checkUser != null) {
|
if (checkUser != null) {
|
||||||
|
appUser.setUserId(checkUser.getUserId());
|
||||||
appUserService.updateAppUser(appUser);
|
appUserService.updateAppUser(appUser);
|
||||||
} else {
|
} else {
|
||||||
appUserService.insertAppUser(appUser);
|
appUserService.insertAppUser(appUser);
|
||||||
@@ -521,7 +509,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) {
|
||||||
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));
|
||||||
@@ -543,22 +531,30 @@ public class SsoService {
|
|||||||
|
|
||||||
//获取身份证
|
//获取身份证
|
||||||
String personCardNo="";
|
String personCardNo="";
|
||||||
if("0".equals(isCompanyUser)){
|
//1.求职者 2.风格员
|
||||||
|
if("1".equals(isCompanyUser) || "2".equals(isCompanyUser)){
|
||||||
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, webAppId, webAppSecret);
|
||||||
}else{
|
|
||||||
personCardNo = info.getString("entCreditCode");
|
|
||||||
}
|
|
||||||
//解密处理
|
|
||||||
if (StringUtils.isNotEmpty(personCardNo)) {
|
|
||||||
sysUser.setIdCard(personCardNo);
|
|
||||||
}
|
|
||||||
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, webAppId, webAppSecret);
|
||||||
sysUser.setPhonenumber(phone);
|
sysUser.setPhonenumber(phone);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
personCardNo = info.getString("entCreditCode");
|
||||||
|
String phone = info.getString("entAdminPhone");
|
||||||
|
//解密电话号码
|
||||||
|
if (StringUtils.isNotEmpty(phone)) {
|
||||||
|
phone = EncryptUtil.decryptByAppIdAndSecret(phone, webAppId, webAppSecret);
|
||||||
|
sysUser.setPhonenumber(phone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//解密处理
|
||||||
|
if (StringUtils.isNotEmpty(personCardNo)) {
|
||||||
|
sysUser.setIdCard(personCardNo);
|
||||||
|
}
|
||||||
|
|
||||||
//部门
|
//部门
|
||||||
if (userJson.containsKey("dept")) {
|
if (userJson.containsKey("dept")) {
|
||||||
JSONObject dept = userJson.getJSONObject("dept");
|
JSONObject dept = userJson.getJSONObject("dept");
|
||||||
|
|||||||
Reference in New Issue
Block a user