|
@@ -521,49 +521,46 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
for (TbBusiness tbBusiness : businessList) {
|
|
|
Date now = new Date();
|
|
|
List<TbBusinessCar> tbBusinessCars = this.findOtherBusinessCar(tbBusiness.getId());
|
|
|
-
|
|
|
//审核
|
|
|
List<TbBusinessItem> tbBusinessItems = tbBusinessItemService.findByBusinessId(tbBusiness.getId());
|
|
|
String customerId = tbBusiness.getPickCustomerId();
|
|
|
TbAccount tbAccount = tbAccountService.getAccountByCustomerId(customerId);
|
|
|
for (TbBusinessCar tbBusinessCar : tbBusinessCars) {
|
|
|
- if (tbBusinessCar.getConfirmJudge()!=CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()){
|
|
|
- tbBusinessCar.setConfirmJudge(CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode())
|
|
|
- .setConfirmJudgeContent("审核通过").setConfirmJudgeTime(now)
|
|
|
- .setConfirmJudgeBy(StpUserUtil.getCreateBy());
|
|
|
- for (TbBusinessItem item : tbBusinessItems) {
|
|
|
- String itemName = item.getItemName();
|
|
|
- // todo 扣除 人工、机械装卸车辆---->每辆车都要支付----->
|
|
|
- if (SystemObject.config.getEveryCarPay().contains(itemName) && tbBusinessCar.getPayUnloadMoney() == 0) {
|
|
|
- List<IOrderItem> expenses = new ArrayList<>();
|
|
|
- IOrderItem orderItem = new IOrderItem();
|
|
|
- orderItem.setExpenseNum(Integer.parseInt(item.getNum()))
|
|
|
- .setUniqExpenseId(item.getItemCode());
|
|
|
- expenses.add(orderItem);
|
|
|
- IOrderPriceRes res = syncService.orderPriceCal(expenses);
|
|
|
- BigDecimal price = res.getTotalOrderPrice();
|
|
|
- BigDecimal balance = tbAccount.getTotalMoney();
|
|
|
- if (price.compareTo(balance) > 0) {
|
|
|
- throw new AjaxError("[" + tbAccount.getCustomerName() + "]账户余额不足扣除" + item.getItemName());
|
|
|
- } else {
|
|
|
- tbBusinessCar.setPayUnloadMoney(1);
|
|
|
- item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
|
|
|
- .setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
|
- tbBusinessItemService.updateById(item);
|
|
|
- tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
|
- tbBusinessService.updateById(tbBusiness);
|
|
|
- BigDecimal afterBalance = balance.subtract(price);
|
|
|
- tbAccount.setTotalMoney(afterBalance);//增加累计扣款
|
|
|
- tbAccountService.updateById(tbAccount);
|
|
|
- TbFeeDetails details = tbFeeDetailsService.savePrePayDetails(res, item, tbBusinessCar, tbBusiness, FeeTypeEnum.STEVEDORE_FEE);
|
|
|
- tbFeeStatisticsService.addOrUpdateStatistic(now, PayEnum.PayType.PER_PAY.getCode());//更新当前日期的日统计
|
|
|
- automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(),tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
- }
|
|
|
+ for (TbBusinessItem item : tbBusinessItems) {
|
|
|
+ String itemName = item.getItemName();
|
|
|
+ // todo 扣除 人工、机械装卸车辆---->每辆车都要支付----->
|
|
|
+ if (SystemObject.config.getEveryCarPay().contains(itemName) && tbBusinessCar.getPayUnloadMoney() == 0) {
|
|
|
+ List<IOrderItem> expenses = new ArrayList<>();
|
|
|
+ IOrderItem orderItem = new IOrderItem();
|
|
|
+ orderItem.setExpenseNum(Integer.parseInt(item.getNum()))
|
|
|
+ .setUniqExpenseId(item.getItemCode());
|
|
|
+ expenses.add(orderItem);
|
|
|
+ IOrderPriceRes res = syncService.orderPriceCal(expenses);
|
|
|
+ BigDecimal price = res.getTotalOrderPrice();
|
|
|
+ BigDecimal balance = tbAccount.getTotalMoney();
|
|
|
+ if (price.compareTo(balance) > 0) {
|
|
|
+ throw new AjaxError("[" + tbAccount.getCustomerName() + "]账户余额不足扣除" + item.getItemName());
|
|
|
+ } else {
|
|
|
+ tbBusinessCar.setPayUnloadMoney(1);
|
|
|
+ item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
|
|
|
+ .setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
|
+ tbBusinessItemService.updateById(item);
|
|
|
+ tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
|
+ tbBusinessService.updateById(tbBusiness);
|
|
|
+ BigDecimal afterBalance = balance.subtract(price);
|
|
|
+ tbAccount.setTotalMoney(afterBalance);//增加累计扣款
|
|
|
+ tbAccountService.updateById(tbAccount);
|
|
|
+ TbFeeDetails details = tbFeeDetailsService.savePrePayDetails(res, item, tbBusinessCar, tbBusiness, FeeTypeEnum.STEVEDORE_FEE);
|
|
|
+ tbFeeStatisticsService.addOrUpdateStatistic(now, PayEnum.PayType.PER_PAY.getCode());//更新当前日期的日统计
|
|
|
+ automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
}
|
|
|
}
|
|
|
- this.updateById(tbBusinessCar);
|
|
|
}
|
|
|
+ tbBusinessCar.setConfirmJudge(CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode())
|
|
|
+ .setConfirmJudgeContent("审核通过").setConfirmJudgeTime(now)
|
|
|
+ .setConfirmJudgeBy(StpUserUtil.getCreateBy());
|
|
|
}
|
|
|
+ this.updateBatchById(tbBusinessCars);
|
|
|
//其他费项 装卸业务管理费” 进行预存款扣除
|
|
|
for (TbBusinessItem item : tbBusinessItems) {
|
|
|
//业务类型是装卸业务管理费且未支付的进行扣款
|
|
@@ -592,7 +589,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
.findAny().orElse(tbBusinessCars.get(0));
|
|
|
TbFeeDetails details = tbFeeDetailsService.savePrePayDetails(res, item, tbBusinessCar, tbBusiness, FeeTypeEnum.STEVEDORE_FEE);
|
|
|
tbFeeStatisticsService.addOrUpdateStatistic(now, PayEnum.PayType.PER_PAY.getCode());//更新当前日期的日统计
|
|
|
- automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(),tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
+ automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
}
|
|
|
}
|
|
|
}
|