|
|
@ -18,7 +18,9 @@ import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
@ -70,7 +72,7 @@ public class WechatRest { |
|
|
|
// openId代表一个唯一微信用户,即微信消息的接收人
|
|
|
|
// String openId="otnrM57kui-WCUmRtChhb1HguOgw";
|
|
|
|
//郭
|
|
|
|
String openId="otnrM544hxIgkMOfaDU8VpJhj_6k"; |
|
|
|
// String openId="otnrM544hxIgkMOfaDU8VpJhj_6k";
|
|
|
|
//刘
|
|
|
|
//String openId ="otnrM5ySvUo7ZZc4qafWzM9eyKBk";
|
|
|
|
//聂总
|
|
|
@ -82,6 +84,12 @@ public class WechatRest { |
|
|
|
//微信的基础accessToken
|
|
|
|
String accessToken=getAccessToken(APP_ID,APPSECRET); |
|
|
|
String wxUrl = WX_URL_MESSAGE_SEND.replace("ACCESS_TOKEN", accessToken); |
|
|
|
List<String> openIds=new ArrayList<>(); |
|
|
|
openIds.add("otnrM57kui-WCUmRtChhb1HguOgw"); |
|
|
|
openIds.add("otnrM544hxIgkMOfaDU8VpJhj_6k"); |
|
|
|
openIds.add("otnrM5ySvUo7ZZc4qafWzM9eyKBk"); |
|
|
|
JSONObject jsonObject=new JSONObject(); |
|
|
|
for(String openId:openIds){ |
|
|
|
sendMag.put("thing3", new Template(csmCashReportVo.getCompanyName())); |
|
|
|
sendMag.put("time4", new Template(csmCashReportVo.getReportDate())); |
|
|
|
Map<String, String> miniprogram = new HashMap<>(); |
|
|
@ -97,7 +105,8 @@ public class WechatRest { |
|
|
|
sendBody.put("data", sendMag); // 模板参数
|
|
|
|
sendBody.put("template_id", templateId);// 模板Id
|
|
|
|
ResponseEntity<String> forEntity = restTemplate.postForEntity(wxUrl, sendBody, String.class); |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(forEntity.getBody()); |
|
|
|
jsonObject = JSONObject.parseObject(forEntity.getBody()); |
|
|
|
} |
|
|
|
// 0
|
|
|
|
String messageCode = jsonObject.getString("errcode"); |
|
|
|
// 2431260672639467520
|
|
|
|