|
@@ -24,15 +24,15 @@ public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObjec
|
|
|
private final WashOrderService washOrderService;
|
|
private final WashOrderService washOrderService;
|
|
|
private final WalletDetailService walletDetailService;
|
|
private final WalletDetailService walletDetailService;
|
|
|
private final AccountService accountService;
|
|
private final AccountService accountService;
|
|
|
- private final StationAccountService investorAccountService;
|
|
|
|
|
|
|
+ private final StationAccountService stationAccountService;
|
|
|
private final SplitRecordService splitRecordService;
|
|
private final SplitRecordService splitRecordService;
|
|
|
|
|
|
|
|
public OrderCloseEventHandler(WashOrderService washOrderService, WalletDetailService walletDetailService,
|
|
public OrderCloseEventHandler(WashOrderService washOrderService, WalletDetailService walletDetailService,
|
|
|
- AccountService accountService, StationAccountService investorAccountService, SplitRecordService splitRecordService) {
|
|
|
|
|
|
|
+ AccountService accountService, StationAccountService stationAccountService, SplitRecordService splitRecordService) {
|
|
|
this.washOrderService = washOrderService;
|
|
this.washOrderService = washOrderService;
|
|
|
this.walletDetailService = walletDetailService;
|
|
this.walletDetailService = walletDetailService;
|
|
|
this.accountService = accountService;
|
|
this.accountService = accountService;
|
|
|
- this.investorAccountService = investorAccountService;
|
|
|
|
|
|
|
+ this.stationAccountService = stationAccountService;
|
|
|
this.splitRecordService = splitRecordService;
|
|
this.splitRecordService = splitRecordService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -119,9 +119,9 @@ public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObjec
|
|
|
* @param washOrder
|
|
* @param washOrder
|
|
|
*/
|
|
*/
|
|
|
private void doLocalSplit(WashOrder washOrder) {
|
|
private void doLocalSplit(WashOrder washOrder) {
|
|
|
- var stationAccount = investorAccountService.getStationAccount(washOrder.getStationId());
|
|
|
|
|
|
|
+ var stationAccount = stationAccountService.getStationAccount(washOrder.getStationId());
|
|
|
var amount = (int) (washOrder.getAmount() * (0.3 - 0.1));
|
|
var amount = (int) (washOrder.getAmount() * (0.3 - 0.1));
|
|
|
- investorAccountService.lambdaUpdate()
|
|
|
|
|
|
|
+ stationAccountService.lambdaUpdate()
|
|
|
.setSql("frozen_amount = frozen_amount - {0}", amount)
|
|
.setSql("frozen_amount = frozen_amount - {0}", amount)
|
|
|
.eq(StationAccount::getId, stationAccount.getId())
|
|
.eq(StationAccount::getId, stationAccount.getId())
|
|
|
.update();
|
|
.update();
|
|
@@ -153,32 +153,32 @@ public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObjec
|
|
|
* @param stationId 用户归属的站点Id
|
|
* @param stationId 用户归属的站点Id
|
|
|
*/
|
|
*/
|
|
|
private void doCrossSplit(WashOrder washOrder, String stationId) {
|
|
private void doCrossSplit(WashOrder washOrder, String stationId) {
|
|
|
- var investorAccount = investorAccountService.getStationAccount(washOrder.getStationId());
|
|
|
|
|
|
|
+ var investorAccount = stationAccountService.getStationAccount(washOrder.getStationId());
|
|
|
var splitAmount = (int) (washOrder.getAmount() * (0.3 - 0.1));
|
|
var splitAmount = (int) (washOrder.getAmount() * (0.3 - 0.1));
|
|
|
var localAmount = (int) (splitAmount * 0.7);
|
|
var localAmount = (int) (splitAmount * 0.7);
|
|
|
var crossAmount = splitAmount - localAmount;
|
|
var crossAmount = splitAmount - localAmount;
|
|
|
|
|
|
|
|
// 当前消费站点收入(跨店消费,原充值站点要分订单的70%)
|
|
// 当前消费站点收入(跨店消费,原充值站点要分订单的70%)
|
|
|
- investorAccountService.lambdaUpdate()
|
|
|
|
|
|
|
+ stationAccountService.lambdaUpdate()
|
|
|
.setSql("balance = balance + {0}", crossAmount)
|
|
.setSql("balance = balance + {0}", crossAmount)
|
|
|
.eq(StationAccount::getId, investorAccount.getId())
|
|
.eq(StationAccount::getId, investorAccount.getId())
|
|
|
.update();
|
|
.update();
|
|
|
|
|
|
|
|
// // 充值站点收入
|
|
// // 充值站点收入
|
|
|
-// investorAccountService.lambdaUpdate()
|
|
|
|
|
|
|
+// stationAccountService.lambdaUpdate()
|
|
|
// .setSql("balance = balance + {0}, frozen_amount = frozen_amount - {1}", localAmount, splitAmount)
|
|
// .setSql("balance = balance + {0}, frozen_amount = frozen_amount - {1}", localAmount, splitAmount)
|
|
|
// .eq(InvestorAccount::getId, investorAccount.getId())
|
|
// .eq(InvestorAccount::getId, investorAccount.getId())
|
|
|
// .update();
|
|
// .update();
|
|
|
//
|
|
//
|
|
|
// // 充值站点支出
|
|
// // 充值站点支出
|
|
|
-// investorAccountService.lambdaUpdate()
|
|
|
|
|
|
|
+// stationAccountService.lambdaUpdate()
|
|
|
// .setSql("balance = balance - {0}", crossAmount)
|
|
// .setSql("balance = balance - {0}", crossAmount)
|
|
|
// .eq(InvestorAccount::getId, investorAccount.getId())
|
|
// .eq(InvestorAccount::getId, investorAccount.getId())
|
|
|
// .update();
|
|
// .update();
|
|
|
|
|
|
|
|
// 以上充值站点的两次操作进行合并
|
|
// 以上充值站点的两次操作进行合并
|
|
|
// 充值站点收入
|
|
// 充值站点收入
|
|
|
- investorAccountService.lambdaUpdate()
|
|
|
|
|
|
|
+ stationAccountService.lambdaUpdate()
|
|
|
.setSql("balance = balance + {0}, frozen_amount = frozen_amount - {1}", localAmount - crossAmount, splitAmount)
|
|
.setSql("balance = balance + {0}, frozen_amount = frozen_amount - {1}", localAmount - crossAmount, splitAmount)
|
|
|
.eq(StationAccount::getId, investorAccount.getId())
|
|
.eq(StationAccount::getId, investorAccount.getId())
|
|
|
.update();
|
|
.update();
|