| | |
| | | estimatedReceivable.setCreateTime(nowDate); |
| | | estimatedReceivable.setFeeSystemNo("YF"+datePart+ RandomUtils.random(5)); |
| | | estimatedReceivable.setFeeType(0); |
| | | PendingSettlementBusiness pendingSettlementBusiness = pendingSettlementBusinessMapper.selectPendingSettlementBusinessByNo(estimatedReceivable.getDispatchNo()); |
| | | if (pendingSettlementBusiness == null){ |
| | | throw new ServiceException("调度单不存在"); |
| | | |
| | | } |
| | | Integer relatedBillStatus = pendingSettlementBusiness.getRelatedBillStatus(); |
| | | if (relatedBillStatus.equals(2)||relatedBillStatus.equals(3)){ |
| | | throw new ServiceException("当前调度单已结算或部分结算无法新增明细"); |
| | | } |
| | | return estimatedReceivableMapper.insertEstimatedReceivable(estimatedReceivable); |
| | | } |
| | | |
| | |
| | | throw new ServiceException("无需重复确认"); |
| | | |
| | | } |
| | | PendingSettlementBusiness pendingSettlementBusiness = pendingSettlementBusinessMapper.selectPendingSettlementBusinessByNo(estimatedReceivable.getDispatchNo()); |
| | | if (pendingSettlementBusiness == null){ |
| | | throw new ServiceException("调度单不存在"); |
| | | |
| | | } |
| | | Integer relatedBillStatus = pendingSettlementBusiness.getRelatedBillStatus(); |
| | | if (relatedBillStatus.equals(2)||relatedBillStatus.equals(3)){ |
| | | throw new ServiceException("当前调度单已结算或部分结算无法确认"); |
| | | } |
| | | if (pendingSettlementBusiness.getBillId()!=null){ |
| | | EstimatedReceivableBill estimatedReceivableBill = estimatedReceivableBillMapper.selectEstimatedReceivableBillById(pendingSettlementBusiness.getBillId()); |
| | | BigDecimal totalAmount = estimatedReceivableBill.getTotalAmount(); |
| | | estimatedReceivableBill.setTotalAmount(totalAmount.add(estimatedReceivable.getEstimatedAmount())); |
| | | estimatedReceivableBillMapper.updateEstimatedReceivableBill(estimatedReceivableBill); |
| | | } |
| | | String username = SecurityUtils.getUsername(); |
| | | |
| | | logService.insertEstimatedReceivableLog("确认应收",id,username); |
| | |
| | | throw new ServiceException("无需重复取消"); |
| | | |
| | | } |
| | | PendingSettlementBusiness pendingSettlementBusiness = pendingSettlementBusinessMapper.selectPendingSettlementBusinessByNo(estimatedReceivable.getDispatchNo()); |
| | | if (pendingSettlementBusiness == null){ |
| | | throw new ServiceException("调度单不存在"); |
| | | |
| | | } |
| | | Integer relatedBillStatus = pendingSettlementBusiness.getRelatedBillStatus(); |
| | | if (relatedBillStatus.equals(2)||relatedBillStatus.equals(3)){ |
| | | throw new ServiceException("当前调度单已结算或部分结算无法取消"); |
| | | } |
| | | if (pendingSettlementBusiness.getBillId()!=null){ |
| | | EstimatedReceivableBill estimatedReceivableBill = estimatedReceivableBillMapper.selectEstimatedReceivableBillById(pendingSettlementBusiness.getBillId()); |
| | | BigDecimal totalAmount = estimatedReceivableBill.getTotalAmount(); |
| | | estimatedReceivableBill.setTotalAmount(totalAmount.subtract(estimatedReceivable.getEstimatedAmount())); |
| | | estimatedReceivableBillMapper.updateEstimatedReceivableBill(estimatedReceivableBill); |
| | | } |
| | | String username = SecurityUtils.getUsername(); |
| | | |
| | | logService.insertEstimatedReceivableLog("取消应收",id,username); |
| | | estimatedReceivable.setIsConfirmed(0); |
| | | |
| | | return estimatedReceivableMapper.updateEstimatedReceivable(estimatedReceivable); |
| | | } |
| | | |