From a9f950c0d11a687a7a940443b8c765f6d87ae4f1 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Tue, 20 Apr 2021 00:26:22 +0800
Subject: [PATCH] 合并新的修改
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java | 60 +++++++++++++++++++++++-------------------------------------
1 files changed, 23 insertions(+), 37 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
index 807ab9d..984fefa 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopRefundRecordServiceImpl.java
@@ -1,20 +1,22 @@
package com.matrix.system.shopXcx.api.service.impl;
-import com.matrix.component.wechat.externalInterface.common.WechatConfigure;
+import com.matrix.component.rabbitmq.RabiitMqTemplate;
+import com.matrix.component.tools.WxTempLateMsgUtil;
+import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.tools.DateUtil;
import com.matrix.core.tools.LogUtil;
import com.matrix.system.common.constance.AppConstance;
-import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil;
-import com.matrix.system.shopXcx.bean.*;
-import com.matrix.system.shopXcx.dao.*;
-import com.matrix.component.tools.WxTempLateMsgUtil;
import com.matrix.system.shopXcx.api.service.WXShopOrderService;
import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService;
+import com.matrix.system.shopXcx.bean.*;
+import com.matrix.system.shopXcx.dao.*;
+import com.matrix.system.shopXcx.mqTask.MQTaskRouting;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -49,7 +51,15 @@
@Value("${wx_pay_debug_onoff}")
private boolean isDebug;
+ @Value("${evn}")
+ private String evn;
+
+ @Autowired
+ private RabiitMqTemplate rabiitMqTemplate;
+
+
@Override
+ @Transactional
public Boolean refundToUser(String id, ShopRefundRecord shopRefundRecord) {
LogUtil.debug("进入退款接口进行退款。。。", id);
Boolean flag = false;
@@ -78,14 +88,13 @@
//Double refundMoney = 0.1 * 100;
//用户ID
- String userId = WechatConfigure.mchID;
if (isDebug) {
- boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, 1, 1, userId);
+ boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, 1, 1, null);
flag = b;
} else {
LogUtil.info("开始调用退款接口。。。退款编号为", refundNo);
- boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, orMoney, reMoney, userId);
+ boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, orMoney, reMoney, null);
flag = b;
}
@@ -102,7 +111,7 @@
//退款成功后同时把优惠券退回到用户的账号中
if (shopOrder.getDiscountAmount() != null && shopOrder.getDiscountAmount().compareTo(BigDecimal.ZERO) >0) {
ShopCouponRecord shopCouponRecord = new ShopCouponRecord();
- String userIds = shopRefundRecord.getUserId();
+ Long userIds = shopRefundRecord.getUserId();
shopCouponRecord.setUserId(userIds);
shopCouponRecord.setOrderId(shopOrder.getId());
List<ShopCouponRecord> recordList = shopCouponRecordDao.selectByModel(shopCouponRecord);
@@ -135,6 +144,10 @@
modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_MONEYBACK_SUCCESS);
modifyMap.put("refundCharge", shopRefundRecord.getRefundMoney());
shopOrderDao.updateByMap(modifyMap);
+
+ rabiitMqTemplate.sendMsg(MQTaskRouting.SHOP_ORDER_REFUND+evn,shopRefundRecord.getOrderId()+"");
+
+
}catch (Exception e){
LogUtil.debug("退款成功,修改退款表和订单表状态出错。。。", id);
e.printStackTrace();
@@ -143,34 +156,7 @@
return flag;
}
- /**
- * 退款成功后发送微信提醒
- * @param shopRefundRecord
- * @return
- */
- @Override
- public int sendRefundInfoToUser(ShopRefundRecord shopRefundRecord) {
- ShopOrder order = shopOrderDao.selectById(shopRefundRecord.getOrderId());
- if (order == null) {
- throw new GlobleException("没有找到需要退款的订单信息");
- }
- List<String> msg = new ArrayList<>();
- //退款说明
- String refundExplain = "退款已经原路返回,具体到账时间可能会有1-3天延迟";
- msg.add(order.getOrderNo());
- msg.add(DateUtil.dateToString(shopRefundRecord.getRefundTime(),DateUtil.DATE_FORMAT_SS));
- msg.add(refundExplain);
- String formId = null;
- if(AppConstance.REFUND_GOODS.equals(shopRefundRecord.getRefundType()) && null != shopRefundRecord.getRefundTransactionNo()){
- formId = shopRefundRecord.getRefundTransactionNo();
- }else {
- formId = order.getWxOrderNo().split("=")[1];
- }
- String page = "pages/refunDetail/refunDetail?id=" + shopRefundRecord.getId() + "&&status=1" + "&&inform=1";
- int res = WxTempLateMsgUtil.sendWxTemplateMsg(msg, order.getUserId(),
- page, WxTempLateMsgUtil.REFUND_SUCCESS, formId);
- return res;
- }
+
@Override
public void updateGroupBuyStatus(Long orderId) {
--
Gitblit v1.9.1