| | |
| | | /** |
| | | * ERP 收款单 Service 实现类 |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Service |
| | | @Validated |
| | |
| | | adminUserApi.validateUser(createReqVO.getFinanceUserId()); |
| | | } |
| | | // 1.5 生成收款单号,并校验唯一性 |
| | | String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_RECEIPT_NO_PREFIX); |
| | | if (financeReceiptMapper.selectByNo(no) != null) { |
| | | throw exception(FINANCE_RECEIPT_NO_EXISTS); |
| | | } |
| | | String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_RECEIPT_NO_PREFIX, |
| | | candidate -> financeReceiptMapper.selectByNo(candidate) != null); |
| | | |
| | | // 2.1 插入收款单 |
| | | ErpFinanceReceiptDO receipt = BeanUtils.toBean(createReqVO, ErpFinanceReceiptDO.class, in -> in |
| | |
| | | // 2.2 更新收款单项 |
| | | updateFinanceReceiptItemList(updateReqVO.getId(), receiptItems); |
| | | // 2.3 更新附件 |
| | | if (updateReqVO.getBlobIds() != null) { |
| | | storageAttachmentApi.deleteAttachmentsByRecord("erp_finance_receipt", updateReqVO.getId()); |
| | | storageAttachmentApi.bindAttachments("file", "erp_finance_receipt", |
| | | updateReqVO.getId(), updateReqVO.getBlobIds()); |
| | | } |
| | | storageAttachmentApi.updateAttachments("file", "erp_finance_receipt", updateReqVO.getId(), updateReqVO.getBlobIds()); |
| | | } |
| | | |
| | | private void calculateTotalPrice(ErpFinanceReceiptDO receipt, List<ErpFinanceReceiptItemDO> receiptItems) { |