Commit 1b931ec5 by gonglei

修改保证金支付流程

1 parent 218abbba
Showing 34 changed files with 359 additions and 59 deletions
...@@ -16,6 +16,7 @@ import com.glsx.usedcar.module.finance.entity.DepositRule; ...@@ -16,6 +16,7 @@ import com.glsx.usedcar.module.finance.entity.DepositRule;
import com.glsx.usedcar.module.finance.entity.Deposit_; import com.glsx.usedcar.module.finance.entity.Deposit_;
import com.glsx.usedcar.module.finance.entity.Withdraw; import com.glsx.usedcar.module.finance.entity.Withdraw;
import com.glsx.usedcar.module.finance.service.DepositService; import com.glsx.usedcar.module.finance.service.DepositService;
import com.glsx.usedcar.module.finance.service.TransactionService;
import com.glsx.usedcar.module.finance.service.WithdrawService; import com.glsx.usedcar.module.finance.service.WithdrawService;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.persistence.criteria.Fetch; import jakarta.persistence.criteria.Fetch;
...@@ -52,9 +53,8 @@ public class DepositController { ...@@ -52,9 +53,8 @@ public class DepositController {
@Resource @Resource
private WxPayService wxService; private WxPayService wxService;
@Resource
@Value("${wx.pay.notifyUrl}") private TransactionService transactionService;
private String notifyUrl;
/** /**
* 分页查询保证金规则 * 分页查询保证金规则
...@@ -193,22 +193,12 @@ public class DepositController { ...@@ -193,22 +193,12 @@ public class DepositController {
* 详见 https://pay.weixin.qq.com/doc/v3/merchant/4012791862 * 详见 https://pay.weixin.qq.com/doc/v3/merchant/4012791862
* </pre> * </pre>
* *
* @param request 请求对象 * @param depositId 请求对象
* @return 退款操作结果 * @return 退款操作结果
*/ */
@PostMapping("refund") @PostMapping("refund")
public WxPayRefundV3Result refund(@RequestBody int depositId ) throws WxPayException { public WxPayRefundV3Result refund(@RequestParam int depositId) throws WxPayException {
Deposit deposit = depositService.getDepositDetailById(depositId); Deposit deposit = depositService.getDepositDetailById(depositId);
WxPayRefundV3Request request=new WxPayRefundV3Request(); return transactionService.refund(deposit);
WxPayRefundV3Request.Amount amount = new WxPayRefundV3Request.Amount();
amount.setCurrency("CNY");
amount.setTotal((int) (deposit.getTransaction().getAmount() * 100));
amount.setRefund((int) (deposit.getAmount() * 100));
request.setAmount(amount);
request.setOutTradeNo(deposit.getOutTradeNo());
request.setTransactionId(deposit.getTransactionId());
request.setNotifyUrl(notifyUrl);
return this.wxService.refundV3(request);
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -1455,6 +1455,16 @@ ...@@ -1455,6 +1455,16 @@
] ]
}, },
{ {
"code": "deposit_refund",
"name": "保证金退款审核",
"type": "MENU",
"enabled": true,
"value": "/finance/deposit/refund",
"children": [
]
},
{
"code": "finance_withdraw", "code": "finance_withdraw",
"name": "提现审核", "name": "提现审核",
"type": "MENU", "type": "MENU",
......
...@@ -4,6 +4,7 @@ import cn.hutool.json.JSONUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.json.JSONUtil;
import com.github.binarywang.wxpay.bean.notify.SignatureHeader; import com.github.binarywang.wxpay.bean.notify.SignatureHeader;
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Response; import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Response;
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Result; import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Result;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result;
import com.github.binarywang.wxpay.bean.transfer.TransferBillsNotifyResult; import com.github.binarywang.wxpay.bean.transfer.TransferBillsNotifyResult;
import com.github.binarywang.wxpay.constant.WxPayConstants; import com.github.binarywang.wxpay.constant.WxPayConstants;
import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.exception.WxPayException;
...@@ -14,6 +15,7 @@ import jakarta.annotation.Resource; ...@@ -14,6 +15,7 @@ import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -91,6 +93,41 @@ public class WxpayController { ...@@ -91,6 +93,41 @@ public class WxpayController {
} }
} }
/**
* <pre>
* 退款回调通知处理
* 详见 https://pay.weixin.qq.com/doc/v3/merchant/4012791865
* </pre>
*
* @param notifyData
* @param request
* @return
* @throws WxPayException
*/
@PostMapping("notify/refund")
public ResponseEntity<String> parseRefundNotifyResult(@RequestBody String notifyData, HttpServletRequest request) {
SignatureHeader header = getRequestHeader(request);
try {
WxPayRefundNotifyV3Result res = this.wxService.parseRefundNotifyV3Result(notifyData, header);
WxPayRefundNotifyV3Result.DecryptNotifyResult decryptRes = res.getResult();
log.info("回调退款通知notify/refund开始");
log.info("回调退款OutRefundNo:"+decryptRes.getOutRefundNo());
// 根据自己业务场景需要构造返回对象
if (WxPayConstants.RefundStatus.SUCCESS.equals(decryptRes.getRefundStatus())) {
transactionService.notifyDepositRefund(decryptRes);
//成功返回200/204,body无需有内容
return ResponseEntity.status(200).body("");
} else {
//失败返回4xx或5xx,且需要构造body信息
return ResponseEntity.status(500).body(WxPayNotifyV3Response.fail("错误原因"));
}
} catch (WxPayException e) {
//失败返回4xx或5xx,且需要构造body信息
return ResponseEntity.status(500).body(WxPayNotifyV3Response.fail("错误原因"));
}
}
@Nullable @Nullable
@RequestMapping("transfer_notify") @RequestMapping("transfer_notify")
public String transfer_notify(@RequestBody String notifyData, HttpServletRequest request) { public String transfer_notify(@RequestBody String notifyData, HttpServletRequest request) {
......
package com.glsx.usedcar.module.auction.service; package com.glsx.usedcar.module.auction.service;
import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.glsx.usedcar.module.account.entity.Account; import com.glsx.usedcar.module.account.entity.Account;
import com.glsx.usedcar.module.auction.entity.AuctionOrder; import com.glsx.usedcar.module.auction.entity.AuctionOrder;
import com.glsx.usedcar.module.auction.entity.AuctionVehicle; import com.glsx.usedcar.module.auction.entity.AuctionVehicle;
...@@ -15,8 +19,10 @@ import com.sayalala.wework.wehook.config.MessagesenderProperties; ...@@ -15,8 +19,10 @@ import com.sayalala.wework.wehook.config.MessagesenderProperties;
import com.sayalala.wework.wehook.entity.WeWorkWebhookMessage; import com.sayalala.wework.wehook.entity.WeWorkWebhookMessage;
import com.sayalala.wework.wehook.service.MessageService; import com.sayalala.wework.wehook.service.MessageService;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.summerframework.core.util.DateTimeUtils; import org.summerframework.core.util.DateTimeUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -40,6 +46,12 @@ public abstract class AbstractAuctionService { ...@@ -40,6 +46,12 @@ public abstract class AbstractAuctionService {
@Resource @Resource
protected MessagesenderProperties messagesenderProperties; protected MessagesenderProperties messagesenderProperties;
@Resource
private WxPayService wxService;
@Value("${wx.pay.notifyUrl}")
private String notifyUrl;
/** /**
* 通过订单查询用户的保证金 * 通过订单查询用户的保证金
* *
...@@ -73,16 +85,35 @@ public abstract class AbstractAuctionService { ...@@ -73,16 +85,35 @@ public abstract class AbstractAuctionService {
if (Objects.nonNull(deposit)) { if (Objects.nonNull(deposit)) {
// 解冻保证金 // 解冻保证金
if (deposit.getDepositState() == Deposit.DepositState.FREEZE) { if (deposit.getDepositState() == Deposit.DepositState.FREEZE) {
deposit.setDepositState(Deposit.DepositState.UNFREEZE); try {
// 计算应该从保证金中扣除多少金额,扣除来源于违约金 refund(deposit);
double depositDeduct = deposit.getAmount() + deposit.getTransaction().getAmount(); } catch (WxPayException e) {
if (depositDeduct < 0) { e.printStackTrace();
account.setSurplus(account.getSurplus() + depositDeduct); }
// deposit.setDepositState(Deposit.DepositState.UNFREEZE);
// // 计算应该从保证金中扣除多少金额,扣除来源于违约金
// double depositDeduct = deposit.getAmount() + deposit.getTransaction().getAmount();
// if (depositDeduct < 0) {
// account.setSurplus(account.getSurplus() + depositDeduct);
// }
// Transaction transaction = new Transaction(account, transactionName, Transaction.TransactionType.UNFREEZE, deposit.getAmount(), account.getSurplus());
// transactionDao.save(transaction);
} }
Transaction transaction = new Transaction(account, transactionName, Transaction.TransactionType.UNFREEZE, deposit.getAmount(), account.getSurplus());
transactionDao.save(transaction);
} }
} }
public WxPayRefundV3Result refund(Deposit deposit ) throws WxPayException {
WxPayRefundV3Request request=new WxPayRefundV3Request();
WxPayRefundV3Request.Amount amount = new WxPayRefundV3Request.Amount();
amount.setCurrency("CNY");
amount.setTotal((int) (deposit.getTransaction().getAmount() * 100));
amount.setRefund((int) (deposit.getAmount() * 100));
request.setAmount(amount);
request.setOutTradeNo(deposit.getOutTradeNo());
request.setTransactionId(deposit.getTransactionId());
request.setNotifyUrl(notifyUrl+"/refund");
return this.wxService.refundV3(request);
} }
/** /**
......
...@@ -20,6 +20,8 @@ public interface DepositDao extends BaseRepository<Deposit, Integer>, JpaSpecifi ...@@ -20,6 +20,8 @@ public interface DepositDao extends BaseRepository<Deposit, Integer>, JpaSpecifi
Optional<Deposit> findTopByOutTradeNoAndAccount_OpenId(String outTradeNo, String openId); Optional<Deposit> findTopByOutTradeNoAndAccount_OpenId(String outTradeNo, String openId);
Optional<Deposit> findTopByOutTradeNoAndTransactionId(String outTradeNo, String transactionId);
Deposit findByAccountAndAuctionVehicle(Account account, AuctionVehicle auctionVehicle); Deposit findByAccountAndAuctionVehicle(Account account, AuctionVehicle auctionVehicle);
Deposit findByAuctionVehicle_AuctionAndAuctionVehicle_VehicleAndDepositStateAndAccount(Auction auction, Vehicle vehicle, Deposit.DepositState depositState, Account account); Deposit findByAuctionVehicle_AuctionAndAuctionVehicle_VehicleAndDepositStateAndAccount(Auction auction, Vehicle vehicle, Deposit.DepositState depositState, Account account);
......
...@@ -75,6 +75,18 @@ public class Deposit extends AuditingTimeEntity { ...@@ -75,6 +75,18 @@ public class Deposit extends AuditingTimeEntity {
private LocalDateTime paymentTime; private LocalDateTime paymentTime;
/** /**
* 退款时间
*/
@Column
private LocalDateTime refundTime;
// /**
// * 退款渠道
// */
// @Column
// private String refundChannel;
/**
* 微信支付订单号 * 微信支付订单号
*/ */
@Column(name = "WXTRANSACTION_ID") @Column(name = "WXTRANSACTION_ID")
......
package com.glsx.usedcar.module.finance.service; package com.glsx.usedcar.module.finance.service;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result;
import com.glsx.usedcar.gsc.GscApiInvoker; import com.glsx.usedcar.gsc.GscApiInvoker;
import com.glsx.usedcar.gsc.GscInvoker; import com.glsx.usedcar.gsc.GscInvoker;
import com.glsx.usedcar.module.account.dao.AccountDao; import com.glsx.usedcar.module.account.dao.AccountDao;
...@@ -294,6 +295,21 @@ public class TransactionService extends AbstractAuctionService { ...@@ -294,6 +295,21 @@ public class TransactionService extends AbstractAuctionService {
} }
} }
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void notifyDepositRefund(WxPayRefundNotifyV3Result.DecryptNotifyResult decryptRes) {
Optional<Deposit> depositOptional = depositDao.findTopByOutTradeNoAndTransactionId(decryptRes.getOutTradeNo(), decryptRes.getTransactionId());
if (depositOptional.isPresent()) {
Deposit deposit = depositOptional.get();
if (deposit.getDepositState() == Deposit.DepositState.FREEZE) {
deposit.setDepositState(Deposit.DepositState.UNFREEZE);
deposit.setRefundTime(DateTimeUtils.attemptParseLocalDateTime(decryptRes.getSuccessTime()));
Account account = deposit.getAccount();
Transaction transaction = new Transaction(account, "保证金退款", Transaction.TransactionType.UNFREEZE, deposit.getAmount(), account.getSurplus());
transactionDao.save(transaction);
}
}
}
public OrderTransaction getOrderTransactionByOrderId(int orderId) { public OrderTransaction getOrderTransactionByOrderId(int orderId) {
return orderTransactionDao.findTopByAuctionOrder_OrderIdOrderByCreateTimeDesc(orderId); return orderTransactionDao.findTopByAuctionOrder_OrderIdOrderByCreateTimeDesc(orderId);
} }
......
...@@ -15,7 +15,6 @@ import {AccountDateStat} from "lib/src/entity/account/domain/AccountDateStat"; ...@@ -15,7 +15,6 @@ import {AccountDateStat} from "lib/src/entity/account/domain/AccountDateStat";
/** /**
* 个人账户(Account) PI接口 * 个人账户(Account) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class AccountController{ export class AccountController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 协议管理(Agreement) PI接口 * 协议管理(Agreement) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class AgreementController{ export class AgreementController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 申诉(Appeal) PI接口 * 申诉(Appeal) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class AppealController{ export class AppealController{
......
...@@ -12,7 +12,6 @@ import {AuctionVehicleRate} from "lib/src/entity/analysis/domain/AuctionVehicleR ...@@ -12,7 +12,6 @@ import {AuctionVehicleRate} from "lib/src/entity/analysis/domain/AuctionVehicleR
/** /**
* 拍卖场次(Auction) PI接口 * 拍卖场次(Auction) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class AuctionController{ export class AuctionController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 拍卖订单(AuctionOrder) PI接口 * 拍卖订单(AuctionOrder) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class AuctionOrderController{ export class AuctionOrderController{
......
...@@ -6,7 +6,6 @@ import dayjs,{Dayjs} from 'dayjs'; ...@@ -6,7 +6,6 @@ import dayjs,{Dayjs} from 'dayjs';
/** /**
* 银行账户(BankAccount) PI接口 * 银行账户(BankAccount) PI接口
* @author gonglei
* @since 2025-10-19 11:05:09 * @since 2025-10-19 11:05:09
*/ */
export class BankAccountController{ export class BankAccountController{
......
...@@ -10,7 +10,6 @@ import {ProvinceRate} from "lib/src/entity/analysis/domain/ProvinceRate"; ...@@ -10,7 +10,6 @@ import {ProvinceRate} from "lib/src/entity/analysis/domain/ProvinceRate";
/** /**
* 投标竞价(Bid) PI接口 * 投标竞价(Bid) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class BidController{ export class BidController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 轮播图(Carousel) PI接口 * 轮播图(Carousel) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class CarouselController{ export class CarouselController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 佣金规则(CommissionRule) PI接口 * 佣金规则(CommissionRule) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class CommissionRuleController{ export class CommissionRuleController{
......
import {AxiosResponse, AxiosStatic} from 'axios'; import {AxiosResponse, AxiosStatic} from 'axios';
import dayjs, {Dayjs} from 'dayjs'; import dayjs,{Dayjs} from 'dayjs';
// region 前端扩展导入包 // region 前端扩展导入包
import {BusinessConfig} from "lib/src/entity/business/domain/BusinessConfig"; import {BusinessConfig} from "lib/src/entity/business/domain/BusinessConfig";
import {ESignPartAConfig} from "lib/src/domain/ESignPartAConfig"; import {ESignPartAConfig} from "lib/src/domain/ESignPartAConfig";
import {DarkBidPriceRange} from "lib/src/entity/business/domain/DarkBidPriceRange"; import {DarkBidPriceRange} from "lib/src/entity/business/domain/DarkBidPriceRange";
import {LightBidPriceRange} from "lib/src/entity/business/domain/LightBidPriceRange"; import {LightBidPriceRange} from "lib/src/entity/business/domain/LightBidPriceRange";
// endregion // endregion
/** /**
*/ */
export class ConfigController { export class ConfigController{
/** /**
* 查询SystemConfig * 查询SystemConfig
* @return BusinessConfig * @return BusinessConfig
*/ */
static getBusinessConfig(axios: AxiosStatic): Promise<AxiosResponse<BusinessConfig>> { static getBusinessConfig(axios:AxiosStatic): Promise<AxiosResponse<BusinessConfig>> {
return axios.get('config/getBusinessConfig'); return axios.get('config/getBusinessConfig');
} }
/** /**
*/ */
static getDarkBidPriceRange(axios: AxiosStatic): Promise<AxiosResponse<DarkBidPriceRange>> { static getDarkBidPriceRange(axios:AxiosStatic): Promise<AxiosResponse<DarkBidPriceRange>> {
return axios.get('config/getDarkBidPriceRange'); return axios.get('config/getDarkBidPriceRange');
} }
/** /**
*/ */
static getESignPartAConfig(axios: AxiosStatic): Promise<AxiosResponse<ESignPartAConfig>> { static getESignPartAConfig(axios:AxiosStatic): Promise<AxiosResponse<ESignPartAConfig>> {
return axios.get('config/getESignPartAConfig'); return axios.get('config/getESignPartAConfig');
} }
/** /**
*/ */
static getLightBidPriceRange(axios: AxiosStatic): Promise<AxiosResponse<LightBidPriceRange>> { static getLightBidPriceRange(axios:AxiosStatic): Promise<AxiosResponse<LightBidPriceRange>> {
return axios.get('config/getLightBidPriceRange'); return axios.get('config/getLightBidPriceRange');
} }
...@@ -43,25 +43,25 @@ export class ConfigController { ...@@ -43,25 +43,25 @@ export class ConfigController {
* @param businessConfig * @param businessConfig
* @return boolean * @return boolean
*/ */
static updateBusinessConfig(axios: AxiosStatic, businessConfig: any): Promise<AxiosResponse<boolean>> { static updateBusinessConfig(axios:AxiosStatic, businessConfig: any): Promise<AxiosResponse<boolean>> {
return axios.post('config/updateBusinessConfig', businessConfig); return axios.post('config/updateBusinessConfig', businessConfig);
} }
/** /**
*/ */
static updateDarkBidPriceRange(axios: AxiosStatic, darkBidPriceRange: any): Promise<AxiosResponse<boolean>> { static updateDarkBidPriceRange(axios:AxiosStatic, darkBidPriceRange: any): Promise<AxiosResponse<boolean>> {
return axios.post('config/updateDarkBidPriceRange', darkBidPriceRange); return axios.post('config/updateDarkBidPriceRange', darkBidPriceRange);
} }
/** /**
*/ */
static updateESignPartAConfig(axios: AxiosStatic, businessConfig: any): Promise<AxiosResponse<boolean>> { static updateESignPartAConfig(axios:AxiosStatic, businessConfig: any): Promise<AxiosResponse<boolean>> {
return axios.post('config/updateESignPartAConfig', businessConfig); return axios.post('config/updateESignPartAConfig', businessConfig);
} }
/** /**
*/ */
static updateLightBidPriceRange(axios: AxiosStatic, lightBidPriceRange: any): Promise<AxiosResponse<boolean>> { static updateLightBidPriceRange(axios:AxiosStatic, lightBidPriceRange: any): Promise<AxiosResponse<boolean>> {
return axios.post('config/updateLightBidPriceRange', lightBidPriceRange); return axios.post('config/updateLightBidPriceRange', lightBidPriceRange);
} }
......
...@@ -9,7 +9,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -9,7 +9,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 合同(Contract) PI接口 * 合同(Contract) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class ContractController{ export class ContractController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 交付订单(DeliveryOrder) PI接口 * 交付订单(DeliveryOrder) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class DeliveryOrderController{ export class DeliveryOrderController{
......
...@@ -10,7 +10,6 @@ import {DepositStat} from "lib/src/entity/finance/domain/DepositStat"; ...@@ -10,7 +10,6 @@ import {DepositStat} from "lib/src/entity/finance/domain/DepositStat";
/** /**
* 保证金规则(DepositRule) PI接口 * 保证金规则(DepositRule) PI接口
* @author gonglei
* @since 2025-10-13 12:18:10 * @since 2025-10-13 12:18:10
*/ */
export class DepositController{ export class DepositController{
...@@ -108,6 +107,18 @@ export class DepositController{ ...@@ -108,6 +107,18 @@ export class DepositController{
static PAGE_DEPOSIT_RULE = 'depositRule/pageDepositRule'; static PAGE_DEPOSIT_RULE = 'depositRule/pageDepositRule';
/** /**
* <pre>
微信支付-申请退款
详见 https://pay.weixin.qq.com/doc/v3/merchant/4012791862
</pre>
* @param depositId 请求对象
* @return 退款操作结果
*/
static refund(axios:AxiosStatic, depositId: number): Promise<AxiosResponse<WxPayRefundV3Result>> {
return axios.post('depositRule/refund', null, {params: {depositId: depositId}});
}
/**
* 删除保证金规则 * 删除保证金规则
* @param ruleId * @param ruleId
* @return int * @return int
......
...@@ -6,7 +6,6 @@ import dayjs,{Dayjs} from 'dayjs'; ...@@ -6,7 +6,6 @@ import dayjs,{Dayjs} from 'dayjs';
/** /**
* 字典表(Dictionary) 控制层 * 字典表(Dictionary) 控制层
* @author gonglei
* @since 2022-04-18 16:06:57 * @since 2022-04-18 16:06:57
*/ */
export class DictionaryController{ export class DictionaryController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 收藏(Favorite) PI接口 * 收藏(Favorite) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class FavoriteController{ export class FavoriteController{
......
...@@ -9,7 +9,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -9,7 +9,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 通知模板(NoticeTemplate) PI接口 * 通知模板(NoticeTemplate) PI接口
* @author gonglei
* @since 2025-10-13 12:18:10 * @since 2025-10-13 12:18:10
*/ */
export class NoticeController{ export class NoticeController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 价格规则(PriceRule) PI接口 * 价格规则(PriceRule) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class PriceRuleController{ export class PriceRuleController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 解押订单(ReleaseOrder) PI接口 * 解押订单(ReleaseOrder) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class ReleaseOrderController{ export class ReleaseOrderController{
......
...@@ -9,7 +9,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -9,7 +9,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 出库(Outbound) PI接口 * 出库(Outbound) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class RelocationController{ export class RelocationController{
......
...@@ -11,7 +11,6 @@ import {OrderTransactionAmountStat} from "lib/src/entity/finance/domain/OrderTra ...@@ -11,7 +11,6 @@ import {OrderTransactionAmountStat} from "lib/src/entity/finance/domain/OrderTra
/** /**
* 交易明细(Transaction) PI接口 * 交易明细(Transaction) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class TransactionController{ export class TransactionController{
......
...@@ -11,7 +11,6 @@ import {FileInfo} from "autumn-vue/lib/core/bean/FileInfo"; ...@@ -11,7 +11,6 @@ import {FileInfo} from "autumn-vue/lib/core/bean/FileInfo";
/** /**
* 库存车辆(Vehicle) PI接口 * 库存车辆(Vehicle) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class VehicleController{ export class VehicleController{
......
...@@ -13,7 +13,6 @@ import {VenueOption} from "lib/src/entity/venue/domain/VenueOption"; ...@@ -13,7 +13,6 @@ import {VenueOption} from "lib/src/entity/venue/domain/VenueOption";
/** /**
* 车辆场地(Venue) PI接口 * 车辆场地(Venue) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class VenueController{ export class VenueController{
......
...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -8,7 +8,6 @@ import {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 提现申请(Withdraw) PI接口 * 提现申请(Withdraw) PI接口
* @author gonglei
* @since 2025-10-13 12:18:11 * @since 2025-10-13 12:18:11
*/ */
export class WithdrawController{ export class WithdrawController{
......
...@@ -46,6 +46,13 @@ export const financeRouter: Array<RouteRecordRaw> = [ ...@@ -46,6 +46,13 @@ export const financeRouter: Array<RouteRecordRaw> = [
} }
}, },
{ {
path: '/finance/deposit/refund',
component: () => import( '@/views/finance/deposit/DepositRefundPage.vue'),
meta: {
breadcrumbs: [{name: '车商管理'}, {name: '保证金退款审核'}]
}
},
{
path: '/finance/withdraw', path: '/finance/withdraw',
component: () => import( '@/views/finance/withdraw/WithdrawPage.vue'), component: () => import( '@/views/finance/withdraw/WithdrawPage.vue'),
meta: { meta: {
......
<template>
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm" @onSearch="pageReload" @onReset="pageReset" :simpleFieldNum="4"/>
<div class="table-operations">
<a-button v-sec="'deposit_3'" type="primary" @click="downloadExcel" :disabled="exporting">
导出流水记录
</a-button>
</div>
<a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false" @change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn"
size="small" :pagination="pageState" :row-key="record => record.transactionId" :scroll="{y: 'calc(100vh - 400px)'}">
<template #customFilterDropdown="{setSelectedKeys, selectedKeys, confirm, clearFilters, column}">
<m-filter-text-render :pagination="pagination" :column="column" :confirm="confirm"></m-filter-text-render>
<m-filter-checkbox-group-render :pagination="pagination" :column="column" :confirm="confirm"></m-filter-checkbox-group-render>
</template>
<template #bodyCell="{column,record}">
<template v-if="column.key === 'action'">
<router-link v-sec="'deposit_7'" :to="{path: '/finance/deposit/view', query: {depositId: record.depositId}}">
<a-button type="link" size="small">查看</a-button>
</router-link>
<router-link v-sec="'deposit_5'" :to="{ path:'/account/view',query:{accountId: record.account.accountId}}">
<a-button type="link" size="small">账户详情</a-button>
</router-link>
<router-link v-sec="'deposit_6'" :to="{ path:'/vehicle/view',query:{vehicleId: record.auctionVehicle.vehicle.vehicleId}}">
<a-button type="link" size="small">车辆档案</a-button>
</router-link>
<!-- <router-link v-sec="'deposit_12'" :to="{ path:'/auction/order/view',query:{orderId: record.auctionOrder.orderId}}">-->
<!-- <a-button type="link" size="small">订单详情</a-button>-->
<!-- </router-link>-->
<router-link v-sec="'deposit_11'" :to="{ path:'/auction/view',query:{auctionId: record.auctionVehicle.auction.auctionId}}">
<a-button type="link" size="small">场次详情</a-button>
</router-link>
<a-button type="link" size="small">退款</a-button>
</template>
<template v-if="column.key === 'transactionType'">
{{ $t('enum.transaction.transactionType.' + record.transaction.transactionType) }}
</template>
<template v-if="column.key === 'depositState'">
<deposit-state-tag :deposit-state="record.depositState"></deposit-state-tag>
</template>
</template>
<!--交易明细列表end-->
</a-table>
</template>
<script lang="ts">
import {Vue, Component} from 'vue-facing-decorator';
import DepositStateTag from "@/views/finance/deposit/DepositStateTag.vue";
import {PaginationComponent} from "autumn-vue/lib/core/page/PaginationComponent";
import {Deposit} from "lib/src/entity/finance/entity/Deposit";
import {Security} from "@/store";
import {message, Modal, TableColumnsType} from "ant-design-vue";
import {DepositStat} from "lib/src/entity/finance/domain/DepositStat";
import {DepositController} from "@/api/DepositController";
import {Operator, Order} from "autumn-vue/lib/core/page/Pagination";
import {ExportUtil} from "@/common/ExportUtil";
import {createVNode} from "vue";
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
import {AuctionOrderController} from "@/api/AuctionOrderController";
@Component({
components: {DepositStateTag}
})
export default class DepositRefundPage extends PaginationComponent<Deposit> {
exporting = false;
@Security.Getter hasPrivilege;
/**
* 表格列配置
*/
columns: TableColumnsType = [
{title: '流水号', dataIndex: ['transaction', 'transactionId'], key: 'transactionId', width: 100, resizable: true, ellipsis: true, sorter: true},
{
title: '姓名', dataIndex: ['account', 'accountName'], key: 'accountName', width: 150, resizable: true, ellipsis: true, sorter: true,
customRender: ({text, record, index, column}) => {
if (this.isPrivilege('deposit_4')) {
return text;
} else {
return text?.substring(0, 1) + '**';
}
}
},
{
title: '手机号', dataIndex: ['account', 'mobile'], key: 'mobile', width: 150, resizable: true, ellipsis: true, sorter: true,
customRender: ({text, record, index, column}) => {
if (this.isPrivilege('deposit_8')) {
return text;
} else {
return text?.substring(0, 3) + '********';
}
}
},
// {title: '交易类型', dataIndex: ['transaction', 'transactionType'], key: 'transactionType', align: 'center', width: 120, resizable: true, ellipsis: true, sorter: true},
{title: '车源号', dataIndex: ['auctionVehicle', 'vehicle', 'baseInfo', 'sourceNo'], key: 'sourceNo', resizable: true, ellipsis: true, sorter: true},
{title: '关联信息', dataIndex: ['auctionVehicle', 'vehicle', 'baseInfo', 'carTypeName'], key: 'carTypeName', resizable: true, ellipsis: true, sorter: true},
{
title: '冻结金额', dataIndex: ['transaction', 'amount'], key: 'amount', align: 'right', width: 140, resizable: true, ellipsis: true, sorter: true,
customRender: ({text, record, index, column}) => {
return '¥' + text;
}
},
{
title: '剩余金额', dataIndex:'amount', key: 'amount', align: 'right', width: 140, resizable: true, ellipsis: true, sorter: true,
customRender: ({text, record, index, column}) => {
return '¥' + text;
}
},
{title: '冻结时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
{
title: '冻结状态', dataIndex: 'depositState', key: 'depositState', align: 'center', fixed: 'right', width: 110, resizable: true, ellipsis: true, sorter: true,
},
{title: '操作', key: 'action', width: 210, align: 'center', fixed: 'right'},
];
depositStat: DepositStat = null;
/**
* 初始化配置
*/
created(): void {
this.init(this.axios, DepositController.PAGE_DEPOSIT);
this.buildQueryForm({
account: [null, {label: '用户姓名', field: 'account.accountName', operator: Operator.like}],
mobile: [null, {label: '手机号', field: 'account.mobile', operator: Operator.like}],
createTime: [null, {label: '冻结时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range'}],
sourceNo: [null, {label: '车源号', field: 'auctionVehicle.vehicle.baseInfo.sourceNo', operator: Operator.like}],
carSeriesName: [null, {label: '车系名称', field: 'auctionVehicle.vehicle.baseInfo.carSeriesName', operator: Operator.like}],
carTypeName: [null, {label: '车型名称', field: 'auctionVehicle.vehicle.baseInfo.carTypeName', operator: Operator.like}],
transactionType: [null, {
label: '交易类型', field: 'transaction.transactionType', type: 'select', allowClear: true, optionItems: [
{label: this.$t('enum.transaction.transactionType.FREEZE'), value: 'FREEZE'},
{label: this.$t('enum.transaction.transactionType.UNFREEZE'), value: 'UNFREEZE'}
], operator: Operator.eq
}],
depositState: [null, {
label: '交易状态', field: 'depositState', type: 'select', allowClear: true, optionItems: [
{label: this.$t('enum.deposit.depositState.FREEZE'), value: 'FREEZE'},
{label: this.$t('enum.deposit.depositState.UNFREEZE'), value: 'UNFREEZE'}
], operator: Operator.eq
}],
amount: [null, {label: '冻结金额', field: 'transaction.amount', fieldName2: 'amount2', operator: Operator.numberBetween, type: 'number-range'}],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pageLoad();
DepositController.getDepositStat(this.axios).then(response => {
this.depositStat = response.data;
});
}
isPrivilege(code): boolean {
return this.hasPrivilege(code);
}
i18n(text: string): string {
return this.$t(text);
}
downloadExcel(): void {
this.exporting = true;
DepositController.exportDeposit(this.axios, this.pagination.requestParams, {responseType: 'blob'}).then(response => {
message.success('导出任务已创建,请稍后在浏览器下载列表中查看');
ExportUtil.downloadExcelFile(response.data, '保证金列表');
}).catch(error => {
console.error('Error downloading Word file:', error);
}).finally(() => {
this.exporting = false;
});
}
confirmRefund(deposit:Deposit):void{
const that=this;
Modal.confirm({
title: '提示',
icon: createVNode(ExclamationCircleOutlined),
content: `保证金冻结金额为 ¥${deposit.transaction.amount},退款金额为 ¥${deposit.amount},您确定将此保证金退款吗?`,
onOk() {
DepositController.refund(that.axios, deposit.depositId).then(response => {
message.success('退款操作成功,请等待支付平台回调');
});
},
onCancel() {
console.log('Cancel');
},
});
}
}
</script>
<style scoped lang="less">
</style>
...@@ -1687,6 +1687,10 @@ ...@@ -1687,6 +1687,10 @@
<DT arr="0" ds="VarChar" en="" id="12" ln="64" sc="null" sg="1" un="0"/> <DT arr="0" ds="VarChar" en="" id="12" ln="64" sc="null" sg="1" un="0"/>
<Cm>微信支付TRANSACTION_ID</Cm> <Cm>微信支付TRANSACTION_ID</Cm>
</Cl> </Cl>
<Cl au="0" df="" nm="REFUND_TIME" nu="1">
<DT arr="0" ds="DateTime" en="" id="700" ln="null" sc="null" sg="1" un="0"/>
<Cm>退款时间</Cm>
</Cl>
<Fk deAc="1" nm="fk_deposit_account" prLkCl="ACCOUNT_ID" upAc="1"> <Fk deAc="1" nm="fk_deposit_account" prLkCl="ACCOUNT_ID" upAc="1">
<PrTb mn="0" nm="account" oe="1" sch="schemaA" zr="0"/> <PrTb mn="0" nm="account" oe="1" sch="schemaA" zr="0"/>
<CdTb mn="1" nm="deposit" oe="1" sch="schemaA" zr="1"/> <CdTb mn="1" nm="deposit" oe="1" sch="schemaA" zr="1"/>
...@@ -3505,7 +3509,7 @@ ...@@ -3505,7 +3509,7 @@
<TbGl bkCl="#6699ff64" h="418" sch="schemaA" tbl="withdraw" w="526" x="1136" y="787"/> <TbGl bkCl="#6699ff64" h="418" sch="schemaA" tbl="withdraw" w="526" x="1136" y="787"/>
<TbGl bkCl="#6699ff64" h="450" sch="schemaA" tbl="account" w="518" x="1131" y="181"/> <TbGl bkCl="#6699ff64" h="450" sch="schemaA" tbl="account" w="518" x="1131" y="181"/>
<TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="bank_account" w="436" x="657" y="866"/> <TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="bank_account" w="436" x="657" y="866"/>
<TbGl bkCl="#6699ff64" h="226" sch="schemaA" tbl="deposit" w="527" x="169" y="116"/> <TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="deposit" w="527" x="169" y="116"/>
<TbGl bkCl="#6699ff64" h="178" sch="schemaA" tbl="recharge" w="453" x="69" y="840"/> <TbGl bkCl="#6699ff64" h="178" sch="schemaA" tbl="recharge" w="453" x="69" y="840"/>
<TbGl bkCl="#6699ff64" h="274" sch="schemaA" tbl="user_info" w="393" x="858" y="1274"/> <TbGl bkCl="#6699ff64" h="274" sch="schemaA" tbl="user_info" w="393" x="858" y="1274"/>
<FkGl bearing="NORTH" bkCl="#00000064" childEdge="NORTH" childOffset="0" lineCount="1" midLineOffset="" nm="schemaA.withdraw.fk_withdraw_account" parentEdge="SOUTH" parentOffset="250"/> <FkGl bearing="NORTH" bkCl="#00000064" childEdge="NORTH" childOffset="0" lineCount="1" midLineOffset="" nm="schemaA.withdraw.fk_withdraw_account" parentEdge="SOUTH" parentOffset="250"/>
...@@ -3581,7 +3585,7 @@ ...@@ -3581,7 +3585,7 @@
<TbGl bkCl="#6699ff64" h="306" sch="schemaA" tbl="appeal" w="481" x="1431" y="2154"/> <TbGl bkCl="#6699ff64" h="306" sch="schemaA" tbl="appeal" w="481" x="1431" y="2154"/>
<TbGl bkCl="#6699ff64" h="162" sch="schemaA" tbl="bid" w="376" x="1754" y="1149"/> <TbGl bkCl="#6699ff64" h="162" sch="schemaA" tbl="bid" w="376" x="1754" y="1149"/>
<TbGl bkCl="#6699ff64" h="274" sch="schemaA" tbl="deposit_rule" w="516" x="0" y="201"/> <TbGl bkCl="#6699ff64" h="274" sch="schemaA" tbl="deposit_rule" w="516" x="0" y="201"/>
<TbGl bkCl="#6699ff64" h="226" sch="schemaA" tbl="deposit" w="527" x="990" y="1845"/> <TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="deposit" w="527" x="990" y="1845"/>
<TbGl bkCl="#6699ff64" h="98" sch="schemaA" tbl="vehicle_browser_history" w="362" x="799" y="2165"/> <TbGl bkCl="#6699ff64" h="98" sch="schemaA" tbl="vehicle_browser_history" w="362" x="799" y="2165"/>
<TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="auction_change" w="388" x="66" y="1292"/> <TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="auction_change" w="388" x="66" y="1292"/>
<TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="auction_vehicle_change" w="388" x="227" y="1883"/> <TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="auction_vehicle_change" w="388" x="227" y="1883"/>
...@@ -4709,6 +4713,7 @@ ...@@ -4709,6 +4713,7 @@
<TreePath>schemaA.venue</TreePath> <TreePath>schemaA.venue</TreePath>
<TreePath>aus.Diagrams</TreePath> <TreePath>aus.Diagrams</TreePath>
<TreePath>数据埋点</TreePath> <TreePath>数据埋点</TreePath>
<TreePath>保证金</TreePath>
<TreePath>合同管理</TreePath> <TreePath>合同管理</TreePath>
<TreePath>车辆场地管理</TreePath> <TreePath>车辆场地管理</TreePath>
<TreePath>schemaA.Tables</TreePath> <TreePath>schemaA.Tables</TreePath>
......
...@@ -117,3 +117,6 @@ ALTER TABLE deposit ADD PAYMENT_TIME DATETIME ...@@ -117,3 +117,6 @@ ALTER TABLE deposit ADD PAYMENT_TIME DATETIME
ALTER TABLE deposit ADD WXTRANSACTION_ID VARCHAR(64) ALTER TABLE deposit ADD WXTRANSACTION_ID VARCHAR(64)
COMMENT '微信支付TRANSACTION_ID' NULL after PAYMENT_TIME; COMMENT '微信支付TRANSACTION_ID' NULL after PAYMENT_TIME;
ALTER TABLE deposit ADD REFUND_TIME DATETIME
COMMENT '退款时间' NULL after WXTRANSACTION_ID;
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!