|
|
@ -171,13 +171,14 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { |
|
|
|
} |
|
|
|
Object RegisterResult = result.getData(); |
|
|
|
JSONObject jsonObject = JSON.parseObject(RegisterResult.toString()); |
|
|
|
CustomerUserResultDTO resultDTO = ConvertUtils.mapToEntity(jsonObject, CustomerUserResultDTO.class); |
|
|
|
Map<String,Object> map = (Map)jsonObject.get("paUserResult"); |
|
|
|
PaUserDTO userDTO = ConvertUtils.mapToEntity(map, PaUserDTO.class); |
|
|
|
//登陆
|
|
|
|
if (formDTO.getIsLogon() && null == resultDTO.getPaUserResult()) { |
|
|
|
if (formDTO.getIsLogon() && null == userDTO) { |
|
|
|
throw new RenException(EpmetErrorCode.PUBLIC_NOT_EXISTS.getCode()); |
|
|
|
} |
|
|
|
//注册
|
|
|
|
if (!formDTO.getIsLogon() && null != resultDTO.getPaUserResult()) { |
|
|
|
if (!formDTO.getIsLogon() && null != userDTO) { |
|
|
|
throw new RenException(EpmetErrorCode.MOBILE_USED.getCode()); |
|
|
|
} |
|
|
|
//3、发送短信验证码
|
|
|
@ -216,10 +217,10 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { |
|
|
|
} |
|
|
|
Object RegisterResult = result.getData(); |
|
|
|
JSONObject jsonObject = JSON.parseObject(RegisterResult.toString()); |
|
|
|
CustomerUserResultDTO resultDTO = ConvertUtils.mapToEntity(jsonObject, CustomerUserResultDTO.class); |
|
|
|
|
|
|
|
//2.用户不存在时不允许登陆
|
|
|
|
PaUserDTO userDTO = resultDTO.getPaUserResult(); |
|
|
|
Map<String,Object> map1 = (Map)jsonObject.get("paUserResult"); |
|
|
|
PaUserDTO userDTO = ConvertUtils.mapToEntity(map1, PaUserDTO.class); |
|
|
|
if (null == userDTO || StringUtils.isBlank(userDTO.getId())) { |
|
|
|
throw new RenException(EpmetErrorCode.PUBLIC_NOT_EXISTS.getCode()); |
|
|
|
} |
|
|
@ -236,13 +237,15 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { |
|
|
|
//4-1.生成token
|
|
|
|
String token = this.generateGovWxmpToken(userDTO.getId()); |
|
|
|
//4-2.判断是否存在信息,给customerId赋值
|
|
|
|
PaCustomerDTO customerDTO = resultDTO.getPaCustomerResult(); |
|
|
|
Map<String,Object> map2 = (Map)jsonObject.get("paCustomerResult"); |
|
|
|
PaCustomerDTO customerDTO = ConvertUtils.mapToEntity(map2, PaCustomerDTO.class); |
|
|
|
String customerId = ""; |
|
|
|
if (null != customerDTO && !StringUtils.isBlank(customerDTO.getId())) { |
|
|
|
customerId = customerDTO.getId(); |
|
|
|
} |
|
|
|
//4-3.token存入redis
|
|
|
|
PaUserWechatDTO wechatDTO = resultDTO.getPaUserWechatResult(); |
|
|
|
Map<String,Object> map3 = (Map)jsonObject.get("PaUserWechatDTO"); |
|
|
|
PaUserWechatDTO wechatDTO = ConvertUtils.mapToEntity(map3, PaUserWechatDTO.class); |
|
|
|
String openid = wechatDTO.getWxOpenId(); |
|
|
|
String unionId = (null == wechatDTO.getUnionId() ? "" : wechatDTO.getUnionId()); |
|
|
|
this.saveLatestGovTokenDto(customerId, userDTO.getId(), openid, unionId, token); |
|
|
|