|
@ -87,36 +87,47 @@ public class WechatRest { |
|
|
} |
|
|
} |
|
|
return "非法请求"; |
|
|
return "非法请求"; |
|
|
} |
|
|
} |
|
|
@PostMapping("/sendMessage") |
|
|
/** |
|
|
public void sendMessage(String orderDate) throws Exception { |
|
|
* 回款审核 |
|
|
CsmCashReportVo csmCashReportVo=csmCashReportMapper.getCsmCashReport(orderDate); |
|
|
* @param orderDate |
|
|
// openId代表一个唯一微信用户,即微信消息的接收人
|
|
|
* @throws Exception |
|
|
// String openId="otnrM57kui-WCUmRtChhb1HguOgw";
|
|
|
*/ |
|
|
//郭
|
|
|
@PostMapping("/SendMessage/{orderDate}") |
|
|
// String openId="otnrM544hxIgkMOfaDU8VpJhj_6k";
|
|
|
public void SendMessage(@PathVariable("orderDate") String orderDate) throws Exception { |
|
|
//刘
|
|
|
//ReportInventoryDayGatherVo csmCashReportVo=reportInventoryDayGatherMapper.getReportInventoryDayGather(orderDate);
|
|
|
//String openId ="otnrM5ySvUo7ZZc4qafWzM9eyKBk";
|
|
|
ReportInventoryDayGatherVo reportInventoryDayGatherVo=reportInventoryDayGatherMapper.getReportInventoryDayGather(orderDate); |
|
|
//聂总
|
|
|
|
|
|
// otnrM521f8KcCsRfL2Jj4Tk8np1g
|
|
|
|
|
|
// 模板参数
|
|
|
// 模板参数
|
|
|
Map<String, Template> sendMag = new HashMap<String, Template>(); |
|
|
Map<String, Template> sendMag = new HashMap<String, Template>(); |
|
|
// 公众号的模板id(也有相应的接口可以查询到)
|
|
|
// 公众号的模板id(也有相应的接口可以查询到)
|
|
|
String templateId = "CIrhaIkH6vWI4guaPqhDmMjOJkC3dt0Wpxs1JAO86N8"; |
|
|
String templateId = "BT6BHEojCmgWNTcpz1raHNIpJEEISP1E134btP51p_8"; |
|
|
//微信的基础accessToken
|
|
|
//微信的基础accessToken
|
|
|
String accessToken=getAccessToken(APP_ID,APPSECRET); |
|
|
String accessToken=getAccessToken(APP_ID_BIZ,APPSECRETBIZ); |
|
|
String wxUrl = WX_URL_MESSAGE_SEND.replace("ACCESS_TOKEN", accessToken); |
|
|
String wxUrl = WX_URL_MESSAGE_SEND.replace("ACCESS_TOKEN", accessToken); |
|
|
List<String> openIds=new ArrayList<>(); |
|
|
List<String> openIds=new ArrayList<>(); |
|
|
|
|
|
// openIds.add("oGdho60xVtWEXUks7nYEAn0tGlDE");
|
|
|
|
|
|
openIds.add("oGdho66394A-4-NyumcJ1MEaT8Lo"); |
|
|
|
|
|
openIds.add("oGdho68CArVhC_-7ELkG-jX21ruk"); |
|
|
|
|
|
// openIds.add("oGdho6yYB47f52HVk2NqirrFbRRk");
|
|
|
|
|
|
// openIds.add("oGdho6-12-ioAKeLhVUDYPucbDb4");
|
|
|
openIds.add("oGdho668Hew45t0xfBJC84TNGVzI"); |
|
|
openIds.add("oGdho668Hew45t0xfBJC84TNGVzI"); |
|
|
// openIds.add("otnrM544hxIgkMOfaDU8VpJhj_6k");
|
|
|
openIds.add("oGdho624Cr3j_iZBj-0_HayKLNc4"); |
|
|
// openIds.add("otnrM5ySvUo7ZZc4qafWzM9eyKBk");
|
|
|
String pa=""; |
|
|
// openIds.add("otnrM521f8KcCsRfL2Jj4Tk8np1g");
|
|
|
|
|
|
JSONObject jsonObject=new JSONObject(); |
|
|
JSONObject jsonObject=new JSONObject(); |
|
|
|
|
|
List<MessageOpenidDto> list=new ArrayList<>(); |
|
|
for(String openId:openIds){ |
|
|
for(String openId:openIds){ |
|
|
sendMag.put("thing3", new Template(csmCashReportVo.getCompanyName())); |
|
|
MessageOpenidDto dto=new MessageOpenidDto(); |
|
|
sendMag.put("time4", new Template(csmCashReportVo.getReportDate())); |
|
|
dto.setOpenId(openId); |
|
|
|
|
|
list.add(dto); |
|
|
|
|
|
sendMag.put("time1", new Template(reportInventoryDayGatherVo.getOrderDate())); |
|
|
|
|
|
sendMag.put("thing2", new Template("每日回款审核报告")); |
|
|
|
|
|
sendMag.put("thing3", new Template("赵丽晓")); |
|
|
Map<String, String> miniprogram = new HashMap<>(); |
|
|
Map<String, String> miniprogram = new HashMap<>(); |
|
|
|
|
|
//云眼
|
|
|
//miniprogram.put("appid","wx11565021714ba796");
|
|
|
//miniprogram.put("appid","wx11565021714ba796");
|
|
|
//miniprogram.put("pagepath","pages/index/auditReport?companyName="+csmCashReportVo.getCompanyName()+"&dataDate="+csmCashReportVo.getDataDate());
|
|
|
//云仓
|
|
|
|
|
|
miniprogram.put("appid","wx05604ce2a8bede05");//wx65c2b78fd1452eeb
|
|
|
|
|
|
miniprogram.put("pagepath","pages/index/demoReportKc2?orderDate="+reportInventoryDayGatherVo.getOrderDate()); |
|
|
|
|
|
pa=miniprogram.get("pagepath"); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
//拼接base参数
|
|
|
//拼接base参数
|
|
|
Map<String, Object> sendBody = new HashMap<>(); |
|
|
Map<String, Object> sendBody = new HashMap<>(); |
|
@ -134,6 +145,19 @@ public class WechatRest { |
|
|
// 2431260672639467520
|
|
|
// 2431260672639467520
|
|
|
String msgId = jsonObject.getString("msgid"); |
|
|
String msgId = jsonObject.getString("msgid"); |
|
|
System.out.println("messageCode : " + messageCode + ", msgId: " +msgId); |
|
|
System.out.println("messageCode : " + messageCode + ", msgId: " +msgId); |
|
|
|
|
|
//推送消息之后保存消息日志
|
|
|
|
|
|
MessagePushLogDto logDto=new MessagePushLogDto(); |
|
|
|
|
|
logDto.setContent(sendMag); |
|
|
|
|
|
logDto.setMessageTime(reportInventoryDayGatherVo.getReportTime()); |
|
|
|
|
|
logDto.setPagepath(pa); |
|
|
|
|
|
logDto.setMessageOpenidDtos(list); |
|
|
|
|
|
ThreadUtil.execute(() -> { |
|
|
|
|
|
try { |
|
|
|
|
|
messagePushLogService.save(logDto); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
//return forEntity.getBody();
|
|
|
//return forEntity.getBody();
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -151,6 +175,7 @@ public class WechatRest { |
|
|
String templateId = "BT6BHEojCmgWNTcpz1raHNIpJEEISP1E134btP51p_8"; |
|
|
String templateId = "BT6BHEojCmgWNTcpz1raHNIpJEEISP1E134btP51p_8"; |
|
|
//微信的基础accessToken
|
|
|
//微信的基础accessToken
|
|
|
String accessToken=getAccessToken(APP_ID_BIZ,APPSECRETBIZ); |
|
|
String accessToken=getAccessToken(APP_ID_BIZ,APPSECRETBIZ); |
|
|
|
|
|
System.out.println("accessToken"+accessToken); |
|
|
String wxUrl = WX_URL_MESSAGE_SEND.replace("ACCESS_TOKEN", accessToken); |
|
|
String wxUrl = WX_URL_MESSAGE_SEND.replace("ACCESS_TOKEN", accessToken); |
|
|
List<String> openIds=new ArrayList<>(); |
|
|
List<String> openIds=new ArrayList<>(); |
|
|
// openIds.add("oGdho60xVtWEXUks7nYEAn0tGlDE");
|
|
|
// openIds.add("oGdho60xVtWEXUks7nYEAn0tGlDE");
|
|
@ -277,6 +302,7 @@ public class WechatRest { |
|
|
RestTemplate restTemplate=new RestTemplate(); |
|
|
RestTemplate restTemplate=new RestTemplate(); |
|
|
String re= restTemplate.getForObject(url,String.class); |
|
|
String re= restTemplate.getForObject(url,String.class); |
|
|
JSONObject jsonObject= JSONObject.parseObject(re); |
|
|
JSONObject jsonObject= JSONObject.parseObject(re); |
|
|
|
|
|
System.out.println(jsonObject); |
|
|
String at=jsonObject.getString("access_token"); |
|
|
String at=jsonObject.getString("access_token"); |
|
|
return at; |
|
|
return at; |
|
|
} |
|
|
} |
|
|