|
@@ -139,41 +139,43 @@ public class WeixinApiController extends ApiController {
|
|
|
*/
|
|
|
public void sendMsg()
|
|
|
{
|
|
|
+ //改为一个公众号服务
|
|
|
Integer pushType = getParaToInt("pushType");
|
|
|
String openid = getPara("openid");
|
|
|
- String source = "中世康恺电子胶片平台";
|
|
|
+// String source = "中世康恺电子胶片平台";
|
|
|
String content = getPara("content");
|
|
|
- String appId;
|
|
|
+// String appId;
|
|
|
String source_utf8 = null;
|
|
|
- try {
|
|
|
- source_utf8 = URLDecoder.decode(source, "UTF-8");
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- switch (source_utf8) {
|
|
|
- case "中世康恺电子胶片平台":
|
|
|
- appId = PropKit.get("appId_zskk");
|
|
|
- break;
|
|
|
-
|
|
|
- case "黑龙江省电子胶片平台":
|
|
|
- appId = PropKit.get("appId_hlj");
|
|
|
- break;
|
|
|
-
|
|
|
- case "辽宁省电子胶片平台":
|
|
|
- appId = PropKit.get("appId_ln");
|
|
|
- break;
|
|
|
-
|
|
|
- case "河南省电子胶片平台":
|
|
|
- appId = PropKit.get("appId_hn");
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- appId = PropKit.get("appId_zskk");
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- ApiConfigKit.setThreadLocalAppId(appId);
|
|
|
+// try {
|
|
|
+// source_utf8 = URLDecoder.decode(source, "UTF-8");
|
|
|
+// } catch (UnsupportedEncodingException e) {
|
|
|
+// // TODO Auto-generated catch block
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+
|
|
|
+// switch (source_utf8) {
|
|
|
+// case "中世康恺电子胶片平台":
|
|
|
+// appId = PropKit.get("appId_zskk");
|
|
|
+// break;
|
|
|
+//
|
|
|
+// case "黑龙江省电子胶片平台":
|
|
|
+// appId = PropKit.get("appId_hlj");
|
|
|
+// break;
|
|
|
+//
|
|
|
+// case "辽宁省电子胶片平台":
|
|
|
+// appId = PropKit.get("appId_ln");
|
|
|
+// break;
|
|
|
+//
|
|
|
+// case "河南省电子胶片平台":
|
|
|
+// appId = PropKit.get("appId_hn");
|
|
|
+// break;
|
|
|
+//
|
|
|
+// default:
|
|
|
+// appId = PropKit.get("appId_zskk");
|
|
|
+// break;
|
|
|
+// }
|
|
|
+//
|
|
|
+// ApiConfigKit.setThreadLocalAppId(appId);
|
|
|
WeixinService wService = ServiceFactory.getService(WeixinService.class);
|
|
|
ApiResult apiResult = wService.sendTemplateMsg(openid, content, pushType, source_utf8);
|
|
|
renderJson(apiResult);
|
|
@@ -213,32 +215,12 @@ public class WeixinApiController extends ApiController {
|
|
|
// }
|
|
|
// redirect("http://wechat.pacsonline.cn/wx_patient/api/getQrcode?appId=" + appId + "&reportId=" + reportId);
|
|
|
// ApiConfigKit.setThreadLocalAppId(appId);
|
|
|
- String urlString = "";
|
|
|
- Report reports = Report.dao.findById(reportId);
|
|
|
- if (reportId == null || reports == null) {
|
|
|
-// renderNull();
|
|
|
-// urlString=null;
|
|
|
- renderText("error");
|
|
|
- return;
|
|
|
+ String urlString = getQrcode(reportId);
|
|
|
+ if (urlString==null) {
|
|
|
+ renderNull();
|
|
|
+ }else {
|
|
|
+ renderText(urlString);
|
|
|
}
|
|
|
-// if (reports.getQrCode() == null || reports.getQrCode().isEmpty()) {
|
|
|
- String str = "{\"expire_seconds\": 2592000, \"action_name\": \"QR_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"ReportQR_"
|
|
|
- + reportId + "\"}}}";
|
|
|
- ApiResult apiResult = QrcodeApi.create(str);
|
|
|
- urlString = apiResult.getJson();
|
|
|
- JSONObject jdJson = JSON.parseObject(urlString);
|
|
|
- String fString = jdJson.getString("url");
|
|
|
- reports.setQrCode(fString);
|
|
|
- reports.update();
|
|
|
- renderText(fString);
|
|
|
-// String url = apiResult.getStr("url");
|
|
|
-// urlString = url;
|
|
|
-// reports.setQrCode(url);
|
|
|
-// reports.update();
|
|
|
-// if (urlString==null) {
|
|
|
-// renderNull();
|
|
|
-// }
|
|
|
-// renderText(urlString);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -248,22 +230,18 @@ public class WeixinApiController extends ApiController {
|
|
|
{
|
|
|
Report reports = Report.dao.findById(reportId);
|
|
|
if (reportId == null || reports == null) {
|
|
|
-// renderNull();
|
|
|
return null;
|
|
|
}
|
|
|
// if (reports.getQrCode() == null || reports.getQrCode().isEmpty()) {
|
|
|
String str = "{\"expire_seconds\": 2592000, \"action_name\": \"QR_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"ReportQR_"
|
|
|
+ reportId + "\"}}}";
|
|
|
ApiResult apiResult = QrcodeApi.create(str);
|
|
|
- String url = apiResult.getStr("url");
|
|
|
+ String jsonString = apiResult.getJson();
|
|
|
+ JSONObject qrJson = JSON.parseObject(jsonString);
|
|
|
+ String url = qrJson.getString("url");
|
|
|
reports.setQrCode(url);
|
|
|
reports.update();
|
|
|
return url;
|
|
|
-// renderText(url);
|
|
|
-// }else {
|
|
|
-// //ApiResult qrresult = new ApiResult(reports.getQrCode());
|
|
|
-// renderText(reports.getQrCode());;
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
/*/
|