Commit 6f317b09 by gonglei

加入框架代码

1 parent 1814b11f
...@@ -2,8 +2,10 @@ package com.glsx.usedcar.module.finance.dao; ...@@ -2,8 +2,10 @@ package com.glsx.usedcar.module.finance.dao;
import com.glsx.usedcar.module.finance.entity.Recharge; import com.glsx.usedcar.module.finance.entity.Recharge;
import com.glsx.usedcar.module.finance.entity.Refund; import com.glsx.usedcar.module.finance.entity.Refund;
import com.glsx.usedcar.module.finance.entity.Withdraw;
import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.summerframework.orm.BaseRepository; import org.summerframework.orm.BaseRepository;
import java.util.List; import java.util.List;
...@@ -11,9 +13,12 @@ import java.util.Optional; ...@@ -11,9 +13,12 @@ import java.util.Optional;
public interface RefundDao extends BaseRepository<Refund, Long>, JpaSpecificationExecutor<Refund> { public interface RefundDao extends BaseRepository<Refund, Long>, JpaSpecificationExecutor<Refund> {
@EntityGraph(attributePaths = {"recharge"}) @EntityGraph(attributePaths = {"recharge", "withdraw"})
Optional<Refund> findTopByRecharge_OutTradeNoAndRecharge_TransactionIdAndOutRefundNo(String outTradeNo, String transactionId, String outRefundNo); Optional<Refund> findTopByRecharge_OutTradeNoAndRecharge_TransactionIdAndOutRefundNo(String outTradeNo, String transactionId, String outRefundNo);
@EntityGraph(attributePaths = {"recharge"}) @EntityGraph(attributePaths = {"recharge"})
List<Refund> findByWithdraw_WithdrawIdOrderByRefundTimeAsc(int withdrawId); List<Refund> findByWithdraw_WithdrawIdOrderByRefundTimeAsc(int withdrawId);
@Query("select sum(r.refundAmount) from Refund r where r.withdraw =?1 and r.refundSuccessTime is not null")
Optional<Double> sumByWithdraw(Withdraw withdraw);
} }
...@@ -110,55 +110,62 @@ public class Withdraw extends AuditingEntity implements Serializable { ...@@ -110,55 +110,62 @@ public class Withdraw extends AuditingEntity implements Serializable {
@Column @Column
private String rejectReason; private String rejectReason;
/**
* 付款单号
*/
@Column
private String transferBillNo;
/** /**
* 【单据状态】 * 已退款金额
* 可选取值
* ACCEPTED: 转账已受理
* PROCESSING: 转账处理中,转账结果尚未明确,如一直处于此状态,建议检查账户余额是否足够
* WAIT_USER_CONFIRM: 待收款用户确认,可拉起微信收款确认页面进行收款确认
* TRANSFERING: 转账结果尚未明确,可拉起微信收款确认页面再次重试确认收款
* SUCCESS: 转账成功
* FAIL: 转账失败
* CANCELING: 商户撤销请求受理成功,该笔转账正在撤销中
* CANCELLED: 转账撤销完成
*
* @see WxPayConstants.TransformBillState
*/ */
@Column @Column(nullable = false, length = 16)
private String state; private double refundAmount;
/**
* 失败原因 // /**
*/ // * 付款单号
@Column // */
private String failReason; // @Column
/** // private String transferBillNo;
* 收款用户姓名 //
*/ // /**
@Column // * 【单据状态】
private String transferName; // * 可选取值
/** // * ACCEPTED: 转账已受理
* 付款金额 // * PROCESSING: 转账处理中,转账结果尚未明确,如一直处于此状态,建议检查账户余额是否足够
*/ // * WAIT_USER_CONFIRM: 待收款用户确认,可拉起微信收款确认页面进行收款确认
@Column // * TRANSFERING: 转账结果尚未明确,可拉起微信收款确认页面再次重试确认收款
private Double paymentAmount; // * SUCCESS: 转账成功
// * FAIL: 转账失败
/** // * CANCELING: 商户撤销请求受理成功,该笔转账正在撤销中
* 用户确认时间 // * CANCELLED: 转账撤销完成
*/ // *
@Column // * @see WxPayConstants.TransformBillState
private LocalDateTime confirmTime; // */
// @Column
/** // private String state;
* 发起付款时间 // /**
*/ // * 失败原因
@Column // */
private LocalDateTime paymentTime; // @Column
// private String failReason;
// /**
// * 收款用户姓名
// */
// @Column
// private String transferName;
// /**
// * 付款金额
// */
// @Column
// private Double paymentAmount;
//
// /**
// * 用户确认时间
// */
// @Column
// private LocalDateTime confirmTime;
//
// /**
// * 发起付款时间
// */
// @Column
// private LocalDateTime paymentTime;
/** /**
* 转账成功时间 * 转账成功时间
*/ */
...@@ -171,20 +178,20 @@ public class Withdraw extends AuditingEntity implements Serializable { ...@@ -171,20 +178,20 @@ public class Withdraw extends AuditingEntity implements Serializable {
@Column @Column
private String transferRemark; private String transferRemark;
/** // /**
* 【微信支付】转账单号 // * 【微信支付】转账单号
*/ // */
@Column // @Column
private String packageInfo; // private String packageInfo;
public void setPayResult(TransferBillsGetResult result) { public void setPayResult(TransferBillsGetResult result) {
double paymentAmount = Long.parseLong(result.getTransferAmount()) * 0.0 / 100; double paymentAmount = Long.parseLong(result.getTransferAmount()) * 0.0 / 100;
LocalDateTime transferTime = DateTimeUtils.attemptParseLocalDateTime(result.getUpdateTime()); LocalDateTime transferTime = DateTimeUtils.attemptParseLocalDateTime(result.getUpdateTime());
this.transferBillNo = result.getTransferBillNo(); // this.transferBillNo = result.getTransferBillNo();
this.state = result.getState(); // this.state = result.getState();
this.failReason = result.getFailReason(); // this.failReason = result.getFailReason();
// this.transferName = result.getUserName(); // this.transferName = result.getUserName();
this.paymentAmount = paymentAmount; // this.paymentAmount = paymentAmount;
this.transferTime = transferTime; this.transferTime = transferTime;
this.transferRemark = result.getTransferRemark(); this.transferRemark = result.getTransferRemark();
} }
......
...@@ -77,6 +77,8 @@ public class TransactionService extends AbstractAuctionService { ...@@ -77,6 +77,8 @@ public class TransactionService extends AbstractAuctionService {
private GscApiInvoker gscApiInvoker; private GscApiInvoker gscApiInvoker;
@Resource @Resource
private MessageSource messageSource; private MessageSource messageSource;
@Resource
private WithdrawDao withdrawDao;
/** /**
...@@ -154,13 +156,7 @@ public class TransactionService extends AbstractAuctionService { ...@@ -154,13 +156,7 @@ public class TransactionService extends AbstractAuctionService {
OrderTransaction save = orderTransactionDao.save(orderTransaction); OrderTransaction save = orderTransactionDao.save(orderTransaction);
// 发送通知消息 // 发送通知消息
sendNoticeMessage(NoticeTemplate.TemplateType.ORDER_TRANSACTION, Map.of( sendNoticeMessage(NoticeTemplate.TemplateType.ORDER_TRANSACTION, Map.of(NoticeField.ORDER_CODE, auctionOrder.getOrderCode(), NoticeField.VEHICLE_NAME, auctionOrder.getVehicle().toVehicleName(), NoticeField.AMOUNT, auctionOrder.getOrderPrice() + auctionOrder.getCommissionPrice(), NoticeField.ORDER_ACCOUNT_NAME, auctionOrder.getAccount().getAccountName(), NoticeField.ORDER_TRANSACTION_TIME, auctionOrder.getCreateTime()));
NoticeField.ORDER_CODE, auctionOrder.getOrderCode(),
NoticeField.VEHICLE_NAME, auctionOrder.getVehicle().toVehicleName(),
NoticeField.AMOUNT, auctionOrder.getOrderPrice() + auctionOrder.getCommissionPrice(),
NoticeField.ORDER_ACCOUNT_NAME, auctionOrder.getAccount().getAccountName(),
NoticeField.ORDER_TRANSACTION_TIME, auctionOrder.getCreateTime()
));
return save; return save;
} }
} }
...@@ -307,6 +303,7 @@ public class TransactionService extends AbstractAuctionService { ...@@ -307,6 +303,7 @@ public class TransactionService extends AbstractAuctionService {
if (refundOptional.isPresent()) { if (refundOptional.isPresent()) {
Refund refund = refundOptional.get(); Refund refund = refundOptional.get();
Recharge recharge = refund.getRecharge(); Recharge recharge = refund.getRecharge();
refund.setRefundSuccessTime(DateTimeUtils.attemptParseLocalDateTime(decryptRes.getSuccessTime())); refund.setRefundSuccessTime(DateTimeUtils.attemptParseLocalDateTime(decryptRes.getSuccessTime()));
double refundAmount = refund.getRefundAmount(); double refundAmount = refund.getRefundAmount();
Account account = recharge.getAccount(); Account account = recharge.getAccount();
...@@ -314,6 +311,11 @@ public class TransactionService extends AbstractAuctionService { ...@@ -314,6 +311,11 @@ public class TransactionService extends AbstractAuctionService {
recharge.setRefundableAmount(recharge.getRefundableAmount() - refundAmount); recharge.setRefundableAmount(recharge.getRefundableAmount() - refundAmount);
Transaction transaction = new Transaction(account, "提现", Transaction.TransactionType.WITHDRAW, -refundAmount, account.getSurplus()); Transaction transaction = new Transaction(account, "提现", Transaction.TransactionType.WITHDRAW, -refundAmount, account.getSurplus());
transactionDao.save(transaction); transactionDao.save(transaction);
refundDao.flush();
Withdraw withdraw = refund.getWithdraw();
withdraw.setRefundAmount(refundDao.sumByWithdraw(withdraw).orElse(0.0));
withdraw.setTransferTime(LocalDateTime.now());
} }
} }
......
...@@ -75,7 +75,8 @@ ...@@ -75,7 +75,8 @@
<!-- </a-descriptions>--> <!-- </a-descriptions>-->
<template v-if="withdraw&&withdraw.auditState==='AUDITED'"> <template v-if="withdraw&&withdraw.auditState==='AUDITED'">
<title-divider title="退款情况" class="mt-10"></title-divider> <div class="mt-16"></div>
<title-divider title="退款情况"></title-divider>
<a-table :columns="columns" :data-source="refunds" :pagination="false" size="small"></a-table> <a-table :columns="columns" :data-source="refunds" :pagination="false" size="small"></a-table>
</template> </template>
......
...@@ -165,7 +165,15 @@ export default class WithdrawPage extends PaginationComponent<Withdraw> { ...@@ -165,7 +165,15 @@ export default class WithdrawPage extends PaginationComponent<Withdraw> {
{title: '申请时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true}, {title: '申请时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
{title: '审核人', dataIndex: 'updateBy', key: 'updateBy', width: 120, resizable: true, ellipsis: true, sorter: true}, {title: '审核人', dataIndex: 'updateBy', key: 'updateBy', width: 120, resizable: true, ellipsis: true, sorter: true},
{title: '审核时间', dataIndex: 'auditTime', key: 'auditTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true}, {title: '审核时间', dataIndex: 'auditTime', key: 'auditTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
{title: '打款进度', dataIndex: 'state', key: 'state', align: 'center', fixed: 'right', width: 120, resizable: true, ellipsis: true, sorter: true},
{
title: '已提现金额', dataIndex: 'refundAmount', key: 'refundAmount', width: 120, align: 'right', resizable: true, ellipsis: true, sorter: true,
customRender: ({text, record, index, column}) => {
return '¥' + text;
}
},
{title: '转账成功时间', dataIndex: 'transferTime', key: 'transferTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
// {title: '打款进度', dataIndex: 'state', key: 'state', align: 'center', fixed: 'right', width: 120, resizable: true, ellipsis: true, sorter: true},
{title: '审核状态', dataIndex: 'auditState', key: 'auditState', align: 'center', fixed: 'right', width: 100, resizable: true, ellipsis: true, sorter: true}, {title: '审核状态', dataIndex: 'auditState', key: 'auditState', align: 'center', fixed: 'right', width: 100, resizable: true, ellipsis: true, sorter: true},
{title: '操作', key: 'action', width: 110, align: 'center', fixed: 'right'}, {title: '操作', key: 'action', width: 110, align: 'center', fixed: 'right'},
]; ];
......
...@@ -3507,6 +3507,10 @@ ...@@ -3507,6 +3507,10 @@
<DT arr="0" ds="VarChar" en="" id="12" ln="255" sc="null" sg="1" un="0"/> <DT arr="0" ds="VarChar" en="" id="12" ln="255" sc="null" sg="1" un="0"/>
<Cm>驳回原因</Cm> <Cm>驳回原因</Cm>
</Cl> </Cl>
<Cl au="0" df="0" nm="REFUND_AMOUNT" nu="0">
<DT arr="0" ds="Decimal" en="" id="3" ln="16" sc="2" sg="1" un="0"/>
<Cm>已退款金额</Cm>
</Cl>
<Fk deAc="1" nm="fk_withdraw_account" prLkCl="ACCOUNT_ID" upAc="1"> <Fk deAc="1" nm="fk_withdraw_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="withdraw" oe="1" sch="schemaA" zr="1"/> <CdTb mn="1" nm="withdraw" oe="1" sch="schemaA" zr="1"/>
...@@ -3548,7 +3552,7 @@ ...@@ -3548,7 +3552,7 @@
<svg path=""/> <svg path=""/>
</DiaProps> </DiaProps>
<TbGl bkCl="#6699ff64" h="178" sch="schemaA" tbl="transaction" w="464" x="514" y="461"/> <TbGl bkCl="#6699ff64" h="178" sch="schemaA" tbl="transaction" w="464" x="514" y="461"/>
<TbGl bkCl="#6699ff64" h="418" sch="schemaA" tbl="withdraw" w="526" x="1136" y="787"/> <TbGl bkCl="#6699ff64" h="434" 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="1486" y="1317"/> <TbGl bkCl="#6699ff64" h="242" sch="schemaA" tbl="bank_account" w="436" x="1486" y="1317"/>
<TbGl bkCl="#6699ff64" h="178" sch="schemaA" tbl="deposit" w="475" x="156" y="133"/> <TbGl bkCl="#6699ff64" h="178" sch="schemaA" tbl="deposit" w="475" x="156" y="133"/>
...@@ -4795,6 +4799,7 @@ ...@@ -4795,6 +4799,7 @@
<TreePath>工单管理</TreePath> <TreePath>工单管理</TreePath>
<TreePath>diagramA</TreePath> <TreePath>diagramA</TreePath>
<TreePath>schemaA</TreePath> <TreePath>schemaA</TreePath>
<TreePath>schemaA.withdraw</TreePath>
<TreePath>aus.Schemas</TreePath> <TreePath>aus.Schemas</TreePath>
<TreePath>aus.Diagrams</TreePath> <TreePath>aus.Diagrams</TreePath>
<TreePath>数据埋点</TreePath> <TreePath>数据埋点</TreePath>
......
...@@ -208,4 +208,7 @@ ALTER TABLE refund ADD CONSTRAINT fk_refund_withdraw ...@@ -208,4 +208,7 @@ ALTER TABLE refund ADD CONSTRAINT fk_refund_withdraw
ALTER TABLE recharge ADD REFUNDABLE_AMOUNT DECIMAL(16, 2) DEFAULT 0 ALTER TABLE recharge ADD REFUNDABLE_AMOUNT DECIMAL(16, 2) DEFAULT 0
COMMENT '可退款金额' NOT NULL after RECHARGE_TYPE; COMMENT '可退款金额' NOT NULL after RECHARGE_TYPE;
update recharge set REFUNDABLE_AMOUNT= AMOUNT where PAYMENT_TIME is not null;
\ No newline at end of file \ No newline at end of file
update recharge set REFUNDABLE_AMOUNT= AMOUNT where PAYMENT_TIME is not null;
ALTER TABLE withdraw ADD REFUND_AMOUNT DECIMAL(16, 2) DEFAULT 0
COMMENT '已退款金额' NOT NULL after REJECT_REASON;
\ 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!