|
@@ -62,6 +62,7 @@ import com.pj.project.tb_declare.TbDeclare;
|
|
|
import com.pj.project.tb_declare.TbDeclareService;
|
|
|
import com.pj.project.tb_deduction_bind.TbDeductionBind;
|
|
|
import com.pj.project.tb_deduction_bind.TbDeductionBindService;
|
|
|
+import com.pj.project.tb_deduction_record.TbDeductionRecord;
|
|
|
import com.pj.project.tb_driver.TbDriver;
|
|
|
import com.pj.project.tb_driver.TbDriverService;
|
|
|
import com.pj.project.tb_fee_details.TbFeeDetails;
|
|
@@ -69,6 +70,8 @@ import com.pj.project.tb_fee_details.TbFeeDetailsService;
|
|
|
import com.pj.project.tb_fee_statistics.TbFeeStatisticsService;
|
|
|
import com.pj.project.tb_goods.TbGoods;
|
|
|
import com.pj.project.tb_goods.TbGoodsService;
|
|
|
+import com.pj.project.tb_invoice_order.TbInvoiceOrder;
|
|
|
+import com.pj.project.tb_invoice_order.TbInvoiceOrderService;
|
|
|
import com.pj.project.tb_item.TbItem;
|
|
|
import com.pj.project.tb_item.TbItemService;
|
|
|
import com.pj.project.tb_item_fac.TbItemFac;
|
|
@@ -178,7 +181,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
private TbFeeDetailsService tbFeeDetailsService;
|
|
|
|
|
|
@Resource
|
|
|
- private TbDeductionBindService tbDeductionBindService;
|
|
|
+ private TbInvoiceOrderService tbInvoiceOrderService;
|
|
|
@Resource
|
|
|
@Lazy
|
|
|
private TbFeeStatisticsService tbFeeStatisticsService;
|
|
@@ -457,10 +460,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
List<String> businessIdList = businessList.stream().map(TbBusiness::getId).collect(Collectors.toList());
|
|
|
String businessIds = StrUtil.join(",", businessIdList);
|
|
|
long judgeCount = businessList.stream().filter(tbBusiness -> tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()).count();
|
|
|
- int size=businessList.size();
|
|
|
+ int size = businessList.size();
|
|
|
result.put("showPay", true);
|
|
|
result.put("businessId", businessIds);
|
|
|
- result.put("noJudgeCount", judgeCount==size?0:1);
|
|
|
+ result.put("noJudgeCount", judgeCount == size ? 0 : 1);
|
|
|
List<TbBusinessItem> items = tbBusinessItemService.findByBusinessIdList(businessIdList);
|
|
|
Date inTime = tbBusinessCar.getRealInTime();
|
|
|
int pay = tbBusinessCar.getPay();
|
|
@@ -835,7 +838,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (dbBusiness == null) {
|
|
|
throw new AjaxError("记录不存在");
|
|
|
}
|
|
|
- if (dbBusiness.getConfirmJudge()== CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()){
|
|
|
+ if (dbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
|
|
|
throw new AjaxError("业务已审核,请驳回后修改");
|
|
|
}
|
|
|
List<TbItem> tbItems = otherBusinessBO.getItems();
|
|
@@ -993,7 +996,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
public void bindOtherBusinessCar(String businessId, List<String> businessCarIdList) {
|
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
|
- if (tbBusiness.getConfirmJudge()== CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()){
|
|
|
+ if (tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
|
|
|
throw new AjaxError("业务已审核,请先驳回");
|
|
|
}
|
|
|
List<TbBusinessCar> list = tbBusinessCarService.findOtherBusinessCar(businessId);
|
|
@@ -1524,7 +1527,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
public void addBusinessCar(TbBusinessCar tbBusinessCar) {
|
|
|
String businessId = tbBusinessCar.getBusinessId();
|
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
|
- if (tbBusiness.getConfirmJudge()== CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()){
|
|
|
+ if (tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
|
|
|
throw new AjaxError("业务已审核,不能绑定新车辆");
|
|
|
}
|
|
|
String carNo = tbBusinessCar.getCarNo().trim().toUpperCase();
|
|
@@ -1578,6 +1581,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 审核通过
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
public void confirmJudgePass(String id) {
|
|
|
TbBusiness tbBusiness = this.getById(id);
|
|
|
if (tbBusiness == null) {
|
|
@@ -1616,13 +1623,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
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);
|
|
|
+ TbDeductionRecord record= automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
+ addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(),details,record);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
//其他费项 装卸业务管理费” 进行预存款扣除
|
|
|
for (TbBusinessItem item : tbBusinessItems) {
|
|
|
//业务类型是装卸业务管理费且未支付的进行扣款
|
|
@@ -1650,15 +1656,46 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.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);
|
|
|
+ TbDeductionRecord record= automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
+ addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(),details,record);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
tbBusiness.setConfirmJudgeTime(now).setConfirmJudgeContent("审核通过")
|
|
|
.setConfirmJudge(CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode())
|
|
|
.setJudgeBy(StpUserUtil.getCreateBy()).setPayTime(now);
|
|
|
this.updateById(tbBusiness);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加开票订单
|
|
|
+ * @param tbBusiness
|
|
|
+ * @param billMoney
|
|
|
+ */
|
|
|
+ private void addInvoiceOrder(TbBusiness tbBusiness, BigDecimal billMoney,TbFeeDetails details,TbDeductionRecord record) {
|
|
|
+ TbInvoiceOrder t = new TbInvoiceOrder();
|
|
|
+ t.setBusinessName(tbBusiness.getGoodsName())
|
|
|
+ .setBusinessNo(tbBusiness.getNo())
|
|
|
+ .setCarNo(tbBusiness.getCarNoStr())
|
|
|
+ .setBusinessId(tbBusiness.getId())
|
|
|
+ .setCustomerId(tbBusiness.getCustomerId())
|
|
|
+ .setBillMoney(billMoney).setDetailId(details.getId())
|
|
|
+ .setPreOrderNum(details.getPreOrderNum())
|
|
|
+ .setDeductionRecordId(record.getId())
|
|
|
+ .setStatus(0).setCreateTime(new Date());
|
|
|
+ tbInvoiceOrderService.save(t);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核驳回
|
|
|
+ * @param id
|
|
|
+ * @param judgeContent
|
|
|
+ */
|
|
|
+ public void callback(String id, String judgeContent) {
|
|
|
+ TbBusiness db = this.getById(id);
|
|
|
+ db.setConfirmJudge(CarEnum.ConfirmJudgeEnum.CALL_BACK.getCode())
|
|
|
+ .setConfirmJudgeContent(judgeContent).setConfirmJudgeTime(new Date())
|
|
|
+ .setJudgeBy(StpUserUtil.getCreateBy());
|
|
|
+ this.updateById(db);
|
|
|
}
|
|
|
}
|