|
@ -3,12 +3,15 @@ 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.CsmCashReport; |
|
|
import com.yxt.supervise.report.api.csmcashreport.CsmCashReportVo; |
|
|
import com.yxt.supervise.report.api.csmcashreport.CsmCashReportVo; |
|
|
|
|
|
import com.yxt.supervise.report.api.reportinventorydaygather.ReportInventoryDayGatherVo; |
|
|
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.CsmCashReportMapper; |
|
|
import com.yxt.supervise.report.biz.csmcashreport.CsmCashReportService; |
|
|
import com.yxt.supervise.report.biz.csmcashreport.CsmCashReportService; |
|
|
import com.yxt.supervise.report.biz.csmcashreportcashedtoday.CsmCashReportCashedTodayService; |
|
|
import com.yxt.supervise.report.biz.csmcashreportcashedtoday.CsmCashReportCashedTodayService; |
|
|
import com.yxt.supervise.report.biz.csmcashreportsalesyesterday.CsmCashReportSalesYesterdayService; |
|
|
import com.yxt.supervise.report.biz.csmcashreportsalesyesterday.CsmCashReportSalesYesterdayService; |
|
|
|
|
|
import com.yxt.supervise.report.biz.reportinventory.ReportInventoryDayGatherMapper; |
|
|
|
|
|
import com.yxt.supervise.report.biz.reportinventory.ReportInventoryService; |
|
|
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; |
|
@ -41,6 +44,8 @@ public class WechatRest { |
|
|
private WechatApiService wechatApiService; |
|
|
private WechatApiService wechatApiService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CsmCashReportMapper csmCashReportMapper; |
|
|
private CsmCashReportMapper csmCashReportMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ReportInventoryDayGatherMapper reportInventoryDayGatherMapper; |
|
|
@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){ |
|
@ -117,7 +122,7 @@ public class WechatRest { |
|
|
//仓库库存日报推送
|
|
|
//仓库库存日报推送
|
|
|
@PostMapping("/inventorySendMessage") |
|
|
@PostMapping("/inventorySendMessage") |
|
|
public void inventorySendMessage(@RequestBody WeChatTemplateMsg data) throws Exception { |
|
|
public void inventorySendMessage(@RequestBody WeChatTemplateMsg data) throws Exception { |
|
|
CsmCashReportVo csmCashReportVo=csmCashReportMapper.getCsmCashReport("2023-06-14"); |
|
|
ReportInventoryDayGatherVo csmCashReportVo=reportInventoryDayGatherMapper.getReportInventoryDayGather("2023-06-25"); |
|
|
// openId代表一个唯一微信用户,即微信消息的接收人
|
|
|
// openId代表一个唯一微信用户,即微信消息的接收人
|
|
|
// String openId="otnrM57kui-WCUmRtChhb1HguOgw";
|
|
|
// String openId="otnrM57kui-WCUmRtChhb1HguOgw";
|
|
|
//郭
|
|
|
//郭
|
|
@ -129,21 +134,22 @@ public class WechatRest { |
|
|
// 模板参数
|
|
|
// 模板参数
|
|
|
Map<String, Template> sendMag = new HashMap<String, Template>(); |
|
|
Map<String, Template> sendMag = new HashMap<String, Template>(); |
|
|
// 公众号的模板id(也有相应的接口可以查询到)
|
|
|
// 公众号的模板id(也有相应的接口可以查询到)
|
|
|
String templateId = "CIrhaIkH6vWI4guaPqhDmMjOJkC3dt0Wpxs1JAO86N8"; |
|
|
String templateId = "Zu4eXonKeUGuNuN9D3NKIEHU7PfqPA3uBfrc-lV0kIs"; |
|
|
//微信的基础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); |
|
|
List<String> openIds=new ArrayList<>(); |
|
|
List<String> openIds=new ArrayList<>(); |
|
|
openIds.add("otnrM57kui-WCUmRtChhb1HguOgw"); |
|
|
openIds.add("otnrM57kui-WCUmRtChhb1HguOgw"); |
|
|
openIds.add("otnrM521f8KcCsRfL2Jj4Tk8np1g"); |
|
|
openIds.add("otnrM544hxIgkMOfaDU8VpJhj_6k"); |
|
|
// openIds.add("otnrM5ySvUo7ZZc4qafWzM9eyKBk");
|
|
|
//openIds.add("otnrM5ySvUo7ZZc4qafWzM9eyKBk");
|
|
|
JSONObject jsonObject=new JSONObject(); |
|
|
JSONObject jsonObject=new JSONObject(); |
|
|
for(String openId:openIds){ |
|
|
for(String openId:openIds){ |
|
|
sendMag.put("thing3", new Template(csmCashReportVo.getCompanyName())); |
|
|
sendMag.put("character_string2", new Template(csmCashReportVo.getSerialNumber())); |
|
|
sendMag.put("time4", new Template(csmCashReportVo.getReportDate())); |
|
|
sendMag.put("thing5", new Template(csmCashReportVo.getReportTime())); |
|
|
|
|
|
sendMag.put("amount3", new Template(String.valueOf(csmCashReportVo.getCountAmount()))); |
|
|
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("pagepath","pages/index/inventoryReport?orderDate="+csmCashReportVo.getOrderDate()); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
//拼接base参数
|
|
|
//拼接base参数
|
|
|
Map<String, Object> sendBody = new HashMap<>(); |
|
|
Map<String, Object> sendBody = new HashMap<>(); |
|
|