提交 a57022bc 作者: xiaowang

钱包操作

上级 7185e568
......@@ -242,12 +242,14 @@ public class PayWalletServiceImpl implements PayWalletService {
assert flyerWalletFlowVO != null;
int flyerUpdateCount = addFlyerSalary(publisherWalletFlowVO, flyerWalletFlowVO, flyerWallet);
if (flyerUpdateCount > 0) {
// 记录流水记录
// 记录订单结算流水记录
PayLogDO flyerPayLogDO = buildPayLogDO(null, flyerWalletFlowVO);
flyerPayLogDO.setSalaryAmtPaid(publisherWalletFlowVO.getFlyerSalaryAmount());
flyerPayLogDO.setOperateUser(publisherWalletFlowVO.getUserAccountId());
// 插入接单者流水记录表
payWalletDao.insertPayLogDO(flyerPayLogDO);
// 记录订单保证金退回记录
sendBackPledge(flyerWalletFlowVO);
return ResultBody.success();
} else {
log.error("正常结算时,接单方用户钱包更新失败,接单者id是:{},发布者传参是:{}", flyerWalletFlowVO.getUserAccountId(), publisherWalletFlowVO);
......@@ -290,6 +292,7 @@ public class PayWalletServiceImpl implements PayWalletService {
flyerPayLogDO.setOperateUser(publisherWalletFlowVO.getUserAccountId());
// 插入接单者流水记录表
payWalletDao.insertPayLogDO(flyerPayLogDO);
sendBackPledge(flyerWalletFlowVO);
return ResultBody.success();
} else {
log.error("飞手未确认修改金额大于原订单状态时,接单方用户钱包更新失败,接单者id是:{},发布者传参是:{}", flyerWalletFlowVO.getUserAccountId(), publisherWalletFlowVO);
......@@ -322,6 +325,7 @@ public class PayWalletServiceImpl implements PayWalletService {
flyerPayLogDO.setOperateUser(publisherWalletFlowVO.getUserAccountId());
// 插入接单者流水记录表
payWalletDao.insertPayLogDO(flyerPayLogDO);
sendBackPledge(flyerWalletFlowVO);
return ResultBody.success();
} else {
log.error("飞手确认修改金额小于原订单状态,接单方用户钱包更新失败,接单者id是:{},发布者传参是:{}", flyerWalletFlowVO.getUserAccountId(), publisherWalletFlowVO);
......@@ -330,6 +334,15 @@ public class PayWalletServiceImpl implements PayWalletService {
return ResultBody.error("钱包操作错误");
}
private void sendBackPledge(FlyerWalletFlowVO flyerWalletFlowVO) {
if (flyerWalletFlowVO.getCashAmount().compareTo(new BigDecimal(0)) > 0 || flyerWalletFlowVO.getSalaryAmount().compareTo(new BigDecimal(0)) > 0) {
PayLogDO flyerPledgeSendBack = buildPayLogDO(null, flyerWalletFlowVO);
flyerPledgeSendBack.setPayMethod(500);
// 插入接单者流水记录表
payWalletDao.insertPayLogDO(flyerPledgeSendBack);
}
}
private int buildFlyerWallet(FlyerWalletFlowVO flyerWalletFlowVO, PayWalletDO flyerWallet) {
PayWalletDO flyerUpdatePayWallet = new PayWalletDO();
flyerUpdatePayWallet.setUserAccountId(flyerWalletFlowVO.getUserAccountId());
......@@ -356,7 +369,10 @@ public class PayWalletServiceImpl implements PayWalletService {
PayWalletDO flyerPayWalletDO = new PayWalletDO();
flyerPayWalletDO.setUserAccountId(flyerWalletFlowVO.getUserAccountId());
flyerPayWalletDO.setPid(flyerWallet.getPid());
flyerPayWalletDO.setSalaryAmt(flyerWallet.getSalaryAmt().add(publisherWalletFlowVO.getFlyerSalaryAmount()));
flyerPayWalletDO.setSalaryAmt(flyerWallet.getSalaryAmt().add(publisherWalletFlowVO.getFlyerSalaryAmount()).add(flyerWalletFlowVO.getSalaryAmount()));
flyerPayWalletDO.setSalaryFreeze(flyerWallet.getSalaryFreeze().subtract(flyerWalletFlowVO.getSalaryAmount()));
flyerPayWalletDO.setCashAmt(flyerWallet.getCashAmt().add(flyerWalletFlowVO.getCashAmount()));
flyerPayWalletDO.setCashFreeze(flyerWallet.getCashFreeze().subtract(flyerWalletFlowVO.getCashAmount()));
int flyerUpdateCount = payWalletDao.updatePayWallet(flyerPayWalletDO);
return flyerUpdateCount;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论