|
@ -14,9 +14,12 @@ import com.ylzinfo.ehc.common.utils.DateUtils;
|
|
|
import com.ylzinfo.ehc.trans.TransRequest;
|
|
|
import com.ylzinfo.ehc.trans.TransResponse;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
import java.util.Date;
|
|
@ -27,8 +30,11 @@ import java.util.UUID;
|
|
|
* Created by Trick on 2019/7/26.
|
|
|
*/
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class OauthYlzConfigService {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(OauthYlzConfigService.class);
|
|
|
|
|
|
@Autowired
|
|
|
private OauthYlzConfigDao oauthYlzConfigDao;
|
|
|
@Autowired
|
|
@ -40,9 +46,9 @@ public class OauthYlzConfigService {
|
|
|
private String fastdfs_file_url;
|
|
|
|
|
|
public Map<String,Object> getOauthQRCode(){
|
|
|
|
|
|
OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
|
|
|
try {
|
|
|
OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
|
|
|
logger.info("getOauthQRCode:",oauthYlzConfigDO.toString());
|
|
|
TransRequest e = new TransRequest();
|
|
|
e.setMethod("ehc.ehealthcard.authurl");
|
|
|
e.setApp_id(oauthYlzConfigDO.getAppId());
|
|
@ -58,10 +64,13 @@ public class OauthYlzConfigService {
|
|
|
e.setBiz_content(JSON.toJSONString(bizContent));
|
|
|
EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
|
|
|
TransResponse re = ehcHandler.execute(e);
|
|
|
|
|
|
String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
|
|
|
logger.info("TransResponse:"+rs);
|
|
|
com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
|
|
|
com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
|
|
|
InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
|
|
|
logger.info("fastdfs_file_url:"+fastdfs_file_url);
|
|
|
UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg",fastdfs_file_url);
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
map.put("fileName",uploadVO.getFileName());
|
|
@ -69,6 +78,8 @@ public class OauthYlzConfigService {
|
|
|
map.put("fullUrl",uploadVO.getFullUrl());
|
|
|
map.put("fullUri",uploadVO.getFullUri());
|
|
|
map.put("out_authorize_no",no);
|
|
|
logger.info("fileUploadService:"+map.toString());
|
|
|
|
|
|
return map;
|
|
|
} catch (Exception var5) {
|
|
|
var5.printStackTrace();
|
|
@ -113,6 +124,7 @@ public class OauthYlzConfigService {
|
|
|
String mobile = biz.getString("mobile_phone");
|
|
|
String pw = idcard.substring(mobile.length()-6);
|
|
|
|
|
|
patient.setIdcard(idcard);
|
|
|
patient.setName(biz.getString("user_name"));
|
|
|
patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
patient.setSalt(salt);
|