|
@ -1,8 +1,14 @@ |
|
|
package com.yxt.supervise.report.biz.wechat; |
|
|
package com.yxt.supervise.report.biz.wechat; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.yxt.supervise.report.api.csmcashreport.CsmCashReport; |
|
|
|
|
|
import com.yxt.supervise.report.api.csmcashreport.CsmCashReportVo; |
|
|
import com.yxt.supervise.report.api.wechat.Template; |
|
|
import com.yxt.supervise.report.api.wechat.Template; |
|
|
import com.yxt.supervise.report.api.wechat.WeChatTemplateMsg; |
|
|
import com.yxt.supervise.report.api.wechat.WeChatTemplateMsg; |
|
|
|
|
|
import com.yxt.supervise.report.biz.csmcashreport.CsmCashReportMapper; |
|
|
|
|
|
import com.yxt.supervise.report.biz.csmcashreport.CsmCashReportService; |
|
|
|
|
|
import com.yxt.supervise.report.biz.csmcashreportcashedtoday.CsmCashReportCashedTodayService; |
|
|
|
|
|
import com.yxt.supervise.report.biz.csmcashreportsalesyesterday.CsmCashReportSalesYesterdayService; |
|
|
import com.yxt.supervise.report.biz.util.WeixinCheckoutUtil; |
|
|
import com.yxt.supervise.report.biz.util.WeixinCheckoutUtil; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import io.swagger.annotations.ApiOperation; |
|
@ -31,6 +37,8 @@ public class WechatRest { |
|
|
WechatService wechatService; |
|
|
WechatService wechatService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WechatApiService wechatApiService; |
|
|
private WechatApiService wechatApiService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private CsmCashReportMapper csmCashReportMapper; |
|
|
@ApiOperation("token") |
|
|
@ApiOperation("token") |
|
|
@GetMapping(value = "token") |
|
|
@GetMapping(value = "token") |
|
|
public String wechate(String signature,String timestamp,String nonce,String echostr){ |
|
|
public String wechate(String signature,String timestamp,String nonce,String echostr){ |
|
@ -58,8 +66,9 @@ public class WechatRest { |
|
|
} |
|
|
} |
|
|
@PostMapping("/sendMessage") |
|
|
@PostMapping("/sendMessage") |
|
|
public void sendMessage(@RequestBody WeChatTemplateMsg data) throws Exception { |
|
|
public void sendMessage(@RequestBody WeChatTemplateMsg data) throws Exception { |
|
|
|
|
|
CsmCashReportVo csmCashReportVo=csmCashReportMapper.getCsmCashReport("2023-06-14"); |
|
|
// openId代表一个唯一微信用户,即微信消息的接收人
|
|
|
// openId代表一个唯一微信用户,即微信消息的接收人
|
|
|
//String openId="otnrM57kui-WCUmRtChhb1HguOgw";
|
|
|
// String openId="otnrM57kui-WCUmRtChhb1HguOgw";
|
|
|
//郭
|
|
|
//郭
|
|
|
String openId="otnrM544hxIgkMOfaDU8VpJhj_6k"; |
|
|
String openId="otnrM544hxIgkMOfaDU8VpJhj_6k"; |
|
|
//刘
|
|
|
//刘
|
|
@ -69,19 +78,15 @@ public class WechatRest { |
|
|
// 模板参数
|
|
|
// 模板参数
|
|
|
Map<String, Template> sendMag = new HashMap<String, Template>(); |
|
|
Map<String, Template> sendMag = new HashMap<String, Template>(); |
|
|
// 公众号的模板id(也有相应的接口可以查询到)
|
|
|
// 公众号的模板id(也有相应的接口可以查询到)
|
|
|
String templateId = "fVgBuwpLC43YkeGWfl1Vw0mW0Qu5WP2giD77TfKAEc4"; |
|
|
String templateId = "CIrhaIkH6vWI4guaPqhDmMjOJkC3dt0Wpxs1JAO86N8"; |
|
|
//微信的基础accessToken
|
|
|
//微信的基础accessToken
|
|
|
String accessToken=getAccessToken(APP_ID,APPSECRET); |
|
|
String accessToken=getAccessToken(APP_ID,APPSECRET); |
|
|
String wxUrl = WX_URL_MESSAGE_SEND.replace("ACCESS_TOKEN", accessToken); |
|
|
String wxUrl = WX_URL_MESSAGE_SEND.replace("ACCESS_TOKEN", accessToken); |
|
|
sendMag.put("first", new Template("f123")); |
|
|
sendMag.put("thing3", new Template(csmCashReportVo.getCompanyName())); |
|
|
sendMag.put("keyword1", new Template("111")); |
|
|
sendMag.put("time4", new Template(csmCashReportVo.getReportDate())); |
|
|
sendMag.put("keyword2", new Template("222")); |
|
|
|
|
|
sendMag.put("keyword3", new Template("333")); |
|
|
|
|
|
sendMag.put("keyword4", new Template("444")); |
|
|
|
|
|
sendMag.put("remark", new Template("123465")); |
|
|
|
|
|
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/index"); |
|
|
miniprogram.put("pagepath","pages/index/auditReport?companyName="+csmCashReportVo.getCompanyName()+"&dataDate="+csmCashReportVo.getDataDate()); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
//拼接base参数
|
|
|
//拼接base参数
|
|
|
Map<String, Object> sendBody = new HashMap<>(); |
|
|
Map<String, Object> sendBody = new HashMap<>(); |
|
|