新增退款申请用户交易记录接口
This commit is contained in:
parent
bba222e730
commit
d10edde2cf
@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cdzy.common.enums.Code;
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.payment.model.dto.*;
|
||||
import com.cdzy.payment.service.EbikeRefundService;
|
||||
import com.cdzy.payment.service.WxPayService;
|
||||
import com.ebike.feign.clients.StaffFeignClient;
|
||||
import com.ebike.feign.model.rsp.StaffFeign;
|
||||
@ -32,6 +33,8 @@ public class EbikeWxPaymentController {
|
||||
private WxPayService wxPayService;
|
||||
@Resource
|
||||
private StaffFeignClient staffFeignClient;
|
||||
@Resource
|
||||
private EbikeRefundService ebikeRefundService;
|
||||
|
||||
/**
|
||||
* 微信支付下单
|
||||
@ -172,7 +175,7 @@ public class EbikeWxPaymentController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款申请
|
||||
* 退款申请用户详情
|
||||
*
|
||||
* @param refundId 退款id
|
||||
* @return
|
||||
@ -180,6 +183,18 @@ public class EbikeWxPaymentController {
|
||||
@PostMapping("/refundApplyUserDetail/{refundId}")
|
||||
public JsonResult<?> refundApplyUserDetail(@PathVariable(name = "refundId") String refundId) {
|
||||
UserBasicInformation r = wxPayService.queryRefundUserInfoById(refundId);
|
||||
return r == null ? JsonResult.failed(String.format("退款单号{%s}查询订单详情失败", refundId)) : JsonResult.success(r);
|
||||
return r == null ? JsonResult.failed(String.format("退款单号{%s}查询用户详情失败", refundId)) : JsonResult.success(r);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款申请用户交易记录
|
||||
*
|
||||
* @param reqTradeRecordDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/refundApplyTradeRecord")
|
||||
public JsonResult<?> refundApplyTradeRecord(@RequestBody ReqTradeRecordDto reqTradeRecordDto) {
|
||||
Page<TransactionRecord> list = ebikeRefundService.queryRefundTradeRecordById(reqTradeRecordDto);
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.cdzy.payment.model.dto;
|
||||
|
||||
import com.cdzy.common.model.PageParam;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:Ding
|
||||
* @ClassName:ReqTradeRecordDto
|
||||
* @Package:com.cdzy.payment.model.dto.ReqTradeRecordDto
|
||||
* @Description:交易记录查询dto
|
||||
* @CreateDate:2025年05月21日
|
||||
* @Version:V1.0
|
||||
**/
|
||||
@Data
|
||||
public class ReqTradeRecordDto {
|
||||
|
||||
private String refundId;
|
||||
|
||||
/**
|
||||
* 分页参数
|
||||
*/
|
||||
@NotNull(message = "分页参数不能为空")
|
||||
private PageParam pageParam;
|
||||
|
||||
}
|
||||
@ -86,4 +86,12 @@ public interface EbikeRefundService extends IService<EbikeRefund> {
|
||||
* @return 退款详情
|
||||
*/
|
||||
ResOrderInfoDto getRefundOrderDetail(String refundId);
|
||||
|
||||
/**
|
||||
* 退款申请交易记录
|
||||
*
|
||||
* @param reqTradeRecordDto 退款id
|
||||
* @return
|
||||
*/
|
||||
Page<TransactionRecord> queryRefundTradeRecordById(ReqTradeRecordDto reqTradeRecordDto);
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ import static com.mybatisflex.core.constant.FuncName.*;
|
||||
* @since 2025-04-25
|
||||
*/
|
||||
@Service
|
||||
public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, EbikeRefund> implements EbikeRefundService{
|
||||
public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, EbikeRefund> implements EbikeRefundService {
|
||||
|
||||
@Resource
|
||||
private OrdersFeignClient ordersFeignClient;
|
||||
@ -41,7 +41,7 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
public Boolean saveRefundResult(EbikeRefund ebikeRefund) {
|
||||
boolean r = save(ebikeRefund);
|
||||
// 同步发起退款
|
||||
if(r)
|
||||
if (r)
|
||||
ordersFeignClient.refundApply(Long.valueOf(ebikeRefund.getOrderId()));
|
||||
return r;
|
||||
}
|
||||
@ -76,7 +76,7 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
}
|
||||
long orderId = Long.parseLong(refund.getOutTradeNo());
|
||||
// 更新订单退款状态
|
||||
switch (refund.getStatus()){
|
||||
switch (refund.getStatus()) {
|
||||
case PROCESSING, CLOSED -> ordersFeignClient.refund(orderId);
|
||||
case SUCCESS -> ordersFeignClient.doneRefund(orderId);
|
||||
case ABNORMAL -> ordersFeignClient.failRefund(orderId);
|
||||
@ -88,12 +88,12 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
public Page<ResApplyRefundDto> getApplyingList(ReqRefundQueryDto refundDto) {
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_REFUND.REFUND_ID.as("id"), EBIKE_REFUND.CREATE_TIME.as("apply_time"), EBIKE_USER.MOBILE.as("phone"),
|
||||
EBIKE_REFUND.ORDER_ID.as("cycling_order_number"), EBIKE_REFUND.REFUND_APPLY.as("apply_refund_amount"),
|
||||
EBIKE_REFUND.ORDER_ID.as("cycling_order_number"), EBIKE_REFUND.REFUND_APPLY.as("apply_refund_amount"),
|
||||
EBIKE_PAYMENT.TOTAL.as("actual_pay_amount"), QueryMethods.case_(EBIKE_PAYMENT.PAYMENT_METHOD)
|
||||
.when(PayMethod.wechat.name()).then("微信支付")
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
EBIKE_PAYMENT.PAYMENT_TIME.as("pay_time"), EBIKE_REFUND.REASON.as("apply_reason"),
|
||||
EBIKE_PAYMENT.PAYMENT_TIME.as("pay_time"), EBIKE_REFUND.REASON.as("apply_reason"),
|
||||
QueryMethods.case_(EBIKE_REFUND.SOURCE).when("0").then("用户")
|
||||
.when("1").then("客服").end().as("source"), EBIKE_USER.NICKNAME.as("applicant"),
|
||||
EBIKE_USER_ORDERS.BIKE_CODE.as("ebike_code"), EBIKE_USER_ORDERS.START_TIME.as("start_time"), EBIKE_USER_ORDERS.END_TIME.as("end_time"),
|
||||
@ -102,14 +102,14 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
.leftJoin(EBIKE_PAYMENT).on(EBIKE_PAYMENT.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER.USER_ID.eq(EBIKE_PAYMENT.USER_ID))
|
||||
.leftJoin(EBIKE_USER_ORDERS).on(EBIKE_USER_ORDERS.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.where(EBIKE_REFUND.PROCESS_STATE.eq(String.valueOf(applying.ordinal())));
|
||||
if(refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
.where(EBIKE_REFUND.PROCESS_STATE.eq(String.valueOf(applying.ordinal())));
|
||||
if (refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
query.and(EBIKE_USER.MOBILE.like(refundDto.getPhone()));
|
||||
if(refundDto.getCyclingOrderNumber()!= null &&!refundDto.getCyclingOrderNumber().isEmpty())
|
||||
if (refundDto.getCyclingOrderNumber() != null && !refundDto.getCyclingOrderNumber().isEmpty())
|
||||
query.and(EBIKE_REFUND.ORDER_ID.like(refundDto.getCyclingOrderNumber()));
|
||||
if(refundDto.getRefundTime()!=null&&!refundDto.getRefundTime().isEmpty()){
|
||||
if (refundDto.getRefundTime() != null && !refundDto.getRefundTime().isEmpty()) {
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.ge(refundDto.getRefundTime().get(0)));
|
||||
if(refundDto.getRefundTime().size()==2)
|
||||
if (refundDto.getRefundTime().size() == 2)
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.le(refundDto.getRefundTime().get(1)));
|
||||
}
|
||||
Page<ResApplyRefundDto> page = refundDto.getPageParam().getPage();
|
||||
@ -126,9 +126,9 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
EBIKE_REFUND.REFUND.as("refund_amount"), QueryMethods.case_(EBIKE_REFUND.REFUND_METHOD)
|
||||
.when("0").then("原路返回")
|
||||
.when("1").then("余额退款")
|
||||
.when("2").then("线下退款").end().as("refund_method"),
|
||||
.when("0").then("原路返回")
|
||||
.when("1").then("余额退款")
|
||||
.when("2").then("线下退款").end().as("refund_method"),
|
||||
EBIKE_PAYMENT.PAYMENT_TIME.as("pay_time"), EBIKE_REFUND.REASON.as("apply_reason"),
|
||||
QueryMethods.case_(EBIKE_REFUND.SOURCE).when("0").then("用户")
|
||||
.when("1").then("客服").end().as("source"), EBIKE_USER.NICKNAME.as("applicant"),
|
||||
@ -139,13 +139,13 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER.USER_ID.eq(EBIKE_PAYMENT.USER_ID))
|
||||
.leftJoin(EBIKE_USER_ORDERS).on(EBIKE_USER_ORDERS.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.where(EBIKE_REFUND.PROCESS_STATE.eq(String.valueOf(processing.ordinal())));
|
||||
if(refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
if (refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
query.and(EBIKE_USER.MOBILE.like(refundDto.getPhone()));
|
||||
if(refundDto.getCyclingOrderNumber()!= null &&!refundDto.getCyclingOrderNumber().isEmpty())
|
||||
if (refundDto.getCyclingOrderNumber() != null && !refundDto.getCyclingOrderNumber().isEmpty())
|
||||
query.and(EBIKE_REFUND.ORDER_ID.like(refundDto.getCyclingOrderNumber()));
|
||||
if(refundDto.getRefundTime()!=null&&!refundDto.getRefundTime().isEmpty()){
|
||||
if (refundDto.getRefundTime() != null && !refundDto.getRefundTime().isEmpty()) {
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.ge(refundDto.getRefundTime().get(0)));
|
||||
if(refundDto.getRefundTime().size()==2)
|
||||
if (refundDto.getRefundTime().size() == 2)
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.le(refundDto.getRefundTime().get(1)));
|
||||
}
|
||||
Page<ResHandleRefundDto> page = refundDto.getPageParam().getPage();
|
||||
@ -155,38 +155,38 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
@Override
|
||||
public Page<ResProcessedRefundDto> getProcessedList(ReqRefundQueryDto refundDto) {
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_REFUND.REFUND_ID.as("id"), EBIKE_REFUND.CREATE_TIME.as("apply_time"), EBIKE_USER.MOBILE.as("phone"),
|
||||
.select(EBIKE_REFUND.REFUND_ID.as("id"), EBIKE_REFUND.CREATE_TIME.as("apply_time"), EBIKE_USER.MOBILE.as("phone"),
|
||||
EBIKE_REFUND.ORDER_ID.as("cycling_order_number"), EBIKE_PAYMENT.TOTAL.as("actual_pay_amount"),
|
||||
QueryMethods.case_(EBIKE_REFUND.STATUS).when(String.valueOf(Status.SUCCESS.ordinal())).then("退款成功")
|
||||
.when(String.valueOf(Status.PROCESSING.ordinal())).then("退款中")
|
||||
QueryMethods.case_(EBIKE_REFUND.STATUS).when(String.valueOf(Status.SUCCESS.ordinal())).then("退款成功")
|
||||
.when(String.valueOf(Status.PROCESSING.ordinal())).then("退款中")
|
||||
.when(String.valueOf(Status.ABNORMAL.ordinal())).then("退款异常")
|
||||
.when(String.valueOf(Status.CLOSED.ordinal())).then("退款终止").end().as("arrived_state"),
|
||||
EBIKE_REFUND.REFUND_TIME.as("arrived_time"),EBIKE_REFUND.REFUND_TRANSACTION_ID.as("trade_serial_number"),
|
||||
QueryMethods.case_(EBIKE_PAYMENT.PAYMENT_METHOD)
|
||||
.when(PayMethod.wechat.name()).then("微信支付")
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
.when(String.valueOf(Status.CLOSED.ordinal())).then("退款终止").end().as("arrived_state"),
|
||||
EBIKE_REFUND.REFUND_TIME.as("arrived_time"), EBIKE_REFUND.REFUND_TRANSACTION_ID.as("trade_serial_number"),
|
||||
QueryMethods.case_(EBIKE_PAYMENT.PAYMENT_METHOD)
|
||||
.when(PayMethod.wechat.name()).then("微信支付")
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
EBIKE_REFUND.REFUND.as("refund_amount"), QueryMethods.case_(EBIKE_REFUND.REFUND_METHOD)
|
||||
.when("0").then("原路返回")
|
||||
.when("1").then("余额退款")
|
||||
.when("2").then("线下退款").end().as("refund_method"),
|
||||
.when("0").then("原路返回")
|
||||
.when("1").then("余额退款")
|
||||
.when("2").then("线下退款").end().as("refund_method"),
|
||||
EBIKE_PAYMENT.PAYMENT_TIME.as("pay_time"), EBIKE_REFUND.REASON.as("apply_reason"),
|
||||
QueryMethods.case_(EBIKE_REFUND.SOURCE).when("0").then("用户")
|
||||
.when("1").then("客服").end().as("source"), EBIKE_USER.NICKNAME.as("applicant"),
|
||||
EBIKE_USER_ORDERS.BIKE_CODE.as("ebike_code"), EBIKE_USER_ORDERS.START_TIME.as("start_time"), EBIKE_USER_ORDERS.END_TIME.as("end_time"),
|
||||
EBIKE_USER_ORDERS.RIDE_POINT, EBIKE_USER_ORDERS.RETURN_POINT
|
||||
)
|
||||
.leftJoin(EBIKE_PAYMENT).on(EBIKE_PAYMENT.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER.USER_ID.eq(EBIKE_PAYMENT.USER_ID))
|
||||
.leftJoin(EBIKE_PAYMENT).on(EBIKE_PAYMENT.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER.USER_ID.eq(EBIKE_PAYMENT.USER_ID))
|
||||
.leftJoin(EBIKE_USER_ORDERS).on(EBIKE_USER_ORDERS.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.where(EBIKE_REFUND.PROCESS_STATE.eq(String.valueOf(processed.ordinal())));
|
||||
if(refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
.where(EBIKE_REFUND.PROCESS_STATE.eq(String.valueOf(processed.ordinal())));
|
||||
if (refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
query.and(EBIKE_USER.MOBILE.like(refundDto.getPhone()));
|
||||
if(refundDto.getCyclingOrderNumber()!= null &&!refundDto.getCyclingOrderNumber().isEmpty())
|
||||
if (refundDto.getCyclingOrderNumber() != null && !refundDto.getCyclingOrderNumber().isEmpty())
|
||||
query.and(EBIKE_REFUND.ORDER_ID.like(refundDto.getCyclingOrderNumber()));
|
||||
if(refundDto.getRefundTime()!=null&&!refundDto.getRefundTime().isEmpty()){
|
||||
if (refundDto.getRefundTime() != null && !refundDto.getRefundTime().isEmpty()) {
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.ge(refundDto.getRefundTime().get(0)));
|
||||
if(refundDto.getRefundTime().size()==2)
|
||||
if (refundDto.getRefundTime().size() == 2)
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.le(refundDto.getRefundTime().get(1)));
|
||||
}
|
||||
Page<ResProcessedRefundDto> page = refundDto.getPageParam().getPage();
|
||||
@ -196,30 +196,30 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
@Override
|
||||
public Page<ResCloseRefundDto> getClosedList(ReqRefundQueryDto refundDto) {
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_REFUND.REFUND_ID.as("id"), EBIKE_REFUND.CREATE_TIME.as("apply_time"), EBIKE_USER.MOBILE.as("phone"),
|
||||
.select(EBIKE_REFUND.REFUND_ID.as("id"), EBIKE_REFUND.CREATE_TIME.as("apply_time"), EBIKE_USER.MOBILE.as("phone"),
|
||||
EBIKE_REFUND.ORDER_ID.as("cycling_order_number"), EBIKE_PAYMENT.TOTAL.as("actual_pay_amount"),
|
||||
EBIKE_REFUND.REMARK.as("reject_reason"), EBIKE_REFUND.PROCESS_TIME.as("reject_time"),
|
||||
QueryMethods.case_(EBIKE_PAYMENT.PAYMENT_METHOD)
|
||||
.when(PayMethod.wechat.name()).then("微信支付")
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
EBIKE_PAYMENT.PAYMENT_TIME.as("pay_time"), EBIKE_REFUND.REASON.as("apply_reason"),
|
||||
QueryMethods.case_(EBIKE_REFUND.SOURCE).when("0").then("用户")
|
||||
.when("1").then("客服").end().as("source"), EBIKE_USER.NICKNAME.as("applicant"),
|
||||
EBIKE_REFUND.REMARK.as("reject_reason"), EBIKE_REFUND.PROCESS_TIME.as("reject_time"),
|
||||
QueryMethods.case_(EBIKE_PAYMENT.PAYMENT_METHOD)
|
||||
.when(PayMethod.wechat.name()).then("微信支付")
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
EBIKE_PAYMENT.PAYMENT_TIME.as("pay_time"), EBIKE_REFUND.REASON.as("apply_reason"),
|
||||
QueryMethods.case_(EBIKE_REFUND.SOURCE).when("0").then("用户")
|
||||
.when("1").then("客服").end().as("source"), EBIKE_USER.NICKNAME.as("applicant"),
|
||||
EBIKE_USER_ORDERS.BIKE_CODE.as("ebike_code"), EBIKE_USER_ORDERS.START_TIME.as("start_time"), EBIKE_USER_ORDERS.END_TIME.as("end_time"),
|
||||
EBIKE_USER_ORDERS.RIDE_POINT, EBIKE_USER_ORDERS.RETURN_POINT
|
||||
)
|
||||
.leftJoin(EBIKE_PAYMENT).on(EBIKE_PAYMENT.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER.USER_ID.eq(EBIKE_PAYMENT.USER_ID))
|
||||
)
|
||||
.leftJoin(EBIKE_PAYMENT).on(EBIKE_PAYMENT.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER.USER_ID.eq(EBIKE_PAYMENT.USER_ID))
|
||||
.leftJoin(EBIKE_USER_ORDERS).on(EBIKE_USER_ORDERS.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.where(EBIKE_REFUND.PROCESS_STATE.eq(String.valueOf(closed.ordinal())));
|
||||
if(refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
.where(EBIKE_REFUND.PROCESS_STATE.eq(String.valueOf(closed.ordinal())));
|
||||
if (refundDto.getPhone() != null && !refundDto.getPhone().isEmpty())
|
||||
query.and(EBIKE_USER.MOBILE.like(refundDto.getPhone()));
|
||||
if(refundDto.getCyclingOrderNumber()!= null &&!refundDto.getCyclingOrderNumber().isEmpty())
|
||||
if (refundDto.getCyclingOrderNumber() != null && !refundDto.getCyclingOrderNumber().isEmpty())
|
||||
query.and(EBIKE_REFUND.ORDER_ID.like(refundDto.getCyclingOrderNumber()));
|
||||
if(refundDto.getRefundTime()!=null&&!refundDto.getRefundTime().isEmpty()){
|
||||
if (refundDto.getRefundTime() != null && !refundDto.getRefundTime().isEmpty()) {
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.ge(refundDto.getRefundTime().get(0)));
|
||||
if(refundDto.getRefundTime().size()==2)
|
||||
if (refundDto.getRefundTime().size() == 2)
|
||||
query.and(EBIKE_REFUND.REFUND_TIME.le(refundDto.getRefundTime().get(1)));
|
||||
}
|
||||
Page<ResCloseRefundDto> page = refundDto.getPageParam().getPage();
|
||||
@ -235,7 +235,7 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
.when(PayMethod.wechat.name()).then("微信支付")
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
EBIKE_PAYMENT.TOTAL.as("actual_amount"),EBIKE_PAYMENT.COST_PRICE.as("total_amount"),
|
||||
EBIKE_PAYMENT.TOTAL.as("actual_amount"), EBIKE_PAYMENT.COST_PRICE.as("total_amount"),
|
||||
EBIKE_USER.NICKNAME.as("user"), EBIKE_USER.MOBILE.as("phone")
|
||||
)
|
||||
.leftJoin(EBIKE_PAYMENT).on(EBIKE_PAYMENT.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
@ -243,4 +243,15 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
.where(EBIKE_REFUND.REFUND_ID.eq(refundId));
|
||||
return getOneAs(query, ResOrderInfoDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<TransactionRecord> queryRefundTradeRecordById(ReqTradeRecordDto reqTradeRecordDto) {
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_PAYMENT.TOTAL.as("amount"), EBIKE_PAYMENT.CREATE_TIME)
|
||||
.leftJoin(EBIKE_PAYMENT).on(EBIKE_PAYMENT.ORDER_ID.eq(EBIKE_REFUND.ORDER_ID))
|
||||
.where(EBIKE_REFUND.REFUND_ID.eq(reqTradeRecordDto.getRefundId()));
|
||||
|
||||
Page<TransactionRecord> page = reqTradeRecordDto.getPageParam().getPage();
|
||||
return pageAs(page, query, TransactionRecord.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import com.ebike.feign.model.rsp.DetailDto;
|
||||
import com.ebike.feign.model.rsp.EbikePaymentDto;
|
||||
import com.ebike.feign.model.rsp.PayDetailDto;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.cipher.Signer;
|
||||
import com.wechat.pay.java.core.exception.HttpException;
|
||||
@ -48,6 +49,8 @@ import java.time.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cdzy.payment.model.entity.table.EbikePaymentTableDef.EBIKE_PAYMENT;
|
||||
import static com.cdzy.payment.model.entity.table.EbikeRefundTableDef.EBIKE_REFUND;
|
||||
import static com.wechat.pay.java.core.http.Constant.*;
|
||||
import static com.wechat.pay.java.core.http.Constant.WECHAT_PAY_SERIAL;
|
||||
|
||||
@ -389,7 +392,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
ebikeRefund.setRefundMethod(processDto.getMethod());
|
||||
// 更新订单状态
|
||||
ordersFeignClient.refund(Long.valueOf(ebikeRefund.getOrderId()));
|
||||
}else if (String.valueOf(RefundProcessState.closed.ordinal()).equals(processDto.getOperate())) {
|
||||
} else if (String.valueOf(RefundProcessState.closed.ordinal()).equals(processDto.getOperate())) {
|
||||
// 更新订单状态
|
||||
ordersFeignClient.rejectRefund(Long.valueOf(ebikeRefund.getOrderId()));
|
||||
}
|
||||
@ -422,7 +425,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
result_.setMessage(String.format("{%s}退款中,不能重复退款", refundDto.getRefundId()));
|
||||
return result_;
|
||||
}
|
||||
if (String.valueOf(Status.CLOSED.ordinal()).equals(ebikeRefund.getStatus())||
|
||||
if (String.valueOf(Status.CLOSED.ordinal()).equals(ebikeRefund.getStatus()) ||
|
||||
String.valueOf(Status.ABNORMAL.ordinal()).equals(ebikeRefund.getStatus())) {
|
||||
//重新发起
|
||||
String new_order = StringUtils.generateSnowflakeId("refundId");
|
||||
@ -476,7 +479,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
try {
|
||||
JSONObject json = JSON.parseObject(err);
|
||||
result_.setMessage(json.getString("message"));
|
||||
}catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
result_.setMessage(err);
|
||||
}
|
||||
return result_;
|
||||
@ -567,7 +570,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
@Override
|
||||
public ResOrderInfoDto queryRefundOrderById(String refundId) {
|
||||
ResOrderInfoDto orderDto = ebikeRefundService.getRefundOrderDetail(refundId);
|
||||
if (orderDto==null){
|
||||
if (orderDto == null) {
|
||||
log.error("{}退款订单不存在", refundId);
|
||||
return null;
|
||||
}
|
||||
@ -581,13 +584,15 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
for (PayDetailDto detailDto : paymentDto.getDetail().getGoodsDetail()) {
|
||||
//1-骑行时长费 2-运营区调度费用 3-停车区调度费用 4-高峰时段出行费用 5-高峰日出行费用 6-起步费用
|
||||
switch (detailDto.getItemType()) {
|
||||
case 1, 4, 5 -> orderDto.setDurationCost(orderDto.getDurationCost()+detailDto.getUnitPrice());
|
||||
case 2 -> orderDto.setDispatchFeeOutOperateArea(orderDto.getParkingAreaOutDispatchFee() + detailDto.getUnitPrice());
|
||||
case 3 -> orderDto.setParkingAreaOutDispatchFee(orderDto.getParkingAreaOutDispatchFee() + detailDto.getUnitPrice());
|
||||
case 1, 4, 5 -> orderDto.setDurationCost(orderDto.getDurationCost() + detailDto.getUnitPrice());
|
||||
case 2 ->
|
||||
orderDto.setDispatchFeeOutOperateArea(orderDto.getParkingAreaOutDispatchFee() + detailDto.getUnitPrice());
|
||||
case 3 ->
|
||||
orderDto.setParkingAreaOutDispatchFee(orderDto.getParkingAreaOutDispatchFee() + detailDto.getUnitPrice());
|
||||
case 6 -> orderDto.setStartupCost(orderDto.getStartupCost() + detailDto.getUnitPrice());
|
||||
}
|
||||
}
|
||||
orderDto.setDispatchFee(orderDto.getDispatchFee() + orderDto.getParkingAreaOutDispatchFee()+orderDto.getDispatchFeeOutOperateArea()+orderDto.getDispatchFeeBanArea());
|
||||
orderDto.setDispatchFee(orderDto.getDispatchFee() + orderDto.getParkingAreaOutDispatchFee() + orderDto.getDispatchFeeOutOperateArea() + orderDto.getDispatchFeeBanArea());
|
||||
|
||||
orderDto.setOrderId(null);
|
||||
return orderDto;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user