|
@@ -60,7 +60,6 @@ public class WeChatInfoService {
|
|
public static String JSCODE2SESSION = "https://api.weixin.qq.com/sns/jscode2session";
|
|
public static String JSCODE2SESSION = "https://api.weixin.qq.com/sns/jscode2session";
|
|
|
|
|
|
public static String SENDMESSAGEURL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
|
public static String SENDMESSAGEURL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
|
- public static String SENDOPENID = "oAjHTv9I4j1_D_BfIzBaj1bbYU9s";
|
|
|
|
public static String OrderTemplateid = "VyMPKDDGOy85wDIJuXR7sBuiIBEg0OPaCg6C_Dt_D0g";
|
|
public static String OrderTemplateid = "VyMPKDDGOy85wDIJuXR7sBuiIBEg0OPaCg6C_Dt_D0g";
|
|
public static String BookingTemplateid = "Wvysqh3Ec9lXpf5tytq0T2zzs662uowNLFCPiAPBFkA";
|
|
public static String BookingTemplateid = "Wvysqh3Ec9lXpf5tytq0T2zzs662uowNLFCPiAPBFkA";
|
|
|
|
|
|
@@ -76,11 +75,15 @@ public class WeChatInfoService {
|
|
|
|
|
|
public int WXSendOrderMessage(String orderno, String total, String date) throws IOException {
|
|
public int WXSendOrderMessage(String orderno, String total, String date) throws IOException {
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
- WechatTemplate wechatTemplate = new WechatTemplate();
|
|
|
|
- wechatTemplate.setTemplate_id(OrderTemplateid);
|
|
|
|
- wechatTemplate.setTouser(SENDOPENID);
|
|
|
|
|
|
|
|
|
|
+ String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
|
|
|
|
+ Map mapToken = JSON.parseObject(resultToken);
|
|
|
|
+ String openid = String.valueOf(mapToken.get("wp_openid"));
|
|
Map<String,TemplateData> mapdata = new HashMap<>();
|
|
Map<String,TemplateData> mapdata = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ WechatTemplate wechatTemplate = new WechatTemplate();
|
|
|
|
+ wechatTemplate.setTemplate_id(OrderTemplateid);
|
|
|
|
+ wechatTemplate.setTouser(openid);
|
|
// 封装模板数据
|
|
// 封装模板数据
|
|
TemplateData first = new TemplateData();
|
|
TemplateData first = new TemplateData();
|
|
first.setValue("用户设备租赁单在线支付成功!");
|
|
first.setValue("用户设备租赁单在线支付成功!");
|
|
@@ -126,9 +129,12 @@ public class WeChatInfoService {
|
|
}
|
|
}
|
|
public int WXSendBookingMessage(CustomerBooking customerBooking) throws IOException {
|
|
public int WXSendBookingMessage(CustomerBooking customerBooking) throws IOException {
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
+ String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
|
|
|
|
+ Map mapToken = JSON.parseObject(resultToken);
|
|
|
|
+ String openid = String.valueOf(mapToken.get("wp_openid"));
|
|
WechatTemplate wechatTemplate = new WechatTemplate();
|
|
WechatTemplate wechatTemplate = new WechatTemplate();
|
|
wechatTemplate.setTemplate_id(BookingTemplateid);
|
|
wechatTemplate.setTemplate_id(BookingTemplateid);
|
|
- wechatTemplate.setTouser(SENDOPENID);
|
|
|
|
|
|
+ wechatTemplate.setTouser(openid);
|
|
|
|
|
|
Map<String,TemplateData> mapdata = new HashMap<>();
|
|
Map<String,TemplateData> mapdata = new HashMap<>();
|
|
// 封装模板数据
|
|
// 封装模板数据
|
|
@@ -305,6 +311,7 @@ public class WeChatInfoService {
|
|
return UUID.randomUUID().toString();
|
|
return UUID.randomUUID().toString();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
public static String sendGet(String url) {
|
|
public static String sendGet(String url) {
|
|
String result = "";
|
|
String result = "";
|
|
StringBuilder jsonStr = new StringBuilder();
|
|
StringBuilder jsonStr = new StringBuilder();
|
|
@@ -354,7 +361,6 @@ public class WeChatInfoService {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- System.out.println(str);
|
|
|
|
return str;
|
|
return str;
|
|
}
|
|
}
|
|
public static String decrypt(String data, String key, String iv, String encodingFormat) throws Exception {
|
|
public static String decrypt(String data, String key, String iv, String encodingFormat) throws Exception {
|