|
@@ -179,6 +179,68 @@ public class WeChatInfoService {
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
+
|
|
|
+ public int WXSendYSOrderMessage(String orderno, String total, String date,String type) throws IOException {
|
|
|
+ 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"));
|
|
|
+ Map<String,TemplateData> mapdata = new HashMap<>();
|
|
|
+
|
|
|
+ WechatTemplate wechatTemplate = new WechatTemplate();
|
|
|
+ wechatTemplate.setTemplate_id(OrderTemplateid);
|
|
|
+ wechatTemplate.setTouser(WPOPENID);
|
|
|
+ // 封装模板数据
|
|
|
+ TemplateData first = new TemplateData();
|
|
|
+ if (type.equals("2")) {
|
|
|
+ first.setValue("用户支付订单首付款成功!");
|
|
|
+ first.setColor("#173177");
|
|
|
+ } else if (type.equals("3")) {
|
|
|
+ first.setValue("用户支付订单尾款成功!");
|
|
|
+ first.setColor("#173177");
|
|
|
+ }
|
|
|
+ mapdata.put("first", first);
|
|
|
+
|
|
|
+ TemplateData keyword1 = new TemplateData();
|
|
|
+ keyword1.setValue(orderno);
|
|
|
+ keyword1.setColor("#fc6961");
|
|
|
+ mapdata.put("keyword1", keyword1);
|
|
|
+
|
|
|
+ TemplateData keyword2 = new TemplateData();
|
|
|
+ keyword2.setValue(total);
|
|
|
+ keyword2.setColor("#173177");
|
|
|
+ mapdata.put("keyword2", keyword2);
|
|
|
+
|
|
|
+ TemplateData keyword3 = new TemplateData();
|
|
|
+ keyword3.setValue(date);
|
|
|
+ keyword3.setColor("#173177");
|
|
|
+ mapdata.put("keyword3", keyword3);
|
|
|
+
|
|
|
+ TemplateData keyword5 = new TemplateData();
|
|
|
+ keyword5.setValue("请尽快安排顾问跟进!");
|
|
|
+ keyword5.setColor("#173177");
|
|
|
+ mapdata.put("remark", keyword5);
|
|
|
+
|
|
|
+ wechatTemplate.setData(mapdata);
|
|
|
+ String toString = mapper.writeValueAsString(wechatTemplate);
|
|
|
+ String result = "";
|
|
|
+ CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
+ WeChatInfo weChatInfo = weChatInfoDao.getWeChatInfo();
|
|
|
+ HttpPost httpPost = new HttpPost(SENDMESSAGEURL+weChatInfo.getAccess_token());
|
|
|
+ StringEntity stringEntity = new StringEntity(toString, ContentType.APPLICATION_JSON);
|
|
|
+ stringEntity.setContentEncoding("utf-8");
|
|
|
+ httpPost.setEntity(stringEntity);
|
|
|
+ CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
|
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
|
+ result = EntityUtils.toString(response.getEntity(), "utf-8");
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public int WXSendBookingMessage(CustomerBooking customerBooking) throws IOException {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
// String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
|