mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-30 03:58:09 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -290,4 +290,24 @@ public class TempController extends BaseController {
|
|||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重试订单退款接口
|
||||||
|
* http://localhost:8080/temp/retryRefundOrder
|
||||||
|
*/
|
||||||
|
@PostMapping("/retryRefundOrder")
|
||||||
|
public RestApiResponse<?> retryRefundOrder(@RequestBody ApplyRefundDTO dto) {
|
||||||
|
RestApiResponse<?> response;
|
||||||
|
try {
|
||||||
|
orderBasicInfoService.retryRefundOrder(dto.getOrderCode());
|
||||||
|
response = new RestApiResponse<>();
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.error("重试订单退款接口 error,", e);
|
||||||
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("重试订单退款接口 error,", e);
|
||||||
|
response = new RestApiResponse<>(e);
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -695,4 +695,23 @@ public class AdapayMemberService {
|
|||||||
log.info("汇付支付创建交易撤销对象param:{}, result:{}", JSON.toJSONString(reverseParams), jsonString);
|
log.info("汇付支付创建交易撤销对象param:{}, result:{}", JSON.toJSONString(reverseParams), jsonString);
|
||||||
return JSONObject.parseObject(jsonString, PaymentReverseResponse.class);
|
return JSONObject.parseObject(jsonString, PaymentReverseResponse.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询支付撤销对象
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<PaymentReverseResponse> queryPaymentReverse(String paymentId, String wechatAppId) throws BaseAdaPayException {
|
||||||
|
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||||||
|
if (config == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||||
|
}
|
||||||
|
Map<String, Object> reverse = Maps.newHashMap();
|
||||||
|
reverse.put("payment_id", paymentId);
|
||||||
|
reverse.put("app_id", config.getAdapayAppId());
|
||||||
|
Map<String, Object> response = PaymentReverse.queryList(reverse, config.getWechatAppId());
|
||||||
|
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(response));
|
||||||
|
List<PaymentReverseResponse> payment_reverses = jsonObject.getList("payment_reverses", PaymentReverseResponse.class);
|
||||||
|
return payment_reverses;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,4 +335,10 @@ public interface IOrderBasicInfoService {
|
|||||||
* 2. 发送启动充电指令
|
* 2. 发送启动充电指令
|
||||||
*/
|
*/
|
||||||
void payOrderSuccessCallback(PayOrderSuccessCallbackDTO dto);
|
void payOrderSuccessCallback(PayOrderSuccessCallbackDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重试订单退款
|
||||||
|
* @param orderCode 订单编号
|
||||||
|
*/
|
||||||
|
void retryRefundOrder(String orderCode) throws BaseAdaPayException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,4 +96,6 @@ public interface IPileMerchantInfoService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PileMerchantInfo> queryFirstLevelMerchant();
|
List<PileMerchantInfo> queryFirstLevelMerchant();
|
||||||
|
|
||||||
|
String queryAppIdByMerchantId(String merchantId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2415,7 +2415,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
}
|
}
|
||||||
memberAdapayRecordService.updateByPrimaryKeySelective(record);
|
memberAdapayRecordService.updateByPrimaryKeySelective(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2769,6 +2768,46 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void retryRefundOrder(String orderCode) throws BaseAdaPayException {
|
||||||
|
// 查询订单信息
|
||||||
|
OrderBasicInfo orderBasicInfo = getOrderInfoByOrderCode(orderCode);
|
||||||
|
if (orderBasicInfo == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_INFO_IS_NULL);
|
||||||
|
}
|
||||||
|
// 如果该订单是订单完成状态,并且是微信支付 存在需要退款金额,则进行后续操作
|
||||||
|
String orderStatus = orderBasicInfo.getOrderStatus();
|
||||||
|
if (!StringUtils.equals(orderStatus, OrderStatusEnum.ORDER_COMPLETE.getValue())) {
|
||||||
|
throw new BusinessException("", "订单不是完成状态");
|
||||||
|
}
|
||||||
|
String payMode = orderBasicInfo.getPayMode();
|
||||||
|
if (!StringUtils.equals(payMode, OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
||||||
|
throw new BusinessException("", "订单不是微信支付");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查到原汇付支付id
|
||||||
|
AdapayCallbackRecord adapayCallbackRecord = adapayCallbackRecordService.selectByOrderCode(orderCode);
|
||||||
|
if (adapayCallbackRecord == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CALLBACK_IS_NULL_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取appId
|
||||||
|
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(orderBasicInfo.getMerchantId());
|
||||||
|
|
||||||
|
// 通过支付id查询退款记录
|
||||||
|
String paymentId = adapayCallbackRecord.getPaymentId();
|
||||||
|
String memberId = orderBasicInfo.getMemberId();
|
||||||
|
BigDecimal refundAmount = orderBasicInfo.getRefundAmount();
|
||||||
|
List<PaymentReverseResponse> paymentReverses = adapayMemberService.queryPaymentReverse(paymentId, wechatAppId);
|
||||||
|
if (CollectionUtils.isEmpty(paymentReverses)) {
|
||||||
|
// 如果没有退款过,重新执行一遍退款
|
||||||
|
PaymentReverseResponse response = adapayMemberService.createPaymentReverseRequest(
|
||||||
|
paymentId, refundAmount, wechatAppId, memberId, ScenarioEnum.ORDER.getValue(),
|
||||||
|
orderCode);
|
||||||
|
logger.info("重试订单退款response:{}", JSON.toJSONString(response));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用汇付支付
|
* 使用汇付支付
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
|||||||
/**
|
/**
|
||||||
* 通过merchantId查询appId
|
* 通过merchantId查询appId
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String queryAppIdByMerchantId(String merchantId) {
|
public String queryAppIdByMerchantId(String merchantId) {
|
||||||
/*
|
/*
|
||||||
一般情况下新建的运营商appId都是有值的,某些早前建的运营商appId可能为空
|
一般情况下新建的运营商appId都是有值的,某些早前建的运营商appId可能为空
|
||||||
|
|||||||
Reference in New Issue
Block a user