diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index a8658a955..fa8bfc3a3 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -292,6 +292,28 @@ public class BillManageApplicationService { return billManageDomainService.confirmBilling(billManageDO); } + @Transactional + public Boolean confirmBillingJob(BillManageDTO billManageDTO) { + //确认账单:未收款状态之前都可以进行确认账单,跳过核账流程,直接到未收款状态 + if(!StringUtils.isNotEmpty(billManageDTO.getBillManageIds())){ + throw new ServiceException("账单管理ids不能为空"); + } + //校验 + Set billManageIds = Stream.of(billManageDTO.getBillManageIds().split(",")).collect(Collectors.toSet()); + BillManageDO billManageDO = new BillManageDO(); + billManageDO.setBillManageIdSet(billManageIds); + List billManageList = billManageDomainService.queryList(billManageDO); + for (BillManagePO billManage : billManageList) { + if(billManage.getBillState() > 2){ + throw new ServiceException("选中数据"+ billManage.getBillNumber() + "状态不可操作确认账单"); + } + } + billManageDO.setOrganizationId(billManageDTO.getOrganizationId()); + billManageDO.setOrganizationName(billManageDTO.getOrganizationName()); + billManageDO.setTopOrganizationId(billManageDTO.getTopOrganizationId()); + return billManageDomainService.confirmBillingJob(billManageDO); + } + public int editIsInvoice(String billNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber) { diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 9819caf59..36976bb93 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -894,7 +894,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -930,7 +930,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1003,7 +1003,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1039,7 +1039,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1127,7 +1127,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1163,7 +1163,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1258,7 +1258,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1294,7 +1294,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1367,7 +1367,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1403,7 +1403,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1491,7 +1491,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1527,7 +1527,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1618,7 +1618,10 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + params.setOrganizationId(organizationId); + params.setTopOrganizationId(topOrganizationId); + params.setOrganizationName(organizationName); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1626,7 +1629,9 @@ public class BillingStatementApplicationService { .eq(BillDetail::getDelFlag, 1)); BmsInvoiceListAddDTO tmsInvoiceListAddDTO = new BmsInvoiceListAddDTO(); tmsInvoiceListAddDTO.setBillManageId(billManageId); - + tmsInvoiceListAddDTO.setOrganizationId(organizationId); + tmsInvoiceListAddDTO.setTopOrganizationId(topOrganizationId); + tmsInvoiceListAddDTO.setOrganizationName(organizationName); if (ObjectUtil.isNotNull(billManage)) { tmsInvoiceListAddDTO.setSettlementCurrency(billManage.getSettlementCurrency()); tmsInvoiceListAddDTO.setBillAmount(billManage.getBillAmount()); @@ -1654,7 +1659,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1727,7 +1732,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1763,7 +1768,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1851,7 +1856,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -1887,7 +1892,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -1982,7 +1987,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -2018,7 +2023,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -2091,7 +2096,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -2127,7 +2132,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } @@ -2215,7 +2220,7 @@ public class BillingStatementApplicationService { //确认账单 BillManageDTO params = new BillManageDTO(); params.setBillManageIds(String.valueOf(billManageId)); - billManageApplicationService.confirmBilling(params); + billManageApplicationService.confirmBillingJob(params); //申请发票 BillManage billManage = billManageService.getById(billManageId); List billDetails = billDetailService.list(new LambdaQueryWrapper() @@ -2251,7 +2256,7 @@ public class BillingStatementApplicationService { bmsMakeOutInvoices.add(bmsMakeOutInvoice); tmsInvoiceListAddDTO.setBmsMakeOutInvoices(bmsMakeOutInvoices); - bmsInvoiceListService.addReceivableBill(tmsInvoiceListAddDTO); + bmsInvoiceListService.addReceivableBillJob(tmsInvoiceListAddDTO); } } } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java index 8272bfe5e..ccfc7dc66 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java @@ -557,6 +557,32 @@ public class BillManageDomainService { return flag && three; } + public Boolean confirmBillingJob(BillManageDO billManageDO) { + //直接修改状态到未收款3状态 +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); +// } + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(BillManage::getBillManageId,billManageDO.getBillManageIdSet()) + .set(BillManage::getBillStep,4) + .set(BillManage::getBillState,3) +// .set(BillManage::getUpdateBy,loginUser.getUserPo().getUserId()) +// .set(BillManage::getUpdateByName,loginUser.getUserPo().getUserName()) + .set(BillManage::getUpdateTime,new Date()); + boolean flag = billManageService.update(updateWrapper); + //保存账单操作记录 + BillOperationLogDO billOperationLogDO = new BillOperationLogDO(); + billOperationLogDO.setBillManageIdSet(billManageDO.getBillManageIdSet()); + billOperationLogDO.setOperationInfo(BillLogsConstants.confirm_bill_text); + billOperationLogDO.setOperationType(3); + billOperationLogDO.setOrganizationId(billManageDO.getOrganizationId()); + billOperationLogDO.setOrganizationName(billManageDO.getOrganizationName()); + billOperationLogDO.setTopOrganizationId(billManageDO.getTopOrganizationId()); + boolean three = billOperationLogDomainService.saveBillOperationLogBatchJob(billOperationLogDO); + return flag && three; + } + public int editIsInvoice(String billNumber, Integer isInvoice, String invoiceId, String invoiceMakeTime,String applyNumber) { diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java index 0495eccdb..3dac710a7 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java @@ -139,6 +139,40 @@ public class BillOperationLogDomainService { return billOperationLogService.saveBatch(saveList); } + public Boolean saveBillOperationLogBatchJob(BillOperationLogDO billOperationLogDO) { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (ObjectUtil.isNull(loginUser)) { +// throw new DigitalLogisticsException(UserError.TIMEOUT); +// } + if(billOperationLogDO.getBillManageIdSet()==null || billOperationLogDO.getBillManageIdSet().size()==0){ + throw new ServiceException("账单集合不能为空"); + } +// String userName = loginUser.getUserPo().getUserName(); +// // 获取登录人id +// Long userId = loginUser.getUserid(); + BillOperationLogDO common = new BillOperationLogDO(); +// common.setCreateByName(userName); +// common.setUpdateByName(userName); + common.setCreateTime(new Date()); + common.setUpdateTime(new Date()); + common.setDelFlag(1); +// common.setCreateBy(userId); +// common.setUpdateBy(userId); +// common.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); +// common.setOrganizationId(loginUser.getUserPo().getOrganizationId()); +// common.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + common.setOperationType(billOperationLogDO.getOperationType()); + common.setOperationInfo(billOperationLogDO.getOperationInfo()); + List saveList = new ArrayList<>(); + for (String billManageId : billOperationLogDO.getBillManageIdSet()) { + BillOperationLog save = new BillOperationLog(); + BeanUtils.copyProperties(common, save); + save.setBillManageId(Long.valueOf(billManageId)); + saveList.add(save); + } + return billOperationLogService.saveBatch(saveList); + } + /** * 批量保存数据 diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java index 3918d6fa6..f4ac9ca67 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/facade/IBmsInvoiceListService.java @@ -26,6 +26,8 @@ public interface IBmsInvoiceListService extends IService { void addReceivableBill(BmsInvoiceListAddDTO tmsInvoiceListAddDTO); + void addReceivableBillJob(BmsInvoiceListAddDTO tmsInvoiceListAddDTO); + void update(BmsInvoiceListDTO tmsInvoiceListDTO); int delete(List ids); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java index 9f2015bdb..ddcaef106 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/bmsInvoiceList/repository/persistence/BmsInvoiceListServiceImpl.java @@ -216,6 +216,76 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl bmsMakeOutInvoices = bmsInvoiceListAddDTO.getBmsMakeOutInvoices(); + if (ObjectUtil.isNotNull(bmsMakeOutInvoices) && bmsMakeOutInvoices.size() > 0) { + for (BmsMakeOutInvoice bmsMakeOutInvoice : bmsMakeOutInvoices) { + bmsMakeOutInvoice.setInvoiceId(listId); + //bmsMakeOutInvoice.setCreateBy(sysUser.getId()); + bmsMakeOutInvoice.setCreateTime(new Date()); + bmsMakeOutInvoiceMapper.insert(bmsMakeOutInvoice); + for (BmsMakeOutInvoiceItem bmsMakeOutInvoiceItem : bmsMakeOutInvoice.getBmsMakeOutInvoiceItems()) { + bmsMakeOutInvoiceItem.setMakeId(bmsMakeOutInvoice.getId()); + //bmsMakeOutInvoiceItem.setCreateBy(sysUser.getId()); + bmsMakeOutInvoiceItem.setCreateTime(new Date()); + bmsMakeOutInvoiceItemMapper.insert(bmsMakeOutInvoiceItem); + } + } + } + } + +// BillManage billManage = billManageMapper.selectById(bmsInvoiceListAddDTO.getBillManageId()); +// if (billManage != null) { +// billManage.setIsInvoice(1); +// billManage.setInvoiceId(bmsInvoiceList.getId().toString()); +// billManage.setApplyNumber(bmsInvoiceList.getApplyNumber()); +// billManageMapper.updateById(billManage); +// } + List billManageIds = bmsInvoiceListAddDTO.getBillManageIds(); + if (billManageIds != null && billManageIds.size() > 0){ + } else { + billManageIds = new ArrayList<>(); + billManageIds.add(bmsInvoiceListAddDTO.getBillManageId()); + } + List billManages = billManageMapper.selectList(new LambdaQueryWrapper().in(BillManage::getBillManageId, billManageIds)); + if (billManages != null && billManages.size() > 0) { + for (BillManage billManage : billManages) { + billManage.setIsInvoice(1); + billManage.setInvoiceId(bmsInvoiceList.getId().toString()); + billManage.setApplyNumber(bmsInvoiceList.getApplyNumber()); + billManageMapper.updateById(billManage); + } + } + /*AjaxResult ajaxResult = financeServiceFeign.editIsInvoice(transportationId,1,bmsInvoiceList.getId(),"",bmsInvoiceList.getApplyNumber()); + if(!"200".equals(String.valueOf(ajaxResult.get("code")))){ + throw new com.mhd.common.core.exception.ServiceException(ajaxResult.get("msg").toString()); + }*/ + } + @Override public BmsSettlementPartyInvoice selectSettlementPartyInfoByName(String settlementPartyName) { return null; @@ -932,4 +1002,43 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl billManageIds; + /**组织ID*/ + @ApiModelProperty(value = "组织ID") + @Excel(name = "组织ID", width = 15) + private Long organizationId; + + /**组织名称*/ + @ApiModelProperty(value = "组织名称") + @Excel(name = "组织名称", width = 15) + private String organizationName; + + /**一级组织ID*/ + @ApiModelProperty(value = "一级组织ID") + @Excel(name = "一级组织ID", width = 15) + private Long topOrganizationId; } \ No newline at end of file