|
@ -2296,74 +2296,6 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
}
|
|
|
|
|
|
|
|
|
/*@RequestMapping(value = "/oauth/registerPatientAndLogin", method = RequestMethod.POST)
|
|
|
public ObjEnvelop registerPatientAndLogin(String name, String mobile, String idcard, String ssc, String pw,String client_id,String login_type,String captcha,String openid,String wxId)throws Exception{
|
|
|
|
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
|
throw new InvalidRequestException("client_id is null");
|
|
|
}
|
|
|
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
//验证码正确
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
|
|
|
Map<String,Object> rs = registerService.registerPatient(name,mobile,idcard,ssc,pw,openid,wxId,captcha);
|
|
|
String code = rs.get("code").toString();
|
|
|
if(!"1".equals(code)){
|
|
|
ObjEnvelop objEnvelop = new ObjEnvelop();
|
|
|
objEnvelop.setObj(rs);
|
|
|
objEnvelop.setStatus(-1);
|
|
|
objEnvelop.setMessage(rs.get("mes")+"");
|
|
|
return objEnvelop;
|
|
|
}
|
|
|
|
|
|
BasePatientDO patientDO = (BasePatientDO)rs.get("patient");
|
|
|
|
|
|
ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
|
|
|
|
|
|
Map<String, String> parameters = new HashedMap();
|
|
|
|
|
|
parameters.put("username",patientDO.getIdcard());
|
|
|
parameters.put("grant_type", "ihealthCode");
|
|
|
|
|
|
TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
|
|
|
if (authenticatedClient != null) {
|
|
|
oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
|
|
|
}
|
|
|
OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
|
|
|
if (token == null) {
|
|
|
throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
|
|
|
}
|
|
|
|
|
|
WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
|
|
|
wlyyUserSimple.setAccessToken(token.getValue());
|
|
|
wlyyUserSimple.setTokenType(token.getTokenType());
|
|
|
wlyyUserSimple.setExpiresIn(token.getExpiresIn());
|
|
|
wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
|
|
|
wlyyUserSimple.setUser(parameters.get("username"));
|
|
|
String loginType = parameters.get("login_type");
|
|
|
|
|
|
BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
|
|
|
userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
|
|
|
|
|
|
baseLoginLogDO.setUserId(wlyyUserSimple.getId());
|
|
|
baseLoginLogDO.setCreateTime(new Date());
|
|
|
String userAgent = JSONObject.toJSONString(wlyyUserSimple);
|
|
|
baseLoginLogDO.setUserAgent(userAgent);
|
|
|
baseLoginLogDO.setLoginType(loginType);
|
|
|
baseLoginLogService.save(baseLoginLogDO);
|
|
|
|
|
|
return ObjEnvelop.getSuccess("success",wlyyUserSimple);
|
|
|
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return ObjEnvelop.getError("登录失败!");
|
|
|
}*/
|
|
|
@RequestMapping(value = "/oauth/registerPatientAndLogin", method = RequestMethod.POST)
|
|
|
public ObjEnvelop registerPatientAndLogin(String name, String mobile, String idcard, String cardType, String ssc, String pw,
|
|
|
String client_id, String login_type, String captcha, String openid, String wxId
|
|
@ -2521,6 +2453,27 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
public Envelop findPatientPw(String mobile, String client_id, String login_type, String captcha
|
|
|
, String pw, String key, String idcard, String text) {
|
|
|
try {
|
|
|
if ("xm_dsyy_wx".equalsIgnoreCase(wechatId)) {
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
|
|
|
if (wlyyHospitalSysDictDO != null && !StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())) {
|
|
|
if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())) {
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
} else {
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
//验证码正确
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
}
|
|
|
String rs = registerService.updateDoctorPw(mobile, pw, wechatId);
|
|
|
if ("ok".equals(rs)) {
|
|
|
return ObjEnvelop.getSuccess("修改成功!");
|
|
|
}
|
|
|
|
|
|
return ObjEnvelop.getError("手机号未注册!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(idcard)) {
|
|
|
return ObjEnvelop.getError("手机号码不能为空!");
|
|
|
}
|