From 7ab77cfbf7a7449d4b152fdc91d33f75fac9d2db Mon Sep 17 00:00:00 2001
From: hjx <577364224@qq.com>
Date: Mon, 9 Feb 2026 14:41:55 +0800
Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90bms=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
mhd_bms/Dockerfile | 17 +
mhd_bms/pom.xml | 177 ++++
.../com/mhd/bms/BmsServiceApplication.java | 21 +
.../BillManageApplicationService.java | 494 +++++++++++
.../BillOperationLogApplicationService.java | 72 ++
.../BillingRulesApplicationService.java | 167 ++++
.../CostCalculationApplicationService.java | 340 ++++++++
.../BillingStatementApplicationService.java | 501 ++++++++++++
.../BusinessDocumentApplicationService.java | 725 +++++++++++++++++
.../ConditionalMappingApplicationService.java | 102 +++
.../DocumentTypeApplicationService.java | 174 ++++
.../MappingMethodApplicationService.java | 100 +++
.../PaymentManageApplicationService.java | 110 +++
.../PaymentOrderApplicationService.java | 118 +++
.../PaymentWalletApplicationService.java | 136 ++++
.../ReceiptManageApplicationService.java | 131 +++
.../FormQueryManageApplicationService.java | 134 +++
.../FormQueryParamsApplicationService.java | 90 ++
.../ReportFormApplicationService.java | 768 ++++++++++++++++++
...SettlementCustomersApplicationService.java | 313 +++++++
.../TaskFlowRecordsApplicationService.java | 180 ++++
.../domain/billManage/entity/BillDetail.java | 78 ++
.../domain/billManage/entity/BillManage.java | 186 +++++
.../repository/facade/IBillDetailService.java | 41 +
.../repository/facade/IBillManageService.java | 43 +
.../repository/mapper/BillDetailMapper.java | 20 +
.../repository/mapper/BillManageMapper.java | 22 +
.../persistence/BillDetailImpl.java | 78 ++
.../persistence/BillManageImpl.java | 81 ++
.../repository/po/BillDetailPO.java | 124 +++
.../repository/po/BillManagePO.java | 197 +++++
.../repository/todo/BillDetailDO.java | 81 ++
.../repository/todo/BillManageDO.java | 208 +++++
.../service/BillDetailDomainService.java | 155 ++++
.../service/BillManageDomainService.java | 506 ++++++++++++
.../entity/BillOperationLog.java | 54 ++
.../facade/IBillOperationLogService.java | 48 ++
.../mapper/BillOperationLogMapper.java | 23 +
.../persistence/BillOperationLogImpl.java | 89 ++
.../repository/po/BillOperationLogPO.java | 54 ++
.../repository/todo/BillOperationLogDO.java | 61 ++
.../BillOperationLogDomainService.java | 164 ++++
.../billingRules/entity/BillingParams.java | 64 ++
.../billingRules/entity/BillingRules.java | 94 +++
.../facade/IBillingParamsService.java | 48 ++
.../facade/IBillingRulesService.java | 43 +
.../mapper/BillingParamsMapper.java | 23 +
.../repository/mapper/BillingRulesMapper.java | 22 +
.../persistence/BillingParamsImpl.java | 86 ++
.../persistence/BillingRulesImpl.java | 83 ++
.../repository/po/BillingParamsPO.java | 91 +++
.../repository/po/BillingRulesPO.java | 97 +++
.../repository/todo/BillingParamsDO.java | 68 ++
.../repository/todo/BillingRulesDO.java | 107 +++
.../service/BillingParamsDomainService.java | 139 ++++
.../service/BillingRulesDomainService.java | 184 +++++
.../entity/BillingStatement.java | 192 +++++
.../facade/IBillingStatementService.java | 59 ++
.../mapper/BillingStatementMapper.java | 45 +
.../persistence/BillingStatementImpl.java | 109 +++
.../po/BillingStatementCollectPO.java | 68 ++
.../repository/po/BillingStatementPO.java | 199 +++++
.../todo/BillingStatementCollectDO.java | 58 ++
.../repository/todo/BillingStatementDO.java | 224 +++++
.../BillingStatementDomainService.java | 511 ++++++++++++
.../entity/BusinessDocument.java | 173 ++++
.../facade/IBusinessDocumentService.java | 45 +
.../mapper/BusinessDocumentMapper.java | 22 +
.../persistence/BusinessDocumentImpl.java | 96 +++
.../repository/po/BusinessDocumentPO.java | 177 ++++
.../repository/todo/BusinessDocumentDO.java | 197 +++++
.../BusinessDocumentDomainService.java | 196 +++++
.../entity/ConditionalMapping.java | 58 ++
.../facade/IConditionalMappingService.java | 43 +
.../mapper/ConditionalMappingMapper.java | 22 +
.../persistence/ConditionalMappingImpl.java | 81 ++
.../repository/po/ConditionalMappingPO.java | 58 ++
.../repository/todo/ConditionalMappingDO.java | 61 ++
.../ConditionalMappingDomainService.java | 64 ++
.../entity/BillingOutputEntity.java | 27 +
.../entity/BillingParamsEntity.java | 38 +
.../costCalculation/po/BillingCostPo.java | 34 +
.../entity/DocumentFromEntity.java | 31 +
.../documentType/entity/DocumentType.java | 70 ++
.../facade/IDocumentTypeService.java | 43 +
.../repository/mapper/DocumentTypeMapper.java | 22 +
.../persistence/DocumentTypeImpl.java | 81 ++
.../repository/po/DocumentTypePO.java | 70 ++
.../repository/todo/DocumentTypeDO.java | 84 ++
.../service/DocumentTypeDomainService.java | 74 ++
.../mappingMethod/entity/MappingMethod.java | 58 ++
.../facade/IMappingMethodService.java | 43 +
.../mapper/MappingMethodMapper.java | 22 +
.../persistence/MappingMethodImpl.java | 81 ++
.../repository/po/MappingMethodPO.java | 58 ++
.../repository/todo/MappingMethodDO.java | 64 ++
.../service/MappingMethodDomainService.java | 76 ++
.../paymentManage/entity/PaymentManage.java | 50 ++
.../facade/IPaymentManageService.java | 43 +
.../mapper/PaymentManageMapper.java | 22 +
.../persistence/PaymentManageImpl.java | 81 ++
.../repository/po/PaymentManagePO.java | 50 ++
.../repository/todo/PaymentManageDO.java | 53 ++
.../service/PaymentManageDomainService.java | 83 ++
.../paymentOrder/entity/PaymentOrder.java | 112 +++
.../entity/PaymentOrderDetails.java | 69 ++
.../facade/IPaymentOrderDetailsService.java | 45 +
.../facade/IPaymentOrderService.java | 45 +
.../mapper/PaymentOrderDetailsMapper.java | 18 +
.../repository/mapper/PaymentOrderMapper.java | 23 +
.../persistence/PaymentOrderDetailsImpl.java | 94 +++
.../persistence/PaymentOrderImpl.java | 86 ++
.../repository/po/PaymentOrderDetailsPO.java | 69 ++
.../repository/po/PaymentOrderPO.java | 117 +++
.../repository/todo/PaymentOrderDO.java | 129 +++
.../todo/PaymentOrderDetailsDO.java | 76 ++
.../PaymentOrderDetailsDomainService.java | 78 ++
.../service/PaymentOrderDomainService.java | 315 +++++++
.../paymentWallet/entity/PaymentWallet.java | 74 ++
.../facade/IPaymentWalletService.java | 43 +
.../mapper/PaymentWalletMapper.java | 22 +
.../persistence/PaymentWalletImpl.java | 81 ++
.../repository/po/PaymentWalletPO.java | 74 ++
.../repository/todo/PaymentWalletDO.java | 77 ++
.../service/PaymentWalletDomainService.java | 64 ++
.../receiptManage/entity/ReceiptDetail.java | 82 ++
.../receiptManage/entity/ReceiptManage.java | 139 ++++
.../facade/IReceiptDetailService.java | 43 +
.../facade/IReceiptManageService.java | 49 ++
.../mapper/ReceiptDetailMapper.java | 22 +
.../mapper/ReceiptManageMapper.java | 28 +
.../persistence/ReceiptDetailImpl.java | 81 ++
.../persistence/ReceiptManageImpl.java | 92 +++
.../repository/po/ReceiptDetailPO.java | 142 ++++
.../repository/po/ReceiptManagePO.java | 144 ++++
.../repository/todo/ReceiptDetailDO.java | 85 ++
.../repository/todo/ReceiptManageDO.java | 168 ++++
.../service/ReceiptDetailDomainService.java | 100 +++
.../service/ReceiptManageDomainService.java | 315 +++++++
.../reportForm/entity/FormQueryManage.java | 56 ++
.../reportForm/entity/FormQueryParams.java | 75 ++
.../domain/reportForm/entity/ReportForm.java | 66 ++
.../facade/IFormQueryManageService.java | 46 ++
.../facade/IFormQueryParamsService.java | 45 +
.../repository/facade/IReportFormService.java | 43 +
.../mapper/FormQueryManageMapper.java | 22 +
.../mapper/FormQueryParamsMapper.java | 23 +
.../repository/mapper/ReportFormMapper.java | 22 +
.../persistence/FormQueryManageImpl.java | 100 +++
.../persistence/FormQueryParamsImpl.java | 86 ++
.../persistence/ReportFormImpl.java | 81 ++
.../repository/po/FormQueryManagePO.java | 59 ++
.../repository/po/FormQueryParamsPO.java | 77 ++
.../repository/po/ReportFormPO.java | 68 ++
.../repository/todo/FormQueryManageDO.java | 64 ++
.../repository/todo/FormQueryParamsDO.java | 82 ++
.../repository/todo/ReportFormDO.java | 72 ++
.../service/FormQueryManageDomainService.java | 127 +++
.../service/FormQueryParamsDomainService.java | 141 ++++
.../service/ReportFormDomainService.java | 93 +++
.../entity/SettlementCustomers.java | 95 +++
.../facade/ISettlementCustomersService.java | 48 ++
.../mapper/SettlementCustomersMapper.java | 27 +
.../persistence/SettlementCustomersImpl.java | 91 +++
.../repository/po/SettlementCustomersPO.java | 95 +++
.../todo/SettlementCustomersDO.java | 107 +++
.../SettlementCustomersDomainService.java | 87 ++
.../entity/TaskFlowRecords.java | 134 +++
.../facade/ITaskFlowRecordsService.java | 43 +
.../mapper/TaskFlowRecordsMapper.java | 22 +
.../persistence/TaskFlowRecordsImpl.java | 81 ++
.../repository/po/TaskFlowRecordsPO.java | 134 +++
.../repository/todo/TaskFlowRecordsDO.java | 148 ++++
.../service/TaskFlowRecordsDomainService.java | 86 ++
.../constant/BillLogsConstants.java | 99 +++
.../feign/vo/ContractManageDetailPO.java | 100 +++
.../feign/vo/ContractManagePO.java | 172 ++++
.../feign/vo/ExpenseAccountPO.java | 105 +++
.../feign/vo/ServiceItemsManagePO.java | 57 ++
.../utils/CheckPasswordUtil.java | 65 ++
.../utils/DynamicCalculationUtil.java | 41 +
.../infrastructure/utils/UniqueKeyUtil.java | 20 +
.../com/mhd/bms/interfaces/JobApi/JobApi.java | 33 +
.../billManage/BillDetailAssembler.java | 65 ++
.../billManage/BillManageAssembler.java | 86 ++
.../BillOperationLogAssembler.java | 65 ++
.../billingRules/BillingParamsAssembler.java | 65 ++
.../billingRules/BillingRulesAssembler.java | 65 ++
.../BillingStatementAssembler.java | 105 +++
.../BusinessDocumentAssembler.java | 83 ++
.../ConditionalMappingAssembler.java | 65 ++
.../documentType/DocumentTypeAssembler.java | 65 ++
.../mappingMethod/MappingMethodAssembler.java | 65 ++
.../paymentManage/PaymentManageAssembler.java | 65 ++
.../paymentOrder/PaymentOrderAssembler.java | 65 ++
.../PaymentOrderDetailsAssembler.java | 65 ++
.../paymentWallet/PaymentWalletAssembler.java | 65 ++
.../receiptManage/ReceiptDetailAssembler.java | 65 ++
.../receiptManage/ReceiptManageAssembler.java | 65 ++
.../reportForm/FormQueryManageAssembler.java | 65 ++
.../reportForm/FormQueryParamsAssembler.java | 65 ++
.../reportForm/ReportFormAssembler.java | 65 ++
.../SettlementCustomersAssembler.java | 65 ++
.../TaskFlowRecordsAssembler.java | 65 ++
.../dto/billManage/BillDetailDTO.java | 127 +++
.../dto/billManage/BillManageDTO.java | 214 +++++
.../billOperationLog/BillOperationLogDTO.java | 56 ++
.../dto/billingRules/BillingParamsDTO.java | 68 ++
.../dto/billingRules/BillingRulesDTO.java | 108 +++
.../dto/billingRules/CostCalculationDTO.java | 42 +
.../BillingStatementCollectDTO.java | 57 ++
.../billingStatement/BillingStatementDTO.java | 230 ++++++
.../businessDocument/BusinessDocumentDTO.java | 199 +++++
.../ConditionalMappingDTO.java | 64 ++
.../dto/documentType/DocumentTypeDTO.java | 82 ++
.../dto/mappingMethod/MappingMethodDTO.java | 64 ++
.../dto/paymentManage/PaymentManageDTO.java | 56 ++
.../dto/paymentOrder/PaymentOrderDTO.java | 128 +++
.../paymentOrder/PaymentOrderDetailsDTO.java | 73 ++
.../dto/paymentWallet/PaymentWalletDTO.java | 80 ++
.../dto/receiptManage/ReceiptDetailDTO.java | 85 ++
.../dto/receiptManage/ReceiptManageDTO.java | 167 ++++
.../dto/reportForm/FormQueryManageDTO.java | 61 ++
.../dto/reportForm/FormQueryParamsDTO.java | 82 ++
.../dto/reportForm/ReportFormDTO.java | 69 ++
.../SettlementCustomersDTO.java | 105 +++
.../taskFlowRecords/TaskFlowRecordsDTO.java | 151 ++++
.../interfaces/facadeApi/BillManageApi.java | 284 +++++++
.../facadeApi/BillOperationLogApi.java | 99 +++
.../interfaces/facadeApi/BillingRulesApi.java | 120 +++
.../facadeApi/BillingStatementApi.java | 330 ++++++++
.../facadeApi/BusinessDocumentApi.java | 219 +++++
.../facadeApi/ConditionalMappingApi.java | 93 +++
.../facadeApi/CostCalculationApi.java | 45 +
.../interfaces/facadeApi/DocumentTypeApi.java | 118 +++
.../facadeApi/FormQueryManageApi.java | 96 +++
.../facadeApi/FormQueryParamsApi.java | 84 ++
.../facadeApi/MappingMethodApi.java | 102 +++
.../facadeApi/PaymentManageApi.java | 115 +++
.../interfaces/facadeApi/PaymentOrderApi.java | 157 ++++
.../facadeApi/PaymentWalletApi.java | 114 +++
.../facadeApi/ReceiptManageApi.java | 185 +++++
.../interfaces/facadeApi/ReportFormApi.java | 145 ++++
.../facadeApi/SettlementCustomersApi.java | 134 +++
.../facadeApi/TaskFlowRecordsApi.java | 97 +++
mhd_bms/src/main/resources/bootstrap.yml | 33 +
.../resources/mapper/BillDetailMapper.xml | 31 +
.../resources/mapper/BillManageMapper.xml | 76 ++
.../mapper/BillOperationLogMapper.xml | 67 ++
.../resources/mapper/BillingParamsMapper.xml | 82 ++
.../resources/mapper/BillingRulesMapper.xml | 105 +++
.../mapper/BillingStatementMapper.xml | 257 ++++++
.../mapper/BusinessDocumentMapper.xml | 191 +++++
.../mapper/ConditionalMappingMapper.xml | 34 +
.../resources/mapper/DocumentTypeMapper.xml | 94 +++
.../mapper/FormQueryManageMapper.xml | 32 +
.../mapper/FormQueryParamsMapper.xml | 41 +
.../resources/mapper/MappingMethodMapper.xml | 31 +
.../resources/mapper/PaymentManageMapper.xml | 50 ++
.../mapper/PaymentOrderDetailsMapper.xml | 7 +
.../resources/mapper/PaymentOrderMapper.xml | 58 ++
.../resources/mapper/PaymentWalletMapper.xml | 80 ++
.../resources/mapper/ReceiptDetailMapper.xml | 64 ++
.../resources/mapper/ReceiptManageMapper.xml | 99 +++
.../resources/mapper/ReportFormMapper.xml | 33 +
.../mapper/SettlementCustomersMapper.xml | 112 +++
.../mapper/TaskFlowRecordsMapper.xml | 157 ++++
267 files changed, 27070 insertions(+)
create mode 100644 mhd_bms/Dockerfile
create mode 100644 mhd_bms/pom.xml
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/BmsServiceApplication.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/billOperationLog/BillOperationLogApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/BillingRulesApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/CostCalculationApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/conditionalMapping/ConditionalMappingApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/documentType/DocumentTypeApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/mappingMethod/MappingMethodApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/paymentManage/PaymentManageApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/paymentOrder/PaymentOrderApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/paymentWallet/PaymentWalletApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryManageApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryParamsApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/ReportFormApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/taskFlowRecords/TaskFlowRecordsApplicationService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillDetail.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/entity/BillManage.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillDetailService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillManageService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillDetailImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillDetailPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/po/BillManagePO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillDetailDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillDetailDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billManage/service/BillManageDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/entity/BillOperationLog.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/facade/IBillOperationLogService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/mapper/BillOperationLogMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/persistence/BillOperationLogImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/po/BillOperationLogPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/repository/todo/BillOperationLogDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billOperationLog/service/BillOperationLogDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/entity/BillingParams.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/entity/BillingRules.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/facade/IBillingParamsService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/facade/IBillingRulesService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/mapper/BillingParamsMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/mapper/BillingRulesMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/persistence/BillingParamsImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/persistence/BillingRulesImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/po/BillingParamsPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/po/BillingRulesPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/todo/BillingParamsDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/repository/todo/BillingRulesDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/service/BillingParamsDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingRules/service/BillingRulesDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/facade/IBillingStatementService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/mapper/BillingStatementMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/persistence/BillingStatementImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementCollectPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementCollectDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/facade/IBusinessDocumentService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/mapper/BusinessDocumentMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/persistence/BusinessDocumentImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/po/BusinessDocumentPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/todo/BusinessDocumentDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/service/BusinessDocumentDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/conditionalMapping/entity/ConditionalMapping.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/conditionalMapping/repository/facade/IConditionalMappingService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/conditionalMapping/repository/mapper/ConditionalMappingMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/conditionalMapping/repository/persistence/ConditionalMappingImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/conditionalMapping/repository/po/ConditionalMappingPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/conditionalMapping/repository/todo/ConditionalMappingDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/conditionalMapping/service/ConditionalMappingDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/costCalculation/entity/BillingOutputEntity.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/costCalculation/entity/BillingParamsEntity.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/costCalculation/po/BillingCostPo.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/entity/DocumentFromEntity.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/entity/DocumentType.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/repository/facade/IDocumentTypeService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/repository/mapper/DocumentTypeMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/repository/persistence/DocumentTypeImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/repository/po/DocumentTypePO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/repository/todo/DocumentTypeDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/documentType/service/DocumentTypeDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/mappingMethod/entity/MappingMethod.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/mappingMethod/repository/facade/IMappingMethodService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/mappingMethod/repository/mapper/MappingMethodMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/mappingMethod/repository/persistence/MappingMethodImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/mappingMethod/repository/po/MappingMethodPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/mappingMethod/repository/todo/MappingMethodDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/mappingMethod/service/MappingMethodDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentManage/entity/PaymentManage.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentManage/repository/facade/IPaymentManageService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentManage/repository/mapper/PaymentManageMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentManage/repository/persistence/PaymentManageImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentManage/repository/po/PaymentManagePO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentManage/repository/todo/PaymentManageDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentManage/service/PaymentManageDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/entity/PaymentOrder.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/entity/PaymentOrderDetails.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/facade/IPaymentOrderDetailsService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/facade/IPaymentOrderService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/mapper/PaymentOrderDetailsMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/mapper/PaymentOrderMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/persistence/PaymentOrderDetailsImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/persistence/PaymentOrderImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/po/PaymentOrderDetailsPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/po/PaymentOrderPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/todo/PaymentOrderDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/repository/todo/PaymentOrderDetailsDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/service/PaymentOrderDetailsDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentOrder/service/PaymentOrderDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentWallet/entity/PaymentWallet.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentWallet/repository/facade/IPaymentWalletService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentWallet/repository/mapper/PaymentWalletMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentWallet/repository/persistence/PaymentWalletImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentWallet/repository/po/PaymentWalletPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentWallet/repository/todo/PaymentWalletDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/paymentWallet/service/PaymentWalletDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/entity/ReceiptDetail.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/entity/ReceiptManage.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/facade/IReceiptDetailService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/facade/IReceiptManageService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/mapper/ReceiptDetailMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/mapper/ReceiptManageMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/persistence/ReceiptDetailImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/persistence/ReceiptManageImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/po/ReceiptDetailPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/po/ReceiptManagePO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/todo/ReceiptDetailDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/repository/todo/ReceiptManageDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/service/ReceiptDetailDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/receiptManage/service/ReceiptManageDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/entity/FormQueryManage.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/entity/FormQueryParams.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/entity/ReportForm.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/facade/IFormQueryManageService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/facade/IFormQueryParamsService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/facade/IReportFormService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/mapper/FormQueryManageMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/mapper/FormQueryParamsMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/mapper/ReportFormMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/persistence/FormQueryManageImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/persistence/FormQueryParamsImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/persistence/ReportFormImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/po/FormQueryManagePO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/po/FormQueryParamsPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/po/ReportFormPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/todo/FormQueryManageDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/todo/FormQueryParamsDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/repository/todo/ReportFormDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/service/FormQueryManageDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/service/FormQueryParamsDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/reportForm/service/ReportFormDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/facade/ISettlementCustomersService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/mapper/SettlementCustomersMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/persistence/SettlementCustomersImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/service/SettlementCustomersDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/taskFlowRecords/entity/TaskFlowRecords.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/taskFlowRecords/repository/facade/ITaskFlowRecordsService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/taskFlowRecords/repository/mapper/TaskFlowRecordsMapper.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/taskFlowRecords/repository/persistence/TaskFlowRecordsImpl.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/taskFlowRecords/repository/po/TaskFlowRecordsPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/taskFlowRecords/repository/todo/TaskFlowRecordsDO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/taskFlowRecords/service/TaskFlowRecordsDomainService.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/constant/BillLogsConstants.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/feign/vo/ContractManageDetailPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/feign/vo/ContractManagePO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/feign/vo/ExpenseAccountPO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/feign/vo/ServiceItemsManagePO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/utils/CheckPasswordUtil.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/utils/DynamicCalculationUtil.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/infrastructure/utils/UniqueKeyUtil.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/JobApi/JobApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/billManage/BillDetailAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/billManage/BillManageAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/billOperationLog/BillOperationLogAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/billingRules/BillingParamsAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/billingRules/BillingRulesAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/billingStatement/BillingStatementAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/businessDocument/BusinessDocumentAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/conditionalMapping/ConditionalMappingAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/documentType/DocumentTypeAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/mappingMethod/MappingMethodAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/paymentManage/PaymentManageAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/paymentOrder/PaymentOrderAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/paymentOrder/PaymentOrderDetailsAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/paymentWallet/PaymentWalletAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/receiptManage/ReceiptDetailAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/receiptManage/ReceiptManageAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/reportForm/FormQueryManageAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/reportForm/FormQueryParamsAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/reportForm/ReportFormAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomers/SettlementCustomersAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/taskFlowRecords/TaskFlowRecordsAssembler.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillDetailDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billOperationLog/BillOperationLogDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingRules/BillingParamsDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingRules/BillingRulesDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingRules/CostCalculationDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementCollectDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/conditionalMapping/ConditionalMappingDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/documentType/DocumentTypeDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/mappingMethod/MappingMethodDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/paymentManage/PaymentManageDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/paymentOrder/PaymentOrderDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/paymentOrder/PaymentOrderDetailsDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/paymentWallet/PaymentWalletDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/receiptManage/ReceiptDetailDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/receiptManage/ReceiptManageDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/reportForm/FormQueryManageDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/reportForm/FormQueryParamsDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/reportForm/ReportFormDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/taskFlowRecords/TaskFlowRecordsDTO.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillOperationLogApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingRulesApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BusinessDocumentApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/ConditionalMappingApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/CostCalculationApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/DocumentTypeApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/FormQueryManageApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/FormQueryParamsApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/MappingMethodApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/PaymentManageApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/PaymentOrderApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/PaymentWalletApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/ReceiptManageApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/ReportFormApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersApi.java
create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/TaskFlowRecordsApi.java
create mode 100644 mhd_bms/src/main/resources/bootstrap.yml
create mode 100644 mhd_bms/src/main/resources/mapper/BillDetailMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/BillManageMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/BillOperationLogMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/BillingParamsMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/BillingRulesMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/BusinessDocumentMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/ConditionalMappingMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/DocumentTypeMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/FormQueryManageMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/FormQueryParamsMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/MappingMethodMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/PaymentManageMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/PaymentOrderDetailsMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/PaymentOrderMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/PaymentWalletMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/ReceiptDetailMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/ReceiptManageMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/ReportFormMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml
create mode 100644 mhd_bms/src/main/resources/mapper/TaskFlowRecordsMapper.xml
diff --git a/mhd_bms/Dockerfile b/mhd_bms/Dockerfile
new file mode 100644
index 000000000..04fc6ed22
--- /dev/null
+++ b/mhd_bms/Dockerfile
@@ -0,0 +1,17 @@
+# 基础镜像
+FROM kdvolder/jdk8
+# author
+MAINTAINER manhuoda
+#指定东八区时区
+ENV TZ Asia/Shanghai
+#指定utf-8编码格
+ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
+# VOLUME 指定了临时文件目录为/tmp。
+# 其效果是在主机 /var/lib/docker 目录下创建了一个临时文件,并链接到容器的/tmp
+VOLUME /tmp
+#将当前jar 复制到容器根目录下
+ADD mhd_bms.jar mhd_bms.jar
+#暴露容器端口 Docker镜像告知Docker宿主机应用监听了端口
+EXPOSE 8019
+# 运行jar包
+ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Xms1000m", "-Xmx1500m","-jar","/mhd_bms.jar"]
diff --git a/mhd_bms/pom.xml b/mhd_bms/pom.xml
new file mode 100644
index 000000000..bc3d095d1
--- /dev/null
+++ b/mhd_bms/pom.xml
@@ -0,0 +1,177 @@
+
+
+
+ mhd
+ com.mhd
+ 3.6.0
+
+ 4.0.0
+
+ mhd_bms
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+
+
+ io.github.openfeign
+ feign-httpclient
+
+
+ org.springframework.cloud
+ spring-cloud-loadbalancer
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+ com.alibaba.csp
+ sentinel-datasource-nacos
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+ org.springframework.cloud
+ spring-cloud-stream
+
+
+ org.springframework.cloud
+ spring-cloud-starter-stream-rabbit
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+
+ com.alibaba.fastjson2
+ fastjson2
+
+
+
+ com.mhd
+ mhd-common-core
+
+
+
+ com.mhd
+ mhd-common-redis
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ 1.2.11
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.4
+ provided
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.3.2
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-sleuth
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-zipkin
+ 2.2.8.RELEASE
+
+
+
+
+ com.mhd
+ mhd-common-security
+
+
+
+ com.mhd
+ mhd-common-log
+
+
+
+
+ jep
+ jep
+ 2.24
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.1.1.RELEASE
+
+
+
+ repackage
+
+
+
+
+
+
+
+
+ 8
+ 8
+
+
+
+ mhd_bms
+
+
+
+ com.spotify
+ dockerfile-maven-plugin
+
+
+
+
+
+
diff --git a/mhd_bms/src/main/java/com/mhd/bms/BmsServiceApplication.java b/mhd_bms/src/main/java/com/mhd/bms/BmsServiceApplication.java
new file mode 100644
index 000000000..47202aba8
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/BmsServiceApplication.java
@@ -0,0 +1,21 @@
+package com.mhd.bms;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+@SpringBootApplication(scanBasePackages = {"com.mhd"})
+@EnableDiscoveryClient
+@EnableFeignClients(basePackages = {"com.mhd"})
+@MapperScan("com.mhd.bms.domain.**.mapper")
+@EnableAsync
+public class BmsServiceApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(BmsServiceApplication.class, args);
+ }
+
+}
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
new file mode 100644
index 000000000..ff58b8a28
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java
@@ -0,0 +1,494 @@
+package com.mhd.bms.application.server.billManage;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.mhd.bms.application.server.billingStatement.BillingStatementApplicationService;
+import com.mhd.bms.application.server.receiptManage.ReceiptManageApplicationService;
+import com.mhd.bms.domain.billManage.entity.BillDetail;
+import com.mhd.bms.domain.billManage.entity.BillManage;
+import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService;
+import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
+import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
+import com.mhd.bms.domain.billManage.repository.todo.BillDetailDO;
+import com.mhd.bms.domain.billManage.repository.todo.BillManageDO;
+import com.mhd.bms.domain.billManage.service.BillDetailDomainService;
+import com.mhd.bms.domain.billManage.service.BillManageDomainService;
+import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO;
+import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService;
+import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
+import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
+import com.mhd.bms.domain.paymentOrder.repository.po.PaymentOrderPO;
+import com.mhd.bms.domain.paymentOrder.repository.todo.PaymentOrderDO;
+import com.mhd.bms.domain.paymentOrder.service.PaymentOrderDomainService;
+import com.mhd.bms.domain.receiptManage.repository.po.ReceiptDetailPO;
+import com.mhd.bms.domain.receiptManage.repository.po.ReceiptManagePO;
+import com.mhd.bms.domain.receiptManage.service.ReceiptManageDomainService;
+import com.mhd.bms.infrastructure.constant.BillLogsConstants;
+import com.mhd.bms.interfaces.assembler.billManage.BillManageAssembler;
+import com.mhd.bms.interfaces.dto.billManage.BillDetailDTO;
+import com.mhd.bms.interfaces.dto.billManage.BillManageDTO;
+import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.OrderSequence;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 账单管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-02
+ */
+@Service
+@Slf4j
+public class BillManageApplicationService {
+ @Autowired
+ private BillManageDomainService billManageDomainService;
+ @Autowired
+ private BillingStatementDomainService billingStatementDomainService;
+ @Autowired
+ private BillDetailDomainService billDetailDomainService;
+ @Autowired
+ private BillingStatementApplicationService billingStatementApplicationService;
+ @Autowired
+ private BillOperationLogDomainService billOperationLogDomainService;
+ @Autowired
+ private ReceiptManageDomainService receiptManageDomainService;
+ @Autowired
+ private PaymentOrderDomainService paymentOrderDomainService;
+
+
+ /**
+ * 分页查询账单管理列表
+ */
+
+ public List queryList(BillManageDO billManageDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ billManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return billManageDomainService.queryList(billManageDO);
+ }
+
+
+ /**
+ * 新增账单管理
+ */
+ public Boolean insert(BillManageDO billManageDO) {
+ return billManageDomainService.insert(billManageDO);
+ }
+
+ /**
+ * 修改账单管理
+ */
+ public Boolean update(BillManageDO billManageDO) {
+ return billManageDomainService.update(billManageDO);
+ }
+
+ /**
+ * 批量删除账单管理
+ */
+ public boolean delete(Long[] billManageIds) {
+ return billManageDomainService.delete(billManageIds);
+ }
+
+ /**
+ * 获取账单管理详细信息
+ */
+ public BillManagePO getInfo(Long billManageId)
+ {
+ return billManageDomainService.getInfo(billManageId);
+ }
+
+
+ /**
+ * 保存账单
+ */
+ public Boolean saveBill(BillingStatementDTO billingStatementDTO) {
+ return billManageDomainService.save(billingStatementDTO);
+ }
+
+ /**
+ * 批量删除账单管理
+ */
+ @Transactional
+ public Boolean deleteByIds(BillManageDTO billManageDTO) {
+ if(!StringUtils.isNotEmpty(billManageDTO.getBillManageIds())){
+ throw new ServiceException("账单管理ids不能为空");
+ }
+ Set billManageIds = Stream.of(billManageDTO.getBillManageIds().split(",")).collect(Collectors.toSet());
+ Long[] billManageIdsLong = billManageIds.stream().map(Long::valueOf).toArray(Long[]::new);
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.in(BillManage::getBillManageId,billManageIds);
+ List billManageList = billManageDomainService.queryListLambda(queryWrapper);
+ //校验状态,如果不是未确认状态,则不允许作废
+ for (BillManage billManage : billManageList) {
+ if(billManage.getBillState() != 6){
+ throw new ServiceException("选中数据"+ billManage.getBillNumber() + "状态不为未作废,不可操作删除");
+ }
+ }
+ //校验通过删除明细
+ boolean flag = billDetailDomainService.deletByManageIds(billManageIds);
+ boolean flagTwo = billManageDomainService.delete(billManageIdsLong);
+ //保存账单操作记录
+ BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
+ billOperationLogDO.setBillManageIdSet(billManageIds);
+ billOperationLogDO.setOperationInfo(BillLogsConstants.delete_bill_text);
+ billOperationLogDO.setOperationType(9);
+ boolean three = billOperationLogDomainService.saveBillOperationLogBatch(billOperationLogDO);
+ return flag && flagTwo && three;
+ }
+
+ /**
+ * 批量作废账单
+ */
+ @Transactional
+ public Boolean nullifyByIds(BillManageDTO billManageDTO) {
+ if(!StringUtils.isNotEmpty(billManageDTO.getBillManageIds())){
+ throw new ServiceException("账单管理ids不能为空");
+ }
+ Set billManageIds = Stream.of(billManageDTO.getBillManageIds().split(",")).collect(Collectors.toSet());
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.in(BillManage::getBillManageId,billManageIds);
+ List billManageList = billManageDomainService.queryListLambda(queryWrapper);
+ //校验状态,如果不是未确认状态,则不允许作废
+ for (BillManage billManage : billManageList) {
+ if(billManage.getBillState() != 1){
+ throw new ServiceException("选中数据"+ billManage.getBillNumber() + "状态不为未确认,不可操作作废");
+ }
+ }
+ //符合条件后,账单作废,且计费流水状态还原到已审核状态
+ Boolean flag = billManageDomainService.nullifyByIds(billManageIds);
+ //查询账单包含所有计费流水
+ List billDetailList = billDetailDomainService.queryByLambda(new LambdaQueryWrapper().in(BillDetail::getBillManageId,billManageIds));
+ Set billingStatementIds = billDetailList.stream().map(BillDetail::getBillingStatementId).collect(Collectors.toSet());
+ Boolean flagTwo = billingStatementDomainService.billNullify(billingStatementIds);
+ return flag && flagTwo;
+ }
+
+ /**
+ * 发起对账
+ */
+ @Transactional
+ public Boolean reconciliation(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() != 1){
+ throw new ServiceException("选中数据"+ billManage.getBillNumber() + "状态不为未确认,不可操作发起对账");
+ }
+ }
+ //发起对账
+ return billManageDomainService.reconciliation(billManageDO);
+ }
+
+ /**
+ * 确认账单
+ */
+ @Transactional
+ public Boolean confirmBilling(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() + "状态不可操作确认账单");
+ }
+ }
+ return billManageDomainService.confirmBilling(billManageDO);
+ }
+
+ /**
+ * 查询对账详情
+ */
+ public BillManagePO getInfoById(BillManageDTO billManageDTO) {
+
+ BillManagePO billManagePO = billManageDomainService.getInfo(billManageDTO.getBillManageId());
+ if(billManagePO == null){
+ throw new ServiceException("账单信息不存在");
+ }
+ List billDetailPOList = billDetailDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
+ billManagePO.setBillDetailPOList(billDetailPOList);
+ return billManagePO;
+ }
+
+ /**
+ * 调整账单
+ */
+ @Transactional
+ public Boolean confirmChangeBill(BillManageDTO billManageDTO) {
+ /*
+ 删除该账单的所有明细,并将所有新数据新增并绑定当前账单,并重新计算账单总额,与传来的是否一致,如果不一致则进行报错,如果一致,则修改账单总额信息
+ */
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ if(billManageDTO.getBillDetailDTOList()==null || billManageDTO.getBillDetailDTOList().size()==0){
+ throw new ServiceException("账单明细不能为空");
+ }
+ BillManagePO billManagePO = billManageDomainService.getInfo(billManageDTO.getBillManageId());
+ if(null == billManagePO){
+ throw new ServiceException("账单信息未找到");
+ }
+ if(billManagePO.getBillState() != 1){
+ throw new ServiceException("账单状态不为未确认,不可操作调整账单");
+ }
+ List billDetailDTOList = billManageDTO.getBillDetailDTOList();
+ Boolean deleteFlag = billDetailDomainService.removeByBillManageId(billManageDTO.getBillManageId());
+ if(!deleteFlag){
+ throw new ServiceException("调整失败,请重试");
+ }
+ //计算集合中所有账单总额、账单金额、账单优惠金额
+ BigDecimal billingTotalAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal billingAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal billingDiscountAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+ //比较传来的账单总额、账单金额、账单优惠金额与计算的是否一致,不一致则报错
+ if(billingTotalAmount.compareTo(billManageDTO.getBillTotalAmount())!=0 || billingAmount.compareTo(billManageDTO.getBillAmount())!=0 || billingDiscountAmount.compareTo(billManageDTO.getBillDiscountAmount())!=0){
+ throw new ServiceException("账单金额不一致,调整失败,请重试");
+ }
+ //将集合中没有计费流水id的过滤到另一个集合,将添加费用的集合保存到计费流水并返回计费流水id
+ List billDetailDTOListNoBillingStatementId = billDetailDTOList.stream().filter(billDetailDTO -> billDetailDTO.getBillingStatementId()==null).collect(Collectors.toList());
+ //遍历集合并保存流水
+ for (BillDetailDTO billDetailDTO : billDetailDTOListNoBillingStatementId) {
+ BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
+ BeanUtils.copyProperties(billDetailDTO,billingStatementDTO);
+ billingStatementDTO.setAccountExpenseType(billDetailDTO.getBillType());
+ Long billingStatementId = billingStatementApplicationService.insertAndReturnId(billingStatementDTO);
+ //遍历billDetailDTOList集合,将计费流水号相同的,赋值计费流水id
+ billDetailDTOList.stream().filter(item -> item.getBillingFlow().equals(billDetailDTO.getBillingFlow())).forEach(billDetailDTO1 -> {
+ billDetailDTO1.setBillingStatementId(billingStatementId);
+ billDetailDTO1.setBillType(billManagePO.getBillType());
+ billDetailDTO1.setBillManageId(billManagePO.getBillManageId());
+ billDetailDTO1.setBillNumber(billManagePO.getBillNumber());
+ });
+ }
+ //保存账单明细
+ Boolean flag = billDetailDomainService.saveBatch(billDetailDTOList);
+ //更新账单金额
+ BillManageDO billManageDO = new BillManageDO();
+ BeanUtils.copyProperties(billManagePO,billManageDO);
+ billManageDO.setBillAmount(billingAmount);
+ billManageDO.setBillAmountUnsettled(billingAmount);
+ billManageDO.setBillDiscountAmount(billingDiscountAmount);
+ billManageDO.setBillTotalAmount(billingTotalAmount);
+ billManageDO.setCostAccuracyCode(billManageDTO.getCostAccuracyCode());
+ billManageDO.setTailCalculationCode(billManageDTO.getTailCalculationCode());
+ billManageDO.setAmountAccuracyCode(billManageDTO.getAmountAccuracyCode());
+ billManageDO.setBillDiscount(billManageDTO.getBillDiscount());
+ billManageDO.setBillDiscountLimit(billManageDTO.getBillDiscountLimit());
+ billManageDO.setCreateTime(billManageDTO.getCreateTime());
+ billManageDO.setUpdateTime(new Date());
+ billManageDO.setUpdateBy(loginUser.getUserid());
+ billManageDO.setUpdateByName(loginUser.getUserPo().getUserName());
+ billManageDomainService.handlData(billManageDO);
+ Boolean flagTwo = billManageDomainService.update(billManageDO);
+ //调整账单操作日志
+ BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
+ billOperationLogDO.setBillManageId(billManageDO.getBillManageId());
+ billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.change_bill_text, billManageDO.getBillAmount()));
+ billOperationLogDO.setOperationType(2);
+ boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
+ return flag && flagTwo && three;
+ }
+
+ /**
+ * 应收账单-客户确认
+ */
+ @Transactional
+ public Boolean customerConfirmation(BillManageDTO billManageDTO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ BillManagePO billManagePO = billManageDomainService.getInfo(billManageDTO.getBillManageId());
+ if(null == billManagePO){
+ throw new ServiceException("账单信息未找到");
+ }
+ if(billManageDTO.getBillDetailDTOList()==null || billManageDTO.getBillDetailDTOList().size()==0){
+ throw new ServiceException("账单明细不能为空");
+ }
+ if(billManagePO.getBillState() != 2 || billManagePO.getBillStep() != 2){
+ throw new ServiceException("账单状态错误,不可操作客户确认");
+ }
+ List billDetailDTOList = billManageDTO.getBillDetailDTOList();
+ //更新账单金额
+ BillManageDO billManageDO = new BillManageDO();
+ billManageDO.setBillManageId(billManagePO.getBillManageId());
+ billManageDO.setReconciliationStatus(billManageDTO.getReconciliationStatus());
+ billManageDO.setReconciliationOpinion(billManageDTO.getReconciliationOpinion());
+ billManageDO.setVoucherAddress(billManageDTO.getVoucherAddress());
+ billManageDO.setBillStep(3);
+ billManageDO.setUpdateTime(new Date());
+ billManageDO.setUpdateBy(loginUser.getUserid());
+ billManageDO.setUpdateByName(loginUser.getUserPo().getUserName());
+ //只有申请调账,才去修改明细
+ Boolean flag = true;
+ String operationInfo = BillLogsConstants.customer_confirm_text_one;
+ if(billManageDTO.getReconciliationStatus() == 2){
+ flag = billDetailDomainService.changeAmount(billDetailDTOList);
+ //计算集合期望金额
+ BigDecimal billExpectedAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingExpectedAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+ billManageDO.setBillExpectedAmount(billExpectedAmount);
+ operationInfo = StringUtils.format(BillLogsConstants.customer_confirm_text_two,billManageDTO.getReconciliationOpinion(),billExpectedAmount);
+ }
+ //保存操作记录
+ BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
+ billOperationLogDO.setBillManageId(billManageDO.getBillManageId());
+ billOperationLogDO.setOperationInfo(operationInfo);
+ billOperationLogDO.setOperationType(5);
+ Boolean flagTwo = billManageDomainService.update(billManageDO);
+ Boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
+ return flag && flagTwo && three;
+ }
+
+
+ /**
+ * 财务审核
+ */
+ public Boolean financialReview(BillManageDTO billManageDTO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ BillManagePO billManagePO = billManageDomainService.getInfo(billManageDTO.getBillManageId());
+ if(null == billManagePO){
+ throw new ServiceException("账单信息未找到");
+ }
+ if(billManageDTO.getBillDetailDTOList()==null || billManageDTO.getBillDetailDTOList().size()==0){
+ throw new ServiceException("账单明细不能为空");
+ }
+ if(billManagePO.getBillState() != 2 || billManagePO.getBillStep() != 3 || (billManagePO.getReconciliationStatus() != 4 && billManagePO.getReconciliationStatus() != 2)){
+ throw new ServiceException("账单状态错误,不可操作审核");
+ }
+ List billDetailDTOList = billManageDTO.getBillDetailDTOList();
+ //只有审核拒绝,才去修改明细
+ Boolean flag = billDetailDomainService.changeAmount(billDetailDTOList);
+
+ //计算集合中所有账单总额、账单金额、账单优惠金额
+ BigDecimal billingTotalAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal billingAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal billingDiscountAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ //更新账单金额
+ BillManageDO billManageDO = new BillManageDO();
+ billManageDO.setBillManageId(billManagePO.getBillManageId());
+ billManageDO.setReconciliationStatus(billManageDTO.getReconciliationStatus());
+ billManageDO.setReconciliationOpinion(billManageDTO.getReconciliationOpinion());
+ billManageDO.setFinancialReviewOpinion(billManageDTO.getFinancialReviewOpinion());
+ billManageDO.setBillAmount(billingAmount);
+ billManageDO.setBillAmountUnsettled(billingAmount);
+ billManageDO.setBillDiscountAmount(billingDiscountAmount);
+ billManageDO.setBillTotalAmount(billingTotalAmount);
+ billManageDO.setCostAccuracyCode(billManageDTO.getCostAccuracyCode());
+ billManageDO.setTailCalculationCode(billManageDTO.getTailCalculationCode());
+ billManageDO.setAmountAccuracyCode(billManageDTO.getAmountAccuracyCode());
+ billManageDO.setBillDiscount(billManageDTO.getBillDiscount());
+ billManageDO.setBillDiscountLimit(billManageDTO.getBillDiscountLimit());
+ billManageDO.setUpdateTime(new Date());
+ billManageDO.setUpdateBy(loginUser.getUserid());
+ billManageDO.setUpdateByName(loginUser.getUserPo().getUserName());
+ billManageDO.setFinancialReviewFlag(billManageDTO.getFinancialReviewFlag());
+ billManageDomainService.handlData(billManageDO);
+ String operationInfo = "";
+ if(billManageDTO.getFinancialReviewFlag()==1){
+ //同意审核
+ billManageDO.setReconciliationStatus(4);
+ billManageDO.setBillStep(4);
+ billManageDO.setBillState(3);
+ operationInfo = StringUtils.format(BillLogsConstants.financial_review_text_one,billManageDO.getFinancialReviewOpinion(),billManageDO.getBillAmount());
+ }else {
+ //拒绝审核
+ billManageDO.setReconciliationStatus(1);
+ billManageDO.setBillStep(2);
+ operationInfo = StringUtils.format(BillLogsConstants.financial_review_text_two,billManageDO.getFinancialReviewOpinion(),billManageDO.getBillAmount());
+ }
+ //保存操作记录
+ BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
+ billOperationLogDO.setBillManageId(billManageDO.getBillManageId());
+ billOperationLogDO.setOperationInfo(operationInfo);
+ billOperationLogDO.setOperationType(6);
+ Boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
+ Boolean flagTwo = billManageDomainService.update(billManageDO);
+ return flag && flagTwo && three;
+ }
+
+
+ /**
+ * 获取账单详情
+ */
+ public Map getDetailsById(BillManageDTO billManageDTO) {
+ //该详情由三部分组成:账单信息、收款信息、操作日志
+ if(billManageDTO.getBillManageId() == null){
+ throw new ServiceException("账单id不能为空");
+ }
+ Map result = new HashMap<>();
+ BillManagePO billManagePO = billManageDomainService.getDetailsById(billManageDTO.getBillManageId());
+ result.put("billManage",billManagePO);
+ if(billManagePO.getBillType()==1){
+ List receiptManagePOList = receiptManageDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
+ result.put("billPayment",receiptManagePOList);
+ }else {
+ List paymentOrderPOList = paymentOrderDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
+ result.put("billPayment",paymentOrderPOList);
+ }
+ result.put("billOperationLog",billOperationLogDomainService.getDetailsById(billManageDTO.getBillManageId()));
+ return result;
+ }
+
+ /**
+ * 列表查询统计
+ */
+ public Map listCount(BillManageDO billManageDO) {
+ Map result = new HashMap<>();
+ result.put("all","0");
+ result.put("uncleared","0");
+ result.put("settled","0");
+ result.put("invalid","0");
+ billManageDO.setQueryParam(0);
+ List billManagePOList = queryList(billManageDO);
+ //过滤出账单状态billState<5的为uncleared
+ long uncleared = billManagePOList.stream().filter(billManagePO -> billManagePO.getBillState() < 5).count();
+ long settled = billManagePOList.stream().filter(billManagePO -> billManagePO.getBillState() == 5).count();
+ long invalid = billManagePOList.stream().filter(billManagePO -> billManagePO.getBillState() == 6).count();
+ result.put("all", String.valueOf(billManagePOList.size()));
+ result.put("uncleared",String.valueOf(uncleared));
+ result.put("settled",String.valueOf(settled));
+ result.put("invalid",String.valueOf(invalid));
+ return result;
+ }
+
+
+
+
+
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billOperationLog/BillOperationLogApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billOperationLog/BillOperationLogApplicationService.java
new file mode 100644
index 000000000..0f37ced97
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billOperationLog/BillOperationLogApplicationService.java
@@ -0,0 +1,72 @@
+package com.mhd.bms.application.server.billOperationLog;
+
+import com.mhd.bms.domain.billOperationLog.repository.po.BillOperationLogPO;
+import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO;
+import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.List;
+/**
+ * 账单操作日志ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-09
+ */
+@Service
+@Slf4j
+public class BillOperationLogApplicationService {
+ @Autowired
+ private BillOperationLogDomainService billOperationLogDomainService;
+
+
+ /**
+ * 分页查询账单操作日志列表
+ */
+
+ public List queryList(BillOperationLogDO billOperationLogDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ billOperationLogDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return billOperationLogDomainService.queryList(billOperationLogDO);
+ }
+
+
+ /**
+ * 新增账单操作日志
+ */
+ public Boolean insert(BillOperationLogDO billOperationLogDO) {
+
+ return billOperationLogDomainService.insert(billOperationLogDO);
+ }
+
+ /**
+ * 修改账单操作日志
+ */
+ public Boolean update(BillOperationLogDO billOperationLogDO) {
+ return billOperationLogDomainService.update(billOperationLogDO);
+ }
+
+ /**
+ * 批量删除账单操作日志
+ */
+ public boolean delete(Long[] billOperationLogIds) {
+ return billOperationLogDomainService.delete(billOperationLogIds);
+ }
+
+ /**
+ * 获取账单操作日志详细信息
+ */
+ public BillOperationLogPO getInfo(Long billOperationLogId)
+ {
+ return billOperationLogDomainService.getInfo(billOperationLogId);
+ }
+
+
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/BillingRulesApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/BillingRulesApplicationService.java
new file mode 100644
index 000000000..53d08e7b2
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/BillingRulesApplicationService.java
@@ -0,0 +1,167 @@
+package com.mhd.bms.application.server.billingRules;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.mhd.bms.domain.billingRules.repository.po.BillingRulesPO;
+import com.mhd.bms.domain.billingRules.repository.todo.BillingParamsDO;
+import com.mhd.bms.domain.billingRules.repository.todo.BillingRulesDO;
+import com.mhd.bms.domain.billingRules.service.BillingParamsDomainService;
+import com.mhd.bms.domain.billingRules.service.BillingRulesDomainService;
+import com.mhd.bms.interfaces.dto.billingRules.BillingRulesDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 计费规则ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-12
+ */
+@Service
+@Slf4j
+public class BillingRulesApplicationService {
+ @Autowired
+ private BillingRulesDomainService billingRulesDomainService;
+ @Autowired
+ private BillingParamsDomainService billingParamsDomainService;
+
+
+ /**
+ * 分页查询计费规则列表
+ */
+
+ public List queryList(BillingRulesDO billingRulesDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ billingRulesDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return billingRulesDomainService.queryList(billingRulesDO);
+ }
+
+
+ /**
+ * 新增计费规则
+ */
+ @Transactional
+ public Boolean insert(BillingRulesDO billingRulesDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ if(billingRulesDO.getBillingParamsDTOList()==null || billingRulesDO.getBillingParamsDTOList().size()==0){
+ throw new ServiceException("计费参数不能为空");
+ }
+ //校验计费规则编码是否重复
+ BillingRulesPO billingRulesPO = billingRulesDomainService.getInfoByCode(billingRulesDO.getBillingRulesCode());
+ if (ObjectUtil.isNotEmpty(billingRulesPO)) {
+ throw new ServiceException("计费规则编码重复");
+ }
+ //保存计费规则
+ boolean flag = billingRulesDomainService.insert(billingRulesDO);
+ //保存计费参数(计费参数在表单中缓存,在最终提交时保存)
+ boolean flagTwo = billingParamsDomainService.saveBillParam(billingRulesDO);
+ return flag && flagTwo;
+ }
+
+
+ /**
+ * 修改计费规则
+ */
+ public Boolean update(BillingRulesDO billingRulesDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ if(billingRulesDO.getBillingParamsDTOList()==null || billingRulesDO.getBillingParamsDTOList().size()==0){
+ throw new ServiceException("计费参数不能为空");
+ }
+ //校验计费规则编码是否重复
+ BillingRulesPO billingRulesPO = billingRulesDomainService.getInfoByCode(billingRulesDO.getBillingRulesCode());
+ if (billingRulesPO != null && !Objects.equals(billingRulesPO.getBillingRulesId(), billingRulesDO.getBillingRulesId())) {
+ throw new ServiceException("计费规则编码重复");
+ }
+ //更新计费规则
+ boolean flag = billingRulesDomainService.update(billingRulesDO);
+ //更新计费参数(计费参数在表单中缓存,在最终提交时保存)
+ boolean flagTwo = billingParamsDomainService.updateBillParam(billingRulesDO);
+ return flag && flagTwo;
+ }
+
+ /**
+ * 批量删除计费规则
+ */
+ public boolean delete(Long[] billingRulesIds) {
+ return billingRulesDomainService.delete(billingRulesIds);
+ }
+
+ /**
+ * 获取计费规则详细信息
+ */
+ public BillingRulesPO getInfo(Long billingRulesId)
+ {
+ if(null == billingRulesId){
+ throw new ServiceException("计费规则id不能为空");
+ }
+ return billingRulesDomainService.getInfo(billingRulesId);
+ }
+
+
+ /**
+ * 根据id删除
+ */
+ public Boolean deleteByIds(BillingRulesDTO billingRulesDTO) {
+ if(!StringUtils.isNotEmpty(billingRulesDTO.getBillingRulesIds())){
+ throw new ServiceException("选中计费规则不能为空");
+ }
+ Set billingRulesIdSet = Stream.of(billingRulesDTO.getBillingRulesIds().split(",")).collect(Collectors.toSet());
+ Long[] billingRulesIds = billingRulesIdSet.stream().map(Long::valueOf).toArray(Long[]::new);
+ return billingRulesDomainService.delete(billingRulesIds);
+ }
+
+ /**
+ * 修改计费规则状态
+ */
+ public Boolean changeStates(BillingRulesDTO billingRulesDTO) {
+ if(billingRulesDTO.getBillingRulesId() == null){
+ throw new ServiceException("计费规则id不能为空");
+ }
+ return billingRulesDomainService.changeStates(billingRulesDTO);
+ }
+
+
+ /**
+ * 根据id查询计费规则信息
+ */
+ public BillingRulesPO getInfoById(BillingRulesDTO billingRulesDTO) {
+ if(billingRulesDTO.getBillingRulesId() == null){
+ throw new ServiceException("计费规则id不能为空");
+ }
+ return billingRulesDomainService.getInfoById(billingRulesDTO.getBillingRulesId());
+ }
+
+ /**
+ * 根据编码查询计费规则信息
+ */
+ public BillingRulesPO getInfoByCode(String billingRulesCode) {
+ if(StringUtils.isEmpty(billingRulesCode)){
+ throw new ServiceException("计费策略编码不能为空");
+ }
+ return billingRulesDomainService.getInfoByCode(billingRulesCode);
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/CostCalculationApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/CostCalculationApplicationService.java
new file mode 100644
index 000000000..71c83d8cb
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingRules/CostCalculationApplicationService.java
@@ -0,0 +1,340 @@
+package com.mhd.bms.application.server.billingRules;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.mhd.bms.domain.billingRules.repository.po.BillingParamsPO;
+import com.mhd.bms.domain.billingRules.repository.po.BillingRulesPO;
+import com.mhd.bms.domain.billingRules.service.BillingParamsDomainService;
+import com.mhd.bms.domain.billingRules.service.BillingRulesDomainService;
+import com.mhd.bms.domain.costCalculation.entity.BillingOutputEntity;
+import com.mhd.bms.domain.costCalculation.entity.BillingParamsEntity;
+import com.mhd.bms.domain.costCalculation.po.BillingCostPo;
+import com.mhd.bms.domain.documentType.entity.DocumentType;
+import com.mhd.bms.domain.documentType.repository.po.DocumentTypePO;
+import com.mhd.bms.domain.documentType.service.DocumentTypeDomainService;
+import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
+import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService;
+import com.mhd.bms.domain.taskFlowRecords.repository.todo.TaskFlowRecordsDO;
+import com.mhd.bms.domain.taskFlowRecords.service.TaskFlowRecordsDomainService;
+import com.mhd.bms.infrastructure.feign.vo.ContractManageDetailPO;
+import com.mhd.bms.infrastructure.feign.vo.ContractManagePO;
+import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO;
+import com.mhd.bms.infrastructure.utils.DynamicCalculationUtil;
+import com.mhd.bms.interfaces.dto.billingRules.CostCalculationDTO;
+import com.mhd.common.core.domain.po.UserRoleMenuPO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.OrderSequence;
+import com.mhd.common.core.utils.RegexUtil;
+import com.mhd.common.core.web.domain.AjaxResult;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.SystemServiceFeign;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ * 费用计算
+ *
+ */
+@Service
+@Slf4j
+public class CostCalculationApplicationService {
+
+ @Autowired
+ private SystemServiceFeign systemServiceFeign;
+ @Autowired
+ private BillingRulesDomainService billingRulesDomainService;
+ @Autowired
+ private BillingParamsDomainService billingParamsDomainService;
+ @Autowired
+ private TaskFlowRecordsDomainService taskFlowRecordsDomainService;
+ @Autowired
+ private DocumentTypeDomainService documentTypeDomainService;
+ @Autowired
+ private SettlementCustomersDomainService settlementCustomersDomainService;
+
+
+
+ /**
+ * 费用计算器
+ */
+ public BillingCostPo costCalculation(CostCalculationDTO costCalculationDTO) {
+ /* 1:根据合同编码查询合同并根据费用科目,获取计费策略,查询计费策略计算对应的字段,判断传来的计费参数必填项是否完整
+ 2:根据计费策略公式进行替换,并根据配置的公式计算结果
+ 3:产生计费任务记录
+ */
+ //获取当前登录人信息
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ BillingCostPo result = new BillingCostPo();
+ BeanUtils.copyProperties(costCalculationDTO, result);
+ TaskFlowRecordsDO taskFlowRecordsDO = new TaskFlowRecordsDO();
+ //第一步 根据合同编码查询合同并根据费用科目,获取计费策略,查询计费策略计算对应的字段,判断传来的计费参数必填项是否完整
+ BillingRulesPO billingRulesPO = chooseBillingParams(costCalculationDTO,taskFlowRecordsDO);
+
+ //第二步 根据计费策略公式进行替换,并根据配置的公式计算结果
+ BigDecimal computationalCost = computational(billingRulesPO,costCalculationDTO,taskFlowRecordsDO);
+ result.setComputationalCost(computationalCost);
+
+ //第三步 产生计费任务记录
+ taskFlowRecordsDO.setBillingResults(computationalCost.toString());
+ taskFlowRecordsDO.setTaskFlow(OrderSequence.getOrderCode("JFRW"));
+ taskFlowRecordsDO.setRequestParams(JSON.toJSONString(costCalculationDTO));
+ taskFlowRecordsDO.setOriginalBusinessNum(costCalculationDTO.getOriginalBusinessNum());
+ Boolean flag = taskFlowRecordsDomainService.saveInCost(taskFlowRecordsDO);
+ if (!flag) {
+ throw new ServiceException("计费任务记录保存失败,请重试");
+ }
+
+ return result;
+ }
+
+
+ /**
+ * 校验必填,并获取本次计算合适的计费参数公式
+ * @param costCalculationDTO 计算参数
+ * @return 计费规则实体
+ */
+ private BillingRulesPO chooseBillingParams(CostCalculationDTO costCalculationDTO,TaskFlowRecordsDO taskFlowRecordsDO) {
+ //获取合同信息
+ AjaxResult ajaxResult = systemServiceFeign.getInfoByCode(costCalculationDTO.getContractNumber());
+ if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("合同信息未找到");
+ }
+ ContractManagePO contractPO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContractManagePO.class);
+ if (null == contractPO) {
+ throw new ServiceException("合同信息未找到");
+ }
+ if(contractPO.getContractManageDetailPOList() == null || contractPO.getContractManageDetailPOList().size() == 0){
+ throw new ServiceException("合同详情列表为空,无法进行计算");
+ }
+
+ //查询单据信息
+ DocumentType documentType = documentTypeDomainService.queryByCode(costCalculationDTO.getDocumentTypeCode());
+ if(documentType == null){
+ throw new ServiceException("单据类型未找到");
+ }
+ //遍历费用科目取出对应配置的费用科目项
+ AjaxResult expenseAccountAjax = systemServiceFeign.getSubInfoByCode(costCalculationDTO.getSubjectCode());
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("费用科目不存在或已被删除");
+ }
+ ExpenseAccountPO expenseAccountPO = JSON.parseObject(JSONObject.toJSONString(expenseAccountAjax.get("data")), ExpenseAccountPO.class);
+ if (null == expenseAccountPO) {
+ throw new ServiceException("费用科目信息未找到");
+ }
+ ContractManageDetailPO contractManageDetailPO = null;
+ //如果是一级科目
+ if(expenseAccountPO.getFirstSubjectFlag()==1){
+ contractManageDetailPO = contractPO.getContractManageDetailPOList().stream().filter(item -> ObjectUtil.equal(item.getFirstSubjectCode(),costCalculationDTO.getSubjectCode())).findAny().orElse(null);
+ taskFlowRecordsDO.setFirstSubjectCode(expenseAccountPO.getSubjectCode());
+ taskFlowRecordsDO.setFirstSubjectName(expenseAccountPO.getSubjectName());
+ }else {
+ contractManageDetailPO = contractPO.getContractManageDetailPOList().stream().filter(item -> ObjectUtil.equal(item.getSecondSubjectCode(),costCalculationDTO.getSubjectCode())).findAny().orElse(null);
+ taskFlowRecordsDO.setFirstSubjectCode(expenseAccountPO.getUpperSubjectCode());
+ taskFlowRecordsDO.setFirstSubjectName(expenseAccountPO.getUpperSubject());
+ taskFlowRecordsDO.setSecondSubjectCode(expenseAccountPO.getSubjectCode());
+ taskFlowRecordsDO.setSecondSubjectName(expenseAccountPO.getSubjectName());
+ }
+ if(null == contractManageDetailPO){
+ throw new ServiceException("合同中不包含该费用科目的计费策略,请查正后重试");
+ }
+ //根据计费策略查询计费规则信息
+ BillingRulesPO billingRulesPO = billingRulesDomainService.getInfo(contractManageDetailPO.getAccountingStrategyId());
+ if(null == billingRulesPO){
+ throw new ServiceException("计费策略信息未找到");
+ }
+ //查询计费参数表获取参数字段,并判断所需字段是否必填
+ List billingParamsPOList = billingParamsDomainService.getInfoByRuleId(billingRulesPO.getBillingRulesId());
+ //先默认一个计费规则中有一个计费参数表
+ if(billingParamsPOList ==null || billingParamsPOList.size() != 1){
+ throw new ServiceException("计费规则未配置计费参数或参数不合规");
+ }
+ //校验计算参数是否完整
+ BillingParamsPO billingParamsPO = billingParamsPOList.get(0);
+ //使用反射校验字段必填是否完整
+ List billingParamsEntityList = JSON.parseArray(billingParamsPO.getBillingParamsJson(), BillingParamsEntity.class);
+ JSONObject paramObj = JSONObject.parseObject(costCalculationDTO.getFormJson());
+ billingParamsEntityList.forEach(item -> {
+ if(paramObj.get(item.getFields()) == null){
+ throw new ServiceException("计费参数"+ item.getFields() +"不能为空");
+ }
+ });
+ billingRulesPO.setBillingParamsPOList(billingParamsPOList);
+ //查询结算对象信息
+ if(contractPO.getSettlementCustomersId() != null){
+ SettlementCustomersPO settlementCustomersPO = settlementCustomersDomainService.getInfo(contractPO.getSettlementCustomersId());
+ if(null != settlementCustomersPO){
+ taskFlowRecordsDO.setSettlementCustomersId(settlementCustomersPO.getSettlementCustomersId());
+ taskFlowRecordsDO.setSettlementEntity(settlementCustomersPO.getSettlementEntity());
+ taskFlowRecordsDO.setMainRole(settlementCustomersPO.getMainRole());
+ }
+ }
+ taskFlowRecordsDO.setBelongModule(documentType.getBelongModule());
+ taskFlowRecordsDO.setBelongModuleCode(documentType.getBelongModuleCode());
+ taskFlowRecordsDO.setDocumentTypeId(documentType.getDocumentTypeId());
+ taskFlowRecordsDO.setDocumentType(documentType.getDocumentType());
+ taskFlowRecordsDO.setDocumentTypeCode(documentType.getDocumentTypeCode());
+ taskFlowRecordsDO.setContractName(contractPO.getContractName());
+ taskFlowRecordsDO.setContractNumber(contractPO.getContractNumber());
+ taskFlowRecordsDO.setBillingRulesId(billingRulesPO.getBillingRulesId());
+ taskFlowRecordsDO.setBillingRulesCode(billingRulesPO.getBillingRulesCode());
+ taskFlowRecordsDO.setBillingRules(billingRulesPO.getBillingRulesName());
+ return billingRulesPO;
+ }
+
+
+ /**
+ * 根据计费公式、计费参数 计算费用
+ * @param billingRulesPO 计费策略
+ * @param costCalculationDTO 计费参数
+ * @param taskFlowRecordsDO 计费任务实体
+ * @return 计费金额
+ */
+ private BigDecimal computational(BillingRulesPO billingRulesPO, CostCalculationDTO costCalculationDTO, TaskFlowRecordsDO taskFlowRecordsDO) {
+ String billingFormula = billingRulesPO.getBillingFormula();
+ //第一版先默认计费规则中只有一条计费参数
+ BillingParamsPO billingParamsPO = billingRulesPO.getBillingParamsPOList().get(0);
+ JSONObject paramObj = JSONObject.parseObject(costCalculationDTO.getFormJson());
+ //需要判断阶梯类型进行获取各计费标志的取值,拼接公式
+ List billingParamsEntityList = JSON.parseArray(billingParamsPO.getBillingParamsJson(), BillingParamsEntity.class);
+ //将计费参数实体分成两组,即:固定参数和条件参数
+ List fixedParamsEntityList = billingParamsEntityList.stream().filter(item -> ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
+ List ladderParamsEntityList = billingParamsEntityList.stream().filter(item -> !ObjectUtil.equal(item.getLadderType(),1)).collect(Collectors.toList());
+ //获取输出字段
+ List billingOutputEntityList = JSON.parseArray(billingParamsPO.getBillingOutputJson(), BillingOutputEntity.class);
+ //获取预制规则
+ String preSetRules = billingParamsPO.getPreSetRules();
+ //获取字段序号下,所有有值的预置规则
+ JSONArray preSetRulesArray = JSONArray.parseArray(preSetRules);
+
+ //==============固定参数直接替换===============
+ if(fixedParamsEntityList.size()>0){
+ for (BillingParamsEntity billingParamsEntity : fixedParamsEntityList) {
+ String flagValue = paramObj.getString(billingParamsEntity.getFields());
+ //替换计费公式中的代号
+ billingFormula = billingFormula.replace(billingParamsEntity.getChargingId(), flagValue);
+ }
+ }
+
+ //=============条件参数需要根据条件满足情况取值预置规则中的数据===========
+ if(ladderParamsEntityList.size() > 0){
+ if(preSetRulesArray.size()==0){
+ throw new ServiceException("阶梯计算没有预置规则,请检查后重试");
+ }
+ BillingParamsEntity ladderParamsEntity = ladderParamsEntityList.stream().filter(item -> item.getLadderType()>2).findAny().orElse(null);
+ //循环预置规则,根据条件参数,找出满足条件的唯一规则,并替换公式
+ JSONObject ladderParams = new JSONObject();
+ for (Object rule : preSetRulesArray) {
+ JSONObject jsonObject = (JSONObject) rule;
+ //参数集合map
+ Map params = new HashMap<>();
+ for (BillingParamsEntity billingParamsEntity : ladderParamsEntityList) {
+ String flagValue = paramObj.getString(billingParamsEntity.getFields());
+ params.put("fields"+billingParamsEntity.getSort(), flagValue);
+ }
+ if(null != ladderParamsEntity){
+ //有特殊阶梯时,需要对特殊阶梯特殊处理
+ String ladderParam = "fields" + ladderParamsEntity.getSort();
+ //先满足阶梯,在判断无阶梯
+ String ladderNum = params.get(ladderParam);
+ String outLadderNum = jsonObject.get(ladderParam).toString();
+ if(determineParam(ladderNum,outLadderNum)){
+ //将该特殊阶梯从jsonObject集合中移除
+// jsonObject.remove(ladderParam);
+ ladderParams = jsonObject;
+ break;
+ }
+ }
+ else {
+ //全部是无阶梯时
+ //判断jsonObject中的取值是否和参数集合paramObj中的值一致
+ if(params.values().containsAll(jsonObject.values())){
+ ladderParams = jsonObject;
+ break;
+ }
+ }
+ }
+ for (BillingParamsEntity billingParamsEntity : ladderParamsEntityList) {
+ String flagValue = ladderParams.getString("outFields" + billingParamsEntity.getSort());
+ //替换计费公式中的代号
+ billingFormula = billingFormula.replace(billingParamsEntity.getChargingId(), flagValue);
+ }
+ //拿到满足条件的预置规则后,替换输出字段,和输入字段
+ if(billingOutputEntityList.size()>0){
+ for (BillingOutputEntity billingOutputEntity : billingOutputEntityList) {
+ //获取输出字段的序号,并取对应序号下的
+ String outFields = ladderParams.getString("outFields" + billingOutputEntity.getSort());
+ //替换公式
+ billingFormula = billingFormula.replace(billingOutputEntity.getOutChargingId(), outFields);
+ }
+ }
+ }
+ else {
+ //==================没有条件参数的时候,也要过滤输出字段,输出字段直接替换===============
+ if(billingOutputEntityList.size()>0){
+ if(preSetRulesArray.size()==0){
+ throw new ServiceException("输出字段没有预置规则,请检查后重试");
+ }
+ //直接取值输出字段对应的预置规则信息,没有条件参数时,预置规则默认只取第一条
+ JSONObject jsonObject = preSetRulesArray.getJSONObject(0);
+ for (BillingOutputEntity billingOutputEntity : billingOutputEntityList) {
+ //获取输出字段的序号,并取对应序号下的
+ String outFields = jsonObject.getString("outFields" + billingOutputEntity.getSort());
+ //替换公式
+ billingFormula = billingFormula.replace(billingOutputEntity.getOutChargingId(), outFields);
+ }
+ }
+ }
+ //这里用正则校验是否还含有英文或者汉字
+ if(RegexUtil.isEngOrChinese(billingFormula)){
+ throw new ServiceException("计费公式不合规,请重试");
+ }
+ taskFlowRecordsDO.setBillingProcess(billingFormula);
+ //用拼接好的公式,计算
+ return DynamicCalculationUtil.calculate(billingFormula);
+ }
+
+ /**
+ * 判断阶梯参数是否满足
+ * @param ladderNum 传来的阶梯参数
+ * @param outLadderNum 预置规则参数
+ * @return 是否满足
+ */
+ private boolean determineParam(String ladderNum, String outLadderNum) {
+ int ladderNumInt = Integer.parseInt(ladderNum);
+ //将outLadderNum中的 (替换为>, )替换为<,[替换为<=,]替换为>=,并且判断ladderNum是否在条件范围中
+ //将数值用逗号拆分
+ int lowerBound = Integer.parseInt(outLadderNum.substring(1, outLadderNum.indexOf(',')));
+ int upperBound = Integer.parseInt(outLadderNum.substring(outLadderNum.indexOf(',') + 1, outLadderNum.length() - 1));
+
+ if(outLadderNum.contains("(") && outLadderNum.contains("]")){
+ if(ladderNumInt > lowerBound && ladderNumInt <= upperBound){
+ return true;
+ }
+ }
+ if(outLadderNum.contains("[") && outLadderNum.contains(")")){
+ if(ladderNumInt >= lowerBound && ladderNumInt < upperBound){
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+}
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
new file mode 100644
index 000000000..ed74c5807
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java
@@ -0,0 +1,501 @@
+package com.mhd.bms.application.server.billingStatement;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.mhd.bms.application.server.billManage.BillManageApplicationService;
+import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
+import com.mhd.bms.domain.billManage.service.BillManageDomainService;
+import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementCollectPO;
+import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
+import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementCollectDO;
+import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
+import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
+import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO;
+import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
+import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService;
+import com.mhd.bms.infrastructure.feign.vo.ContractManagePO;
+import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO;
+import com.mhd.bms.interfaces.assembler.billingStatement.BillingStatementAssembler;
+import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO;
+import com.mhd.common.core.domain.po.OrganizationPo;
+import com.mhd.common.core.domain.po.SysDictDataVo;
+import com.mhd.common.core.domain.po.projectManagement.ProjectManagementPO;
+import com.mhd.common.core.enums.DictCode;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.OrderSequence;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.core.web.domain.AjaxResult;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.ProductServiceFeign;
+import com.mhd.system.api.SystemServiceFeign;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 计费流水ApplicationService
+ *
+ * @author gen
+ * @date 2024-06-26
+ */
+@Service
+@Slf4j
+public class BillingStatementApplicationService {
+ @Autowired
+ private BillingStatementDomainService billingStatementDomainService;
+ @Autowired
+ private ProductServiceFeign productServiceFeign;
+ @Autowired
+ private SystemServiceFeign systemServiceFeign;
+ @Autowired
+ private SettlementCustomersDomainService settlementCustomersDomainService;
+ @Autowired
+ private BillManageApplicationService billManageApplicationService;
+ @Autowired
+ private BillManageDomainService billManageDomainService;
+
+
+ /**
+ * 分页查询计费流水列表
+ */
+
+ public List queryList(BillingStatementDO billingStatementDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null) {
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1) {
+ billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return billingStatementDomainService.queryList(billingStatementDO);
+ }
+
+ /**
+ * 查询出账汇总
+ */
+ public List queryCollectList(BillingStatementCollectDO billingStatementCollectDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null) {
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1) {
+ billingStatementCollectDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return billingStatementDomainService.queryCollectList(billingStatementCollectDO);
+ }
+
+ /**
+ * 查询出账未出账全部
+ */
+ public Map collectListSize(BillingStatementCollectDO billingStatementCollectDO) {
+ Map map = new HashMap<>();
+ map.put("notBeen","0");
+ map.put("been","0");
+ map.put("all","0");
+ billingStatementCollectDO.setBillingState(0);
+ List all = queryCollectList(billingStatementCollectDO);
+ //统计出all集合中billingStateCount字段中含有的1和2的数量
+ long notBeen = all.stream().filter(billingStatementCollectPO -> billingStatementCollectPO.getBillingStateCount().contains("1") || billingStatementCollectPO.getBillingStateCount().contains("2")).count();
+ //统计出all集合中billingStateCount字段中含有的3的数量
+ long been = all.stream().filter(billingStatementCollectPO -> billingStatementCollectPO.getBillingStateCount().contains("3")).count();
+ map.put("notBeen",String.valueOf(notBeen));
+ map.put("been",String.valueOf(been));
+ map.put("all", String.valueOf(all.size()));
+ return map;
+ }
+
+ /**
+ * 查询出账详情
+ */
+ public List queryDetails(BillingStatementCollectDO bdo) {
+ return billingStatementDomainService.queryDetails(bdo);
+ }
+
+
+ /**
+ * 新增计费流水
+ */
+ public Boolean insert(BillingStatementDO billingStatementDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //处理数据
+ handleDate(billingStatementDO);
+
+ billingStatementDO.setDataSources(2);
+ billingStatementDO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
+ billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ billingStatementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ billingStatementDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ return billingStatementDomainService.insert(billingStatementDO);
+ }
+
+ /**
+ * 处理数据
+ */
+ private void handleDate(BillingStatementDO billingStatementDO) {
+ if (billingStatementDO.getOrganizationId() != null) {
+ //获取组织信息
+ AjaxResult ajaxResult = productServiceFeign.getOrganizationInfo(billingStatementDO.getOrganizationId());
+ if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("选中组织信息未找到");
+ }
+ OrganizationPo organizationPo = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), OrganizationPo.class);
+ if (null == organizationPo) {
+ throw new ServiceException("组织信息未找到");
+ }
+ billingStatementDO.setOrganizationName(organizationPo.getOrganizationName());
+ billingStatementDO.setTopOrganizationId(organizationPo.getParentOrganizationId());
+ }
+ //根据费用科目code查询费用信息,并赋值
+ if (StringUtils.isNotEmpty(billingStatementDO.getSecondSubjectCode())) {
+ AjaxResult ajaxResult = systemServiceFeign.getSubInfoByCode(billingStatementDO.getSecondSubjectCode());
+ if ("200".equals(String.valueOf(ajaxResult.get("code")))) {
+ ExpenseAccountPO expenseAccountPO = JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), ExpenseAccountPO.class);
+ if (null == expenseAccountPO) {
+ throw new ServiceException("费用科目信息未找到");
+ }
+ if (expenseAccountPO.getFirstSubjectFlag() == 1) {
+ //如果是一级科目
+ billingStatementDO.setFirstSubjectName(expenseAccountPO.getSubjectName());
+ billingStatementDO.setFirstSubjectCode(expenseAccountPO.getSubjectCode());
+ billingStatementDO.setSecondSubjectCode("");
+ billingStatementDO.setSecondSubjectName("");
+ } else {
+ //不是一级科目
+ billingStatementDO.setFirstSubjectName(expenseAccountPO.getUpperSubject());
+ billingStatementDO.setFirstSubjectCode(expenseAccountPO.getUpperSubjectCode());
+ billingStatementDO.setSecondSubjectCode(expenseAccountPO.getSubjectCode());
+ billingStatementDO.setSecondSubjectName(expenseAccountPO.getSubjectName());
+ }
+ billingStatementDO.setBelongModuleCode(expenseAccountPO.getBelongModuleCode());
+ billingStatementDO.setBelongModule(expenseAccountPO.getBelongModule());
+ }
+ }
+ //根据结算对象id查询结算对象数据,并赋值
+ if (StringUtils.isNotEmpty(billingStatementDO.getSettlementCustomersCode())) {
+ SettlementCustomers settlementCustomers = settlementCustomersDomainService.queryByCode(billingStatementDO.getSettlementCustomersCode());
+ if (null != settlementCustomers) {
+ billingStatementDO.setSettlementCustomersCode(settlementCustomers.getSettlementCustomersCode());
+ billingStatementDO.setSettlementEntity(settlementCustomers.getSettlementEntity());
+ billingStatementDO.setSettlementCustomersId(settlementCustomers.getSettlementCustomersId());
+ }
+ }
+ //根据费用类型id查询费用类型对象数据,并赋值
+ if (StringUtils.isNotEmpty(billingStatementDO.getServiceItemsCode())) {
+ AjaxResult ajaxResult = systemServiceFeign.getServiceItemsByCode(billingStatementDO.getServiceItemsCode());
+ if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("费用类型未找到");
+ }
+ billingStatementDO.setServiceItemsManageId(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getLong("serviceItemsManageId"));
+ billingStatementDO.setServiceItemsName(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getString("serviceItemsName"));
+ }
+ //根据合同编码查询合同信息,并赋值
+ if (StringUtils.isNotEmpty(billingStatementDO.getContractNumber())) {
+ AjaxResult ajaxResult = systemServiceFeign.getInfoByCode(billingStatementDO.getContractNumber());
+ if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("合同信息未找到");
+ }
+ ContractManagePO contractPO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContractManagePO.class);
+ if (null == contractPO) {
+ throw new ServiceException("合同信息未找到");
+ }
+ billingStatementDO.setContractName(contractPO.getContractName());
+ billingStatementDO.setContractManageId(contractPO.getContractManageId());
+ billingStatementDO.setContractType(contractPO.getContractType());
+ }
+ //根据项目编码,查询项目信息并赋值
+ if (StringUtils.isNotEmpty(billingStatementDO.getProjectCode())) {
+ AjaxResult ajaxResult = systemServiceFeign.getProjectByCode(billingStatementDO.getProjectCode());
+ if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("项目信息未找到");
+ }
+ ProjectManagementPO projectManagePO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ProjectManagementPO.class);
+ if (null == projectManagePO) {
+ throw new ServiceException("项目信息未找到");
+ }
+ billingStatementDO.setProjectManageId(projectManagePO.getProjectManagementId());
+ billingStatementDO.setProjectName(projectManagePO.getProjectManagementName());
+ }
+ //来源系统
+ if (StringUtils.isNotEmpty(billingStatementDO.getBelongModuleCode())){
+ List modulesTypeList = null;
+ AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.MODULES.getCode());
+ if("200".equals(String.valueOf(ajaxResult.get("code")))){
+ modulesTypeList = JSON.parseArray(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
+ }
+ if (modulesTypeList != null && modulesTypeList.size() > 0){
+ for (SysDictDataVo sysDictDataVo : modulesTypeList) {
+ if (billingStatementDO.getBelongModuleCode().equals(sysDictDataVo.getDictValue())){
+ billingStatementDO.setBelongModule(sysDictDataVo.getDictLabel());
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * 修改计费流水
+ */
+ public Boolean update(BillingStatementDO billingStatementDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //处理数据
+ handleDate(billingStatementDO);
+
+ return billingStatementDomainService.update(billingStatementDO);
+ }
+
+ /**
+ * 批量删除计费流水
+ */
+ public boolean delete(Long[] billingStatementIds) {
+ return billingStatementDomainService.delete(billingStatementIds);
+ }
+
+ /**
+ * 获取计费流水详细信息
+ */
+ public BillingStatementPO getInfo(Long billingStatementId) {
+ return billingStatementDomainService.getInfo(billingStatementId);
+ }
+
+
+ /**
+ * 根据id删除计费流水
+ */
+ public Boolean deleteByIds(BillingStatementDTO billingStatementDTO) {
+ //只有已作废状态的记录可以操作删除
+ if (!StringUtils.isNotEmpty(billingStatementDTO.getBillingStatementIds())) {
+ throw new ServiceException("所选数据不能为空");
+ }
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ Set billingStatementIds = Stream.of(billingStatementDTO.getBillingStatementIds().split(",")).collect(Collectors.toSet());
+ Long[] documentTypeIds = billingStatementIds.stream().map(Long::valueOf).toArray(Long[]::new);
+ return billingStatementDomainService.delete(documentTypeIds);
+ }
+
+ /**
+ * 批量审核
+ */
+ @Transactional
+ public void reviewBilling(BillingStatementDTO billingStatementDTO) {
+ if (!StringUtils.isNotEmpty(billingStatementDTO.getBillingStatementIds())) {
+ throw new ServiceException("所选审核对象不能为空");
+ }
+ billingStatementDomainService.reviewBilling(billingStatementDTO);
+ }
+
+
+ /**
+ * 批量费用红冲
+ */
+ @Transactional
+ public void redFlushBilling(BillingStatementDTO billingStatementDTO) {
+ if (!StringUtils.isNotEmpty(billingStatementDTO.getBillingStatementIds())) {
+ throw new ServiceException("所选红冲对象不能为空");
+ }
+ billingStatementDomainService.redFlushBilling(billingStatementDTO);
+ }
+
+
+ /**
+ * 生成账单
+ */
+ @Transactional
+ public Boolean generateBills(BillingStatementDTO billingStatementDTO) {
+ //获取当前登录用户信息
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ /*
+ 首先对账单主体、来源系统、账单类型、组织进行唯一校验
+ 对要生成账单的流水加锁
+ 然后判断流水状态是否满足生成账单需求
+ 最后生成账单
+ */
+ billingStatementDomainService.checkUniqueEntity(billingStatementDTO.getBillingStatementIds());
+ //校验完成后,生成账单
+ Boolean flag1 = billManageApplicationService.saveBill(billingStatementDTO);
+ //修改流水状态
+ billingStatementDTO.setBillingState(3);
+ Boolean flag2 = billingStatementDomainService.updateBillingState(billingStatementDTO);
+ if (flag1 && flag2) {
+ return true;
+ } else {
+ throw new ServiceException("生成账单失败");
+ }
+ }
+
+
+ /**
+ * 批量流水作废
+ */
+ @Transactional
+ public void nullifyByIds(BillingStatementDTO billingStatementDTO) {
+
+ if (!StringUtils.isNotEmpty(billingStatementDTO.getBillingStatementIds())) {
+ throw new ServiceException("所选作废对象不能为空");
+ }
+ billingStatementDomainService.nullifyByIds(billingStatementDTO);
+ }
+
+
+ /**
+ * 查询批量出账列表
+ */
+ public List queryPaymentOutList(BillingStatementDO billingStatementDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null) {
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1) {
+ billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ List billManagePOList = new ArrayList<>();
+ List billingStatementPOList = billingStatementDomainService.queryPaymentOutList(billingStatementDO);
+ if(billingStatementPOList != null && billingStatementPOList.size() > 0){
+ //按 结算对象、来源系统、收支类型、组织进行分组
+ Map> billingStatementPOSMap = billingStatementPOList.stream().collect(Collectors.groupingBy(billingStatementPO -> billingStatementPO.getOrganizationId()+"_"+billingStatementPO.getSettlementCustomersCode()+"_"+billingStatementPO.getAccountExpenseType()+"_"+billingStatementPO.getBelongModuleCode()));
+ billingStatementPOSMap.forEach((key,value)->{
+ if(value.size()>0){
+ //生成账单浏览
+ BillManagePO billManagePO = billManageDomainService.getBillBrowse(value);
+ billManagePOList.add(billManagePO);
+ }
+ });
+ }
+ return billManagePOList;
+ }
+
+
+ /**
+ * 批量生成账单
+ */
+ @Transactional
+ public void batchGenerateBills(BillingStatementDTO billingStatementDTO) {
+ /*
+ 首先查询所有数据,并根据结算对象、来源系统、收支类型、组织进行分组
+ 然后每组分别调用生成账单
+ 如果生成失败,则回滚流水账单到已审核状态,如果成功则状态更新到已出账
+ */
+ //校验是否可进行生成账单操作
+ if (!billingStatementDomainService.checkGenerateBills(billingStatementDTO)) {
+ throw new ServiceException("生成账单失败,请刷新后再试");
+ }
+ billingStatementDomainService.batchGenerateBills(billingStatementDTO);
+ }
+
+
+ /**
+ * 查询计费流水列表统计
+ */
+ public Map queryListCount(BillingStatementDO billingStatementDO) {
+ Map result = new HashMap<>();
+ result.put("all","0");
+ result.put("outgoing","0");
+ result.put("unpaidAccount","0");
+ result.put("other","0");
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null) {
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1) {
+ billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ List billingStatementPOS = billingStatementDomainService.queryList(billingStatementDO);
+ if(billingStatementPOS != null && billingStatementPOS.size() > 0){
+ //过滤出流水状态为待审核和已审核的并统计
+ long unpaidAccount = billingStatementPOS.stream().filter(billingStatementPO -> billingStatementPO.getBillingState() == 1 || billingStatementPO.getBillingState() == 2).count();
+ long outgoing = billingStatementPOS.stream().filter(billingStatementPO -> billingStatementPO.getBillingState() == 3).count();
+ long other = billingStatementPOS.stream().filter(billingStatementPO -> billingStatementPO.getBillingState() == 4 || billingStatementPO.getBillingState() == 5).count();
+ result.put("all",String.valueOf(billingStatementPOS.size()));
+ result.put("outgoing",String.valueOf(outgoing));
+ result.put("unpaidAccount",String.valueOf(unpaidAccount));
+ result.put("other",String.valueOf(other));
+ }
+ return result;
+ }
+
+
+ /**
+ * 新增并返回id
+ */
+ public Long insertAndReturnId(BillingStatementDTO billingStatementDTO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ BillingStatementDO billingStatementDO = new BillingStatementAssembler().toDO(billingStatementDTO);
+ //处理数据
+ handleDate(billingStatementDO);
+
+ billingStatementDO.setDataSources(2);
+ if(StringUtils.isEmpty(billingStatementDO.getBillingFlow())){
+ billingStatementDO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
+ }
+ billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ billingStatementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ billingStatementDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ return billingStatementDomainService.insertAndReturnId(billingStatementDO);
+ }
+
+ /**
+ * 应收账单-添加费用
+ */
+ public BillingStatementPO addCost(BillingStatementDO billingStatementDO) {
+ /*
+ 此方法只进行实体返回,并不进行数据保存
+ */
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ BillingStatementPO billingStatementPO = new BillingStatementPO();
+ //处理数据
+ handleDate(billingStatementDO);
+ BeanUtils.copyProperties(billingStatementDO,billingStatementPO);
+ billingStatementPO.setBillingTotalAmount(billingStatementDO.getBillingAmount());
+ billingStatementPO.setDataSources(2);
+ billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
+ billingStatementPO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ billingStatementPO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ billingStatementPO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ return billingStatementPO;
+ }
+
+ /**
+ * 应收账单-添加明细
+ */
+ public List getBillDetailsList(BillingStatementDO billingStatementDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1) {
+ billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ return billingStatementDomainService.getBillDetailsList(billingStatementDO);
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java
new file mode 100644
index 000000000..21f2bd2ee
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/businessDocument/BusinessDocumentApplicationService.java
@@ -0,0 +1,725 @@
+package com.mhd.bms.application.server.businessDocument;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.mhd.bms.application.server.billingRules.CostCalculationApplicationService;
+import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
+import com.mhd.bms.domain.businessDocument.entity.BusinessDocument;
+import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO;
+import com.mhd.bms.domain.businessDocument.repository.todo.BusinessDocumentDO;
+import com.mhd.bms.domain.businessDocument.service.BusinessDocumentDomainService;
+import com.mhd.bms.domain.costCalculation.po.BillingCostPo;
+import com.mhd.bms.domain.documentType.entity.DocumentFromEntity;
+import com.mhd.bms.domain.documentType.entity.DocumentType;
+import com.mhd.bms.domain.documentType.repository.po.DocumentTypePO;
+import com.mhd.bms.domain.documentType.service.DocumentTypeDomainService;
+import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
+import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
+import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService;
+import com.mhd.bms.infrastructure.feign.vo.ContractManageDetailPO;
+import com.mhd.bms.infrastructure.feign.vo.ContractManagePO;
+import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO;
+import com.mhd.bms.interfaces.assembler.businessDocument.BusinessDocumentAssembler;
+import com.mhd.bms.interfaces.dto.billingRules.CostCalculationDTO;
+import com.mhd.bms.interfaces.dto.businessDocument.BusinessDocumentDTO;
+import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
+import com.mhd.common.core.domain.po.OrganizationPo;
+import com.mhd.common.core.domain.po.SysDictDataVo;
+import com.mhd.common.core.enums.BelongModuleCode;
+import com.mhd.common.core.enums.DictCode;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.OrderSequence;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.core.web.domain.AjaxResult;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.ProductServiceFeign;
+import com.mhd.system.api.SystemServiceFeign;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 业务单据ApplicationService
+ *
+ * @author gen
+ * @date 2024-06-21
+ */
+@Service
+@Slf4j
+public class BusinessDocumentApplicationService {
+ @Autowired
+ private BusinessDocumentDomainService businessDocumentDomainService;
+ @Autowired
+ private ProductServiceFeign productServiceFeign;
+ @Autowired
+ private SystemServiceFeign systemServiceFeign;
+ @Autowired
+ private DocumentTypeDomainService documentTypeDomainService;
+ @Autowired
+ private SettlementCustomersDomainService settlementCustomersDomainService;
+ @Autowired
+ private BillingStatementDomainService billingStatementDomainService;
+ @Autowired
+ private CostCalculationApplicationService costCalculationApplicationService;
+
+
+ /**
+ * 分页查询业务单据列表
+ */
+
+ public List queryList(BusinessDocumentDO businessDocumentDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ businessDocumentDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return businessDocumentDomainService.queryList(businessDocumentDO);
+ }
+
+
+ /**
+ * 新增业务单据
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean insert(BusinessDocumentDO businessDocumentDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //校验使用的表单是否必填校验
+ checkDoucumentType(businessDocumentDO);
+ //处理数据
+ handleDate(businessDocumentDO);
+ businessDocumentDO.setDataSources(2);
+ businessDocumentDO.setBusinessFlow(OrderSequence.getOrderCode("LS"));
+ businessDocumentDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ businessDocumentDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ businessDocumentDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ //调用费用计算,计算费用金额进行保存
+ CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
+ costCalculationDTO.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
+ costCalculationDTO.setContractNumber(businessDocumentDO.getContractNumber());
+ costCalculationDTO.setFormJson(businessDocumentDO.getDocumentFormJson());
+ costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentDO.getSecondSubjectCode()) ? businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode());
+ costCalculationDTO.setDocumentTypeCode(businessDocumentDO.getDocumentTypeCode());
+ BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
+ businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
+// businessDocumentDO.setEstimatedCost(new BigDecimal("100"));
+ return businessDocumentDomainService.insert(businessDocumentDO);
+ }
+
+ /**
+ * 校验表单单据类型必填
+ * @param businessDocumentDO
+ */
+ private void checkDoucumentType(BusinessDocumentDO businessDocumentDO) {
+ if(!StringUtils.isNotEmpty(businessDocumentDO.getDocumentTypeCode())){
+ throw new ServiceException("所选表单不能为空");
+ }
+ DocumentType documentType = documentTypeDomainService.queryByCode(businessDocumentDO.getDocumentTypeCode());
+ if(null == documentType){
+ throw new ServiceException("表单类型信息未找到");
+ }
+ if(StringUtils.isNotEmpty(documentType.getFormJson())){
+ //将form的json数据转换为DocumentFromEntity实体集合
+ List documentFromEntityList = JSONObject.parseArray(documentType.getFormJson(), DocumentFromEntity.class);
+ //将传来的documentFormJson表单json数据和查询出的集合比较,判断是否必填
+ //将documentFormJson转为jsonObject
+ JSONObject businessDocumentDOJsonObject = JSONObject.parseObject(businessDocumentDO.getDocumentFormJson());
+ documentFromEntityList.forEach(documentFromEntity -> {
+ if(documentFromEntity.getNotNull() == 1){
+ if(businessDocumentDOJsonObject.get(documentFromEntity.getField()) == null){
+ throw new ServiceException(documentFromEntity.getTitle()+"不能为空");
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * 处理数据
+ */
+ private void handleDate(BusinessDocumentDO businessDocumentDO) {
+ if(businessDocumentDO.getOrganizationId() != null){
+ //获取组织信息
+ AjaxResult ajaxResult = productServiceFeign.getOrganizationInfo(businessDocumentDO.getOrganizationId());
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
+ throw new ServiceException("选中组织信息未找到");
+ }
+ OrganizationPo organizationPo = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), OrganizationPo.class);
+ if(null == organizationPo){
+ throw new ServiceException("组织信息未找到");
+ }
+ businessDocumentDO.setOrganizationName(organizationPo.getOrganizationName());
+ businessDocumentDO.setTopOrganizationId(organizationPo.getParentOrganizationId());
+ if(organizationPo.getParentOrganizationId()==0){
+ businessDocumentDO.setTopOrganizationId(businessDocumentDO.getOrganizationId());
+ }
+ }
+ if(StringUtils.isNotEmpty(businessDocumentDO.getProjectCode())){
+ AjaxResult ajaxResult = systemServiceFeign.getProjectByCode(businessDocumentDO.getProjectCode());
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("项目信息未找到");
+ }
+ businessDocumentDO.setProjectName(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getString("projectName"));
+ businessDocumentDO.setProjectManageId(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getLong("projectManageId"));
+ }
+ //根据单据类型id查询单据类型数据,并赋值
+ if(StringUtils.isNotEmpty(businessDocumentDO.getDocumentTypeCode())){
+ DocumentType documentType = documentTypeDomainService.queryByCode(businessDocumentDO.getDocumentTypeCode());
+ if(null != documentType){
+ businessDocumentDO.setDocumentType(documentType.getDocumentType());
+ businessDocumentDO.setDocumentTypeCode(documentType.getDocumentTypeCode());
+ businessDocumentDO.setDocumentTypeId(documentType.getDocumentTypeId());
+ }
+ }
+ //来源系统
+ if (StringUtils.isNotEmpty(businessDocumentDO.getBelongModuleCode())){
+ List modulesTypeList = null;
+ AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.MODULES.getCode());
+ if("200".equals(String.valueOf(ajaxResult.get("code")))){
+ modulesTypeList = JSON.parseArray(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
+ }
+ if (modulesTypeList != null && modulesTypeList.size() > 0){
+ for (SysDictDataVo sysDictDataVo : modulesTypeList) {
+ if (businessDocumentDO.getBelongModuleCode().equals(sysDictDataVo.getDictValue())){
+ businessDocumentDO.setBelongModule(sysDictDataVo.getDictLabel());
+ break;
+ }
+ }
+ }
+ }
+
+ //根据结算对象code查询结算对象数据,并赋值
+ if(StringUtils.isNotEmpty(businessDocumentDO.getSettlementCustomersCode())){
+ SettlementCustomers settlementCustomers = settlementCustomersDomainService.queryByCode(businessDocumentDO.getSettlementCustomersCode());
+ if(null == settlementCustomers){
+ throw new ServiceException("结算对象信息未找到");
+ }
+ businessDocumentDO.setSettlementCustomersCode(settlementCustomers.getSettlementCustomersCode());
+ businessDocumentDO.setSettlementEntity(settlementCustomers.getSettlementEntity());
+ businessDocumentDO.setSettlementCustomersId(settlementCustomers.getSettlementCustomersId());
+ //如果前端没传项目code则从结算对象中获取
+ if(StringUtils.isEmpty(businessDocumentDO.getProjectCode())){
+ businessDocumentDO.setProjectCode(settlementCustomers.getProjectCode());
+ businessDocumentDO.setProjectName(settlementCustomers.getProjectName());
+ }
+ }
+
+ //根据费用类型id查询费用类型对象数据,并赋值
+ if(StringUtils.isNotEmpty(businessDocumentDO.getServiceItemsCode())){
+ AjaxResult ajaxResult = systemServiceFeign.getServiceItemsByCode(businessDocumentDO.getServiceItemsCode());
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("费用类型未找到");
+ }
+ businessDocumentDO.setServiceItemsManageId(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getLong("serviceItemsManageId"));
+ businessDocumentDO.setServiceItemsName(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getString("serviceItemsName"));
+ }
+ //根据费用科目code查询费用信息,并赋值
+ if(StringUtils.isNotEmpty(businessDocumentDO.getSecondSubjectCode())){
+ AjaxResult ajaxResult = systemServiceFeign.getSubInfoByCode(businessDocumentDO.getSecondSubjectCode());
+ if("200".equals(String.valueOf(ajaxResult.get("code")))){
+ ExpenseAccountPO expenseAccountPO = JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), ExpenseAccountPO.class);
+ if(null == expenseAccountPO || expenseAccountPO.getExpenseAccountId()==null){
+ throw new ServiceException("费用科目信息未找到");
+ }
+ if(expenseAccountPO.getFirstSubjectFlag()==1){
+ //如果是一级科目
+ businessDocumentDO.setFirstSubjectName(expenseAccountPO.getSubjectName());
+ businessDocumentDO.setFirstSubjectCode(expenseAccountPO.getSubjectCode());
+ businessDocumentDO.setSecondSubjectCode("");
+ }else {
+ //不是一级科目
+ businessDocumentDO.setFirstSubjectName(expenseAccountPO.getUpperSubject());
+ businessDocumentDO.setFirstSubjectCode(expenseAccountPO.getUpperSubjectCode());
+ businessDocumentDO.setSecondSubjectCode(expenseAccountPO.getSubjectCode());
+ businessDocumentDO.setSecondSubjectName(expenseAccountPO.getSubjectName());
+ }
+ //判断如果前端没有传费用类别,则此处根据费用科目获取关联费用类别
+ if(StringUtils.isEmpty(businessDocumentDO.getServiceItemsCode())){
+ AjaxResult ajaxResultServiceItems = systemServiceFeign.getServiceItemsById(businessDocumentDO.getServiceItemsManageId());
+ if("200".equals(String.valueOf(ajaxResultServiceItems.get("code")))) {
+ businessDocumentDO.setServiceItemsCode(JSONObject.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResultServiceItems.get("data"))).getString("serviceItemsCode"));
+ businessDocumentDO.setServiceItemsName(JSONObject.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResultServiceItems.get("data"))).getString("serviceItemsName"));
+ }
+ }
+ }
+ }
+ //根据结算对象和费用科目,获取合同
+ int contractType = 2;
+ if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
+ contractType = 1;
+ }
+ AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomer(businessDocumentDO.getSettlementCustomersCode(),contractType);
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("合同信息未找到");
+ }
+ ContractManagePO contractPO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContractManagePO.class);
+ if (null == contractPO) {
+ throw new ServiceException("合同信息未找到");
+ }
+ businessDocumentDO.setContractName(contractPO.getContractName());
+ businessDocumentDO.setContractNumber(contractPO.getContractNumber());
+ }
+
+ /**
+ * 修改业务单据
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean update(BusinessDocumentDO businessDocumentDO) {
+ BusinessDocumentPO businessDocumentPO = businessDocumentDomainService.getInfo(businessDocumentDO.getBusinessDocumentId());
+ if(null == businessDocumentPO){
+ throw new ServiceException("业务单据信息未找到");
+ }
+ if(businessDocumentPO.getDataSources()==1){
+ throw new ServiceException("非手工录入数据,无法修改");
+ }
+ //校验使用的表单是否必填校验
+ checkDoucumentType(businessDocumentDO);
+ //处理数据
+ handleDate(businessDocumentDO);
+ return businessDocumentDomainService.update(businessDocumentDO);
+ }
+
+ /**
+ * 批量删除业务单据
+ */
+ public boolean delete(Long[] businessDocumentIds) {
+ return businessDocumentDomainService.delete(businessDocumentIds);
+ }
+
+ /**
+ * 获取业务单据详细信息
+ */
+ public BusinessDocumentPO getInfo(Long businessDocumentId)
+ {
+ return businessDocumentDomainService.getInfo(businessDocumentId);
+ }
+
+
+ /**
+ * 同步业务单据数据
+ */
+ public String syncData(BusinessDocumentDO businessDocumentDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //校验必填项
+ checkDoucumentType(businessDocumentDO);
+ //处理数据
+ handleDate(businessDocumentDO);
+ String flow = OrderSequence.getOrderCode("LS");
+ businessDocumentDO.setBusinessFlow(flow);
+ businessDocumentDO.setDataSources(1);
+ businessDocumentDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ businessDocumentDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ businessDocumentDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+
+ //TODO 计算费用并保存
+
+ businessDocumentDomainService.insert(businessDocumentDO);
+ return flow;
+ }
+
+
+ /**
+ * 费用重算(批量)
+ */
+ @Transactional
+ public Boolean costRecalculation(List businessDocumentDTOList) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ if(businessDocumentDTOList == null || businessDocumentDTOList.size()==0){
+ throw new ServiceException("所选记录不能为空");
+ }
+ //循环遍历并保存重算后金额
+ List businessDocumentList = new ArrayList<>();
+ for (BusinessDocumentDTO businessDocumentDTO : businessDocumentDTOList) {
+ BusinessDocument businessDocument = new BusinessDocument();
+ businessDocument.setBusinessDocumentId(businessDocumentDTO.getBusinessDocumentId());
+ businessDocument.setBillAmount(businessDocumentDTO.getNewBillAmount());
+ businessDocument.setEstimatedCost(businessDocumentDTO.getRecalculateCost());
+ businessDocument.setUpdateBy(loginUser.getUserPo().getUserId());
+ businessDocument.setUpdateByName(loginUser.getUserPo().getUserName());
+ businessDocument.setUpdateTime(new Date());
+ businessDocumentList.add(businessDocument);
+ }
+ return businessDocumentDomainService.saveOrUpdateBatch(businessDocumentList);
+ }
+
+ /**
+ * 批量删除业务单据
+ * @param businessDocumentDTO
+ * @return
+ */
+ @Transactional
+ public void deleteByIds(BusinessDocumentDTO businessDocumentDTO) {
+ //只有已作废状态的记录可以操作删除
+ if(!StringUtils.isNotEmpty(businessDocumentDTO.getBusinessDocumentIds())){
+ throw new ServiceException("所选数据不能为空");
+ }
+ List businessDocumentIdLongList = new ArrayList<>();
+ Set businessDocumentIds = Stream.of(businessDocumentDTO.getBusinessDocumentIds().split(",")).collect(Collectors.toSet());
+ for (String businessDocumentId : businessDocumentIds) {
+ Long businessDocumentIdLong = Long.valueOf(businessDocumentId);
+ BusinessDocumentPO businessDocumentPO = businessDocumentDomainService.getInfo(businessDocumentIdLong);
+ if(null == businessDocumentPO){
+ throw new ServiceException("业务单据信息未找到");
+ }
+ if(businessDocumentPO.getBusinessState()!=5){
+ throw new ServiceException("所选记录"+ businessDocumentPO.getBusinessFlow() +"未作废不可删除");
+ }
+ businessDocumentIdLongList.add(businessDocumentIdLong);
+ }
+ if(businessDocumentIdLongList.size()>0){
+ businessDocumentDomainService.deleteByIds(businessDocumentIdLongList);
+ }
+ }
+
+
+ /**
+ * 作废业务单据
+ */
+ @Transactional
+ public void nullifyByIds(BusinessDocumentDTO businessDocumentDTO) {
+ //只有未生效状态的记录可以操作作废
+ if(!StringUtils.isNotEmpty(businessDocumentDTO.getBusinessDocumentIds())){
+ throw new ServiceException("所选数据不能为空");
+ }
+ List businessDocumentIdLongList = new ArrayList<>();
+ Set businessDocumentIds = Stream.of(businessDocumentDTO.getBusinessDocumentIds().split(",")).collect(Collectors.toSet());
+ for (String businessDocumentId : businessDocumentIds) {
+ Long businessDocumentIdLong = Long.valueOf(businessDocumentId);
+ BusinessDocumentPO businessDocumentPO = businessDocumentDomainService.getInfo(businessDocumentIdLong);
+ if(null == businessDocumentPO){
+ throw new ServiceException("业务单据信息未找到");
+ }
+ if(businessDocumentPO.getBusinessState()!=1){
+ throw new ServiceException("所选记录"+ businessDocumentPO.getBusinessFlow() +"已生效不可作废");
+ }
+ businessDocumentIdLongList.add(businessDocumentIdLong);
+ }
+ if(businessDocumentIdLongList.size()>0){
+ businessDocumentDomainService.nullifyByIds(businessDocumentIdLongList);
+ }
+ }
+
+ /**
+ * 生效业务单据
+ */
+ @Transactional
+ public void takeEffectByIds(BusinessDocumentDTO businessDocumentDTO) {
+ //只有未生效状态的记录可以操作生效变更为已生效状态
+ if(!StringUtils.isNotEmpty(businessDocumentDTO.getBusinessDocumentIds())){
+ throw new ServiceException("所选数据不能为空");
+ }
+ List businessDocumentIdLongList = new ArrayList<>();
+ Set businessDocumentIds = Stream.of(businessDocumentDTO.getBusinessDocumentIds().split(",")).collect(Collectors.toSet());
+ for (String businessDocumentId : businessDocumentIds) {
+ Long businessDocumentIdLong = Long.valueOf(businessDocumentId);
+ BusinessDocumentPO businessDocumentPO = businessDocumentDomainService.getInfo(businessDocumentIdLong);
+ if(null == businessDocumentPO){
+ throw new ServiceException("业务单据信息未找到");
+ }
+ if(businessDocumentPO.getBusinessState()!=1 && businessDocumentPO.getBusinessState()!=4){
+ throw new ServiceException("所选记录"+ businessDocumentPO.getBusinessFlow() +"已生效不可操作");
+ }
+ businessDocumentIdLongList.add(businessDocumentIdLong);
+ }
+ if(businessDocumentIdLongList.size()>0){
+ businessDocumentDomainService.takeEffectByIds(businessDocumentIdLongList);
+ }
+ }
+
+ /**
+ * 审核业务单据
+ */
+ @Transactional
+ public void auditByIds(BusinessDocumentDTO businessDocumentDTO) {
+ //只有已生效状态的记录可以操作审核变更为已计费状态并生成计费流水
+ if(!StringUtils.isNotEmpty(businessDocumentDTO.getBusinessDocumentIds())){
+ throw new ServiceException("所选数据不能为空");
+ }
+ List businessDocumentIdLongList = new ArrayList<>();
+ Set businessDocumentIds = Stream.of(businessDocumentDTO.getBusinessDocumentIds().split(",")).collect(Collectors.toSet());
+ for (String businessDocumentId : businessDocumentIds) {
+ Long businessDocumentIdLong = Long.valueOf(businessDocumentId);
+ BusinessDocumentPO businessDocumentPO = businessDocumentDomainService.getInfo(businessDocumentIdLong);
+ if(null == businessDocumentPO){
+ throw new ServiceException("业务单据信息未找到");
+ }
+ if(businessDocumentPO.getBusinessState()!=2){
+ throw new ServiceException("所选记录"+ businessDocumentPO.getBusinessFlow() +"不是已生效状态不可操作");
+ }
+ //生成计费流水
+ billingStatementDomainService.generateFlow(businessDocumentPO);
+ businessDocumentIdLongList.add(businessDocumentIdLong);
+ }
+ if(businessDocumentIdLongList.size()>0){
+ businessDocumentDomainService.auditByIds(businessDocumentIdLongList,businessDocumentDTO);
+ }
+
+ }
+
+
+ /**
+ * 导入业务单据
+ */
+ public Boolean importDocument(List businessDocumentDTOList) {
+ List businessDocumentList = new ArrayList<>();
+ if(businessDocumentDTOList != null && businessDocumentDTOList.size()>0){
+ for (BusinessDocumentDTO businessDocumentDTO : businessDocumentDTOList) {
+ BusinessDocument businessDocument = new BusinessDocument();
+ //处理导入业务单据
+
+
+ BeanUtils.copyProperties(businessDocumentDTO,businessDocument);
+ businessDocument.setDataSources(2);
+ businessDocumentList.add(businessDocument);
+ }
+ }
+ return businessDocumentDomainService.saveBatch(businessDocumentList);
+ }
+
+ /**
+ * 费用重算列表查询
+ * @param businessDocumentDO
+ * @return
+ */
+ public List costRecalculationList(BusinessDocumentDO businessDocumentDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ if(!StringUtils.isNotEmpty(businessDocumentDO.getBusinessDocumentIds())){
+ throw new ServiceException("所选记录不能为空");
+ }
+ Set businessDocumentIds = Stream.of(businessDocumentDO.getBusinessDocumentIds().split(",")).collect(Collectors.toSet());
+ if(businessDocumentIds.size()>10){
+ throw new ServiceException("重算数量过大,建议选中十条以内");
+ }
+ //查询业务单据
+ BusinessDocumentDO queryParam = new BusinessDocumentDO();
+ queryParam.setBusinessDocumentIdSet(businessDocumentIds);
+ List businessDocumentPOList = businessDocumentDomainService.queryList(queryParam);
+ if(null == businessDocumentPOList || businessDocumentPOList.size()==0){
+ throw new ServiceException("业务单据信息未找到");
+ }
+ //判断是否可进行费用重算,盘算业务状态是否已计费,计费之前可进行费用重算并保存
+ long count = businessDocumentPOList.stream().filter(businessDocumentPO -> businessDocumentPO.getBusinessState() > 2).count();
+ if(count >0){
+ throw new ServiceException("所选数据中包含已计费等状态,无法进行费用重算");
+ }
+ //循环集合,重新计算费用
+ for (BusinessDocumentPO businessDocumentPO : businessDocumentPOList) {
+ //计算费用
+ CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
+ costCalculationDTO.setOriginalBusinessNum(businessDocumentPO.getOriginalBusinessNum());
+ costCalculationDTO.setContractNumber(businessDocumentPO.getContractNumber());
+ costCalculationDTO.setFormJson(businessDocumentPO.getDocumentFormJson());
+ costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentPO.getSecondSubjectCode()) ? businessDocumentPO.getFirstSubjectCode():businessDocumentPO.getSecondSubjectCode());
+ costCalculationDTO.setDocumentTypeCode(businessDocumentPO.getDocumentTypeCode());
+ BillingCostPo billingCostPo = null;
+ try {
+ billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
+ }catch (Exception e){
+ businessDocumentPO.setRecalculateCostFailRemark(e.getMessage());
+ }
+ if(null != billingCostPo){
+ businessDocumentPO.setRecalculateCost(billingCostPo.getComputationalCost());
+ }
+ }
+ return businessDocumentPOList;
+ }
+
+
+ /**
+ * 业务系统推送BMS业务单据保存
+ */
+ @Transactional
+ public Boolean pushSyncData(BusinessDocumentDO businessDocumentDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //校验使用的表单是否必填校验
+ checkDoucumentType(businessDocumentDO);
+ //根据结算对象和费用科目,获取合同
+ int contractType = 2;
+ if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
+ contractType = 1;
+ }
+ AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomer(businessDocumentDO.getSettlementCustomersCode(),contractType);
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("合同信息未找到");
+ }
+ ContractManagePO contractPO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContractManagePO.class);
+ if (null == contractPO) {
+ throw new ServiceException("合同信息未找到");
+ }
+ businessDocumentDO.setContractName(contractPO.getContractName());
+ businessDocumentDO.setContractNumber(contractPO.getContractNumber());
+ //处理数据
+ businessDocumentDO.setDataSources(1);
+ businessDocumentDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ businessDocumentDO.setOrganizationId(businessDocumentDO.getOrganizationId()==null ? loginUser.getUserPo().getOrganizationId() : businessDocumentDO.getOrganizationId());
+ handleDateSync(businessDocumentDO);
+
+ List businessDocumentList = new ArrayList<>();
+ //根据合同获取合同明细信息
+ List contractManageDetailPOList = contractPO.getContractManageDetailPOList();
+ //遍历contractManageDetailPOList集合,根据合同维护的费用科目,生成业务单据
+ for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOList) {
+ /*
+ 判断合同详情中的单据类型,如果传来的单据类型在合同中,则生成对应的费用科目所对应的业务单据
+ 校验根据原始业务单号和费用科目,查询业务单据是否已存在,如果已存在则修改,如果不存在则新增
+ 业务系统只传业务数据,同时还要传结算主体,bms根据结算主体获取合同信息,进而进行下一步操作
+ */
+ Set documentTypeCodeSet = Stream.of(contractManageDetailPO.getDocumentTypeCode().split(",")).collect(Collectors.toSet());
+ if(documentTypeCodeSet.contains(businessDocumentDO.getDocumentTypeCode())){
+ //生成一条业务单据
+ BusinessDocument businessDocument = new BusinessDocument();
+ BeanUtils.copyProperties(businessDocumentDO,businessDocument);
+ BusinessDocumentDO params = new BusinessDocumentDO();
+ params.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
+ params.setSecondSubjectCode(StringUtils.isEmpty(contractManageDetailPO.getSecondSubjectCode()) ? contractManageDetailPO.getFirstSubjectCode():contractManageDetailPO.getSecondSubjectCode());
+ BusinessDocumentPO businessDocumentPO = businessDocumentDomainService.queryByOriginalBusinessNumAndSubjectCode(params);
+ if(null != businessDocumentPO){
+ businessDocument.setBusinessDocumentId(businessDocumentPO.getBusinessDocumentId());
+ }
+ businessDocument.setBusinessFlow(OrderSequence.getOrderCode("LS"));
+ businessDocument.setFirstSubjectCode(contractManageDetailPO.getFirstSubjectCode());
+ businessDocument.setFirstSubjectName(contractManageDetailPO.getFirstSubjectName());
+ businessDocument.setSecondSubjectCode(contractManageDetailPO.getSecondSubjectCode());
+ businessDocument.setSecondSubjectName(contractManageDetailPO.getSecondSubjectName());
+ //调用费用计算,计算费用金额进行保存
+ CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
+ costCalculationDTO.setOriginalBusinessNum(businessDocument.getOriginalBusinessNum());
+ costCalculationDTO.setContractNumber(businessDocument.getContractNumber());
+ costCalculationDTO.setFormJson(businessDocument.getDocumentFormJson());
+ costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocument.getSecondSubjectCode()) ? businessDocument.getFirstSubjectCode():businessDocument.getSecondSubjectCode());
+ costCalculationDTO.setDocumentTypeCode(businessDocument.getDocumentTypeCode());
+ BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
+ businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
+ businessDocumentList.add(businessDocument);
+ }
+ }
+ return businessDocumentDomainService.saveOrUpdateBatch(businessDocumentList);
+ }
+
+ private void handleDateSync(BusinessDocumentDO businessDocumentDO) {
+ if(businessDocumentDO.getOrganizationId() != null){
+ //获取组织信息
+ AjaxResult ajaxResult = productServiceFeign.getOrganizationInfo(businessDocumentDO.getOrganizationId());
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
+ throw new ServiceException("选中组织信息未找到");
+ }
+ OrganizationPo organizationPo = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), OrganizationPo.class);
+ if(null == organizationPo){
+ throw new ServiceException("组织信息未找到");
+ }
+ businessDocumentDO.setOrganizationName(organizationPo.getOrganizationName());
+ businessDocumentDO.setTopOrganizationId(organizationPo.getParentOrganizationId());
+ if(organizationPo.getParentOrganizationId()==0){
+ businessDocumentDO.setTopOrganizationId(businessDocumentDO.getOrganizationId());
+ }
+ }
+ if(StringUtils.isNotEmpty(businessDocumentDO.getProjectCode())){
+ AjaxResult ajaxResult = systemServiceFeign.getProjectByCode(businessDocumentDO.getProjectCode());
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("项目信息未找到");
+ }
+ businessDocumentDO.setProjectName(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getString("projectName"));
+ businessDocumentDO.setProjectManageId(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getLong("projectManageId"));
+ }
+ //根据单据类型id查询单据类型数据,并赋值
+ if(StringUtils.isNotEmpty(businessDocumentDO.getDocumentTypeCode())){
+ DocumentType documentType = documentTypeDomainService.queryByCode(businessDocumentDO.getDocumentTypeCode());
+ if(null != documentType){
+ businessDocumentDO.setDocumentType(documentType.getDocumentType());
+ businessDocumentDO.setDocumentTypeCode(documentType.getDocumentTypeCode());
+ businessDocumentDO.setDocumentTypeId(documentType.getDocumentTypeId());
+ }
+ }
+ //来源系统
+ if (StringUtils.isNotEmpty(businessDocumentDO.getBelongModuleCode())){
+ List modulesTypeList = null;
+ AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.MODULES.getCode());
+ if("200".equals(String.valueOf(ajaxResult.get("code")))){
+ modulesTypeList = JSON.parseArray(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
+ }
+ if (modulesTypeList != null && modulesTypeList.size() > 0){
+ for (SysDictDataVo sysDictDataVo : modulesTypeList) {
+ if (businessDocumentDO.getBelongModuleCode().equals(sysDictDataVo.getDictValue())){
+ businessDocumentDO.setBelongModule(sysDictDataVo.getDictLabel());
+ break;
+ }
+ }
+ }
+ }
+
+ //根据结算对象code查询结算对象数据,并赋值
+ if(StringUtils.isNotEmpty(businessDocumentDO.getSettlementCustomersCode())){
+ SettlementCustomers settlementCustomers = settlementCustomersDomainService.queryByCode(businessDocumentDO.getSettlementCustomersCode());
+ if(null == settlementCustomers){
+ throw new ServiceException("结算对象信息未找到");
+ }
+ businessDocumentDO.setSettlementCustomersCode(settlementCustomers.getSettlementCustomersCode());
+ businessDocumentDO.setSettlementEntity(settlementCustomers.getSettlementEntity());
+ businessDocumentDO.setSettlementCustomersId(settlementCustomers.getSettlementCustomersId());
+ //如果前端没传项目code则从结算对象中获取
+ if(StringUtils.isEmpty(businessDocumentDO.getProjectCode())){
+ businessDocumentDO.setProjectCode(settlementCustomers.getProjectCode());
+ businessDocumentDO.setProjectName(settlementCustomers.getProjectName());
+ }
+ }
+
+ //根据费用类型id查询费用类型对象数据,并赋值
+ if(StringUtils.isNotEmpty(businessDocumentDO.getServiceItemsCode())){
+ AjaxResult ajaxResult = systemServiceFeign.getServiceItemsByCode(businessDocumentDO.getServiceItemsCode());
+ if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
+ throw new ServiceException("费用类型未找到");
+ }
+ businessDocumentDO.setServiceItemsManageId(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getLong("serviceItemsManageId"));
+ businessDocumentDO.setServiceItemsName(JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data"))).getString("serviceItemsName"));
+ }
+
+ }
+
+ /**
+ * 业务系统推送BMS业务单据保存 (批量)
+ */
+ @Transactional
+ public Boolean pushSyncDataList(List businessDataPushDTOList) {
+ if(businessDataPushDTOList != null && businessDataPushDTOList.size() > 0){
+ for (BusinessDataPushDTO businessDataPushDTO : businessDataPushDTOList) {
+ //转换实体
+ BusinessDocumentDO businessDocumentDO = new BusinessDocumentAssembler().syncDataAssemble(businessDataPushDTO);
+ if(!pushSyncData(businessDocumentDO)){
+ throw new ServiceException("保存单据失败,请重试");
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/conditionalMapping/ConditionalMappingApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/conditionalMapping/ConditionalMappingApplicationService.java
new file mode 100644
index 000000000..35c930bac
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/conditionalMapping/ConditionalMappingApplicationService.java
@@ -0,0 +1,102 @@
+package com.mhd.bms.application.server.conditionalMapping;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.mhd.bms.domain.conditionalMapping.repository.po.ConditionalMappingPO;
+import com.mhd.bms.domain.conditionalMapping.repository.todo.ConditionalMappingDO;
+import com.mhd.bms.domain.conditionalMapping.service.ConditionalMappingDomainService;
+import com.mhd.bms.interfaces.dto.conditionalMapping.ConditionalMappingDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 条件映射管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-08-07
+ */
+@Service
+@Slf4j
+public class ConditionalMappingApplicationService {
+ @Autowired
+ private ConditionalMappingDomainService conditionalMappingDomainService;
+
+
+ /**
+ * 分页查询条件映射管理列表
+ */
+
+ public List queryList(ConditionalMappingDO conditionalMappingDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ conditionalMappingDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return conditionalMappingDomainService.queryList(conditionalMappingDO);
+ }
+
+
+ /**
+ * 新增条件映射管理
+ */
+ public Boolean insert(ConditionalMappingDO conditionalMappingDO) {
+ //获取当前登录人
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ conditionalMappingDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ conditionalMappingDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ conditionalMappingDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ return conditionalMappingDomainService.insert(conditionalMappingDO);
+ }
+
+ /**
+ * 修改条件映射管理
+ */
+ public Boolean update(ConditionalMappingDO conditionalMappingDO) {
+ return conditionalMappingDomainService.update(conditionalMappingDO);
+ }
+
+ /**
+ * 批量删除条件映射管理
+ */
+ public boolean delete(Long[] conditionalMappingIds) {
+ return conditionalMappingDomainService.delete(conditionalMappingIds);
+ }
+
+ /**
+ * 获取条件映射管理详细信息
+ */
+ public ConditionalMappingPO getInfo(Long conditionalMappingId)
+ {
+ return conditionalMappingDomainService.getInfo(conditionalMappingId);
+ }
+
+
+ /**
+ * 批量删除
+ * @param conditionalMappingDTO
+ * @return
+ */
+ public Boolean deleteByIds(ConditionalMappingDTO conditionalMappingDTO) {
+ if(!StringUtils.isNotEmpty(conditionalMappingDTO.getConditionalMappingIds())){
+ throw new ServiceException("条件映射ID不能为空");
+ }
+ Set conditionalMappingIds = Stream.of(conditionalMappingDTO.getConditionalMappingIds().split(",")).collect(Collectors.toSet());
+ Long[] ids = conditionalMappingIds.stream().map(Long::valueOf).toArray(Long[]::new);
+ return conditionalMappingDomainService.delete(ids);
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/documentType/DocumentTypeApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/documentType/DocumentTypeApplicationService.java
new file mode 100644
index 000000000..6654b7d7a
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/documentType/DocumentTypeApplicationService.java
@@ -0,0 +1,174 @@
+package com.mhd.bms.application.server.documentType;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.mhd.bms.domain.documentType.entity.DocumentType;
+import com.mhd.bms.domain.documentType.repository.po.DocumentTypePO;
+import com.mhd.bms.domain.documentType.repository.todo.DocumentTypeDO;
+import com.mhd.bms.domain.documentType.service.DocumentTypeDomainService;
+import com.mhd.bms.interfaces.dto.documentType.DocumentTypeDTO;
+import com.mhd.common.core.domain.po.SysDictDataVo;
+import com.mhd.common.core.enums.DictCode;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.core.web.domain.AjaxResult;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.SystemServiceFeign;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 单据类型ApplicationService
+ *
+ * @author gen
+ * @date 2024-06-18
+ */
+@Service
+@Slf4j
+public class DocumentTypeApplicationService {
+ @Autowired
+ private DocumentTypeDomainService documentTypeDomainService;
+ @Autowired
+ private SystemServiceFeign systemServiceFeign;
+
+
+ /**
+ * 分页查询单据类型列表
+ */
+
+ public List queryList(DocumentTypeDO documentTypeDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ documentTypeDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return documentTypeDomainService.queryList(documentTypeDO);
+ }
+
+
+ /**
+ * 新增单据类型
+ */
+ public Boolean insert(DocumentTypeDO documentTypeDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //校验编码唯一性
+ checkCode(documentTypeDO);
+ //处理数据字典
+ handleDict(documentTypeDO);
+ documentTypeDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ documentTypeDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ documentTypeDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ return documentTypeDomainService.insert(documentTypeDO);
+ }
+
+ /**
+ * 校验单据类型编码唯一性
+ */
+ private void checkCode(DocumentTypeDO documentTypeDO) {
+ if(!StringUtils.isNotEmpty(documentTypeDO.getDocumentTypeCode())){
+ throw new ServiceException("单据类型编码不能为空");
+ }
+ DocumentType documentType = documentTypeDomainService.queryByCode(documentTypeDO.getDocumentTypeCode());
+ if (documentType != null){
+ throw new ServiceException("单据类型编码已存在");
+ }
+ }
+
+ /**
+ * 处理数据字典信息
+ */
+ private void handleDict(DocumentTypeDO documentTypeDO) {
+ //查询来源模块数据字典
+ if(StringUtils.isNotEmpty(documentTypeDO.getBelongModuleCode())){
+ List modulesTypeList = null;
+ AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.MODULES.getCode());
+ if("200".equals(String.valueOf(ajaxResult.get("code")))){
+ modulesTypeList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
+ }
+ if (modulesTypeList != null && modulesTypeList.size() > 0){
+ for (SysDictDataVo sysDictDataVo : modulesTypeList) {
+ if (documentTypeDO.getBelongModuleCode().equals(sysDictDataVo.getDictValue())){
+ documentTypeDO.setBelongModule(sysDictDataVo.getDictLabel());
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * 修改单据类型
+ */
+ public Boolean update(DocumentTypeDO documentTypeDO) {
+ //校验编码唯一性
+ if(!StringUtils.isNotEmpty(documentTypeDO.getDocumentTypeCode())){
+ throw new ServiceException("单据类型编码不能为空");
+ }
+ DocumentType documentType = documentTypeDomainService.queryByCode(documentTypeDO.getDocumentTypeCode());
+ if (documentType != null && !Objects.equals(documentType.getDocumentTypeId(), documentTypeDO.getDocumentTypeId())){
+ throw new ServiceException("单据类型编码已存在");
+ }
+ //处理数据字典
+ handleDict(documentTypeDO);
+ return documentTypeDomainService.update(documentTypeDO);
+ }
+
+ /**
+ * 批量删除单据类型
+ */
+ public boolean delete(Long[] documentTypeIds) {
+ return documentTypeDomainService.delete(documentTypeIds);
+ }
+
+ /**
+ * 获取单据类型详细信息
+ */
+ public DocumentTypePO getInfo(Long documentTypeId)
+ {
+ return documentTypeDomainService.getInfo(documentTypeId);
+ }
+
+
+ /**
+ * 批量删除单据类型
+ * @param documentTypeDTO
+ * @return
+ */
+ public Boolean deleteByIds(DocumentTypeDTO documentTypeDTO) {
+ if(!StringUtils.isNotEmpty(documentTypeDTO.getDocumentTypeIds())){
+ throw new ServiceException("单据类型ids不能为空");
+ }
+ Set idSet = Stream.of(documentTypeDTO.getDocumentTypeIds().split(",")).collect(Collectors.toSet());
+ Long[] documentTypeIds = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
+ return documentTypeDomainService.delete(documentTypeIds);
+ }
+
+ public boolean changeStatus(DocumentTypeDO documentTypeDO) {
+ if(documentTypeDO.getDocumentTypeId()==null){
+ throw new ServiceException("单据类型id不能为空");
+ }
+ if(documentTypeDO.getEnablingStatus() != 1 && documentTypeDO.getEnablingStatus() != 2){
+ throw new ServiceException("单据类型状态错误");
+ }
+ DocumentTypeDO documentTypeSave = new DocumentTypeDO();
+ documentTypeSave.setDocumentTypeId(documentTypeDO.getDocumentTypeId());
+ documentTypeSave.setEnablingStatus(documentTypeDO.getEnablingStatus());
+ return documentTypeDomainService.update(documentTypeSave);
+
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/mappingMethod/MappingMethodApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/mappingMethod/MappingMethodApplicationService.java
new file mode 100644
index 000000000..5286931f9
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/mappingMethod/MappingMethodApplicationService.java
@@ -0,0 +1,100 @@
+package com.mhd.bms.application.server.mappingMethod;
+
+import com.mhd.bms.domain.mappingMethod.repository.po.MappingMethodPO;
+import com.mhd.bms.domain.mappingMethod.repository.todo.MappingMethodDO;
+import com.mhd.bms.domain.mappingMethod.service.MappingMethodDomainService;
+import com.mhd.bms.interfaces.dto.mappingMethod.MappingMethodDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 方法映射ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-12
+ */
+@Service
+@Slf4j
+public class MappingMethodApplicationService {
+ @Autowired
+ private MappingMethodDomainService mappingMethodDomainService;
+
+
+ /**
+ * 分页查询方法映射列表
+ */
+
+ public List queryList(MappingMethodDO mappingMethodDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ mappingMethodDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return mappingMethodDomainService.queryList(mappingMethodDO);
+ }
+
+
+ /**
+ * 新增方法映射
+ */
+ public Boolean insert(MappingMethodDO mappingMethodDO) {
+
+ return mappingMethodDomainService.insert(mappingMethodDO);
+ }
+
+ /**
+ * 修改方法映射
+ */
+ public Boolean update(MappingMethodDO mappingMethodDO) {
+ return mappingMethodDomainService.update(mappingMethodDO);
+ }
+
+ /**
+ * 批量删除方法映射
+ */
+ public boolean delete(Long[] mappingMethodIds) {
+ return mappingMethodDomainService.delete(mappingMethodIds);
+ }
+
+ /**
+ * 获取方法映射详细信息
+ */
+ public MappingMethodPO getInfo(Long mappingMethodId)
+ {
+ return mappingMethodDomainService.getInfo(mappingMethodId);
+ }
+
+
+ /**
+ * 根据ID删除
+ */
+ @Transactional
+ public Boolean deleteByIds(MappingMethodDTO mappingMethodDTO) {
+ if(!StringUtils.isNotEmpty(mappingMethodDTO.getMappingMethodIds())){
+ throw new ServiceException("方法ID不能为空");
+ }
+ Set mappingMethodIdSet = Stream.of(mappingMethodDTO.getMappingMethodIds().split(",")).collect(Collectors.toSet());
+ Long[] mappingMethodIds = mappingMethodIdSet.stream().map(Long::valueOf).toArray(Long[]::new);
+ return mappingMethodDomainService.delete(mappingMethodIds);
+ }
+
+ public MappingMethodPO getInfoById(MappingMethodDTO mappingMethodDTO) {
+ if(null == mappingMethodDTO.getMappingMethodId()){
+ throw new ServiceException("方法ID不能为空");
+ }
+ return mappingMethodDomainService.getInfo(mappingMethodDTO.getMappingMethodId());
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentManage/PaymentManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentManage/PaymentManageApplicationService.java
new file mode 100644
index 000000000..351adc201
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentManage/PaymentManageApplicationService.java
@@ -0,0 +1,110 @@
+package com.mhd.bms.application.server.paymentManage;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.mhd.bms.domain.paymentManage.entity.PaymentManage;
+import com.mhd.bms.domain.paymentManage.repository.po.PaymentManagePO;
+import com.mhd.bms.domain.paymentManage.repository.todo.PaymentManageDO;
+import com.mhd.bms.domain.paymentManage.service.PaymentManageDomainService;
+import com.mhd.bms.interfaces.dto.paymentManage.PaymentManageDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 支付管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-09
+ */
+@Service
+@Slf4j
+public class PaymentManageApplicationService {
+ @Autowired
+ private PaymentManageDomainService paymentManageDomainService;
+
+
+ /**
+ * 分页查询支付管理列表
+ */
+
+ public List queryList(PaymentManageDO paymentManageDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ paymentManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return paymentManageDomainService.queryList(paymentManageDO);
+ }
+
+
+ /**
+ * 新增支付管理
+ */
+ public Boolean insert(PaymentManageDO paymentManageDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //校验支付编码是否重复
+ PaymentManage paymentManage = paymentManageDomainService.selectByPaymentCode(paymentManageDO.getPaymentMethodCode());
+ if(null != paymentManage){
+ throw new ServiceException("支付编码不能重复");
+ }
+ paymentManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ paymentManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ paymentManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ return paymentManageDomainService.insert(paymentManageDO);
+ }
+
+ /**
+ * 修改支付管理
+ */
+ public Boolean update(PaymentManageDO paymentManageDO) {
+ //校验支付编码是否重复
+ PaymentManage paymentManage = paymentManageDomainService.selectByPaymentCode(paymentManageDO.getPaymentMethodCode());
+ if(null != paymentManage && !Objects.equals(paymentManage.getPaymentManageId(), paymentManageDO.getPaymentManageId())){
+ throw new ServiceException("支付编码不能重复");
+ }
+ return paymentManageDomainService.update(paymentManageDO);
+ }
+
+ /**
+ * 批量删除支付管理
+ */
+ public boolean delete(Long[] paymentManageIds) {
+ return paymentManageDomainService.delete(paymentManageIds);
+ }
+
+ /**
+ * 获取支付管理详细信息
+ */
+ public PaymentManagePO getInfo(Long paymentManageId)
+ {
+ return paymentManageDomainService.getInfo(paymentManageId);
+ }
+
+ /**
+ * 根据id删除支付管理
+ */
+ public Boolean deleteByIds(PaymentManageDTO paymentManageDTO) {
+ if(!StringUtils.isNotEmpty(paymentManageDTO.getPaymentManageIds())){
+ throw new ServiceException("支付管理id不能为空");
+ }
+ Set paymentManageIdSet = Stream.of(paymentManageDTO.getPaymentManageIds().split(",")).collect(Collectors.toSet());
+ Long[] paymentManageIds = paymentManageIdSet.stream().map(Long::valueOf).toArray(Long[]::new);
+ return paymentManageDomainService.delete(paymentManageIds);
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentOrder/PaymentOrderApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentOrder/PaymentOrderApplicationService.java
new file mode 100644
index 000000000..67a33870e
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentOrder/PaymentOrderApplicationService.java
@@ -0,0 +1,118 @@
+package com.mhd.bms.application.server.paymentOrder;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.mhd.bms.domain.billManage.service.BillManageDomainService;
+import com.mhd.bms.domain.paymentOrder.repository.po.PaymentOrderPO;
+import com.mhd.bms.domain.paymentOrder.repository.todo.PaymentOrderDO;
+import com.mhd.bms.domain.paymentOrder.service.PaymentOrderDomainService;
+import com.mhd.bms.infrastructure.utils.CheckPasswordUtil;
+import com.mhd.bms.interfaces.dto.paymentOrder.PaymentOrderDTO;
+import com.mhd.common.core.constant.PaymentChannelConstants;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+/**
+ * 付款单ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-16
+ */
+@Service
+@Slf4j
+public class PaymentOrderApplicationService {
+ @Autowired
+ private PaymentOrderDomainService paymentOrderDomainService;
+ @Autowired
+ private BillManageDomainService billManageDomainService;
+
+
+ /**
+ * 分页查询付款单列表
+ */
+
+ public List queryList(PaymentOrderDO paymentOrderDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ paymentOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return paymentOrderDomainService.queryList(paymentOrderDO);
+ }
+
+
+ /**
+ * 新增付款单
+ */
+ public Boolean insert(PaymentOrderDO paymentOrderDO) {
+
+ return paymentOrderDomainService.insert(paymentOrderDO);
+ }
+
+ /**
+ * 修改付款单
+ */
+ public Boolean update(PaymentOrderDO paymentOrderDO) {
+ return paymentOrderDomainService.update(paymentOrderDO);
+ }
+
+ /**
+ * 批量删除付款单
+ */
+ public boolean delete(Long[] paymentOrderIds) {
+ return paymentOrderDomainService.delete(paymentOrderIds);
+ }
+
+ /**
+ * 获取付款单详细信息
+ */
+ public PaymentOrderPO getInfo(Long paymentOrderId)
+ {
+ return paymentOrderDomainService.getInfo(paymentOrderId);
+ }
+
+
+ /**
+ * 批量付款
+ */
+// @Transactional
+ public boolean batchPayment(PaymentOrderDO paymentOrderDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //校验支付密码
+ CheckPasswordUtil.checkPayPassword(paymentOrderDO.getPayPassword(),null);
+ //校验账单状态是否合规
+ paymentOrderDomainService.checkSettlementStatus(paymentOrderDO);
+ //判断支付通道类型 TODO 此处先只做线下支付
+ if(ObjectUtil.equal(paymentOrderDO.getPaymentChannelCode(), PaymentChannelConstants.offline_pay)){
+ //付款
+ Boolean flag = paymentOrderDomainService.batchPayment(paymentOrderDO);
+ //更改账单状态
+ Boolean flagTwo = billManageDomainService.updateBillPaymentInfo(paymentOrderDO);
+ return flag && flagTwo;
+ }
+
+ return false;
+ }
+
+ /**
+ * 根据id获取付款单信息
+ */
+ public PaymentOrderPO getInfoById(PaymentOrderDTO paymentOrderDTO) {
+ if(paymentOrderDTO.getPaymentOrderId() == null){
+ throw new ServiceException("付款单id不能为空");
+ }
+ return paymentOrderDomainService.getInfoById(paymentOrderDTO.getPaymentOrderId());
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentWallet/PaymentWalletApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentWallet/PaymentWalletApplicationService.java
new file mode 100644
index 000000000..94651d5c6
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/paymentWallet/PaymentWalletApplicationService.java
@@ -0,0 +1,136 @@
+package com.mhd.bms.application.server.paymentWallet;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.mhd.bms.domain.paymentManage.entity.PaymentManage;
+import com.mhd.bms.domain.paymentManage.repository.po.PaymentManagePO;
+import com.mhd.bms.domain.paymentManage.service.PaymentManageDomainService;
+import com.mhd.bms.domain.paymentWallet.repository.po.PaymentWalletPO;
+import com.mhd.bms.domain.paymentWallet.repository.todo.PaymentWalletDO;
+import com.mhd.bms.domain.paymentWallet.service.PaymentWalletDomainService;
+import com.mhd.bms.interfaces.dto.paymentWallet.PaymentWalletDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 支付钱包管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-09
+ */
+@Service
+@Slf4j
+public class PaymentWalletApplicationService {
+ @Autowired
+ private PaymentWalletDomainService paymentWalletDomainService;
+ @Autowired
+ private PaymentManageDomainService paymentManageDomainService;
+
+
+ /**
+ * 分页查询支付钱包管理列表
+ */
+
+ public List queryList(PaymentWalletDO paymentWalletDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ paymentWalletDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return paymentWalletDomainService.queryList(paymentWalletDO);
+ }
+
+
+ /**
+ * 新增支付钱包管理
+ */
+ public Boolean insert(PaymentWalletDO paymentWalletDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //根据支付方式编码查询支付方式
+ if(!StringUtils.isNotEmpty(paymentWalletDO.getPaymentMethodCode())){
+ throw new ServiceException("支付方式编码不能为空");
+ }
+ PaymentManage paymentManage = paymentManageDomainService.selectByPaymentCode(paymentWalletDO.getPaymentMethodCode());
+ if(null == paymentManage){
+ throw new ServiceException("支付方式信息未找到");
+ }
+ paymentWalletDO.setPaymentMethod(paymentManage.getPaymentMethod());
+ paymentWalletDO.setPaymentManageId(paymentManage.getPaymentManageId());
+ paymentWalletDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ paymentWalletDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ paymentWalletDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ return paymentWalletDomainService.insert(paymentWalletDO);
+ }
+
+ /**
+ * 修改支付钱包管理
+ */
+ public Boolean update(PaymentWalletDO paymentWalletDO) {
+ //根据支付方式编码查询支付方式
+ if(!StringUtils.isNotEmpty(paymentWalletDO.getPaymentMethodCode())){
+ throw new ServiceException("支付方式编码不能为空");
+ }
+ PaymentManage paymentManage = paymentManageDomainService.selectByPaymentCode(paymentWalletDO.getPaymentMethodCode());
+ if(null == paymentManage){
+ throw new ServiceException("支付方式信息未找到");
+ }
+ paymentWalletDO.setPaymentMethod(paymentWalletDO.getPaymentMethod());
+ paymentWalletDO.setPaymentWalletId(paymentWalletDO.getPaymentWalletId());
+ return paymentWalletDomainService.update(paymentWalletDO);
+ }
+
+ /**
+ * 批量删除支付钱包管理
+ */
+ public boolean delete(Long[] paymentWalletIds) {
+ return paymentWalletDomainService.delete(paymentWalletIds);
+ }
+
+ /**
+ * 获取支付钱包管理详细信息
+ */
+ public PaymentWalletPO getInfo(Long paymentWalletId)
+ {
+ return paymentWalletDomainService.getInfo(paymentWalletId);
+ }
+
+
+ /**
+ * 批量删除支付钱包管理
+ */
+ public Boolean deleteByIds(PaymentWalletDTO paymentWalletDTO) {
+ if(!StringUtils.isNotEmpty(paymentWalletDTO.getPaymentWalletIds())){
+ throw new ServiceException("支付钱包管理id不能为空");
+ }
+ Set paymentWalletIdSet = Stream.of(paymentWalletDTO.getPaymentWalletIds().split(",")).collect(Collectors.toSet());
+ Long[] paymentWalletIds = paymentWalletIdSet.stream().map(Long::valueOf).toArray(Long[]::new);
+ return paymentWalletDomainService.delete(paymentWalletIds);
+ }
+
+ /**
+ * 查看详情
+ * @param paymentWalletDTO
+ * @return
+ */
+ public PaymentWalletPO getInfoById(PaymentWalletDTO paymentWalletDTO) {
+ if(null == paymentWalletDTO.getPaymentWalletId()){
+ throw new ServiceException("支付钱包id不能为空");
+ }
+ return paymentWalletDomainService.getInfo(paymentWalletDTO.getPaymentWalletId());
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java
new file mode 100644
index 000000000..3e1c3aa4b
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/receiptManage/ReceiptManageApplicationService.java
@@ -0,0 +1,131 @@
+package com.mhd.bms.application.server.receiptManage;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.mhd.bms.domain.billManage.service.BillManageDomainService;
+import com.mhd.bms.domain.receiptManage.entity.ReceiptManage;
+import com.mhd.bms.domain.receiptManage.repository.po.ReceiptManagePO;
+import com.mhd.bms.domain.receiptManage.repository.todo.ReceiptManageDO;
+import com.mhd.bms.domain.receiptManage.service.ReceiptManageDomainService;
+import com.mhd.bms.infrastructure.utils.CheckPasswordUtil;
+import com.mhd.bms.interfaces.dto.receiptManage.ReceiptManageDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 收款单管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-08
+ */
+@Service
+@Slf4j
+public class ReceiptManageApplicationService {
+ @Autowired
+ private ReceiptManageDomainService receiptManageDomainService;
+ @Autowired
+ private BillManageDomainService billManageDomainService;
+
+
+ /**
+ * 分页查询收款单管理列表
+ */
+
+ public List queryList(ReceiptManageDO receiptManageDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null){
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ receiptManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ }
+ return receiptManageDomainService.queryList(receiptManageDO);
+ }
+
+
+ /**
+ * 新增收款单管理
+ */
+ public Boolean insert(ReceiptManageDO receiptManageDO) {
+
+ return receiptManageDomainService.insert(receiptManageDO);
+ }
+
+ /**
+ * 修改收款单管理
+ */
+ public Boolean update(ReceiptManageDO receiptManageDO) {
+ return receiptManageDomainService.update(receiptManageDO);
+ }
+
+ /**
+ * 批量删除收款单管理
+ */
+ public boolean delete(Long[] receiptManageIds) {
+ return receiptManageDomainService.delete(receiptManageIds);
+ }
+
+ /**
+ * 获取收款单管理详细信息
+ */
+ public ReceiptManagePO getInfo(Long receiptManageId)
+ {
+ return receiptManageDomainService.getInfo(receiptManageId);
+ }
+
+
+ /**
+ * 批量收款
+ */
+ @Transactional
+ public Boolean batchCollection(ReceiptManageDO receiptManageDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ //校验支付密码
+ CheckPasswordUtil.checkPayPassword(receiptManageDO.getPayPassword(),null);
+ //校验结算状态是否正确
+// receiptManageDomainService.checkSettlementStatus(receiptManageDO);
+ //保存结算单
+ Boolean flag = receiptManageDomainService.batchCollection(receiptManageDO);
+ //更新账单信息
+ Boolean flagTwo = billManageDomainService.updateBillSettlementInfo(receiptManageDO);
+ return flag && flagTwo;
+ }
+
+
+ /**
+ * 退款
+ */
+ @Transactional
+ public Boolean refund(ReceiptManageDO receiptManageDO) {
+ //校验支付密码
+ CheckPasswordUtil.checkPayPassword(receiptManageDO.getPayPassword(),null);
+ return receiptManageDomainService.refund(receiptManageDO);
+ }
+
+ /**
+ * 查询收款单详情
+ */
+ public ReceiptManagePO getDetailsInfo(ReceiptManageDTO receiptManageDTO) {
+ if(null == receiptManageDTO.getReceiptManageId()){
+ throw new ServiceException("收款单id不能为空");
+ }
+ return receiptManageDomainService.getDetailsInfo(receiptManageDTO.getReceiptManageId());
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryManageApplicationService.java
new file mode 100644
index 000000000..6f6e25596
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryManageApplicationService.java
@@ -0,0 +1,134 @@
+package com.mhd.bms.application.server.reportForm;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.mhd.bms.domain.reportForm.entity.FormQueryManage;
+import com.mhd.bms.domain.reportForm.repository.po.FormQueryManagePO;
+import com.mhd.bms.domain.reportForm.repository.po.FormQueryParamsPO;
+import com.mhd.bms.domain.reportForm.repository.todo.FormQueryManageDO;
+import com.mhd.bms.domain.reportForm.service.FormQueryManageDomainService;
+import com.mhd.bms.interfaces.dto.reportForm.FormQueryManageDTO;
+import com.mhd.bms.interfaces.dto.reportForm.FormQueryParamsDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+/**
+ * 查询条件管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-26
+ */
+@Service
+@Slf4j
+public class FormQueryManageApplicationService {
+ @Autowired
+ private FormQueryManageDomainService formQueryManageDomainService;
+ @Autowired
+ private FormQueryParamsApplicationService formQueryParamsApplicationService;
+
+
+ /**
+ * 分页查询查询条件管理列表
+ */
+
+ public List queryList(FormQueryManageDO formQueryManageDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ if(formQueryManageDO.getFormType() == null){
+ throw new ServiceException("所属报表类型不能为空");
+ }
+ if(formQueryManageDO.getReportFormId() == null){
+ throw new ServiceException("报表ID不能为空");
+ }
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ formQueryManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ formQueryManageDO.setCreateBy(loginUser.getUserPo().getUserId());
+ List formQueryManagePOList = formQueryManageDomainService.queryList(formQueryManageDO);
+ if(null != formQueryManagePOList && formQueryManagePOList.size() > 0){
+ for (FormQueryManagePO formQueryManagePO : formQueryManagePOList) {
+ List formQueryParamsPOList = formQueryParamsApplicationService.getInfoByFormQueryManageId(formQueryManagePO.getFormQueryManageId());
+ formQueryManagePO.setFormQueryParamsPOList(formQueryParamsPOList);
+ }
+ }
+ return formQueryManagePOList;
+ }
+
+
+ /**
+ * 新增查询条件管理
+ */
+ @Transactional
+ public Boolean insert(FormQueryManageDO formQueryManageDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ formQueryManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ formQueryManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ formQueryManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ //判断如果该查询条件设为了默认,则将其他的设为非默认
+ if (formQueryManageDO.getDefaultFlag() == 1){
+ formQueryManageDomainService.updateDefaultFlag(formQueryManageDO.getFormType());
+ }
+ boolean flagTwo = formQueryManageDomainService.insert(formQueryManageDO);
+ for (FormQueryParamsDTO formQueryParamsDTO : formQueryManageDO.getFormQueryParamsDTOList()) {
+ formQueryParamsDTO.setFormQueryManageId(formQueryManageDO.getFormQueryManageId());
+ }
+ boolean flag = formQueryParamsApplicationService.insert(formQueryManageDO.getFormQueryParamsDTOList());
+ return flag && flagTwo;
+ }
+
+ /**
+ * 修改查询条件管理
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean update(FormQueryManageDO formQueryManageDO) {
+ //先将之前的旧数据删除
+ Boolean flagThree = formQueryParamsApplicationService.deleteByFormQueryManageId(formQueryManageDO.getFormQueryManageId());
+ Boolean flag = formQueryParamsApplicationService.update(formQueryManageDO.getFormQueryParamsDTOList());
+ Boolean flagTwo = formQueryManageDomainService.update(formQueryManageDO);
+ return flag && flagTwo && flagThree;
+ }
+
+ /**
+ * 批量删除查询条件管理
+ */
+ public boolean delete(Long[] formQueryManageIds) {
+ return formQueryManageDomainService.delete(formQueryManageIds);
+ }
+
+ /**
+ * 获取查询条件管理详细信息
+ */
+ public FormQueryManagePO getInfo(Long formQueryManageId)
+ {
+ FormQueryManagePO formQueryManagePO = formQueryManageDomainService.getInfo(formQueryManageId);
+ List formQueryParamsPOList = formQueryParamsApplicationService.getInfoByFormQueryManageId(formQueryManageId);
+ if(null != formQueryManagePO){
+ formQueryManagePO.setFormQueryParamsPOList(formQueryParamsPOList);
+ }
+ return formQueryManagePO;
+ }
+
+
+ public Boolean deleteByIds(FormQueryManageDTO formQueryManageDTO) {
+ if(formQueryManageDTO.getFormQueryManageId() == null){
+ throw new ServiceException("查询条件管理id不能为空");
+ }
+ Boolean flag = formQueryManageDomainService.deleteById(formQueryManageDTO.getFormQueryManageId());
+ Boolean flagTwo = formQueryParamsApplicationService.deleteByFormQueryManageId(formQueryManageDTO.getFormQueryManageId());
+ return flag && flagTwo;
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryParamsApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryParamsApplicationService.java
new file mode 100644
index 000000000..32ebeacf1
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/FormQueryParamsApplicationService.java
@@ -0,0 +1,90 @@
+package com.mhd.bms.application.server.reportForm;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.mhd.bms.domain.reportForm.entity.FormQueryParams;
+import com.mhd.bms.domain.reportForm.repository.po.FormQueryParamsPO;
+import com.mhd.bms.domain.reportForm.repository.todo.FormQueryParamsDO;
+import com.mhd.bms.domain.reportForm.service.FormQueryParamsDomainService;
+import com.mhd.bms.interfaces.dto.reportForm.FormQueryParamsDTO;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+/**
+ * 报查询条件管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-25
+ */
+@Service
+@Slf4j
+public class FormQueryParamsApplicationService {
+ @Autowired
+ private FormQueryParamsDomainService formQueryParamsDomainService;
+
+
+ /**
+ * 分页查询报查询条件管理列表
+ */
+
+ public List queryList(FormQueryParamsDO formQueryParamsDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ formQueryParamsDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ formQueryParamsDO.setCreateBy(loginUser.getUserPo().getUserId());
+ return formQueryParamsDomainService.queryList(formQueryParamsDO);
+ }
+
+
+ /**
+ * 新增报查询条件管理
+ */
+ public Boolean insert(List formQueryParamsDTOList) {
+ return formQueryParamsDomainService.saveBatch(formQueryParamsDTOList);
+ }
+
+ /**
+ * 修改报查询条件管理
+ */
+ public Boolean update(List formQueryParamsDTOList) {
+ return formQueryParamsDomainService.update(formQueryParamsDTOList);
+ }
+
+ /**
+ * 批量删除报查询条件管理
+ */
+ public boolean delete(Long[] formQueryParamsIds) {
+ return formQueryParamsDomainService.delete(formQueryParamsIds);
+ }
+
+ /**
+ * 获取报查询条件管理详细信息
+ */
+ public FormQueryParamsPO getInfo(Long formQueryParamsId)
+ {
+ return formQueryParamsDomainService.getInfo(formQueryParamsId);
+ }
+
+
+ /**
+ * 根据表单查询管理ID,删除表单参数列表
+ */
+ public Boolean deleteByFormQueryManageId(Long formQueryManageId) {
+ return formQueryParamsDomainService.deleteByFormQueryManageId(formQueryManageId);
+ }
+
+ public List getInfoByFormQueryManageId(Long formQueryManageId) {
+ return formQueryParamsDomainService.getInfoByFormQueryManageId(formQueryManageId);
+ }
+}
diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/ReportFormApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/ReportFormApplicationService.java
new file mode 100644
index 000000000..5779f7b90
--- /dev/null
+++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/reportForm/ReportFormApplicationService.java
@@ -0,0 +1,768 @@
+package com.mhd.bms.application.server.reportForm;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.ReflectUtil;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.mhd.bms.domain.billManage.entity.BillManage;
+import com.mhd.bms.domain.billManage.service.BillManageDomainService;
+import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
+import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
+import com.mhd.bms.domain.paymentManage.entity.PaymentManage;
+import com.mhd.bms.domain.paymentOrder.entity.PaymentOrder;
+import com.mhd.bms.domain.paymentOrder.entity.PaymentOrderDetails;
+import com.mhd.bms.domain.paymentOrder.service.PaymentOrderDetailsDomainService;
+import com.mhd.bms.domain.paymentOrder.service.PaymentOrderDomainService;
+import com.mhd.bms.domain.receiptManage.entity.ReceiptDetail;
+import com.mhd.bms.domain.receiptManage.entity.ReceiptManage;
+import com.mhd.bms.domain.receiptManage.service.ReceiptDetailDomainService;
+import com.mhd.bms.domain.receiptManage.service.ReceiptManageDomainService;
+import com.mhd.bms.domain.reportForm.entity.FormQueryParams;
+import com.mhd.bms.domain.reportForm.repository.po.ReportFormPO;
+import com.mhd.bms.domain.reportForm.repository.todo.ReportFormDO;
+import com.mhd.bms.domain.reportForm.service.ReportFormDomainService;
+import com.mhd.bms.interfaces.dto.reportForm.ReportFormDTO;
+import com.mhd.common.core.exception.ServiceException;
+import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
+import com.mhd.common.core.exception.digitalLogisticsException.UserError;
+import com.mhd.common.core.utils.PageUtils;
+import com.mhd.common.core.utils.StringUtils;
+import com.mhd.common.security.utils.SecurityUtils;
+import com.mhd.system.api.model.LoginUser;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.temporal.WeekFields;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+/**
+ * 分析报管理ApplicationService
+ *
+ * @author gen
+ * @date 2024-07-25
+ */
+@Service
+@Slf4j
+public class ReportFormApplicationService {
+ @Autowired
+ private ReportFormDomainService reportFormDomainService;
+ @Autowired
+ private BillingStatementDomainService billingStatementDomainService;
+ @Autowired
+ private BillManageDomainService billManageDomainService;
+ @Autowired
+ private PaymentOrderDomainService paymentOrderDomainService;
+ @Autowired
+ private PaymentOrderDetailsDomainService paymentOrderDetailsDomainService;
+ @Autowired
+ private ReceiptManageDomainService receiptManageDomainService;
+ @Autowired
+ private ReceiptDetailDomainService receiptDetailDomainService;
+
+ //特殊字段集合
+ private static ArrayList specialFieldsList = new ArrayList<>();
+ static {
+ specialFieldsList.add("form_years");
+ specialFieldsList.add("form_month");
+ specialFieldsList.add("form_day");
+ specialFieldsList.add("form_week");
+ }
+
+
+ /**
+ * 分页查询分析报管理列表
+ */
+
+ public List queryList(ReportFormDO reportFormDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ if(reportFormDO.getFormType()==null){
+ throw new ServiceException("报表类型不能为空");
+ }
+ Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
+ if (topOrganizationId != null && topOrganizationId != 1){
+ reportFormDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ }
+ reportFormDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ return reportFormDomainService.queryList(reportFormDO);
+ }
+
+
+ /**
+ * 新增分析报管理
+ */
+ public Boolean insert(ReportFormDO reportFormDO) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (ObjectUtil.isNull(loginUser)) {
+ throw new DigitalLogisticsException(UserError.TIMEOUT);
+ }
+ reportFormDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
+ reportFormDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
+ reportFormDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
+ return reportFormDomainService.insert(reportFormDO);
+ }
+
+ /**
+ * 修改分析报管理
+ */
+ public Boolean update(ReportFormDO reportFormDO) {
+ return reportFormDomainService.update(reportFormDO);
+ }
+
+ /**
+ * 批量删除分析报管理
+ */
+ public boolean delete(Long[] reportFormIds) {
+ return reportFormDomainService.delete(reportFormIds);
+ }
+
+ /**
+ * 获取分析报管理详细信息
+ */
+ public ReportFormPO getInfo(Long reportFormId)
+ {
+ return reportFormDomainService.getInfo(reportFormId);
+ }
+
+
+ public Boolean deleteByIds(ReportFormDTO reportFormDTO) {
+ if(reportFormDTO.getReportFormId()==null){
+ throw new ServiceException("报表信息ID不能为空");
+ }
+ return reportFormDomainService.deleteByIds(reportFormDTO.getReportFormId());
+ }
+
+ /**
+ * 综合分析报表查询
+ */
+ public List