mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -330,10 +330,10 @@ public class PayController extends BaseController {
|
||||
orderService.adapayRefund(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("微信退款接口 warn", e);
|
||||
logger.warn("汇付支付退款接口 warn", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("微信退款接口 error", e);
|
||||
logger.error("汇付支付退款接口 error", e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_WEIXIN_REFUND_ERROR);
|
||||
}
|
||||
return response;
|
||||
|
||||
@@ -120,17 +120,12 @@ public class OrderService {
|
||||
@Autowired
|
||||
private IMemberInvoiceTitleService memberInvoiceTitleService;
|
||||
|
||||
private List<String> stationIdList = Lists.newArrayList("1", "2");
|
||||
|
||||
@Value("${adapay.appId}")
|
||||
private String ADAPAY_APP_ID;
|
||||
|
||||
@Value("${adapay.callback}")
|
||||
private String ADAPAY_CALLBACK_URL;
|
||||
|
||||
@Value("${adapay.refundCallback}")
|
||||
private String adapay_refund_callback_url;
|
||||
|
||||
/**
|
||||
* 生成订单
|
||||
*
|
||||
@@ -1333,11 +1328,11 @@ public class OrderService {
|
||||
String sign = request.getParameter("sign");
|
||||
//验签请参publicKey
|
||||
String publicKey = AdapayCore.PUBLIC_KEY;
|
||||
log.info("汇付支付回调验签请参data={}, sign={}", data, sign);
|
||||
log.info("汇付支付退款回调验签请参data={}, sign={}", data, sign);
|
||||
//验签标记
|
||||
boolean checkSign = AdapaySign.verifySign(data, sign, publicKey);
|
||||
if (!checkSign) {
|
||||
log.info("汇付支付回调验签失败:{}", data);
|
||||
log.info("汇付支付退款回调验签失败:{}", data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ public class SpringBootTestController {
|
||||
Map<String, Object> refundParams = Maps.newHashMap();
|
||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(refundAmount));
|
||||
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
||||
refundParams.put("notify_url", "https://api.jsowellcloud.com/uniapp/pay/adapayRefundCallback");
|
||||
Map<String, Object> response = Refund.create(id, refundParams);
|
||||
System.out.println(JSON.toJSONString(response));
|
||||
// if (response != null && !response.isEmpty()) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -51,6 +50,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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;
|
||||
|
||||
@@ -130,6 +130,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
@Autowired
|
||||
private IPileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Value("${adapay.refundCallback}")
|
||||
private String ADAPAY_REFUND_CALLBACK_URL;
|
||||
|
||||
/**
|
||||
* 条件查询订单基本信息
|
||||
*
|
||||
@@ -1757,17 +1760,28 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
Map<String, Object> refundParams = Maps.newHashMap();
|
||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(dto.getRefundAmount()));
|
||||
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
||||
refundParams.put("notify_url", ADAPAY_REFUND_CALLBACK_URL);
|
||||
Map<String, Object> response = Refund.create(id, refundParams);
|
||||
logger.info("创建退款对象:{}", JSON.toJSONString(response));
|
||||
if (response != null && !response.isEmpty()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(response.get("expend").toString());
|
||||
JSONObject pay_info = jsonObject.getJSONObject("pay_info");
|
||||
Map<String, Object> resultMap = JSONObject.parseObject(pay_info.toJSONString(), new TypeReference<Map<String, Object>>() {});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refundForBalanceWithAdapay(WeChatRefundDTO dto) {
|
||||
// 查会员余额
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId());
|
||||
if (memberVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_MEMBER_NULL_ERROR);
|
||||
}
|
||||
// 校验退款金额
|
||||
BigDecimal principalBalance = memberVO.getPrincipalBalance();
|
||||
BigDecimal refundAmount = dto.getRefundAmount();
|
||||
if (refundAmount.compareTo(principalBalance) > 0) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_REFUND_MEMBER_BALANCE_ERROR);
|
||||
}
|
||||
|
||||
// 查询用户充值余额订单 过滤掉已经退款的充值订单
|
||||
|
||||
// 也许需要多笔支付订单才够退款
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user