|
@@ -6,6 +6,8 @@ import java.net.URLEncoder;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
@@ -27,6 +29,27 @@ import com.zskk.service.bean.WxJSConfigBean;
|
|
|
|
|
|
public class WeixinService {
|
|
|
|
|
|
+ private static final Map<String, String> REMOTE_DIAGNOSIS_PATIENT_PAY_TEMPLATE_ID = new HashMap<String , String>(){{
|
|
|
+ put("中世康恺电子胶片平台", "VZ0Y3yj6N6187EggHdtdUZYcdQ-UycrjKCZKjqLn60Y");
|
|
|
+ put("河南省电子胶片平台", "DaOb3mBWUKTprlI4UEw8yVJUTTxJ79oRmxzbAqKPWU8");
|
|
|
+ }};
|
|
|
+
|
|
|
+ private static final Map<String, String> REMOTE_DIAGNOSIS_FINISH_TEMPLATE_ID = new HashMap<String , String>(){{
|
|
|
+ put("中世康恺电子胶片平台", "5wIAbbe28AGQRW7NsPkCla8g_vfiimVOOXJ3Jd-rjBA");
|
|
|
+ put("河南省电子胶片平台", "10OhHh4MwjjHJjv8Z44J7ZX5jKaB5PNRagJkH98GNPk");
|
|
|
+ }};
|
|
|
+
|
|
|
+ private static final Map<String, String> REMOTE_DIAGNOSIS_CANCEL_TEMPLATE_ID = new HashMap<String , String>(){{
|
|
|
+ put("中世康恺电子胶片平台", "HuPWL7THvmw0J8svYAWo7_1_AKXwYO46RH2DbgMRGHU");
|
|
|
+ put("河南省电子胶片平台", "cERKtFujCw3pXZJfBWzA2SaGyGt47aU-482Hl9BDkPc");
|
|
|
+ }};
|
|
|
+
|
|
|
+ private static final Map<String, String> REMOTE_DIAGNOSIS_REFUND_TEMPLATE_ID = new HashMap<String , String>(){{
|
|
|
+ put("中世康恺电子胶片平台", "34C7dwguVjn1zGAw1Qu-HFImnWwHa54A2WrAA0DLUHE");
|
|
|
+ put("河南省电子胶片平台", "4SvFSB2Ix5KjFEhRI0aRru-hJqCZl4gpoS5DwTNF2YA");
|
|
|
+ }};
|
|
|
+
|
|
|
+
|
|
|
/*/
|
|
|
* 微信消息推送类型枚举
|
|
|
*/
|
|
@@ -128,7 +151,7 @@ public class WeixinService {
|
|
|
/*
|
|
|
* 发送模板消息
|
|
|
*/
|
|
|
- public ApiResult sendTemplateMsg(String openid, String content, Integer pushtype) {
|
|
|
+ public ApiResult sendTemplateMsg(String openid, String content, Integer pushtype, String source) {
|
|
|
PUSH_TYPE type = null;
|
|
|
ApiResult apiResult = null;
|
|
|
for (PUSH_TYPE xxxEnum : PUSH_TYPE.values()) {
|
|
@@ -154,7 +177,8 @@ public class WeixinService {
|
|
|
Double total_fee_double_value = Double.valueOf(total_fee)/100;
|
|
|
DecimalFormat df = new DecimalFormat("######0.00");
|
|
|
String total_fee_to_yuan = df.format(total_fee_double_value);
|
|
|
- apiResult = sendRemoteDiagnosisPatientPayMsg(openid, urlString, out_trade_no, name_utf8, total_fee_to_yuan);
|
|
|
+ String template_id = REMOTE_DIAGNOSIS_PATIENT_PAY_TEMPLATE_ID.get(source);
|
|
|
+ apiResult = sendRemoteDiagnosisPatientPayMsg(openid, urlString, out_trade_no, name_utf8, total_fee_to_yuan, template_id);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -172,7 +196,8 @@ public class WeixinService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
String total_fee = contentJson.getString("total_fee");
|
|
|
- apiResult = sendRemoteDiagnosisFinishMsg(openid, urlString, name_utf8);
|
|
|
+ String template_id = REMOTE_DIAGNOSIS_FINISH_TEMPLATE_ID.get(source);
|
|
|
+ apiResult = sendRemoteDiagnosisFinishMsg(openid, urlString, name_utf8, template_id);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -183,7 +208,8 @@ public class WeixinService {
|
|
|
String out_trade_no = contentJson.getString("out_trade_no");
|
|
|
String name = contentJson.getString("name");
|
|
|
String total_fee = contentJson.getString("total_fee");
|
|
|
- apiResult = sendRemoteDiagnosisCancelMsg(openid, urlString, out_trade_no);
|
|
|
+ String template_id = REMOTE_DIAGNOSIS_CANCEL_TEMPLATE_ID.get(source);
|
|
|
+ apiResult = sendRemoteDiagnosisCancelMsg(openid, urlString, out_trade_no, template_id);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -197,7 +223,8 @@ public class WeixinService {
|
|
|
Double total_fee_double_value = Double.valueOf(total_fee)/100;
|
|
|
DecimalFormat df = new DecimalFormat("######0.00");
|
|
|
String total_fee_to_yuan = df.format(total_fee_double_value);
|
|
|
- apiResult = sendRemoteDiagnosisRefundMsg(openid, urlString, out_trade_no, total_fee_to_yuan);
|
|
|
+ String template_id = REMOTE_DIAGNOSIS_REFUND_TEMPLATE_ID.get(source);
|
|
|
+ apiResult = sendRemoteDiagnosisRefundMsg(openid, urlString, out_trade_no, total_fee_to_yuan, template_id);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -207,10 +234,10 @@ public class WeixinService {
|
|
|
return apiResult;
|
|
|
}
|
|
|
|
|
|
- public ApiResult sendRemoteDiagnosisPatientPayMsg(String openid, String url, String out_trade_no, String name, String total_fee) {
|
|
|
+ public ApiResult sendRemoteDiagnosisPatientPayMsg(String openid, String url, String out_trade_no, String name, String total_fee, String template_id) {
|
|
|
String str = " {\n" +
|
|
|
" \"touser\":\""+openid+"\",\n" +
|
|
|
- " \"template_id\":\"VZ0Y3yj6N6187EggHdtdUZYcdQ-UycrjKCZKjqLn60Y\",\n" +
|
|
|
+ " \"template_id\":\""+template_id+"\",\n" +
|
|
|
" \"url\":\""+url+"\",\n" +
|
|
|
" \"topcolor\":\"#FF0000\",\n" +
|
|
|
" \"data\":{\n" +
|
|
@@ -248,10 +275,10 @@ public class WeixinService {
|
|
|
return apiResult;
|
|
|
}
|
|
|
|
|
|
- public ApiResult sendRemoteDiagnosisFinishMsg(String openid, String url, String name) {
|
|
|
+ public ApiResult sendRemoteDiagnosisFinishMsg(String openid, String url, String name, String template_id) {
|
|
|
String str = " {\n" +
|
|
|
" \"touser\":\""+openid+"\",\n" +
|
|
|
- " \"template_id\":\"5wIAbbe28AGQRW7NsPkCla8g_vfiimVOOXJ3Jd-rjBA\",\n" +
|
|
|
+ " \"template_id\":\""+template_id+"\",\n" +
|
|
|
" \"url\":\""+url+"\",\n" +
|
|
|
" \"topcolor\":\"#FF0000\",\n" +
|
|
|
" \"data\":{\n" +
|
|
@@ -281,10 +308,10 @@ public class WeixinService {
|
|
|
return apiResult;
|
|
|
}
|
|
|
|
|
|
- public ApiResult sendRemoteDiagnosisCancelMsg(String openid, String url, String out_trade_no) {
|
|
|
+ public ApiResult sendRemoteDiagnosisCancelMsg(String openid, String url, String out_trade_no, String template_id) {
|
|
|
String str = " {\n" +
|
|
|
" \"touser\":\""+openid+"\",\n" +
|
|
|
- " \"template_id\":\"HuPWL7THvmw0J8svYAWo7_1_AKXwYO46RH2DbgMRGHU\",\n" +
|
|
|
+ " \"template_id\":\""+template_id+"\",\n" +
|
|
|
" \"url\":\""+url+"\",\n" +
|
|
|
" \"topcolor\":\"#FF0000\",\n" +
|
|
|
" \"data\":{\n" +
|
|
@@ -310,10 +337,10 @@ public class WeixinService {
|
|
|
return apiResult;
|
|
|
}
|
|
|
|
|
|
- public ApiResult sendRemoteDiagnosisRefundMsg(String openid, String url, String out_trade_no, String total_fee) {
|
|
|
+ public ApiResult sendRemoteDiagnosisRefundMsg(String openid, String url, String out_trade_no, String total_fee, String template_id) {
|
|
|
String str = " {\n" +
|
|
|
" \"touser\":\""+openid+"\",\n" +
|
|
|
- " \"template_id\":\"34C7dwguVjn1zGAw1Qu-HFImnWwHa54A2WrAA0DLUHE\",\n" +
|
|
|
+ " \"template_id\":\""+template_id+"\",\n" +
|
|
|
" \"url\":\""+url+"\",\n" +
|
|
|
" \"topcolor\":\"#FF0000\",\n" +
|
|
|
" \"data\":{\n" +
|