|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.google.code.kaptcha.impl.DefaultKaptcha;
|
|
import com.google.code.kaptcha.impl.DefaultKaptcha;
|
|
import com.google.code.kaptcha.util.Config;
|
|
import com.google.code.kaptcha.util.Config;
|
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
|
|
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.restmodel.ResultStatus;
|
|
import com.yihu.jw.restmodel.ResultStatus;
|
|
@ -35,6 +36,7 @@ import org.apache.commons.collections.map.HashedMap;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.http.*;
|
|
import org.springframework.http.*;
|
|
import org.springframework.security.authentication.AuthenticationManager;
|
|
import org.springframework.security.authentication.AuthenticationManager;
|
|
@ -136,6 +138,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
private BasePatientDao basePatientDao;
|
|
private BasePatientDao basePatientDao;
|
|
@Autowired
|
|
@Autowired
|
|
private BaseDoctorDao doctorDao;
|
|
private BaseDoctorDao doctorDao;
|
|
|
|
@Value("${wechat.id}")
|
|
|
|
private String wechatId;
|
|
|
|
@Autowired
|
|
|
|
private XzzxService xzzxService;
|
|
|
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
private void init() {
|
|
private void init() {
|
|
@ -925,8 +931,16 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
@RequestMapping(value = "/oauth/getCaQRCode", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/oauth/getCaQRCode", method = RequestMethod.GET)
|
|
public ObjEnvelop getCaQRCode(){
|
|
public ObjEnvelop getCaQRCode(){
|
|
logger.info("/oauth/getCaQRCode");
|
|
logger.info("/oauth/getCaQRCode");
|
|
String sys ="JKZLHLWYLJKGLPT";
|
|
|
|
return ObjEnvelop.getSuccess("success", oauthCaConfigSerivce.getQRCode(sys));
|
|
|
|
|
|
if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
|
String sys ="JKZLHLWYLJKGLPT";
|
|
|
|
return ObjEnvelop.getSuccess("success", oauthCaConfigSerivce.getQRCode(sys));
|
|
|
|
}else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
|
|
|
|
String sys ="2017070411003376";
|
|
|
|
return ObjEnvelop.getSuccess("success", xzzxService.getQRCode(sys));
|
|
|
|
}else {
|
|
|
|
return ObjEnvelop.getSuccess("success", null);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -942,18 +956,37 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
throw new InvalidRequestException("client_id is null");
|
|
throw new InvalidRequestException("client_id is null");
|
|
}
|
|
}
|
|
|
|
String username = null;
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
|
if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
|
rs = oauthCaConfigSerivce.getQueryQRCode(qrcode);
|
|
|
|
JSONObject data = rs.getJSONObject("data");
|
|
|
|
String qrCodeStatus = data.getString("qrCodeStatus");
|
|
|
|
if(!"LoginQrCodeBeenScan".equals(qrCodeStatus)){
|
|
|
|
return ObjEnvelop.getSuccess("error",rs);
|
|
|
|
}
|
|
|
|
username = data.getString("userIdCardNum");
|
|
|
|
}else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
|
|
|
|
rs = xzzxService.getTokeninfo("2017070411003376",qrcode);
|
|
|
|
JSONObject jsonObject = rs.getJSONObject("data");
|
|
|
|
logger.info("查询登录信息"+rs);
|
|
|
|
String qrCodeStatus = rs.getString("status");
|
|
|
|
if(!"0".equals(qrCodeStatus)){
|
|
|
|
return ObjEnvelop.getSuccess("error",rs);
|
|
|
|
}
|
|
|
|
username = jsonObject.getString("userIdcardNum");
|
|
|
|
}
|
|
|
|
|
|
JSONObject rs = oauthCaConfigSerivce.getQueryQRCode(qrcode);
|
|
|
|
JSONObject data = rs.getJSONObject("data");
|
|
|
|
String qrCodeStatus = data.getString("qrCodeStatus");
|
|
|
|
if(!"LoginQrCodeBeenScan".equals(qrCodeStatus)){
|
|
|
|
return ObjEnvelop.getSuccess("error",rs);
|
|
|
|
|
|
if (org.apache.commons.lang.StringUtils.isNotBlank(username)){
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findByIdcard(username);
|
|
|
|
doctorDO.setCaFlag(1);
|
|
|
|
doctorDao.save(doctorDO);
|
|
}
|
|
}
|
|
|
|
|
|
ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
|
|
ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
|
|
|
|
|
|
Map<String, String> parameters = new HashedMap();
|
|
Map<String, String> parameters = new HashedMap();
|
|
parameters.put("username",data.getString("userIdCardNum"));
|
|
|
|
|
|
parameters.put("username",username);
|
|
parameters.put("login_type","2");
|
|
parameters.put("login_type","2");
|
|
parameters.put("grant_type", "ihealthDcotor");
|
|
parameters.put("grant_type", "ihealthDcotor");
|
|
|
|
|