Commit 0b7a825e by gonglei

修改保证金支付流程

1 parent 6566ab25
Showing 28 changed files with 269 additions and 61 deletions
package com.glsx.usedcar.web.api.finance;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
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.finance.entity.Deposit;
import com.glsx.usedcar.module.finance.entity.Recharge;
import com.glsx.usedcar.module.finance.service.DepositService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.summerframework.core.exception.FieldException;
import static com.glsx.usedcar.web.WebConstants.LOGIN_ACCOUNT;
@Slf4j
@RestController
@RequestMapping("/api/deposit")
public class DepositController {
@Resource
private DepositService depositService;
@Resource
private WxPayService wxService;
@Value("${wx.pay.notifyUrl}")
private String notifyUrl;
/**
* 保证金支付接口
* @param aucvehId
* @param account
* @return
* @throws WxPayException
* @throws FieldException
*/
@PostMapping("addDeposit")
public WxPayUnifiedOrderV3Result.JsapiResult addDeposit(@RequestParam int aucvehId, @RequestAttribute(LOGIN_ACCOUNT) Account account) throws WxPayException, FieldException {
Deposit deposit = depositService.addDeposit(aucvehId,account.getAccountId() );
WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
request.setDescription("保证金");
request.setOutTradeNo(deposit.getOutTradeNo());
request.setNotifyUrl(notifyUrl);
request.setSupportFapiao(false);
WxPayUnifiedOrderV3Request.Amount amount = new WxPayUnifiedOrderV3Request.Amount();
amount.setCurrency("CNY");
amount.setTotal((int) (deposit.getAmount() * 100));
request.setAmount(amount);
WxPayUnifiedOrderV3Request.Payer payer = new WxPayUnifiedOrderV3Request.Payer();
payer.setOpenid(deposit.getAccount().getOpenId());
request.setPayer(payer);
request.setAttach("deposit");
WxPayUnifiedOrderV3Result.JsapiResult result = wxService.createOrderV3(TradeTypeEnum.JSAPI, request);
return result;
}
}
...@@ -31,13 +31,14 @@ public class RechargeController { ...@@ -31,13 +31,14 @@ public class RechargeController {
private String notifyUrl; private String notifyUrl;
/** /**
* 充值接口 * 充值接口 (过时接口,不再使用)
* 详见:https://pay.weixin.qq.com/doc/v3/merchant/4012791856 * 详见:https://pay.weixin.qq.com/doc/v3/merchant/4012791856
* *
* @param recharge * @param recharge
* @param account * @param account
* @return * @return
*/ */
@Deprecated
@PostMapping("addRecharge") @PostMapping("addRecharge")
public WxPayUnifiedOrderV3Result.JsapiResult addRecharge(@RequestBody Recharge recharge, @RequestAttribute(LOGIN_ACCOUNT) Account account) throws WxPayException, FieldException { public WxPayUnifiedOrderV3Result.JsapiResult addRecharge(@RequestBody Recharge recharge, @RequestAttribute(LOGIN_ACCOUNT) Account account) throws WxPayException, FieldException {
recharge = transactionService.addRecharge(account.getAccountId(), recharge); recharge = transactionService.addRecharge(account.getAccountId(), recharge);
...@@ -58,14 +59,16 @@ public class RechargeController { ...@@ -58,14 +59,16 @@ public class RechargeController {
return result; return result;
} }
/**
* 调用统一下单接口(JSAPI)
* 详见:https://pay.weixin.qq.com/doc/v3/merchant/4012791856 // /**
*/ // * 调用统一下单接口(JSAPI)
@PostMapping("createOrder") // * 详见:https://pay.weixin.qq.com/doc/v3/merchant/4012791856
public WxPayUnifiedOrderV3Result.JsapiResult createOrder(@RequestBody WxPayUnifiedOrderV3Request request) throws WxPayException { // */
return this.wxService.createOrderV3(TradeTypeEnum.JSAPI, request); // @PostMapping("createOrder")
} // public WxPayUnifiedOrderV3Result.JsapiResult createOrder(@RequestBody WxPayUnifiedOrderV3Request request) throws WxPayException {
// return this.wxService.createOrderV3(TradeTypeEnum.JSAPI, request);
// }
} }
...@@ -67,6 +67,9 @@ public class WxpayController { ...@@ -67,6 +67,9 @@ public class WxpayController {
if ("recharge".equals(attach)) { if ("recharge".equals(attach)) {
// 充值成功通知 // 充值成功通知
transactionService.notifyRecharge(outTradeNo, openid, transactionId); transactionService.notifyRecharge(outTradeNo, openid, transactionId);
} else if ("deposit".equals(attach)) {
// 保证金支付成功通知
transactionService.notifyDeposit(outTradeNo, openid, transactionId);
} else if ("order".equals(attach)) { } else if ("order".equals(attach)) {
// 车款支付成功通知 // 车款支付成功通知
transactionService.notifyAuctionOrder(outTradeNo, decryptRes.getAmount().getTotal() * 100, transactionId); transactionService.notifyAuctionOrder(outTradeNo, decryptRes.getAmount().getTotal() * 100, transactionId);
......
...@@ -124,23 +124,25 @@ public class BidService { ...@@ -124,23 +124,25 @@ public class BidService {
Deposit deposit = depositDao.findByAccountAndAuctionVehicle(account, auctionVehicle); Deposit deposit = depositDao.findByAccountAndAuctionVehicle(account, auctionVehicle);
// 用户没有交过保证金,需要先交保证金 // 用户没有交过保证金,需要先交保证金
if (Objects.isNull(deposit)) { if (Objects.isNull(deposit)||Objects.isNull(deposit.getPaymentTime())) {
//需要交的保证金 //需要交的保证金
int depositAmount = auctionVehicle.getAuction().getDeposit(); int depositAmount = auctionVehicle.getAuction().getDeposit();
// 查询已经交过的冻结的保证金
double freezeAmount = Math.abs(depositDao.sumFreezeByAccountId(accountId, Deposit.DepositState.FREEZE).orElse(0.0));
// 申请提现中的金额
double unauditWithdrawAmount = withdrawDao.sumWithdrawByAccountAuditState(account.getAccountId(), AuditState.UNAUDITED).orElse(0.0);
if ((account.getSurplus() - freezeAmount - unauditWithdrawAmount) < depositAmount) {
throw new FieldException("depositAmount", depositAmount, "参与本车竞拍需缴纳保证金¥" + depositAmount); throw new FieldException("depositAmount", depositAmount, "参与本车竞拍需缴纳保证金¥" + depositAmount);
}
//记录交易记录 // 查询已经交过的冻结的保证金
Transaction transaction = new Transaction(account, "参拍场次:" + auctionVehicle.getAuction().getAuctionName(), Transaction.TransactionType.FREEZE, -depositAmount, account.getSurplus()); // double freezeAmount = Math.abs(depositDao.sumFreezeByAccountId(accountId, Deposit.DepositState.FREEZE).orElse(0.0));
transaction = transactionDao.save(transaction); // // 申请提现中的金额
//创建保证金记录 // double unauditWithdrawAmount = withdrawDao.sumWithdrawByAccountAuditState(account.getAccountId(), AuditState.UNAUDITED).orElse(0.0);
deposit = new Deposit(account, auctionVehicle, transaction); // if ((account.getSurplus() - freezeAmount - unauditWithdrawAmount) < depositAmount) {
deposit.setAmount(depositAmount); // throw new FieldException("depositAmount", depositAmount, "参与本车竞拍需缴纳保证金¥" + depositAmount);
depositDao.save(deposit); // }
// //记录交易记录
// Transaction transaction = new Transaction(account, "参拍场次:" + auctionVehicle.getAuction().getAuctionName(), Transaction.TransactionType.FREEZE, -depositAmount, account.getSurplus());
// transaction = transactionDao.save(transaction);
// //创建保证金记录
// deposit = new Deposit(account, auctionVehicle, transaction);
// deposit.setAmount(depositAmount);
// depositDao.save(deposit);
} }
// 最低出价 // 最低出价
......
...@@ -18,6 +18,8 @@ public interface DepositDao extends BaseRepository<Deposit, Integer>, JpaSpecifi ...@@ -18,6 +18,8 @@ public interface DepositDao extends BaseRepository<Deposit, Integer>, JpaSpecifi
@EntityGraph(attributePaths = {"account", "auctionVehicle", "auctionVehicle.auction", "auctionVehicle.vehicle", "transaction"}) @EntityGraph(attributePaths = {"account", "auctionVehicle", "auctionVehicle.auction", "auctionVehicle.vehicle", "transaction"})
Deposit findByDepositId(int depositId); Deposit findByDepositId(int depositId);
Optional<Deposit> findTopByOutTradeNoAndAccount_OpenId(String outTradeNo, String openId);
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);
......
...@@ -12,6 +12,8 @@ import org.hibernate.annotations.DynamicUpdate; ...@@ -12,6 +12,8 @@ import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.summerframework.orm.entity.AuditingTimeEntity; import org.summerframework.orm.entity.AuditingTimeEntity;
import java.time.LocalDateTime;
import static jakarta.persistence.GenerationType.IDENTITY; import static jakarta.persistence.GenerationType.IDENTITY;
@Entity @Entity
...@@ -66,6 +68,18 @@ public class Deposit extends AuditingTimeEntity { ...@@ -66,6 +68,18 @@ public class Deposit extends AuditingTimeEntity {
@Column(nullable = false) @Column(nullable = false)
private double amount; private double amount;
@Column(unique = true, nullable = false)
private String outTradeNo;
@Column
private LocalDateTime paymentTime;
/**
* 微信支付订单号
*/
@Column(name = "WXTRANSACTION_ID")
private String transactionId;
/** /**
* 保证金状态 * 保证金状态
*/ */
......
package com.glsx.usedcar.module.finance.service; package com.glsx.usedcar.module.finance.service;
import com.glsx.usedcar.module.account.dao.AccountDao; import com.glsx.usedcar.module.account.dao.AccountDao;
import com.glsx.usedcar.module.account.entity.Account;
import com.glsx.usedcar.module.auction.dao.AuctionVehicleDao;
import com.glsx.usedcar.module.auction.entity.AuctionVehicle;
import com.glsx.usedcar.module.finance.dao.DepositDao; import com.glsx.usedcar.module.finance.dao.DepositDao;
import com.glsx.usedcar.module.finance.dao.DepositRuleDao; import com.glsx.usedcar.module.finance.dao.DepositRuleDao;
import com.glsx.usedcar.module.finance.dao.TransactionDao;
import com.glsx.usedcar.module.finance.domain.DepositStat; import com.glsx.usedcar.module.finance.domain.DepositStat;
import com.glsx.usedcar.module.finance.entity.Deposit; import com.glsx.usedcar.module.finance.entity.Deposit;
import com.glsx.usedcar.module.finance.entity.DepositRule; import com.glsx.usedcar.module.finance.entity.DepositRule;
import com.glsx.usedcar.module.finance.entity.DepositRule_; import com.glsx.usedcar.module.finance.entity.DepositRule_;
import com.glsx.usedcar.module.finance.entity.Transaction;
import com.glsx.usedcar.module.meta.AuditState;
import com.glsx.usedcar.util.CoderGenerator;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.hibernate.ObjectNotFoundException; import org.hibernate.ObjectNotFoundException;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.summerframework.core.exception.FieldException;
import org.summerframework.orm.UpdateField; import org.summerframework.orm.UpdateField;
import org.summerframework.orm.paging.Pagination; import org.summerframework.orm.paging.Pagination;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
/** /**
...@@ -36,6 +46,12 @@ public class DepositService { ...@@ -36,6 +46,12 @@ public class DepositService {
@Resource @Resource
private AccountDao accountDao; private AccountDao accountDao;
@Resource
private AuctionVehicleDao auctionVehicleDao;
@Resource
private TransactionDao transactionDao;
/** /**
* 通过ID查询一个保证金规则 * 通过ID查询一个保证金规则
* *
...@@ -78,6 +94,39 @@ public class DepositService { ...@@ -78,6 +94,39 @@ public class DepositService {
return depositDao.sumFreezeByAccountId(accountId, Deposit.DepositState.FREEZE).orElse(0.0); return depositDao.sumFreezeByAccountId(accountId, Deposit.DepositState.FREEZE).orElse(0.0);
} }
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public Deposit addDeposit(int aucvehId, int accountId) throws FieldException {
AuctionVehicle auctionVehicle = auctionVehicleDao.findTopByAucvehId(aucvehId);
if (auctionVehicle.getAuctionState() != AuctionVehicle.AuctionState.AUCTIONING) {
throw new FieldException("aucvehId", aucvehId, "该车辆已结束竞标");
}
Account account = accountDao.findById(accountId).orElseThrow(() -> new ObjectNotFoundException(accountId, Account.class.getSimpleName()));
if (!account.isEnabled()) {
throw new FieldException("accountId", accountId, "你已被禁止竞价");
}
Deposit deposit = depositDao.findByAccountAndAuctionVehicle(account, auctionVehicle);
if (Objects.nonNull(deposit)) {
if(!StringUtils.hasText(deposit.getOutTradeNo())){
// 修补历史数据
deposit.setOutTradeNo(CoderGenerator.generateCode(8));
}
return deposit;
}
// double freezeAmount = Math.abs(depositDao.sumFreezeByAccountId(accountId, Deposit.DepositState.FREEZE).orElse(0.0));
// 申请提现中的金额
int depositAmount = auctionVehicle.getAuction().getDeposit();
//记录交易记录
Transaction transaction = new Transaction(account, "参拍场次:" + auctionVehicle.getAuction().getAuctionName(), Transaction.TransactionType.FREEZE, -depositAmount, account.getSurplus());
transaction = transactionDao.save(transaction);
//创建保证金记录
deposit = new Deposit(account, auctionVehicle, transaction);
deposit.setOutTradeNo(CoderGenerator.generateCode(8));
deposit.setAmount(depositAmount);
return depositDao.save(deposit);
}
/** /**
* 修改保证金规则 * 修改保证金规则
* *
......
...@@ -9,15 +9,13 @@ import com.glsx.usedcar.module.auction.entity.AuctionOrder; ...@@ -9,15 +9,13 @@ import com.glsx.usedcar.module.auction.entity.AuctionOrder;
import com.glsx.usedcar.module.auction.service.AbstractAuctionService; import com.glsx.usedcar.module.auction.service.AbstractAuctionService;
import com.glsx.usedcar.module.business.entity.NoticeTemplate; import com.glsx.usedcar.module.business.entity.NoticeTemplate;
import com.glsx.usedcar.module.business.service.NoticeField; import com.glsx.usedcar.module.business.service.NoticeField;
import com.glsx.usedcar.module.finance.dao.DepositDao;
import com.glsx.usedcar.module.finance.dao.OrderTransactionDao; import com.glsx.usedcar.module.finance.dao.OrderTransactionDao;
import com.glsx.usedcar.module.finance.dao.RechargeDao; import com.glsx.usedcar.module.finance.dao.RechargeDao;
import com.glsx.usedcar.module.finance.dao.TransactionDao; import com.glsx.usedcar.module.finance.dao.TransactionDao;
import com.glsx.usedcar.module.finance.domain.OrderTransactionAmountStat; import com.glsx.usedcar.module.finance.domain.OrderTransactionAmountStat;
import com.glsx.usedcar.module.finance.domain.OrderTransactionStat; import com.glsx.usedcar.module.finance.domain.OrderTransactionStat;
import com.glsx.usedcar.module.finance.entity.OrderTransaction; import com.glsx.usedcar.module.finance.entity.*;
import com.glsx.usedcar.module.finance.entity.OrderTransaction_;
import com.glsx.usedcar.module.finance.entity.Recharge;
import com.glsx.usedcar.module.finance.entity.Transaction;
import com.glsx.usedcar.module.meta.AuditState; import com.glsx.usedcar.module.meta.AuditState;
import com.glsx.usedcar.module.track.dao.ApproveHistoryDao; import com.glsx.usedcar.module.track.dao.ApproveHistoryDao;
import com.glsx.usedcar.module.track.entity.ApproveHistory; import com.glsx.usedcar.module.track.entity.ApproveHistory;
...@@ -76,6 +74,8 @@ public class TransactionService extends AbstractAuctionService { ...@@ -76,6 +74,8 @@ public class TransactionService extends AbstractAuctionService {
private GscApiInvoker gscApiInvoker; private GscApiInvoker gscApiInvoker;
@Resource @Resource
private MessageSource messageSource; private MessageSource messageSource;
@Resource
private DepositDao depositDao;
/** /**
* 通过ID查询一个交易明细 * 通过ID查询一个交易明细
...@@ -253,6 +253,17 @@ public class TransactionService extends AbstractAuctionService { ...@@ -253,6 +253,17 @@ public class TransactionService extends AbstractAuctionService {
} }
} }
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void notifyDeposit(String outTradeNo, String openId, String transactionId) {
Optional<Deposit> depositOptional = depositDao.findTopByOutTradeNoAndAccount_OpenId(outTradeNo, openId);
if (depositOptional.isPresent()) {
Deposit deposit = depositOptional.get();
deposit.setPaymentTime(LocalDateTime.now());
deposit.setTransactionId(transactionId);
}
}
/** /**
* 订单支付结果通知 * 订单支付结果通知
* *
......
...@@ -21,3 +21,4 @@ dist ...@@ -21,3 +21,4 @@ dist
*.sw? *.sw?
/images/ /images/
/icons/ /icons/
/src/api/WechatBindController.ts
...@@ -11,7 +11,6 @@ import {AccountInfo} from "lib/src/entity/account/domain/AccountInfo"; ...@@ -11,7 +11,6 @@ import {AccountInfo} from "lib/src/entity/account/domain/AccountInfo";
/** /**
* 个人账户(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{
......
...@@ -7,7 +7,6 @@ import {Agreement} from "lib/src/entity/business/entity/Agreement"; ...@@ -7,7 +7,6 @@ import {Agreement} from "lib/src/entity/business/entity/Agreement";
/** /**
* 协议管理(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{
......
...@@ -7,7 +7,6 @@ import {Appeal} from "lib/src/entity/auction/entity/Appeal"; ...@@ -7,7 +7,6 @@ import {Appeal} from "lib/src/entity/auction/entity/Appeal";
/** /**
* 申诉(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{
......
...@@ -9,7 +9,6 @@ import type {Page} from "autumn-vue/lib/core/page/Page"; ...@@ -9,7 +9,6 @@ import type {Page} from "autumn-vue/lib/core/page/Page";
/** /**
* 拍卖场次(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{
......
...@@ -10,7 +10,6 @@ import {Contract} from "lib/src/entity/auction/entity/Contract"; ...@@ -10,7 +10,6 @@ import {Contract} from "lib/src/entity/auction/entity/Contract";
/** /**
* 拍卖订单(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{
......
...@@ -7,7 +7,6 @@ import {BankAccount} from "lib/src/entity/finance/entity/BankAccount"; ...@@ -7,7 +7,6 @@ import {BankAccount} from "lib/src/entity/finance/entity/BankAccount";
/** /**
* 银行账户(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{
......
...@@ -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";
/** /**
* 投标竞价(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{
......
...@@ -7,7 +7,6 @@ import {Carousel} from "lib/src/entity/business/entity/Carousel"; ...@@ -7,7 +7,6 @@ import {Carousel} from "lib/src/entity/business/entity/Carousel";
/** /**
* 轮播图(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{
......
import {AxiosResponse, AxiosStatic} from 'axios';
import dayjs, {Dayjs} from 'dayjs';
import {AxiosResponse, AxiosStatic} from 'axios';
import dayjs,{Dayjs} from 'dayjs';
// region 前端扩展导入包 // region 前端扩展导入包
import {LightBidPriceRange} from "lib/src/entity/business/domain/LightBidPriceRange"; import {LightBidPriceRange} from "lib/src/entity/business/domain/LightBidPriceRange";
import {BusinessConfig} from "lib/src/entity/business/domain/BusinessConfig"; import {BusinessConfig} from "lib/src/entity/business/domain/BusinessConfig";
import {DarkBidPriceRange} from "lib/src/entity/business/domain/DarkBidPriceRange"; import {DarkBidPriceRange} from "lib/src/entity/business/domain/DarkBidPriceRange";
// 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 getLightBidPriceRange(axios: AxiosStatic): Promise<AxiosResponse<LightBidPriceRange>> { static getLightBidPriceRange(axios:AxiosStatic): Promise<AxiosResponse<LightBidPriceRange>> {
return axios.get('config/getLightBidPriceRange'); return axios.get('config/getLightBidPriceRange');
} }
......
import {AxiosResponse, AxiosStatic} from 'axios';
import dayjs,{Dayjs} from 'dayjs';
// region 前端扩展导入包
import type {WxPayUnifiedOrderV3Result} from "lib/src/domain/WxPayUnifiedOrderV3Result";
// endregion
/**
*/
export class DepositController{
/**
* 保证金支付接口
* @param aucvehId
* @param account
* @return WxPayUnifiedOrderV3Result.JsapiResult
* @throws WxPayException
* @throws FieldException
*/
static addDeposit(axios:AxiosStatic, aucvehId: number): Promise<AxiosResponse<WxPayUnifiedOrderV3Result.JsapiResult>> {
return axios.post('deposit/addDeposit', null, {params: {aucvehId: aucvehId}});
}
// region 前端扩展代码区
// endregion
}
...@@ -8,7 +8,6 @@ import {Diction} from "autumn-vue/lib/core/dictionary/Diction"; ...@@ -8,7 +8,6 @@ import {Diction} from "autumn-vue/lib/core/dictionary/Diction";
/** /**
* 字典表(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{
......
...@@ -11,7 +11,7 @@ import type {WxPayUnifiedOrderV3Result} from "lib/src/domain/WxPayUnifiedOrderV3 ...@@ -11,7 +11,7 @@ import type {WxPayUnifiedOrderV3Result} from "lib/src/domain/WxPayUnifiedOrderV3
export class RechargeController{ export class RechargeController{
/** /**
* 充值接口 * 充值接口 (过时接口,不再使用)
详见:https://pay.weixin.qq.com/doc/v3/merchant/4012791856 详见:https://pay.weixin.qq.com/doc/v3/merchant/4012791856
* @param recharge * @param recharge
* @param account * @param account
...@@ -21,14 +21,6 @@ export class RechargeController{ ...@@ -21,14 +21,6 @@ export class RechargeController{
return axios.post('recharge/addRecharge', recharge); return axios.post('recharge/addRecharge', recharge);
} }
/**
* 调用统一下单接口(JSAPI)
详见:https://pay.weixin.qq.com/doc/v3/merchant/4012791856
*/
static createOrder(axios:AxiosStatic, request: any): Promise<AxiosResponse<WxPayUnifiedOrderV3Result.JsapiResult>> {
return axios.post('recharge/createOrder', request);
}
// region 前端扩展代码区 // region 前端扩展代码区
// endregion // endregion
} }
...@@ -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{
......
...@@ -11,7 +11,6 @@ import type {WxPayUnifiedOrderV3Result} from "lib/src/domain/WxPayUnifiedOrderV3 ...@@ -11,7 +11,6 @@ import type {WxPayUnifiedOrderV3Result} from "lib/src/domain/WxPayUnifiedOrderV3
/** /**
* 交易明细(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{
......
...@@ -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{
......
...@@ -296,6 +296,9 @@ import {maskNumberStr} from "@/common/CommonUtils"; ...@@ -296,6 +296,9 @@ import {maskNumberStr} from "@/common/CommonUtils";
import {ConfigController} from "@/api/ConfigController"; import {ConfigController} from "@/api/ConfigController";
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";
import {Recharge} from "lib/src/entity/finance/entity/Recharge";
import {RechargeController} from "@/api/RechargeController";
import {DepositController} from "@/api/DepositController";
@Component({ @Component({
components: {BidSuccessDialog} components: {BidSuccessDialog}
...@@ -727,6 +730,39 @@ export default class AuctionVehiclePage extends Vue { ...@@ -727,6 +730,39 @@ export default class AuctionVehiclePage extends Vue {
this.isAgreed = !this.isAgreed; this.isAgreed = !this.isAgreed;
} }
/**
* 支付保证金
*/
confirmRecharge(): void {
const recharge = new Recharge();
uni.showLoading({title: '正在支付保证金...', mask: true});
const that=this;
DepositController.addDeposit(this.axios, this.aucvehId).then(res => {
const result = res.data;
uni.requestPayment({
provider: 'wxpay',
timeStamp: result.timeStamp,
nonceStr: result.nonceStr,
orderInfo: undefined,
package: result.packageValue,
signType: result.signType,
paySign: result.paySign,
complete(result: any): void {
}, fail(error: any): void {
//支付失败时出发,比如取消支付、余额不足等
setTimeout(() => {
uni.showToast({title: error, icon: 'none'});
}, 300);
}, success(result: any): void {
// //触发该success时已经是输入密码支付成功后触发,可做一些页面跳转和成功提示
setTimeout(() => {
that.commitBid();
}, 800);
},
});
}).finally(() => uni.hideLoading());
}
// 提交出价 // 提交出价
submitBid() { submitBid() {
if (!this.isAgreed) { if (!this.isAgreed) {
...@@ -775,7 +811,8 @@ export default class AuctionVehiclePage extends Vue { ...@@ -775,7 +811,8 @@ export default class AuctionVehiclePage extends Vue {
confirmText: '立即缴纳', confirmText: '立即缴纳',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
uni.navigateTo({url: '/module/deposit/RechargePage'}); this.confirmRecharge();
// uni.navigateTo({url: '/module/deposit/RechargePage'});
} }
} }
}); });
......
...@@ -1676,6 +1676,17 @@ ...@@ -1676,6 +1676,17 @@
<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>订单号(生成订单后赋值)</Cm> <Cm>订单号(生成订单后赋值)</Cm>
</Cl> </Cl>
<Cl au="0" df="" nm="OUT_TRADE_NO" nu="1">
<DT arr="0" ds="VarChar" en="" id="12" ln="128" sc="null" sg="1" un="0"/>
</Cl>
<Cl au="0" df="" nm="PAYMENT_TIME" nu="1">
<DT arr="0" ds="DateTime" en="" id="700" ln="null" sc="null" sg="1" un="0"/>
<Cm>支付时间</Cm>
</Cl>
<Cl au="0" df="" nm="WXTRANSACTION_ID" nu="1">
<DT arr="0" ds="VarChar" en="" id="12" ln="64" sc="null" sg="1" un="0"/>
<Cm>微信支付TRANSACTION_ID</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"/>
...@@ -3494,7 +3505,7 @@ ...@@ -3494,7 +3505,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="178" sch="schemaA" tbl="deposit" w="475" x="276" y="151"/> <TbGl bkCl="#6699ff64" h="226" 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"/>
...@@ -3570,7 +3581,7 @@ ...@@ -3570,7 +3581,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="178" sch="schemaA" tbl="deposit" w="475" x="990" y="1845"/> <TbGl bkCl="#6699ff64" h="226" 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"/>
...@@ -4698,7 +4709,6 @@ ...@@ -4698,7 +4709,6 @@
<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>
......
...@@ -105,3 +105,15 @@ ALTER TABLE deposit_rule ...@@ -105,3 +105,15 @@ ALTER TABLE deposit_rule
ALTER TABLE account ALTER TABLE account
ADD DISABLE_REASON VARCHAR(255) ADD DISABLE_REASON VARCHAR(255)
COMMENT '禁用原因' NULL after SUPPER; COMMENT '禁用原因' NULL after SUPPER;
/******************** Update Table: deposit ************************/
# 2025-12-30
ALTER TABLE deposit ADD OUT_TRADE_NO VARCHAR(128) NULL after ORDER_CODE;
ALTER TABLE deposit ADD PAYMENT_TIME DATETIME
COMMENT '支付时间' NULL after OUT_TRADE_NO;
ALTER TABLE deposit ADD WXTRANSACTION_ID VARCHAR(64)
COMMENT '微信支付TRANSACTION_ID' NULL after PAYMENT_TIME;
\ 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!