|
@ -35,7 +35,6 @@ import java.io.InputStream;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@Service
|
|
@ -171,6 +170,44 @@ public class QrcodeService {
|
|
|
throw new Exception("找不到对应医生信息!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public String makeUrlQrcode(String flag) throws Exception {
|
|
|
System.out.println("flag"+flag);
|
|
|
|
|
|
String token=null;
|
|
|
//中山医院互联网医院
|
|
|
if("xm_zsyy_wx".equals(wxId)) {
|
|
|
String response = entranceService.getAccessToken("100033");
|
|
|
net.sf.json.JSONObject object1 = net.sf.json.JSONObject.fromObject(response);
|
|
|
if (null != object1&&null!=object1.get("respCode") && "00".equals(object1.get("respCode"))) {
|
|
|
token = object1.getJSONObject("respEntity").getString("access_token");
|
|
|
} else {
|
|
|
throw new Exception("获取ACCESSTOKEN失败");
|
|
|
}
|
|
|
|
|
|
}else if("xm_xzzx_wx".equals(wxId)){
|
|
|
token = xzzxEntranceService.getXzToken();
|
|
|
}else{
|
|
|
token = wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
|
|
|
}
|
|
|
System.out.println("token"+token);
|
|
|
System.out.println("wxId"+wxId);
|
|
|
|
|
|
// 二维码内容
|
|
|
String content = "flag_" + flag ;
|
|
|
System.out.println("content"+content);
|
|
|
// 二维码图片文件名
|
|
|
String fileName = flag+".png";
|
|
|
/*String path = QrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
|
|
|
+ File.separator + "qrcode";*/
|
|
|
System.out.println("fileName"+fileName);
|
|
|
// 通过微信接口生成医生二维码
|
|
|
String uri = makeQrcodeFromWeiXin(content, fileName, token);
|
|
|
System.out.println("uri"+uri);
|
|
|
|
|
|
return uri;
|
|
|
}
|
|
|
/**
|
|
|
* 从微信生成二维码并下载到本地
|
|
|
*
|