退单
This commit is contained in:
@@ -41,6 +41,7 @@ import com.peanut.modules.pay.weChatPay.service.WxpayService;
|
|||||||
import com.peanut.modules.sys.entity.SysConfigEntity;
|
import com.peanut.modules.sys.entity.SysConfigEntity;
|
||||||
import com.peanut.modules.sys.service.SysConfigService;
|
import com.peanut.modules.sys.service.SysConfigService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.http.HttpException;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
@@ -676,6 +677,7 @@ public class BuyOrderController {
|
|||||||
}
|
}
|
||||||
//设置状态为已退款
|
//设置状态为已退款
|
||||||
buyOrder.setOrderStatus(Constants.ORDER_STATUS_REFUNDING);
|
buyOrder.setOrderStatus(Constants.ORDER_STATUS_REFUNDING);
|
||||||
|
buyOrderService.updateById(buyOrder);
|
||||||
|
|
||||||
BigDecimal refundFee = buyOrder.getRealMoney();
|
BigDecimal refundFee = buyOrder.getRealMoney();
|
||||||
BigDecimal shippingMoney = buyOrder.getShippingMoney()==null?BigDecimal.ZERO:buyOrder.getShippingMoney();
|
BigDecimal shippingMoney = buyOrder.getShippingMoney()==null?BigDecimal.ZERO:buyOrder.getShippingMoney();
|
||||||
@@ -742,7 +744,11 @@ public class BuyOrderController {
|
|||||||
} else if (buyOrder.getCome()==4) {
|
} else if (buyOrder.getCome()==4) {
|
||||||
weChatRefundInfo.setAppName("thyy");
|
weChatRefundInfo.setAppName("thyy");
|
||||||
}
|
}
|
||||||
wxpayService.refund(weChatRefundInfo);
|
try {
|
||||||
|
wxpayService.refund(weChatRefundInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("msg=" + e.getMessage()); // 👈 关键
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else if (Constants.PAYMENT_METHOD_ALI_PAY.equals(buyOrder.getPaymentMethod())) {
|
// else if (Constants.PAYMENT_METHOD_ALI_PAY.equals(buyOrder.getPaymentMethod())) {
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ public class PayRefundOrder implements Serializable {
|
|||||||
|
|
||||||
|
|
||||||
@TableId
|
@TableId
|
||||||
private Integer refundId;
|
private Integer id;
|
||||||
|
|
||||||
|
private String refundId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付方式 1微信,2支付宝,3虚拟币
|
* 支付方式 1微信,2支付宝,3虚拟币
|
||||||
@@ -29,8 +31,9 @@ public class PayRefundOrder implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* BuyOrder
|
* BuyOrder
|
||||||
*/
|
*/
|
||||||
private Integer orderId;
|
private String orderSn;
|
||||||
|
|
||||||
|
private Integer orderId;
|
||||||
/**
|
/**
|
||||||
* 微信支付宝订单号
|
* 微信支付宝订单号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
|||||||
// 这里 * 100,微信支付单位为 ‘分’
|
// 这里 * 100,微信支付单位为 ‘分’
|
||||||
BigDecimal hand = new BigDecimal("100");
|
BigDecimal hand = new BigDecimal("100");
|
||||||
Map<String, Object> amountMap = new HashMap<>();
|
Map<String, Object> amountMap = new HashMap<>();
|
||||||
amountMap.put("refund", refund.multiply(hand));
|
amountMap.put("refund", refund.multiply(hand).intValue());
|
||||||
amountMap.put("total", total.multiply(hand).intValue());
|
amountMap.put("total", total.multiply(hand).intValue());
|
||||||
amountMap.put("currency", "CNY");
|
amountMap.put("currency", "CNY");
|
||||||
paramMap.put("amount", amountMap);
|
paramMap.put("amount", amountMap);
|
||||||
@@ -392,14 +392,18 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
|||||||
appid = wechatPayConfig.getThyyappId();
|
appid = wechatPayConfig.getThyyappId();
|
||||||
}
|
}
|
||||||
// app id
|
// app id
|
||||||
paramMap.put("appid", appid);
|
// paramMap.put("appid", appid);
|
||||||
|
|
||||||
String notify_url = wechatPayConfig.getRefundNotifyUrl();
|
String notify_url = wechatPayConfig.getRefundNotifyUrl();
|
||||||
String mchName = "";
|
String mchName = "";
|
||||||
|
|
||||||
|
String mchid = wechatPayConfig.getMchId();
|
||||||
if ("trainingClass".equals(refundInfo.getOrderType())||"lsorder".equals(refundInfo.getOrderType())) {
|
if ("trainingClass".equals(refundInfo.getOrderType())||"lsorder".equals(refundInfo.getOrderType())) {
|
||||||
mchName = "LS";
|
mchName = "LS";
|
||||||
|
mchid = wechatPayConfig.getLsMchId();
|
||||||
notify_url = wechatPayConfig.getLsRefundNotifyUrl();
|
notify_url = wechatPayConfig.getLsRefundNotifyUrl();
|
||||||
}
|
}
|
||||||
|
// paramMap.put("mchid", mchid);
|
||||||
paramMap.put("notify_url", notify_url);
|
paramMap.put("notify_url", notify_url);
|
||||||
|
|
||||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(paramMap));
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(paramMap));
|
||||||
@@ -470,9 +474,9 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
|||||||
|
|
||||||
PayRefundOrder refund = new PayRefundOrder();
|
PayRefundOrder refund = new PayRefundOrder();
|
||||||
refund.setPayType("1");
|
refund.setPayType("1");
|
||||||
refund.setOrderId(order.getOrderId());
|
refund.setRefundId(resourceMap.get("refund_id").toString());
|
||||||
refund.setTradeNo(resourceMap.get("transaction_id").toString());
|
refund.setTradeNo(resourceMap.get("transaction_id").toString());
|
||||||
refund.setOutTradeNo(resourceMap.get("out_trade_no").toString());
|
refund.setOrderSn(resourceMap.get("out_trade_no").toString());
|
||||||
refund.setRefundFee(((Map)resourceMap.get("amount")).get("refund").toString());
|
refund.setRefundFee(((Map)resourceMap.get("amount")).get("refund").toString());
|
||||||
refundOrderService.save(refund);
|
refundOrderService.save(refund);
|
||||||
|
|
||||||
|
|||||||
@@ -210,8 +210,9 @@
|
|||||||
|
|
||||||
<!-- <!– 4.2 生产环境:输出到文档–>-->
|
<!-- <!– 4.2 生产环境:输出到文档–>-->
|
||||||
<springProfile name="test,prod">
|
<springProfile name="test,prod">
|
||||||
<logger name="com.peanut" level="ERROR" additivity="false">
|
<logger name="com.peanut" level="INFO" additivity="false">
|
||||||
<!-- <appender-ref ref="DEBUG_FILE"/>-->
|
<!-- <appender-ref ref="DEBUG_FILE"/>-->
|
||||||
|
<appender-ref ref="INFO_FILE"/>
|
||||||
<appender-ref ref="ERROR_FILE"/>
|
<appender-ref ref="ERROR_FILE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<root level="info">
|
<root level="info">
|
||||||
|
|||||||
Reference in New Issue
Block a user