新增商家端退款申请通知

This commit is contained in:
朱耘稷
2020-12-10 19:24:02 +08:00
parent d5082ac293
commit b963f268a9
4 changed files with 57 additions and 14 deletions

View File

@ -99,7 +99,7 @@ public class TemplateListener implements SmartApplicationListener {
yxStoreCustomers.forEach(msg -> {
if (StrUtil.isNotBlank(msg.getOpenId())) {
weixinTemplateService.paySuccessNoticeToKefu(templateBean.getOrderId()
, templateBean.getPrice(), templateBean.getUid());
, templateBean.getPrice(), msg.getOpenId());
}
});
} catch (Exception e) {
@ -114,7 +114,7 @@ public class TemplateListener implements SmartApplicationListener {
weixinPayService.refundOrder(templateBean.getOrderId(), payPrice);
}
weixinTemplateService.refundSuccessNotice(templateBean.getOrderId(), templateBean.getPrice(),
weixinTemplateService.refundSuccessNotice("您的订单退款申请被通过,钱款将很快还至您的支付账户。",templateBean.getOrderId(), templateBean.getPrice(),
templateBean.getUid(), templateBean.getTime());
break;
case TYPE_3:
@ -162,6 +162,22 @@ public class TemplateListener implements SmartApplicationListener {
}
break;
case TYPE_9:
weixinTemplateService.refundSuccessNotice("您的订单退款申请已提交,等待审核。",templateBean.getOrderId(), templateBean.getPrice(),
templateBean.getUid(), templateBean.getTime());
/**************给客服发送消息**************/
try {
List<YxStoreCustomer> yxStoreCustomers = yxStoreCustomerService.list(new LambdaQueryWrapper<YxStoreCustomer>().eq(YxStoreCustomer::getIsEnable, ShopConstants.YSHOP_ONE_NUM));
yxStoreCustomers.forEach(msg -> {
if (StrUtil.isNotBlank(msg.getOpenId())) {
weixinTemplateService.refundSuccessNoticeToKefu("尊敬的客服,您有新的退款申请待处理!",templateBean.getOrderId()
, templateBean.getPrice(), msg.getOpenId(), templateBean.getTime());
}
});
} catch (Exception e) {
log.error("消息发送失败:{}", e);
}
break;
default:
//todo

View File

@ -111,9 +111,9 @@ public class WeixinTemplateService {
*
* @param orderId
* @param price
* @param uid
* @param openId
*/
public void paySuccessNoticeToKefu(String orderId,String price,Long uid) {
public void paySuccessNoticeToKefu(String orderId,String price,String openId) {
Map<String, String> map = new HashMap<>();
map.put("first", "尊敬的客服,您有新订单了");
map.put("keyword1",orderId);
@ -122,17 +122,13 @@ public class WeixinTemplateService {
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
String appId=RedisUtil.get(ShopKeyUtils.getWxAppAppId());
if(StrUtil.isNotBlank(tempId)) {
String openid = this.getUserOpenid(uid);
if(StrUtil.isBlank(openid)) {
return;
}
if(StrUtil.isBlank(appId)){
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
}else{
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
miniProgram.setAppid(RedisUtil.get(ShopKeyUtils.getWxAppAppId()));
miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId);
this.sendWxMpTemplateMessageToWx(openid, tempId, miniProgram, map);
this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map);
}
}
@ -148,7 +144,7 @@ public class WeixinTemplateService {
* @param uid uid
* @param time 时间
*/
public void refundSuccessNotice(String orderId,String price,Long uid,String time){
public void refundSuccessNotice(String title,String orderId,String price,Long uid,String time){
String openid = this.getUserOpenid(uid);
@ -157,7 +153,7 @@ public class WeixinTemplateService {
}
Map<String,String> map = new HashMap<>();
map.put("first","您的订单退款申请被通过,钱款将很快还至您的支付账户。");
map.put("first",title);
//订单号
map.put("keyword1",orderId);
map.put("keyword2",price);
@ -169,6 +165,36 @@ public class WeixinTemplateService {
}
}
/**
* 发送退款申请给客服
* @param orderId 订单号
* @param price 金额
* @param openId openId
* @param time 时间
*/
public void refundSuccessNoticeToKefu(String title,String orderId,String price,String openId,String time){
Map<String,String> map = new HashMap<>();
map.put("first",title);
//订单号
map.put("keyword1",orderId);
map.put("keyword2",price);
map.put("keyword3", time);
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
String appId=RedisUtil.get(ShopKeyUtils.getWxAppAppId());
if(StrUtil.isNotBlank(tempId)) {
if(StrUtil.isBlank(appId)){
this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
}else{
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
miniProgram.setAppid(RedisUtil.get(ShopKeyUtils.getWxAppAppId()));
miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId);
this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map);
}
}
}
/**
* 发货成功通知
* @param orderId 单号