|
|
@@ -119,30 +119,46 @@ public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObjec
|
|
|
* @param washOrder
|
|
|
*/
|
|
|
private void doLocalSplit(WashOrder washOrder) {
|
|
|
- var stationAccount = stationAccountService.getStationAccount(washOrder.getStationId());
|
|
|
- var amount = (int) (washOrder.getAmount() * (0.3 - 0.1));
|
|
|
+ // 平台手续费10%
|
|
|
+ var platformAmount = (int) (washOrder.getAmount() * 0.1);
|
|
|
+ // 解冻金额
|
|
|
+ var amount = (int) (washOrder.getAmount() * 0.3 - platformAmount);
|
|
|
stationAccountService.lambdaUpdate()
|
|
|
.setSql("frozen_amount = frozen_amount - {0}", amount)
|
|
|
- .eq(StationAccount::getId, stationAccount.getId())
|
|
|
+ .eq(StationAccount::getStationId, washOrder.getStationId())
|
|
|
.update();
|
|
|
+
|
|
|
+ // 平台技术服务费10%
|
|
|
+ stationAccountService.lambdaUpdate()
|
|
|
+ .setSql("balance = balance + {0}", platformAmount)
|
|
|
+ .eq(StationAccount::getId, StationAccount.PLATFORM_ACCOUNT_ID)
|
|
|
+ .update();
|
|
|
+
|
|
|
+ // 技术服务费
|
|
|
+ var splitRecord0 = new SplitRecord()
|
|
|
+ .setFromStationId(washOrder.getStationId())
|
|
|
+ .setToStationId(StationAccount.PLATFORM_STATION_ID)
|
|
|
+ .setTradeNo(washOrder.getOrderId())
|
|
|
+ .setAmount(platformAmount)
|
|
|
+ .setType(SplitRecord.TYPE_PLATFORM);
|
|
|
+
|
|
|
// 冻结户解冻
|
|
|
var splitRecord1 = new SplitRecord()
|
|
|
- .setFromStationId(stationAccount.getStationId())
|
|
|
- .setToStationId(stationAccount.getStationId())
|
|
|
+ .setFromStationId(washOrder.getStationId())
|
|
|
+ .setToStationId(washOrder.getStationId())
|
|
|
.setTradeNo(washOrder.getOrderId())
|
|
|
.setAmount(amount)
|
|
|
.setType(SplitRecord.TYPE_UNFREEZE);
|
|
|
|
|
|
// 基本户入账
|
|
|
var splitRecord2 = new SplitRecord()
|
|
|
- .setFromStationId(stationAccount.getStationId())
|
|
|
- .setToStationId(stationAccount.getStationId())
|
|
|
+ .setFromStationId(washOrder.getStationId())
|
|
|
+ .setToStationId(washOrder.getStationId())
|
|
|
.setTradeNo(washOrder.getOrderId())
|
|
|
.setAmount(amount)
|
|
|
.setType(SplitRecord.TYPE_CONSUME);
|
|
|
|
|
|
- splitRecordService.saveBatch(List.of(splitRecord1, splitRecord2));
|
|
|
-
|
|
|
+ splitRecordService.saveBatch(List.of(splitRecord0, splitRecord1, splitRecord2));
|
|
|
|
|
|
}
|
|
|
|