新增商家端退款申请通知
This commit is contained in:
@ -21,7 +21,8 @@ public enum TemplateListenEnum {
|
|||||||
TYPE_5("5","在线买单/收款成功通知"),
|
TYPE_5("5","在线买单/收款成功通知"),
|
||||||
TYPE_6("6","商家收款通知"),
|
TYPE_6("6","商家收款通知"),
|
||||||
TYPE_7("7","用户下单未支付通知"),
|
TYPE_7("7","用户下单未支付通知"),
|
||||||
TYPE_8("8","用户提现通知");
|
TYPE_8("8","用户提现通知"),
|
||||||
|
TYPE_9("9","退款申请通知");
|
||||||
private String value;
|
private String value;
|
||||||
private String desc;
|
private String desc;
|
||||||
|
|
||||||
|
@ -1063,7 +1063,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
.orderId(order.getOrderId())
|
.orderId(order.getOrderId())
|
||||||
.price(order.getPayPrice().toString())
|
.price(order.getPayPrice().toString())
|
||||||
.uid(order.getUid())
|
.uid(order.getUid())
|
||||||
.templateType(TemplateListenEnum.TYPE_2.getValue())
|
.templateType(TemplateListenEnum.TYPE_9.getValue())
|
||||||
.time(DateUtil.formatTime(new Date()))
|
.time(DateUtil.formatTime(new Date()))
|
||||||
.build();
|
.build();
|
||||||
publisher.publishEvent(new TemplateEvent(this,templateBean));
|
publisher.publishEvent(new TemplateEvent(this,templateBean));
|
||||||
|
@ -99,7 +99,7 @@ public class TemplateListener implements SmartApplicationListener {
|
|||||||
yxStoreCustomers.forEach(msg -> {
|
yxStoreCustomers.forEach(msg -> {
|
||||||
if (StrUtil.isNotBlank(msg.getOpenId())) {
|
if (StrUtil.isNotBlank(msg.getOpenId())) {
|
||||||
weixinTemplateService.paySuccessNoticeToKefu(templateBean.getOrderId()
|
weixinTemplateService.paySuccessNoticeToKefu(templateBean.getOrderId()
|
||||||
, templateBean.getPrice(), templateBean.getUid());
|
, templateBean.getPrice(), msg.getOpenId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -114,7 +114,7 @@ public class TemplateListener implements SmartApplicationListener {
|
|||||||
weixinPayService.refundOrder(templateBean.getOrderId(), payPrice);
|
weixinPayService.refundOrder(templateBean.getOrderId(), payPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
weixinTemplateService.refundSuccessNotice(templateBean.getOrderId(), templateBean.getPrice(),
|
weixinTemplateService.refundSuccessNotice("您的订单退款申请被通过,钱款将很快还至您的支付账户。",templateBean.getOrderId(), templateBean.getPrice(),
|
||||||
templateBean.getUid(), templateBean.getTime());
|
templateBean.getUid(), templateBean.getTime());
|
||||||
break;
|
break;
|
||||||
case TYPE_3:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
//todo
|
//todo
|
||||||
|
@ -111,9 +111,9 @@ public class WeixinTemplateService {
|
|||||||
*
|
*
|
||||||
* @param orderId
|
* @param orderId
|
||||||
* @param price
|
* @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<String, String> map = new HashMap<>();
|
||||||
map.put("first", "尊敬的客服,您有新订单了");
|
map.put("first", "尊敬的客服,您有新订单了");
|
||||||
map.put("keyword1",orderId);
|
map.put("keyword1",orderId);
|
||||||
@ -122,17 +122,13 @@ public class WeixinTemplateService {
|
|||||||
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
||||||
String appId=RedisUtil.get(ShopKeyUtils.getWxAppAppId());
|
String appId=RedisUtil.get(ShopKeyUtils.getWxAppAppId());
|
||||||
if(StrUtil.isNotBlank(tempId)) {
|
if(StrUtil.isNotBlank(tempId)) {
|
||||||
String openid = this.getUserOpenid(uid);
|
|
||||||
if(StrUtil.isBlank(openid)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(StrUtil.isBlank(appId)){
|
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{
|
}else{
|
||||||
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
|
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
|
||||||
miniProgram.setAppid(RedisUtil.get(ShopKeyUtils.getWxAppAppId()));
|
miniProgram.setAppid(RedisUtil.get(ShopKeyUtils.getWxAppAppId()));
|
||||||
miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId);
|
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 uid uid
|
||||||
* @param time 时间
|
* @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);
|
String openid = this.getUserOpenid(uid);
|
||||||
|
|
||||||
@ -157,7 +153,7 @@ public class WeixinTemplateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("first","您的订单退款申请被通过,钱款将很快还至您的支付账户。");
|
map.put("first",title);
|
||||||
//订单号
|
//订单号
|
||||||
map.put("keyword1",orderId);
|
map.put("keyword1",orderId);
|
||||||
map.put("keyword2",price);
|
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 单号
|
* @param orderId 单号
|
||||||
|
Reference in New Issue
Block a user