From 92eb695ac1254708feb6e740432fc5da9e1ad42b Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 08 七月 2026 15:37:12 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' into dev_山西_黎城康森商砼
---
src/main/java/com/ruoyi/production/bean/dto/ProductionPlanImportDto.java | 4
src/main/java/com/ruoyi/ai/assistant/ApproveTodoIntentExecutor.java | 199
src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceMapper.java | 24
src/main/java/com/ruoyi/sales/service/ShippingInfoService.java | 9
src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java | 22
src/main/java/com/ruoyi/purchase/service/PurchaseReportService.java | 14
src/main/java/com/ruoyi/account/mapper/financial/FinFixedAssetMapper.java | 12
src/main/java/com/ruoyi/collaborativeApproval/service/impl/MeetingServiceImpl.java | 4
src/main/java/com/ruoyi/common/utils/OrderUtils.java | 19
src/main/java/com/ruoyi/account/bean/dto/SalesRefundAmountOrderDto.java | 24
src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeController.java | 18
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java | 199
src/main/java/com/ruoyi/approve/pojo/KnowledgeBaseVector.java | 80
src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsVo.java | 33
src/main/java/com/ruoyi/technology/bean/vo/TechnologyBomStructureVo.java | 3
src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java | 104
doc/financial-ai-front-integration.md | 192
src/main/resources/application-dev.yml | 15
src/main/java/com/ruoyi/staff/service/StaffSalaryMainService.java | 8
src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeDeptMapper.xml | 13
src/main/java/com/ruoyi/account/service/purchase/AccountPaymentApplicationService.java | 33
src/main/java/com/ruoyi/technology/controller/TechnologyOperationController.java | 10
src/main/java/com/ruoyi/project/common/CaptchaController.java | 196
src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java | 32
src/main/java/com/ruoyi/production/controller/ProductionOrderController.java | 18
src/main/resources/application-yss.yml | 268
src/main/java/com/ruoyi/approve/dto/KnowledgeBaseVectorVO.java | 21
src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java | 7
src/main/java/com/ruoyi/approve/service/KnowledgeBaseVectorService.java | 43
src/main/java/com/ruoyi/device/pojo/DeviceRepair.java | 12
src/main/java/com/ruoyi/account/service/sales/AccountSalesService.java | 28
src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java | 10
src/main/java/com/ruoyi/account/pojo/financial/FinVoucherEntry.java | 85
src/main/java/com/ruoyi/approve/mapper/ApprovalTaskMapper.java | 18
docs/mock_data_check.md | 183
src/main/java/com/ruoyi/account/service/financial/AccountPurchaseService.java | 27
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java | 108
src/main/resources/mapper/system/SysPostMapper.xml | 31
src/main/java/com/ruoyi/stock/service/StockOutRecordService.java | 2
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDto.java | 197
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java | 7
src/main/resources/mapper/system/SysDictTypeMapper.xml | 25
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementUpdateDto.java | 32
src/main/java/com/ruoyi/approve/pojo/ApprovalInstance.java | 151
src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchasePaymentVo.java | 34
src/main/java/com/ruoyi/approve/mapper/FinReimbursementMapper.java | 24
src/main/java/com/ruoyi/project/system/controller/SysConfigController.java | 254
doc/前端联调文档-设备报修保养财务模块改造.md | 233
src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java | 237
src/main/java/com/ruoyi/approve/mapper/FinReimbursementDetailMapper.java | 18
src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java | 9
src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDistributionVO.java | 27
src/main/java/com/ruoyi/account/controller/sales/AccountInvoiceApplicationController.java | 94
src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateDto.java | 15
src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java | 94
src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml | 37
src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseInboundDto.java | 31
src/main/resources/mapper/approve/ApprovalInstanceMapper.xml | 61
src/main/java/com/ruoyi/mock/service/DataGenerateService.java | 15
src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml | 3
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java | 3
src/main/java/com/ruoyi/project/monitor/controller/CacheController.java | 222
src/main/java/com/ruoyi/sales/controller/PaymentShippingController.java | 3
src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java | 21
src/main/resources/financial-agent-prompt.txt | 11
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java | 142
src/main/java/com/ruoyi/approve/service/FinReimbursementTravelService.java | 16
src/main/java/com/ruoyi/mock/service/impl/DataGenerateServiceImpl.java | 1745 +
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java | 31
src/main/java/com/ruoyi/account/service/financial/FinVoucherService.java | 27
src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java | 123
src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml | 48
src/main/java/com/ruoyi/account/bean/vo/sales/AccountInvoiceApplicationVo.java | 23
src/main/java/com/ruoyi/ai/service/impl/AiChatSessionServiceImpl.java | 23
src/main/java/com/ruoyi/purchase/vo/PurchaseStockInProductVo.java | 53
src/main/java/com/ruoyi/approve/service/impl/FinReimbursementDetailServiceImpl.java | 20
src/main/resources/application-zdjc.yml | 268
src/main/java/com/ruoyi/account/bean/vo/sales/SalesReturnVo.java | 64
src/main/resources/mapper/sales/ShippingInfoMapper.xml | 50
src/main/java/com/ruoyi/account/mapper/SalesRefundAmountOrderMapper.java | 2
src/main/java/com/ruoyi/technology/service/impl/TechnologyBomServiceImpl.java | 137
src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java | 8
src/main/resources/sales-agent-prompt.txt | 9
doc/20260520_首页生产看板性能优化前端变更文档.md | 107
src/main/java/com/ruoyi/account/mapper/purchase/AccountPaymentApplicationMapper.java | 32
src/main/java/com/ruoyi/ai/controller/XiaozhiController.java | 42
src/main/java/com/ruoyi/warehouse/service/DocumentationFileService.java | 3
src/main/java/com/ruoyi/approve/controller/ApprovalRecordController.java | 18
src/main/java/com/ruoyi/mock/service/impl/DataCheckServiceImpl.java | 282
src/main/java/com/ruoyi/staff/service/impl/StaffSalaryMainServiceImpl.java | 202
src/main/resources/mapper/production/ProductionProductMainMapper.xml | 12
src/main/resources/mapper/system/SysUserMapper.xml | 32
src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchaseInvoiceDto.java | 32
src/main/resources/application.yml | 10
src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java | 22
src/main/java/com/ruoyi/stock/controller/StockUninventoryController.java | 12
src/main/java/com/ruoyi/mock/vo/DataGenerateResult.java | 37
src/main/java/com/ruoyi/production/pojo/ProductionProductInput.java | 3
src/main/java/com/ruoyi/project/system/service/ISysUserService.java | 7
src/main/java/com/ruoyi/stock/mapper/StockOutRecordMapper.java | 3
src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java | 31
src/main/java/com/ruoyi/approve/controller/KnowledgeBaseController.java | 140
src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchasePayment.java | 127
src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java | 60
src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java | 307
src/main/java/com/ruoyi/approve/service/impl/FinReimbursementServiceImpl.java | 574
src/main/java/com/ruoyi/basic/dto/StorageBlobVO.java | 4
src/main/java/com/ruoyi/procurementrecord/bean/dto/Details.java | 20
src/main/java/com/ruoyi/sales/vo/CustomerTransactionsDetailsVo.java | 36
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java | 111
src/main/resources/mapper/staff/StaffOnJobMapper.xml | 112
src/main/java/com/ruoyi/ai/service/KnowledgeRagService.java | 34
src/main/java/com/ruoyi/approve/service/impl/KnowledgeBaseVectorServiceImpl.java | 144
src/main/java/com/ruoyi/purchase/service/impl/PurchaseReportServiceImpl.java | 32
src/main/java/com/ruoyi/account/bean/dto/SalesReceiptReturnDto.java | 8
src/main/java/com/ruoyi/mock/prompt/MockDataPrompt.java | 242
src/main/java/com/ruoyi/project/system/controller/SysDictDataController.java | 240
src/main/resources/mapper/device/DeviceLedgerMapper.xml | 2
src/main/java/com/ruoyi/approve/controller/FinReimbursementTravelController.java | 18
src/main/java/com/ruoyi/ai/assistant/PurchaseAgent.java | 3
src/main/java/com/ruoyi/basic/service/impl/SupplierServiceImpl.java | 12
src/main/java/com/ruoyi/device/mapper/DeviceLedgerMapper.java | 4
src/main/resources/mapper/stock/StockOutRecordMapper.xml | 39
src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseReturnDto.java | 31
src/main/java/com/ruoyi/CodeGenerator.java | 6
src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java | 2
src/main/java/com/ruoyi/basic/enums/ApplicationTypeEnum.java | 3
src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java | 6
src/main/java/com/ruoyi/technology/service/TechnologyOperationService.java | 2
src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java | 66
src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java | 7
src/main/java/com/ruoyi/projectManagement/controller/RolesController.java | 4
src/main/java/com/ruoyi/account/pojo/AccountStatementDetails.java | 115
src/main/java/com/ruoyi/account/service/AccountStatementDetailsService.java | 16
src/main/java/com/ruoyi/ai/assistant/PurchaseIntentExecutor.java | 249
src/main/java/com/ruoyi/procurementrecord/service/ReturnSaleProductService.java | 2
src/main/java/com/ruoyi/staff/controller/StaffSalaryMainController.java | 18
src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesInvoiceDto.java | 33
src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNews.java | 88
src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml | 1
src/main/resources/mapper/production/ProductionPlanMapper.xml | 3
src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java | 44
doc/20260522_采购台账入库状态_销售产品入库审核状态前端联调文档.md | 127
src/main/java/com/ruoyi/framework/security/LoginUser.java | 5
src/main/java/com/ruoyi/ai/controller/PurchaseAiController.java | 855
src/main/java/com/ruoyi/approve/controller/ApprovalInstanceController.java | 67
src/main/java/com/ruoyi/approve/controller/FinReimbursementDetailController.java | 18
src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml | 30
src/main/java/com/ruoyi/ai/store/MongoChatMemoryStore.java | 73
src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java | 39
src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml | 16
src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java | 1
src/main/java/com/ruoyi/quality/controller/QualityInspectParamController.java | 25
src/main/java/com/ruoyi/technology/service/impl/TechnologyParamServiceImpl.java | 10
src/main/java/com/ruoyi/account/service/impl/SalesRefundAmountOrderServiceImpl.java | 2
src/main/java/com/ruoyi/basic/dto/ProductModelExportDto.java | 3
src/main/java/com/ruoyi/collaborativeApproval/vo/EnterpriseNewsVo.java | 15
src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsServiceImpl.java | 409
src/main/java/com/ruoyi/account/controller/purchase/AccountPaymentApplicationController.java | 86
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java | 31
src/main/resources/mapper/stock/StockInventoryMapper.xml | 390
src/main/resources/mapper/approve/ApprovalInstanceNodeMapper.xml | 21
doc/20260522_StockInRecord列表源单号前端联调文档_276补充.md | 65
src/main/java/com/ruoyi/framework/config/ApplicationConfig.java | 94
src/main/java/com/ruoyi/project/system/domain/SysUser.java | 78
src/main/java/com/ruoyi/basic/service/ICustomerService.java | 18
src/main/resources/application-hqjc.yml | 268
src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesCollectionServiceImpl.java | 96
src/main/java/com/ruoyi/account/pojo/financial/FinIntangibleAsset.java | 98
src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationService.java | 3
src/main/java/com/ruoyi/account/service/SalesReceiptReturnService.java | 2
src/main/java/com/ruoyi/ai/schedule/AiSessionCleanupTask.java | 24
src/main/resources/mapper/account/financial/AccountSubjectMapper.xml | 31
src/main/resources/application-ckgm.yml | 268
src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsController.java | 61
src/main/java/com/ruoyi/account/mapper/sales/AccountSalesCollectionMapper.java | 35
doc/20260515_设备巡检异常联动维修单_前端联调文档.md | 170
src/main/java/com/ruoyi/home/dto/StatisticsReceivablePayableDto.java | 4
src/main/java/com/ruoyi/production/service/impl/ProductionProductOutputServiceImpl.java | 1
src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java | 4
src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java | 508
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementExceptionRecordController.java | 11
src/main/java/com/ruoyi/account/bean/dto/StatementAccountDto.java | 35
src/main/resources/mapper/measuringinstrumentledger/SparePartsRequisitionRecordMapper.xml | 1
src/main/java/com/ruoyi/project/monitor/controller/SysJobController.java | 372
src/main/java/com/ruoyi/account/service/purchase/AccountPurchaseInvoiceService.java | 31
src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java | 2
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml | 237
src/main/java/com/ruoyi/purchase/pojo/SalesLedgerProductTemplate.java | 4
doc/20260508_采购多文件分析附件存储与历史回显联调说明.md | 149
doc/20260512_AccountSubject树形改造前端修改文档.md | 185
src/main/java/com/ruoyi/approve/pojo/FinReimbursementDetail.java | 157
src/main/java/com/ruoyi/technology/pojo/TechnologyRouting.java | 1
src/main/java/com/ruoyi/account/pojo/sales/AccountSalesCollection.java | 127
src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 69
src/main/java/com/ruoyi/production/bean/dto/ProductionAccountDto.java | 30
doc/20260522_财务升级AI模块前端变更联调文档.md | 150
src/main/java/com/ruoyi/device/controller/DeviceRepairController.java | 10
src/main/java/com/ruoyi/account/controller/sales/AccountSalesController.java | 68
src/main/java/com/ruoyi/ai/mongodbBean/ChatMessages.java | 16
src/main/java/com/ruoyi/production/pojo/ProductionProductOutput.java | 3
src/main/java/com/ruoyi/approve/bean/vo/FinReimbursementVo.java | 34
src/main/java/com/ruoyi/project/system/controller/SysProfileController.java | 266
src/main/java/com/ruoyi/projectManagement/pojo/Roles.java | 1
src/main/java/com/ruoyi/account/service/purchase/AccountSubjectService.java | 32
src/main/java/com/ruoyi/approve/service/ApprovalInstanceNodeService.java | 16
src/main/resources/mapper/warehouse/DocumentationMapper.xml | 1
src/main/resources/mapper/staff/StaffSalaryMainMapper.xml | 7
src/main/java/com/ruoyi/account/mapper/financial/FinVoucherEntryMapper.java | 28
src/main/java/com/ruoyi/production/service/ProductionPlanService.java | 2
src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java | 55
src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderProductsDto.java | 2
src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java | 11
src/main/java/com/ruoyi/production/util/TaskPlanQuantityUtil.java | 137
src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java | 5
src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java | 264
src/main/java/com/ruoyi/account/pojo/purchase/AccountPaymentApplication.java | 141
src/main/java/com/ruoyi/approve/pojo/FinReimbursement.java | 209
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml | 16
src/main/resources/mapper/sales/SalesLedgerMapper.xml | 19
src/main/resources/mapper/technology/TechnologyOperationParamMapper.xml | 2
src/main/java/com/ruoyi/production/bean/dto/ProductionPlanDto.java | 3
src/main/resources/mapper/basic/SupplierManageMapper.xml | 63
src/main/java/com/ruoyi/quality/utils/QualityInspectHelper.java | 73
src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java | 876
doc/20260521_首页HomeController接口升级前端变更文档.md | 113
src/main/java/com/ruoyi/approve/pojo/ApprovalRecord.java | 98
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementDto.java | 96
src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml | 87
src/main/resources/mapper/quality/QualityTestStandardMapper.xml | 1
src/main/java/com/ruoyi/approve/service/impl/ApprovalRecordServiceImpl.java | 20
src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java | 91
src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNode.java | 66
src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateMapper.java | 24
src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeMapper.java | 18
src/main/java/com/ruoyi/ai/assistant/FinancialIntentExecutor.java | 284
src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeApproverServiceImpl.java | 20
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutPageDto.java | 132
doc/20260516_制造智能助手前端联调文档.md | 258
src/main/java/com/ruoyi/approve/pojo/ApprovalInstanceNode.java | 106
src/main/resources/purchase-agent-prompt.txt | 9
src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java | 192
src/main/resources/mapper/quality/QualityInspectMapper.xml | 52
src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeDeptServiceImpl.java | 20
src/main/java/com/ruoyi/ai/assistant/ManufacturingAgent.java | 22
src/main/java/com/ruoyi/basic/utils/FileUtil.java | 11
src/main/resources/mapper/approve/ApprovalTemplateMapper.xml | 33
src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java | 23
src/main/java/com/ruoyi/basic/service/ISupplierService.java | 21
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementManagementUpdateDto.java | 44
src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationParamServiceImpl.java | 8
src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeApproverMapper.java | 18
src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDetail.java | 17
src/main/resources/mapper/account/financial/FinVoucherEntryMapper.xml | 74
src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchaseInvoiceVo.java | 19
src/main/java/com/ruoyi/staff/dto/StaffOnJobDto.java | 2
src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchasePaymentServiceImpl.java | 90
src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java | 4
src/main/java/com/ruoyi/account/mapper/financial/FinVoucherMapper.java | 12
src/main/resources/mapper/basic/CustomerMapper.xml | 83
src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeDeptController.java | 18
src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java | 11
src/main/resources/mapper/approve/ApprovalTaskMapper.xml | 24
src/main/resources/mapper/system/SysNoticeMapper.xml | 5
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java | 775
src/main/java/com/ruoyi/project/system/controller/SysLoginController.java | 284
src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java | 3
src/main/resources/logback.xml | 16
src/main/java/com/ruoyi/project/system/controller/SysDeptController.java | 268
src/main/java/com/ruoyi/staff/init/DataInitializer.java | 33
src/main/java/com/ruoyi/staff/mapper/SchemeApplicableStaffMapper.java | 7
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnSaleProduct.java | 15
src/main/java/com/ruoyi/approve/service/ApprovalTaskService.java | 16
src/main/java/com/ruoyi/approve/mapper/ApprovalRecordMapper.java | 18
src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java | 29
src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java | 5
src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java | 4
src/main/java/com/ruoyi/project/system/controller/SysUserController.java | 581
src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationServiceImpl.java | 158
src/main/java/com/ruoyi/sales/vo/CustomerTransactionsVo.java | 33
doc/sql/20260609_knowledge_base_vector.sql | 30
src/main/resources/approve-todo-agent-prompt.txt | 2
src/main/resources/mapper/technology/TechnologyOperationMapper.xml | 2
src/main/java/com/ruoyi/approve/pojo/ApprovalTemplate.java | 107
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java | 52
src/main/java/com/ruoyi/account/service/impl/AccountStatementDetailsServiceImpl.java | 20
src/main/java/com/ruoyi/account/service/purchase/AccountPurchasePaymentService.java | 30
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordOutController.java | 6
src/main/java/com/ruoyi/account/controller/SalesReceiptReturnController.java | 2
src/main/java/com/ruoyi/account/service/AccountingService.java | 19
src/main/java/com/ruoyi/production/enums/ProductOrderStatusEnum.java | 11
src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java | 140
src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java | 91
src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.java | 10
src/main/java/com/ruoyi/approve/bean/vo/ApproveGetAndUpdateVo.java | 9
doc/20260522_StockInRecord列表源单号前端联调文档.md | 75
src/main/java/com/ruoyi/customervisits/service/impl/CustomerVisitsServiceImpl.java | 2
src/main/java/com/ruoyi/account/pojo/financial/AccountSubject.java | 117
src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderHasAllInfoDto.java | 30
src/main/java/com/ruoyi/quality/pojo/QualityInspect.java | 17
src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java | 124
src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java | 4
src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherPageDto.java | 37
src/main/java/com/ruoyi/ai/config/FinancialAgentConfig.java | 20
src/main/java/com/ruoyi/common/enums/EnterpriseNewsStatusEnum.java | 143
src/main/java/com/ruoyi/device/dto/DeviceLedgerDto.java | 17
src/main/java/com/ruoyi/quality/controller/QualityTestStandardBindingController.java | 27
src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java | 3
src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java | 7
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java | 6
src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java | 12
src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectDto.java | 10
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementAddDto.java | 27
src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java | 1
src/main/java/com/ruoyi/collaborativeApproval/dto/EnterpriseNewsDto.java | 26
src/main/java/com/ruoyi/home/controller/HomeController.java | 588
src/main/java/com/ruoyi/account/mapper/sales/AccountInvoiceApplicationMapper.java | 34
src/main/java/com/ruoyi/approve/controller/ApprovalTemplateController.java | 74
src/main/java/com/ruoyi/device/service/IDeviceLedgerService.java | 6
doc/20260512_add_parent_id_to_account_subject.sql | 5
src/main/java/com/ruoyi/account/bean/dto/sales/AccountInvoiceApplicationDto.java | 34
src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseInvoiceServiceImpl.java | 59
src/main/java/com/ruoyi/approve/service/FinReimbursementDetailService.java | 16
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java | 79
src/main/java/com/ruoyi/project/monitor/controller/SysLogininforController.java | 140
src/main/java/com/ruoyi/staff/dto/StaffSalaryCalculateDto.java | 16
src/main/java/com/ruoyi/stock/controller/StockOutRecordController.java | 11
src/main/java/com/ruoyi/common/enums/SalesQuotationStatusEnum.java | 43
src/main/java/com/ruoyi/purchase/controller/AccountingReportController.java | 63
src/main/java/com/ruoyi/account/pojo/sales/AccountSalesInvoice.java | 168
src/main/java/com/ruoyi/technology/service/TechnologyBomService.java | 2
src/main/java/com/ruoyi/sales/dto/SalesQuotationDto.java | 2
src/main/java/com/ruoyi/account/controller/purchase/AccountPurchasePaymentController.java | 71
src/main/java/com/ruoyi/ai/config/ManufacturingAgentConfig.java | 20
src/main/java/com/ruoyi/ai/controller/ManufacturingAiController.java | 112
src/main/java/com/ruoyi/approve/pojo/ApproveProcess.java | 10
src/main/java/com/ruoyi/project/system/controller/SysPostController.java | 266
src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesInvoiceVo.java | 19
src/main/resources/application-myhb-pro.yml | 268
doc/20260520_首页生产看板前端联调文档.md | 160
src/main/resources/mapper/staff/PersonalShiftMapper.xml | 15
src/main/java/com/ruoyi/staff/mapper/StaffSalaryMainMapper.java | 4
src/main/resources/mapper/production/ProductionOrderMapper.xml | 83
src/main/resources/mapper/approve/KnowledgeBaseMapper.xml | 4
src/main/java/com/ruoyi/approve/mapper/FinReimbursementTravelMapper.java | 18
src/main/java/com/ruoyi/sales/pojo/PaymentShipping.java | 1
src/main/java/com/ruoyi/quality/controller/QualityTestStandardParamController.java | 35
src/main/resources/mapper/device/DeviceRepairMapper.xml | 16
src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingProductVo.java | 46
src/main/resources/mapper/warehouse/WarehouseGoodsShelvesRowcolMapper.xml | 1
doc/20260523_ 协同审批新增出差时间和结束时间.sql | 3
src/main/java/com/ruoyi/production/pojo/ProductionOrder.java | 9
src/main/java/com/ruoyi/account/controller/financial/FinVoucherController.java | 69
src/main/resources/mapper/system/SysDeptMapper.xml | 39
src/main/resources/mapper/system/SysRoleMapper.xml | 32
src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeApproverDto.java | 8
src/main/java/com/ruoyi/stock/service/StockInventoryService.java | 2
src/main/java/com/ruoyi/approve/controller/ApprovalTaskController.java | 18
src/main/java/com/ruoyi/procurementrecord/bean/dto/InventoryInformationDto.java | 28
src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordOutMapper.java | 2
src/main/java/com/ruoyi/account/bean/dto/financial/FinLedgerQueryDto.java | 25
src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherStatusDto.java | 15
src/main/java/com/ruoyi/project/system/controller/SysMenuController.java | 270
src/main/java/com/ruoyi/account/controller/financial/AccountSubjectController.java | 70
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java | 129
src/main/java/com/ruoyi/production/service/impl/ProductionProductInputServiceImpl.java | 1
sql/product-inventory-management-new-pro.sql | 5814 +++++
src/main/java/com/ruoyi/ai/controller/SalesAiController.java | 141
src/main/java/com/ruoyi/staff/service/impl/StaffLeaveServiceImpl.java | 1
src/main/resources/mapper/basic/ProductModelMapper.xml | 1
src/main/java/com/ruoyi/warehouse/mapper/DocumentationFileMapper.java | 3
doc/20260615_add_plan_person_and_executor_to_routing_operation.sql | 8
src/main/resources/application-khyy.yml | 268
src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml | 3
src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeService.java | 20
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDtoCopy.java | 206
src/main/java/com/ruoyi/ai/dto/AiChatMessageDto.java | 17
src/main/java/com/ruoyi/common/enums/StockOutQualifiedRecordTypeEnum.java | 6
src/main/resources/application-lsy.yml | 268
src/main/java/com/ruoyi/quality/controller/QualityReportController.java | 34
src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeDept.java | 59
doc/20260522_财务助手提问优化前端变更文档.md | 59
src/main/java/com/ruoyi/mock/service/DataCheckService.java | 15
src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java | 13
src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java | 6
src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml | 63
src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerEntryRecordVo.java | 43
src/main/java/com/ruoyi/staff/pojo/StaffSalaryDetail.java | 3
src/main/java/com/ruoyi/account/controller/sales/AccountSalesInvoiceController.java | 72
src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java | 54
src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java | 15
src/main/java/com/ruoyi/basic/vo/CustomerVo.java | 5
src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrderProducts.java | 20
src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateServiceImpl.java | 308
src/main/java/com/ruoyi/quality/controller/QualityUnqualifiedController.java | 45
src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java | 54
src/main/java/com/ruoyi/purchase/dto/SimpleReturnOrderGroupDto.java | 2
src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java | 4
src/main/resources/mapper/aftersalesservice/AfterSalesNearExpiryMapper.xml | 23
src/main/java/com/ruoyi/account/bean/dto/financial/FinIntangibleAssetDto.java | 13
src/main/java/com/ruoyi/account/controller/sales/AccountSalesCollectionController.java | 79
src/main/java/com/ruoyi/account/bean/vo/financial/AccountSubjectVo.java | 21
src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java | 424
src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java | 24
src/main/java/com/ruoyi/account/controller/AccountStatementController.java | 71
src/main/java/com/ruoyi/project/monitor/controller/ServerController.java | 54
src/main/java/com/ruoyi/basic/mapper/SupplierManageMapper.java | 6
src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java | 311
src/main/java/com/ruoyi/approve/pojo/ApprovalTask.java | 128
src/main/resources/mapper/sales/SalesQuotationMapper.xml | 29
src/main/java/com/ruoyi/approve/controller/FinReimbursementController.java | 60
src/main/java/com/ruoyi/approve/service/ApprovalRecordService.java | 16
src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml | 1
src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml | 101
src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeVo.java | 13
src/main/java/com/ruoyi/sales/service/ISalesLedgerProductService.java | 7
src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java | 2
src/main/java/com/ruoyi/approve/controller/ApprovalInstanceNodeController.java | 19
src/main/java/com/ruoyi/account/controller/AccountingController.java | 24
src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeUserMapper.xml | 13
src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java | 35
src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchaseInvoice.java | 168
src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java | 5
src/main/resources/mapper/staff/StaffLeaveMapper.xml | 32
src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml | 45
src/main/java/com/ruoyi/production/pojo/ProductionOrderRoutingOperation.java | 3
src/main/java/com/ruoyi/technology/pojo/TechnologyOperation.java | 2
src/main/java/com/ruoyi/ai/assistant/KnowledgeChatAgent.java | 35
src/main/java/com/ruoyi/purchase/vo/PurchaseReturnDetailsVo.java | 17
src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java | 22
doc/20260522_首页财务接口升级前端变更文档.md | 120
src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPaymentApplicationDto.java | 34
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java | 82
src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerMapper.java | 3
src/main/java/com/ruoyi/account/controller/SalesRefundAmountOrderController.java | 2
src/main/java/com/ruoyi/project/system/controller/SysRoleController.java | 510
src/main/java/com/ruoyi/purchase/vo/PurchaseReportVo.java | 44
src/main/java/com/ruoyi/project/monitor/controller/SysUserOnlineController.java | 166
src/main/resources/mapper/approve/ApproveProcessMapper.xml | 5
src/main/java/com/ruoyi/ai/controller/KnowledgeChatController.java | 85
src/main/resources/mapper/approve/ApprovalTemplateNodeMapper.xml | 15
src/main/java/com/ruoyi/quality/controller/QualityInspectController.java | 47
src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java | 751
src/main/java/com/ruoyi/ai/config/SalesAgentConfig.java | 21
src/main/resources/mapper/approve/ApprovalRecordMapper.xml | 20
src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java | 29
src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsDetailsVo.java | 36
src/main/java/com/ruoyi/account/pojo/financial/FinVoucher.java | 83
src/main/java/com/ruoyi/ai/assistant/SalesIntentExecutor.java | 270
src/main/java/com/ruoyi/account/mapper/AccountStatementMapper.java | 28
src/main/java/com/ruoyi/project/system/mapper/SysUserDeptMapper.java | 25
src/main/resources/mapper/account/AccountStatementMapper.xml | 78
src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesCollectionDto.java | 34
src/main/java/com/ruoyi/common/enums/TypeEnums.java | 70
src/main/java/com/ruoyi/account/mapper/sales/AccountSalesInvoiceMapper.java | 24
src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.java | 22
src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java | 3
src/main/java/com/ruoyi/account/pojo/financial/FinFixedAsset.java | 101
src/main/java/com/ruoyi/sales/dto/ShippingApproveDto.java | 15
src/main/resources/manufacturing-agent-prompt.txt | 10
src/main/java/com/ruoyi/account/controller/financial/FinFixedAssetController.java | 63
src/main/resources/application-hthb.yml | 268
src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeApproverController.java | 18
src/main/java/com/ruoyi/account/mapper/financial/AccountSubjectMapper.java | 23
src/main/java/com/ruoyi/account/service/sales/AccountInvoiceApplicationService.java | 35
src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java | 1
src/main/java/com/ruoyi/production/bean/vo/ProductionAccountVo.java | 35
src/main/java/com/ruoyi/ai/tools/FinancialAgentTools.java | 2311 ++
doc/20260518_销售助手前端联调文档.md | 188
src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectImportDto.java | 36
src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingController.java | 2
src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java | 14
src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java | 264
src/main/java/com/ruoyi/ai/tools/SalesAgentTools.java | 1633 +
src/main/java/com/ruoyi/approve/bean/dto/ApprovalInstanceDto.java | 21
src/main/java/com/ruoyi/basic/pojo/ProductModel.java | 7
src/main/java/com/ruoyi/account/bean/vo/sales/SalesOutboundVo.java | 60
src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeUser.java | 59
src/main/java/com/ruoyi/approve/bean/vo/ApprovalInstanceVo.java | 37
src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeUserController.java | 18
src/main/java/com/ruoyi/staff/mapper/StaffOnJobMapper.java | 4
src/main/java/com/ruoyi/quality/service/IQualityInspectService.java | 3
src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java | 55
src/main/java/com/ruoyi/ai/tools/ManufacturingAgentTools.java | 1035 +
src/main/java/com/ruoyi/production/pojo/ProductionAccount.java | 6
src/main/resources/application-btw.yml | 268
src/main/java/com/ruoyi/warehouse/controller/DocumentationFileController.java | 3
src/main/java/com/ruoyi/production/mapper/ProductionOrderMapper.java | 21
src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml | 97
src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java | 2
src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNodeApprover.java | 76
src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoStageHandleService.java | 9
src/main/java/com/ruoyi/account/service/AccountStatementService.java | 32
src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java | 2
src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java | 3
src/main/java/com/ruoyi/account/controller/purchase/AccounPurchaseController.java | 68
src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java | 1
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerRecordMapper.xml | 4
docs/routing_operation_plan_person.md | 91
src/main/java/com/ruoyi/account/service/impl/sales/AccountInvoiceApplicationServiceImpl.java | 102
.gitignore | 8
src/main/resources/mapper/device/DeviceMaintenanceMapper.xml | 2
doc/20260512_财务管理模块前端联调文档.md | 288
src/main/java/com/ruoyi/sales/pojo/SalesLedger.java | 31
src/main/resources/mapper/technology/TechnologyRoutingOperationMapper.xml | 1
src/main/resources/application-qlmc-pro.yml | 268
src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml | 187
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java | 11
src/main/java/com/ruoyi/account/bean/dto/financial/FinFixedAssetDto.java | 13
src/main/java/com/ruoyi/approve/service/FinReimbursementService.java | 31
src/main/resources/mapper/staff/SchemeApplicableStaffMapper.xml | 14
src/main/java/com/ruoyi/approve/utils/ApproveProcessConfigNodeUtils.java | 363
src/main/java/com/ruoyi/stock/mapper/StockInRecordMapper.java | 4
src/main/java/com/ruoyi/device/service/IDeviceRepairService.java | 4
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 398
src/main/resources/mapper/sales/ShippingProductDetailMapper.xml | 9
src/main/java/com/ruoyi/account/service/financial/FinLedgerService.java | 17
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java | 50
src/main/java/com/ruoyi/mock/dto/DataGenerateRequest.java | 33
src/main/java/com/ruoyi/purchase/dto/VatDto.java | 17
src/main/java/com/ruoyi/ai/service/PurchaseAiService.java | 1069 +
src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java | 22
src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesCollectionVo.java | 26
src/main/java/com/ruoyi/account/service/sales/AccountSalesCollectionService.java | 33
doc/20260512_create_financial_management_tables.sql | 104
src/main/java/com/ruoyi/approve/service/impl/FinReimbursementTravelServiceImpl.java | 20
src/main/java/com/ruoyi/stock/controller/StockInventoryController.java | 20
src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java | 6
src/main/java/com/ruoyi/account/service/impl/purchase/AccountPaymentApplicationServiceImpl.java | 96
src/main/java/com/ruoyi/staff/pojo/StaffOnJob.java | 1
src/main/resources/application-xhks.yml | 268
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java | 113
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 4
src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnManagementDto.java | 54
src/main/java/com/ruoyi/account/service/impl/SalesReceiptReturnServiceImpl.java | 2
src/main/java/com/ruoyi/account/service/impl/AccountStatementServiceImpl.java | 298
src/main/java/com/ruoyi/ai/assistant/SalesAgent.java | 22
src/main/java/com/ruoyi/approve/pojo/KnowledgeBase.java | 15
src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingUseVo.java | 2
src/main/java/com/ruoyi/account/service/sales/AccountSalesInvoiceService.java | 28
src/main/java/com/ruoyi/approve/pojo/FinReimbursementTravel.java | 162
src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesInvoiceServiceImpl.java | 53
src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeDeptMapper.java | 18
src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingInfoVo.java | 17
src/main/java/com/ruoyi/account/pojo/AccountStatement.java | 127
src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java | 237
src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml | 250
src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsMapper.java | 24
src/main/java/com/ruoyi/stock/service/StockInRecordService.java | 2
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java | 80
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java | 676
src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeServiceImpl.java | 62
src/main/resources/mapper/approve/FinReimbursementTravelMapper.xml | 29
src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.java | 2
src/main/java/com/ruoyi/account/mapper/AccountStatementDetailsMapper.java | 18
src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeUserMapper.java | 18
src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java | 7
src/main/java/com/ruoyi/project/system/controller/SysRegisterController.java | 66
src/main/java/com/ruoyi/production/service/impl/ProductionAccountServiceImpl.java | 3
src/main/java/com/ruoyi/quality/controller/QualityTestStandardController.java | 57
src/main/resources/mapper/production/ProductionOrderRoutingOperationMapper.xml | 1
src/main/java/com/ruoyi/staff/service/IStaffOnJobService.java | 2
src/main/java/com/ruoyi/approve/service/impl/ApprovalTaskServiceImpl.java | 20
src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationParamServiceImpl.java | 35
src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml | 4
src/main/resources/mapper/purchase/PurchaseReturnOrderProductsMapper.xml | 4
src/main/java/com/ruoyi/common/enums/ApprovalStatusEnum.java | 49
src/main/java/com/ruoyi/sales/controller/MetricStatisticsController.java | 24
src/main/java/com/ruoyi/sales/excel/InvoiceLedgerExcelDto.java | 7
src/main/java/com/ruoyi/production/controller/ProductionPlanController.java | 9
src/main/java/com/ruoyi/production/pojo/ProductionProductMain.java | 4
doc/知识库RAG功能实现文档.md | 1034 +
src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java | 209
src/main/resources/application-xlgs.yml | 268
src/main/java/com/ruoyi/account/bean/dto/sales/SalesOutboundDto.java | 31
src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseReturnVo.java | 64
src/main/java/com/ruoyi/ai/controller/FinancialAiController.java | 144
src/main/resources/application-qfsw.yml | 268
src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml | 24
src/main/resources/mapper/approve/FinReimbursementMapper.xml | 62
src/main/java/com/ruoyi/staff/excel/StaffSalaryExportData.java | 64
src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceNodeServiceImpl.java | 20
src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java | 8
src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java | 105
src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnSaleProductDto.java | 41
src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java | 5
src/main/java/com/ruoyi/staff/dto/StaffLeaveDto.java | 1
src/main/resources/application-nhxcl.yml | 268
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java | 116
src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickRecordServiceImpl.java | 1
src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceNodeMapper.java | 18
src/main/java/com/ruoyi/basic/dto/ProductModelDto.java | 2
src/main/java/com/ruoyi/mock/controller/DataCheckController.java | 54
src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordOutService.java | 6
src/main/java/com/ruoyi/ai/assistant/ApproveTodoAgent.java | 3
docs/mock_data_generate.md | 243
src/main/java/com/ruoyi/common/enums/StockInQualifiedRecordTypeEnum.java | 13
src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeUserServiceImpl.java | 20
src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java | 20
src/main/java/com/ruoyi/warehouse/mapper/DocumentationMapper.java | 1
src/main/java/com/ruoyi/ai/service/impl/KnowledgeRagServiceImpl.java | 342
src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java | 29
src/main/java/com/ruoyi/procurementrecord/mapper/ReturnSaleProductMapper.java | 2
src/main/java/com/ruoyi/account/service/financial/FinFixedAssetService.java | 26
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java | 4
src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java | 55
src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskServiceImpl.java | 3
src/main/resources/application-jfhy.yml | 268
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java | 14
src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml | 1
doc/20260511_设备保养定时任务设备项目字段前端联调说明.md | 111
src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchaseInvoiceMapper.java | 29
src/main/java/com/ruoyi/technology/pojo/TechnologyParam.java | 6
src/main/resources/mapper/approve/ApprovalTemplateNodeApproverMapper.xml | 16
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java | 136
src/main/java/com/ruoyi/approve/bean/dto/FinReimbursementDto.java | 21
src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchasePaymentDto.java | 34
src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java | 7
src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeApproverService.java | 16
src/main/java/com/ruoyi/common/enums/ShippingStatusEnum.java | 42
src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingServiceImpl.java | 2
src/main/java/com/ruoyi/account/mapper/financial/FinIntangibleAssetMapper.java | 12
src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsService.java | 29
src/main/java/com/ruoyi/production/service/impl/ProductionPlanServiceImpl.java | 317
src/main/java/com/ruoyi/account/service/impl/financial/FinIntangibleAssetServiceImpl.java | 250
src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingServiceImpl.java | 31
src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java | 4
src/main/resources/mapper/production/ProductionAccountMapper.xml | 12
src/main/java/com/ruoyi/account/controller/financial/FinLedgerController.java | 39
src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeUserService.java | 16
src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java | 209
src/main/resources/static/销售台账导入模板.xlsx | 0
src/main/java/com/ruoyi/technology/pojo/TechnologyRoutingOperation.java | 3
src/main/resources/mapper/collaborativeApproval/EnterpriseNewsMapper.xml | 47
src/main/java/com/ruoyi/mock/vo/DataCheckResult.java | 36
src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml | 10
src/main/java/com/ruoyi/account/pojo/sales/AccountInvoiceApplication.java | 138
src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeDto.java | 12
src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java | 35
src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java | 13
src/main/resources/mapper/stock/StockInRecordMapper.xml | 130
src/main/java/com/ruoyi/account/service/financial/FinIntangibleAssetService.java | 26
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml | 9
src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutAdd.java | 29
src/main/java/com/ruoyi/ai/context/AiSessionUserContext.java | 30
src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java | 2
src/main/java/com/ruoyi/ai/assistant/FinancialAgent.java | 22
src/main/java/com/ruoyi/account/controller/financial/FinIntangibleAssetController.java | 63
src/main/java/com/ruoyi/account/service/impl/financial/FinFixedAssetServiceImpl.java | 231
src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeApproverVo.java | 9
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java | 2
src/main/java/com/ruoyi/account/bean/dto/financial/FinDetailLedgerQueryDto.java | 22
src/main/resources/mapper/technology/TechnologyBomStructureMapper.xml | 3
src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java | 186
src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml | 10
src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java | 2
src/main/java/com/ruoyi/common/utils/DateUtils.java | 21
src/main/java/com/ruoyi/account/service/impl/financial/AccountSubjectServiceImpl.java | 397
src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java | 14
src/main/java/com/ruoyi/account/bean/dto/sales/SalesReturnDto.java | 31
src/main/java/com/ruoyi/production/bean/dto/ProductionProductMainDto.java | 40
src/main/java/com/ruoyi/account/bean/vo/StatementAccountVo.java | 25
doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql | 22
src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java | 8
src/main/resources/mapper/approve/FinReimbursementDetailMapper.xml | 29
doc/20260521_采购智能体优化前端变更文档.md | 85
src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPaymentApplicationVo.java | 23
src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java | 7
src/main/resources/application-rfsy.yml | 268
src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderProductsDetailVo.java | 65
src/main/java/com/ruoyi/purchase/pojo/PurchaseLedger.java | 17
src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeDeptService.java | 16
src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseInboundVo.java | 48
src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml | 58
src/main/java/com/ruoyi/account/controller/purchase/AccountPurchaseInvoiceController.java | 79
src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseServiceImpl.java | 59
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java | 4
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java | 4
src/main/java/com/ruoyi/ai/assistant/ManufacturingIntentExecutor.java | 136
src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml | 116
src/main/java/com/ruoyi/approve/service/ApprovalTemplateService.java | 34
src/main/java/com/ruoyi/approve/mapper/KnowledgeBaseVectorMapper.java | 39
src/main/java/com/ruoyi/mock/dto/DataCheckRequest.java | 15
src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherEntryDto.java | 13
src/main/java/com/ruoyi/account/service/SalesRefundAmountOrderService.java | 2
/dev/null | 24
src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateVo.java | 17
src/main/java/com/ruoyi/approve/service/ApprovalInstanceService.java | 33
src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesServiceImpl.java | 58
src/main/java/com/ruoyi/account/bean/dto/financial/FinIdBatchDto.java | 17
src/main/java/com/ruoyi/ai/dto/KnowledgeChatRequest.java | 21
src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchasePaymentMapper.java | 29
src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordMapper.java | 6
src/main/java/com/ruoyi/approve/service/impl/ApproveBusinessStatusService.java | 175
694 files changed, 53,932 insertions(+), 7,064 deletions(-)
diff --git a/.gitignore b/.gitignore
index b60b03f..8fac07c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,12 +4,14 @@
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
-
+claude.md
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
-# IDE
+# Claude Code
+.claude/
+
### STS ###
.apt_generated
@@ -43,4 +45,4 @@
!*/build/*.java
!*/build/*.html
-!*/build/*.xml
\ No newline at end of file
+!*/build/*.xml
diff --git "a/doc/20260508_\351\207\207\350\264\255\345\244\232\346\226\207\344\273\266\345\210\206\346\236\220\351\231\204\344\273\266\345\255\230\345\202\250\344\270\216\345\216\206\345\217\262\345\233\236\346\230\276\350\201\224\350\260\203\350\257\264\346\230\216.md" "b/doc/20260508_\351\207\207\350\264\255\345\244\232\346\226\207\344\273\266\345\210\206\346\236\220\351\231\204\344\273\266\345\255\230\345\202\250\344\270\216\345\216\206\345\217\262\345\233\236\346\230\276\350\201\224\350\260\203\350\257\264\346\230\216.md"
new file mode 100644
index 0000000..c883a22
--- /dev/null
+++ "b/doc/20260508_\351\207\207\350\264\255\345\244\232\346\226\207\344\273\266\345\210\206\346\236\220\351\231\204\344\273\266\345\255\230\345\202\250\344\270\216\345\216\206\345\217\262\345\233\236\346\230\276\350\201\224\350\260\203\350\257\264\346\230\216.md"
@@ -0,0 +1,149 @@
+# 閲囪喘澶氭枃浠跺垎鏋愰檮浠跺瓨鍌ㄤ笌鍘嗗彶鍥炴樉鑱旇皟璇存槑
+
+> 鏇存柊鏃堕棿锛�2026-05-08
+> 閫傜敤鑼冨洿锛氶噰璐櫤鑳戒綋澶氭枃浠跺垎鏋� + 鍘嗗彶浼氳瘽闄勪欢鍥炴樉
+
+## 1. 鍙樻洿鑳屾櫙
+
+鍚庣宸茶ˉ榻愪互涓嬭兘鍔涳細
+
+1. `POST /purchase-ai/analyze-files` 涓婁紶鏃跺厛瀛橀檮浠跺埌鏈嶅姟鍣紙鍏叡璁块棶锛夈��
+2. 鎸夋枃浠剁被鍨嬭繑鍥炲彲璁块棶璺緞锛�
+ - 鍥剧墖 / PDF锛氫紭鍏堥瑙堣矾寰�
+ - 鍏跺畠鏂囦欢锛氫紭鍏堜笅杞借矾寰�
+3. 鐢ㄦ埛鎻愰棶涓庨檮浠惰矾寰勫垎寮�瀛樺叆 Mongo銆�
+4. 鍘嗗彶娑堟伅鎺ュ彛鍙寜鈥滄秷鎭淮搴︹�濆洖浼犻檮浠惰矾寰勶紝鍓嶇鍙洿鎺ュ洖鏄鹃檮浠跺崱鐗囥��
+
+---
+
+## 2. 鎺ュ彛琛屼负
+
+### 2.1 澶氭枃浠跺垎鏋愭帴鍙�
+
+```http
+POST /purchase-ai/analyze-files
+Content-Type: multipart/form-data
+```
+
+璇锋眰鍙傛暟锛�
+
+- `files`: `MultipartFile[]`锛堝繀濉級
+- `message`: `string`锛堝彲閫夛級
+- `memoryId`: `string`锛堝彲閫夛級
+
+鍚庣澶勭悊娴佺▼锛�
+
+1. 璋冪敤 `StorageBlobService.upload(files, true)` 涓婁紶骞朵繚瀛橀檮浠躲��
+2. 鐢熸垚闄勪欢璁块棶璺緞锛堥瑙� / 涓嬭浇锛夈��
+3. 灏嗏�滄湰娆℃彁闂� + 鏈闄勪欢璺緞鍒楄〃鈥濆啓鍏� Mongo銆�
+4. 缁х画鎵ц鍘熸湁鏂囦欢瑙f瀽鍜� AI 鍒嗘瀽娴佺▼銆�
+
+鍙兘閿欒锛堟祦寮忔枃鏈級锛�
+
+- `鏂囦欢涓婁紶澶辫触`
+- `浼氳瘽鏂囦欢淇℃伅淇濆瓨澶辫触`
+
+### 2.2 鍘嗗彶娑堟伅鎺ュ彛锛堝墠绔噸鐐癸級
+
+```http
+GET /purchase-ai/history/messages/{memoryId}
+```
+
+娑堟伅瀵硅薄鏂板鍙�夊瓧娈� `filePaths`锛堜粎鐢ㄦ埛娑堟伅鍙兘鏈夊�硷級锛�
+
+```json
+{
+ "role": "user | assistant | system | tool | unknown",
+ "content": "娑堟伅鏂囨湰",
+ "filePaths": [
+ "/common/preview/xxx?publicKey=...",
+ "/common/download/yyy?publicKey=..."
+ ]
+}
+```
+
+璇存槑锛�
+
+1. `filePaths` 鍙兘缂哄け鎴栦负绌猴紙鑰佷細璇� / 鏅�氬璇濓級銆�
+2. 鍗曟潯鐢ㄦ埛娑堟伅鍙兘鍖呭惈澶氫釜闄勪欢璺緞銆�
+3. 璇ュ瓧娈靛凡鎸夋秷鎭淮搴﹀榻愶紝鍙洿鎺ョ敤浜庡巻鍙插洖鏄俱��
+
+---
+
+## 3. 鍓嶇鏀归�犲缓璁紙鎸夊綋鍓嶅疄鐜拌惤鍦帮級
+
+### 3.1 鍘嗗彶鍝嶅簲妯″瀷
+
+寤鸿鍦ㄥ巻鍙叉秷鎭師濮嬬粨鏋勪腑淇濈暀 `filePaths`锛�
+
+```ts
+type AiHistoryMessage = {
+ role: string;
+ content: string;
+ filePaths?: string[];
+};
+```
+
+### 3.2 UI 娑堟伅妯″瀷鏄犲皠
+
+鑻ュ墠绔〉闈㈢敤鐨勬槸 `localUploadFiles` 娓叉煋闄勪欢鍗$墖锛堝 `AIChatSidebar` 褰撳墠瀹炵幇锛夛紝鍘嗗彶娑堟伅闇�鍋氫竴娆℃槧灏勶細
+
+```ts
+type LocalUploadFileItem = {
+ previewId: string;
+ name: string;
+ size: number;
+ type: string;
+ isImage: boolean;
+ previewUrl: string;
+ rawFile: null;
+};
+```
+
+鏄犲皠瑙勫垯寤鸿锛�
+
+1. 浠� `role === 'user'` 涓� `filePaths?.length > 0` 鏃剁敓鎴� `localUploadFiles`銆�
+2. `previewId` 鐢� `${memoryId}-${messageIndex}-${fileIndex}` 鐢熸垚绋冲畾鍊笺��
+3. `name` 鍙粠 URL 璺緞瑙f瀽锛涜В鏋愬け璐ョ敤 `file-{n}`銆�
+4. `isImage` 鍙寜鎵╁睍鍚嶅垽鏂紙`png/jpg/jpeg/gif/webp/bmp/svg`锛夈��
+5. 鍥剧墖鐨� `previewUrl` 鐩存帴浣跨敤璺緞锛涢潪鍥剧墖鍙疆绌哄苟璧板浘鏍囧睍绀恒��
+
+### 3.3 娑堟伅娓叉煋
+
+瀵逛簬鐢ㄦ埛娑堟伅锛�
+
+1. 姝e父娓叉煋 `content`銆�
+2. 鑻ュ瓨鍦� `localUploadFiles`锛堟垨鐩存帴浣跨敤 `filePaths`锛夛紝鍦ㄦ秷鎭笅鏂规覆鏌撻檮浠跺垪琛�/鍗$墖銆�
+3. 閾炬帴鐩存帴浣跨敤鍚庣杩斿洖璺緞锛屼笉鍐嶆嫾鎺ユ垨浜屾鏀瑰啓銆�
+
+> 鍚庣宸插畬鎴愨�滈瑙�/涓嬭浇璺緞鈥濋�夋嫨锛屽墠绔彧璐熻矗灞曠ず涓庢墦寮�銆�
+
+### 3.4 鍏煎瑕佹眰
+
+- `filePaths` 缂哄け锛氫笉鎶ラ敊锛屼笉娓叉煋闄勪欢鍖哄煙銆�
+- 鑰佷細璇濓細缁х画鎸� `role/content` 灞曠ず锛屼笉褰卞搷鍘嗗彶璁板綍鏌ョ湅銆�
+- 澶氶檮浠讹細淇濇寔椤哄簭灞曠ず锛岄伩鍏嶆墦涔辩敤鎴蜂笂浼犻『搴忋��
+
+---
+
+## 4. Mongo 瀛楁璇存槑锛堝悗绔凡瀹炵幇锛�
+
+`chat_messages` 鏂囨。鏂板/浣跨敤瀛楁锛�
+
+- `analyzeUserQuestions: string[]`
+- `analyzeFilePaths: string[]`锛堝吋瀹规棫瀛楁锛�
+- `analyzeFilePathGroups: string[][]`锛堟帹鑽愶紝鎸夋彁闂垎缁勶級
+
+鍘嗗彶娑堟伅鍥炰紶鏃讹紝鍚庣浼樺厛璇诲彇 `analyzeFilePathGroups`锛屽苟鍏煎 `analyzeFilePaths`銆�
+
+---
+
+## 5. 鑱旇皟楠屾敹娓呭崟
+
+1. 鏂板缓浼氳瘽锛屼笂浼� 1 寮犲浘鐗� + 1 涓� Excel锛屽彂閫佸垎鏋愯姹傘��
+2. 璋冪敤 `GET /purchase-ai/history/messages/{memoryId}`锛岀‘璁ょ敤鎴锋秷鎭惈 `filePaths` 涓旀暟閲忔纭��
+3. 鍒锋柊椤甸潰鍚庨噸鏂拌繘鍏ュ悓涓�浼氳瘽锛岀‘璁ら檮浠跺崱鐗囧彲鍥炴樉銆�
+4. 鍒嗗埆楠岃瘉锛�
+ - 鍥剧墖/PDF 鍙瑙堣闂�
+ - 鍏跺畠鏂囦欢鍙笅杞借闂�
+5. 楠岃瘉鑰佷細璇濓紙鏃� `filePaths`锛夊彲姝e父灞曠ず锛岄〉闈笉鎶ラ敊銆�
diff --git "a/doc/20260511_\350\256\276\345\244\207\344\277\235\345\205\273\345\256\232\346\227\266\344\273\273\345\212\241\350\256\276\345\244\207\351\241\271\347\233\256\345\255\227\346\256\265\345\211\215\347\253\257\350\201\224\350\260\203\350\257\264\346\230\216.md" "b/doc/20260511_\350\256\276\345\244\207\344\277\235\345\205\273\345\256\232\346\227\266\344\273\273\345\212\241\350\256\276\345\244\207\351\241\271\347\233\256\345\255\227\346\256\265\345\211\215\347\253\257\350\201\224\350\260\203\350\257\264\346\230\216.md"
new file mode 100644
index 0000000..e35f0f9
--- /dev/null
+++ "b/doc/20260511_\350\256\276\345\244\207\344\277\235\345\205\273\345\256\232\346\227\266\344\273\273\345\212\241\350\256\276\345\244\207\351\241\271\347\233\256\345\255\227\346\256\265\345\211\215\347\253\257\350\201\224\350\260\203\350\257\264\346\230\216.md"
@@ -0,0 +1,111 @@
+# 璁惧淇濆吇瀹氭椂浠诲姟璁惧椤圭洰瀛楁鍓嶇鑱旇皟璇存槑
+
+> 鏇存柊鏃堕棿锛�2026-05-11
+> 閫傜敤鑼冨洿锛氳澶囦繚鍏诲畾鏃朵换鍔★紙`maintenance_task`锛変笌璁惧淇濆吇璁板綍锛坄device_maintenance`锛�
+
+## 1. 鍙樻洿姒傝堪
+
+鏈鍚庣鍙樻洿锛�
+
+1. `MaintenanceTask` 鏂板瀛楁 `machineryCategory`锛堣澶囬」鐩級銆�
+2. 瀹氭椂浠诲姟鎵ц鐢熸垚璁惧淇濆吇璁板綍鏃讹紝浼氭妸 `MaintenanceTask.machineryCategory` 鍚屾鍐欏叆 `DeviceMaintenance.machineryCategory`銆�
+
+瀵瑰簲浠g爜浣嶇疆锛�
+
+- `src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java`
+- `src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java`
+
+## 2. 鏁版嵁搴撳彉鏇�
+
+闇�瑕佸厛鎵ц鏁版嵁搴撳彉鏇达紙鍚﹀垯鏂板/鏌ヨ璇ュ瓧娈典細寮傚父锛夛細
+
+```sql
+ALTER TABLE `maintenance_task`
+ ADD COLUMN `machinery_category` VARCHAR(100) NULL COMMENT '璁惧椤圭洰' AFTER `device_model`;
+```
+
+## 3. 瀛楁绾﹀畾
+
+| 瀛楁 | 鍚箟 | 绫诲瀷 | 寤鸿 |
+| --- | --- | --- | --- |
+| machineryCategory | 璁惧椤圭洰 | string | 鍓嶇鏂板/缂栬緫瀹氭椂浠诲姟鏃朵紶鍊� |
+
+璇存槑锛�
+
+- 鍚庣褰撳墠鏈璇ュ瓧娈靛仛寮哄埗闈炵┖鏍¢獙锛屼絾涓氬姟涓婂缓璁墠绔綔涓哄繀濉鐞嗐��
+- 鍘嗗彶 `maintenance_task` 鏃ф暟鎹嫢璇ュ瓧娈典负绌猴紝鍒欏熀浜庢棫浠诲姟鐢熸垚鐨勪繚鍏昏褰曚篃浼氫负绌恒��
+
+## 4. 鎺ュ彛鑱旇皟
+
+### 4.1 鏂板瀹氭椂浠诲姟
+
+```http
+POST /deviceMaintenanceTask/add
+Content-Type: application/json
+```
+
+璇锋眰绀轰緥锛�
+
+```json
+{
+ "taskName": "绌哄帇鏈篈-鍛ㄤ繚鍏�",
+ "taskId": 1001,
+ "deviceModel": "GA75",
+ "machineryCategory": "鍔ㄥ姏璁惧",
+ "frequencyType": "WEEKLY",
+ "frequencyDetail": "MON,09:00",
+ "registrantId": 1,
+ "registrationDate": "2026-05-11",
+ "remarks": "鑱旇皟鏍蜂緥"
+}
+```
+
+### 4.2 淇敼瀹氭椂浠诲姟
+
+```http
+POST /deviceMaintenanceTask/update
+Content-Type: application/json
+```
+
+璇锋眰绀轰緥锛堝惈 `id`锛夛細
+
+```json
+{
+ "id": 12,
+ "machineryCategory": "鍔ㄥ姏璁惧"
+}
+```
+
+### 4.3 瀹氭椂浠诲姟鍒楄〃
+
+```http
+GET /deviceMaintenanceTask/listPage?pageNum=1&pageSize=10
+```
+
+杩斿洖璁板綍涓細鍖呭惈 `machineryCategory` 瀛楁銆�
+
+### 4.4 璁惧淇濆吇璁板綍鍒楄〃/璇︽儏
+
+```http
+GET /device/maintenance/page?pageNum=1&pageSize=10
+GET /device/maintenance/{id}
+```
+
+杩斿洖涓� `machineryCategory` 鏉ユ簮浜� `device_maintenance.machinery_category`銆�
+瀵逛簬鈥滅敱瀹氭椂浠诲姟鑷姩鐢熸垚鈥濈殑璁板綍锛岃鍊间細缁ф壙鐢熸垚鏃跺搴斾换鍔$殑 `machineryCategory`銆�
+
+## 5. 鍓嶇鏀归�犵偣
+
+1. 瀹氭椂浠诲姟鏂板/缂栬緫琛ㄥ崟澧炲姞鈥滆澶囬」鐩紙machineryCategory锛夆�濊緭鍏ラ」銆�
+2. 鎻愪氦 `/deviceMaintenanceTask/add`銆乣/deviceMaintenanceTask/update` 鏃舵惡甯� `machineryCategory`銆�
+3. 瀹氭椂浠诲姟鍒楄〃澧炲姞鈥滆澶囬」鐩�濆垪锛堝椤甸潰鏈夎鍒楄〃锛夈��
+4. 璁惧淇濆吇璁板綍鍒楄〃/璇︽儏澧炲姞鈥滆澶囬」鐩�濆睍绀猴紝绌哄�兼樉绀� `--`銆�
+
+## 6. 鑱旇皟楠屾敹娓呭崟
+
+1. 鏂板涓�涓甫 `machineryCategory` 鐨勫畾鏃朵换鍔★紝淇濆瓨鎴愬姛銆�
+2. 鏌ヨ `/deviceMaintenanceTask/listPage`锛岀‘璁よ浠诲姟杩斿洖 `machineryCategory`銆�
+3. 绛夊緟涓�娆″畾鏃惰Е鍙戯紙鎴栧皢棰戠巼璋冨埌涓磋繎鏃堕棿锛夛紝鐢熸垚淇濆吇璁板綍銆�
+4. 鏌ヨ `/device/maintenance/page` 鎴栬鎯呮帴鍙o紝纭鏂拌褰曠殑 `machineryCategory` 涓庝换鍔′竴鑷淬��
+5. 淇敼浠诲姟 `machineryCategory` 鍚庡啀娆¤Е鍙戯紝纭鈥滄柊鐢熸垚璁板綍鈥濅娇鐢ㄦ柊鍊硷紙鍘嗗彶璁板綍涓嶅洖鍐欙級銆�
+
diff --git "a/doc/20260512_AccountSubject\346\240\221\345\275\242\346\224\271\351\200\240\345\211\215\347\253\257\344\277\256\346\224\271\346\226\207\346\241\243.md" "b/doc/20260512_AccountSubject\346\240\221\345\275\242\346\224\271\351\200\240\345\211\215\347\253\257\344\277\256\346\224\271\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..c798c40
--- /dev/null
+++ "b/doc/20260512_AccountSubject\346\240\221\345\275\242\346\224\271\351\200\240\345\211\215\347\253\257\344\277\256\346\224\271\346\226\207\346\241\243.md"
@@ -0,0 +1,185 @@
+# AccountSubject 鏍戝舰鏀归�犲墠绔慨鏀规枃妗�
+
+鏇存柊鏃堕棿锛�2026-05-12
+
+## 1. 鍙樻洿鑳屾櫙
+
+`AccountSubjectController` 宸叉敼涓虹埗瀛愬眰绾ч�掑綊妯″紡锛宍/accountSubject/list` 鐜板湪杩斿洖鏍戝舰缁撴瀯锛坄children` 閫掑綊锛夛紝涓嶅啀鏄崟绾殑骞抽摵鍒楄〃銆�
+
+---
+
+## 2. 鍚庣鎺ュ彛鍙樺寲
+
+### 2.1 鏌ヨ鎺ュ彛锛堝凡鍙樻洿涓烘爲锛�
+
+- URL锛歚GET /accountSubject/list`
+- 鍏ュ弬锛氫繚鎸佷笉鍙橈紙`current,size,subjectCode,subjectName,subjectType,status`锛�
+- 鍑哄弬锛氫粛鏄垎椤靛3锛坄records,total`锛夛紝浣� `records` 鍙樹负鏍戣妭鐐规暟缁勶紙鏍硅妭鐐瑰垎椤碉紝瀛愯妭鐐归�掑綊鍐呭祵锛�
+
+绀轰緥锛�
+
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": {
+ "records": [
+ {
+ "id": 1,
+ "parentId": null,
+ "subjectCode": "1002",
+ "subjectName": "閾惰瀛樻",
+ "subjectType": "璧勪骇绫�",
+ "balanceDirection": "鍊熸柟",
+ "status": 0,
+ "leaf": false,
+ "children": [
+ {
+ "id": 2,
+ "parentId": 1,
+ "subjectCode": "100201",
+ "subjectName": "宸ヨ瀛樻",
+ "subjectType": "璧勪骇绫�",
+ "balanceDirection": "鍊熸柟",
+ "status": 0,
+ "leaf": true,
+ "children": []
+ }
+ ]
+ }
+ ],
+ "total": 1
+ }
+}
+```
+
+### 2.2 鏂板/缂栬緫鎺ュ彛瀛楁鍙樺寲
+
+- `POST /accountSubject/add`
+- `PUT /accountSubject/edit`
+
+鏂板鏀寔瀛楁锛�
+
+- `parentId`锛氱埗鑺傜偣ID锛堜负绌鸿〃绀烘牴鑺傜偣锛�
+
+绀轰緥锛�
+
+```json
+{
+ "id": 2,
+ "parentId": 1,
+ "subjectCode": "100201",
+ "subjectName": "宸ヨ瀛樻",
+ "subjectType": "璧勪骇绫�",
+ "balanceDirection": "鍊熸柟",
+ "status": 0,
+ "remark": ""
+}
+```
+
+### 2.3 鍒犻櫎鎺ュ彛琛屼负鍙樺寲
+
+- `DELETE /accountSubject/remove/{ids}`
+
+琛屼负锛�
+
+1. 鍒犻櫎鐖惰妭鐐规椂浼氶�掑綊鍒犻櫎鎵�鏈夊瓙瀛欒妭鐐广��
+2. 鑻ヤ换鎰忓緟鍒犻櫎鑺傜偣锛堝惈瀛愬瓩锛夊凡琚� `fin_voucher_entry.subject_code` 寮曠敤锛屽垯鏁翠綋鍒犻櫎澶辫触銆�
+
+---
+
+## 3. 鍓嶇鏀归�犳竻鍗�
+
+## 3.1 鎬昏处绉戠洰绠$悊椤�
+
+鏂囦欢锛歚src/views/financialManagement/generalLedger/index.vue`
+
+### 蹇呮敼椤�
+
+1. 鏂板鈥滅埗绉戠洰鈥濋�夋嫨鎺т欢锛坄el-cascader` 鎴� `el-tree-select`锛夛紝淇濆瓨鏃跺甫 `parentId`銆�
+2. 鍒楄〃鏀逛负鏍戣〃灞曠ず锛堟帹鑽� `el-table` + `row-key` + `tree-props`锛夈��
+3. 鎼滅储閫昏緫淇濇寔涓嶅彉锛屼絾瑕佸吋瀹� `records` 涓烘爲缁撴瀯銆�
+
+---
+
+## 3.2 鍑瘉椤电鐩笅鎷�
+
+鏂囦欢锛歚src/views/financialManagement/voucher/index.vue`
+
+褰撳墠鍑瘉鍒嗗綍浣跨敤 `el-select`锛堝钩閾猴級銆�
+鍚庣宸茶繑鍥炴爲锛岄渶瑕佸墠绔墎骞冲寲鍚庡啀缁戝畾涓嬫媺銆�
+
+绀轰緥锛堝彲澶嶇敤锛夛細
+
+```js
+const flattenSubjectTree = (nodes, result = []) => {
+ (nodes || []).forEach(node => {
+ result.push({
+ code: node.subjectCode,
+ name: node.subjectName,
+ id: node.id,
+ parentId: node.parentId
+ });
+ if (node.children?.length) {
+ flattenSubjectTree(node.children, result);
+ }
+ });
+ return result;
+};
+
+// list 鎺ュ彛杩斿洖鍚庯細
+const treeRecords = response.data?.records || [];
+subjectList.value = flattenSubjectTree(treeRecords);
+```
+
+---
+
+## 3.3 绉戠洰鎬昏处/鏄庣粏璐﹂〉绾ц仈
+
+鏂囦欢锛�
+
+- `src/views/financialManagement/voucher/generalLedger.vue`
+- `src/views/financialManagement/voucher/detailLedger.vue`
+
+褰撳墠閫昏緫鏄妸 `records` 寮哄埗鏄犲皠鎴� `children: []`锛岄渶瑕佸垹闄よ繖娈碘�滃钩閾烘敼閫犫�濓紝鐩存帴浣跨敤鍚庣鏍戙��
+
+绀轰緥锛堝彲澶嶇敤锛夛細
+
+```js
+const toCascaderTree = (nodes = []) =>
+ nodes
+ .filter(item => item.subjectCode && item.subjectName)
+ .map(item => ({
+ code: item.subjectCode,
+ name: item.subjectName,
+ children: toCascaderTree(item.children || [])
+ }));
+
+subjectOptions.value = toCascaderTree(response.data?.records || []);
+```
+
+---
+
+## 4. 寤鸿鐨勫墠绔瓧娈电害瀹�
+
+寤鸿鍦ㄥ墠绔� `form` 澧炲姞锛�
+
+- `parentId: null`
+
+骞跺湪缂栬緫鍥炲~鏃朵繚鎸� `parentId`銆�
+
+---
+
+## 5. 鑱旇皟娉ㄦ剰浜嬮」
+
+1. `/accountSubject/list` 鐨� `total` 鏄牴鑺傜偣鏁伴噺锛屼笉鏄叏閲忚妭鐐规暟銆�
+2. 鑻ラ〉闈粛鎸夊钩閾� `records.map(...)` 澶勭悊锛屼細涓㈠け瀛愯妭鐐广��
+3. 鍒犻櫎绉戠洰澶辫触鏃讹紝浼樺厛妫�鏌ユ槸鍚﹁鍑瘉鍒嗗綍寮曠敤銆�
+4. 淇濆瓨澶辫触鍑虹幇鈥滅埗绉戠洰涓嶈兘鏄綋鍓嶇鐩垨鍏跺瓙绉戠洰鈥濇椂锛岄渶瑕佸墠绔檺鍒剁埗鑺傜偣鍙�夎寖鍥淬��
+
+---
+
+## 6. 鏁版嵁搴撳瓧娈佃姹�
+
+`account_subject` 闇�瑕佸寘鍚� `parent_id` 瀛楁锛坄bigint`锛屽彲绌猴級銆�
+鑻ョ嚎涓婂簱灏氭湭娣诲姞锛岃鍏堟墽琛� DDL 鍐嶈仈璋冦��
diff --git a/doc/20260512_add_parent_id_to_account_subject.sql b/doc/20260512_add_parent_id_to_account_subject.sql
new file mode 100644
index 0000000..cf33a33
--- /dev/null
+++ b/doc/20260512_add_parent_id_to_account_subject.sql
@@ -0,0 +1,5 @@
+-- account_subject 澧炲姞鐖剁骇绉戠洰瀛楁锛堟爲褰㈢粨鏋勶級
+ALTER TABLE `account_subject`
+ADD COLUMN `parent_id` bigint NULL COMMENT '鐖剁鐩甀D锛堜负绌鸿〃绀烘牴鑺傜偣锛�' AFTER `id`;
+
+CREATE INDEX `idx_account_subject_parent_id` ON `account_subject` (`parent_id`);
diff --git a/doc/20260512_create_financial_management_tables.sql b/doc/20260512_create_financial_management_tables.sql
new file mode 100644
index 0000000..db3caad
--- /dev/null
+++ b/doc/20260512_create_financial_management_tables.sql
@@ -0,0 +1,104 @@
+-- 璐㈠姟绠$悊妯″潡寤鸿〃鑴氭湰锛堝浐瀹氳祫浜�/鏃犲舰璧勪骇/鍑瘉/绉戠洰璐︼級
+-- 璇存槑锛�
+-- 1) 鎬昏处绉戠洰缁х画澶嶇敤宸叉湁琛� account_subject锛屼笉閲嶅鍒涘缓 fin_account_subject銆�
+-- 2) 閲戦瀛楁缁熶竴 decimal(18,2)銆�
+
+CREATE TABLE IF NOT EXISTS `fin_fixed_asset` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `asset_code` varchar(64) NOT NULL COMMENT '璧勪骇缂栧彿',
+ `asset_name` varchar(128) NOT NULL COMMENT '璧勪骇鍚嶇О',
+ `category` varchar(64) NOT NULL COMMENT '璧勪骇绫诲埆',
+ `specification` varchar(255) DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `purchase_date` date NOT NULL COMMENT '璐疆鏃ユ湡',
+ `original_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '璧勪骇鍘熷��',
+ `useful_life` int NOT NULL DEFAULT '1' COMMENT '浣跨敤骞撮檺(骞�)',
+ `residual_rate` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '娈嬪�肩巼(%)',
+ `accumulated_depreciation` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '绱鎶樻棫',
+ `net_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '鍑�鍊�',
+ `location` varchar(255) DEFAULT NULL COMMENT '瀛樻斁鍦扮偣',
+ `department` varchar(128) DEFAULT NULL COMMENT '浣跨敤閮ㄩ棬',
+ `keeper` varchar(64) DEFAULT NULL COMMENT '淇濈浜�',
+ `status` varchar(32) NOT NULL DEFAULT 'in_use' COMMENT '鐘舵��: in_use/idle/repair/scrapped',
+ `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_fin_fixed_asset_code` (`asset_code`),
+ KEY `idx_fin_fixed_asset_status` (`status`),
+ KEY `idx_fin_fixed_asset_category` (`category`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='鍥哄畾璧勪骇';
+
+CREATE TABLE IF NOT EXISTS `fin_intangible_asset` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `asset_code` varchar(64) NOT NULL COMMENT '璧勪骇缂栧彿',
+ `asset_name` varchar(128) NOT NULL COMMENT '璧勪骇鍚嶇О',
+ `category` varchar(64) NOT NULL COMMENT '璧勪骇绫诲埆',
+ `certificate_no` varchar(128) DEFAULT NULL COMMENT '璇佷功缂栧彿',
+ `acquisition_date` date NOT NULL COMMENT '鍙栧緱鏃ユ湡',
+ `original_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '璧勪骇鍘熷��',
+ `amortization_period` int NOT NULL DEFAULT '1' COMMENT '鎽婇攢骞撮檺(骞�)',
+ `residual_rate` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '娈嬪�肩巼(%)',
+ `accumulated_amortization` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '绱鎽婇攢',
+ `net_value` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '鍑�鍊�',
+ `validity_date` date DEFAULT NULL COMMENT '鏈夋晥鏈熻嚦',
+ `status` varchar(32) NOT NULL DEFAULT 'in_use' COMMENT '鐘舵��: in_use/expired/amortized',
+ `description` varchar(1000) DEFAULT NULL COMMENT '璧勪骇鎻忚堪',
+ `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_fin_intangible_asset_code` (`asset_code`),
+ KEY `idx_fin_intangible_asset_status` (`status`),
+ KEY `idx_fin_intangible_asset_category` (`category`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='鏃犲舰璧勪骇';
+
+CREATE TABLE IF NOT EXISTS `fin_voucher` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `voucher_no` varchar(64) NOT NULL COMMENT '鍑瘉瀛楀彿',
+ `voucher_date` date NOT NULL COMMENT '鍑瘉鏃ユ湡',
+ `summary` varchar(500) DEFAULT NULL COMMENT '鎽樿',
+ `debit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '鍊熸柟鍚堣',
+ `credit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '璐锋柟鍚堣',
+ `creator` varchar(64) DEFAULT NULL COMMENT '鍒跺崟浜�',
+ `status` varchar(32) NOT NULL DEFAULT 'unposted' COMMENT '鐘舵��: unposted/posted/cancelled',
+ `attachment_count` int NOT NULL DEFAULT '0' COMMENT '闄勪欢寮犳暟',
+ `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uk_fin_voucher_no` (`voucher_no`),
+ KEY `idx_fin_voucher_date` (`voucher_date`),
+ KEY `idx_fin_voucher_status` (`status`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='鍑瘉涓昏〃';
+
+CREATE TABLE IF NOT EXISTS `fin_voucher_entry` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `voucher_id` bigint NOT NULL COMMENT '鍑瘉ID',
+ `row_no` int NOT NULL DEFAULT '1' COMMENT '琛屽彿',
+ `subject_code` varchar(64) NOT NULL COMMENT '绉戠洰缂栫爜',
+ `subject_name` varchar(128) DEFAULT NULL COMMENT '绉戠洰鍚嶇О',
+ `summary` varchar(500) DEFAULT NULL COMMENT '鎽樿',
+ `debit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '鍊熸柟閲戦',
+ `credit` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '璐锋柟閲戦',
+ `auxiliary_type` varchar(32) DEFAULT NULL COMMENT '杈呭姪鏍哥畻绫诲瀷',
+ `auxiliary_id` varchar(64) DEFAULT NULL COMMENT '杈呭姪鏍哥畻瀵硅薄ID',
+ `auxiliary_name` varchar(128) DEFAULT NULL COMMENT '杈呭姪鏍哥畻瀵硅薄鍚嶇О',
+ `create_user` varchar(64) DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`),
+ KEY `idx_fin_voucher_entry_voucher` (`voucher_id`),
+ KEY `idx_fin_voucher_entry_subject` (`subject_code`),
+ KEY `idx_fin_voucher_entry_aux` (`auxiliary_type`, `auxiliary_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='鍑瘉鍒嗗綍';
diff --git "a/doc/20260512_\350\264\242\345\212\241\347\256\241\347\220\206\346\250\241\345\235\227\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260512_\350\264\242\345\212\241\347\256\241\347\220\206\346\250\241\345\235\227\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..1804d82
--- /dev/null
+++ "b/doc/20260512_\350\264\242\345\212\241\347\256\241\347\220\206\346\250\241\345\235\227\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,288 @@
+# 璐㈠姟绠$悊妯″潡鍓嶇鑱旇皟鏂囨。锛坅ccount 妯″潡锛�
+
+鏇存柊鏃堕棿锛�2026-05-12
+
+## 1. 閫氱敤璇存槑
+
+### 1.1 鍝嶅簲缁撴瀯
+鎴愬姛鍝嶅簲锛�
+
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": {}
+}
+```
+
+涓氬姟鏍¢獙澶辫触锛堜緥濡傚�熻捶涓嶅钩琛°�佸繀濉己澶憋級鐢卞叏灞�寮傚父杩斿洖锛�
+
+```json
+{
+ "code": 500,
+ "msg": "閿欒淇℃伅",
+ "data": null
+}
+```
+
+### 1.2 鍒嗛〉缁撴瀯
+鍒嗛〉鎺ュ彛缁熶竴浣跨敤 MyBatis-Plus `Page`锛�
+- 璇锋眰鍙傛暟锛歚current`銆乣size`
+- 杩斿洖锛歚data.records`銆乣data.total`
+
+---
+
+## 2. 鎬昏处绉戠洰锛堝凡鍦ㄥ師鎺ュ彛涓婂寮烘牎楠岋級
+
+鎺ュ彛淇濇寔涓嶅彉锛�
+- `GET /accountSubject/list`
+- `POST /accountSubject/add`
+- `PUT /accountSubject/edit`
+- `DELETE /accountSubject/remove/{ids}`
+- `POST /accountSubject/export`
+
+鏂板瑙勫垯锛�
+1. `subjectCode`銆乣subjectName`銆乣subjectType` 蹇呭~銆�
+2. `subjectCode` 鍞竴鏍¢獙銆�
+3. 鍒犻櫎鍓嶅仛寮曠敤鏍¢獙锛氳嫢琚嚟璇佸垎褰�(`fin_voucher_entry.subject_code`)寮曠敤锛岀姝㈠垹闄ゃ��
+
+---
+
+## 3. 鍥哄畾璧勪骇
+
+Base URL锛歚/financial/fixedAsset`
+
+### 3.1 鍒嗛〉鏌ヨ
+- `GET /page`
+- Query锛歚current,size,assetCode,assetName,category,status`
+
+### 3.2 鏂板
+- `POST /add`
+- Body锛圝SON锛夛細
+
+```json
+{
+ "assetCode": "GD20260512001",
+ "assetName": "鍔炲叕鐢佃剳",
+ "category": "electronic",
+ "specification": "ThinkPad X1",
+ "purchaseDate": "2026-05-01",
+ "originalValue": 8000.00,
+ "usefulLife": 5,
+ "residualRate": 5.00,
+ "location": "璐㈠姟閮�",
+ "department": "璐㈠姟閮�",
+ "keeper": "寮犱笁",
+ "status": "in_use",
+ "remark": "绀轰緥"
+}
+```
+
+### 3.3 淇敼
+- `PUT /update`
+- Body锛氬悓鏂板锛岄渶鍖呭惈 `id`
+
+### 3.4 鍒犻櫎
+- `DELETE /delete?ids=1&ids=2`
+
+### 3.5 鎶樻棫璁℃彁锛堟寜鏈堬級
+- `POST /depreciate`
+- Body 鍙�夛細
+ - 鍏ㄩ儴鍦ㄧ敤璧勪骇锛歚{}`
+ - 鎸囧畾璧勪骇锛歚{"ids":[1,2,3]}`
+
+鏍稿績鍏紡锛�
+- `monthlyDepreciation = originalValue * (1 - residualRate/100) / (usefulLife*12)`
+- `accumulatedDepreciation += monthlyDepreciation`
+- `netValue = originalValue - accumulatedDepreciation`
+
+鐘舵�佸缓璁�硷細
+- `in_use`銆乣idle`銆乣repair`銆乣scrapped`
+
+---
+
+## 4. 鏃犲舰璧勪骇
+
+Base URL锛歚/financial/intangibleAsset`
+
+### 4.1 鍒嗛〉鏌ヨ
+- `GET /page`
+- Query锛歚current,size,assetCode,assetName,category,status`
+
+### 4.2 鏂板
+- `POST /add`
+
+```json
+{
+ "assetCode": "WX20260512001",
+ "assetName": "ERP杞欢璁稿彲",
+ "category": "software",
+ "certificateNo": "SW-001",
+ "acquisitionDate": "2026-05-01",
+ "originalValue": 50000.00,
+ "amortizationPeriod": 10,
+ "residualRate": 0.00,
+ "validityDate": "2036-05-01",
+ "status": "in_use",
+ "description": "绀轰緥",
+ "remark": ""
+}
+```
+
+### 4.3 淇敼
+- `PUT /update`
+- Body锛氬悓鏂板锛岄渶鍖呭惈 `id`
+
+### 4.4 鍒犻櫎
+- `DELETE /delete?ids=1&ids=2`
+
+### 4.5 鎽婇攢璁℃彁锛堟寜鏈堬級
+- `POST /amortize`
+- Body 鍙�夛細
+ - 鍏ㄩ儴鍦ㄧ敤璧勪骇锛歚{}`
+ - 鎸囧畾璧勪骇锛歚{"ids":[1,2,3]}`
+
+鏍稿績鍏紡锛�
+- `monthlyAmortization = originalValue * (1 - residualRate/100) / (amortizationPeriod*12)`
+- `accumulatedAmortization += monthlyAmortization`
+- `netValue = originalValue - accumulatedAmortization`
+- 褰� `netValue <= 0` 鏃讹細`netValue=0` 涓� `status=amortized`
+
+鐘舵�佸缓璁�硷細
+- `in_use`銆乣expired`銆乣amortized`
+
+---
+
+## 5. 鍑瘉
+
+Base URL锛歚/financial/voucher`
+
+### 5.1 鍒嗛〉鏌ヨ
+- `GET /page`
+- Query锛歚current,size,voucherNo,creator,status,startDate,endDate`
+
+### 5.2 鏂板
+- `POST /add`
+
+```json
+{
+ "voucherNo": "璁�-0001",
+ "voucherDate": "2026-05-12",
+ "summary": "閿�鍞敹鍏�",
+ "creator": "寮犱笁",
+ "attachmentCount": 0,
+ "remark": "",
+ "entries": [
+ {
+ "subjectCode": "1002",
+ "subjectName": "閾惰瀛樻",
+ "summary": "鏀跺埌璐ф",
+ "debit": 1000.00,
+ "credit": 0
+ },
+ {
+ "subjectCode": "6001",
+ "subjectName": "涓昏惀涓氬姟鏀跺叆",
+ "summary": "纭鏀跺叆",
+ "debit": 0,
+ "credit": 1000.00
+ }
+ ]
+}
+```
+
+### 5.3 淇敼
+- `PUT /update`
+- Body锛氬悓鏂板锛岄渶鍖呭惈 `id`
+- 浠� `unposted` 鐘舵�佸厑璁镐慨鏀�
+
+### 5.4 杩囪处
+- `POST /post`
+
+```json
+{
+ "id": 1
+}
+```
+
+### 5.5 浣滃簾
+- `POST /cancel`
+
+```json
+{
+ "id": 1
+}
+```
+
+### 5.6 璇︽儏
+- `GET /detail/{id}`
+
+鍏抽敭鏍¢獙锛�
+1. 鍒嗗綍鑷冲皯涓�鏉℃湁鏁堣锛堢鐩笉绌猴紝涓斿�熸柟鎴栬捶鏂� > 0锛夈��
+2. 姣忔潯鏈夋晥鍒嗗綍涓嶈兘鍊熻捶鍚屾椂澶т簬 0銆�
+3. 鍊熻捶骞宠 锛歚sum(debit) == sum(credit)` 涓旈兘 > 0銆�
+4. `subjectCode` 蹇呴』瀛樺湪浜� `account_subject`銆�
+
+鐘舵�佹祦杞細
+- `unposted -> posted`
+- `unposted -> cancelled`
+
+---
+
+## 6. 绉戠洰鎬昏处
+
+### 6.1 鏌ヨ鎺ュ彛
+- `GET /financial/ledger/general`
+
+### 6.2 Query 鍙傛暟
+- `subjectCode`锛堝繀濉級
+- `startMonth`锛圷YYY-MM锛�
+- `endMonth`锛圷YYY-MM锛�
+
+### 6.3 杩斿洖瀛楁
+- `rowType`锛歚opening` / `entry` / `monthly_total` / `yearly_total`
+- `date`
+- `voucherNo`
+- `summary`
+- `debit`
+- `credit`
+- `direction`锛堝��/璐凤級
+- `balance`锛堝�熸璐疯礋锛�
+
+璇存槑锛�
+- 绉戠洰鏀寔鈥滄寚瀹氱鐩強鍏朵笅绾э紙鍓嶇紑鍖归厤锛夆�濇煡璇€��
+- 鑷姩杈撳嚭鈥滄湡鍒濅綑棰� / 鏈湀鍚堣 / 鏈勾绱鈥濄��
+
+---
+
+## 7. 绉戠洰鏄庣粏璐�
+
+### 7.1 鏌ヨ鎺ュ彛
+- `GET /financial/ledger/detail`
+
+### 7.2 Query 鍙傛暟
+- `subjectCode`锛堝繀濉級
+- `auxiliaryType`锛堝彲閫夛細`customer/supplier/department/employee/project`锛�
+- `auxiliaryId`锛堝彲閫夛級
+- `startMonth`锛圷YYY-MM锛�
+- `endMonth`锛圷YYY-MM锛�
+
+### 7.3 杩斿洖瀛楁
+鍚岀鐩�昏处锛�
+- `rowType,date,voucherNo,summary,debit,credit,direction,balance`
+
+---
+
+## 8. 鏁版嵁搴撹剼鏈�
+
+宸叉彁渚涜剼鏈細
+
+- `doc/20260512_create_financial_management_tables.sql`
+
+鍖呭惈锛�
+- `fin_fixed_asset`
+- `fin_intangible_asset`
+- `fin_voucher`
+- `fin_voucher_entry`
+
+鎬昏处绉戠洰澶嶇敤鐜版湁 `account_subject`銆�
diff --git a/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql b/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql
new file mode 100644
index 0000000..7f34fe0
--- /dev/null
+++ b/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql
@@ -0,0 +1,22 @@
+ALTER TABLE `inspection_task`
+ ADD COLUMN `inspection_project` VARCHAR(100) NULL COMMENT '宸℃椤圭洰' AFTER `task_name`;
+
+ALTER TABLE `inspection_task`
+ ADD COLUMN `inspection_result` VARCHAR(1) NULL COMMENT '宸℃缁撴灉 0寮傚父 1姝e父' AFTER `remarks`,
+ ADD COLUMN `abnormal_description` VARCHAR(500) NULL COMMENT '寮傚父鎻忚堪' AFTER `inspection_result`,
+ ADD COLUMN `device_repair_id` BIGINT NULL COMMENT '鍏宠仈缁翠慨鍗旾D' AFTER `abnormal_description`,
+ ADD COLUMN `acceptance_user_id` BIGINT NULL COMMENT '楠屾敹浜篒D' AFTER `device_repair_id`,
+ ADD COLUMN `acceptance_name` VARCHAR(100) NULL COMMENT '楠屾敹浜�' AFTER `acceptance_user_id`;
+
+ALTER TABLE `timing_task`
+ ADD COLUMN `inspection_project` VARCHAR(100) NULL COMMENT '宸℃椤圭洰' AFTER `task_name`,
+ ADD COLUMN `is_enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '鏄惁鍚敤 0鍚� 1鏄�' AFTER `is_active`;
+
+CREATE INDEX `idx_inspection_task_device_repair_id`
+ ON `inspection_task` (`device_repair_id`);
+
+CREATE INDEX `idx_inspection_task_inspection_result`
+ ON `inspection_task` (`inspection_result`);
+
+CREATE INDEX `idx_timing_task_is_enabled`
+ ON `timing_task` (`is_enabled`);
diff --git "a/doc/20260515_\350\256\276\345\244\207\345\267\241\346\243\200\345\274\202\345\270\270\350\201\224\345\212\250\347\273\264\344\277\256\345\215\225_\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260515_\350\256\276\345\244\207\345\267\241\346\243\200\345\274\202\345\270\270\350\201\224\345\212\250\347\273\264\344\277\256\345\215\225_\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..0df5fcc
--- /dev/null
+++ "b/doc/20260515_\350\256\276\345\244\207\345\267\241\346\243\200\345\274\202\345\270\270\350\201\224\345\212\250\347\273\264\344\277\256\345\215\225_\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,170 @@
+# 璁惧宸℃涓庡畾鏃跺贰妫�鍓嶇鑱旇皟鏂囨。锛坕nspectiontask锛�
+
+> 鏇存柊鏃ユ湡锛�2026-05-15
+> 閫傜敤妯″潡锛氳澶囧贰妫�浠诲姟 `inspectiontask`锛坄/inspectionTask`锛変笌瀹氭椂宸℃浠诲姟锛坄/timingTask`锛�
+
+## 1. 鏈鏀瑰姩
+
+1. 宸℃浠诲姟鏂板瀛楁锛�
+ - `inspectionProject`锛堝贰妫�椤圭洰锛�
+ - `inspectionResult`锛堝贰妫�缁撴灉锛宍0`寮傚父 / `1`姝e父锛屽繀濉級
+ - `abnormalDescription`锛堝紓甯告弿杩帮級
+ - `deviceRepairId`锛堝叧鑱旂淮淇崟ID锛屽紓甯告椂鍚庣鑷姩鍥炲~锛�
+ - `acceptanceUserId`锛堥獙鏀朵汉ID锛�
+ - `acceptanceName`锛堥獙鏀朵汉锛�
+2. 寮傚父鏍¢獙瑙勫垯锛�
+ - `inspectionResult=1`锛堟甯革級锛氱収鐗囬潪蹇呭~銆�
+ - `inspectionResult=0`锛堝紓甯革級锛氬繀椤绘湁鐓х墖锛屼笖蹇呴』濉啓 `abnormalDescription`銆�
+3. 寮傚父鑱斿姩瑙勫垯锛�
+ - 寮傚父淇濆瓨鍚庤嚜鍔ㄧ敓鎴� `device_repair` 骞跺洖濉� `deviceRepairId`銆�
+4. 瀹氭椂浠诲姟鏂板瀛楁锛�
+ - `inspectionProject`锛堝贰妫�椤圭洰锛�
+ - `isEnabled`锛堟槸鍚﹀惎鐢紝`0`鍚� / `1`鏄級
+5. 澶囨敞甯﹀叆瑙勫垯锛�
+ - 瀹氭椂浠诲姟鑷姩鐢熸垚宸℃璁板綍鏃讹紝鑻ュ畾鏃朵换鍔� `remarks` 鏈夊�硷紝浼氭嫾鎺ュ埌宸℃璁板綍澶囨敞涓��
+
+## 2. 鏁版嵁搴撳彉鏇�
+
+鑱旇皟鍓嶆墽琛� SQL锛�
+
+- [doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql](/D:/鐗涢┈/鍗楅��/鍚庣/product-inventory-management-after-jdk25/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql)
+
+> 璇存槑锛氳鑴氭湰褰撳墠浣滅敤浜� `inspection_task` 涓� `timing_task` 涓ゅ紶琛紝鏂囦欢鍚嶅巻鍙蹭繚鐣欐湭鏀广��
+
+## 3. 宸℃浠诲姟鎺ュ彛
+
+### 3.1 淇濆瓨鎺ュ彛
+
+`POST /inspectionTask/addOrEditInspectionTask`
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| id | long | 鍚� | 鏈夊��=淇敼锛屾棤鍊�=鏂板 |
+| taskId | int | 寤鸿蹇呭~ | 璁惧ID锛堢敤浜庡紓甯歌嚜鍔ㄥ缓缁翠慨鍗曪級 |
+| taskName | string | 寤鸿蹇呭~ | 璁惧鍚嶇О |
+| inspectionProject | string | 鍚� | 宸℃椤圭洰 |
+| inspectorId | string | 鍚� | 宸℃浜篒D锛屾敮鎸侀�楀彿鍒嗛殧 |
+| inspectionResult | string | 鏄� | `0`=寮傚父锛宍1`=姝e父 |
+| abnormalDescription | string | 鏉′欢蹇呭~ | 寮傚父鏃跺繀濉� |
+| acceptanceUserId | long | 鍚� | 楠屾敹浜篒D |
+| acceptanceName | string | 鍚� | 楠屾敹浜哄鍚� |
+| commonFileListDTO | array | 鏉′欢蹇呭~ | 闄勪欢缁�1锛堝紓甯告椂涓夌粍鑷冲皯涓�缁勬湁鍥撅級 |
+| commonFileListAfterDTO | array | 鏉′欢蹇呭~ | 闄勪欢缁�2锛堝紓甯告椂涓夌粍鑷冲皯涓�缁勬湁鍥撅級 |
+| commonFileListBeforeDTO | array | 鏉′欢蹇呭~ | 闄勪欢缁�3锛堝紓甯告椂涓夌粍鑷冲皯涓�缁勬湁鍥撅級 |
+
+寮傚父绀轰緥锛�
+
+```json
+{
+ "taskId": 1001,
+ "taskName": "绌哄帇鏈篈-01",
+ "inspectionProject": "娑︽粦绯荤粺",
+ "inspectorId": "12",
+ "inspectionResult": "0",
+ "abnormalDescription": "鐢垫満寮傚搷锛屾俯鍗囧亸楂�",
+ "acceptanceUserId": 20,
+ "commonFileListDTO": [
+ {
+ "id": 90001,
+ "application": "file"
+ }
+ ]
+}
+```
+
+姝e父绀轰緥锛�
+
+```json
+{
+ "taskId": 1001,
+ "taskName": "绌哄帇鏈篈-01",
+ "inspectionProject": "鐐规",
+ "inspectorId": "12",
+ "inspectionResult": "1",
+ "acceptanceUserId": 20
+}
+```
+
+### 3.2 鍒楄〃鎺ュ彛
+
+`GET /inspectionTask/list`
+
+杩斿洖鍖呭惈鏂板瀛楁锛�
+
+- `inspectionProject`
+- `inspectionResult`
+- `abnormalDescription`
+- `deviceRepairId`
+- `acceptanceUserId`
+- `acceptanceName`
+
+## 4. 瀹氭椂浠诲姟鎺ュ彛
+
+### 4.1 淇濆瓨鎺ュ彛
+
+`POST /timingTask/addOrEditTimingTask`
+
+鏂板/鏇存柊瀛楁锛�
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| inspectionProject | string | 鍚� | 宸℃椤圭洰 |
+| remarks | string | 鍚� | 澶囨敞 |
+| isEnabled | int | 鍚� | `0`=绂佺敤锛宍1`=鍚敤锛涗笉浼犻粯璁ゅ惎鐢� |
+
+绀轰緥锛�
+
+```json
+{
+ "taskName": "绌哄帇鏈篈-01瀹氭椂宸℃",
+ "inspectionProject": "鏈堝害宸℃",
+ "taskId": 1001,
+ "inspectorIds": "12,13",
+ "frequencyType": "DAILY",
+ "frequencyDetail": "09:00",
+ "remarks": "閲嶇偣妫�鏌ヨ酱鎵挎俯搴�",
+ "isEnabled": 1
+}
+```
+
+### 4.2 鍚敤鐘舵�佽涓�
+
+1. `isEnabled=1`锛氫换鍔¤繘鍏ヨ皟搴︼紝鎸夐娆¤嚜鍔ㄧ敓鎴愬贰妫�璁板綍銆�
+2. `isEnabled=0`锛氫换鍔′笉璋冨害锛涘凡瀛樺湪璋冨害浼氳绉婚櫎銆�
+
+### 4.3 澶囨敞甯﹀叆瑙勫垯
+
+瀹氭椂浠诲姟鑷姩鐢熸垚宸℃璁板綍鏃讹細
+
+1. 宸℃璁板綍澶囨敞鍥哄畾鍓嶇紑锛歚鑷姩鐢熸垚鑷畾鏃朵换鍔D: {id}`
+2. 褰撳畾鏃朵换鍔� `remarks` 闈炵┖鏃讹紝鎷兼帴涓猴細
+ `鑷姩鐢熸垚鑷畾鏃朵换鍔D: {id}锛泏remarks}`
+
+## 5. 寮傚父鑷姩寤虹淮淇崟瑙勫垯
+
+褰撳贰妫�璁板綍 `inspectionResult=0` 鏃讹細
+
+1. 鑻� `deviceRepairId` 涓虹┖锛屽悗绔嚜鍔ㄥ垱寤� `device_repair`锛�
+ - `deviceLedgerId`锛氭潵鑷� `taskId`
+ - `deviceName`锛氫紭鍏� `taskName`锛屽惁鍒欏彇璁惧鍙拌处鍚嶇О
+ - `remark`锛氬紓甯告弿杩�
+ - `status`锛歚0`锛堝緟缁翠慨锛�
+2. 鑻ュ凡鏈夊叧鑱旂淮淇崟锛屼粎鍚屾鏇存柊缁翠慨鍗� `remark`銆�
+
+## 6. 鍓嶇鏀归�犲缓璁�
+
+1. 宸℃琛ㄥ崟鏂板 `inspectionProject` 杈撳叆妗嗐��
+2. 宸℃琛ㄥ崟淇濈暀鈥滄甯�/寮傚父鈥濊仈鍔ㄦ牎楠岋細
+ - 寮傚父鏃跺己鍒跺紓甯告弿杩� + 鑷冲皯涓�缁勫浘鐗囥��
+3. 瀹氭椂浠诲姟琛ㄥ崟鏂板鈥滄槸鍚﹀惎鐢ㄢ�濆紑鍏冲苟鏄犲皠 `isEnabled`銆�
+4. 瀹氭椂浠诲姟琛ㄥ崟鏂板 `inspectionProject` 涓� `remarks` 杈撳叆椤广��
+5. 宸℃鍒楄〃灞曠ず `inspectionProject` 鍜� `deviceRepairId`锛堟敮鎸佽烦杞淮淇崟璇︽儏锛夈��
+
+## 7. 鑱旇皟楠屾敹娓呭崟
+
+1. 宸℃鏂板/淇敼鍙纭彁浜� `inspectionProject` 骞跺湪鍒楄〃鍥炴樉銆�
+2. 寮傚父宸℃锛堟湁鎻忚堪+鏈夊浘锛変繚瀛樻垚鍔熷苟鍥炲~ `deviceRepairId`銆�
+3. 寮傚父宸℃缂烘弿杩版垨缂哄浘鐗囨椂琚嫤鎴��
+4. 瀹氭椂浠诲姟 `isEnabled=0` 鏃朵笉鍐嶈Е鍙戣嚜鍔ㄥ贰妫�璁板綍銆�
+5. 瀹氭椂浠诲姟 `isEnabled=1` 鏃舵寜棰戞鐢熸垚宸℃璁板綍銆�
+6. 瀹氭椂浠诲姟鏈� `remarks` 鏃讹紝鑷姩宸℃璁板綍澶囨敞甯︿笂璇ュ唴瀹广��
diff --git "a/doc/20260516_\345\210\266\351\200\240\346\231\272\350\203\275\345\212\251\346\211\213\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260516_\345\210\266\351\200\240\346\231\272\350\203\275\345\212\251\346\211\213\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..d4b9a1f
--- /dev/null
+++ "b/doc/20260516_\345\210\266\351\200\240\346\231\272\350\203\275\345\212\251\346\211\213\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,258 @@
+# 鍒堕�犳櫤鑳藉姪鎵嬪墠绔仈璋冩枃妗o紙`manufacturing-ai`锛�
+
+> 鏇存柊鏃ユ湡锛�2026-05-16
+> 閫傜敤妯″潡锛氱敓浜х幇鍦恒�佽鍒掋�佸伐鍗曘�佽澶囥�佽川閲忋�佺墿鏂欍�佸紓甯稿鐞�
+> 鑳藉姏鑼冨洿锛氭煡銆侀棶銆佸姙銆侀璀︺�佸垎鏋�
+
+## 1. 鎺ュ彛鎬昏
+
+1. 娴佸紡瀵硅瘽锛歚POST /manufacturing-ai/chat`
+2. 浼氳瘽鍒楄〃锛歚GET /manufacturing-ai/history/sessions`
+3. 浼氳瘽娑堟伅锛歚GET /manufacturing-ai/history/messages/{memoryId}`
+4. 鍒犻櫎浼氳瘽锛歚DELETE /manufacturing-ai/history/{memoryId}`
+
+璇存槑锛�
+- `/chat` 涓� **SSE/娴佸紡鏂囨湰** 杩斿洖锛坄text/stream;charset=utf-8`锛夈��
+- 鍛戒腑鈥滄煡/棰勮/鍒嗘瀽/鍔炩�濆伐鍏锋椂锛屾祦寮忔渶缁堝唴瀹规槸 **JSON 瀛楃涓�**锛堜笉鏄� `AjaxResult`锛夈��
+- 鏈懡涓伐鍏锋椂锛岃繑鍥炴櫘閫氳嚜鐒惰瑷�鏂囨湰銆�
+
+## 2. 閴存潈涓庤姹傚ご
+
+- 缁熶竴浣跨敤绯荤粺鐧诲綍鎬侊紙`Authorization` 涓庣幇鏈夋帴鍙d竴鑷达級銆�
+- `POST /manufacturing-ai/chat` 璇锋眰澶达細`Content-Type: application/json`銆�
+
+## 3. 瀵硅瘽鎺ュ彛
+
+### 3.1 璇锋眰
+
+```http
+POST /manufacturing-ai/chat
+Content-Type: application/json
+```
+
+```json
+{
+ "memoryId": "mfg-ai-001",
+ "message": "鏌ヨ澶囪タ闂ㄥ瓙鍙橀鍣ㄧ殑缁翠慨鎯呭喌"
+}
+```
+
+瀛楁璇存槑锛�
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+| --- | --- | --- | --- |
+| memoryId | string | 鏄� | 浼氳瘽 ID锛屽墠绔敓鎴愬苟澶嶇敤 |
+| message | string | 鏄� | 鐢ㄦ埛杈撳叆 |
+
+### 3.2 杩斿洖锛堟祦寮忥級
+
+```http
+Content-Type: text/stream;charset=utf-8
+```
+
+鍓嶇澶勭悊寤鸿锛�
+1. 鎸夋祦鎷兼帴瀹屾暣鏂囨湰銆�
+2. 灏濊瘯 `JSON.parse(fullText)`锛�
+ - 鎴愬姛锛氭寜缁撴瀯鍖栫粨鏋滄覆鏌撱��
+ - 澶辫触锛氭寜鏅�氳亰澶╂枃鏈覆鏌撱��
+
+## 4. 缁撴瀯鍖栧搷搴斿崗璁�
+
+### 4.1 閫氱敤缁撴瀯
+
+```json
+{
+ "success": true,
+ "type": "manufacturing_device_repair_list",
+ "description": "宸茶繑鍥炶澶囩淮淇褰曘��",
+ "summary": {},
+ "data": {},
+ "charts": {}
+}
+```
+
+### 4.2 `type` 鏋氫妇
+
+| type | 鍦烘櫙 |
+| --- | --- |
+| manufacturing_site_snapshot | 鐢熶骇鐜板満姒傝 |
+| manufacturing_plan_list | 鐢熶骇璁″垝鏌ヨ |
+| manufacturing_workorder_list | 宸ュ崟鏌ヨ |
+| manufacturing_device_list | 璁惧鍙拌处鏌ヨ |
+| manufacturing_device_repair_list | 璁惧缁翠慨璁板綍鏌ヨ |
+| manufacturing_quality_list | 璐ㄩ噺鏌ヨ |
+| manufacturing_material_list | 鐗╂枡搴撳瓨鏌ヨ |
+| manufacturing_exception_list | 寮傚父澶勭悊鏌ヨ |
+| manufacturing_warning | 棰勮鐪嬫澘 |
+| manufacturing_analysis | 缁忚惀鍒嗘瀽 |
+| manufacturing_action_plan | 鍔炵悊寤鸿锛堝姩浣滃崱锛� |
+
+## 5. 鈥滄煡鈥濊兘鍔涜仈璋冭鐐�
+
+### 5.1 璁惧鐩稿叧璺敱瑙勫垯锛堝叧閿級
+
+- 褰撶敤鎴疯緭鍏ュ寘鍚� `缁翠慨/鎶ヤ慨/妫�淇�/缁存姢`锛岃澶囧煙浼氳繑鍥� `manufacturing_device_repair_list`锛堟煡 `device_repair`锛夈��
+- 鏈寘鍚互涓婅瘝鏃讹紝杩斿洖 `manufacturing_device_list`锛堟煡璁惧鍙拌处锛夈��
+
+绀轰緥锛�
+- `鏌ヨ澶嘇-01` -> `manufacturing_device_list`
+- `鏌ヨ澶嘇-01缁翠慨鎯呭喌` -> `manufacturing_device_repair_list`
+
+### 5.2 缁翠慨璁板綍鏃堕棿杩囨护瑙勫垯锛堝叧閿級
+
+- 鐢ㄦ埛鏄庣‘甯︽椂闂存潯浠讹紙濡傗�滄湰鏈�/涓婂懆/杩�7澶�/2026-05-01 鍒� 2026-05-16鈥濓級鎵嶆寜鏃堕棿杩囨护缁翠慨璁板綍銆�
+- 鏈甫鏃堕棿鏉′欢鏃讹紝涓嶉粯璁ゆ寜杩� 30 澶╂埅鏂紝閬垮厤鍘嗗彶缁翠慨璁板綍琚杩囨护銆�
+
+### 5.3 鍏抽敭璇嶅鐞嗚鍒欙紙璁惧/缁翠慨锛�
+
+- 绯荤粺浼氭竻娲楀櫔闊宠瘝锛歚鏌ヨ/鏌ョ湅/璇�/璁惧/缁翠慨鎯呭喌/璁板綍/淇℃伅` 绛夈��
+- 鍚屾椂浼氶�氳繃璁惧鍙拌处鍖归厤 `deviceLedgerId` 鍏滃簳锛屽啀鍥炴煡缁翠慨璁板綍锛岄檷浣庘�滄湁鏁版嵁浣嗘煡涓嶅埌鈥濈殑姒傜巼銆�
+
+### 5.4 鍒楄〃缁撴灉绾﹀畾
+
+- 鍒楄〃鏁版嵁缁熶竴鍦� `data.items`
+- 缁熻鎽樿鍦� `summary`
+
+甯哥敤瀛楁锛�
+
+| type | 甯哥敤瀛楁 |
+| --- | --- |
+| manufacturing_plan_list | `mpsNo`, `requiredDate`, `status` |
+| manufacturing_workorder_list | `workOrderNo`, `planStartTime`, `planEndTime`, `status` |
+| manufacturing_device_list | `deviceName`, `deviceModel`, `pendingRepairCount` |
+| manufacturing_device_repair_list | `deviceName`, `deviceModel`, `repairTime`, `repairName`, `maintenanceName`, `status`, `createTime` |
+
+## 6. 鈥滈璀︹�濊仈璋冭鐐�
+
+- `type = manufacturing_warning`
+- 棰勮鏄庣粏鍦� `data.items`锛屾瘡椤瑰寘鍚細
+ - `level`锛歚high` / `medium`
+ - `title`
+ - `count`
+ - `detail`
+
+鐘舵�佸彛寰勶細
+- 璁惧鈥滃緟缁翠慨鈥濈粺璁℃寜 `status = 0` 璁$畻锛堜笉鍐嶆妸鍏朵粬鐘舵�佽鍏ュ緟缁翠慨锛夈��
+
+## 7. 鈥滃垎鏋愨�濊仈璋冭鐐�
+
+- `type = manufacturing_analysis`
+- 鍏抽敭鎸囨爣鍦� `summary`
+- 鎸囨爣鍗″湪 `data.coreMetrics`
+- 鍥捐〃閰嶇疆鍦� `charts`锛�
+ - `charts.domainBarOption`
+ - `charts.qualityPieOption`
+
+鍥捐〃閰嶇疆鍙洿鎺ョ粰 ECharts 浣跨敤銆�
+
+## 8. 鈥滃姙鈥濊兘鍔涜仈璋冭鐐�
+
+褰撳墠鈥滃姙鈥濅负 **鍔炵悊寤鸿妯″紡**锛圓I 杈撳嚭鍔ㄤ綔鍗★紝鍓嶇纭鍚庤皟鐢ㄧ洰鏍囦笟鍔℃帴鍙o級銆�
+
+- `type = manufacturing_action_plan`
+- 鍔ㄤ綔鍗℃暟缁勶細`data.actionCards`
+
+鍔ㄤ綔鍗″瓧娈碉細
+
+| 瀛楁 | 璇存槑 |
+| --- | --- |
+| code | 鍔ㄤ綔缂栫爜 |
+| name | 鍔ㄤ綔鍚嶇О |
+| method | 璇锋眰鏂规硶 |
+| targetApi | 鐩爣涓氬姟鎺ュ彛 |
+| requiredFields | 蹇呭~瀛楁 |
+| examplePayload | 绀轰緥鍙傛暟 |
+| description | 璇存槑 |
+
+鍐呯疆鍔ㄤ綔绀轰緥锛�
+1. `POST /productionOperationTask/assign`
+2. `POST /device/repair`
+3. `POST /quality/qualityUnqualified/deal`
+4. `POST /stockInventory/addstockInventory`
+5. `POST /procurementExceptionRecord/add`
+
+## 9. 浼氳瘽绠$悊鎺ュ彛
+
+### 9.1 浼氳瘽鍒楄〃
+
+```http
+GET /manufacturing-ai/history/sessions
+```
+
+`AjaxResult.data` 瀛楁锛�
+- `memoryId`
+- `title`
+- `lastMessage`
+- `messageCount`
+- `lastChatTime`
+
+### 9.2 浼氳瘽娑堟伅
+
+```http
+GET /manufacturing-ai/history/messages/{memoryId}
+```
+
+`AjaxResult.data` 瀛楁锛�
+- `role`锛歚user` / `assistant` / `system` / `tool`
+- `content`
+- `filePaths`
+
+### 9.3 鍒犻櫎浼氳瘽
+
+```http
+DELETE /manufacturing-ai/history/{memoryId}
+```
+
+杩斿洖鏍囧噯 `AjaxResult`銆�
+
+## 10. 閿欒涓庤竟鐣�
+
+`/chat` 甯歌杩斿洖鏂囨湰锛�
+- `memoryId涓嶈兘涓虹┖`
+- `message涓嶈兘涓虹┖`
+
+寤鸿鍓嶇鍙戦�佸墠鍏堝仛蹇呭~鏍¢獙銆�
+
+## 11. 鍓嶇鑱旇皟娴佺▼寤鸿
+
+1. 鐧诲綍鍚庡垱寤哄苟澶嶇敤 `memoryId`銆�
+2. 璋冪敤 `/manufacturing-ai/chat`锛屾寜 SSE 鎷兼帴瀹屾暣鏂囨湰銆�
+3. 鍏堝皾璇� JSON 瑙f瀽锛�
+ - 鎴愬姛锛氭寜 `type` 璺敱鍒板搴� UI锛堝垪琛�/棰勮/鍒嗘瀽/鍔ㄤ綔鍗★級銆�
+ - 澶辫触锛氭寜鏅�氳亰澶╂秷鎭睍绀恒��
+4. 鈥滃姙鈥濆満鏅敱鐢ㄦ埛纭鍔ㄤ綔鍗″悗锛屽墠绔皟鐢� `targetApi` 瀹屾垚涓氬姟鎻愪氦銆�
+5. 閫氳繃鍘嗗彶鎺ュ彛鍋氫細璇濆洖鏄句笌鍒犻櫎銆�
+
+## 12. 鍓嶇闆嗘垚绾︽潫锛堟湰娆¤ˉ鍏咃級
+
+### 12.1 鏅鸿兘浣撴柊澧炰笌寮圭獥鍚屾瑙勫垯锛堝己鍒讹級
+
+1. 褰� `src/views/aiIndustrialBrain/index.vue` 鏂板鏅鸿兘浣擄紙`agents`锛夐�昏緫鏃讹紝蹇呴』鍚屾纭寮圭獥鍔╂墜鍙敤鎬с��
+2. 寮圭獥鍔╂墜缁熶竴鐢� `src/components/AIChatSidebar/assistants/index.js` 鐨� `assistantRegistry` 娉ㄥ唽銆�
+3. 鏂板鏅鸿兘浣撶殑 `key` 鑻ヨ鍦ㄥ脊绐椾腑鍙敤锛屽繀椤诲湪 `assistantRegistry` 涓彁渚涘悓鍚嶉厤缃��
+4. 鏈湪 `assistantRegistry` 娉ㄥ唽鐨勬櫤鑳戒綋锛屽脊绐楁樉绀轰负 `pending`锛堝紑鍙戜腑锛夋�併��
+
+### 12.2 鐢熶骇鍔╂墜鎺ュ叆绾﹀畾
+
+1. 鐢熶骇鍔╂墜閰嶇疆浣嶄簬 `src/components/AIChatSidebar/assistants/productionAssistant.js`锛宍apiBase = /manufacturing-ai`銆�
+2. AI 宸ヤ笟澶ц剳涓敓浜ф櫤鑳戒綋杩涘叆寮圭獥鍚庯紝榛樿浣跨敤 `production` 鍔╂墜銆�
+3. 鍏ㄥ眬鍙充晶瀵硅瘽妗嗗姪鎵嬪垏鎹㈠垪琛ㄥ凡鍖呭惈锛�
+ - `general`锛堝緟鍔炲姪鐞嗭級
+ - `purchase`锛堥噰璐姪鐞嗭級
+ - `production`锛堢敓浜у姪鐞嗭級
+
+### 12.3 瀛楁涓枃鍖栧睍绀鸿鍒�
+
+1. 闈㈠悜涓氬姟鐢ㄦ埛鐨勫瓧娈靛悕銆佹爣绛俱�佸繀濉彁绀轰笉鐩存帴灞曠ず鑻辨枃 key銆�
+2. `requiredFields`銆乣missingFields` 鎻愮ず闇�杞崲涓轰腑鏂囪矾寰勬爣绛撅紙绀轰緥锛歚缂哄皯蹇呭~瀛楁锛氬伐鍗曞彿銆佽鍒掔粨鏉熸椂闂碻锛夈��
+3. 缁撴瀯鍖栧垪琛ㄥ垪鍚嶃�佹憳瑕佹寚鏍囥�佸姩浣滃崱瀛楁浼樺厛鏄剧ず涓枃锛涜嫳鏂� key 浠呯敤浜庢帴鍙i�氫俊涓庤皟璇曘��
+
+## 13. 鏈鏇存柊璁板綍锛�2026-05-16锛�
+
+1. 鏂板璁惧缁翠慨璁板綍杩斿洖绫诲瀷锛歚manufacturing_device_repair_list`銆�
+2. 淇璁惧鍩熸剰鍥惧垎娴侊細`缁翠慨/鎶ヤ慨/妫�淇�/缁存姢` 璧扮淮淇褰曪紝涓嶅啀璇蛋璁惧鍒楄〃銆�
+3. 淇缁翠慨璁板綍鏃堕棿杩囨护锛氫粎鍦ㄧ敤鎴锋槑纭椂闂存潯浠舵椂鐢熸晥銆�
+4. 淇寰呯淮淇粺璁″彛寰勶細鎸� `status = 0` 缁熻銆�
+5. 鏂板 AI 宸ヤ笟澶ц剳鏅鸿兘浣撲笌寮圭獥鍚屾缁存姢瑙勫垯锛氭柊澧炴櫤鑳戒綋蹇呴』鍚屾娉ㄥ唽寮圭獥鍔╂墜銆�
+6. 鐢熶骇鍔╂墜宸叉帴鍏ュ伐涓氬ぇ鑴戝脊绐椾笌鍏ㄥ眬鍙充晶瀵硅瘽妗嗗姪鎵嬪垏鎹€��
+7. 澧炲姞瀛楁涓枃鍖栧睍绀虹害鏉燂細閬垮厤鑻辨枃瀛楁瀵逛笟鍔$敤鎴风洿鍑恒��
diff --git "a/doc/20260518_\351\224\200\345\224\256\345\212\251\346\211\213\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260518_\351\224\200\345\224\256\345\212\251\346\211\213\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..d0c6e40
--- /dev/null
+++ "b/doc/20260518_\351\224\200\345\224\256\345\212\251\346\211\213\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,188 @@
+# 閿�鍞姪鎵嬪墠绔仈璋冩枃妗o紙`/sales-ai`锛�
+> 鏇存柊鏃堕棿锛�2026-05-18
+> 閫傜敤妯″潡锛氬鎴锋。妗堬紙绉佹捣/鍏捣锛夈�侀攢鍞姤浠枫�侀攢鍞彴璐︺�侀攢鍞��璐с�佸鎴峰線鏉ャ�佸彂璐у彴璐︺�佹寚鏍囩粺璁�
+> 閲嶇偣鑳藉姏锛氬鎴锋祦澶遍闄╁垎鏋愩�佸洖娆句笌鎶ヤ环绛栫暐寤鸿
+
+## 1. 鎺ュ彛鎬昏
+
+1. 娴佸紡瀵硅瘽锛歚POST /sales-ai/chat`
+2. 浼氳瘽鍒楄〃锛歚GET /sales-ai/history/sessions`
+3. 浼氳瘽娑堟伅锛歚GET /sales-ai/history/messages/{memoryId}`
+4. 鍒犻櫎浼氳瘽锛歚DELETE /sales-ai/history/{memoryId}`
+
+璇存槑锛�
+- `/chat` 杩斿洖 `text/stream;charset=utf-8`锛圫SE 鏂囨湰娴侊級銆�
+- 鍛戒腑宸ュ叿鏃讹紝鏈�缁堝唴瀹逛负 **JSON 瀛楃涓�**锛堥潪 `AjaxResult`锛夈��
+- 鏈懡涓伐鍏锋椂锛岃繑鍥炴櫘閫氫腑鏂囨枃鏈��
+
+## 2. 瀵硅瘽鎺ュ彛
+
+### 2.1 璇锋眰
+
+```http
+POST /sales-ai/chat
+Content-Type: application/json
+```
+
+```json
+{
+ "memoryId": "sales-ai-001",
+ "message": "甯垜鍋氬鎴锋祦澶遍闄╁垎鏋愶紝杩�90澶╋紝鍓�10鏉�"
+}
+```
+
+瀛楁璇存槑锛�
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+| --- | --- | --- | --- |
+| `memoryId` | string | 鏄� | 浼氳瘽 ID锛屽墠绔敓鎴愬苟澶嶇敤 |
+| `message` | string | 鏄� | 鐢ㄦ埛杈撳叆 |
+
+### 2.2 杩斿洖澶勭悊
+
+鍓嶇寤鸿娴佺▼锛�
+1. 鍏堟寜娴佹嫾鎺ュ畬鏁存枃鏈� `fullText`銆�
+2. 灏濊瘯 `JSON.parse(fullText)`锛�
+ - 鎴愬姛锛氭寜 `type` 璺敱鍒扮粨鏋勫寲缁勪欢銆�
+ - 澶辫触锛氭寜鏅�氳亰澶╂枃鏈睍绀恒��
+
+## 3. 缁撴瀯鍖栧搷搴斿崗璁�
+
+### 3.1 閫氱敤缁撴瀯
+
+```json
+{
+ "success": true,
+ "type": "sales_dashboard",
+ "description": "宸茶繑鍥為攢鍞寚鏍囩粺璁�",
+ "summary": {},
+ "data": {},
+ "charts": {}
+}
+```
+
+### 3.2 `type` 鏋氫妇
+
+| type | 鍦烘櫙 |
+| --- | --- |
+| `sales_customer_profile_list` | 瀹㈡埛妗f锛堢娴�/鍏捣锛� |
+| `sales_quotation_list` | 閿�鍞姤浠� |
+| `sales_ledger_list` | 閿�鍞彴璐� |
+| `sales_return_list` | 閿�鍞��璐� |
+| `sales_customer_interaction_list` | 瀹㈡埛寰�鏉ワ紙鍥炴锛� |
+| `sales_shipping_list` | 鍙戣揣鍙拌处 |
+| `sales_dashboard` | 鎸囨爣缁熻 |
+| `sales_customer_churn_risk` | 瀹㈡埛娴佸け椋庨櫓鍒嗘瀽 |
+| `sales_collection_quote_strategy` | 鍥炴涓庢姤浠风瓥鐣ュ缓璁� |
+
+## 4. 鑿滃崟鑳藉姏鏄犲皠锛堝搴旇惀閿�绠$悊锛�
+
+1. 瀹㈡埛妗f锛堢娴凤級锛氱ず渚嬫彁闂� `鏌ヨ绉佹捣瀹㈡埛妗f鍓�10鏉
+2. 瀹㈡埛妗f锛堝叕娴凤級锛氱ず渚嬫彁闂� `鏌ヨ鍏捣瀹㈡埛妗f`
+3. 閿�鍞姤浠凤細绀轰緥鎻愰棶 `鏌ヨ鏈湀閿�鍞姤浠穈
+4. 閿�鍞彴璐︼細绀轰緥鎻愰棶 `鏌ヨ鏈湀閿�鍞彴璐
+5. 閿�鍞��璐э細绀轰緥鎻愰棶 `鏌ヨ杩�30澶╅攢鍞��璐
+6. 瀹㈡埛寰�鏉ワ細绀轰緥鎻愰棶 `鏌ヨ杩�30澶╁鎴峰洖娆惧線鏉
+7. 鍙戣揣鍙拌处锛氱ず渚嬫彁闂� `鏌ヨ鏈湀鍙戣揣鍙拌处`
+8. 鎸囨爣缁熻锛氱ず渚嬫彁闂� `鏌ョ湅閿�鍞寚鏍囩粺璁
+
+## 5. 閲嶇偣鑳藉姏鑱旇皟
+
+### 5.1 瀹㈡埛娴佸け椋庨櫓鍒嗘瀽锛坄sales_customer_churn_risk`锛�
+
+鏁版嵁浣嶇疆锛�
+- 鍒楄〃锛歚data.items`
+- 姹囨�伙細`summary.highRiskCount / mediumRiskCount / lowRiskCount`
+- 鍥捐〃锛歚charts.riskLevelPieOption`銆乣charts.riskScoreBarOption`
+
+鍗曢」甯哥敤瀛楁锛�
+- `customerName`
+- `riskLevel`锛坄high`/`medium`/`low`锛�
+- `riskScore`锛�0-100锛�
+- `pendingAmount`
+- `pendingRate`
+- `daysSinceLastOrder`
+- `riskReasons`锛堝瓧绗︿覆鏁扮粍锛�
+
+### 5.2 鍥炴涓庢姤浠风瓥鐣ュ缓璁紙`sales_collection_quote_strategy`锛�
+
+鏁版嵁浣嶇疆锛�
+- 绛栫暐鍗★細`data.items`
+- 姹囨�伙細`summary.highPriorityCount / mediumPriorityCount / lowPriorityCount`
+- 鍥捐〃锛歚charts.pendingAmountBarOption`銆乣charts.priorityPieOption`
+
+鍗曢」甯哥敤瀛楁锛�
+- `customerName`
+- `priority`锛坄high`/`medium`/`low`锛�
+- `pendingAmount`
+- `quoteConversionRate`
+- `collectionStrategy`
+- `quotationStrategy`
+- `nextAction`
+
+## 6. 鎸囨爣缁熻鑱旇皟锛坄sales_dashboard`锛�
+
+鍏抽敭瀛楁锛�
+- `summary.contractAmountTotal`
+- `summary.receivedAmountTotal`
+- `summary.pendingAmountTotal`
+- `summary.shipRate`
+
+鍥捐〃瀛楁锛堝彲鐩存帴缁� ECharts锛夛細
+- `charts.amountBarOption`
+- `charts.shippingPieOption`
+- `charts.customerTopBarOption`
+- `charts.contractTrendLineOption`
+
+闄勫姞鏁版嵁锛�
+- `data.topCustomers`
+- `data.contractTrend`
+
+## 7. 浼氳瘽鍘嗗彶鎺ュ彛
+
+### 7.1 浼氳瘽鍒楄〃
+
+```http
+GET /sales-ai/history/sessions
+```
+
+杩斿洖 `AjaxResult.data` 瀛楁锛�
+- `memoryId`
+- `title`
+- `lastMessage`
+- `messageCount`
+- `lastChatTime`
+
+### 7.2 浼氳瘽娑堟伅
+
+```http
+GET /sales-ai/history/messages/{memoryId}
+```
+
+杩斿洖 `AjaxResult.data` 瀛楁锛�
+- `role`锛歚user` / `assistant` / `system` / `tool`
+- `content`
+- `filePaths`锛堝綋鍓嶉攢鍞姪鎵嬫湭浣跨敤鏂囦欢鍒嗘瀽锛屽彲蹇界暐锛�
+
+### 7.3 鍒犻櫎浼氳瘽
+
+```http
+DELETE /sales-ai/history/{memoryId}
+```
+
+杩斿洖鏍囧噯 `AjaxResult`銆�
+
+## 8. 鍓嶇鎺ュ叆绾︽潫
+
+1. 鏂板鍔╂墜閰嶇疆鏃讹紝`assistantRegistry` 蹇呴』娉ㄥ唽 `sales`锛堟垨浣犳柟绾﹀畾 key锛夛紝骞舵寚鍚� `apiBase = /sales-ai`銆�
+2. 缁撴瀯鍖栨覆鏌撳繀椤诲熀浜� `type` 鍒嗗彂锛屼笉瑕佷粎闈犲叧閿瘝銆�
+3. 鑱婂ぉ娓叉煋闇�淇濈暀鈥滄枃鏈厹搴曗�濓紝閬垮厤 JSON 瑙f瀽澶辫触鏃堕〉闈㈢┖鐧姐��
+4. 涓氬姟灞曠ず瀛楁寤鸿涓枃鍖栵紝涓嶇洿鎺ュ睍绀鸿嫳鏂囧瓧娈� key銆�
+
+## 9. 鑱旇皟楠屾敹娓呭崟
+
+1. 鑳芥甯告祦寮忔帴鏀� `/sales-ai/chat` 鍝嶅簲骞舵嫾鎺ユ枃鏈��
+2. 鑳芥寜 `type` 姝g‘娓叉煋 9 绫荤粨鏋勫寲缁撴灉銆�
+3. 鑳芥纭睍绀衡�滃鎴锋祦澶遍闄╁垎鏋愨�濆拰鈥滃洖娆句笌鎶ヤ环绛栫暐寤鸿鈥濅袱涓噸鐐瑰満鏅��
+4. 浼氳瘽鍒楄〃銆佷細璇濇秷鎭�佸垹闄や細璇濆叏閾捐矾鍙敤銆�
+5. `memoryId` 澶嶇敤鍚庡彲鍥炵湅鍘嗗彶锛屼笉浼氫覆浼氳瘽銆�
diff --git "a/doc/20260520_\351\246\226\351\241\265\347\224\237\344\272\247\347\234\213\346\235\277\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260520_\351\246\226\351\241\265\347\224\237\344\272\247\347\234\213\346\235\277\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..aaa6055
--- /dev/null
+++ "b/doc/20260520_\351\246\226\351\241\265\347\224\237\344\272\247\347\234\213\346\235\277\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,160 @@
+# 棣栭〉鐢熶骇鐪嬫澘鍓嶇鑱旇皟鏂囨。
+
+鏇存柊鏃堕棿锛�2026-05-20
+妯″潡锛歚/home`锛堥椤碉級
+
+## 1. 鎺ュ彛娓呭崟
+
+1. `GET /home/productionOverview`锛氱敓浜ф�昏
+2. `GET /home/productionRealtimeBoard`锛氱敓浜у疄鏃剁湅鏉�
+3. `GET /home/productionOrderProgress`锛氱敓浜ц鍗曡繘搴�
+4. `GET /home/todayProductionPlan`锛氫粖鏃ョ敓浜ц鍒�
+
+鎵�鏈夋帴鍙g粺涓�杩斿洖 `AjaxResult`锛�
+
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": {}
+}
+```
+
+## 2. 鐢熶骇鎬昏
+
+### 2.1 璇锋眰
+
+```http
+GET /home/productionOverview
+```
+
+### 2.2 杩斿洖 `data`
+
+```json
+{
+ "totalOutput": 1280.00,
+ "totalScrap": 25.00,
+ "yieldRate": 98.08
+}
+```
+
+瀛楁璇存槑锛�
+
+- `totalOutput`锛氱疮璁′骇鍑猴紙浠讹紝鍚堟牸鏁帮級
+- `totalScrap`锛氱疮璁℃姤搴燂紙浠讹級
+- `yieldRate`锛氳壇鐜囷紙0-100锛屽墠绔睍绀烘椂鍙嫾鎺� `%`锛�
+
+## 3. 鐢熶骇瀹炴椂鐪嬫澘
+
+### 3.1 璇锋眰
+
+```http
+GET /home/productionRealtimeBoard
+```
+
+### 3.2 杩斿洖 `data`
+
+```json
+{
+ "deviceOee": {
+ "value": 74.00,
+ "compareYesterday": 2.50
+ },
+ "orderAchievementRate": {
+ "value": 81.30,
+ "compareYesterday": -1.20
+ },
+ "defectRate": {
+ "value": 1.40,
+ "compareYesterday": 0.30
+ }
+}
+```
+
+瀛楁璇存槑锛�
+
+- `value`锛氬綋鏃ユ寚鏍囧�硷紙0-100锛�
+- `compareYesterday`锛氳緝鏄ㄦ棩鍙樺寲鍊硷紙鍙鍙礋锛涘墠绔寜姝h礋鍐冲畾绠ご鏂瑰悜鍜岄鑹诧級
+
+## 4. 鐢熶骇璁㈠崟杩涘害
+
+### 4.1 璇锋眰
+
+```http
+GET /home/productionOrderProgress?tab=all&pageNum=1&pageSize=10
+```
+
+鍙傛暟锛�
+
+- `tab`锛歚all` / `inProgress` / `completed` / `paused`
+- `pageNum`锛氶〉鐮侊紙榛樿 `1`锛�
+- `pageSize`锛氭瘡椤垫潯鏁帮紙榛樿 `10`锛屾渶澶� `50`锛�
+
+### 4.2 杩斿洖 `data`
+
+```json
+{
+ "tab": "all",
+ "total": 24,
+ "pageNum": 1,
+ "pageSize": 10,
+ "inProgressCount": 6,
+ "completedCount": 12,
+ "pausedCount": 2,
+ "records": [
+ {
+ "orderNo": "MO-20260518-001",
+ "productName": "鏅鸿兘鎺у埗鍣�",
+ "plannedQuantity": 1000.00,
+ "completedQuantity": 860.00,
+ "completionRate": 86.00,
+ "dueDate": "2026-05-20",
+ "status": 2,
+ "statusLabel": "杩涜涓�"
+ }
+ ]
+}
+```
+
+瀛楁璇存槑锛�
+
+- `completionRate`锛氬畬鎴愮巼锛�0-100锛�
+- `status`锛氬悗绔姸鎬佺爜锛坄1`寰呭紑濮嬶紝`2`杩涜涓紝`3`宸插畬鎴愶紝`4`宸叉殏鍋滐級
+- `statusLabel`锛氱姸鎬佷腑鏂囧睍绀哄��
+
+## 5. 浠婃棩鐢熶骇璁″垝
+
+### 5.1 璇锋眰
+
+```http
+GET /home/todayProductionPlan?limit=4
+```
+
+鍙傛暟锛�
+
+- `limit`锛氳繑鍥炴潯鏁帮紙榛樿 `4`锛屾渶澶� `20`锛�
+
+### 5.2 杩斿洖 `data`
+
+```json
+{
+ "total": 9,
+ "records": [
+ {
+ "orderNo": "MO-20260518-004",
+ "productName": "缁撴瀯浠禔",
+ "plannedQuantity": 1200.00,
+ "dueDate": "2026-05-15",
+ "status": 2,
+ "statusLabel": "杩涜涓�"
+ }
+ ]
+}
+```
+
+## 6. 鍓嶇灞曠ず绾﹀畾
+
+- 鐧惧垎姣斿瓧娈电粺涓�鏄暟鍊硷紙濡� `74.00`锛夛紝鍓嶇鑷鎷兼帴 `%`銆�
+- 鎵�鏈夋暟鍊间繚鐣欎袱浣嶅皬鏁般��
+- `dueDate` 鍙兘涓� `null`锛屽墠绔渶鍏滃簳灞曠ず锛堝 `--`锛夈��
+- `compareYesterday` 姝h礋閮藉彲鑳藉嚭鐜帮紝寤鸿鎸� `>0` 涓婂崌銆乣<0` 涓嬮檷銆乣=0` 鎸佸钩澶勭悊銆�
diff --git "a/doc/20260520_\351\246\226\351\241\265\347\224\237\344\272\247\347\234\213\346\235\277\346\200\247\350\203\275\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md" "b/doc/20260520_\351\246\226\351\241\265\347\224\237\344\272\247\347\234\213\346\235\277\346\200\247\350\203\275\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..730dbf1
--- /dev/null
+++ "b/doc/20260520_\351\246\226\351\241\265\347\224\237\344\272\247\347\234\213\346\235\277\346\200\247\350\203\275\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
@@ -0,0 +1,107 @@
+# 棣栭〉鐢熶骇鐪嬫澘鎬ц兘浼樺寲鍓嶇鍙樻洿鏂囨。
+
+鏇存柊鏃堕棿锛�2026-05-20
+閫傜敤椤甸潰锛氶椤�
+娑夊強鍖哄潡锛�
+
+1. 鐢熶骇璁㈠崟杩涘害
+2. 浠婃棩鐢熶骇璁″垝
+
+## 1. 鏈浼樺寲鐩爣
+
+閽堝澶ф暟鎹噺鍦烘櫙锛堣鍗曟暟閲忓銆佺敓浜у巻鍙查暱锛変紭鍖栨煡璇㈡�ц兘锛岄檷浣庨椤垫帴鍙e搷搴旀椂闂村拰鍐呭瓨鍗犵敤銆�
+
+## 2. 娑夊強鎺ュ彛
+
+1. `GET /home/productionOrderProgress`
+2. `GET /home/todayProductionPlan`
+
+## 3. 鍓嶇鏄惁闇�瑕佹敼浠g爜
+
+缁撹锛�**鏃犲己鍒舵敼鍔紝鎺ュ彛鍏ュ弬涓庤繑鍥炵粨鏋勪繚鎸佸吋瀹�**銆�
+浣犵幇鏈夐〉闈㈠彲浠ョ洿鎺ヨ仈璋冿紝涓嶉渶瑕佹敼瀛楁鏄犲皠銆�
+
+## 4. 鎺ュ彛璇存槑锛堜繚鎸佷笉鍙橈級
+
+### 4.1 鐢熶骇璁㈠崟杩涘害
+
+璇锋眰锛�
+
+```http
+GET /home/productionOrderProgress?tab=all&pageNum=1&pageSize=10
+```
+
+鍙傛暟锛�
+
+- `tab`锛歚all` / `inProgress` / `completed` / `paused`
+- `pageNum`锛氶〉鐮侊紝榛樿 `1`
+- `pageSize`锛氭瘡椤垫潯鏁帮紝榛樿 `10`锛屾渶澶� `50`
+
+杩斿洖 `data`锛堢粨鏋勪笉鍙橈級锛�
+
+```json
+{
+ "tab": "all",
+ "total": 1200,
+ "pageNum": 1,
+ "pageSize": 10,
+ "inProgressCount": 180,
+ "completedCount": 900,
+ "pausedCount": 20,
+ "records": [
+ {
+ "orderNo": "MO-20260518-001",
+ "productName": "鏅鸿兘鎺у埗鍣�",
+ "plannedQuantity": 1000.00,
+ "completedQuantity": 860.00,
+ "completionRate": 86.00,
+ "dueDate": "2026-05-20",
+ "status": 2,
+ "statusLabel": "杩涜涓�"
+ }
+ ]
+}
+```
+
+### 4.2 浠婃棩鐢熶骇璁″垝
+
+璇锋眰锛�
+
+```http
+GET /home/todayProductionPlan?limit=4
+```
+
+鍙傛暟锛�
+
+- `limit`锛氳繑鍥炴潯鏁帮紝榛樿 `4`锛屾渶澶� `20`
+
+杩斿洖 `data`锛堢粨鏋勪笉鍙橈級锛�
+
+```json
+{
+ "total": 230,
+ "records": [
+ {
+ "orderNo": "MO-20260518-004",
+ "productName": "缁撴瀯浠禔",
+ "plannedQuantity": 1200.00,
+ "dueDate": "2026-05-15",
+ "status": 2,
+ "statusLabel": "杩涜涓�"
+ }
+ ]
+}
+```
+
+## 5. 鍚庣浼樺寲鐐癸紙渚涘墠绔煡鎮夛級
+
+1. 璁㈠崟杩涘害涓庝粖鏃ヨ鍒掓敼涓鸿交閲� SQL锛屼粎鏌ヨ棣栭〉蹇呴渶瀛楁銆�
+2. 鍘绘帀浜嗛椤垫煡璇㈣矾寰勪腑涓嶅繀瑕佺殑澶у叧鑱斻�佸浘鐗囧~鍏呭拰瀵硅薄瑁呴厤銆�
+3. 鐘舵�佺粺璁℃敼涓烘暟鎹簱鑱氬悎璁℃暟锛屼笉鍐嶉�愭潯鎷夊彇璁$畻銆�
+4. 鍒嗛〉涓庢潯鏁颁笂闄愪繚鐣欙紙`pageSize <= 50`, `limit <= 20`锛夈��
+
+## 6. 鍓嶇寤鸿
+
+1. 鍒囨崲 `tab` 鏃朵繚鐣欑幇鏈夎皟鐢ㄦ柟寮忓嵆鍙��
+2. `dueDate` 鍙兘涓虹┖锛岀户缁寜 `--` 鍏滃簳灞曠ず銆�
+3. 鐧惧垎姣斿瓧娈典粛涓烘暟鍊硷紝鍓嶇缁х画杩藉姞 `%` 灞曠ず銆�
diff --git "a/doc/20260521_\351\207\207\350\264\255\346\231\272\350\203\275\344\275\223\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md" "b/doc/20260521_\351\207\207\350\264\255\346\231\272\350\203\275\344\275\223\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..58089e8
--- /dev/null
+++ "b/doc/20260521_\351\207\207\350\264\255\346\231\272\350\203\275\344\275\223\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
@@ -0,0 +1,85 @@
+# 閲囪喘鏅鸿兘浣撲紭鍖栧墠绔彉鏇存枃妗�
+
+## 1. 鍙樻洿鑳屾櫙
+
+鏈閽堝閲囪喘鏅鸿兘浣撳仛浜嗗榻愪紭鍖栵紙鍙傝�冮攢鍞�/瀹℃壒/鍒堕�犳櫤鑳戒綋锛夛細
+
+1. 鎻愬崌 `quickPrompts` 鍛戒腑绋冲畾鎬с��
+2. 澧炲己鐩稿鏃堕棿璇嗗埆锛堜粖澶�/鏄ㄥぉ/鏈懆/涓婂懆/鏈湀/涓婃湀/浠婂勾/鍘诲勾/杩慛澶╃瓑锛夈��
+3. 澧炲姞涓氬姟鎰忓浘鏈瘑鍒椂鐨勭粨鏋勫寲鍏滃簳鍝嶅簲锛岄伩鍏嶇紪閫犳暟鎹��
+4. 琛ュ厖寰呬粯娆炬煡璇㈢殑姹囨�诲瓧娈碉紝渚夸簬鍓嶇鐩存帴娓叉煋缁熻鍗$墖銆�
+
+## 2. 鎺ュ彛褰卞搷姒傝
+
+| 鎺ュ彛 | 鏂规硶 | 鏄惁鏀硅矾寰� | 鏄惁鏀瑰叆鍙� | 鏄惁鏀硅繑鍥炵粨鏋� |
+| --- | --- | --- | --- | --- |
+| `/purchase-ai/chat` | POST(SSE) | 鍚� | 鍚� | 鏄紙鏂板鍏滃簳 JSON 绫诲瀷锛� |
+| `/purchase-ai/analyze-files` | POST(SSE) | 鍚� | 鍚� | 鍚︼紙浠呭唴閮ㄦ彁绀鸿瘝澧炲己锛� |
+
+## 3. 鏂板鍏滃簳鍝嶅簲锛堥噸鐐癸級
+
+褰撶敤鎴锋槑鏄惧湪闂噰璐笟鍔★紝浣嗘潯浠朵笉鍏呭垎涓旀湭鍛戒腑鍙墽琛屾剰鍥炬椂锛宍/purchase-ai/chat` 浼氱洿鎺ヨ繑鍥炵粨鏋勫寲 JSON锛堣�屼笉鏄嚜鐢辨枃鏈級锛�
+
+```json
+{
+ "success": false,
+ "type": "purchase_intent_not_recognized",
+ "description": "鏈瘑鍒埌鍙墽琛岀殑閲囪喘鏌ヨ鏉′欢銆備负淇濊瘉缁撴灉鍑嗙‘锛屽綋鍓嶄笉浼氭帹娴嬫垨缂栭�犳暟鎹紝璇疯ˉ鍏呮槑纭椂闂磋寖鍥淬�佷緵搴斿晢銆侀噰璐悎鍚屽彿鎴栫墿鏂欏悗鍐嶆煡璇€��",
+ "summary": {},
+ "data": {
+ "quickPrompts": [
+ "鏈湀閲囪喘閲戦鎺掑悕鍓嶅崄鐨勭墿鏂欐湁鍝簺锛�",
+ "鍝簺閲囪喘璁㈠崟杩樻湭鍏ュ簱锛�",
+ "鏈�杩�7澶╀緵搴斿晢鍒拌揣寮傚父鏈夊摢浜涳紵",
+ "甯垜缁熻寰呬粯娆鹃噰璐崟锛�",
+ "鍒楀嚭鏈湀閲囪喘閫�璐ф儏鍐�"
+ ]
+ },
+ "charts": {}
+}
+```
+
+鍓嶇澶勭悊寤鸿锛�
+
+1. 褰� `type === "purchase_intent_not_recognized"` 鏃讹紝灞曠ず `description`銆�
+2. 璇诲彇 `data.quickPrompts` 浣滀负蹇嵎鎻愰棶鎸夐挳锛堝彲鐩存帴鍥炲~杈撳叆妗嗭級銆�
+
+## 4. 寰呬粯娆捐繑鍥炴柊澧炴眹鎬诲瓧娈�
+
+鎺ュ彛绫诲瀷锛歚type = "purchase_pending_payment_list"`
+浣嶇疆锛歚summary`
+
+鏂板瀛楁锛�
+
+| 瀛楁 | 绫诲瀷 | 璇存槑 |
+| --- | --- | --- |
+| pendingOrderCount | number | 寰呬粯娆捐鍗曟暟 |
+| totalContractAmount | number | 寰呬粯娆捐鍗曞悎鍚屾�婚 |
+| totalPaidAmount | number | 宸蹭粯娆炬�婚 |
+| totalPendingAmount | number | 寰呬粯娆炬�婚 |
+
+璇存槑锛氬師鏈夊瓧娈典粛淇濈暀锛堝吋瀹癸級锛屾湰娆′负澧為噺瀛楁锛屼笉鐮村潖鐜版湁娓叉煋銆�
+
+## 5. 鏃堕棿鍙e緞浼樺寲
+
+閲囪喘鏅鸿兘浣撶幇鍦ㄧ粺涓�鎸変腑鍥芥椂鍖哄姩鎬佹棩鏈熸崲绠楃浉瀵规椂闂达紝鏀寔锛�
+
+- 浠婂ぉ銆佹槰澶�
+- 鏈懆銆佷笂鍛�
+- 鏈湀銆佷笂鏈�
+- 浠婂勾銆佸幓骞�
+- 杩慛澶�/鍛�/鏈�/骞淬�佽繎鍗婂勾銆佽繎鍗婁釜鏈�
+
+鍓嶇鏃犻渶鏀逛紶鍙傦紝浣嗗睍绀烘椂闂磋寖鍥存椂璇蜂互鍚庣杩斿洖 `summary.startDate/endDate/timeRange` 涓哄噯銆�
+
+## 6. 鍓嶇鑱旇皟妫�鏌ユ竻鍗�
+
+1. `chat` 娴佸紡缁撴灉鎷兼帴鍚庯紝浼樺厛鎸� JSON 瑙f瀽銆�
+2. 瑕嗙洊鏂扮被鍨� `purchase_intent_not_recognized` 鐨� UI 澶勭悊銆�
+3. 寰呬粯娆鹃〉闈㈣鍙栧苟灞曠ず `summary.totalPendingAmount` 绛夋柊澧炲瓧娈点��
+4. 楠岃瘉浠ヤ笅蹇嵎闂鍙ǔ瀹氳繑鍥炵粨鏋勫寲缁撴灉锛�
+ - 鏈湀閲囪喘閲戦鎺掑悕鍓嶅崄鐨勭墿鏂欐湁鍝簺锛�
+ - 鍝簺閲囪喘璁㈠崟杩樻湭鍏ュ簱锛�
+ - 鏈�杩�7澶╀緵搴斿晢鍒拌揣寮傚父鏈夊摢浜涳紵
+ - 甯垜缁熻寰呬粯娆鹃噰璐崟锛�
+ - 鍒楀嚭鏈湀閲囪喘閫�璐ф儏鍐�
diff --git "a/doc/20260521_\351\246\226\351\241\265HomeController\346\216\245\345\217\243\345\215\207\347\272\247\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md" "b/doc/20260521_\351\246\226\351\241\265HomeController\346\216\245\345\217\243\345\215\207\347\272\247\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..008660f
--- /dev/null
+++ "b/doc/20260521_\351\246\226\351\241\265HomeController\346\216\245\345\217\243\345\215\207\347\272\247\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
@@ -0,0 +1,113 @@
+# 棣栭〉 HomeController 鎺ュ彛鍗囩骇鍓嶇鍙樻洿鏂囨。
+
+鏇存柊鏃堕棿锛�2026-05-21
+閫傜敤妯″潡锛氶椤碉紙`/home`锛�
+
+## 1. 鍙樻洿姒傝
+
+鏈涓� **鍏煎寮忓崌绾�**锛屾棫璋冪敤鏂瑰紡浠嶅彲鐢ㄣ��
+閲嶇偣鏄粰鐢熶骇鐪嬫澘鎺ュ彛澧炲姞鏇存槑纭殑绛涢�夊弬鏁帮紝渚夸簬鍓嶇鎸夋棩鏈熷拰鐘舵�佹煡璇€��
+
+娑夊強鎺ュ彛锛�
+
+1. `GET /home/productionOrderProgress`
+2. `GET /home/todayProductionPlan`
+
+## 2. 鍙傛暟鍙樻洿
+
+### 2.1 鐢熶骇璁㈠崟杩涘害 `GET /home/productionOrderProgress`
+
+鏃у弬鏁帮紙浠嶅吋瀹癸級锛�
+
+- `tab`锛歚all` / `inProgress` / `completed` / `paused`
+- `pageNum`锛氶粯璁� `1`
+- `pageSize`锛氶粯璁� `10`锛屾渶澶� `50`
+
+鏂板鍙傛暟锛�
+
+- `status`锛堝彲閫夛級锛氱姸鎬佺瓫閫夛紝浼樺厛绾ч珮浜� `tab`
+ 鍙�夊�硷細`all` / `waiting` / `inProgress` / `completed` / `paused` / `1` / `2` / `3` / `4`
+- `bizDate`锛堝彲閫夛級锛氫笟鍔℃棩鏈熺瓫閫夛紝鏍煎紡 `yyyy-MM-dd`锛堟寜璁㈠崟鍒涘缓鏃堕棿杩囨护锛�
+
+鍙傛暟浼樺厛绾э細
+
+1. 濡傛灉浼犱簡 `status`锛屽悗绔紭鍏堟寜 `status` 瑙f瀽锛�
+2. 鏈紶 `status` 鏃讹紝娌跨敤鍘熸湁 `tab` 琛屼负锛�
+3. `status` 鎴� `bizDate` 鏍煎紡閿欒鏃惰繑鍥炲け璐ヤ俊鎭��
+
+璇锋眰绀轰緥锛�
+
+```http
+GET /home/productionOrderProgress?status=completed&bizDate=2026-05-20&pageNum=1&pageSize=10
+```
+
+### 2.2 浠婃棩鐢熶骇璁″垝 `GET /home/todayProductionPlan`
+
+鏃у弬鏁帮紙浠嶅吋瀹癸級锛�
+
+- `limit`锛氶粯璁� `4`锛屾渶澶� `20`
+
+鏂板鍙傛暟锛�
+
+- `planDate`锛堝彲閫夛級锛氳鍒掓棩鏈熺瓫閫夛紝鏍煎紡 `yyyy-MM-dd`锛堟寜 `plan_complete_time` 杩囨护锛�
+
+璇锋眰绀轰緥锛�
+
+```http
+GET /home/todayProductionPlan?limit=6&planDate=2026-05-21
+```
+
+## 3. 杩斿洖缁撴瀯鍙樻洿
+
+### 3.1 `productionOrderProgress` 杩斿洖鏂板瀛楁
+
+鏂板锛�
+
+- `status`锛氭爣鍑嗗寲鐘舵�佸洖鏄撅紙`all` / `waiting` / `inProgress` / `completed` / `paused`锛�
+- `bizDate`锛氭棩鏈熺瓫閫夊洖鏄撅紙鏈紶鏃朵负 `null`锛�
+- `waitingCount`锛氬緟寮�濮嬭鍗曟暟閲�
+
+鍏煎淇濈暀锛�
+
+- `tab` 瀛楁缁х画杩斿洖锛堣�侀〉闈㈡棤闇�鏀瑰姩鍙户缁娇鐢級
+
+杩斿洖绀轰緥锛�
+
+```json
+{
+ "tab": "completed",
+ "status": "completed",
+ "bizDate": "2026-05-20",
+ "total": 24,
+ "pageNum": 1,
+ "pageSize": 10,
+ "waitingCount": 3,
+ "inProgressCount": 6,
+ "completedCount": 12,
+ "pausedCount": 2,
+ "records": []
+}
+```
+
+### 3.2 `todayProductionPlan` 杩斿洖鏂板瀛楁
+
+鏂板锛�
+
+- `planDate`锛氭棩鏈熺瓫閫夊洖鏄撅紙鏈紶鏃朵负 `null`锛�
+
+杩斿洖绀轰緥锛�
+
+```json
+{
+ "planDate": "2026-05-21",
+ "total": 9,
+ "records": []
+}
+```
+
+## 4. 鍓嶇鏀归�犲缓璁�
+
+1. 鏂伴〉闈㈠缓璁紭鍏堜紶 `status`锛岄�愭鏇夸唬 `tab`銆�
+2. 闇�瑕佹寜鏃ユ湡澶嶇洏鐪嬫澘鏃讹紝浣跨敤 `bizDate` / `planDate`銆�
+3. 鑰侀〉闈㈠彲涓嶆敼锛岀户缁部鐢ㄥ師鍙傛暟涔熻兘姝e父鑱旇皟銆�
+
diff --git "a/doc/20260522_StockInRecord\345\210\227\350\241\250\346\272\220\345\215\225\345\217\267\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260522_StockInRecord\345\210\227\350\241\250\346\272\220\345\215\225\345\217\267\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..56d1570
--- /dev/null
+++ "b/doc/20260522_StockInRecord\345\210\227\350\241\250\346\272\220\345\215\225\345\217\267\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,75 @@
+# StockInRecord 鍒楄〃婧愬崟鍙峰墠绔仈璋冩枃妗�
+
+鏇存柊鏃堕棿锛�2026-05-22
+閫傜敤鎺ュ彛锛歚GET /stockInRecord/listPage`
+
+## 1. 鍙樻洿璇存槑
+
+鏈瀵瑰叆搴撶鐞嗗垪琛ㄦ帴鍙e鍔犺繑鍥炲瓧娈� `sourceOrderNo`锛堟簮鍗曞彿锛夛紝鐢ㄤ簬鍘熸潗鏂欏満鏅睍绀洪噰璐潵婧愬崟鍙枫��
+
+鐢熸晥鏉′欢锛�
+
+- 褰撹姹傚弬鏁� `topParentProductId = 278` 鏃讹紝鍚庣杩斿洖 `sourceOrderNo`銆�
+- 鍏朵粬 `topParentProductId` 鍦烘櫙涓嬶紝璇ュ瓧娈佃繑鍥� `null`锛堟垨涓嶅睍绀猴級銆�
+
+## 2. 瀛楁瀹氫箟
+
+鏂板瀛楁锛�
+
+- `sourceOrderNo`锛歚string`锛屾簮鍗曞彿锛堥噰璐悎鍚屽彿锛夈��
+
+## 3. 鍙栧�艰鍒�
+
+浠呭湪 `topParentProductId = 278` 鏃舵寜鈥滄潵婧愨�濊绠楋細
+
+1. 鏉ユ簮 = `閲囪喘-鍏ュ簱`锛坄recordType = 7`锛�
+ - 鍏堟寜 `recordId` 鏌ラ噰璐骇鍝佽〃 `sales_ledger_product`锛坄type=2`锛夛紱
+ - 鍐嶉�氳繃 `sales_ledger_product.sales_ledger_id` 鏌ラ噰璐彴璐﹁〃 `purchase_ledger`锛�
+ - 杩斿洖 `purchase_ledger.purchase_contract_number` 浣滀负 `sourceOrderNo`銆�
+ - 鍏煎鍏滃簳锛氳嫢鏈懡涓噰璐骇鍝侀摼璺紝鍒欐寜 `recordId` 鐩存帴鏌� `purchase_ledger.id` 鍙栧崟鍙枫��
+
+2. 鏉ユ簮 = `閲囪喘-璐ㄦ-鍚堟牸鍏ュ簱`锛坄recordType = 10`锛�
+ - 鍏堟寜 `recordId` 鏌ヨ川妫�琛� `quality_inspect`锛�
+ - 鍐嶉�氳繃 `quality_inspect.purchase_ledger_id` 鏌ラ噰璐彴璐﹁〃 `purchase_ledger`锛�
+ - 杩斿洖 `purchase_ledger.purchase_contract_number` 浣滀负 `sourceOrderNo`銆�
+
+## 4. 杩斿洖绀轰緥
+
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": {
+ "records": [
+ {
+ "id": 1024,
+ "recordType": "7",
+ "productName": "閾滄帓",
+ "model": "T2-30x3",
+ "sourceOrderNo": "CG-2026-00128"
+ },
+ {
+ "id": 1025,
+ "recordType": "10",
+ "productName": "閾滄帓",
+ "model": "T2-30x3",
+ "sourceOrderNo": "CG-2026-00131"
+ }
+ ],
+ "total": 2
+ }
+}
+```
+
+## 5. 鍓嶇鑱旇皟寤鸿
+
+1. 鍒楄〃鍒楁柊澧炩�滄簮鍗曞彿鈥濓紝璇诲彇瀛楁 `sourceOrderNo`銆�
+2. 寤鸿浠呭湪 `topParentProductId = 278` 鐨勯〉闈�/绛涢�夋潯浠朵笅灞曠ず璇ュ垪銆�
+3. 褰� `sourceOrderNo` 涓虹┖鏃跺睍绀� `--`锛岄伩鍏嶇┖鐧姐��
+
+## 6. 鍥炲綊娓呭崟
+
+1. `topParentProductId=278` + `recordType=7`锛氬簲杩斿洖閲囪喘鍚堝悓鍙枫��
+2. `topParentProductId=278` + `recordType=10`锛氬簲杩斿洖閲囪喘鍚堝悓鍙凤紙缁忚川妫�閾捐矾锛夈��
+3. `topParentProductId!=278`锛歚sourceOrderNo` 搴斾负 `null` 鎴栧墠绔笉灞曠ず銆�
+4. 鍘熸湁瀛楁锛坄productName/model/unit/createBy` 绛夛級涓嶅彈褰卞搷銆�
diff --git "a/doc/20260522_StockInRecord\345\210\227\350\241\250\346\272\220\345\215\225\345\217\267\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243_276\350\241\245\345\205\205.md" "b/doc/20260522_StockInRecord\345\210\227\350\241\250\346\272\220\345\215\225\345\217\267\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243_276\350\241\245\345\205\205.md"
new file mode 100644
index 0000000..93d9b25
--- /dev/null
+++ "b/doc/20260522_StockInRecord\345\210\227\350\241\250\346\272\220\345\215\225\345\217\267\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243_276\350\241\245\345\205\205.md"
@@ -0,0 +1,65 @@
+# StockInRecord 鍒楄〃婧愬崟鍙峰墠绔仈璋冩枃妗o紙`topParentProductId=276`琛ュ厖锛�
+
+鏇存柊鏃堕棿锛�2026-05-22
+閫傜敤鎺ュ彛锛歚GET /stockInRecord/listPage`
+
+## 1. 鍙樻洿璇存槑
+
+鍦ㄥ凡鏈� `sourceOrderNo` 鍩虹涓婏紝鏂板 `topParentProductId = 276` 鐨勬簮鍗曞彿婧簮閫昏緫锛�
+
+- 鏍规嵁鈥滄潵婧愶紙recordType锛�+ recordId鈥濇函婧愶紱
+- 浼樺厛杩斿洖閿�鍞崟鍙凤紙閿�鍞悎鍚屽彿锛夛紱
+- 鑻ラ攢鍞崟鍙蜂负绌猴紝鍒欏洖閫�杩斿洖鐢熶骇璁㈠崟鍙凤紱
+- 涓嶈�冭檻鑷畾涔夊叆搴擄紙`recordType=0/9`锛夈��
+
+## 2. 杩斿洖瀛楁
+
+瀛楁鏃犳柊澧烇紝缁х画浣跨敤锛�
+
+- `sourceOrderNo`锛歚string`锛屾簮鍗曞彿銆�
+
+## 3. 276 鍦烘櫙鍙栧�艰鍒�
+
+璇锋眰鍙傛暟婊¤冻 `topParentProductId = 276` 鏃讹細
+
+1. `recordType = 14/15`锛堥攢鍞��璐�-鍚堟牸/涓嶅悎鏍煎叆搴擄級
+ - `stock_in_record.record_id -> return_sale_product.id -> return_management.shipping_id -> shipping_info.sales_ledger_id -> sales_ledger.sales_contract_no`
+ - 杩斿洖閿�鍞悎鍚屽彿銆�
+
+2. `recordType = 2/5`锛堢敓浜ф姤宸�-鍏ュ簱/鎶ュ簾锛�
+ - `stock_in_record.record_id -> production_product_main.id -> production_operation_task.production_order_id -> production_order`
+ - 鍏堝彇璇ョ敓浜ц鍗曞叧鑱旈攢鍞悎鍚屽彿锛堢敱鐢熶骇璁″垝鍏宠仈閿�鍞彴璐﹁仛鍚堬級锛�
+ - 閿�鍞悎鍚屽彿涓虹┖鏃讹紝杩斿洖 `production_order.nps_no`銆�
+
+3. `recordType = 6`锛堣川妫�-鍚堟牸鍏ュ簱锛�
+ - `stock_in_record.record_id -> quality_inspect.id -> quality_inspect.product_main_id -> production_product_main -> production_operation_task -> production_order`
+ - 鍏堝彇閿�鍞悎鍚屽彿锛岀┖鍒欏洖閫� `production_order.nps_no`銆�
+
+4. `recordType = 4/11`锛堜笉鍚堟牸澶勭悊-鎶ュ簾/璁╂鏀捐锛�
+ - `stock_in_record.record_id -> quality_unqualified.id -> quality_unqualified.inspect_id -> quality_inspect -> production_product_main -> production_operation_task -> production_order`
+ - 鍏堝彇閿�鍞悎鍚屽彿锛岀┖鍒欏洖閫� `production_order.nps_no`銆�
+
+5. `recordType = 20/22`锛堥鏂欓��鏂�/鐢熶骇閫�鏂�-鍚堟牸鍏ュ簱锛�
+ - `stock_in_record.record_id -> production_order_pick.id -> production_order`
+ - 鍏堝彇閿�鍞悎鍚屽彿锛岀┖鍒欏洖閫� `production_order.nps_no`銆�
+
+6. `recordType = 0/9`锛堣嚜瀹氫箟鍏ュ簱锛�
+ - 涓嶅弬涓庢函婧愶紝`sourceOrderNo = null`銆�
+
+## 4. 鍏朵粬鍦烘櫙璇存槑
+
+- `topParentProductId = 278` 鐨勯噰璐摼璺簮鍗曞彿閫昏緫淇濇寔涓嶅彉銆�
+- 鍏朵粬 `topParentProductId` 涓嶈Е鍙戞湰娆� 276 瑙勫垯锛宍sourceOrderNo` 涓虹┖銆�
+
+## 5. 鍓嶇鑱旇皟寤鸿
+
+1. 鍦� `topParentProductId=276` 鐨勫垪琛ㄥ満鏅睍绀衡�滄簮鍗曞彿鈥濆垪锛岃鍙� `sourceOrderNo`銆�
+2. 寤鸿绌哄�肩粺涓�灞曠ず `--`銆�
+3. 涓嶉渶瑕佹柊澧炶姹傚弬鏁帮紝娌跨敤鐜版湁 `/stockInRecord/listPage`銆�
+
+## 6. 鍥炲綊娓呭崟
+
+1. `topParentProductId=276` + `recordType=14/15`锛氬簲杩斿洖閿�鍞悎鍚屽彿銆�
+2. `topParentProductId=276` + `recordType=2/5/6/4/11/20/22`锛氫紭鍏堥攢鍞悎鍚屽彿锛岀己澶辨椂杩斿洖鐢熶骇璁㈠崟鍙枫��
+3. `topParentProductId=276` + `recordType=0/9`锛歚sourceOrderNo` 涓虹┖銆�
+4. `topParentProductId=278`锛氫粛鎸夐噰璐摼璺繑鍥為噰璐悎鍚屽彿銆�
diff --git "a/doc/20260522_\350\264\242\345\212\241\345\212\251\346\211\213\346\217\220\351\227\256\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md" "b/doc/20260522_\350\264\242\345\212\241\345\212\251\346\211\213\346\217\220\351\227\256\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..ad4656e
--- /dev/null
+++ "b/doc/20260522_\350\264\242\345\212\241\345\212\251\346\211\213\346\217\220\351\227\256\344\274\230\345\214\226\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
@@ -0,0 +1,59 @@
+# 璐㈠姟鍔╂墜鎻愰棶浼樺寲鍓嶇鍙樻洿鏂囨。
+
+鏇存柊鏃堕棿锛�2026-05-22
+閫傜敤妯″潡锛氳储鍔℃櫤鑳藉姪鎵嬶紙`/financial-ai`锛�
+
+## 1. 鑳屾櫙
+
+褰撳墠棣栭〉璐㈠姟鍔╂墜蹇嵎鎻愰棶涓猴細
+
+1. `鐢熸垚鏈懆缁忚惀鍛ㄦ姤`
+2. `涓轰粈涔堝埄娑︿笅闄峘
+3. `鍝釜瀹㈡埛鏈�璧氶挶`
+
+闂鐐癸細
+
+- 绗� 3 鏉¢棶娉曞湪閮ㄥ垎鍦烘櫙涓嬫剰鍥惧懡涓笉绋冲畾锛屽鏄撹蛋鏅�氭枃鏈洖绛旓紝瀵艰嚧鍥捐〃閾炬帴浠ュ師濮� Markdown 鏂囨湰灞曠ず锛堝 ``锛夈��
+- 蹇嵎鎻愰棶缂哄皯鏃堕棿鑼冨洿鍜屽垎鏋愮洰鏍囷紝缁撴灉绋冲畾鎬т笌鍙В閲婃�ц緝寮便��
+
+## 2. 鍓嶇蹇嵎鎻愰棶鏂囨浼樺寲锛堝繀鏀癸級
+
+寤鸿灏嗛粯璁や笁鏉″揩鎹锋彁闂皟鏁翠负锛�
+
+1. `鐢熸垚鏈懆缁忚惀鍛ㄦ姤锛堝埄娑︿笌鐜伴噾娴侊級`
+2. `鍒嗘瀽鏈湀鍒╂鼎涓嬮檷鍘熷洜`
+3. `杩�30澶╁摢涓鎴峰埄娑﹁础鐚渶楂榒
+
+璇存槑锛�
+
+- 涓夋潯闂硶鍧囧甫鏃堕棿鑼冨洿鎴栧垎鏋愮洰鏍囷紝鍚庣鍛戒腑鏇寸ǔ瀹氥��
+- 绗� 3 鏉′笌鈥滄渶璧氶挶瀹㈡埛鈥濊涔変竴鑷达紝浣嗏�滃埄娑﹁础鐚渶楂樷�濇洿鏄庣‘锛岄�傚悎鐩存帴椹卞姩鍒╂鼎鍒嗘瀽缁撴灉椤点��
+
+## 3. 涓庡悗绔兘鍔涙槧灏�
+
+| 蹇嵎鎻愰棶 | 棰勬湡鍛戒腑鑳藉姏 | 棰勬湡 `type` |
+| --- | --- | --- |
+| 鐢熸垚鏈懆缁忚惀鍛ㄦ姤锛堝埄娑︿笌鐜伴噾娴侊級 | 缁忚惀鎶ュ憡鐢熸垚 | `financial_operation_report` |
+| 鍒嗘瀽鏈湀鍒╂鼎涓嬮檷鍘熷洜 | 璁㈠崟鍒╂鼎鍒嗘瀽 | `financial_order_profit_analysis` |
+| 杩�30澶╁摢涓鎴峰埄娑﹁础鐚渶楂� | 璁㈠崟鍒╂鼎鍒嗘瀽 | `financial_order_profit_analysis` |
+
+鍚庣宸插悓姝ュ寮衡�滄渶璧氶挶瀹㈡埛/瀹㈡埛鍒╂鼎鏈�楂�/鍒╂鼎璐$尞鏈�楂樷�濈瓑鍚屼箟闂硶璇嗗埆锛屽墠绔寜浠ヤ笂鏂囨鏀归�犲悗鍙洿鎺ヨ仈璋冦��
+
+## 4. 鑱婂ぉ鍐呭娓叉煋鍏滃簳锛堝缓璁敼锛�
+
+閽堝鑱婂ぉ杩斿洖鏂囨湰涓嚭鐜扮殑鍥捐〃 Markdown 閾炬帴锛坄https://local/generate_chart?options=...`锛夛紝寤鸿鍓嶇澧炲姞鍏滃簳澶勭悊锛�
+
+1. 璇嗗埆 Markdown 鍥剧墖璇硶涓殑 `local/generate_chart` 閾炬帴銆�
+2. 瑙f瀽 `options` 鍙傛暟骞惰浆鎹负 ECharts `option` 鍚庢覆鏌撳浘琛ㄧ粍浠躲��
+3. 瑙f瀽澶辫触鏃朵笉灞曠ず鍘熷闀块摼鎺ユ枃鏈紝灞曠ず缁熶竴绌烘�佹彁绀恒��
+
+## 5. 鑱旇皟鍥炲綊娓呭崟
+
+1. 鐐瑰嚮蹇嵎鎻愰棶 `鐢熸垚鏈懆缁忚惀鍛ㄦ姤锛堝埄娑︿笌鐜伴噾娴侊級`
+ - 鏍¢獙杩斿洖 `type=financial_operation_report`锛屽苟姝e父娓叉煋鎽樿/寤鸿/鍥捐〃銆�
+2. 鐐瑰嚮蹇嵎鎻愰棶 `鍒嗘瀽鏈湀鍒╂鼎涓嬮檷鍘熷洜`
+ - 鏍¢獙杩斿洖 `type=financial_order_profit_analysis`锛屽苟灞曠ず浜忔崯璁㈠崟涓庡鎴峰埄娑︽帓琛屻��
+3. 鐐瑰嚮蹇嵎鎻愰棶 `杩�30澶╁摢涓鎴峰埄娑﹁础鐚渶楂榒
+ - 鏍¢獙杩斿洖 `type=financial_order_profit_analysis`锛宍summary.topCustomerByProfit` 鏈夊�笺��
+4. 鎵嬪伐杈撳叆 `鍝釜瀹㈡埛鏈�璧氶挶`銆乣鍝釜瀹㈡埛鍒╂鼎鏈�楂榒
+ - 鏍¢獙浠嶅懡涓� `financial_order_profit_analysis`锛屼笉鍐嶅嚭鐜板師濮嬪浘琛� Markdown 閾炬帴鐩村嚭銆�
diff --git "a/doc/20260522_\350\264\242\345\212\241\345\215\207\347\272\247AI\346\250\241\345\235\227\345\211\215\347\253\257\345\217\230\346\233\264\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260522_\350\264\242\345\212\241\345\215\207\347\272\247AI\346\250\241\345\235\227\345\211\215\347\253\257\345\217\230\346\233\264\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..e011374
--- /dev/null
+++ "b/doc/20260522_\350\264\242\345\212\241\345\215\207\347\272\247AI\346\250\241\345\235\227\345\211\215\347\253\257\345\217\230\346\233\264\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,150 @@
+# 璐㈠姟妯″潡鍗囩骇鍚� AI 妯″潡鍓嶇鍙樻洿鑱旇皟鏂囨。锛堥噰璐�/閿�鍞�/鐢熶骇/寰呭姙锛�
+
+鏇存柊鏃ユ湡锛�2026-05-22
+閫傜敤鑼冨洿锛歚/sales-ai`銆乣/purchase-ai`銆乣/manufacturing-ai`銆乣/xiaozhi`锛堝鎵瑰緟鍔烇級
+
+## 1. 鍙樻洿鎬昏
+
+| 妯″潡 | 瀵瑰鎺ュ彛 | 鏄惁闇�瑕佸墠绔敼閫� | 缁撹 |
+| --- | --- | --- | --- |
+| 閿�鍞� AI | `POST /sales-ai/chat` | 鏄� | 璐㈠姟鍙e緞鍒囨崲鍒版柊鏀舵妯″瀷锛岄儴鍒� `type` 鐨勫瓧娈佃涔夊彉鍖� |
+| 閲囪喘 AI | `POST /purchase-ai/chat` | 鏄� | 浠樻/鍙戠エ/寰呬粯娆捐绠楀垏鎹㈠埌鏂拌储鍔¢摼璺紝缁熻鍊间粠鍗犱綅鏀逛负鐪熷疄鍊� |
+| 鐢熶骇 AI | `POST /manufacturing-ai/chat` | 鍚� | 宸叉牳鏌ワ紝鏃犳棫璐㈠姟閫昏緫渚濊禆锛屾棤瀛楁鍙樻洿 |
+| 寰呭姙 AI | `POST /xiaozhi/chat` | 鍚� | 宸叉牳鏌ワ紝鏃犳棫璐㈠姟閫昏緫渚濊禆锛屾棤瀛楁鍙樻洿 |
+
+## 2. 閿�鍞� AI 鍙樻洿锛坄/sales-ai/chat`锛�
+
+### 2.1 `type = sales_return_list`锛堥攢鍞��娆�/鍥炴璁板綍锛�
+
+褰撳墠杩斿洖鏁版嵁鏉ユ簮缁熶竴涓烘柊璐㈠姟琛� `account_sales_collection`锛屼笉鍐嶈蛋鏃ф敹娆鹃��璐ч�昏緫銆�
+
+`data.items[]` 鍏抽敭瀛楁锛�
+
+| 瀛楁 | 绫诲瀷 | 璇存槑 |
+| --- | --- | --- |
+| id | number | 鏀舵璁板綍ID |
+| refundId | string | 鏄犲皠 `collectionNumber`锛屽墠绔彲缁х画浣滀负鈥滈��娆�/鍥炴鍗曞彿鈥濆睍绀� |
+| collectionNumber | string | 鏀舵鍗曞彿 |
+| paymentMethod | string | 鏀舵鏂瑰紡 |
+| actualAmount | number | 鏀舵閲戦锛堜笌 `collectionAmount` 鍚屽�硷級 |
+| collectionAmount | number | 鏀舵閲戦锛堟帹鑽愪富灞曠ず瀛楁锛� |
+| customerId | number | 瀹㈡埛ID |
+| remark | string | 澶囨敞 |
+| createTime | string | 鏀舵鏃ユ湡锛坹yyy-MM-dd锛� |
+
+`summary` 澧為噺鍏虫敞锛�
+- `returnAmount`锛氭椂闂磋寖鍥村唴閲戦姹囨�伙紙鎸� `collectionAmount` 缁熻锛�
+
+### 2.2 `type = sales_customer_interaction_list`锛堝鎴峰線鏉ワ級
+
+褰撳墠杩斿洖鍩轰簬鏂伴摼璺細
+`account_sales_collection.stock_out_record_ids -> stock_out_record(record_type=13) -> shipping_info -> sales_ledger`
+
+杩斿洖绾﹀畾锛�
+- 鏃犳暟鎹椂锛歚description = "no_customer_interactions"`
+- 鏈夋暟鎹椂锛歚description = "ok"`
+
+`summary` 鍏抽敭瀛楁锛�
+- `totalReceiptAmount`
+- `customerCount`
+
+`data.items[]` 鍏抽敭瀛楁锛�
+- `salesLedgerId`
+- `salesContractNo`
+- `customerName`
+- `projectName`
+- `receiptPaymentDate`
+- `receiptPaymentAmount`
+- `receiptPaymentType`
+- `collectionNumber`
+- `registrant`
+- `remark`
+
+### 2.3 `type = sales_ledger_list`锛堥攢鍞彴璐︼級
+
+瀛楁缁撴瀯涓嶅彉锛屼絾閲戦鍙e緞宸插垏鎹細
+- `receivedAmount` 鐢辨柊鏀舵妯″瀷姹囨�诲緱鍒帮紱
+- `pendingAmount = max(0, invoicedAmount - receivedAmount)`锛�
+- 鑻ユ敹娆捐褰曟湭鏄惧紡鍏宠仈鍙拌处锛屽垯鎸夊鎴风淮搴﹀厹搴曞綊闆嗐��
+
+鍓嶇鏀归�犲缓璁細
+- 涓嶆敼瀛楁鍚嶏紱
+- 閲嶇偣鍥炲綊鈥滃凡鏀堕噾棰�/寰呭洖娆鹃噾棰濃�濇槸鍚︿笌璐㈠姟鍙拌处涓�鑷淬��
+
+## 3. 閲囪喘 AI 鍙樻洿锛坄/purchase-ai/chat`锛�
+
+### 3.1 `type = purchase_stats`锛堥噰璐粺璁★級
+
+浠ヤ笅瀛楁宸蹭粠鍗犱綅鍊兼敼涓虹湡瀹炵粺璁″�硷細
+- `summary.paymentCount`
+- `summary.invoiceCount`
+- `summary.paymentAmount`
+- `summary.invoiceAmount`
+
+鍙戠エ閲戦鍙e緞锛�
+- 浼樺厛 `taxInclusivePrice`
+- 鑻ヤ负绌�/0锛屽垯浣跨敤 `taxExclusivelPrice + taxPrice`
+
+### 3.2 `type = purchase_pending_payment_list`锛堝緟浠樻閲囪喘鍗曪級
+
+鏍稿績璁$畻宸插垏鎹㈠埌鏂拌储鍔¢摼璺細
+
+`account_purchase_payment -> account_payment_application -> stock_in_record -> (purchase_ledger / quality_inspect) -> purchase_ledger_id`
+
+鏄犲皠瑙勫垯锛�
+1. `stock_in_record.record_type = 7`锛歚record_id` 鐩存帴瑙嗕负 `purchase_ledger_id`
+2. `stock_in_record.record_type = 10`锛氶�氳繃 `quality_inspect.id = record_id` 鍙� `quality_inspect.purchase_ledger_id`
+
+閲戦瀛楁鍙e緞锛�
+- `paidAmount`锛氭柊閾捐矾绱宸蹭粯娆鹃噾棰�
+- `pendingAmount = contractAmount - paidAmount`锛�<=0 鐨勮褰曚笉杩斿洖锛�
+
+`summary` 鍏抽敭瀛楁锛堝潎涓虹湡瀹炲�硷級锛�
+- `pendingOrderCount`
+- `totalContractAmount`
+- `totalPaidAmount`
+- `totalPendingAmount`
+
+### 3.3 鏁版嵁娓呮礂淇
+
+宸蹭慨澶� `record_type` 甯︾┖鏍煎鑷寸殑鏄犲皠涓㈠け闂锛堝悗绔粺涓� `trim()` 鍚庡啀鍒ゆ柇 `7/10`锛夈��
+
+## 4. 鐢熶骇 AI / 寰呭姙 AI 鏍告煡缁撹
+
+宸叉牳鏌ヤ互涓嬫ā鍧椾唬鐮侊紝鏈彂鐜版棫璐㈠姟閫昏緫鑰﹀悎鐐癸細
+- `ManufacturingAgentTools`锛堢敓浜э級
+- `ApproveTodoTools`锛堝緟鍔炲鎵癸級
+
+缁撹锛�
+- 瀵瑰 `type` 涓庡瓧娈电粨鏋勬棤鍙樻洿锛�
+- 鍓嶇鏃犻渶鍋氬吋瀹规敼閫狅紝浠呴渶鍋氫竴娆″洖褰掗獙璇併��
+
+## 5. 鍓嶇鑱旇皟瑕佺偣
+
+1. `/sales-ai/chat`銆乣/purchase-ai/chat` 缁х画鎸� SSE 鏂囨湰娴佹嫾鎺ュ悗鍋� JSON 瑙f瀽銆�
+2. 鎸� `type` 璺敱娓叉煋锛屼笉瑕佷粎渚濊禆 `description` 鏂囨銆�
+3. `sales_customer_interaction_list` 闇�鍏煎 `description` 鏋氫妇锛歚ok` / `no_customer_interactions`銆�
+4. `sales_return_list` 閲戦灞曠ず缁熶竴鐢� `collectionAmount`锛坄actualAmount` 淇濈暀鍏煎锛夈��
+5. `purchase_pending_payment_list` 鐨勬眹鎬诲崱鐗囪鐩存帴璇诲彇 `summary.totalPendingAmount` 绛夊瓧娈碉紝涓嶅啀鍓嶇浜屾浼扮畻銆�
+
+## 6. 鍥炲綊娓呭崟锛堝缓璁級
+
+### 閿�鍞�
+1. 鎻愰棶锛氣�滆繎30澶╁摢涓鍗曞洖娆炬渶灏戔��
+ - 鏍¢獙 `sales_ledger_list` 鐨� `receivedAmount/pendingAmount`銆�
+2. 鎻愰棶锛氣�滄煡璇㈡湰鏈堥攢鍞��娆锯��
+ - 鏍¢獙 `sales_return_list` 鐨� `collectionNumber/collectionAmount/returnAmount`銆�
+3. 鎻愰棶锛氣�滄煡璇㈡湰鏈堝鎴峰線鏉モ��
+ - 鏍¢獙 `sales_customer_interaction_list` 鐨� `totalReceiptAmount/customerCount`銆�
+
+### 閲囪喘
+1. 鎻愰棶锛氣�滅粺璁℃湰鏈堥噰璐暟鎹��
+ - 鏍¢獙 `purchase_stats` 鐨� `paymentCount/invoiceCount/paymentAmount/invoiceAmount` 闈炲浐瀹�0銆�
+2. 鎻愰棶锛氣�滃垪鍑哄緟浠樻閲囪喘鍗曗��
+ - 鏍¢獙 `purchase_pending_payment_list` 鐨� `paidAmount/pendingAmount` 涓庤储鍔″疄闄呬竴鑷淬��
+
+### 鐢熶骇/寰呭姙
+1. 鐢熶骇鎻愰棶锛氣�滄煡璇㈡湰鍛ㄨ澶囩淮淇褰曗��
+2. 寰呭姙鎻愰棶锛氣�滄煡璇㈡垜鐨勫緟瀹℃壒鍒楄〃鈥�
+ - 鏍¢獙杩斿洖缁撴瀯涓庡崌绾у墠涓�鑷达紙鏃犲瓧娈电牬鍧忥級銆�
+
diff --git "a/doc/20260522_\351\207\207\350\264\255\345\217\260\350\264\246\345\205\245\345\272\223\347\212\266\346\200\201_\351\224\200\345\224\256\344\272\247\345\223\201\345\205\245\345\272\223\345\256\241\346\240\270\347\212\266\346\200\201\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260522_\351\207\207\350\264\255\345\217\260\350\264\246\345\205\245\345\272\223\347\212\266\346\200\201_\351\224\200\345\224\256\344\272\247\345\223\201\345\205\245\345\272\223\345\256\241\346\240\270\347\212\266\346\200\201\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..ae212fc
--- /dev/null
+++ "b/doc/20260522_\351\207\207\350\264\255\345\217\260\350\264\246\345\205\245\345\272\223\347\212\266\346\200\201_\351\224\200\345\224\256\344\272\247\345\223\201\345\205\245\345\272\223\345\256\241\346\240\270\347\212\266\346\200\201\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,127 @@
+# 閲囪喘鍏ュ簱鐘舵�佸墠绔仈璋冩枃妗�
+鏇存柊鏃堕棿锛�2026-05-22
+閫傜敤鐗堟湰锛氭湰娆″悗绔彉鏇村悗
+
+## 1. 鍙樻洿鑼冨洿
+
+1. `GET /purchaseLedger/listPage`
+ - 鏂板鏌ヨ鏉′欢锛歚stockInStatus`锛堝叆搴撶姸鎬侊級
+ - 鏂板杩斿洖瀛楁锛歚stockInStatus`锛堝叆搴撶姸鎬侊級
+2. `GET /salesLedgerProduct/list`
+ - 鏂板杩斿洖瀛楁锛歚stockInApprovalStatus`锛堟瘡涓骇鍝佺殑鍏ュ簱瀹℃牳鐘舵�侊級
+
+---
+
+## 2. 鍏ュ簱鐘舵�佹灇涓撅紙涓ゆ帴鍙d竴鑷达級
+
+- `寰呭叆搴揱
+- `鍏ュ簱涓璥
+- `瀹屽叏鍏ュ簱`
+
+璇存槑锛氬墠绔瓫閫夊�艰鐩存帴浣跨敤浠ヤ笂涓枃鏋氫妇鍊笺��
+
+---
+
+## 3. 鎺ュ彛涓�锛歚GET /purchaseLedger/listPage`
+
+### 3.1 鏂板璇锋眰鍙傛暟
+
+- `stockInStatus`锛歚string`锛屽彲閫�
+ 鍙紶鍊硷細`寰呭叆搴揱 / `鍏ュ簱涓璥 / `瀹屽叏鍏ュ簱`
+
+### 3.2 鏂板杩斿洖瀛楁
+
+- `stockInStatus`锛歚string`锛岄噰璐彴璐︾淮搴﹀叆搴撶姸鎬�
+
+### 3.3 鐘舵�佽绠楄鍒欙紙閲囪喘鍙拌处缁村害锛�
+
+浠ヨ閲囪喘鍙拌处涓� `sales_ledger_product.type = 2` 鐨勯噰璐骇鍝佷负璁$畻鑼冨洿锛�
+
+1. 鍏ㄩ儴浜у搧閮借揪鍒扳�滃畬鍏ㄥ叆搴撯�� => 鍙拌处鐘舵�� `瀹屽叏鍏ュ簱`
+2. 鑷冲皯鏈変竴涓骇鍝佸瓨鍦ㄢ�滃鏍搁�氳繃鍏ュ簱鈥濓紝浣嗘湭鍏ㄩ儴瀹屽叏鍏ュ簱 => 鍙拌处鐘舵�� `鍏ュ簱涓璥
+3. 娌℃湁浠讳綍浜у搧瀛樺湪鈥滃鏍搁�氳繃鍏ュ簱鈥� => 鍙拌处鐘舵�� `寰呭叆搴揱
+
+鈥滃鏍搁�氳繃鍏ュ簱鈥濈粺璁″彛寰勶細`stock_in_record.approval_status = 1`锛屽苟鎸変互涓嬫潵婧愭函婧愶細
+- `record_type = 7`锛堥噰璐�-鍏ュ簱锛夛細鎸夐噰璐彴璐�+浜у搧鍏宠仈缁熻
+- `record_type = 10`锛堥噰璐�-璐ㄦ-鍚堟牸鍏ュ簱锛夛細閫氳繃 `quality_inspect` 鍥炴函鍒伴噰璐彴璐�+浜у搧缁熻
+
+### 3.4 杩斿洖绀轰緥锛堣妭閫夛級
+
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": {
+ "records": [
+ {
+ "id": 1201,
+ "purchaseContractNumber": "CG20260522001",
+ "supplierName": "XX渚涘簲鍟�",
+ "stockInStatus": "鍏ュ簱涓�"
+ }
+ ],
+ "total": 1
+ }
+}
+```
+
+---
+
+## 4. 鎺ュ彛浜岋細`GET /salesLedgerProduct/list`
+
+### 4.1 鏂板杩斿洖瀛楁
+
+- `stockInApprovalStatus`锛歚string`锛屽綋鍓嶄骇鍝佽鐨勫叆搴撳鏍哥姸鎬�
+
+### 4.2 鐘舵�佽绠楄鍒欙紙浜у搧缁村害锛�
+
+浠呭綋浜у搧 `type = 2`锛堥噰璐骇鍝侊級鏃惰绠楀苟杩斿洖锛�
+
+1. 瀹℃牳閫氳繃鍏ュ簱鏁伴噺 `<= 0` => `寰呭叆搴揱
+2. 瀹℃牳閫氳繃鍏ュ簱鏁伴噺 `>= 浜у搧閲囪喘鏁伴噺` => `瀹屽叏鍏ュ簱`
+3. 鍏朵粬鎯呭喌 => `鍏ュ簱涓璥
+
+鍏朵腑鈥滃鏍搁�氳繃鍏ュ簱鏁伴噺鈥濈粺璁″悓鏍峰熀浜庯細
+- `stock_in_record.approval_status = 1`
+- 鏉ユ簮 `record_type = 7 / 10` 鐨勬函婧愬叧鑱旈�昏緫
+
+`type != 2` 鐨勪骇鍝侊紝璇ュ瓧娈佃繑鍥� `null`銆�
+
+### 4.3 杩斿洖绀轰緥锛堣妭閫夛級
+
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": [
+ {
+ "id": 5566,
+ "type": 2,
+ "productCategory": "閾滄潗",
+ "specificationModel": "T2-30x3",
+ "quantity": 100,
+ "stockInApprovalStatus": "寰呭叆搴�"
+ }
+ ]
+}
+```
+
+---
+
+## 5. 鍓嶇鏀归�犲缓璁�
+
+1. 閲囪喘鍙拌处鍒楄〃鏂板鈥滃叆搴撶姸鎬佲�濈瓫閫夐」锛屽�煎浐瀹氾細`寰呭叆搴�/鍏ュ簱涓�/瀹屽叏鍏ュ簱`銆�
+2. 閲囪喘鍙拌处鍒楄〃鏂板鈥滃叆搴撶姸鎬佲�濆垪锛屽睍绀� `stockInStatus`銆�
+3. 閲囪喘浜у搧鍒楄〃鏂板鈥滃叆搴撳鏍哥姸鎬佲�濆垪锛屽睍绀� `stockInApprovalStatus`銆�
+4. 绌哄�硷紙濡� `type != 2`锛夊缓璁睍绀轰负 `--`銆�
+
+---
+
+## 6. 鑱旇皟妫�鏌ユ竻鍗�
+
+1. `/purchaseLedger/listPage` 涓嶄紶 `stockInStatus`锛氬簲姝e父杩斿洖鍏ㄩ儴鏁版嵁锛屽苟甯� `stockInStatus`銆�
+2. `/purchaseLedger/listPage?stockInStatus=寰呭叆搴揱锛氫粎杩斿洖寰呭叆搴撳彴璐︺��
+3. `/purchaseLedger/listPage?stockInStatus=鍏ュ簱涓璥锛氫粎杩斿洖鍏ュ簱涓彴璐︺��
+4. `/purchaseLedger/listPage?stockInStatus=瀹屽叏鍏ュ簱`锛氫粎杩斿洖瀹屽叏鍏ュ簱鍙拌处銆�
+5. `/salesLedgerProduct/list` 鍦ㄩ噰璐骇鍝侊紙`type=2`锛変笅杩斿洖 `stockInApprovalStatus`銆�
+6. `/salesLedgerProduct/list` 鍦ㄩ潪閲囪喘浜у搧锛坄type!=2`锛変笅 `stockInApprovalStatus` 涓� `null`銆�
diff --git "a/doc/20260522_\351\246\226\351\241\265\350\264\242\345\212\241\346\216\245\345\217\243\345\215\207\347\272\247\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md" "b/doc/20260522_\351\246\226\351\241\265\350\264\242\345\212\241\346\216\245\345\217\243\345\215\207\347\272\247\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..532eba7
--- /dev/null
+++ "b/doc/20260522_\351\246\226\351\241\265\350\264\242\345\212\241\346\216\245\345\217\243\345\215\207\347\272\247\345\211\215\347\253\257\345\217\230\346\233\264\346\226\207\346\241\243.md"
@@ -0,0 +1,120 @@
+# 棣栭〉璐㈠姟鎺ュ彛鍗囩骇鍓嶇鍙樻洿鏂囨。
+
+鏇存柊鏃堕棿锛�2026-05-22
+閫傜敤妯″潡锛氶椤碉紙`/home`锛�
+
+## 1. 鍙樻洿姒傝
+
+鏈涓� **鍏煎寮忓崌绾�**锛屾帴鍙� URL銆佽姹傚弬鏁般�佽繑鍥炲瓧娈典繚鎸佷笉鍙樸��
+涓昏鍙樻洿鏄椤佃储鍔℃暟鎹粠鍗犱綅/鍗婃垚鍝侀�昏緫锛屽垏鎹负鎸夎储鍔$湡瀹炴暟鎹彛寰勮绠椼��
+
+娑夊強鎺ュ彛锛�
+
+1. `GET /home/statisticsReceivablePayable`
+2. `GET /home/monthlyIncome`
+3. `GET /home/monthlyExpenditure`
+
+## 2. 鍙傛暟璇存槑锛堟棤鏂板锛�
+
+### 2.1 `GET /home/statisticsReceivablePayable`
+
+- `type`锛歚1` 鏈懆锛宍2` 鏈湀锛宍3` 鏈搴︼紙榛樿 `1`锛�
+
+### 2.2 `GET /home/monthlyIncome`
+
+- 鏃犲弬鏁�
+
+### 2.3 `GET /home/monthlyExpenditure`
+
+- 鏃犲弬鏁�
+
+## 3. 杩斿洖瀛楁鍙e緞鍙樻洿
+
+### 3.1 搴旀敹搴斾粯缁熻 `statisticsReceivablePayable`
+
+杩斿洖瀛楁涓嶅彉锛�
+
+- `receivableMoney`
+- `payableMoney`
+- `advanceMoney`
+- `prepayMoney`
+
+鏂板彛寰勶細
+
+- `receivableMoney = max(閿�鍞悎鍚岄噾棰濆悎璁� - 鏀舵閲戦鍚堣, 0)`
+- `payableMoney = max(閲囪喘鍚堝悓閲戦鍚堣 - 浠樻閲戦鍚堣, 0)`
+- `advanceMoney = 鏀舵閲戦鍚堣`
+- `prepayMoney = 浠樻閲戦鍚堣`
+
+浠ヤ笂閲戦鍧囨寜 `type` 瀵瑰簲鏃堕棿鑼冨洿缁熻锛屼繚鐣欎袱浣嶅皬鏁般��
+
+杩斿洖绀轰緥锛�
+
+```json
+{
+ "receivableMoney": 128000.00,
+ "payableMoney": 76000.00,
+ "advanceMoney": 42000.00,
+ "prepayMoney": 31000.00
+}
+```
+
+### 3.2 鏈堝害鏀跺叆 `monthlyIncome`
+
+杩斿洖瀛楁涓嶅彉锛�
+
+- `monthlyIncome`
+- `collectionRate`
+- `overdueNum`
+- `overdueRate`
+
+鏂板彛寰勶細
+
+- `monthlyIncome`锛氬綋鏈堟敹娆惧悎璁�
+- `collectionRate`锛歚褰撴湀鏀舵鍚堣 / 褰撴湀閿�鍞悎鍚岄噾棰濆悎璁� * 100`
+- `overdueNum`锛氬巻鍙插簲鏀跺璐﹀崟锛坄account_statement.account_type=1`锛変腑锛屾棭浜庡綋鏈堜笖 `closing_balance > 0` 鐨勬暟閲�
+- `overdueRate`锛歚overdueNum / 鍘嗗彶搴旀敹瀵硅处鍗曟�绘暟 * 100`
+
+杩斿洖绀轰緥锛�
+
+```json
+{
+ "monthlyIncome": 89500.00,
+ "collectionRate": "62.80",
+ "overdueNum": 4,
+ "overdueRate": "18.18"
+}
+```
+
+### 3.3 鏈堝害鏀嚭 `monthlyExpenditure`
+
+杩斿洖瀛楁涓嶅彉锛�
+
+- `monthlyExpenditure`
+- `paymentRate`
+- `grossProfit`
+- `profitMarginRate`
+
+鏂板彛寰勶細
+
+- `monthlyExpenditure`锛氬綋鏈堜粯娆惧悎璁�
+- `paymentRate`锛歚褰撴湀浠樻鍚堣 / 褰撴湀閲囪喘鍚堝悓閲戦鍚堣 * 100`
+- `grossProfit`锛歚褰撴湀鏀舵鍚堣 - 褰撴湀浠樻鍚堣`
+- `profitMarginRate`锛歚grossProfit / 褰撴湀鏀舵鍚堣 * 100`
+
+杩斿洖绀轰緥锛�
+
+```json
+{
+ "monthlyExpenditure": 73400.00,
+ "paymentRate": "57.34",
+ "grossProfit": 16100.00,
+ "profitMarginRate": "17.99"
+}
+```
+
+## 4. 鍓嶇鑱旇皟璇存槑
+
+1. 鍓嶇瀛楁鏄犲皠鏃犻渶璋冩暣锛屽彲鐩存帴娌跨敤鐜版湁瑙f瀽閫昏緫銆�
+2. 鐧惧垎姣斿瓧娈典粛涓轰笉甯� `%` 鐨勫瓧绗︿覆锛屽墠绔闇�灞曠ず `%` 璇风户缁墠绔嫾鎺ャ��
+3. 鏈鍚庣杩斿洖鍊肩敱鐪熷疄璐㈠姟鏁版嵁椹卞姩锛屽缓璁噸鐐瑰洖褰掑崱鐗囨眹鎬讳笌瓒嬪娍鍥剧殑鏁板�艰仈鍔ㄣ��
diff --git "a/doc/20260523_ \345\215\217\345\220\214\345\256\241\346\211\271\346\226\260\345\242\236\345\207\272\345\267\256\346\227\266\351\227\264\345\222\214\347\273\223\346\235\237\346\227\266\351\227\264.sql" "b/doc/20260523_ \345\215\217\345\220\214\345\256\241\346\211\271\346\226\260\345\242\236\345\207\272\345\267\256\346\227\266\351\227\264\345\222\214\347\273\223\346\235\237\346\227\266\351\227\264.sql"
new file mode 100644
index 0000000..0e0c5ce
--- /dev/null
+++ "b/doc/20260523_ \345\215\217\345\220\214\345\256\241\346\211\271\346\226\260\345\242\236\345\207\272\345\267\256\346\227\266\351\227\264\345\222\214\347\273\223\346\235\237\346\227\266\351\227\264.sql"
@@ -0,0 +1,3 @@
+ALTER TABLE approve_process
+ ADD COLUMN start_date_time datetime DEFAULT NULL COMMENT '鍑哄樊寮�濮嬫椂闂�',
+ ADD COLUMN end_date_time datetime DEFAULT NULL COMMENT '鍑哄樊缁撴潫鏃堕棿';
diff --git a/doc/20260615_add_plan_person_and_executor_to_routing_operation.sql b/doc/20260615_add_plan_person_and_executor_to_routing_operation.sql
new file mode 100644
index 0000000..b98e8ca
--- /dev/null
+++ b/doc/20260615_add_plan_person_and_executor_to_routing_operation.sql
@@ -0,0 +1,8 @@
+# 鐢熶骇宸ュ簭鏂板璁″垝浜哄憳鍜岃鍒掓墽琛屼汉鍛樺瓧娈�
+ALTER TABLE technology_routing_operation
+ ADD plan_person bigint NULL COMMENT '璁″垝浜哄憳ID',
+ ADD executor bigint NULL COMMENT '璁″垝鎵ц浜哄憳ID';
+
+ALTER TABLE production_order_routing_operation
+ ADD plan_person bigint NULL COMMENT '璁″垝浜哄憳ID',
+ ADD executor bigint NULL COMMENT '璁″垝鎵ц浜哄憳ID';
diff --git a/doc/financial-ai-front-integration.md b/doc/financial-ai-front-integration.md
new file mode 100644
index 0000000..f632c78
--- /dev/null
+++ b/doc/financial-ai-front-integration.md
@@ -0,0 +1,192 @@
+# 璐㈠姟鏅鸿兘浣撳墠绔仈璋冩枃妗�
+
+## 1. 妯″潡璇存槑
+
+璐㈠姟鏅鸿兘浣撳悗绔凡鏂板缁熶竴鍏ュ彛 `financial-ai`锛岀敤浜庝笟璐竴浣撳寲鍒嗘瀽锛岃鐩栵細
+
+- 鏅鸿兘鎴愭湰鏍哥畻
+- 璁㈠崟鍒╂鼎鍒嗘瀽
+- 搴撳瓨璧勯噾鍒嗘瀽
+- 搴旀敹搴斾粯涓庣幇閲戞祦棰勬祴
+- 缁忚惀寮傚父棰勮
+- AI 缁忚惀椹鹃┒鑸�
+- 鏃ユ姤/鍛ㄦ姤鑷姩鐢熸垚
+- 璐㈠姟鐭ヨ瘑妫�绱紙杞婚噺 RAG 涓婁笅鏂囷級
+
+鎺ュ彛閲囩敤 **SSE 娴佸紡杈撳嚭**锛屽伐鍏峰懡涓椂杩斿洖缁撴瀯鍖� JSON 瀛楃涓层��
+
+## 2. 鎺ュ彛娓呭崟
+
+### 2.1 瀵硅瘽鎺ュ彛锛圫SE锛�
+
+- `POST /financial-ai/chat`
+- `Content-Type: application/json`
+- `Accept: text/stream;charset=utf-8`
+
+璇锋眰浣擄細
+
+```json
+{
+ "memoryId": "finance-uuid-001",
+ "message": "鏌ヨ杩�30澶╀簭鎹熻鍗�"
+}
+```
+
+瀛楁璇存槑锛�
+
+- `memoryId`锛氫細璇濆敮涓�鏍囪瘑锛堝墠绔敓鎴� UUID锛屽崟浼氳瘽澶嶇敤锛�
+- `message`锛氳嚜鐒惰瑷�闂
+
+---
+
+### 2.2 浼氳瘽鍒楄〃
+
+- `GET /financial-ai/history/sessions`
+
+---
+
+### 2.3 浼氳瘽娑堟伅
+
+- `GET /financial-ai/history/messages/{memoryId}`
+
+---
+
+### 2.4 鍒犻櫎浼氳瘽
+
+- `DELETE /financial-ai/history/{memoryId}`
+
+## 3. SSE 杩斿洖澶勭悊瑙勮寖
+
+### 3.1 杩斿洖褰㈡��
+
+- 鏅�氶棶绛旓細娴佸紡鏂囨湰鐗囨
+- 宸ュ叿鍛戒腑锛氬畬鏁� JSON 瀛楃涓诧紙閫氬父涓�娆℃�ц緭鍑猴紝涔熷彲鑳藉垎鐗囷級
+
+鍓嶇寤鸿澶勭悊娴佺▼锛�
+
+1. 灏� SSE 鍒嗙墖鎸夐『搴忔嫾鎺ユ垚 `rawText`
+2. 瀵� `rawText` 灏濊瘯 `JSON.parse`
+3. 鑻ュ彲瑙f瀽锛屾寜 `type` 鍒嗗彂娓叉煋鍥捐〃/琛ㄦ牸
+4. 鑻ヤ笉鍙В鏋愶紝鎸夋櫘閫氭枃鏈睍绀�
+
+### 3.2 缁撴瀯鍖� JSON 閫氱敤鏍煎紡
+
+```json
+{
+ "success": true,
+ "type": "financial_order_profit_analysis",
+ "description": "宸插畬鎴愯鍗曞埄娑﹀垎鏋�",
+ "summary": {},
+ "data": {},
+ "charts": {}
+}
+```
+
+瀛楁璇存槑锛�
+
+- `type`锛氱粨鏋滅被鍨嬶紙鍓嶇娓叉煋鍒嗗彂閿級
+- `summary`锛氬ご閮ㄦ寚鏍�
+- `data`锛氳〃鏍兼槑缁�/寤鸿鍒楄〃
+- `charts`锛欵Charts `option` 鏁版嵁
+
+## 4. type 涓庡墠绔〉闈㈡槧灏�
+
+寤鸿鎸� `type` 寤虹珛娓叉煋绛栫暐锛�
+
+- `financial_cost_accounting`锛氭垚鏈牳绠楅〉
+- `financial_order_profit_analysis`锛氳鍗曞埄娑﹂〉
+- `financial_inventory_capital_analysis`锛氬簱瀛樿祫閲戦〉
+- `financial_cashflow_forecast`锛氱幇閲戞祦椤�
+- `financial_business_anomaly_warning`锛氶闄╅璀﹂〉
+- `financial_business_cockpit`锛氱粡钀ラ┚椹惰埍
+- `financial_operation_report`锛氭棩鎶ュ懆鎶ラ〉
+- `financial_rag_knowledge`锛氱煡璇嗘绱�/鍙e緞璇存槑鍗$墖
+
+## 5. 鍏抽敭鏁版嵁瀛楁锛堣仈璋冮噸鐐癸級
+
+### 5.1 鎴愭湰/鍒╂鼎绫�
+
+- `data.orders[]`锛�
+ - `salesContractNo`
+ - `customerName`
+ - `revenue`
+ - `materialCost`
+ - `laborCost`
+ - `depreciationCost`
+ - `scrapCost`
+ - `totalCost`
+ - `profit`
+ - `profitRate`
+ - `riskLevel`
+ - `reasons`
+ - `suggestion`
+
+### 5.2 搴撳瓨璧勯噾绫�
+
+- `data.items[]`锛�
+ - `productName`
+ - `model`
+ - `quantity`
+ - `inventoryValue`
+ - `stagnantDays`
+ - `overstock`
+ - `riskLevel`
+
+### 5.3 鐜伴噾娴佺被
+
+- `data.actualMonthly[]` / `data.forecastMonthly[]`锛�
+ - `month`
+ - `income`
+ - `expense`
+ - `netFlow`
+- `data.receivableRiskTop[]` / `data.payablePressureTop[]`
+
+### 5.4 寮傚父棰勮绫�
+
+- `data.items[]`锛�
+ - `riskLevel`
+ - `type`
+ - `message`
+ - `detail`
+
+### 5.5 鎶ュ憡绫�
+
+- `data.headline`
+- `data.conclusions[]`
+- `data.riskSuggestions[]`
+- `data.orderProfitTop[]`
+
+## 6. 鍥捐〃鑱旇皟瑙勮寖
+
+`charts` 鍐呭瓧娈靛潎涓� ECharts `option`锛屽彲鐩存帴鍠傜粰鍥捐〃缁勪欢銆�
+
+甯歌瀛楁锛�
+
+- 鏌辩姸鍥撅細`orderProfitBarOption` / `processCostBarOption` / `inventoryValueTopOption`
+- 楗煎浘锛歚costCompositionPieOption` / `inventoryAgingPieOption` / `anomalyLevelPieOption`
+- 瓒嬪娍鍥撅細`cashFlowTrendOption`
+- 浠〃鐩橈細`fundGapGaugeOption` / `inventoryTurnoverGauge`
+
+## 7. 鎺ㄨ崘鍓嶇闂彞锛堝洖褰掓祴璇曪級
+
+1. `鏌ョ湅鏈湀缁忚惀椹鹃┒鑸盽
+2. `鏌ヨ杩�30澶╀簭鎹熻鍗昤
+3. `鍒嗘瀽杩�30澶╁簱瀛樿祫閲戝崰鐢╜
+4. `棰勬祴鏈潵3涓湀鐜伴噾娴乣
+5. `鐢熸垚鏈懆缁忚惀鍛ㄦ姤`
+6. `涓轰粈涔堝埄娑︿笅闄峘
+7. `鍝釜瀹㈡埛鏈�璧氶挶`
+8. `鍝釜宸ュ簭鎴愭湰鏈�楂榒
+
+## 8. 寮傚父涓庡厹搴曞鐞�
+
+- `memoryId` 涓虹┖锛氳繑鍥炴枃鏈� `memoryId涓嶈兘涓虹┖`
+- `message` 涓虹┖锛氳繑鍥炴枃鏈� `message涓嶈兘涓虹┖`
+- 鏃犳暟鎹満鏅細`success=true` 涓� `data.items=[]`锛屽墠绔寜绌烘�佸睍绀�
+- 闈� JSON 娴佽繑鍥烇細鎸夋櫘閫氳亰澶╂枃鏈睍绀�
+
+## 9. 鑱旇皟寤鸿
+
+1. 鍏堝仛 `type` 鍒嗗彂鍣紙淇濊瘉鎵�鏈夌粨鏋勫寲缁撴灉鍙惤鍦帮級
+2. 鍐嶅仛鎽樿鍗$墖锛坄summary`锛�+ 琛ㄦ牸锛坄data`锛�+ 鍥捐〃锛坄charts`锛�
+3. 鏈�鍚庤ˉ浼氳瘽鍘嗗彶涓庡垹闄よ兘鍔涳紝褰㈡垚瀹屾暣瀵硅瘽闂幆
diff --git a/doc/sql/20260609_knowledge_base_vector.sql b/doc/sql/20260609_knowledge_base_vector.sql
new file mode 100644
index 0000000..7b4323f
--- /dev/null
+++ b/doc/sql/20260609_knowledge_base_vector.sql
@@ -0,0 +1,30 @@
+-- 鐭ヨ瘑搴撳悜閲忔绱㈠姛鑳芥暟鎹簱鍙樻洿
+-- 鎵ц鍓嶈纭繚 knowledge_base 琛ㄥ凡瀛樺湪
+
+-- 1. knowledge_base 琛ㄥ鍔犲瓧娈�
+ALTER TABLE knowledge_base
+ADD COLUMN IF NOT EXISTS file_count INT DEFAULT 0 COMMENT '鏂囦欢鏁伴噺',
+ADD COLUMN IF NOT EXISTS total_chunk_count INT DEFAULT 0 COMMENT '鎬诲垏鐗囨暟閲�',
+ADD COLUMN IF NOT EXISTS description VARCHAR(500) COMMENT '鐭ヨ瘑搴撴弿杩�';
+
+-- 2. 鍒涘缓鐭ヨ瘑搴撴枃浠跺悜閲忚褰曡〃
+CREATE TABLE IF NOT EXISTS knowledge_base_vector (
+ id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '涓婚敭ID',
+ knowledge_base_id BIGINT NOT NULL COMMENT '鍏宠仈鐭ヨ瘑搴揑D',
+ storage_blob_id BIGINT NOT NULL COMMENT '鍏宠仈鏂囦欢blob ID',
+ file_name VARCHAR(255) NOT NULL COMMENT '鏂囦欢鍚嶇О',
+ file_type VARCHAR(50) NOT NULL COMMENT '鏂囦欢绫诲瀷(docx/pdf/xlsx/txt绛�)',
+ vector_status TINYINT DEFAULT 0 COMMENT '鍚戦噺鍖栫姸鎬�: 0-寰呭鐞�, 1-澶勭悊涓�, 2-宸插畬鎴�, 3-澶辫触',
+ vector_error VARCHAR(500) COMMENT '鍚戦噺鍖栧け璐ュ師鍥�',
+ chunk_count INT DEFAULT 0 COMMENT '鍒囩墖鏁伴噺',
+ namespace VARCHAR(100) COMMENT '鍚戦噺鍛藉悕绌洪棿',
+ create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ create_user INT COMMENT '鍒涘缓浜�',
+ update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ update_user INT COMMENT '鏇存柊浜�',
+ tenant_id BIGINT COMMENT '绉熸埛ID',
+ dept_id BIGINT COMMENT '閮ㄩ棬ID',
+ INDEX idx_knowledge_base_id (knowledge_base_id),
+ INDEX idx_storage_blob_id (storage_blob_id),
+ INDEX idx_vector_status (vector_status)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='鐭ヨ瘑搴撴枃浠跺悜閲忚褰曡〃';
\ No newline at end of file
diff --git "a/doc/\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243-\350\256\276\345\244\207\346\212\245\344\277\256\344\277\235\345\205\273\350\264\242\345\212\241\346\250\241\345\235\227\346\224\271\351\200\240.md" "b/doc/\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243-\350\256\276\345\244\207\346\212\245\344\277\256\344\277\235\345\205\273\350\264\242\345\212\241\346\250\241\345\235\227\346\224\271\351\200\240.md"
new file mode 100644
index 0000000..43c468c
--- /dev/null
+++ "b/doc/\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243-\350\256\276\345\244\207\346\212\245\344\277\256\344\277\235\345\205\273\350\264\242\345\212\241\346\250\241\345\235\227\346\224\271\351\200\240.md"
@@ -0,0 +1,233 @@
+# 鍓嶇鑱旇皟鏂囨。锛堣澶囨姤淇� / 璁惧淇濆吇瀹氭椂浠诲姟 / 璐㈠姟绉戠洰鎬昏处锛�
+
+## 1. 鍙樻洿鑼冨洿
+
+鏈鑱旇皟娑夊強 3 涓ā鍧楋細
+
+1. 璐㈠姟妯″潡锛氱鐩�昏处鍘绘帀鍑瘉瀛楀彿銆佹憳瑕侊紝鍙繑鍥� 1 鏉″悎璁℃暟鎹��
+2. 璁惧淇濆吇瀹氭椂浠诲姟锛氭柊澧� `淇濆吇浜篳 瀛楁锛屽畾鏃朵换鍔$敓鎴愪繚鍏昏褰曟椂甯﹀叆銆�
+3. 璁惧鎶ヤ慨锛氱‘璁ゆ姤淇悗鏂板楠屾敹瀹℃壒锛岄獙鏀堕�氳繃鍚庢墠绠楀畬缁撱��
+
+---
+
+## 2. 鎺ュ彛娓呭崟
+
+### 2.1 璐㈠姟-绉戠洰鎬昏处
+
+- **GET** `/financial/ledger/general`
+- 璇存槑锛氳繑鍥炵鐩�昏处鍚堣锛屼粎 1 鏉¤褰曘��
+
+#### 璇锋眰鍙傛暟锛圦uery锛�
+
+| 鍙傛暟 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| `subjectCode` | string | 鏄� | 绉戠洰缂栫爜 |
+| `startMonth` | string | 鏄� | 寮�濮嬫湀浠斤紝鏍煎紡 `YYYY-MM` |
+| `endMonth` | string | 鏄� | 缁撴潫鏈堜唤锛屾牸寮� `YYYY-MM` |
+
+#### 杩斿洖缁撴瀯
+
+`R<List<FinLedgerRowVo>>`
+
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": [
+ {
+ "rowType": "yearly_total",
+ "date": "2026-05-31",
+ "debit": 12000.00,
+ "credit": 8000.00,
+ "direction": "鍊�",
+ "balance": 4000.00
+ }
+ ]
+}
+```
+
+#### 鑱旇皟娉ㄦ剰
+
+1. `data` 鍥哄畾鍙湁 1 鏉★紙鍚堣锛夈��
+2. `voucherNo`銆乣summary` 涓嶈繑鍥烇紙涓嶅啀灞曠ず鍑瘉瀛楀彿銆佹憳瑕侊級銆�
+
+---
+
+### 2.2 璁惧淇濆吇瀹氭椂浠诲姟锛堟柊澧炰繚鍏讳汉锛�
+
+- 鍩虹璺緞锛歚/deviceMaintenanceTask`
+- 鐩稿叧鎺ュ彛锛�
+ - **POST** `/add`
+ - **POST** `/update`
+ - **GET** `/listPage`
+
+#### 鏂板瀛楁
+
+| 瀛楁 | 绫诲瀷 | 璇存槑 |
+|---|---|---|
+| `maintenancePerson` | string | 淇濆吇浜� |
+
+#### 鏂板/鏇存柊璇锋眰绀轰緥
+
+```json
+{
+ "id": 1,
+ "taskName": "绌哄帇鏈轰繚鍏讳换鍔�",
+ "taskId": 1001,
+ "maintenancePerson": "寮犱笁",
+ "frequencyType": "MONTHLY",
+ "frequencyDetail": "10,09:00",
+ "remarks": "姣忔湀渚嬭淇濆吇"
+}
+```
+
+#### 瀹氭椂浠诲姟涓嬪彂琛屼负
+
+瀹氭椂浠诲姟鎵ц鍚庯紝绯荤粺鑷姩鍒涘缓淇濆吇璁板綍锛坄device_maintenance`锛夋椂浼氬啓鍏ワ細
+
+- `maintenanceActuallyName = maintenancePerson`
+
+鍗冲墠绔湪瀹氭椂浠诲姟閲岀淮鎶ょ殑淇濆吇浜猴紝浼氳嚜鍔ㄥ甫鍏ュ埌淇濆吇璁板綍銆�
+
+---
+
+### 2.3 璁惧鎶ヤ慨锛堢‘璁ゅ悗楠屾敹瀹℃壒锛�
+
+- 鍩虹璺緞锛歚/device/repair`
+
+#### 鐘舵�佸畾涔�
+
+| 鐘舵�佸�� | 鍚箟 |
+|---|---|
+| `0` | 寰呯淮淇� |
+| `3` | 寰呴獙鏀� |
+| `1` | 瀹岀粨 |
+| `2` | 澶辫触 |
+
+#### 2.3.1 缁翠慨纭锛堝師纭鎶ヤ慨锛�
+
+- **POST** `/device/repair/repair`
+- 璇存槑锛氭彁浜ゅ悗鐘舵�佷粠 `寰呯淮淇�(0)` 杩涘叆 `寰呴獙鏀�(3)`锛屼笉鍐嶇洿鎺ュ畬缁撱��
+
+璇锋眰绀轰緥锛�
+
+```json
+{
+ "id": 10001,
+ "maintenanceName": "鏉庡洓",
+ "maintenanceTime": "2026-05-14 10:30:00",
+ "maintenanceResult": "鏇存崲杞存壙骞惰瘯杩愯姝e父",
+ "sparePartsUseList": [
+ {
+ "id": 501,
+ "quantity": 2
+ }
+ ]
+}
+```
+
+甯歌澶辫触鎻愮ず锛堢敤浜庡墠绔脊绐楋級锛�
+
+- `鎶ヤ慨璁板綍涓嶅瓨鍦╜
+- `璇ユ姤淇凡瀹岀粨锛屼笉鑳介噸澶嶇‘璁ょ淮淇甡
+- `璇ユ姤淇凡鎻愪氦楠屾敹瀹℃壒`
+- `澶囦欢 xxx 鏁伴噺涓嶈冻`
+
+#### 2.3.2 楠屾敹瀹℃壒锛堟柊澧烇級
+
+- **POST** `/device/repair/acceptance`
+- 璇存槑锛氫粎 `寰呴獙鏀�(3)` 鍙鎵癸紱瀹℃壒閫氳繃鍚庣姸鎬佹敼涓� `瀹岀粨(1)`銆�
+
+璇锋眰鍙傛暟锛圔ody锛夛細
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| `id` | long | 鏄� | 鎶ヤ慨璁板綍ID |
+| `acceptanceName` | string | 鏄� | 楠屾敹浜� |
+| `acceptanceTime` | string | 鏄� | 楠屾敹鏃堕棿锛屾牸寮� `yyyy-MM-dd HH:mm:ss` |
+| `acceptanceRemark` | string | 鏄� | 楠屾敹澶囨敞 |
+
+璇锋眰绀轰緥锛�
+
+```json
+{
+ "id": 10001,
+ "acceptanceName": "鐜嬩簲",
+ "acceptanceTime": "2026-05-14 11:00:00",
+ "acceptanceRemark": "缁翠慨椤规牳楠岄�氳繃锛岃澶囪繍琛屾甯�"
+}
+```
+
+甯歌澶辫触鎻愮ず锛�
+
+- `鎶ヤ慨璁板綍id涓嶈兘涓虹┖`
+- `鎶ヤ慨璁板綍涓嶅瓨鍦╜
+- `璇ユ姤淇湭杩涘叆寰呴獙鏀剁姸鎬侊紝涓嶈兘瀹℃壒`
+- `楠屾敹浜轰笉鑳戒负绌篳
+- `楠屾敹鏃堕棿涓嶈兘涓虹┖`
+- `楠屾敹澶囨敞涓嶈兘涓虹┖`
+
+#### 2.3.3 鏅�氭洿鏂版帴鍙i檺鍒�
+
+- **PUT** `/device/repair`
+- 闄愬埗锛氫笉鑳介�氳繃鏅�氭洿鏂扮洿鎺ユ妸鐘舵�佹敼鎴� `瀹岀粨(1)`锛堝繀椤昏蛋楠屾敹瀹℃壒鎺ュ彛锛夈��
+- 澶辫触鎻愮ず锛歚璇峰厛鎻愪氦楠屾敹瀹℃壒锛岄獙鏀堕�氳繃鍚庢墠鍙畬缁揱
+
+---
+
+## 3. 杩斿洖瀛楁鍙樻洿锛堟姤淇垪琛�/璇︽儏锛�
+
+浠ヤ笅鎺ュ彛杩斿洖宸叉柊澧為獙鏀跺瓧娈碉細
+
+- **GET** `/device/repair/page`
+- **GET** `/device/repair/{id}`
+
+鏂板杩斿洖瀛楁锛�
+
+| 瀛楁 | 绫诲瀷 | 璇存槑 |
+|---|---|---|
+| `acceptanceName` | string | 楠屾敹浜� |
+| `acceptanceTime` | string | 楠屾敹鏃堕棿 |
+| `acceptanceRemark` | string | 楠屾敹澶囨敞 |
+
+---
+
+## 4. 鍓嶇鏀归�犲缓璁�
+
+1. 鎶ヤ慨鍒楄〃澧炲姞鐘舵�佸�� `3=寰呴獙鏀禶 鐨勫睍绀烘枃妗堜笌绛涢�夐」銆�
+2. 鈥滅‘璁ょ淮淇�濇寜閽皟鐢� `/device/repair/repair`锛屾垚鍔熷悗鍒锋柊涓哄緟楠屾敹鐘舵�併��
+3. 鏂板鈥滈獙鏀跺鎵光�濆脊绐楋紝蹇呭~锛�
+ - 楠屾敹浜�
+ - 楠屾敹鏃堕棿
+ - 楠屾敹澶囨敞
+4. 绂佹鍦ㄦ櫘閫氱紪杈戦〉鐩存帴灏嗙姸鎬佺疆涓哄畬缁撱��
+5. 璁惧淇濆吇瀹氭椂浠诲姟鏂板鈥滀繚鍏讳汉鈥濊緭鍏ラ」锛屽苟鍦ㄥ垪琛�/璇︽儏灞曠ず銆�
+6. 绉戠洰鎬昏处椤甸潰鎸夊崟琛屽悎璁℃覆鏌擄紝涓嶅啀鏄剧ず鍑瘉瀛楀彿銆佹憳瑕佸垪銆�
+
+---
+
+## 5. 鑱旇皟妫�鏌ユ竻鍗�
+
+1. 绉戠洰鎬昏处鏌ヨ杩斿洖 `data.length === 1`锛屼笖鏃� `voucherNo/summary`銆�
+2. 鏂板淇濆吇瀹氭椂浠诲姟鏃朵紶 `maintenancePerson`锛屽垪琛ㄨ兘鍥炴樉銆�
+3. 瀹氭椂浠诲姟瑙﹀彂鍚庯紝鐢熸垚鐨勪繚鍏昏褰� `maintenanceActuallyName` 涓庡畾鏃朵换鍔′繚鍏讳汉涓�鑷淬��
+4. 鎶ヤ慨鍗曟祦绋嬶細`0寰呯淮淇� -> 3寰呴獙鏀� -> 1瀹岀粨`銆�
+5. 寰呴獙鏀跺崟鎹湭濉獙鏀朵汉/楠屾敹鏃堕棿/楠屾敹澶囨敞鏃讹紝鍚庣杩斿洖瀵瑰簲閿欒鎻愮ず銆�
+6. 灏濊瘯閫氳繃 `PUT /device/repair` 鐩存帴璁句负瀹岀粨鏃讹紝鍚庣杩斿洖鎷︽埅鎻愮ず銆�
+
+---
+
+## 6. 鏁版嵁搴撳彉鏇达紙鑱旇皟鍓嶇‘璁わ級
+
+```sql
+ALTER TABLE maintenance_task
+ ADD COLUMN maintenance_person VARCHAR(100) NULL COMMENT '淇濆吇浜�';
+
+ALTER TABLE device_repair
+ ADD COLUMN acceptance_name VARCHAR(100) NULL COMMENT '楠屾敹浜�',
+ ADD COLUMN acceptance_time DATETIME NULL COMMENT '楠屾敹鏃堕棿',
+ ADD COLUMN acceptance_remark VARCHAR(500) NULL COMMENT '楠屾敹澶囨敞';
+```
+
+> 鑻ユ湭鎵ц浠ヤ笂 SQL锛岀浉鍏虫帴鍙d細鍑虹幇瀛楁涓嶅瓨鍦ㄥ紓甯搞��
+
diff --git "a/doc/\347\237\245\350\257\206\345\272\223RAG\345\212\237\350\203\275\345\256\236\347\216\260\346\226\207\346\241\243.md" "b/doc/\347\237\245\350\257\206\345\272\223RAG\345\212\237\350\203\275\345\256\236\347\216\260\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..4a94cc5
--- /dev/null
+++ "b/doc/\347\237\245\350\257\206\345\272\223RAG\345\212\237\350\203\275\345\256\236\347\216\260\346\226\207\346\241\243.md"
@@ -0,0 +1,1034 @@
+# 鐭ヨ瘑搴揜AG鍚戦噺妫�绱㈠姛鑳藉疄鐜版枃妗�
+
+## 涓�銆佸姛鑳芥杩�
+
+鍩轰簬 RAG锛圧etrieval-Augmented Generation锛夋妧鏈疄鐜扮煡璇嗗簱闂瓟鍔熻兘锛屾敮鎸侊細
+- 鐭ヨ瘑搴撶鐞嗭紙CRUD锛�
+- 鏂囦欢涓婁紶涓庡悜閲忓寲澶勭悊
+- 鍩轰簬鍚戦噺妫�绱㈢殑鏅鸿兘闂瓟
+- 澶氱鏂囦欢鏍煎紡鏀寔锛坱xt銆乵d銆乨ocx銆亁lsx銆亁ls銆乸df锛�
+
+## 浜屻�佹妧鏈灦鏋�
+
+### 2.1 鎶�鏈爤
+| 缁勪欢 | 鎶�鏈� |
+|------|------|
+| 鍚戦噺鏁版嵁搴� | Pinecone |
+| Embedding妯″瀷 | 闃块噷浜� DashScope text-embedding-v3 |
+| LLM | 闃块噷浜戦�氫箟鍗冮棶 qwen-max |
+| 妗嗘灦 | langchain4j |
+| ORM | MyBatis-Plus |
+
+### 2.2 鏋舵瀯鍥�
+
+```
+鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+鈹� 鍓嶇搴旂敤 鈹�
+鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+ 鈹�
+ 鈻�
+鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+鈹� Controller Layer 鈹�
+鈹� 鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹�
+鈹� 鈹� KnowledgeBaseCtrl 鈹� 鈹� KnowledgeChatController 鈹� 鈹�
+鈹� 鈹� (鐭ヨ瘑搴撶鐞�) 鈹� 鈹� (鐭ヨ瘑搴撻棶绛�) 鈹� 鈹�
+鈹� 鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹�
+鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+ 鈹�
+ 鈻�
+鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+鈹� Service Layer 鈹�
+鈹� 鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹�
+鈹� 鈹侹nowledgeBaseService 鈹� 鈹� KnowledgeRagService 鈹� 鈹�
+鈹� 鈹� (鐭ヨ瘑搴揅RUD) 鈹� 鈹� (鍚戦噺鍖�/妫�绱�) 鈹� 鈹�
+鈹� 鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹�
+鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+ 鈹�
+ 鈻�
+鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+鈹� AI Layer 鈹�
+鈹� 鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹屸攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹�
+鈹� 鈹� KnowledgeChatAgent 鈹� 鈹� EmbeddingStore (Pinecone) 鈹� 鈹�
+鈹� 鈹� (闂瓟Agent) 鈹� 鈹� (鍚戦噺瀛樺偍) 鈹� 鈹�
+鈹� 鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹� 鈹�
+鈹斺攢鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�
+```
+
+---
+
+## 涓夈�佸悗绔疄鐜�
+
+### 3.1 鏁版嵁搴撹璁�
+
+#### 3.1.1 鐭ヨ瘑搴撹〃锛坘nowledge_base锛�
+
+```sql
+CREATE TABLE knowledge_base (
+ id BIGINT AUTO_INCREMENT PRIMARY KEY,
+ title VARCHAR(255) COMMENT '鐭ヨ瘑鏍囬',
+ type VARCHAR(50) COMMENT '鐭ヨ瘑绫诲瀷',
+ scenario VARCHAR(255) COMMENT '閫傜敤鍦烘櫙',
+ efficiency VARCHAR(20) COMMENT '瑙e喅鏁堢巼',
+ problem TEXT COMMENT '闂鎻忚堪',
+ solution TEXT COMMENT '瑙e喅鏂规',
+ key_points TEXT COMMENT '鍏抽敭瑕佺偣',
+ creator VARCHAR(100) COMMENT '鍒涘缓浜�',
+ usage_count INT DEFAULT 0 COMMENT '浣跨敤娆℃暟',
+ file_count INT DEFAULT 0 COMMENT '鏂囦欢鏁伴噺',
+ total_chunk_count INT DEFAULT 0 COMMENT '鎬诲垏鐗囨暟閲�',
+ description VARCHAR(500) COMMENT '鐭ヨ瘑搴撴弿杩�',
+ create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
+ update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ create_user INT,
+ update_user INT,
+ tenant_id BIGINT,
+ dept_id BIGINT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='鐭ヨ瘑搴撹〃';
+```
+
+#### 3.1.2 鐭ヨ瘑搴撳悜閲忚褰曡〃锛坘nowledge_base_vector锛�
+
+```sql
+CREATE TABLE knowledge_base_vector (
+ id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '涓婚敭ID',
+ knowledge_base_id BIGINT NOT NULL COMMENT '鍏宠仈鐭ヨ瘑搴揑D',
+ storage_blob_id BIGINT NOT NULL COMMENT '鍏宠仈鏂囦欢blob ID',
+ file_name VARCHAR(255) NOT NULL COMMENT '鏂囦欢鍚嶇О',
+ file_type VARCHAR(50) NOT NULL COMMENT '鏂囦欢绫诲瀷',
+ vector_status TINYINT DEFAULT 0 COMMENT '鍚戦噺鍖栫姸鎬�: 0-寰呭鐞�, 1-澶勭悊涓�, 2-宸插畬鎴�, 3-澶辫触',
+ vector_error VARCHAR(500) COMMENT '鍚戦噺鍖栧け璐ュ師鍥�',
+ chunk_count INT DEFAULT 0 COMMENT '鍒囩墖鏁伴噺',
+ namespace VARCHAR(100) COMMENT '鍚戦噺鍛藉悕绌洪棿',
+ create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
+ create_user INT,
+ update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ update_user INT,
+ tenant_id BIGINT,
+ dept_id BIGINT,
+ INDEX idx_knowledge_base_id (knowledge_base_id),
+ INDEX idx_storage_blob_id (storage_blob_id),
+ INDEX idx_vector_status (vector_status)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='鐭ヨ瘑搴撴枃浠跺悜閲忚褰曡〃';
+```
+
+### 3.2 Maven渚濊禆
+
+```xml
+<!-- langchain4j BOM -->
+<dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>dev.langchain4j</groupId>
+ <artifactId>langchain4j-bom</artifactId>
+ <version>1.0.0-beta3</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+</dependencyManagement>
+
+<dependencies>
+ <!-- langchain4j 鏍稿績 -->
+ <dependency>
+ <groupId>dev.langchain4j</groupId>
+ <artifactId>langchain4j-spring-boot-starter</artifactId>
+ </dependency>
+
+ <!-- Pinecone 鍚戦噺鏁版嵁搴� -->
+ <dependency>
+ <groupId>dev.langchain4j</groupId>
+ <artifactId>langchain4j-pinecone</artifactId>
+ </dependency>
+
+ <!-- 闃块噷浜� DashScope -->
+ <dependency>
+ <groupId>dev.langchain4j</groupId>
+ <artifactId>langchain4j-community-dashscope-spring-boot-starter</artifactId>
+ </dependency>
+</dependencies>
+```
+
+### 3.3 閰嶇疆鏂囦欢锛坅pplication.yml锛�
+
+```yaml
+# Pinecone 鍚戦噺鏁版嵁搴撻厤缃�
+pinecone:
+ api-key: your-pinecone-api-key
+ index: your-index-name
+ namespace: knowledge-base
+
+# langchain4j 閰嶇疆
+langchain4j:
+ community:
+ dashscope:
+ streaming-chat-model:
+ api-key: your-dashscope-api-key
+ model-name: "qwen-max"
+ embedding-model:
+ api-key: your-dashscope-api-key
+ model-name: "text-embedding-v3"
+```
+
+### 3.4 鏍稿績浠g爜瀹炵幇
+
+#### 3.4.1 瀹炰綋绫�
+
+**KnowledgeBase.java**
+```java
+@Data
+@TableName("knowledge_base")
+public class KnowledgeBase implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+ private String title;
+ private String type;
+ private String scenario;
+ private String efficiency;
+ private String problem;
+ private String solution;
+ private String keyPoints;
+ private String creator;
+ private Integer usageCount;
+ private Integer fileCount;
+ private Integer totalChunkCount;
+ private String description;
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+ @TableField(fill = FieldFill.INSERT)
+ private Long tenantId;
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
+```
+
+**KnowledgeBaseVector.java**
+```java
+@Data
+@TableName("knowledge_base_vector")
+public class KnowledgeBaseVector implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+ private Long knowledgeBaseId;
+ private Long storageBlobId;
+ private String fileName;
+ private String fileType;
+ private Integer vectorStatus;
+ private String vectorError;
+ private Integer chunkCount;
+ private String namespace;
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+ @TableField(fill = FieldFill.INSERT)
+ private Long tenantId;
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ // 鍚戦噺鍖栫姸鎬佸父閲�
+ public static final int STATUS_PENDING = 0;
+ public static final int STATUS_PROCESSING = 1;
+ public static final int STATUS_COMPLETED = 2;
+ public static final int STATUS_FAILED = 3;
+}
+```
+
+#### 3.4.2 EmbeddingStore閰嶇疆
+
+**EmbeddingStoreConfig.java**
+```java
+@Configuration
+public class EmbeddingStoreConfig {
+
+ @Value("${pinecone.api-key}")
+ private String pineconeApiKey;
+
+ @Value("${pinecone.index}")
+ private String indexName;
+
+ @Value("${pinecone.namespace}")
+ private String namespace;
+
+ @Bean
+ public Pinecone pinecone() {
+ return new Pinecone.Builder(pineconeApiKey).build();
+ }
+
+ @Bean
+ public Index pineconeIndex(Pinecone pinecone) {
+ return pinecone.getIndexConnection(indexName);
+ }
+
+ @Bean
+ public EmbeddingStore<TextSegment> embeddingStore(EmbeddingModel embeddingModel) {
+ return PineconeEmbeddingStore.builder()
+ .apiKey(pineconeApiKey)
+ .index(indexName)
+ .nameSpace(namespace)
+ .createIndex(PineconeServerlessIndexConfig.builder()
+ .cloud("AWS")
+ .region("us-east-1")
+ .dimension(embeddingModel.dimension())
+ .build())
+ .build();
+ }
+}
+```
+
+#### 3.4.3 RAG鏈嶅姟瀹炵幇
+
+**KnowledgeRagService.java**
+```java
+public interface KnowledgeRagService {
+ void processVectorAsync(Long vectorId);
+ void processVector(Long vectorId);
+ List<String> searchRelevantContent(String namespace, String query, int maxResults);
+ void deleteEmbeddings(String namespace, Long storageBlobId);
+}
+```
+
+**KnowledgeRagServiceImpl.java**锛堟牳蹇冨疄鐜帮級
+```java
+@Slf4j
+@Service
+public class KnowledgeRagServiceImpl implements KnowledgeRagService {
+
+ private final KnowledgeBaseVectorService knowledgeBaseVectorService;
+ private final StorageBlobService storageBlobService;
+ private final EmbeddingModel embeddingModel;
+ private final EmbeddingStore<TextSegment> embeddingStore;
+ private final FileProperties fileProperties;
+ private final Index pineconeIndex;
+
+ @Value("${pinecone.namespace}")
+ private String namespace;
+
+ private static final int CHUNK_SIZE = 500;
+ private static final int CHUNK_OVERLAP = 100;
+ private static final long CHUNK_THRESHOLD_BYTES = 80L * 1024 * 1024;
+ private static final int EMBEDDING_MAX_LENGTH = 8000;
+
+ @Override
+ @Async("threadPoolTaskExecutor")
+ public void processVectorAsync(Long vectorId) {
+ processVector(vectorId);
+ }
+
+ @Override
+ public void processVector(Long vectorId) {
+ KnowledgeBaseVector vector = knowledgeBaseVectorService.getById(vectorId);
+ if (vector == null) return;
+
+ try {
+ // 鏇存柊鐘舵�佷负澶勭悊涓�
+ knowledgeBaseVectorService.updateVectorStatus(vectorId, STATUS_PROCESSING, null, null);
+
+ // 鑾峰彇鏂囦欢鍐呭
+ StorageBlob blob = storageBlobService.getById(vector.getStorageBlobId());
+ File file = getFile(blob);
+ String content = extractFileContent(file, vector.getFileName());
+
+ if (content == null || content.trim().isEmpty()) {
+ throw new RuntimeException("鏂囦欢鍐呭涓虹┖");
+ }
+
+ // 鏂囨湰鍒囩墖
+ List<TextSegment> chunks;
+ boolean needChunk = file.length() > CHUNK_THRESHOLD_BYTES || content.length() > EMBEDDING_MAX_LENGTH;
+ if (needChunk) {
+ chunks = splitText(content, vector);
+ } else {
+ Map<String, Object> metadata = buildMetadata(vector);
+ chunks = List.of(TextSegment.from(content, new Metadata(metadata)));
+ }
+
+ // 鐢熸垚宓屽叆鍚戦噺骞跺瓨鍌�
+ int chunkCount = 0;
+ for (TextSegment chunk : chunks) {
+ Embedding embedding = embeddingModel.embed(chunk).content();
+ embeddingStore.add(embedding, chunk);
+ chunkCount++;
+ }
+
+ // 鏇存柊鐘舵�佷负瀹屾垚
+ knowledgeBaseVectorService.updateVectorStatus(vectorId, STATUS_COMPLETED, chunkCount, null);
+
+ } catch (Exception e) {
+ log.error("鍚戦噺鍖栧鐞嗗け璐�", e);
+ knowledgeBaseVectorService.updateVectorStatus(vectorId, STATUS_FAILED, null, e.getMessage());
+ }
+ }
+
+ @Override
+ public List<String> searchRelevantContent(String namespace, String query, int maxResults) {
+ Embedding queryEmbedding = embeddingModel.embed(query).content();
+ EmbeddingSearchRequest searchRequest = EmbeddingSearchRequest.builder()
+ .queryEmbedding(queryEmbedding)
+ .maxResults(maxResults)
+ .minScore(0.7)
+ .build();
+ EmbeddingSearchResult<TextSegment> searchResult = embeddingStore.search(searchRequest);
+ return searchResult.matches().stream()
+ .map(match -> match.embedded().text())
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void deleteEmbeddings(String namespace, Long storageBlobId) {
+ Struct filter = Struct.newBuilder()
+ .putFields("storageBlobId", Value.newBuilder()
+ .setStructValue(Struct.newBuilder()
+ .putFields("$eq", Value.newBuilder()
+ .setNumberValue(storageBlobId.doubleValue())
+ .build()))
+ .build())
+ .build();
+ pineconeIndex.delete(new ArrayList<>(), false, this.namespace, filter);
+ }
+
+ private String extractFileContent(File file, String fileName) throws Exception {
+ String ext = getFileExtension(fileName);
+ if (isPlainText(ext)) {
+ return readFileWithEncoding(file);
+ }
+ if ("docx".equals(ext)) {
+ return extractDocx(file);
+ }
+ if ("xlsx".equals(ext) || "xls".equals(ext)) {
+ return extractExcel(file);
+ }
+ return readFileWithEncoding(file);
+ }
+
+ // ... 鍏朵粬杈呭姪鏂规硶
+}
+```
+
+#### 3.4.4 鐭ヨ瘑搴撻棶绛擜gent
+
+**KnowledgeChatAgent.java**
+```java
+@AiService(
+ wiringMode = EXPLICIT,
+ streamingChatModel = "qwenStreamingChatModel",
+ chatMemoryProvider = "chatMemoryProvider"
+)
+public interface KnowledgeChatAgent {
+
+ @SystemMessage("""
+ 浣犳槸浼佷笟鐭ヨ瘑搴撻棶绛斿姪鎵嬨��
+ 浣犻渶瑕佸熀浜庢彁渚涚殑鐭ヨ瘑搴撳唴瀹瑰洖绛旂敤鎴烽棶棰樸��
+ 閬靛惊浠ヤ笅瑙勫垯锛�
+ 1. 涓ユ牸鍩轰簬鐭ヨ瘑搴撳唴瀹瑰洖绛旓紝涓嶈缂栭�犱俊鎭�
+ 2. 濡傛灉鐭ヨ瘑搴撲腑娌℃湁鐩稿叧淇℃伅锛屾槑纭憡鐭ョ敤鎴�
+ 3. 鍥炵瓟瑕佸噯纭�佺畝娲併�佹湁鏉$悊
+ 4. 寮曠敤鏉ユ簮鏃舵敞鏄�"鏍规嵁鐭ヨ瘑搴撳唴瀹�"
+ """)
+ Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage);
+}
+```
+
+#### 3.4.5 Controller灞�
+
+**KnowledgeBaseController.java**
+```java
+@RestController
+@RequestMapping("/knowledgeBase")
+@Tag(name = "鐭ヨ瘑搴撶鐞�")
+public class KnowledgeBaseController {
+
+ @GetMapping("/getList")
+ public AjaxResult getList(@RequestParam(defaultValue = "1") long current,
+ @RequestParam(defaultValue = "10") long size,
+ KnowledgeBase knowledgeBase) {
+ Page page = new Page(current, size);
+ return AjaxResult.success(knowledgeBaseService.listpage(page, knowledgeBase));
+ }
+
+ @PostMapping("/add")
+ public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase) {
+ return AjaxResult.success(knowledgeBaseService.save(knowledgeBase));
+ }
+
+ @PostMapping("/update")
+ public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase) {
+ return AjaxResult.success(knowledgeBaseService.updateById(knowledgeBase));
+ }
+
+ @DeleteMapping("/delete")
+ public AjaxResult delete(@RequestBody List<Long> ids) {
+ return AjaxResult.success(knowledgeBaseService.removeByIds(ids));
+ }
+
+ @GetMapping("/vector/status/{knowledgeBaseId}")
+ @Operation(summary = "鏌ヨ鐭ヨ瘑搴撴枃浠跺悜閲忓寲鐘舵��")
+ public AjaxResult getVectorStatus(@PathVariable Long knowledgeBaseId) {
+ return AjaxResult.success(knowledgeBaseVectorService.getVectorStatusByKnowledgeBaseId(knowledgeBaseId));
+ }
+
+ @PostMapping("/vector/reprocess/{vectorId}")
+ @Operation(summary = "閲嶆柊鍚戦噺鍖栨枃浠�")
+ public AjaxResult reprocessVector(@PathVariable Long vectorId) {
+ knowledgeBaseVectorService.reprocessVector(vectorId);
+ return AjaxResult.success("宸查噸鏂版彁浜ゅ悜閲忓寲浠诲姟");
+ }
+
+ @PostMapping("/file/save")
+ @Operation(summary = "淇濆瓨鐭ヨ瘑搴撴枃浠跺叧鑱�")
+ public AjaxResult saveKnowledgeBaseFiles(@RequestBody KnowledgeBaseFileDTO dto) {
+ // 淇濆瓨闄勪欢鍏宠仈骞惰Е鍙戝悜閲忓寲
+ // ...
+ }
+
+ @DeleteMapping("/file/delete")
+ @Operation(summary = "鍒犻櫎鐭ヨ瘑搴撴枃浠�")
+ public AjaxResult deleteKnowledgeBaseFiles(@RequestBody List<Long> vectorIds) {
+ knowledgeBaseVectorService.deleteVectors(vectorIds);
+ return AjaxResult.success();
+ }
+}
+```
+
+**KnowledgeChatController.java**
+```java
+@RestController
+@RequestMapping("/ai/knowledge")
+@Tag(name = "鐭ヨ瘑搴撻棶绛�")
+public class KnowledgeChatController {
+
+ private final KnowledgeChatAgent knowledgeChatAgent;
+ private final KnowledgeRagService knowledgeRagService;
+ private final KnowledgeBaseService knowledgeBaseService;
+
+ @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
+ @Operation(summary = "鐭ヨ瘑搴撻棶绛�")
+ public Flux<String> chat(@RequestBody KnowledgeChatRequest request) {
+ // 妫�绱㈢浉鍏冲唴瀹�
+ String namespace = "kb-" + request.getKnowledgeBaseId();
+ List<String> relevantContents = knowledgeRagService.searchRelevantContent(
+ namespace, request.getQuestion(), 5);
+
+ if (relevantContents.isEmpty()) {
+ return Flux.just("鐭ヨ瘑搴撲腑鏈壘鍒扮浉鍏冲唴瀹�");
+ }
+
+ // 鏋勫缓涓婁笅鏂�
+ StringBuilder context = new StringBuilder();
+ context.append("浠ヤ笅鏄粠鐭ヨ瘑搴撲腑妫�绱㈠埌鐨勭浉鍏冲唴瀹癸細\n\n");
+ for (int i = 0; i < relevantContents.size(); i++) {
+ context.append("銆愬唴瀹�").append(i + 1).append("銆慭n");
+ context.append(relevantContents.get(i)).append("\n\n");
+ }
+ context.append("---\n璇峰熀浜庝互涓婄煡璇嗗簱鍐呭鍥炵瓟锛歕n").append(request.getQuestion());
+
+ return knowledgeChatAgent.chat(request.getMemoryId(), context.toString());
+ }
+
+ @GetMapping("/list")
+ @Operation(summary = "鐭ヨ瘑搴撳垪琛�")
+ public AjaxResult listKnowledgeBases() {
+ return AjaxResult.success(knowledgeBaseService.list());
+ }
+}
+```
+
+---
+
+## 鍥涖�丄PI鎺ュ彛鏂囨。
+
+### 4.1 鐭ヨ瘑搴撶鐞嗘帴鍙�
+
+| 鎺ュ彛 | 鏂规硶 | 璺緞 | 璇存槑 |
+|------|------|------|------|
+| 鑾峰彇鍒楄〃 | GET | /knowledgeBase/getList | 鍒嗛〉鏌ヨ鐭ヨ瘑搴撳垪琛� |
+| 鏂板鐭ヨ瘑搴� | POST | /knowledgeBase/add | 鍒涘缓鐭ヨ瘑搴� |
+| 鏇存柊鐭ヨ瘑搴� | POST | /knowledgeBase/update | 鏇存柊鐭ヨ瘑搴撲俊鎭� |
+| 鍒犻櫎鐭ヨ瘑搴� | DELETE | /knowledgeBase/delete | 鎵归噺鍒犻櫎鐭ヨ瘑搴� |
+| 鏌ヨ鍚戦噺鍖栫姸鎬� | GET | /knowledgeBase/vector/status/{id} | 鏌ヨ鏂囦欢鍚戦噺鍖栫姸鎬� |
+| 閲嶆柊鍚戦噺鍖� | POST | /knowledgeBase/vector/reprocess/{id} | 閲嶆柊澶勭悊澶辫触鐨勬枃浠� |
+| 淇濆瓨鏂囦欢鍏宠仈 | POST | /knowledgeBase/file/save | 涓婁紶鏂囦欢鍚庡叧鑱斿埌鐭ヨ瘑搴� |
+| 鍒犻櫎鏂囦欢 | DELETE | /knowledgeBase/file/delete | 鍒犻櫎鐭ヨ瘑搴撴枃浠� |
+
+### 4.2 鐭ヨ瘑搴撻棶绛旀帴鍙�
+
+| 鎺ュ彛 | 鏂规硶 | 璺緞 | 璇存槑 |
+|------|------|------|------|
+| 鐭ヨ瘑搴撻棶绛� | POST | /ai/knowledge/chat | 娴佸紡杩斿洖闂瓟缁撴灉 |
+| 鐭ヨ瘑搴撳垪琛� | GET | /ai/knowledge/list | 鑾峰彇鍙�夌煡璇嗗簱鍒楄〃 |
+
+### 4.3 鎺ュ彛璇︾粏璇存槑
+
+#### 4.3.1 淇濆瓨鐭ヨ瘑搴撴枃浠跺叧鑱�
+
+**璇锋眰**
+```json
+POST /knowledgeBase/file/save
+{
+ "knowledgeBaseId": 1,
+ "storageBlobIds": [100, 101, 102]
+}
+```
+
+**鍝嶅簲**
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛"
+}
+```
+
+#### 4.3.2 鐭ヨ瘑搴撻棶绛�
+
+**璇锋眰**
+```json
+POST /ai/knowledge/chat
+Content-Type: application/json
+
+{
+ "knowledgeBaseId": 1,
+ "memoryId": "session-uuid",
+ "question": "濡備綍澶勭悊搴撳瓨鐩樼偣宸紓锛�"
+}
+```
+
+**鍝嶅簲**锛圫SE娴佸紡锛�
+```
+鏍规嵁鐭ヨ瘑搴撳唴瀹癸紝搴撳瓨鐩樼偣宸紓鐨勫鐞嗘祦绋嬪涓嬶細
+
+1. 鍙戠幇宸紓鍚庯紝棣栧厛鏍稿鐩樼偣璁板綍...
+2. 妫�鏌ユ槸鍚︽湁婕忕洏鎴栭敊鐩�...
+3. ...
+```
+
+---
+
+## 浜斻�佸墠绔疄鐜�
+
+### 5.1 鐭ヨ瘑搴撶鐞嗛〉闈�
+
+```vue
+<template>
+ <div class="knowledge-base">
+ <!-- 鍒楄〃 -->
+ <el-table :data="tableData" border>
+ <el-table-column prop="title" label="鐭ヨ瘑鏍囬" />
+ <el-table-column prop="type" label="鐭ヨ瘑绫诲瀷" />
+ <el-table-column prop="fileCount" label="鏂囦欢鏁伴噺" />
+ <el-table-column prop="totalChunkCount" label="鍒囩墖鏁伴噺" />
+ <el-table-column label="鎿嶄綔">
+ <template #default="{ row }">
+ <el-button @click="handleEdit(row)">缂栬緫</el-button>
+ <el-button @click="handleFiles(row)">鏂囦欢绠$悊</el-button>
+ <el-button @click="handleChat(row)">闂瓟</el-button>
+ <el-button type="danger" @click="handleDelete(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue'
+import { getKnowledgeBaseList, deleteKnowledgeBase } from '@/api/knowledge'
+
+const tableData = ref([])
+
+const loadData = async () => {
+ const res = await getKnowledgeBaseList({ current: 1, size: 10 })
+ tableData.value = res.data.records
+}
+
+onMounted(loadData)
+</script>
+```
+
+### 5.2 鏂囦欢涓婁紶涓庡悜閲忓寲鐘舵��
+
+```vue
+<template>
+ <div class="file-manager">
+ <!-- 鏂囦欢涓婁紶 -->
+ <el-upload
+ :action="uploadUrl"
+ :on-success="handleUploadSuccess"
+ multiple
+ >
+ <el-button type="primary">涓婁紶鏂囦欢</el-button>
+ </el-upload>
+
+ <!-- 鏂囦欢鍒楄〃涓庡悜閲忓寲鐘舵�� -->
+ <el-table :data="fileList">
+ <el-table-column prop="fileName" label="鏂囦欢鍚�" />
+ <el-table-column label="鍚戦噺鍖栫姸鎬�">
+ <template #default="{ row }">
+ <el-tag :type="getStatusType(row.vectorStatus)">
+ {{ getStatusText(row.vectorStatus) }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="chunkCount" label="鍒囩墖鏁�" />
+ <el-table-column label="鎿嶄綔">
+ <template #default="{ row }">
+ <el-button v-if="row.vectorStatus === 3" @click="reprocess(row)">
+ 閲嶆柊澶勭悊
+ </el-button>
+ <el-button type="danger" @click="deleteFile(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+</template>
+
+<script setup>
+const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/common/upload'
+
+// 涓婁紶鎴愬姛鍚庝繚瀛樺叧鑱�
+const uploadedBlobIds = ref([])
+
+const handleUploadSuccess = (response, file) => {
+ if (response.code === 200) {
+ uploadedBlobIds.value.push(response.data.id)
+ }
+}
+
+// 淇濆瓨鏂囦欢鍏宠仈
+const saveFiles = async () => {
+ await saveKnowledgeBaseFiles({
+ knowledgeBaseId: props.knowledgeBaseId,
+ storageBlobIds: uploadedBlobIds.value
+ })
+ // 鍒锋柊鏂囦欢鍒楄〃
+ loadFileList()
+}
+
+// 鐘舵�佹枃鏈槧灏�
+const getStatusText = (status) => {
+ const map = {
+ 0: '寰呭鐞�',
+ 1: '澶勭悊涓�',
+ 2: '宸插畬鎴�',
+ 3: '澶辫触'
+ }
+ return map[status] || '鏈煡'
+}
+
+const getStatusType = (status) => {
+ const map = {
+ 0: 'info',
+ 1: 'warning',
+ 2: 'success',
+ 3: 'danger'
+ }
+ return map[status] || 'info'
+}
+</script>
+```
+
+### 5.3 鐭ヨ瘑搴撻棶绛旂晫闈�
+
+```vue
+<template>
+ <div class="knowledge-chat">
+ <!-- 鐭ヨ瘑搴撻�夋嫨 -->
+ <el-select v-model="selectedKbId" placeholder="閫夋嫨鐭ヨ瘑搴�">
+ <el-option
+ v-for="kb in knowledgeBases"
+ :key="kb.id"
+ :label="kb.title"
+ :value="kb.id"
+ />
+ </el-select>
+
+ <!-- 瀵硅瘽鍖哄煙 -->
+ <div class="chat-messages">
+ <div
+ v-for="(msg, index) in messages"
+ :key="index"
+ :class="['message', msg.role]"
+ >
+ <div class="content">{{ msg.content }}</div>
+ </div>
+ </div>
+
+ <!-- 杈撳叆妗� -->
+ <el-input
+ v-model="inputQuestion"
+ placeholder="璇疯緭鍏ラ棶棰�"
+ @keyup.enter="sendMessage"
+ >
+ <template #append>
+ <el-button @click="sendMessage" :loading="loading">鍙戦��</el-button>
+ </template>
+ </el-input>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue'
+import { getKnowledgeBaseList, knowledgeChat } from '@/api/knowledge'
+
+const knowledgeBases = ref([])
+const selectedKbId = ref(null)
+const messages = ref([])
+const inputQuestion = ref('')
+const loading = ref(false)
+const memoryId = ref(crypto.randomUUID())
+
+const sendMessage = async () => {
+ if (!inputQuestion.value.trim()) return
+ if (!selectedKbId.value) {
+ ElMessage.warning('璇烽�夋嫨鐭ヨ瘑搴�')
+ return
+ }
+
+ // 娣诲姞鐢ㄦ埛娑堟伅
+ messages.value.push({
+ role: 'user',
+ content: inputQuestion.value
+ })
+
+ loading.value = true
+
+ try {
+ // 娴佸紡璇锋眰
+ const response = await fetch('/api/ai/knowledge/chat', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ knowledgeBaseId: selectedKbId.value,
+ memoryId: memoryId.value,
+ question: inputQuestion.value
+ })
+ })
+
+ // 澶勭悊SSE娴佸紡鍝嶅簲
+ const reader = response.body.getReader()
+ const decoder = new TextDecoder()
+ let aiContent = ''
+
+ messages.value.push({ role: 'assistant', content: '' })
+
+ while (true) {
+ const { done, value } = await reader.read()
+ if (done) break
+
+ const text = decoder.decode(value)
+ aiContent += text
+ messages.value[messages.value.length - 1].content = aiContent
+ }
+ } finally {
+ loading.value = false
+ inputQuestion.value = ''
+ }
+}
+
+onMounted(async () => {
+ const res = await getKnowledgeBaseList()
+ knowledgeBases.value = res.data
+})
+</script>
+```
+
+### 5.4 API灏佽
+
+```javascript
+// api/knowledge.js
+import request from '@/utils/request'
+
+// 鑾峰彇鐭ヨ瘑搴撳垪琛�
+export function getKnowledgeBaseList(params) {
+ return request({
+ url: '/knowledgeBase/getList',
+ method: 'get',
+ params
+ })
+}
+
+// 鏂板鐭ヨ瘑搴�
+export function addKnowledgeBase(data) {
+ return request({
+ url: '/knowledgeBase/add',
+ method: 'post',
+ data
+ })
+}
+
+// 鏇存柊鐭ヨ瘑搴�
+export function updateKnowledgeBase(data) {
+ return request({
+ url: '/knowledgeBase/update',
+ method: 'post',
+ data
+ })
+}
+
+// 鍒犻櫎鐭ヨ瘑搴�
+export function deleteKnowledgeBase(ids) {
+ return request({
+ url: '/knowledgeBase/delete',
+ method: 'delete',
+ data: ids
+ })
+}
+
+// 鑾峰彇鏂囦欢鍚戦噺鍖栫姸鎬�
+export function getVectorStatus(knowledgeBaseId) {
+ return request({
+ url: `/knowledgeBase/vector/status/${knowledgeBaseId}`,
+ method: 'get'
+ })
+}
+
+// 閲嶆柊鍚戦噺鍖�
+export function reprocessVector(vectorId) {
+ return request({
+ url: `/knowledgeBase/vector/reprocess/${vectorId}`,
+ method: 'post'
+ })
+}
+
+// 淇濆瓨鏂囦欢鍏宠仈
+export function saveKnowledgeBaseFiles(data) {
+ return request({
+ url: '/knowledgeBase/file/save',
+ method: 'post',
+ data
+ })
+}
+
+// 鍒犻櫎鏂囦欢
+export function deleteKnowledgeBaseFiles(vectorIds) {
+ return request({
+ url: '/knowledgeBase/file/delete',
+ method: 'delete',
+ data: vectorIds
+ })
+}
+
+// 鐭ヨ瘑搴撻棶绛旓紙娴佸紡锛�
+export async function knowledgeChat(data) {
+ const response = await fetch('/api/ai/knowledge/chat', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(data)
+ })
+ return response.body
+}
+
+// 鑾峰彇鐭ヨ瘑搴撳垪琛紙闂瓟鐢級
+export function getKnowledgeBaseListForChat() {
+ return request({
+ url: '/ai/knowledge/list',
+ method: 'get'
+ })
+}
+```
+
+---
+
+## 鍏�佹牳蹇冩祦绋�
+
+### 6.1 鏂囦欢涓婁紶涓庡悜閲忓寲娴佺▼
+
+```
+1. 鍓嶇璋冪敤 /common/upload 涓婁紶鏂囦欢 鈫� 杩斿洖 storageBlobId
+2. 鍓嶇璋冪敤 /knowledgeBase/file/save 鍏宠仈鏂囦欢鍒扮煡璇嗗簱
+3. 鍚庣鍒涘缓 KnowledgeBaseVector 璁板綍锛堢姸鎬侊細寰呭鐞嗭級
+4. 鍚庣寮傛璋冪敤 KnowledgeRagService.processVectorAsync()
+ 鈹溾攢鈹� 鏇存柊鐘舵�佷负"澶勭悊涓�"
+ 鈹溾攢鈹� 鎻愬彇鏂囦欢鍐呭锛堟敮鎸佸绉嶆牸寮忥級
+ 鈹溾攢鈹� 鑷姩妫�娴嬫枃浠剁紪鐮侊紙UTF-8/GBK锛�
+ 鈹溾攢鈹� 鏂囨湰鍒囩墖锛堝ぇ鏂囦欢鎴栭暱鍐呭鎵嶅垏鐗囷級
+ 鈹溾攢鈹� 鐢熸垚 Embedding 鍚戦噺
+ 鈹溾攢鈹� 瀛樺偍鍒� Pinecone
+ 鈹斺攢鈹� 鏇存柊鐘舵�佷负"瀹屾垚"鎴�"澶辫触"
+```
+
+### 6.2 鐭ヨ瘑搴撻棶绛旀祦绋�
+
+```
+1. 鐢ㄦ埛閫夋嫨鐭ヨ瘑搴擄紝杈撳叆闂
+2. 鍓嶇璋冪敤 /ai/knowledge/chat锛堟祦寮忔帴鍙o級
+3. 鍚庣澶勭悊锛�
+ 鈹溾攢鈹� 鏋勫缓鍛藉悕绌洪棿锛歬b-{knowledgeBaseId}
+ 鈹溾攢鈹� 璋冪敤 Embedding 妯″瀷鐢熸垚闂鍚戦噺
+ 鈹溾攢鈹� 浠� Pinecone 妫�绱㈢浉鍏冲唴瀹癸紙minScore=0.7, maxResults=5锛�
+ 鈹溾攢鈹� 鏋勫缓涓婁笅鏂� Prompt
+ 鈹溾攢鈹� 璋冪敤 LLM 鐢熸垚鍥炵瓟
+ 鈹斺攢鈹� 娴佸紡杩斿洖缁撴灉
+```
+
+---
+
+## 涓冦�佹敞鎰忎簨椤�
+
+1. **Pinecone 鍛藉悕绌洪棿**锛氫笉鑳戒娇鐢� `__default__`锛屽繀椤讳娇鐢ㄨ嚜瀹氫箟鍛藉悕绌洪棿
+2. **鏂囦欢缂栫爜**锛氳嚜鍔ㄦ娴� UTF-8/GBK锛岄伩鍏嶄贡鐮�
+3. **鍒囩墖绛栫暐**锛�
+ - 鏂囦欢 > 80MB 鎴栧唴瀹� > 8000 瀛楃鏃舵墠鍒囩墖
+ - 鍒囩墖澶у皬 500 瀛楃锛岄噸鍙� 100 瀛楃
+ - 浼樺厛鍦ㄥ彞瀛愯竟鐣屽垏鍒�
+4. **Embedding 闄愬埗**锛氶樋閲屼簯 DashScope 闄愬埗鍗曟杈撳叆鏈�澶� 8192 瀛楃
+5. **鍚戦噺鍒犻櫎**锛氫娇鐢� Pinecone 鍘熺敓瀹㈡埛绔紝閫氳繃 metadata filter 鍒犻櫎
+6. **寮傛澶勭悊**锛氬悜閲忓寲浣跨敤 `@Async` 寮傛鎵ц锛岄伩鍏嶉樆濉炴帴鍙�
+
+---
+
+## 鍏�佹枃浠舵竻鍗�
+
+### 鍚庣鏂囦欢
+```
+src/main/java/com/ruoyi/
+鈹溾攢鈹� approve/
+鈹� 鈹溾攢鈹� controller/
+鈹� 鈹� 鈹斺攢鈹� KnowledgeBaseController.java
+鈹� 鈹溾攢鈹� pojo/
+鈹� 鈹� 鈹溾攢鈹� KnowledgeBase.java
+鈹� 鈹� 鈹斺攢鈹� KnowledgeBaseVector.java
+鈹� 鈹溾攢鈹� service/
+鈹� 鈹� 鈹溾攢鈹� KnowledgeBaseService.java
+鈹� 鈹� 鈹溾攢鈹� KnowledgeBaseVectorService.java
+鈹� 鈹� 鈹斺攢鈹� impl/
+鈹� 鈹� 鈹溾攢鈹� KnowledgeBaseServiceImpl.java
+鈹� 鈹� 鈹斺攢鈹� KnowledgeBaseVectorServiceImpl.java
+鈹� 鈹溾攢鈹� mapper/
+鈹� 鈹� 鈹溾攢鈹� KnowledgeBaseMapper.java
+鈹� 鈹� 鈹斺攢鈹� KnowledgeBaseVectorMapper.java
+鈹� 鈹斺攢鈹� dto/
+鈹� 鈹斺攢鈹� KnowledgeBaseVectorVO.java
+鈹斺攢鈹� ai/
+ 鈹溾攢鈹� config/
+ 鈹� 鈹溾攢鈹� EmbeddingStoreConfig.java
+ 鈹� 鈹斺攢鈹� XiaozhiAgentConfig.java
+ 鈹溾攢鈹� controller/
+ 鈹� 鈹斺攢鈹� KnowledgeChatController.java
+ 鈹溾攢鈹� assistant/
+ 鈹� 鈹斺攢鈹� KnowledgeChatAgent.java
+ 鈹溾攢鈹� service/
+ 鈹� 鈹溾攢鈹� KnowledgeRagService.java
+ 鈹� 鈹斺攢鈹� impl/
+ 鈹� 鈹斺攢鈹� KnowledgeRagServiceImpl.java
+ 鈹斺攢鈹� dto/
+ 鈹斺攢鈹� KnowledgeChatRequest.java
+```
+
+### 鍓嶇鏂囦欢
+```
+src/views/knowledge/
+鈹溾攢鈹� index.vue # 鐭ヨ瘑搴撳垪琛�
+鈹溾攢鈹� form.vue # 鏂板/缂栬緫琛ㄥ崟
+鈹溾攢鈹� files.vue # 鏂囦欢绠$悊
+鈹斺攢鈹� chat.vue # 鐭ヨ瘑搴撻棶绛�
+
+src/api/knowledge.js # API灏佽
+```
\ No newline at end of file
diff --git a/docs/mock_data_check.md b/docs/mock_data_check.md
new file mode 100644
index 0000000..8c67159
--- /dev/null
+++ b/docs/mock_data_check.md
@@ -0,0 +1,183 @@
+# 鏁版嵁妯℃嫙 - 鍩虹鏁版嵁妫�娴�
+
+## 娑夊強椤甸潰
+
+- 鏁版嵁妯℃嫙鎿嶄綔椤甸潰锛堟柊澧烇級
+
+## API
+
+| 鏂规硶 | 璺緞 | 璇存槑 |
+|------|------|------|
+| POST | /mock/dataCheck | 妫�娴嬫寚瀹氭ā鍧楃殑鍩虹鏁版嵁鏄惁灏辩华 |
+
+**璇锋眰鍙傛暟锛�**
+
+| 鍙傛暟 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|------|------|------|------|
+| modules | List\<String\> | 鏄� | 瑕佹娴嬬殑妯″潡鍒楄〃锛屽彲閫夊�硷細sales锛堥攢鍞級銆乸urchase锛堥噰璐級銆乹uality锛堣川閲忥級銆乸roduction锛堢敓浜э級 |
+
+璇锋眰浣撶ず渚嬶細
+```json
+{ "modules": ["sales", "purchase", "quality", "production"] }
+```
+
+**鍝嶅簲锛�**
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": {
+ "totalItems": 6,
+ "passedItems": 3,
+ "items": [
+ {
+ "module": "common",
+ "itemName": "浜у搧鏁版嵁",
+ "minRequired": 1,
+ "currentCount": 5,
+ "passed": true,
+ "message": "閫氳繃"
+ },
+ {
+ "module": "sales",
+ "itemName": "瀹㈡埛鏁版嵁",
+ "minRequired": 1,
+ "currentCount": 0,
+ "passed": false,
+ "message": "缂哄皯瀹㈡埛鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-瀹㈡埛绠$悊銆戜腑娣诲姞鑷冲皯1鏉″鎴�"
+ }
+ ]
+ }
+}
+```
+
+## 妫�娴嬭鍒�
+
+### 閿�鍞ā鍧� (sales)
+| 妫�娴嬮」 | 鏈�浣庢暟閲� | 鏈�氳繃鎻愮ず |
+|--------|----------|------------|
+| 浜у搧鏁版嵁 | 1 | 缂哄皯浜у搧鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-浜у搧绠$悊銆戜腑娣诲姞鑷冲皯1鏉′骇鍝� |
+| 瀹㈡埛鏁版嵁 | 1 | 缂哄皯瀹㈡埛鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-瀹㈡埛绠$悊銆戜腑娣诲姞鑷冲皯1鏉″鎴� |
+| 鎶ヤ环瀹℃壒妯℃澘 | 1 | 缂哄皯鎶ヤ环瀹℃壒妯℃澘锛岃鍏堝湪銆愮郴缁熺鐞�-瀹℃壒妯℃澘銆戜腑鍒涘缓鎶ヤ环瀹℃壒妯℃澘 |
+| 鍙戣揣瀹℃壒妯℃澘 | 1 | 缂哄皯鍙戣揣瀹℃壒妯℃澘锛岃鍏堝湪銆愮郴缁熺鐞�-瀹℃壒妯℃澘銆戜腑鍒涘缓鍙戣揣瀹℃壒妯℃澘 |
+
+### 閲囪喘妯″潡 (purchase)
+| 妫�娴嬮」 | 鏈�浣庢暟閲� | 鏈�氳繃鎻愮ず |
+|--------|----------|------------|
+| 浜у搧鏁版嵁 | 1 | 缂哄皯浜у搧鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-浜у搧绠$悊銆戜腑娣诲姞鑷冲皯1鏉′骇鍝� |
+| 渚涘簲鍟嗘暟鎹� | 1 | 缂哄皯渚涘簲鍟嗘暟鎹紝璇峰厛鍦ㄣ�愬熀纭�鏁版嵁-渚涘簲鍟嗙鐞嗐�戜腑娣诲姞鑷冲皯1鏉′緵搴斿晢 |
+| 閲囪喘瀹℃壒妯℃澘 | 1 | 缂哄皯閲囪喘瀹℃壒妯℃澘锛岃鍏堝湪銆愮郴缁熺鐞�-瀹℃壒妯℃澘銆戜腑鍒涘缓閲囪喘瀹℃壒妯℃澘 |
+
+### 鐢熶骇妯″潡 (production)
+| 妫�娴嬮」 | 鏈�浣庢暟閲� | 鏈�氳繃鎻愮ず |
+|--------|----------|------------|
+| 浜у搧鏁版嵁 | 1 | 缂哄皯浜у搧鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-浜у搧绠$悊銆戜腑娣诲姞鑷冲皯1鏉′骇鍝� |
+| 浜у搧瑙勬牸 | 1 | 缂哄皯浜у搧瑙勬牸锛岃鍏堝湪銆愬熀纭�鏁版嵁-浜у搧绠$悊銆戜腑涓轰骇鍝佹坊鍔犺鏍煎瀷鍙� |
+| 宸ュ簭 | 1 | 缂哄皯宸ュ簭锛岃鍏堝湪銆愬伐鑹鸿璁�-宸ュ簭绠$悊銆戜腑鍒涘缓宸ュ簭 |
+| BOM | 1 | 缂哄皯BOM锛岃鍏堝湪銆愬伐鑹鸿璁�-BOM绠$悊銆戜腑鍒涘缓BOM |
+| BOM浜у搧缁撴瀯 | 1 | 缂哄皯BOM浜у搧缁撴瀯锛岃鍏堝湪銆愬伐鑹鸿璁�-BOM绠$悊銆戜腑涓築OM娣诲姞浜у搧缁撴瀯鑺傜偣 |
+| 宸ヨ壓璺嚎 | 1 | 缂哄皯宸ヨ壓璺嚎锛岃鍏堝湪銆愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑鍒涘缓宸ヨ壓璺嚎 |
+| 宸ヨ壓璺嚎宸ュ簭 | 1 | 缂哄皯宸ヨ壓璺嚎宸ュ簭锛岃鍏堝湪銆愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑涓哄伐鑹鸿矾绾挎坊鍔犲伐搴� |
+| 浜у搧-宸ヨ壓璺嚎鍏宠仈 | 鈮�1 | 閮ㄥ垎浜у搧瑙勬牸鏈叧鑱斿伐鑹鸿矾绾匡紝璇峰厛鍦ㄣ�愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑涓轰骇鍝佽鏍煎垱寤哄伐鑹鸿矾绾� |
+| 宸ヨ壓璺嚎-宸ュ簭鍏宠仈 | 鈮�1 | 閮ㄥ垎宸ヨ壓璺嚎鏈坊鍔犲伐搴忥紝璇峰厛鍦ㄣ�愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑涓哄伐鑹鸿矾绾挎坊鍔犲伐搴� |
+| BOM-浜у搧缁撴瀯鍏宠仈 | 鈮�1 | 閮ㄥ垎BOM鏈坊鍔犱骇鍝佺粨鏋勶紝璇峰厛鍦ㄣ�愬伐鑹鸿璁�-BOM绠$悊銆戜腑涓築OM娣诲姞浜у搧缁撴瀯鑺傜偣 |
+
+### 璐ㄩ噺妯″潡 (quality)
+| 妫�娴嬮」 | 鏈�浣庢暟閲� | 鏈�氳繃鎻愮ず |
+|--------|----------|------------|
+| 浜у搧鏁版嵁 | 1 | 缂哄皯浜у搧鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-浜у搧绠$悊銆戜腑娣诲姞鑷冲皯1鏉′骇鍝� |
+| 妫�娴嬫爣鍑� | 1 | 缂哄皯妫�娴嬫爣鍑嗭紝璇峰厛鍦ㄣ�愯川閲忕鐞�-妫�娴嬫爣鍑嗐�戜腑鍒涘缓妫�娴嬫爣鍑� |
+| 鎸囨爣缁戝畾 | 1 | 缂哄皯鎸囨爣缁戝畾锛岃鍏堝湪銆愯川閲忕鐞�-妫�娴嬫爣鍑嗙粦瀹氥�戜腑灏嗘娴嬫爣鍑嗕笌浜у搧缁戝畾 |
+
+## 鍓嶇淇敼鐐�
+
+### 1. 鏁版嵁妯℃嫙椤甸潰鍏ュ彛
+
+鍦ㄥ乏渚ц彍鍗曟柊澧�"鏁版嵁妯℃嫙"鑿滃崟椤癸紝璺敱 `/mock`銆�
+
+### 2. 鏁版嵁妫�娴嬪尯鍩�
+
+```html
+<template>
+ <div class="mock-container">
+ <el-card header="鍩虹鏁版嵁妫�娴�">
+ <el-checkbox-group v-model="selectedModules">
+ <el-checkbox label="sales">閿�鍞ā鍧�</el-checkbox>
+ <el-checkbox label="purchase">閲囪喘妯″潡</el-checkbox>
+ <el-checkbox label="quality">璐ㄩ噺妯″潡</el-checkbox>
+ <el-checkbox label="production">鐢熶骇妯″潡</el-checkbox>
+ </el-checkbox-group>
+ <el-button type="primary" @click="handleCheck" :loading="checking">
+ 寮�濮嬫娴�
+ </el-button>
+ </el-card>
+
+ <el-card v-if="checkResult" header="妫�娴嬬粨鏋�" style="margin-top: 16px">
+ <el-alert
+ :title="`閫氳繃 ${checkResult.passedItems} / ${checkResult.totalItems} 椤筦"
+ :type="checkResult.passedItems === checkResult.totalItems ? 'success' : 'warning'"
+ :closable="false"
+ show-icon
+ />
+ <el-table :data="checkResult.items" style="margin-top: 12px">
+ <el-table-column prop="module" label="妯″潡" width="100" />
+ <el-table-column prop="itemName" label="妫�娴嬮」" width="160" />
+ <el-table-column prop="minRequired" label="鏈�浣庤姹�" width="80" />
+ <el-table-column prop="currentCount" label="褰撳墠鏁伴噺" width="80" />
+ <el-table-column label="鐘舵��" width="80">
+ <template #default="{ row }">
+ <el-tag :type="row.passed ? 'success' : 'danger'">
+ {{ row.passed ? '閫氳繃' : '鏈�氳繃' }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="message" label="鎻愮ず" />
+ </el-table>
+ </el-card>
+ </div>
+</template>
+```
+
+### 3. data 鏁版嵁
+
+```js
+data() {
+ return {
+ selectedModules: ['sales', 'purchase', 'quality', 'production'],
+ checking: false,
+ checkResult: null,
+ }
+}
+```
+
+### 4. 鏂规硶
+
+```js
+import request from '@/utils/request'
+
+methods: {
+ async handleCheck() {
+ if (this.selectedModules.length === 0) {
+ this.$message.warning('璇疯嚦灏戦�夋嫨涓�涓ā鍧�')
+ return
+ }
+ this.checking = true
+ try {
+ const res = await request.post('/mock/dataCheck', {
+ modules: this.selectedModules
+ })
+ this.checkResult = res.data
+ } finally {
+ this.checking = false
+ }
+ }
+}
+```
+
+## 娉ㄦ剰浜嬮」
+
+- 浜у搧鏁版嵁锛堝叕鍏卞熀纭�锛夊湪澶氫釜妯″潡闂村叡浜紝妫�娴嬬粨鏋滀腑鍙嚭鐜颁竴娆★紝涓嶄細閲嶅灞曠ず
+- 妫�娴嬩粎鍋氬彧璇绘煡璇紝涓嶅啓鍏ヤ换浣曟暟鎹�
+- 妯″潡鍙傛暟涓虹┖鏁扮粍鏃惰繑鍥炵┖妫�娴嬪垪琛�
+- 寤鸿鍦ㄦ暟鎹ā鎷熷紑濮嬪墠鍏堣皟鐢ㄦ鎺ュ彛纭鍩虹鏁版嵁灏辩华
+- 鐢熶骇妯″潡闄や簡妫�娴嬫暟鎹噺锛岃繕浼氭娴嬪叧鑱旀�э紙浜у搧-宸ヨ壓璺嚎銆佸伐鑹鸿矾绾�-宸ュ簭銆丅OM-浜у搧缁撴瀯锛夛紝纭繚宸ヨ壓璁捐鏁版嵁瀹屾暣
diff --git a/docs/mock_data_generate.md b/docs/mock_data_generate.md
new file mode 100644
index 0000000..6dc801e
--- /dev/null
+++ b/docs/mock_data_generate.md
@@ -0,0 +1,243 @@
+# 鏁版嵁妯℃嫙 - AI 鏁版嵁鐢熸垚
+
+## 娑夊強椤甸潰
+
+- 鏁版嵁妯℃嫙鎿嶄綔椤甸潰锛堟柊澧�/淇敼锛�
+
+## API
+
+| 鏂规硶 | 璺緞 | 璇存槑 |
+|------|------|------|
+| POST | /mock/generate | AI 鐢熸垚妯℃嫙鏁版嵁锛堝惈鍓嶇疆鍩虹鏁版嵁妫�娴嬶級 |
+
+**璇锋眰鍙傛暟锛�**
+
+| 鍙傛暟 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|------|------|------|------|
+| modules | List\<String\> | 鏄� | 瑕佺敓鎴愭暟鎹殑妯″潡锛歴ales锛堥攢鍞級銆乸urchase锛堥噰璐級銆乹uality锛堣川閲忥級銆乸roduction锛堢敓浜э級銆乻tock锛堝簱瀛橈級 |
+| industries | List\<String\> | 鏄� | 琛屼笟锛屽锛歔"鏈烘鍒堕��", "椋熷搧鍔犲伐", "鐢靛瓙瑁呴厤"] |
+| countMin | int | 鍚� | 姣忎釜瀹炰綋鐢熸垚鏉℃暟鏈�灏忓�硷紝榛樿 3 |
+| countMax | int | 鍚� | 姣忎釜瀹炰綋鐢熸垚鏉℃暟鏈�澶у�硷紝榛樿 10 |
+| dateStart | String | 鍚� | 鏃堕棿鑼冨洿寮�濮嬶紙yyyy-MM-dd锛� |
+| dateEnd | String | 鍚� | 鏃堕棿鑼冨洿缁撴潫锛坹yyy-MM-dd锛� |
+| additionalInfo | String | 鍚� | 鍏朵粬琛ュ厖鎻忚堪锛屽"浜у搧浠ラ噾灞為浂閮ㄤ欢涓轰富" |
+
+璇锋眰浣撶ず渚嬶細
+```json
+{
+ "modules": ["sales", "purchase", "quality"],
+ "industries": ["鏈烘鍒堕��", "鐢靛瓙瑁呴厤"],
+ "countMin": 3,
+ "countMax": 8,
+ "dateStart": "2026-01-01",
+ "dateEnd": "2026-06-01",
+ "additionalInfo": "浜у搧浠ラ噾灞為浂閮ㄤ欢鍜岀數瀛愬厓鍣ㄤ欢涓轰富"
+}
+```
+
+**鍝嶅簲锛堟垚鍔燂級锛�**
+```json
+{
+ "code": 200,
+ "msg": "鎿嶄綔鎴愬姛",
+ "data": {
+ "status": "SUCCESS",
+ "totalGenerated": 24,
+ "moduleSummaries": [
+ { "module": "sales", "entityName": "瀹㈡埛", "generatedCount": 5, "successCount": 5, "failCount": 0 },
+ { "module": "sales", "entityName": "閿�鍞彴璐�", "generatedCount": 5, "successCount": 5, "failCount": 0 },
+ { "module": "purchase", "entityName": "渚涘簲鍟�", "generatedCount": 4, "successCount": 4, "failCount": 0 },
+ { "module": "purchase", "entityName": "閲囪喘鍙拌处", "generatedCount": 4, "successCount": 4, "failCount": 0 },
+ { "module": "quality", "entityName": "妫�娴嬫爣鍑�", "generatedCount": 3, "successCount": 3, "failCount": 0 },
+ { "module": "quality", "entityName": "鎸囨爣缁戝畾", "generatedCount": 3, "successCount": 3, "failCount": 0 }
+ ],
+ "errors": [],
+ "checkResult": null
+ }
+}
+```
+
+**鍝嶅簲锛堝熀纭�鏁版嵁涓嶈冻锛屽墠缃娴嬫湭閫氳繃锛夛細**
+```json
+{
+ "code": 500,
+ "msg": "鍩虹鏁版嵁涓嶈冻锛岃鍏堣ˉ鍏呭悗鍐嶇敓鎴�",
+ "data": {
+ "status": "CHECK_FAILED",
+ "checkResult": {
+ "totalItems": 6,
+ "passedItems": 3,
+ "items": [
+ { "module": "common", "itemName": "浜у搧鏁版嵁", "passed": true, "message": "閫氳繃" },
+ { "module": "sales", "itemName": "瀹㈡埛鏁版嵁", "passed": false, "message": "缂哄皯瀹㈡埛鏁版嵁锛岃鍏�..." }
+ ]
+ }
+ }
+}
+```
+
+## 宸ヤ綔娴佺▼
+
+1. 鐢ㄦ埛鍦ㄩ〉闈㈤�夋嫨妯″潡 + 濉啓琛屼笟/鏁伴噺/鏃堕棿绛変俊鎭�
+2. 璋冪敤 `POST /mock/generate`
+3. 鍚庣棣栧厛璋冪敤 `POST /mock/dataCheck` 妫�娴嬪熀纭�鏁版嵁鏄惁灏辩华
+4. 鑻ュ熀纭�鏁版嵁涓嶈冻锛岃繑鍥炴娴嬬粨鏋滐紝鎻愮ず鐢ㄦ埛鍏堣ˉ榻�
+5. 鑻ュ熀纭�鏁版嵁灏辩华锛岃皟鐢� AI 澶фā鍨嬬敓鎴愮鍚堣涓氱壒寰佺殑 JSON 鏁版嵁
+6. 鎸変緷璧栭『搴忓垱寤烘暟鎹紙瀹㈡埛鈫掗攢鍞彴璐︺�佷緵搴斿晢鈫掗噰璐彴璐︺�佹娴嬫爣鍑嗏啋鎸囨爣缁戝畾...锛�
+7. 杩斿洖鐢熸垚鎽樿
+
+## 鍓嶇淇敼鐐�
+
+### 1. 鏁版嵁鐢熸垚鍖哄煙锛堝湪鏁版嵁妫�娴嬪尯鍩熶笅鏂癸級
+
+```html
+<el-card header="AI 鏁版嵁鐢熸垚" style="margin-top: 16px">
+ <el-form :model="generateForm" label-width="100px">
+ <el-form-item label="閫夋嫨妯″潡">
+ <el-checkbox-group v-model="generateForm.modules">
+ <el-checkbox label="sales">閿�鍞�</el-checkbox>
+ <el-checkbox label="purchase">閲囪喘</el-checkbox>
+ <el-checkbox label="quality">璐ㄩ噺</el-checkbox>
+ <el-checkbox label="production">鐢熶骇</el-checkbox>
+ <el-checkbox label="stock">搴撳瓨</el-checkbox>
+ </el-checkbox-group>
+ </el-form-item>
+
+ <el-form-item label="琛屼笟">
+ <el-select
+ v-model="generateForm.industries"
+ multiple
+ filterable
+ allow-create
+ placeholder="杈撳叆鎴栭�夋嫨琛屼笟"
+ >
+ <el-option label="鏈烘鍒堕��" value="鏈烘鍒堕��" />
+ <el-option label="椋熷搧鍔犲伐" value="椋熷搧鍔犲伐" />
+ <el-option label="鐢靛瓙瑁呴厤" value="鐢靛瓙瑁呴厤" />
+ <el-option label="姹借溅闆堕儴浠�" value="姹借溅闆堕儴浠�" />
+ <el-option label="鍖荤枟鍣ㄦ" value="鍖荤枟鍣ㄦ" />
+ <el-option label="鍖栧伐鏉愭枡" value="鍖栧伐鏉愭枡" />
+ <el-option label="绾虹粐鏈嶈" value="绾虹粐鏈嶈" />
+ <el-option label="瀹跺叿鍒堕��" value="瀹跺叿鍒堕��" />
+ </el-select>
+ </el-form-item>
+
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item label="鐢熸垚鏉℃暟">
+ <el-slider
+ v-model="generateForm.countRange"
+ range
+ :min="1"
+ :max="50"
+ :marks="{1:'1', 10:'10', 20:'20', 50:'50'}"
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鏃堕棿鑼冨洿">
+ <el-date-picker
+ v-model="generateForm.dateRange"
+ type="daterange"
+ range-separator="鑷�"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ value-format="yyyy-MM-dd"
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ <el-form-item label="琛ュ厖淇℃伅">
+ <el-input
+ v-model="generateForm.additionalInfo"
+ type="textarea"
+ :rows="2"
+ placeholder="濡傦細浜у搧浠ラ噾灞為浂閮ㄤ欢涓轰富锛屽鎴烽泦涓湪鍗庝笢鍦板尯"
+ />
+ </el-form-item>
+
+ <el-form-item>
+ <el-button type="primary" @click="handleGenerate" :loading="generating">
+ 寮�濮嬬敓鎴�
+ </el-button>
+ <el-button @click="handleCheckFirst" :loading="checking">
+ 鍏堟娴嬪啀鐢熸垚
+ </el-button>
+ </el-form-item>
+ </el-form>
+</el-card>
+```
+
+### 3. data 鏁版嵁
+
+```js
+data() {
+ return {
+ generateForm: {
+ modules: [],
+ industries: [],
+ countRange: [3, 10],
+ dateRange: [],
+ additionalInfo: '',
+ },
+ generating: false,
+ generateResult: null,
+ }
+}
+```
+
+### 4. 鏂规硶
+
+```js
+methods: {
+ // 鐩存帴鐢熸垚锛堝唴閮ㄨ嚜鍔ㄦ娴嬶級
+ async handleGenerate() {
+ if (this.generateForm.modules.length === 0) {
+ this.$message.warning('璇疯嚦灏戦�夋嫨涓�涓ā鍧�')
+ return
+ }
+ this.generating = true
+ try {
+ const res = await request.post('/mock/generate', {
+ modules: this.generateForm.modules,
+ industries: this.generateForm.industries,
+ countMin: this.generateForm.countRange[0],
+ countMax: this.generateForm.countRange[1],
+ dateStart: this.generateForm.dateRange[0] || null,
+ dateEnd: this.generateForm.dateRange[1] || null,
+ additionalInfo: this.generateForm.additionalInfo,
+ })
+ if (res.code === 200) {
+ this.generateResult = res.data
+ this.$message.success(`鎴愬姛鐢熸垚 ${res.data.totalGenerated} 鏉℃暟鎹甡)
+ } else {
+ // 鍩虹鏁版嵁涓嶈冻
+ this.generateResult = res.data
+ this.checkResult = res.data.checkResult
+ this.$message.warning(res.msg)
+ }
+ } finally {
+ this.generating = false
+ }
+ },
+
+ // 鍏堟娴嬪啀鐢熸垚
+ async handleCheckFirst() {
+ await this.handleCheck()
+ if (this.checkResult && this.checkResult.passedItems === this.checkResult.totalItems) {
+ await this.handleGenerate()
+ } else {
+ this.$message.warning('璇峰厛琛ラ綈鍩虹鏁版嵁鍚庡啀鐢熸垚')
+ }
+ },
+}
+```
+
+## 娉ㄦ剰浜嬮」
+
+- `POST /mock/generate` 鍐呴儴浼氳嚜鍔ㄨ皟鐢ㄦ暟鎹娴嬶紝涓嶉渶瑕佹墜鍔ㄥ垎涓ゆ璧�
+- AI 鐢熸垚鐨勬暟鎹細灏介噺绗﹀悎琛屼笟鐗瑰緛锛屼絾寤鸿鐢熸垚鍚庢鏌ュ叧閿暟鎹殑鍚堢悊鎬�
+- 鐢熶骇妯″潡鍜屽簱瀛樻ā鍧椾緷璧栦骇鍝佹暟鎹紙Product/ProductModel锛夛紝璇风‘淇濆熀纭�鏁版嵁涓湁浜у搧
+- 閿�鍞彴璐︾殑鍚堝悓閲戦鐢变骇鍝佹槑缁嗚嚜鍔ㄨ绠楋紝AI 鍙渶鐢熸垚浜у搧琛岀殑鍗曚环鍜屾暟閲�
+- 浜х敓鐨勬暟鎹�氳繃鏈嶅姟灞傚垱寤猴紝浼氳嚜鍔ㄥ~鍏� tenantId/deptId/createUser 绛夊瓧娈�
diff --git a/docs/routing_operation_plan_person.md b/docs/routing_operation_plan_person.md
new file mode 100644
index 0000000..999d9a3
--- /dev/null
+++ b/docs/routing_operation_plan_person.md
@@ -0,0 +1,91 @@
+# 鐢熶骇宸ュ簭鏂板璁″垝浜哄憳鍜岃鍒掓墽琛屼汉鍛�
+
+## 娑夊強椤甸潰
+
+- 宸ヨ壓璺嚎宸ュ簭绠$悊椤甸潰锛坱echnology_routing_operation锛�
+
+## API
+
+娑夊強浠ヤ笅鎺ュ彛鐨勮姹�/鍝嶅簲鏂板瀛楁锛�
+
+| 鏂规硶 | 璺緞 | 璇存槑 |
+|------|------|------|
+| GET | /technologyRoutingOperation/page | 鍒嗛〉鏌ヨ |
+| GET | /technologyRoutingOperation/list | 鍒楄〃鏌ヨ |
+| GET | /technologyRoutingOperation/{id} | 璇︽儏 |
+| POST | /technologyRoutingOperation/add | 鏂板 |
+| PUT | /technologyRoutingOperation | 淇敼 |
+
+**鏂板鍝嶅簲/璇锋眰瀛楁锛�**
+
+| 鍙傛暟 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|------|------|------|------|
+| planPerson | Long | 鍚� | 璁″垝浜哄憳ID |
+| executor | Long | 鍚� | 璁″垝鎵ц浜哄憳ID |
+| planPersonName | String | 鍚� | 璁″垝浜哄憳濮撳悕锛堝搷搴斿瓧娈碉紝鍚庣鑷姩鍏宠仈鏌ヨ锛� |
+| executorName | String | 鍚� | 璁″垝鎵ц浜哄憳濮撳悕锛堝搷搴斿瓧娈碉紝鍚庣鑷姩鍏宠仈鏌ヨ锛� |
+
+## 鍓嶇淇敼鐐�
+
+### 1. 琛ㄥ崟鏂板瀛楁
+
+鍦ㄥ伐搴忚〃鍗曚腑鏂板涓や釜浜哄憳閫夋嫨涓嬫媺妗嗭細
+
+```html
+<el-form-item label="璁″垝浜哄憳" prop="planPerson">
+ <el-select v-model="processForm.planPerson"
+ placeholder="璇烽�夋嫨璁″垝浜哄憳"
+ clearable
+ filterable
+ style="width: 100%">
+ <el-option v-for="item in employeeOptions"
+ :key="item.id"
+ :label="item.staffName"
+ :value="item.id" />
+ </el-select>
+</el-form-item>
+<el-form-item label="璁″垝鎵ц浜哄憳" prop="executor">
+ <el-select v-model="processForm.executor"
+ placeholder="璇烽�夋嫨璁″垝鎵ц浜哄憳"
+ clearable
+ filterable
+ style="width: 100%">
+ <el-option v-for="item in employeeOptions"
+ :key="item.id"
+ :label="item.staffName"
+ :value="item.id" />
+ </el-select>
+</el-form-item>
+```
+
+### 2. data 鏁版嵁
+
+```js
+data() {
+ return {
+ processForm: {
+ planPerson: null,
+ executor: null,
+ // ...鍏朵粬瀛楁
+ },
+ employeeOptions: [], // 鍛樺伐鍒楄〃锛岄渶浠庢帴鍙h幏鍙�
+ }
+}
+```
+
+### 3. 琛ㄦ牸鍒楁柊澧�
+
+鍒楄〃涓彲鐩存帴浣跨敤鍚庣杩斿洖鐨勫鍚嶅睍绀猴細
+
+```html
+<el-table-column label="璁″垝浜哄憳" prop="planPersonName" />
+<el-table-column label="璁″垝鎵ц浜哄憳" prop="executorName" />
+```
+
+## 娉ㄦ剰浜嬮」
+
+- `planPerson` 鍜� `executor` 瀛樺偍鐨勬槸鍛樺伐ID锛圠ong绫诲瀷锛夛紝鎻愪氦琛ㄥ崟鏃朵紶ID
+- 鍝嶅簲涓� `planPersonName` 鍜� `executorName` 鐢卞悗绔�氳繃 `staff_on_job` 琛ㄨ嚜鍔ㄥ叧鑱旀煡璇紝鍓嶇鏃犻渶棰濆杞崲
+- 鍛樺伐涓嬫媺鍒楄〃鏁版嵁闇�浠庡憳宸ユ帴鍙h幏鍙栵紙鍙傝�冪幇鏈� `employeeOptions` 鏁版嵁婧愶級
+- 鏁版嵁搴撹縼绉籗QL锛歚doc/20260615_add_plan_person_and_executor_to_routing_operation.sql`
+- 鐢熶骇璁㈠崟宸ュ簭锛坄production_order_routing_operation`锛夊悓姝ユ敮鎸佽繖涓や釜瀛楁
diff --git a/sql/product-inventory-management-new-pro.sql b/sql/product-inventory-management-new-pro.sql
new file mode 100644
index 0000000..2752b38
--- /dev/null
+++ b/sql/product-inventory-management-new-pro.sql
@@ -0,0 +1,5814 @@
+/*
+ Navicat Premium Dump SQL
+
+ Source Server : localhost
+ Source Server Type : MySQL
+ Source Server Version : 80408 (8.4.8)
+ Source Host : localhost:3306
+ Source Schema : product-inventory-management-new-pro
+
+ Target Server Type : MySQL
+ Target Server Version : 80408 (8.4.8)
+ File Encoding : 65001
+
+ Date: 16/06/2026 10:13:25
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for account_expense
+-- ----------------------------
+DROP TABLE IF EXISTS `account_expense`;
+CREATE TABLE `account_expense` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `business_id` int NULL DEFAULT NULL COMMENT '涓氬姟id',
+ `business_type` int NULL DEFAULT NULL COMMENT '涓氬姟绫诲瀷 1-浠樻 2-杩樺�熸',
+ `expense_date` date NULL DEFAULT NULL COMMENT '鏀嚭鏃ユ湡',
+ `expense_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏀嚭绫诲瀷',
+ `supplier_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `expense_money` decimal(18, 2) NULL DEFAULT NULL COMMENT '鏀嚭閲戦',
+ `expense_described` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏀嚭鎻忚堪',
+ `expense_method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '浠樻鏂瑰紡',
+ `invoice_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍙戠エ鍙风爜',
+ `note` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `input_user` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '褰曞叆浜哄憳',
+ `input_time` date NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--鏀嚭绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_file
+-- ----------------------------
+DROP TABLE IF EXISTS `account_file`;
+CREATE TABLE `account_file` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `url` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞',
+ `file_size` int NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `account_id` bigint NULL DEFAULT NULL COMMENT '璐㈠姟ID',
+ `account_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '绫诲瀷(鏀跺叆/鏀嚭)',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 272 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_income
+-- ----------------------------
+DROP TABLE IF EXISTS `account_income`;
+CREATE TABLE `account_income` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `income_date` date NULL DEFAULT NULL COMMENT '鏀跺叆鏃ユ湡',
+ `income_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏀跺叆绫诲瀷',
+ `customer_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `income_money` decimal(18, 2) NULL DEFAULT NULL COMMENT '鏀跺叆閲戦',
+ `income_described` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏀跺叆鎻忚堪',
+ `income_method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏀舵鏂瑰紡',
+ `invoice_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍙戠エ鍙风爜',
+ `note` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `input_user` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '褰曞叆浜哄憳',
+ `input_time` date NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `business_id` int NULL DEFAULT NULL COMMENT '涓氬姟id',
+ `business_type` int NULL DEFAULT NULL COMMENT '涓氬姟绫诲瀷 1-鍥炴 2-鍊熸',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 696 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--鏀跺叆绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_invoice_application
+-- ----------------------------
+DROP TABLE IF EXISTS `account_invoice_application`;
+CREATE TABLE `account_invoice_application` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `customer_id` int NOT NULL COMMENT '瀹㈡埛id',
+ `stock_out_record_ids` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍏宠仈鍑哄簱鍗昳d(澶氶��)',
+ `invoice_application_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '寮�绁ㄧ敵璇峰崟鍙�',
+ `invoice_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `apply_date` date NULL DEFAULT NULL COMMENT '鐢宠鏃ユ湡',
+ `invoice_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鍙戠エ鍐呭',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `status` int NULL DEFAULT 0 COMMENT '瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃',
+ `invoice_amount` decimal(18, 4) NULL DEFAULT NULL COMMENT '寮�绁ㄩ噾棰�',
+ `tax_rate` decimal(5, 0) NULL DEFAULT NULL COMMENT '绋庣巼',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--寮�绁ㄧ敵璇�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_payment_application
+-- ----------------------------
+DROP TABLE IF EXISTS `account_payment_application`;
+CREATE TABLE `account_payment_application` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `supplier_id` int NOT NULL COMMENT '渚涘簲鍟唅d',
+ `stock_in_record_ids` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '鍏宠仈鍏ュ簱鍗昳d(澶氶��)',
+ `invoice_application_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '浠樻鐢宠鍗曞彿',
+ `payment_method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '浠樻鏂瑰紡',
+ `payment_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '浠樻浜嬬敱',
+ `apply_date` date NULL DEFAULT NULL COMMENT '鐢宠鏃ユ湡',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `status` int NULL DEFAULT 0 COMMENT '瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃',
+ `payment_amount` decimal(15, 4) NULL DEFAULT NULL COMMENT '浠樻閲戦',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--浠樻鐢宠' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_purchase_invoice
+-- ----------------------------
+DROP TABLE IF EXISTS `account_purchase_invoice`;
+CREATE TABLE `account_purchase_invoice` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `invoice_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍙戠エ鍙风爜',
+ `tax_rate` decimal(5, 0) NULL DEFAULT NULL COMMENT '绋庣巼',
+ `invoice_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `issue_date` date NULL DEFAULT NULL COMMENT '寮�绁ㄦ棩鏈�',
+ `tax_exclusivel_price` decimal(15, 2) NULL DEFAULT NULL COMMENT '閲戦(涓嶅惈绋�)',
+ `tax_price` decimal(15, 2) NULL DEFAULT NULL COMMENT '绋庨',
+ `tax_inclusive_price` decimal(15, 2) NULL DEFAULT NULL COMMENT '浠风◣鍚堣',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `invoice_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鍙戠エ鍐呭',
+ `supplier_id` int NOT NULL COMMENT '渚涘簲鍟唅d',
+ `storage_attachment_id` int NULL DEFAULT NULL COMMENT '鍏宠仈涓婁紶鐨勫彂绁ㄩ檮浠秈d',
+ `stock_in_record_ids` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '鍏宠仈鍏ュ簱鍗昳d(澶氶��)',
+ `status` int NULL DEFAULT 0 COMMENT '鐘舵�� 0鍚敤 1绂佺敤',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--杩涢」鍙戠エ' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_purchase_payment
+-- ----------------------------
+DROP TABLE IF EXISTS `account_purchase_payment`;
+CREATE TABLE `account_purchase_payment` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `account_payment_application_id` int NOT NULL COMMENT '鍏宠仈浠樻鐢宠id',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `supplier_id` int NOT NULL COMMENT '渚涘簲鍟唅d',
+ `payment_date` date NULL DEFAULT NULL COMMENT '浠樻鏃ユ湡',
+ `payment_method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '浠樻鏂瑰紡',
+ `payment_amount` decimal(15, 2) NULL DEFAULT NULL COMMENT '浠樻閲戦',
+ `payment_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '浠樻鍗曞彿',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--浠樻鍗�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_sales_collection
+-- ----------------------------
+DROP TABLE IF EXISTS `account_sales_collection`;
+CREATE TABLE `account_sales_collection` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `stock_out_record_ids` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍏宠仈鍑哄簱鍗昳d(澶氶��)',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `customer_id` int NOT NULL COMMENT '瀹㈡埛id',
+ `collection_date` date NULL DEFAULT NULL COMMENT '鏀舵鏃ユ湡',
+ `collection_amount` decimal(15, 2) NULL DEFAULT NULL COMMENT '鏀舵閲戦',
+ `collection_method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏀舵鏂瑰紡',
+ `collection_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鏀舵鍗曞彿',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--鏀舵鍗�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_sales_invoice
+-- ----------------------------
+DROP TABLE IF EXISTS `account_sales_invoice`;
+CREATE TABLE `account_sales_invoice` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `account_invoice_application_id` int NOT NULL COMMENT '鍏宠仈寮�绁ㄧ敵璇穒d',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `invoice_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍙戠エ鍙风爜',
+ `tax_rate` decimal(5, 0) NULL DEFAULT NULL COMMENT '绋庣巼',
+ `invoice_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `issue_date` date NULL DEFAULT NULL COMMENT '寮�绁ㄦ棩鏈�',
+ `tax_exclusivel_price` decimal(15, 2) NULL DEFAULT NULL COMMENT '閲戦(涓嶅惈绋�)',
+ `tax_price` decimal(15, 2) NULL DEFAULT NULL COMMENT '绋庨',
+ `tax_inclusive_price` decimal(15, 2) NULL DEFAULT NULL COMMENT '浠风◣鍚堣',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `invoice_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鍙戠エ鍐呭',
+ `customer_id` int NULL DEFAULT NULL COMMENT '瀹㈡埛id',
+ `storage_attachment_id` int NULL DEFAULT NULL COMMENT '鍏宠仈涓婁紶鐨勫彂绁ㄩ檮浠秈d',
+ `status` int NULL DEFAULT 0 COMMENT '鐘舵�� 0鍚敤 1绂佺敤',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--閿�椤瑰彂绁�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_statement
+-- ----------------------------
+DROP TABLE IF EXISTS `account_statement`;
+CREATE TABLE `account_statement` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `customer_id` int NOT NULL COMMENT '瀹㈡埛id',
+ `statement_month` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '瀵硅处鏈堜唤(yyyy-MM)',
+ `account_type` int NOT NULL COMMENT '涓氬姟绫诲瀷(1搴旀敹瀵硅处;2搴斾粯瀵硅处)',
+ `statement_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '瀵硅处鍗曞彿',
+ `opening_balance` decimal(15, 2) NULL DEFAULT NULL COMMENT '鏈熷垵浣欓',
+ `current_plan` decimal(15, 2) NULL DEFAULT NULL COMMENT '鏈湡搴旀敹/搴斾粯',
+ `current_actually` decimal(15, 2) NULL DEFAULT NULL COMMENT '鏈湡鏀舵/浠樻',
+ `closing_balance` decimal(15, 2) NULL DEFAULT NULL COMMENT '鏈熸湯浣欓',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--瀵硅处鍗�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_statement_details
+-- ----------------------------
+DROP TABLE IF EXISTS `account_statement_details`;
+CREATE TABLE `account_statement_details` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `account_statement_id` int NOT NULL COMMENT '鍏宠仈瀵硅处鍗昳d',
+ `occurrence_date` date NULL DEFAULT NULL COMMENT '鏁版嵁鏃ユ湡',
+ `receipt_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍗曟嵁缂栧彿',
+ `type` int NULL DEFAULT NULL COMMENT '鏁版嵁绫诲瀷(1鍑哄簱;2鍏ュ簱;3鏀舵;4浠樻;5閫�璐�)',
+ `amount` decimal(15, 2) NULL DEFAULT NULL COMMENT '閲戦',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '璐㈠姟绠$悊--瀵硅处鍗曟槑缁�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for account_subject
+-- ----------------------------
+DROP TABLE IF EXISTS `account_subject`;
+CREATE TABLE `account_subject` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `parent_id` bigint NULL DEFAULT NULL COMMENT '鐖剁鐩甀D锛堜负绌鸿〃绀烘牴鑺傜偣锛�',
+ `subject_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '绉戠洰缂栫爜(鍞竴鏍囪瘑)',
+ `subject_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '绉戠洰鍚嶇О',
+ `subject_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '绉戠洰绫诲瀷',
+ `balance_direction` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浣欓鏂瑰悜',
+ `status` int NULL DEFAULT 0 COMMENT '鐘舵�� 0鍚敤 1绂佺敤',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_account_subject_parent_id`(`parent_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鎬昏处绉戠洰琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for after_sales_near_expiry
+-- ----------------------------
+DROP TABLE IF EXISTS `after_sales_near_expiry`;
+CREATE TABLE `after_sales_near_expiry` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '涓存湡浜у搧鍚嶇О',
+ `batch_number` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '浜у搧鎵瑰彿',
+ `expire_date` date NULL DEFAULT NULL COMMENT '涓存湡鏃ユ湡',
+ `stock_quantity` int NULL DEFAULT NULL COMMENT '搴撳瓨鏁伴噺',
+ `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `dis_res` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '闂鎻忚堪',
+ `status` int NULL DEFAULT NULL COMMENT '澶勭悊鐘舵�� (濡�: 1-寰呭鐞� 2-宸插鐞�)',
+ `dispose_user_id` bigint NULL DEFAULT NULL COMMENT '澶勭悊浜篒D',
+ `dispose_nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '澶勭悊浜哄悕绉�',
+ `dis_date` date NULL DEFAULT NULL COMMENT '澶勭悊鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `contact_phone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `dispose_result` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '澶勭悊缁撴灉',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '涓存湡鍞悗绠$悊琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for after_sales_service
+-- ----------------------------
+DROP TABLE IF EXISTS `after_sales_service`;
+CREATE TABLE `after_sales_service` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `status` int NULL DEFAULT NULL COMMENT '鐘舵�� 1-寰呭鐞� 2-宸插鐞�',
+ `check_user_id` bigint NULL DEFAULT NULL COMMENT '鐧昏浜�',
+ `check_nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鐧昏浜哄悕绉�',
+ `dispose_user_id` bigint NULL DEFAULT NULL COMMENT '澶勭悊浜�',
+ `dispose_nick_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '澶勭悊浜哄悕绉�',
+ `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `dis_res` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '闂鎻忚堪',
+ `pro_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '澶勭悊缁撴灉',
+ `feedback_date` date NULL DEFAULT NULL COMMENT '鍙嶉鏃ユ湡',
+ `dis_date` date NULL DEFAULT NULL COMMENT '澶勭悊鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `service_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鍞悗绫诲瀷',
+ `urgency` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '绱ф�ョ▼搴�',
+ `sales_ledger_id` bigint NULL DEFAULT NULL COMMENT '閿�鍞鍗昳d',
+ `distribution_user_id` bigint NULL DEFAULT NULL COMMENT '鍒嗛厤浜篿d',
+ `product_model_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鍞悗浜у搧id闆嗗悎',
+ `after_sales_service_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鍞悗鍗曞彿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '鍞悗鏈嶅姟' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for after_sales_service_file
+-- ----------------------------
+DROP TABLE IF EXISTS `after_sales_service_file`;
+CREATE TABLE `after_sales_service_file` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `service_id` bigint NOT NULL COMMENT '鍞悗鏈嶅姟璁板綍ID',
+ `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `file_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '鏂囦欢璁块棶鍦板潃',
+ `file_size` bigint NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `file_suffix` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鏂囦欢鍚庣紑',
+ `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '0' COMMENT '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 1浠h〃鍒犻櫎锛�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '涓婁紶鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_service_id`(`service_id` ASC) USING BTREE COMMENT '鍞悗ID绱㈠紩'
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '鍞悗鏈嶅姟闄勪欢琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for ai_chat_session
+-- ----------------------------
+DROP TABLE IF EXISTS `ai_chat_session`;
+CREATE TABLE `ai_chat_session` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `memory_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '浼氳瘽ID',
+ `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛ID',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `title` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浼氳瘽鏍囬',
+ `last_message` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏈�鍚庝竴鏉℃秷鎭�',
+ `message_count` int NOT NULL DEFAULT 0 COMMENT '娑堟伅鏁伴噺',
+ `last_chat_time` datetime NULL DEFAULT NULL COMMENT '鏈�鍚庤亰澶╂椂闂�',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'AI鍘嗗彶浼氳瘽鍏冩暟鎹〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for annual_leave_setting
+-- ----------------------------
+DROP TABLE IF EXISTS `annual_leave_setting`;
+CREATE TABLE `annual_leave_setting` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `employee_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐绫诲瀷',
+ `work_years` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヤ綔骞撮檺',
+ `annual_days` int NULL DEFAULT NULL COMMENT '骞村亣澶╂暟',
+ `max_carry_over` int NULL DEFAULT NULL COMMENT '鏈�澶х粨杞ぉ鏁�',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '骞村亣璁剧疆' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approval_instance
+-- ----------------------------
+DROP TABLE IF EXISTS `approval_instance`;
+CREATE TABLE `approval_instance` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '瀹℃壒瀹炰緥ID',
+ `instance_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒缂栧彿',
+ `template_id` bigint NULL DEFAULT NULL COMMENT '妯℃澘ID',
+ `template_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妯℃澘鍚嶇О',
+ `business_id` bigint NULL DEFAULT NULL COMMENT '涓氬姟ID',
+ `business_type` int NULL DEFAULT NULL COMMENT '涓氬姟绫诲瀷',
+ `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒鏍囬',
+ `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒鐘舵��',
+ `current_level` int NULL DEFAULT NULL COMMENT '褰撳墠瀹℃壒绾у埆',
+ `applicant_id` bigint NOT NULL COMMENT '鐢宠浜篒D',
+ `applicant_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢宠浜哄悕绉�',
+ `apply_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鐢宠鏃堕棿',
+ `finish_time` datetime NULL DEFAULT NULL COMMENT '瀹屾垚鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎',
+ `dept_id` int NULL DEFAULT NULL,
+ `form_config` json NULL,
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_business`(`business_type` ASC, `business_id` ASC) USING BTREE,
+ INDEX `idx_status`(`status` ASC) USING BTREE,
+ INDEX `idx_applicant`(`applicant_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 99 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒瀹炰緥琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approval_instance_node
+-- ----------------------------
+DROP TABLE IF EXISTS `approval_instance_node`;
+CREATE TABLE `approval_instance_node` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鑺傜偣瀹炰緥ID',
+ `instance_id` bigint NOT NULL COMMENT '瀹℃壒瀹炰緥ID',
+ `level_no` int NOT NULL COMMENT '瀹℃壒绾у埆',
+ `approve_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒绫诲瀷',
+ `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鑺傜偣鐘舵��',
+ `start_time` datetime NULL DEFAULT NULL COMMENT '寮�濮嬫椂闂�',
+ `finish_time` datetime NULL DEFAULT NULL COMMENT '瀹屾垚鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎',
+ `dept_id` int NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_instance_id`(`instance_id` ASC) USING BTREE,
+ INDEX `idx_instance_level`(`instance_id` ASC, `level_no` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 123 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒鑺傜偣瀹炰緥琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approval_record
+-- ----------------------------
+DROP TABLE IF EXISTS `approval_record`;
+CREATE TABLE `approval_record` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '瀹℃壒璁板綍ID',
+ `instance_id` bigint NULL DEFAULT NULL COMMENT '瀹℃壒瀹炰緥ID',
+ `node_id` bigint NULL DEFAULT NULL COMMENT '鑺傜偣瀹炰緥ID',
+ `task_id` bigint NULL DEFAULT NULL COMMENT '瀹℃壒浠诲姟ID',
+ `operator_id` bigint NULL DEFAULT NULL COMMENT '鎿嶄綔浜篒D',
+ `operator_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎿嶄綔浜哄悕绉�',
+ `action` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎿嶄綔绫诲瀷',
+ `comment` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒鎰忚',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 180 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒璁板綍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approval_task
+-- ----------------------------
+DROP TABLE IF EXISTS `approval_task`;
+CREATE TABLE `approval_task` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '瀹℃壒浠诲姟ID',
+ `instance_id` bigint NOT NULL COMMENT '瀹℃壒瀹炰緥ID',
+ `node_id` bigint NOT NULL COMMENT '鑺傜偣瀹炰緥ID',
+ `level_no` int NOT NULL COMMENT '瀹℃壒绾у埆',
+ `approver_id` bigint NOT NULL COMMENT '瀹℃壒浜篒D',
+ `approver_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒浜哄悕绉�',
+ `task_status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浠诲姟鐘舵��',
+ `approve_time` datetime NULL DEFAULT NULL COMMENT '瀹℃壒鏃堕棿',
+ `comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒鎰忚',
+ `is_read` tinyint NOT NULL DEFAULT 0 COMMENT '鏄惁宸茶',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎',
+ `dept_id` int NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_approver`(`approver_id` ASC, `task_status` ASC) USING BTREE,
+ INDEX `idx_instance`(`instance_id` ASC) USING BTREE,
+ INDEX `idx_node`(`node_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 124 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒浠诲姟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approval_template
+-- ----------------------------
+DROP TABLE IF EXISTS `approval_template`;
+CREATE TABLE `approval_template` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '妯℃澘ID',
+ `template_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '妯℃澘鍚嶇О',
+ `enabled` tinyint NOT NULL DEFAULT 1 COMMENT '鍚敤鐘舵�侊細1鍚敤锛�0鍋滅敤',
+ `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妯℃澘璇存槑',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎锛�0鍚︼紝1鏄�',
+ `dept_id` int NULL DEFAULT NULL,
+ `form_config` json NULL COMMENT '鍔ㄦ�佽〃鍗曢厤缃甁SON',
+ `template_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '妯℃澘绫诲瀷锛�0绯荤粺鍐呯疆锛�1鑷畾涔�',
+ `business_type` int NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒妯℃澘琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approval_template_node
+-- ----------------------------
+DROP TABLE IF EXISTS `approval_template_node`;
+CREATE TABLE `approval_template_node` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鑺傜偣ID',
+ `template_id` bigint NOT NULL COMMENT '瀹℃壒妯℃澘ID',
+ `level_no` int NOT NULL COMMENT '瀹℃壒绾у埆锛屼粠1寮�濮�',
+ `approve_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒鏂瑰紡锛欰ND浼氱锛孫R鎴栫',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `create_user` int NULL DEFAULT NULL,
+ `dept_id` int NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_template_level`(`template_id` ASC, `level_no` ASC) USING BTREE,
+ INDEX `idx_template_id`(`template_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 68 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒妯℃澘鑺傜偣琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approval_template_node_approver
+-- ----------------------------
+DROP TABLE IF EXISTS `approval_template_node_approver`;
+CREATE TABLE `approval_template_node_approver` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `node_id` bigint NOT NULL COMMENT '瀹℃壒鑺傜偣ID',
+ `template_id` bigint NOT NULL COMMENT '瀹℃壒妯℃澘ID',
+ `approver_id` bigint NOT NULL COMMENT '瀹℃壒浜篒D',
+ `approver_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒浜哄悕绉板啑浣�',
+ `sort_no` int NOT NULL DEFAULT 1 COMMENT '瀹℃壒浜烘帓搴�',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `dept_id` int NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `deleted` int NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_node_approver`(`node_id` ASC, `approver_id` ASC) USING BTREE,
+ INDEX `idx_node_id`(`node_id` ASC) USING BTREE,
+ INDEX `idx_template_id`(`template_id` ASC) USING BTREE,
+ INDEX `idx_approver_id`(`approver_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 76 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒妯℃澘鑺傜偣瀹℃壒浜鸿〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approve_log
+-- ----------------------------
+DROP TABLE IF EXISTS `approve_log`;
+CREATE TABLE `approve_log` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `approve_id` bigint NOT NULL COMMENT '瀹℃壒id',
+ `approve_node_order` int NOT NULL COMMENT '瀹℃壒鑺傜偣椤哄簭',
+ `approve_user` bigint NOT NULL COMMENT '瀹℃壒浜篿d',
+ `approve_time` datetime NOT NULL COMMENT '瀹℃壒鏃堕棿',
+ `approve_status` int NOT NULL COMMENT '瀹℃壒鐘舵��',
+ `approve_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒澶囨敞',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒鏃ュ織琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approve_node
+-- ----------------------------
+DROP TABLE IF EXISTS `approve_node`;
+CREATE TABLE `approve_node` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `approve_process_id` char(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒缂栧彿',
+ `approve_node_order` int NOT NULL COMMENT '瀹℃壒鑺傜偣椤哄簭',
+ `approve_node_user_id` int NULL DEFAULT NULL COMMENT '瀹℃壒鑺傜偣鐢ㄦ埛id',
+ `approve_node_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒鑺傜偣鐢ㄦ埛鍚嶅瓧',
+ `approve_node_time` datetime NOT NULL COMMENT '瀹℃壒鑺傜偣鏃堕棿',
+ `approve_node_status` int NOT NULL COMMENT '瀹℃壒鑺傜偣鐘舵��:1鍚屾剰锛�2鎷掔粷锛�0灏氭湭瀹℃牳锛堥粯璁や负0锛�',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `delete_flag` int NOT NULL COMMENT '鍒犻櫎鏍囪:0姝e父锛�1鍒犻櫎',
+ `approve_node_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒鑺傜偣鎷掔粷鍘熷洜',
+ `approve_node_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒鑺傜偣澶囨敞',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 115 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒鑺傜偣琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approve_process
+-- ----------------------------
+DROP TABLE IF EXISTS `approve_process`;
+CREATE TABLE `approve_process` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `approve_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹℃壒id',
+ `approve_user` bigint NOT NULL COMMENT '鐢宠浜篿d',
+ `approve_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢宠浜哄悕绉�',
+ `approve_dept_id` bigint NULL DEFAULT NULL COMMENT '鐢宠閮ㄩ棬id',
+ `approve_dept_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢宠閮ㄩ棬鍚嶇О',
+ `approve_user_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒鐢ㄦ埛ids',
+ `approve_user_names` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒鐢ㄦ埛鍚嶇О',
+ `approve_user_current_id` bigint NULL DEFAULT NULL COMMENT '褰撳墠瀹℃壒鐢ㄦ埛id',
+ `approve_user_current_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰撳墠瀹℃壒鐢ㄦ埛鍚嶇О',
+ `approve_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐢宠鍘熷洜',
+ `approve_time` datetime NOT NULL COMMENT '鐢宠鏃ユ湡',
+ `approve_over_time` datetime NULL DEFAULT NULL COMMENT '瀹℃壒瀹屾垚鏃堕棿',
+ `approve_status` int NOT NULL COMMENT '瀹℃壒鐘舵�侊細0寰呭鏍革紝1瀹℃牳涓紝2瀹℃牳瀹屾垚',
+ `approve_delete` int NOT NULL COMMENT '瀹℃壒鏄惁鍒犻櫎锛�0姝e父锛�1鍒犻櫎',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `approve_type` int NULL DEFAULT NULL COMMENT '瀹℃壒绫诲瀷',
+ `approve_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `start_date_time` datetime NULL DEFAULT NULL COMMENT '寮�濮嬫椂闂�',
+ `end_date_time` datetime NULL DEFAULT NULL COMMENT '缁撴潫鏃堕棿',
+ `start_date` date NULL DEFAULT NULL COMMENT '寮�濮嬫棩鏈�',
+ `end_date` date NULL DEFAULT NULL COMMENT '缁撴潫鏃ユ湡',
+ `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍦扮偣',
+ `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鎶ラ攢閲戦',
+ `maintenance_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '缁翠慨浠锋牸',
+ `device_repair_id` int NULL DEFAULT NULL COMMENT '璁惧鎶ヤ慨id',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 98 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒娴佺▼琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for approve_process_config_node
+-- ----------------------------
+DROP TABLE IF EXISTS `approve_process_config_node`;
+CREATE TABLE `approve_process_config_node` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `approve_type` int NULL DEFAULT NULL COMMENT '瀹℃壒绫诲瀷锛�1鍏嚭绠$悊锛�2璇峰亣绠$悊锛�3鍑哄樊绠$悊锛�4鎶ラ攢绠$悊锛�5閲囪喘瀹℃壒锛�6鎶ヤ环瀹℃壒锛�7鍙戣揣瀹℃壒锛�8鍗遍櫓浣滀笟瀹℃壒',
+ `node_order` int NULL DEFAULT NULL COMMENT '鑺傜偣椤哄簭',
+ `approver_id` int NULL DEFAULT NULL COMMENT '瀹℃壒浜篒D',
+ `approver_name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒浜哄悕绉�',
+ `timeout_hours` int NULL DEFAULT NULL COMMENT '瓒呮椂鏃堕暱锛堝皬鏃讹級',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛ID',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛ID',
+ `update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `delete_flag` tinyint(1) NULL DEFAULT 0 COMMENT '鍒犻櫎鏍囪锛�0姝e父锛�1鍒犻櫎',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹℃壒娴佺▼閰嶇疆鑺傜偣琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for bank
+-- ----------------------------
+DROP TABLE IF EXISTS `bank`;
+CREATE TABLE `bank` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `bank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閾惰鍚嶇О',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閾惰绠$悊琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for borrow_info
+-- ----------------------------
+DROP TABLE IF EXISTS `borrow_info`;
+CREATE TABLE `borrow_info` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鍊熸璁板綍涓婚敭ID',
+ `borrower_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍊熸浜哄鍚�',
+ `borrow_amount` decimal(18, 2) NULL DEFAULT NULL COMMENT '鍊熸閲戦锛堝厓锛�',
+ `interest_rate` decimal(5, 2) NULL DEFAULT NULL COMMENT '鍊熸鍒╃巼锛堝锛�5.85 浠h〃5.85%锛�',
+ `borrow_date` date NULL DEFAULT NULL COMMENT '鍊熸鏃ユ湡',
+ `repay_date` date NULL DEFAULT NULL COMMENT '瀹為檯杩樻鏃ユ湡锛堣繕娆惧悗濉厖锛�',
+ `status` tinyint NOT NULL DEFAULT 1 COMMENT '鍊熸鐘舵�侊細1=寰呰繕娆撅紝2=宸茶繕娆�',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞锛堝�熸璇存槑锛�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓鑰匢D',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰匢D',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍊熸淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for common_file
+-- ----------------------------
+DROP TABLE IF EXISTS `common_file`;
+CREATE TABLE `common_file` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `common_id` int NOT NULL COMMENT '鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�',
+ `type` int NULL DEFAULT NULL COMMENT '鍏宠仈琛ㄧ被鍨�',
+ `url` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '闄勪欢璺緞',
+ `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '闄勪欢鍚嶇О',
+ `create_time` date NULL DEFAULT NULL,
+ `update_time` date NULL DEFAULT NULL,
+ `file_size` bigint NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閿�鍞彴璐︽枃浠�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for compensation_performance
+-- ----------------------------
+DROP TABLE IF EXISTS `compensation_performance`;
+CREATE TABLE `compensation_performance` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `staff_id` bigint NOT NULL COMMENT '鍛樺伐id',
+ `pay_date` date NULL DEFAULT NULL COMMENT '钖祫鏈堜唤',
+ `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '濮撳悕',
+ `should_attended_num` decimal(10, 2) NULL DEFAULT NULL COMMENT '搴斿嚭鍕ゅぉ鏁�',
+ `actual_attended_num` decimal(10, 2) NULL DEFAULT NULL COMMENT '瀹為檯鍑哄嫟澶╂暟',
+ `basic_salary` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍩烘湰宸ヨ祫',
+ `post_salary` decimal(10, 2) NULL DEFAULT NULL COMMENT '宀椾綅宸ヨ祫',
+ `deduction_absenteeism` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍏ョ鑱岀己鍕ゆ墸娆�',
+ `sick_leave_deductions` decimal(10, 2) NULL DEFAULT NULL COMMENT '鐥呭亣鎵f',
+ `deduction_personal_leave` decimal(10, 2) NULL DEFAULT NULL COMMENT '浜嬪亣鎵f',
+ `forget_clock_deduct` decimal(10, 2) NULL DEFAULT NULL COMMENT '蹇樿鎵撳崱鎵f',
+ `performance_score` decimal(10, 2) NULL DEFAULT NULL COMMENT '缁╂晥寰楀垎',
+ `performance_pay` decimal(10, 2) NULL DEFAULT NULL COMMENT '缁╂晥宸ヨ祫',
+ `payable_wages` decimal(10, 2) NULL DEFAULT NULL COMMENT '搴斿彂鍚堣',
+ `social_security_individuals` decimal(10, 2) NULL DEFAULT NULL COMMENT '绀句繚涓汉',
+ `social_security_companies` decimal(10, 2) NULL DEFAULT NULL COMMENT '绀句繚鍏徃',
+ `social_security_total` decimal(10, 2) NULL DEFAULT NULL COMMENT '绀句繚鍚堣',
+ `provident_fund_individuals` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍏Н閲戜釜浜�',
+ `provident_fund_company` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍏Н閲戝叕鍙�',
+ `provident_fund_total` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍏Н閲戝悎璁�',
+ `taxable_waget` decimal(10, 2) NULL DEFAULT NULL COMMENT '搴旂◣宸ヨ祫',
+ `personal_income_tax` decimal(10, 2) NULL DEFAULT NULL COMMENT '涓汉鎵�寰楃◣',
+ `actual_wages` decimal(10, 2) NULL DEFAULT NULL COMMENT '瀹炲彂宸ヨ祫',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '钖叕缁╂晥' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for custom_storage
+-- ----------------------------
+DROP TABLE IF EXISTS `custom_storage`;
+CREATE TABLE `custom_storage` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `item_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鐗╁搧绫诲瀷',
+ `inbound_date` date NULL DEFAULT NULL COMMENT '鍏ュ簱鏃堕棿',
+ `inbound_batches` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍏ュ簱鎵规',
+ `inbound_num` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍏ュ簱鏁伴噺',
+ `supplier_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `product_category` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '浜у搧澶х被',
+ `specification_model` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `unit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `tax_inclusive_unit_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍚◣鍗曚环',
+ `tax_inclusive_total_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍚◣鎬讳环',
+ `tax_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '绋庣巼(%)',
+ `tax_exclusive_total_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '涓嶅惈绋庢�讳环',
+ `create_by` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍏ュ簱浜�',
+ `create_time` datetime NULL DEFAULT NULL,
+ `update_time` datetime NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` bigint NULL DEFAULT NULL,
+ `code` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '缂栧彿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer
+-- ----------------------------
+DROP TABLE IF EXISTS `customer`;
+CREATE TABLE `customer` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `taxpayer_identification_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '绾崇◣浜鸿瘑鍒彿',
+ `company_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍏徃鍦板潃',
+ `company_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍏徃鐢佃瘽',
+ `contact_person` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鑱旂郴浜�',
+ `contact_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `maintainer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '缁存姢浜�',
+ `maintenance_time` date NOT NULL COMMENT '缁存姢鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `basic_bank_account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閾惰鍩烘湰鎴�',
+ `bank_account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閾惰璐﹀彿',
+ `bank_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寮�鎴疯鍙�',
+ `customer_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `usage_user` int NULL DEFAULT NULL COMMENT '浣跨敤鐢ㄦ埛',
+ `usage_status` int NULL DEFAULT NULL COMMENT '浣跨敤鐘舵��',
+ `type` smallint NOT NULL DEFAULT 0 COMMENT '绫诲瀷 0 绉佹捣瀹㈡埛 1 鍏捣瀹㈡埛',
+ `is_assigned` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁琚垎閰嶏細0-鏈垎閰嶏紝1-宸插垎閰�',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 427 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹㈡埛妗f' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer_follow_up
+-- ----------------------------
+DROP TABLE IF EXISTS `customer_follow_up`;
+CREATE TABLE `customer_follow_up` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `follow_up_method` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璺熻繘鏂瑰紡',
+ `follow_up_level` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璺熻繘绋嬪害',
+ `follow_up_time` datetime NOT NULL COMMENT '璺熻繘鏃堕棿',
+ `follower_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璺熻繘浜哄鍚�',
+ `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璺熻繘鍐呭',
+ `follower_user_id` bigint NULL DEFAULT NULL COMMENT '璺熻繘浜篒D',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `customer_id` bigint NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_tenant_id`(`tenant_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹㈡埛璺熻繘杩涘害琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer_follow_up_file
+-- ----------------------------
+DROP TABLE IF EXISTS `customer_follow_up_file`;
+CREATE TABLE `customer_follow_up_file` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `follow_up_id` int NULL DEFAULT NULL COMMENT '璺熻繘璁板綍ID',
+ `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `file_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '鏂囦欢璁块棶鍦板潃',
+ `file_size` bigint NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `file_suffix` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鏂囦欢鍚庣紑',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '涓婁紶鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_follow_up_id`(`follow_up_id` ASC) USING BTREE COMMENT '璺熻繘璁板綍ID绱㈠紩'
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '瀹㈡埛璺熻繘闄勪欢琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer_private
+-- ----------------------------
+DROP TABLE IF EXISTS `customer_private`;
+CREATE TABLE `customer_private` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `taxpayer_identification_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '绾崇◣浜鸿瘑鍒彿',
+ `company_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍏徃鍦板潃',
+ `company_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍏徃鐢佃瘽',
+ `contact_person` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鑱旂郴浜�',
+ `contact_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `maintainer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '缁存姢浜�',
+ `maintenance_time` date NOT NULL COMMENT '缁存姢鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `basic_bank_account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閾惰鍩烘湰鎴�',
+ `bank_account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閾惰璐﹀彿',
+ `bank_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寮�鎴疯鍙�',
+ `customer_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `usage_user` int NULL DEFAULT NULL,
+ `usage_status` int NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹㈡埛妗f' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer_private_pool
+-- ----------------------------
+DROP TABLE IF EXISTS `customer_private_pool`;
+CREATE TABLE `customer_private_pool` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
+ `customer_id` bigint NULL DEFAULT NULL COMMENT '瀹㈡埛id',
+ `bound_id` bigint NULL DEFAULT NULL COMMENT '缁戝畾浜篿d',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `dept_id` int NULL DEFAULT NULL,
+ `type` int NULL DEFAULT 0 COMMENT '绫诲瀷鍖哄垎鍏捣瀹㈡埛鍜岀娴峰鎴� 榛樿鏄娴峰鎴�0 鍏捣1',
+ `delete_flag` int NULL DEFAULT 0 COMMENT '鍒犻櫎鏍囧織',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '绉佹捣瀹㈡埛' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer_return_visit
+-- ----------------------------
+DROP TABLE IF EXISTS `customer_return_visit`;
+CREATE TABLE `customer_return_visit` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `is_enabled` tinyint(1) NULL DEFAULT 1 COMMENT '鎻愰啋寮�鍏� (0:鍏抽棴, 1:寮�鍚�)',
+ `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '鎻愰啋鍐呭',
+ `reminder_time` datetime NOT NULL COMMENT '鎻愰啋鏃堕棿',
+ `is_completed` tinyint(1) NULL DEFAULT 0 COMMENT '澶勭悊鐘舵�� (0:寰呮彁閱�, 1:宸叉彁閱�)',
+ `remind_user_id` bigint NOT NULL COMMENT '鎺ユ敹鎻愰啋鐨勭敤鎴稩D',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `customer_id` bigint NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_remind_user`(`remind_user_id` ASC, `is_completed` ASC) USING BTREE COMMENT '鐢ㄦ埛寰呭姙鏌ヨ绱㈠紩'
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '瀹㈡埛鍥炶鎻愰啋琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer_user
+-- ----------------------------
+DROP TABLE IF EXISTS `customer_user`;
+CREATE TABLE `customer_user` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `customer_id` bigint NOT NULL DEFAULT 0 COMMENT '瀹㈡埛id',
+ `user_id` bigint NOT NULL DEFAULT 0 COMMENT '鐢ㄦ埛id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '绉熸埛id',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for customer_visits
+-- ----------------------------
+DROP TABLE IF EXISTS `customer_visits`;
+CREATE TABLE `customer_visits` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `customer_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `contact` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴浜�',
+ `contact_phone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `location` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浣嶇疆',
+ `visiting_people` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎷滆浜�',
+ `purpose_visit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎷滆鐩殑',
+ `purpose_date` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎷滆鏃堕棿',
+ `visit_address` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎷滆鍦板潃',
+ `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰卛d',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰卛d',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹㈡埛鎷滆鐧昏' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for device_defect_record
+-- ----------------------------
+DROP TABLE IF EXISTS `device_defect_record`;
+CREATE TABLE `device_defect_record` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `device_ledger_id` bigint NOT NULL COMMENT '璁惧鍙拌处id',
+ `defect_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎻忚堪',
+ `eliminate_time` datetime NULL DEFAULT NULL COMMENT '娑堢己鏃堕棿',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鐘舵��',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璁惧缂洪櫡璁板綍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for device_ledger
+-- ----------------------------
+DROP TABLE IF EXISTS `device_ledger`;
+CREATE TABLE `device_ledger` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鍚嶇О',
+ `device_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `supplier_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟�',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `number` decimal(10, 0) NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `tax_including_price_unit` decimal(10, 0) NULL DEFAULT NULL COMMENT '鍚◣鍗曚环',
+ `tax_including_price_total` decimal(10, 0) NULL DEFAULT NULL COMMENT '鍚◣鎬讳环',
+ `tax_rate` decimal(10, 0) NULL DEFAULT NULL COMMENT '绋庣巼',
+ `un_tax_including_price_total` decimal(10, 0) NULL DEFAULT NULL COMMENT '涓嶅惈绋庢�讳环',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '褰曞叆浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鐘舵��',
+ `plan_runtime_time` date NULL DEFAULT NULL COMMENT '璁″垝杩愯鏃堕棿',
+ `start_runtime_time` datetime NULL DEFAULT NULL COMMENT '寮�濮嬭繍琛屾椂闂�',
+ `end_runtime_time` datetime NULL DEFAULT NULL COMMENT '缁撴潫杩愯鏃堕棿',
+ `runtime_duration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '杩愯鏃堕暱',
+ `device_brand` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鍝佺墝',
+ `storage_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀛樻斁浣嶇疆',
+ `is_depr` int NULL DEFAULT NULL COMMENT '鏄惁鎶樻棫 1-鏄� 2-鍚�',
+ `annual_depreciation_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '姣忓勾鎶樻棫閲戦',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧绫诲瀷',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for device_maintenance
+-- ----------------------------
+DROP TABLE IF EXISTS `device_maintenance`;
+CREATE TABLE `device_maintenance` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `device_ledger_id` bigint NOT NULL COMMENT '璁惧鍙拌处id',
+ `maintenance_plan_time` timestamp NULL DEFAULT NULL COMMENT '璁″垝淇濆吇鏃ユ湡',
+ `maintenance_actually_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹為檯淇濆吇浜�',
+ `maintenance_actually_time` timestamp NULL DEFAULT NULL COMMENT '瀹為檯淇濆吇鏃ユ湡',
+ `status` int NOT NULL DEFAULT 0 COMMENT '鐘舵�� 0 寰呬繚鍏� 1 瀹岀粨',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NOT NULL COMMENT '褰曞叆浜�',
+ `update_user` int NOT NULL COMMENT '鏇存柊浜�',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `device_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `maintenance_result` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '淇濆吇缁撴灉',
+ `maintenance_task_id` int NULL DEFAULT NULL COMMENT '淇濆吇浠诲姟id',
+ `frequency_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰戞',
+ `frequency_detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰戞璇︽儏',
+ `next_execution_time` timestamp NULL DEFAULT NULL COMMENT '涓嬫鎵ц鏃堕棿',
+ `last_execution_time` timestamp NULL DEFAULT NULL COMMENT '鏈�鍚庢墽琛屾椂闂�',
+ `spare_parts_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `machinery_category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 39 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for device_maintenance_file
+-- ----------------------------
+DROP TABLE IF EXISTS `device_maintenance_file`;
+CREATE TABLE `device_maintenance_file` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞',
+ `file_size` int NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `device_maintenance_id` int NULL DEFAULT NULL COMMENT '璁惧淇濆吇璁板綍ID',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璁惧淇濆吇闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for device_repair
+-- ----------------------------
+DROP TABLE IF EXISTS `device_repair`;
+CREATE TABLE `device_repair` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `device_ledger_id` bigint NOT NULL COMMENT '璁惧鍙拌处id',
+ `repair_time` timestamp NULL DEFAULT NULL COMMENT '鎶ヤ慨鏃ユ湡',
+ `repair_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鎶ヤ慨浜�',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '鏁呴殰鐜拌薄',
+ `maintenance_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '缁翠慨浜�',
+ `maintenance_time` timestamp NULL DEFAULT NULL COMMENT '缁翠慨鏃堕棿',
+ `maintenance_result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '缁翠慨缁撴灉',
+ `status` int NULL DEFAULT 0 COMMENT '鐘舵��',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NOT NULL COMMENT '褰曞叆浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `device_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `maintenance_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '缁翠慨浠锋牸',
+ `approver_id` int NULL DEFAULT NULL COMMENT '瀹℃壒浜篿d',
+ `spare_parts_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `machinery_category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `acceptance_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '楠屾敹浜�',
+ `acceptance_time` datetime NULL DEFAULT NULL COMMENT '楠屾敹鏃堕棿',
+ `acceptance_remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '楠屾敹澶囨敞',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for device_runtime
+-- ----------------------------
+DROP TABLE IF EXISTS `device_runtime`;
+CREATE TABLE `device_runtime` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `device_ledger_id` bigint NOT NULL COMMENT '璁惧鍙拌处id',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鐘舵��',
+ `plan_runtime_time` datetime NULL DEFAULT NULL COMMENT '璁″垝杩愯鏃堕棿',
+ `start_runtime_time` datetime NULL DEFAULT NULL COMMENT '寮�濮嬭繍琛屾椂闂�',
+ `end_runtime_time` datetime NULL DEFAULT NULL COMMENT '缁撴潫杩愯鏃堕棿',
+ `runtime_duration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '杩愯鏃堕暱',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璁惧杩愯琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for document_classification
+-- ----------------------------
+DROP TABLE IF EXISTS `document_classification`;
+CREATE TABLE `document_classification` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绫诲埆鍚嶇О',
+ `parent_id` bigint NULL DEFAULT NULL COMMENT '鐖剁被id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏂囨。鍒嗙被琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for documentation
+-- ----------------------------
+DROP TABLE IF EXISTS `documentation`;
+CREATE TABLE `documentation` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `document_classification_id` bigint NULL DEFAULT NULL COMMENT '绫诲埆鍚嶇Оid',
+ `doc_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囨。鍚嶇О',
+ `doc_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囨。缂栧彿',
+ `year` bigint NULL DEFAULT NULL COMMENT '骞翠唤',
+ `responsible_person` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璐d换浜�',
+ `warehouse_goods_shelves_rowcol_id` bigint NULL DEFAULT NULL COMMENT '鏂囨。鏀剧疆璐ф灦id',
+ `doc_date` datetime NULL DEFAULT NULL COMMENT '鏂囨。鏃ユ湡',
+ `retention_period` bigint NULL DEFAULT NULL COMMENT '淇濈鏈熼檺',
+ `security_level` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '淇濆瘑绾у埆(缁濆瘑锛屼竴鑸�)',
+ `copy_count` bigint NULL DEFAULT NULL COMMENT '浠芥暟',
+ `page_count` bigint NULL DEFAULT NULL COMMENT '椤垫暟',
+ `doc_category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囨。绫诲埆',
+ `doc_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囨。绉嶇被',
+ `urgency_level` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ョ▼搴�(绱ф�ワ紝鏅��)',
+ `doc_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囨。鐘舵��(鍊熷嚭锛屾甯革紝浣滃簾)',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏂囨。淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for documentation_borrow_management
+-- ----------------------------
+DROP TABLE IF EXISTS `documentation_borrow_management`;
+CREATE TABLE `documentation_borrow_management` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `documentation_id` bigint NULL DEFAULT NULL COMMENT '鏂囨。id',
+ `borrower` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍊熼槄浜�',
+ `borrow_purpose` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍊熼槄鐩殑',
+ `borrow_date` datetime NULL DEFAULT NULL COMMENT '鍊熼槄鏃ユ湡',
+ `due_return_date` datetime NULL DEFAULT NULL COMMENT '搴斿綊杩樻棩鏈�',
+ `returner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰掕繕浜�',
+ `return_date` datetime NULL DEFAULT NULL COMMENT '瀹為檯褰掕繕鏃ユ湡',
+ `borrow_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍊熼槄鐘舵�侊紙鍊熼槄)',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏂囨。鍊熼槄琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for documentation_file
+-- ----------------------------
+DROP TABLE IF EXISTS `documentation_file`;
+CREATE TABLE `documentation_file` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞',
+ `file_size` bigint NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `documentation_id` bigint NULL DEFAULT NULL COMMENT '鏂囨。ID',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏂囨。--闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for documentation_return_management
+-- ----------------------------
+DROP TABLE IF EXISTS `documentation_return_management`;
+CREATE TABLE `documentation_return_management` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `documentation_id` bigint NULL DEFAULT NULL COMMENT '鏂囨。id',
+ `borrow_id` bigint NULL DEFAULT NULL COMMENT '鍊熼槄id',
+ `borrower` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍊熼槄浜�',
+ `borrow_purpose` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍊熼槄鐩殑',
+ `borrow_date` datetime NULL DEFAULT NULL COMMENT '鍊熼槄鏃ユ湡',
+ `due_return_date` datetime NULL DEFAULT NULL COMMENT '搴斿綊杩樻棩鏈�',
+ `returner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰掕繕浜�',
+ `return_date` datetime NULL DEFAULT NULL COMMENT '瀹為檯褰掕繕鏃ユ湡',
+ `borrow_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍊熼槄鐘舵��(褰掕繕)',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏂囨。褰掕繕琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for duty_plan
+-- ----------------------------
+DROP TABLE IF EXISTS `duty_plan`;
+CREATE TABLE `duty_plan` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁″垝鏍囬',
+ `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁″垝鎻忚堪',
+ `level` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁″垝绾у埆',
+ `period` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏃堕棿鍛ㄦ湡',
+ `start_date` datetime NULL DEFAULT NULL COMMENT '寮�濮嬫椂闂�',
+ `end_date` datetime NULL DEFAULT NULL COMMENT '缁撴潫鏃堕棿',
+ `assignee` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璐熻矗浜�',
+ `priority` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浼樺厛绾�',
+ `tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏍囩',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `progress` int NULL DEFAULT NULL COMMENT '瀹屾垚搴�',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍊肩彮涓庤鍒�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for electricity_consumption_area
+-- ----------------------------
+DROP TABLE IF EXISTS `electricity_consumption_area`;
+CREATE TABLE `electricity_consumption_area` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `area_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍖哄煙鍚嶇О',
+ `area_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍖哄煙绫诲瀷',
+ `sort` bigint NULL DEFAULT NULL COMMENT '鎺掑簭',
+ `fu_id` int NULL DEFAULT NULL COMMENT '鐖剁被id',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄧ數鍖哄煙' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for energy_period
+-- ----------------------------
+DROP TABLE IF EXISTS `energy_period`;
+CREATE TABLE `energy_period` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `date` date NULL DEFAULT NULL COMMENT '鏃ユ湡',
+ `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏃舵鍗曚环 (鍏� / 搴�)',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `peak` decimal(10, 2) NULL DEFAULT NULL COMMENT '宄版',
+ `flat` decimal(10, 2) NULL DEFAULT NULL COMMENT '骞虫',
+ `valley` decimal(10, 2) NULL DEFAULT NULL COMMENT '璋锋',
+ `sharp` decimal(10, 2) NULL DEFAULT NULL COMMENT '灏栨',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄧ數鏃舵琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for enterprise_news
+-- ----------------------------
+DROP TABLE IF EXISTS `enterprise_news`;
+CREATE TABLE `enterprise_news` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+ `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鏍囬',
+ `summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '鎽樿',
+ `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '姝f枃',
+ `category` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒嗙被',
+ `read_scope` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'all' COMMENT '闃呰鑼冨洿 all鍏ㄥ憳 dept閮ㄩ棬 custom鑷畾涔�',
+ `is_required` tinyint NOT NULL DEFAULT 0 COMMENT '鏄惁蹇呰 0鍚� 1鏄�',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '鐘舵�� 0鑽夌 1宸插彂甯� 2宸蹭笅绾�',
+ `required_read_count` int NOT NULL DEFAULT 0 COMMENT '闇�瑕侀槄璇荤殑鏁伴噺',
+ `read_count` int NOT NULL DEFAULT 0 COMMENT '宸茬粡闃呰鐨勬暟閲�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_enterprise_news_status`(`status` ASC) USING BTREE,
+ INDEX `idx_enterprise_news_category`(`category` ASC) USING BTREE,
+ INDEX `idx_enterprise_news_dept_id`(`dept_id` ASC) USING BTREE,
+ INDEX `idx_enterprise_news_create_time`(`create_time` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '浼佷笟鏂伴椈琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for enterprise_news_scope_dept
+-- ----------------------------
+DROP TABLE IF EXISTS `enterprise_news_scope_dept`;
+CREATE TABLE `enterprise_news_scope_dept` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+ `news_id` bigint NOT NULL COMMENT '浼佷笟鏂伴椈ID',
+ `dept_id` bigint NOT NULL COMMENT '閮ㄩ棬ID',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_enterprise_news_scope_dept`(`news_id` ASC, `dept_id` ASC) USING BTREE,
+ INDEX `idx_enterprise_news_scope_dept_dept_id`(`dept_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '浼佷笟鏂伴椈闃呰鑼冨洿閮ㄩ棬琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for enterprise_news_scope_user
+-- ----------------------------
+DROP TABLE IF EXISTS `enterprise_news_scope_user`;
+CREATE TABLE `enterprise_news_scope_user` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+ `news_id` bigint NOT NULL COMMENT '浼佷笟鏂伴椈ID',
+ `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛ID',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_enterprise_news_scope_user`(`news_id` ASC, `user_id` ASC) USING BTREE,
+ INDEX `idx_enterprise_news_scope_user_user_id`(`user_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '浼佷笟鏂伴椈闃呰鑼冨洿鐢ㄦ埛琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for equipment_energy_consumption
+-- ----------------------------
+DROP TABLE IF EXISTS `equipment_energy_consumption`;
+CREATE TABLE `equipment_energy_consumption` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '璁惧缂栧彿',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '璁惧鍚嶇О',
+ `power_rating` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '棰濆畾鍔熺巼',
+ `power_actual` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '瀹為檯鍔熺巼',
+ `day_num` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '褰撴棩鐢ㄧ數閲�',
+ `sum_num` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '绱鐢ㄧ數閲�',
+ `every_num` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '姣忔棩闄愬埗鐢甸噺',
+ `run_date` date NULL DEFAULT NULL COMMENT '杩愯鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `electricity_consumption_area_id` bigint NULL DEFAULT NULL COMMENT '鍖哄煙id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '璁惧鑳借��' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for file_sharing
+-- ----------------------------
+DROP TABLE IF EXISTS `file_sharing`;
+CREATE TABLE `file_sharing` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏变韩鏍囬',
+ `departments` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎺ユ敹閮ㄩ棬',
+ `files` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓婁紶鏂囦欢',
+ `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏变韩鎻忚堪',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '琛屾斂绠$悊-閫氱煡绠$悊-鏂囦欢鍏变韩' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for fin_fixed_asset
+-- ----------------------------
+DROP TABLE IF EXISTS `fin_fixed_asset`;
+CREATE TABLE `fin_fixed_asset` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `asset_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璧勪骇缂栧彿',
+ `asset_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璧勪骇鍚嶇О',
+ `category` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璧勪骇绫诲埆',
+ `specification` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `purchase_date` date NOT NULL COMMENT '璐疆鏃ユ湡',
+ `original_value` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '璧勪骇鍘熷��',
+ `useful_life` int NOT NULL DEFAULT 1 COMMENT '浣跨敤骞撮檺(骞�)',
+ `residual_rate` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '娈嬪�肩巼(%)',
+ `accumulated_depreciation` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '绱鎶樻棫',
+ `net_value` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '鍑�鍊�',
+ `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '瀛樻斁鍦扮偣',
+ `department` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浣跨敤閮ㄩ棬',
+ `keeper` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇濈浜�',
+ `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'in_use' COMMENT '鐘舵��: in_use/idle/repair/scrapped',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_fin_fixed_asset_code`(`asset_code` ASC) USING BTREE,
+ INDEX `idx_fin_fixed_asset_status`(`status` ASC) USING BTREE,
+ INDEX `idx_fin_fixed_asset_category`(`category` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鍥哄畾璧勪骇' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for fin_intangible_asset
+-- ----------------------------
+DROP TABLE IF EXISTS `fin_intangible_asset`;
+CREATE TABLE `fin_intangible_asset` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `asset_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璧勪骇缂栧彿',
+ `asset_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璧勪骇鍚嶇О',
+ `category` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璧勪骇绫诲埆',
+ `certificate_no` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璇佷功缂栧彿',
+ `acquisition_date` date NOT NULL COMMENT '鍙栧緱鏃ユ湡',
+ `original_value` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '璧勪骇鍘熷��',
+ `amortization_period` int NOT NULL DEFAULT 1 COMMENT '鎽婇攢骞撮檺(骞�)',
+ `residual_rate` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '娈嬪�肩巼(%)',
+ `accumulated_amortization` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '绱鎽婇攢',
+ `net_value` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '鍑�鍊�',
+ `validity_date` date NULL DEFAULT NULL COMMENT '鏈夋晥鏈熻嚦',
+ `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'in_use' COMMENT '鐘舵��: in_use/expired/amortized',
+ `description` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璧勪骇鎻忚堪',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_fin_intangible_asset_code`(`asset_code` ASC) USING BTREE,
+ INDEX `idx_fin_intangible_asset_status`(`status` ASC) USING BTREE,
+ INDEX `idx_fin_intangible_asset_category`(`category` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鏃犲舰璧勪骇' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for fin_reimbursement
+-- ----------------------------
+DROP TABLE IF EXISTS `fin_reimbursement`;
+CREATE TABLE `fin_reimbursement` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `bill_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鎶ラ攢鍗曞彿',
+ `reimbursement_type` tinyint NOT NULL COMMENT '鎶ラ攢绫诲瀷锛�1-宸梾鎶ラ攢锛�2-璐圭敤鎶ラ攢',
+ `expense_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璐圭敤绫诲瀷锛氬樊鏃呰垂/鍔炲叕閲囪喘/涓氬姟鎷涘緟/浜ら�氳垂/閫氳璐�/鍏朵粬',
+ `applicant_id` bigint NOT NULL COMMENT '鐢宠浜篒D',
+ `applicant_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍛樺伐缂栧彿',
+ `applicant_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍛樺伐濮撳悕',
+ `applicant_dept_id` bigint NULL DEFAULT NULL COMMENT '鐢宠閮ㄩ棬ID',
+ `applicant_dept_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鐢宠閮ㄩ棬鍚嶇О',
+ `reason` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鎶ラ攢鍘熷洜',
+ `apply_amount` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '鐢宠閲戦',
+ `detail_total_amount` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '鏄庣粏姹囨�婚噾棰�',
+ `payee_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鏀舵浜�',
+ `payee_account` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏀舵璐﹀彿',
+ `payee_bank` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '寮�鎴锋敮琛�',
+ `approval_instance_id` bigint NULL DEFAULT NULL COMMENT '瀹℃壒瀹炰緥ID锛屽搴� approval_instance.id',
+ `approve_process_id` bigint NULL DEFAULT NULL COMMENT '瀹℃壒娴佺▼ID锛屽搴� approve_process.id',
+ `bill_status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'DRAFT' COMMENT '鍗曟嵁鐘舵�侊細DRAFT-鑽夌锛孖N_APPROVAL-瀹℃壒涓紝APPROVED-瀹℃壒閫氳繃锛孯EJECTED-瀹℃壒椹冲洖锛學ITHDRAWN-宸叉挙鍥烇紝PAID-宸蹭粯娆�',
+ `approved_time` datetime NULL DEFAULT NULL COMMENT '瀹℃壒閫氳繃鏃堕棿',
+ `paid_time` datetime NULL DEFAULT NULL COMMENT '浠樻鏃堕棿',
+ `account_expense_id` bigint NULL DEFAULT NULL COMMENT '鐢熸垚鐨勮储鍔℃敮鍑鸿褰旾D锛屽搴� account_expense.id',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '褰掑睘閮ㄩ棬ID',
+ `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎锛�0-鍚︼紝1-鏄�',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_fin_reimbursement_bill_no`(`bill_no` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_type_status`(`reimbursement_type` ASC, `bill_status` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_applicant`(`applicant_id` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_approval_instance`(`approval_instance_id` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_apply_amount`(`apply_amount` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_create_time`(`create_time` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鎶ラ攢鍗曚富琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for fin_reimbursement_detail
+-- ----------------------------
+DROP TABLE IF EXISTS `fin_reimbursement_detail`;
+CREATE TABLE `fin_reimbursement_detail` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `reimbursement_id` bigint NOT NULL COMMENT '鎶ラ攢鍗旾D锛屽搴� fin_reimbursement.id',
+ `row_no` int NOT NULL DEFAULT 1 COMMENT '鏄庣粏琛屽彿',
+ `invoice_date` date NULL DEFAULT NULL COMMENT '鍙戠エ鏃ユ湡',
+ `expense_category` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璐圭敤绉戠洰',
+ `amount` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '閲戦',
+ `description` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鎻忚堪',
+ `invoice_no` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍙戠エ鍙风爜',
+ `invoice_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `invoice_amount` decimal(18, 2) NULL DEFAULT NULL COMMENT '绁ㄩ潰閲戦',
+ `tax_rate` decimal(8, 2) NULL DEFAULT NULL COMMENT '绋庣巼',
+ `tax_amount` decimal(18, 2) NULL DEFAULT NULL COMMENT '绋庨',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '褰掑睘閮ㄩ棬ID',
+ `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎锛�0-鍚︼紝1-鏄�',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_fin_reimbursement_detail_reimbursement`(`reimbursement_id` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_detail_category`(`expense_category` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_detail_invoice_date`(`invoice_date` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鎶ラ攢鍗曟槑缁嗚〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for fin_reimbursement_travel
+-- ----------------------------
+DROP TABLE IF EXISTS `fin_reimbursement_travel`;
+CREATE TABLE `fin_reimbursement_travel` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `reimbursement_id` bigint NOT NULL COMMENT '鎶ラ攢鍗旾D锛屽搴� fin_reimbursement.id',
+ `start_time` datetime NOT NULL COMMENT '鍑哄樊寮�濮嬫椂闂�',
+ `end_time` datetime NOT NULL COMMENT '鍑哄樊缁撴潫鏃堕棿',
+ `travel_days` decimal(8, 2) NULL DEFAULT NULL COMMENT '鍑哄樊澶╂暟',
+ `departure_city` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍑哄樊鍦�/鍑哄彂鍩庡競',
+ `destination_city` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鐩殑鍦�/鐩殑鍩庡競',
+ `hotel_standard` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '閰掑簵鏍囧噯',
+ `lodging_days` decimal(8, 4) NULL DEFAULT 0.0000 COMMENT '浣忓澶╂暟',
+ `meal_allowance` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '鐢熸椿琛ヨ创',
+ `transport_allowance` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '浜ら�氳ˉ璐�',
+ `lodging_limit` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '浣忓闄愰',
+ `standard_tag` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鐗规壒鏍囪鏂囨湰锛屽鍦ㄦ爣鍑嗚寖鍥村唴/瓒呮爣鐗规壒',
+ `within_standard` tinyint NOT NULL DEFAULT 1 COMMENT '鏄惁鍦ㄦ爣鍑嗗唴锛�1-鏄紝0-鍚�',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '褰掑睘閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_fin_reimbursement_travel_reimbursement`(`reimbursement_id` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_travel_start_end`(`start_time` ASC, `end_time` ASC) USING BTREE,
+ INDEX `idx_fin_reimbursement_travel_city`(`departure_city` ASC, `destination_city` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '宸梾鎶ラ攢鎵╁睍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for fin_voucher
+-- ----------------------------
+DROP TABLE IF EXISTS `fin_voucher`;
+CREATE TABLE `fin_voucher` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `voucher_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍑瘉瀛楀彿',
+ `voucher_date` date NOT NULL COMMENT '鍑瘉鏃ユ湡',
+ `summary` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鎽樿',
+ `debit` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '鍊熸柟鍚堣',
+ `credit` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '璐锋柟鍚堣',
+ `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒跺崟浜�',
+ `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'unposted' COMMENT '鐘舵��: unposted/posted/cancelled',
+ `attachment_count` int NOT NULL DEFAULT 0 COMMENT '闄勪欢寮犳暟',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `uk_fin_voucher_no`(`voucher_no` ASC) USING BTREE,
+ INDEX `idx_fin_voucher_date`(`voucher_date` ASC) USING BTREE,
+ INDEX `idx_fin_voucher_status`(`status` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鍑瘉涓昏〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for fin_voucher_entry
+-- ----------------------------
+DROP TABLE IF EXISTS `fin_voucher_entry`;
+CREATE TABLE `fin_voucher_entry` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `voucher_id` bigint NOT NULL COMMENT '鍑瘉ID',
+ `row_no` int NOT NULL DEFAULT 1 COMMENT '琛屽彿',
+ `subject_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '绉戠洰缂栫爜',
+ `subject_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绉戠洰鍚嶇О',
+ `summary` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鎽樿',
+ `debit` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '鍊熸柟閲戦',
+ `credit` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '璐锋柟閲戦',
+ `auxiliary_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '杈呭姪鏍哥畻绫诲瀷',
+ `auxiliary_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '杈呭姪鏍哥畻瀵硅薄ID',
+ `auxiliary_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '杈呭姪鏍哥畻瀵硅薄鍚嶇О',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_fin_voucher_entry_voucher`(`voucher_id` ASC) USING BTREE,
+ INDEX `idx_fin_voucher_entry_subject`(`subject_code` ASC) USING BTREE,
+ INDEX `idx_fin_voucher_entry_aux`(`auxiliary_type` ASC, `auxiliary_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鍑瘉鍒嗗綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for gas_tank_warning
+-- ----------------------------
+DROP TABLE IF EXISTS `gas_tank_warning`;
+CREATE TABLE `gas_tank_warning` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `tank_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍌ㄦ皵缃愮紪鐮�',
+ `tank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍌ㄦ皵缃愬悕绉�',
+ `tank_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍌ㄦ皵缃愮被鍨�',
+ `specification_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `volume` bigint NULL DEFAULT NULL COMMENT '瀹圭Н(m鲁)',
+ `current_gas_level` bigint NULL DEFAULT NULL COMMENT '褰撳墠姘斾綋閲�',
+ `safety_gas_level` bigint NULL DEFAULT NULL COMMENT '瀹夊叏姘斾綋閲�',
+ `min_gas_level` bigint NULL DEFAULT NULL COMMENT '鏈�浣庢皵浣撻噺',
+ `max_gas_level` bigint NULL DEFAULT NULL COMMENT '鏈�楂樻皵浣撻噺',
+ `current_pressure` decimal(10, 1) NULL DEFAULT NULL COMMENT '褰撳墠鍘嬪姏(MPa)',
+ `warning_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰勮绫诲瀷',
+ `warning_level` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰勮绾у埆',
+ `warning_threshold` bigint NULL DEFAULT NULL COMMENT '棰勮闃堝��',
+ `is_enabled` int NULL DEFAULT NULL COMMENT '鏄惁鍚敤',
+ `warning_time` datetime NULL DEFAULT NULL COMMENT '棰勮鏃堕棿',
+ `warning_duration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰勮鎸佺画澶╂暟',
+ `last_update_time` datetime NULL DEFAULT NULL COMMENT '鏈�鍚庢洿鏂版椂闂�',
+ `expected_refill_time` datetime NULL DEFAULT NULL COMMENT '棰勮鍏呰鏃堕棿',
+ `expected_shortage_time` datetime NULL DEFAULT NULL COMMENT '棰勮缂烘皵鏃堕棿',
+ `warning_rule` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰�???鏃惰Е鍙戦璀�-棰勮瑙勫垯',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '搴撳瓨棰勮-姘旂綈璀﹀憡' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for gen_table
+-- ----------------------------
+DROP TABLE IF EXISTS `gen_table`;
+CREATE TABLE `gen_table` (
+ `table_id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+ `table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '琛ㄥ悕绉�',
+ `table_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '琛ㄦ弿杩�',
+ `sub_table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏宠仈瀛愯〃鐨勮〃鍚�',
+ `sub_table_fk_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀛愯〃鍏宠仈鐨勫閿悕',
+ `class_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀹炰綋绫诲悕绉�',
+ `tpl_category` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'crud' COMMENT '浣跨敤鐨勬ā鏉匡紙crud鍗曡〃鎿嶄綔 tree鏍戣〃鎿嶄綔锛�',
+ `tpl_web_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍓嶇妯℃澘绫诲瀷锛坋lement-ui妯$増 element-plus妯$増锛�',
+ `package_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢熸垚鍖呰矾寰�',
+ `module_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢熸垚妯″潡鍚�',
+ `business_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢熸垚涓氬姟鍚�',
+ `function_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢熸垚鍔熻兘鍚�',
+ `function_author` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢熸垚鍔熻兘浣滆��',
+ `gen_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鐢熸垚浠g爜鏂瑰紡锛�0zip鍘嬬缉鍖� 1鑷畾涔夎矾寰勶級',
+ `gen_path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '/' COMMENT '鐢熸垚璺緞锛堜笉濉粯璁ら」鐩矾寰勶級',
+ `options` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏跺畠鐢熸垚閫夐」',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`table_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浠g爜鐢熸垚涓氬姟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for gen_table_column
+-- ----------------------------
+DROP TABLE IF EXISTS `gen_table_column`;
+CREATE TABLE `gen_table_column` (
+ `column_id` bigint NOT NULL AUTO_INCREMENT COMMENT '缂栧彿',
+ `table_id` bigint NULL DEFAULT NULL COMMENT '褰掑睘琛ㄧ紪鍙�',
+ `column_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒楀悕绉�',
+ `column_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒楁弿杩�',
+ `column_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒楃被鍨�',
+ `java_type` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'JAVA绫诲瀷',
+ `java_field` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'JAVA瀛楁鍚�',
+ `is_pk` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁涓婚敭锛�1鏄級',
+ `is_increment` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁鑷锛�1鏄級',
+ `is_required` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁蹇呭~锛�1鏄級',
+ `is_insert` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁涓烘彃鍏ュ瓧娈碉紙1鏄級',
+ `is_edit` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁缂栬緫瀛楁锛�1鏄級',
+ `is_list` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁鍒楄〃瀛楁锛�1鏄級',
+ `is_query` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁鏌ヨ瀛楁锛�1鏄級',
+ `query_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'EQ' COMMENT '鏌ヨ鏂瑰紡锛堢瓑浜庛�佷笉绛変簬銆佸ぇ浜庛�佸皬浜庛�佽寖鍥达級',
+ `html_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄剧ず绫诲瀷锛堟枃鏈銆佹枃鏈煙銆佷笅鎷夋銆佸閫夋銆佸崟閫夋銆佹棩鏈熸帶浠讹級',
+ `dict_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀛楀吀绫诲瀷',
+ `sort` int NULL DEFAULT NULL COMMENT '鎺掑簭',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`column_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浠g爜鐢熸垚涓氬姟琛ㄥ瓧娈�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for holiday_application
+-- ----------------------------
+DROP TABLE IF EXISTS `holiday_application`;
+CREATE TABLE `holiday_application` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `staff_id` int NULL DEFAULT NULL COMMENT '鍛樺伐id',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍋囨湡绫诲瀷',
+ `start_date` datetime NULL DEFAULT NULL COMMENT '寮�濮嬫棩鏈�',
+ `end_date` datetime NULL DEFAULT NULL COMMENT '缁撴潫鏃ユ湡',
+ `days` int NULL DEFAULT NULL COMMENT '澶╂暟',
+ `reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢宠鍘熷洜',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍋囨湡鐢宠' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for holiday_settings
+-- ----------------------------
+DROP TABLE IF EXISTS `holiday_settings`;
+CREATE TABLE `holiday_settings` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍋囨湡鍚嶇О',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍋囨湡绫诲瀷',
+ `start_date` datetime NULL DEFAULT NULL COMMENT '寮�濮嬫棩鏈�',
+ `end_date` datetime NULL DEFAULT NULL COMMENT '缁撴潫鏃ユ湡',
+ `days` int NULL DEFAULT NULL COMMENT '澶╂暟',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍋囨湡璁剧疆' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for inbound_management
+-- ----------------------------
+DROP TABLE IF EXISTS `inbound_management`;
+CREATE TABLE `inbound_management` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '搴忓彿',
+ `order_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁㈠崟鍙�',
+ `arrival_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒拌揣鍗曞彿',
+ `supplier_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒拌揣鐘舵��',
+ `arrival_time` datetime NULL DEFAULT NULL COMMENT '鍒拌揣鏃堕棿',
+ `arrival_quantity` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒拌揣鏁伴噺',
+ `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '淇敼鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘鍒拌揣琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for inspection_task
+-- ----------------------------
+DROP TABLE IF EXISTS `inspection_task`;
+CREATE TABLE `inspection_task` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '宸℃浠诲姟鍞竴鏍囪瘑',
+ `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鍚嶇О',
+ `inspection_project` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸℃椤圭洰',
+ `task_id` int NULL DEFAULT NULL COMMENT '璁惧id',
+ `inspector_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `inspector` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵ц宸℃鐨勪汉鍛樺鍚�',
+ `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '浠诲姟闄勫姞璇存槑鎴栫壒娈婃儏鍐佃褰�',
+ `inspection_result` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸℃缁撴灉 0寮傚父 1姝e父',
+ `abnormal_description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寮傚父鎻忚堪',
+ `device_repair_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈缁翠慨鍗旾D',
+ `acceptance_user_id` bigint NULL DEFAULT NULL COMMENT '楠屾敹浜篒D',
+ `acceptance_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '楠屾敹浜�',
+ `registrant_id` bigint NULL DEFAULT NULL,
+ `registrant` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浠诲姟鐧昏浜哄鍚�',
+ `frequency_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰戞',
+ `inspection_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸℃鍦扮偣璇︾粏鎻忚堪',
+ `frequency_detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏃堕棿缁嗚妭',
+ `deleted` int NOT NULL DEFAULT 0 COMMENT '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛',
+ `create_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�',
+ `update_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鏈�鍚庢洿鏂版椂闂�',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_inspection_task_device_repair_id`(`device_repair_id` ASC) USING BTREE,
+ INDEX `idx_inspection_task_inspection_result`(`inspection_result` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '宸℃浠诲姟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for invoice_ledger
+-- ----------------------------
+DROP TABLE IF EXISTS `invoice_ledger`;
+CREATE TABLE `invoice_ledger` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `invoice_registration_product_id` bigint NULL DEFAULT NULL COMMENT '浜у搧寮�绁ㄧ櫥璁拌褰曡〃涓婚敭',
+ `invoice_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ鍙�',
+ `invoice_total` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍙戠エ閲戦',
+ `invoice_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寮�绁ㄤ汉',
+ `invoice_date` datetime NULL DEFAULT NULL COMMENT '寮�绁ㄦ棩鏈�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 666 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '寮�绁ㄥ彴璐�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for invoice_ledger_file
+-- ----------------------------
+DROP TABLE IF EXISTS `invoice_ledger_file`;
+CREATE TABLE `invoice_ledger_file` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞',
+ `file_size` int NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `invoice_ledger_id` bigint NULL DEFAULT NULL COMMENT '寮�绁ㄥ彴璐D',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 49 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '寮�绁ㄥ彴璐﹂檮浠惰〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for invoice_purchase
+-- ----------------------------
+DROP TABLE IF EXISTS `invoice_purchase`;
+CREATE TABLE `invoice_purchase` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `purchase_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '閲囪喘鍚堝悓鍙�',
+ `sales_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '閿�鍞悎鍚屽彿',
+ `supplier_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `invoice_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍙戠エ鍙�',
+ `invoice_amount` decimal(10, 2) NOT NULL COMMENT '鍙戠エ閲戦锛堝厓锛�',
+ `tax_rate` decimal(5, 2) NOT NULL COMMENT '绋庣巼',
+ `iss_uer_id` int NULL DEFAULT NULL,
+ `iss_uer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '寮�绁ㄤ汉',
+ `issue_date` date NOT NULL COMMENT '寮�绁ㄦ棩鏈�',
+ `invoice_file` longblob NULL COMMENT '鍙戠エ鏂囦欢锛圥DF鏍煎紡锛�',
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `purchase_ledger_id` int NULL DEFAULT NULL,
+ `sales_ledger_id` int NULL DEFAULT NULL COMMENT '鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍙戠エ淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for invoice_registration
+-- ----------------------------
+DROP TABLE IF EXISTS `invoice_registration`;
+CREATE TABLE `invoice_registration` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `sales_ledger_id` bigint NULL DEFAULT NULL COMMENT '閿�鍞彴璐ales_ledger涓婚敭',
+ `sales_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閿�鍞悎鍚屽彿',
+ `customer_id` bigint NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇ОID',
+ `salesman` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓氬姟鍛�',
+ `project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椤圭洰鍚嶇О',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 503 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '寮�绁ㄧ櫥璁拌褰曡〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for invoice_registration_product
+-- ----------------------------
+DROP TABLE IF EXISTS `invoice_registration_product`;
+CREATE TABLE `invoice_registration_product` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `sales_ledger_id` bigint NOT NULL COMMENT '鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�',
+ `sales_ledger_product_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈sales_ledger_product涓婚敭',
+ `invoice_registration_id` bigint NULL DEFAULT NULL COMMENT '寮�绁ㄧ櫥璁拌〃invoice_registration涓婚敭',
+ `product_category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜у搧澶х被',
+ `specification_model` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `quantity` decimal(18, 2) NOT NULL COMMENT '鏁伴噺',
+ `tax_rate` decimal(5, 2) NOT NULL COMMENT '绋庣巼',
+ `tax_inclusive_unit_price` decimal(18, 2) NOT NULL COMMENT '鍚◣鍗曚环',
+ `tax_inclusive_total_price` decimal(18, 2) NOT NULL COMMENT '鍚◣鎬讳环',
+ `tax_exclusive_total_price` decimal(18, 2) NOT NULL COMMENT '涓嶅惈绋庢�讳环',
+ `invoice_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `invoice_num` decimal(10, 2) NULL DEFAULT NULL COMMENT '寮�绁ㄦ暟',
+ `invoice_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '寮�绁ㄩ噾棰�',
+ `no_invoice_num` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈紑绁ㄦ暟',
+ `no_invoice_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈紑绁ㄩ噾棰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 666 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜у搧寮�绁ㄧ櫥璁拌褰曡〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for knowledge_base
+-- ----------------------------
+DROP TABLE IF EXISTS `knowledge_base`;
+CREATE TABLE `knowledge_base` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐭ヨ瘑鏍囬',
+ `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐭ヨ瘑绫诲瀷',
+ `scenario` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫傜敤鍦烘櫙',
+ `efficiency` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙e喅鏁堢巼',
+ `problem` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '闂鎻忚堪',
+ `solution` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '瑙e喅鏂规',
+ `key_points` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鍏抽敭瑕佺偣',
+ `creator` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `usage_count` int NULL DEFAULT 0 COMMENT '浣跨敤娆℃暟',
+ `file_count` int NULL DEFAULT 0 COMMENT '鏂囦欢鏁伴噺',
+ `total_chunk_count` int NULL DEFAULT 0 COMMENT '鎬诲垏鐗囨暟閲�',
+ `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐭ヨ瘑搴撴弿杩�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `create_user` int NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` bigint NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐭ヨ瘑搴撹〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for knowledge_base_vector
+-- ----------------------------
+DROP TABLE IF EXISTS `knowledge_base_vector`;
+CREATE TABLE `knowledge_base_vector` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `knowledge_base_id` bigint NOT NULL COMMENT '鍏宠仈鐭ヨ瘑搴揑D',
+ `storage_blob_id` bigint NOT NULL COMMENT '鍏宠仈鏂囦欢blob ID',
+ `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏂囦欢鍚嶇О',
+ `file_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏂囦欢绫诲瀷',
+ `vector_status` tinyint NULL DEFAULT 0 COMMENT '鍚戦噺鍖栫姸鎬�: 0-寰呭鐞�, 1-澶勭悊涓�, 2-宸插畬鎴�, 3-澶辫触',
+ `vector_error` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚戦噺鍖栧け璐ュ師鍥�',
+ `chunk_count` int NULL DEFAULT 0 COMMENT '鍒囩墖鏁伴噺',
+ `namespace` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚戦噺鍛藉悕绌洪棿',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` bigint NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_knowledge_base_id`(`knowledge_base_id` ASC) USING BTREE,
+ INDEX `idx_storage_blob_id`(`storage_blob_id` ASC) USING BTREE,
+ INDEX `idx_vector_status`(`vector_status` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐭ヨ瘑搴撴枃浠跺悜閲忚褰曡〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for labor_issue
+-- ----------------------------
+DROP TABLE IF EXISTS `labor_issue`;
+CREATE TABLE `labor_issue` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `order_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鍔充繚鍗曞彿',
+ `staff_id` bigint NULL DEFAULT NULL COMMENT '鍛樺伐id',
+ `dict_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鍔充繚绫诲瀷锛堝瓧鍏革級',
+ `dict_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '瀛楀吀id',
+ `num` bigint NULL DEFAULT NULL COMMENT '鍙戞斁鏁伴噺',
+ `factory_date` date NULL DEFAULT NULL COMMENT '杩涘巶鏃ユ湡',
+ `Issue_date` date NULL DEFAULT NULL COMMENT '鍙戞斁鏃ユ湡',
+ `adopted_date` date NULL DEFAULT NULL COMMENT '棰嗙敤鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '鍔充繚鍙戞斁琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for loss
+-- ----------------------------
+DROP TABLE IF EXISTS `loss`;
+CREATE TABLE `loss` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `rate` decimal(10, 2) NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for maintenance_task
+-- ----------------------------
+DROP TABLE IF EXISTS `maintenance_task`;
+CREATE TABLE `maintenance_task` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁惧鍚嶇О',
+ `task_id` int NULL DEFAULT NULL COMMENT '璁惧id',
+ `frequency_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '棰戞',
+ `frequency_detail` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `next_execution_time` datetime(6) NULL DEFAULT NULL,
+ `last_execution_time` datetime(6) NULL DEFAULT NULL,
+ `is_active` tinyint(1) NULL DEFAULT NULL,
+ `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `registrant_id` bigint NULL DEFAULT NULL COMMENT '褰曞叆浜篿d',
+ `registrant` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰曞叆浜�',
+ `registration_date` date NOT NULL COMMENT '褰曞叆鏃ユ湡',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `deleted` int NOT NULL DEFAULT 0 COMMENT '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛',
+ `create_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�',
+ `update_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鏈�鍚庢洿鏂版椂闂�',
+ `tenant_id` int NULL DEFAULT NULL,
+ `device_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `machinery_category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧椤圭洰',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `maintenance_person` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '淇濆吇浜�',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹氭椂淇濆吇浠诲姟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for measuring_instrument_ledger
+-- ----------------------------
+DROP TABLE IF EXISTS `measuring_instrument_ledger`;
+CREATE TABLE `measuring_instrument_ledger` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `user_id` bigint NULL DEFAULT NULL COMMENT '褰曞叆浜篿d',
+ `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '褰曞叆浜哄悕绉�',
+ `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '璁¢噺鍣ㄥ叿缂栧彿',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '璁¢噺鍣ㄥ叿鍚嶇О',
+ `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `most_date` date NULL DEFAULT NULL COMMENT '鏈�杩戜竴娆℃瀹氭棩鏈�',
+ `valid` int NULL DEFAULT NULL COMMENT '妫�瀹氭湁鏁堟湡锛堝崟浣嶅ぉ锛�',
+ `next_date` date NULL DEFAULT NULL COMMENT '棰勮涓嬫妫�瀹氭棩鏈�',
+ `record_date` date NULL DEFAULT NULL COMMENT '褰曞叆鏃ユ湡',
+ `status` int NULL DEFAULT NULL COMMENT '鐘舵�侊紙1-鏈夋晥 2-閫炬湡锛�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `instation_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '瀹夎浣嶇疆',
+ `unit` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '妫�瀹氬崟浣�',
+ `cycle` int NULL DEFAULT NULL COMMENT '妫�瀹氬懆鏈燂紙澶╋級',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '璁¢噺鍣ㄥ叿鍙拌处' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for measuring_instrument_ledger_record
+-- ----------------------------
+DROP TABLE IF EXISTS `measuring_instrument_ledger_record`;
+CREATE TABLE `measuring_instrument_ledger_record` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `measuring_instrument_ledger_id` bigint NULL DEFAULT NULL COMMENT '璁¢噺鍣ㄥ叿鍙拌处id',
+ `user_id` bigint NULL DEFAULT NULL COMMENT '妫�瀹歩d',
+ `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '妫�瀹氫汉鍚嶇О',
+ `record_date` date NULL DEFAULT NULL COMMENT '妫�瀹氭棩鏈�',
+ `entry_date` date NULL DEFAULT NULL COMMENT '褰曞叆鏃ユ湡',
+ `valid` int NULL DEFAULT NULL COMMENT '妫�瀹氭湁鏁堟湡锛堝崟浣嶅ぉ锛�',
+ `status` int NULL DEFAULT NULL COMMENT '鐘舵�侊紙1-鏈夋晥 2-閫炬湡锛�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '璁¢噺鍣ㄥ叿鍙拌处璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for meet_application
+-- ----------------------------
+DROP TABLE IF EXISTS `meet_application`;
+CREATE TABLE `meet_application` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鐢宠ID',
+ `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '浼氳涓婚',
+ `room_id` bigint NOT NULL COMMENT '浼氳瀹D',
+ `host` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '涓绘寔浜�',
+ `meeting_date` date NOT NULL COMMENT '浼氳鏃ユ湡',
+ `start_time` datetime NOT NULL COMMENT '寮�濮嬫椂闂�',
+ `end_time` datetime NOT NULL COMMENT '缁撴潫鏃堕棿',
+ `participants` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '鍙備細浜哄憳锛圝SON鏍煎紡瀛樺偍ID鏁扮粍锛�',
+ `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '浼氳璇存槑',
+ `application_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'approval' COMMENT '鐢宠绫诲瀷锛坅pproval:瀹℃壒娴佺▼, department:閮ㄩ棬绾�, notification:閫氱煡鍙戝竷锛�',
+ `status` tinyint NOT NULL DEFAULT 0 COMMENT '鐘舵�侊紙0:寰呭鎵�, 1:宸查�氳繃, 2:宸叉嫆缁�, 3:宸插彇娑堬級',
+ `applicant` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '鐢宠浜�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `publish_status` int NULL DEFAULT 0 COMMENT '鍙戝竷鐘舵��',
+ `publish_comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '鍙戝竷璇勮',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_title`(`title` ASC) USING BTREE,
+ INDEX `idx_meeting_date`(`meeting_date` ASC) USING BTREE,
+ INDEX `idx_applicant`(`applicant` ASC) USING BTREE,
+ INDEX `idx_status`(`status` ASC) USING BTREE,
+ INDEX `idx_create_time`(`create_time` ASC) USING BTREE,
+ INDEX `idx_tenant_id`(`tenant_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '浼氳鐢宠琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for meet_draft
+-- ----------------------------
+DROP TABLE IF EXISTS `meet_draft`;
+CREATE TABLE `meet_draft` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鑽夌ID',
+ `room_id` bigint NOT NULL COMMENT '浼氳缂栧彿',
+ `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '浼氳涓婚',
+ `host` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '涓绘寔浜�',
+ `meeting_date` date NOT NULL COMMENT '浼氳鏃ユ湡',
+ `start_time` datetime NOT NULL COMMENT '寮�濮嬫椂闂�',
+ `end_time` datetime NOT NULL COMMENT '缁撴潫鏃堕棿',
+ `participants` int NOT NULL DEFAULT 0 COMMENT '鍙備細浜烘暟',
+ `participant_list` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '鍙備細浜哄憳鍒楄〃',
+ `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '浼氳璇存槑',
+ `creator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '鍒涘缓浜�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '浼氳鑽夌琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for meeting_minutes
+-- ----------------------------
+DROP TABLE IF EXISTS `meeting_minutes`;
+CREATE TABLE `meeting_minutes` (
+ `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '绾ID',
+ `meeting_id` bigint UNSIGNED NOT NULL COMMENT '鍏宠仈鐨勪細璁甀D',
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '绾鏍囬',
+ `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '绾鍐呭锛堝瘜鏂囨湰锛�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_meeting_id`(`meeting_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浼氳绾琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for meeting_room
+-- ----------------------------
+DROP TABLE IF EXISTS `meeting_room`;
+CREATE TABLE `meeting_room` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '浼氳瀹D',
+ `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '浼氳瀹ゅ悕绉�',
+ `location` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '浣嶇疆',
+ `capacity` int NOT NULL DEFAULT 10 COMMENT '瀹圭撼浜烘暟',
+ `equipment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '璁惧閰嶇疆锛堥�楀彿鍒嗛殧锛�',
+ `status` tinyint NOT NULL DEFAULT 1 COMMENT '鐘舵�侊紙1:鍚敤 0:绂佺敤锛�',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '浼氳瀹よ〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for notice
+-- ----------------------------
+DROP TABLE IF EXISTS `notice`;
+CREATE TABLE `notice` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鍏憡ID',
+ `title` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '鍏憡鏍囬',
+ `type` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '1' COMMENT '鍏憡绫诲瀷锛�1鏀惧亣閫氱煡 2璁惧缁翠慨閫氱煡锛�',
+ `status` tinyint NOT NULL DEFAULT 0 COMMENT '鐘舵�侊紙0鑽夌 1鍙戝竷 2宸蹭笅绾匡級',
+ `content` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '鍏憡鍐呭',
+ `priority` tinyint NOT NULL DEFAULT 0 COMMENT '浼樺厛绾�(1鏅�� 2閲嶈 3绱ф��)',
+ `create_user` bigint NOT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` timestamp NOT NULL COMMENT '鍒涘缓鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '绉熸埛id',
+ `expiration_date` date NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '閫氱煡鍏憡琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for notice_type
+-- ----------------------------
+DROP TABLE IF EXISTS `notice_type`;
+CREATE TABLE `notice_type` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `notice_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '閫氱煡鍏憡鐨勫叕鍛婄被鍨�',
+ `tenant_id` int NULL DEFAULT NULL,
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '閫氱煡鍏憡鐨勫叕鍛婄被鍨嬬淮鎶�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for notification_management
+-- ----------------------------
+DROP TABLE IF EXISTS `notification_management`;
+CREATE TABLE `notification_management` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫氱煡鏍囬',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫氱煡绫诲瀷',
+ `priority` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浼樺厛绾�',
+ `expire_date` datetime NULL DEFAULT NULL COMMENT '鏈夋晥鏈熸椂闂�',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `departments` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎺ユ敹閮ㄩ棬',
+ `sync_methods` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚屾鏂瑰紡',
+ `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫氱煡鍐呭',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '琛屾斂绠$悊-閫氱煡绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for office_supplies
+-- ----------------------------
+DROP TABLE IF EXISTS `office_supplies`;
+CREATE TABLE `office_supplies` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '娉ㄨВ',
+ `code` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '缂栧彿',
+ `applicant` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鐢宠浜�',
+ `item_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鐗╁搧鍚嶇О',
+ `dept` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '閮ㄩ棬',
+ `material_type` int NULL DEFAULT NULL COMMENT '鐗╄祫绫诲瀷锛�1-鍏朵粬 2-娓呮磥鐢ㄥ搧 3-鐢靛瓙鐢ㄥ搧 4-鐢靛瓙璁惧锛�',
+ `apply_num` int NULL DEFAULT NULL COMMENT '鐢宠鏁伴噺',
+ `approval_opinions` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '瀹℃壒鎰忚',
+ `reason` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鐢宠鍘熷洜',
+ `urgency` int NULL DEFAULT NULL COMMENT '绱ф�ョ▼搴︼紙1-鏅�� 2-绱ф�� 3-闈炲父绱ф�ワ級',
+ `status` int NULL DEFAULT NULL COMMENT '鐘舵�侊紙1-寰呭鎵� 2-宸叉嫆缁� 3-宸查�氳繃 4-宸插彂鏀撅級',
+ `apply_time` datetime NULL DEFAULT NULL COMMENT '鐢宠鏃堕棿',
+ `approval` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '瀹℃壒浜�',
+ `approval_time` datetime NULL DEFAULT NULL COMMENT '瀹℃壒鏃堕棿',
+ `issue_user` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '鍙戞斁浜�',
+ `issue_time` datetime NULL DEFAULT NULL COMMENT '鍙戞斁鏃堕棿',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for online_meeting
+-- ----------------------------
+DROP TABLE IF EXISTS `online_meeting`;
+CREATE TABLE `online_meeting` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浼氳鏍囬',
+ `start_time` datetime NULL DEFAULT NULL COMMENT '寮�濮嬫椂闂�',
+ `duration` int NULL DEFAULT NULL COMMENT '浼氳鏃堕暱',
+ `platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浼氳骞冲彴',
+ `participants` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙備細浜哄憳',
+ `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浼氳鎻忚堪',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '琛屾斂绠$悊-閫氱煡绠$悊-鍦ㄧ嚎浼氳' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for overtime_setting
+-- ----------------------------
+DROP TABLE IF EXISTS `overtime_setting`;
+CREATE TABLE `overtime_setting` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍔犵彮瑙勫垯鍚嶇О',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍔犵彮绫诲瀷',
+ `start_time` time NULL DEFAULT NULL COMMENT '寮�濮嬫椂闂�',
+ `end_time` time NULL DEFAULT NULL COMMENT '缁撴潫鏃堕棿',
+ `rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍊嶇巼',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍔犵彮璁剧疆' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for payment_registration
+-- ----------------------------
+DROP TABLE IF EXISTS `payment_registration`;
+CREATE TABLE `payment_registration` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `sale_ledger_id` bigint NULL DEFAULT 0 COMMENT '閿�鍞彴璐d',
+ `sales_ledger_product_id` int NULL DEFAULT NULL COMMENT '閿�鍞骇鍝乮d',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `purchase_ledger_id` bigint NOT NULL DEFAULT 0 COMMENT '閲囪喘鍙拌处id',
+ `supplier_id` bigint NOT NULL DEFAULT 0 COMMENT '渚涘簲鍟唅d',
+ `ticket_registration_id` bigint NOT NULL DEFAULT 0 COMMENT '鍙戠エid',
+ `current_payment_amount` decimal(12, 2) NOT NULL COMMENT '鏈浠樻閲戦',
+ `payment_method` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浠樻褰㈠紡',
+ `registrant_id` bigint NOT NULL DEFAULT 0 COMMENT '鐧昏浜�',
+ `payment_date` date NOT NULL COMMENT '浠樻鏃ユ湡',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `registrationt_date` date NULL DEFAULT NULL COMMENT '鐧昏鏃ユ湡',
+ `tax_rate` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绋庣巼',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浠樻鐧昏琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for pda_version
+-- ----------------------------
+DROP TABLE IF EXISTS `pda_version`;
+CREATE TABLE `pda_version` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚嶇О',
+ `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐗堟湰',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PDA鐗堟湰淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for personal_attendance_location_config
+-- ----------------------------
+DROP TABLE IF EXISTS `personal_attendance_location_config`;
+CREATE TABLE `personal_attendance_location_config` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `sys_dept_id` int NOT NULL DEFAULT 0 COMMENT '閮ㄩ棬id',
+ `location_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍦扮偣鍚嶇О',
+ `longitude` double NULL DEFAULT NULL COMMENT '缁忓害',
+ `latitude` double NULL DEFAULT NULL COMMENT '绾害',
+ `radius` double NULL DEFAULT NULL COMMENT '鎵撳崱鑼冨洿',
+ `start_at` time NULL DEFAULT NULL COMMENT '涓婄彮鏃堕棿',
+ `end_at` time NULL DEFAULT NULL COMMENT '涓嬬彮鏃堕棿',
+ `shift` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐝',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `shift`(`shift` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜哄憳鎵撳崱瑙勫垯閰嶇疆' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for personal_attendance_records
+-- ----------------------------
+DROP TABLE IF EXISTS `personal_attendance_records`;
+CREATE TABLE `personal_attendance_records` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `staff_on_job_id` bigint NOT NULL DEFAULT 0 COMMENT '鍛樺伐鍦ㄨ亴id',
+ `date` date NOT NULL COMMENT '鏃ユ湡',
+ `work_start_at` datetime NULL DEFAULT NULL COMMENT '宸ヤ綔寮�濮嬫椂闂�',
+ `work_end_at` datetime NULL DEFAULT NULL COMMENT '宸ヤ綔缁撴潫鏃堕棿',
+ `work_hours` decimal(5, 2) NULL DEFAULT NULL COMMENT '宸ヤ綔鏃堕暱',
+ `status` tinyint NOT NULL DEFAULT 0 COMMENT '鐘舵�� 0姝e父 1杩熷埌 2鏃╅��',
+ `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 65 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '涓汉鑰冨嫟璁板綍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for personal_shift
+-- ----------------------------
+DROP TABLE IF EXISTS `personal_shift`;
+CREATE TABLE `personal_shift` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `personal_attendance_location_config_id` int NULL DEFAULT NULL COMMENT '鐝(鎵撳崱瑙勫垯id)',
+ `staff_on_job_id` bigint NOT NULL DEFAULT 0 COMMENT '鍛樺伐鍦ㄨ亴id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `work_time` datetime NULL DEFAULT NULL COMMENT '鎺掔彮鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 123 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for procurement_exception_record
+-- ----------------------------
+DROP TABLE IF EXISTS `procurement_exception_record`;
+CREATE TABLE `procurement_exception_record` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `purchase_ledger_id` int NOT NULL COMMENT '閲囪喘鍙拌处id',
+ `exception_reason` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寮傚父鍘熷洜',
+ `exception_num` decimal(18, 2) NULL DEFAULT NULL COMMENT '寮傚父鏁伴噺',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰卛d',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰卛d',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘寮傚父璁板綍-涓嶅悎鏍肩墿鍝�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for procurement_plan
+-- ----------------------------
+DROP TABLE IF EXISTS `procurement_plan`;
+CREATE TABLE `procurement_plan` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `code` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '缂栫爜',
+ `plan_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍚嶇О',
+ `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鎻忚堪',
+ `status` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鐘舵��',
+ `is_system_preset` tinyint(1) NULL DEFAULT NULL COMMENT '鏄惁绯荤粺棰勭疆',
+ `consider_existing_stock` tinyint(1) NULL DEFAULT NULL,
+ `warehouse_control` tinyint(1) NULL DEFAULT NULL,
+ `calculate_total_demand` tinyint(1) NULL DEFAULT NULL,
+ `consider_safety_stock` tinyint(1) NULL DEFAULT NULL,
+ `consider_locked_stock` tinyint(1) NULL DEFAULT NULL,
+ `not_consider_material_aux` tinyint(1) NULL DEFAULT NULL,
+ `negative_stock_as_demand` tinyint(1) NULL DEFAULT NULL,
+ `summary_material` tinyint(1) NULL DEFAULT NULL,
+ `summary_aux_attributes` tinyint(1) NULL DEFAULT NULL,
+ `summary_demand_date` tinyint(1) NULL DEFAULT NULL,
+ `formula` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '璁$畻鍏紡',
+ `create_time` datetime NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` datetime NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '閲囪喘璁″垝琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for procurement_price_management
+-- ----------------------------
+DROP TABLE IF EXISTS `procurement_price_management`;
+CREATE TABLE `procurement_price_management` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `product_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍟嗗搧鍚嶇О',
+ `specification` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `product_code` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍟嗗搧缂栫爜',
+ `supplier_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '渚涘簲鍟�',
+ `base_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍩虹浠锋牸',
+ `unit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `discount_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鎶樻墸绫诲瀷',
+ `discount_value` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鎶樻墸鍊�',
+ `discount_end_time` datetime NULL DEFAULT NULL COMMENT '鎶樻墸鏈夋晥鏈�',
+ `min_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈�浣庝环鏍�',
+ `max_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈�楂樹环鏍�',
+ `warning_threshold` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '棰勮闃堝��(%)',
+ `effective_time` datetime NULL DEFAULT NULL COMMENT '鐢熸晥鏃堕棿',
+ `expire_time` datetime NULL DEFAULT NULL COMMENT '澶辨晥鏃堕棿',
+ `reason` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '璋冧环鍘熷洜',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '閲囪喘浠锋牸绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for procurement_record_out
+-- ----------------------------
+DROP TABLE IF EXISTS `procurement_record_out`;
+CREATE TABLE `procurement_record_out` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `sales_ledger_product_id` int NOT NULL DEFAULT 0 COMMENT '浜у搧淇℃伅琛╥d',
+ `procurement_record_storage_id` int NOT NULL COMMENT '鍏ュ簱璁板綍琛╥d',
+ `inbound_batches` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍑哄簱鎵规',
+ `inbound_num` decimal(18, 2) NULL DEFAULT NULL COMMENT '鍑哄簱鏁伴噺',
+ `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍑哄簱鐢ㄦ埛鍚嶇О',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓鑰卛d',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰卛d',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '缂栧彿',
+ `type` int NULL DEFAULT NULL,
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘鍑哄簱璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for procurement_record_storage
+-- ----------------------------
+DROP TABLE IF EXISTS `procurement_record_storage`;
+CREATE TABLE `procurement_record_storage` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `sales_ledger_product_id` int NOT NULL COMMENT '浜у搧淇℃伅琛╥d',
+ `inbound_batches` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏ュ簱鎵规',
+ `total_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鎬讳环',
+ `unit_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍗曚环',
+ `inbound_num` decimal(18, 2) NULL DEFAULT NULL COMMENT '鍏ュ簱鏁伴噺',
+ `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏ュ簱鐢ㄦ埛鍚嶇О',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰卛d',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰卛d',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `warn_num` decimal(10, 2) NULL DEFAULT NULL,
+ `type` int NULL DEFAULT 1,
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `quality_inspect_id` bigint NULL DEFAULT NULL COMMENT '璐ㄦid',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘鍏ュ簱璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for product
+-- ----------------------------
+DROP TABLE IF EXISTS `product`;
+CREATE TABLE `product` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `parent_id` int NULL DEFAULT NULL COMMENT '鐖秈d',
+ `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜у搧',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 409 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜у搧' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for product_borrow
+-- ----------------------------
+DROP TABLE IF EXISTS `product_borrow`;
+CREATE TABLE `product_borrow` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `borrow_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰嗙敤鍗曞彿',
+ `product_model_id` bigint NOT NULL COMMENT '浜у搧瑙勬牸ID',
+ `batch_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `borrow_quantity` decimal(18, 4) NOT NULL COMMENT '棰嗙敤鏁伴噺',
+ `returned_quantity` decimal(18, 4) NULL DEFAULT 0.0000 COMMENT '宸插綊杩樻暟閲�',
+ `borrower_id` bigint NULL DEFAULT NULL COMMENT '棰嗙敤浜篒D',
+ `borrower_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰嗙敤浜哄鍚�',
+ `borrow_time` datetime NOT NULL COMMENT '棰嗙敤鏃堕棿',
+ `expected_return_time` datetime NULL DEFAULT NULL COMMENT '棰勮褰掕繕鏃堕棿',
+ `approval_status` tinyint NULL DEFAULT 0 COMMENT '瀹℃壒鐘舵�侊紙0-寰呭鎵癸紝1-宸查�氳繃锛�2-宸查┏鍥烇級',
+ `status` tinyint NULL DEFAULT 0 COMMENT '褰掕繕鐘舵�侊紙0-鏈綊杩橈紝1-閮ㄥ垎褰掕繕锛�2-宸插叏閮ㄥ綊杩橈級',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_borrow_no`(`borrow_no` ASC) USING BTREE,
+ INDEX `idx_product_model_id`(`product_model_id` ASC) USING BTREE,
+ INDEX `idx_borrower_id`(`borrower_id` ASC) USING BTREE,
+ INDEX `idx_approval_status`(`approval_status` ASC) USING BTREE,
+ INDEX `idx_status`(`status` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜у搧棰嗙敤琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for product_borrow_return
+-- ----------------------------
+DROP TABLE IF EXISTS `product_borrow_return`;
+CREATE TABLE `product_borrow_return` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `borrow_id` bigint NOT NULL COMMENT '棰嗙敤璁板綍ID',
+ `product_model_id` bigint NOT NULL COMMENT '浜у搧瑙勬牸ID',
+ `batch_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `return_quantity` decimal(18, 4) NOT NULL COMMENT '褰掕繕鏁伴噺',
+ `returner_id` bigint NULL DEFAULT NULL COMMENT '褰掕繕浜篒D',
+ `returner_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰掕繕浜哄鍚�',
+ `return_time` datetime NOT NULL COMMENT '褰掕繕鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_borrow_id`(`borrow_id` ASC) USING BTREE,
+ INDEX `idx_product_model_id`(`product_model_id` ASC) USING BTREE,
+ INDEX `idx_returner_id`(`returner_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜у搧褰掕繕璁板綍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for product_model
+-- ----------------------------
+DROP TABLE IF EXISTS `product_model`;
+CREATE TABLE `product_model` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `product_id` int NULL DEFAULT NULL COMMENT '鍏宠仈浜у搧id',
+ `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸淇″彿',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 386 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜у搧鍨嬪彿琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for product_record
+-- ----------------------------
+DROP TABLE IF EXISTS `product_record`;
+CREATE TABLE `product_record` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `ticket_registration_id` int NULL DEFAULT NULL COMMENT '鏉ョエ鐧昏id',
+ `purchase_ledger_id` int NULL DEFAULT NULL COMMENT '閲囪喘鍙拌处id',
+ `product_category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜у搧澶х被',
+ `specification_model` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `quantity` decimal(18, 0) NOT NULL COMMENT '鏁伴噺',
+ `tax_rate` decimal(5, 0) NOT NULL COMMENT '绋庣巼',
+ `tax_inclusive_unit_price` decimal(18, 2) NOT NULL COMMENT '鍚◣鍗曚环',
+ `tax_inclusive_total_price` decimal(18, 2) NOT NULL COMMENT '鍚◣鎬讳环',
+ `tax_exclusive_total_price` decimal(18, 2) NOT NULL COMMENT '涓嶅惈绋庢�讳环',
+ `invoice_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '1.閿�鍞彴璐︼紝2.閲囪喘鍙拌处',
+ `tickets_num` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈鏉ョエ鏁�',
+ `tickets_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈鏉ョエ閲戦(鍏�)',
+ `future_tickets` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈潵绁ㄦ暟',
+ `future_tickets_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈潵绁ㄩ噾棰�(鍏�)',
+ `product_id` int NULL DEFAULT NULL COMMENT '浜у搧id',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '鍨嬪彿id',
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `sale_ledger_project_id` int NULL DEFAULT NULL COMMENT 'sale_ledger_projectI_id',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘鍙拌处浜у搧寮�绁ㄨ褰�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_account
+-- ----------------------------
+DROP TABLE IF EXISTS `production_account`;
+CREATE TABLE `production_account` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `sales_ledger_id` bigint NULL DEFAULT NULL COMMENT '閿�鍞彴璐d',
+ `sales_ledger_product_id` bigint NULL DEFAULT NULL COMMENT '閿�鍞骇鍝佽鏍糹d',
+ `production_product_main_id` bigint NULL DEFAULT NULL COMMENT '鎶ュ伐琛╥d',
+ `scheduling_user_id` bigint NULL DEFAULT NULL COMMENT '鐢熶骇浜篿d',
+ `scheduling_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '鐢熶骇浜哄悕绉�',
+ `finished_num` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '鐢熶骇鏁伴噺',
+ `work_hours` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '宸ユ椂瀹氶',
+ `technology_operation_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '宸ュ簭鍚嶇О',
+ `scheduling_date` timestamp NULL DEFAULT NULL COMMENT '鐢熶骇鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '鐢熶骇鏍哥畻琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_bom_structure
+-- ----------------------------
+DROP TABLE IF EXISTS `production_bom_structure`;
+CREATE TABLE `production_bom_structure` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `parent_id` bigint NULL DEFAULT NULL COMMENT '鐖惰妭鐐笽D',
+ `production_order_id` bigint NULL DEFAULT NULL COMMENT '鐢熶骇璁㈠崟id',
+ `product_model_id` bigint NOT NULL COMMENT '浜у搧瑙勬牸id',
+ `technology_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭id',
+ `production_order_bom_id` bigint NULL DEFAULT NULL COMMENT '鐢熶骇璁㈠崟BOMid',
+ `unit_quantity` decimal(16, 4) NOT NULL COMMENT '鍗曚綅浜у嚭闇�瑕佹暟閲�',
+ `demanded_quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT '闇�姹傛暟閲�',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 327 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇璁㈠崟BOM浜у搧缁撴瀯' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_operation_main_param
+-- ----------------------------
+DROP TABLE IF EXISTS `production_operation_main_param`;
+CREATE TABLE `production_operation_main_param` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `technology_routing_operation_param_id` bigint NOT NULL COMMENT '宸ヨ壓璺嚎宸ュ簭鍙傛暟琛╥d',
+ `param_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍙傛暟缂栫爜(鍞竴鏍囪瘑)',
+ `param_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍙傛暟鍚嶇О',
+ `param_type` tinyint NOT NULL COMMENT '鍙傛暟绫诲瀷(1鏁板瓧 2鏂囨湰 3涓嬫媺閫夋嫨 4鏃堕棿)',
+ `param_format` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍙傛暟鏍煎紡',
+ `unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `is_required` tinyint NULL DEFAULT 0 COMMENT '鏄惁蹇呭~',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `technology_param_id` bigint NULL DEFAULT NULL COMMENT '鍩虹鍙傛暟ID',
+ `technology_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭id',
+ `technology_operation_param_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭鍙傛暟ID',
+ `technology_routing_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ヨ壓璺嚎宸ュ簭ID',
+ `standard_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏍囧噯鍊�',
+ `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '杈撳叆鍊�',
+ `production_order_routing_operation_param_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭鍙傛暟ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鐢熶骇宸ュ崟鎶ュ伐鍙傛暟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_operation_task
+-- ----------------------------
+DROP TABLE IF EXISTS `production_operation_task`;
+CREATE TABLE `production_operation_task` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `production_order_routing_operation_id` bigint NOT NULL DEFAULT 0 COMMENT '鐢熶骇宸ヨ壓璺嚎宸ュ簭琛╥d',
+ `technology_routing_operation_id` bigint NOT NULL DEFAULT 0 COMMENT '宸ヨ壓璺嚎宸ュ簭琛╥d',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `work_order_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '宸ュ崟缂栧彿',
+ `plan_start_time` date NULL DEFAULT NULL COMMENT '璁″垝寮�濮嬫椂闂�',
+ `plan_end_time` date NULL DEFAULT NULL COMMENT '璁″垝缁撴潫鏃堕棿',
+ `actual_start_time` date NULL DEFAULT NULL COMMENT '瀹為檯寮�濮嬫椂闂�',
+ `actual_end_time` date NULL DEFAULT NULL COMMENT '瀹為檯缁撴潫鏃堕棿',
+ `status` int NOT NULL DEFAULT 0 COMMENT '鐘舵�� 1 寰呯‘璁� 2 寰呯敓浜� 3鐢熶骇涓� 4宸茬敓浜�',
+ `production_order_id` bigint NOT NULL DEFAULT 0 COMMENT '鐢熶骇璁㈠崟id',
+ `plan_quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT '璁″垝鏁伴噺',
+ `complete_quantity` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '瀹屾垚鏁伴噺',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `user_ids` json NULL COMMENT '鏉冮檺鐢ㄦ埛锛屾牸寮忥細[1,2,3]',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 238 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '鐢熶骇宸ュ崟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_order
+-- ----------------------------
+DROP TABLE IF EXISTS `production_order`;
+CREATE TABLE `production_order` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `production_plan_ids` json NULL COMMENT '鐢熶骇璁″垝ID鍒楄〃锛屾牸寮忥細[1,2,3]',
+ `product_model_id` bigint NOT NULL DEFAULT 0 COMMENT '浜у搧瑙勬牸id',
+ `technology_routing_id` bigint NOT NULL DEFAULT 0 COMMENT '宸ヨ壓璺嚎id',
+ `nps_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '鐢熶骇璁㈠崟鍙�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `quantity` decimal(18, 2) NOT NULL COMMENT '闇�姹傛暟閲�',
+ `complete_quantity` decimal(18, 2) NULL DEFAULT NULL COMMENT '瀹屾垚鏁伴噺',
+ `start_time` datetime NULL DEFAULT NULL COMMENT '寮�濮嬫棩鏈�',
+ `end_time` datetime NULL DEFAULT NULL COMMENT '缁撴潫鏃ユ湡',
+ `plan_complete_time` date NULL DEFAULT NULL COMMENT '璁″垝瀹屾垚鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `status` int NULL DEFAULT 1 COMMENT '鐘舵�侊紙1.寰呭紑濮嬨��2.杩涜涓��3.宸插畬鎴愩��4.宸插彇娑堬級',
+ `is_end_order` tinyint(1) NULL DEFAULT 0 COMMENT '鏄惁缁撴潫',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 64 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇璁㈠崟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_order_bom
+-- ----------------------------
+DROP TABLE IF EXISTS `production_order_bom`;
+CREATE TABLE `production_order_bom` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `production_order_id` bigint NULL DEFAULT NULL COMMENT '鐢熶骇璁㈠崟id',
+ `product_model_id` bigint NOT NULL COMMENT '浜у搧瑙勬牸id',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐗堟湰鍙�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `bom_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'BOM缂栧彿',
+ `bom_id` bigint NOT NULL COMMENT 'bom鐨刬d',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 75 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇璁㈠崟BOM' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_order_pick
+-- ----------------------------
+DROP TABLE IF EXISTS `production_order_pick`;
+CREATE TABLE `production_order_pick` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `quantity` decimal(16, 2) NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `production_order_id` bigint NOT NULL DEFAULT 0 COMMENT '鐢熶骇璁㈠崟id',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `operation_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ュ簭鍚嶇О',
+ `technology_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭id\r\n',
+ `demanded_quantity` decimal(16, 2) NULL DEFAULT NULL COMMENT '闇�姹傛暟閲�',
+ `is_bom` tinyint(1) NULL DEFAULT NULL COMMENT '鏄惁bom棰嗘枡',
+ `is_returned` tinyint(1) NULL DEFAULT 0 COMMENT '鏄惁宸查��鏂�',
+ `feeding_qty` decimal(20, 2) NULL DEFAULT NULL COMMENT '琛ユ枡鎬婚噺',
+ `return_qty` decimal(20, 2) NULL DEFAULT NULL COMMENT '閫�鏂欐暟閲�',
+ `actual_qty` decimal(20, 2) NULL DEFAULT NULL COMMENT '瀹為檯鏁伴噺',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 81 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璁㈠崟棰嗘枡绾胯竟浠�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_order_pick_record
+-- ----------------------------
+DROP TABLE IF EXISTS `production_order_pick_record`;
+CREATE TABLE `production_order_pick_record` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
+ `pick_id` bigint NOT NULL DEFAULT 0 COMMENT '鍏宠仈棰嗘枡鍗昳d锛坧roduction_order_pick.id锛�',
+ `production_order_id` bigint NULL DEFAULT 0 COMMENT '鐢熶骇璁㈠崟id',
+ `production_operation_task_id` bigint NULL DEFAULT 0 COMMENT '鐢熶骇宸ュ崟id',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `pick_quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT '棰嗘枡鏁伴噺',
+ `before_quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT '棰嗘枡鍓嶆暟閲�',
+ `after_quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT '棰嗘枡鍚庡墿浣欐暟閲�',
+ `pick_type` tinyint NULL DEFAULT 1 COMMENT '棰嗘枡绫诲瀷锛�1姝e父棰嗘枡 2琛ユ枡',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `feeding_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '琛ユ枡鍘熷洜',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_pick_id`(`pick_id` ASC) USING BTREE,
+ INDEX `idx_production_order_id`(`production_order_id` ASC) USING BTREE,
+ INDEX `idx_batch_no`(`batch_no` ASC) USING BTREE,
+ INDEX `idx_create_time`(`create_time` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 105 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '绾胯竟浠撳嚭鍏ュ簱璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_order_routing
+-- ----------------------------
+DROP TABLE IF EXISTS `production_order_routing`;
+CREATE TABLE `production_order_routing` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `product_model_id` bigint NOT NULL DEFAULT 0 COMMENT '浜у搧瑙勬牸id',
+ `production_order_id` bigint NOT NULL DEFAULT 0 COMMENT '鐢熶骇璁㈠崟id',
+ `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '鎻忚堪',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `technology_routing_id` bigint NOT NULL DEFAULT 0 COMMENT '宸ヨ壓璺嚎id',
+ `process_route_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヨ壓璺嚎缂栫爜',
+ `bom_id` int NULL DEFAULT NULL COMMENT '鍏宠仈bom鐨刬d',
+ `order_bom_id` int NULL DEFAULT NULL COMMENT '鍏宠仈璁㈠崟bom鐨刬d',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 74 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇璁㈠崟宸ヨ壓璺嚎琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_order_routing_operation
+-- ----------------------------
+DROP TABLE IF EXISTS `production_order_routing_operation`;
+CREATE TABLE `production_order_routing_operation` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `production_order_id` bigint NOT NULL DEFAULT 0 COMMENT '鐢熶骇璁㈠崟id',
+ `technology_routing_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ヨ壓璺嚎宸ュ簭琛╥d',
+ `technology_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭琛╥d',
+ `order_routing_id` int NULL DEFAULT NULL COMMENT '鍏宠仈璁㈠崟宸ヨ壓璺嚎鐨刬d',
+ `operation_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '宸ュ簭鍚嶇О',
+ `product_model_id` bigint NOT NULL DEFAULT 0 COMMENT '浜у搧瑙勬牸id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `drag_sort` int NULL DEFAULT NULL COMMENT '鎷栧姩鎺掑簭',
+ `is_quality` tinyint(1) NULL DEFAULT 1 COMMENT '鏄惁璐ㄦ宸ュ簭',
+ `is_production` tinyint(1) NULL DEFAULT 1 COMMENT '鏄惁鐢熶骇',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `type` int NULL DEFAULT NULL COMMENT '绫诲瀷 鍖哄垎璁℃椂鍜岃浠�(0璁℃椂1璁′欢)',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 260 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_order_routing_operation_param
+-- ----------------------------
+DROP TABLE IF EXISTS `production_order_routing_operation_param`;
+CREATE TABLE `production_order_routing_operation_param` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `production_order_id` bigint NULL DEFAULT NULL COMMENT '鐢熶骇璁㈠崟id',
+ `technology_routing_operation_param_id` bigint NULL DEFAULT NULL COMMENT '宸ヨ壓璺嚎宸ュ簭鍙傛暟琛╥d',
+ `param_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍙傛暟缂栫爜(鍞竴鏍囪瘑)',
+ `param_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍙傛暟鍚嶇О',
+ `param_type` tinyint NOT NULL COMMENT '鍙傛暟绫诲瀷(1鏁板瓧 2鏂囨湰 3涓嬫媺閫夋嫨 4鏃堕棿)',
+ `param_format` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍙傛暟鏍煎紡',
+ `unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `is_required` tinyint NULL DEFAULT 0 COMMENT '鏄惁蹇呭~',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `param_id` bigint NULL DEFAULT NULL COMMENT '鍩虹鍙傛暟ID',
+ `technology_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭id',
+ `technology_operation_param_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭鍙傛暟ID',
+ `production_order_routing_operation_id` bigint NOT NULL COMMENT '鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭ID',
+ `standard_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏍囧噯鍊�',
+ `input_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '杈撳叆鍊�',
+ `production_product_main_id` bigint NULL DEFAULT NULL COMMENT '鎶ュ伐id',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 334 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭鍙傛暟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_plan
+-- ----------------------------
+DROP TABLE IF EXISTS `production_plan`;
+CREATE TABLE `production_plan` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `sales_ledger_id` bigint NULL DEFAULT 0 COMMENT '閿�鍞彴璐d',
+ `sales_ledger_product_id` bigint NULL DEFAULT NULL COMMENT '閿�鍞骇鍝佽鏍糹d',
+ `mps_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓荤敓浜ц鍒掑彿',
+ `required_date` datetime(6) NULL DEFAULT NULL COMMENT '闇�姹傛棩鏈�',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime(6) NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime(6) NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧鍨嬪彿id',
+ `qty_required` decimal(12, 6) NULL DEFAULT NULL COMMENT '闇�姹傛暟閲�',
+ `status` int NULL DEFAULT NULL COMMENT '鐘舵�� 0鏈笅鍙� 1閮ㄥ垎涓嬪彂 2宸蹭笅鍙�',
+ `source` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏉ユ簮',
+ `promised_delivery_date` datetime(6) NULL DEFAULT NULL COMMENT '鎵胯鏃ユ湡',
+ `quantity_issued` decimal(12, 6) NULL DEFAULT NULL COMMENT '宸蹭笅鍙戞暟閲�',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 70 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇璁″垝琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_product_input
+-- ----------------------------
+DROP TABLE IF EXISTS `production_product_input`;
+CREATE TABLE `production_product_input` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `input_quantity` decimal(18, 6) NOT NULL COMMENT '鎶曞叆鏁伴噺',
+ `production_product_main_id` bigint NOT NULL COMMENT '鎶ュ伐琛╥d',
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧鍨嬪彿id',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鐢ㄦ埛',
+ `product_main_id` bigint NULL DEFAULT NULL COMMENT '鐢熶骇鎶ュ伐琛╥d',
+ `quantity` decimal(18, 2) NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_product_main_id`(`production_product_main_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 52 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇鎶ュ伐鎶曞叆琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_product_main
+-- ----------------------------
+DROP TABLE IF EXISTS `production_product_main`;
+CREATE TABLE `production_product_main` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `product_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎶ュ伐鍗曞彿',
+ `user_id` bigint NULL DEFAULT NULL COMMENT '鎶ュ伐浜哄憳id',
+ `user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎶ュ伐浜哄憳',
+ `production_operation_task_id` bigint NULL DEFAULT NULL COMMENT '宸ュ崟id',
+ `status` int NULL DEFAULT NULL COMMENT '鎶ュ伐鐘舵��',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鐢ㄦ埛',
+ `work_hour` decimal(10, 2) NULL DEFAULT NULL COMMENT '宸ユ椂',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇鎶ュ伐琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for production_product_output
+-- ----------------------------
+DROP TABLE IF EXISTS `production_product_output`;
+CREATE TABLE `production_product_output` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `production_product_main_id` bigint NOT NULL COMMENT '鎶ュ伐鍗昳d',
+ `product_model_id` bigint NOT NULL COMMENT '浜у搧瑙勬牸id',
+ `quantity` decimal(16, 4) NOT NULL DEFAULT 0.0000 COMMENT '鎶ュ伐鏁伴噺',
+ `scrap_qty` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '鎶ュ簾鏁伴噺',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鐢ㄦ埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `product_main_id` bigint NULL DEFAULT NULL COMMENT '鐢熶骇鎶ュ伐琛╥d',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢熶骇鎶ュ伐浜у嚭琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for project_management_contract_info
+-- ----------------------------
+DROP TABLE IF EXISTS `project_management_contract_info`;
+CREATE TABLE `project_management_contract_info` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚嶇О',
+ `sex` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎬у埆',
+ `birthday` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢熸棩',
+ `department` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閮ㄩ棬',
+ `job` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱屽姟',
+ `phone_number` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵嬫満鍙�',
+ `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閭',
+ `qq` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'QQ',
+ `linea_fissa` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍥哄畾鍙风爜',
+ `wx` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寰俊',
+ `origine_etnica` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绫嶈疮',
+ `rappresentante_legale` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '娉曚汉浠h〃',
+ `project_management_info_id` bigint NULL DEFAULT NULL COMMENT '瀵瑰簲椤圭洰绠$悊淇℃伅id',
+ `is_delete` int NOT NULL DEFAULT 0,
+ `create_user` bigint NULL DEFAULT NULL,
+ `update_user` bigint NULL DEFAULT NULL,
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '椤圭洰鑱旂郴淇℃伅' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for project_management_info
+-- ----------------------------
+DROP TABLE IF EXISTS `project_management_info`;
+CREATE TABLE `project_management_info` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '椤圭洰缂栧彿',
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓婚',
+ `client_id` bigint NULL DEFAULT NULL COMMENT '瀹㈡埛id',
+ `client_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `project_management_info_parent_id` bigint NULL DEFAULT NULL COMMENT '绱㈠紩鐨勭埗椤圭洰id',
+ `establish_time` date NULL DEFAULT NULL COMMENT '绔嬮」鏃堕棿',
+ `project_management_plan_id` bigint NOT NULL COMMENT '椤圭洰闃舵id',
+ `source` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏉ユ簮',
+ `manager_id` bigint NULL DEFAULT NULL COMMENT '椤圭洰缁忕悊id',
+ `manager_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椤圭洰缁忕悊鍚嶅瓧',
+ `salesman_id` bigint NULL DEFAULT NULL COMMENT '涓氬姟鍛榠d',
+ `salesman_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓氬姟鍛樺悕瀛�',
+ `is_delete` int NOT NULL DEFAULT 0,
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `create_user` int NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `plan_start_time` date NULL DEFAULT NULL COMMENT '璁″垝寮�濮嬫椂闂�',
+ `plan_end_time` date NULL DEFAULT NULL COMMENT '璁″垝缁撴潫鏃堕棿',
+ `actual_start_time` date NULL DEFAULT NULL COMMENT '瀹為檯寮�濮嬫椂闂�',
+ `actual_end_time` date NULL DEFAULT NULL COMMENT '瀹為檯缁撴潫鏃ユ湡',
+ `review_status` int NULL DEFAULT NULL COMMENT '瀹℃牳鐘舵��',
+ `status` int NULL DEFAULT NULL COMMENT '椤圭洰鐘舵��',
+ `department_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬id',
+ `department_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閮ㄩ棬鍚嶅瓧',
+ `order_date` timestamp NULL DEFAULT NULL COMMENT '璁㈠崟鏃ユ湡',
+ `order_amount` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁㈠崟閲戦',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `attachment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闄勪欢',
+ `plan_stage` json NULL COMMENT '椤圭洰闃舵 json',
+ `team` json NULL COMMENT '鍥㈤槦',
+ `create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '椤圭洰绠$悊淇℃伅' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for project_management_info_stage
+-- ----------------------------
+DROP TABLE IF EXISTS `project_management_info_stage`;
+CREATE TABLE `project_management_info_stage` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `project_management_plan_node_id` bigint NOT NULL COMMENT '瀵瑰簲璁″垝鑺傜偣id',
+ `project_management_info_id` bigint NOT NULL COMMENT '瀵瑰簲椤圭洰id',
+ `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎻忚堪',
+ `actual_leader_id` bigint NULL DEFAULT NULL COMMENT '瀹為檯璐熻矗浜篿d',
+ `actual_leader_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹為檯璐熻矗浜哄悕绉�',
+ `estimated_duration` int NULL DEFAULT NULL COMMENT '棰勮宸ユ湡',
+ `plan_start_time` date NULL DEFAULT NULL COMMENT '璁″垝寮�濮�',
+ `plan_end_time` date NULL DEFAULT NULL COMMENT '璁″垝缁撴潫',
+ `progress` int NOT NULL DEFAULT 0 COMMENT '杩涘害',
+ `actual_start_time` date NULL DEFAULT NULL COMMENT '瀹為檯寮�濮嬫椂闂�',
+ `actual_end_time` date NULL DEFAULT NULL COMMENT '瀹為檯缁撴潫鏃堕棿',
+ `attachment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闄勪欢',
+ `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `is_delete` int NOT NULL DEFAULT 0,
+ `create_user` bigint NULL DEFAULT NULL,
+ `update_user` bigint NULL DEFAULT NULL,
+ `create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '椤圭洰闃舵' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for project_management_plan
+-- ----------------------------
+DROP TABLE IF EXISTS `project_management_plan`;
+CREATE TABLE `project_management_plan` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁″垝鍚嶇О',
+ `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁″垝鎻忚堪',
+ `attachment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闄勪欢 ,杩涜鍒嗗壊',
+ `is_delete` int NOT NULL DEFAULT 0,
+ `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `create_user` int NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '椤圭洰绠$悊璁″垝琛�(椤圭洰绠$悊绫诲瀷)' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for project_management_plan_node
+-- ----------------------------
+DROP TABLE IF EXISTS `project_management_plan_node`;
+CREATE TABLE `project_management_plan_node` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `project_management_plan_id` bigint NOT NULL COMMENT '瀵瑰簲id',
+ `sort` int NOT NULL COMMENT '鎺掑簭',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '闃舵鍚嶇О',
+ `leader_id` bigint NULL DEFAULT NULL COMMENT '璐熻矗浠籌D',
+ `leader_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璐熻矗浠诲悕绉�',
+ `estimated_duration` int NULL DEFAULT NULL COMMENT '棰勮宸ユ湡(澶�)',
+ `hourly_rate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `work_content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浣滀笟鍐呭',
+ `is_delete` int NOT NULL DEFAULT 0,
+ `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `create_user` int NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `create_user_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璁″垝鑺傜偣' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for project_management_roles
+-- ----------------------------
+DROP TABLE IF EXISTS `project_management_roles`;
+CREATE TABLE `project_management_roles` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'id',
+ `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '鍚嶇О',
+ `status` tinyint NOT NULL DEFAULT 1 COMMENT '鐘舵��(1:鍚敤, 0:绂佺敤)',
+ `create_time` timestamp NOT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_time` timestamp NOT NULL COMMENT '鏇存柊鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '椤圭洰瑙掕壊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for project_management_shipping_address
+-- ----------------------------
+DROP TABLE IF EXISTS `project_management_shipping_address`;
+CREATE TABLE `project_management_shipping_address` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `consignee` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏀惰揣浜�',
+ `contract` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴鏂瑰紡',
+ `address` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍦板潃',
+ `is_delete` int NOT NULL DEFAULT 0,
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `create_user` bigint NULL DEFAULT NULL,
+ `update_user` bigint NULL DEFAULT NULL,
+ `project_management_info_id` bigint NULL DEFAULT NULL COMMENT '瀵瑰簲椤圭洰淇℃伅id',
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏀惰揣鍦板潃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for purchase_ledger
+-- ----------------------------
+DROP TABLE IF EXISTS `purchase_ledger`;
+CREATE TABLE `purchase_ledger` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '鑷涓婚敭ID',
+ `purchase_contract_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '閲囪喘鍚堝悓鍙�',
+ `supplier_id` int NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉癷d',
+ `supplier_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `recorder_id` int NULL DEFAULT NULL COMMENT '褰曞叆浜篿d\r\n',
+ `recorder_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '褰曞叆浜哄鍚�',
+ `sales_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閿�鍞悎鍚屽彿',
+ `project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椤圭洰鍚嶇О',
+ `entry_date` date NOT NULL COMMENT '褰曞叆鏃ユ湡',
+ `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `attachment_materials` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闄勪欢鏉愭枡璺緞鎴栧悕绉�',
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '璁板綍鍒涘缓鏃堕棿',
+ `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '璁板綍鏈�鍚庢洿鏂版椂闂�',
+ `sales_ledger_id` int NULL DEFAULT NULL COMMENT '鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `contract_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍚堝悓閲戦',
+ `business_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓氬姟鍛�',
+ `business_person_id` int NULL DEFAULT NULL COMMENT '涓氬姟鍛榠d',
+ `phone_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰曞叆浜虹數璇�',
+ `payment_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `execution_date` datetime NULL DEFAULT NULL,
+ `approval_status` bigint NULL DEFAULT 1 COMMENT '1-寰呭鏍革紝2-瀹℃壒涓紝3-瀹℃壒閫氳繃锛�4-瀹℃壒澶辫触',
+ `template_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妯℃澘鍚嶇О',
+ `approve_user_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃壒浜篿d',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `template_id` int NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 44 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘鍙拌处' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for purchase_ledger_template
+-- ----------------------------
+DROP TABLE IF EXISTS `purchase_ledger_template`;
+CREATE TABLE `purchase_ledger_template` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '鑷涓婚敭ID',
+ `purchase_contract_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閲囪喘鍚堝悓鍙�',
+ `supplier_id` int NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉癷d',
+ `supplier_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `recorder_id` int NULL DEFAULT NULL COMMENT '褰曞叆浜篿d\r\n',
+ `recorder_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰曞叆浜哄鍚�',
+ `sales_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閿�鍞悎鍚屽彿',
+ `project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椤圭洰鍚嶇О',
+ `entry_date` date NULL DEFAULT NULL COMMENT '褰曞叆鏃ユ湡',
+ `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '璁板綍鍒涘缓鏃堕棿',
+ `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '璁板綍鏈�鍚庢洿鏂版椂闂�',
+ `sales_ledger_id` int NULL DEFAULT NULL COMMENT '鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�',
+ `contract_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍚堝悓閲戦',
+ `business_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓氬姟鍛�',
+ `business_person_id` int NULL DEFAULT NULL COMMENT '涓氬姟鍛榠d',
+ `phone_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰曞叆浜虹數璇�',
+ `payment_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `execution_date` datetime NULL DEFAULT NULL,
+ `template_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妯℃澘鍚嶇О',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘鍙拌处妯℃澘' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for purchase_return_order_products
+-- ----------------------------
+DROP TABLE IF EXISTS `purchase_return_order_products`;
+CREATE TABLE `purchase_return_order_products` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `purchase_return_order_id` bigint NOT NULL DEFAULT 0 COMMENT '閫�璐у崟id',
+ `sales_ledger_product_id` bigint NOT NULL DEFAULT 0 COMMENT '閲囪喘浜у搧id',
+ `return_quantity` decimal(16, 4) NOT NULL DEFAULT 0.0000 COMMENT '閫�璐ф暟閲�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `stock_in_record_id` bigint NOT NULL COMMENT '鍏宠仈鍏ュ簱鍗昳d',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_purchase_return_order_id`(`purchase_return_order_id` ASC) USING BTREE,
+ INDEX `idx_sales_ledger_product_id`(`sales_ledger_product_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘閫�璐т骇鍝佽〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for purchase_return_orders
+-- ----------------------------
+DROP TABLE IF EXISTS `purchase_return_orders`;
+CREATE TABLE `purchase_return_orders` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫�璐у崟缂栧彿',
+ `return_type` tinyint NOT NULL DEFAULT 0 COMMENT '閫�璐ф柟寮� 0閫�璐ч��娆� 1鎷掓敹',
+ `supplier_id` bigint NOT NULL DEFAULT 0 COMMENT '渚涘簲鍟唅d',
+ `shipping_type` tinyint NULL DEFAULT NULL COMMENT '鍙戣揣绫诲瀷 1璐ц溅 2蹇��',
+ `truck_plate_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戣揣杞︾墝鍙�',
+ `express_company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '蹇�掑叕鍙�',
+ `express_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '蹇�掑崟鍙�',
+ `project_id` bigint NOT NULL DEFAULT 0 COMMENT '椤圭洰id',
+ `project_phase` tinyint NOT NULL DEFAULT 0 COMMENT '椤圭洰闃舵',
+ `prepared_at` datetime NULL DEFAULT NULL COMMENT '鍒跺崟鏃ユ湡',
+ `prepared_user_id` bigint NOT NULL DEFAULT 0 COMMENT '鍒跺崟浜篿d',
+ `return_user_id` bigint NOT NULL DEFAULT 0 COMMENT '閫�鏂欎汉id',
+ `purchase_ledger_id` bigint NOT NULL DEFAULT 0 COMMENT '閲囪喘璁㈠崟id',
+ `total_discount_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏁村崟鎶樻墸棰�',
+ `total_discount_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏁村崟鎶樻墸鐜�',
+ `total_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鎴愪氦閲戦',
+ `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `income_type` int NULL DEFAULT NULL COMMENT '鏀跺叆绫诲瀷',
+ `prepared_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒跺崟浜哄悕绉�',
+ `return_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫�鏂欎汉鍚嶇О',
+ `create_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `update_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_supplier_id`(`supplier_id` ASC) USING BTREE,
+ INDEX `idx_purchase_ledger_id`(`purchase_ledger_id` ASC) USING BTREE,
+ INDEX `idx_project_id`(`project_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閲囪喘閫�璐у崟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qr_code
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_code`;
+CREATE TABLE `qr_code` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '浜岀淮鐮佸敮涓�鏍囪瘑',
+ `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鍚嶇О',
+ `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵�鍦ㄤ綅缃弿杩�',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛ID锛岀敤浜庡绉熸埛闅旂',
+ `deleted` int NOT NULL DEFAULT 0 COMMENT '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛',
+ `create_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�',
+ `update_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鏈�鍚庢洿鏂版椂闂�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜岀淮鐮佺鐞嗚〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qr_code_scan_record
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_code_scan_record`;
+CREATE TABLE `qr_code_scan_record` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鎵爜璁板綍鍞竴鏍囪瘑',
+ `qr_code_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈鐨勪簩缁寸爜ID',
+ `scanner_id` bigint NULL DEFAULT NULL COMMENT '鎵爜浜虹敤鎴稩D',
+ `device_id` int NULL DEFAULT NULL COMMENT '璁惧id',
+ `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧鍚嶇О',
+ `scan_time` datetime(6) NULL DEFAULT NULL COMMENT '瀹為檯鎵爜鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛ID锛岀敤浜庡绉熸埛闅旂',
+ `deleted` int NOT NULL DEFAULT 0 COMMENT '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛',
+ `create_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�',
+ `update_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鏈�鍚庢洿鏂版椂闂�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜岀淮鐮佹壂鐮佽褰曡〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_blob_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_blob_triggers`;
+CREATE TABLE `qrtz_blob_triggers` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `trigger_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_name鐨勫閿�',
+ `trigger_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_group鐨勫閿�',
+ `blob_data` blob NULL COMMENT '瀛樻斁鎸佷箙鍖朤rigger瀵硅薄',
+ PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE,
+ CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Blob绫诲瀷鐨勮Е鍙戝櫒琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_calendars
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_calendars`;
+CREATE TABLE `qrtz_calendars` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `calendar_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏃ュ巻鍚嶇О',
+ `calendar` blob NOT NULL COMMENT '瀛樻斁鎸佷箙鍖朿alendar瀵硅薄',
+ PRIMARY KEY (`sched_name`, `calendar_name`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏃ュ巻淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_cron_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_cron_triggers`;
+CREATE TABLE `qrtz_cron_triggers` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `trigger_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_name鐨勫閿�',
+ `trigger_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_group鐨勫閿�',
+ `cron_expression` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'cron琛ㄨ揪寮�',
+ `time_zone_id` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏃跺尯',
+ PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE,
+ CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Cron绫诲瀷鐨勮Е鍙戝櫒琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_fired_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_fired_triggers`;
+CREATE TABLE `qrtz_fired_triggers` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `entry_id` varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍣ㄥ疄渚媔d',
+ `trigger_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_name鐨勫閿�',
+ `trigger_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_group鐨勫閿�',
+ `instance_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍣ㄥ疄渚嬪悕',
+ `fired_time` bigint NOT NULL COMMENT '瑙﹀彂鐨勬椂闂�',
+ `sched_time` bigint NOT NULL COMMENT '瀹氭椂鍣ㄥ埗瀹氱殑鏃堕棿',
+ `priority` int NOT NULL COMMENT '浼樺厛绾�',
+ `state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐘舵��',
+ `job_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浠诲姟鍚嶇О',
+ `job_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浠诲姟缁勫悕',
+ `is_nonconcurrent` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁骞跺彂',
+ `requests_recovery` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏄惁鎺ュ彈鎭㈠鎵ц',
+ PRIMARY KEY (`sched_name`, `entry_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '宸茶Е鍙戠殑瑙﹀彂鍣ㄨ〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_job_details
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_job_details`;
+CREATE TABLE `qrtz_job_details` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `job_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浠诲姟鍚嶇О',
+ `job_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浠诲姟缁勫悕',
+ `description` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐩稿叧浠嬬粛',
+ `job_class_name` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鎵ц浠诲姟绫诲悕绉�',
+ `is_durable` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏄惁鎸佷箙鍖�',
+ `is_nonconcurrent` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏄惁骞跺彂',
+ `is_update_data` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏄惁鏇存柊鏁版嵁',
+ `requests_recovery` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鏄惁鎺ュ彈鎭㈠鎵ц',
+ `job_data` blob NULL COMMENT '瀛樻斁鎸佷箙鍖杍ob瀵硅薄',
+ PRIMARY KEY (`sched_name`, `job_name`, `job_group`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浠诲姟璇︾粏淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_locks
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_locks`;
+CREATE TABLE `qrtz_locks` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `lock_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鎮茶閿佸悕绉�',
+ PRIMARY KEY (`sched_name`, `lock_name`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀛樺偍鐨勬偛瑙傞攣淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_paused_trigger_grps
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`;
+CREATE TABLE `qrtz_paused_trigger_grps` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `trigger_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_group鐨勫閿�',
+ PRIMARY KEY (`sched_name`, `trigger_group`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏆傚仠鐨勮Е鍙戝櫒琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_scheduler_state
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_scheduler_state`;
+CREATE TABLE `qrtz_scheduler_state` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `instance_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瀹炰緥鍚嶇О',
+ `last_checkin_time` bigint NOT NULL COMMENT '涓婃妫�鏌ユ椂闂�',
+ `checkin_interval` bigint NOT NULL COMMENT '妫�鏌ラ棿闅旀椂闂�',
+ PRIMARY KEY (`sched_name`, `instance_name`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璋冨害鍣ㄧ姸鎬佽〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_simple_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_simple_triggers`;
+CREATE TABLE `qrtz_simple_triggers` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `trigger_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_name鐨勫閿�',
+ `trigger_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_group鐨勫閿�',
+ `repeat_count` bigint NOT NULL COMMENT '閲嶅鐨勬鏁扮粺璁�',
+ `repeat_interval` bigint NOT NULL COMMENT '閲嶅鐨勯棿闅旀椂闂�',
+ `times_triggered` bigint NOT NULL COMMENT '宸茬粡瑙﹀彂鐨勬鏁�',
+ PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE,
+ CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '绠�鍗曡Е鍙戝櫒鐨勪俊鎭〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_simprop_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_simprop_triggers`;
+CREATE TABLE `qrtz_simprop_triggers` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `trigger_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_name鐨勫閿�',
+ `trigger_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_triggers琛╰rigger_group鐨勫閿�',
+ `str_prop_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'String绫诲瀷鐨則rigger鐨勭涓�涓弬鏁�',
+ `str_prop_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'String绫诲瀷鐨則rigger鐨勭浜屼釜鍙傛暟',
+ `str_prop_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'String绫诲瀷鐨則rigger鐨勭涓変釜鍙傛暟',
+ `int_prop_1` int NULL DEFAULT NULL COMMENT 'int绫诲瀷鐨則rigger鐨勭涓�涓弬鏁�',
+ `int_prop_2` int NULL DEFAULT NULL COMMENT 'int绫诲瀷鐨則rigger鐨勭浜屼釜鍙傛暟',
+ `long_prop_1` bigint NULL DEFAULT NULL COMMENT 'long绫诲瀷鐨則rigger鐨勭涓�涓弬鏁�',
+ `long_prop_2` bigint NULL DEFAULT NULL COMMENT 'long绫诲瀷鐨則rigger鐨勭浜屼釜鍙傛暟',
+ `dec_prop_1` decimal(13, 4) NULL DEFAULT NULL COMMENT 'decimal绫诲瀷鐨則rigger鐨勭涓�涓弬鏁�',
+ `dec_prop_2` decimal(13, 4) NULL DEFAULT NULL COMMENT 'decimal绫诲瀷鐨則rigger鐨勭浜屼釜鍙傛暟',
+ `bool_prop_1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'Boolean绫诲瀷鐨則rigger鐨勭涓�涓弬鏁�',
+ `bool_prop_2` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'Boolean绫诲瀷鐨則rigger鐨勭浜屼釜鍙傛暟',
+ PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE,
+ CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍚屾鏈哄埗鐨勮閿佽〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for qrtz_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_triggers`;
+CREATE TABLE `qrtz_triggers` (
+ `sched_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冨害鍚嶇О',
+ `trigger_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瑙﹀彂鍣ㄧ殑鍚嶅瓧',
+ `trigger_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瑙﹀彂鍣ㄦ墍灞炵粍鐨勫悕瀛�',
+ `job_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_job_details琛╦ob_name鐨勫閿�',
+ `job_group` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'qrtz_job_details琛╦ob_group鐨勫閿�',
+ `description` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐩稿叧浠嬬粛',
+ `next_fire_time` bigint NULL DEFAULT NULL COMMENT '涓婁竴娆¤Е鍙戞椂闂达紙姣锛�',
+ `prev_fire_time` bigint NULL DEFAULT NULL COMMENT '涓嬩竴娆¤Е鍙戞椂闂达紙榛樿涓�-1琛ㄧず涓嶈Е鍙戯級',
+ `priority` int NULL DEFAULT NULL COMMENT '浼樺厛绾�',
+ `trigger_state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瑙﹀彂鍣ㄧ姸鎬�',
+ `trigger_type` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瑙﹀彂鍣ㄧ殑绫诲瀷',
+ `start_time` bigint NOT NULL COMMENT '寮�濮嬫椂闂�',
+ `end_time` bigint NULL DEFAULT NULL COMMENT '缁撴潫鏃堕棿',
+ `calendar_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏃ョ▼琛ㄥ悕绉�',
+ `misfire_instr` smallint NULL DEFAULT NULL COMMENT '琛ュ伩鎵ц鐨勭瓥鐣�',
+ `job_data` blob NULL COMMENT '瀛樻斁鎸佷箙鍖杍ob瀵硅薄',
+ PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE,
+ INDEX `sched_name`(`sched_name` ASC, `job_name` ASC, `job_group` ASC) USING BTREE,
+ CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `job_name`, `job_group`) REFERENCES `qrtz_job_details` (`sched_name`, `job_name`, `job_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瑙﹀彂鍣ㄨ缁嗕俊鎭〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for quality_inspect
+-- ----------------------------
+DROP TABLE IF EXISTS `quality_inspect`;
+CREATE TABLE `quality_inspect` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `inspect_type` int NULL DEFAULT NULL COMMENT '绫诲埆(0:鍘熸潗鏂欐楠�;1:杩囩▼妫�楠�;2:鍑哄巶妫�楠�)',
+ `check_time` date NULL DEFAULT NULL COMMENT '妫�娴嬫棩鏈�',
+ `supplier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉�(鍘熸潗鏂欐楠�)',
+ `customer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О(杩囩▼妫�楠�/鍑哄巶妫�楠�)',
+ `process` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ュ簭(杩囩▼妫�楠�)',
+ `check_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妫�楠屽憳',
+ `product_id` bigint NULL DEFAULT NULL COMMENT '浜у搧ID',
+ `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜у搧鍚嶇О',
+ `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `quantity` decimal(18, 2) NULL DEFAULT NULL COMMENT '鍏ㄩ儴鏁伴噺',
+ `qualified_quantity` decimal(18, 2) NULL DEFAULT NULL COMMENT '鍚堟牸鐨勬暟閲�',
+ `unqualified_quantity` decimal(18, 2) NULL DEFAULT NULL COMMENT '涓嶅悎鏍肩殑鏁伴噺',
+ `check_company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妫�娴嬪崟浣�',
+ `check_result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妫�娴嬬粨鏋�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `inspect_state` int NULL DEFAULT NULL COMMENT '绫诲埆锛�0-鏈彁浜� 1-宸叉彁浜わ級',
+ `purchase_ledger_id` int NULL DEFAULT NULL COMMENT '閲囪喘璁㈠崟id',
+ `product_main_id` bigint NULL DEFAULT NULL COMMENT '鎶ュ伐鍗昳d',
+ `defective_phenomena` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓嶅悎鏍肩幇璞℃弿杩�',
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `test_standard_id` int NULL DEFAULT NULL COMMENT '鍏宠仈妫�娴嬫爣鍑嗕富琛╥d',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 71 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璐ㄩ噺绠$悊--鍘熸潗鏂�/杩囩▼/鍑哄巶妫�楠�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for quality_inspect_file
+-- ----------------------------
+DROP TABLE IF EXISTS `quality_inspect_file`;
+CREATE TABLE `quality_inspect_file` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞',
+ `file_size` int NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `inspect_id` bigint NULL DEFAULT NULL COMMENT '妫�楠孖D',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璐ㄩ噺绠$悊--妫�楠岄檮浠�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for quality_inspect_param
+-- ----------------------------
+DROP TABLE IF EXISTS `quality_inspect_param`;
+CREATE TABLE `quality_inspect_param` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `parameter_item` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎸囨爣',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `standard_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏍囧噯鍊�',
+ `control_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍐呮帶鍊�',
+ `test_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妫�楠屽��',
+ `inspect_id` bigint NULL DEFAULT NULL COMMENT '妫�楠孖D',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璐ㄩ噺绠$悊--妫�楠岃褰�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for quality_test_standard
+-- ----------------------------
+DROP TABLE IF EXISTS `quality_test_standard`;
+CREATE TABLE `quality_test_standard` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `standard_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏍囧噯缂栧彿鎸囨爣',
+ `standard_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏍囧噯鍚嶇О',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `process_id` int NULL DEFAULT NULL COMMENT '鍏宠仈宸ュ簭id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `inspect_type` int NULL DEFAULT NULL COMMENT '绫诲埆(0:鍘熸潗鏂欐楠�;1:杩囩▼妫�楠�;2:鍑哄巶妫�楠�)',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璐ㄩ噺绠$悊--妫�娴嬫寚鏍囩淮鎶�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for quality_test_standard_binding
+-- ----------------------------
+DROP TABLE IF EXISTS `quality_test_standard_binding`;
+CREATE TABLE `quality_test_standard_binding` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `product_id` bigint NULL DEFAULT NULL COMMENT '浜у搧ID',
+ `test_standard_id` int NULL DEFAULT NULL COMMENT '鍏宠仈妫�娴嬫爣鍑嗕富琛╥d',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '妫�娴嬫爣鍑嗕富琛ㄤ笌浜у搧鍏宠仈琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for quality_test_standard_param
+-- ----------------------------
+DROP TABLE IF EXISTS `quality_test_standard_param`;
+CREATE TABLE `quality_test_standard_param` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `parameter_item` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙傛暟椤�',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `standard_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏍囧噯鍊�',
+ `control_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍐呮帶鍊�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `test_standard_id` int NULL DEFAULT NULL COMMENT '鍏宠仈妫�娴嬫爣鍑嗕富琛╥d',
+ `default_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '榛樿鍊�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '妫�娴嬫爣鍑嗗弬鏁�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for quality_unqualified
+-- ----------------------------
+DROP TABLE IF EXISTS `quality_unqualified`;
+CREATE TABLE `quality_unqualified` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `inspect_type` int NULL DEFAULT NULL COMMENT '绫诲埆(0:鍘熸潗鏂欐楠�;1:杩囩▼妫�楠�;2:鍑哄巶妫�楠�)',
+ `inspect_state` int NULL DEFAULT NULL COMMENT '鐘舵��(0:寰呭鐞�;1:宸插鐞�)',
+ `check_time` date NULL DEFAULT NULL COMMENT '妫�娴嬫棩鏈�',
+ `check_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '妫�楠屽憳',
+ `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜у搧鍚嶇О',
+ `model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `quantity` decimal(18, 2) NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `defective_phenomena` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓嶅悎鏍肩幇璞�',
+ `deal_result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶勭悊缁撴灉',
+ `deal_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶勭悊浜�',
+ `deal_time` date NULL DEFAULT NULL COMMENT '澶勭悊鏃ユ湡',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `product_id` bigint NULL DEFAULT NULL COMMENT '浜у搧ID',
+ `inspect_id` int NULL DEFAULT NULL COMMENT '鍏宠仈妫�楠宨d',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `product_model_id` int NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 52 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璐ㄩ噺绠$悊--涓嶅悎鏍煎搧绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for reading_status
+-- ----------------------------
+DROP TABLE IF EXISTS `reading_status`;
+CREATE TABLE `reading_status` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `rule_id` int NULL DEFAULT NULL COMMENT '鐢ㄥ嵃绠$悊-瑙勭珷鍒跺害id',
+ `employee` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐濮撳悕',
+ `department` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵�灞為儴闂�',
+ `confirm_time` datetime NULL DEFAULT NULL COMMENT '纭鏃堕棿',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '闃呰鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄥ嵃绠$悊-瑙勭珷鍒跺害-闃呰鐘舵��' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for receipt_payment
+-- ----------------------------
+DROP TABLE IF EXISTS `receipt_payment`;
+CREATE TABLE `receipt_payment` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `sales_ledger_id` int NULL DEFAULT NULL COMMENT '閿�鍞彴璐d',
+ `sales_ledger_product_id` int NULL DEFAULT NULL COMMENT '閿�鍞骇鍝乮d',
+ `invoice_ledger_id` bigint NULL DEFAULT NULL COMMENT 'invoice_ledger寮�绁ㄥ彴璐﹁〃涓婚敭ID',
+ `receipt_payment_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍥炴褰㈠紡 0鐢垫眹1鎵垮厬',
+ `receipt_payment_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍥炴閲戦',
+ `registrant` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐧昏浜�',
+ `receipt_payment_date` datetime NULL DEFAULT NULL COMMENT '鏉ユ鏃ユ湡',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 286 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍥炴鐧昏琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for return_management
+-- ----------------------------
+DROP TABLE IF EXISTS `return_management`;
+CREATE TABLE `return_management` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '搴忓彿',
+ `return_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫�璐у崟鍙�',
+ `customer_id` bigint NULL DEFAULT NULL COMMENT '瀹㈡埛 id',
+ `shipping_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈鍙戣揣鍗曞彿',
+ `shipping_type` tinyint NULL DEFAULT NULL COMMENT '鍙戣揣绫诲瀷 1璐ц溅 2蹇��',
+ `truck_plate_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戣揣杞︾墝鍙�',
+ `express_company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '蹇�掑叕鍙�',
+ `express_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '蹇�掑崟鍙�',
+ `project_stage` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椤圭洰闃舵',
+ `maker` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒跺崟浜�',
+ `make_time` timestamp NULL DEFAULT NULL COMMENT '鍒跺崟鏃堕棿',
+ `settler` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '缁撶畻浜�',
+ `status` int NOT NULL DEFAULT 0,
+ `project_id` int NULL DEFAULT NULL COMMENT '椤圭洰id',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `return_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫�璐у師鍥�',
+ `refund_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '閫�娆炬�婚',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閫�璐х鐞嗚〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for return_sale_product
+-- ----------------------------
+DROP TABLE IF EXISTS `return_sale_product`;
+CREATE TABLE `return_sale_product` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
+ `return_management_id` int NULL DEFAULT NULL COMMENT '閫�璐у崟id',
+ `stock_out_record_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈鍑哄簱鍗昳d',
+ `num` decimal(16, 3) NOT NULL COMMENT '閫�璐т骇鍝佹暟閲�',
+ `status` int NULL DEFAULT NULL COMMENT '閫�璐х姸鎬�',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `is_quality` int NULL DEFAULT NULL COMMENT '鏄惁鏈夎川閲忛棶棰�(1-鏄� 2-鍚�)',
+ `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍗曚环',
+ `amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '閲戦',
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閫�璐т骇鍝佽〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for rpa_process_automation
+-- ----------------------------
+DROP TABLE IF EXISTS `rpa_process_automation`;
+CREATE TABLE `rpa_process_automation` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `program_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绋嬪簭鍚�',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵ц鐘舵��',
+ `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎻忚堪',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'RPA娴佺▼鑷姩鍖�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for rules_regulations_management
+-- ----------------------------
+DROP TABLE IF EXISTS `rules_regulations_management`;
+CREATE TABLE `rules_regulations_management` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `regulation_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒跺害缂栧彿',
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒跺害鏍囬',
+ `category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒跺害鍒嗙被',
+ `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鍒跺害鍐呭',
+ `effective_time` datetime NULL DEFAULT NULL COMMENT '鐢熸晥鏃堕棿',
+ `scope` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫傜敤鑼冨洿',
+ `require_confirm` int NULL DEFAULT NULL COMMENT '鏄惁闇�瑕佺‘璁�',
+ `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐗堟湰',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `read_count` int NULL DEFAULT NULL COMMENT '宸茶浜烘暟',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瑙勭珷鍒跺害绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for rules_regulations_management_file
+-- ----------------------------
+DROP TABLE IF EXISTS `rules_regulations_management_file`;
+CREATE TABLE `rules_regulations_management_file` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞',
+ `file_size` int NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `rules_regulations_management_id` int NULL DEFAULT NULL COMMENT '瑙勭珷鍒跺害ID',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '瑙勭珷鍒跺害绠$悊--闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for rygl_add_employee
+-- ----------------------------
+DROP TABLE IF EXISTS `rygl_add_employee`;
+CREATE TABLE `rygl_add_employee` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '搴忓彿',
+ `status` int NULL DEFAULT NULL COMMENT '1鍏ヨ亴2绂昏亴',
+ `employee_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐缂栧彿',
+ `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '濮撳悕',
+ `sex` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎬у埆',
+ `native_place` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绫嶈疮',
+ `post` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宀椾綅',
+ `home_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹跺涵浣忓潃',
+ `first_degree` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绗竴瀛﹀巻',
+ `major` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓撲笟',
+ `id_number` int NULL DEFAULT NULL COMMENT '韬唤璇佸彿',
+ `age` int NULL DEFAULT NULL COMMENT '骞撮緞',
+ `contact_number` int NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `emergency_contact` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉',
+ `emergency_contact_number` int NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯荤數璇�',
+ `contract_term` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚堝悓骞撮檺',
+ `contract_start_date` datetime NULL DEFAULT NULL COMMENT '鍚堝悓寮�濮嬫棩鏈�',
+ `contract_end_date` datetime NULL DEFAULT NULL COMMENT '鍚堝悓缁撴潫鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_accident
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_accident`;
+CREATE TABLE `safe_accident` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `accident_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜嬫晠缂栧彿',
+ `accident_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜嬫晠鍚嶇О',
+ `accident_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜嬫晠绫诲瀷',
+ `happen_time` datetime NULL DEFAULT NULL COMMENT '浜嬫晠鍙戠敓鏃堕棿',
+ `happen_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜嬫晠鍙戠敓浣嶇疆',
+ `accident_grade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜嬫晠绛夌骇',
+ `accident_cause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '浜嬫晠鐩存帴鍘熷洜',
+ `root_cause` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '浜嬫晠鏍规湰鍘熷洜',
+ `person_loss` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜哄憳鎹熷け鎯呭喌',
+ `asset_loss` decimal(10, 2) NULL DEFAULT NULL COMMENT '鐩存帴璐骇鎹熷け锛堝厓锛� ',
+ `production_loss` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢熶骇褰卞搷鎯呭喌',
+ `handle_measures` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鐜板満搴旀�ュ缃帾鏂�',
+ `responsible_person` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜嬫晠璐d换浜�',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '涓婃姤鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '涓婃姤浜篿d',
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_certification
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_certification`;
+CREATE TABLE `safe_certification` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勭▼璧勮川鍚嶇О',
+ `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勭▼璧勮川缂栧彿',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勭▼璧勮川绫诲瀷',
+ `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐗堟湰鍙�',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `effective_time` date NULL DEFAULT NULL COMMENT '鏈夋晥鏈�',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--瀹夊叏瑙勭▼涓庤祫璐ㄧ鐞�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_certification_file
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_certification_file`;
+CREATE TABLE `safe_certification_file` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `safe_certification_id` int NULL DEFAULT NULL COMMENT '鍏宠仈瀹夊叏鐢熶骇璧勮川id',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `file_size` double NULL DEFAULT NULL,
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--瀹夊叏瑙勭▼涓庤祫璐ㄧ鐞�--闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_contingency_plan
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_contingency_plan`;
+CREATE TABLE `safe_contingency_plan` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `plan_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '搴旀�ラ妗堢紪鐮�',
+ `plan_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '搴旀�ラ妗堝悕绉�',
+ `plan_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰勬绫诲瀷',
+ `apply_scope` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閫傜敤鑼冨洿',
+ `core_responsor_user_id` int NULL DEFAULT NULL COMMENT '鏍稿績璐d换浜�',
+ `exec_steps` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '搴旀�ュ缃楠�',
+ `publish_time` date NULL DEFAULT NULL COMMENT '鍙戝竷鐢熸晥鏃堕棿',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏈�鍚庝慨璁㈡椂闂�',
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--搴旀�ラ妗堟煡闃�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_hazard
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_hazard`;
+CREATE TABLE `safe_hazard` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗遍櫓婧愬悕绉�',
+ `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗遍櫓婧愮紪鐮�',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗遍櫓婧愮被鍨�',
+ `risk_level` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椋庨櫓绛夌骇',
+ `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵�鍦ㄤ綅缃�',
+ `spec_info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸 / 椋庨櫓鎻忚堪',
+ `control_measures` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绠℃帶鎺柦',
+ `principal_user_id` int NULL DEFAULT NULL COMMENT '绠℃帶璐d换浜� ID',
+ `principal_mobile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璐d换浜鸿仈绯荤數璇�',
+ `stock_qty` decimal(10, 2) NULL DEFAULT NULL COMMENT '搴撳瓨鏁伴噺',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--鍗遍櫓婧愬彴璐�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_hazard_record
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_hazard_record`;
+CREATE TABLE `safe_hazard_record` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `material_record_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曞彿',
+ `safe_hazard_id` int NULL DEFAULT NULL COMMENT '鍏宠仈鍗遍櫓婧愬彴璐� ID',
+ `apply_user_id` int NULL DEFAULT NULL COMMENT '棰嗙敤浜� ID',
+ `apply_time` date NULL DEFAULT NULL COMMENT '棰嗙敤鏃堕棿',
+ `apply_qty` decimal(10, 2) NULL DEFAULT NULL COMMENT '棰嗙敤鏁伴噺',
+ `apply_purpose` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰嗙敤鐢ㄩ��',
+ `return_user_id` int NULL DEFAULT NULL COMMENT '褰掕繕浜� ID',
+ `return_time` date NULL DEFAULT NULL COMMENT '褰掕繕鏃堕棿',
+ `return_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰掕繕鎯呭喌璇存槑',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--鍗遍櫓鐗╂枡绠℃帶' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_hidden
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_hidden`;
+CREATE TABLE `safe_hidden` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `hidden_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闅愭偅缂栧彿',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闅愭偅绫诲瀷',
+ `risk_level` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闅愭偅椋庨櫓绛夌骇',
+ `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '闅愭偅鍏蜂綋浣嶇疆',
+ `hidden_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '闅愭偅鎻忚堪',
+ `rectify_user_id` int NULL DEFAULT NULL COMMENT '鏁存敼璐d换浜� ID',
+ `rectify_user_mobile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏁存敼浜鸿仈绯荤數璇�',
+ `rectify_time` date NULL DEFAULT NULL COMMENT '鏁存敼瀹屾垚鏈熼檺(鏃ユ湡)',
+ `rectify_measures` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '鏁存敼鍏蜂綋鎺柦',
+ `rectify_actual_time` date NULL DEFAULT NULL COMMENT '瀹為檯鏁存敼瀹屾垚鏃堕棿',
+ `verify_user_id` int NULL DEFAULT NULL COMMENT '楠屾敹浜� ID',
+ `verify_result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '楠屾敹缁撴灉',
+ `verify_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '楠屾敹鎰忚',
+ `verify_time` date NULL DEFAULT NULL COMMENT '楠屾敹鏃堕棿',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '涓婃姤鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '涓婃姤浜篿d',
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--闅愭偅鎺掓煡涓婃姤' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_hidden_file
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_hidden_file`;
+CREATE TABLE `safe_hidden_file` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `safe_hidden_id` int NULL DEFAULT NULL COMMENT '鍏宠仈闅愭偅鎺掓煡涓婃姤id',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `file_size` double NULL DEFAULT NULL,
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--闅愭偅鎺掓煡涓婃姤--闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_training
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_training`;
+CREATE TABLE `safe_training` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `course_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璇剧▼缂栧彿',
+ `training_objectives` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍩硅鐩爣',
+ `training_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍩硅鍐呭',
+ `training_mode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍩硅鏂瑰紡',
+ `state` int NULL DEFAULT NULL COMMENT '鐘舵��(0锛氭湭寮�濮�1锛氳繘琛屼腑锛�2锛氬凡缁撴潫)',
+ `participants` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍙傚姞瀵硅薄',
+ `place_training` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍩硅鍦扮偣',
+ `training_lecturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍩硅璁插笀',
+ `training_date` date NULL DEFAULT NULL COMMENT '鍩硅鏃ユ湡',
+ `opening_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '寮�濮嬫椂闂�(鏃跺垎绉�)',
+ `end_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '缁撴潫鏃堕棿(鏃跺垎绉�)',
+ `project_credits` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '璇鹃瀛﹀垎',
+ `class_hour` double NULL DEFAULT NULL COMMENT '璇炬椂',
+ `assessment_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鑰冩牳鏂瑰紡',
+ `comprehensive_assessment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏈鍩硅缁煎悎璇勪环',
+ `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `assessment_user_id` int NULL DEFAULT NULL COMMENT '璇勪环浜篿d',
+ `assessment_date` date NULL DEFAULT NULL COMMENT '璇勪环鏃堕棿',
+ `training_abstract` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍩硅鎽樿',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--瀹夊叏鍩硅鑰冩牳' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_training_details
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_training_details`;
+CREATE TABLE `safe_training_details` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `user_id` int NULL DEFAULT NULL COMMENT '鐢ㄦ埛琛ㄦ牸锛坲ser锛変富閿�',
+ `safe_training_id` int NULL DEFAULT NULL COMMENT '鍏宠仈瀹夊叏鍩硅鑰冩牳id',
+ `examination_results` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鑰冩牳缁撴灉',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--瀹夊叏鍩硅鑰冩牳--璁板綍璇︽儏' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for safe_training_file
+-- ----------------------------
+DROP TABLE IF EXISTS `safe_training_file`;
+CREATE TABLE `safe_training_file` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `safe_training_id` int NULL DEFAULT NULL COMMENT '鍏宠仈瀹夊叏鍩硅鑰冩牳id',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `file_size` double NULL DEFAULT NULL,
+ `create_time` timestamp NULL DEFAULT NULL,
+ `create_user` int NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL,
+ `update_user` int NULL DEFAULT NULL,
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹夊叏鐢熶骇--瀹夊叏鍩硅鑰冩牳--闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sales_ledger
+-- ----------------------------
+DROP TABLE IF EXISTS `sales_ledger`;
+CREATE TABLE `sales_ledger` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '閿�鍞彴璐︿富閿�',
+ `sales_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '閿�鍞悎鍚屽彿',
+ `customer_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍚堝悓鍙�',
+ `project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椤圭洰鍚嶇О',
+ `entry_date` date NULL DEFAULT NULL COMMENT '褰曞叆鏃ユ湡',
+ `salesman` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓氬姟鍛�',
+ `customer_id` int NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇Оid',
+ `customer_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `entry_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '褰曞叆浜�',
+ `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `attachment_materials` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '闄勪欢鏉愭枡锛屽瓨鍌ㄦ枃浠跺悕绛夌浉鍏充俊鎭�',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `contract_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�',
+ `execution_date` datetime NULL DEFAULT NULL COMMENT '绛捐鏃ユ湡',
+ `payment_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `delivery_date` timestamp NULL DEFAULT NULL COMMENT '浜よ揣鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_sales_entry_person`(`entry_person` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 57 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閿�鍞彴璐�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sales_ledger_product
+-- ----------------------------
+DROP TABLE IF EXISTS `sales_ledger_product`;
+CREATE TABLE `sales_ledger_product` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '浜у搧淇℃伅涓婚敭',
+ `sales_ledger_id` int NOT NULL COMMENT '鍏宠仈鍙拌处涓昏〃涓婚敭',
+ `product_category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜у搧澶х被',
+ `specification_model` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `quantity` decimal(18, 2) NOT NULL COMMENT '鏁伴噺',
+ `min_stock` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈�浣庡簱瀛�',
+ `tax_rate` decimal(5, 0) NOT NULL COMMENT '绋庣巼',
+ `tax_inclusive_unit_price` decimal(18, 2) NOT NULL COMMENT '鍚◣鍗曚环',
+ `tax_inclusive_total_price` decimal(18, 2) NOT NULL COMMENT '鍚◣鎬讳环',
+ `tax_exclusive_total_price` decimal(18, 2) NOT NULL COMMENT '涓嶅惈绋庢�讳环',
+ `invoice_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `type` int NULL DEFAULT NULL COMMENT '1.閿�鍞彴璐︼紝2.閲囪喘鍙拌处',
+ `product_id` int NULL DEFAULT NULL COMMENT '浜у搧id',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '鍨嬪彿id',
+ `register` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐧昏浜�',
+ `register_date` datetime NULL DEFAULT NULL COMMENT '鐧昏鏃ユ湡',
+ `warn_num` decimal(10, 2) NULL DEFAULT NULL COMMENT '棰勮鏁伴噺',
+ `approve_status` int NULL DEFAULT 0 COMMENT '瀹℃壒鐘舵�侊細0鏈嚭搴�,1宸插嚭搴�,2寰呭鏍�(瀹℃牳涓�),3瀹℃牳瀹屾垚,4瀹℃牳澶辫触',
+ `is_checked` tinyint(1) NOT NULL DEFAULT 1 COMMENT '鏄惁鎺ㄩ�佽川妫�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `is_production` tinyint(1) NULL DEFAULT 0 COMMENT '鏄惁鐢熶骇',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 105 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜у搧淇℃伅' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sales_ledger_product_template
+-- ----------------------------
+DROP TABLE IF EXISTS `sales_ledger_product_template`;
+CREATE TABLE `sales_ledger_product_template` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '浜у搧淇℃伅涓婚敭',
+ `sales_ledger_id` int NOT NULL COMMENT '鍏宠仈鍙拌处妯℃澘涓昏〃涓婚敭',
+ `product_category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜у搧澶х被',
+ `specification_model` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `quantity` decimal(18, 2) NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `min_stock` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏈�浣庡簱瀛�',
+ `tax_rate` decimal(5, 0) NULL DEFAULT NULL COMMENT '绋庣巼',
+ `tax_inclusive_unit_price` decimal(18, 2) NULL DEFAULT NULL COMMENT '鍚◣鍗曚环',
+ `tax_inclusive_total_price` decimal(18, 2) NULL DEFAULT NULL COMMENT '鍚◣鎬讳环',
+ `tax_exclusive_total_price` decimal(18, 2) NULL DEFAULT NULL COMMENT '涓嶅惈绋庢�讳环',
+ `invoice_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙戠エ绫诲瀷',
+ `type` int NULL DEFAULT NULL COMMENT '1.閿�鍞彴璐︼紝2.閲囪喘鍙拌处',
+ `product_id` bigint NULL DEFAULT NULL COMMENT '浜у搧id',
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '鍨嬪彿id',
+ `register` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `register_date` datetime NULL DEFAULT NULL,
+ `warn_num` decimal(10, 2) NULL DEFAULT NULL,
+ `is_checked` tinyint NULL DEFAULT 1 COMMENT '鏄惁鎺ㄩ�佽川妫�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜у搧淇℃伅妯℃澘' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sales_quotation
+-- ----------------------------
+DROP TABLE IF EXISTS `sales_quotation`;
+CREATE TABLE `sales_quotation` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `quotation_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鎶ヤ环鍗曞彿',
+ `customer_id` bigint NOT NULL DEFAULT 0 COMMENT '瀹㈡埛id',
+ `salesperson` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '涓氬姟鍛�',
+ `quotation_date` date NULL DEFAULT NULL COMMENT '鎶ヤ环鏃ユ湡',
+ `valid_date` date NULL DEFAULT NULL COMMENT '鏈夋晥鏈熻嚦',
+ `total_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鎶ヤ环閲戦',
+ `payment_method` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '浠樻鏂瑰紡',
+ `delivery_period` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '浜よ揣鏈�,澶╂暟',
+ `status` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鎶ヤ环鐘舵��',
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `customer` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 49 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '閿�鍞�/鎶ヤ环' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sales_quotation_product
+-- ----------------------------
+DROP TABLE IF EXISTS `sales_quotation_product`;
+CREATE TABLE `sales_quotation_product` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `sales_quotation_id` int NULL DEFAULT NULL COMMENT '閿�鍞姤浠峰崟id',
+ `product` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '浜у搧鍚嶇О',
+ `product_id` bigint NULL DEFAULT NULL COMMENT '浜у搧Id',
+ `specification` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '瑙勬牸鍨嬪彿',
+ `quantity` int NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `unit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `unit_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍗曚环',
+ `amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '閲戦',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸Id',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 55 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '閿�鍞姤浠蜂骇鍝佽〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sales_receipt_return
+-- ----------------------------
+DROP TABLE IF EXISTS `sales_receipt_return`;
+CREATE TABLE `sales_receipt_return` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭 ID',
+ `refund_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '閫�娆惧崟鍙�',
+ `payment_account` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浠樻璐﹀彿',
+ `payment_account_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浠樻璐﹀彿鍚嶇О',
+ `payment_method` tinyint NULL DEFAULT NULL COMMENT '浠樻鏂瑰紡',
+ `actual_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '瀹為檯浠樻閲戦',
+ `fee` decimal(10, 2) NULL DEFAULT NULL COMMENT '鎵嬬画璐�',
+ `transaction_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜ゆ槗鍙�',
+ `discount_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '浼樻儬閲戦',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏀舵閫�璐ц〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sales_refund_amount_order
+-- ----------------------------
+DROP TABLE IF EXISTS `sales_refund_amount_order`;
+CREATE TABLE `sales_refund_amount_order` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `return_management_id` bigint NULL DEFAULT NULL COMMENT '閫�璐у崟鍙穒d',
+ `status` int NULL DEFAULT NULL COMMENT '鐘舵�� 0:寰呭鏍� 1:寰呴��娆� 2锛氬凡閫�娆�',
+ `refund_amount` decimal(16, 3) NULL DEFAULT NULL COMMENT '搴旈��娆鹃噾棰�',
+ `refunded_amount` decimal(16, 3) NULL DEFAULT NULL COMMENT '宸查��娆鹃噾棰�',
+ `not_refunded_amount` decimal(16, 3) NULL DEFAULT NULL COMMENT '鏈��娆鹃噾棰�',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篿d',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊浜篿d',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '閿�鍞鐞�--閫�娆惧崟' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for salesperson_management
+-- ----------------------------
+DROP TABLE IF EXISTS `salesperson_management`;
+CREATE TABLE `salesperson_management` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '濮撳悕',
+ `phone` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `email` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '閭',
+ `department` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '閮ㄩ棬',
+ `position` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鑱屼綅',
+ `hire_date` datetime NULL DEFAULT NULL COMMENT '鍏ヨ亴鏃ユ湡',
+ `permissions` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鏉冮檺',
+ `status` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鐘舵��',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃ユ湡',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '涓氬姟鍛樼鐞嗚〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for scheme_applicable_staff
+-- ----------------------------
+DROP TABLE IF EXISTS `scheme_applicable_staff`;
+CREATE TABLE `scheme_applicable_staff` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏍囬',
+ `dept_ids` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閮ㄩ棬ids',
+ `staff_names` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜哄憳鍚嶇О,澶氫釜浣跨敤,闅斿紑',
+ `staff_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浜哄憳id,澶氫釜浣跨敤,闅斿紑',
+ `insurance_types` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '淇濋櫓绫诲瀷鍚嶇О澶氫釜浣跨敤,闅斿紑',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '绀句繚鏂规閫傜敤浜哄憳琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for scheme_insurance_detail
+-- ----------------------------
+DROP TABLE IF EXISTS `scheme_insurance_detail`;
+CREATE TABLE `scheme_insurance_detail` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '鏄庣粏ID锛堜富閿級',
+ `scheme_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈鐨勭ぞ淇濇柟妗圛D',
+ `insurance_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '淇濋櫓绫诲瀷锛堝鍖荤枟淇濋櫓銆佸吇鑰佷繚闄╃瓑锛�',
+ `payment_base` decimal(10, 2) NULL DEFAULT NULL COMMENT '缂磋垂鍩烘暟',
+ `use_basic_salary` int NULL DEFAULT 1 COMMENT '鏄惁璋冪敤鍩烘湰宸ヨ祫锛�1-鍚︼紝2-鏄�',
+ `personal_ratio` decimal(5, 2) NULL DEFAULT 0.00 COMMENT '涓汉缂磋垂姣斾緥锛�%锛�',
+ `personal_fixed` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '涓汉鍥哄畾缂磋垂閲戦',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '绀句繚鏂规淇濋櫓绂忓埄鏄庣粏琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for seal_application_management
+-- ----------------------------
+DROP TABLE IF EXISTS `seal_application_management`;
+CREATE TABLE `seal_application_management` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `application_num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢宠缂栧彿',
+ `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢宠鏍囬',
+ `seal_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢ㄥ嵃绫诲瀷',
+ `reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢宠鐢ㄥ嵃鍘熷洜',
+ `urgency` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ョ▼搴�',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�-鐢宠浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿-鐢宠鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `approve_user_id` int NULL DEFAULT NULL COMMENT '瀹℃壒浜篿d',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄥ嵃鐢宠绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for shipping_info
+-- ----------------------------
+DROP TABLE IF EXISTS `shipping_info`;
+CREATE TABLE `shipping_info` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `sales_ledger_id` bigint NULL DEFAULT NULL COMMENT '閿�鍞彴璐d',
+ `shipping_date` datetime NULL DEFAULT NULL COMMENT '鍙戣揣鏃ユ湡',
+ `shipping_car_number` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍙戣揣杞︾墝鍙�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `sales_ledger_product_id` int NULL DEFAULT NULL COMMENT '閿�鍞彴璐︿骇鍝佽〃id',
+ `shipping_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍙戣揣缂栧彿',
+ `express_number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '蹇�掑崟鍙�',
+ `express_company` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '蹇�掑叕鍙�',
+ `type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍙戣揣绫诲瀷',
+ `status` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鐘舵��',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_shipping_sales_ledger_status`(`sales_ledger_id` ASC, `status` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 68 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '鍙戣揣淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for shipping_product_detail
+-- ----------------------------
+DROP TABLE IF EXISTS `shipping_product_detail`;
+CREATE TABLE `shipping_product_detail` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
+ `stock_inventory_id` bigint NULL DEFAULT NULL COMMENT '搴撳瓨琛╥d',
+ `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵规鍙�',
+ `quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT '鍙戣揣鐨勬暟閲�',
+ `shipping_info_id` bigint NULL DEFAULT NULL COMMENT '鍙戣揣鍙拌处id',
+ `product_model_id` bigint NULL DEFAULT NULL COMMENT '浜у搧id',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 80 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍙戣揣鍙拌处璇︽儏琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for spare_parts
+-- ----------------------------
+DROP TABLE IF EXISTS `spare_parts`;
+CREATE TABLE `spare_parts` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囦欢鍒嗙被鍚嶇О',
+ `parent_id` int NULL DEFAULT NULL COMMENT '澶囦欢鍒嗙被鐖秈d',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎻忚堪',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '浠锋牸',
+ `quantity` decimal(10, 2) NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `device_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧id闆嗗悎锛堝瓧绗︿覆,闅斿紑锛�',
+ `spare_parts_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璁惧绠$悊-澶囦欢绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for spare_parts_requisition_record
+-- ----------------------------
+DROP TABLE IF EXISTS `spare_parts_requisition_record`;
+CREATE TABLE `spare_parts_requisition_record` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `source_type` smallint NULL DEFAULT NULL COMMENT '鏉ユ簮绫诲瀷(0 缁翠慨 1 淇濆吇)',
+ `source_id` bigint NOT NULL DEFAULT 0 COMMENT '鏉ユ簮id',
+ `device_ledger_id` bigint NOT NULL DEFAULT 0 COMMENT '璁惧id',
+ `spare_parts_id` bigint NOT NULL DEFAULT 0 COMMENT '澶囦欢id',
+ `quantity` int NOT NULL DEFAULT 0 COMMENT '鏁伴噺',
+ `create_user` bigint NOT NULL DEFAULT 0 COMMENT '鍒涘缓浜�',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '璁惧鎶ヤ慨淇濆吇鐨勫浠堕浣跨敤琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_contacts_personal
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_contacts_personal`;
+CREATE TABLE `staff_contacts_personal` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `contact_id` int NULL DEFAULT NULL COMMENT '鍛樺伐ID',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '涓汉閫氳褰�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_contract
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_contract`;
+CREATE TABLE `staff_contract` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `staff_on_job_id` bigint NOT NULL DEFAULT 0 COMMENT '鍛樺伐鍦ㄨ亴id',
+ `contract_start_time` datetime NULL DEFAULT NULL COMMENT '鍚堝悓寮�濮嬫椂闂�',
+ `contract_end_time` datetime NULL DEFAULT NULL COMMENT '鍚堝悓缁撴潫鏃堕棿',
+ `contract_term` int NOT NULL DEFAULT 0 COMMENT '鍚堝悓鏈熼檺',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_education
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_education`;
+CREATE TABLE `staff_education` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `staff_on_job_id` bigint NOT NULL COMMENT '鍏宠仈staff_on_job琛ㄤ富閿甀D',
+ `education` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀛﹀巻',
+ `school_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '姣曚笟闄㈡牎',
+ `enroll_time` date NULL DEFAULT NULL COMMENT '鍏ュ鏃堕棿',
+ `graduate_time` date NULL DEFAULT NULL COMMENT '姣曚笟鏃堕棿',
+ `major` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓撲笟',
+ `degree` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀛︿綅',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍛樺伐鏁欒偛缁忓巻琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_emergency_contact
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_emergency_contact`;
+CREATE TABLE `staff_emergency_contact` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `staff_on_job_id` bigint NOT NULL COMMENT '鍏宠仈staff_on_job琛ㄤ富閿甀D',
+ `contact_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉濮撳悕',
+ `contact_relation` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉鍏崇郴',
+ `contact_phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉鎵嬫満',
+ `contact_address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉浣忓潃',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍛樺伐绱ф�ヨ仈绯讳汉琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_join_leave_record
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_join_leave_record`;
+CREATE TABLE `staff_join_leave_record` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `staff_state` int NULL DEFAULT NULL COMMENT '鐘舵��(0:绂昏亴;1:鍏ヨ亴)',
+ `staff_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐缂栧彿',
+ `leave_date` date NULL DEFAULT NULL COMMENT '绂昏亴鏃ユ湡',
+ `staff_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐濮撳悕',
+ `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎬у埆',
+ `native_place` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绫嶈疮',
+ `post_job` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宀椾綅',
+ `adress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹跺涵浣忓潃',
+ `first_study` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绗竴瀛﹀巻',
+ `profession` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓撲笟',
+ `identity_card` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '韬唤璇佸彿鐮�',
+ `age` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '骞撮緞',
+ `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `emergency_contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉',
+ `emergency_contact_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉鐢佃瘽',
+ `contract_term` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚堝悓骞撮檺',
+ `contract_start_time` date NULL DEFAULT NULL COMMENT '鍚堝悓寮�濮嬫棩鏈�',
+ `contract_end_time` date NULL DEFAULT NULL COMMENT '鍚堝悓缁撴潫鏃ユ湡',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `probation_period` int NULL DEFAULT NULL COMMENT '璇曠敤鏈燂紙鏈堬級',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜哄憳绠$悊--鏂板鍏ヨ亴/绂昏亴' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_leave
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_leave`;
+CREATE TABLE `staff_leave` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `staff_on_job_id` bigint NOT NULL DEFAULT 0 COMMENT '鍛樺伐鍦ㄨ亴id',
+ `reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绂昏亴鍘熷洜',
+ `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '绂昏亴澶囨敞',
+ `tenant_id` bigint NOT NULL COMMENT '绉熸埛id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `leave_date` date NULL DEFAULT NULL COMMENT '绂昏亴鏃ユ湡',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_on_job
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_on_job`;
+CREATE TABLE `staff_on_job` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `staff_state` int NULL DEFAULT NULL COMMENT '鐘舵��(0:绂昏亴;1:鍦ㄨ亴)',
+ `staff_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐缂栧彿',
+ `staff_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐濮撳悕',
+ `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎬у埆',
+ `native_place` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绫嶈疮',
+ `adress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹跺涵浣忓潃',
+ `first_study` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绗竴瀛﹀巻',
+ `profession` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓撲笟',
+ `identity_card` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '韬唤璇佸彿鐮�',
+ `age` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '骞撮緞',
+ `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `emergency_contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉',
+ `emergency_contact_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绱ф�ヨ仈绯讳汉鐢佃瘽',
+ `contract_term` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍚堝悓骞撮檺',
+ `contract_expire_time` date NULL DEFAULT NULL COMMENT '鍚堝悓鍒版湡鏃ユ湡',
+ `trial_end_date` date NULL DEFAULT NULL COMMENT '缁撴潫璇曠敤鏃堕棿',
+ `trial_start_date` date NULL DEFAULT NULL COMMENT '寮�濮嬭瘯鐢ㄦ椂闂�',
+ `salary_select` char(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヨ祫鎶ラ叕閫夋嫨鏉℃',
+ `pro_salary` decimal(10, 2) NULL DEFAULT NULL COMMENT '璇曠敤鏈熷伐璧�',
+ `date_select` char(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍔冲姩鍚堝悓鏈熼檺閫夋嫨',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '鏃�' COMMENT '澶囨敞锛堢鍒╁緟閬囷級',
+ `sign_date` date NULL DEFAULT NULL COMMENT '绛捐鏃ユ湡',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `sys_post_id` bigint NOT NULL DEFAULT 0 COMMENT '宀椾綅id',
+ `sys_dept_id` bigint NOT NULL DEFAULT 0 COMMENT '閮ㄩ棬id',
+ `role_id` bigint NULL DEFAULT NULL COMMENT '瑙掕壊id',
+ `alias` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒悕',
+ `birth_date` date NULL DEFAULT NULL COMMENT '鍑虹敓鏃ユ湡',
+ `nation` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '姹夋棌' COMMENT '姘戞棌',
+ `marital_status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '鏈' COMMENT '濠氬Щ鐘跺喌',
+ `pro_term` int NULL DEFAULT 3 COMMENT '璇曠敤鏈燂紙鏈堬級',
+ `positive_date` date NULL DEFAULT NULL COMMENT '杞鏃ユ湡',
+ `basic_salary` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '鍩烘湰宸ヨ祫',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `staff_no`(`staff_no` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浜哄憳绠$悊--鍛樺伐鍙拌处/鍚堝悓绠$悊' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_salary_detail
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_salary_detail`;
+CREATE TABLE `staff_salary_detail` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `main_id` bigint NOT NULL COMMENT '鍏宠仈宸ヨ祫涓昏〃ID',
+ `staff_on_job_id` bigint NOT NULL COMMENT '鍏宠仈staff_on_job琛ㄤ富閿甀D',
+ `staff_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍛樺伐濮撳悕',
+ `post_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱屼綅鍚嶇О',
+ `dept_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閮ㄩ棬鍚嶇О',
+ `basic_salary` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '鍩烘湰宸ヨ祫',
+ `piece_salary` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '璁′欢宸ヨ祫',
+ `hourly_salary` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '璁℃椂宸ヨ祫',
+ `other_income` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '鍏朵粬鏀跺叆',
+ `social_personal` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '绀句繚涓汉',
+ `fund_personal` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '鍏Н閲戜釜浜�',
+ `other_deduct` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '鍏朵粬鏀嚭',
+ `salary_tax` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '宸ヨ祫涓◣',
+ `gross_salary` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '搴斿彂宸ヨ祫',
+ `deduct_salary` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '搴旀墸宸ヨ祫',
+ `net_salary` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '瀹炲彂宸ヨ祫',
+ `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `social_supplement_amount` decimal(18, 2) NOT NULL DEFAULT 0.00 COMMENT '绀句繚琛ョ即',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 185 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍛樺伐宸ヨ祫鏄庣粏琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_salary_main
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_salary_main`;
+CREATE TABLE `staff_salary_main` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `audit_user_id` bigint NULL DEFAULT NULL COMMENT '瀹℃牳浜篿d',
+ `audit_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹℃牳浜哄悕绉�',
+ `salary_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヨ祫涓婚',
+ `dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏宠仈閮ㄩ棬ID锛屽涓敤閫楀彿鍒嗛殧',
+ `salary_month` varchar(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヨ祫鏈堜唤锛屾牸寮忥細yyyy-MM',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `status` tinyint NOT NULL DEFAULT 0 COMMENT '鐘舵�侊細1-鑽夌 2-瀹℃牳鏈�氳繃 3-寰呭鏍� 4-寰呭彂鏀� 5-宸插彂鏀�',
+ `total_salary` decimal(12, 2) NULL DEFAULT NULL COMMENT '宸ヨ祫鎬婚',
+ `pay_bank` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏀粯閾惰',
+ `pay_time` datetime NULL DEFAULT NULL COMMENT '鍙戞斁鏃堕棿',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍛樺伐宸ヨ祫涓昏〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_scheduling
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_scheduling`;
+CREATE TABLE `staff_scheduling` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `staff_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍛樺伐ID',
+ `department` int NULL DEFAULT NULL COMMENT '閮ㄩ棬',
+ `shift_type` int NULL DEFAULT NULL COMMENT '鎺掔彮绫诲瀷',
+ `work_date` date NULL DEFAULT NULL COMMENT '宸ヤ綔鏃ユ湡',
+ `work_start_time` timestamp NULL DEFAULT NULL COMMENT '寮�濮嬪伐浣滄椂闂�',
+ `lunch_time` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '鍗堜紤鏃堕棿',
+ `work_end_time` timestamp NULL DEFAULT NULL COMMENT '缁撴潫宸ヤ綔鏃堕棿',
+ `work_hours` decimal(10, 2) NULL DEFAULT NULL COMMENT '宸ヤ綔鏃堕暱',
+ `status` int NULL DEFAULT NULL COMMENT '鐘舵��',
+ `staff_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL,
+ `remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for staff_work_experience
+-- ----------------------------
+DROP TABLE IF EXISTS `staff_work_experience`;
+CREATE TABLE `staff_work_experience` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `staff_on_job_id` bigint NOT NULL COMMENT '鍏宠仈staff_on_job琛ㄤ富閿甀D',
+ `former_company` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍓嶅叕鍙�',
+ `former_dept` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍓嶅叕鍙搁儴闂�',
+ `former_position` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍓嶅叕鍙歌亴浣�',
+ `start_date` date NULL DEFAULT NULL COMMENT '寮�濮嬫棩鏈�',
+ `end_date` date NULL DEFAULT NULL COMMENT '缁撴潫鏃ユ湡',
+ `work_desc` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヤ綔鎻忚堪',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍛樺伐宸ヤ綔缁忓巻琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for stock_in_record
+-- ----------------------------
+DROP TABLE IF EXISTS `stock_in_record`;
+CREATE TABLE `stock_in_record` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `inbound_batches` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏ュ簱鎵规',
+ `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `stock_in_num` decimal(16, 4) NULL DEFAULT NULL COMMENT '鍏ュ簱鏁伴噺',
+ `record_id` int NULL DEFAULT NULL COMMENT '鍏ュ簱鏉ユ簮id',
+ `record_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏ュ簱绫诲瀷',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '0鍚堟牸鍏ュ簱1涓嶅悎鏍煎叆搴�',
+ `weighing_date` datetime NULL DEFAULT NULL COMMENT '杩囩鏃ユ湡',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `approval_status` int NULL DEFAULT 0,
+ `warn_num` decimal(16, 4) NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 153 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍏ュ簱璁板綍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for stock_inventory
+-- ----------------------------
+DROP TABLE IF EXISTS `stock_inventory`;
+CREATE TABLE `stock_inventory` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '瑙勬牸id',
+ `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `qualitity` decimal(16, 4) NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `version` int NULL DEFAULT NULL COMMENT '鐗堟湰鍙�',
+ `locked_quantity` decimal(16, 4) NULL DEFAULT 0.0000 COMMENT '琚鍗曢攣瀹氭暟閲�',
+ `warn_num` decimal(16, 4) NULL DEFAULT NULL COMMENT '棰勮鏁伴噺',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '搴撳瓨琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for stock_out_record
+-- ----------------------------
+DROP TABLE IF EXISTS `stock_out_record`;
+CREATE TABLE `stock_out_record` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `outbound_batches` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏ュ簱鎵规',
+ `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `stock_out_num` decimal(16, 4) NULL DEFAULT NULL COMMENT '鍏ュ簱鏁伴噺',
+ `record_id` int NULL DEFAULT NULL COMMENT '鍏ュ簱鏉ユ簮id',
+ `record_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏ュ簱绫诲瀷',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '浜у搧瑙勬牸id',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_time` timestamp NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏇存柊浜�',
+ `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '0鍚堟牸鍑哄簱1涓嶅悎鏍煎嚭搴�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `approval_status` int NULL DEFAULT 0 COMMENT '瀹℃壒鐘舵�� 0-寰呭鎵� 1-閫氳繃 2-椹冲洖 3-閿�鍞嚭搴撳緟纭',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 157 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍑哄簱璁板綍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for stock_uninventory
+-- ----------------------------
+DROP TABLE IF EXISTS `stock_uninventory`;
+CREATE TABLE `stock_uninventory` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭id',
+ `product_model_id` int NULL DEFAULT NULL COMMENT '瑙勬牸id',
+ `batch_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鎵瑰彿',
+ `qualitity` decimal(16, 4) NULL DEFAULT NULL COMMENT '鏁伴噺',
+ `create_time` timestamp NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `version` int NULL DEFAULT NULL COMMENT '鐗堟湰鍙�',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `locked_quantity` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍐荤粨鏁伴噺',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '涓嶅悎鏍煎簱瀛樿〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for storage_attachment
+-- ----------------------------
+DROP TABLE IF EXISTS `storage_attachment`;
+CREATE TABLE `storage_attachment` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `deleted` bigint NOT NULL DEFAULT 0 COMMENT '閫昏緫鍒犻櫎锛�0姝e父锛�',
+ `record_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏宠仈鐨勮褰曠被鍨�',
+ `record_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈鐨勮褰旾D',
+ `application` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢鐢ㄩ�旓紝濡� file/avatar',
+ `storage_blob_id` bigint NULL DEFAULT NULL COMMENT '鍏宠仈storage_blob璁板綍ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 215 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏂囦欢鍏宠仈琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for storage_blob
+-- ----------------------------
+DROP TABLE IF EXISTS `storage_blob`;
+CREATE TABLE `storage_blob` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `resource_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璧勬簮鍞竴鏍囪瘑锛堝瀵硅薄瀛樺偍key锛�',
+ `content_type` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璧勬簮绫诲瀷锛屽 image/jpeg',
+ `original_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍘熸枃浠跺悕',
+ `uid_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍞竴鏂囦欢鍚�',
+ `byte_size` bigint NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬锛堝瓧鑺傦級',
+ `path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞锛堟湰鍦版垨URL锛�',
+ `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 195 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏂囦欢琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for supplier_manage
+-- ----------------------------
+DROP TABLE IF EXISTS `supplier_manage`;
+CREATE TABLE `supplier_manage` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `supplier_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `taxpayer_identification_num` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绾崇◣浜鸿瘑鍒彿',
+ `company_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏徃鍦板潃',
+ `supplier_type` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗙被鍨�',
+ `company_phone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍏徃鐢佃瘽',
+ `bank_account_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寮�鎴疯',
+ `bank_account_num` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璐﹀彿',
+ `contact_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴浜�',
+ `contact_user_phone` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `maintain_user_id` bigint NULL DEFAULT NULL COMMENT '缁存姢浜篒D',
+ `maintain_time` datetime NULL DEFAULT NULL COMMENT '缁存姢鏃堕棿',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `is_white` bigint NULL DEFAULT 0 COMMENT '鏄惁鐧藉悕鍗曪紙0鏄� 1鍚︼級',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 223 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '渚涘簲鍟嗙鐞�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for supplier_manage_file
+-- ----------------------------
+DROP TABLE IF EXISTS `supplier_manage_file`;
+CREATE TABLE `supplier_manage_file` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢鍚嶇О',
+ `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏂囦欢璺緞',
+ `file_size` int NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `supplier_id` bigint NULL DEFAULT NULL COMMENT '渚涘簲鍟咺D',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '渚涘簲鍟嗙鐞�--璧勮川闄勪欢' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_config
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_config`;
+CREATE TABLE `sys_config` (
+ `config_id` int NOT NULL AUTO_INCREMENT COMMENT '鍙傛暟涓婚敭',
+ `config_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍙傛暟鍚嶇О',
+ `config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍙傛暟閿悕',
+ `config_value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍙傛暟閿��',
+ `config_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'N' COMMENT '绯荤粺鍐呯疆锛圷鏄� N鍚︼級',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ PRIMARY KEY (`config_id`) USING BTREE,
+ INDEX `idx_config_key`(`config_key` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍙傛暟閰嶇疆琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_dept
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_dept`;
+CREATE TABLE `sys_dept` (
+ `dept_id` bigint NOT NULL AUTO_INCREMENT COMMENT '閮ㄩ棬id',
+ `parent_id` bigint NULL DEFAULT 0 COMMENT '鐖堕儴闂╥d',
+ `ancestors` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '绁栫骇鍒楄〃',
+ `dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '閮ㄩ棬鍚嶇О',
+ `order_num` int NULL DEFAULT 0 COMMENT '鏄剧ず椤哄簭',
+ `leader` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璐熻矗浜�',
+ `phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鑱旂郴鐢佃瘽',
+ `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閭',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '閮ㄩ棬鐘舵�侊紙0姝e父 1鍋滅敤锛�',
+ `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `dept_nick` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閮ㄩ棬缂栧彿',
+ PRIMARY KEY (`dept_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 213 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閮ㄩ棬琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_dict_data
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_dict_data`;
+CREATE TABLE `sys_dict_data` (
+ `dict_code` bigint NOT NULL AUTO_INCREMENT COMMENT '瀛楀吀缂栫爜',
+ `dict_sort` int NULL DEFAULT 0 COMMENT '瀛楀吀鎺掑簭',
+ `dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀛楀吀鏍囩',
+ `dict_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀛楀吀閿��',
+ `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀛楀吀绫诲瀷',
+ `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏍峰紡灞炴�э紙鍏朵粬鏍峰紡鎵╁睍锛�',
+ `list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '琛ㄦ牸鍥炴樉鏍峰紡',
+ `is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'N' COMMENT '鏄惁榛樿锛圷鏄� N鍚︼級',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鐘舵�侊紙0姝e父 1鍋滅敤锛�',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ PRIMARY KEY (`dict_code`) USING BTREE,
+ INDEX `idx_dict_type_status`(`dict_type` ASC, `status` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 260 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀛楀吀鏁版嵁琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_dict_type
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_dict_type`;
+CREATE TABLE `sys_dict_type` (
+ `dict_id` bigint NOT NULL AUTO_INCREMENT COMMENT '瀛楀吀涓婚敭',
+ `dict_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀛楀吀鍚嶇О',
+ `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀛楀吀绫诲瀷',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鐘舵�侊紙0姝e父 1鍋滅敤锛�',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ PRIMARY KEY (`dict_id`) USING BTREE,
+ UNIQUE INDEX `dict_type`(`dict_type` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀛楀吀绫诲瀷琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_job
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_job`;
+CREATE TABLE `sys_job` (
+ `job_id` bigint NOT NULL AUTO_INCREMENT COMMENT '浠诲姟ID',
+ `job_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '浠诲姟鍚嶇О',
+ `job_group` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'DEFAULT' COMMENT '浠诲姟缁勫悕',
+ `invoke_target` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冪敤鐩爣瀛楃涓�',
+ `cron_expression` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT 'cron鎵ц琛ㄨ揪寮�',
+ `misfire_policy` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '3' COMMENT '璁″垝鎵ц閿欒绛栫暐锛�1绔嬪嵆鎵ц 2鎵ц涓�娆� 3鏀惧純鎵ц锛�',
+ `concurrent` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '1' COMMENT '鏄惁骞跺彂鎵ц锛�0鍏佽 1绂佹锛�',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鐘舵�侊紙0姝e父 1鏆傚仠锛�',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '澶囨敞淇℃伅',
+ PRIMARY KEY (`job_id`, `job_name`, `job_group`) USING BTREE,
+ INDEX `idx_job_status`(`status` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹氭椂浠诲姟璋冨害琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_job_log
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_job_log`;
+CREATE TABLE `sys_job_log` (
+ `job_log_id` bigint NOT NULL AUTO_INCREMENT COMMENT '浠诲姟鏃ュ織ID',
+ `job_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浠诲姟鍚嶇О',
+ `job_group` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '浠诲姟缁勫悕',
+ `invoke_target` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璋冪敤鐩爣瀛楃涓�',
+ `job_message` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏃ュ織淇℃伅',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鎵ц鐘舵�侊紙0姝e父 1澶辫触锛�',
+ `exception_info` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '寮傚父淇℃伅',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ PRIMARY KEY (`job_log_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹氭椂浠诲姟璋冨害鏃ュ織琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_logininfor
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_logininfor`;
+CREATE TABLE `sys_logininfor` (
+ `info_id` bigint NOT NULL AUTO_INCREMENT COMMENT '璁块棶ID',
+ `user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鐢ㄦ埛璐﹀彿',
+ `ipaddr` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鐧诲綍IP鍦板潃',
+ `login_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鐧诲綍鍦扮偣',
+ `browser` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '娴忚鍣ㄧ被鍨�',
+ `os` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鎿嶄綔绯荤粺',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鐧诲綍鐘舵�侊紙0鎴愬姛 1澶辫触锛�',
+ `msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鎻愮ず娑堟伅',
+ `login_time` datetime NULL DEFAULT NULL COMMENT '璁块棶鏃堕棿',
+ PRIMARY KEY (`info_id`) USING BTREE,
+ INDEX `idx_sys_logininfor_s`(`status` ASC) USING BTREE,
+ INDEX `idx_sys_logininfor_lt`(`login_time` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4498 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '绯荤粺璁块棶璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_menu`;
+CREATE TABLE `sys_menu` (
+ `menu_id` bigint NOT NULL AUTO_INCREMENT COMMENT '鑿滃崟ID',
+ `menu_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鑿滃崟鍚嶇О',
+ `parent_id` bigint NULL DEFAULT 0 COMMENT '鐖惰彍鍗旾D',
+ `order_num` int NULL DEFAULT 0 COMMENT '鏄剧ず椤哄簭',
+ `path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '璺敱鍦板潃',
+ `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '缁勪欢璺緞',
+ `query` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璺敱鍙傛暟',
+ `route_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '璺敱鍚嶇О',
+ `is_frame` int NULL DEFAULT 1 COMMENT '鏄惁涓哄閾撅紙0鏄� 1鍚︼級',
+ `is_cache` int NULL DEFAULT 0 COMMENT '鏄惁缂撳瓨锛�0缂撳瓨 1涓嶇紦瀛橈級',
+ `menu_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鑿滃崟绫诲瀷锛圡鐩綍 C鑿滃崟 F鎸夐挳锛�',
+ `visible` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鑿滃崟鐘舵�侊紙0鏄剧ず 1闅愯棌锛�',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鑿滃崟鐘舵�侊紙0姝e父 1鍋滅敤锛�',
+ `perms` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏉冮檺鏍囪瘑',
+ `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '#' COMMENT '鑿滃崟鍥炬爣',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '澶囨敞',
+ `app_component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'app缁勪欢璺緞',
+ PRIMARY KEY (`menu_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2348 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鑿滃崟鏉冮檺琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_notice
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_notice`;
+CREATE TABLE `sys_notice` (
+ `notice_id` int NOT NULL AUTO_INCREMENT COMMENT '鍏憡ID',
+ `notice_title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍏憡鏍囬',
+ `notice_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍏憡绫诲瀷锛�1閫氱煡 2鍏憡锛�',
+ `notice_content` longblob NULL COMMENT '鍏憡鍐呭',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鍏憡鐘舵�侊紙0姝e父 1鍏抽棴锛�',
+ `consignee_id` bigint NULL DEFAULT NULL COMMENT '鍙戦�佷汉id',
+ `sender_id` bigint NULL DEFAULT NULL COMMENT '鏀朵欢浜篿d',
+ `jump_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璺宠浆璺緞',
+ `app_jump_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'APP璺宠浆璺緞',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `tenant_id` int NULL DEFAULT NULL,
+ PRIMARY KEY (`notice_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1296 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '閫氱煡鍏憡琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_oper_log
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_oper_log`;
+CREATE TABLE `sys_oper_log` (
+ `oper_id` bigint NOT NULL AUTO_INCREMENT COMMENT '鏃ュ織涓婚敭',
+ `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '妯″潡鏍囬',
+ `business_type` int NULL DEFAULT 0 COMMENT '涓氬姟绫诲瀷锛�0鍏跺畠 1鏂板 2淇敼 3鍒犻櫎锛�',
+ `method` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏂规硶鍚嶇О',
+ `request_method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '璇锋眰鏂瑰紡',
+ `operator_type` int NULL DEFAULT 0 COMMENT '鎿嶄綔绫诲埆锛�0鍏跺畠 1鍚庡彴鐢ㄦ埛 2鎵嬫満绔敤鎴凤級',
+ `oper_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鎿嶄綔浜哄憳',
+ `dept_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '閮ㄩ棬鍚嶇О',
+ `oper_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '璇锋眰URL',
+ `oper_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '涓绘満鍦板潃',
+ `oper_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鎿嶄綔鍦扮偣',
+ `oper_param` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '璇锋眰鍙傛暟',
+ `json_result` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '杩斿洖鍙傛暟',
+ `status` int NULL DEFAULT 0 COMMENT '鎿嶄綔鐘舵�侊紙0姝e父 1寮傚父锛�',
+ `error_msg` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '閿欒娑堟伅',
+ `oper_time` datetime NULL DEFAULT NULL COMMENT '鎿嶄綔鏃堕棿',
+ `cost_time` bigint NULL DEFAULT 0 COMMENT '娑堣�楁椂闂�',
+ PRIMARY KEY (`oper_id`) USING BTREE,
+ INDEX `idx_sys_oper_log_bt`(`business_type` ASC) USING BTREE,
+ INDEX `idx_sys_oper_log_s`(`status` ASC) USING BTREE,
+ INDEX `idx_sys_oper_log_ot`(`oper_time` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 119789 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鎿嶄綔鏃ュ織璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_post
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_post`;
+CREATE TABLE `sys_post` (
+ `post_id` bigint NOT NULL AUTO_INCREMENT COMMENT '宀椾綅ID',
+ `post_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '宀椾綅缂栫爜',
+ `post_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '宀椾綅鍚嶇О',
+ `post_sort` int NOT NULL COMMENT '鏄剧ず椤哄簭',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐘舵�侊紙0姝e父 1鍋滅敤锛�',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ PRIMARY KEY (`post_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '宀椾綅淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_role
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_role`;
+CREATE TABLE `sys_role` (
+ `role_id` bigint NOT NULL AUTO_INCREMENT COMMENT '瑙掕壊ID',
+ `role_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瑙掕壊鍚嶇О',
+ `role_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瑙掕壊鏉冮檺瀛楃涓�',
+ `role_sort` int NOT NULL COMMENT '鏄剧ず椤哄簭',
+ `data_scope` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '1' COMMENT '鏁版嵁鑼冨洿锛�1锛氬叏閮ㄦ暟鎹潈闄� 2锛氳嚜瀹氭暟鎹潈闄� 3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺 4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶級',
+ `menu_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀�',
+ `dept_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '閮ㄩ棬鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀�',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '瑙掕壊鐘舵�侊紙0姝e父 1鍋滅敤锛�',
+ `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ PRIMARY KEY (`role_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 112 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瑙掕壊淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_role_dept
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_role_dept`;
+CREATE TABLE `sys_role_dept` (
+ `role_id` bigint NOT NULL COMMENT '瑙掕壊ID',
+ `dept_id` bigint NOT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`role_id`, `dept_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瑙掕壊鍜岄儴闂ㄥ叧鑱旇〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_role_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_role_menu`;
+CREATE TABLE `sys_role_menu` (
+ `role_id` bigint NOT NULL COMMENT '瑙掕壊ID',
+ `menu_id` bigint NOT NULL COMMENT '鑿滃崟ID',
+ PRIMARY KEY (`role_id`, `menu_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瑙掕壊鍜岃彍鍗曞叧鑱旇〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_user
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_user`;
+CREATE TABLE `sys_user` (
+ `user_id` bigint NOT NULL AUTO_INCREMENT COMMENT '鐢ㄦ埛ID',
+ `user_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐢ㄦ埛璐﹀彿',
+ `nick_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鐢ㄦ埛鏄电О',
+ `user_type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '00' COMMENT '鐢ㄦ埛绫诲瀷锛�00绯荤粺鐢ㄦ埛锛�',
+ `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鐢ㄦ埛閭',
+ `phonenumber` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鎵嬫満鍙风爜',
+ `sex` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鐢ㄦ埛鎬у埆锛�0鐢� 1濂� 2鏈煡锛�',
+ `avatar` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '澶村儚鍦板潃',
+ `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '瀵嗙爜',
+ `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '璐﹀彿鐘舵�侊紙0姝e父 1鍋滅敤锛�',
+ `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�',
+ `login_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏈�鍚庣櫥褰旾P',
+ `login_date` datetime NULL DEFAULT NULL COMMENT '鏈�鍚庣櫥褰曟椂闂�',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `ai_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT '鏄惁寮�閫欰I鍔熻兘锛�0鍚� 1鏄級',
+ PRIMARY KEY (`user_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 262 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄦ埛淇℃伅琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_user_client
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_user_client`;
+CREATE TABLE `sys_user_client` (
+ `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛ID',
+ `cid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '涓帹CID',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏈�鍚庢椿璺冩椂闂�',
+ PRIMARY KEY (`user_id`) USING BTREE,
+ UNIQUE INDEX `uk_cid`(`cid` ASC) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄦ埛瀹夊崜璁惧' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_user_dept
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_user_dept`;
+CREATE TABLE `sys_user_dept` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `user_id` bigint NULL DEFAULT NULL COMMENT 'sys_user琛ㄤ富閿�',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT 'sys_dept琛ㄤ富閿�',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 648 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_user_post
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_user_post`;
+CREATE TABLE `sys_user_post` (
+ `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛ID',
+ `post_id` bigint NOT NULL COMMENT '宀椾綅ID',
+ PRIMARY KEY (`user_id`, `post_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄦ埛涓庡矖浣嶅叧鑱旇〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for sys_user_role
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_user_role`;
+CREATE TABLE `sys_user_role` (
+ `user_id` bigint NOT NULL COMMENT '鐢ㄦ埛ID',
+ `role_id` bigint NOT NULL COMMENT '瑙掕壊ID',
+ PRIMARY KEY (`user_id`, `role_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄦ埛鍜岃鑹插叧鑱旇〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_bom
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_bom`;
+CREATE TABLE `technology_bom` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `product_model_id` bigint NOT NULL COMMENT '浜у搧瑙勬牸id',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐗堟湰鍙�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '鏇存柊鑰�',
+ `bom_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'BOM缂栧彿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'BOM琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_bom_structure
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_bom_structure`;
+CREATE TABLE `technology_bom_structure` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `parent_id` bigint NULL DEFAULT NULL COMMENT '鐖惰妭鐐笽D',
+ `product_model_id` bigint NOT NULL COMMENT '浜у搧id',
+ `operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭id',
+ `unit_quantity` decimal(16, 4) NOT NULL COMMENT '鍗曚綅浜у嚭闇�瑕佹暟閲�',
+ `demanded_quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT '闇�姹傛暟閲�',
+ `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `bom_id` bigint NOT NULL COMMENT 'bom鐨刬d',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 61 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'BOM浜у搧缁撴瀯琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_operation
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_operation`;
+CREATE TABLE `technology_operation` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '宸ヨ壓鍚嶇О',
+ `no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '宸ヨ壓缂栧彿',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '澶囨敞',
+ `salary_quota` decimal(16, 3) NULL DEFAULT NULL COMMENT '宸ヨ祫瀹氶',
+ `is_quality` tinyint(1) NULL DEFAULT 1 COMMENT '鏄惁璐ㄦ宸ュ簭',
+ `is_production` tinyint(1) NULL DEFAULT 1 COMMENT '鏄惁鐢熶骇',
+ `type` int NULL DEFAULT NULL COMMENT '绫诲瀷 鍖哄垎璁℃椂鍜岃浠�(0璁℃椂1璁′欢)',
+ `device_ledger_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧id',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '宸ュ簭琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_operation_param
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_operation_param`;
+CREATE TABLE `technology_operation_param` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `technology_param_id` bigint NULL DEFAULT NULL COMMENT '鍩虹鍙傛暟琛╥d',
+ `technology_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭id',
+ `standard_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '鏍囧噯鍊�',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '宸ュ簭鍙傛暟' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_param
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_param`;
+CREATE TABLE `technology_param` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `param_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍙傛暟缂栫爜(鍞竴鏍囪瘑)',
+ `param_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍙傛暟鍚嶇О',
+ `param_type` tinyint NOT NULL COMMENT '鍙傛暟绫诲瀷(1鏁板瓧 2鏂囨湰 3涓嬫媺閫夋嫨 4鏃堕棿)',
+ `param_format` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍙傛暟鏍煎紡',
+ `unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `is_required` tinyint NULL DEFAULT 0 COMMENT '鏄惁蹇呭~',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鍩虹鍙傛暟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_routing
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_routing`;
+CREATE TABLE `technology_routing` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `product_model_id` bigint NOT NULL DEFAULT 0 COMMENT '浜у搧id',
+ `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '鎻忚堪',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `process_route_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヨ壓璺嚎缂栫爜',
+ `bom_id` int NULL DEFAULT NULL COMMENT '鍏宠仈bom鐨刬d',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '宸ヨ壓璺嚎琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_routing_operation
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_routing_operation`;
+CREATE TABLE `technology_routing_operation` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `technology_routing_id` bigint NOT NULL DEFAULT 0 COMMENT '宸ヨ壓璺嚎id',
+ `product_model_id` bigint NOT NULL DEFAULT 0 COMMENT '浜у搧id',
+ `technology_operation_id` bigint NOT NULL DEFAULT 0 COMMENT '宸ュ簭id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `drag_sort` int NULL DEFAULT NULL COMMENT '鎷栧姩鎺掑簭',
+ `is_quality` tinyint(1) NULL DEFAULT 1 COMMENT '鏄惁璐ㄦ宸ュ簭',
+ `is_production` tinyint(1) NULL DEFAULT 1 COMMENT '鏄惁鐢熶骇',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `type` int NULL DEFAULT NULL COMMENT '绫诲瀷 鍖哄垎璁℃椂鍜岃浠�(0璁℃椂1璁′欢)',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '宸ヨ壓璺嚎宸ュ簭琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for technology_routing_operation_param
+-- ----------------------------
+DROP TABLE IF EXISTS `technology_routing_operation_param`;
+CREATE TABLE `technology_routing_operation_param` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `param_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍙傛暟缂栫爜(鍞竴鏍囪瘑)',
+ `param_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍙傛暟鍚嶇О',
+ `param_type` tinyint NOT NULL COMMENT '鍙傛暟绫诲瀷(1鏁板瓧 2鏂囨湰 3涓嬫媺閫夋嫨 4鏃堕棿)',
+ `param_format` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍙傛暟鏍煎紡',
+ `unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍗曚綅',
+ `is_required` tinyint NULL DEFAULT 0 COMMENT '鏄惁蹇呭~',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `create_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '淇敼浜�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ `param_id` bigint NULL DEFAULT NULL COMMENT '鍩虹鍙傛暟ID',
+ `technology_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭id',
+ `technology_operation_param_id` bigint NULL DEFAULT NULL COMMENT '宸ュ簭鍙傛暟ID',
+ `technology_routing_operation_id` bigint NULL DEFAULT NULL COMMENT '宸ヨ壓璺嚎宸ュ簭ID',
+ `standard_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鏍囧噯鍊�',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 79 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '宸ヨ壓璺嚎宸ュ簭鍙傛暟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for temp_file
+-- ----------------------------
+DROP TABLE IF EXISTS `temp_file`;
+CREATE TABLE `temp_file` (
+ `temp_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '涓存椂鏂囦欢ID',
+ `original_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍘熷鏂囦欢鍚�',
+ `temp_path` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '涓存椂瀛樺偍璺緞',
+ `expire_time` datetime NOT NULL COMMENT '杩囨湡鏃堕棿',
+ `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `status` tinyint NULL DEFAULT 0 COMMENT '鐘舵�侊細0=涓存椂锛�1=宸茬‘璁わ紝2=宸茶繃鏈�',
+ `type` int NULL DEFAULT NULL,
+ `file_size` bigint NULL DEFAULT NULL COMMENT '鏂囦欢澶у皬',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`temp_id`) USING BTREE,
+ INDEX `idx_expire_time`(`expire_time` ASC) USING BTREE COMMENT '鐢ㄤ簬杩囨湡鏂囦欢娓呯悊鐨勭储寮�',
+ INDEX `idx_status`(`status` ASC) USING BTREE COMMENT '鐢ㄤ簬鐘舵�佹煡璇㈢殑绱㈠紩'
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '涓存椂鏂囦欢璁板綍琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for ticket_registration
+-- ----------------------------
+DROP TABLE IF EXISTS `ticket_registration`;
+CREATE TABLE `ticket_registration` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `purchase_contract_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '閲囪喘鍚堝悓鍙�',
+ `sales_contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閿�鍞悎鍚屽彿',
+ `customer_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹㈡埛鍚嶇О',
+ `business_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓氬姟鍛�',
+ `project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '椤圭洰鍚嶇О',
+ `product_id` int NULL DEFAULT NULL COMMENT '浜у搧淇℃伅',
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
+ `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
+ `purchase_ledger_id` int NULL DEFAULT NULL COMMENT '閲囪喘鍙拌处id',
+ `supplier_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '渚涘簲鍟嗗悕绉�',
+ `sales_ledger_id` int NULL DEFAULT NULL COMMENT '鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�',
+ `business_person_id` int NULL DEFAULT NULL COMMENT '涓氬姟鍛榠d',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `contract_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '鍚堝悓閲戦',
+ `invoice_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '鍙戠エ鍙�',
+ `invoice_amount` decimal(10, 2) NOT NULL COMMENT '鍙戠エ閲戦锛堝厓锛�',
+ `iss_uer_id` int NULL DEFAULT NULL COMMENT '寮�绁ㄤ汉id',
+ `iss_uer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '寮�绁ㄤ汉',
+ `issue_date` date NULL DEFAULT NULL COMMENT '寮�绁ㄦ棩鏈�',
+ `enter_date` timestamp NULL DEFAULT NULL,
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 158 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鏉ョエ鐧昏琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for timing_task
+-- ----------------------------
+DROP TABLE IF EXISTS `timing_task`;
+CREATE TABLE `timing_task` (
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '璁惧鍚嶇О',
+ `inspection_project` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸℃椤圭洰',
+ `task_id` int NULL DEFAULT NULL COMMENT '璁惧id',
+ `inspector_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '宸℃浜�',
+ `inspection_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸℃鍦扮偣',
+ `frequency_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '棰戞',
+ `frequency_detail` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `next_execution_time` datetime(6) NULL DEFAULT NULL,
+ `last_execution_time` datetime(6) NULL DEFAULT NULL,
+ `is_active` tinyint(1) NULL DEFAULT NULL,
+ `is_enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT '鏄惁鍚敤 0鍚� 1鏄�',
+ `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `registrant_id` bigint NULL DEFAULT NULL COMMENT '鐧昏浜篿d',
+ `registrant` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐧昏浜�',
+ `registration_date` date NOT NULL COMMENT '鐧昏鏃ユ湡',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `deleted` int NOT NULL DEFAULT 0 COMMENT '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛',
+ `create_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�',
+ `update_time` datetime(6) NULL DEFAULT NULL COMMENT '璁板綍鏈�鍚庢洿鏂版椂闂�',
+ `tenant_id` int NULL DEFAULT NULL,
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `idx_timing_task_is_enabled`(`is_enabled` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '瀹氭椂宸℃浠诲姟琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for warehouse
+-- ----------------------------
+DROP TABLE IF EXISTS `warehouse`;
+CREATE TABLE `warehouse` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `warehouse_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '浠撳簱鍚嶇О',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浠撳簱琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for warehouse_goods_shelves
+-- ----------------------------
+DROP TABLE IF EXISTS `warehouse_goods_shelves`;
+CREATE TABLE `warehouse_goods_shelves` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璐ф灦鍚嶇О',
+ `row` bigint NULL DEFAULT NULL COMMENT '灞傛暟',
+ `col` bigint NULL DEFAULT NULL COMMENT '鍒楁暟',
+ `warehouse_id` bigint NULL DEFAULT NULL COMMENT '浠撳簱id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浠撳簱璐ф灦琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for warehouse_goods_shelves_rowcol
+-- ----------------------------
+DROP TABLE IF EXISTS `warehouse_goods_shelves_rowcol`;
+CREATE TABLE `warehouse_goods_shelves_rowcol` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `row` bigint NULL DEFAULT NULL COMMENT '灞傛暟',
+ `col` bigint NULL DEFAULT NULL COMMENT '鍒楁暟',
+ `warehouse_goods_shelves_id` bigint NULL DEFAULT NULL COMMENT '璐ф灦id',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鐢ㄦ埛',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鐢ㄦ埛',
+ `tenant_id` bigint NULL DEFAULT NULL COMMENT '绉熸埛ID',
+ `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '澶囨敞',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 101 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '浠撳簱璐ф灦灞傦紝鍒楄〃' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for water_record
+-- ----------------------------
+DROP TABLE IF EXISTS `water_record`;
+CREATE TABLE `water_record` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `device_model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '璁惧瑙勬牸鍨嬪彿',
+ `type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐢ㄦ按绫诲瀷',
+ `rated_rate` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '棰濆畾娴侀噺',
+ `actual_traffic` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '瀹為檯娴侀噺',
+ `run_time` date NULL DEFAULT NULL COMMENT '杩愯鏃堕棿',
+ `water_day` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '褰撴棩鐢ㄦ按閲�',
+ `water_day_limit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '姣忔棩闄愬埗姘撮噺',
+ `water_price` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '姘磋垂鍗曚环',
+ `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '澶囨敞',
+ `create_user` bigint NULL DEFAULT NULL COMMENT '鍒涘缓鑰�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '鐢ㄦ按璁板綍' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for work_report
+-- ----------------------------
+DROP TABLE IF EXISTS `work_report`;
+CREATE TABLE `work_report` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `plan_id` int NULL DEFAULT NULL COMMENT '鎵�灞炶鍒扞D锛屽叧鑱攄uty_plan琛�',
+ `report_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '姹囨姤鏍囬',
+ `progress` int NULL DEFAULT NULL COMMENT '宸ヤ綔杩涘害鐧惧垎姣�',
+ `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宸ヤ綔鍐呭',
+ `issues` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '閬囧埌鐨勯棶棰�',
+ `next_plan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涓嬩竴姝ヨ鍒�',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '宸ヤ綔姹囨姤琛�' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Table structure for working_hours_setting
+-- ----------------------------
+DROP TABLE IF EXISTS `working_hours_setting`;
+CREATE TABLE `working_hours_setting` (
+ `id` int NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鏃堕棿娈靛悕绉�',
+ `start_time` time NULL DEFAULT NULL COMMENT '涓婄彮鏃堕棿',
+ `end_time` time NULL DEFAULT NULL COMMENT '涓嬬彮鏃堕棿',
+ `flexible_start` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '寮规�т笂鐝�',
+ `flexible_minutes` int NULL DEFAULT NULL COMMENT '寮规�ф椂闂�(鍒嗛挓)',
+ `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '鐘舵��',
+ `create_user` int NULL DEFAULT NULL COMMENT '鍒涘缓浜�',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` int NULL DEFAULT NULL COMMENT '淇敼鑰�',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '淇敼鏃堕棿',
+ `tenant_id` int NULL DEFAULT NULL COMMENT '绉熸埛id',
+ `dept_id` bigint NULL DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '涓婄彮鏃堕棿璁剧疆' ROW_FORMAT = DYNAMIC;
+
+-- ----------------------------
+-- Procedure structure for add_create_user_to_all_tables
+-- ----------------------------
+DROP PROCEDURE IF EXISTS `add_create_user_to_all_tables`;
+delimiter ;;
+CREATE PROCEDURE `add_create_user_to_all_tables`()
+BEGIN
+ DECLARE v_table_name VARCHAR(255);
+ DECLARE col_exists INT;
+ DECLARE done INT DEFAULT 0;
+
+ -- 娓告爣锛氳幏鍙栨墍鏈夐渶瑕佸鐞嗙殑琛紙鏄庣‘鎸囧畾琛ㄥ埆鍚嶏級
+ DECLARE table_cursor CURSOR FOR
+ SELECT t.TABLE_NAME
+ FROM information_schema.TABLES t
+ WHERE t.TABLE_SCHEMA = DATABASE()
+ AND t.TABLE_TYPE = 'BASE TABLE'
+ AND t.TABLE_NAME NOT LIKE 'sys_%'
+ AND t.TABLE_NAME NOT LIKE 'qrtz_%';
+
+ -- 娓告爣缁撴潫澶勭悊
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
+
+ OPEN table_cursor;
+
+ table_loop: LOOP
+ FETCH table_cursor INTO v_table_name;
+ IF done = 1 THEN
+ LEAVE table_loop;
+ END IF;
+
+ -- 妫�鏌ュ瓧娈垫槸鍚﹀瓨鍦紙鏄庣‘鍒悕锛屽交搴曡В鍐� 1052 閿欒锛�
+ SELECT COUNT(*) INTO col_exists
+ FROM information_schema.COLUMNS c
+ WHERE c.TABLE_SCHEMA = DATABASE()
+ AND c.TABLE_NAME = v_table_name
+ AND c.COLUMN_NAME = 'create_user';
+
+ -- 涓嶅瓨鍦ㄥ垯娣诲姞
+ IF col_exists = 0 THEN
+ SET @sql = CONCAT('ALTER TABLE `', v_table_name, '` ADD COLUMN create_user BIGINT NULL COMMENT \'鍒涘缓浜篒D\'');
+ PREPARE stmt FROM @sql;
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+ END IF;
+
+ END LOOP table_loop;
+
+ CLOSE table_cursor;
+ SELECT '鎵ц瀹屾垚锛佹墍鏈夎〃宸叉坊鍔� create_user 瀛楁' AS result;
+END
+;;
+delimiter ;
+
+-- ----------------------------
+-- Procedure structure for add_dept_id_to_all_tables
+-- ----------------------------
+DROP PROCEDURE IF EXISTS `add_dept_id_to_all_tables`;
+delimiter ;;
+CREATE PROCEDURE `add_dept_id_to_all_tables`()
+BEGIN
+ DECLARE v_table_name VARCHAR(255);
+ DECLARE col_exists INT;
+ DECLARE done INT DEFAULT 0;
+
+ -- 娓告爣锛氳幏鍙栨墍鏈夐渶瑕佸鐞嗙殑琛紙鏄庣‘鎸囧畾琛ㄥ埆鍚嶏級
+ DECLARE table_cursor CURSOR FOR
+ SELECT t.TABLE_NAME
+ FROM information_schema.TABLES t
+ WHERE t.TABLE_SCHEMA = DATABASE()
+ AND t.TABLE_TYPE = 'BASE TABLE'
+ AND t.TABLE_NAME NOT LIKE 'sys_%'
+ AND t.TABLE_NAME NOT LIKE 'qrtz_%';
+
+ -- 娓告爣缁撴潫澶勭悊
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
+
+ OPEN table_cursor;
+
+ table_loop: LOOP
+ FETCH table_cursor INTO v_table_name;
+ IF done = 1 THEN
+ LEAVE table_loop;
+ END IF;
+
+ -- 妫�鏌ュ瓧娈垫槸鍚﹀瓨鍦紙鏄庣‘鍒悕锛屽交搴曡В鍐� 1052 閿欒锛�
+ SELECT COUNT(*) INTO col_exists
+ FROM information_schema.COLUMNS c
+ WHERE c.TABLE_SCHEMA = DATABASE()
+ AND c.TABLE_NAME = v_table_name
+ AND c.COLUMN_NAME = 'dept_id';
+
+ -- 涓嶅瓨鍦ㄥ垯娣诲姞
+ IF col_exists = 0 THEN
+ SET @sql = CONCAT('ALTER TABLE `', v_table_name, '` ADD COLUMN dept_id BIGINT NULL COMMENT \'閮ㄩ棬ID\'');
+ PREPARE stmt FROM @sql;
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+ END IF;
+
+ END LOOP table_loop;
+
+ CLOSE table_cursor;
+ SELECT '鎵ц瀹屾垚锛佹墍鏈夎〃宸叉坊鍔� dept_id 瀛楁' AS result;
+END
+;;
+delimiter ;
+
+-- ----------------------------
+-- Procedure structure for truncate_non_sys_tables
+-- ----------------------------
+DROP PROCEDURE IF EXISTS `truncate_non_sys_tables`;
+delimiter ;;
+CREATE PROCEDURE `truncate_non_sys_tables`()
+BEGIN
+ DECLARE done INT DEFAULT FALSE;
+ DECLARE tbl_name VARCHAR(255);
+
+ DECLARE cur CURSOR FOR
+ SELECT TABLE_NAME
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA = DATABASE()
+ AND (
+ TABLE_NAME NOT LIKE 'sys\\_%'
+ OR TABLE_NAME IN (
+ 'sys_oper_log',
+ 'sys_logininfor',
+ 'sys_notice',
+ 'sys_job',
+ 'sys_job_log'
+ )
+ )
+ -- 涓嶆竻鐞唒roduct琛�
+ AND TABLE_NAME <> 'product'
+ AND TABLE_TYPE = 'BASE TABLE';
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+ -- 涓存椂绂佺敤澶栭敭绾︽潫
+ SET FOREIGN_KEY_CHECKS = 0;
+ SET AUTOCOMMIT = 0;
+
+ OPEN cur;
+
+ read_loop: LOOP
+ FETCH cur INTO tbl_name;
+
+ IF done THEN
+ LEAVE read_loop;
+ END IF;
+
+ SET @sql = CONCAT('DELETE FROM `', tbl_name, '`');
+
+ PREPARE stmt FROM @sql;
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+
+ SELECT CONCAT('宸叉竻鐞嗚〃: ', tbl_name) AS message;
+ END LOOP;
+
+ CLOSE cur;
+
+ -- 鎭㈠閰嶇疆
+ SET FOREIGN_KEY_CHECKS = 1;
+ SET AUTOCOMMIT = 1;
+
+ SELECT '鎵�鏈夌洰鏍囪〃宸叉竻绌哄畬鎴愶紙宸叉帓闄roduct琛級锛�' AS final_message;
+END
+;;
+delimiter ;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/src/main/java/com/ruoyi/CodeGenerator.java b/src/main/java/com/ruoyi/CodeGenerator.java
index 721245b..e9f7110 100644
--- a/src/main/java/com/ruoyi/CodeGenerator.java
+++ b/src/main/java/com/ruoyi/CodeGenerator.java
@@ -20,11 +20,11 @@
// 婕旂ず渚嬪瓙锛屾墽琛� main 鏂规硶鎺у埗鍙拌緭鍏ユā鍧楄〃鍚嶅洖杞﹁嚜鍔ㄧ敓鎴愬搴旈」鐩洰褰曚腑
public class CodeGenerator {
- public static String database_url = "jdbc:mysql://localhost:3300/product-inventory-management-new-pro";
+ public static String database_url = "jdbc:mysql://localhost:3306/product-inventory-management-new-pro";
public static String database_username = "root";
- public static String database_password= "root";
+ public static String database_password= "123456";
public static String author = "鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃";
- public static String model = "sales"; // 妯″潡
+ public static String model = "account"; // 妯″潡
public static String setParent = "com.ruoyi."+ model; // 鍖呰矾寰�
public static String tablePrefix = ""; // 璁剧疆杩囨护琛ㄥ墠缂�
public static void main(String[] args) {
diff --git a/src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java b/src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java
new file mode 100644
index 0000000..8d4bf31
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java
@@ -0,0 +1,29 @@
+package com.ruoyi.account.bean.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+
+@Data
+@Schema(name = "AccountReportDto", description = "璐㈠姟鎶ヨ〃--鏃ユ湡鍙傛暟")
+public class AccountReportDto {
+
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate entryDateStart;
+
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate entryDateEnd;
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDetail.java b/src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDetail.java
new file mode 100644
index 0000000..1ea4837
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDetail.java
@@ -0,0 +1,17 @@
+package com.ruoyi.account.bean.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author :yys
+ * @date : 2026/1/17 13:42
+ */
+@Data
+public class DeviceTypeDetail {
+
+ private String type; // 璁惧绫诲瀷
+ private BigDecimal count; // 鏁伴噺
+ private BigDecimal amount; // 浠锋牸
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDistributionVO.java b/src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDistributionVO.java
new file mode 100644
index 0000000..f540b42
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/DeviceTypeDistributionVO.java
@@ -0,0 +1,27 @@
+package com.ruoyi.account.bean.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author :yys
+ * @date : 2026/1/17 13:19
+ */
+@Data
+public class DeviceTypeDistributionVO {
+
+ private Integer totalCount = 0; // 璁惧绫诲瀷鎬绘暟
+
+ // 楗煎浘鍜屾姌绾垮浘鐨勫垎绫伙紙璁惧绫诲瀷锛�
+ private List<String> categories = new ArrayList<>();
+ // 鍚勭被鍨嬭澶囩殑鏁伴噺
+ private List<BigDecimal> countData = new ArrayList<>();
+ // 鍚勭被鍨嬭澶囩殑鎬婚噾棰�
+ private List<BigDecimal> amountData = new ArrayList<>();
+ // 鏄庣粏鍒楄〃锛屽寘鍚被鍨嬨�佹暟閲忋�侀噾棰�
+ private List<DeviceTypeDetail> details = new ArrayList<>();
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/SalesReceiptReturnDto.java b/src/main/java/com/ruoyi/account/bean/dto/SalesReceiptReturnDto.java
new file mode 100644
index 0000000..e0d9e81
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/SalesReceiptReturnDto.java
@@ -0,0 +1,8 @@
+package com.ruoyi.account.bean.dto;
+
+import com.ruoyi.account.pojo.SalesReceiptReturn;
+import lombok.Data;
+
+@Data
+public class SalesReceiptReturnDto extends SalesReceiptReturn {
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/SalesRefundAmountOrderDto.java b/src/main/java/com/ruoyi/account/bean/dto/SalesRefundAmountOrderDto.java
new file mode 100644
index 0000000..7ea68b9
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/SalesRefundAmountOrderDto.java
@@ -0,0 +1,24 @@
+package com.ruoyi.account.bean.dto;
+
+import com.ruoyi.account.pojo.SalesRefundAmountOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class SalesRefundAmountOrderDto extends SalesRefundAmountOrder {
+
+ @Schema(description = "閫�璐у崟鍙�")
+ private String returnManagementNo;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "閿�鍞崟鍙�")
+ private String salesContractNo;
+
+ @Schema(description = "鍒涘缓浜哄悕绉�")
+ private String createUserName;
+
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/StatementAccountDto.java b/src/main/java/com/ruoyi/account/bean/dto/StatementAccountDto.java
new file mode 100644
index 0000000..52b6513
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/StatementAccountDto.java
@@ -0,0 +1,35 @@
+package com.ruoyi.account.bean.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "StatementAccountDto", description = "璐㈠姟绠$悊--鐢熸垚瀵硅处鍗�(浼犲弬)")
+public class StatementAccountDto {
+
+ //涓氬姟绫诲瀷(1搴旀敹瀵硅处;2搴斾粯瀵硅处)
+ @Schema(name = "accountType", description = "涓氬姟绫诲瀷(1搴旀敹瀵硅处;2搴斾粯瀵硅处)")
+ private Integer accountType;
+
+ //閫夋嫨鐨勫鎴�(搴旀敹鏄鎴�,搴斾粯鏄緵搴斿晢supplierId)
+ @Schema(name = "customerId", description = "瀹㈡埛ID")
+ private Long customerId;
+
+ //瀵硅处鏈堜唤yyyy-MM
+ @Schema(name = "statementMonth", description = "瀵硅处鏈堜唤")
+ private String statementMonth;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectDto.java
new file mode 100644
index 0000000..4d55666
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectDto.java
@@ -0,0 +1,10 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import com.ruoyi.account.pojo.financial.AccountSubject;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class AccountSubjectDto extends AccountSubject {
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectImportDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectImportDto.java
new file mode 100644
index 0000000..7ea5225
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/AccountSubjectImportDto.java
@@ -0,0 +1,36 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class AccountSubjectImportDto {
+
+ @Schema(description = "绉戠洰缂栫爜")
+ @Excel(name = "绉戠洰缂栫爜")
+ private String subjectCode;
+
+ @Schema(description = "绉戠洰鍚嶇О")
+ @Excel(name = "绉戠洰鍚嶇О")
+ private String subjectName;
+
+ @Schema(description = "绉戠洰绫诲瀷")
+ @Excel(name = "绉戠洰绫诲瀷")
+ private String subjectType;
+
+ @Schema(description = "浣欓鏂瑰悜")
+ @Excel(name = "浣欓鏂瑰悜")
+ private String balanceDirection;
+
+ /**
+ * 鐘舵�� 0鍚敤 1绂佺敤
+ */
+ @Schema(description = "鐘舵��")
+ @Excel(name = "鐘舵��",readConverterExp = "0=鍚敤,1=绂佺敤")
+ private Integer status;
+
+ @Schema(description = "澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinDetailLedgerQueryDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinDetailLedgerQueryDto.java
new file mode 100644
index 0000000..84a3676
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinDetailLedgerQueryDto.java
@@ -0,0 +1,22 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 绉戠洰鏄庣粏璐︽煡璇㈠弬鏁帮紙鍚緟鍔╂牳绠楁潯浠讹級銆�
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FinDetailLedgerQueryDto extends FinLedgerQueryDto {
+
+ /**
+ * 杈呭姪鏍哥畻绫诲瀷锛歝ustomer/supplier/department/employee/project銆�
+ */
+ private String auxiliaryType;
+
+ /**
+ * 杈呭姪鏍哥畻瀵硅薄ID銆�
+ */
+ private String auxiliaryId;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinFixedAssetDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinFixedAssetDto.java
new file mode 100644
index 0000000..c6baeca
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinFixedAssetDto.java
@@ -0,0 +1,13 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import com.ruoyi.account.pojo.financial.FinFixedAsset;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 鍥哄畾璧勪骇鏌ヨ涓庝繚瀛� DTO銆�
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FinFixedAssetDto extends FinFixedAsset {
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinIdBatchDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinIdBatchDto.java
new file mode 100644
index 0000000..e3023ed
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinIdBatchDto.java
@@ -0,0 +1,17 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 鎵归噺ID璇锋眰鍙傛暟銆�
+ */
+@Data
+public class FinIdBatchDto {
+
+ /**
+ * ID闆嗗悎銆�
+ */
+ private List<Long> ids;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinIntangibleAssetDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinIntangibleAssetDto.java
new file mode 100644
index 0000000..60dd50e
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinIntangibleAssetDto.java
@@ -0,0 +1,13 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import com.ruoyi.account.pojo.financial.FinIntangibleAsset;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 鏃犲舰璧勪骇鏌ヨ涓庝繚瀛� DTO銆�
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FinIntangibleAssetDto extends FinIntangibleAsset {
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinLedgerQueryDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinLedgerQueryDto.java
new file mode 100644
index 0000000..cfc0553
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinLedgerQueryDto.java
@@ -0,0 +1,25 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import lombok.Data;
+
+/**
+ * 绉戠洰璐︽煡璇㈠弬鏁般��
+ */
+@Data
+public class FinLedgerQueryDto {
+
+ /**
+ * 绉戠洰缂栫爜锛堟敮鎸佹湯绾ф垨鎸囧畾绉戠洰锛夈��
+ */
+ private String subjectCode;
+
+ /**
+ * 寮�濮嬫湀浠斤紝鏍煎紡锛歒YYY-MM銆�
+ */
+ private String startMonth;
+
+ /**
+ * 缁撴潫鏈堜唤锛屾牸寮忥細YYYY-MM銆�
+ */
+ private String endMonth;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java
new file mode 100644
index 0000000..3f90ea2
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java
@@ -0,0 +1,23 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import com.ruoyi.account.pojo.financial.FinVoucher;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 鍑瘉淇濆瓨 DTO锛堜富琛� + 鍒嗗綍锛夈��
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FinVoucherDto extends FinVoucher {
+
+ /**
+ * 鍑瘉鏄庣粏鍒嗗綍銆�
+ */
+ private List<FinVoucherEntryDto> entries;
+
+ private List<StorageBlobDTO> storageBlobDTOs;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherEntryDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherEntryDto.java
new file mode 100644
index 0000000..f722d79
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherEntryDto.java
@@ -0,0 +1,13 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import com.ruoyi.account.pojo.financial.FinVoucherEntry;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 鍑瘉鍒嗗綍 DTO銆�
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FinVoucherEntryDto extends FinVoucherEntry {
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherPageDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherPageDto.java
new file mode 100644
index 0000000..9955bcc
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherPageDto.java
@@ -0,0 +1,37 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import lombok.Data;
+
+import java.time.LocalDate;
+
+/**
+ * 鍑瘉鍒嗛〉鏌ヨ鍙傛暟銆�
+ */
+@Data
+public class FinVoucherPageDto {
+
+ /**
+ * 鍑瘉瀛楀彿锛堟ā绯婂尮閰嶏級銆�
+ */
+ private String voucherNo;
+
+ /**
+ * 鍒跺崟浜恒��
+ */
+ private String creator;
+
+ /**
+ * 鍑瘉鐘舵�併��
+ */
+ private String status;
+
+ /**
+ * 寮�濮嬫棩鏈燂紙鍚級銆�
+ */
+ private LocalDate startDate;
+
+ /**
+ * 缁撴潫鏃ユ湡锛堝惈锛夈��
+ */
+ private LocalDate endDate;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherStatusDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherStatusDto.java
new file mode 100644
index 0000000..47c0900
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherStatusDto.java
@@ -0,0 +1,15 @@
+package com.ruoyi.account.bean.dto.financial;
+
+import lombok.Data;
+
+/**
+ * 鍑瘉鐘舵�佸彉鏇村弬鏁般��
+ */
+@Data
+public class FinVoucherStatusDto {
+
+ /**
+ * 鍑瘉ID銆�
+ */
+ private Long id;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPaymentApplicationDto.java b/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPaymentApplicationDto.java
new file mode 100644
index 0000000..dfe0562
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPaymentApplicationDto.java
@@ -0,0 +1,34 @@
+package com.ruoyi.account.bean.dto.purchase;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "AccountPaymentApplicationDto", description = "璐㈠姟绠$悊--浠樻鐢宠鍙拌处(浼犲弬)")
+public class AccountPaymentApplicationDto {
+
+ @Schema(description = "渚涘簲鍟咺D")
+ private Integer supplierId;
+
+ @Schema(description = "鐢宠鍗曞彿")
+ private String invoiceApplicationNo;
+
+ @Schema(description = "瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃")
+ private Integer status;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchaseInvoiceDto.java b/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchaseInvoiceDto.java
new file mode 100644
index 0000000..3a799eb
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchaseInvoiceDto.java
@@ -0,0 +1,32 @@
+package com.ruoyi.account.bean.dto.purchase;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "AccountPurchaseInvoiceDto", description = "璐㈠姟绠$悊--杩涢」鍙戠エ鍙拌处(浼犲弬)")
+public class AccountPurchaseInvoiceDto {
+
+ @Schema(description = "渚涘簲鍟咺D")
+ private Integer supplierId;
+
+ @Schema(description = "鍙戠エ鍙风爜")
+ private String invoiceNumber;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+
+ @Schema(description = "鐘舵��")
+ private Integer status;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchasePaymentDto.java b/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchasePaymentDto.java
new file mode 100644
index 0000000..f01d241
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/purchase/AccountPurchasePaymentDto.java
@@ -0,0 +1,34 @@
+package com.ruoyi.account.bean.dto.purchase;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "AccountPurchasePaymentDto", description = "璐㈠姟绠$悊--浠樻鍗曞彴璐�(浼犲弬)")
+public class AccountPurchasePaymentDto {
+
+ @Schema(description = "渚涘簲鍟咺D")
+ private Integer supplierId;
+
+ @Schema(description = "浠樻鍗曞彿")
+ private String paymentNumber;
+
+ @Schema(description = "浠樻鏂瑰紡")
+ private String paymentMethod;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseInboundDto.java b/src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseInboundDto.java
new file mode 100644
index 0000000..cec0719
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseInboundDto.java
@@ -0,0 +1,31 @@
+package com.ruoyi.account.bean.dto.purchase;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "PurchaseInboundDto", description = "璐㈠姟绠$悊--閲囪喘鍏ュ簱鍙拌处(浼犲弬)")
+public class PurchaseInboundDto {
+
+ @Schema(description = "鍏ュ簱鍗曞彿")
+ private String inboundBatches;
+
+ private Long supplierId;
+
+ @Schema(description = "渚涘簲鍟�")
+ private String supplierName;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseReturnDto.java b/src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseReturnDto.java
new file mode 100644
index 0000000..eb6adec
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/purchase/PurchaseReturnDto.java
@@ -0,0 +1,31 @@
+package com.ruoyi.account.bean.dto.purchase;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "PurchaseReturnDto", description = "璐㈠姟绠$悊--閲囪喘閫�璐у彴璐�(浼犲弬)")
+public class PurchaseReturnDto {
+
+ @Schema(description = "閫�璐у崟鍙�")
+ private String returnNo;
+
+ private Long supplierId;
+
+ @Schema(description = "渚涘簲鍟�")
+ private String supplierName;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/sales/AccountInvoiceApplicationDto.java b/src/main/java/com/ruoyi/account/bean/dto/sales/AccountInvoiceApplicationDto.java
new file mode 100644
index 0000000..d7917f3
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/sales/AccountInvoiceApplicationDto.java
@@ -0,0 +1,34 @@
+package com.ruoyi.account.bean.dto.sales;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "AccountInvoiceApplicationDto", description = "璐㈠姟绠$悊--寮�绁ㄧ敵璇峰彴璐�(浼犲弬)")
+public class AccountInvoiceApplicationDto {
+
+ @Schema(description = "瀹㈡埛ID")
+ private Integer customerId;
+
+ @Schema(description = "鐢宠鍗曞彿")
+ private String invoiceApplicationNo;
+
+ @Schema(description = "瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃")
+ private Integer status;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesCollectionDto.java b/src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesCollectionDto.java
new file mode 100644
index 0000000..ec3c042
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesCollectionDto.java
@@ -0,0 +1,34 @@
+package com.ruoyi.account.bean.dto.sales;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "AccountSalesCollectionDto", description = "璐㈠姟绠$悊--鏀舵鍗曞彴璐�(浼犲弬)")
+public class AccountSalesCollectionDto {
+
+ @Schema(description = "瀹㈡埛ID")
+ private Integer customerId;
+
+ @Schema(description = "鏀舵鍗曞彿")
+ private String collectionNumber;
+
+ @Schema(description = "鏀舵鏂瑰紡")
+ private String collectionMethod;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesInvoiceDto.java b/src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesInvoiceDto.java
new file mode 100644
index 0000000..4774edb
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/sales/AccountSalesInvoiceDto.java
@@ -0,0 +1,33 @@
+package com.ruoyi.account.bean.dto.sales;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "AccountSalesInvoiceDto", description = "璐㈠姟绠$悊--閿�椤瑰彂绁ㄥ彴璐�(浼犲弬)")
+public class AccountSalesInvoiceDto {
+
+ @Schema(description = "瀹㈡埛ID")
+ private Integer customerId;
+
+ @Schema(description = "鍙戠エ鍙风爜")
+ private String invoiceNumber;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+
+ @Schema(description = "鐘舵��")
+ private Integer status;
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/sales/SalesOutboundDto.java b/src/main/java/com/ruoyi/account/bean/dto/sales/SalesOutboundDto.java
new file mode 100644
index 0000000..b8c9cc6
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/sales/SalesOutboundDto.java
@@ -0,0 +1,31 @@
+package com.ruoyi.account.bean.dto.sales;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "SalesOutboundDto", description = "璐㈠姟绠$悊--閿�鍞嚭搴撳彴璐�(浼犲弬)")
+public class SalesOutboundDto {
+
+ @Schema(description = "鍑哄簱鍗曞彿")
+ private String outboundBatches;
+
+ private Long customerId;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/sales/SalesReturnDto.java b/src/main/java/com/ruoyi/account/bean/dto/sales/SalesReturnDto.java
new file mode 100644
index 0000000..5a239ae
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/dto/sales/SalesReturnDto.java
@@ -0,0 +1,31 @@
+package com.ruoyi.account.bean.dto.sales;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "SalesReturnDto", description = "璐㈠姟绠$悊--閿�鍞��璐у彴璐�(浼犲弬)")
+public class SalesReturnDto {
+
+ @Schema(description = "閫�璐у崟鍙�")
+ private String returnNo;
+
+ private Long customerId;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+
+ @Schema(description = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java b/src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java
new file mode 100644
index 0000000..f7b39d8
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java
@@ -0,0 +1,66 @@
+package com.ruoyi.account.bean.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+
+@Data
+@Schema(name = "AccountReportVo", description = "璐㈠姟鎶ヨ〃--杩斿洖鍙傛暟")
+public class AccountReportVo {
+
+ @Schema(description = "鎬昏惀鏀�")
+ private BigDecimal totalIncome;
+
+ @Schema(description = "鎬绘敮鍑�")
+ private BigDecimal totalExpense;
+
+ @Schema(description = "搴旀敹璐︽")
+ private BigDecimal accountsReceivable;
+
+ @Schema(description = "搴斾粯璐︽")
+ private BigDecimal accountsPayable;
+
+ @Schema(description = "鍑�鏀跺叆")
+ private BigDecimal netRevenue;
+
+ // --- 鎶樼嚎鍥撅細鏈堝害瓒嬪娍鏁版嵁 ---
+ @Schema(description = "鏈堝害瓒嬪娍鏁版嵁鍒楄〃")
+ private List<MonthlyTrendVO> monthlyTrendList;
+
+ // --- 鏌辩姸鍥撅細搴旀敹搴斾粯鏈堝害鏁版嵁 ---
+ @Schema(description = "搴旀敹搴斾粯鏈堝害鏁版嵁鍒楄〃")
+ private List<ReceivablePayableVO> receivablePayableList;
+
+ @Data
+ @Schema(description = "鏈堝害瓒嬪娍VO锛堟姌绾垮浘鐢級")
+ public static class MonthlyTrendVO {
+ @Schema(description = "鏈堜唤锛屾牸寮忥細yyyy-MM")
+ private String month;
+
+ @Schema(description = "褰撴湀钀ユ敹")
+ private BigDecimal income;
+
+ @Schema(description = "褰撴湀鏀嚭")
+ private BigDecimal expense;
+
+ @Schema(description = "褰撴湀鍑�鍒╂鼎")
+ private BigDecimal profit;
+ }
+
+ @Data
+ @Schema(description = "搴旀敹搴斾粯鏈堝害VO锛堟煴鐘跺浘鐢級")
+ public static class ReceivablePayableVO {
+ @Schema(description = "鏈堜唤锛屾牸寮忥細yyyy-MM")
+ private String month;
+
+ @Schema(description = "搴旀敹璐︽閲戦")
+ private BigDecimal receivable;
+
+ @Schema(description = "搴斾粯璐︽閲戦")
+ private BigDecimal payable;
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/StatementAccountVo.java b/src/main/java/com/ruoyi/account/bean/vo/StatementAccountVo.java
new file mode 100644
index 0000000..4dd073c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/StatementAccountVo.java
@@ -0,0 +1,25 @@
+package com.ruoyi.account.bean.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.account.pojo.AccountStatement;
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(name = "StatementAccountVo", description = "璐㈠姟绠$悊--瀵硅处鍗曡鎯�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class StatementAccountVo extends AccountStatement {
+
+ //瀹㈡埛鍚嶇О(搴旀敹鏄鎴�,搴斾粯鏄緵搴斿晢)
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ //瀵硅处鏄庣粏
+ @Schema(description = "瀵硅处鏄庣粏")
+ private List<AccountStatementDetails> accountStatementDetails;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/financial/AccountSubjectVo.java b/src/main/java/com/ruoyi/account/bean/vo/financial/AccountSubjectVo.java
new file mode 100644
index 0000000..106eb17
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/financial/AccountSubjectVo.java
@@ -0,0 +1,21 @@
+package com.ruoyi.account.bean.vo.financial;
+
+import com.ruoyi.account.pojo.financial.AccountSubject;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class AccountSubjectVo extends AccountSubject {
+
+ /**
+ * 瀛愮鐩垪琛紙閫掑綊缁撴瀯锛夈��
+ */
+ private List<AccountSubjectVo> children = new ArrayList<>();
+
+ /**
+ * 鏄惁鍙跺瓙鑺傜偣銆�
+ */
+ private Boolean leaf;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerEntryRecordVo.java b/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerEntryRecordVo.java
new file mode 100644
index 0000000..846b350
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerEntryRecordVo.java
@@ -0,0 +1,43 @@
+package com.ruoyi.account.bean.vo.financial;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 绉戠洰璐﹀熀纭�鍒嗗綍鏌ヨ瀵硅薄锛圫QL鏄犲皠浣跨敤锛夈��
+ */
+@Data
+public class FinLedgerEntryRecordVo {
+
+ /**
+ * 鍑瘉鏃ユ湡銆�
+ */
+ private LocalDate voucherDate;
+
+ /**
+ * 鍑瘉瀛楀彿銆�
+ */
+ private String voucherNo;
+
+ /**
+ * 鎽樿銆�
+ */
+ private String summary;
+
+ /**
+ * 鍊熸柟閲戦銆�
+ */
+ private BigDecimal debit;
+
+ /**
+ * 璐锋柟閲戦銆�
+ */
+ private BigDecimal credit;
+
+ /**
+ * 琛屽彿锛堟帓搴忓瓧娈碉級銆�
+ */
+ private Integer rowNo;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java b/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java
new file mode 100644
index 0000000..da4131f
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java
@@ -0,0 +1,55 @@
+package com.ruoyi.account.bean.vo.financial;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 绉戠洰璐﹁鏁版嵁杩斿洖瀵硅薄銆�
+ */
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class FinLedgerRowVo {
+
+ /**
+ * 琛岀被鍨嬶細opening/entry/monthly_total/yearly_total銆�
+ */
+ private String rowType;
+
+ /**
+ * 鏃ユ湡銆�
+ */
+ private LocalDate date;
+
+ /**
+ * 鍑瘉瀛楀彿銆�
+ */
+ private String voucherNo;
+
+ /**
+ * 鎽樿銆�
+ */
+ private String summary;
+
+ /**
+ * 鍊熸柟閲戦銆�
+ */
+ private BigDecimal debit;
+
+ /**
+ * 璐锋柟閲戦銆�
+ */
+ private BigDecimal credit;
+
+ /**
+ * 浣欓鏂瑰悜锛氬��/璐枫��
+ */
+ private String direction;
+
+ /**
+ * 浣欓锛堝�熸璐疯礋锛夈��
+ */
+ private BigDecimal balance;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java b/src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java
new file mode 100644
index 0000000..4b23545
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java
@@ -0,0 +1,24 @@
+package com.ruoyi.account.bean.vo.financial;
+
+import com.ruoyi.account.pojo.financial.FinVoucher;
+import com.ruoyi.account.pojo.financial.FinVoucherEntry;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 鍑瘉璇︽儏杩斿洖瀵硅薄銆�
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FinVoucherDetailVo extends FinVoucher {
+
+ /**
+ * 鍑瘉鍒嗗綍鍒楄〃銆�
+ */
+ private List<FinVoucherEntry> entries;
+ private List<StorageBlobVO> storageBlobVOList;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPaymentApplicationVo.java b/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPaymentApplicationVo.java
new file mode 100644
index 0000000..26cae0e
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPaymentApplicationVo.java
@@ -0,0 +1,23 @@
+package com.ruoyi.account.bean.vo.purchase;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.account.pojo.purchase.AccountPaymentApplication;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+@Schema(name = "AccountPaymentApplicationVo", description = "璐㈠姟绠$悊--浠樻鐢宠鍙拌处(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class AccountPaymentApplicationVo extends AccountPaymentApplication {
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "鍏ュ簱鍗曞彿")
+ @Excel(name = "鍏ュ簱鍗曞彿")
+ private String inboundBatches;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchaseInvoiceVo.java b/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchaseInvoiceVo.java
new file mode 100644
index 0000000..9d753b2
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchaseInvoiceVo.java
@@ -0,0 +1,19 @@
+package com.ruoyi.account.bean.vo.purchase;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+@Schema(name = "AccountPurchaseInvoiceVo", description = "璐㈠姟绠$悊--杩涢」鍙戠エ鍙拌处(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class AccountPurchaseInvoiceVo extends AccountPurchaseInvoice {
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchasePaymentVo.java b/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchasePaymentVo.java
new file mode 100644
index 0000000..367e17a
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/purchase/AccountPurchasePaymentVo.java
@@ -0,0 +1,34 @@
+package com.ruoyi.account.bean.vo.purchase;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+@Schema(name = "AccountPurchasePaymentVo", description = "璐㈠姟绠$悊--浠樻鍗曞彴璐�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class AccountPurchasePaymentVo extends AccountPurchasePayment {
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "浠樻鐢宠鍗曞彿")
+ @Excel(name = "浠樻鐢宠鍗曞彿")
+ private String invoiceApplicationNo;
+
+ @Schema(description = "寮�鎴疯")
+ @Excel(name = "寮�鎴疯")
+ private String bankAccountName;
+
+ @Schema(description = "閾惰璐﹀彿")
+ @Excel(name = "閾惰璐﹀彿")
+ private String bankAccountNum;
+
+ @Schema(description = "鏄惁鐢熸垚浜嗗璐﹀崟")
+ private boolean isAccountStatemen;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseInboundVo.java b/src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseInboundVo.java
new file mode 100644
index 0000000..48831e1
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseInboundVo.java
@@ -0,0 +1,48 @@
+package com.ruoyi.account.bean.vo.purchase;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "PurchaseInboundVo", description = "璐㈠姟绠$悊--閲囪喘鍏ュ簱鍙拌处(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class PurchaseInboundVo {
+
+ @Schema(description = "鍏ュ簱鍗昳d")
+ private Long id;
+
+ @Schema(description = "鍏ュ簱鍗曞彿")
+ @Excel(name = "鍏ュ簱鍗曞彿")
+ private String inboundBatches;
+
+ @Schema(description = "渚涘簲鍟�")
+ @Excel(name = "渚涘簲鍟�")
+ private String supplierName;
+
+ @Schema(description = "鍏ュ簱鏃ユ湡")
+ @Excel(name = "鍏ュ簱鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate InboundDate;
+
+ @Schema(description = "浜у搧鍚嶇О")
+ @Excel(name = "浜у搧鍚嶇О")
+ private String productName;
+
+ @Schema(description = "浜у搧瑙勬牸")
+ @Excel(name = "浜у搧瑙勬牸")
+ private String specificationModel;
+
+ @Schema(description = "閲戦")
+ @Excel(name = "閲戦")
+ private BigDecimal InboundAmount;
+
+ @Schema(description = "閲囪喘璁㈠崟鍙�")
+ @Excel(name = "閲囪喘璁㈠崟鍙�")
+ private String purchaseContractNumber;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseReturnVo.java b/src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseReturnVo.java
new file mode 100644
index 0000000..4c21ac5
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/purchase/PurchaseReturnVo.java
@@ -0,0 +1,64 @@
+package com.ruoyi.account.bean.vo.purchase;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@Schema(name = "PurchaseReturnVo", description = "璐㈠姟绠$悊--閲囪喘閫�璐у彴璐�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class PurchaseReturnVo {
+
+ @Schema(description = "閫�璐у崟id")
+ private Long id;
+
+ @Excel(name = "閫�璐у崟鍙�")
+ @Schema(description = "閫�璐у崟鍙�")
+ private String returnNo;
+
+ @Schema(description = "渚涘簲鍟�")
+ @Excel(name = "渚涘簲鍟�")
+ private String supplierName;
+
+ @Schema(description = "鍏宠仈鍏ュ簱鍗曞彿")
+ @Excel(name = "鍏宠仈鍏ュ簱鍗曞彿")
+ private String inboundBatches;
+
+ @Schema(description = "鍙戣揣绫诲瀷")
+ @Excel(name = "鍙戣揣绫诲瀷")
+ private Integer shippingType;
+
+ @Schema(description = "鍙戣揣杞︾墝鍙�")
+ @Excel(name = "鍙戣揣杞︾墝鍙�")
+ private String truckPlateNo;
+
+ @Schema(description = "蹇�掑叕鍙�")
+ @Excel(name = "蹇�掑叕鍙�")
+ private String expressCompany;
+
+ @Schema(description = "蹇�掑崟鍙�")
+ @Excel(name = "蹇�掑崟鍙�")
+ private String expressNo;
+
+ @Schema(description = "閫�璐ф棩鏈�")
+ @Excel(name = "閫�璐ф棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime preparedAt;
+
+ @Schema(description = "閫�娆炬�婚")
+ @Excel(name = "閫�娆炬�婚")
+ private BigDecimal totalAmount;
+
+ @Schema(description = "閫�璐ф柟寮�")
+ @Excel(name = "閫�璐ф柟寮�")
+ private String returnType;
+
+ @Schema(description = "閲囪喘璁㈠崟鍙�")
+ @Excel(name = "閲囪喘璁㈠崟鍙�")
+ private String purchaseContractNumber;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/sales/AccountInvoiceApplicationVo.java b/src/main/java/com/ruoyi/account/bean/vo/sales/AccountInvoiceApplicationVo.java
new file mode 100644
index 0000000..55bf22b
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/sales/AccountInvoiceApplicationVo.java
@@ -0,0 +1,23 @@
+package com.ruoyi.account.bean.vo.sales;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.account.pojo.sales.AccountInvoiceApplication;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+@Schema(name = "AccountInvoiceApplicationVo", description = "璐㈠姟绠$悊--寮�绁ㄧ敵璇峰彴璐�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class AccountInvoiceApplicationVo extends AccountInvoiceApplication {
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "鍑哄簱鍗曞彿")
+ @Excel(name = "鍑哄簱鍗曞彿")
+ private String outboundBatches;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesCollectionVo.java b/src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesCollectionVo.java
new file mode 100644
index 0000000..bde5fe0
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesCollectionVo.java
@@ -0,0 +1,26 @@
+package com.ruoyi.account.bean.vo.sales;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+@Schema(name = "AccountSalesCollectionVo", description = "璐㈠姟绠$悊--鏀舵鍗曞彴璐�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class AccountSalesCollectionVo extends AccountSalesCollection {
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "鍑哄簱鍗曞彿")
+ @Excel(name = "鍑哄簱鍗曞彿")
+ private String outboundBatches;
+
+ @Schema(description = "鏄惁鐢熸垚浜嗗璐﹀崟")
+ private boolean isAccountStatemen;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesInvoiceVo.java b/src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesInvoiceVo.java
new file mode 100644
index 0000000..1dfd4e3
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/sales/AccountSalesInvoiceVo.java
@@ -0,0 +1,19 @@
+package com.ruoyi.account.bean.vo.sales;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.account.pojo.sales.AccountSalesInvoice;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+@Schema(name = "AccountSalesInvoiceVo", description = "璐㈠姟绠$悊--閿�椤瑰彂绁ㄥ彴璐�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class AccountSalesInvoiceVo extends AccountSalesInvoice {
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/sales/SalesOutboundVo.java b/src/main/java/com/ruoyi/account/bean/vo/sales/SalesOutboundVo.java
new file mode 100644
index 0000000..66d364f
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/sales/SalesOutboundVo.java
@@ -0,0 +1,60 @@
+package com.ruoyi.account.bean.vo.sales;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "SalesOutboundVo", description = "璐㈠姟绠$悊--閿�鍞嚭搴撳彴璐�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class SalesOutboundVo {
+
+ @Schema(description = "鍑哄簱鍗昳d")
+ private Long id;
+
+ @Schema(description = "鍑哄簱鍗曞彿")
+ @Excel(name = "鍑哄簱鍗曞彿")
+ private String outboundBatches;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "鍑哄簱鏃ユ湡")
+ @Excel(name = "鍑哄簱鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate shippingDate;
+
+ @Schema(description = "浜у搧鍚嶇О")
+ @Excel(name = "浜у搧鍚嶇О")
+ private String productName;
+
+ @Schema(description = "浜у搧瑙勬牸")
+ @Excel(name = "浜у搧瑙勬牸")
+ private String specificationModel;
+
+ @Schema(description = "閲戦")
+ @Excel(name = "閲戦")
+ private BigDecimal outboundAmount;
+
+ @Schema(description = "绋庣巼")
+ private BigDecimal taxRate;
+
+ @Schema(description = "鍙戣揣缂栧彿")
+ @Excel(name = "鍙戣揣缂栧彿")
+ private String shippingNo;
+
+ @Schema(description = "閿�鍞鍗曞彿")
+ @Excel(name = "閿�鍞鍗曞彿")
+ private String salesContractNo;
+
+ @Schema(description = "宸叉敹娆鹃噾棰�")
+ @ExcelIgnore
+ private BigDecimal amountReceived;
+}
diff --git a/src/main/java/com/ruoyi/account/bean/vo/sales/SalesReturnVo.java b/src/main/java/com/ruoyi/account/bean/vo/sales/SalesReturnVo.java
new file mode 100644
index 0000000..36f65c4
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/sales/SalesReturnVo.java
@@ -0,0 +1,64 @@
+package com.ruoyi.account.bean.vo.sales;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@Schema(name = "SalesReturnVo", description = "璐㈠姟绠$悊--閿�鍞��璐у彴璐�(杩斿洖)")
+@ExcelIgnoreUnannotated
+public class SalesReturnVo {
+
+ @Schema(description = "閫�璐у崟id")
+ private Long id;
+
+ @Excel(name = "閫�璐у崟鍙�")
+ @Schema(description = "閫�璐у崟鍙�")
+ private String returnNo;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "鍏宠仈鍙戣揣鍗曞彿")
+ @Excel(name = "鍏宠仈鍙戣揣鍗曞彿")
+ private String shippingNo;
+
+ @Schema(description = "鍙戣揣绫诲瀷")
+ @Excel(name = "鍙戣揣绫诲瀷")
+ private Integer shippingType;
+
+ @Schema(description = "鍙戣揣杞︾墝鍙�")
+ @Excel(name = "鍙戣揣杞︾墝鍙�")
+ private String truckPlateNo;
+
+ @Schema(description = "蹇�掑叕鍙�")
+ @Excel(name = "蹇�掑叕鍙�")
+ private String expressCompany;
+
+ @Schema(description = "蹇�掑崟鍙�")
+ @Excel(name = "蹇�掑崟鍙�")
+ private String expressNo;
+
+ @Schema(description = "閫�璐ф棩鏈�")
+ @Excel(name = "閫�璐ф棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime makeTime;
+
+ @Schema(description = "閫�娆炬�婚")
+ @Excel(name = "閫�娆炬�婚")
+ private BigDecimal refundAmount;
+
+ @Schema(description = "閫�璐у師鍥�")
+ @Excel(name = "閫�璐у師鍥�")
+ private String returnReason;
+
+ @Schema(description = "閿�鍞鍗曞彿")
+ @Excel(name = "閿�鍞鍗曞彿")
+ private String salesContractNo;
+}
diff --git a/src/main/java/com/ruoyi/account/controller/AccountExpenseController.java b/src/main/java/com/ruoyi/account/controller/AccountExpenseController.java
deleted file mode 100644
index 4796d33..0000000
--- a/src/main/java/com/ruoyi/account/controller/AccountExpenseController.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package com.ruoyi.account.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.ReportDateDto;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.service.AccountExpenseService;
-import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import jakarta.annotation.Resource;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.Date;
-import java.util.List;
-
-/**
- * 璐㈠姟绠$悊--鏀嚭绠$悊
- */
-@RestController
-@RequestMapping("/account/accountExpense")
-@Tag(name = "璐㈠姟绠$悊--鏀嚭绠$悊")
-public class AccountExpenseController {
-
- @Resource
- private AccountExpenseService accountExpenseService;
-
- @Resource
- private AccountIncomeService accountIncomeService;
-
-
- /**
- * 鏂板
- * @param accountExpense
- * @return
- */
- @PostMapping("/add")
- @Operation(summary = "鏂板")
- public AjaxResult add(@RequestBody AccountExpense accountExpense) {
- accountExpense.setInputTime(new Date());
- LoginUser loginUser = SecurityUtils.getLoginUser();
- accountExpense.setInputUser(loginUser.getNickName());
- return AjaxResult.success(accountExpenseService.save(accountExpense));
- }
-
- /**
- * 鍒犻櫎
- * @param ids
- * @return
- */
- @DeleteMapping("/del")
- @Operation(summary = "鍒犻櫎")
- public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) {
- if(CollectionUtils.isEmpty(ids)){
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
- }
- //鍒犻櫎妫�楠屽崟
- return AjaxResult.success(accountExpenseService.removeBatchByIds(ids));
- }
-
- /**
- * 淇敼
- * @param accountExpense
- * @return
- */
- @PostMapping("/update")
- @Operation(summary = "淇敼")
- public AjaxResult update(@RequestBody AccountExpense accountExpense) {
- return AjaxResult.success(accountExpenseService.updateById(accountExpense));
- }
-
- /**
- *鍒嗛〉鏌ヨ
- * @param page
- * @param accountExpense
- * @return
- */
- @GetMapping("/listPage")
- @Operation(summary = "鍒嗛〉鏌ヨ")
- public AjaxResult accountExpenseListPage(Page page, AccountExpense accountExpense) {
- return AjaxResult.success(accountExpenseService.accountExpenseListPage(page, accountExpense));
- }
-
- /**
- * 璇︽儏
- * @param id
- * @return
- */
- @GetMapping("/{id}")
- @Operation(summary = "璇︽儏")
- public AjaxResult accountExpenseDetail(@PathVariable("id") Integer id) {
- return AjaxResult.success(accountExpenseService.getById(id));
- }
-
- /**
- * 瀵煎嚭
- * @param response
- * @param accountExpense
- */
- @PostMapping("/export")
- @Operation(summary = "瀵煎嚭")
- public void accountExpenseExport(HttpServletResponse response,AccountExpense accountExpense) {
- accountExpenseService.accountExpenseExport(response, accountExpense);
- }
-
- /**
- * 璐㈠姟鎶ヨ〃鍥捐〃鏌ヨ
- * @param dateQueryDto
- * @return
- */
- @GetMapping("/report/forms")
- @Operation(summary = "璐㈠姟鎶ヨ〃鍥捐〃鏌ヨ")
- public AjaxResult report(DateQueryDto dateQueryDto) {
- return AjaxResult.success(accountExpenseService.report(dateQueryDto));
- }
-
- /**
- * 璐㈠姟鎶ヨ〃-璐㈠姟鍒嗘瀽
- * @return
- */
- @GetMapping("/report/analysis")
- @Operation(summary = "璐㈠姟鎶ヨ〃-璐㈠姟鍒嗘瀽")
- public AjaxResult analysis() {
- return AjaxResult.success(accountExpenseService.analysis());
- }
-
- /**
- * 璐㈠姟鎶ヨ〃鍥捐〃鏀跺叆骞村害鏌ヨ
- * @param
- * @return
- */
- @GetMapping("/report/income")
- @Operation(summary = "璐㈠姟鎶ヨ〃鍥捐〃鏀跺叆骞村害鏌ヨ")
- public AjaxResult reportIncome(ReportDateDto reportDateDto) {
- return AjaxResult.success(accountIncomeService.reportIncome(reportDateDto));
- }
-
- /**
- * 璐㈠姟鎶ヨ〃鍥捐〃鏀嚭骞村害鏌ヨ
- * @param
- * @return
- */
- @GetMapping("/report/expense")
- @Operation(summary = "璐㈠姟鎶ヨ〃鍥捐〃鏀嚭骞村害鏌ヨ")
- public AjaxResult reportExpense(ReportDateDto reportDateDto) {
- return AjaxResult.success(accountExpenseService.reportExpense(reportDateDto));
- }
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/controller/AccountFileController.java b/src/main/java/com/ruoyi/account/controller/AccountFileController.java
deleted file mode 100644
index 42c20d1..0000000
--- a/src/main/java/com/ruoyi/account/controller/AccountFileController.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.ruoyi.account.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.pojo.AccountFile;
-import com.ruoyi.account.service.AccountFileService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.quality.pojo.QualityInspectFile;
-import com.ruoyi.quality.service.IQualityInspectFileService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.annotation.Resource;
-import java.util.List;
-
-/**
- * 璐㈠姟闄勪欢
- */
-@RestController
-@RequestMapping("/account/accountFile")
-@Tag(name = "璐㈠姟闄勪欢")
-public class AccountFileController {
-
-
- @Resource
- private AccountFileService accountFileService;
-
-
- /**
- * 鏂板
- * @param accountFile
- * @return
- */
- @PostMapping("/add")
- @Operation(summary = "鏂板")
- public AjaxResult add(@RequestBody AccountFile accountFile) {
- return AjaxResult.success(accountFileService.save(accountFile));
- }
-
- /**
- * 鍒犻櫎
- * @param ids
- * @return
- */
- @DeleteMapping("/del")
- @Operation(summary = "鍒犻櫎")
- public AjaxResult delAccountFile(@RequestBody List<Integer> ids) {
- if(CollectionUtils.isEmpty(ids)){
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
- }
- //鍒犻櫎妫�楠岄檮浠�
- return AjaxResult.success(accountFileService.removeBatchByIds(ids));
- }
-
- /**
- *鍒嗛〉鏌ヨ
- * @param page
- * @param accountFile
- * @return
- */
- @GetMapping("/listPage")
- @Operation(summary = "鍒嗛〉鏌ヨ")
- public AjaxResult accountFileListPage(Page page, AccountFile accountFile) {
- return AjaxResult.success(accountFileService.accountFileListPage(page, accountFile));
- }
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/controller/AccountIncomeController.java b/src/main/java/com/ruoyi/account/controller/AccountIncomeController.java
deleted file mode 100644
index 690e75a..0000000
--- a/src/main/java/com/ruoyi/account/controller/AccountIncomeController.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.ruoyi.account.controller;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.account.service.AccountFileService;
-import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.quality.pojo.QualityInspect;
-import com.ruoyi.quality.pojo.QualityInspectFile;
-import com.ruoyi.quality.pojo.QualityInspectParam;
-import com.ruoyi.quality.service.IQualityInspectFileService;
-import com.ruoyi.quality.service.IQualityInspectParamService;
-import com.ruoyi.quality.service.IQualityInspectService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.annotation.Resource;
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.Date;
-import java.util.List;
-
-/**
- * 璐㈠姟绠$悊--鏀跺叆绠$悊
- */
-@RestController
-@RequestMapping("/account/accountIncome")
-@Tag(name = "璐㈠姟绠$悊--鏀跺叆绠$悊")
-public class AccountIncomeController {
-
- @Resource
- private AccountIncomeService accountIncomeService;
-
-
- /**
- * 鏂板
- * @param accountIncome
- * @return
- */
- @PostMapping("/add")
- @Operation(summary = "鏂板")
- public AjaxResult add(@RequestBody AccountIncome accountIncome) {
- accountIncome.setInputTime(new Date());
- LoginUser loginUser = SecurityUtils.getLoginUser();
- accountIncome.setInputUser(loginUser.getNickName());
- return AjaxResult.success(accountIncomeService.save(accountIncome));
- }
-
- /**
- * 鍒犻櫎
- * @param ids
- * @return
- */
- @DeleteMapping("/del")
- @Operation(summary = "鍒犻櫎")
- public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) {
- if(CollectionUtils.isEmpty(ids)){
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
- }
- //鍒犻櫎妫�楠屽崟
- return AjaxResult.success(accountIncomeService.removeBatchByIds(ids));
- }
-
- /**
- * 淇敼
- * @param accountIncome
- * @return
- */
- @PostMapping("/update")
- @Operation(summary = "淇敼")
- public AjaxResult update(@RequestBody AccountIncome accountIncome) {
- return AjaxResult.success(accountIncomeService.updateById(accountIncome));
- }
-
- /**
- *鍒嗛〉鏌ヨ
- * @param page
- * @param accountIncome
- * @return
- */
- @GetMapping("/listPage")
- @Operation(summary = "鍒嗛〉鏌ヨ")
- public AjaxResult accountIncomeListPage(Page page, AccountIncome accountIncome) {
- return AjaxResult.success(accountIncomeService.accountIncomeListPage(page, accountIncome));
- }
-
- /**
- * 璇︽儏
- * @param id
- * @return
- */
- @GetMapping("/{id}")
- @Operation(summary = "璇︽儏")
- public AjaxResult accountIncomeDetail(@PathVariable("id") Integer id) {
- return AjaxResult.success(accountIncomeService.getById(id));
- }
-
- /**
- * 瀵煎嚭
- * @param response
- * @param accountIncome
- */
- @PostMapping("/export")
- @Operation(summary = "瀵煎嚭")
- public void accountIncomeExport(HttpServletResponse response,AccountIncome accountIncome) {
- accountIncomeService.accountIncomeExport(response, accountIncome);
- }
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/controller/AccountStatementController.java b/src/main/java/com/ruoyi/account/controller/AccountStatementController.java
new file mode 100644
index 0000000..b53f457
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/AccountStatementController.java
@@ -0,0 +1,71 @@
+package com.ruoyi.account.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.StatementAccountDto;
+import com.ruoyi.account.bean.vo.StatementAccountVo;
+import com.ruoyi.account.service.AccountStatementService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 09:42:47
+ */
+@RestController
+@RequestMapping("/accountStatement")
+@RequiredArgsConstructor
+@Tag(name = "璐㈠姟绠$悊-瀵硅处鍗�")
+public class AccountStatementController {
+
+ private final AccountStatementService accountStatementService;
+
+ @GetMapping("/getAccountStatementDetailsByMonth")
+ @Log(title = "鏍规嵁瀹㈡埛鍜屾湀浠芥煡璇㈠璐﹀崟鏄庣粏", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--鏍规嵁瀹㈡埛鍜屾湀浠芥煡璇㈠璐﹀崟鏄庣粏")
+ public R getAccountStatementDetailsByMonth(StatementAccountDto statementAccountDto) {
+ return R.ok(accountStatementService.getAccountStatementDetailsByMonth(statementAccountDto));
+ }
+
+ @PostMapping("/addAccountStatement")
+ @Log(title = "鏂板瀵硅处鍗�", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--鏂板瀵硅处鍗�")
+ public R addAccountStatement(@RequestBody StatementAccountVo statementAccountVo) {
+ return R.ok(accountStatementService.addAccountStatement(statementAccountVo));
+ }
+
+ @DeleteMapping("/deleteAccountStatement")
+ @Log(title = "鍒犻櫎瀵硅处鍗�", businessType = BusinessType.DELETE)
+ @Operation(summary = "璐㈠姟绠$悊--鍒犻櫎瀵硅处鍗�")
+ public R deleteAccountStatement(@RequestParam("ids") Long[] ids) {
+ return R.ok(accountStatementService.deleteAccountStatement(Arrays.asList(ids)));
+ }
+
+ @GetMapping("/listPageAccountStatement")
+ @Log(title = "瀵硅处鍗曞彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--瀵硅处鍗曞彴璐�")
+ public R<IPage<StatementAccountVo>> listPageAccountStatement(Page page, StatementAccountDto statementAccountDto) {
+ IPage<StatementAccountVo> listPage = accountStatementService.listPageAccountStatement(page,statementAccountDto);
+ return R.ok(listPage);
+ }
+
+ @PostMapping("/exportAccountStatement")
+ @Operation(summary = "瀵煎嚭瀵硅处鍗曟枃浠�")
+ @Log(title = "瀵煎嚭瀵硅处鍗曟枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountStatement(HttpServletResponse response, StatementAccountDto statementAccountDto) {
+ accountStatementService.exportAccountStatement(response,statementAccountDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/AccountingController.java b/src/main/java/com/ruoyi/account/controller/AccountingController.java
index 4688942..9eeb208 100644
--- a/src/main/java/com/ruoyi/account/controller/AccountingController.java
+++ b/src/main/java/com/ruoyi/account/controller/AccountingController.java
@@ -1,12 +1,16 @@
package com.ruoyi.account.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.service.impl.AccountingServiceImpl;
+import com.ruoyi.account.bean.dto.AccountReportDto;
+import com.ruoyi.account.service.AccountingService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
-import io.swagger.v3.oas.annotations.tags.Tag;
+import com.ruoyi.framework.web.domain.R;
import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -19,11 +23,11 @@
@Tag(name = "浼氳鏍哥畻")
@RestController
@RequestMapping("/accounting")
-@AllArgsConstructor
+@RequiredArgsConstructor
public class AccountingController extends BaseController {
- private AccountingServiceImpl accountingService;
+ private final AccountingService accountingService;
@Operation(summary = "鎬昏")
@GetMapping("/total")
@@ -43,4 +47,14 @@
return accountingService.calculateDepreciation(page,year);
}
+ /*****************************************璐㈠姟鎶ヨ〃******************************************************************************/
+
+ @GetMapping("/accountStatementDetailsByMonth")
+ @Log(title = "璐㈠姟鎶ヨ〃", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟鎶ヨ〃")
+ public R getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) {
+ return R.ok(accountingService.getAccountStatementDetailsByMonth(accountReportDto));
+ }
+
+
}
diff --git a/src/main/java/com/ruoyi/account/controller/BorrowInfoController.java b/src/main/java/com/ruoyi/account/controller/BorrowInfoController.java
deleted file mode 100644
index 7620c19..0000000
--- a/src/main/java/com/ruoyi/account/controller/BorrowInfoController.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.ruoyi.account.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.pojo.BorrowInfo;
-import com.ruoyi.account.service.BorrowInfoService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * <p>
- * 鍊熸淇℃伅琛� 鍓嶇鎺у埗鍣�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-01-15 02:57:29
- */
-@Tag(name = "鍊熸淇℃伅琛�")
-@RestController
-@RequestMapping("/borrowInfo")
-@AllArgsConstructor
-public class BorrowInfoController {
-
- private BorrowInfoService borrowInfoService;
-
- @GetMapping("/listPage")
- @Operation(summary = "鍒嗛〉鏌ヨ")
- public AjaxResult listPage(Page page, BorrowInfo borrowInfo) {
- return borrowInfoService.listPage(page,borrowInfo);
- }
-
- /**
- * 鏂板
- */
- @PostMapping("/add")
- @Transactional(rollbackFor = Exception.class)
- @Log(title = "鏂板鍊熸淇℃伅", businessType = BusinessType.INSERT)
- public AjaxResult add(@RequestBody BorrowInfo borrowInfo) {
- return borrowInfoService.add(borrowInfo);
- }
-
- /**
- * 淇敼
- */
- @PostMapping("/update")
- @Transactional(rollbackFor = Exception.class)
- @Log(title = "淇敼鍊熸淇℃伅", businessType = BusinessType.UPDATE)
- public AjaxResult updateBorrowInfo(@RequestBody BorrowInfo borrowInfo) {
- return borrowInfoService.updateBorrowInfo(borrowInfo);
- }
-
-
- /**
- * 鍒犻櫎
- */
- @DeleteMapping("/delete")
- @Transactional(rollbackFor = Exception.class)
- @Log(title = "鍒犻櫎鍊熸淇℃伅", businessType = BusinessType.DELETE)
- public AjaxResult delete(@RequestBody List<Long> ids) {
- return borrowInfoService.delete(ids);
- }
-
- /**
- * 瀵煎嚭
- */
- @PostMapping("/export")
- @Operation(summary = "瀵煎嚭鍊熸淇℃伅")
- public void export(HttpServletResponse response, BorrowInfo borrowInfo) {
- List<BorrowInfo> list = borrowInfoService.list();
- ExcelUtil<BorrowInfo> util = new ExcelUtil<>(BorrowInfo.class);
- util.exportExcel(response,list, "鍊熸淇℃伅鏁版嵁");
- }
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/controller/SalesReceiptReturnController.java b/src/main/java/com/ruoyi/account/controller/SalesReceiptReturnController.java
index 786e7c3..5968d10 100644
--- a/src/main/java/com/ruoyi/account/controller/SalesReceiptReturnController.java
+++ b/src/main/java/com/ruoyi/account/controller/SalesReceiptReturnController.java
@@ -1,7 +1,7 @@
package com.ruoyi.account.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.account.dto.SalesReceiptReturnDto;
+import com.ruoyi.account.bean.dto.SalesReceiptReturnDto;
import com.ruoyi.account.pojo.SalesReceiptReturn;
import com.ruoyi.account.service.SalesReceiptReturnService;
import com.ruoyi.account.service.impl.SalesReceiptReturnServiceImpl;
diff --git a/src/main/java/com/ruoyi/account/controller/SalesRefundAmountOrderController.java b/src/main/java/com/ruoyi/account/controller/SalesRefundAmountOrderController.java
index 7f8bf25..f547377 100644
--- a/src/main/java/com/ruoyi/account/controller/SalesRefundAmountOrderController.java
+++ b/src/main/java/com/ruoyi/account/controller/SalesRefundAmountOrderController.java
@@ -1,7 +1,7 @@
package com.ruoyi.account.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.SalesRefundAmountOrderDto;
+import com.ruoyi.account.bean.dto.SalesRefundAmountOrderDto;
import com.ruoyi.account.pojo.SalesRefundAmountOrder;
import com.ruoyi.account.service.SalesRefundAmountOrderService;
import com.ruoyi.framework.web.domain.R;
diff --git a/src/main/java/com/ruoyi/account/controller/financial/AccountSubjectController.java b/src/main/java/com/ruoyi/account/controller/financial/AccountSubjectController.java
new file mode 100644
index 0000000..19d333d
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/financial/AccountSubjectController.java
@@ -0,0 +1,70 @@
+package com.ruoyi.account.controller.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.financial.AccountSubjectDto;
+import com.ruoyi.account.bean.vo.financial.AccountSubjectVo;
+import com.ruoyi.account.service.purchase.AccountSubjectService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 鎬昏处绉戠洰琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@RestController
+@RequestMapping("/accountSubject")
+@RequiredArgsConstructor
+@Tag(name = "鎬昏处绉戠洰")
+public class AccountSubjectController {
+ private final AccountSubjectService accountSubjectService;
+
+ @GetMapping("/list")
+ @Log(title = "鎬昏处绉戠洰鏁版嵁闆嗗悎", businessType = BusinessType.OTHER)
+ @Operation(summary = "鎬昏处绉戠洰鏍戝舰鏌ヨ锛堥�掑綊锛�")
+ public R<IPage<AccountSubjectVo>> AccountSubjectDtoList(Page<AccountSubjectDto> page, AccountSubjectDto accountSubjectDto) {
+ IPage<AccountSubjectVo> paramList = accountSubjectService.baseList(page, accountSubjectDto);
+ return R.ok(paramList);
+ }
+
+ @PostMapping("/add")
+ @Log(title = "鏂板鎬昏处绉戠洰", businessType = BusinessType.INSERT)
+ @Operation(summary = "鏂板鎬昏处绉戠洰")
+ public R AccountSubjectDtoAdd(@RequestBody AccountSubjectDto accountSubjectDto) {
+ return R.ok(accountSubjectService.saveAccountSubject(accountSubjectDto));
+ }
+
+ @PutMapping("/edit")
+ @Log(title = "淇敼鎬昏处绉戠洰", businessType = BusinessType.UPDATE)
+ @Operation(summary = "淇敼鎬昏处绉戠洰")
+ public R AccountSubjectDtoEdit(@RequestBody AccountSubjectDto accountSubjectDto) {
+ return R.ok(accountSubjectService.updateAccountSubject(accountSubjectDto));
+ }
+
+ @DeleteMapping("/remove/{ids}")
+ @Log(title = "鍒犻櫎鎬昏处绉戠洰", businessType = BusinessType.DELETE)
+ @Operation(summary = "鍒犻櫎鎬昏处绉戠洰")
+ public R AccountSubjectDtooRemove(@PathVariable Long[] ids) {
+ return R.ok(accountSubjectService.removeAccountSubjectByIds(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/export")
+ @Operation(summary = "瀵煎嚭鎬昏处绉戠洰鏂囦欢")
+ @Log(title = "瀵煎嚭鎬昏处绉戠洰鏂囦欢", businessType = BusinessType.EXPORT)
+ public void exportAccountSubject(HttpServletResponse response) {
+ accountSubjectService.exportAccountSubject(response);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/financial/FinFixedAssetController.java b/src/main/java/com/ruoyi/account/controller/financial/FinFixedAssetController.java
new file mode 100644
index 0000000..a18c9da
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/financial/FinFixedAssetController.java
@@ -0,0 +1,63 @@
+package com.ruoyi.account.controller.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.financial.FinFixedAssetDto;
+import com.ruoyi.account.bean.dto.financial.FinIdBatchDto;
+import com.ruoyi.account.pojo.financial.FinFixedAsset;
+import com.ruoyi.account.service.financial.FinFixedAssetService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * 鍥哄畾璧勪骇鎺у埗鍣ㄣ��
+ */
+@RestController
+@RequestMapping("/financial/fixedAsset")
+@RequiredArgsConstructor
+@Tag(name = "璐㈠姟绠$悊-鍥哄畾璧勪骇")
+public class FinFixedAssetController {
+
+ private final FinFixedAssetService finFixedAssetService;
+
+ @GetMapping("/page")
+ @Operation(summary = "鍥哄畾璧勪骇鍒嗛〉鏌ヨ")
+ public R<IPage<FinFixedAsset>> page(Page<FinFixedAsset> page, FinFixedAssetDto queryDto) {
+ return R.ok(finFixedAssetService.pageList(page, queryDto));
+ }
+
+ @PostMapping("/add")
+ @Log(title = "鍥哄畾璧勪骇", businessType = BusinessType.INSERT)
+ @Operation(summary = "鏂板鍥哄畾璧勪骇")
+ public R<Boolean> add(@RequestBody FinFixedAssetDto dto) {
+ return R.ok(finFixedAssetService.add(dto));
+ }
+
+ @PutMapping("/update")
+ @Log(title = "鍥哄畾璧勪骇", businessType = BusinessType.UPDATE)
+ @Operation(summary = "淇敼鍥哄畾璧勪骇")
+ public R<Boolean> update(@RequestBody FinFixedAssetDto dto) {
+ return R.ok(finFixedAssetService.update(dto));
+ }
+
+ @DeleteMapping("/delete")
+ @Log(title = "鍥哄畾璧勪骇", businessType = BusinessType.DELETE)
+ @Operation(summary = "鍒犻櫎鍥哄畾璧勪骇")
+ public R<Boolean> delete(@RequestParam("ids") Long[] ids) {
+ return R.ok(finFixedAssetService.deleteByIds(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/depreciate")
+ @Log(title = "鍥哄畾璧勪骇鎶樻棫璁℃彁", businessType = BusinessType.UPDATE)
+ @Operation(summary = "鍥哄畾璧勪骇鎸夋湀璁℃彁鎶樻棫")
+ public R depreciate(@RequestBody(required = false) FinIdBatchDto dto) {
+ return R.ok(finFixedAssetService.depreciate(dto == null ? null : dto.getIds()));
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/controller/financial/FinIntangibleAssetController.java b/src/main/java/com/ruoyi/account/controller/financial/FinIntangibleAssetController.java
new file mode 100644
index 0000000..cb12f8c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/financial/FinIntangibleAssetController.java
@@ -0,0 +1,63 @@
+package com.ruoyi.account.controller.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.financial.FinIdBatchDto;
+import com.ruoyi.account.bean.dto.financial.FinIntangibleAssetDto;
+import com.ruoyi.account.pojo.financial.FinIntangibleAsset;
+import com.ruoyi.account.service.financial.FinIntangibleAssetService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * 鏃犲舰璧勪骇鎺у埗鍣ㄣ��
+ */
+@RestController
+@RequestMapping("/financial/intangibleAsset")
+@RequiredArgsConstructor
+@Tag(name = "璐㈠姟绠$悊-鏃犲舰璧勪骇")
+public class FinIntangibleAssetController {
+
+ private final FinIntangibleAssetService finIntangibleAssetService;
+
+ @GetMapping("/page")
+ @Operation(summary = "鏃犲舰璧勪骇鍒嗛〉鏌ヨ")
+ public R<IPage<FinIntangibleAsset>> page(Page<FinIntangibleAsset> page, FinIntangibleAssetDto queryDto) {
+ return R.ok(finIntangibleAssetService.pageList(page, queryDto));
+ }
+
+ @PostMapping("/add")
+ @Log(title = "鏃犲舰璧勪骇", businessType = BusinessType.INSERT)
+ @Operation(summary = "鏂板鏃犲舰璧勪骇")
+ public R<Boolean> add(@RequestBody FinIntangibleAssetDto dto) {
+ return R.ok(finIntangibleAssetService.add(dto));
+ }
+
+ @PutMapping("/update")
+ @Log(title = "鏃犲舰璧勪骇", businessType = BusinessType.UPDATE)
+ @Operation(summary = "淇敼鏃犲舰璧勪骇")
+ public R<Boolean> update(@RequestBody FinIntangibleAssetDto dto) {
+ return R.ok(finIntangibleAssetService.update(dto));
+ }
+
+ @DeleteMapping("/delete")
+ @Log(title = "鏃犲舰璧勪骇", businessType = BusinessType.DELETE)
+ @Operation(summary = "鍒犻櫎鏃犲舰璧勪骇")
+ public R<Boolean> delete(@RequestParam("ids") Long[] ids) {
+ return R.ok(finIntangibleAssetService.deleteByIds(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/amortize")
+ @Log(title = "鏃犲舰璧勪骇鎽婇攢璁℃彁", businessType = BusinessType.UPDATE)
+ @Operation(summary = "鏃犲舰璧勪骇鎸夋湀璁℃彁鎽婇攢")
+ public R amortize(@RequestBody(required = false) FinIdBatchDto dto) {
+ return R.ok(finIntangibleAssetService.amortize(dto == null ? null : dto.getIds()));
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/controller/financial/FinLedgerController.java b/src/main/java/com/ruoyi/account/controller/financial/FinLedgerController.java
new file mode 100644
index 0000000..423030a
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/financial/FinLedgerController.java
@@ -0,0 +1,39 @@
+package com.ruoyi.account.controller.financial;
+
+import com.ruoyi.account.bean.dto.financial.FinDetailLedgerQueryDto;
+import com.ruoyi.account.bean.dto.financial.FinLedgerQueryDto;
+import com.ruoyi.account.bean.vo.financial.FinLedgerRowVo;
+import com.ruoyi.account.service.financial.FinLedgerService;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 绉戠洰鎬昏处/鏄庣粏璐︽帶鍒跺櫒銆�
+ */
+@RestController
+@RequestMapping("/financial/ledger")
+@RequiredArgsConstructor
+@Tag(name = "璐㈠姟绠$悊-绉戠洰璐�")
+public class FinLedgerController {
+
+ private final FinLedgerService finLedgerService;
+
+ @GetMapping("/general")
+ @Operation(summary = "绉戠洰鎬昏处鏌ヨ")
+ public R<List<FinLedgerRowVo>> general(FinLedgerQueryDto queryDto) {
+ return R.ok(finLedgerService.queryGeneralLedger(queryDto));
+ }
+
+ @GetMapping("/detail")
+ @Operation(summary = "绉戠洰鏄庣粏璐︽煡璇�")
+ public R<List<FinLedgerRowVo>> detail(FinDetailLedgerQueryDto queryDto) {
+ return R.ok(finLedgerService.queryDetailLedger(queryDto));
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/controller/financial/FinVoucherController.java b/src/main/java/com/ruoyi/account/controller/financial/FinVoucherController.java
new file mode 100644
index 0000000..beeaafa
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/financial/FinVoucherController.java
@@ -0,0 +1,69 @@
+package com.ruoyi.account.controller.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.financial.FinVoucherDto;
+import com.ruoyi.account.bean.dto.financial.FinVoucherPageDto;
+import com.ruoyi.account.bean.dto.financial.FinVoucherStatusDto;
+import com.ruoyi.account.bean.vo.financial.FinVoucherDetailVo;
+import com.ruoyi.account.pojo.financial.FinVoucher;
+import com.ruoyi.account.service.financial.FinVoucherService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 鍑瘉鎺у埗鍣ㄣ��
+ */
+@RestController
+@RequestMapping("/financial/voucher")
+@RequiredArgsConstructor
+@Tag(name = "璐㈠姟绠$悊-鍑瘉")
+public class FinVoucherController {
+
+ private final FinVoucherService finVoucherService;
+
+ @GetMapping("/page")
+ @Operation(summary = "鍑瘉鍒嗛〉鏌ヨ")
+ public R<IPage<FinVoucher>> page(Page<FinVoucher> page, FinVoucherPageDto queryDto) {
+ return R.ok(finVoucherService.pageList(page, queryDto));
+ }
+
+ @PostMapping("/add")
+ @Log(title = "鍑瘉", businessType = BusinessType.INSERT)
+ @Operation(summary = "鏂板鍑瘉")
+ public R<Boolean> add(@RequestBody FinVoucherDto dto) {
+ return R.ok(finVoucherService.addVoucher(dto));
+ }
+
+ @PutMapping("/update")
+ @Log(title = "鍑瘉", businessType = BusinessType.UPDATE)
+ @Operation(summary = "淇敼鍑瘉")
+ public R<Boolean> update(@RequestBody FinVoucherDto dto) {
+ return R.ok(finVoucherService.updateVoucher(dto));
+ }
+
+ @PostMapping("/post")
+ @Log(title = "鍑瘉杩囪处", businessType = BusinessType.UPDATE)
+ @Operation(summary = "鍑瘉杩囪处")
+ public R<Boolean> post(@RequestBody FinVoucherStatusDto dto) {
+ return R.ok(finVoucherService.postVoucher(dto.getId()));
+ }
+
+ @PostMapping("/cancel")
+ @Log(title = "鍑瘉浣滃簾", businessType = BusinessType.UPDATE)
+ @Operation(summary = "鍑瘉浣滃簾")
+ public R<Boolean> cancel(@RequestBody FinVoucherStatusDto dto) {
+ return R.ok(finVoucherService.cancelVoucher(dto.getId()));
+ }
+
+ @GetMapping("/detail/{id}")
+ @Operation(summary = "鍑瘉璇︽儏")
+ public R<FinVoucherDetailVo> detail(@PathVariable("id") Long id) {
+ return R.ok(finVoucherService.detail(id));
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/controller/purchase/AccounPurchaseController.java b/src/main/java/com/ruoyi/account/controller/purchase/AccounPurchaseController.java
new file mode 100644
index 0000000..283e8fb
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/purchase/AccounPurchaseController.java
@@ -0,0 +1,68 @@
+package com.ruoyi.account.controller.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto;
+import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo;
+import com.ruoyi.account.service.financial.AccountPurchaseService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊鐨勯噰璐儴鍒� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@RestController
+@RequestMapping("/accountPurchase")
+@RequiredArgsConstructor
+@Tag(name = "璐㈠姟绠$悊鐨勯噰璐儴鍒�")
+public class AccounPurchaseController {
+
+ private final AccountPurchaseService accountPurchaseService;
+
+ @GetMapping("/listPageAccountPurchase")
+ @Log(title = "閲囪喘鍏ュ簱鍙拌处", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--閲囪喘鍏ュ簱鍙拌处")
+ public R<IPage<PurchaseInboundVo>> listPageAccountPurchase(Page page, PurchaseInboundDto purchaseInboundDto) {
+ IPage<PurchaseInboundVo> listPage = accountPurchaseService.listPageAccountPurchase(page,purchaseInboundDto);
+ return R.ok(listPage);
+ }
+
+ @PostMapping("/exportAccountPurchaseInbound")
+ @Operation(summary = "瀵煎嚭閲囪喘鍏ュ簱鏂囦欢")
+ @Log(title = "瀵煎嚭閲囪喘鍏ュ簱鏂囦欢", businessType = BusinessType.EXPORT)
+ public void exportAccountPurchaseInbound(HttpServletResponse response, PurchaseInboundDto purchaseInboundDto) {
+ accountPurchaseService.exportAccountPurchaseInbound(response,purchaseInboundDto);
+ }
+
+ @GetMapping("/listPageAccountPurchaseReturn")
+ @Log(title = "閲囪喘閫�璐у彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--閲囪喘閫�璐у彴璐�")
+ public R<IPage<PurchaseReturnVo>> listPageAccountPurchaseReturn(Page page, PurchaseReturnDto purchaseReturnDto) {
+ IPage<PurchaseReturnVo> listPage = accountPurchaseService.listPageAccountPurchaseReturn(page,purchaseReturnDto);
+ return R.ok(listPage);
+ }
+
+ @PostMapping("/exportAccountPurchaseReturn")
+ @Operation(summary = "瀵煎嚭閲囪喘閫�璐ф枃浠�")
+ @Log(title = "瀵煎嚭閲囪喘閫�璐ф枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountPurchaseReturn(HttpServletResponse response,PurchaseReturnDto purchaseReturnDto) {
+ accountPurchaseService.exportAccountPurchaseReturn(response,purchaseReturnDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/purchase/AccountPaymentApplicationController.java b/src/main/java/com/ruoyi/account/controller/purchase/AccountPaymentApplicationController.java
new file mode 100644
index 0000000..423d0ef
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/purchase/AccountPaymentApplicationController.java
@@ -0,0 +1,86 @@
+package com.ruoyi.account.controller.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo;
+import com.ruoyi.account.pojo.purchase.AccountPaymentApplication;
+import com.ruoyi.account.service.purchase.AccountPaymentApplicationService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鐢宠 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:44:22
+ */
+@RestController
+@RequestMapping("/accountPaymentApplication")
+@Tag(name = "璐㈠姟绠$悊--浠樻鐢宠")
+@RequiredArgsConstructor
+public class AccountPaymentApplicationController {
+
+ private final AccountPaymentApplicationService accountPaymentApplicationService;
+
+ @GetMapping("/listPageAccountPaymentApplication")
+ @Log(title = "浠樻鐢宠鍙拌处", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--浠樻鐢宠鍙拌处")
+ public R<IPage<AccountPaymentApplicationVo>> listPageAccountPaymentApplication(Page page, AccountPaymentApplicationDto accountPaymentApplicationDto) {
+ IPage<AccountPaymentApplicationVo> listPage = accountPaymentApplicationService.listPageAccountPaymentApplication(page,accountPaymentApplicationDto);
+ return R.ok(listPage);
+ }
+
+ @GetMapping("/getInboundBatchesBySupplier")
+ @Log(title = "鏍规嵁渚涘簲鍟嗘煡璇㈠叆搴撳崟鍙�(浠樻鐢宠)", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--鏍规嵁渚涘簲鍟嗘煡璇㈠叆搴撳崟鍙�(浠樻鐢宠)")
+ public R getInboundBatchesBySupplier(Integer supplierId) {
+ return R.ok(accountPaymentApplicationService.getInboundBatchesBySupplier(supplierId));
+ }
+
+ @PostMapping("/addAccountPaymentApplication")
+ @Log(title = "鏂板浠樻鐢宠", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--鏂板浠樻鐢宠")
+ public R addAccountPaymentApplication(@RequestBody AccountPaymentApplication accountPaymentApplication) {
+ return R.ok(accountPaymentApplicationService.addAccountPaymentApplication(accountPaymentApplication));
+ }
+
+ @PutMapping("/updateAccountPaymentApplication")
+ @Log(title = "淇敼浠樻鐢宠", businessType = BusinessType.UPDATE)
+ @Operation(summary = "璐㈠姟绠$悊--淇敼浠樻鐢宠")
+ public R updateAccountPaymentApplication(@RequestBody AccountPaymentApplication accountPaymentApplication) {
+ return R.ok(accountPaymentApplicationService.updateById(accountPaymentApplication));
+ }
+
+ @PutMapping("/auditAccountPaymentApplication")
+ @Log(title = "瀹℃牳浠樻鐢宠", businessType = BusinessType.UPDATE)
+ @Operation(summary = "璐㈠姟绠$悊--瀹℃牳浠樻鐢宠")
+ public R auditAccountPaymentApplication(@RequestBody AccountPaymentApplication accountPaymentApplication) {
+ return R.ok(accountPaymentApplicationService.updateById(accountPaymentApplication));
+ }
+
+ @DeleteMapping("/deleteAccountPaymentApplication")
+ @Log(title = "鍒犻櫎浠樻鐢宠", businessType = BusinessType.DELETE)
+ @Operation(summary = "璐㈠姟绠$悊--鍒犻櫎浠樻鐢宠")
+ public R deleteAccountPaymentApplication(@RequestParam("ids") Long[] ids) {
+ return R.ok(accountPaymentApplicationService.deleteAccountPaymentApplication(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/exportAccountPaymentApplication")
+ @Operation(summary = "瀵煎嚭浠樻鐢宠鏂囦欢")
+ @Log(title = "瀵煎嚭浠樻鐢宠鏂囦欢", businessType = BusinessType.EXPORT)
+ public void exportAccountPaymentApplication(HttpServletResponse response, AccountPaymentApplicationDto accountPaymentApplicationDto) {
+ accountPaymentApplicationService.exportAccountPaymentApplication(response,accountPaymentApplicationDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/purchase/AccountPurchaseInvoiceController.java b/src/main/java/com/ruoyi/account/controller/purchase/AccountPurchaseInvoiceController.java
new file mode 100644
index 0000000..c755aad
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/purchase/AccountPurchaseInvoiceController.java
@@ -0,0 +1,79 @@
+package com.ruoyi.account.controller.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo;
+import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice;
+import com.ruoyi.account.service.purchase.AccountPurchaseInvoiceService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--杩涢」鍙戠エ 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:06:17
+ */
+@RestController
+@RequestMapping("/accountPurchaseInvoice")
+@Tag(name = "璐㈠姟绠$悊--杩涢」鍙戠エ")
+@RequiredArgsConstructor
+public class AccountPurchaseInvoiceController {
+
+ private final AccountPurchaseInvoiceService accountPurchaseInvoiceService;
+
+ @GetMapping("/listPageAccountPurchaseInvoice")
+ @Log(title = "杩涢」鍙戠エ鍙拌处", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--杩涢」鍙戠エ鍙拌处")
+ public R<IPage<AccountPurchaseInvoiceVo>> listPageAccountPurchaseInvoice(Page page, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) {
+ IPage<AccountPurchaseInvoiceVo> listPage = accountPurchaseInvoiceService.listPageAccountPurchaseInvoice(page,accountPurchaseInvoiceDto);
+ return R.ok(listPage);
+ }
+
+ @GetMapping("/getInboundBatchesBySupplier")
+ @Log(title = "鏍规嵁渚涘簲鍟嗘煡璇㈠叆搴撳崟鍙�(杩涢」鍙戠エ)", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--鏍规嵁渚涘簲鍟嗘煡璇㈠叆搴撳崟鍙�(杩涢」鍙戠エ)")
+ public R getInboundBatchesBySupplier(Integer supplierId) {
+ return R.ok(accountPurchaseInvoiceService.getInboundBatchesBySupplier(supplierId));
+ }
+
+ @PostMapping("/addAccountPurchaseInvoice")
+ @Log(title = "鏂板杩涢」鍙戠エ", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--鏂板杩涢」鍙戠エ")
+ public R addAccountPurchaseInvoice(@RequestBody AccountPurchaseInvoice accountPurchaseInvoice) {
+ return R.ok(accountPurchaseInvoiceService.save(accountPurchaseInvoice));
+ }
+
+ @PutMapping("/cancelAccountPurchaseInvoice")
+ @Log(title = "浣滃簾杩涢」鍙戠エ", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--浣滃簾閿�椤瑰彂绁�")
+ public R cancelAccountPurchaseInvoice(@RequestBody AccountPurchaseInvoice accountPurchaseInvoice) {
+ return R.ok(accountPurchaseInvoiceService.updateById(accountPurchaseInvoice));
+ }
+
+ @DeleteMapping("/deleteAccountPurchaseInvoice")
+ @Log(title = "鍒犻櫎杩涢」鍙戠エ", businessType = BusinessType.DELETE)
+ @Operation(summary = "璐㈠姟绠$悊--鍒犻櫎杩涢」鍙戠エ")
+ public R deleteAccountPurchaseInvoice(@RequestParam("ids") Long[] ids) {
+ return R.ok(accountPurchaseInvoiceService.deleteAccountPurchaseInvoice(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/exportAccountPurchaseInvoice")
+ @Operation(summary = "瀵煎嚭杩涢」鍙戠エ鏂囦欢")
+ @Log(title = "瀵煎嚭杩涢」鍙戠エ鏂囦欢", businessType = BusinessType.EXPORT)
+ public void exportAccountPurchaseInvoice(HttpServletResponse response, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) {
+ accountPurchaseInvoiceService.exportAccountPurchaseInvoice(response,accountPurchaseInvoiceDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/purchase/AccountPurchasePaymentController.java b/src/main/java/com/ruoyi/account/controller/purchase/AccountPurchasePaymentController.java
new file mode 100644
index 0000000..c73e547
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/purchase/AccountPurchasePaymentController.java
@@ -0,0 +1,71 @@
+package com.ruoyi.account.controller.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.service.purchase.AccountPurchasePaymentService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鍗� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 04:14:51
+ */
+@RestController
+@RequestMapping("/accountPurchasePayment")
+@Tag(name = "璐㈠姟绠$悊--浠樻鍗�")
+@RequiredArgsConstructor
+public class AccountPurchasePaymentController {
+
+ private final AccountPurchasePaymentService accountPurchasePaymentService;
+
+ @GetMapping("/listPageAccountPurchasePayment")
+ @Log(title = "浠樻鍗曞彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--浠樻鍗曞彴璐�")
+ public R<IPage<AccountPurchasePaymentVo>> listPageAccountPurchasePayment(Page page, AccountPurchasePaymentDto accountPurchasePaymentDto) {
+ IPage<AccountPurchasePaymentVo> listPage = accountPurchasePaymentService.listPageAccountPurchasePayment(page,accountPurchasePaymentDto);
+ return R.ok(listPage);
+ }
+
+ @PostMapping("/addAccountPurchasePayment")
+ @Log(title = "鏂板浠樻鍗�", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--鏂板浠樻鍗�")
+ public R addAccountPurchasePayment(@RequestBody AccountPurchasePayment accountPurchasePayment) {
+ return R.ok(accountPurchasePaymentService.addAccountPurchasePayment(accountPurchasePayment));
+ }
+
+ @PutMapping("/updateAccountPurchasePayment")
+ @Log(title = "缂栬緫浠樻鍗�", businessType = BusinessType.UPDATE)
+ @Operation(summary = "璐㈠姟绠$悊--缂栬緫浠樻鍗�")
+ public R updateAccountPurchasePayment(@RequestBody AccountPurchasePayment accountPurchasePayment) {
+ return R.ok(accountPurchasePaymentService.updateById(accountPurchasePayment));
+ }
+
+ @DeleteMapping("/deleteAccountPurchasePayment")
+ @Log(title = "鍒犻櫎浠樻鍗�", businessType = BusinessType.DELETE)
+ @Operation(summary = "璐㈠姟绠$悊--鍒犻櫎浠樻鍗�")
+ public R deleteAccountPurchasePayment(@RequestParam("ids") Long[] ids) {
+ return R.ok(accountPurchasePaymentService.deleteAccountPurchasePayment(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/exportAccountPurchasePayment")
+ @Operation(summary = "瀵煎嚭浠樻鍗曟枃浠�")
+ @Log(title = "瀵煎嚭浠樻鍗曟枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountPurchasePayment(HttpServletResponse response, AccountPurchasePaymentDto accountPurchasePaymentDto) {
+ accountPurchasePaymentService.exportAccountPurchasePayment(response,accountPurchasePaymentDto);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/controller/sales/AccountInvoiceApplicationController.java b/src/main/java/com/ruoyi/account/controller/sales/AccountInvoiceApplicationController.java
new file mode 100644
index 0000000..699f57c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/sales/AccountInvoiceApplicationController.java
@@ -0,0 +1,94 @@
+package com.ruoyi.account.controller.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto;
+import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo;
+import com.ruoyi.account.pojo.sales.AccountInvoiceApplication;
+import com.ruoyi.account.service.sales.AccountInvoiceApplicationService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--寮�绁ㄧ敵璇� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 01:38:32
+ */
+@RestController
+@RequestMapping("/accountInvoiceApplication")
+@Tag(name = "璐㈠姟绠$悊--寮�绁ㄧ敵璇�")
+@RequiredArgsConstructor
+public class AccountInvoiceApplicationController {
+
+ private final AccountInvoiceApplicationService accountInvoiceApplicationService;
+
+ @GetMapping("/listPageAccountInvoiceApplication")
+ @Log(title = "寮�绁ㄧ敵璇峰彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--寮�绁ㄧ敵璇峰彴璐�")
+ public R<IPage<AccountInvoiceApplicationVo>> listPageAccountInvoiceApplication(Page page, AccountInvoiceApplicationDto accountInvoiceApplicationDto) {
+ IPage<AccountInvoiceApplicationVo> listPage = accountInvoiceApplicationService.listPageAccountInvoiceApplication(page,accountInvoiceApplicationDto);
+ return R.ok(listPage);
+ }
+
+ @GetMapping("/getAccountInvoiceApplicationList")
+ @Log(title = "鏍规嵁瀹㈡埛id鏌ヨ寮�绁ㄧ敵璇峰彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--寮�绁ㄧ敵璇峰彴璐�")
+ public R<List<AccountInvoiceApplicationVo>> getAccountInvoiceApplicationList(@RequestParam Integer customerId){
+ return R.ok(accountInvoiceApplicationService.getAccountInvoiceApplicationList(customerId));
+ }
+
+ @GetMapping("/getOutboundBatchesByCustomer")
+ @Log(title = "鏍规嵁瀹㈡埛鏌ヨ鍑哄簱鍗曞彿(寮�绁ㄧ敵璇�)", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--鏍规嵁瀹㈡埛鏌ヨ鍑哄簱鍗曞彿(寮�绁ㄧ敵璇�)")
+ public R getOutboundBatchesByCustomer(Integer customerId) {
+ return R.ok(accountInvoiceApplicationService.getOutboundBatchesByCustomer(customerId));
+ }
+
+ @PostMapping("/addAccountInvoiceApplication")
+ @Log(title = "鏂板寮�绁ㄧ敵璇�", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--鏂板寮�绁ㄧ敵璇�")
+ public R addAccountInvoiceApplication(@RequestBody AccountInvoiceApplication accountInvoiceApplication) {
+ return R.ok(accountInvoiceApplicationService.addAccountInvoiceApplication(accountInvoiceApplication));
+ }
+
+ @PutMapping("/updateAccountInvoiceApplication")
+ @Log(title = "淇敼寮�绁ㄧ敵璇�", businessType = BusinessType.UPDATE)
+ @Operation(summary = "璐㈠姟绠$悊--淇敼寮�绁ㄧ敵璇�")
+ public R updateAccountInvoiceApplication(@RequestBody AccountInvoiceApplication accountInvoiceApplication) {
+ return R.ok(accountInvoiceApplicationService.updateById(accountInvoiceApplication));
+ }
+
+ @PutMapping("/auditAccountInvoiceApplication")
+ @Log(title = "瀹℃牳寮�绁ㄧ敵璇�", businessType = BusinessType.UPDATE)
+ @Operation(summary = "璐㈠姟绠$悊--瀹℃牳寮�绁ㄧ敵璇�")
+ public R auditAccountInvoiceApplication(@RequestBody AccountInvoiceApplication accountInvoiceApplication) {
+ return R.ok(accountInvoiceApplicationService.updateById(accountInvoiceApplication));
+ }
+
+ @DeleteMapping("/deleteAccountInvoiceApplication")
+ @Log(title = "鍒犻櫎寮�绁ㄧ敵璇�", businessType = BusinessType.DELETE)
+ @Operation(summary = "璐㈠姟绠$悊--鍒犻櫎寮�绁ㄧ敵璇�")
+ public R deleteAccountInvoiceApplication(@RequestParam("ids") Long[] ids) {
+ return R.ok(accountInvoiceApplicationService.deleteAccountInvoiceApplication(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/exportAccountInvoiceApplication")
+ @Operation(summary = "瀵煎嚭寮�绁ㄧ敵璇锋枃浠�")
+ @Log(title = "瀵煎嚭寮�绁ㄧ敵璇锋枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountInvoiceApplication(HttpServletResponse response, AccountInvoiceApplicationDto accountInvoiceApplicationDto) {
+ accountInvoiceApplicationService.exportAccountInvoiceApplication(response,accountInvoiceApplicationDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/sales/AccountSalesCollectionController.java b/src/main/java/com/ruoyi/account/controller/sales/AccountSalesCollectionController.java
new file mode 100644
index 0000000..6ab1f2a
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/sales/AccountSalesCollectionController.java
@@ -0,0 +1,79 @@
+package com.ruoyi.account.controller.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.account.service.sales.AccountSalesCollectionService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--鏀舵鍗� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:49:56
+ */
+@RestController
+@RequestMapping("/accountSalesCollection")
+@Tag(name = "璐㈠姟绠$悊--鏀舵鍗�")
+@RequiredArgsConstructor
+public class AccountSalesCollectionController {
+
+ private final AccountSalesCollectionService accountSalesCollectionService;
+
+ @GetMapping("/listPageAccountSalesCollection")
+ @Log(title = "鏀舵鍗曞彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--鏀舵鍗曞彴璐�")
+ public R<IPage<AccountSalesCollectionVo>> listPageAccountSalesCollection(Page page, AccountSalesCollectionDto accountSalesCollectionDto) {
+ IPage<AccountSalesCollectionVo> listPage = accountSalesCollectionService.listPageAccountSalesCollection(page,accountSalesCollectionDto);
+ return R.ok(listPage);
+ }
+
+ @GetMapping("/getOutboundBatchesByCustomer")
+ @Log(title = "鏍规嵁瀹㈡埛鏌ヨ鍑哄簱鍗曞彿(鏀舵鍗�)", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--鏍规嵁瀹㈡埛鏌ヨ鍑哄簱鍗曞彿(鏀舵鍗�)")
+ public R getOutboundBatchesByCustomer(Integer customerId) {
+ return R.ok(accountSalesCollectionService.getOutboundBatchesByCustomer(customerId));
+ }
+
+ @PostMapping("/addAccountSalesCollection")
+ @Log(title = "鏂板鏀舵鍗�", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--鏂板鏀舵鍗�")
+ public R addAccountSalesCollection(@RequestBody AccountSalesCollection accountSalesCollection) {
+ return R.ok(accountSalesCollectionService.addAccountSalesCollection(accountSalesCollection));
+ }
+
+ @PutMapping("/updateAccountSalesCollection")
+ @Log(title = "缂栬緫鏀舵鍗�", businessType = BusinessType.UPDATE)
+ @Operation(summary = "璐㈠姟绠$悊--缂栬緫鏀舵鍗�")
+ public R updateAccountSalesCollection(@RequestBody AccountSalesCollection accountSalesCollection) {
+ return R.ok(accountSalesCollectionService.updateById(accountSalesCollection));
+ }
+
+ @DeleteMapping("/deleteAccountSalesCollection")
+ @Log(title = "鍒犻櫎鏀舵鍗�", businessType = BusinessType.DELETE)
+ @Operation(summary = "璐㈠姟绠$悊--鍒犻櫎鏀舵鍗�")
+ public R deleteAccountSalesCollection(@RequestParam("ids") Long[] ids) {
+ return R.ok(accountSalesCollectionService.deleteAccountSalesCollection(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/exportAccountSalesCollection")
+ @Operation(summary = "瀵煎嚭鏀舵鍗曟枃浠�")
+ @Log(title = "瀵煎嚭鏀舵鍗曟枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountSalesCollection(HttpServletResponse response, AccountSalesCollectionDto accountSalesCollectionDto) {
+ accountSalesCollectionService.exportAccountSalesCollection(response,accountSalesCollectionDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/sales/AccountSalesController.java b/src/main/java/com/ruoyi/account/controller/sales/AccountSalesController.java
new file mode 100644
index 0000000..25d8096
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/sales/AccountSalesController.java
@@ -0,0 +1,68 @@
+package com.ruoyi.account.controller.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.SalesOutboundDto;
+import com.ruoyi.account.bean.dto.sales.SalesReturnDto;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.bean.vo.sales.SalesReturnVo;
+import com.ruoyi.account.service.sales.AccountSalesService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊鐨勯攢鍞儴鍒� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@RestController
+@RequestMapping("/accountSales")
+@RequiredArgsConstructor
+@Tag(name = "璐㈠姟绠$悊鐨勯攢鍞儴鍒�")
+public class AccountSalesController {
+
+ private final AccountSalesService accountSalesService;
+
+ @GetMapping("/listPageAccountSales")
+ @Log(title = "閿�鍞嚭搴撳彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--閿�鍞嚭搴撳彴璐�")
+ public R<IPage<SalesOutboundVo>> listPageAccountSales(Page page, SalesOutboundDto salesOutboundDto) {
+ IPage<SalesOutboundVo> listPage = accountSalesService.listPageAccountSales(page,salesOutboundDto);
+ return R.ok(listPage);
+ }
+
+ @PostMapping("/exportAccountSalesOutbound")
+ @Operation(summary = "瀵煎嚭閿�鍞嚭搴撴枃浠�")
+ @Log(title = "瀵煎嚭閿�鍞嚭搴撴枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountSalesOutbound(HttpServletResponse response,SalesOutboundDto salesOutboundDto) {
+ accountSalesService.exportAccountSalesOutbound(response,salesOutboundDto);
+ }
+
+ @GetMapping("/listPageAccountSalesReturn")
+ @Log(title = "閿�鍞��璐у彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--閿�鍞��璐у彴璐�")
+ public R<IPage<SalesReturnVo>> listPageAccountSalesReturn(Page page, SalesReturnDto salesReturnDto) {
+ IPage<SalesReturnVo> listPage = accountSalesService.listPageAccountSalesReturn(page,salesReturnDto);
+ return R.ok(listPage);
+ }
+
+ @PostMapping("/exportAccountSalesReturn")
+ @Operation(summary = "瀵煎嚭閿�鍞��璐ф枃浠�")
+ @Log(title = "瀵煎嚭閿�鍞��璐ф枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountSalesReturn(HttpServletResponse response,SalesReturnDto salesReturnDto) {
+ accountSalesService.exportAccountSalesReturn(response,salesReturnDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/sales/AccountSalesInvoiceController.java b/src/main/java/com/ruoyi/account/controller/sales/AccountSalesInvoiceController.java
new file mode 100644
index 0000000..05c13b0
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/controller/sales/AccountSalesInvoiceController.java
@@ -0,0 +1,72 @@
+package com.ruoyi.account.controller.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo;
+import com.ruoyi.account.pojo.sales.AccountSalesInvoice;
+import com.ruoyi.account.service.sales.AccountSalesInvoiceService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--閿�椤瑰彂绁� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:10:20
+ */
+@RestController
+@RequestMapping("/accountSalesInvoice")
+@Tag(name = "璐㈠姟绠$悊--閿�椤瑰彂绁�")
+@RequiredArgsConstructor
+public class AccountSalesInvoiceController {
+
+ private final AccountSalesInvoiceService accountSalesInvoiceService;
+
+ @GetMapping("/listPageAccountSalesInvoice")
+ @Log(title = "閿�椤瑰彂绁ㄥ彴璐�", businessType = BusinessType.OTHER)
+ @Operation(summary = "璐㈠姟绠$悊--閿�椤瑰彂绁ㄥ彴璐�")
+ public R<IPage<AccountSalesInvoiceVo>> listPageAccountSalesInvoice(Page page, AccountSalesInvoiceDto accountSalesInvoiceDto) {
+ IPage<AccountSalesInvoiceVo> listPage = accountSalesInvoiceService.listPageAccountSalesInvoice(page,accountSalesInvoiceDto);
+ return R.ok(listPage);
+ }
+
+ @PostMapping("/addAccountSalesInvoice")
+ @Log(title = "鏂板閿�椤瑰彂绁�", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--鏂板閿�椤瑰彂绁�")
+ public R addAccountSalesInvoice(@RequestBody AccountSalesInvoice accountSalesInvoice) {
+ return R.ok(accountSalesInvoiceService.save(accountSalesInvoice));
+ }
+
+ @PutMapping("/cancelAccountSalesInvoice")
+ @Log(title = "浣滃簾閿�椤瑰彂绁�", businessType = BusinessType.INSERT)
+ @Operation(summary = "璐㈠姟绠$悊--浣滃簾閿�椤瑰彂绁�")
+ public R cancelAccountSalesInvoice(@RequestBody AccountSalesInvoice accountSalesInvoice) {
+ return R.ok(accountSalesInvoiceService.updateById(accountSalesInvoice));
+ }
+
+ @DeleteMapping("/deleteAccountSalesInvoice")
+ @Log(title = "鍒犻櫎閿�椤瑰彂绁�", businessType = BusinessType.DELETE)
+ @Operation(summary = "璐㈠姟绠$悊--鍒犻櫎閿�椤瑰彂绁�")
+ public R deleteAccountSalesInvoice(@RequestParam("ids") Long[] ids) {
+ return R.ok(accountSalesInvoiceService.deleteAccountSalesInvoice(Arrays.asList(ids)));
+ }
+
+ @PostMapping("/exportAccountSalesInvoice")
+ @Operation(summary = "瀵煎嚭閿�椤瑰彂绁ㄦ枃浠�")
+ @Log(title = "瀵煎嚭閿�椤瑰彂绁ㄦ枃浠�", businessType = BusinessType.EXPORT)
+ public void exportAccountSalesInvoice(HttpServletResponse response, AccountSalesInvoiceDto accountSalesInvoiceDto) {
+ accountSalesInvoiceService.exportAccountSalesInvoice(response,accountSalesInvoiceDto);
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/account/dto/AccountDto.java b/src/main/java/com/ruoyi/account/dto/AccountDto.java
deleted file mode 100644
index 93ed680..0000000
--- a/src/main/java/com/ruoyi/account/dto/AccountDto.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.ruoyi.account.dto;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import jakarta.validation.constraints.NotBlank;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 璐㈠姟绠$悊--璐㈠姟鎶ヨ〃
- */
-
-@Data
-public class AccountDto implements Serializable {
-
-
- /**
- * 鎬绘敹鍏�
- */
- private BigDecimal totalIncome;
-
- /**
- * 鍚勭被鍨嬫敹鍏ラ噾棰�(閿�鍞敹鍏ワ紝鏈嶅姟鏀跺叆锛屽叾浠栨敹鍏�)
- */
- private List<AccountDto2> incomeType;
-
-
- /**
- * 鏀跺叆绗旀暟
- */
- private Long incomeNumber;
-
- /**
- * 鎬绘敮鍑�
- */
- private BigDecimal totalExpense;
-
-
- /**
- * 鍚勭被鍨嬫敮鍑洪噾棰�(鍔炲叕鐢ㄥ搧锛屽憳宸ュ伐璧勶紝宸梾璐癸紝璁惧璐圭敤锛屽叾浠�)
- */
- private List<AccountDto2> expenseType;
-
- /**
- * 鏀嚭绗旀暟
- */
- private Long expenseNumber;
-
- /**
- * 鍑�鏀跺叆
- */
- private BigDecimal netRevenue;
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/dto/AccountDto2.java b/src/main/java/com/ruoyi/account/dto/AccountDto2.java
deleted file mode 100644
index 235278b..0000000
--- a/src/main/java/com/ruoyi/account/dto/AccountDto2.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.ruoyi.account.dto;
-
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.pojo.AccountIncome;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 璐㈠姟绠$悊--璐㈠姟鎶ヨ〃(绫诲瀷)
- */
-
-@Data
-public class AccountDto2 implements Serializable {
-
-
- /**
- * 绫诲瀷
- */
- private String typeName;
-
-
- /**
- * 鐧惧垎鍗犳瘮
- */
- private BigDecimal proportion;
-
-
-
- /**
- * 閲戦
- */
- private BigDecimal account;
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/dto/AccountDto3.java b/src/main/java/com/ruoyi/account/dto/AccountDto3.java
deleted file mode 100644
index 33b4b8e..0000000
--- a/src/main/java/com/ruoyi/account/dto/AccountDto3.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ruoyi.account.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 璐㈠姟绠$悊--璐㈠姟鎶ヨ〃(绫诲瀷)
- */
-
-@Data
-public class AccountDto3 implements Serializable {
-
-
- /**
- * 绫诲瀷
- */
- private String typeName;
-
-
- /**
- * 鐧惧垎鍗犳瘮
- */
- private BigDecimal proportion;
-
-
-
- /**
- * 閲戦
- */
- private List<BigDecimal> account;
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/dto/DeviceTypeDetail.java b/src/main/java/com/ruoyi/account/dto/DeviceTypeDetail.java
deleted file mode 100644
index ccbc897..0000000
--- a/src/main/java/com/ruoyi/account/dto/DeviceTypeDetail.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.ruoyi.account.dto;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author :yys
- * @date : 2026/1/17 13:42
- */
-@Data
-public class DeviceTypeDetail {
-
- private String type; // 璁惧绫诲瀷
- private BigDecimal count; // 鏁伴噺
- private BigDecimal amount; // 浠锋牸
-}
diff --git a/src/main/java/com/ruoyi/account/dto/DeviceTypeDistributionVO.java b/src/main/java/com/ruoyi/account/dto/DeviceTypeDistributionVO.java
deleted file mode 100644
index 1c294bd..0000000
--- a/src/main/java/com/ruoyi/account/dto/DeviceTypeDistributionVO.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.ruoyi.account.dto;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author :yys
- * @date : 2026/1/17 13:19
- */
-@Data
-public class DeviceTypeDistributionVO {
-
- private Integer totalCount = 0; // 璁惧绫诲瀷鎬绘暟
-
- // 楗煎浘鍜屾姌绾垮浘鐨勫垎绫伙紙璁惧绫诲瀷锛�
- private List<String> categories = new ArrayList<>();
- // 鍚勭被鍨嬭澶囩殑鏁伴噺
- private List<BigDecimal> countData = new ArrayList<>();
- // 鍚勭被鍨嬭澶囩殑鎬婚噾棰�
- private List<BigDecimal> amountData = new ArrayList<>();
- // 鏄庣粏鍒楄〃锛屽寘鍚被鍨嬨�佹暟閲忋�侀噾棰�
- private List<DeviceTypeDetail> details = new ArrayList<>();
-
-}
diff --git a/src/main/java/com/ruoyi/account/dto/ReportDateDto.java b/src/main/java/com/ruoyi/account/dto/ReportDateDto.java
deleted file mode 100644
index ab3799a..0000000
--- a/src/main/java/com/ruoyi/account/dto/ReportDateDto.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.ruoyi.account.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDate;
-import java.util.Date;
-
-/**
- * @author :yys
- * @date : 2026/1/16 16:57
- */
-@Data
-public class ReportDateDto {
-
- /**
- * 寮�濮嬫椂闂�
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate entryDateStart;
-
- /**
- * 缁撴潫鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate entryDateEnd;
-
- /**
- * 寮�濮嬫湀浠�
- */
- private Integer startMonth;
-
- /**
- * 缁撴潫鏈堜唤
- */
- private Integer endMonth;
-
-}
diff --git a/src/main/java/com/ruoyi/account/dto/SalesReceiptReturnDto.java b/src/main/java/com/ruoyi/account/dto/SalesReceiptReturnDto.java
deleted file mode 100644
index 728d9a7..0000000
--- a/src/main/java/com/ruoyi/account/dto/SalesReceiptReturnDto.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.ruoyi.account.dto;
-
-import com.ruoyi.account.pojo.SalesReceiptReturn;
-import lombok.Data;
-
-@Data
-public class SalesReceiptReturnDto extends SalesReceiptReturn {
-}
diff --git a/src/main/java/com/ruoyi/account/dto/SalesRefundAmountOrderDto.java b/src/main/java/com/ruoyi/account/dto/SalesRefundAmountOrderDto.java
deleted file mode 100644
index a948957..0000000
--- a/src/main/java/com/ruoyi/account/dto/SalesRefundAmountOrderDto.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.ruoyi.account.dto;
-
-import com.ruoyi.account.pojo.SalesRefundAmountOrder;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-@Data
-public class SalesRefundAmountOrderDto extends SalesRefundAmountOrder {
-
- @Schema(description = "閫�璐у崟鍙�")
- private String returnManagementNo;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Schema(description = "閿�鍞崟鍙�")
- private String salesContractNo;
-
- @Schema(description = "鍒涘缓浜哄悕绉�")
- private String createUserName;
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/mapper/AccountExpenseMapper.java b/src/main/java/com/ruoyi/account/mapper/AccountExpenseMapper.java
deleted file mode 100644
index 3cd3fc8..0000000
--- a/src/main/java/com/ruoyi/account/mapper/AccountExpenseMapper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.ruoyi.account.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.AccountDto;
-import com.ruoyi.account.dto.AccountDto2;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.dto.DateQueryDto;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
-@Mapper
-public interface AccountExpenseMapper extends BaseMapper<AccountExpense> {
- IPage<AccountExpense> accountExpenseListPage(Page page, @Param("accountExpense") AccountExpense accountExpense);
-
- List<AccountExpense> accountExpenseExport(@Param("accountExpense") AccountExpense accountExpense);
-
-
- List<AccountDto2> report(@Param("dateQueryDto") DateQueryDto dateQueryDto);
- BigDecimal report1(@Param("dateQueryDto") DateQueryDto dateQueryDto, @Param("dictValue") String dictValue);
-
- List<IncomeExpenseAnalysisDto> selectAccountExpenseStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat);
-
- List<com.ruoyi.dto.MapDto> selectExpenseComposition(@Param("startDate") String startDate, @Param("endDate") String endDate);
-}
diff --git a/src/main/java/com/ruoyi/account/mapper/AccountFileMapper.java b/src/main/java/com/ruoyi/account/mapper/AccountFileMapper.java
deleted file mode 100644
index d5b55be..0000000
--- a/src/main/java/com/ruoyi/account/mapper/AccountFileMapper.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.ruoyi.account.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.pojo.AccountFile;
-import com.ruoyi.quality.pojo.QualityInspectFile;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-@Mapper
-public interface AccountFileMapper extends BaseMapper<AccountFile> {
-
- IPage<AccountFile> accountFileListPage(Page page, @Param("accountFile") AccountFile accountFile);
-}
diff --git a/src/main/java/com/ruoyi/account/mapper/AccountIncomeMapper.java b/src/main/java/com/ruoyi/account/mapper/AccountIncomeMapper.java
deleted file mode 100644
index 9a9f951..0000000
--- a/src/main/java/com/ruoyi/account/mapper/AccountIncomeMapper.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.ruoyi.account.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.AccountDto2;
-import com.ruoyi.account.pojo.AccountFile;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
-@Mapper
-public interface AccountIncomeMapper extends BaseMapper<AccountIncome> {
-
- IPage<AccountIncome> accountIncomeListPage(Page page, @Param("accountIncome") AccountIncome accountIncome);
-
- List<AccountIncome> accountIncomeExport(@Param("accountIncome") AccountIncome accountIncome);
-
- List<AccountDto2> report(@Param("dateQueryDto") DateQueryDto dateQueryDto);
- BigDecimal report1(@Param("dateQueryDto") DateQueryDto dateQueryDto, @Param("dictValue") String dictValue);
-
- List<IncomeExpenseAnalysisDto> selectIncomeStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat);
-
-}
diff --git a/src/main/java/com/ruoyi/account/mapper/AccountStatementDetailsMapper.java b/src/main/java/com/ruoyi/account/mapper/AccountStatementDetailsMapper.java
new file mode 100644
index 0000000..7b6e72f
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/AccountStatementDetailsMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.account.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--瀵硅处鍗曟槑缁� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 10:12:42
+ */
+@Mapper
+public interface AccountStatementDetailsMapper extends BaseMapper<AccountStatementDetails> {
+
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/AccountStatementMapper.java b/src/main/java/com/ruoyi/account/mapper/AccountStatementMapper.java
new file mode 100644
index 0000000..89730cb
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/AccountStatementMapper.java
@@ -0,0 +1,28 @@
+package com.ruoyi.account.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.StatementAccountDto;
+import com.ruoyi.account.bean.vo.StatementAccountVo;
+import com.ruoyi.account.pojo.AccountStatement;
+import com.ruoyi.purchase.dto.VatDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 09:42:47
+ */
+@Mapper
+public interface AccountStatementMapper extends BaseMapper<AccountStatement> {
+
+
+ IPage<StatementAccountVo> listPageAccountStatement(Page page, @Param("req") StatementAccountDto statementAccountDto);
+
+ IPage<VatDto> selectVatDtoPage(Page page, @Param("month") String month);
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/BorrowInfoMapper.java b/src/main/java/com/ruoyi/account/mapper/BorrowInfoMapper.java
deleted file mode 100644
index bcac543..0000000
--- a/src/main/java/com/ruoyi/account/mapper/BorrowInfoMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.account.mapper;
-
-import com.ruoyi.account.pojo.BorrowInfo;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * <p>
- * 鍊熸淇℃伅琛� Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-01-15 02:57:29
- */
-@Mapper
-public interface BorrowInfoMapper extends BaseMapper<BorrowInfo> {
-
-}
diff --git a/src/main/java/com/ruoyi/account/mapper/SalesRefundAmountOrderMapper.java b/src/main/java/com/ruoyi/account/mapper/SalesRefundAmountOrderMapper.java
index adfae86..e2b0761 100644
--- a/src/main/java/com/ruoyi/account/mapper/SalesRefundAmountOrderMapper.java
+++ b/src/main/java/com/ruoyi/account/mapper/SalesRefundAmountOrderMapper.java
@@ -2,7 +2,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.SalesRefundAmountOrderDto;
+import com.ruoyi.account.bean.dto.SalesRefundAmountOrderDto;
import com.ruoyi.account.pojo.SalesRefundAmountOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
diff --git a/src/main/java/com/ruoyi/account/mapper/financial/AccountSubjectMapper.java b/src/main/java/com/ruoyi/account/mapper/financial/AccountSubjectMapper.java
new file mode 100644
index 0000000..a5dd4fc
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/financial/AccountSubjectMapper.java
@@ -0,0 +1,23 @@
+package com.ruoyi.account.mapper.financial;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.account.pojo.financial.AccountSubject;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 鎬昏处绉戠洰琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@Mapper
+public interface AccountSubjectMapper extends BaseMapper<AccountSubject> {
+
+ Long countReferencedBySubjectCodes(@Param("subjectCodes") List<String> subjectCodes);
+
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/financial/FinFixedAssetMapper.java b/src/main/java/com/ruoyi/account/mapper/financial/FinFixedAssetMapper.java
new file mode 100644
index 0000000..da2ae49
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/financial/FinFixedAssetMapper.java
@@ -0,0 +1,12 @@
+package com.ruoyi.account.mapper.financial;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.account.pojo.financial.FinFixedAsset;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 鍥哄畾璧勪骇 Mapper銆�
+ */
+@Mapper
+public interface FinFixedAssetMapper extends BaseMapper<FinFixedAsset> {
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/financial/FinIntangibleAssetMapper.java b/src/main/java/com/ruoyi/account/mapper/financial/FinIntangibleAssetMapper.java
new file mode 100644
index 0000000..8a7bbb2
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/financial/FinIntangibleAssetMapper.java
@@ -0,0 +1,12 @@
+package com.ruoyi.account.mapper.financial;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.account.pojo.financial.FinIntangibleAsset;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 鏃犲舰璧勪骇 Mapper銆�
+ */
+@Mapper
+public interface FinIntangibleAssetMapper extends BaseMapper<FinIntangibleAsset> {
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/financial/FinVoucherEntryMapper.java b/src/main/java/com/ruoyi/account/mapper/financial/FinVoucherEntryMapper.java
new file mode 100644
index 0000000..2fa2b73
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/financial/FinVoucherEntryMapper.java
@@ -0,0 +1,28 @@
+package com.ruoyi.account.mapper.financial;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo;
+import com.ruoyi.account.pojo.financial.FinVoucherEntry;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.time.LocalDate;
+import java.util.List;
+
+/**
+ * 鍑瘉鍒嗗綍 Mapper銆�
+ */
+@Mapper
+public interface FinVoucherEntryMapper extends BaseMapper<FinVoucherEntry> {
+
+ List<FinLedgerEntryRecordVo> listPostedEntries(@Param("subjectCode") String subjectCode,
+ @Param("startDate") LocalDate startDate,
+ @Param("endDate") LocalDate endDate,
+ @Param("auxiliaryType") String auxiliaryType,
+ @Param("auxiliaryId") String auxiliaryId);
+
+ List<FinLedgerEntryRecordVo> listPostedEntriesBefore(@Param("subjectCode") String subjectCode,
+ @Param("beforeDate") LocalDate beforeDate,
+ @Param("auxiliaryType") String auxiliaryType,
+ @Param("auxiliaryId") String auxiliaryId);
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/financial/FinVoucherMapper.java b/src/main/java/com/ruoyi/account/mapper/financial/FinVoucherMapper.java
new file mode 100644
index 0000000..b528b7c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/financial/FinVoucherMapper.java
@@ -0,0 +1,12 @@
+package com.ruoyi.account.mapper.financial;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.account.pojo.financial.FinVoucher;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 鍑瘉涓昏〃 Mapper銆�
+ */
+@Mapper
+public interface FinVoucherMapper extends BaseMapper<FinVoucher> {
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/purchase/AccountPaymentApplicationMapper.java b/src/main/java/com/ruoyi/account/mapper/purchase/AccountPaymentApplicationMapper.java
new file mode 100644
index 0000000..f6d90f9
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/purchase/AccountPaymentApplicationMapper.java
@@ -0,0 +1,32 @@
+package com.ruoyi.account.mapper.purchase;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.pojo.purchase.AccountPaymentApplication;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鐢宠 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:44:22
+ */
+@Mapper
+public interface AccountPaymentApplicationMapper extends BaseMapper<AccountPaymentApplication> {
+
+ IPage<AccountPaymentApplicationVo> listPageAccountPaymentApplication(Page page, @Param("req") AccountPaymentApplicationDto accountPaymentApplicationDto);
+
+ List<PurchaseInboundVo> getInboundBatchesBySupplier(@Param("supplierId") Integer supplierId);
+
+ //鍒ゆ柇璇ュ嚭搴撹褰曟槸鍚︽湁寮�绁ㄧ敵璇�
+ boolean existsByStockInRecordId(@Param("stockInRecordIds") List<Long> stockInRecordIds);
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchaseInvoiceMapper.java b/src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchaseInvoiceMapper.java
new file mode 100644
index 0000000..bd8e25a
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchaseInvoiceMapper.java
@@ -0,0 +1,29 @@
+package com.ruoyi.account.mapper.purchase;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--杩涢」鍙戠エ Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:06:17
+ */
+@Mapper
+public interface AccountPurchaseInvoiceMapper extends BaseMapper<AccountPurchaseInvoice> {
+
+ IPage<AccountPurchaseInvoiceVo> listPageAccountPurchaseInvoice(Page page, @Param("req") AccountPurchaseInvoiceDto accountPurchaseInvoiceDto);
+
+ List<PurchaseInboundVo> getInboundBatchesBySupplier(@Param("supplierId") Integer supplierId);
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchasePaymentMapper.java b/src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchasePaymentMapper.java
new file mode 100644
index 0000000..f687c74
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/purchase/AccountPurchasePaymentMapper.java
@@ -0,0 +1,29 @@
+package com.ruoyi.account.mapper.purchase;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鍗� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 04:14:51
+ */
+@Mapper
+public interface AccountPurchasePaymentMapper extends BaseMapper<AccountPurchasePayment> {
+
+ IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, @Param("req") AccountPurchasePaymentDto accountPurchasePaymentDto);
+
+ List<IncomeExpenseAnalysisDto> selectPayment(@Param("startStr") String startStr, @Param("endStr") String endStr, @Param("dateFormat") String dateFormat);
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/sales/AccountInvoiceApplicationMapper.java b/src/main/java/com/ruoyi/account/mapper/sales/AccountInvoiceApplicationMapper.java
new file mode 100644
index 0000000..c37a31f
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/sales/AccountInvoiceApplicationMapper.java
@@ -0,0 +1,34 @@
+package com.ruoyi.account.mapper.sales;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto;
+import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.pojo.sales.AccountInvoiceApplication;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--寮�绁ㄧ敵璇� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 01:38:32
+ */
+@Mapper
+public interface AccountInvoiceApplicationMapper extends BaseMapper<AccountInvoiceApplication> {
+
+ IPage<AccountInvoiceApplicationVo> listPageAccountInvoiceApplication(Page page, @Param("req") AccountInvoiceApplicationDto accountInvoiceApplicationDto);
+
+ List<SalesOutboundVo> getOutboundBatchesByCustomer(@Param("customerId") Integer customerId);
+
+ //鍒ゆ柇璇ュ嚭搴撹褰曟槸鍚︽湁寮�绁ㄧ敵璇�
+ boolean existsByStockOutRecordId(@Param("stockOutRecordIds") List<Long> stockOutRecordIds);
+
+ List<AccountInvoiceApplicationVo> selectAccountInvoiceApplicationList(@Param("customerId") Integer customerId);
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/sales/AccountSalesCollectionMapper.java b/src/main/java/com/ruoyi/account/mapper/sales/AccountSalesCollectionMapper.java
new file mode 100644
index 0000000..2f1cf6e
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/sales/AccountSalesCollectionMapper.java
@@ -0,0 +1,35 @@
+package com.ruoyi.account.mapper.sales;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--鏀舵鍗� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:49:56
+ */
+@Mapper
+public interface AccountSalesCollectionMapper extends BaseMapper<AccountSalesCollection> {
+
+ IPage<AccountSalesCollectionVo> listPageAccountSalesCollection(Page page, @Param("req") AccountSalesCollectionDto accountSalesCollectionDto);
+
+ //鍒ゆ柇璇ュ嚭搴撹褰曟槸鍚︽湁鏀舵鍗�
+ boolean existsByStockOutRecordId(@Param("stockOutRecordIds") List<Long> stockOutRecordIds);
+
+ List<SalesOutboundVo> getOutboundBatchesByCustomer(@Param("customerId") Integer customerId);
+
+ List<IncomeExpenseAnalysisDto> selectIncomeStats(@Param("startStr") String startStr, @Param("endStr") String endStr, @Param("dateFormat") String dateFormat);
+}
diff --git a/src/main/java/com/ruoyi/account/mapper/sales/AccountSalesInvoiceMapper.java b/src/main/java/com/ruoyi/account/mapper/sales/AccountSalesInvoiceMapper.java
new file mode 100644
index 0000000..ea88e8f
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/mapper/sales/AccountSalesInvoiceMapper.java
@@ -0,0 +1,24 @@
+package com.ruoyi.account.mapper.sales;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo;
+import com.ruoyi.account.pojo.sales.AccountSalesInvoice;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--閿�椤瑰彂绁� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:10:20
+ */
+@Mapper
+public interface AccountSalesInvoiceMapper extends BaseMapper<AccountSalesInvoice> {
+
+ IPage<AccountSalesInvoiceVo> listPageAccountSalesInvoice(Page page, @Param("req") AccountSalesInvoiceDto accountSalesInvoiceDto);
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/AccountExpense.java b/src/main/java/com/ruoyi/account/pojo/AccountExpense.java
deleted file mode 100644
index dcb6b4b..0000000
--- a/src/main/java/com/ruoyi/account/pojo/AccountExpense.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.ruoyi.account.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import jakarta.validation.constraints.NotBlank;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.Date;
-
-/**
- * 璐㈠姟绠$悊--鏀嚭绠$悊
- * account_expense
- */
-@TableName(value = "account_expense")
-@Data
-public class AccountExpense extends DateQueryDto implements Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * 搴忓彿
- */
- @TableId(type = IdType.AUTO)
- private Long id;
-
- /**
- * 涓氬姟id
- */
- private Long businessId;
-
- /**
- * 涓氬姟绫诲瀷 1-浠樻 2-杩樻 3-钖祫鍙戞斁
- */
- private Integer businessType;
-
- /**
- * 鏀嚭鏃ユ湡
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鏀嚭鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
- private Date expenseDate;
-
- /**
- * 鏀嚭绫诲瀷(鍔炲叕鐢ㄥ搧锛屽憳宸ュ伐璧勶紝宸梾璐癸紝璁惧璐圭敤锛屾潵绁ㄤ粯娆撅紝鍏朵粬)
- */
- @Excel(name = "鏀嚭绫诲瀷",readConverterExp = "0=鍔炲叕鐢ㄥ搧,1=鍛樺伐宸ヨ祫,2=宸梾璐�,3=璁惧璐圭敤,4=鏉ョエ浠樻,5=鍏朵粬")
- @NotBlank(message = "鏀嚭绫诲瀷涓嶈兘涓虹┖!!")
- private String expenseType;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
- /**
- * 鏀嚭閲戦
- */
- @Excel(name = "鏀嚭閲戦")
- private BigDecimal expenseMoney;
-
- /**
- * 鏀嚭鎻忚堪
- */
- @Excel(name = "鏀嚭鎻忚堪")
- private String expenseDescribed;
-
- /**
- * 浠樻鏂瑰紡(鐜伴噾锛屾敮绁紝閾惰杞处锛屽叾浠�)
- */
- @Excel(name = "浠樻鏂瑰紡",readConverterExp = "0=鐜伴噾,1=鏀エ,2=閾惰杞处,3=鍏朵粬")
- private String expenseMethod;
-
- /**
- * 鍙戠エ鍙风爜
- */
- @Excel(name = "鍙戠エ鍙风爜")
- private String invoiceNumber;
-
- /**
- * 澶囨敞
- */
- @Excel(name = "澶囨敞")
- private String note;
-
- /**
- * 褰曞叆浜哄憳
- */
- @Excel(name = "褰曞叆浜哄憳")
- private String inputUser;
-
- /**
- * 褰曞叆鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "褰曞叆鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
- private Date inputTime;
-
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/account/pojo/AccountFile.java b/src/main/java/com/ruoyi/account/pojo/AccountFile.java
deleted file mode 100644
index b22ab91..0000000
--- a/src/main/java/com/ruoyi/account/pojo/AccountFile.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.ruoyi.account.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import jakarta.validation.constraints.NotBlank;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-/**
- * 璐㈠姟绠$悊--闄勪欢
- * account_file
- */
-@TableName(value = "account_file")
-@Data
-public class AccountFile implements Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * 搴忓彿
- */
- @TableId(type = IdType.AUTO)
- private Long id;
-
- @Schema(description = "鏂囦欢鍚嶇О")
- private String name;
-
- @Schema(description = "鏂囦欢璺緞")
- private String url;
-
- @Schema(description = "鏂囦欢澶у皬")
- private int fileSize;
-
- @Schema(description = "璐㈠姟ID")
- @NotBlank(message = "璐㈠姟id涓嶈兘涓虹┖!")
- private Long accountId;
-
- /**
- * 绫诲瀷(鏀跺叆/鏀嚭)
- */
- @Schema(description = "绫诲瀷(鏀跺叆/鏀嚭)")
- private String accountType;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/account/pojo/AccountIncome.java b/src/main/java/com/ruoyi/account/pojo/AccountIncome.java
deleted file mode 100644
index d6ce79c..0000000
--- a/src/main/java/com/ruoyi/account/pojo/AccountIncome.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package com.ruoyi.account.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import jakarta.validation.constraints.NotBlank;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.List;
-
-/**
- * 璐㈠姟绠$悊--鏀跺叆绠$悊
- * account_income
- */
-@TableName(value = "account_income")
-@Data
-public class AccountIncome extends DateQueryDto implements Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * 搴忓彿
- */
- @TableId(type = IdType.AUTO)
- private Long id;
-
- /**
- * 涓氬姟id
- */
- private Long businessId;
-
- /**
- * 涓氬姟绫诲瀷 1-鍥炴 2-鍊熸
- */
- private Integer businessType;
-
- /**
- * 鏀跺叆鏃ユ湡
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鏀跺叆鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
- private Date incomeDate;
-
- /**
- * 鏀跺叆绫诲瀷(閿�鍞敹鍏ワ紝鏈嶅姟鏀跺叆锛屽叾浠栨敹鍏�)
- */
- @Excel(name = "鏀跺叆绫诲瀷", readConverterExp = "0=閿�鍞敹鍏�,1=鏈嶅姟鏀跺叆,2=鍏朵粬鏀跺叆,3=鍥炴鏀跺叆")
- @NotBlank(message = "鏀跺叆绫诲瀷涓嶈兘涓虹┖!!")
- private String incomeType;
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- /**
- * 鏀跺叆閲戦
- */
- @Excel(name = "鏀跺叆閲戦")
- private BigDecimal incomeMoney;
-
- /**
- * 鏀跺叆鎻忚堪
- */
- @Excel(name = "鏀跺叆鎻忚堪")
- private String incomeDescribed;
-
- /**
- * 鏀舵鏂瑰紡(鐜伴噾锛屾敮绁紝閾惰杞处锛屽叾浠�)
- */
- @Excel(name = "鏀舵鏂瑰紡", readConverterExp = "0=鐜伴噾,1=鏀エ,2=閾惰杞处,3=鍏朵粬")
- private String incomeMethod;
-
- /**
- * 鏀舵鏂瑰紡鏍囩
- */
- @TableField(exist = false)
- private String incomeMethodLabel;
-
- /**
- * payment_methods 瀛楀吀缂栫爜闆嗗悎锛坆usiness_type 涓虹┖鏃讹級
- */
- @TableField(exist = false)
- private List<String> paymentMethodList;
-
- /**
- * receipt_payment_type 瀛楀吀缂栫爜闆嗗悎锛坆usiness_type=1鏃讹級
- */
- @TableField(exist = false)
- private List<String> receiptPaymentMethodList;
-
- /**
- * 鍙戠エ鍙风爜
- */
- @Excel(name = "鍙戠エ鍙风爜")
- private String invoiceNumber;
-
- /**
- * 澶囨敞
- */
- @Excel(name = "澶囨敞")
- private String note;
-
- /**
- * 褰曞叆浜哄憳
- */
- @Excel(name = "褰曞叆浜哄憳")
- private String inputUser;
-
- /**
- * 褰曞叆鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "褰曞叆鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
- private Date inputTime;
-
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/account/pojo/AccountStatement.java b/src/main/java/com/ruoyi/account/pojo/AccountStatement.java
new file mode 100644
index 0000000..20d2495
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/AccountStatement.java
@@ -0,0 +1,127 @@
+package com.ruoyi.account.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 09:42:47
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_statement")
+@ApiModel(value = "AccountStatement瀵硅薄", description = "璐㈠姟绠$悊--瀵硅处鍗�")
+public class AccountStatement implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 瀹㈡埛id(搴旀敹鏄鎴穋ustomer,搴斾粯鏄緵搴斿晢supplier)
+ */
+ @ApiModelProperty("瀹㈡埛id")
+ private Integer customerId;
+
+ /**
+ * 瀵硅处鏈堜唤(yyyy-MM)
+ */
+ @ApiModelProperty("瀵硅处鏈堜唤(yyyy-MM)")
+ @Excel(name = "瀵硅处鏈堜唤")
+ private String statementMonth;
+
+ /**
+ * 涓氬姟绫诲瀷(1搴旀敹瀵硅处;2搴斾粯瀵硅处)
+ */
+ @ApiModelProperty("涓氬姟绫诲瀷(1搴旀敹瀵硅处;2搴斾粯瀵硅处)")
+ @Excel(name = "涓氬姟绫诲瀷",readConverterExp = "1=搴旀敹瀵硅处,2=搴斾粯瀵硅处")
+ private Integer accountType;
+
+ /**
+ * 瀵硅处鍗曞彿
+ */
+ @ApiModelProperty("瀵硅处鍗曞彿")
+ @Excel(name = "瀵硅处鍗曞彿")
+ private String statementNumber;
+
+ /**
+ * 鏈熷垵浣欓
+ */
+ @ApiModelProperty("鏈熷垵浣欓")
+ @Excel(name = "鏈熷垵浣欓")
+ private BigDecimal openingBalance;
+
+ /**
+ * 鏈湡搴旀敹/搴斾粯
+ */
+ @ApiModelProperty("鏈湡搴旀敹/搴斾粯")
+ @Excel(name = "鏈湡搴旀敹/搴斾粯")
+ private BigDecimal currentPlan;
+
+ /**
+ * 鏈湡鏀舵/浠樻
+ */
+ @ApiModelProperty("鏈湡鏀舵/浠樻")
+ @Excel(name = "鏈湡鏀舵/浠樻")
+ private BigDecimal currentActually;
+
+ /**
+ * 鏈熸湯浣欓
+ */
+ @ApiModelProperty("鏈熸湯浣欓")
+ @Excel(name = "鏈熸湯浣欓")
+ private BigDecimal closingBalance;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/AccountStatementDetails.java b/src/main/java/com/ruoyi/account/pojo/AccountStatementDetails.java
new file mode 100644
index 0000000..016a099
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/AccountStatementDetails.java
@@ -0,0 +1,115 @@
+package com.ruoyi.account.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--瀵硅处鍗曟槑缁�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 10:12:42
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_statement_details")
+@ApiModel(value = "AccountStatementDetails瀵硅薄", description = "璐㈠姟绠$悊--瀵硅处鍗曟槑缁�")
+public class AccountStatementDetails implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍏宠仈瀵硅处鍗昳d
+ */
+ @ApiModelProperty("鍏宠仈瀵硅处鍗昳d")
+ private Integer accountStatementId;
+
+ /**
+ * 鏁版嵁鏃ユ湡
+ */
+ @ApiModelProperty("鏁版嵁鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate occurrenceDate;
+
+ /**
+ * 鍗曟嵁缂栧彿
+ */
+ @ApiModelProperty("鍗曟嵁缂栧彿")
+ private String receiptNumber;
+
+ /**
+ * 鏁版嵁绫诲瀷(1鍑哄簱;2鍏ュ簱;3鏀舵;4浠樻;5閫�璐�)
+ */
+ @ApiModelProperty("鏁版嵁绫诲瀷(1鍑哄簱;2鍏ュ簱;3鏀舵;4浠樻;5閫�璐�)")
+ private Integer type;
+
+ /**
+ * 閲戦
+ */
+ @ApiModelProperty("閲戦")
+ private BigDecimal amount;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ private String remark;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/BorrowInfo.java b/src/main/java/com/ruoyi/account/pojo/BorrowInfo.java
deleted file mode 100644
index 8e4d809..0000000
--- a/src/main/java/com/ruoyi/account/pojo/BorrowInfo.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.ruoyi.account.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.format.annotation.DateTimeFormat;
-
-/**
- * <p>
- * 鍊熸淇℃伅琛�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-01-15 02:57:29
- */
-@Getter
-@Setter
-@TableName("borrow_info")
-@Schema(name = "BorrowInfo瀵硅薄", description = "鍊熸淇℃伅琛�")
-public class BorrowInfo extends DateQueryDto implements Serializable{
-
- private static final long serialVersionUID = 1L;
-
- @Schema(description = "鍊熸璁板綍涓婚敭ID")
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @Schema(description = "鍊熸浜哄鍚�")
- @Excel(name = "鍊熸浜哄鍚�")
- private String borrowerName;
-
- @Schema(description = "鍊熸閲戦锛堝厓锛�")
- @Excel(name = "鍊熸閲戦锛堝厓锛�")
- private BigDecimal borrowAmount;
-
- @Schema(description = "鍊熸鍒╃巼锛堝锛�5.85 浠h〃5.85%锛�")
- @Excel(name = "鍊熸鍒╃巼")
- private BigDecimal interestRate;
-
- @Schema(description = "鍊熸鏃ユ湡")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鍊熸鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
- private LocalDate borrowDate;
-
- @Schema(description = "瀹為檯杩樻鏃ユ湡锛堣繕娆惧悗濉厖锛�")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "瀹為檯杩樻鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
- private LocalDate repayDate;
-
- @Schema(description = "鍊熸鐘舵�侊細1=寰呰繕娆撅紝2=宸茶繕娆�")
- @Excel(name = "鍊熸鐘舵��", readConverterExp = "1=寰呰繕娆�,2=宸茶繕娆�")
- private Integer status;
-
- @Schema(description = "澶囨敞锛堝�熸璇存槑锛�")
- @Excel(name = "澶囨敞")
- private String remark;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鍒涘缓鑰匢D")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "淇敼鑰匢D")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛id")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/account/pojo/financial/AccountSubject.java b/src/main/java/com/ruoyi/account/pojo/financial/AccountSubject.java
new file mode 100644
index 0000000..2548a9c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/financial/AccountSubject.java
@@ -0,0 +1,117 @@
+package com.ruoyi.account.pojo.financial;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 鎬昏处绉戠洰琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_subject")
+@ApiModel(value = "AccountSubject瀵硅薄", description = "鎬昏处绉戠洰琛�")
+public class AccountSubject implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @ApiModelProperty("涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鐖剁鐩甀D锛堜负绌鸿〃绀烘牴鑺傜偣锛�
+ */
+ @ApiModelProperty("鐖剁鐩甀D锛堜负绌鸿〃绀烘牴鑺傜偣锛�")
+ private Long parentId;
+
+ /**
+ * 绉戠洰缂栫爜(鍞竴鏍囪瘑)
+ */
+ @ApiModelProperty("绉戠洰缂栫爜(鍞竴鏍囪瘑)")
+ private String subjectCode;
+
+ /**
+ * 绉戠洰鍚嶇О
+ */
+ @ApiModelProperty("绉戠洰鍚嶇О")
+ private String subjectName;
+
+ /**
+ * 绉戠洰绫诲瀷
+ */
+ @ApiModelProperty("绉戠洰绫诲瀷")
+ private String subjectType;
+
+ /**
+ * 浣欓鏂瑰悜
+ */
+ @ApiModelProperty("浣欓鏂瑰悜")
+ private String balanceDirection;
+
+ /**
+ * 鐘舵�� 0鍚敤 1绂佺敤
+ */
+ @ApiModelProperty("鐘舵�� 0鍚敤 1绂佺敤")
+ private Integer status;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ private String remark;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/financial/FinFixedAsset.java b/src/main/java/com/ruoyi/account/pojo/financial/FinFixedAsset.java
new file mode 100644
index 0000000..f11f700
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/financial/FinFixedAsset.java
@@ -0,0 +1,101 @@
+package com.ruoyi.account.pojo.financial;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 鍥哄畾璧勪骇瀹炰綋銆�
+ */
+@Getter
+@Setter
+@ToString
+@TableName("fin_fixed_asset")
+@ApiModel(value = "FinFixedAsset瀵硅薄", description = "鍥哄畾璧勪骇")
+public class FinFixedAsset implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty("涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty("璧勪骇缂栧彿")
+ private String assetCode;
+
+ @ApiModelProperty("璧勪骇鍚嶇О")
+ private String assetName;
+
+ @ApiModelProperty("璧勪骇绫诲埆")
+ private String category;
+
+ @ApiModelProperty("瑙勬牸鍨嬪彿")
+ private String specification;
+
+ @ApiModelProperty("璐疆鏃ユ湡")
+ private LocalDate purchaseDate;
+
+ @ApiModelProperty("璧勪骇鍘熷��")
+ private BigDecimal originalValue;
+
+ @ApiModelProperty("浣跨敤骞撮檺(骞�)")
+ private Integer usefulLife;
+
+ @ApiModelProperty("娈嬪�肩巼(%)")
+ private BigDecimal residualRate;
+
+ @ApiModelProperty("绱鎶樻棫")
+ private BigDecimal accumulatedDepreciation;
+
+ @ApiModelProperty("鍑�鍊�")
+ private BigDecimal netValue;
+
+ @ApiModelProperty("瀛樻斁鍦扮偣")
+ private String location;
+
+ @ApiModelProperty("浣跨敤閮ㄩ棬")
+ private String department;
+
+ @ApiModelProperty("淇濈浜�")
+ private String keeper;
+
+ @ApiModelProperty("鐘舵��")
+ private String status;
+
+ @ApiModelProperty("澶囨敞")
+ private String remark;
+
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private String createUser;
+
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private String updateUser;
+
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/financial/FinIntangibleAsset.java b/src/main/java/com/ruoyi/account/pojo/financial/FinIntangibleAsset.java
new file mode 100644
index 0000000..e8ab4d3
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/financial/FinIntangibleAsset.java
@@ -0,0 +1,98 @@
+package com.ruoyi.account.pojo.financial;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 鏃犲舰璧勪骇瀹炰綋銆�
+ */
+@Getter
+@Setter
+@ToString
+@TableName("fin_intangible_asset")
+@ApiModel(value = "FinIntangibleAsset瀵硅薄", description = "鏃犲舰璧勪骇")
+public class FinIntangibleAsset implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty("涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty("璧勪骇缂栧彿")
+ private String assetCode;
+
+ @ApiModelProperty("璧勪骇鍚嶇О")
+ private String assetName;
+
+ @ApiModelProperty("璧勪骇绫诲埆")
+ private String category;
+
+ @ApiModelProperty("璇佷功缂栧彿")
+ private String certificateNo;
+
+ @ApiModelProperty("鍙栧緱鏃ユ湡")
+ private LocalDate acquisitionDate;
+
+ @ApiModelProperty("璧勪骇鍘熷��")
+ private BigDecimal originalValue;
+
+ @ApiModelProperty("鎽婇攢骞撮檺(骞�)")
+ private Integer amortizationPeriod;
+
+ @ApiModelProperty("娈嬪�肩巼(%)")
+ private BigDecimal residualRate;
+
+ @ApiModelProperty("绱鎽婇攢")
+ private BigDecimal accumulatedAmortization;
+
+ @ApiModelProperty("鍑�鍊�")
+ private BigDecimal netValue;
+
+ @ApiModelProperty("鏈夋晥鏈熻嚦")
+ private LocalDate validityDate;
+
+ @ApiModelProperty("鐘舵��")
+ private String status;
+
+ @ApiModelProperty("璧勪骇鎻忚堪")
+ private String description;
+
+ @ApiModelProperty("澶囨敞")
+ private String remark;
+
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private String createUser;
+
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private String updateUser;
+
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/financial/FinVoucher.java b/src/main/java/com/ruoyi/account/pojo/financial/FinVoucher.java
new file mode 100644
index 0000000..0a2918c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/financial/FinVoucher.java
@@ -0,0 +1,83 @@
+package com.ruoyi.account.pojo.financial;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 鍑瘉涓昏〃瀹炰綋銆�
+ */
+@Getter
+@Setter
+@ToString
+@TableName("fin_voucher")
+@ApiModel(value = "FinVoucher瀵硅薄", description = "鍑瘉涓昏〃")
+public class FinVoucher implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty("涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty("鍑瘉瀛楀彿")
+ private String voucherNo;
+
+ @ApiModelProperty("鍑瘉鏃ユ湡")
+ private LocalDate voucherDate;
+
+ @ApiModelProperty("鎽樿")
+ private String summary;
+
+ @ApiModelProperty("鍊熸柟鍚堣")
+ private BigDecimal debit;
+
+ @ApiModelProperty("璐锋柟鍚堣")
+ private BigDecimal credit;
+
+ @ApiModelProperty("鍒跺崟浜�")
+ private String creator;
+
+ @ApiModelProperty("鐘舵��: unposted/posted/cancelled")
+ private String status;
+
+ @ApiModelProperty("闄勪欢鏁伴噺")
+ private Integer attachmentCount;
+
+ @ApiModelProperty("澶囨敞")
+ private String remark;
+
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private String createUser;
+
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private String updateUser;
+
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/financial/FinVoucherEntry.java b/src/main/java/com/ruoyi/account/pojo/financial/FinVoucherEntry.java
new file mode 100644
index 0000000..44ac56e
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/financial/FinVoucherEntry.java
@@ -0,0 +1,85 @@
+package com.ruoyi.account.pojo.financial;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 鍑瘉鍒嗗綍瀹炰綋銆�
+ */
+@Getter
+@Setter
+@ToString
+@TableName("fin_voucher_entry")
+@ApiModel(value = "FinVoucherEntry瀵硅薄", description = "鍑瘉鍒嗗綍")
+public class FinVoucherEntry implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty("涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty("鍑瘉ID")
+ private Long voucherId;
+
+ @ApiModelProperty("琛屽彿")
+ private Integer rowNo;
+
+ @ApiModelProperty("绉戠洰缂栫爜")
+ private String subjectCode;
+
+ @ApiModelProperty("绉戠洰鍚嶇О")
+ private String subjectName;
+
+ @ApiModelProperty("鎽樿")
+ private String summary;
+
+ @ApiModelProperty("鍊熸柟閲戦")
+ private BigDecimal debit;
+
+ @ApiModelProperty("璐锋柟閲戦")
+ private BigDecimal credit;
+
+ @ApiModelProperty("杈呭姪鏍哥畻绫诲瀷")
+ private String auxiliaryType;
+
+ @ApiModelProperty("杈呭姪鏍哥畻瀵硅薄ID")
+ private String auxiliaryId;
+
+ @ApiModelProperty("杈呭姪鏍哥畻瀵硅薄鍚嶇О")
+ private String auxiliaryName;
+
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private String createUser;
+
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private String updateUser;
+
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/purchase/AccountPaymentApplication.java b/src/main/java/com/ruoyi/account/pojo/purchase/AccountPaymentApplication.java
new file mode 100644
index 0000000..9a01df7
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/purchase/AccountPaymentApplication.java
@@ -0,0 +1,141 @@
+package com.ruoyi.account.pojo.purchase;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鐢宠
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:44:22
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_payment_application")
+@ApiModel(value = "AccountPaymentApplication瀵硅薄", description = "璐㈠姟绠$悊--浠樻鐢宠")
+public class AccountPaymentApplication implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 渚涘簲鍟唅d
+ */
+ @ApiModelProperty("渚涘簲鍟唅d")
+ private Integer supplierId;
+
+ /**
+ * 鍏宠仈鍏ュ簱鍗昳d(澶氶��)
+ */
+ @ApiModelProperty("鍏宠仈鍏ュ簱鍗昳d(澶氶��)")
+ private String stockInRecordIds;
+
+ /**
+ * 浠樻鐢宠鍗曞彿
+ */
+ @ApiModelProperty("浠樻鐢宠鍗曞彿")
+ @Excel(name = "浠樻鐢宠鍗曞彿")
+ private String invoiceApplicationNo;
+
+ /**
+ * 浠樻鏂瑰紡
+ */
+ @ApiModelProperty("浠樻鏂瑰紡")
+ @Excel(name = "浠樻鏂瑰紡")
+ private String paymentMethod;
+
+ /**
+ * 浠樻浜嬬敱
+ */
+ @ApiModelProperty("浠樻浜嬬敱")
+ @Excel(name = "浠樻浜嬬敱")
+ private String paymentContent;
+
+ /**
+ * 鐢宠鏃ユ湡
+ */
+ @ApiModelProperty("鐢宠鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "鐢宠鏃ユ湡")
+ private LocalDate applyDate;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+
+ /**
+ * 瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃
+ */
+ @ApiModelProperty("瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃")
+ @Excel(name = "瀹℃牳鐘舵��",readConverterExp = "0=寰呭鏍�,1=瀹℃牳閫氳繃,2=瀹℃牳涓嶉�氳繃")
+ private Integer status;
+
+ /**
+ * 浠樻閲戦
+ */
+ @ApiModelProperty("浠樻閲戦")
+ @Excel(name = "浠樻閲戦")
+ private BigDecimal paymentAmount;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchaseInvoice.java b/src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchaseInvoice.java
new file mode 100644
index 0000000..c71ecd0
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchaseInvoice.java
@@ -0,0 +1,168 @@
+package com.ruoyi.account.pojo.purchase;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--杩涢」鍙戠エ
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:06:17
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_purchase_invoice")
+@ApiModel(value = "AccountPurchaseInvoice瀵硅薄", description = "璐㈠姟绠$悊--杩涢」鍙戠エ")
+public class AccountPurchaseInvoice implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 鍙戠エ鍙风爜
+ */
+ @ApiModelProperty("鍙戠エ鍙风爜")
+ @Excel(name = "鍙戠エ鍙风爜")
+ private String invoiceNumber;
+
+ /**
+ * 绋庣巼
+ */
+ @ApiModelProperty("绋庣巼")
+ @Excel(name = "绋庣巼")
+ private Integer taxRate;
+
+ /**
+ * 鍙戠エ绫诲瀷
+ */
+ @ApiModelProperty("鍙戠エ绫诲瀷")
+ @Excel(name = "鍙戠エ绫诲瀷")
+ private String invoiceType;
+
+ /**
+ * 寮�绁ㄦ棩鏈�
+ */
+ @ApiModelProperty("寮�绁ㄦ棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "寮�绁ㄦ棩鏈�")
+ private LocalDate issueDate;
+
+ /**
+ * 閲戦(涓嶅惈绋�)
+ */
+ @ApiModelProperty("閲戦(涓嶅惈绋�)")
+ @Excel(name = "閲戦(涓嶅惈绋�)")
+ private BigDecimal taxExclusivelPrice;
+
+ /**
+ * 绋庨
+ */
+ @ApiModelProperty("绋庨")
+ @Excel(name = "绋庨")
+ private BigDecimal taxPrice;
+
+ /**
+ * 浠风◣鍚堣
+ */
+ @ApiModelProperty("浠风◣鍚堣")
+ @Excel(name = "浠风◣鍚堣")
+ private BigDecimal taxInclusivePrice;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+
+ /**
+ * 鍙戠エ鍐呭
+ */
+ @ApiModelProperty("鍙戠エ鍐呭")
+ @Excel(name = "鍙戠エ鍐呭")
+ private String invoiceContent;
+
+ /**
+ * 渚涘簲鍟唅d
+ */
+ @ApiModelProperty("渚涘簲鍟唅d")
+ private Integer supplierId;
+
+ /**
+ * 鍏宠仈涓婁紶鐨勫彂绁ㄩ檮浠秈d
+ */
+ @ApiModelProperty("鍏宠仈涓婁紶鐨勫彂绁ㄩ檮浠秈d")
+ private Integer storageAttachmentId;
+
+ /**
+ * 鍏宠仈鍏ュ簱鍗昳d(澶氶��)
+ */
+ @ApiModelProperty("鍏宠仈鍏ュ簱鍗昳d(澶氶��)")
+ private String stockInRecordIds;
+
+ /**
+ * 鐘舵�� 0鍚敤 1绂佺敤
+ */
+ @ApiModelProperty("鐘舵�� 0鍚敤 1绂佺敤")
+ @Excel(name = "鐘舵��", readConverterExp = "0=姝e父,1=浣滃簾")
+ private Integer status;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchasePayment.java b/src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchasePayment.java
new file mode 100644
index 0000000..7fc2d4e
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/purchase/AccountPurchasePayment.java
@@ -0,0 +1,127 @@
+package com.ruoyi.account.pojo.purchase;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鍗�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 04:14:51
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_purchase_payment")
+@ApiModel(value = "AccountPurchasePayment瀵硅薄", description = "璐㈠姟绠$悊--浠樻鍗�")
+public class AccountPurchasePayment implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍏宠仈浠樻鐢宠id
+ */
+ @ApiModelProperty("鍏宠仈浠樻鐢宠id")
+ private Integer accountPaymentApplicationId;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 渚涘簲鍟唅d
+ */
+ @ApiModelProperty("渚涘簲鍟唅d")
+ private Integer supplierId;
+
+ /**
+ * 浠樻鏃ユ湡
+ */
+ @ApiModelProperty("浠樻鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "浠樻鏃ユ湡")
+ private LocalDate paymentDate;
+
+ /**
+ * 浠樻鏂瑰紡
+ */
+ @ApiModelProperty("浠樻鏂瑰紡")
+ @Excel(name = "浠樻鏂瑰紡",dictType = "checkout_payment")
+ private String paymentMethod;
+
+ /**
+ * 浠樻閲戦
+ */
+ @ApiModelProperty("浠樻閲戦")
+ @Excel(name = "浠樻閲戦")
+ private BigDecimal paymentAmount;
+
+ /**
+ * 浠樻鍗曞彿
+ */
+ @ApiModelProperty("浠樻鍗曞彿")
+ @Excel(name = "浠樻鍗曞彿")
+ private String paymentNumber;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/sales/AccountInvoiceApplication.java b/src/main/java/com/ruoyi/account/pojo/sales/AccountInvoiceApplication.java
new file mode 100644
index 0000000..ed4b72a
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/sales/AccountInvoiceApplication.java
@@ -0,0 +1,138 @@
+package com.ruoyi.account.pojo.sales;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--寮�绁ㄧ敵璇�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 01:38:32
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_invoice_application")
+@ApiModel(value = "AccountInvoiceApplication瀵硅薄", description = "璐㈠姟绠$悊--寮�绁ㄧ敵璇�")
+public class AccountInvoiceApplication implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 瀹㈡埛id
+ */
+ @ApiModelProperty("瀹㈡埛id")
+ private Integer customerId;
+
+ /**
+ * 鍏宠仈鍑哄簱鍗昳d(澶氶��)
+ */
+ @ApiModelProperty("鍏宠仈鍑哄簱鍗昳d(澶氶��)")
+ private String stockOutRecordIds;
+
+ /**
+ * 寮�绁ㄧ敵璇峰崟鍙�
+ */
+ @ApiModelProperty("寮�绁ㄧ敵璇峰崟鍙�")
+ @Excel(name = "寮�绁ㄧ敵璇峰崟鍙�")
+ private String invoiceApplicationNo;
+
+ /**
+ * 鍙戠エ绫诲瀷
+ */
+ @ApiModelProperty("鍙戠エ绫诲瀷")
+ @Excel(name = "鍙戠エ绫诲瀷")
+ private String invoiceType;
+
+ /**
+ * 鐢宠鏃ユ湡
+ */
+ @ApiModelProperty("鐢宠鏃ユ湡")
+ @Excel(name = "鐢宠鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate applyDate;
+
+ /**
+ * 鍙戠エ鍐呭
+ */
+ @ApiModelProperty("鍙戠エ鍐呭")
+ @Excel(name = "鍙戠エ鍐呭")
+ private String invoiceContent;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+
+ /**
+ * 瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃
+ */
+ @ApiModelProperty("瀹℃牳鐘舵��:0寰呭鏍�1瀹℃牳閫氳繃2瀹℃牳涓嶉�氳繃")
+ @Excel(name = "瀹℃牳鐘舵��",readConverterExp = "0=寰呭鏍�,1=瀹℃牳閫氳繃,2=瀹℃牳涓嶉�氳繃")
+ private Integer status;
+
+ @ApiModelProperty("寮�绁ㄩ噾棰�")
+ @Excel(name = "寮�绁ㄩ噾棰�")
+ private BigDecimal invoiceAmount;
+
+ @ApiModelProperty("绋庣巼")
+ @Excel(name = "绋庣巼")
+ private BigDecimal taxRate;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/sales/AccountSalesCollection.java b/src/main/java/com/ruoyi/account/pojo/sales/AccountSalesCollection.java
new file mode 100644
index 0000000..40ea9a8
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/sales/AccountSalesCollection.java
@@ -0,0 +1,127 @@
+package com.ruoyi.account.pojo.sales;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--鏀舵鍗�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:49:56
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_sales_collection")
+@ApiModel(value = "AccountSalesCollection瀵硅薄", description = "璐㈠姟绠$悊--鏀舵鍗�")
+public class AccountSalesCollection implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍏宠仈鍑哄簱鍗昳d(澶氶��)
+ */
+ @ApiModelProperty("鍏宠仈鍑哄簱鍗昳d(澶氶��)")
+ private String stockOutRecordIds;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 瀹㈡埛id
+ */
+ @ApiModelProperty("瀹㈡埛id")
+ private Integer customerId;
+
+ /**
+ * 鏀舵鏃ユ湡
+ */
+ @ApiModelProperty("鏀舵鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "鏀舵鏃ユ湡")
+ private LocalDate collectionDate;
+
+ /**
+ * 鏀舵閲戦
+ */
+ @ApiModelProperty("鏀舵閲戦")
+ @Excel(name = "鏀舵閲戦")
+ private BigDecimal collectionAmount;
+
+ /**
+ * 鏀舵鏂瑰紡
+ */
+ @ApiModelProperty("鏀舵鏂瑰紡")
+ @Excel(name = "鏀舵鏂瑰紡",dictType = "payment_methods")
+ private String collectionMethod;
+
+ /**
+ * 鏀舵鍗曞彿
+ */
+ @ApiModelProperty("鏀舵鍗曞彿")
+ @Excel(name = "鏀舵鍗曞彿")
+ private String collectionNumber;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+}
diff --git a/src/main/java/com/ruoyi/account/pojo/sales/AccountSalesInvoice.java b/src/main/java/com/ruoyi/account/pojo/sales/AccountSalesInvoice.java
new file mode 100644
index 0000000..7551cb3
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/pojo/sales/AccountSalesInvoice.java
@@ -0,0 +1,168 @@
+package com.ruoyi.account.pojo.sales;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--閿�椤瑰彂绁�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:10:20
+ */
+@Getter
+@Setter
+@ToString
+@TableName("account_sales_invoice")
+@ApiModel(value = "AccountSalesInvoice瀵硅薄", description = "璐㈠姟绠$悊--閿�椤瑰彂绁�")
+public class AccountSalesInvoice implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍏宠仈寮�绁ㄧ敵璇穒d
+ */
+ @ApiModelProperty("鍏宠仈寮�绁ㄧ敵璇穒d")
+ private Integer accountInvoiceApplicationId;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @ApiModelProperty("鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼浜�
+ */
+ @ApiModelProperty("淇敼浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty("淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 鍙戠エ鍙风爜
+ */
+ @ApiModelProperty("鍙戠エ鍙风爜")
+ @Excel(name = "鍙戠エ鍙风爜")
+ private String invoiceNumber;
+
+ /**
+ * 绋庣巼
+ */
+ @ApiModelProperty("绋庣巼")
+ @Excel(name = "绋庣巼")
+ private BigDecimal taxRate;
+
+ /**
+ * 鍙戠エ绫诲瀷
+ */
+ @ApiModelProperty("鍙戠エ绫诲瀷")
+ @Excel(name = "鍙戠エ绫诲瀷")
+ private String invoiceType;
+
+ /**
+ * 寮�绁ㄦ棩鏈�
+ */
+ @ApiModelProperty("寮�绁ㄦ棩鏈�")
+ @Excel(name = "寮�绁ㄦ棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate issueDate;
+
+ /**
+ * 閲戦(涓嶅惈绋�)
+ */
+ @ApiModelProperty("閲戦(涓嶅惈绋�)")
+ @Excel(name = "閲戦(涓嶅惈绋�)")
+ private BigDecimal taxExclusivelPrice;
+
+ /**
+ * 绋庨
+ */
+ @ApiModelProperty("绋庨")
+ @Excel(name = "绋庨")
+ private BigDecimal taxPrice;
+
+ /**
+ * 浠风◣鍚堣
+ */
+ @ApiModelProperty("浠风◣鍚堣")
+ @Excel(name = "浠风◣鍚堣")
+ private BigDecimal taxInclusivePrice;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty("澶囨敞")
+ @Excel(name = "澶囨敞")
+ private String remark;
+
+ /**
+ * 鍙戠エ鍐呭
+ */
+ @ApiModelProperty("鍙戠エ鍐呭")
+ @Excel(name = "鍙戠エ鍐呭")
+ private String invoiceContent;
+
+ /**
+ * 瀹㈡埛id
+ */
+ @ApiModelProperty("瀹㈡埛id")
+ private Integer customerId;
+
+ /**
+ * 鍏宠仈涓婁紶鐨勫彂绁ㄩ檮浠秈d
+ */
+ @ApiModelProperty("鍏宠仈涓婁紶鐨勫彂绁ㄩ檮浠秈d")
+ private Integer storageAttachmentId;
+
+ /**
+ * 鐘舵�� 0鍚敤 1绂佺敤
+ */
+ @ApiModelProperty("鐘舵�� 0鍚敤 1绂佺敤")
+ @Excel(name = "鐘舵��", readConverterExp = "0=姝e父,1=浣滃簾")
+ private Integer status;
+}
diff --git a/src/main/java/com/ruoyi/account/service/AccountExpenseService.java b/src/main/java/com/ruoyi/account/service/AccountExpenseService.java
deleted file mode 100644
index 4997c23..0000000
--- a/src/main/java/com/ruoyi/account/service/AccountExpenseService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.ruoyi.account.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.account.dto.AccountDto;
-import com.ruoyi.account.dto.AccountDto2;
-import com.ruoyi.account.dto.AccountDto3;
-import com.ruoyi.account.dto.ReportDateDto;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.dto.DateQueryDto;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.Map;
-
-public interface AccountExpenseService extends IService<AccountExpense> {
-
- IPage<AccountExpense> accountExpenseListPage(Page page, AccountExpense accountExpense);
-
- void accountExpenseExport(HttpServletResponse response, AccountExpense accountExpense);
-
- AccountDto report(DateQueryDto dateQueryDto);
-
- List<AccountDto3> reportExpense(ReportDateDto reportDateDto);
-
- Map<String,List<String>> analysis();
-
- AccountExpense getByInvoiceNumber(String purchaseContractNumber);
-
- List<AccountExpense> getByInvoiceNumberList(String purchaseContractNumber);
-}
diff --git a/src/main/java/com/ruoyi/account/service/AccountFileService.java b/src/main/java/com/ruoyi/account/service/AccountFileService.java
deleted file mode 100644
index fe24512..0000000
--- a/src/main/java/com/ruoyi/account/service/AccountFileService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ruoyi.account.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.account.pojo.AccountFile;
-import com.ruoyi.quality.pojo.QualityInspectFile;
-
-public interface AccountFileService extends IService<AccountFile> {
-
-
- IPage<AccountFile> accountFileListPage(Page page, AccountFile accountFile);
-}
diff --git a/src/main/java/com/ruoyi/account/service/AccountIncomeService.java b/src/main/java/com/ruoyi/account/service/AccountIncomeService.java
deleted file mode 100644
index 33bb02f..0000000
--- a/src/main/java/com/ruoyi/account/service/AccountIncomeService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.ruoyi.account.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.account.dto.AccountDto2;
-import com.ruoyi.account.dto.AccountDto3;
-import com.ruoyi.account.dto.ReportDateDto;
-import com.ruoyi.account.pojo.AccountIncome;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.List;
-
-public interface AccountIncomeService extends IService<AccountIncome> {
-
-
- IPage<AccountIncome> accountIncomeListPage(Page page, AccountIncome accountIncome);
-
- void accountIncomeExport(HttpServletResponse response, AccountIncome accountIncome);
-
- List<AccountDto3> reportIncome(ReportDateDto reportDateDto);
-
- AccountIncome getByInvoiceNumber(String purchaseContractNumber);
-
- List<AccountIncome> getByInvoiceNumberList(String purchaseContractNumber);
-}
diff --git a/src/main/java/com/ruoyi/account/service/AccountStatementDetailsService.java b/src/main/java/com/ruoyi/account/service/AccountStatementDetailsService.java
new file mode 100644
index 0000000..c9a4928
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/AccountStatementDetailsService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.account.service;
+
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--瀵硅处鍗曟槑缁� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 10:12:42
+ */
+public interface AccountStatementDetailsService extends IService<AccountStatementDetails> {
+
+}
diff --git a/src/main/java/com/ruoyi/account/service/AccountStatementService.java b/src/main/java/com/ruoyi/account/service/AccountStatementService.java
new file mode 100644
index 0000000..a0bc218
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/AccountStatementService.java
@@ -0,0 +1,32 @@
+package com.ruoyi.account.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.account.bean.dto.StatementAccountDto;
+import com.ruoyi.account.bean.vo.StatementAccountVo;
+import com.ruoyi.account.pojo.AccountStatement;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 09:42:47
+ */
+public interface AccountStatementService extends IService<AccountStatement> {
+
+ StatementAccountVo getAccountStatementDetailsByMonth(StatementAccountDto statementAccountDto);
+
+ boolean addAccountStatement(StatementAccountVo statementAccountVo);
+
+ boolean deleteAccountStatement(List<Long> ids);
+
+ IPage<StatementAccountVo> listPageAccountStatement(Page page, StatementAccountDto statementAccountDto);
+
+ void exportAccountStatement(HttpServletResponse response, StatementAccountDto statementAccountDto);
+}
diff --git a/src/main/java/com/ruoyi/account/service/AccountingService.java b/src/main/java/com/ruoyi/account/service/AccountingService.java
new file mode 100644
index 0000000..6190dc8
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/AccountingService.java
@@ -0,0 +1,19 @@
+package com.ruoyi.account.service;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.AccountReportDto;
+import com.ruoyi.account.bean.vo.AccountReportVo;
+import com.ruoyi.framework.web.domain.AjaxResult;
+
+public interface AccountingService {
+
+ AjaxResult total(Integer year);
+
+ AjaxResult deviceTypeDistribution(Integer year);
+
+ AjaxResult calculateDepreciation(Page page, Integer year);
+
+ AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto);
+
+}
diff --git a/src/main/java/com/ruoyi/account/service/BorrowInfoService.java b/src/main/java/com/ruoyi/account/service/BorrowInfoService.java
deleted file mode 100644
index eb1c83b..0000000
--- a/src/main/java/com/ruoyi/account/service/BorrowInfoService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.ruoyi.account.service;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.pojo.BorrowInfo;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-
-import java.util.List;
-
-/**
- * <p>
- * 鍊熸淇℃伅琛� 鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-01-15 02:57:29
- */
-public interface BorrowInfoService extends IService<BorrowInfo> {
-
- AjaxResult listPage(Page page, BorrowInfo borrowInfo);
-
- AjaxResult add(BorrowInfo borrowInfo);
-
- AjaxResult updateBorrowInfo(BorrowInfo borrowInfo);
-
- AjaxResult delete(List<Long> ids);
-}
diff --git a/src/main/java/com/ruoyi/account/service/SalesReceiptReturnService.java b/src/main/java/com/ruoyi/account/service/SalesReceiptReturnService.java
index 77c6aa9..456415d 100644
--- a/src/main/java/com/ruoyi/account/service/SalesReceiptReturnService.java
+++ b/src/main/java/com/ruoyi/account/service/SalesReceiptReturnService.java
@@ -1,7 +1,7 @@
package com.ruoyi.account.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.account.dto.SalesReceiptReturnDto;
+import com.ruoyi.account.bean.dto.SalesReceiptReturnDto;
import com.ruoyi.account.pojo.SalesReceiptReturn;
import com.baomidou.mybatisplus.extension.service.IService;
diff --git a/src/main/java/com/ruoyi/account/service/SalesRefundAmountOrderService.java b/src/main/java/com/ruoyi/account/service/SalesRefundAmountOrderService.java
index bf45755..4465913 100644
--- a/src/main/java/com/ruoyi/account/service/SalesRefundAmountOrderService.java
+++ b/src/main/java/com/ruoyi/account/service/SalesRefundAmountOrderService.java
@@ -2,7 +2,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.SalesRefundAmountOrderDto;
+import com.ruoyi.account.bean.dto.SalesRefundAmountOrderDto;
import com.ruoyi.account.pojo.SalesRefundAmountOrder;
import com.baomidou.mybatisplus.extension.service.IService;
diff --git a/src/main/java/com/ruoyi/account/service/financial/AccountPurchaseService.java b/src/main/java/com/ruoyi/account/service/financial/AccountPurchaseService.java
new file mode 100644
index 0000000..b7a6cfd
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/financial/AccountPurchaseService.java
@@ -0,0 +1,27 @@
+package com.ruoyi.account.service.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto;
+import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊鐨勯攢鍞儴鍒� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+public interface AccountPurchaseService {
+ IPage<PurchaseInboundVo> listPageAccountPurchase(Page page, PurchaseInboundDto purchaseInboundDto);
+
+ void exportAccountPurchaseInbound(HttpServletResponse response, PurchaseInboundDto purchaseInboundDto);
+
+ IPage<PurchaseReturnVo> listPageAccountPurchaseReturn(Page page, PurchaseReturnDto purchaseReturnDto);
+
+ void exportAccountPurchaseReturn(HttpServletResponse response, PurchaseReturnDto purchaseReturnDto);
+}
diff --git a/src/main/java/com/ruoyi/account/service/financial/FinFixedAssetService.java b/src/main/java/com/ruoyi/account/service/financial/FinFixedAssetService.java
new file mode 100644
index 0000000..0b2c1cc
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/financial/FinFixedAssetService.java
@@ -0,0 +1,26 @@
+package com.ruoyi.account.service.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.account.bean.dto.financial.FinFixedAssetDto;
+import com.ruoyi.account.pojo.financial.FinFixedAsset;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鍥哄畾璧勪骇鏈嶅姟銆�
+ */
+public interface FinFixedAssetService extends IService<FinFixedAsset> {
+
+ IPage<FinFixedAsset> pageList(Page<FinFixedAsset> page, FinFixedAssetDto queryDto);
+
+ Boolean add(FinFixedAssetDto dto);
+
+ Boolean update(FinFixedAssetDto dto);
+
+ Boolean deleteByIds(List<Long> ids);
+
+ Map<String, Object> depreciate(List<Long> ids);
+}
diff --git a/src/main/java/com/ruoyi/account/service/financial/FinIntangibleAssetService.java b/src/main/java/com/ruoyi/account/service/financial/FinIntangibleAssetService.java
new file mode 100644
index 0000000..46d946a
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/financial/FinIntangibleAssetService.java
@@ -0,0 +1,26 @@
+package com.ruoyi.account.service.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.account.bean.dto.financial.FinIntangibleAssetDto;
+import com.ruoyi.account.pojo.financial.FinIntangibleAsset;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏃犲舰璧勪骇鏈嶅姟銆�
+ */
+public interface FinIntangibleAssetService extends IService<FinIntangibleAsset> {
+
+ IPage<FinIntangibleAsset> pageList(Page<FinIntangibleAsset> page, FinIntangibleAssetDto queryDto);
+
+ Boolean add(FinIntangibleAssetDto dto);
+
+ Boolean update(FinIntangibleAssetDto dto);
+
+ Boolean deleteByIds(List<Long> ids);
+
+ Map<String, Object> amortize(List<Long> ids);
+}
diff --git a/src/main/java/com/ruoyi/account/service/financial/FinLedgerService.java b/src/main/java/com/ruoyi/account/service/financial/FinLedgerService.java
new file mode 100644
index 0000000..c4e9fa4
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/financial/FinLedgerService.java
@@ -0,0 +1,17 @@
+package com.ruoyi.account.service.financial;
+
+import com.ruoyi.account.bean.dto.financial.FinDetailLedgerQueryDto;
+import com.ruoyi.account.bean.dto.financial.FinLedgerQueryDto;
+import com.ruoyi.account.bean.vo.financial.FinLedgerRowVo;
+
+import java.util.List;
+
+/**
+ * 绉戠洰璐︽湇鍔°��
+ */
+public interface FinLedgerService {
+
+ List<FinLedgerRowVo> queryGeneralLedger(FinLedgerQueryDto queryDto);
+
+ List<FinLedgerRowVo> queryDetailLedger(FinDetailLedgerQueryDto queryDto);
+}
diff --git a/src/main/java/com/ruoyi/account/service/financial/FinVoucherService.java b/src/main/java/com/ruoyi/account/service/financial/FinVoucherService.java
new file mode 100644
index 0000000..078bac4
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/financial/FinVoucherService.java
@@ -0,0 +1,27 @@
+package com.ruoyi.account.service.financial;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.account.bean.dto.financial.FinVoucherDto;
+import com.ruoyi.account.bean.dto.financial.FinVoucherPageDto;
+import com.ruoyi.account.bean.vo.financial.FinVoucherDetailVo;
+import com.ruoyi.account.pojo.financial.FinVoucher;
+
+/**
+ * 鍑瘉鏈嶅姟銆�
+ */
+public interface FinVoucherService extends IService<FinVoucher> {
+
+ IPage<FinVoucher> pageList(Page<FinVoucher> page, FinVoucherPageDto queryDto);
+
+ Boolean addVoucher(FinVoucherDto dto);
+
+ Boolean updateVoucher(FinVoucherDto dto);
+
+ Boolean postVoucher(Long id);
+
+ Boolean cancelVoucher(Long id);
+
+ FinVoucherDetailVo detail(Long id);
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountExpenseServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountExpenseServiceImpl.java
deleted file mode 100644
index 40b1f31..0000000
--- a/src/main/java/com/ruoyi/account/service/impl/AccountExpenseServiceImpl.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package com.ruoyi.account.service.impl;
-
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.dto.AccountDto;
-import com.ruoyi.account.dto.AccountDto2;
-import com.ruoyi.account.dto.AccountDto3;
-import com.ruoyi.account.dto.ReportDateDto;
-import com.ruoyi.account.mapper.AccountExpenseMapper;
-import com.ruoyi.account.mapper.AccountIncomeMapper;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.account.service.AccountExpenseService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.project.system.domain.SysDictData;
-import com.ruoyi.project.system.mapper.SysDictDataMapper;
-import lombok.AllArgsConstructor;
-import org.springframework.stereotype.Service;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.math.BigDecimal;
-import java.time.DayOfWeek;
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-import java.util.stream.Collectors;
-
-@AllArgsConstructor
-@Service
-public class AccountExpenseServiceImpl extends ServiceImpl<AccountExpenseMapper, AccountExpense> implements AccountExpenseService {
-
- private AccountExpenseMapper accountExpenseMapper;
-
- private AccountIncomeMapper accountIncomeMapper;
-
- private SysDictDataMapper sysDictDataMapper;
-
-
- //鍒嗛〉鏌ヨ
- @Override
- public IPage<AccountExpense> accountExpenseListPage(Page page, AccountExpense accountExpense) {
- return accountExpenseMapper.accountExpenseListPage(page,accountExpense);
- }
-
- //瀵煎嚭
- @Override
- public void accountExpenseExport(HttpServletResponse response, AccountExpense accountExpense) {
- List<AccountExpense> accountExpenses =accountExpenseMapper.accountExpenseExport(accountExpense);
- ExcelUtil<AccountExpense> util = new ExcelUtil<AccountExpense>(AccountExpense.class);
- util.exportExcel(response, accountExpenses, "鏀嚭绠$悊瀵煎嚭");
- }
-
- //璐㈠姟鎶ヨ〃鍥捐〃
- @Override
- public AccountDto report(DateQueryDto dateQueryDto) {
- AccountDto accountDto = new AccountDto();
- //鑾峰彇璇ユ鏃堕棿鍐呯殑鎵�鏈夋敹鍏�
- List<AccountDto2> accountIncomes =accountIncomeMapper.report(dateQueryDto);
-
- Long incomeNumber = accountIncomeMapper.selectCount(Wrappers.<AccountIncome>lambdaQuery()
- .between(AccountIncome::getIncomeDate, dateQueryDto.getEntryDateStart(), dateQueryDto.getEntryDateEnd()));
- accountDto.setIncomeNumber(incomeNumber);
- BigDecimal totalIncome = accountIncomes.stream().map(AccountDto2::getAccount).reduce(BigDecimal.ZERO, BigDecimal::add);
- accountDto.setTotalIncome(totalIncome);
- accountIncomes.stream().forEach(accountDto2 -> {
- accountDto2.setProportion(accountDto2.getAccount().divide(totalIncome,2,BigDecimal.ROUND_HALF_UP));
- });
- accountDto.setIncomeType(accountIncomes);
- //鑾峰彇璇ユ鏃堕棿鍐呯殑鎵�鏈夋敮鍑�
- List<AccountDto2> accountExpenses =accountExpenseMapper.report(dateQueryDto);
- accountDto.setExpenseType(accountExpenses);
- Long expenseNumber = accountExpenseMapper.selectCount(Wrappers.<AccountExpense>lambdaQuery()
- .between(AccountExpense::getExpenseDate, dateQueryDto.getEntryDateStart(), dateQueryDto.getEntryDateEnd()));
- accountDto.setExpenseNumber(expenseNumber);
- BigDecimal totalExpense = accountExpenses.stream().map(AccountDto2::getAccount).reduce(BigDecimal.ZERO, BigDecimal::add);
- accountDto.setTotalExpense(totalExpense);
- accountExpenses.stream().forEach(accountDto2 -> {
- accountDto2.setProportion(accountDto2.getAccount().divide(totalExpense,2,BigDecimal.ROUND_HALF_UP));
- });
- accountDto.setExpenseType(accountExpenses);
- //鍑�鏀跺叆
- BigDecimal netRevenue = totalIncome.subtract(totalExpense);
- accountDto.setNetRevenue(netRevenue);
- return accountDto;
- }
-
- //璐㈠姟鎶ヨ〃骞存煡璇�
- @Override
- public List<AccountDto3> reportExpense(ReportDateDto reportDateDto) {
- List<AccountDto3> accountDto3s = new ArrayList<>();
- //鍏堟煡璇㈡敹鍏ョ被鍨嬫湁鍝簺
- List<SysDictData> incomeTypes = sysDictDataMapper.selectDictDataByType("expense_types");
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-// int currentYear = LocalDate.now().getYear(); // 鑾峰彇褰撳墠骞翠唤锛堝2025锛�
- for (SysDictData incomeType : incomeTypes) {
- AccountDto3 accountDto3 = new AccountDto3();
- accountDto3.setTypeName(incomeType.getDictLabel());//绫诲瀷
- List<BigDecimal> account=new ArrayList<>();
- LocalDate startDate = reportDateDto.getEntryDateStart();
- LocalDate endDate = reportDateDto.getEntryDateEnd();
-
- // 鍒濆鍖栧惊鐜彉閲忎负璧峰鏃ユ湡
- LocalDate currentDate = startDate;
-
- // 寰幆锛氬綋鍓嶆棩鏈熶笉瓒呰繃缁撴潫鏃ユ湡鏃剁户缁�
- while (!currentDate.isAfter(endDate)) {
- // 褰撴湀绗竴澶�
- LocalDate firstDay = currentDate.withDayOfMonth(1);
- DateQueryDto dateQueryDto = new DateQueryDto();
- dateQueryDto.setEntryDateStart(firstDay.format(formatter));
-
- // 褰撴湀鏈�鍚庝竴澶�
- LocalDate lastDay = firstDay.plusMonths(1).minusDays(1);
- dateQueryDto.setEntryDateEnd(lastDay.format(formatter));
-
- // 绱姞鏁版嵁
- account.add(accountExpenseMapper.report1(dateQueryDto, incomeType.getDictValue()));
-
- // 鏈堜唤鍔犱竴锛堣嚜鍔ㄥ鐞嗚法骞达紝姣斿12鏈堝姞1涓湀浼氬彉鎴愪笅涓�骞�1鏈堬級
- currentDate = currentDate.plusMonths(1);
- }
- accountDto3.setAccount(account);//绫诲瀷
- accountDto3s.add(accountDto3);
- }
- return accountDto3s;
- }
-
- @Override
- public Map<String, List<String>> analysis() {
- // 鑾峰彇鏈�杩戝洓涓湀锛堝綋鍓嶆湀 + 鍓�3涓湀锛夌殑鏃堕棿鑼冨洿
- LocalDate today = LocalDate.now();
- DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); // 骞存湀鏍煎紡鍖栧櫒
- Map<String, List<String>> result = new HashMap<>();
- List<String> months = new ArrayList<>(); // 瀛樺偍骞存湀锛堝 2025-12銆�2025-11锛�
- List<String> totalIncomeList = new ArrayList<>(); // 姣忔湀鎬绘敹鍏�
- List<String> totalExpenseList = new ArrayList<>(); // 姣忔湀鎬绘敮鍑�
- List<String> netIncomeList = new ArrayList<>(); // 姣忔湀鍑�鏀跺叆锛堟敹鍏�-鏀嚭锛�
-
- // 姝ラ1锛氳绠楄繎4涓湀鐨勫勾鏈堝垪琛紙褰撳墠鏈堛�佸墠1鏈堛�佸墠2鏈堛�佸墠3鏈堬級
- List<String> targetMonths = new ArrayList<>();
- for (int i = 0; i < 4; i++) {
- LocalDate currentMonth = today.minusMonths(i);
- String monthStr = currentMonth.format(monthFormatter);
- targetMonths.add(monthStr);
- }
- // 鍙嶈浆鍒楄〃锛岀‘淇濋『搴忎负銆屽墠3鏈� 鈫� 褰撳墠鏈堛�嶏紙鍙�夛紝鎸夐渶姹傝皟鏁撮『搴忥級
- Collections.reverse(targetMonths);
-
- // 姝ラ2锛氫竴娆℃�ф煡璇㈣繎4涓湀鎵�鏈夋敹鍏ユ暟鎹紝鎸夆�滃勾鏈堚�濆垎缁勬眹鎬�
- LocalDate fourMonthsAgo = today.minusMonths(3).withDayOfMonth(1); // 杩�4涓湀璧峰鏃ワ紙鍓�3鏈�1鍙凤級
- LocalDate currentMonthEnd = today.withDayOfMonth(today.lengthOfMonth()); // 褰撳墠鏈堢粨鏉熸棩
- ZoneId zoneId = ZoneId.of("Asia/Shanghai");
- // 鏌ヨ杩�4涓湀鎵�鏈夋敹鍏�
- List<AccountIncome> allIncomes = accountIncomeMapper.selectList(
- Wrappers.<AccountIncome>lambdaQuery()
- .ge(AccountIncome::getIncomeDate, fourMonthsAgo.toString()) // 澶т簬绛変簬璧峰鏃�
- .le(AccountIncome::getIncomeDate, currentMonthEnd.toString()) // 灏忎簬绛変簬缁撴潫鏃�
- );
-
- // 鏀跺叆鎸夆�滃勾鏈堚�濆垎缁勬眹鎬伙紙key锛氬勾鏈堝瓧绗︿覆锛寁alue锛氬綋鏈堟�绘敹鍏ワ級
- Map<String, BigDecimal> monthlyIncomeMap = allIncomes.stream()
- .filter(income -> income.getIncomeMoney() != null) // 杩囨护绌洪噾棰�
- .collect(Collectors.groupingBy(
- income -> {
- // 灏嗚緭鍏ユ椂闂达紙瀛楃涓诧級杞崲涓篖ocalDate锛屽啀鏍煎紡鍖栦负骞存湀
- LocalDate inputDate = income.getIncomeDate().toInstant().atZone(zoneId).toLocalDate();
- return inputDate.format(monthFormatter);
- },
- Collectors.reducing(BigDecimal.ZERO, AccountIncome::getIncomeMoney, BigDecimal::add)
- ));
-
- // 姝ラ3锛氫竴娆℃�ф煡璇㈣繎4涓湀鎵�鏈夋敮鍑烘暟鎹紝鎸夆�滃勾鏈堚�濆垎缁勬眹鎬�
- List<AccountExpense> allExpenses = accountExpenseMapper.selectList(
- Wrappers.<AccountExpense>lambdaQuery()
- .ge(AccountExpense::getExpenseDate, fourMonthsAgo.toString())
- .le(AccountExpense::getExpenseDate, currentMonthEnd.toString())
- );
-
- // 鏀嚭鎸夆�滃勾鏈堚�濆垎缁勬眹鎬�
- Map<String, BigDecimal> monthlyExpenseMap = allExpenses.stream()
- .filter(expense -> expense.getExpenseMoney() != null) // 杩囨护绌洪噾棰�
- .collect(Collectors.groupingBy(
- expense -> {
- LocalDate inputDate = expense.getExpenseDate().toInstant().atZone(zoneId).toLocalDate();
- return inputDate.format(monthFormatter);
- },
- Collectors.reducing(BigDecimal.ZERO, AccountExpense::getExpenseMoney, BigDecimal::add)
- ));
-
- // 姝ラ4锛氬惊鐜�4涓洰鏍囨湀浠斤紝濉厖缁熻鏁版嵁锛堟棤鏁版嵁鏃堕粯璁や负0锛�
- for (String month : targetMonths) {
- // 褰撴湀鎬绘敹鍏ワ紙鏃犳暟鎹垯涓�0锛�
- BigDecimal totalIncome = monthlyIncomeMap.getOrDefault(month, BigDecimal.ZERO);
- // 褰撴湀鎬绘敮鍑猴紙鏃犳暟鎹垯涓�0锛�
- BigDecimal totalExpense = monthlyExpenseMap.getOrDefault(month, BigDecimal.ZERO);
- // 褰撴湀鍑�鏀跺叆锛堟敹鍏� - 鏀嚭锛�
- BigDecimal netIncome = totalIncome.subtract(totalExpense);
-
- // 濉厖鍒楄〃
- months.add(month);
- totalIncomeList.add(totalIncome.toString());
- totalExpenseList.add(totalExpense.toString());
- netIncomeList.add(netIncome.toString());
- }
-
- // 缁勮缁撴灉
- result.put("days", months); // 骞存湀锛堝 ["2025-09", "2025-10", "2025-11", "2025-12"]锛�
- result.put("totalIncome", totalIncomeList); // 瀵瑰簲鏈堜唤鎬绘敹鍏�
- result.put("totalExpense", totalExpenseList); // 瀵瑰簲鏈堜唤鎬绘敮鍑�
- result.put("netIncome", netIncomeList); // 瀵瑰簲鏈堜唤鍑�鏀跺叆
-
- return result;
- }
-
- @Override
- public AccountExpense getByInvoiceNumber(String purchaseContractNumber) {
- return accountExpenseMapper.selectOne(Wrappers.<AccountExpense>lambdaQuery()
- .eq(AccountExpense::getInvoiceNumber, purchaseContractNumber));
- }
-
- @Override
- public List<AccountExpense> getByInvoiceNumberList(String purchaseContractNumber) {
- return accountExpenseMapper.selectList(Wrappers.<AccountExpense>lambdaQuery()
- .eq(AccountExpense::getInvoiceNumber, purchaseContractNumber));
- }
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountFileServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountFileServiceImpl.java
deleted file mode 100644
index b1e8f84..0000000
--- a/src/main/java/com/ruoyi/account/service/impl/AccountFileServiceImpl.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.ruoyi.account.service.impl;
-
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.mapper.AccountFileMapper;
-import com.ruoyi.account.pojo.AccountFile;
-import com.ruoyi.account.service.AccountFileService;
-import com.ruoyi.quality.mapper.QualityInspectFileMapper;
-import com.ruoyi.quality.pojo.QualityInspectFile;
-import com.ruoyi.quality.service.IQualityInspectFileService;
-import lombok.AllArgsConstructor;
-import org.springframework.stereotype.Service;
-
-@AllArgsConstructor
-@Service
-public class AccountFileServiceImpl extends ServiceImpl<AccountFileMapper, AccountFile> implements AccountFileService {
-
- private AccountFileMapper accountFileMapper;
-
-
- @Override
- public IPage<AccountFile> accountFileListPage(Page page, AccountFile accountFile) {
- return accountFileMapper.accountFileListPage(page,accountFile);
- }
-}
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java
deleted file mode 100644
index 4a754e0..0000000
--- a/src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.ruoyi.account.service.impl;
-
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.dto.AccountDto3;
-import com.ruoyi.account.dto.ReportDateDto;
-import com.ruoyi.account.mapper.AccountIncomeMapper;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.dto.DateQueryDto;
-import com.ruoyi.project.system.domain.SysDictData;
-import com.ruoyi.project.system.mapper.SysDictDataMapper;
-import lombok.AllArgsConstructor;
-import org.springframework.stereotype.Service;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@AllArgsConstructor
-@Service
-public class AccountIncomeServiceImpl extends ServiceImpl<AccountIncomeMapper, AccountIncome> implements AccountIncomeService {
-
- private AccountIncomeMapper accountIncomeMapper;
-
- private SysDictDataMapper sysDictDataMapper;
-
-
- //鍒嗛〉鏌ヨ
- @Override
- public IPage<AccountIncome> accountIncomeListPage(Page page, AccountIncome accountIncome) {
- resolveIncomeMethodLabelFilter(accountIncome);
- return accountIncomeMapper.accountIncomeListPage(page,accountIncome);
- }
-
- private void resolveIncomeMethodLabelFilter(AccountIncome accountIncome) {
- if (accountIncome == null) {
- return;
- }
- if (accountIncome.getIncomeMethodLabel() == null || accountIncome.getIncomeMethodLabel().trim().isEmpty()) {
- return;
- }
- String targetLabel = accountIncome.getIncomeMethodLabel().trim();
- List<String> paymentMethodList = selectDictValuesByLabel("payment_methods", targetLabel);
- List<String> receiptPaymentMethodList = selectDictValuesByLabel("receipt_payment_type", targetLabel);
- if (paymentMethodList.isEmpty()) {
- paymentMethodList = Collections.singletonList("__NO_MATCH__");
- }
- if (receiptPaymentMethodList.isEmpty()) {
- receiptPaymentMethodList = Collections.singletonList("__NO_MATCH__");
- }
- accountIncome.setPaymentMethodList(paymentMethodList);
- accountIncome.setReceiptPaymentMethodList(receiptPaymentMethodList);
- accountIncome.setIncomeMethod(null);
- }
-
- private List<String> selectDictValuesByLabel(String dictType, String label) {
- return sysDictDataMapper.selectDictDataByType(dictType).stream()
- .filter(item -> label.equals(item.getDictLabel()))
- .map(SysDictData::getDictValue)
- .filter(v -> v != null && !v.trim().isEmpty())
- .distinct()
- .collect(Collectors.toList());
- }
-
- //瀵煎嚭
- @Override
- public void accountIncomeExport(HttpServletResponse response, AccountIncome accountIncome) {
- List<AccountIncome> accountIncomes =accountIncomeMapper.accountIncomeExport(accountIncome);
- ExcelUtil<AccountIncome> util = new ExcelUtil<AccountIncome>(AccountIncome.class);
- util.exportExcel(response, accountIncomes, "鏀跺叆绠$悊瀵煎嚭");
- }
-
- //璐㈠姟鎶ヨ〃骞存煡璇�
- @Override
- public List<AccountDto3> reportIncome(ReportDateDto reportDateDto) {
- List<AccountDto3> accountDto3s = new ArrayList<>();
- //鍏堟煡璇㈡敹鍏ョ被鍨嬫湁鍝簺
- List<SysDictData> incomeTypes = sysDictDataMapper.selectDictDataByType("income_types");
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-// int currentYear = LocalDate.now().getYear(); // 鑾峰彇褰撳墠骞翠唤锛堝2025锛�
- for (SysDictData incomeType : incomeTypes) {
- AccountDto3 accountDto3 = new AccountDto3();
- accountDto3.setTypeName(incomeType.getDictLabel());//绫诲瀷
- List<BigDecimal> account=new ArrayList<>();
- LocalDate startDate = reportDateDto.getEntryDateStart();
- LocalDate endDate = reportDateDto.getEntryDateEnd();
-
- // 鍒濆鍖栧惊鐜彉閲忎负璧峰鏃ユ湡
- LocalDate currentDate = startDate;
-
- // 寰幆锛氬綋鍓嶆棩鏈熶笉瓒呰繃缁撴潫鏃ユ湡鏃剁户缁�
- while (!currentDate.isAfter(endDate)) {
- // 褰撴湀绗竴澶�
- LocalDate firstDay = currentDate.withDayOfMonth(1);
- DateQueryDto dateQueryDto = new DateQueryDto();
- dateQueryDto.setEntryDateStart(firstDay.format(formatter));
-
- // 褰撴湀鏈�鍚庝竴澶�
- LocalDate lastDay = firstDay.plusMonths(1).minusDays(1);
- dateQueryDto.setEntryDateEnd(lastDay.format(formatter));
-
- // 绱姞鏁版嵁
- account.add(accountIncomeMapper.report1(dateQueryDto, incomeType.getDictValue()));
-
- // 鏈堜唤鍔犱竴锛堣嚜鍔ㄥ鐞嗚法骞达紝姣斿12鏈堝姞1涓湀浼氬彉鎴愪笅涓�骞�1鏈堬級
- currentDate = currentDate.plusMonths(1);
- }
- accountDto3.setAccount(account);//绫诲瀷
- accountDto3s.add(accountDto3);
- }
- return accountDto3s;
- }
-
- @Override
- public AccountIncome getByInvoiceNumber(String purchaseContractNumber) {
- AccountIncome accountIncome = accountIncomeMapper.selectOne(new LambdaQueryWrapper<AccountIncome>()
- .eq(AccountIncome::getInvoiceNumber, purchaseContractNumber));
- return accountIncome;
- }
-
- @Override
- public List<AccountIncome> getByInvoiceNumberList(String purchaseContractNumber) {
- return accountIncomeMapper.selectList(new LambdaQueryWrapper<AccountIncome>()
- .eq(AccountIncome::getInvoiceNumber, purchaseContractNumber));
- }
-}
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountStatementDetailsServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountStatementDetailsServiceImpl.java
new file mode 100644
index 0000000..6d1ba1c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/AccountStatementDetailsServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.account.service.impl;
+
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.ruoyi.account.mapper.AccountStatementDetailsMapper;
+import com.ruoyi.account.service.AccountStatementDetailsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--瀵硅处鍗曟槑缁� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 10:12:42
+ */
+@Service
+public class AccountStatementDetailsServiceImpl extends ServiceImpl<AccountStatementDetailsMapper, AccountStatementDetails> implements AccountStatementDetailsService {
+
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountStatementServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountStatementServiceImpl.java
new file mode 100644
index 0000000..411d595
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/AccountStatementServiceImpl.java
@@ -0,0 +1,298 @@
+package com.ruoyi.account.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.StatementAccountDto;
+import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto;
+import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto;
+import com.ruoyi.account.bean.dto.sales.SalesOutboundDto;
+import com.ruoyi.account.bean.dto.sales.SalesReturnDto;
+import com.ruoyi.account.bean.vo.StatementAccountVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.bean.vo.sales.SalesReturnVo;
+import com.ruoyi.account.mapper.AccountStatementDetailsMapper;
+import com.ruoyi.account.mapper.AccountStatementMapper;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.AccountStatement;
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.account.service.AccountStatementService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
+import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
+import com.ruoyi.stock.mapper.StockInRecordMapper;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * <p>
+ * 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 09:42:47
+ */
+@Service
+@RequiredArgsConstructor
+@Transactional(rollbackFor = Exception.class)
+public class AccountStatementServiceImpl extends ServiceImpl<AccountStatementMapper, AccountStatement> implements AccountStatementService {
+
+ private final AccountStatementMapper accountStatementMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final StockOutRecordMapper stockOutRecordMapper;
+ private final StockInRecordMapper stockInRecordMapper;
+ private final ReturnManagementMapper returnManagementMapper;
+ private final AccountStatementDetailsMapper accountStatementDetailsMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
+ private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMdd");
+
+ @Override
+ public StatementAccountVo getAccountStatementDetailsByMonth(StatementAccountDto statementAccountDto) {
+ //瀵硅处鏈堜唤杞崲鎴愬紑濮嬫棩鏈熷拰缁撴潫鏃ユ湡鍖洪棿
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
+ YearMonth yearMonth = YearMonth.parse(statementAccountDto.getStatementMonth(), formatter);
+ statementAccountDto.setStartDate(yearMonth.atDay(1));
+ statementAccountDto.setEndDate(yearMonth.atEndOfMonth());
+ if (statementAccountDto.getAccountType() == 1){
+ //搴旀敹瀵硅处--Customer
+ return getAccountStatementDetailsByCustomerAndMonth(statementAccountDto);
+ }else {
+ //搴斾粯瀵硅处--SupplierManage
+ return getAccountStatementDetailsBySupplierAndMonth(statementAccountDto);
+ }
+ }
+
+ @Override
+ public boolean addAccountStatement(StatementAccountVo statementAccountVo) {
+ //鍚屼竴瀹㈡埛鎴栬�呭悓涓�渚涘簲鍟�,涓�涓湀浠藉彧鑳芥湁涓�涓璐﹀崟
+ List<AccountStatement> accountStatements = accountStatementMapper.selectList(Wrappers.<AccountStatement>lambdaQuery()
+ .eq(AccountStatement::getStatementMonth, statementAccountVo.getStatementMonth())
+ .eq(AccountStatement::getAccountType, statementAccountVo.getAccountType())
+ .eq(AccountStatement::getCustomerId, statementAccountVo.getCustomerId()));
+ if (CollectionUtils.isNotEmpty(accountStatements)){
+ throw new ServiceException("鍚屼竴瀹㈡埛鎴栬�呭悓涓�渚涘簲鍟�,涓�涓湀浠藉彧鑳芥湁涓�涓璐﹀崟");
+ }
+ AccountStatement accountStatement = new AccountStatement();
+ BeanUtils.copyProperties(statementAccountVo, accountStatement);
+ accountStatement.setStatementNumber(genStatementAccountNo());
+ boolean save = save(accountStatement);
+ statementAccountVo.getAccountStatementDetails().stream().forEach(accountStatementDetails -> {
+ accountStatementDetails.setAccountStatementId(accountStatement.getId());
+ //娣诲姞瀵硅处鍗曟槑缁�
+ accountStatementDetailsMapper.insert(accountStatementDetails);
+ });
+ return save;
+ }
+
+ @Override
+ public boolean deleteAccountStatement(List<Long> ids) {
+ //鍒犻櫎瀵硅处鍗曟槑缁�
+ accountStatementDetailsMapper.delete(Wrappers.<AccountStatementDetails>lambdaQuery().in(AccountStatementDetails::getAccountStatementId, ids));
+ return removeByIds(ids);
+ }
+
+ @Override
+ public IPage<StatementAccountVo> listPageAccountStatement(Page page, StatementAccountDto statementAccountDto) {
+ return accountStatementMapper.listPageAccountStatement(page, statementAccountDto);
+ }
+
+ @Override
+ public void exportAccountStatement(HttpServletResponse response, StatementAccountDto statementAccountDto) {
+ List<StatementAccountVo> list = accountStatementMapper.listPageAccountStatement(new Page(1,-1),statementAccountDto).getRecords();
+ ExcelUtil<StatementAccountVo> util = new ExcelUtil<>(StatementAccountVo.class);
+ util.exportExcel(response, list , "瀵硅处鍗�");
+ }
+
+ //鏍规嵁瀹㈡埛鍜屾湀浠借幏鍙栧璐﹁鎯�(閿�鍞�)
+ private StatementAccountVo getAccountStatementDetailsByCustomerAndMonth(StatementAccountDto statementAccountDto) {
+ StatementAccountVo statementAccountVo = new StatementAccountVo();
+ statementAccountVo.setAccountType(1);//搴旀敹瀵硅处
+ List<AccountStatementDetails> accountStatementDetailsList = new ArrayList<>();
+ /*鏌ヨ鍑哄簱鏄庣粏*/
+ SalesOutboundDto salesOutboundDto = new SalesOutboundDto();
+ salesOutboundDto.setCustomerId(statementAccountDto.getCustomerId());
+ salesOutboundDto.setStartDate(statementAccountDto.getStartDate());
+ salesOutboundDto.setEndDate(statementAccountDto.getEndDate());
+ List<SalesOutboundVo> salesOutboundVos = stockOutRecordMapper.listPageAccountSales(new Page(1, -1), salesOutboundDto).getRecords();
+ salesOutboundVos.stream().forEach(salesOutboundVo -> {
+ AccountStatementDetails accountStatementDetails = new AccountStatementDetails();
+ //鏁版嵁鏃ユ湡=鍑哄簱鏃ユ湡
+ accountStatementDetails.setOccurrenceDate(salesOutboundVo.getShippingDate());
+ //鍗曟嵁缂栧彿=鍑哄簱鍗曞彿
+ accountStatementDetails.setReceiptNumber(salesOutboundVo.getOutboundBatches());
+ //绫诲瀷=鍑哄簱
+ accountStatementDetails.setType(1);
+ //閲戦=鍑哄簱閲戦
+ accountStatementDetails.setAmount(salesOutboundVo.getOutboundAmount());
+ //澶囨敞
+ accountStatementDetails.setRemark("浜у搧閿�鍞嚭搴擄紝浜у搧锛�"+salesOutboundVo.getProductName());
+ accountStatementDetailsList.add(accountStatementDetails);
+ });
+ /*鏌ヨ鏀舵鏄庣粏*/
+ List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList(Wrappers.<AccountSalesCollection>lambdaQuery()
+ .eq(AccountSalesCollection::getCustomerId, statementAccountDto.getCustomerId())
+ .between(AccountSalesCollection::getCollectionDate, statementAccountDto.getStartDate(), statementAccountDto.getEndDate()));
+ accountSalesCollections.stream().forEach(accountSalesCollection -> {
+ AccountStatementDetails accountStatementDetails = new AccountStatementDetails();
+ //鏁版嵁鏃ユ湡=鏀舵鏃ユ湡
+ accountStatementDetails.setOccurrenceDate(accountSalesCollection.getCollectionDate());
+ //鍗曟嵁缂栧彿=鏀舵鍗曞彿
+ accountStatementDetails.setReceiptNumber(accountSalesCollection.getCollectionNumber());
+ //绫诲瀷=鏀舵
+ accountStatementDetails.setType(3);
+ //閲戦=鏀舵閲戦
+ accountStatementDetails.setAmount(accountSalesCollection.getCollectionAmount());
+ //澶囨敞
+ accountStatementDetails.setRemark("瀹㈡埛鍥炴锛屽娉細"+accountSalesCollection.getRemark());
+ accountStatementDetailsList.add(accountStatementDetails);
+ });
+ /*鏌ヨ閫�璐ф槑缁�*/
+ SalesReturnDto salesReturnDto = new SalesReturnDto();
+ salesReturnDto.setCustomerId(statementAccountDto.getCustomerId());
+ salesReturnDto.setStartDate(statementAccountDto.getStartDate());
+ salesReturnDto.setEndDate(statementAccountDto.getEndDate());
+ List<SalesReturnVo> salesReturnVos = returnManagementMapper.listPageAccountSalesReturn(new Page(1, -1), salesReturnDto).getRecords();
+ salesReturnVos.stream().forEach(salesReturnVo -> {
+ AccountStatementDetails accountStatementDetails = new AccountStatementDetails();
+ //鏁版嵁鏃ユ湡=閫�璐ф棩鏈�
+ accountStatementDetails.setOccurrenceDate(salesReturnVo.getMakeTime().toLocalDate());
+ //鍗曟嵁缂栧彿=閫�璐у崟鍙�
+ accountStatementDetails.setReceiptNumber(salesReturnVo.getReturnNo());
+ //绫诲瀷=閫�璐�
+ accountStatementDetails.setType(5);
+ //閲戦=閫�娆鹃噾棰�
+ accountStatementDetails.setAmount(salesReturnVo.getRefundAmount());
+ //澶囨敞
+ accountStatementDetails.setRemark("浜у搧閫�璐э紝鍘熷洜锛�"+salesReturnVo.getReturnReason());
+ accountStatementDetailsList.add(accountStatementDetails);
+ });
+ //鏈熷垵浣欓=涓婁釜鏈堢殑鏈熸湯浣欓
+ statementAccountVo.setOpeningBalance(BigDecimal.ZERO);
+ List<AccountStatement> accountStatements = accountStatementMapper.selectList(Wrappers.<AccountStatement>lambdaQuery()
+ .eq(AccountStatement::getAccountType, 1)
+ .eq(AccountStatement::getCustomerId, statementAccountDto.getCustomerId())
+ .eq(AccountStatement::getStatementMonth,
+ YearMonth.parse(statementAccountDto.getStatementMonth()).minusMonths(1).toString()));
+ if (CollectionUtils.isNotEmpty(accountStatements)){
+ statementAccountVo.setOpeningBalance(accountStatements.get(accountStatements.size() - 1).getClosingBalance());
+ }
+ //鏈湡搴旀敹=鍑哄簱-閫�璐ч噾棰濈疮璁�
+ statementAccountVo.setCurrentPlan(salesOutboundVos.stream().map(SalesOutboundVo::getOutboundAmount).reduce(BigDecimal.ZERO, BigDecimal::add)
+ .subtract(salesReturnVos.stream().map(SalesReturnVo::getRefundAmount).reduce(BigDecimal.ZERO, BigDecimal::add)));
+ //鏈湡鏀舵=鏀舵閲戦绱
+ statementAccountVo.setCurrentActually(accountSalesCollections.stream().map(AccountSalesCollection::getCollectionAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+ //鏈熸湯浣欓=鏈熷垵+搴旀敹-鏀舵
+ statementAccountVo.setClosingBalance(statementAccountVo.getOpeningBalance().add(statementAccountVo.getCurrentPlan()).subtract(statementAccountVo.getCurrentActually()));
+ statementAccountVo.setAccountStatementDetails(accountStatementDetailsList);
+ return statementAccountVo;
+ }
+
+ //鏍规嵁渚涘簲鍟嗗拰鏈堜唤鑾峰彇瀵硅处璇︽儏(閲囪喘)
+ private StatementAccountVo getAccountStatementDetailsBySupplierAndMonth(StatementAccountDto statementAccountDto) {
+ StatementAccountVo statementAccountVo = new StatementAccountVo();
+ statementAccountVo.setAccountType(2);//搴斾粯瀵硅处
+ List<AccountStatementDetails> accountStatementDetailsList = new ArrayList<>();
+ /*鏌ヨ鍏ュ簱鏄庣粏*/
+ PurchaseInboundDto purchaseInboundDto = new PurchaseInboundDto();
+ purchaseInboundDto.setSupplierId(statementAccountDto.getCustomerId());
+ purchaseInboundDto.setStartDate(statementAccountDto.getStartDate());
+ purchaseInboundDto.setEndDate(statementAccountDto.getEndDate());
+ List<PurchaseInboundVo> purchaseInboundVos = stockInRecordMapper.listPageAccountPurchase(new Page(1, -1), purchaseInboundDto).getRecords();
+ purchaseInboundVos.stream().forEach(purchaseInboundVo -> {
+ AccountStatementDetails accountStatementDetails = new AccountStatementDetails();
+ //鏁版嵁鏃ユ湡=鍏ュ簱鏃ユ湡
+ accountStatementDetails.setOccurrenceDate(purchaseInboundVo.getInboundDate());
+ //鍗曟嵁缂栧彿=鍏ュ簱鍗曞彿
+ accountStatementDetails.setReceiptNumber(purchaseInboundVo.getInboundBatches());
+ //绫诲瀷=鍏ュ簱
+ accountStatementDetails.setType(2);
+ //閲戦=鍏ュ簱閲戦
+ accountStatementDetails.setAmount(purchaseInboundVo.getInboundAmount());
+ //澶囨敞
+ accountStatementDetails.setRemark("浜у搧閲囪喘鍏ュ簱锛屼骇鍝侊細"+purchaseInboundVo.getProductName());
+ accountStatementDetailsList.add(accountStatementDetails);
+ });
+ /*鏌ヨ浠樻鏄庣粏*/
+ List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery()
+ .eq(AccountPurchasePayment::getSupplierId, statementAccountDto.getCustomerId())
+ .between(AccountPurchasePayment::getPaymentDate, statementAccountDto.getStartDate(), statementAccountDto.getEndDate()));
+ accountPurchasePayments.stream().forEach(accountPurchasePayment -> {
+ AccountStatementDetails accountStatementDetails = new AccountStatementDetails();
+ //鏁版嵁鏃ユ湡=浠樻鏃ユ湡
+ accountStatementDetails.setOccurrenceDate(accountPurchasePayment.getPaymentDate());
+ //鍗曟嵁缂栧彿=浠樻鍗曞彿
+ accountStatementDetails.setReceiptNumber(accountPurchasePayment.getPaymentNumber());
+ //绫诲瀷=浠樻
+ accountStatementDetails.setType(4);
+ //閲戦=浠樻閲戦
+ accountStatementDetails.setAmount(accountPurchasePayment.getPaymentAmount());
+ //澶囨敞
+ accountStatementDetails.setRemark("鏀粯璐ф锛屽娉細"+accountPurchasePayment.getRemark());
+ accountStatementDetailsList.add(accountStatementDetails);
+ });
+ /*鏌ヨ閫�璐ф槑缁�*/
+ PurchaseReturnDto purchaseReturnDto = new PurchaseReturnDto();
+ purchaseReturnDto.setSupplierId(statementAccountDto.getCustomerId());
+ purchaseReturnDto.setStartDate(statementAccountDto.getStartDate());
+ purchaseReturnDto.setEndDate(statementAccountDto.getEndDate());
+ List<PurchaseReturnVo> purchaseReturnVos = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1, -1), purchaseReturnDto).getRecords();
+ purchaseReturnVos.stream().forEach(purchaseReturnVo -> {
+ AccountStatementDetails accountStatementDetails = new AccountStatementDetails();
+ //鏁版嵁鏃ユ湡=閫�璐ф棩鏈�
+ accountStatementDetails.setOccurrenceDate(purchaseReturnVo.getPreparedAt().toLocalDate());
+ //鍗曟嵁缂栧彿=閫�璐у崟鍙�
+ accountStatementDetails.setReceiptNumber(purchaseReturnVo.getReturnNo());
+ //绫诲瀷=閫�璐�
+ accountStatementDetails.setType(5);
+ //閲戦=閫�娆鹃噾棰�
+ accountStatementDetails.setAmount(purchaseReturnVo.getTotalAmount());
+ //澶囨敞
+ accountStatementDetails.setRemark("浜у搧閫�璐э紝閫�璐ф柟寮忥細"+purchaseReturnVo.getReturnType());
+ accountStatementDetailsList.add(accountStatementDetails);
+ });
+ //鏈熷垵浣欓=涓婁釜鏈堢殑鏈熸湯浣欓
+ statementAccountVo.setOpeningBalance(BigDecimal.ZERO);
+ List<AccountStatement> accountStatements = accountStatementMapper.selectList(Wrappers.<AccountStatement>lambdaQuery()
+ .eq(AccountStatement::getAccountType, 2)
+ .eq(AccountStatement::getCustomerId, statementAccountDto.getCustomerId())
+ .eq(AccountStatement::getStatementMonth,
+ YearMonth.parse(statementAccountDto.getStatementMonth()).minusMonths(1).toString()));
+ if (CollectionUtils.isNotEmpty(accountStatements)){
+ statementAccountVo.setOpeningBalance(accountStatements.get(accountStatements.size() - 1).getClosingBalance());
+ }
+ //鏈湡搴斾粯=鍏ュ簱-閫�璐ч噾棰濈疮璁�
+ statementAccountVo.setCurrentPlan(purchaseInboundVos.stream().map(PurchaseInboundVo::getInboundAmount).reduce(BigDecimal.ZERO, BigDecimal::add)
+ .subtract(purchaseReturnVos.stream().map(PurchaseReturnVo::getTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add)));
+ //鏈湡浠樻=浠樻閲戦绱
+ statementAccountVo.setCurrentActually(accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+ //鏈熸湯浣欓=鏈熷垵+搴旀敹-鏀舵
+ statementAccountVo.setClosingBalance(statementAccountVo.getOpeningBalance().add(statementAccountVo.getCurrentPlan()).subtract(statementAccountVo.getCurrentActually()));
+ statementAccountVo.setAccountStatementDetails(accountStatementDetailsList);
+ return statementAccountVo;
+ }
+
+ private String genStatementAccountNo() {
+ return "DZ" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
index 0ed77af..f42599a 100644
--- a/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
@@ -3,27 +3,47 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.DeviceTypeDetail;
-import com.ruoyi.account.dto.DeviceTypeDistributionVO;
-import com.ruoyi.account.mapper.BorrowInfoMapper;
-import com.ruoyi.account.pojo.BorrowInfo;
+import com.ruoyi.account.bean.dto.AccountReportDto;
+import com.ruoyi.account.bean.dto.DeviceTypeDetail;
+import com.ruoyi.account.bean.dto.DeviceTypeDistributionVO;
+import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto;
+import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto;
+import com.ruoyi.account.bean.dto.sales.SalesOutboundDto;
+import com.ruoyi.account.bean.dto.sales.SalesReturnDto;
+import com.ruoyi.account.bean.vo.AccountReportVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.bean.vo.sales.SalesReturnVo;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.account.service.AccountingService;
import com.ruoyi.device.mapper.DeviceLedgerMapper;
import com.ruoyi.device.pojo.DeviceLedger;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.procurementrecord.mapper.CustomStorageMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
+import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
import com.ruoyi.procurementrecord.pojo.CustomStorage;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
+import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
+import com.ruoyi.stock.mapper.StockInRecordMapper;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
+import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Year;
+import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
@@ -35,14 +55,21 @@
@Service
@Slf4j
@RequiredArgsConstructor
-public class AccountingServiceImpl {
+public class AccountingServiceImpl implements AccountingService {
private final DeviceLedgerMapper deviceLedgerMapper;
- private final BorrowInfoMapper borrowInfoMapper;
private final CustomStorageMapper customStorageMapper;
private final ProcurementRecordMapper procurementRecordMapper;
private final ProcurementRecordOutMapper procurementRecordOutMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private final StockOutRecordMapper stockOutRecordMapper;
+ private final ReturnManagementMapper returnManagementMapper;
+ private final StockInRecordMapper stockInRecordMapper;
+ private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
+
+ @Override
public AjaxResult total(Integer year) {
Map<String,Object> map = new HashMap<>();
map.put("deprAmount",0); // 鎶樻棫閲戦
@@ -75,17 +102,8 @@
map.put("netValue",reduce.subtract(total));
}
// 璐熷��
- LambdaQueryWrapper<BorrowInfo> borrowInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
- borrowInfoLambdaQueryWrapper.like(BorrowInfo::getCreateTime,year)
- .eq(BorrowInfo::getStatus,1);
- List<BorrowInfo> borrowInfos = borrowInfoMapper.selectList(borrowInfoLambdaQueryWrapper);
- if(CollectionUtils.isNotEmpty(borrowInfos)){
- BigDecimal reduce = borrowInfos.stream()
- .map(BorrowInfo::getBorrowAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- map.put("debt",reduce);
- }
+ map.put("debt",BigDecimal.ZERO);
+
// 搴撳瓨璧勪骇
LambdaQueryWrapper<ProcurementRecordStorage> procurementRecordStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
procurementRecordStorageLambdaQueryWrapper.like(ProcurementRecordStorage::getCreateTime,year);
@@ -245,6 +263,7 @@
return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP);
}
+ @Override
public AjaxResult deviceTypeDistribution(Integer year) {
// 2. 缁勮杩斿洖VO
DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO();
@@ -268,6 +287,7 @@
return AjaxResult.success(vo);
}
+ @Override
public AjaxResult calculateDepreciation(Page page, Integer year) {
LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year)
@@ -279,4 +299,159 @@
}
return AjaxResult.success(deviceLedgerIPage);
}
+
+ @Override
+ public AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) {
+ AccountReportVo accountReportVo = new AccountReportVo();
+ LocalDate start = accountReportDto.getEntryDateStart();
+ LocalDate end = accountReportDto.getEntryDateEnd();
+ DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
+
+ // ========== 1. 椤堕儴鍗$墖鏁版嵁 ==========
+ // 1.1 鎬昏惀鏀� = 鏀舵鍗曟�婚噾棰�
+ List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList(
+ Wrappers.<AccountSalesCollection>lambdaQuery()
+ .between(AccountSalesCollection::getCollectionDate, start, end)
+ );
+ BigDecimal totalIncome = Optional.of(
+ accountSalesCollections.stream()
+ .map(AccountSalesCollection::getCollectionAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ accountReportVo.setTotalIncome(totalIncome);
+ // 1.2 鎬绘敮鍑� = 浠樻鍗曟�婚噾棰�
+ List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(
+ Wrappers.<AccountPurchasePayment>lambdaQuery()
+ .between(AccountPurchasePayment::getPaymentDate, start, end)
+ );
+ BigDecimal totalExpense = Optional.of(
+ accountPurchasePayments.stream()
+ .map(AccountPurchasePayment::getPaymentAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ accountReportVo.setTotalExpense(totalExpense);
+ // 1.3 搴旀敹璐︽ = 閿�鍞嚭搴撻噾棰濆悎璁� - 閿�鍞��璐ч噾棰濆悎璁�
+ SalesOutboundDto salesOutboundDto = new SalesOutboundDto();
+ salesOutboundDto.setStartDate(accountReportDto.getEntryDateStart());
+ salesOutboundDto.setEndDate(accountReportDto.getEntryDateEnd());
+ List<SalesOutboundVo> salesOutboundVos = stockOutRecordMapper.listPageAccountSales(new Page(1, -1), salesOutboundDto).getRecords();
+ BigDecimal salesOutAmount = Optional.of(
+ salesOutboundVos.stream()
+ .map(SalesOutboundVo::getOutboundAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ SalesReturnDto salesReturnDto = new SalesReturnDto();
+ salesReturnDto.setStartDate(accountReportDto.getEntryDateStart());
+ salesReturnDto.setEndDate(accountReportDto.getEntryDateEnd());
+ List<SalesReturnVo> salesReturnVos = returnManagementMapper.listPageAccountSalesReturn(new Page(1, -1), salesReturnDto).getRecords();
+ BigDecimal salesReturnAmount = Optional.of(
+ salesReturnVos.stream()
+ .map(SalesReturnVo::getRefundAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ accountReportVo.setAccountsReceivable(salesOutAmount.subtract(salesReturnAmount));
+ // 1.4 搴斾粯璐︽ = 閲囪喘鍏ュ簱閲戦鍚堣 - 閲囪喘閫�璐ч噾棰濆悎璁�
+ PurchaseInboundDto purchaseInboundDto = new PurchaseInboundDto();
+ purchaseInboundDto.setStartDate(accountReportDto.getEntryDateStart());
+ purchaseInboundDto.setEndDate(accountReportDto.getEntryDateEnd());
+ List<PurchaseInboundVo> purchaseInboundVos = stockInRecordMapper.listPageAccountPurchase(new Page(1, -1), purchaseInboundDto).getRecords();
+ BigDecimal purchaseInAmount = Optional.of(
+ purchaseInboundVos.stream()
+ .map(PurchaseInboundVo::getInboundAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ PurchaseReturnDto purchaseReturnDto = new PurchaseReturnDto();
+ purchaseReturnDto.setStartDate(accountReportDto.getEntryDateStart());
+ purchaseReturnDto.setEndDate(accountReportDto.getEntryDateEnd());
+ List<PurchaseReturnVo> purchaseReturnVos = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1, -1), purchaseReturnDto).getRecords();
+ BigDecimal purchaseReturnAmount = Optional.of(
+ purchaseReturnVos.stream()
+ .map(PurchaseReturnVo::getTotalAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ accountReportVo.setAccountsPayable(purchaseInAmount.subtract(purchaseReturnAmount));
+ // 1.5 鍑�鍒╂鼎 = 鎬昏惀鏀� - 鎬绘敮鍑�
+ BigDecimal netProfit = totalIncome.subtract(totalExpense);
+ accountReportVo.setNetRevenue(netProfit);
+
+ // ========== 2. 鎶樼嚎鍥撅細鏈堝害钀ユ敹/鏀嚭/鍑�鍒╂鼎瓒嬪娍 ==========
+ Map<String, BigDecimal> monthIncomeMap = new HashMap<>();
+ Map<String, BigDecimal> monthExpenseMap = new HashMap<>();
+ // 鏈堝害钀ユ敹
+ accountSalesCollections.forEach(item -> {
+ String month = item.getCollectionDate().format(monthFormatter);
+ monthIncomeMap.put(month, monthIncomeMap.getOrDefault(month, BigDecimal.ZERO)
+ .add(Optional.ofNullable(item.getCollectionAmount()).orElse(BigDecimal.ZERO)));
+ });
+ // 鏈堝害鏀嚭
+ accountPurchasePayments.forEach(item -> {
+ String month = item.getPaymentDate().format(monthFormatter);
+ monthExpenseMap.put(month, monthExpenseMap.getOrDefault(month, BigDecimal.ZERO)
+ .add(Optional.ofNullable(item.getPaymentAmount()).orElse(BigDecimal.ZERO)));
+ });
+ // 鐢熸垚杩炵画鏈堜唤鍒楄〃
+ List<String> monthList = new ArrayList<>();
+ LocalDate current = start.withDayOfMonth(1);
+ while (!current.isAfter(end.withDayOfMonth(1))) {
+ monthList.add(current.format(monthFormatter));
+ current = current.plusMonths(1);
+ }
+ // 缁勮瓒嬪娍鏁版嵁
+ List<AccountReportVo.MonthlyTrendVO> trendList = new ArrayList<>();
+ for (String month : monthList) {
+ BigDecimal income = monthIncomeMap.getOrDefault(month, BigDecimal.ZERO);
+ BigDecimal expense = monthExpenseMap.getOrDefault(month, BigDecimal.ZERO);
+ AccountReportVo.MonthlyTrendVO trend = new AccountReportVo.MonthlyTrendVO();
+ trend.setMonth(month);
+ trend.setIncome(income);
+ trend.setExpense(expense);
+ trend.setProfit(income.subtract(expense));
+ trendList.add(trend);
+ }
+ accountReportVo.setMonthlyTrendList(trendList);
+
+ // ========== 3. 鏌辩姸鍥撅細鏈堝害搴旀敹/搴斾粯鏁版嵁 ==========
+ Map<String, BigDecimal> monthReceivableMap = new HashMap<>();
+ Map<String, BigDecimal> monthPayableMap = new HashMap<>();
+ // 鏈堝害搴旀敹锛堥攢鍞嚭搴�-閫�璐э級
+ salesOutboundVos.forEach(item -> {
+ String month = item.getShippingDate().format(monthFormatter);
+ monthReceivableMap.put(month, monthReceivableMap.getOrDefault(month, BigDecimal.ZERO)
+ .add(Optional.ofNullable(item.getOutboundAmount()).orElse(BigDecimal.ZERO)));
+ });
+ salesReturnVos.forEach(item -> {
+ String month = item.getMakeTime().format(monthFormatter);
+ monthReceivableMap.put(month, monthReceivableMap.getOrDefault(month, BigDecimal.ZERO)
+ .subtract(Optional.ofNullable(item.getRefundAmount()).orElse(BigDecimal.ZERO)));
+ });
+
+ // 鏈堝害搴斾粯锛堥噰璐叆搴�-閫�璐э級
+ purchaseInboundVos.forEach(item -> {
+ String month = item.getInboundDate().format(monthFormatter);
+ monthPayableMap.put(month, monthPayableMap.getOrDefault(month, BigDecimal.ZERO)
+ .add(Optional.ofNullable(item.getInboundAmount()).orElse(BigDecimal.ZERO)));
+ });
+ purchaseReturnVos.forEach(item -> {
+ String month = item.getPreparedAt().format(monthFormatter);
+ monthPayableMap.put(month, monthPayableMap.getOrDefault(month, BigDecimal.ZERO)
+ .subtract(Optional.ofNullable(item.getTotalAmount()).orElse(BigDecimal.ZERO)));
+ });
+ // 缁勮搴旀敹搴斾粯鏁版嵁
+ List<AccountReportVo.ReceivablePayableVO> rpList = new ArrayList<>();
+ for (String month : monthList) {
+ AccountReportVo.ReceivablePayableVO rp = new AccountReportVo.ReceivablePayableVO();
+ rp.setMonth(month);
+ rp.setReceivable(monthReceivableMap.getOrDefault(month, BigDecimal.ZERO));
+ rp.setPayable(monthPayableMap.getOrDefault(month, BigDecimal.ZERO));
+ rpList.add(rp);
+ }
+ accountReportVo.setReceivablePayableList(rpList);
+ return accountReportVo;
+ }
}
diff --git a/src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java
deleted file mode 100644
index 773799d..0000000
--- a/src/main/java/com/ruoyi/account/service/impl/BorrowInfoServiceImpl.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package com.ruoyi.account.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.mapper.BorrowInfoMapper;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.account.pojo.BorrowInfo;
-import com.ruoyi.account.service.AccountExpenseService;
-import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.account.service.BorrowInfoService;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * <p>
- * 鍊熸淇℃伅琛� 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-01-15 02:57:29
- */
-@Service
-@Slf4j
-@RequiredArgsConstructor
-public class BorrowInfoServiceImpl extends ServiceImpl<BorrowInfoMapper, BorrowInfo> implements BorrowInfoService {
-
- private final BorrowInfoMapper borrowInfoMapper;
- private final AccountIncomeService accountIncomeService;
- private final AccountExpenseService accountExpenseService;
-
- @Override
- public AjaxResult listPage(Page page, BorrowInfo borrowInfo) {
- LambdaQueryWrapper<BorrowInfo> borrowInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
- if(borrowInfo != null){
- if(StringUtils.isNotEmpty(borrowInfo.getEntryDateStart()) && StringUtils.isNotEmpty(borrowInfo.getEntryDateEnd())){
- borrowInfoLambdaQueryWrapper.ge(BorrowInfo::getBorrowDate, borrowInfo.getEntryDateStart());
- borrowInfoLambdaQueryWrapper.le(BorrowInfo::getBorrowDate, borrowInfo.getEntryDateEnd());
- }
- if(borrowInfo.getStatus() != null){
- borrowInfoLambdaQueryWrapper.eq(BorrowInfo::getStatus, borrowInfo.getStatus());
- }
- if(StringUtils.isNotEmpty(borrowInfo.getBorrowerName())){
- borrowInfoLambdaQueryWrapper.like(BorrowInfo::getBorrowerName, borrowInfo.getBorrowerName());
- }
- }
- return AjaxResult.success(borrowInfoMapper.selectPage(page, borrowInfoLambdaQueryWrapper));
- }
-
- @Override
- public AjaxResult add(BorrowInfo borrowInfo) {
- int insert = borrowInfoMapper.insert(borrowInfo);
- if(insert > 0){
- // 娣诲姞鎴愬姛锛岃繘鍏ユ敹鍏ョ鐞�
- AccountIncome accountIncome = new AccountIncome();
- accountIncome.setBusinessId(borrowInfo.getId());
- accountIncome.setBusinessType(2);
- accountIncome.setIncomeDate(DateUtils.toDate(borrowInfo.getBorrowDate()));
- accountIncome.setIncomeType("2");
- accountIncome.setIncomeMoney(borrowInfo.getBorrowAmount());
- accountIncome.setIncomeDescribed("鍊熸");
- accountIncome.setIncomeMethod("3");
- accountIncome.setInputTime(DateUtils.getNowDate());
- accountIncome.setInputUser(borrowInfo.getBorrowerName());
- accountIncomeService.save(accountIncome);
- return AjaxResult.success("娣诲姞鎴愬姛");
- }
- return AjaxResult.success("娣诲姞澶辫触");
- }
-
- @Override
- public AjaxResult updateBorrowInfo(BorrowInfo borrowInfo) {
- int update = borrowInfoMapper.updateById(borrowInfo);
- if(update > 0){
- // 淇敼鎴愬姛锛屼慨鏀规敹鍏ョ鐞�
- AccountIncome one = accountIncomeService.getOne(new LambdaQueryWrapper<AccountIncome>()
- .eq(AccountIncome::getBusinessId, borrowInfo.getId())
- .eq(AccountIncome::getBusinessType, 2)
- .last("limit 1"));
- if(one != null){
- one.setIncomeMoney(borrowInfo.getBorrowAmount());
- accountIncomeService.updateById(one);
- }
- // 鏄惁涓鸿繕娆�
- if(borrowInfo.getStatus() != null && borrowInfo.getStatus() == 2){
- // 鏂板鏀嚭璁板綍
- AccountExpense accountExpense = new AccountExpense();
- accountExpense.setBusinessId(borrowInfo.getId());
- accountExpense.setBusinessType(2);
- accountExpense.setExpenseDate(DateUtils.toDate(borrowInfo.getRepayDate()));
- accountExpense.setExpenseType("5");
- accountExpense.setExpenseMoney(borrowInfo.getBorrowAmount());
- accountExpense.setExpenseDescribed("杩樻");
- accountExpense.setExpenseMethod("3");
- accountExpense.setInputTime(DateUtils.getNowDate());
- accountExpense.setInputUser(borrowInfo.getBorrowerName());
- accountExpenseService.save(accountExpense);
- }
- return AjaxResult.success("淇敼鎴愬姛");
- }
- return AjaxResult.success("淇敼澶辫触");
- }
-
- @Override
- public AjaxResult delete(List<Long> ids) {
- int delete = borrowInfoMapper.deleteBatchIds(ids);
- if(delete > 0){
- // 鍒犻櫎鎴愬姛锛屽垹闄ゆ敹鍏ョ鐞�
- accountIncomeService.remove(new LambdaQueryWrapper<AccountIncome>()
- .in(AccountIncome::getBusinessId, ids)
- .eq(AccountIncome::getBusinessType, 2));
- // 鍒犻櫎鏀嚭绠$悊
- accountExpenseService.remove(new LambdaQueryWrapper<AccountExpense>()
- .in(AccountExpense::getBusinessId, ids)
- .eq(AccountExpense::getBusinessType, 2));
- return AjaxResult.success("鍒犻櫎鎴愬姛");
- }
- return AjaxResult.success("鍒犻櫎澶辫触");
- }
-}
diff --git a/src/main/java/com/ruoyi/account/service/impl/SalesReceiptReturnServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/SalesReceiptReturnServiceImpl.java
index 3aa201e..c39697f 100644
--- a/src/main/java/com/ruoyi/account/service/impl/SalesReceiptReturnServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/SalesReceiptReturnServiceImpl.java
@@ -1,7 +1,7 @@
package com.ruoyi.account.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.account.dto.SalesReceiptReturnDto;
+import com.ruoyi.account.bean.dto.SalesReceiptReturnDto;
import com.ruoyi.account.pojo.SalesReceiptReturn;
import com.ruoyi.account.mapper.SalesReceiptReturnMapper;
import com.ruoyi.account.service.SalesReceiptReturnService;
diff --git a/src/main/java/com/ruoyi/account/service/impl/SalesRefundAmountOrderServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/SalesRefundAmountOrderServiceImpl.java
index 3dcc1cd..3bd5de9 100644
--- a/src/main/java/com/ruoyi/account/service/impl/SalesRefundAmountOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/SalesRefundAmountOrderServiceImpl.java
@@ -3,7 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.dto.SalesRefundAmountOrderDto;
+import com.ruoyi.account.bean.dto.SalesRefundAmountOrderDto;
import com.ruoyi.account.mapper.SalesRefundAmountOrderMapper;
import com.ruoyi.account.pojo.SalesRefundAmountOrder;
import com.ruoyi.account.service.SalesRefundAmountOrderService;
diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/AccountSubjectServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/AccountSubjectServiceImpl.java
new file mode 100644
index 0000000..aa0c858
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/AccountSubjectServiceImpl.java
@@ -0,0 +1,397 @@
+package com.ruoyi.account.service.impl.financial;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.financial.AccountSubjectDto;
+import com.ruoyi.account.bean.dto.financial.AccountSubjectImportDto;
+import com.ruoyi.account.bean.vo.financial.AccountSubjectVo;
+import com.ruoyi.account.mapper.financial.AccountSubjectMapper;
+import com.ruoyi.account.pojo.financial.AccountSubject;
+import com.ruoyi.account.service.purchase.AccountSubjectService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 鎬昏处绉戠洰琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountSubjectServiceImpl extends ServiceImpl<AccountSubjectMapper, AccountSubject> implements AccountSubjectService {
+
+ private final AccountSubjectMapper accountSubjectMapper;
+
+ @Override
+ public IPage<AccountSubjectVo> baseList(Page<AccountSubjectDto> page, AccountSubjectDto accountSubjectDto) {
+ Page<AccountSubjectDto> requestPage = page == null ? new Page<>(1, 10) : page;
+ List<AccountSubject> allSubjects = list(loadBaseQueryWrapper(accountSubjectDto));
+ List<AccountSubject> filteredSubjects = applyTreeFilter(allSubjects, accountSubjectDto);
+ List<AccountSubjectVo> fullTree = buildTree(filteredSubjects);
+
+ long current = requestPage.getCurrent() <= 0 ? 1 : requestPage.getCurrent();
+ long size = requestPage.getSize() <= 0 ? 10 : requestPage.getSize();
+ int fromIndex = (int) Math.min((current - 1) * size, fullTree.size());
+ int toIndex = (int) Math.min(fromIndex + size, fullTree.size());
+ List<AccountSubjectVo> pagedRoots = fromIndex >= toIndex
+ ? Collections.emptyList()
+ : fullTree.subList(fromIndex, toIndex);
+
+ Page<AccountSubjectVo> resultPage = new Page<>(current, size, fullTree.size());
+ resultPage.setRecords(pagedRoots);
+ return resultPage;
+ }
+
+ @Override
+ public Boolean saveAccountSubject(AccountSubjectDto accountSubjectDto) {
+ validateSubjectRequiredFields(accountSubjectDto);
+ validateSubjectCodeUnique(accountSubjectDto, false);
+ validateParent(accountSubjectDto.getParentId(), null);
+ if (accountSubjectDto.getStatus() == null) {
+ accountSubjectDto.setStatus(0);
+ }
+ return save(accountSubjectDto);
+ }
+
+ @Override
+ public Boolean updateAccountSubject(AccountSubjectDto accountSubjectDto) {
+ if (accountSubjectDto == null || accountSubjectDto.getId() == null) {
+ throw new ServiceException("淇敼澶辫触锛岀鐩甀D涓嶈兘涓虹┖");
+ }
+ if (getById(accountSubjectDto.getId()) == null) {
+ throw new ServiceException("淇敼澶辫触锛屾湭鎵惧埌瀵瑰簲绉戠洰");
+ }
+ validateParent(accountSubjectDto.getParentId(), accountSubjectDto.getId());
+ validateSubjectRequiredFields(accountSubjectDto);
+ validateSubjectCodeUnique(accountSubjectDto, true);
+ return updateById(accountSubjectDto);
+ }
+
+ @Override
+ public Boolean removeAccountSubjectByIds(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ return true;
+ }
+ List<AccountSubject> allSubjects = list();
+ if (allSubjects == null || allSubjects.isEmpty()) {
+ return true;
+ }
+ Map<Long, List<Long>> childrenIdMap = buildChildrenIdMap(allSubjects);
+ Set<Long> removeIds = new LinkedHashSet<>();
+ for (Long id : ids) {
+ collectDescendantIds(id, childrenIdMap, removeIds);
+ }
+ if (removeIds.isEmpty()) {
+ return true;
+ }
+ List<String> subjectCodes = allSubjects.stream()
+ .filter(subject -> removeIds.contains(subject.getId()))
+ .map(AccountSubject::getSubjectCode)
+ .filter(StringUtils::isNotEmpty)
+ .collect(Collectors.toList());
+ if (!subjectCodes.isEmpty()) {
+ Long referencedCount = accountSubjectMapper.countReferencedBySubjectCodes(subjectCodes);
+ if (referencedCount != null && referencedCount > 0) {
+ throw new ServiceException("鍒犻櫎澶辫触锛岀鐩凡琚嚟璇佸垎褰曞紩鐢�");
+ }
+ }
+ return removeByIds(removeIds);
+ }
+
+ @Override
+ public void exportAccountSubject(HttpServletResponse response) {
+ List<AccountSubject> list = accountSubjectMapper.selectList(null);
+ List<AccountSubjectImportDto> importDtos = list.stream().map(accountSubject -> {
+ AccountSubjectImportDto accountSubjectImportDto = new AccountSubjectImportDto();
+ BeanUtils.copyProperties(accountSubject, accountSubjectImportDto);
+ return accountSubjectImportDto;
+ }).collect(Collectors.toList());
+ ExcelUtil<AccountSubjectImportDto> util = new ExcelUtil<>(AccountSubjectImportDto.class);
+ util.exportExcel(response, importDtos , "鎬昏处绉戠洰");
+ }
+
+ /**
+ * 鏍¢獙绉戠洰蹇呭~瀛楁锛岄伩鍏嶈剰鏁版嵁鍐欏叆銆�
+ */
+ private void validateSubjectRequiredFields(AccountSubjectDto accountSubjectDto) {
+ if (accountSubjectDto == null) {
+ throw new ServiceException("鎬昏处绉戠洰鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(accountSubjectDto.getSubjectCode())) {
+ throw new ServiceException("绉戠洰缂栫爜涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(accountSubjectDto.getSubjectName())) {
+ throw new ServiceException("绉戠洰鍚嶇О涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(accountSubjectDto.getSubjectType())) {
+ throw new ServiceException("绉戠洰绫诲瀷涓嶈兘涓虹┖");
+ }
+ }
+
+ /**
+ * 鏍¢獙绉戠洰缂栫爜鍞竴锛屾柊澧炲拰淇敼閮借鎵ц銆�
+ */
+ private void validateSubjectCodeUnique(AccountSubjectDto accountSubjectDto, boolean isUpdate) {
+ LambdaQueryWrapper<AccountSubject> codeQueryWrapper = new LambdaQueryWrapper<>();
+ codeQueryWrapper.eq(AccountSubject::getSubjectCode, accountSubjectDto.getSubjectCode());
+ if (isUpdate) {
+ codeQueryWrapper.ne(AccountSubject::getId, accountSubjectDto.getId());
+ }
+ AccountSubject exists = getOne(codeQueryWrapper, false);
+ if (Objects.nonNull(exists)) {
+ throw new ServiceException("绉戠洰缂栫爜宸插瓨鍦紝璇峰嬁閲嶅鎻愪氦");
+ }
+ }
+
+ /**
+ * 浠呮寜閫氱敤杩囨护鏉′欢鏌ヨ鍩虹鏁版嵁锛堟爲褰㈣繃婊ゅ悗缁啀鍋氾級銆�
+ */
+ private LambdaQueryWrapper<AccountSubject> loadBaseQueryWrapper(AccountSubjectDto accountSubjectDto) {
+ LambdaQueryWrapper<AccountSubject> queryWrapper = new LambdaQueryWrapper<>();
+ if (accountSubjectDto != null && accountSubjectDto.getStatus() != null) {
+ queryWrapper.eq(AccountSubject::getStatus, accountSubjectDto.getStatus());
+ }
+ queryWrapper.orderByDesc(AccountSubject::getSubjectCode).orderByDesc(AccountSubject::getId);
+ return queryWrapper;
+ }
+
+ /**
+ * 鏍戝舰杩囨护锛氬懡涓妭鐐瑰悗淇濈暀鍏剁埗閾句笌瀛愭爲锛屼繚璇侀�掑綊缁撴瀯瀹屾暣銆�
+ */
+ private List<AccountSubject> applyTreeFilter(List<AccountSubject> allSubjects, AccountSubjectDto queryDto) {
+ if (allSubjects == null || allSubjects.isEmpty()) {
+ return Collections.emptyList();
+ }
+ boolean hasFilter = queryDto != null && (
+ StringUtils.isNotEmpty(queryDto.getSubjectCode())
+ || StringUtils.isNotEmpty(queryDto.getSubjectName())
+ || StringUtils.isNotEmpty(queryDto.getSubjectType())
+ );
+ if (!hasFilter) {
+ return allSubjects;
+ }
+
+ Map<Long, AccountSubject> subjectMap = allSubjects.stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(AccountSubject::getId, item -> item, (a, b) -> a, LinkedHashMap::new));
+ Map<Long, List<AccountSubject>> childrenMap = buildChildrenMap(allSubjects);
+
+ Set<Long> matchedIds = new LinkedHashSet<>();
+ for (AccountSubject subject : allSubjects) {
+ if (subject.getId() == null) {
+ continue;
+ }
+ if (matchesFilter(subject, queryDto)) {
+ matchedIds.add(subject.getId());
+ }
+ }
+ if (matchedIds.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ Set<Long> resultIds = new LinkedHashSet<>(matchedIds);
+ for (Long matchedId : matchedIds) {
+ addAncestors(matchedId, subjectMap, resultIds);
+ addDescendants(matchedId, childrenMap, resultIds);
+ }
+
+ return allSubjects.stream()
+ .filter(item -> item.getId() != null && resultIds.contains(item.getId()))
+ .collect(Collectors.toList());
+ }
+
+ private boolean matchesFilter(AccountSubject subject, AccountSubjectDto queryDto) {
+ if (queryDto == null) {
+ return true;
+ }
+ if (StringUtils.isNotEmpty(queryDto.getSubjectCode())
+ && (subject.getSubjectCode() == null || !subject.getSubjectCode().contains(queryDto.getSubjectCode()))) {
+ return false;
+ }
+ if (StringUtils.isNotEmpty(queryDto.getSubjectName())
+ && (subject.getSubjectName() == null || !subject.getSubjectName().contains(queryDto.getSubjectName()))) {
+ return false;
+ }
+ if (StringUtils.isNotEmpty(queryDto.getSubjectType())
+ && !queryDto.getSubjectType().equals(subject.getSubjectType())) {
+ return false;
+ }
+ return true;
+ }
+
+ private void addAncestors(Long subjectId, Map<Long, AccountSubject> subjectMap, Set<Long> resultIds) {
+ AccountSubject current = subjectMap.get(subjectId);
+ if (current == null) {
+ return;
+ }
+ Long parentId = current.getParentId();
+ while (parentId != null && parentId > 0) {
+ AccountSubject parent = subjectMap.get(parentId);
+ if (parent == null) {
+ break;
+ }
+ if (!resultIds.add(parent.getId())) {
+ break;
+ }
+ parentId = parent.getParentId();
+ }
+ }
+
+ private void addDescendants(Long subjectId, Map<Long, List<AccountSubject>> childrenMap, Set<Long> resultIds) {
+ List<AccountSubject> children = childrenMap.getOrDefault(subjectId, Collections.emptyList());
+ for (AccountSubject child : children) {
+ if (child.getId() == null) {
+ continue;
+ }
+ if (resultIds.add(child.getId())) {
+ addDescendants(child.getId(), childrenMap, resultIds);
+ }
+ }
+ }
+
+ private Map<Long, List<AccountSubject>> buildChildrenMap(List<AccountSubject> subjects) {
+ Map<Long, List<AccountSubject>> childrenMap = new HashMap<>();
+ for (AccountSubject subject : subjects) {
+ if (subject.getId() == null) {
+ continue;
+ }
+ Long parentId = subject.getParentId();
+ if (parentId == null || parentId <= 0) {
+ continue;
+ }
+ childrenMap.computeIfAbsent(parentId, key -> new ArrayList<>()).add(subject);
+ }
+ return childrenMap;
+ }
+
+ /**
+ * 鍩轰簬 parentId 閫掑綊鏋勫缓绉戠洰鏍戙��
+ */
+ private List<AccountSubjectVo> buildTree(List<AccountSubject> subjects) {
+ if (subjects == null || subjects.isEmpty()) {
+ return Collections.emptyList();
+ }
+ List<AccountSubject> sortedSubjects = new ArrayList<>(subjects);
+ sortedSubjects.sort(Comparator
+ .comparing(AccountSubject::getSubjectCode, Comparator.nullsFirst(String::compareTo)).reversed()
+ .thenComparing(AccountSubject::getId, Comparator.nullsFirst(Long::compareTo)).reversed());
+
+ Map<Long, AccountSubjectVo> subjectVoMap = new LinkedHashMap<>();
+ for (AccountSubject subject : sortedSubjects) {
+ if (subject.getId() == null) {
+ continue;
+ }
+ AccountSubjectVo vo = new AccountSubjectVo();
+ BeanUtils.copyProperties(subject, vo);
+ subjectVoMap.put(subject.getId(), vo);
+ }
+
+ List<AccountSubjectVo> roots = new ArrayList<>();
+ for (AccountSubject subject : sortedSubjects) {
+ if (subject.getId() == null) {
+ continue;
+ }
+ AccountSubjectVo current = subjectVoMap.get(subject.getId());
+ Long parentId = subject.getParentId();
+ if (parentId != null && parentId > 0 && subjectVoMap.containsKey(parentId)) {
+ subjectVoMap.get(parentId).getChildren().add(current);
+ } else {
+ roots.add(current);
+ }
+ }
+
+ markLeafRecursively(roots);
+ return roots;
+ }
+
+ private void markLeafRecursively(List<AccountSubjectVo> nodes) {
+ for (AccountSubjectVo node : nodes) {
+ List<AccountSubjectVo> children = node.getChildren();
+ node.setLeaf(children == null || children.isEmpty());
+ if (children != null && !children.isEmpty()) {
+ markLeafRecursively(children);
+ }
+ }
+ }
+
+ /**
+ * 鏍¢獙鐖跺瓙鍏崇郴锛氱埗鑺傜偣蹇呴』瀛樺湪锛屼笖涓嶈兘褰㈡垚寰幆寮曠敤銆�
+ */
+ private void validateParent(Long parentId, Long currentId) {
+ if (parentId == null || parentId <= 0) {
+ return;
+ }
+ if (currentId != null && parentId.equals(currentId)) {
+ throw new ServiceException("鐖剁鐩笉鑳介�夋嫨鑷韩");
+ }
+ AccountSubject parent = getById(parentId);
+ if (parent == null) {
+ throw new ServiceException("鐖剁鐩笉瀛樺湪锛岃閲嶆柊閫夋嫨");
+ }
+ // 闃叉褰㈡垚鐜細鏇存柊鏃讹紝鐖惰妭鐐逛笉鑳芥槸褰撳墠鑺傜偣鐨勪换鎰忓瓙瀛欒妭鐐广��
+ if (currentId != null) {
+ Set<Long> visited = new HashSet<>();
+ Long traceParentId = parentId;
+ while (traceParentId != null && traceParentId > 0) {
+ if (!visited.add(traceParentId)) {
+ throw new ServiceException("绉戠洰灞傜骇瀛樺湪寰幆寮曠敤锛岃妫�鏌ョ埗绉戠洰璁剧疆");
+ }
+ if (traceParentId.equals(currentId)) {
+ throw new ServiceException("鐖剁鐩笉鑳芥槸褰撳墠绉戠洰鎴栧叾瀛愮鐩�");
+ }
+ AccountSubject traceNode = getById(traceParentId);
+ if (traceNode == null) {
+ break;
+ }
+ traceParentId = traceNode.getParentId();
+ }
+ }
+ }
+
+ private Map<Long, List<Long>> buildChildrenIdMap(List<AccountSubject> subjects) {
+ Map<Long, List<Long>> map = new HashMap<>();
+ for (AccountSubject subject : subjects) {
+ if (subject.getId() == null || subject.getParentId() == null || subject.getParentId() <= 0) {
+ continue;
+ }
+ map.computeIfAbsent(subject.getParentId(), key -> new ArrayList<>()).add(subject.getId());
+ }
+ return map;
+ }
+
+ /**
+ * 鏀堕泦寰呭垹闄よ妭鐐瑰強鍏舵墍鏈夊瓙瀛欒妭鐐广��
+ */
+ private void collectDescendantIds(Long id, Map<Long, List<Long>> childrenIdMap, Set<Long> result) {
+ if (id == null || !result.add(id)) {
+ return;
+ }
+ List<Long> children = childrenIdMap.getOrDefault(id, Collections.emptyList());
+ for (Long childId : children) {
+ collectDescendantIds(childId, childrenIdMap, result);
+ }
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/FinFixedAssetServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/FinFixedAssetServiceImpl.java
new file mode 100644
index 0000000..cb7a476
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/FinFixedAssetServiceImpl.java
@@ -0,0 +1,231 @@
+package com.ruoyi.account.service.impl.financial;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.financial.FinFixedAssetDto;
+import com.ruoyi.account.mapper.financial.FinFixedAssetMapper;
+import com.ruoyi.account.pojo.financial.FinFixedAsset;
+import com.ruoyi.account.service.financial.FinFixedAssetService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+/**
+ * 鍥哄畾璧勪骇鏈嶅姟瀹炵幇銆�
+ */
+@Service
+@RequiredArgsConstructor
+public class FinFixedAssetServiceImpl extends ServiceImpl<FinFixedAssetMapper, FinFixedAsset> implements FinFixedAssetService {
+
+ private static final BigDecimal ONE_HUNDRED = new BigDecimal("100");
+ private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+
+ @Override
+ public IPage<FinFixedAsset> pageList(Page<FinFixedAsset> page, FinFixedAssetDto queryDto) {
+ LambdaQueryWrapper<FinFixedAsset> wrapper = new LambdaQueryWrapper<>();
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetCode())) {
+ wrapper.like(FinFixedAsset::getAssetCode, queryDto.getAssetCode());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetName())) {
+ wrapper.like(FinFixedAsset::getAssetName, queryDto.getAssetName());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getCategory())) {
+ wrapper.eq(FinFixedAsset::getCategory, queryDto.getCategory());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getStatus())) {
+ wrapper.eq(FinFixedAsset::getStatus, queryDto.getStatus());
+ }
+ wrapper.orderByDesc(FinFixedAsset::getId);
+ return page(page, wrapper);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean add(FinFixedAssetDto dto) {
+ validateForSave(dto, false);
+ if (StringUtils.isEmpty(dto.getAssetCode())) {
+ dto.setAssetCode(generateAssetCode());
+ }
+ BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate());
+ dto.setResidualRate(residualRate);
+ BigDecimal accumulatedDepreciation = defaultMoney(dto.getAccumulatedDepreciation());
+ dto.setAccumulatedDepreciation(accumulatedDepreciation);
+ dto.setNetValue(calculateNetValue(dto.getOriginalValue(), accumulatedDepreciation));
+ if (StringUtils.isEmpty(dto.getStatus())) {
+ dto.setStatus("in_use");
+ }
+ return save(dto);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean update(FinFixedAssetDto dto) {
+ if (dto == null || dto.getId() == null) {
+ throw new ServiceException("淇敼澶辫触锛岃祫浜D涓嶈兘涓虹┖");
+ }
+ FinFixedAsset existed = getById(dto.getId());
+ if (existed == null) {
+ throw new ServiceException("淇敼澶辫触锛屽浐瀹氳祫浜т笉瀛樺湪");
+ }
+ if (StringUtils.isEmpty(dto.getAssetCode())) {
+ dto.setAssetCode(existed.getAssetCode());
+ }
+ if (StringUtils.isEmpty(dto.getStatus())) {
+ dto.setStatus(existed.getStatus());
+ }
+ validateForSave(dto, true);
+ BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate());
+ dto.setResidualRate(residualRate);
+ if (dto.getAccumulatedDepreciation() == null) {
+ dto.setAccumulatedDepreciation(defaultMoney(existed.getAccumulatedDepreciation()));
+ }
+ dto.setNetValue(calculateNetValue(dto.getOriginalValue(), dto.getAccumulatedDepreciation()));
+ return updateById(dto);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean deleteByIds(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ throw new ServiceException("鍒犻櫎澶辫触锛岃閫夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ }
+ return removeByIds(ids);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Map<String, Object> depreciate(List<Long> ids) {
+ LambdaQueryWrapper<FinFixedAsset> wrapper = new LambdaQueryWrapper<>();
+ if (ids != null && !ids.isEmpty()) {
+ wrapper.in(FinFixedAsset::getId, ids);
+ } else {
+ wrapper.eq(FinFixedAsset::getStatus, "in_use");
+ }
+ List<FinFixedAsset> assets = list(wrapper);
+ BigDecimal totalMonthlyDepreciation = ZERO;
+ int processedCount = 0;
+ for (FinFixedAsset asset : assets) {
+ if (!"in_use".equals(asset.getStatus())) {
+ continue;
+ }
+ BigDecimal monthlyDepreciation = calculateMonthlyDepreciation(
+ asset.getOriginalValue(),
+ asset.getResidualRate(),
+ asset.getUsefulLife()
+ );
+ BigDecimal accumulatedDepreciation = defaultMoney(asset.getAccumulatedDepreciation()).add(monthlyDepreciation);
+ if (accumulatedDepreciation.compareTo(defaultMoney(asset.getOriginalValue())) > 0) {
+ accumulatedDepreciation = defaultMoney(asset.getOriginalValue());
+ }
+ asset.setAccumulatedDepreciation(roundMoney(accumulatedDepreciation));
+ asset.setNetValue(calculateNetValue(asset.getOriginalValue(), asset.getAccumulatedDepreciation()));
+ updateById(asset);
+ processedCount++;
+ totalMonthlyDepreciation = totalMonthlyDepreciation.add(monthlyDepreciation);
+ }
+ Map<String, Object> result = new HashMap<>(4);
+ result.put("processedCount", processedCount);
+ result.put("totalMonthlyDepreciation", roundMoney(totalMonthlyDepreciation));
+ result.put("executionTime", LocalDateTime.now());
+ return result;
+ }
+
+ /**
+ * 鎸夋枃妗h鍒欐牎楠屽浐瀹氳祫浜ф暟鎹��
+ */
+ private void validateForSave(FinFixedAssetDto dto, boolean isUpdate) {
+ if (dto == null) {
+ throw new ServiceException("鍥哄畾璧勪骇鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (isUpdate && dto.getId() == null) {
+ throw new ServiceException("淇敼澶辫触锛岃祫浜D涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(dto.getAssetName())) {
+ throw new ServiceException("璧勪骇鍚嶇О涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(dto.getCategory())) {
+ throw new ServiceException("璧勪骇绫诲埆涓嶈兘涓虹┖");
+ }
+ if (dto.getPurchaseDate() == null) {
+ throw new ServiceException("璐疆鏃ユ湡涓嶈兘涓虹┖");
+ }
+ if (dto.getOriginalValue() == null || dto.getOriginalValue().compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("璧勪骇鍘熷�间笉鑳戒负绌轰笖涓嶈兘灏忎簬0");
+ }
+ if (dto.getUsefulLife() == null || dto.getUsefulLife() <= 0) {
+ throw new ServiceException("浣跨敤骞撮檺蹇呴』澶т簬0");
+ }
+ if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("娈嬪�肩巼涓嶈兘灏忎簬0");
+ }
+ if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(ONE_HUNDRED) > 0) {
+ throw new ServiceException("娈嬪�肩巼涓嶈兘澶т簬100%");
+ }
+ if (StringUtils.isNotEmpty(dto.getAssetCode())) {
+ LambdaQueryWrapper<FinFixedAsset> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(FinFixedAsset::getAssetCode, dto.getAssetCode());
+ if (isUpdate) {
+ wrapper.ne(FinFixedAsset::getId, dto.getId());
+ }
+ if (count(wrapper) > 0) {
+ throw new ServiceException("璧勪骇缂栧彿宸插瓨鍦紝璇峰嬁閲嶅鎻愪氦");
+ }
+ }
+ }
+
+ /**
+ * 鍥哄畾璧勪骇鎶樻棫鍏紡锛�
+ * monthlyDepreciation = originalValue * (1 - residualRate/100) / (usefulLife*12)
+ */
+ private BigDecimal calculateMonthlyDepreciation(BigDecimal originalValue, BigDecimal residualRate, Integer usefulLife) {
+ BigDecimal normalizedOriginalValue = defaultMoney(originalValue);
+ BigDecimal normalizedResidualRate = normalizeResidualRate(residualRate);
+ BigDecimal depreciableRatio = BigDecimal.ONE.subtract(normalizedResidualRate.divide(ONE_HUNDRED, 8, RoundingMode.HALF_UP));
+ BigDecimal months = BigDecimal.valueOf((long) usefulLife * 12L);
+ if (months.compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("浣跨敤骞撮檺鏃犳晥锛屾棤娉曡鎻愭姌鏃�");
+ }
+ return roundMoney(normalizedOriginalValue.multiply(depreciableRatio).divide(months, 8, RoundingMode.HALF_UP));
+ }
+
+ /**
+ * 鍑�鍊� = 鍘熷�� - 绱鎶樻棫銆�
+ */
+ private BigDecimal calculateNetValue(BigDecimal originalValue, BigDecimal accumulatedDepreciation) {
+ BigDecimal value = defaultMoney(originalValue).subtract(defaultMoney(accumulatedDepreciation));
+ if (value.compareTo(BigDecimal.ZERO) < 0) {
+ value = BigDecimal.ZERO;
+ }
+ return roundMoney(value);
+ }
+
+ private BigDecimal normalizeResidualRate(BigDecimal residualRate) {
+ return residualRate == null ? BigDecimal.ZERO : residualRate;
+ }
+
+ private BigDecimal defaultMoney(BigDecimal value) {
+ return value == null ? ZERO : roundMoney(value);
+ }
+
+ private BigDecimal roundMoney(BigDecimal value) {
+ if (value == null) {
+ return ZERO;
+ }
+ return value.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private String generateAssetCode() {
+ return "GD" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/FinIntangibleAssetServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/FinIntangibleAssetServiceImpl.java
new file mode 100644
index 0000000..72e5f06
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/FinIntangibleAssetServiceImpl.java
@@ -0,0 +1,250 @@
+package com.ruoyi.account.service.impl.financial;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.financial.FinIntangibleAssetDto;
+import com.ruoyi.account.mapper.financial.FinIntangibleAssetMapper;
+import com.ruoyi.account.pojo.financial.FinIntangibleAsset;
+import com.ruoyi.account.service.financial.FinIntangibleAssetService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+/**
+ * 鏃犲舰璧勪骇鏈嶅姟瀹炵幇銆�
+ */
+@Service
+@RequiredArgsConstructor
+public class FinIntangibleAssetServiceImpl extends ServiceImpl<FinIntangibleAssetMapper, FinIntangibleAsset> implements FinIntangibleAssetService {
+
+ private static final BigDecimal ONE_HUNDRED = new BigDecimal("100");
+ private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+
+ @Override
+ public IPage<FinIntangibleAsset> pageList(Page<FinIntangibleAsset> page, FinIntangibleAssetDto queryDto) {
+ LambdaQueryWrapper<FinIntangibleAsset> wrapper = new LambdaQueryWrapper<>();
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetCode())) {
+ wrapper.like(FinIntangibleAsset::getAssetCode, queryDto.getAssetCode());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getAssetName())) {
+ wrapper.like(FinIntangibleAsset::getAssetName, queryDto.getAssetName());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getCategory())) {
+ wrapper.eq(FinIntangibleAsset::getCategory, queryDto.getCategory());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getStatus())) {
+ wrapper.eq(FinIntangibleAsset::getStatus, queryDto.getStatus());
+ }
+ wrapper.orderByDesc(FinIntangibleAsset::getId);
+ return page(page, wrapper);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean add(FinIntangibleAssetDto dto) {
+ validateForSave(dto, false);
+ if (StringUtils.isEmpty(dto.getAssetCode())) {
+ dto.setAssetCode(generateAssetCode());
+ }
+ BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate());
+ dto.setResidualRate(residualRate);
+ BigDecimal accumulatedAmortization = defaultMoney(dto.getAccumulatedAmortization());
+ dto.setAccumulatedAmortization(accumulatedAmortization);
+ dto.setNetValue(calculateNetValue(dto.getOriginalValue(), accumulatedAmortization));
+ if (StringUtils.isEmpty(dto.getStatus())) {
+ dto.setStatus("in_use");
+ }
+ return save(dto);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean update(FinIntangibleAssetDto dto) {
+ if (dto == null || dto.getId() == null) {
+ throw new ServiceException("淇敼澶辫触锛岃祫浜D涓嶈兘涓虹┖");
+ }
+ FinIntangibleAsset existed = getById(dto.getId());
+ if (existed == null) {
+ throw new ServiceException("淇敼澶辫触锛屾棤褰㈣祫浜т笉瀛樺湪");
+ }
+ if (StringUtils.isEmpty(dto.getAssetCode())) {
+ dto.setAssetCode(existed.getAssetCode());
+ }
+ if (StringUtils.isEmpty(dto.getStatus())) {
+ dto.setStatus(existed.getStatus());
+ }
+ validateForSave(dto, true);
+ BigDecimal residualRate = normalizeResidualRate(dto.getResidualRate());
+ dto.setResidualRate(residualRate);
+ if (dto.getAccumulatedAmortization() == null) {
+ dto.setAccumulatedAmortization(defaultMoney(existed.getAccumulatedAmortization()));
+ }
+ dto.setNetValue(calculateNetValue(dto.getOriginalValue(), dto.getAccumulatedAmortization()));
+ if (dto.getNetValue().compareTo(BigDecimal.ZERO) <= 0) {
+ dto.setStatus("amortized");
+ } else if ("amortized".equals(dto.getStatus())) {
+ dto.setStatus("in_use");
+ }
+ if (dto.getValidityDate() != null
+ && dto.getValidityDate().isBefore(LocalDate.now())
+ && !"amortized".equals(dto.getStatus())) {
+ dto.setStatus("expired");
+ }
+ return updateById(dto);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean deleteByIds(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ throw new ServiceException("鍒犻櫎澶辫触锛岃閫夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ }
+ return removeByIds(ids);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Map<String, Object> amortize(List<Long> ids) {
+ LambdaQueryWrapper<FinIntangibleAsset> wrapper = new LambdaQueryWrapper<>();
+ if (ids != null && !ids.isEmpty()) {
+ wrapper.in(FinIntangibleAsset::getId, ids);
+ } else {
+ wrapper.eq(FinIntangibleAsset::getStatus, "in_use");
+ }
+ List<FinIntangibleAsset> assets = list(wrapper);
+ BigDecimal totalMonthlyAmortization = ZERO;
+ int processedCount = 0;
+ for (FinIntangibleAsset asset : assets) {
+ if (!"in_use".equals(asset.getStatus())) {
+ continue;
+ }
+ BigDecimal monthlyAmortization = calculateMonthlyAmortization(
+ asset.getOriginalValue(),
+ asset.getResidualRate(),
+ asset.getAmortizationPeriod()
+ );
+ BigDecimal accumulatedAmortization = defaultMoney(asset.getAccumulatedAmortization()).add(monthlyAmortization);
+ if (accumulatedAmortization.compareTo(defaultMoney(asset.getOriginalValue())) > 0) {
+ accumulatedAmortization = defaultMoney(asset.getOriginalValue());
+ }
+ asset.setAccumulatedAmortization(roundMoney(accumulatedAmortization));
+ asset.setNetValue(calculateNetValue(asset.getOriginalValue(), asset.getAccumulatedAmortization()));
+
+ // 瑙勫垯锛氬綋鍑�鍊� <= 0 鏃讹紝鍑�鍊煎綊闆跺苟鏍囪涓哄凡鎽婇攢瀹屻��
+ if (asset.getNetValue().compareTo(BigDecimal.ZERO) <= 0) {
+ asset.setNetValue(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP));
+ asset.setStatus("amortized");
+ } else if (asset.getValidityDate() != null && asset.getValidityDate().isBefore(LocalDate.now())) {
+ asset.setStatus("expired");
+ }
+ updateById(asset);
+ processedCount++;
+ totalMonthlyAmortization = totalMonthlyAmortization.add(monthlyAmortization);
+ }
+ Map<String, Object> result = new HashMap<>(4);
+ result.put("processedCount", processedCount);
+ result.put("totalMonthlyAmortization", roundMoney(totalMonthlyAmortization));
+ result.put("executionTime", LocalDateTime.now());
+ return result;
+ }
+
+ /**
+ * 鎸夋枃妗h鍒欐牎楠屾棤褰㈣祫浜ф暟鎹��
+ */
+ private void validateForSave(FinIntangibleAssetDto dto, boolean isUpdate) {
+ if (dto == null) {
+ throw new ServiceException("鏃犲舰璧勪骇鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (isUpdate && dto.getId() == null) {
+ throw new ServiceException("淇敼澶辫触锛岃祫浜D涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(dto.getAssetName())) {
+ throw new ServiceException("璧勪骇鍚嶇О涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(dto.getCategory())) {
+ throw new ServiceException("璧勪骇绫诲埆涓嶈兘涓虹┖");
+ }
+ if (dto.getAcquisitionDate() == null) {
+ throw new ServiceException("鍙栧緱鏃ユ湡涓嶈兘涓虹┖");
+ }
+ if (dto.getOriginalValue() == null || dto.getOriginalValue().compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("璧勪骇鍘熷�间笉鑳戒负绌轰笖涓嶈兘灏忎簬0");
+ }
+ if (dto.getAmortizationPeriod() == null || dto.getAmortizationPeriod() <= 0) {
+ throw new ServiceException("鎽婇攢骞撮檺蹇呴』澶т簬0");
+ }
+ if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("娈嬪�肩巼涓嶈兘灏忎簬0");
+ }
+ if (dto.getResidualRate() != null && dto.getResidualRate().compareTo(ONE_HUNDRED) > 0) {
+ throw new ServiceException("娈嬪�肩巼涓嶈兘澶т簬100%");
+ }
+ if (StringUtils.isNotEmpty(dto.getAssetCode())) {
+ LambdaQueryWrapper<FinIntangibleAsset> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(FinIntangibleAsset::getAssetCode, dto.getAssetCode());
+ if (isUpdate) {
+ wrapper.ne(FinIntangibleAsset::getId, dto.getId());
+ }
+ if (count(wrapper) > 0) {
+ throw new ServiceException("璧勪骇缂栧彿宸插瓨鍦紝璇峰嬁閲嶅鎻愪氦");
+ }
+ }
+ }
+
+ /**
+ * 鏃犲舰璧勪骇鎽婇攢鍏紡锛�
+ * monthlyAmortization = originalValue * (1 - residualRate/100) / (amortizationPeriod*12)
+ */
+ private BigDecimal calculateMonthlyAmortization(BigDecimal originalValue, BigDecimal residualRate, Integer amortizationPeriod) {
+ BigDecimal normalizedOriginalValue = defaultMoney(originalValue);
+ BigDecimal normalizedResidualRate = normalizeResidualRate(residualRate);
+ BigDecimal amortizableRatio = BigDecimal.ONE.subtract(normalizedResidualRate.divide(ONE_HUNDRED, 8, RoundingMode.HALF_UP));
+ BigDecimal months = BigDecimal.valueOf((long) amortizationPeriod * 12L);
+ if (months.compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("鎽婇攢骞撮檺鏃犳晥锛屾棤娉曡鎻愭憡閿�");
+ }
+ return roundMoney(normalizedOriginalValue.multiply(amortizableRatio).divide(months, 8, RoundingMode.HALF_UP));
+ }
+
+ /**
+ * 鍑�鍊� = 鍘熷�� - 绱鎽婇攢銆�
+ */
+ private BigDecimal calculateNetValue(BigDecimal originalValue, BigDecimal accumulatedAmortization) {
+ BigDecimal value = defaultMoney(originalValue).subtract(defaultMoney(accumulatedAmortization));
+ if (value.compareTo(BigDecimal.ZERO) < 0) {
+ value = BigDecimal.ZERO;
+ }
+ return roundMoney(value);
+ }
+
+ private BigDecimal normalizeResidualRate(BigDecimal residualRate) {
+ return residualRate == null ? BigDecimal.ZERO : residualRate;
+ }
+
+ private BigDecimal defaultMoney(BigDecimal value) {
+ return value == null ? ZERO : roundMoney(value);
+ }
+
+ private BigDecimal roundMoney(BigDecimal value) {
+ if (value == null) {
+ return ZERO;
+ }
+ return value.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private String generateAssetCode() {
+ return "WX" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
new file mode 100644
index 0000000..a36b241
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
@@ -0,0 +1,237 @@
+package com.ruoyi.account.service.impl.financial;
+
+import com.ruoyi.account.bean.dto.financial.FinDetailLedgerQueryDto;
+import com.ruoyi.account.bean.dto.financial.FinLedgerQueryDto;
+import com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo;
+import com.ruoyi.account.bean.vo.financial.FinLedgerRowVo;
+import com.ruoyi.account.mapper.financial.FinVoucherEntryMapper;
+import com.ruoyi.account.service.financial.FinLedgerService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+import java.util.*;
+
+/**
+ * 绉戠洰鎬昏处/鏄庣粏璐︽湇鍔″疄鐜般��
+ */
+@Service
+@RequiredArgsConstructor
+public class FinLedgerServiceImpl implements FinLedgerService {
+
+ private static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM");
+ private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+
+ private final FinVoucherEntryMapper finVoucherEntryMapper;
+
+ @Override
+ public List<FinLedgerRowVo> queryGeneralLedger(FinLedgerQueryDto queryDto) {
+ if (queryDto == null || StringUtils.isEmpty(queryDto.getSubjectCode())) {
+ return Collections.emptyList();
+ }
+ YearMonth startMonth = parseMonth(queryDto.getStartMonth(), "寮�濮嬫湀浠�");
+ YearMonth endMonth = parseMonth(queryDto.getEndMonth(), "缁撴潫鏈堜唤");
+ if (startMonth.isAfter(endMonth)) {
+ throw new ServiceException("寮�濮嬫湀浠戒笉鑳藉ぇ浜庣粨鏉熸湀浠�");
+ }
+ return Collections.singletonList(buildGeneralLedgerTotalRow(queryDto.getSubjectCode(), startMonth, endMonth));
+ }
+
+ @Override
+ public List<FinLedgerRowVo> queryDetailLedger(FinDetailLedgerQueryDto queryDto) {
+ if (queryDto == null || StringUtils.isEmpty(queryDto.getSubjectCode())) {
+ return Collections.emptyList();
+ }
+ YearMonth startMonth = parseMonth(queryDto.getStartMonth(), "寮�濮嬫湀浠�");
+ YearMonth endMonth = parseMonth(queryDto.getEndMonth(), "缁撴潫鏈堜唤");
+ if (startMonth.isAfter(endMonth)) {
+ throw new ServiceException("寮�濮嬫湀浠戒笉鑳藉ぇ浜庣粨鏉熸湀浠�");
+ }
+ return buildLedgerRows(queryDto.getSubjectCode(), startMonth, endMonth, queryDto.getAuxiliaryType(), queryDto.getAuxiliaryId());
+ }
+
+ /**
+ * 鏋勫缓璐︾翱琛屾暟鎹紝杈撳嚭鏈熷垵銆佸垎褰曘�佹湰鏈堝悎璁°�佹湰骞寸疮璁°��
+ */
+ private List<FinLedgerRowVo> buildLedgerRows(String subjectCode,
+ YearMonth startMonth,
+ YearMonth endMonth,
+ String auxiliaryType,
+ String auxiliaryId) {
+ LocalDate startDate = startMonth.atDay(1);
+ LocalDate endDate = endMonth.atEndOfMonth();
+
+ List<FinLedgerEntryRecordVo> openingEntries = finVoucherEntryMapper.listPostedEntriesBefore(
+ subjectCode, startDate, auxiliaryType, auxiliaryId
+ );
+ BigDecimal openingBalance = calculateBalance(openingEntries);
+
+ List<FinLedgerEntryRecordVo> currentPeriodEntries = finVoucherEntryMapper.listPostedEntries(
+ subjectCode, startDate, endDate, auxiliaryType, auxiliaryId
+ );
+ Map<YearMonth, List<FinLedgerEntryRecordVo>> monthEntriesMap = groupEntriesByMonth(currentPeriodEntries);
+
+ List<FinLedgerRowVo> rows = new ArrayList<>();
+ BigDecimal runningBalance = openingBalance;
+ BigDecimal yearDebit = ZERO;
+ BigDecimal yearCredit = ZERO;
+
+ for (YearMonth month = startMonth; !month.isAfter(endMonth); month = month.plusMonths(1)) {
+ rows.add(buildOpeningRow(month.atDay(1), runningBalance));
+
+ List<FinLedgerEntryRecordVo> monthEntries = monthEntriesMap.getOrDefault(month, Collections.emptyList());
+ BigDecimal monthDebit = ZERO;
+ BigDecimal monthCredit = ZERO;
+ for (FinLedgerEntryRecordVo entry : monthEntries) {
+ BigDecimal debit = money(entry.getDebit());
+ BigDecimal credit = money(entry.getCredit());
+ runningBalance = runningBalance.add(debit).subtract(credit);
+ monthDebit = monthDebit.add(debit);
+ monthCredit = monthCredit.add(credit);
+
+ FinLedgerRowVo row = new FinLedgerRowVo();
+ row.setRowType("entry");
+ row.setDate(entry.getVoucherDate());
+ row.setVoucherNo(entry.getVoucherNo());
+ row.setSummary(StringUtils.isNotEmpty(entry.getSummary()) ? entry.getSummary() : "");
+ row.setDebit(debit);
+ row.setCredit(credit);
+ row.setBalance(money(runningBalance));
+ row.setDirection(resolveDirection(runningBalance));
+ rows.add(row);
+ }
+
+ rows.add(buildMonthlyTotalRow(month.atEndOfMonth(), monthDebit, monthCredit, runningBalance));
+ yearDebit = yearDebit.add(monthDebit);
+ yearCredit = yearCredit.add(monthCredit);
+ }
+
+ rows.add(buildYearlyTotalRow(endMonth.atEndOfMonth(), yearDebit, yearCredit, runningBalance));
+ return rows;
+ }
+
+ private FinLedgerRowVo buildGeneralLedgerTotalRow(String subjectCode, YearMonth startMonth, YearMonth endMonth) {
+ LocalDate startDate = startMonth.atDay(1);
+ LocalDate endDate = endMonth.atEndOfMonth();
+
+ List<FinLedgerEntryRecordVo> openingEntries = finVoucherEntryMapper.listPostedEntriesBefore(
+ subjectCode, startDate, null, null
+ );
+ BigDecimal openingBalance = calculateBalance(openingEntries);
+
+ List<FinLedgerEntryRecordVo> currentPeriodEntries = finVoucherEntryMapper.listPostedEntries(
+ subjectCode, startDate, endDate, null, null
+ );
+
+ BigDecimal totalDebit = ZERO;
+ BigDecimal totalCredit = ZERO;
+ for (FinLedgerEntryRecordVo entry : currentPeriodEntries) {
+ totalDebit = totalDebit.add(money(entry.getDebit()));
+ totalCredit = totalCredit.add(money(entry.getCredit()));
+ }
+
+ BigDecimal endingBalance = openingBalance.add(totalDebit).subtract(totalCredit);
+ FinLedgerRowVo totalRow = new FinLedgerRowVo();
+ totalRow.setRowType("yearly_total");
+ totalRow.setDate(endDate);
+ totalRow.setDebit(money(totalDebit));
+ totalRow.setCredit(money(totalCredit));
+ totalRow.setBalance(money(endingBalance));
+ totalRow.setDirection(resolveDirection(endingBalance));
+ return totalRow;
+ }
+
+ private Map<YearMonth, List<FinLedgerEntryRecordVo>> groupEntriesByMonth(List<FinLedgerEntryRecordVo> entries) {
+ Map<YearMonth, List<FinLedgerEntryRecordVo>> map = new LinkedHashMap<>();
+ for (FinLedgerEntryRecordVo entry : entries) {
+ if (entry.getVoucherDate() == null) {
+ continue;
+ }
+ YearMonth month = YearMonth.from(entry.getVoucherDate());
+ map.computeIfAbsent(month, key -> new ArrayList<>()).add(entry);
+ }
+ return map;
+ }
+
+ private FinLedgerRowVo buildOpeningRow(LocalDate date, BigDecimal openingBalance) {
+ FinLedgerRowVo row = new FinLedgerRowVo();
+ row.setRowType("opening");
+ row.setDate(date);
+ row.setVoucherNo("-");
+ row.setSummary("鏈熷垵浣欓");
+ row.setDebit(ZERO);
+ row.setCredit(ZERO);
+ row.setBalance(money(openingBalance));
+ row.setDirection(resolveDirection(openingBalance));
+ return row;
+ }
+
+ private FinLedgerRowVo buildMonthlyTotalRow(LocalDate date,
+ BigDecimal monthDebit,
+ BigDecimal monthCredit,
+ BigDecimal monthBalance) {
+ FinLedgerRowVo row = new FinLedgerRowVo();
+ row.setRowType("monthly_total");
+ row.setDate(date);
+ row.setVoucherNo("-");
+ row.setSummary("鏈湀鍚堣");
+ row.setDebit(money(monthDebit));
+ row.setCredit(money(monthCredit));
+ row.setBalance(money(monthBalance));
+ row.setDirection(resolveDirection(monthBalance));
+ return row;
+ }
+
+ private FinLedgerRowVo buildYearlyTotalRow(LocalDate date,
+ BigDecimal yearDebit,
+ BigDecimal yearCredit,
+ BigDecimal yearBalance) {
+ FinLedgerRowVo row = new FinLedgerRowVo();
+ row.setRowType("yearly_total");
+ row.setDate(date);
+ row.setVoucherNo("-");
+ row.setSummary("鍚堣");
+ row.setDebit(money(yearDebit));
+ row.setCredit(money(yearCredit));
+ row.setBalance(money(yearBalance));
+ row.setDirection(resolveDirection(yearBalance));
+ return row;
+ }
+
+ private BigDecimal calculateBalance(List<FinLedgerEntryRecordVo> entries) {
+ BigDecimal balance = ZERO;
+ for (FinLedgerEntryRecordVo entry : entries) {
+ balance = balance.add(money(entry.getDebit())).subtract(money(entry.getCredit()));
+ }
+ return money(balance);
+ }
+
+ private String resolveDirection(BigDecimal balance) {
+ return money(balance).compareTo(BigDecimal.ZERO) >= 0 ? "鍊�" : "璐�";
+ }
+
+ private YearMonth parseMonth(String value, String fieldLabel) {
+ if (StringUtils.isEmpty(value)) {
+ throw new ServiceException(fieldLabel + "涓嶈兘涓虹┖锛屾牸寮忓簲涓篩YYY-MM");
+ }
+ try {
+ return YearMonth.parse(value, MONTH_FORMATTER);
+ } catch (DateTimeParseException ex) {
+ throw new ServiceException(fieldLabel + "鏍煎紡閿欒锛屾牸寮忓簲涓篩YYY-MM");
+ }
+ }
+
+ private BigDecimal money(BigDecimal value) {
+ if (value == null) {
+ return ZERO;
+ }
+ return value.setScale(2, RoundingMode.HALF_UP);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java
new file mode 100644
index 0000000..6859b52
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java
@@ -0,0 +1,307 @@
+package com.ruoyi.account.service.impl.financial;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.financial.FinVoucherDto;
+import com.ruoyi.account.bean.dto.financial.FinVoucherEntryDto;
+import com.ruoyi.account.bean.dto.financial.FinVoucherPageDto;
+import com.ruoyi.account.bean.vo.financial.FinVoucherDetailVo;
+import com.ruoyi.account.mapper.financial.AccountSubjectMapper;
+import com.ruoyi.account.mapper.financial.FinVoucherEntryMapper;
+import com.ruoyi.account.mapper.financial.FinVoucherMapper;
+import com.ruoyi.account.pojo.financial.AccountSubject;
+import com.ruoyi.account.pojo.financial.FinVoucher;
+import com.ruoyi.account.pojo.financial.FinVoucherEntry;
+import com.ruoyi.account.service.financial.FinVoucherService;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 鍑瘉鏈嶅姟瀹炵幇銆�
+ */
+@Service
+@RequiredArgsConstructor
+public class FinVoucherServiceImpl extends ServiceImpl<FinVoucherMapper, FinVoucher> implements FinVoucherService {
+
+ private static final BigDecimal ZERO = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+
+ private final FinVoucherEntryMapper finVoucherEntryMapper;
+ private final AccountSubjectMapper accountSubjectMapper;
+ private final FileUtil fileUtil;
+
+ @Override
+ public IPage<FinVoucher> pageList(Page<FinVoucher> page, FinVoucherPageDto queryDto) {
+ LambdaQueryWrapper<FinVoucher> wrapper = new LambdaQueryWrapper<>();
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getVoucherNo())) {
+ wrapper.like(FinVoucher::getVoucherNo, queryDto.getVoucherNo());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getCreator())) {
+ wrapper.eq(FinVoucher::getCreator, queryDto.getCreator());
+ }
+ if (queryDto != null && StringUtils.isNotEmpty(queryDto.getStatus())) {
+ wrapper.eq(FinVoucher::getStatus, queryDto.getStatus());
+ }
+ if (queryDto != null && queryDto.getStartDate() != null) {
+ wrapper.ge(FinVoucher::getVoucherDate, queryDto.getStartDate());
+ }
+ if (queryDto != null && queryDto.getEndDate() != null) {
+ wrapper.le(FinVoucher::getVoucherDate, queryDto.getEndDate());
+ }
+ wrapper.orderByDesc(FinVoucher::getVoucherDate).orderByDesc(FinVoucher::getId);
+ return page(page, wrapper);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean addVoucher(FinVoucherDto dto) {
+ validateVoucherBasicInfo(dto, false);
+ List<FinVoucherEntry> validEntries = buildAndValidateEntries(dto);
+
+ FinVoucher voucher = new FinVoucher();
+ BeanUtils.copyProperties(dto, voucher);
+ voucher.setStatus("unposted");
+ voucher.setAttachmentCount(voucher.getAttachmentCount() == null ? 0 : voucher.getAttachmentCount());
+ BigDecimal totalDebit = calculateTotalDebit(validEntries);
+ BigDecimal totalCredit = calculateTotalCredit(validEntries);
+ voucher.setDebit(totalDebit);
+ voucher.setCredit(totalCredit);
+ if (StringUtils.isEmpty(voucher.getSummary())) {
+ voucher.setSummary(findDefaultSummary(validEntries));
+ }
+ save(voucher);
+ saveEntries(voucher.getId(), validEntries);
+ // 5. 淇濆瓨閿�鍞彴璐﹂檮浠�
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_VOUCHER, voucher.getId(), dto.getStorageBlobDTOs());
+ return true;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean updateVoucher(FinVoucherDto dto) {
+ validateVoucherBasicInfo(dto, true);
+ FinVoucher existed = getById(dto.getId());
+ if (existed == null) {
+ throw new ServiceException("淇敼澶辫触锛屽嚟璇佷笉瀛樺湪");
+ }
+ if (!"unposted".equals(existed.getStatus())) {
+ throw new ServiceException("浠呮湭杩囪处鍑瘉鍏佽淇敼");
+ }
+ List<FinVoucherEntry> validEntries = buildAndValidateEntries(dto);
+
+ FinVoucher voucher = new FinVoucher();
+ BeanUtils.copyProperties(dto, voucher);
+ voucher.setStatus(existed.getStatus());
+ voucher.setAttachmentCount(voucher.getAttachmentCount() == null ? 0 : voucher.getAttachmentCount());
+ BigDecimal totalDebit = calculateTotalDebit(validEntries);
+ BigDecimal totalCredit = calculateTotalCredit(validEntries);
+ voucher.setDebit(totalDebit);
+ voucher.setCredit(totalCredit);
+ if (StringUtils.isEmpty(voucher.getSummary())) {
+ voucher.setSummary(findDefaultSummary(validEntries));
+ }
+ updateById(voucher);
+
+ LambdaQueryWrapper<FinVoucherEntry> deleteWrapper = new LambdaQueryWrapper<>();
+ deleteWrapper.eq(FinVoucherEntry::getVoucherId, voucher.getId());
+ finVoucherEntryMapper.delete(deleteWrapper);
+ saveEntries(voucher.getId(), validEntries);
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_VOUCHER, voucher.getId(), dto.getStorageBlobDTOs());
+ return true;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean postVoucher(Long id) {
+ FinVoucher voucher = getById(id);
+ if (voucher == null) {
+ throw new ServiceException("杩囪处澶辫触锛屽嚟璇佷笉瀛樺湪");
+ }
+ if (!"unposted".equals(voucher.getStatus())) {
+ throw new ServiceException("浠呮湭杩囪处鍑瘉鍏佽杩囪处");
+ }
+ voucher.setStatus("posted");
+ return updateById(voucher);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean cancelVoucher(Long id) {
+ FinVoucher voucher = getById(id);
+ if (voucher == null) {
+ throw new ServiceException("浣滃簾澶辫触锛屽嚟璇佷笉瀛樺湪");
+ }
+ if (!"unposted".equals(voucher.getStatus())) {
+ throw new ServiceException("浠呮湭杩囪处鍑瘉鍏佽浣滃簾");
+ }
+ voucher.setStatus("cancelled");
+ return updateById(voucher);
+ }
+
+ @Override
+ public FinVoucherDetailVo detail(Long id) {
+ FinVoucher voucher = getById(id);
+ if (voucher == null) {
+ throw new ServiceException("鏌ヨ澶辫触锛屽嚟璇佷笉瀛樺湪");
+ }
+ LambdaQueryWrapper<FinVoucherEntry> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(FinVoucherEntry::getVoucherId, id)
+ .orderByAsc(FinVoucherEntry::getRowNo)
+ .orderByAsc(FinVoucherEntry::getId);
+ List<FinVoucherEntry> entries = finVoucherEntryMapper.selectList(wrapper);
+
+ FinVoucherDetailVo vo = new FinVoucherDetailVo();
+ BeanUtils.copyProperties(voucher, vo);
+ vo.setEntries(entries);
+ vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.FIN_VOUCHER, id));
+ return vo;
+ }
+
+ /**
+ * 鏍¢獙鍑瘉涓昏〃瀛楁銆佺姸鎬佸瓧娈典笌鍞竴鎬с��
+ */
+ private void validateVoucherBasicInfo(FinVoucherDto dto, boolean isUpdate) {
+ if (dto == null) {
+ throw new ServiceException("鍑瘉鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (isUpdate && dto.getId() == null) {
+ throw new ServiceException("淇敼澶辫触锛屽嚟璇両D涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(dto.getVoucherNo())) {
+ throw new ServiceException("鍑瘉瀛楀彿涓嶈兘涓虹┖");
+ }
+ if (dto.getVoucherDate() == null) {
+ throw new ServiceException("鍑瘉鏃ユ湡涓嶈兘涓虹┖");
+ }
+ LambdaQueryWrapper<FinVoucher> uniqueWrapper = new LambdaQueryWrapper<>();
+ uniqueWrapper.eq(FinVoucher::getVoucherNo, dto.getVoucherNo());
+ if (isUpdate) {
+ uniqueWrapper.ne(FinVoucher::getId, dto.getId());
+ }
+ if (count(uniqueWrapper) > 0) {
+ throw new ServiceException("鍑瘉瀛楀彿宸插瓨鍦紝璇峰嬁閲嶅鎻愪氦");
+ }
+ }
+
+ /**
+ * 杩囨护鏈夋晥鍒嗗綍骞舵墽琛屽�熻捶骞宠 鏍¢獙銆�
+ */
+ private List<FinVoucherEntry> buildAndValidateEntries(FinVoucherDto dto) {
+ List<FinVoucherEntryDto> rawEntries = dto.getEntries();
+ if (rawEntries == null || rawEntries.isEmpty()) {
+ throw new ServiceException("鍒嗗綍涓嶈兘涓虹┖锛岃嚦灏戦渶瑕佷竴鏉℃湁鏁堝垎褰�");
+ }
+ List<FinVoucherEntry> validEntries = new ArrayList<>();
+ int rowNo = 1;
+ for (FinVoucherEntryDto entryDto : rawEntries) {
+ if (entryDto == null || StringUtils.isEmpty(entryDto.getSubjectCode())) {
+ continue;
+ }
+ BigDecimal debit = defaultMoney(entryDto.getDebit());
+ BigDecimal credit = defaultMoney(entryDto.getCredit());
+ if (debit.compareTo(BigDecimal.ZERO) <= 0 && credit.compareTo(BigDecimal.ZERO) <= 0) {
+ continue;
+ }
+ if (debit.compareTo(BigDecimal.ZERO) > 0 && credit.compareTo(BigDecimal.ZERO) > 0) {
+ throw new ServiceException("鍒嗗綍鍊熸柟鍜岃捶鏂逛笉鑳藉悓鏃跺ぇ浜�0");
+ }
+ FinVoucherEntry entry = new FinVoucherEntry();
+ BeanUtils.copyProperties(entryDto, entry);
+ entry.setDebit(debit);
+ entry.setCredit(credit);
+ entry.setRowNo(rowNo++);
+ validEntries.add(entry);
+ }
+ if (validEntries.isEmpty()) {
+ throw new ServiceException("鍒嗗綍鑷冲皯闇�瑕佷竴鏉℃湁鏁堣锛堢鐩笉绌猴紝涓斿�熸柟鎴栬捶鏂瑰ぇ浜�0锛�");
+ }
+
+ // 鍒嗗綍绉戠洰蹇呴』瀛樺湪锛岄伩鍏嶈剰绉戠洰缂栫爜鍏ヨ处銆�
+ Set<String> subjectCodes = validEntries.stream()
+ .map(FinVoucherEntry::getSubjectCode)
+ .filter(StringUtils::isNotEmpty)
+ .collect(Collectors.toSet());
+ if (subjectCodes.isEmpty()) {
+ throw new ServiceException("鍒嗗綍绉戠洰涓嶈兘涓虹┖");
+ }
+ LambdaQueryWrapper<AccountSubject> subjectWrapper = new LambdaQueryWrapper<>();
+ subjectWrapper.in(AccountSubject::getSubjectCode, subjectCodes);
+ List<AccountSubject> subjects = accountSubjectMapper.selectList(subjectWrapper);
+ Map<String, AccountSubject> subjectMap = subjects.stream()
+ .collect(Collectors.toMap(AccountSubject::getSubjectCode, it -> it, (a, b) -> a));
+ for (FinVoucherEntry entry : validEntries) {
+ AccountSubject accountSubject = subjectMap.get(entry.getSubjectCode());
+ if (accountSubject == null) {
+ throw new ServiceException("绉戠洰缂栫爜涓嶅瓨鍦細" + entry.getSubjectCode());
+ }
+ if (StringUtils.isEmpty(entry.getSubjectName())) {
+ entry.setSubjectName(accountSubject.getSubjectName());
+ }
+ }
+
+ BigDecimal totalDebit = calculateTotalDebit(validEntries);
+ BigDecimal totalCredit = calculateTotalCredit(validEntries);
+ if (totalDebit.compareTo(BigDecimal.ZERO) <= 0 || totalCredit.compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("鍊熻捶閲戦蹇呴』澶т簬0");
+ }
+ if (totalDebit.compareTo(totalCredit) != 0) {
+ throw new ServiceException("鍊熻捶涓嶅钩琛★紝绂佹淇濆瓨");
+ }
+ return validEntries;
+ }
+
+ private void saveEntries(Long voucherId, List<FinVoucherEntry> entries) {
+ if (voucherId == null) {
+ throw new ServiceException("鍑瘉ID涓嶈兘涓虹┖");
+ }
+ for (FinVoucherEntry entry : entries) {
+ entry.setVoucherId(voucherId);
+ finVoucherEntryMapper.insert(entry);
+ }
+ }
+
+ private String findDefaultSummary(List<FinVoucherEntry> entries) {
+ for (FinVoucherEntry entry : entries) {
+ if (StringUtils.isNotEmpty(entry.getSummary())) {
+ return entry.getSummary();
+ }
+ }
+ return "";
+ }
+
+ private BigDecimal calculateTotalDebit(List<FinVoucherEntry> entries) {
+ BigDecimal total = BigDecimal.ZERO;
+ for (FinVoucherEntry entry : entries) {
+ total = total.add(defaultMoney(entry.getDebit()));
+ }
+ return total.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal calculateTotalCredit(List<FinVoucherEntry> entries) {
+ BigDecimal total = BigDecimal.ZERO;
+ for (FinVoucherEntry entry : entries) {
+ total = total.add(defaultMoney(entry.getCredit()));
+ }
+ return total.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal defaultMoney(BigDecimal value) {
+ if (value == null) {
+ return ZERO;
+ }
+ return value.setScale(2, RoundingMode.HALF_UP);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPaymentApplicationServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPaymentApplicationServiceImpl.java
new file mode 100644
index 0000000..9eecc49
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPaymentApplicationServiceImpl.java
@@ -0,0 +1,96 @@
+package com.ruoyi.account.service.impl.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.mapper.purchase.AccountPaymentApplicationMapper;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.pojo.purchase.AccountPaymentApplication;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.service.purchase.AccountPaymentApplicationService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鐢宠 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:44:22
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountPaymentApplicationServiceImpl extends ServiceImpl<AccountPaymentApplicationMapper, AccountPaymentApplication> implements AccountPaymentApplicationService {
+
+ private final AccountPaymentApplicationMapper accountPaymentApplicationMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss");
+
+ @Override
+ public IPage<AccountPaymentApplicationVo> listPageAccountPaymentApplication(Page page, AccountPaymentApplicationDto accountPaymentApplicationDto) {
+ return accountPaymentApplicationMapper.listPageAccountPaymentApplication(page, accountPaymentApplicationDto);
+ }
+
+ @Override
+ public List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId) {
+ return accountPaymentApplicationMapper.getInboundBatchesBySupplier(supplierId);
+ }
+
+ @Override
+ public boolean addAccountPaymentApplication(AccountPaymentApplication accountPaymentApplication) {
+ if (StringUtils.isEmpty(accountPaymentApplication.getInvoiceApplicationNo())) {
+ accountPaymentApplication.setInvoiceApplicationNo(genPaymentApplicationNo());
+ }
+ String stockInRecordIds= accountPaymentApplication.getStockInRecordIds();
+ if (stockInRecordIds != null && !stockInRecordIds.isEmpty()) {
+ List<Long> ids = Arrays.stream(stockInRecordIds.split(","))
+ .map(Long::valueOf)
+ .toList();
+ if (accountPaymentApplicationMapper.existsByStockInRecordId(ids)){
+ throw new ServiceException("瀛樺湪閲嶅鐨勫叆搴撳崟");
+ }
+ }
+ return save(accountPaymentApplication);
+ }
+
+ @Override
+ public boolean deleteAccountPaymentApplication(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ throw new ServiceException("鍒犻櫎澶辫触锛岃閫夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ }
+ //鍒ゆ柇鏄惁宸茬粡鏈夊搴旂殑浠樻鍗�,濡傛灉鏈夊垯鏃犳硶鍒犻櫎
+ List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery().in(AccountPurchasePayment::getAccountPaymentApplicationId, ids));
+ if (CollectionUtils.isNotEmpty(accountPurchasePayments)){
+ throw new ServiceException("鍒犻櫎澶辫触锛屽凡缁忔湁鍏宠仈鐨勪粯娆惧崟");
+ }
+ //鍒犻櫎寮�绁ㄧ敵璇�
+ return removeBatchByIds(ids);
+ }
+
+ @Override
+ public void exportAccountPaymentApplication(HttpServletResponse response, AccountPaymentApplicationDto accountPaymentApplicationDto) {
+ List<AccountPaymentApplicationVo> list = accountPaymentApplicationMapper.listPageAccountPaymentApplication(new Page(1,-1),accountPaymentApplicationDto).getRecords();
+ ExcelUtil<AccountPaymentApplicationVo> util = new ExcelUtil<>(AccountPaymentApplicationVo.class);
+ util.exportExcel(response, list , "浠樻鐢宠");
+ }
+
+ private String genPaymentApplicationNo() {
+ return "FK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseInvoiceServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseInvoiceServiceImpl.java
new file mode 100644
index 0000000..5ca2efe
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseInvoiceServiceImpl.java
@@ -0,0 +1,59 @@
+package com.ruoyi.account.service.impl.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.mapper.purchase.AccountPurchaseInvoiceMapper;
+import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice;
+import com.ruoyi.account.service.purchase.AccountPurchaseInvoiceService;
+import com.ruoyi.basic.mapper.StorageAttachmentMapper;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--杩涢」鍙戠エ 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:06:17
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountPurchaseInvoiceServiceImpl extends ServiceImpl<AccountPurchaseInvoiceMapper, AccountPurchaseInvoice> implements AccountPurchaseInvoiceService {
+
+ private final AccountPurchaseInvoiceMapper accountPurchaseInvoiceMapper;
+ private final StorageAttachmentMapper storageAttachmentMapper;
+
+ @Override
+ public IPage<AccountPurchaseInvoiceVo> listPageAccountPurchaseInvoice(Page page, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) {
+ return accountPurchaseInvoiceMapper.listPageAccountPurchaseInvoice(page, accountPurchaseInvoiceDto);
+ }
+
+ @Override
+ public boolean deleteAccountPurchaseInvoice(List<Long> ids) {
+ List<AccountPurchaseInvoice> accountPurchaseInvoices = accountPurchaseInvoiceMapper.selectByIds(ids);
+ //鍒犻櫎闄勪欢
+ storageAttachmentMapper.deleteBatchIds(accountPurchaseInvoices.stream().map(AccountPurchaseInvoice::getStorageAttachmentId).toList());
+ return removeBatchByIds(ids);
+ }
+
+ @Override
+ public void exportAccountPurchaseInvoice(HttpServletResponse response, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto) {
+ List<AccountPurchaseInvoiceVo> list = accountPurchaseInvoiceMapper.listPageAccountPurchaseInvoice(new Page(1,-1),accountPurchaseInvoiceDto).getRecords();
+ ExcelUtil<AccountPurchaseInvoiceVo> util = new ExcelUtil<>(AccountPurchaseInvoiceVo.class);
+ util.exportExcel(response, list , "杩涢」鍙戠エ");
+ }
+
+ @Override
+ public List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId) {
+ return accountPurchaseInvoiceMapper.getInboundBatchesBySupplier(supplierId);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchasePaymentServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchasePaymentServiceImpl.java
new file mode 100644
index 0000000..b9953a0
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchasePaymentServiceImpl.java
@@ -0,0 +1,90 @@
+package com.ruoyi.account.service.impl.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo;
+import com.ruoyi.account.mapper.AccountStatementDetailsMapper;
+import com.ruoyi.account.mapper.purchase.AccountPaymentApplicationMapper;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.ruoyi.account.pojo.purchase.AccountPaymentApplication;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.service.purchase.AccountPurchasePaymentService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鍗� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 04:14:51
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountPurchasePaymentServiceImpl extends ServiceImpl<AccountPurchasePaymentMapper, AccountPurchasePayment> implements AccountPurchasePaymentService {
+
+ private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss");
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private final AccountStatementDetailsMapper accountStatementDetailsMapper;
+ private final AccountPaymentApplicationMapper accountPaymentApplicationMapper;
+
+ @Override
+ public IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, AccountPurchasePaymentDto accountPurchasePaymentDto) {
+ return accountPurchasePaymentMapper.listPageAccountPurchasePayment(page, accountPurchasePaymentDto);
+ }
+
+ @Override
+ public boolean addAccountPurchasePayment(AccountPurchasePayment accountPurchasePayment) {
+ if (StringUtils.isEmpty(accountPurchasePayment.getPaymentNumber())) {
+ accountPurchasePayment.setPaymentNumber(genAccountPurchasePaymentNo());
+ }
+ //鏍¢獙绱浠樻閲戦涓嶈兘瓒呰繃鐢宠閲戦
+ AccountPaymentApplication accountPaymentApplication = accountPaymentApplicationMapper.selectById(accountPurchasePayment.getAccountPaymentApplicationId());
+ List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery().eq(AccountPurchasePayment::getAccountPaymentApplicationId, accountPurchasePayment.getAccountPaymentApplicationId()));
+ BigDecimal totalPaymentAmount = accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+ if (accountPaymentApplication.getPaymentAmount().compareTo(totalPaymentAmount) < 0) {
+ throw new ServiceException("绱浠樻閲戦涓嶈兘瓒呰繃鐢宠閲戦");
+ }
+ return save(accountPurchasePayment);
+ }
+
+ @Override
+ public void exportAccountPurchasePayment(HttpServletResponse response, AccountPurchasePaymentDto accountPurchasePaymentDto) {
+ List<AccountPurchasePaymentVo> list = accountPurchasePaymentMapper.listPageAccountPurchasePayment(new Page(1,-1),accountPurchasePaymentDto).getRecords();
+ ExcelUtil<AccountPurchasePaymentVo> util = new ExcelUtil<>(AccountPurchasePaymentVo.class);
+ util.exportExcel(response, list , "浠樻鍗�");
+ }
+
+ @Override
+ public boolean deleteAccountPurchasePayment(List<Long> ids) {
+ //濡傛灉璇ヤ粯娆惧崟宸茬粡鐢熸垚瀵硅处鍗曞垯鏃犳硶鍒犻櫎
+ List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectByIds(ids);
+ List<String> strings = accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentNumber).toList();
+ List<AccountStatementDetails> accountStatementDetails = accountStatementDetailsMapper.selectList(Wrappers.<AccountStatementDetails>lambdaQuery()
+ .in(AccountStatementDetails::getReceiptNumber, strings));
+ if (CollectionUtils.isNotEmpty(accountStatementDetails)){
+ throw new ServiceException("璇ヤ粯娆惧崟宸茬粡鐢熸垚瀵硅处鍗曪紝鏃犳硶鍒犻櫎");
+ }
+ return removeByIds(ids);
+ }
+
+ private String genAccountPurchasePaymentNo() {
+ return "SK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseServiceImpl.java
new file mode 100644
index 0000000..9547d05
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/purchase/AccountPurchaseServiceImpl.java
@@ -0,0 +1,59 @@
+package com.ruoyi.account.service.impl.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto;
+import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo;
+import com.ruoyi.account.service.financial.AccountPurchaseService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
+import com.ruoyi.stock.mapper.StockInRecordMapper;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊鐨勯攢鍞儴鍒� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountPurchaseServiceImpl implements AccountPurchaseService {
+
+ private final StockInRecordMapper stockInRecordMapper;
+
+ private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
+
+
+ @Override
+ public IPage<PurchaseInboundVo> listPageAccountPurchase(Page page, PurchaseInboundDto purchaseInboundDto) {
+ return stockInRecordMapper.listPageAccountPurchase(page,purchaseInboundDto);
+ }
+
+ @Override
+ public void exportAccountPurchaseInbound(HttpServletResponse response, PurchaseInboundDto purchaseInboundDto) {
+ List<PurchaseInboundVo> list = stockInRecordMapper.listPageAccountPurchase(new Page(1,-1),purchaseInboundDto).getRecords();
+ ExcelUtil<PurchaseInboundVo> util = new ExcelUtil<>(PurchaseInboundVo.class);
+ util.exportExcel(response, list , "閲囪喘鍏ュ簱");
+ }
+
+ @Override
+ public IPage<PurchaseReturnVo> listPageAccountPurchaseReturn(Page page, PurchaseReturnDto purchaseReturnDto) {
+ return purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(page,purchaseReturnDto);
+ }
+
+ @Override
+ public void exportAccountPurchaseReturn(HttpServletResponse response, PurchaseReturnDto purchaseReturnDto) {
+ List<PurchaseReturnVo> list = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1,-1),purchaseReturnDto).getRecords();
+ ExcelUtil<PurchaseReturnVo> util = new ExcelUtil<>(PurchaseReturnVo.class);
+ util.exportExcel(response, list , "閲囪喘閫�璐�");
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/sales/AccountInvoiceApplicationServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/sales/AccountInvoiceApplicationServiceImpl.java
new file mode 100644
index 0000000..c88ede2
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/sales/AccountInvoiceApplicationServiceImpl.java
@@ -0,0 +1,102 @@
+package com.ruoyi.account.service.impl.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto;
+import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.mapper.sales.AccountInvoiceApplicationMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesInvoiceMapper;
+import com.ruoyi.account.pojo.sales.AccountInvoiceApplication;
+import com.ruoyi.account.pojo.sales.AccountSalesInvoice;
+import com.ruoyi.account.service.sales.AccountInvoiceApplicationService;
+import com.ruoyi.basic.mapper.StorageAttachmentMapper;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--寮�绁ㄧ敵璇� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 01:38:32
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountInvoiceApplicationServiceImpl extends ServiceImpl<AccountInvoiceApplicationMapper, AccountInvoiceApplication> implements AccountInvoiceApplicationService {
+
+ private final AccountInvoiceApplicationMapper accountInvoiceApplicationMapper;
+ private final AccountSalesInvoiceMapper accountSalesInvoiceMapper;
+ private final StorageAttachmentMapper storageAttachmentMapper;
+ private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss");
+
+ @Override
+ public IPage<AccountInvoiceApplicationVo> listPageAccountInvoiceApplication(Page page, AccountInvoiceApplicationDto accountInvoiceApplicationDto) {
+ return accountInvoiceApplicationMapper.listPageAccountInvoiceApplication(page, accountInvoiceApplicationDto);
+ }
+
+ @Override
+ public List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId) {
+ return accountInvoiceApplicationMapper.getOutboundBatchesByCustomer(customerId);
+ }
+
+ @Override
+ public boolean addAccountInvoiceApplication(AccountInvoiceApplication accountInvoiceApplication) {
+ if (StringUtils.isEmpty(accountInvoiceApplication.getInvoiceApplicationNo())) {
+ accountInvoiceApplication.setInvoiceApplicationNo(genInvoiceApplicationNo());
+ }
+ String stockOutRecordIds = accountInvoiceApplication.getStockOutRecordIds();
+ if (stockOutRecordIds != null && !stockOutRecordIds.isEmpty()) {
+ List<Long> ids = Arrays.stream(stockOutRecordIds.split(","))
+ .map(Long::valueOf)
+ .toList();
+ if (accountInvoiceApplicationMapper.existsByStockOutRecordId(ids)){
+ throw new ServiceException("瀛樺湪閲嶅鐨勫嚭搴撳崟");
+ }
+ }
+ return save(accountInvoiceApplication);
+ }
+
+ @Override
+ public void exportAccountInvoiceApplication(HttpServletResponse response, AccountInvoiceApplicationDto accountInvoiceApplicationDto) {
+ List<AccountInvoiceApplicationVo> list = accountInvoiceApplicationMapper.listPageAccountInvoiceApplication(new Page(1,-1),accountInvoiceApplicationDto).getRecords();
+ ExcelUtil<AccountInvoiceApplicationVo> util = new ExcelUtil<>(AccountInvoiceApplicationVo.class);
+ util.exportExcel(response, list , "寮�绁ㄧ敵璇�");
+ }
+
+ @Override
+ public boolean deleteAccountInvoiceApplication(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ throw new ServiceException("鍒犻櫎澶辫触锛岃閫夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ }
+ //鍒犻櫎鐩稿叧闄勪欢
+ List<AccountSalesInvoice> accountSalesInvoices = accountSalesInvoiceMapper.selectList(Wrappers.<AccountSalesInvoice>lambdaQuery().in(AccountSalesInvoice::getAccountInvoiceApplicationId,ids));
+ storageAttachmentMapper.deleteBatchIds(accountSalesInvoices.stream().map(AccountSalesInvoice::getStorageAttachmentId).toList());
+ //鍒犻櫎鐩稿叧鐨勯攢椤瑰彂绁�
+ accountSalesInvoiceMapper.delete(Wrappers.<AccountSalesInvoice>lambdaQuery().in(AccountSalesInvoice::getAccountInvoiceApplicationId,ids));
+ //鍒犻櫎寮�绁ㄧ敵璇�
+ return removeBatchByIds(ids);
+ }
+
+ @Override
+ public List<AccountInvoiceApplicationVo> getAccountInvoiceApplicationList(Integer customerId) {
+ return accountInvoiceApplicationMapper.selectAccountInvoiceApplicationList(customerId);
+ }
+
+ private String genInvoiceApplicationNo() {
+ return "KP" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesCollectionServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesCollectionServiceImpl.java
new file mode 100644
index 0000000..45900d7
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesCollectionServiceImpl.java
@@ -0,0 +1,96 @@
+package com.ruoyi.account.service.impl.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.mapper.AccountStatementDetailsMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.account.service.sales.AccountSalesCollectionService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--鏀舵鍗� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:49:56
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountSalesCollectionServiceImpl extends ServiceImpl<AccountSalesCollectionMapper, AccountSalesCollection> implements AccountSalesCollectionService {
+
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final AccountStatementDetailsMapper accountStatementDetailsMapper;
+ private static final DateTimeFormatter CODE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss");
+
+
+ @Override
+ public IPage<AccountSalesCollectionVo> listPageAccountSalesCollection(Page page, AccountSalesCollectionDto accountSalesCollectionDto) {
+ return accountSalesCollectionMapper.listPageAccountSalesCollection(page, accountSalesCollectionDto);
+ }
+
+ @Override
+ public boolean addAccountSalesCollection(AccountSalesCollection accountSalesCollection) {
+ if (StringUtils.isEmpty(accountSalesCollection.getCollectionNumber())) {
+ accountSalesCollection.setCollectionNumber(genAccountSalesCollectionNo());
+ }
+// String stockOutRecordIds = accountSalesCollection.getStockOutRecordIds();
+// if (stockOutRecordIds != null && !stockOutRecordIds.isEmpty()) {
+// List<Long> ids = Arrays.stream(stockOutRecordIds.split(","))
+// .map(Long::valueOf)
+// .toList();
+// if (accountSalesCollectionMapper.existsByStockOutRecordId(ids)){
+// throw new ServiceException("瀛樺湪閲嶅鐨勫嚭搴撳崟");
+// }
+// }
+ return save(accountSalesCollection);
+ }
+
+ @Override
+ public void exportAccountSalesCollection(HttpServletResponse response, AccountSalesCollectionDto accountSalesCollectionDto) {
+ List<AccountSalesCollectionVo> list = accountSalesCollectionMapper.listPageAccountSalesCollection(new Page(1,-1),accountSalesCollectionDto).getRecords();
+ ExcelUtil<AccountSalesCollectionVo> util = new ExcelUtil<>(AccountSalesCollectionVo.class);
+ util.exportExcel(response, list , "鏀舵鍗�");
+ }
+
+ @Override
+ public boolean deleteAccountSalesCollection(List<Long> ids) {
+ //濡傛灉璇ユ敹娆惧崟宸茬粡鐢熸垚瀵硅处鍗曞垯鏃犳硶鍒犻櫎
+ List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectByIds(ids);
+ List<String> strings = accountSalesCollections.stream().map(AccountSalesCollection::getCollectionNumber).toList();
+ List<AccountStatementDetails> accountStatementDetails = accountStatementDetailsMapper.selectList(Wrappers.<AccountStatementDetails>lambdaQuery()
+ .in(AccountStatementDetails::getReceiptNumber, strings));
+ if (CollectionUtils.isNotEmpty(accountStatementDetails)){
+ throw new ServiceException("璇ユ敹娆惧崟宸茬粡鐢熸垚瀵硅处鍗曪紝鏃犳硶鍒犻櫎");
+ }
+ return removeByIds(ids);
+ }
+
+ @Override
+ public List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId) {
+ return accountSalesCollectionMapper.getOutboundBatchesByCustomer(customerId);
+ }
+
+ private String genAccountSalesCollectionNo() {
+ return "SK" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesInvoiceServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesInvoiceServiceImpl.java
new file mode 100644
index 0000000..b2fe7e3
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesInvoiceServiceImpl.java
@@ -0,0 +1,53 @@
+package com.ruoyi.account.service.impl.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo;
+import com.ruoyi.account.mapper.sales.AccountSalesInvoiceMapper;
+import com.ruoyi.account.pojo.sales.AccountSalesInvoice;
+import com.ruoyi.account.service.sales.AccountSalesInvoiceService;
+import com.ruoyi.basic.mapper.StorageAttachmentMapper;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--閿�椤瑰彂绁� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:10:20
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountSalesInvoiceServiceImpl extends ServiceImpl<AccountSalesInvoiceMapper, AccountSalesInvoice> implements AccountSalesInvoiceService {
+
+ private final AccountSalesInvoiceMapper accountSalesInvoiceMapper;
+ private final StorageAttachmentMapper storageAttachmentMapper;
+
+ @Override
+ public IPage<AccountSalesInvoiceVo> listPageAccountSalesInvoice(Page page, AccountSalesInvoiceDto accountSalesInvoiceDto) {
+ return accountSalesInvoiceMapper.listPageAccountSalesInvoice(page, accountSalesInvoiceDto);
+ }
+
+ @Override
+ public void exportAccountSalesInvoice(HttpServletResponse response, AccountSalesInvoiceDto accountSalesInvoiceDto) {
+ List<AccountSalesInvoiceVo> list = accountSalesInvoiceMapper.listPageAccountSalesInvoice(new Page(1,-1),accountSalesInvoiceDto).getRecords();
+ ExcelUtil<AccountSalesInvoiceVo> util = new ExcelUtil<>(AccountSalesInvoiceVo.class);
+ util.exportExcel(response, list , "閿�椤瑰彂绁�");
+ }
+
+ @Override
+ public boolean deleteAccountSalesInvoice(List<Long> ids) {
+ List<AccountSalesInvoice> accountSalesInvoices = accountSalesInvoiceMapper.selectByIds(ids);
+ //鍒犻櫎闄勪欢
+ storageAttachmentMapper.deleteBatchIds(accountSalesInvoices.stream().map(AccountSalesInvoice::getStorageAttachmentId).toList());
+ return removeBatchByIds(ids);
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesServiceImpl.java
new file mode 100644
index 0000000..814d294
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/impl/sales/AccountSalesServiceImpl.java
@@ -0,0 +1,58 @@
+package com.ruoyi.account.service.impl.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.SalesOutboundDto;
+import com.ruoyi.account.bean.dto.sales.SalesReturnDto;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.bean.vo.sales.SalesReturnVo;
+import com.ruoyi.account.service.sales.AccountSalesService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊鐨勯攢鍞儴鍒� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+@Service
+@RequiredArgsConstructor
+public class AccountSalesServiceImpl implements AccountSalesService {
+
+ private final StockOutRecordMapper stockOutRecordMapper;
+
+ private final ReturnManagementMapper returnManagementMapper;
+
+ @Override
+ public IPage<SalesOutboundVo> listPageAccountSales(Page page, SalesOutboundDto salesOutboundDto) {
+ return stockOutRecordMapper.listPageAccountSales(page,salesOutboundDto);
+ }
+
+ @Override
+ public void exportAccountSalesOutbound(HttpServletResponse response, SalesOutboundDto salesOutboundDto) {
+ List<SalesOutboundVo> list = stockOutRecordMapper.listPageAccountSales(new Page(1,-1),salesOutboundDto).getRecords();
+ ExcelUtil<SalesOutboundVo> util = new ExcelUtil<>(SalesOutboundVo.class);
+ util.exportExcel(response, list , "閿�鍞嚭搴�");
+ }
+
+ @Override
+ public IPage<SalesReturnVo> listPageAccountSalesReturn(Page page, SalesReturnDto salesReturnDto) {
+ return returnManagementMapper.listPageAccountSalesReturn(page,salesReturnDto);
+ }
+
+ @Override
+ public void exportAccountSalesReturn(HttpServletResponse response, SalesReturnDto salesReturnDto) {
+ List<SalesReturnVo> list = returnManagementMapper.listPageAccountSalesReturn(new Page(1,-1),salesReturnDto).getRecords();
+ ExcelUtil<SalesReturnVo> util = new ExcelUtil<>(SalesReturnVo.class);
+ util.exportExcel(response, list , "閿�鍞��璐�");
+ }
+}
diff --git a/src/main/java/com/ruoyi/account/service/purchase/AccountPaymentApplicationService.java b/src/main/java/com/ruoyi/account/service/purchase/AccountPaymentApplicationService.java
new file mode 100644
index 0000000..c2c5c66
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/purchase/AccountPaymentApplicationService.java
@@ -0,0 +1,33 @@
+package com.ruoyi.account.service.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.account.bean.dto.purchase.AccountPaymentApplicationDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.pojo.purchase.AccountPaymentApplication;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鐢宠 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:44:22
+ */
+public interface AccountPaymentApplicationService extends IService<AccountPaymentApplication> {
+
+ IPage<AccountPaymentApplicationVo> listPageAccountPaymentApplication(Page page, AccountPaymentApplicationDto accountPaymentApplicationDto);
+
+ List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId);
+
+ boolean addAccountPaymentApplication(AccountPaymentApplication accountPaymentApplication);
+
+ boolean deleteAccountPaymentApplication(List<Long> ids);
+
+ void exportAccountPaymentApplication(HttpServletResponse response, AccountPaymentApplicationDto accountPaymentApplicationDto);
+}
diff --git a/src/main/java/com/ruoyi/account/service/purchase/AccountPurchaseInvoiceService.java b/src/main/java/com/ruoyi/account/service/purchase/AccountPurchaseInvoiceService.java
new file mode 100644
index 0000000..d799c5e
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/purchase/AccountPurchaseInvoiceService.java
@@ -0,0 +1,31 @@
+package com.ruoyi.account.service.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchaseInvoiceDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--杩涢」鍙戠エ 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 03:06:17
+ */
+public interface AccountPurchaseInvoiceService extends IService<AccountPurchaseInvoice> {
+
+ IPage<AccountPurchaseInvoiceVo> listPageAccountPurchaseInvoice(Page page, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto);
+
+ boolean deleteAccountPurchaseInvoice(List<Long> ids);
+
+ void exportAccountPurchaseInvoice(HttpServletResponse response, AccountPurchaseInvoiceDto accountPurchaseInvoiceDto);
+
+ List<PurchaseInboundVo> getInboundBatchesBySupplier(Integer supplierId);
+}
diff --git a/src/main/java/com/ruoyi/account/service/purchase/AccountPurchasePaymentService.java b/src/main/java/com/ruoyi/account/service/purchase/AccountPurchasePaymentService.java
new file mode 100644
index 0000000..018a497
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/purchase/AccountPurchasePaymentService.java
@@ -0,0 +1,30 @@
+package com.ruoyi.account.service.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.AccountPurchasePaymentDto;
+import com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--浠樻鍗� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-19 04:14:51
+ */
+public interface AccountPurchasePaymentService extends IService<AccountPurchasePayment> {
+
+ IPage<AccountPurchasePaymentVo> listPageAccountPurchasePayment(Page page, AccountPurchasePaymentDto accountPurchasePaymentDto);
+
+ boolean addAccountPurchasePayment(AccountPurchasePayment accountPurchasePayment);
+
+ void exportAccountPurchasePayment(HttpServletResponse response, AccountPurchasePaymentDto accountPurchasePaymentDto);
+
+ boolean deleteAccountPurchasePayment(List<Long> ids);
+}
diff --git a/src/main/java/com/ruoyi/account/service/purchase/AccountSubjectService.java b/src/main/java/com/ruoyi/account/service/purchase/AccountSubjectService.java
new file mode 100644
index 0000000..51d44ec
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/purchase/AccountSubjectService.java
@@ -0,0 +1,32 @@
+package com.ruoyi.account.service.purchase;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.financial.AccountSubjectDto;
+import com.ruoyi.account.bean.vo.financial.AccountSubjectVo;
+import com.ruoyi.account.pojo.financial.AccountSubject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 鎬昏处绉戠洰琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+public interface AccountSubjectService extends IService<AccountSubject> {
+
+ IPage<AccountSubjectVo> baseList(Page<AccountSubjectDto> page, AccountSubjectDto accountSubjectDto);
+
+ Boolean saveAccountSubject(AccountSubjectDto accountSubjectDto);
+
+ Boolean updateAccountSubject(AccountSubjectDto accountSubjectDto);
+
+ Boolean removeAccountSubjectByIds(List<Long> ids);
+
+ void exportAccountSubject(HttpServletResponse response);
+}
diff --git a/src/main/java/com/ruoyi/account/service/sales/AccountInvoiceApplicationService.java b/src/main/java/com/ruoyi/account/service/sales/AccountInvoiceApplicationService.java
new file mode 100644
index 0000000..d2cefc1
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/sales/AccountInvoiceApplicationService.java
@@ -0,0 +1,35 @@
+package com.ruoyi.account.service.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.account.bean.dto.sales.AccountInvoiceApplicationDto;
+import com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.pojo.sales.AccountInvoiceApplication;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--寮�绁ㄧ敵璇� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 01:38:32
+ */
+public interface AccountInvoiceApplicationService extends IService<AccountInvoiceApplication> {
+
+ IPage<AccountInvoiceApplicationVo> listPageAccountInvoiceApplication(Page page, AccountInvoiceApplicationDto accountInvoiceApplicationDto);
+
+ List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId);
+
+ boolean addAccountInvoiceApplication(AccountInvoiceApplication accountInvoiceApplication);
+
+ void exportAccountInvoiceApplication(HttpServletResponse response, AccountInvoiceApplicationDto accountInvoiceApplicationDto);
+
+ boolean deleteAccountInvoiceApplication(List<Long> ids);
+
+ List<AccountInvoiceApplicationVo> getAccountInvoiceApplicationList(Integer customerId);
+}
diff --git a/src/main/java/com/ruoyi/account/service/sales/AccountSalesCollectionService.java b/src/main/java/com/ruoyi/account/service/sales/AccountSalesCollectionService.java
new file mode 100644
index 0000000..d5172fb
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/sales/AccountSalesCollectionService.java
@@ -0,0 +1,33 @@
+package com.ruoyi.account.service.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountSalesCollectionDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--鏀舵鍗� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:49:56
+ */
+public interface AccountSalesCollectionService extends IService<AccountSalesCollection> {
+
+ IPage<AccountSalesCollectionVo> listPageAccountSalesCollection(Page page, AccountSalesCollectionDto accountSalesCollectionDto);
+
+ boolean addAccountSalesCollection(AccountSalesCollection accountSalesCollection);
+
+ void exportAccountSalesCollection(HttpServletResponse response, AccountSalesCollectionDto accountSalesCollectionDto);
+
+ boolean deleteAccountSalesCollection(List<Long> ids);
+
+ List<SalesOutboundVo> getOutboundBatchesByCustomer(Integer customerId);
+}
diff --git a/src/main/java/com/ruoyi/account/service/sales/AccountSalesInvoiceService.java b/src/main/java/com/ruoyi/account/service/sales/AccountSalesInvoiceService.java
new file mode 100644
index 0000000..1809177
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/sales/AccountSalesInvoiceService.java
@@ -0,0 +1,28 @@
+package com.ruoyi.account.service.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.AccountSalesInvoiceDto;
+import com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo;
+import com.ruoyi.account.pojo.sales.AccountSalesInvoice;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊--閿�椤瑰彂绁� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:10:20
+ */
+public interface AccountSalesInvoiceService extends IService<AccountSalesInvoice> {
+
+ IPage<AccountSalesInvoiceVo> listPageAccountSalesInvoice(Page page, AccountSalesInvoiceDto accountSalesInvoiceDto);
+
+ void exportAccountSalesInvoice(HttpServletResponse response, AccountSalesInvoiceDto accountSalesInvoiceDto);
+
+ boolean deleteAccountSalesInvoice(List<Long> ids);
+}
diff --git a/src/main/java/com/ruoyi/account/service/sales/AccountSalesService.java b/src/main/java/com/ruoyi/account/service/sales/AccountSalesService.java
new file mode 100644
index 0000000..82f606c
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/sales/AccountSalesService.java
@@ -0,0 +1,28 @@
+package com.ruoyi.account.service.sales;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.SalesOutboundDto;
+import com.ruoyi.account.bean.dto.sales.SalesReturnDto;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.bean.vo.sales.SalesReturnVo;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * <p>
+ * 璐㈠姟绠$悊鐨勯攢鍞儴鍒� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-07 04:45:30
+ */
+public interface AccountSalesService {
+
+ IPage<SalesOutboundVo> listPageAccountSales(Page page, SalesOutboundDto salesOutboundDto);
+
+ void exportAccountSalesOutbound(HttpServletResponse response, SalesOutboundDto salesOutboundDto);
+
+ IPage<SalesReturnVo> listPageAccountSalesReturn(Page page, SalesReturnDto salesReturnDto);
+
+ void exportAccountSalesReturn(HttpServletResponse response, SalesReturnDto salesReturnDto);
+}
diff --git a/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java b/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java
index 43fa217..e3b509f 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java
@@ -115,7 +115,6 @@
/**
* 鍒涘缓鏃堕棿
*/
- @TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
diff --git a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
index a141327..49e7ae3 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
@@ -11,6 +11,8 @@
import com.ruoyi.aftersalesservice.service.AfterSalesServiceService;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
+
+import java.time.LocalDateTime;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -69,7 +71,7 @@
if(sysUser == null) throw new RuntimeException("瀹℃牳浜轰笉瀛樺湪");
afterSalesServiceNewDto.setCheckNickName(sysUser.getNickName());
if (StringUtils.isEmpty(afterSalesServiceNewDto.getAfterSalesServiceNo())) {
- String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_");
+ String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_", afterSalesServiceNewDto.getCreateTime() != null ? afterSalesServiceNewDto.getCreateTime() : LocalDateTime.now());
afterSalesServiceNewDto.setAfterSalesServiceNo(string);
}
return this.save(afterSalesServiceNewDto);
diff --git a/src/main/java/com/ruoyi/ai/assistant/ApproveTodoAgent.java b/src/main/java/com/ruoyi/ai/assistant/ApproveTodoAgent.java
index 3b37909..bad0e0a 100644
--- a/src/main/java/com/ruoyi/ai/assistant/ApproveTodoAgent.java
+++ b/src/main/java/com/ruoyi/ai/assistant/ApproveTodoAgent.java
@@ -3,6 +3,7 @@
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
import dev.langchain4j.service.spring.AiService;
import reactor.core.publisher.Flux;
@@ -16,5 +17,5 @@
public interface ApproveTodoAgent {
@SystemMessage(fromResource = "approve-todo-agent-prompt.txt")
- Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage);
+ Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate);
}
diff --git a/src/main/java/com/ruoyi/ai/assistant/ApproveTodoIntentExecutor.java b/src/main/java/com/ruoyi/ai/assistant/ApproveTodoIntentExecutor.java
index 9f8499d..8d8ad45 100644
--- a/src/main/java/com/ruoyi/ai/assistant/ApproveTodoIntentExecutor.java
+++ b/src/main/java/com/ruoyi/ai/assistant/ApproveTodoIntentExecutor.java
@@ -14,8 +14,9 @@
@Component
public class ApproveTodoIntentExecutor {
- private static final Pattern APPROVE_ID_PATTERN = Pattern.compile("\\b[A-Za-z]*\\d{8,}\\b");
- private static final Pattern LIMIT_PATTERN = Pattern.compile("(鍓峾鏈�杩�)?(\\d{1,2})鏉�");
+ private static final Pattern APPROVE_ID_BY_LABEL_PATTERN = Pattern.compile("(娴佺▼缂栧彿|娴佺▼鍙穦娴佺▼ID|瀹℃壒缂栧彿|缂栧彿)\\s*[:锛歖?\\s*([A-Za-z0-9_-]{2,64})");
+ private static final Pattern APPROVE_ID_PATTERN = Pattern.compile("\\b[A-Za-z]*\\d{6,}[A-Za-z0-9_-]*\\b");
+ private static final Pattern LIMIT_PATTERN = Pattern.compile("(鍓峾鏈�杩�)?\\s*(\\d{1,2})\\s*鏉�");
private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})");
private static final Pattern NUMBER_PATTERN = Pattern.compile("(\\d+(?:\\.\\d+)?)");
private static final Pattern RECENT_RANGE_PATTERN = Pattern.compile("杩慭\d+(澶﹟鍛▅涓湀|鏈坾骞�)");
@@ -34,54 +35,63 @@
}
String text = message.trim();
+ String quickPromptResponse = tryExecuteQuickPrompt(memoryId, text);
+ if (StringUtils.hasText(quickPromptResponse)) {
+ return quickPromptResponse;
+ }
+
String approveId = extractApproveId(text);
+ boolean hasApproveId = StringUtils.hasText(approveId) && !isPlaceholderApproveId(approveId);
+ String startDate = extractStartDate(text);
+ String endDate = extractEndDate(text);
+ String timeRange = extractTimeRange(text);
if (isStatsIntent(text)) {
return approveTodoTools.getTodoStats(
memoryId,
- extractStartDate(text),
- extractEndDate(text),
- extractTimeRange(text)
+ startDate,
+ endDate,
+ timeRange
);
}
if (containsAny(text, "娴佽浆", "杩涘害", "鑺傜偣", "鏃ュ織", "鍗″湪", "鍗″埌", "褰撳墠瀹℃壒浜�", "澶勭悊璁板綍")) {
- return StringUtils.hasText(approveId)
+ return hasApproveId
? approveTodoTools.getTodoProgress(memoryId, approveId)
: missingApproveId("todo_progress", "鏌ヨ瀹℃壒杩涘害闇�瑕佹彁渚涙祦绋嬬紪鍙枫��");
}
if (containsAny(text, "璇︽儏", "鏄庣粏") && !containsAny(text, "鍒楄〃")) {
- return StringUtils.hasText(approveId)
+ return hasApproveId
? approveTodoTools.getTodoDetail(memoryId, approveId)
: missingApproveId("todo_detail", "鏌ヨ瀹℃壒璇︽儏闇�瑕佹彁渚涙祦绋嬬紪鍙枫��");
}
if (containsAny(text, "鍙栨秷瀹℃牳", "鎾ら攢瀹℃牳", "鍥為��瀹℃牳", "鎾ら攢瀹℃壒", "鎾ゅ洖瀹℃壒")
|| (containsAny(text, "鎾ら攢", "鎾ゅ洖") && containsAny(text, "瀹℃壒鎿嶄綔", "瀹℃牳鎿嶄綔"))) {
- return StringUtils.hasText(approveId)
- ? approveTodoTools.cancelReviewTodo(memoryId, approveId, firstNonBlank(extractTail(text, "鍘熷洜"), extractTail(text, "澶囨敞")))
+ return hasApproveId
+ ? approveTodoTools.cancelReviewTodo(memoryId, approveId, extractRemark(text))
: missingApproveId("cancel_review_action", "鍙栨秷瀹℃牳闇�瑕佹彁渚涙祦绋嬬紪鍙枫��");
}
if (containsAny(text, "鍒犻櫎", "绉婚櫎")) {
- return StringUtils.hasText(approveId)
+ return hasApproveId
? approveTodoTools.deleteTodo(memoryId, approveId)
: missingApproveId("delete_action", "鍒犻櫎瀹℃壒鍗曢渶瑕佹彁渚涙祦绋嬬紪鍙枫��");
}
if (containsAny(text, "椹冲洖", "鎷掔粷")) {
- return StringUtils.hasText(approveId)
- ? approveTodoTools.reviewTodo(memoryId, approveId, "reject", firstNonBlank(extractTail(text, "鍘熷洜"), extractTail(text, "澶囨敞")))
+ return hasApproveId
+ ? approveTodoTools.reviewTodo(memoryId, approveId, "reject", extractRemark(text))
: missingApproveId("review_action", "椹冲洖瀹℃壒闇�瑕佹彁渚涙祦绋嬬紪鍙枫��");
}
if (containsAny(text, "瀹℃牳閫氳繃", "瀹℃壒閫氳繃", "閫氳繃瀹℃壒", "鍚屾剰瀹℃壒", "瀹℃壒鍚屾剰")) {
- return StringUtils.hasText(approveId)
- ? approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractTail(text, "澶囨敞"))
+ return hasApproveId
+ ? approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractRemark(text))
: missingApproveId("review_action", "瀹℃壒閫氳繃闇�瑕佹彁渚涙祦绋嬬紪鍙枫��");
}
- if (StringUtils.hasText(approveId)
+ if (hasApproveId
&& containsAny(text, "閫氳繃", "鍚屾剰")
&& !containsAny(text, "鏈�氳繃", "閫氳繃鐜�", "瀹℃壒閫氳繃鐜�", "瀹℃牳閫氳繃鐜�")) {
- return approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractTail(text, "澶囨敞"));
+ return approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractRemark(text));
}
if (containsAny(text, "淇敼", "鏇存柊", "鍙樻洿")) {
- return StringUtils.hasText(approveId)
+ return hasApproveId
? approveTodoTools.updateTodo(
memoryId,
approveId,
@@ -101,7 +111,82 @@
extractApproveType(text),
extractKeyword(text),
extractLimit(text),
- extractScope(text));
+ extractScope(text),
+ startDate,
+ endDate,
+ timeRange);
+ }
+ return null;
+ }
+
+ private String tryExecuteQuickPrompt(String memoryId, String text) {
+ String normalized = normalizeForMatch(text);
+ String approveId = extractApproveId(text);
+ boolean hasApproveId = StringUtils.hasText(approveId) && !isPlaceholderApproveId(approveId);
+
+ if ("鎴戝綋鍓嶆湁鍝簺瀹℃壒寰呭姙闇�瑕佸鐞�".equals(normalized)) {
+ return approveTodoTools.listTodos(memoryId, "pending", null, null, 10, "approver", null, null, null);
+ }
+ if ("甯垜鍒楀嚭浠婂ぉ鏂板鐨勫鎵瑰緟鍔�".equals(normalized)) {
+ return approveTodoTools.listTodos(memoryId, "all", null, null, 10, "related", null, null, "浠婂ぉ");
+ }
+ if ("褰撳墠寰呮垜瀹℃壒鐨勫崟鎹寜鏃堕棿鍊掑簭鍒楀嚭鏉�".equals(normalized)) {
+ return approveTodoTools.listTodos(memoryId, "pending", null, null, 10, "approver", null, null, null);
+ }
+ if ("鎴戝彂璧风殑瀹℃壒閲屽摢浜涜繕鍦ㄥ鐞嗕腑".equals(normalized)) {
+ return approveTodoTools.listTodos(memoryId, "processing", null, null, 10, "applicant", null, null, null);
+ }
+ if ("杩�7澶╂垜鐨勫鎵瑰緟鍔炵粺璁℃儏鍐垫�庝箞鏍�".equals(normalized)) {
+ return approveTodoTools.getTodoStats(memoryId, null, null, "杩�7澶�");
+ }
+ if ("鏈湀鎴戠殑瀹℃壒涓�氳繃椹冲洖澶勭悊涓悇鏈夊灏�".equals(normalized)) {
+ return approveTodoTools.getTodoStats(memoryId, null, null, "鏈湀");
+ }
+ if ("杩�30澶╁悇绫诲瀷瀹℃壒鏁伴噺鍒嗗竷鏄粈涔�".equals(normalized)) {
+ return approveTodoTools.getTodoStats(memoryId, null, null, "杩�30澶�");
+ }
+
+ if (normalized.startsWith("鏌ヨ娴佺▼缂栧彿") && normalized.contains("瀹℃壒璇︽儏")) {
+ return hasApproveId
+ ? approveTodoTools.getTodoDetail(memoryId, approveId)
+ : missingApproveId("todo_detail", "鏌ヨ瀹℃壒璇︽儏闇�瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
+ }
+ if (normalized.startsWith("娴佺▼缂栧彿")
+ && normalized.contains("鍗″湪鍝釜瀹℃壒鑺傜偣")
+ && normalized.contains("褰撳墠瀹℃壒浜烘槸璋�")) {
+ return hasApproveId
+ ? approveTodoTools.getTodoProgress(memoryId, approveId)
+ : missingApproveId("todo_progress", "鏌ヨ瀹℃壒杩涘害闇�瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
+ }
+ if (normalized.startsWith("甯垜鏌ョ湅娴佺▼缂栧彿") && normalized.contains("瀹℃壒娴佽浆璁板綍")) {
+ return hasApproveId
+ ? approveTodoTools.getTodoProgress(memoryId, approveId)
+ : missingApproveId("todo_progress", "鏌ヨ瀹℃壒娴佽浆璁板綍闇�瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
+ }
+ if (normalized.startsWith("甯垜瀹℃壒閫氳繃娴佺▼缂栧彿")) {
+ return hasApproveId
+ ? approveTodoTools.reviewTodo(memoryId, approveId, "approve", extractRemark(text))
+ : missingApproveId("review_action", "瀹℃壒閫氳繃闇�瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
+ }
+ if (normalized.startsWith("甯垜椹冲洖娴佺▼缂栧彿")) {
+ return hasApproveId
+ ? approveTodoTools.reviewTodo(memoryId, approveId, "reject", extractRemark(text))
+ : missingApproveId("review_action", "椹冲洖瀹℃壒闇�瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
+ }
+ if (normalized.startsWith("鎾ら攢鎴戝垰鍒氬娴佺▼缂栧彿") && normalized.contains("瀹℃壒鎿嶄綔")) {
+ return hasApproveId
+ ? approveTodoTools.cancelReviewTodo(memoryId, approveId, extractRemark(text))
+ : missingApproveId("cancel_review_action", "鎾ら攢瀹℃壒鎿嶄綔闇�瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
+ }
+ if (normalized.startsWith("甯垜淇敼娴佺▼缂栧彿") && normalized.contains("澶囨敞涓�")) {
+ return hasApproveId
+ ? approveTodoTools.updateTodo(memoryId, approveId, null, null, null, null, null, null, extractRemark(text))
+ : missingApproveId("update_action", "淇敼瀹℃壒鍗曢渶瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
+ }
+ if (normalized.startsWith("鍒犻櫎鎴戝彂璧风殑娴佺▼缂栧彿")) {
+ return hasApproveId
+ ? approveTodoTools.deleteTodo(memoryId, approveId)
+ : missingApproveId("delete_action", "鍒犻櫎瀹℃壒鍗曢渶瑕佹彁渚涚湡瀹炴祦绋嬬紪鍙枫��");
}
return null;
}
@@ -130,6 +215,10 @@
}
private String extractApproveId(String text) {
+ Matcher keywordMatcher = APPROVE_ID_BY_LABEL_PATTERN.matcher(text);
+ if (keywordMatcher.find()) {
+ return keywordMatcher.group(2);
+ }
Matcher matcher = APPROVE_ID_PATTERN.matcher(text);
return matcher.find() ? matcher.group() : null;
}
@@ -196,6 +285,8 @@
.replace("鍗曟嵁", "")
.replace("寰呭姙", "")
.replace("鍒楄〃", "")
+ .replace("娴佺▼缂栧彿", "")
+ .replace("娴佺▼鍙�", "")
.replace("鍓�10鏉�", "")
.replace("鏈�杩�10鏉�", "")
.trim();
@@ -203,7 +294,7 @@
}
private String extractValue(String text, String fieldName) {
- Pattern pattern = Pattern.compile(fieldName + "(鏀逛负|淇敼涓簗鏄�)[:锛歖?[\\s]*([^,锛屻�傦紱;\\s]+)");
+ Pattern pattern = Pattern.compile(fieldName + "(鏀逛负|淇敼涓簗涓簗鏄�)[:锛歖?[\\s]*([^,锛屻�傦紱;\\s]+)");
Matcher matcher = pattern.matcher(text);
return matcher.find() ? matcher.group(2) : null;
}
@@ -250,7 +341,7 @@
if (!text.contains(fieldName)) {
return null;
}
- Matcher matcher = Pattern.compile(fieldName + "(鏀逛负|淇敼涓簗鏄�)[:锛歖?[\\s]*(\\d{1,2})").matcher(text);
+ Matcher matcher = Pattern.compile(fieldName + "(鏀逛负|淇敼涓簗涓簗鏄�)[:锛歖?[\\s]*(\\d{1,2})").matcher(text);
return matcher.find() ? Integer.parseInt(matcher.group(2)) : null;
}
@@ -264,21 +355,85 @@
}
private String extractTail(String text, String key) {
+ Pattern quotedPattern = Pattern.compile(key + "(鏄瘄涓�)?[:锛歖?[\\s]*[鈥淺"]([^鈥漒"]+)[鈥漒"]");
+ Matcher quotedMatcher = quotedPattern.matcher(text);
+ if (quotedMatcher.find()) {
+ return cleanContent(quotedMatcher.group(2));
+ }
Pattern pattern = Pattern.compile(key + "(鏄瘄涓�)?[:锛歖?[\\s]*(.+)");
Matcher matcher = pattern.matcher(text);
- return matcher.find() ? matcher.group(2).trim() : null;
+ return matcher.find() ? cleanContent(matcher.group(2)) : null;
}
private String extractScope(String text) {
if (containsAny(text, "鎴戝彂璧�", "鎴戞彁浜�", "鎴戠敵璇�", "鐢宠浜烘槸鎴�")) {
return "applicant";
}
- if (containsAny(text, "寰呮垜瀹℃壒", "寰呮垜瀹℃牳", "鎴戝鐞�", "鎴戝鎵�", "褰撳墠寰呮垜", "闇�瑕佹垜澶勭悊")) {
+ if (containsAny(text, "寰呮垜瀹℃壒", "寰呮垜瀹℃牳", "鎴戝鐞�", "鎴戝鎵�", "褰撳墠寰呮垜", "闇�瑕佹垜澶勭悊", "闇�瑕佸鐞�")) {
return "approver";
}
return "related";
}
+ private String extractRemark(String text) {
+ return firstNonBlank(firstNonBlank(extractTail(text, "澶囨敞"), extractTail(text, "鍘熷洜")), extractQuotedContent(text));
+ }
+
+ private String extractQuotedContent(String text) {
+ Matcher matcher = Pattern.compile("[鈥淺"]([^鈥漒"]+)[鈥漒"]").matcher(text);
+ return matcher.find() ? cleanContent(matcher.group(1)) : null;
+ }
+
+ private String normalizeForMatch(String text) {
+ if (!StringUtils.hasText(text)) {
+ return "";
+ }
+ return text.replace("锛�", "")
+ .replace(",", "")
+ .replace("銆�", "")
+ .replace(".", "")
+ .replace("锛�", "")
+ .replace("!", "")
+ .replace("锛�", "")
+ .replace("?", "")
+ .replace("锛�", "")
+ .replace(":", "")
+ .replace("锛�", "")
+ .replace(";", "")
+ .replace("鈥�", "")
+ .replace("鈥�", "")
+ .replace("\"", "")
+ .replace(" ", "")
+ .trim();
+ }
+
+ private boolean isPlaceholderApproveId(String approveId) {
+ if (!StringUtils.hasText(approveId)) {
+ return true;
+ }
+ String value = approveId.trim();
+ return "xxx".equalsIgnoreCase(value)
+ || value.matches("[xX]{2,}")
+ || "娴佺▼缂栧彿".equals(value)
+ || "缂栧彿".equals(value)
+ || value.contains("绀轰緥")
+ || value.contains("璇疯緭鍏�");
+ }
+
+ private String cleanContent(String text) {
+ if (!StringUtils.hasText(text)) {
+ return null;
+ }
+ return text.trim()
+ .replace("鈥�", "")
+ .replace("鈥�", "")
+ .replace("\"", "")
+ .replace("銆�", "")
+ .replace("锛�", "")
+ .replace(";", "")
+ .trim();
+ }
+
private String firstNonBlank(String first, String second) {
return StringUtils.hasText(first) ? first : second;
}
diff --git a/src/main/java/com/ruoyi/ai/assistant/FinancialAgent.java b/src/main/java/com/ruoyi/ai/assistant/FinancialAgent.java
new file mode 100644
index 0000000..875b98d
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/assistant/FinancialAgent.java
@@ -0,0 +1,22 @@
+package com.ruoyi.ai.assistant;
+
+import dev.langchain4j.service.MemoryId;
+import dev.langchain4j.service.SystemMessage;
+import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
+import dev.langchain4j.service.spring.AiService;
+import reactor.core.publisher.Flux;
+
+import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT;
+
+@AiService(
+ wiringMode = EXPLICIT,
+ streamingChatModel = "qwenStreamingChatModel",
+ chatMemoryProvider = "chatMemoryProviderFinancial",
+ tools = "financialAgentTools"
+)
+public interface FinancialAgent {
+
+ @SystemMessage(fromResource = "financial-agent-prompt.txt")
+ Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate);
+}
diff --git a/src/main/java/com/ruoyi/ai/assistant/FinancialIntentExecutor.java b/src/main/java/com/ruoyi/ai/assistant/FinancialIntentExecutor.java
new file mode 100644
index 0000000..f402fc2
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/assistant/FinancialIntentExecutor.java
@@ -0,0 +1,284 @@
+package com.ruoyi.ai.assistant;
+
+import com.ruoyi.ai.tools.FinancialAgentTools;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Component
+public class FinancialIntentExecutor {
+
+ private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final Pattern LIMIT_PATTERN = Pattern.compile("(?:鍓峾鏈�杩憒灞曠ず|杩斿洖)?\\s*(\\d{1,2})\\s*(?:鏉涓獆鍚�)");
+ private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})");
+ private static final Pattern RELATIVE_DAY_PATTERN = Pattern.compile("(?:杩憒鏈�杩�)\\s*(\\d{1,3})\\s*澶�");
+ private static final Pattern FUTURE_MONTH_PATTERN = Pattern.compile("(?:鏈潵|鍚庣画|鎺ヤ笅鏉�)\\s*(\\d{1,2})\\s*(?:涓�)?鏈�");
+
+ private final FinancialAgentTools financialAgentTools;
+
+ public FinancialIntentExecutor(FinancialAgentTools financialAgentTools) {
+ this.financialAgentTools = financialAgentTools;
+ }
+
+ public String tryExecute(String memoryId, String message) {
+ if (!StringUtils.hasText(message)) {
+ return null;
+ }
+ String text = message.trim();
+
+ String quickPromptResponse = tryExecuteQuickPrompt(memoryId, text);
+ if (StringUtils.hasText(quickPromptResponse)) {
+ return quickPromptResponse;
+ }
+
+ DateRange dateRange = extractDateRange(text);
+ Integer limit = extractLimit(text);
+ String keyword = extractKeyword(text);
+ String startDate = dateRange.startDate();
+ String endDate = dateRange.endDate();
+ String timeRange = dateRange.label();
+
+ if (containsAny(text, "鎴愭湰鏍哥畻", "浜у搧鎴愭湰", "宸ュ簭鎴愭湰", "浜哄伐鎴愭湰", "鎶樻棫", "鏉愭枡鎹熻��", "鎴愭湰鏈�楂�")) {
+ return financialAgentTools.calculateIntelligentCost(memoryId, startDate, endDate, timeRange, keyword, limit);
+ }
+ if (containsAny(text, "鍒╂鼎鍒嗘瀽", "璁㈠崟鍒╂鼎", "浜忔崯璁㈠崟", "浣庡埄娑�", "鏈�璧氶挶瀹㈡埛", "鍝釜瀹㈡埛鏈�璧氶挶",
+ "瀹㈡埛鏈�璧氶挶", "鍒╂鼎鏈�楂樺鎴�", "鍒╂鼎璐$尞鏈�楂�", "鍒╂鼎涓嬮檷")) {
+ return financialAgentTools.analyzeOrderProfit(memoryId, startDate, endDate, timeRange, keyword, limit);
+ }
+ if (containsAny(text, "搴撳瓨璧勯噾", "搴撳瓨绉帇", "鍛嗘粸搴撳瓨", "璧勯噾鍗犵敤", "鍛ㄨ浆鐜�", "搴撳瓨鍛ㄨ浆")) {
+ return financialAgentTools.analyzeInventoryCapital(memoryId, startDate, endDate, timeRange, keyword, limit);
+ }
+ if (containsAny(text, "鐜伴噾娴�", "鍥炴椋庨櫓", "浠樻鍘嬪姏", "璧勯噾缂哄彛", "搴旀敹", "搴斾粯", "鍥炴棰勬祴")) {
+ return financialAgentTools.forecastCashFlow(memoryId, startDate, endDate, timeRange, extractForecastMonths(text));
+ }
+ if (containsAny(text, "寮傚父棰勮", "缁忚惀寮傚父", "椋庨櫓棰勮", "鎴愭湰寮傚父", "鍒╂鼎寮傚父", "鍥炴寮傚父", "璁㈠崟椋庨櫓")) {
+ return financialAgentTools.detectBusinessAnomalies(memoryId, startDate, endDate, timeRange, limit);
+ }
+ if (containsAny(text, "椹鹃┒鑸�", "缁忚惀鐪嬫澘", "缁忚惀鎬昏", "缁忚惀浠〃鐩�", "缁忚惀澶х洏")) {
+ return financialAgentTools.getBusinessCockpit(memoryId, startDate, endDate, timeRange);
+ }
+ if (containsAny(text, "鏃ユ姤", "鍛ㄦ姤", "缁忚惀鎶ュ憡", "鍒嗘瀽鎶ュ憡")) {
+ return financialAgentTools.generateOperationReport(memoryId, startDate, endDate, timeRange,
+ containsAny(text, "鍛ㄦ姤") ? "weekly" : "daily");
+ }
+ if (containsAny(text, "涓氳储铻嶅悎", "涓氳储鑱斿姩", "鍙e緞", "鎸囨爣瑙i噴", "涓轰粈涔�")) {
+ return financialAgentTools.retrieveFinancialKnowledge(memoryId, text);
+ }
+ return null;
+ }
+
+ private String tryExecuteQuickPrompt(String memoryId, String text) {
+ String normalized = normalizeForMatch(text);
+ if ("鐢熸垚鏈懆缁忚惀鍛ㄦ姤鍒╂鼎涓庣幇閲戞祦".equals(normalized) || "鐢熸垚鏈懆缁忚惀鍛ㄦ姤".equals(normalized) || "鐢熸垚鍛ㄦ姤".equals(normalized)) {
+ DateRange range = weekRange();
+ return financialAgentTools.generateOperationReport(memoryId, range.startDate(), range.endDate(), range.label(), "weekly");
+ }
+ if ("鍒嗘瀽鏈湀鍒╂鼎涓嬮檷鍘熷洜".equals(normalized)) {
+ DateRange range = monthRange();
+ return financialAgentTools.analyzeOrderProfit(memoryId, range.startDate(), range.endDate(), range.label(), null, null);
+ }
+ if ("杩�30澶╁摢涓鎴峰埄娑﹁础鐚渶楂�".equals(normalized)) {
+ DateRange range = recentDaysRange(30);
+ return financialAgentTools.analyzeOrderProfit(memoryId, range.startDate(), range.endDate(), range.label(), null, null);
+ }
+ if ("鏌ョ湅鏈湀缁忚惀椹鹃┒鑸�".equals(normalized) || "鏌ョ湅缁忚惀椹鹃┒鑸�".equals(normalized)) {
+ DateRange range = monthRange();
+ return financialAgentTools.getBusinessCockpit(memoryId, range.startDate(), range.endDate(), range.label());
+ }
+ if ("鏌ヨ杩�30澶╀簭鎹熻鍗�".equals(normalized)) {
+ DateRange range = recentDaysRange(30);
+ return financialAgentTools.analyzeOrderProfit(memoryId, range.startDate(), range.endDate(), range.label(), null, null);
+ }
+ if ("鍒嗘瀽杩�30澶╁簱瀛樿祫閲戝崰鐢�".equals(normalized)) {
+ DateRange range = recentDaysRange(30);
+ return financialAgentTools.analyzeInventoryCapital(memoryId, range.startDate(), range.endDate(), range.label(), null, null);
+ }
+ if ("棰勬祴鏈潵3涓湀鐜伴噾娴�".equals(normalized)) {
+ return financialAgentTools.forecastCashFlow(memoryId, null, null, null, 3);
+ }
+ if ("鍝釜宸ュ簭鎴愭湰鏈�楂�".equals(normalized)) {
+ return financialAgentTools.calculateIntelligentCost(memoryId, null, null, null, null, null);
+ }
+ return null;
+ }
+
+ private boolean containsAny(String text, String... keywords) {
+ for (String keyword : keywords) {
+ if (text.contains(keyword)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Integer extractLimit(String text) {
+ Matcher matcher = LIMIT_PATTERN.matcher(text);
+ return matcher.find() ? Integer.parseInt(matcher.group(1)) : null;
+ }
+
+ private Integer extractForecastMonths(String text) {
+ Matcher matcher = FUTURE_MONTH_PATTERN.matcher(text);
+ return matcher.find() ? Integer.parseInt(matcher.group(1)) : null;
+ }
+
+ private DateRange extractDateRange(String text) {
+ Matcher matcher = DATE_PATTERN.matcher(text);
+ if (matcher.find()) {
+ String first = matcher.group(1);
+ String second = matcher.find() ? matcher.group(1) : first;
+ return buildDateRange(first, second, first + "鑷�" + second);
+ }
+ if (text.contains("鏈湀")) {
+ return monthRange();
+ }
+ if (text.contains("涓婃湀")) {
+ return lastMonthRange();
+ }
+ if (text.contains("浠婂勾") || text.contains("鏈勾")) {
+ return yearRange();
+ }
+ if (text.contains("鏈懆")) {
+ return weekRange();
+ }
+ Matcher relativeDayMatcher = RELATIVE_DAY_PATTERN.matcher(text);
+ if (relativeDayMatcher.find()) {
+ int days = Integer.parseInt(relativeDayMatcher.group(1));
+ return recentDaysRange(days);
+ }
+ return new DateRange(null, null, null);
+ }
+
+ private DateRange buildDateRange(String start, String end, String label) {
+ LocalDate startDate = parseDate(start);
+ LocalDate endDate = parseDate(end);
+ if (startDate == null || endDate == null) {
+ return new DateRange(null, null, null);
+ }
+ if (startDate.isAfter(endDate)) {
+ LocalDate temp = startDate;
+ startDate = endDate;
+ endDate = temp;
+ }
+ return new DateRange(formatDate(startDate), formatDate(endDate), label);
+ }
+
+ private DateRange recentDaysRange(int days) {
+ LocalDate end = LocalDate.now();
+ int safeDays = Math.max(days, 1);
+ LocalDate start = end.minusDays(safeDays - 1L);
+ return new DateRange(formatDate(start), formatDate(end), "杩�" + safeDays + "澶�");
+ }
+
+ private DateRange monthRange() {
+ LocalDate today = LocalDate.now();
+ return new DateRange(formatDate(today.withDayOfMonth(1)), formatDate(today), "鏈湀");
+ }
+
+ private DateRange weekRange() {
+ LocalDate today = LocalDate.now();
+ LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ return new DateRange(formatDate(start), formatDate(today), "鏈懆");
+ }
+
+ private DateRange lastMonthRange() {
+ YearMonth lastMonth = YearMonth.now().minusMonths(1);
+ return new DateRange(formatDate(lastMonth.atDay(1)), formatDate(lastMonth.atEndOfMonth()), "涓婃湀");
+ }
+
+ private DateRange yearRange() {
+ LocalDate today = LocalDate.now();
+ return new DateRange(formatDate(today.withDayOfYear(1)), formatDate(today), "浠婂勾");
+ }
+
+ private LocalDate parseDate(String text) {
+ try {
+ return LocalDate.parse(text, DATE_FMT);
+ } catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ private String formatDate(LocalDate date) {
+ return date == null ? null : date.format(DATE_FMT);
+ }
+
+ private String normalizeForMatch(String text) {
+ if (!StringUtils.hasText(text)) {
+ return "";
+ }
+ return text.replace("锛�", "")
+ .replace("锛�", "")
+ .replace("(", "")
+ .replace(")", "")
+ .replace("锛�", "")
+ .replace(",", "")
+ .replace("銆�", "")
+ .replace(".", "")
+ .replace("锛�", "")
+ .replace("!", "")
+ .replace("锛�", "")
+ .replace("?", "")
+ .replace("锛�", "")
+ .replace(":", "")
+ .replace("锛�", "")
+ .replace(";", "")
+ .replace(" ", "")
+ .trim();
+ }
+
+ private String extractKeyword(String text) {
+ String cleaned = text
+ .replaceAll("\\d{4}-\\d{2}-\\d{2}", "")
+ .replaceAll("(?:杩憒鏈�杩�)\\s*\\d{1,3}\\s*澶�", "")
+ .replaceAll("(?:鍓峾鏈�杩憒灞曠ず|杩斿洖)?\\s*\\d{1,2}\\s*(?:鏉涓獆鍚�)", "")
+ .replace("鏌ヨ", "")
+ .replace("鏌ョ湅", "")
+ .replace("鐪嬩笅", "")
+ .replace("鐪嬬湅", "")
+ .replace("甯垜", "")
+ .replace("璇�", "")
+ .replace("涓�涓�", "")
+ .replace("涓轰粈涔�", "")
+ .replace("鍝釜瀹㈡埛鏈�璧氶挶", "")
+ .replace("鏈�杩戝摢涓鎴锋渶璧氶挶", "")
+ .replace("鏈湀鍝釜瀹㈡埛鏈�璧氶挶", "")
+ .replace("杩�30澶╁摢涓鎴锋渶璧氶挶", "")
+ .replace("鏈�璧氶挶瀹㈡埛", "")
+ .replace("瀹㈡埛鏈�璧氶挶", "")
+ .replace("鍝釜瀹㈡埛鍒╂鼎鏈�楂�", "")
+ .replace("鍒╂鼎鏈�楂樺鎴�", "")
+ .replace("鍝釜瀹㈡埛鍒╂鼎璐$尞鏈�楂�", "")
+ .replace("鍒╂鼎璐$尞鏈�楂樺鎴�", "")
+ .replace("鏈湀", "")
+ .replace("鏈懆", "")
+ .replace("鏈勾", "")
+ .replace("浠婂勾", "")
+ .replace("涓婃湀", "")
+ .replace("杩�30澶�", "")
+ .replace("杩�7澶�", "")
+ .replace("杩�90澶�", "")
+ .replace("鍓�10鏉�", "")
+ .replace("鏈�杩�10鏉�", "")
+ .replace("鍓�20鏉�", "")
+ .replace("鏈�杩�20鏉�", "")
+ .replace("璁㈠崟鍒╂鼎鍒嗘瀽", "")
+ .replace("鍒╂鼎鍒嗘瀽", "")
+ .replace("搴撳瓨璧勯噾鍒嗘瀽", "")
+ .replace("鐜伴噾娴侀娴�", "")
+ .replace("缁忚惀椹鹃┒鑸�", "")
+ .replace("鏃ユ姤", "")
+ .replace("鍛ㄦ姤", "")
+ .replace("寮傚父棰勮", "")
+ .replace("鏉�", "")
+ .trim();
+ return cleaned.length() >= 2 ? cleaned : null;
+ }
+
+ private record DateRange(String startDate, String endDate, String label) {
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/assistant/KnowledgeChatAgent.java b/src/main/java/com/ruoyi/ai/assistant/KnowledgeChatAgent.java
new file mode 100644
index 0000000..2d4072c
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/assistant/KnowledgeChatAgent.java
@@ -0,0 +1,35 @@
+package com.ruoyi.ai.assistant;
+
+import dev.langchain4j.service.MemoryId;
+import dev.langchain4j.service.SystemMessage;
+import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.spring.AiService;
+import reactor.core.publisher.Flux;
+
+import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT;
+
+/**
+ * 鐭ヨ瘑搴撻棶绛擜gent
+ * 鍩轰簬RAG妫�绱㈠寮虹敓鎴�
+ */
+@AiService(
+ wiringMode = EXPLICIT,
+ streamingChatModel = "qwenStreamingChatModel",
+ chatMemoryProvider = "chatMemoryProviderXiaozhi"
+)
+public interface KnowledgeChatAgent {
+
+ @SystemMessage("""
+ 浣犳槸浼佷笟鐭ヨ瘑搴撻棶绛斿姪鎵嬨��
+
+ 浣犻渶瑕佸熀浜庢彁渚涚殑鐭ヨ瘑搴撳唴瀹瑰洖绛旂敤鎴烽棶棰樸��
+
+ 閬靛惊浠ヤ笅瑙勫垯锛�
+ 1. 涓ユ牸鍩轰簬鐭ヨ瘑搴撳唴瀹瑰洖绛旓紝涓嶈缂栭�犱俊鎭�
+ 2. 濡傛灉鐭ヨ瘑搴撲腑娌℃湁鐩稿叧淇℃伅锛屾槑纭憡鐭ョ敤鎴�
+ 3. 鍥炵瓟瑕佸噯纭�佺畝娲併�佹湁鏉$悊
+ 4. 濡傛灉鍐呭杈冨锛屼娇鐢ㄥ垎鐐瑰垪琛ㄥ舰寮�
+ 5. 寮曠敤鏉ユ簮鏃舵敞鏄�"鏍规嵁鐭ヨ瘑搴撳唴瀹�"
+ """)
+ Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/ai/assistant/ManufacturingAgent.java b/src/main/java/com/ruoyi/ai/assistant/ManufacturingAgent.java
new file mode 100644
index 0000000..0d16703
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/assistant/ManufacturingAgent.java
@@ -0,0 +1,22 @@
+package com.ruoyi.ai.assistant;
+
+import dev.langchain4j.service.MemoryId;
+import dev.langchain4j.service.SystemMessage;
+import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
+import dev.langchain4j.service.spring.AiService;
+import reactor.core.publisher.Flux;
+
+import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT;
+
+@AiService(
+ wiringMode = EXPLICIT,
+ streamingChatModel = "qwenStreamingChatModel",
+ chatMemoryProvider = "chatMemoryProviderManufacturing",
+ tools = "manufacturingAgentTools"
+)
+public interface ManufacturingAgent {
+
+ @SystemMessage(fromResource = "manufacturing-agent-prompt.txt")
+ Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate);
+}
diff --git a/src/main/java/com/ruoyi/ai/assistant/ManufacturingIntentExecutor.java b/src/main/java/com/ruoyi/ai/assistant/ManufacturingIntentExecutor.java
new file mode 100644
index 0000000..e9d9396
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/assistant/ManufacturingIntentExecutor.java
@@ -0,0 +1,136 @@
+package com.ruoyi.ai.assistant;
+
+import com.ruoyi.ai.tools.ManufacturingAgentTools;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Component
+public class ManufacturingIntentExecutor {
+
+ private static final Pattern LIMIT_PATTERN = Pattern.compile("(鍓峾鏈�杩�)?(\\d{1,2})鏉�");
+ private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})");
+
+ private final ManufacturingAgentTools manufacturingAgentTools;
+
+ public ManufacturingIntentExecutor(ManufacturingAgentTools manufacturingAgentTools) {
+ this.manufacturingAgentTools = manufacturingAgentTools;
+ }
+
+ public String tryExecute(String memoryId, String message) {
+ if (!StringUtils.hasText(message)) {
+ return null;
+ }
+ String text = message.trim();
+ String keyword = extractKeyword(text);
+ Integer limit = extractLimit(text);
+ String startDate = extractStartDate(text);
+ String endDate = extractEndDate(text);
+
+ if (containsAny(text, "棰勮", "鍛婅", "椋庨櫓", "鎻愰啋")) {
+ return manufacturingAgentTools.getWarningBoard(memoryId, startDate, endDate, text);
+ }
+ if (containsAny(text, "鍒嗘瀽", "缁熻", "瓒嬪娍", "鐪嬫澘", "鎶ヨ〃", "鎬昏")) {
+ return manufacturingAgentTools.analyzeFactory(memoryId, startDate, endDate, text);
+ }
+ if (containsAny(text, "鍔�", "澶勭悊", "娲惧伐", "瀹夋帓", "闂幆", "璺熻繘", "澶勭疆")) {
+ return manufacturingAgentTools.planActions(memoryId, text);
+ }
+
+ if (containsAny(text, "鐢熶骇鐜板満", "鐜板満", "杞﹂棿")) {
+ return manufacturingAgentTools.queryDomain(memoryId, "site", keyword, limit, startDate, endDate, text);
+ }
+ if (containsAny(text, "璁″垝", "鎺掍骇", "mps")) {
+ return manufacturingAgentTools.queryDomain(memoryId, "plan", keyword, limit, startDate, endDate, text);
+ }
+ if (containsAny(text, "宸ュ崟", "浣滀笟鍗�", "浠诲姟鍗�", "浠诲姟")) {
+ return manufacturingAgentTools.queryDomain(memoryId, "workorder", keyword, limit, startDate, endDate, text);
+ }
+ if (containsAny(text, "璁惧", "缁翠慨", "淇濆吇", "鏁呴殰")) {
+ return manufacturingAgentTools.queryDomain(memoryId, "device", keyword, limit, startDate, endDate, text);
+ }
+ if (containsAny(text, "璐ㄩ噺", "璐ㄦ", "涓嶅悎鏍�", "妫�楠�")) {
+ return manufacturingAgentTools.queryDomain(memoryId, "quality", keyword, limit, startDate, endDate, text);
+ }
+ if (containsAny(text, "鐗╂枡", "搴撳瓨", "搴撲綅", "鍏ュ簱", "鍑哄簱")) {
+ return manufacturingAgentTools.queryDomain(memoryId, "material", keyword, limit, startDate, endDate, text);
+ }
+ if (containsAny(text, "寮傚父", "渚嬪", "鍋忓樊")) {
+ return manufacturingAgentTools.queryDomain(memoryId, "exception", keyword, limit, startDate, endDate, text);
+ }
+ return null;
+ }
+
+ private boolean containsAny(String text, String... keywords) {
+ for (String keyword : keywords) {
+ if (text.toLowerCase().contains(keyword.toLowerCase())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Integer extractLimit(String text) {
+ Matcher matcher = LIMIT_PATTERN.matcher(text);
+ return matcher.find() ? Integer.parseInt(matcher.group(2)) : 10;
+ }
+
+ private String extractStartDate(String text) {
+ Matcher matcher = DATE_PATTERN.matcher(text);
+ return matcher.find() ? matcher.group(1) : null;
+ }
+
+ private String extractEndDate(String text) {
+ Matcher matcher = DATE_PATTERN.matcher(text);
+ if (!matcher.find()) {
+ return null;
+ }
+ return matcher.find() ? matcher.group(1) : null;
+ }
+
+ private String extractKeyword(String text) {
+ String cleaned = text
+ .replace("鏌ヨ", "")
+ .replace("鏌ョ湅", "")
+ .replace("甯垜", "")
+ .replace("璇�", "")
+ .replace("涓�涓�", "")
+ .replace("鎵�鏈�", "")
+ .replace("鍏ㄩ儴", "")
+ .replace("浠婂勾", "")
+ .replace("鏈勾", "")
+ .replace("鍘诲勾", "")
+ .replace("鏈湀", "")
+ .replace("涓婃湀", "")
+ .replace("鏈懆", "")
+ .replace("涓婂懆", "")
+ .replace("浠婂ぉ", "")
+ .replace("鏄ㄥぉ", "")
+ .replace("杩�30澶�", "")
+ .replace("杩�7澶�", "")
+ .replace("杩�15澶�", "")
+ .replace("杩�60澶�", "")
+ .replace("鏈�杩�30澶�", "")
+ .replace("鏈�杩�7澶�", "")
+ .replace("鏈�杩�15澶�", "")
+ .replace("鏈�杩�60澶�", "")
+ .replace("鐢熶骇鐜板満", "")
+ .replace("鐜板満", "")
+ .replace("鐢熶骇宸ュ崟", "")
+ .replace("鐢熶骇", "")
+ .replace("璁″垝", "")
+ .replace("鎺掍骇", "")
+ .replace("宸ュ崟", "")
+ .replace("璁惧", "")
+ .replace("璐ㄩ噺", "")
+ .replace("鐗╂枡", "")
+ .replace("搴撳瓨", "")
+ .replace("寮傚父", "")
+ .replace("鍓�10鏉�", "")
+ .replace("鏈�杩�10鏉�", "")
+ .trim();
+ return cleaned.length() >= 2 ? cleaned : null;
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/assistant/PurchaseAgent.java b/src/main/java/com/ruoyi/ai/assistant/PurchaseAgent.java
index 6a4ff4e..421261d 100644
--- a/src/main/java/com/ruoyi/ai/assistant/PurchaseAgent.java
+++ b/src/main/java/com/ruoyi/ai/assistant/PurchaseAgent.java
@@ -3,6 +3,7 @@
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
import dev.langchain4j.service.spring.AiService;
import reactor.core.publisher.Flux;
@@ -17,5 +18,5 @@
public interface PurchaseAgent {
@SystemMessage(fromResource = "purchase-agent-prompt.txt")
- Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage);
+ Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate);
}
diff --git a/src/main/java/com/ruoyi/ai/assistant/PurchaseIntentExecutor.java b/src/main/java/com/ruoyi/ai/assistant/PurchaseIntentExecutor.java
index 5991fc3..c04915e 100644
--- a/src/main/java/com/ruoyi/ai/assistant/PurchaseIntentExecutor.java
+++ b/src/main/java/com/ruoyi/ai/assistant/PurchaseIntentExecutor.java
@@ -4,6 +4,9 @@
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -11,8 +14,12 @@
public class PurchaseIntentExecutor {
private static final Pattern ID_PATTERN = Pattern.compile("\\b\\d{1,12}\\b");
- private static final Pattern LIMIT_PATTERN = Pattern.compile("(鍓峾鏈�杩�)?(\\d{1,2})鏉�");
- private static final Pattern DATE_PATTERN = Pattern.compile("\\d{4}-\\d{2}-\\d{2}");
+ private static final Pattern LIMIT_PATTERN = Pattern.compile("(鍓峾鏈�杩�)?\\s*(\\d{1,2})\\s*鏉�");
+ private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})");
+ private static final Pattern RELATIVE_RANGE_PATTERN = Pattern.compile("(杩憒鏈�杩�)\\s*(\\d{1,3})\\s*(澶﹟鍛▅涓湀|鏈坾骞�)");
+ private static final Pattern HALF_RANGE_PATTERN = Pattern.compile("(鏈�杩憒杩�)?鍗�(涓�)?(鏈坾骞�)");
+ private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
private final PurchaseAgentTools purchaseAgentTools;
@@ -25,71 +32,63 @@
return null;
}
String text = message.trim();
+ String quickPromptResponse = tryExecuteQuickPrompt(memoryId, text);
+ if (StringUtils.hasText(quickPromptResponse)) {
+ return quickPromptResponse;
+ }
- if (containsAny(text, "鎺掕", "鎺掑悕", "鍓嶅嚑", "鍓嶄簲", "鍓嶅崄") && containsAny(text, "鐗╂枡", "浜у搧", "鍘熸潗鏂�", "閲囪喘閲戦", "閲戦")) {
- return purchaseAgentTools.rankPurchaseMaterials(
- memoryId,
- extractStartDate(text),
- extractEndDate(text),
- text,
- extractLimit(text)
- );
+ String keyword = extractKeyword(text);
+ Integer limit = extractLimit(text);
+ DateRange dateRange = extractDateRange(text);
+ String startDate = dateRange.startDate();
+ String endDate = dateRange.endDate();
+
+ if (containsAny(text, "鎺掕", "鎺掑悕", "鍓嶅嚑", "鍓嶄簲", "鍓嶅崄")
+ && containsAny(text, "鐗╂枡", "浜у搧", "鍘熸潗鏂�", "閲囪喘閲戦", "閲戦")) {
+ return purchaseAgentTools.rankPurchaseMaterials(memoryId, startDate, endDate, text, limit);
}
if (containsAny(text, "鏈叆搴�", "寰呭叆搴�", "娌℃湁鍏ュ簱", "杩樻湭鍏ュ簱")) {
- return purchaseAgentTools.listUnstockedPurchaseOrders(
- memoryId,
- extractStartDate(text),
- extractEndDate(text),
- extractKeyword(text),
- extractLimit(text)
- );
+ return purchaseAgentTools.listUnstockedPurchaseOrders(memoryId, startDate, endDate, keyword, limit);
}
if (containsAny(text, "鍒拌揣寮傚父", "鍒拌揣鏈夊紓甯�", "寮傚父鍒拌揣", "鍒拌揣闂", "渚涘簲鍟嗗埌璐у紓甯�")) {
- return purchaseAgentTools.listArrivalExceptions(
- memoryId,
- extractStartDate(text),
- extractEndDate(text),
- text,
- extractLimit(text)
- );
+ return purchaseAgentTools.listArrivalExceptions(memoryId, startDate, endDate, text, limit);
}
if (containsAny(text, "寰呬粯娆�", "鏈粯娆�", "鏈粯娓�", "寰呮敮浠�", "搴斾粯")) {
- return purchaseAgentTools.listPendingPaymentOrders(
- memoryId,
- extractStartDate(text),
- extractEndDate(text),
- extractKeyword(text),
- extractLimit(text)
- );
+ return purchaseAgentTools.listPendingPaymentOrders(memoryId, startDate, endDate, keyword, limit);
}
if (containsAny(text, "閫�璐�", "閫�鏂�", "鎷掓敹")) {
- return purchaseAgentTools.listPurchaseReturns(
- memoryId,
- extractStartDate(text),
- extractEndDate(text),
- extractKeyword(text),
- extractLimit(text)
- );
+ return purchaseAgentTools.listPurchaseReturns(memoryId, startDate, endDate, keyword, limit);
}
if (isStatsIntent(text)) {
- return purchaseAgentTools.getPurchaseStats(
- memoryId,
- extractStartDate(text),
- extractEndDate(text),
- text
- );
+ return purchaseAgentTools.getPurchaseStats(memoryId, startDate, endDate, text);
}
- if (containsAny(text, "璇︽儏", "鏄庣粏") && extractId(text) != null) {
- return purchaseAgentTools.getPurchaseLedgerDetail(memoryId, extractId(text));
+
+ Long ledgerId = extractId(text);
+ if (containsAny(text, "璇︽儏", "鏄庣粏") && ledgerId != null) {
+ return purchaseAgentTools.getPurchaseLedgerDetail(memoryId, ledgerId);
}
if (containsAny(text, "鍙拌处", "閲囪喘鍗�", "閲囪喘璁㈠崟", "璁㈠崟", "鍚堝悓", "鍒楄〃", "鏌ヨ")) {
- return purchaseAgentTools.listPurchaseLedgers(
- memoryId,
- extractKeyword(text),
- extractStartDate(text),
- extractEndDate(text),
- extractLimit(text)
- );
+ return purchaseAgentTools.listPurchaseLedgers(memoryId, keyword, startDate, endDate, limit);
+ }
+ return null;
+ }
+
+ private String tryExecuteQuickPrompt(String memoryId, String text) {
+ String normalized = normalizeForMatch(text);
+ if ("鏈湀閲囪喘閲戦鎺掑悕鍓嶅崄鐨勭墿鏂欐湁鍝簺".equals(normalized)) {
+ return purchaseAgentTools.rankPurchaseMaterials(memoryId, null, null, "鏈湀", 10);
+ }
+ if ("鍝簺閲囪喘璁㈠崟杩樻湭鍏ュ簱".equals(normalized)) {
+ return purchaseAgentTools.listUnstockedPurchaseOrders(memoryId, null, null, null, 10);
+ }
+ if ("鏈�杩�7澶╀緵搴斿晢鍒拌揣寮傚父鏈夊摢浜�".equals(normalized)) {
+ return purchaseAgentTools.listArrivalExceptions(memoryId, null, null, "鏈�杩�7澶�", 10);
+ }
+ if ("甯垜缁熻寰呬粯娆鹃噰璐崟".equals(normalized)) {
+ return purchaseAgentTools.listPendingPaymentOrders(memoryId, null, null, null, 10);
+ }
+ if ("鍒楀嚭鏈湀閲囪喘閫�璐ф儏鍐�".equals(normalized)) {
+ return purchaseAgentTools.listPurchaseReturns(memoryId, null, null, null, 10);
}
return null;
}
@@ -100,8 +99,10 @@
}
boolean queryWord = containsAny(text, "鏌ヨ", "鏌ョ湅", "鐪嬩笅", "鐪嬬湅", "鑾峰彇");
boolean dataWord = containsAny(text, "鏁版嵁", "閲戦", "鏁伴噺", "鍚堝悓棰�", "浠樻棰�", "鍙戠エ棰�");
- boolean timeWord = containsAny(text, "浠婂ぉ", "鏈懆", "鏈湀", "涓婃湀", "浠婂勾", "鍘诲勾", "杩戝崐骞�", "鏈�杩戝崐涓湀", "鍗婁釜鏈�")
- || DATE_PATTERN.matcher(text).find();
+ boolean timeWord = containsAny(text, "浠婂ぉ", "鏄ㄥぉ", "鏈懆", "涓婂懆", "鏈湀", "涓婃湀", "浠婂勾", "鍘诲勾", "杩戝崐骞�", "鏈�杩戝崐涓湀", "鍗婁釜鏈�")
+ || DATE_PATTERN.matcher(text).find()
+ || RELATIVE_RANGE_PATTERN.matcher(text).find()
+ || HALF_RANGE_PATTERN.matcher(text).find();
return queryWord && dataWord && timeWord;
}
@@ -127,23 +128,125 @@
return matcher.find() ? Integer.parseInt(matcher.group(2)) : 10;
}
- private String extractStartDate(String text) {
+ private DateRange extractDateRange(String text) {
Matcher matcher = DATE_PATTERN.matcher(text);
- return matcher.find() ? matcher.group() : null;
+ if (matcher.find()) {
+ String first = matcher.group(1);
+ String second = matcher.find() ? matcher.group(1) : first;
+ return buildDateRange(first, second);
+ }
+
+ LocalDate today = LocalDate.now(CHINA_ZONE_ID);
+ if (text.contains("浠婂ぉ")) {
+ return new DateRange(formatDate(today), formatDate(today));
+ }
+ if (text.contains("鏄ㄥぉ")) {
+ LocalDate yesterday = today.minusDays(1);
+ return new DateRange(formatDate(yesterday), formatDate(yesterday));
+ }
+ if (text.contains("鏈懆")) {
+ LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ return new DateRange(formatDate(start), formatDate(today));
+ }
+ if (text.contains("涓婂懆")) {
+ LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ LocalDate start = thisWeekStart.minusWeeks(1);
+ LocalDate end = start.plusDays(6);
+ return new DateRange(formatDate(start), formatDate(end));
+ }
+ if (text.contains("鏈湀")) {
+ return new DateRange(formatDate(today.withDayOfMonth(1)), formatDate(today));
+ }
+ if (text.contains("涓婃湀")) {
+ LocalDate start = today.minusMonths(1).withDayOfMonth(1);
+ return new DateRange(formatDate(start), formatDate(start.withDayOfMonth(start.lengthOfMonth())));
+ }
+ if (text.contains("浠婂勾") || text.contains("鏈勾")) {
+ return new DateRange(formatDate(today.withDayOfYear(1)), formatDate(today));
+ }
+ if (text.contains("鍘诲勾")) {
+ LocalDate start = today.minusYears(1).withDayOfYear(1);
+ LocalDate end = start.withDayOfYear(start.lengthOfYear());
+ return new DateRange(formatDate(start), formatDate(end));
+ }
+ if (containsAny(text, "杩戝崐骞�", "鏈�杩戝崐骞�")) {
+ return new DateRange(formatDate(today.minusMonths(6).plusDays(1)), formatDate(today));
+ }
+ if (containsAny(text, "杩戝崐涓湀", "鏈�杩戝崐涓湀", "鍗婁釜鏈�")) {
+ return new DateRange(formatDate(today.minusDays(14)), formatDate(today));
+ }
+
+ Matcher relativeMatcher = RELATIVE_RANGE_PATTERN.matcher(text);
+ if (relativeMatcher.find()) {
+ int amount = Integer.parseInt(relativeMatcher.group(2));
+ String unit = relativeMatcher.group(3);
+ LocalDate start = switch (unit) {
+ case "澶�" -> today.minusDays(Math.max(amount - 1L, 0));
+ case "鍛�" -> today.minusWeeks(Math.max(amount, 1)).plusDays(1);
+ case "涓湀", "鏈�" -> today.minusMonths(Math.max(amount, 1)).plusDays(1);
+ case "骞�" -> today.minusYears(Math.max(amount, 1)).plusDays(1);
+ default -> today.minusDays(29);
+ };
+ return new DateRange(formatDate(start), formatDate(today));
+ }
+
+ return new DateRange(null, null);
}
- private String extractEndDate(String text) {
- Matcher matcher = DATE_PATTERN.matcher(text);
- if (!matcher.find()) {
+ private DateRange buildDateRange(String start, String end) {
+ LocalDate startDate = parseDate(start);
+ LocalDate endDate = parseDate(end);
+ if (startDate == null || endDate == null) {
+ return new DateRange(null, null);
+ }
+ if (startDate.isAfter(endDate)) {
+ LocalDate temp = startDate;
+ startDate = endDate;
+ endDate = temp;
+ }
+ return new DateRange(formatDate(startDate), formatDate(endDate));
+ }
+
+ private LocalDate parseDate(String text) {
+ try {
+ return LocalDate.parse(text, DATE_FMT);
+ } catch (Exception ignored) {
return null;
}
- return matcher.find() ? matcher.group() : null;
+ }
+
+ private String formatDate(LocalDate date) {
+ return date == null ? null : date.format(DATE_FMT);
+ }
+
+ private String normalizeForMatch(String text) {
+ if (!StringUtils.hasText(text)) {
+ return "";
+ }
+ return text.replace("锛�", "")
+ .replace(",", "")
+ .replace("銆�", "")
+ .replace(".", "")
+ .replace("锛�", "")
+ .replace("!", "")
+ .replace("锛�", "")
+ .replace("?", "")
+ .replace("锛�", "")
+ .replace(":", "")
+ .replace("锛�", "")
+ .replace(";", "")
+ .replace(" ", "")
+ .trim();
}
private String extractKeyword(String text) {
String cleaned = text
.replace("鏌ヨ", "")
.replace("鏌ョ湅", "")
+ .replace("鐪嬩笅", "")
+ .replace("鐪嬬湅", "")
+ .replace("璇�", "")
+ .replace("涓�涓�", "")
.replace("閲囪喘", "")
.replace("閲囪喘鍗�", "")
.replace("閲囪喘璁㈠崟", "")
@@ -153,9 +256,33 @@
.replace("鍝簺", "")
.replace("鍒楀嚭", "")
.replace("甯垜", "")
+ .replace("缁熻", "")
+ .replace("鍒嗘瀽", "")
+ .replace("鏈湀", "")
+ .replace("涓婃湀", "")
+ .replace("鏈勾", "")
+ .replace("浠婂勾", "")
+ .replace("鍘诲勾", "")
+ .replace("鏈懆", "")
+ .replace("涓婂懆", "")
+ .replace("浠婂ぉ", "")
+ .replace("鏄ㄥぉ", "")
+ .replace("杩�30澶�", "")
+ .replace("杩�7澶�", "")
+ .replace("杩�15澶�", "")
+ .replace("杩�60澶�", "")
+ .replace("鏈�杩�30澶�", "")
+ .replace("鏈�杩�7澶�", "")
+ .replace("鏈�杩�15澶�", "")
+ .replace("鏈�杩�60澶�", "")
.replace("鏈�杩�10鏉�", "")
.replace("鍓�10鏉�", "")
+ .replace("鍓�20鏉�", "")
+ .replace("鏈�杩�20鏉�", "")
.trim();
return cleaned.length() >= 2 ? cleaned : null;
}
+
+ private record DateRange(String startDate, String endDate) {
+ }
}
diff --git a/src/main/java/com/ruoyi/ai/assistant/SalesAgent.java b/src/main/java/com/ruoyi/ai/assistant/SalesAgent.java
new file mode 100644
index 0000000..e2f9a81
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/assistant/SalesAgent.java
@@ -0,0 +1,22 @@
+package com.ruoyi.ai.assistant;
+
+import dev.langchain4j.service.MemoryId;
+import dev.langchain4j.service.SystemMessage;
+import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
+import dev.langchain4j.service.spring.AiService;
+import reactor.core.publisher.Flux;
+
+import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT;
+
+@AiService(
+ wiringMode = EXPLICIT,
+ streamingChatModel = "qwenStreamingChatModel",
+ chatMemoryProvider = "chatMemoryProviderSales",
+ tools = "salesAgentTools"
+)
+public interface SalesAgent {
+
+ @SystemMessage(fromResource = "sales-agent-prompt.txt")
+ Flux<String> chat(@MemoryId String memoryId, @UserMessage String userMessage, @V("currentDate") String currentDate);
+}
diff --git a/src/main/java/com/ruoyi/ai/assistant/SalesIntentExecutor.java b/src/main/java/com/ruoyi/ai/assistant/SalesIntentExecutor.java
new file mode 100644
index 0000000..4388a3c
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/assistant/SalesIntentExecutor.java
@@ -0,0 +1,270 @@
+package com.ruoyi.ai.assistant;
+
+import com.ruoyi.ai.tools.SalesAgentTools;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Component
+public class SalesIntentExecutor {
+
+ private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final Pattern LIMIT_PATTERN = Pattern.compile("(鍓峾鏈�杩�)?\\s*(\\d{1,2})\\s*鏉�");
+ private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})");
+ private static final Pattern RELATIVE_DAY_PATTERN = Pattern.compile("(杩憒鏈�杩�)?\\s*(\\d{1,3})\\s*澶�");
+
+ private final SalesAgentTools salesAgentTools;
+
+ public SalesIntentExecutor(SalesAgentTools salesAgentTools) {
+ this.salesAgentTools = salesAgentTools;
+ }
+
+ public String tryExecute(String memoryId, String message) {
+ if (!StringUtils.hasText(message)) {
+ return null;
+ }
+ String text = message.trim();
+
+ String quickPromptResponse = tryExecuteQuickPrompt(memoryId, text);
+ if (StringUtils.hasText(quickPromptResponse)) {
+ return quickPromptResponse;
+ }
+
+ String keyword = extractKeyword(text);
+ Integer limit = extractLimit(text);
+ DateRange dateRange = extractDateRange(text);
+ String startDate = dateRange.startDate();
+ String endDate = dateRange.endDate();
+
+ if (containsAny(text, "娴佸け", "娴佸け椋庨櫓", "瀹㈡埛娴佸け", "椋庨櫓鍒嗘瀽")) {
+ return salesAgentTools.analyzeCustomerChurnRisk(memoryId, startDate, endDate, text, keyword, limit);
+ }
+ if (containsAny(text, "鍥炴", "鏀舵", "鎶ヤ环")
+ && containsAny(text, "寤鸿", "绛栫暐", "浼樺寲", "鏂规")) {
+ return salesAgentTools.suggestCollectionAndQuotationStrategy(
+ memoryId, startDate, endDate, text, keyword, limit, shouldPrioritizeHighRisk(text));
+ }
+ if (containsAny(text, "鎸囨爣", "缁熻", "鐪嬫澘", "鎬昏", "缁忚惀鍒嗘瀽")) {
+ return salesAgentTools.getSalesDashboard(memoryId, startDate, endDate, text);
+ }
+ if (containsAny(text, "瀹㈡埛妗f", "绉佹捣", "鍏捣", "瀹㈡埛姹�")) {
+ return salesAgentTools.listCustomerProfiles(memoryId, extractSeaType(text), keyword, limit);
+ }
+ if (containsAny(text, "閿�鍞姤浠�", "鎶ヤ环鍗�", "鎶ヤ环", "璇环")) {
+ return salesAgentTools.listSalesQuotations(memoryId, keyword, startDate, endDate, limit);
+ }
+ if (containsAny(text, "閿�鍞��璐�", "閫�璐�", "閫�娆�")) {
+ return salesAgentTools.listSalesReturns(memoryId, startDate, endDate, keyword, limit);
+ }
+ if (containsAny(text, "瀹㈡埛寰�鏉�", "寰�鏉�", "鍥炴", "搴旀敹", "鏉ユ", "鏀舵鏄庣粏")) {
+ return salesAgentTools.listCustomerInteractions(memoryId, keyword, startDate, endDate, limit);
+ }
+ if (containsAny(text, "鍙戣揣鍙拌处", "鍙戣揣", "鐗╂祦", "蹇��", "杩愯緭")) {
+ return salesAgentTools.listShippingLedgers(memoryId, keyword, startDate, endDate, limit);
+ }
+ if (containsAny(text, "閿�鍞彴璐�", "閿�鍞悎鍚�", "閿�鍞鍗�", "鍚堝悓鍙拌处", "璁㈠崟鍙拌处")) {
+ return salesAgentTools.listSalesLedgers(memoryId, keyword, startDate, endDate, limit);
+ }
+ return null;
+ }
+
+ private String tryExecuteQuickPrompt(String memoryId, String text) {
+ String normalized = normalizeForMatch(text);
+ if ("鏌ヨ绉佹捣瀹㈡埛妗f鍓�10鏉�".equals(normalized)) {
+ return salesAgentTools.listCustomerProfiles(memoryId, "private", null, 10);
+ }
+ if ("鏌ヨ鍏捣瀹㈡埛妗f".equals(normalized)) {
+ return salesAgentTools.listCustomerProfiles(memoryId, "public", null, 10);
+ }
+ if ("鏌ヨ鏈湀閿�鍞姤浠�".equals(normalized)) {
+ DateRange range = monthRange();
+ return salesAgentTools.listSalesQuotations(memoryId, null, range.startDate(), range.endDate(), 10);
+ }
+ if ("鏌ヨ鏈湀閿�鍞彴璐�".equals(normalized)) {
+ DateRange range = monthRange();
+ return salesAgentTools.listSalesLedgers(memoryId, null, range.startDate(), range.endDate(), 10);
+ }
+ if ("鏌ヨ杩�30澶╅攢鍞��璐�".equals(normalized)) {
+ DateRange range = recentDaysRange(30);
+ return salesAgentTools.listSalesReturns(memoryId, range.startDate(), range.endDate(), null, 10);
+ }
+ if ("鏌ヨ杩�30澶╁鎴峰洖娆惧線鏉�".equals(normalized)) {
+ DateRange range = recentDaysRange(30);
+ return salesAgentTools.listCustomerInteractions(memoryId, null, range.startDate(), range.endDate(), 10);
+ }
+ if ("鏌ヨ鏈湀鍙戣揣鍙拌处".equals(normalized)) {
+ DateRange range = monthRange();
+ return salesAgentTools.listShippingLedgers(memoryId, null, range.startDate(), range.endDate(), 10);
+ }
+ if ("鏌ョ湅閿�鍞寚鏍囩粺璁�".equals(normalized)) {
+ return salesAgentTools.getSalesDashboard(memoryId, null, null, "鏈湀");
+ }
+ if ("甯垜鍋氬鎴锋祦澶遍闄╁垎鏋愯繎30澶╁墠20鏉�".equals(normalized)) {
+ DateRange range = recentDaysRange(30);
+ return salesAgentTools.analyzeCustomerChurnRisk(memoryId, range.startDate(), range.endDate(), "杩�30澶�", null, 20);
+ }
+ if ("鐢熸垚鍥炴涓庢姤浠风瓥鐣ュ缓璁紭鍏堥珮椋庨櫓瀹㈡埛".equals(normalized)) {
+ DateRange range = recentDaysRange(30);
+ return salesAgentTools.suggestCollectionAndQuotationStrategy(memoryId, range.startDate(), range.endDate(), "杩�30澶�", null, 10, true);
+ }
+ return null;
+ }
+
+ private boolean containsAny(String text, String... keywords) {
+ for (String keyword : keywords) {
+ if (text.contains(keyword)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String extractSeaType(String text) {
+ if (text.contains("鍏捣")) {
+ return "public";
+ }
+ if (text.contains("绉佹捣")) {
+ return "private";
+ }
+ return null;
+ }
+
+ private Integer extractLimit(String text) {
+ Matcher matcher = LIMIT_PATTERN.matcher(text);
+ return matcher.find() ? Integer.parseInt(matcher.group(2)) : 10;
+ }
+
+ private DateRange extractDateRange(String text) {
+ Matcher matcher = DATE_PATTERN.matcher(text);
+ if (matcher.find()) {
+ String first = matcher.group(1);
+ String second = matcher.find() ? matcher.group(1) : first;
+ return buildDateRange(first, second);
+ }
+ if (text.contains("鏈湀")) {
+ return monthRange();
+ }
+ if (text.contains("涓婃湀")) {
+ return lastMonthRange();
+ }
+ if (text.contains("鏈勾") || text.contains("浠婂勾")) {
+ return yearRange();
+ }
+ Matcher relativeDayMatcher = RELATIVE_DAY_PATTERN.matcher(text);
+ if (relativeDayMatcher.find()) {
+ int days = Integer.parseInt(relativeDayMatcher.group(2));
+ return recentDaysRange(days);
+ }
+ return new DateRange(null, null);
+ }
+
+ private DateRange buildDateRange(String start, String end) {
+ LocalDate startDate = parseDate(start);
+ LocalDate endDate = parseDate(end);
+ if (startDate == null || endDate == null) {
+ return new DateRange(null, null);
+ }
+ if (startDate.isAfter(endDate)) {
+ LocalDate temp = startDate;
+ startDate = endDate;
+ endDate = temp;
+ }
+ return new DateRange(formatDate(startDate), formatDate(endDate));
+ }
+
+ private DateRange recentDaysRange(int days) {
+ LocalDate end = LocalDate.now();
+ int safeDays = Math.max(days, 1);
+ LocalDate start = end.minusDays(safeDays - 1L);
+ return new DateRange(formatDate(start), formatDate(end));
+ }
+
+ private DateRange monthRange() {
+ LocalDate today = LocalDate.now();
+ return new DateRange(formatDate(today.withDayOfMonth(1)), formatDate(today));
+ }
+
+ private DateRange lastMonthRange() {
+ YearMonth lastMonth = YearMonth.now().minusMonths(1);
+ return new DateRange(formatDate(lastMonth.atDay(1)), formatDate(lastMonth.atEndOfMonth()));
+ }
+
+ private DateRange yearRange() {
+ LocalDate today = LocalDate.now();
+ return new DateRange(formatDate(today.withDayOfYear(1)), formatDate(today));
+ }
+
+ private LocalDate parseDate(String text) {
+ try {
+ return LocalDate.parse(text, DATE_FMT);
+ } catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ private String formatDate(LocalDate date) {
+ return date == null ? null : date.format(DATE_FMT);
+ }
+
+ private String normalizeForMatch(String text) {
+ if (!StringUtils.hasText(text)) {
+ return "";
+ }
+ return text.replace("锛�", "")
+ .replace(",", "")
+ .replace("銆�", "")
+ .replace(".", "")
+ .replace("锛�", "")
+ .replace("!", "")
+ .replace("锛�", "")
+ .replace("?", "")
+ .replace("锛�", "")
+ .replace(":", "")
+ .replace("锛�", "")
+ .replace(";", "")
+ .replace(" ", "")
+ .trim();
+ }
+
+ private Boolean shouldPrioritizeHighRisk(String text) {
+ return containsAny(text, "浼樺厛楂橀闄�", "楂橀闄╁鎴�", "楂橀闄�");
+ }
+
+ private String extractKeyword(String text) {
+ String cleaned = text
+ .replace("鏌ヨ", "")
+ .replace("鏌ョ湅", "")
+ .replace("鐪嬩笅", "")
+ .replace("鐪嬬湅", "")
+ .replace("甯垜", "")
+ .replace("璇�", "")
+ .replace("涓�涓�", "")
+ .replace("閿�鍞�", "")
+ .replace("瀹㈡埛妗f", "")
+ .replace("鎶ヤ环鍗�", "")
+ .replace("閿�鍞姤浠�", "")
+ .replace("閿�鍞彴璐�", "")
+ .replace("鍙戣揣鍙拌处", "")
+ .replace("瀹㈡埛寰�鏉�", "")
+ .replace("閿�鍞��璐�", "")
+ .replace("鍓�10鏉�", "")
+ .replace("鏈�杩�10鏉�", "")
+ .replace("鍓�20鏉�", "")
+ .replace("鏈�杩�20鏉�", "")
+ .replace("杩�30澶�", "")
+ .replace("鏈湀", "")
+ .replace("鏈勾", "")
+ .replace("浠婂勾", "")
+ .replace("鏉�", "")
+ .trim();
+ return cleaned.length() >= 2 ? cleaned : null;
+ }
+
+ private record DateRange(String startDate, String endDate) {
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java b/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java
index ca5156d..eaa487c 100644
--- a/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java
+++ b/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java
@@ -5,32 +5,48 @@
import dev.langchain4j.store.embedding.EmbeddingStore;
import dev.langchain4j.store.embedding.pinecone.PineconeEmbeddingStore;
import dev.langchain4j.store.embedding.pinecone.PineconeServerlessIndexConfig;
-import org.springframework.beans.factory.annotation.Autowired;
+import io.pinecone.clients.Index;
+import io.pinecone.clients.Pinecone;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
- * @author :yys
- * @date : 2025/5/2 21:07
+ * 鍚戦噺瀛樺偍閰嶇疆
*/
@Configuration
public class EmbeddingStoreConfig {
- @Autowired
- private EmbeddingModel embeddingModel;
+ @Value("${pinecone.api-key:pcsk_4SJLnh_tNB3wSLJU8tc4E5P28PcXX8eCLdURqZpVhg1FMV8CRYxjneWdzqRdB5Ftqooi9}")
+ private String pineconeApiKey;
+
+ @Value("${pinecone.index:xiaozhi-index}")
+ private String indexName;
+
+ @Value("${pinecone.namespace:knowledge-base}")
+ private String namespace;
@Bean
- public EmbeddingStore<TextSegment> embeddingStore() {
- //鍒涘缓鍚戦噺瀛樺偍
+ public Pinecone pinecone() {
+ return new Pinecone.Builder(pineconeApiKey).build();
+ }
+
+ @Bean
+ public Index pineconeIndex(Pinecone pinecone) {
+ return pinecone.getIndexConnection(indexName);
+ }
+
+ @Bean
+ public EmbeddingStore<TextSegment> embeddingStore(EmbeddingModel embeddingModel) {
return PineconeEmbeddingStore.builder()
- .apiKey("pcsk_4SJLnh_tNB3wSLJU8tc4E5P28PcXX8eCLdURqZpVhg1FMV8CRYxjneWdzqRdB5Ftqooi9")
- .index("xiaozhi-index")//濡傛灉鎸囧畾鐨勭储寮曚笉瀛樺湪锛屽皢鍒涘缓涓�涓柊鐨勭储寮�
- .nameSpace("xiaozhi-namespace") //濡傛灉鎸囧畾鐨勫悕绉扮┖闂翠笉瀛樺湪锛屽皢鍒涘缓涓�涓柊鐨勫悕绉� 绌洪棿
+ .apiKey(pineconeApiKey)
+ .index(indexName)
+ .nameSpace(namespace)
.createIndex(PineconeServerlessIndexConfig.builder()
- .cloud("AWS") //鎸囧畾绱㈠紩閮ㄧ讲鍦� AWS 浜戞湇鍔′笂銆�
- .region("us-east-1") //鎸囧畾绱㈠紩鎵�鍦ㄧ殑 AWS 鍖哄煙涓� us-east-1銆�
- .dimension(embeddingModel.dimension()) //鎸囧畾绱㈠紩鐨勫悜閲忕淮搴︼紝璇ョ淮搴︿笌 embeddedModel 鐢熸垚鐨勫悜閲忕淮搴︾浉鍚屻��
+ .cloud("AWS")
+ .region("us-east-1")
+ .dimension(embeddingModel.dimension())
.build())
.build();
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/ai/config/FinancialAgentConfig.java b/src/main/java/com/ruoyi/ai/config/FinancialAgentConfig.java
new file mode 100644
index 0000000..0706e74
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/config/FinancialAgentConfig.java
@@ -0,0 +1,20 @@
+package com.ruoyi.ai.config;
+
+import com.ruoyi.ai.store.MongoChatMemoryStore;
+import dev.langchain4j.memory.chat.ChatMemoryProvider;
+import dev.langchain4j.memory.chat.MessageWindowChatMemory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class FinancialAgentConfig {
+
+ @Bean
+ ChatMemoryProvider chatMemoryProviderFinancial(MongoChatMemoryStore mongoChatMemoryStore) {
+ return memoryId -> MessageWindowChatMemory.builder()
+ .id(memoryId)
+ .maxMessages(40)
+ .chatMemoryStore(mongoChatMemoryStore)
+ .build();
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/config/ManufacturingAgentConfig.java b/src/main/java/com/ruoyi/ai/config/ManufacturingAgentConfig.java
new file mode 100644
index 0000000..79aa222
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/config/ManufacturingAgentConfig.java
@@ -0,0 +1,20 @@
+package com.ruoyi.ai.config;
+
+import com.ruoyi.ai.store.MongoChatMemoryStore;
+import dev.langchain4j.memory.chat.ChatMemoryProvider;
+import dev.langchain4j.memory.chat.MessageWindowChatMemory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ManufacturingAgentConfig {
+
+ @Bean
+ ChatMemoryProvider chatMemoryProviderManufacturing(MongoChatMemoryStore mongoChatMemoryStore) {
+ return memoryId -> MessageWindowChatMemory.builder()
+ .id(memoryId)
+ .maxMessages(30)
+ .chatMemoryStore(mongoChatMemoryStore)
+ .build();
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/config/SalesAgentConfig.java b/src/main/java/com/ruoyi/ai/config/SalesAgentConfig.java
new file mode 100644
index 0000000..aed3104
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/config/SalesAgentConfig.java
@@ -0,0 +1,21 @@
+package com.ruoyi.ai.config;
+
+import com.ruoyi.ai.store.MongoChatMemoryStore;
+import dev.langchain4j.memory.chat.ChatMemoryProvider;
+import dev.langchain4j.memory.chat.MessageWindowChatMemory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class SalesAgentConfig {
+
+ @Bean
+ ChatMemoryProvider chatMemoryProviderSales(MongoChatMemoryStore mongoChatMemoryStore) {
+ return memoryId -> MessageWindowChatMemory.builder()
+ .id(memoryId)
+ .maxMessages(30)
+ .chatMemoryStore(mongoChatMemoryStore)
+ .build();
+ }
+}
+
diff --git a/src/main/java/com/ruoyi/ai/context/AiSessionUserContext.java b/src/main/java/com/ruoyi/ai/context/AiSessionUserContext.java
index 3a5877b..5251561 100644
--- a/src/main/java/com/ruoyi/ai/context/AiSessionUserContext.java
+++ b/src/main/java/com/ruoyi/ai/context/AiSessionUserContext.java
@@ -4,6 +4,8 @@
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
+import java.time.Duration;
+import java.time.Instant;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -11,18 +13,26 @@
public class AiSessionUserContext {
private final Map<String, LoginUser> loginUserByMemoryId = new ConcurrentHashMap<>();
+ private final Map<String, Instant> lastAccessTimeByMemoryId = new ConcurrentHashMap<>();
+ private static final Duration SESSION_TIMEOUT = Duration.ofHours(24);
public void bind(String memoryId, LoginUser loginUser) {
if (!StringUtils.hasText(memoryId) || loginUser == null) {
return;
}
loginUserByMemoryId.put(memoryId, loginUser);
+ lastAccessTimeByMemoryId.put(memoryId, Instant.now());
}
public LoginUser get(String memoryId) {
if (!StringUtils.hasText(memoryId)) {
return null;
}
+ if (isExpired(memoryId)) {
+ remove(memoryId);
+ return null;
+ }
+ lastAccessTimeByMemoryId.put(memoryId, Instant.now());
return loginUserByMemoryId.get(memoryId);
}
@@ -31,5 +41,25 @@
return;
}
loginUserByMemoryId.remove(memoryId);
+ lastAccessTimeByMemoryId.remove(memoryId);
+ }
+
+ public void cleanExpiredSessions() {
+ Instant now = Instant.now();
+ lastAccessTimeByMemoryId.entrySet().removeIf(entry -> {
+ boolean expired = Duration.between(entry.getValue(), now).compareTo(SESSION_TIMEOUT) > 0;
+ if (expired) {
+ loginUserByMemoryId.remove(entry.getKey());
+ }
+ return expired;
+ });
+ }
+
+ private boolean isExpired(String memoryId) {
+ Instant lastAccess = lastAccessTimeByMemoryId.get(memoryId);
+ if (lastAccess == null) {
+ return true;
+ }
+ return Duration.between(lastAccess, Instant.now()).compareTo(SESSION_TIMEOUT) > 0;
}
}
diff --git a/src/main/java/com/ruoyi/ai/controller/FinancialAiController.java b/src/main/java/com/ruoyi/ai/controller/FinancialAiController.java
new file mode 100644
index 0000000..9465d5a
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/controller/FinancialAiController.java
@@ -0,0 +1,144 @@
+package com.ruoyi.ai.controller;
+
+import com.ruoyi.ai.assistant.FinancialAgent;
+import com.ruoyi.ai.assistant.FinancialIntentExecutor;
+import com.ruoyi.ai.bean.ChatForm;
+import com.ruoyi.ai.context.AiSessionUserContext;
+import com.ruoyi.ai.service.AiChatSessionService;
+import com.ruoyi.ai.store.MongoChatMemoryStore;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.data.message.UserMessage;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import reactor.core.publisher.Flux;
+
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+@Tag(name = "璐㈠姟鏅鸿兘浣�")
+@RestController
+@RequestMapping("/financial-ai")
+public class FinancialAiController extends BaseController {
+
+ private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
+
+ private final FinancialAgent financialAgent;
+ private final FinancialIntentExecutor financialIntentExecutor;
+ private final AiSessionUserContext aiSessionUserContext;
+ private final MongoChatMemoryStore mongoChatMemoryStore;
+ private final AiChatSessionService aiChatSessionService;
+
+ public FinancialAiController(FinancialAgent financialAgent,
+ FinancialIntentExecutor financialIntentExecutor,
+ AiSessionUserContext aiSessionUserContext,
+ MongoChatMemoryStore mongoChatMemoryStore,
+ AiChatSessionService aiChatSessionService) {
+ this.financialAgent = financialAgent;
+ this.financialIntentExecutor = financialIntentExecutor;
+ this.aiSessionUserContext = aiSessionUserContext;
+ this.mongoChatMemoryStore = mongoChatMemoryStore;
+ this.aiChatSessionService = aiChatSessionService;
+ }
+
+ @Operation(summary = "璐㈠姟鏅鸿兘浣撳璇�")
+ @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
+ public Flux<String> chat(@RequestBody ChatForm chatForm) {
+ if (!StringUtils.hasText(chatForm.getMemoryId())) {
+ return Flux.just("memoryId涓嶈兘涓虹┖");
+ }
+ if (!StringUtils.hasText(chatForm.getMessage())) {
+ return Flux.just("message涓嶈兘涓虹┖");
+ }
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ String memoryId = chatForm.getMemoryId();
+ String userMessage = chatForm.getMessage();
+
+ aiSessionUserContext.bind(memoryId, loginUser);
+ aiChatSessionService.touchSession(memoryId, loginUser, userMessage);
+
+ String directResponse = financialIntentExecutor.tryExecute(memoryId, userMessage);
+ if (StringUtils.isNotEmpty(directResponse)) {
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(directResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(directResponse);
+ }
+
+ if (isBusinessDataIntent(userMessage)) {
+ String noGuessResponse = "鏈瘑鍒埌鍙墽琛岀殑鏁版嵁鏌ヨ鏉′欢銆備负淇濊瘉缁撴灉鍑嗙‘锛屽綋鍓嶄笉浼氭帹娴嬫垨缂栭�犳暟鎹紝璇疯ˉ鍏呮槑纭椂闂磋寖鍥淬�佸鎴枫�佷緵搴斿晢鎴栧崟鍙峰悗鍐嶆煡璇€��";
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(noGuessResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(noGuessResponse);
+ }
+
+ return financialAgent.chat(memoryId, userMessage, currentDateForPrompt())
+ .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser))
+ .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser));
+ }
+
+ @Operation(summary = "璐㈠姟鏅鸿兘浣撲細璇濆垪琛�")
+ @GetMapping("/history/sessions")
+ public AjaxResult listSessions() {
+ return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser()));
+ }
+
+ @Operation(summary = "璐㈠姟鏅鸿兘浣撲細璇濇秷鎭�")
+ @GetMapping("/history/messages/{memoryId}")
+ public AjaxResult listMessages(@PathVariable String memoryId) {
+ return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser()));
+ }
+
+ @Operation(summary = "鍒犻櫎璐㈠姟鏅鸿兘浣撲細璇�")
+ @DeleteMapping("/history/{memoryId}")
+ public AjaxResult deleteSession(@PathVariable String memoryId) {
+ aiSessionUserContext.remove(memoryId);
+ return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()));
+ }
+
+ private String currentDateForPrompt() {
+ return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT);
+ }
+
+ private boolean isBusinessDataIntent(String message) {
+ if (!StringUtils.hasText(message)) {
+ return false;
+ }
+ String text = message.trim();
+ return containsAny(text,
+ "鏌ヨ", "鏌ョ湅", "缁熻", "鍒嗘瀽", "寤鸿", "鎴愭湰鏍哥畻", "浜у搧鎴愭湰", "宸ュ簭鎴愭湰",
+ "璁㈠崟鍒╂鼎", "浜忔崯璁㈠崟", "浣庡埄娑�", "搴撳瓨璧勯噾", "搴撳瓨绉帇", "鍛嗘粸搴撳瓨",
+ "鐜伴噾娴�", "鍥炴椋庨櫓", "浠樻鍘嬪姏", "璧勯噾缂哄彛", "搴旀敹", "搴斾粯",
+ "寮傚父棰勮", "缁忚惀寮傚父", "椋庨櫓棰勮", "椹鹃┒鑸�", "缁忚惀鐪嬫澘", "缁忚惀鎬昏",
+ "鏃ユ姤", "鍛ㄦ姤", "缁忚惀鎶ュ憡", "鍒嗘瀽鎶ュ憡", "涓氳储铻嶅悎", "鍙e緞", "鎸囨爣瑙i噴");
+ }
+
+ private boolean containsAny(String text, String... keywords) {
+ for (String keyword : keywords) {
+ if (text.contains(keyword)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/controller/KnowledgeChatController.java b/src/main/java/com/ruoyi/ai/controller/KnowledgeChatController.java
new file mode 100644
index 0000000..2738439
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/controller/KnowledgeChatController.java
@@ -0,0 +1,85 @@
+package com.ruoyi.ai.controller;
+
+import com.ruoyi.ai.assistant.KnowledgeChatAgent;
+import com.ruoyi.ai.dto.KnowledgeChatRequest;
+import com.ruoyi.ai.service.KnowledgeRagService;
+import com.ruoyi.approve.pojo.KnowledgeBase;
+import com.ruoyi.approve.service.KnowledgeBaseService;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import reactor.core.publisher.Flux;
+
+import java.util.List;
+
+/**
+ * 鐭ヨ瘑搴撻棶绛擟ontroller
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ai/knowledge")
+@RequiredArgsConstructor
+@Tag(name = "鐭ヨ瘑搴撻棶绛�")
+public class KnowledgeChatController {
+
+ private final KnowledgeChatAgent knowledgeChatAgent;
+ private final KnowledgeRagService knowledgeRagService;
+ private final KnowledgeBaseService knowledgeBaseService;
+
+ /**
+ * 鐭ヨ瘑搴撻棶绛旓紙娴佸紡杩斿洖锛�
+ */
+ @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
+ @Operation(summary = "鐭ヨ瘑搴撻棶绛�")
+ public Flux<String> chat(@RequestBody KnowledgeChatRequest request) {
+ if (request.getKnowledgeBaseId() == null) {
+ return Flux.just("鐭ヨ瘑搴揑D涓嶈兘涓虹┖");
+ }
+ if (!StringUtils.hasText(request.getMemoryId())) {
+ return Flux.just("浼氳瘽ID涓嶈兘涓虹┖");
+ }
+ if (!StringUtils.hasText(request.getQuestion())) {
+ return Flux.just("闂涓嶈兘涓虹┖");
+ }
+
+ KnowledgeBase knowledgeBase = knowledgeBaseService.getById(request.getKnowledgeBaseId());
+ if (knowledgeBase == null) {
+ return Flux.just("鐭ヨ瘑搴撲笉瀛樺湪");
+ }
+
+ String namespace = "kb-" + request.getKnowledgeBaseId();
+
+ List<String> relevantContents = knowledgeRagService.searchRelevantContent(
+ namespace, request.getQuestion(), 5);
+
+ if (relevantContents.isEmpty()) {
+ return Flux.just("鐭ヨ瘑搴撲腑鏈壘鍒扮浉鍏冲唴瀹癸紝璇峰厛涓婁紶鐩稿叧鏂囨。銆�");
+ }
+
+ StringBuilder contextBuilder = new StringBuilder();
+ contextBuilder.append("浠ヤ笅鏄粠鐭ヨ瘑搴撲腑妫�绱㈠埌鐨勭浉鍏冲唴瀹癸細\n\n");
+ for (int i = 0; i < relevantContents.size(); i++) {
+ contextBuilder.append("銆愬唴瀹�").append(i + 1).append("銆慭n");
+ contextBuilder.append(relevantContents.get(i)).append("\n\n");
+ }
+ contextBuilder.append("---\n");
+ contextBuilder.append("璇峰熀浜庝互涓婄煡璇嗗簱鍐呭鍥炵瓟鐢ㄦ埛闂锛歕n");
+ contextBuilder.append(request.getQuestion());
+
+ return knowledgeChatAgent.chat(request.getMemoryId(), contextBuilder.toString());
+ }
+
+ /**
+ * 鐭ヨ瘑搴撳垪琛紙鐢ㄤ簬閫夋嫨鐭ヨ瘑搴擄級
+ */
+ @GetMapping("/list")
+ @Operation(summary = "鐭ヨ瘑搴撳垪琛�")
+ public AjaxResult listKnowledgeBases() {
+ List<KnowledgeBase> list = knowledgeBaseService.list();
+ return AjaxResult.success(list);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/ai/controller/ManufacturingAiController.java b/src/main/java/com/ruoyi/ai/controller/ManufacturingAiController.java
new file mode 100644
index 0000000..87eb418
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/controller/ManufacturingAiController.java
@@ -0,0 +1,112 @@
+package com.ruoyi.ai.controller;
+
+import com.ruoyi.ai.assistant.ManufacturingAgent;
+import com.ruoyi.ai.assistant.ManufacturingIntentExecutor;
+import com.ruoyi.ai.bean.ChatForm;
+import com.ruoyi.ai.context.AiSessionUserContext;
+import com.ruoyi.ai.service.AiChatSessionService;
+import com.ruoyi.ai.store.MongoChatMemoryStore;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.data.message.UserMessage;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import reactor.core.publisher.Flux;
+
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+@Tag(name = "鍒堕�犳櫤鑳藉姪鎵�")
+@RestController
+@RequestMapping("/manufacturing-ai")
+public class ManufacturingAiController extends BaseController {
+
+ private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
+
+ private final ManufacturingAgent manufacturingAgent;
+ private final ManufacturingIntentExecutor manufacturingIntentExecutor;
+ private final AiSessionUserContext aiSessionUserContext;
+ private final MongoChatMemoryStore mongoChatMemoryStore;
+ private final AiChatSessionService aiChatSessionService;
+
+ public ManufacturingAiController(ManufacturingAgent manufacturingAgent,
+ ManufacturingIntentExecutor manufacturingIntentExecutor,
+ AiSessionUserContext aiSessionUserContext,
+ MongoChatMemoryStore mongoChatMemoryStore,
+ AiChatSessionService aiChatSessionService) {
+ this.manufacturingAgent = manufacturingAgent;
+ this.manufacturingIntentExecutor = manufacturingIntentExecutor;
+ this.aiSessionUserContext = aiSessionUserContext;
+ this.mongoChatMemoryStore = mongoChatMemoryStore;
+ this.aiChatSessionService = aiChatSessionService;
+ }
+
+ @Operation(summary = "鍒堕�犲璇�")
+ @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
+ public Flux<String> chat(@RequestBody ChatForm chatForm) {
+ if (!StringUtils.hasText(chatForm.getMemoryId())) {
+ return Flux.just("memoryId涓嶈兘涓虹┖");
+ }
+ if (!StringUtils.hasText(chatForm.getMessage())) {
+ return Flux.just("message涓嶈兘涓虹┖");
+ }
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ String memoryId = chatForm.getMemoryId();
+ String userMessage = chatForm.getMessage();
+
+ aiSessionUserContext.bind(memoryId, loginUser);
+ aiChatSessionService.touchSession(memoryId, loginUser, userMessage);
+
+ String directResponse = manufacturingIntentExecutor.tryExecute(memoryId, userMessage);
+ if (StringUtils.isNotEmpty(directResponse)) {
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(directResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(directResponse);
+ }
+
+ return manufacturingAgent.chat(memoryId, userMessage, currentDateForPrompt())
+ .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser))
+ .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser));
+ }
+
+ @Operation(summary = "鍒堕�犱細璇濆垪琛�")
+ @GetMapping("/history/sessions")
+ public AjaxResult listSessions() {
+ return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser()));
+ }
+
+ @Operation(summary = "鍒堕�犱細璇濇秷鎭�")
+ @GetMapping("/history/messages/{memoryId}")
+ public AjaxResult listMessages(@PathVariable String memoryId) {
+ return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser()));
+ }
+
+ @Operation(summary = "鍒犻櫎鍒堕�犱細璇�")
+ @DeleteMapping("/history/{memoryId}")
+ public AjaxResult deleteSession(@PathVariable String memoryId) {
+ aiSessionUserContext.remove(memoryId);
+ return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()));
+ }
+
+ private String currentDateForPrompt() {
+ return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT);
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/controller/PurchaseAiController.java b/src/main/java/com/ruoyi/ai/controller/PurchaseAiController.java
index 2bb0625..158ea61 100644
--- a/src/main/java/com/ruoyi/ai/controller/PurchaseAiController.java
+++ b/src/main/java/com/ruoyi/ai/controller/PurchaseAiController.java
@@ -1,151 +1,41 @@
package com.ruoyi.ai.controller;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.ruoyi.ai.assistant.PurchaseAgent;
-import com.ruoyi.ai.assistant.PurchaseIntentExecutor;
import com.ruoyi.ai.bean.ChatForm;
import com.ruoyi.ai.bean.PurchaseAiConfirmRequest;
-import com.ruoyi.ai.context.AiSessionUserContext;
-import com.ruoyi.ai.service.AiChatSessionService;
-import com.ruoyi.ai.service.AiFileTextExtractor;
-import com.ruoyi.ai.store.MongoChatMemoryStore;
-import com.ruoyi.basic.mapper.SupplierManageMapper;
-import com.ruoyi.basic.pojo.SupplierManage;
+import com.ruoyi.ai.service.PurchaseAiService;
import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.purchase.dto.PurchaseLedgerDto;
-import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import com.ruoyi.purchase.service.IPaymentRegistrationService;
-import com.ruoyi.purchase.service.IPurchaseLedgerService;
-import com.ruoyi.purchase.service.PurchaseReturnOrdersService;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import dev.langchain4j.data.image.Image;
-import dev.langchain4j.data.message.AiMessage;
-import dev.langchain4j.data.message.ChatMessage;
-import dev.langchain4j.data.message.Content;
-import dev.langchain4j.data.message.ImageContent;
-import dev.langchain4j.data.message.SystemMessage;
-import dev.langchain4j.data.message.TextContent;
-import dev.langchain4j.data.message.UserMessage;
-import dev.langchain4j.model.chat.StreamingChatLanguageModel;
-import dev.langchain4j.model.chat.response.ChatResponse;
-import dev.langchain4j.model.chat.response.StreamingChatResponseHandler;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import reactor.core.publisher.Flux;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.Base64;
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.UUID;
@Tag(name = "閲囪喘鏅鸿兘浣�")
@RestController
@RequestMapping("/purchase-ai")
public class PurchaseAiController extends BaseController {
- private static final String PURCHASE_FILE_ANALYZE_MEMORY_PREFIX = "purchase-file-analyze::";
- private static final int MAX_FILE_COUNT = 10;
- private static final int MAX_SINGLE_FILE_TEXT_LENGTH = 8000;
- private static final int MAX_TOTAL_FILE_TEXT_LENGTH = 30000;
+ private final PurchaseAiService purchaseAiService;
- private final PurchaseAgent purchaseAgent;
- private final PurchaseIntentExecutor purchaseIntentExecutor;
- private final AiSessionUserContext aiSessionUserContext;
- private final MongoChatMemoryStore mongoChatMemoryStore;
- private final AiChatSessionService aiChatSessionService;
- private final AiFileTextExtractor aiFileTextExtractor;
- private final ObjectMapper objectMapper;
- private final IPurchaseLedgerService purchaseLedgerService;
- private final IPaymentRegistrationService paymentRegistrationService;
- private final PurchaseReturnOrdersService purchaseReturnOrdersService;
- private final SupplierManageMapper supplierManageMapper;
- private final StreamingChatLanguageModel purchaseVisionStreamingChatModel;
-
- public PurchaseAiController(PurchaseAgent purchaseAgent,
- PurchaseIntentExecutor purchaseIntentExecutor,
- AiSessionUserContext aiSessionUserContext,
- MongoChatMemoryStore mongoChatMemoryStore,
- AiChatSessionService aiChatSessionService,
- AiFileTextExtractor aiFileTextExtractor,
- ObjectMapper objectMapper,
- IPurchaseLedgerService purchaseLedgerService,
- IPaymentRegistrationService paymentRegistrationService,
- PurchaseReturnOrdersService purchaseReturnOrdersService,
- SupplierManageMapper supplierManageMapper,
- @Qualifier("purchaseVisionStreamingChatModel") StreamingChatLanguageModel purchaseVisionStreamingChatModel) {
- this.purchaseAgent = purchaseAgent;
- this.purchaseIntentExecutor = purchaseIntentExecutor;
- this.aiSessionUserContext = aiSessionUserContext;
- this.mongoChatMemoryStore = mongoChatMemoryStore;
- this.aiChatSessionService = aiChatSessionService;
- this.aiFileTextExtractor = aiFileTextExtractor;
- this.objectMapper = objectMapper;
- this.purchaseLedgerService = purchaseLedgerService;
- this.paymentRegistrationService = paymentRegistrationService;
- this.purchaseReturnOrdersService = purchaseReturnOrdersService;
- this.supplierManageMapper = supplierManageMapper;
- this.purchaseVisionStreamingChatModel = purchaseVisionStreamingChatModel;
+ public PurchaseAiController(PurchaseAiService purchaseAiService) {
+ this.purchaseAiService = purchaseAiService;
}
@Operation(summary = "閲囪喘瀵硅瘽")
@PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
public Flux<String> chat(@RequestBody ChatForm chatForm) {
- if (!StringUtils.hasText(chatForm.getMemoryId())) {
- return Flux.just("memoryId涓嶈兘涓虹┖");
- }
- if (!StringUtils.hasText(chatForm.getMessage())) {
- return Flux.just("message涓嶈兘涓虹┖");
- }
-
LoginUser loginUser = SecurityUtils.getLoginUser();
- String memoryId = chatForm.getMemoryId();
- String userMessage = chatForm.getMessage();
-
- aiSessionUserContext.bind(memoryId, loginUser);
- aiChatSessionService.touchSession(memoryId, loginUser, userMessage);
-
- String directResponse = purchaseIntentExecutor.tryExecute(memoryId, userMessage);
- if (StringUtils.isNotEmpty(directResponse)) {
- mongoChatMemoryStore.appendMessages(
- memoryId,
- List.of(UserMessage.from(userMessage), AiMessage.from(directResponse))
- );
- aiChatSessionService.refreshSessionStats(memoryId, loginUser);
- return Flux.just(directResponse);
- }
-
- return purchaseAgent.chat(memoryId, userMessage)
- .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser))
- .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser));
+ return purchaseAiService.chat(chatForm, loginUser);
}
@Operation(summary = "閲囪喘澶氭枃浠跺垎鏋�")
@@ -153,751 +43,34 @@
public Flux<String> analyzeFiles(@RequestParam("files") MultipartFile[] files,
@RequestParam(value = "message", required = false) String message,
@RequestParam(value = "memoryId", required = false) String memoryId) {
- if (files == null || files.length == 0) {
- return Flux.just("files涓嶈兘涓虹┖");
- }
- if (files.length > MAX_FILE_COUNT) {
- return Flux.just("涓�娆℃渶澶氬垎鏋�" + MAX_FILE_COUNT + "涓枃浠�");
- }
-
- String rawMemoryId = StringUtils.hasText(memoryId) ? memoryId : UUID.randomUUID().toString();
- String finalMemoryId = rawMemoryId.startsWith(PURCHASE_FILE_ANALYZE_MEMORY_PREFIX)
- ? rawMemoryId
- : PURCHASE_FILE_ANALYZE_MEMORY_PREFIX + rawMemoryId;
-
LoginUser loginUser = SecurityUtils.getLoginUser();
- aiSessionUserContext.bind(finalMemoryId, loginUser);
-
- String finalMessage = StringUtils.hasText(message)
- ? message
- : "璇峰垎鏋愯繖浜涢噰璐枃浠讹紝鎻愬彇鍙敤浜庝笟鍔″鐞嗙殑鏁版嵁锛屽苟鏁寸悊鎴愬緟瀹㈡埛纭鐨勬牸寮�";
-
- String fileContent;
- try {
- fileContent = buildMultiFileContent(files);
- } catch (IllegalArgumentException ex) {
- return Flux.just(ex.getMessage());
- } catch (IOException ex) {
- return Flux.just("鏂囦欢璇诲彇澶辫触");
- }
-
- if (!StringUtils.hasText(fileContent)) {
- return Flux.just("鏈彁鍙栧埌鏈夋晥鏂囦欢鍐呭");
- }
-
- String userPrompt = buildPurchaseFileAnalyzePrompt(finalMessage, fileContent);
- aiChatSessionService.touchSession(finalMemoryId, loginUser, "閲囪喘澶氭枃浠跺垎鏋�: " + finalMessage);
-
- if (containsImageFile(files)) {
- return chatWithPurchaseVisionModel(finalMemoryId, userPrompt, files)
- .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser))
- .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser));
- }
-
- return Flux.defer(() -> purchaseAgent.chat(finalMemoryId, userPrompt))
- .onErrorResume(NoSuchElementException.class, ex -> {
- mongoChatMemoryStore.deleteMessages(finalMemoryId);
- return purchaseAgent.chat(finalMemoryId, userPrompt);
- })
- .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser))
- .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser));
+ return purchaseAiService.analyzeFiles(files, message, memoryId, loginUser);
}
@Operation(summary = "閲囪喘澶氭枃浠跺垎鏋愮‘璁ゅ鐞�")
@PostMapping("/analyze-files/confirm")
public AjaxResult confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) {
- if (request == null || !StringUtils.hasText(request.getBusinessType())) {
- return AjaxResult.error("businessType涓嶈兘涓虹┖");
- }
- if (request.getPayload() == null || request.getPayload().isEmpty()) {
- return AjaxResult.error("payload涓嶈兘涓虹┖");
- }
-
- try {
- String businessType = request.getBusinessType().trim();
- return switch (businessType) {
- case "purchase_ledger" -> processPurchaseLedger(request.getPayload());
- case "payment_registration" -> processPaymentRegistration(request.getPayload());
- case "purchase_return_order" -> processPurchaseReturnOrder(request.getPayload());
- default -> AjaxResult.error("鏆備笉鏀寔璇ヤ笟鍔$被鍨�: " + businessType);
- };
- } catch (Exception ex) {
- return AjaxResult.error(toCustomerMessage(ex));
- }
+ return purchaseAiService.confirmAnalyzeResult(request);
}
@Operation(summary = "閲囪喘浼氳瘽鍒楄〃")
@GetMapping("/history/sessions")
public AjaxResult listSessions() {
- return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser()));
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ return success(purchaseAiService.listSessions(loginUser));
}
@Operation(summary = "閲囪喘浼氳瘽娑堟伅")
@GetMapping("/history/messages/{memoryId}")
public AjaxResult listMessages(@PathVariable String memoryId) {
- return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser()));
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ return success(purchaseAiService.listMessages(memoryId, loginUser));
}
@Operation(summary = "鍒犻櫎閲囪喘浼氳瘽")
@DeleteMapping("/history/{memoryId}")
public AjaxResult deleteSession(@PathVariable String memoryId) {
- aiSessionUserContext.remove(memoryId);
- return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()));
- }
-
- private String buildMultiFileContent(MultipartFile[] files) throws IOException {
- StringBuilder builder = new StringBuilder();
- int totalLength = 0;
- for (MultipartFile file : files) {
- String text = aiFileTextExtractor.extractText(file);
- if (!StringUtils.hasText(text)) {
- continue;
- }
- String limitedText = text.length() > MAX_SINGLE_FILE_TEXT_LENGTH
- ? text.substring(0, MAX_SINGLE_FILE_TEXT_LENGTH)
- : text;
- if (totalLength + limitedText.length() > MAX_TOTAL_FILE_TEXT_LENGTH) {
- int remain = MAX_TOTAL_FILE_TEXT_LENGTH - totalLength;
- if (remain <= 0) {
- break;
- }
- limitedText = limitedText.substring(0, remain);
- }
- builder.append("\n--- 鏂囦欢: ")
- .append(file.getOriginalFilename())
- .append(" ---\n")
- .append(limitedText)
- .append('\n');
- totalLength += limitedText.length();
- }
- return builder.toString();
- }
-
- private boolean containsImageFile(MultipartFile[] files) {
- for (MultipartFile file : files) {
- if (aiFileTextExtractor.isImageFile(file)) {
- return true;
- }
- }
- return false;
- }
-
- private Flux<String> chatWithPurchaseVisionModel(String memoryId, String userPrompt, MultipartFile[] files) {
- return Flux.create(sink -> {
- try {
- List<Content> contents = new ArrayList<>();
- contents.add(TextContent.from(userPrompt));
- for (MultipartFile file : files) {
- if (!aiFileTextExtractor.isImageFile(file)) {
- continue;
- }
- contents.add(TextContent.from("涓嬮潰杩欏紶鍥剧墖鏂囦欢鍚嶏細" + file.getOriginalFilename()));
- contents.add(ImageContent.from(Image.builder()
- .base64Data(Base64.getEncoder().encodeToString(file.getBytes()))
- .mimeType(resolveImageMimeType(file))
- .build()));
- }
-
- List<ChatMessage> messages = List.of(
- SystemMessage.from("浣犳槸閲囪喘涓氬姟鏂囦欢鍒嗘瀽鍔╂墜銆傝浠庢枃鏈拰鍥剧墖涓瘑鍒噰璐彴璐︺�侀噰璐骇鍝佹槑缁嗐�佷粯娆炬垨閫�璐т俊鎭紝鍙緭鍑哄悎娉� JSON銆�"),
- UserMessage.from(contents)
- );
- purchaseVisionStreamingChatModel.chat(messages, new StreamingChatResponseHandler() {
- @Override
- public void onPartialResponse(String partialResponse) {
- sink.next(partialResponse);
- }
-
- @Override
- public void onCompleteResponse(ChatResponse completeResponse) {
- sink.complete();
- }
-
- @Override
- public void onError(Throwable error) {
- sink.error(error);
- }
- });
- } catch (Exception ex) {
- sink.next("鍥剧墖鏂囦欢璇诲彇澶辫触锛岃纭鍥剧墖鏍煎紡涓� png銆乯pg銆乯peg銆亀ebp 鎴� bmp锛屼笖澶у皬涓嶈秴杩�10MB");
- sink.complete();
- }
- });
- }
-
- private String resolveImageMimeType(MultipartFile file) {
- String contentType = file.getContentType();
- if (StringUtils.hasText(contentType) && contentType.startsWith("image/")) {
- return contentType;
- }
- String filename = file.getOriginalFilename();
- String ext = "";
- if (StringUtils.hasText(filename) && filename.contains(".")) {
- ext = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase();
- }
- return switch (ext) {
- case "jpg", "jpeg" -> "image/jpeg";
- case "webp" -> "image/webp";
- case "bmp" -> "image/bmp";
- default -> "image/png";
- };
- }
-
- private String buildPurchaseFileAnalyzePrompt(String message, String fileContent) {
- return """
- 浣犳槸閲囪喘涓氬姟鏂囦欢鍒嗘瀽鍔╂墜銆傝涓ユ牸鏍规嵁鐢ㄦ埛涓婁紶鐨勫涓枃浠跺拰鐢ㄦ埛瑕佹眰鎻愬彇閲囪喘涓氬姟鏁版嵁銆�
-
- 鐢ㄦ埛瑕佹眰:
- %s
-
- 杈撳嚭瑕佹眰:
- 1. 鍙緭鍑哄悎娉� JSON锛屼笉瑕� Markdown锛屼笉瑕侀澶栬В閲娿��
- 2. JSON 椤跺眰瀛楁鍥哄畾涓�:
- - success: boolean
- - businessType: purchase_ledger | payment_registration | purchase_return_order | unknown
- - action: confirm_required
- - description: 涓枃璇存槑
- - confidence: 0鍒�1鐨勫皬鏁�
- - missingFields: 缂哄け瀛楁涓枃鍚嶇О鏁扮粍锛岄潰鍚戝鎴峰睍绀猴紝涓嶈杈撳嚭鑻辨枃瀛楁鍚�
- - warnings: 椋庨櫓鎻愮ず鏁扮粍
- - payload: 寰呭鎴风‘璁ょ殑鏁版嵁锛屽瓧娈靛悕蹇呴』浣跨敤鍚庣 DTO 瀛楁鍚�
- - preview: 缁欏鎴风‘璁ょ敤鐨勪腑鏂囨憳瑕佹暟缁�
- 3. 濡傛灉鍙垽鏂负閲囪喘鍙拌处锛宐usinessType 浣跨敤 purchase_ledger锛宲ayload.purchaseLedgers 涓洪噰璐鍗�/閲囪喘鍙拌处鏁扮粍:
- - purchaseLedgers: 閲囪喘璁㈠崟/閲囪喘鍙拌处鏁扮粍锛屾瘡鏉¤褰曞瓧娈靛悕蹇呴』涓� PurchaseLedgerDto 淇濇寔涓�鑷�
- - 浜у搧鏄庣粏蹇呴』鏀惧湪姣忔潯閲囪喘鍙拌处璁板綍鐨� productData 瀛楁涓紝productData 绫诲瀷涓� List<SalesLedgerProduct>
- - 涓嶈浼樺厛浣跨敤 payload 椤跺眰 productData锛涢《灞� productData 浠呬綔涓烘棫鏍煎紡鍏煎
- - 鏂囦欢閲岀殑鈥滈噰璐崟鍙封�濆氨鏄�滈噰璐悎鍚屽彿鈥濓紝缁熶竴鏄犲皠涓� purchaseContractNumber
- - 鏂囦欢閲岀殑鈥滈攢鍞崟鍙封�濆氨鏄�滈攢鍞悎鍚屽彿鈥濓紝缁熶竴鏄犲皠涓� salesContractNo
- - 鎵�鏈夋棩鏈熷瓧娈靛繀椤讳娇鐢� yyyy-MM-dd锛屼緥濡� 2026-04-30锛涗笉瑕佽緭鍑� 4/30/26銆�2026/4/30銆�2026骞�4鏈�30鏃� 鎴栧甫鏃跺垎绉掔殑鏍煎紡
- - 閲囪喘鍙拌处涓嶉渶瑕佸湪 payload 涓紶瀹℃壒浜猴紝涓嶈杈撳嚭 approveUserIds銆乤pproverId
- - missingFields 鍙~鍐欎笟鍔″繀濉絾鏃犳硶璇嗗埆鐨勫瓧娈碉紝涓嶈鎶� PurchaseLedgerDto 鐨勬墍鏈夌┖瀛楁閮藉垪涓虹己澶憋紱缂哄け椤瑰繀椤诲啓涓枃锛屼緥濡傗�滀緵搴斿晢鍚嶇О鈥濃�滃惈绋庡崟浠封�濓紝涓嶈鍐� supplierId銆乼axInclusiveUnitPrice
- - 閲囪喘鍙拌处涓昏〃蹇呭~瀛楁浠呮寜杩欎簺鍒ゆ柇: purchaseContractNumber銆乻upplierName 鎴� supplierId
- - productData 姣忔潯浜у搧蹇呭~瀛楁: productCategory銆乻pecificationModel銆乽nit銆乹uantity銆乼axInclusiveUnitPrice 鎴� taxInclusiveTotalPrice锛涘鏋滃彧鏈夊惈绋庢�讳环鍜屾暟閲忥紝蹇呴』璁$畻 taxInclusiveUnitPrice锛涘鏋滃彧鏈夊惈绋庡崟浠峰拰鏁伴噺锛屽繀椤昏绠� taxInclusiveTotalPrice
- - 浜у搧瀛楁鎸夐噰璐鍏ユ帴鍙� PurchaseLedgerProductImportDto 瀵归綈: 閲囪喘鍗曞彿銆佷骇鍝佸ぇ绫汇�佽鏍煎瀷鍙枫�佸崟浣嶃�佹暟閲忋�佺◣鐜囥�佸惈绋庡崟浠枫�佸惈绋庢�讳环銆佸彂绁ㄧ被鍨嬨�佹槸鍚﹁川妫�
- - 閲囪喘浜у搧 type 鍥哄畾涓� 2
- - purchaseLedgers 姣忔潯璁板綍鍙娇鐢ㄨ繖浜� PurchaseLedgerDto 瀛楁鍚�:
- entryDateStart, entryDateEnd, id, purchaseContractNumber, supplierId, supplierName, isWhite, recorderId, recorderName, salesContractNo, salesContractNoId, projectName, entryDate, executionDate, remarks, attachmentMaterials, createdAt, updatedAt, salesLedgerId, hasChildren, Type, productData, tempFileIds, SalesLedgerFiles, phoneNumber, businessPersonId, productId, productModelId, invoiceNumber, invoiceAmount, ticketRegistrationId, contractAmount, receiptPaymentAmount, unReceiptPaymentAmount, type, paymentMethod, approvalStatus, templateName
- - productData 姣忔潯浜у搧鍙娇鐢ㄨ繖浜� SalesLedgerProduct 瀛楁鍚�:
- productCategory, specificationModel, unit, quantity, taxRate, taxInclusiveUnitPrice, taxInclusiveTotalPrice, taxExclusiveTotalPrice, invoiceType, productId, productModelId, isChecked, type
- 4. 濡傛灉鍙垽鏂负浠樻鐧昏锛宐usinessType 浣跨敤 payment_registration锛宲ayload.records 涓轰粯娆剧櫥璁版暟缁勶紝瀛楁灏介噺鍖呭惈 purchaseLedgerId銆乻alesLedgerProductId銆乧urrentPaymentAmount銆乸aymentMethod銆乸aymentDate銆�
- 5. 濡傛灉鍙垽鏂负閲囪喘閫�璐э紝businessType 浣跨敤 purchase_return_order锛宲ayload 鎸� PurchaseReturnOrderDto 缁勭粐锛屾槑缁嗘斁 purchaseReturnOrderProductsDtos銆�
- 6. 缂哄皯涓氬姟澶勭悊蹇呴』瀛楁鏃讹紝涓嶈缂栭�� ID锛屾妸瀛楁鏀惧叆 missingFields锛屽苟浠嶈繑鍥炲彲纭鐨勮崏绋挎暟鎹��
- 7. 鎵�鏈変腑鏂囧唴瀹圭洿鎺ヤ繚鐣欙紝涓嶈杞箟鎴� Unicode銆�
-
- 鏂囦欢鍐呭:
- %s
- """.formatted(message, fileContent);
- }
-
- private AjaxResult processPurchaseLedger(Map<String, Object> payload) throws Exception {
- if (payload.containsKey("purchaseLedgers")) {
- return processPurchaseLedgerBatch(payload);
- }
-
- Map<String, Object> normalizedPayload = normalizePurchaseLedgerMap(payload);
- PurchaseLedgerDto dto = objectMapper.convertValue(normalizedPayload, PurchaseLedgerDto.class);
- AjaxResult ledgerResult = validatePurchaseLedger(dto, 0);
- if (ledgerResult != null) {
- return ledgerResult;
- }
- AjaxResult supplierResult = fillSupplierIdByName(dto);
- if (supplierResult != null) {
- return supplierResult;
- }
- AjaxResult productResult = validatePurchaseProducts(dto.getProductData(), 0);
- if (productResult != null) {
- return productResult;
- }
- int result = purchaseLedgerService.addOrEditPurchase(dto);
- return AjaxResult.success("閲囪喘鍙拌处宸插鐞�", result);
- }
-
- private AjaxResult processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception {
- List<Map<String, Object>> purchaseLedgers = toMapList(payload.get("purchaseLedgers"));
- if (purchaseLedgers.isEmpty()) {
- return AjaxResult.error("purchaseLedgers涓嶈兘涓虹┖");
- }
-
- List<Map<String, Object>> topLevelProductData = toMapList(payload.get("productData"));
- List<Map<String, Object>> results = new ArrayList<>();
- for (int i = 0; i < purchaseLedgers.size(); i++) {
- Map<String, Object> ledgerMap = normalizePurchaseLedgerMap(purchaseLedgers.get(i));
- PurchaseLedgerDto dto = objectMapper.convertValue(ledgerMap, PurchaseLedgerDto.class);
- AjaxResult ledgerResult = validatePurchaseLedger(dto, i);
- if (ledgerResult != null) {
- return ledgerResult;
- }
- AjaxResult supplierResult = fillSupplierIdByName(dto);
- if (supplierResult != null) {
- return supplierResult;
- }
-
- List<SalesLedgerProduct> products = dto.getProductData();
- if (products == null || products.isEmpty()) {
- products = matchProductsForLedger(ledgerMap, dto, topLevelProductData, purchaseLedgers.size() == 1);
- dto.setProductData(products);
- }
- AjaxResult productResult = validatePurchaseProducts(products, i);
- if (productResult != null) {
- return productResult;
- }
- int result = purchaseLedgerService.addOrEditPurchase(dto);
-
- Map<String, Object> item = new LinkedHashMap<>();
- item.put("index", i);
- item.put("purchaseContractNumber", dto.getPurchaseContractNumber());
- item.put("supplierId", dto.getSupplierId());
- item.put("supplierName", dto.getSupplierName());
- item.put("productCount", products.size());
- item.put("result", result);
- results.add(item);
- }
- return AjaxResult.success("閲囪喘鍙拌处宸叉壒閲忓鐞�", results);
- }
-
- private List<SalesLedgerProduct> matchProductsForLedger(Map<String, Object> ledgerMap,
- PurchaseLedgerDto dto,
- List<Map<String, Object>> productData,
- boolean onlyOneLedger) {
- List<SalesLedgerProduct> products = new ArrayList<>();
- for (Map<String, Object> productMap : productData) {
- if (onlyOneLedger || productBelongsToLedger(productMap, ledgerMap, dto)) {
- products.add(objectMapper.convertValue(normalizeSalesLedgerProductMap(productMap), SalesLedgerProduct.class));
- }
- }
- return products;
- }
-
- private boolean productBelongsToLedger(Map<String, Object> productMap, Map<String, Object> ledgerMap, PurchaseLedgerDto dto) {
- Long productPurchaseLedgerId = longValue(productMap, "purchaseLedgerId", "purchaseId", "閲囪喘璁㈠崟id", "閲囪喘鍙拌处id");
- if (productPurchaseLedgerId != null && dto.getId() != null && productPurchaseLedgerId.equals(dto.getId())) {
- return true;
- }
-
- Long productSalesLedgerId = longValue(productMap, "salesLedgerId");
- if (productSalesLedgerId != null && dto.getId() != null && productSalesLedgerId.equals(dto.getId())) {
- return true;
- }
-
- String productContractNo = stringValue(productMap, "purchaseContractNumber", "purchaseContractNo", "閲囪喘鍚堝悓鍙�", "閲囪喘鍗曞彿", "閲囪喘璁㈠崟鍙�");
- if (StringUtils.hasText(productContractNo)
- && StringUtils.hasText(dto.getPurchaseContractNumber())
- && productContractNo.trim().equals(dto.getPurchaseContractNumber().trim())) {
- return true;
- }
-
- String ledgerContractNo = stringValue(ledgerMap, "purchaseContractNumber", "purchaseContractNo", "閲囪喘鍚堝悓鍙�", "閲囪喘鍗曞彿", "閲囪喘璁㈠崟鍙�");
- if (StringUtils.hasText(productContractNo)
- && StringUtils.hasText(ledgerContractNo)
- && productContractNo.trim().equals(ledgerContractNo.trim())) {
- return true;
- }
-
- String productSalesContractNo = stringValue(productMap, "salesContractNo", "salesContractNumber", "閿�鍞悎鍚屽彿", "閿�鍞崟鍙�", "閿�鍞鍗曞彿");
- if (StringUtils.hasText(productSalesContractNo)
- && StringUtils.hasText(dto.getSalesContractNo())
- && productSalesContractNo.trim().equals(dto.getSalesContractNo().trim())) {
- return true;
- }
-
- String ledgerSalesContractNo = stringValue(ledgerMap, "salesContractNo", "salesContractNumber", "閿�鍞悎鍚屽彿", "閿�鍞崟鍙�", "閿�鍞鍗曞彿");
- if (StringUtils.hasText(productSalesContractNo)
- && StringUtils.hasText(ledgerSalesContractNo)
- && productSalesContractNo.trim().equals(ledgerSalesContractNo.trim())) {
- return true;
- }
-
- String productSupplierName = stringValue(productMap, "supplierName", "渚涘簲鍟嗗悕绉�");
- return StringUtils.hasText(productSupplierName)
- && StringUtils.hasText(dto.getSupplierName())
- && productSupplierName.trim().equals(dto.getSupplierName().trim());
- }
-
- private Map<String, Object> normalizePurchaseLedgerMap(Map<String, Object> source) {
- Map<String, Object> target = new LinkedHashMap<>();
- copyPurchaseLedgerDtoFields(source, target);
- putDtoFieldIfPresent(source, target, "entryDateStart", "褰曞叆寮�濮嬫棩鏈�", "褰曞叆鏃ユ湡寮�濮�");
- putDtoFieldIfPresent(source, target, "entryDateEnd", "褰曞叆缁撴潫鏃ユ湡", "褰曞叆鏃ユ湡缁撴潫");
- putDtoFieldIfPresent(source, target, "id", "閲囪喘鍙拌处id", "閲囪喘璁㈠崟id", "涓婚敭");
- putDtoFieldIfPresent(source, target, "purchaseContractNumber", "purchaseContractNo", "閲囪喘鍚堝悓鍙�", "閲囪喘鍗曞彿", "閲囪喘璁㈠崟鍙�");
- putDtoFieldIfPresent(source, target, "supplierId", "渚涘簲鍟唅d", "渚涘簲鍟咺D", "渚涘簲鍟嗗悕绉癷d", "渚涘簲鍟嗗悕绉癐D");
- putDtoFieldIfPresent(source, target, "supplierName", "渚涘簲鍟�", "渚涘簲鍟嗗悕绉�");
- putDtoFieldIfPresent(source, target, "isWhite", "鏄惁鐧藉悕鍗�");
- putDtoFieldIfPresent(source, target, "recorderId", "褰曞叆浜篿d", "褰曞叆浜篒D", "褰曞叆浜哄鍚峣d", "褰曞叆浜哄鍚岻D");
- putDtoFieldIfPresent(source, target, "recorderName", "褰曞叆浜�", "褰曞叆浜哄鍚�");
- putDtoFieldIfPresent(source, target, "salesContractNo", "salesContractNumber", "閿�鍞悎鍚屽彿", "閿�鍞崟鍙�", "閿�鍞鍗曞彿");
- putDtoFieldIfPresent(source, target, "salesContractNoId", "閿�鍞悎鍚屽彿id", "閿�鍞悎鍚屽彿ID", "閿�鍞崟鍙穒d", "閿�鍞崟鍙稩D");
- putDtoFieldIfPresent(source, target, "projectName", "椤圭洰", "椤圭洰鍚嶇О");
- putDtoFieldIfPresent(source, target, "entryDate", "褰曞叆鏃ユ湡");
- putDtoFieldIfPresent(source, target, "executionDate", "绛捐鏃ユ湡", "鍚堝悓绛捐鏃ユ湡");
- putDtoFieldIfPresent(source, target, "remarks", "澶囨敞", "璇存槑");
- putDtoFieldIfPresent(source, target, "attachmentMaterials", "闄勪欢鏉愭枡", "闄勪欢鏉愭枡璺緞鎴栧悕绉�");
- putDtoFieldIfPresent(source, target, "createdAt", "鍒涘缓鏃堕棿", "璁板綍鍒涘缓鏃堕棿");
- putDtoFieldIfPresent(source, target, "updatedAt", "鏇存柊鏃堕棿", "璁板綍鏈�鍚庢洿鏂版椂闂�");
- putDtoFieldIfPresent(source, target, "salesLedgerId", "閿�鍞彴璐d", "閿�鍞彴璐D", "鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�");
- putDtoFieldIfPresent(source, target, "hasChildren", "鏄惁鏈夊瓙绾�", "鏄惁鏈夋槑缁�");
- putDtoFieldIfPresent(source, target, "Type", "鍙拌处绫诲瀷", "涓氬姟绫诲瀷");
- putDtoFieldIfPresent(source, target, "productData", "products", "浜у搧鏄庣粏", "閲囪喘浜у搧鏄庣粏");
- putDtoFieldIfPresent(source, target, "tempFileIds", "涓存椂鏂囦欢id", "涓存椂鏂囦欢ID", "涓存椂鏂囦欢ids");
- putDtoFieldIfPresent(source, target, "SalesLedgerFiles", "闄勪欢鍒楄〃", "閿�鍞彴璐﹂檮浠�");
- putDtoFieldIfPresent(source, target, "phoneNumber", "涓氬姟鍛樻墜鏈哄彿", "鎵嬫満鍙�");
- putDtoFieldIfPresent(source, target, "businessPersonId", "涓氬姟鍛榠d", "涓氬姟鍛業D");
- putDtoFieldIfPresent(source, target, "productId", "浜у搧id", "浜у搧ID");
- putDtoFieldIfPresent(source, target, "productModelId", "浜у搧瑙勬牸id", "浜у搧瑙勬牸ID");
- putDtoFieldIfPresent(source, target, "invoiceNumber", "鍙戠エ鍙�", "鍙戠エ鍙风爜");
- putDtoFieldIfPresent(source, target, "invoiceAmount", "鍙戠エ閲戦", "鍙戠エ閲戦锛堝厓锛�");
- putDtoFieldIfPresent(source, target, "ticketRegistrationId", "鏉ョエ鐧昏id", "鏉ョエ鐧昏ID");
- putDtoFieldIfPresent(source, target, "contractAmount", "鍚堝悓閲戦", "鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�");
- putDtoFieldIfPresent(source, target, "receiptPaymentAmount", "鏉ョエ閲戦", "宸叉潵绁ㄩ噾棰�", "宸叉潵绁ㄩ噾棰�(鍏�)");
- putDtoFieldIfPresent(source, target, "unReceiptPaymentAmount", "鏈潵绁ㄩ噾棰�", "鏈潵绁ㄩ噾棰�(鍏�)");
- putDtoFieldIfPresent(source, target, "type", "鏂囦欢绫诲瀷");
- putDtoFieldIfPresent(source, target, "paymentMethod", "浠樻鏂瑰紡");
- putDtoFieldIfPresent(source, target, "approvalStatus", "瀹℃壒鐘舵��");
- putDtoFieldIfPresent(source, target, "templateName", "妯℃澘鍚嶇О");
- target.remove("approveUserIds");
- target.remove("approverId");
- normalizeNestedProductData(target);
- attachImportStyleProductData(source, target);
- if (target.get("type") == null) {
- target.put("type", 2);
- }
- target.putIfAbsent("entryDate", LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
- normalizePurchaseLedgerDateFields(target);
- return target;
- }
-
- private void attachImportStyleProductData(Map<String, Object> source, Map<String, Object> target) {
- if (target.get("productData") != null) {
- return;
- }
- Map<String, Object> productMap = normalizeSalesLedgerProductMap(source);
- if (hasImportStyleProductData(productMap)) {
- target.put("productData", List.of(productMap));
- }
- }
-
- private boolean hasImportStyleProductData(Map<String, Object> productMap) {
- return hasMapText(productMap, "productCategory")
- || hasMapText(productMap, "specificationModel")
- || productMap.get("quantity") != null
- || productMap.get("taxInclusiveUnitPrice") != null
- || productMap.get("taxInclusiveTotalPrice") != null;
- }
-
- private boolean hasMapText(Map<String, Object> map, String key) {
- Object value = map.get(key);
- return value != null && StringUtils.hasText(String.valueOf(value));
- }
-
- private void normalizeNestedProductData(Map<String, Object> target) {
- Object productDataValue = target.get("productData");
- if (productDataValue == null) {
- return;
- }
- List<Map<String, Object>> productMaps = toMapList(productDataValue);
- List<Map<String, Object>> normalizedProducts = new ArrayList<>();
- for (Map<String, Object> productMap : productMaps) {
- normalizedProducts.add(normalizeSalesLedgerProductMap(productMap));
- }
- target.put("productData", normalizedProducts);
- }
-
- private Map<String, Object> normalizeSalesLedgerProductMap(Map<String, Object> source) {
- Map<String, Object> target = new LinkedHashMap<>();
- copySalesLedgerProductFields(source, target);
- putDtoFieldIfPresent(source, target, "productCategory", "浜у搧澶х被", "浜у搧鍚嶇О", "浜у搧", "鍝佸悕", "鐗╂枡鍚嶇О");
- putDtoFieldIfPresent(source, target, "specificationModel", "瑙勬牸鍨嬪彿", "鍨嬪彿", "瑙勬牸", "浜у搧瑙勬牸");
- putDtoFieldIfPresent(source, target, "unit", "鍗曚綅");
- putDtoFieldIfPresent(source, target, "quantity", "鏁伴噺", "閲囪喘鏁伴噺");
- putDtoFieldIfPresent(source, target, "taxRate", "绋庣巼");
- putDtoFieldIfPresent(source, target, "taxInclusiveUnitPrice", "鍚◣鍗曚环", "鍗曚环", "閲囪喘鍗曚环", "鍚◣浠锋牸");
- putDtoFieldIfPresent(source, target, "taxInclusiveTotalPrice", "鍚◣鎬讳环", "鎬讳环", "閲囪喘閲戦", "閲戦", "鍚堝悓閲戦");
- putDtoFieldIfPresent(source, target, "taxExclusiveTotalPrice", "涓嶅惈绋庢�讳环");
- putDtoFieldIfPresent(source, target, "invoiceType", "鍙戠エ绫诲瀷", "鍙戠エ绫诲埆");
- putDtoFieldIfPresent(source, target, "productId", "浜у搧id", "浜у搧ID");
- putDtoFieldIfPresent(source, target, "productModelId", "浜у搧瑙勬牸id", "浜у搧瑙勬牸ID", "鍨嬪彿id", "鍨嬪彿ID");
- putDtoFieldIfPresent(source, target, "isChecked", "鏄惁璐ㄦ", "鏄惁璐ㄦ楠�", "璐ㄦ");
- putDtoFieldIfPresent(source, target, "type", "鍙拌处绫诲瀷");
- normalizeProductAmounts(target);
- target.putIfAbsent("type", 2);
- return target;
- }
-
- private void copySalesLedgerProductFields(Map<String, Object> source, Map<String, Object> target) {
- String[] productFields = {
- "id", "salesLedgerId", "warnNum", "productCategory", "specificationModel", "unit",
- "speculativeTradingName", "quantity", "minStock", "taxRate", "taxInclusiveUnitPrice",
- "taxInclusiveTotalPrice", "taxExclusiveTotalPrice", "invoiceType", "type", "ticketsNum",
- "ticketsAmount", "futureTickets", "futureTicketsAmount", "invoiceNum", "noInvoiceNum",
- "invoiceAmount", "noInvoiceAmount", "productId", "productModelId", "register", "registerDate",
- "approveStatus", "pendingInvoiceTotal", "invoiceTotal", "pendingTicketsTotal", "ticketsTotal",
- "isChecked", "isProduction"
- };
- for (String field : productFields) {
- if (source.containsKey(field)) {
- target.put(field, source.get(field));
- }
- }
- }
-
- private void normalizeProductAmounts(Map<String, Object> target) {
- BigDecimal quantity = decimalValue(target.get("quantity"));
- BigDecimal unitPrice = decimalValue(target.get("taxInclusiveUnitPrice"));
- BigDecimal totalPrice = decimalValue(target.get("taxInclusiveTotalPrice"));
- if (unitPrice == null && totalPrice != null && quantity != null && quantity.compareTo(BigDecimal.ZERO) != 0) {
- target.put("taxInclusiveUnitPrice", totalPrice.divide(quantity, 6, RoundingMode.HALF_UP));
- }
- if (totalPrice == null && unitPrice != null && quantity != null) {
- target.put("taxInclusiveTotalPrice", unitPrice.multiply(quantity));
- }
- BigDecimal taxRate = decimalValue(target.get("taxRate"));
- totalPrice = decimalValue(target.get("taxInclusiveTotalPrice"));
- if (target.get("taxExclusiveTotalPrice") == null && totalPrice != null && taxRate != null) {
- BigDecimal divisor = BigDecimal.ONE.add(taxRate.divide(new BigDecimal("100"), 6, RoundingMode.HALF_UP));
- target.put("taxExclusiveTotalPrice", totalPrice.divide(divisor, 2, RoundingMode.HALF_UP));
- }
- }
-
- private AjaxResult validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) {
- if (products == null || products.isEmpty()) {
- return null;
- }
- for (int i = 0; i < products.size(); i++) {
- SalesLedgerProduct product = products.get(i);
- String prefix = "绗�" + (ledgerIndex + 1) + "涓噰璐彴璐︾殑绗�" + (i + 1) + "鏉′骇鍝�";
- if (!StringUtils.hasText(product.getProductCategory())) {
- return AjaxResult.error(prefix + "缂哄皯浜у搧鍚嶇О锛岃琛ュ厖鍚庡啀纭");
- }
- if (!StringUtils.hasText(product.getSpecificationModel())) {
- return AjaxResult.error(prefix + "缂哄皯瑙勬牸鍨嬪彿锛岃琛ュ厖鍚庡啀纭");
- }
- if (!StringUtils.hasText(product.getUnit())) {
- return AjaxResult.error(prefix + "缂哄皯鍗曚綅锛岃琛ュ厖鍚庡啀纭");
- }
- if (product.getQuantity() == null) {
- return AjaxResult.error(prefix + "缂哄皯鏁伴噺");
- }
- if (product.getTaxInclusiveUnitPrice() == null) {
- return AjaxResult.error(prefix + "缂哄皯鍚◣鍗曚环锛岃琛ュ厖鍚庡啀纭");
- }
- if (product.getTaxInclusiveTotalPrice() == null) {
- return AjaxResult.error(prefix + "缂哄皯鍚◣鎬讳环锛岃琛ュ厖鍚庡啀纭");
- }
- }
- return null;
- }
-
- private AjaxResult validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) {
- String prefix = "绗�" + (ledgerIndex + 1) + "涓噰璐彴璐�";
- if (!StringUtils.hasText(dto.getPurchaseContractNumber())) {
- return AjaxResult.error(prefix + "缂哄皯閲囪喘鍚堝悓鍙凤紝璇疯ˉ鍏呭悗鍐嶇‘璁�");
- }
- if (dto.getSupplierId() == null && !StringUtils.hasText(dto.getSupplierName())) {
- return AjaxResult.error(prefix + "缂哄皯渚涘簲鍟嗗悕绉帮紝璇疯ˉ鍏呭悗鍐嶇‘璁�");
- }
- return null;
- }
-
- private void normalizePurchaseLedgerDateFields(Map<String, Object> target) {
- normalizeDateField(target, "entryDate");
- normalizeDateField(target, "executionDate");
- normalizeDateField(target, "createdAt");
- normalizeDateField(target, "updatedAt");
- }
-
- private void normalizeDateField(Map<String, Object> target, String fieldName) {
- Object value = target.get(fieldName);
- if (value == null) {
- return;
- }
- String normalizedDate = normalizeDateValue(value);
- if (StringUtils.hasText(normalizedDate)) {
- target.put(fieldName, normalizedDate);
- }
- }
-
- private String normalizeDateValue(Object value) {
- if (value instanceof Date date) {
- return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().format(DateTimeFormatter.ISO_LOCAL_DATE);
- }
- if (value instanceof Number number) {
- return LocalDate.of(1899, 12, 30)
- .plusDays(number.longValue())
- .format(DateTimeFormatter.ISO_LOCAL_DATE);
- }
-
- String text = String.valueOf(value).trim();
- if (!StringUtils.hasText(text)) {
- return null;
- }
- if (text.length() >= 10 && text.charAt(4) == '-' && text.charAt(7) == '-') {
- return text.substring(0, 10);
- }
-
- String normalizedText = text.replace("骞�", "-")
- .replace("鏈�", "-")
- .replace("鏃�", "")
- .replace(".", "-")
- .replace("/", "-")
- .trim();
- DateTimeFormatter[] formatters = {
- DateTimeFormatter.ofPattern("yyyy-M-d"),
- DateTimeFormatter.ofPattern("M-d-yyyy"),
- DateTimeFormatter.ofPattern("M-d-yy")
- };
- for (DateTimeFormatter formatter : formatters) {
- try {
- return LocalDate.parse(normalizedText, formatter).format(DateTimeFormatter.ISO_LOCAL_DATE);
- } catch (DateTimeParseException ignored) {
- // Try the next supported input pattern.
- }
- }
- return text;
- }
-
- private void copyPurchaseLedgerDtoFields(Map<String, Object> source, Map<String, Object> target) {
- String[] dtoFields = {
- "entryDateStart", "entryDateEnd", "id", "purchaseContractNumber",
- "supplierId", "supplierName", "isWhite", "recorderId", "recorderName", "salesContractNo",
- "salesContractNoId", "projectName", "entryDate", "executionDate", "remarks", "attachmentMaterials",
- "createdAt", "updatedAt", "salesLedgerId", "hasChildren", "Type", "productData", "tempFileIds",
- "SalesLedgerFiles", "phoneNumber", "businessPersonId", "productId", "productModelId", "invoiceNumber",
- "invoiceAmount", "ticketRegistrationId", "contractAmount", "receiptPaymentAmount",
- "unReceiptPaymentAmount", "type", "paymentMethod", "approvalStatus", "templateName"
- };
- for (String field : dtoFields) {
- if (source.containsKey(field)) {
- target.put(field, source.get(field));
- }
- }
- }
-
- private void putDtoFieldIfPresent(Map<String, Object> source, Map<String, Object> target, String dtoField, String... aliases) {
- if (target.containsKey(dtoField) && target.get(dtoField) != null) {
- return;
- }
- for (String alias : aliases) {
- Object value = source.get(alias);
- if (value != null && StringUtils.hasText(String.valueOf(value))) {
- target.put(dtoField, value);
- return;
- }
- }
- }
-
- private List<Map<String, Object>> toMapList(Object value) {
- if (value == null) {
- return List.of();
- }
- return objectMapper.convertValue(value, new TypeReference<List<Map<String, Object>>>() {
- });
- }
-
- private String stringValue(Map<String, Object> map, String... keys) {
- for (String key : keys) {
- Object value = map.get(key);
- if (value != null && StringUtils.hasText(String.valueOf(value))) {
- return String.valueOf(value);
- }
- }
- return null;
- }
-
- private Long longValue(Map<String, Object> map, String... keys) {
- String value = stringValue(map, keys);
- if (!StringUtils.hasText(value)) {
- return null;
- }
- try {
- return Long.parseLong(value.trim());
- } catch (NumberFormatException ignored) {
- return null;
- }
- }
-
- private BigDecimal decimalValue(Object value) {
- if (value == null) {
- return null;
- }
- if (value instanceof BigDecimal decimal) {
- return decimal;
- }
- if (value instanceof Number number) {
- return new BigDecimal(String.valueOf(number));
- }
- String text = String.valueOf(value)
- .replace(",", "")
- .replace("锛�", "")
- .replace("鍏�", "")
- .replace("锟�", "")
- .trim();
- if (!StringUtils.hasText(text)) {
- return null;
- }
- try {
- return new BigDecimal(text);
- } catch (NumberFormatException ignored) {
- return null;
- }
- }
-
- private String toCustomerMessage(Exception ex) {
- String message = ex.getMessage();
- if (!StringUtils.hasText(message)) {
- return "澶勭悊澶辫触锛岃妫�鏌ョ‘璁ゆ暟鎹悗閲嶈瘯";
- }
- if (message.contains("tax_inclusive_unit_price")) {
- return "澶勭悊澶辫触锛氫骇鍝佹槑缁嗙己灏戝惈绋庡崟浠凤紝璇疯ˉ鍏呭悗鍐嶇‘璁�";
- }
- if (message.contains("tax_inclusive_total_price")) {
- return "澶勭悊澶辫触锛氫骇鍝佹槑缁嗙己灏戝惈绋庢�讳环锛岃琛ュ厖鍚庡啀纭";
- }
- if (message.contains("entryDate")) {
- return "澶勭悊澶辫触锛氬綍鍏ユ棩鏈熸牸寮忎笉姝g‘锛岃浣跨敤 yyyy-MM-dd锛屼緥濡� 2026-04-30";
- }
- if (message.contains("supplier")) {
- return "澶勭悊澶辫触锛氫緵搴斿晢淇℃伅涓嶅畬鏁达紝璇风‘璁や緵搴斿晢鍚嶇О鎴栦緵搴斿晢ID";
- }
- if (message.contains("SQL") || message.contains("java.") || message.contains("Exception")) {
- return "澶勭悊澶辫触锛氱‘璁ゆ暟鎹笉瀹屾暣鎴栨牸寮忎笉姝g‘锛岃妫�鏌ュ繀濉瓧娈靛悗閲嶈瘯";
- }
- return "澶勭悊澶辫触锛�" + message;
- }
-
- private AjaxResult fillSupplierIdByName(PurchaseLedgerDto dto) {
- if (dto.getSupplierId() != null) {
- return null;
- }
- if (!StringUtils.hasText(dto.getSupplierName())) {
- return AjaxResult.error("渚涘簲鍟咺D涓嶈兘涓虹┖锛涙湭璇嗗埆鍒颁緵搴斿晢鍚嶇О锛屾棤娉曡嚜鍔ㄥ尮閰嶄緵搴斿晢ID");
- }
-
- SupplierManage supplier = supplierManageMapper.selectOne(new LambdaQueryWrapper<SupplierManage>()
- .eq(SupplierManage::getSupplierName, dto.getSupplierName().trim())
- .last("limit 1"));
- if (supplier == null) {
- return AjaxResult.error("鏈壘鍒颁緵搴斿晢锛�" + dto.getSupplierName() + "锛岃鍏堢淮鎶や緵搴斿晢鎴栨墜鍔ㄩ�夋嫨渚涘簲鍟咺D");
- }
- dto.setSupplierId(supplier.getId());
- return null;
- }
-
- private AjaxResult processPaymentRegistration(Map<String, Object> payload) {
- Object recordsValue = payload.get("records");
- List<PaymentRegistration> records;
- if (recordsValue == null) {
- records = Collections.singletonList(objectMapper.convertValue(payload, PaymentRegistration.class));
- } else {
- records = objectMapper.convertValue(recordsValue, new TypeReference<List<PaymentRegistration>>() {
- });
- }
- int result = paymentRegistrationService.insertPaymentRegistration(records);
- return AjaxResult.success("浠樻鐧昏宸插鐞�", result);
- }
-
- private AjaxResult processPurchaseReturnOrder(Map<String, Object> payload) {
- PurchaseReturnOrderDto dto = objectMapper.convertValue(payload, PurchaseReturnOrderDto.class);
- Boolean result = purchaseReturnOrdersService.add(dto);
- return AjaxResult.success("閲囪喘閫�璐у崟宸插鐞�", result);
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ return toAjax(purchaseAiService.deleteSession(memoryId, loginUser));
}
}
diff --git a/src/main/java/com/ruoyi/ai/controller/SalesAiController.java b/src/main/java/com/ruoyi/ai/controller/SalesAiController.java
new file mode 100644
index 0000000..0c92ad6
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/controller/SalesAiController.java
@@ -0,0 +1,141 @@
+package com.ruoyi.ai.controller;
+
+import com.ruoyi.ai.assistant.SalesAgent;
+import com.ruoyi.ai.assistant.SalesIntentExecutor;
+import com.ruoyi.ai.bean.ChatForm;
+import com.ruoyi.ai.context.AiSessionUserContext;
+import com.ruoyi.ai.service.AiChatSessionService;
+import com.ruoyi.ai.store.MongoChatMemoryStore;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.data.message.UserMessage;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import reactor.core.publisher.Flux;
+
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+@Tag(name = "閿�鍞姪鎵嬫櫤鑳戒綋")
+@RestController
+@RequestMapping("/sales-ai")
+public class SalesAiController extends BaseController {
+
+ private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
+
+ private final SalesAgent salesAgent;
+ private final SalesIntentExecutor salesIntentExecutor;
+ private final AiSessionUserContext aiSessionUserContext;
+ private final MongoChatMemoryStore mongoChatMemoryStore;
+ private final AiChatSessionService aiChatSessionService;
+
+ public SalesAiController(SalesAgent salesAgent,
+ SalesIntentExecutor salesIntentExecutor,
+ AiSessionUserContext aiSessionUserContext,
+ MongoChatMemoryStore mongoChatMemoryStore,
+ AiChatSessionService aiChatSessionService) {
+ this.salesAgent = salesAgent;
+ this.salesIntentExecutor = salesIntentExecutor;
+ this.aiSessionUserContext = aiSessionUserContext;
+ this.mongoChatMemoryStore = mongoChatMemoryStore;
+ this.aiChatSessionService = aiChatSessionService;
+ }
+
+ @Operation(summary = "閿�鍞姪鎵嬪璇�")
+ @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
+ public Flux<String> chat(@RequestBody ChatForm chatForm) {
+ if (!StringUtils.hasText(chatForm.getMemoryId())) {
+ return Flux.just("memoryId涓嶈兘涓虹┖");
+ }
+ if (!StringUtils.hasText(chatForm.getMessage())) {
+ return Flux.just("message涓嶈兘涓虹┖");
+ }
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ String memoryId = chatForm.getMemoryId();
+ String userMessage = chatForm.getMessage();
+
+ aiSessionUserContext.bind(memoryId, loginUser);
+ aiChatSessionService.touchSession(memoryId, loginUser, userMessage);
+
+ String directResponse = salesIntentExecutor.tryExecute(memoryId, userMessage);
+ if (StringUtils.isNotEmpty(directResponse)) {
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(directResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(directResponse);
+ }
+
+ if (isBusinessDataIntent(userMessage)) {
+ String noGuessResponse = "鏈瘑鍒埌鍙墽琛岀殑鏁版嵁鏌ヨ鏉′欢銆備负淇濊瘉缁撴灉鍑嗙‘锛屽綋鍓嶄笉浼氭帹娴嬫垨缂栭�犳暟鎹紝璇疯ˉ鍏呮槑纭椂闂磋寖鍥淬�佸鎴锋垨鍗曞彿鍚庡啀鏌ヨ銆�";
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(noGuessResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(noGuessResponse);
+ }
+
+ return salesAgent.chat(memoryId, userMessage, currentDateForPrompt())
+ .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser))
+ .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser));
+ }
+
+ @Operation(summary = "閿�鍞姪鎵嬩細璇濆垪琛�")
+ @GetMapping("/history/sessions")
+ public AjaxResult listSessions() {
+ return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser()));
+ }
+
+ @Operation(summary = "閿�鍞姪鎵嬩細璇濇秷鎭�")
+ @GetMapping("/history/messages/{memoryId}")
+ public AjaxResult listMessages(@PathVariable String memoryId) {
+ return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser()));
+ }
+
+ @Operation(summary = "鍒犻櫎閿�鍞姪鎵嬩細璇�")
+ @DeleteMapping("/history/{memoryId}")
+ public AjaxResult deleteSession(@PathVariable String memoryId) {
+ aiSessionUserContext.remove(memoryId);
+ return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()));
+ }
+
+ private boolean isBusinessDataIntent(String message) {
+ if (!StringUtils.hasText(message)) {
+ return false;
+ }
+ String text = message.trim();
+ return containsAny(text,
+ "鏌ヨ", "鏌ョ湅", "缁熻", "鍒嗘瀽", "寤鸿", "瀹㈡埛妗f", "绉佹捣", "鍏捣",
+ "閿�鍞姤浠�", "閿�鍞彴璐�", "閿�鍞��璐�", "瀹㈡埛寰�鏉�", "鍙戣揣鍙拌处", "鍥炴", "鎶ヤ环", "椋庨櫓");
+ }
+
+ private boolean containsAny(String text, String... keywords) {
+ for (String keyword : keywords) {
+ if (text.contains(keyword)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String currentDateForPrompt() {
+ return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT);
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java b/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java
index eac43b2..82d088c 100644
--- a/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java
+++ b/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java
@@ -29,6 +29,9 @@
import reactor.core.publisher.Flux;
import java.io.IOException;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.UUID;
@@ -39,6 +42,8 @@
public class XiaozhiController extends BaseController {
private static final String FILE_ANALYZE_MEMORY_PREFIX = "file-analyze::";
+ private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
private final ApproveTodoAgent approveTodoAgent;
private final ApproveTodoIntentExecutor approveTodoIntentExecutor;
@@ -90,7 +95,17 @@
return Flux.just(directResponse);
}
- return approveTodoAgent.chat(memoryId, userMessage)
+ if (isApproveTodoBusinessIntent(userMessage)) {
+ String noGuessResponse = "鏈瘑鍒埌鍙墽琛岀殑瀹℃壒寰呭姙鎿嶄綔鏉′欢銆備负淇濊瘉缁撴灉鍑嗙‘锛屽綋鍓嶄笉浼氭帹娴嬫垨缂栭�犲鎵规暟鎹紝璇疯ˉ鍏呮祦绋嬬紪鍙枫�佹椂闂磋寖鍥存垨鏄庣‘鎿嶄綔鎸囦护鍚庡啀璇曘��";
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(noGuessResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(noGuessResponse);
+ }
+
+ return approveTodoAgent.chat(memoryId, userMessage, currentDateForPrompt())
.doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser))
.doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser));
}
@@ -159,4 +174,29 @@
aiSessionUserContext.remove(memoryId);
return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()));
}
+
+ private boolean isApproveTodoBusinessIntent(String message) {
+ if (!StringUtils.hasText(message)) {
+ return false;
+ }
+ String text = message.trim();
+ boolean hasDomainWord = containsAny(text,
+ "瀹℃壒", "寰呭姙", "娴佺▼缂栧彿", "娴佺▼鍙�", "瀹℃壒娴佽浆", "瀹℃壒鑺傜偣", "褰撳墠瀹℃壒浜�", "椹冲洖", "閫氳繃", "鎾ら攢", "鍒犻櫎");
+ boolean hasIntentWord = containsAny(text,
+ "鏌ヨ", "鏌ョ湅", "鍒楀嚭", "缁熻", "鍒嗘瀽", "鍒嗗竷", "閫氳繃", "椹冲洖", "鎾ら攢", "鍒犻櫎", "淇敼", "鏈夊摢浜�", "鍗″湪");
+ return hasDomainWord && hasIntentWord;
+ }
+
+ private boolean containsAny(String text, String... keywords) {
+ for (String keyword : keywords) {
+ if (text.contains(keyword)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String currentDateForPrompt() {
+ return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT);
+ }
}
diff --git a/src/main/java/com/ruoyi/ai/dto/AiChatMessageDto.java b/src/main/java/com/ruoyi/ai/dto/AiChatMessageDto.java
index 9242b3e..081bf12 100644
--- a/src/main/java/com/ruoyi/ai/dto/AiChatMessageDto.java
+++ b/src/main/java/com/ruoyi/ai/dto/AiChatMessageDto.java
@@ -1,15 +1,28 @@
package com.ruoyi.ai.dto;
-import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
+import java.util.List;
+
@Data
@NoArgsConstructor
-@AllArgsConstructor
public class AiChatMessageDto {
private String role;
private String content;
+
+ private List<String> filePaths;
+
+ public AiChatMessageDto(String role, String content) {
+ this.role = role;
+ this.content = content;
+ }
+
+ public AiChatMessageDto(String role, String content, List<String> filePaths) {
+ this.role = role;
+ this.content = content;
+ this.filePaths = filePaths;
+ }
}
diff --git a/src/main/java/com/ruoyi/ai/dto/KnowledgeChatRequest.java b/src/main/java/com/ruoyi/ai/dto/KnowledgeChatRequest.java
new file mode 100644
index 0000000..134c2c8
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/dto/KnowledgeChatRequest.java
@@ -0,0 +1,21 @@
+package com.ruoyi.ai.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 鐭ヨ瘑搴撻棶绛旇姹�
+ */
+@Data
+@Schema(description = "鐭ヨ瘑搴撻棶绛旇姹�")
+public class KnowledgeChatRequest {
+
+ @Schema(description = "鐭ヨ瘑搴揑D", required = true)
+ private Long knowledgeBaseId;
+
+ @Schema(description = "浼氳瘽ID锛岀敤浜庝繚鎸佷笂涓嬫枃", required = true)
+ private String memoryId;
+
+ @Schema(description = "鐢ㄦ埛鎻愰棶鍐呭", required = true)
+ private String question;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/ai/mongodbBean/ChatMessages.java b/src/main/java/com/ruoyi/ai/mongodbBean/ChatMessages.java
index 0a239d8..e2944cb 100644
--- a/src/main/java/com/ruoyi/ai/mongodbBean/ChatMessages.java
+++ b/src/main/java/com/ruoyi/ai/mongodbBean/ChatMessages.java
@@ -9,6 +9,7 @@
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
+import java.util.List;
@Data
@AllArgsConstructor
@@ -24,6 +25,21 @@
private String content;
+ /**
+ * 澶氭枃浠跺垎鏋愮敤鎴锋彁闂俊鎭紙涓庢枃浠惰矾寰勫垎寮�瀛樺偍锛�
+ */
+ private List<String> analyzeUserQuestions;
+
+ /**
+ * 澶氭枃浠跺垎鏋愪笂浼犳枃浠惰矾寰勶紙鍥剧墖鍜� pdf 浣跨敤棰勮鍦板潃锛屽叾浠栦娇鐢ㄤ笅杞藉湴鍧�锛�
+ */
+ private List<String> analyzeFilePaths;
+
+ /**
+ * 澶氭枃浠跺垎鏋愭瘡娆℃彁闂搴旂殑鏂囦欢璺緞鍒嗙粍
+ */
+ private List<List<String>> analyzeFilePathGroups;
+
private Date createTime;
private Date updateTime;
diff --git a/src/main/java/com/ruoyi/ai/schedule/AiSessionCleanupTask.java b/src/main/java/com/ruoyi/ai/schedule/AiSessionCleanupTask.java
new file mode 100644
index 0000000..cecdba8
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/schedule/AiSessionCleanupTask.java
@@ -0,0 +1,24 @@
+package com.ruoyi.ai.schedule;
+
+import com.ruoyi.ai.context.AiSessionUserContext;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AiSessionCleanupTask {
+
+ private final AiSessionUserContext aiSessionUserContext;
+
+ public AiSessionCleanupTask(AiSessionUserContext aiSessionUserContext) {
+ this.aiSessionUserContext = aiSessionUserContext;
+ }
+
+ @Scheduled(cron = "0 0 2 * * ?")
+ public void cleanupExpiredSessions() {
+ try {
+ aiSessionUserContext.cleanExpiredSessions();
+ } catch (Exception e) {
+ System.err.println("娓呯悊杩囨湡AI浼氳瘽澶辫触: " + e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/service/KnowledgeRagService.java b/src/main/java/com/ruoyi/ai/service/KnowledgeRagService.java
new file mode 100644
index 0000000..44d5f87
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/service/KnowledgeRagService.java
@@ -0,0 +1,34 @@
+package com.ruoyi.ai.service;
+
+import java.util.List;
+
+/**
+ * 鐭ヨ瘑搴揜AG鏈嶅姟
+ * 璐熻矗鏂囦欢鍚戦噺鍖栧鐞嗗拰妫�绱�
+ */
+public interface KnowledgeRagService {
+
+ /**
+ * 寮傛澶勭悊鍚戦噺鍖�
+ */
+ void processVectorAsync(Long vectorId);
+
+ /**
+ * 鍚屾澶勭悊鍚戦噺鍖�
+ */
+ void processVector(Long vectorId);
+
+ /**
+ * 妫�绱㈢浉鍏冲唴瀹�
+ * @param namespace 鍛藉悕绌洪棿
+ * @param query 鏌ヨ鏂囨湰
+ * @param maxResults 鏈�澶х粨鏋滄暟
+ * @return 鐩稿叧鍐呭鍒楄〃
+ */
+ List<String> searchRelevantContent(String namespace, String query, int maxResults);
+
+ /**
+ * 鍒犻櫎鎸囧畾鏂囦欢鐨勫悜閲忔暟鎹�
+ */
+ void deleteEmbeddings(String namespace, Long storageBlobId);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/ai/service/PurchaseAiService.java b/src/main/java/com/ruoyi/ai/service/PurchaseAiService.java
new file mode 100644
index 0000000..cbc936c
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/service/PurchaseAiService.java
@@ -0,0 +1,1069 @@
+package com.ruoyi.ai.service;
+
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.ruoyi.ai.assistant.PurchaseAgent;
+import com.ruoyi.ai.assistant.PurchaseIntentExecutor;
+import com.ruoyi.ai.bean.ChatForm;
+import com.ruoyi.ai.bean.PurchaseAiConfirmRequest;
+import com.ruoyi.ai.context.AiSessionUserContext;
+import com.ruoyi.ai.dto.AiChatMessageDto;
+import com.ruoyi.ai.dto.AiChatSessionDto;
+import com.ruoyi.ai.store.MongoChatMemoryStore;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.basic.mapper.SupplierManageMapper;
+import com.ruoyi.basic.pojo.SupplierManage;
+import com.ruoyi.basic.service.StorageBlobService;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.purchase.dto.PurchaseLedgerDto;
+import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
+import com.ruoyi.purchase.service.IPurchaseLedgerService;
+import com.ruoyi.purchase.service.PurchaseReturnOrdersService;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import dev.langchain4j.data.image.Image;
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.data.message.ChatMessage;
+import dev.langchain4j.data.message.Content;
+import dev.langchain4j.data.message.ImageContent;
+import dev.langchain4j.data.message.SystemMessage;
+import dev.langchain4j.data.message.TextContent;
+import dev.langchain4j.data.message.UserMessage;
+import dev.langchain4j.model.chat.StreamingChatLanguageModel;
+import dev.langchain4j.model.chat.response.ChatResponse;
+import dev.langchain4j.model.chat.response.StreamingChatResponseHandler;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import reactor.core.publisher.Flux;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Base64;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.UUID;
+import java.nio.file.Files;
+
+@Service
+public class PurchaseAiService {
+
+ private static final String PURCHASE_FILE_ANALYZE_MEMORY_PREFIX = "purchase-file-analyze::";
+ private static final int MAX_FILE_COUNT = 10;
+ private static final int MAX_SINGLE_FILE_TEXT_LENGTH = 8000;
+ private static final int MAX_TOTAL_FILE_TEXT_LENGTH = 30000;
+ private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
+
+ private final PurchaseAgent purchaseAgent;
+ private final PurchaseIntentExecutor purchaseIntentExecutor;
+ private final AiSessionUserContext aiSessionUserContext;
+ private final MongoChatMemoryStore mongoChatMemoryStore;
+ private final AiChatSessionService aiChatSessionService;
+ private final AiFileTextExtractor aiFileTextExtractor;
+ private final ObjectMapper objectMapper;
+ private final IPurchaseLedgerService purchaseLedgerService;
+ private final PurchaseReturnOrdersService purchaseReturnOrdersService;
+ private final StorageBlobService storageBlobService;
+ private final SupplierManageMapper supplierManageMapper;
+ private final StreamingChatLanguageModel purchaseVisionStreamingChatModel;
+
+ public PurchaseAiService(PurchaseAgent purchaseAgent,
+ PurchaseIntentExecutor purchaseIntentExecutor,
+ AiSessionUserContext aiSessionUserContext,
+ MongoChatMemoryStore mongoChatMemoryStore,
+ AiChatSessionService aiChatSessionService,
+ AiFileTextExtractor aiFileTextExtractor,
+ ObjectMapper objectMapper,
+ IPurchaseLedgerService purchaseLedgerService,
+ PurchaseReturnOrdersService purchaseReturnOrdersService,
+ StorageBlobService storageBlobService,
+ SupplierManageMapper supplierManageMapper,
+ @Qualifier("purchaseVisionStreamingChatModel") StreamingChatLanguageModel purchaseVisionStreamingChatModel) {
+ this.purchaseAgent = purchaseAgent;
+ this.purchaseIntentExecutor = purchaseIntentExecutor;
+ this.aiSessionUserContext = aiSessionUserContext;
+ this.mongoChatMemoryStore = mongoChatMemoryStore;
+ this.aiChatSessionService = aiChatSessionService;
+ this.aiFileTextExtractor = aiFileTextExtractor;
+ this.objectMapper = objectMapper;
+ this.purchaseLedgerService = purchaseLedgerService;
+ this.purchaseReturnOrdersService = purchaseReturnOrdersService;
+ this.storageBlobService = storageBlobService;
+ this.supplierManageMapper = supplierManageMapper;
+ this.purchaseVisionStreamingChatModel = purchaseVisionStreamingChatModel;
+ }
+
+ public Flux<String> chat(ChatForm chatForm, LoginUser loginUser) {
+ if (!StringUtils.hasText(chatForm.getMemoryId())) {
+ return Flux.just("memoryId涓嶈兘涓虹┖");
+ }
+ if (!StringUtils.hasText(chatForm.getMessage())) {
+ return Flux.just("message涓嶈兘涓虹┖");
+ }
+
+ String memoryId = chatForm.getMemoryId();
+ String userMessage = chatForm.getMessage();
+
+ aiSessionUserContext.bind(memoryId, loginUser);
+ aiChatSessionService.touchSession(memoryId, loginUser, userMessage);
+
+ String directResponse = purchaseIntentExecutor.tryExecute(memoryId, userMessage);
+ if (StringUtils.isNotEmpty(directResponse)) {
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(directResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(directResponse);
+ }
+
+ if (isPurchaseBusinessIntent(userMessage)) {
+ String noGuessResponse = buildNoGuessResponse();
+ mongoChatMemoryStore.appendMessages(
+ memoryId,
+ List.of(UserMessage.from(userMessage), AiMessage.from(noGuessResponse))
+ );
+ aiChatSessionService.refreshSessionStats(memoryId, loginUser);
+ return Flux.just(noGuessResponse);
+ }
+
+ return purchaseAgent.chat(memoryId, userMessage, currentDateForPrompt())
+ .doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser))
+ .doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser));
+ }
+
+ public Flux<String> analyzeFiles(MultipartFile[] files,
+ String message,
+ String memoryId,
+ LoginUser loginUser) {
+ if (files == null || files.length == 0) {
+ return Flux.just("files涓嶈兘涓虹┖");
+ }
+ if (files.length > MAX_FILE_COUNT) {
+ return Flux.just("涓�娆℃渶澶氬垎鏋�" + MAX_FILE_COUNT + "涓枃浠�");
+ }
+
+ String rawMemoryId = StringUtils.hasText(memoryId) ? memoryId : UUID.randomUUID().toString();
+ String finalMemoryId = rawMemoryId.startsWith(PURCHASE_FILE_ANALYZE_MEMORY_PREFIX)
+ ? rawMemoryId
+ : PURCHASE_FILE_ANALYZE_MEMORY_PREFIX + rawMemoryId;
+
+ aiSessionUserContext.bind(finalMemoryId, loginUser);
+
+ String finalMessage = StringUtils.hasText(message)
+ ? message
+ : "璇峰垎鏋愯繖浜涢噰璐枃浠讹紝鎻愬彇鍙敤浜庝笟鍔″鐞嗙殑鏁版嵁锛屽苟鏁寸悊鎴愬緟瀹㈡埛纭鐨勬牸寮�";
+
+ List<String> filePaths;
+ try {
+ List<StorageBlobVO> uploadedFiles = storageBlobService.upload(copyFilesForUpload(files), true);
+ filePaths = resolveFileAccessPaths(uploadedFiles);
+ } catch (Exception ex) {
+ return Flux.just("鏂囦欢涓婁紶澶辫触");
+ }
+ try {
+ mongoChatMemoryStore.appendAnalyzeFileContext(finalMemoryId, finalMessage, filePaths);
+ } catch (Exception ex) {
+ return Flux.just("浼氳瘽鏂囦欢淇℃伅淇濆瓨澶辫触");
+ }
+
+ String fileContent;
+ try {
+ fileContent = buildMultiFileContent(files);
+ } catch (IllegalArgumentException ex) {
+ return Flux.just(ex.getMessage());
+ } catch (IOException ex) {
+ return Flux.just("鏂囦欢璇诲彇澶辫触");
+ }
+
+ if (!StringUtils.hasText(fileContent)) {
+ return Flux.just("鏈彁鍙栧埌鏈夋晥鏂囦欢鍐呭");
+ }
+
+ String userPrompt = buildPurchaseFileAnalyzePrompt(finalMessage, fileContent);
+ aiChatSessionService.touchSession(finalMemoryId, loginUser, "閲囪喘澶氭枃浠跺垎鏋�: " + finalMessage);
+
+ if (containsImageFile(files)) {
+ return chatWithPurchaseVisionModel(finalMemoryId, finalMessage, userPrompt, files)
+ .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser))
+ .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser));
+ }
+
+ return Flux.defer(() -> purchaseAgent.chat(finalMemoryId, userPrompt, currentDateForPrompt()))
+ .onErrorResume(NoSuchElementException.class, ex -> {
+ mongoChatMemoryStore.deleteMessages(finalMemoryId);
+ return purchaseAgent.chat(finalMemoryId, userPrompt, currentDateForPrompt());
+ })
+ .doOnComplete(() -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser))
+ .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser));
+ }
+
+ public AjaxResult confirmAnalyzeResult(PurchaseAiConfirmRequest request) {
+ if (request == null || !StringUtils.hasText(request.getBusinessType())) {
+ return AjaxResult.error("businessType涓嶈兘涓虹┖");
+ }
+ if (request.getPayload() == null || request.getPayload().isEmpty()) {
+ return AjaxResult.error("payload涓嶈兘涓虹┖");
+ }
+
+ try {
+ String businessType = request.getBusinessType().trim();
+ return switch (businessType) {
+ case "purchase_ledger" -> processPurchaseLedger(request.getPayload());
+ case "purchase_return_order" -> processPurchaseReturnOrder(request.getPayload());
+ default -> AjaxResult.error("鏆備笉鏀寔璇ヤ笟鍔$被鍨�: " + businessType);
+ };
+ } catch (Exception ex) {
+ return AjaxResult.error(toCustomerMessage(ex));
+ }
+ }
+
+ public List<AiChatSessionDto> listSessions(LoginUser loginUser) {
+ return aiChatSessionService.listCurrentUserSessions(loginUser);
+ }
+
+ public List<AiChatMessageDto> listMessages(String memoryId, LoginUser loginUser) {
+ return aiChatSessionService.listCurrentUserMessages(memoryId, loginUser);
+ }
+
+ public boolean deleteSession(String memoryId, LoginUser loginUser) {
+ aiSessionUserContext.remove(memoryId);
+ return aiChatSessionService.deleteCurrentUserSession(memoryId, loginUser);
+ }
+
+ private String buildMultiFileContent(MultipartFile[] files) throws IOException {
+ StringBuilder builder = new StringBuilder();
+ int totalLength = 0;
+ for (MultipartFile file : files) {
+ String text = aiFileTextExtractor.extractText(file);
+ if (!StringUtils.hasText(text)) {
+ continue;
+ }
+ String limitedText = text.length() > MAX_SINGLE_FILE_TEXT_LENGTH
+ ? text.substring(0, MAX_SINGLE_FILE_TEXT_LENGTH)
+ : text;
+ if (totalLength + limitedText.length() > MAX_TOTAL_FILE_TEXT_LENGTH) {
+ int remain = MAX_TOTAL_FILE_TEXT_LENGTH - totalLength;
+ if (remain <= 0) {
+ break;
+ }
+ limitedText = limitedText.substring(0, remain);
+ }
+ builder.append("\n--- 鏂囦欢: ")
+ .append(file.getOriginalFilename())
+ .append(" ---\n")
+ .append(limitedText)
+ .append('\n');
+ totalLength += limitedText.length();
+ }
+ return builder.toString();
+ }
+
+ private boolean containsImageFile(MultipartFile[] files) {
+ for (MultipartFile file : files) {
+ if (aiFileTextExtractor.isImageFile(file)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private List<String> resolveFileAccessPaths(List<StorageBlobVO> uploadedFiles) {
+ if (StringUtils.isEmpty(uploadedFiles)) {
+ return Collections.emptyList();
+ }
+ List<String> filePaths = new ArrayList<>();
+ for (StorageBlobVO uploadedFile : uploadedFiles) {
+ if (uploadedFile == null) {
+ continue;
+ }
+ String selectedPath;
+ if (shouldUsePreviewPath(uploadedFile)) {
+ selectedPath = StringUtils.hasText(uploadedFile.getPreviewURL())
+ ? uploadedFile.getPreviewURL()
+ : uploadedFile.getDownloadURL();
+ } else {
+ selectedPath = StringUtils.hasText(uploadedFile.getDownloadURL())
+ ? uploadedFile.getDownloadURL()
+ : uploadedFile.getPreviewURL();
+ }
+ if (StringUtils.hasText(selectedPath)) {
+ filePaths.add(selectedPath);
+ }
+ }
+ return filePaths;
+ }
+
+ private boolean shouldUsePreviewPath(StorageBlobVO uploadedFile) {
+ String contentType = uploadedFile.getContentType();
+ if (StringUtils.hasText(contentType)) {
+ String normalized = contentType.toLowerCase(Locale.ROOT);
+ if (normalized.startsWith("image/") || "application/pdf".equals(normalized)) {
+ return true;
+ }
+ }
+ String filename = uploadedFile.getOriginalFilename();
+ if (!StringUtils.hasText(filename) || !filename.contains(".")) {
+ return false;
+ }
+ String ext = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase(Locale.ROOT);
+ return StringUtils.inStringIgnoreCase(ext, "png", "jpg", "jpeg", "webp", "bmp", "pdf");
+ }
+
+ private List<MultipartFile> copyFilesForUpload(MultipartFile[] files) throws IOException {
+ List<MultipartFile> copies = new ArrayList<>();
+ for (MultipartFile file : files) {
+ copies.add(new InMemoryMultipartFile(
+ file.getName(),
+ file.getOriginalFilename(),
+ file.getContentType(),
+ file.getBytes()
+ ));
+ }
+ return copies;
+ }
+
+ private static final class InMemoryMultipartFile implements MultipartFile {
+ private final String name;
+ private final String originalFilename;
+ private final String contentType;
+ private final byte[] bytes;
+
+ private InMemoryMultipartFile(String name, String originalFilename, String contentType, byte[] bytes) {
+ this.name = name;
+ this.originalFilename = originalFilename;
+ this.contentType = contentType;
+ this.bytes = bytes == null ? new byte[0] : bytes;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getOriginalFilename() {
+ return originalFilename;
+ }
+
+ @Override
+ public String getContentType() {
+ return contentType;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return bytes.length == 0;
+ }
+
+ @Override
+ public long getSize() {
+ return bytes.length;
+ }
+
+ @Override
+ public byte[] getBytes() {
+ return bytes.clone();
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ return new ByteArrayInputStream(bytes);
+ }
+
+ @Override
+ public void transferTo(File dest) throws IOException, IllegalStateException {
+ Files.write(dest.toPath(), bytes);
+ }
+ }
+
+ private Flux<String> chatWithPurchaseVisionModel(String memoryId,
+ String userMessage,
+ String userPrompt,
+ MultipartFile[] files) {
+ return Flux.create(sink -> {
+ StringBuilder assistantReply = new StringBuilder();
+ try {
+ List<Content> contents = new ArrayList<>();
+ contents.add(TextContent.from(userPrompt));
+ for (MultipartFile file : files) {
+ if (!aiFileTextExtractor.isImageFile(file)) {
+ continue;
+ }
+ contents.add(TextContent.from("涓嬮潰杩欏紶鍥剧墖鏂囦欢鍚嶏細" + file.getOriginalFilename()));
+ contents.add(ImageContent.from(Image.builder()
+ .base64Data(Base64.getEncoder().encodeToString(file.getBytes()))
+ .mimeType(resolveImageMimeType(file))
+ .build()));
+ }
+
+ List<ChatMessage> messages = List.of(
+ SystemMessage.from("浣犳槸閲囪喘涓氬姟鏂囦欢鍒嗘瀽鍔╂墜銆傝浠庢枃鏈拰鍥剧墖涓瘑鍒噰璐彴璐︺�侀噰璐骇鍝佹槑缁嗐�佷粯娆炬垨閫�璐т俊鎭紝鍙緭鍑哄悎娉� JSON銆�"),
+ UserMessage.from(contents)
+ );
+ safeAppendMessages(memoryId, List.of(UserMessage.from("閲囪喘澶氭枃浠跺垎鏋�: " + userMessage)));
+ purchaseVisionStreamingChatModel.chat(messages, new StreamingChatResponseHandler() {
+ @Override
+ public void onPartialResponse(String partialResponse) {
+ if (partialResponse != null) {
+ assistantReply.append(partialResponse);
+ sink.next(partialResponse);
+ }
+ }
+
+ @Override
+ public void onCompleteResponse(ChatResponse completeResponse) {
+ if (StringUtils.hasText(assistantReply.toString())) {
+ safeAppendMessages(memoryId, List.of(AiMessage.from(assistantReply.toString())));
+ }
+ sink.complete();
+ }
+
+ @Override
+ public void onError(Throwable error) {
+ sink.error(error);
+ }
+ });
+ } catch (Exception ex) {
+ sink.next("鍥剧墖鏂囦欢璇诲彇澶辫触锛岃纭鍥剧墖鏍煎紡涓� png銆乯pg銆乯peg銆亀ebp 鎴� bmp锛屼笖澶у皬涓嶈秴杩�10MB");
+ sink.complete();
+ }
+ });
+ }
+
+ private void safeAppendMessages(String memoryId, List<ChatMessage> messages) {
+ if (!StringUtils.hasText(memoryId) || StringUtils.isEmpty(messages)) {
+ return;
+ }
+ try {
+ mongoChatMemoryStore.appendMessages(memoryId, messages);
+ } catch (Exception ignored) {
+ }
+ }
+
+ private String resolveImageMimeType(MultipartFile file) {
+ String contentType = file.getContentType();
+ if (StringUtils.hasText(contentType) && contentType.startsWith("image/")) {
+ return contentType;
+ }
+ String filename = file.getOriginalFilename();
+ String ext = "";
+ if (StringUtils.hasText(filename) && filename.contains(".")) {
+ ext = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase();
+ }
+ return switch (ext) {
+ case "jpg", "jpeg" -> "image/jpeg";
+ case "webp" -> "image/webp";
+ case "bmp" -> "image/bmp";
+ default -> "image/png";
+ };
+ }
+
+ private String currentDateForPrompt() {
+ return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT);
+ }
+
+ private boolean isPurchaseBusinessIntent(String message) {
+ if (!StringUtils.hasText(message)) {
+ return false;
+ }
+ String text = message.trim();
+ boolean hasDomainWord = containsAny(text,
+ "閲囪喘", "閲囪喘鍙拌处", "閲囪喘鍗�", "閲囪喘璁㈠崟", "渚涘簲鍟�", "鐗╂枡", "鍏ュ簱", "鍒拌揣", "寰呬粯娆�",
+ "浠樻", "閫�璐�", "閫�鏂�", "鍙戠エ", "鍚堝悓");
+ boolean hasIntentWord = containsAny(text,
+ "鏌ヨ", "鏌ョ湅", "缁熻", "鍒嗘瀽", "鎺掕", "鎺掑悕", "鍒楀嚭", "鏈夊摢浜�", "鎯呭喌", "鏄庣粏", "璇︽儏", "鎶ヨ〃");
+ return hasDomainWord && hasIntentWord;
+ }
+
+ private boolean containsAny(String text, String... keywords) {
+ for (String keyword : keywords) {
+ if (text.contains(keyword)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String buildNoGuessResponse() {
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("success", false);
+ result.put("type", "purchase_intent_not_recognized");
+ result.put("description", "鏈瘑鍒埌鍙墽琛岀殑閲囪喘鏌ヨ鏉′欢銆備负淇濊瘉缁撴灉鍑嗙‘锛屽綋鍓嶄笉浼氭帹娴嬫垨缂栭�犳暟鎹紝璇疯ˉ鍏呮槑纭椂闂磋寖鍥淬�佷緵搴斿晢銆侀噰璐悎鍚屽彿鎴栫墿鏂欏悗鍐嶆煡璇€��");
+ result.put("summary", Map.of());
+ result.put("data", Map.of(
+ "quickPrompts", List.of(
+ "鏈湀閲囪喘閲戦鎺掑悕鍓嶅崄鐨勭墿鏂欐湁鍝簺锛�",
+ "鍝簺閲囪喘璁㈠崟杩樻湭鍏ュ簱锛�",
+ "鏈�杩�7澶╀緵搴斿晢鍒拌揣寮傚父鏈夊摢浜涳紵",
+ "甯垜缁熻寰呬粯娆鹃噰璐崟锛�",
+ "鍒楀嚭鏈湀閲囪喘閫�璐ф儏鍐�"
+ )
+ ));
+ result.put("charts", Map.of());
+ return JSON.toJSONString(result);
+ }
+
+ private String buildPurchaseFileAnalyzePrompt(String message, String fileContent) {
+ return """
+ 浣犳槸閲囪喘涓氬姟鏂囦欢鍒嗘瀽鍔╂墜銆傝涓ユ牸鏍规嵁鐢ㄦ埛涓婁紶鐨勫涓枃浠跺拰鐢ㄦ埛瑕佹眰鎻愬彇閲囪喘涓氬姟鏁版嵁銆�
+
+ 鐢ㄦ埛瑕佹眰:
+ %s
+
+ 杈撳嚭瑕佹眰:
+ 1. 鍙緭鍑哄悎娉� JSON锛屼笉瑕� Markdown锛屼笉瑕侀澶栬В閲娿��
+ 2. JSON 椤跺眰瀛楁鍥哄畾涓�:
+ - success: boolean
+ - businessType: purchase_ledger | purchase_return_order | unknown
+ - action: confirm_required
+ - description: 涓枃璇存槑
+ - confidence: 0鍒�1鐨勫皬鏁�
+ - missingFields: 缂哄け瀛楁涓枃鍚嶇О鏁扮粍锛岄潰鍚戝鎴峰睍绀猴紝涓嶈杈撳嚭鑻辨枃瀛楁鍚�
+ - warnings: 椋庨櫓鎻愮ず鏁扮粍
+ - payload: 寰呭鎴风‘璁ょ殑鏁版嵁锛屽瓧娈靛悕蹇呴』浣跨敤鍚庣 DTO 瀛楁鍚�
+ - preview: 缁欏鎴风‘璁ょ敤鐨勪腑鏂囨憳瑕佹暟缁�
+ 3. 濡傛灉鍙垽鏂负閲囪喘鍙拌处锛宐usinessType 浣跨敤 purchase_ledger锛宲ayload.purchaseLedgers 涓洪噰璐鍗�/閲囪喘鍙拌处鏁扮粍:
+ - purchaseLedgers: 閲囪喘璁㈠崟/閲囪喘鍙拌处鏁扮粍锛屾瘡鏉¤褰曞瓧娈靛悕蹇呴』涓� PurchaseLedgerDto 淇濇寔涓�鑷�
+ - 浜у搧鏄庣粏蹇呴』鏀惧湪姣忔潯閲囪喘鍙拌处璁板綍鐨� productData 瀛楁涓紝productData 绫诲瀷涓� List<SalesLedgerProduct>
+ - 涓嶈浼樺厛浣跨敤 payload 椤跺眰 productData锛涢《灞� productData 浠呬綔涓烘棫鏍煎紡鍏煎
+ - 鏂囦欢閲岀殑鈥滈噰璐崟鍙封�濆氨鏄�滈噰璐悎鍚屽彿鈥濓紝缁熶竴鏄犲皠涓� purchaseContractNumber
+ - 鏂囦欢閲岀殑鈥滈攢鍞崟鍙封�濆氨鏄�滈攢鍞悎鍚屽彿鈥濓紝缁熶竴鏄犲皠涓� salesContractNo
+ - 鎵�鏈夋棩鏈熷瓧娈靛繀椤讳娇鐢� yyyy-MM-dd锛屼緥濡� 2026-04-30锛涗笉瑕佽緭鍑� 4/30/26銆�2026/4/30銆�2026骞�4鏈�30鏃� 鎴栧甫鏃跺垎绉掔殑鏍煎紡
+ - 閲囪喘鍙拌处涓嶉渶瑕佸湪 payload 涓紶瀹℃壒浜猴紝涓嶈杈撳嚭 approveUserIds銆乤pproverId
+ - missingFields 鍙~鍐欎笟鍔″繀濉絾鏃犳硶璇嗗埆鐨勫瓧娈碉紝涓嶈鎶� PurchaseLedgerDto 鐨勬墍鏈夌┖瀛楁閮藉垪涓虹己澶憋紱缂哄け椤瑰繀椤诲啓涓枃锛屼緥濡傗�滀緵搴斿晢鍚嶇О鈥濃�滃惈绋庡崟浠封�濓紝涓嶈鍐� supplierId銆乼axInclusiveUnitPrice
+ - 閲囪喘鍙拌处涓昏〃蹇呭~瀛楁浠呮寜杩欎簺鍒ゆ柇: purchaseContractNumber銆乻upplierName 鎴� supplierId
+ - productData 姣忔潯浜у搧蹇呭~瀛楁: productCategory銆乻pecificationModel銆乽nit銆乹uantity銆乼axInclusiveUnitPrice 鎴� taxInclusiveTotalPrice锛涘鏋滃彧鏈夊惈绋庢�讳环鍜屾暟閲忥紝蹇呴』璁$畻 taxInclusiveUnitPrice锛涘鏋滃彧鏈夊惈绋庡崟浠峰拰鏁伴噺锛屽繀椤昏绠� taxInclusiveTotalPrice
+ - 浜у搧瀛楁鎸夐噰璐鍏ユ帴鍙� PurchaseLedgerProductImportDto 瀵归綈: 閲囪喘鍗曞彿銆佷骇鍝佸ぇ绫汇�佽鏍煎瀷鍙枫�佸崟浣嶃�佹暟閲忋�佺◣鐜囥�佸惈绋庡崟浠枫�佸惈绋庢�讳环銆佸彂绁ㄧ被鍨嬨�佹槸鍚﹁川妫�
+ - 閲囪喘浜у搧 type 鍥哄畾涓� 2
+ - purchaseLedgers 姣忔潯璁板綍鍙娇鐢ㄨ繖浜� PurchaseLedgerDto 瀛楁鍚�:
+ entryDateStart, entryDateEnd, id, purchaseContractNumber, supplierId, supplierName, isWhite, recorderId, recorderName, salesContractNo, salesContractNoId, projectName, entryDate, executionDate, remarks, attachmentMaterials, createdAt, updatedAt, salesLedgerId, hasChildren, Type, productData, tempFileIds, SalesLedgerFiles, phoneNumber, businessPersonId, productId, productModelId, invoiceNumber, invoiceAmount, ticketRegistrationId, contractAmount, receiptPaymentAmount, unReceiptPaymentAmount, type, paymentMethod, approvalStatus, templateName
+ - productData 姣忔潯浜у搧鍙娇鐢ㄨ繖浜� SalesLedgerProduct 瀛楁鍚�:
+ productCategory, specificationModel, unit, quantity, taxRate, taxInclusiveUnitPrice, taxInclusiveTotalPrice, taxExclusiveTotalPrice, invoiceType, productId, productModelId, isChecked, type
+ 4. 濡傛灉鍙垽鏂负浠樻鐧昏锛宐usinessType 浣跨敤 payload.records 涓轰粯娆剧櫥璁版暟缁勶紝瀛楁灏介噺鍖呭惈 purchaseLedgerId銆乻alesLedgerProductId銆乧urrentPaymentAmount銆乸aymentMethod銆乸aymentDate銆�
+ 5. 濡傛灉鍙垽鏂负閲囪喘閫�璐э紝businessType 浣跨敤 purchase_return_order锛宲ayload 鎸� PurchaseReturnOrderDto 缁勭粐锛屾槑缁嗘斁 purchaseReturnOrderProductsDtos銆�
+ 6. 缂哄皯涓氬姟澶勭悊蹇呴』瀛楁鏃讹紝涓嶈缂栭�� ID锛屾妸瀛楁鏀惧叆 missingFields锛屽苟浠嶈繑鍥炲彲纭鐨勮崏绋挎暟鎹��
+ 7. 鎵�鏈変腑鏂囧唴瀹圭洿鎺ヤ繚鐣欙紝涓嶈杞箟鎴� Unicode銆�
+
+ 鏂囦欢鍐呭:
+ %s
+ """.formatted(message, fileContent);
+ }
+
+ private AjaxResult processPurchaseLedger(Map<String, Object> payload) throws Exception {
+ if (payload.containsKey("purchaseLedgers")) {
+ return processPurchaseLedgerBatch(payload);
+ }
+
+ Map<String, Object> normalizedPayload = normalizePurchaseLedgerMap(payload);
+ PurchaseLedgerDto dto = objectMapper.convertValue(normalizedPayload, PurchaseLedgerDto.class);
+ AjaxResult ledgerResult = validatePurchaseLedger(dto, 0);
+ if (ledgerResult != null) {
+ return ledgerResult;
+ }
+ AjaxResult supplierResult = fillSupplierIdByName(dto);
+ if (supplierResult != null) {
+ return supplierResult;
+ }
+ AjaxResult productResult = validatePurchaseProducts(dto.getProductData(), 0);
+ if (productResult != null) {
+ return productResult;
+ }
+ int result = purchaseLedgerService.addOrEditPurchase(dto);
+ return AjaxResult.success("閲囪喘鍙拌处宸插鐞�", result);
+ }
+
+ private AjaxResult processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception {
+ List<Map<String, Object>> purchaseLedgers = toMapList(payload.get("purchaseLedgers"));
+ if (purchaseLedgers.isEmpty()) {
+ return AjaxResult.error("purchaseLedgers涓嶈兘涓虹┖");
+ }
+
+ List<Map<String, Object>> topLevelProductData = toMapList(payload.get("productData"));
+ List<Map<String, Object>> results = new ArrayList<>();
+ for (int i = 0; i < purchaseLedgers.size(); i++) {
+ Map<String, Object> ledgerMap = normalizePurchaseLedgerMap(purchaseLedgers.get(i));
+ PurchaseLedgerDto dto = objectMapper.convertValue(ledgerMap, PurchaseLedgerDto.class);
+ AjaxResult ledgerResult = validatePurchaseLedger(dto, i);
+ if (ledgerResult != null) {
+ return ledgerResult;
+ }
+ AjaxResult supplierResult = fillSupplierIdByName(dto);
+ if (supplierResult != null) {
+ return supplierResult;
+ }
+
+ List<SalesLedgerProduct> products = dto.getProductData();
+ if (products == null || products.isEmpty()) {
+ products = matchProductsForLedger(ledgerMap, dto, topLevelProductData, purchaseLedgers.size() == 1);
+ dto.setProductData(products);
+ }
+ AjaxResult productResult = validatePurchaseProducts(products, i);
+ if (productResult != null) {
+ return productResult;
+ }
+ int result = purchaseLedgerService.addOrEditPurchase(dto);
+
+ Map<String, Object> item = new LinkedHashMap<>();
+ item.put("index", i);
+ item.put("purchaseContractNumber", dto.getPurchaseContractNumber());
+ item.put("supplierId", dto.getSupplierId());
+ item.put("supplierName", dto.getSupplierName());
+ item.put("productCount", products.size());
+ item.put("result", result);
+ results.add(item);
+ }
+ return AjaxResult.success("閲囪喘鍙拌处宸叉壒閲忓鐞�", results);
+ }
+
+ private List<SalesLedgerProduct> matchProductsForLedger(Map<String, Object> ledgerMap,
+ PurchaseLedgerDto dto,
+ List<Map<String, Object>> productData,
+ boolean onlyOneLedger) {
+ List<SalesLedgerProduct> products = new ArrayList<>();
+ for (Map<String, Object> productMap : productData) {
+ if (onlyOneLedger || productBelongsToLedger(productMap, ledgerMap, dto)) {
+ products.add(objectMapper.convertValue(normalizeSalesLedgerProductMap(productMap), SalesLedgerProduct.class));
+ }
+ }
+ return products;
+ }
+
+ private boolean productBelongsToLedger(Map<String, Object> productMap, Map<String, Object> ledgerMap, PurchaseLedgerDto dto) {
+ Long productPurchaseLedgerId = longValue(productMap, "purchaseLedgerId", "purchaseId", "閲囪喘璁㈠崟id", "閲囪喘鍙拌处id");
+ if (productPurchaseLedgerId != null && dto.getId() != null && productPurchaseLedgerId.equals(dto.getId())) {
+ return true;
+ }
+
+ Long productSalesLedgerId = longValue(productMap, "salesLedgerId");
+ if (productSalesLedgerId != null && dto.getId() != null && productSalesLedgerId.equals(dto.getId())) {
+ return true;
+ }
+
+ String productContractNo = stringValue(productMap, "purchaseContractNumber", "purchaseContractNo", "閲囪喘鍚堝悓鍙�", "閲囪喘鍗曞彿", "閲囪喘璁㈠崟鍙�");
+ if (StringUtils.hasText(productContractNo)
+ && StringUtils.hasText(dto.getPurchaseContractNumber())
+ && productContractNo.trim().equals(dto.getPurchaseContractNumber().trim())) {
+ return true;
+ }
+
+ String ledgerContractNo = stringValue(ledgerMap, "purchaseContractNumber", "purchaseContractNo", "閲囪喘鍚堝悓鍙�", "閲囪喘鍗曞彿", "閲囪喘璁㈠崟鍙�");
+ if (StringUtils.hasText(productContractNo)
+ && StringUtils.hasText(ledgerContractNo)
+ && productContractNo.trim().equals(ledgerContractNo.trim())) {
+ return true;
+ }
+
+ String productSalesContractNo = stringValue(productMap, "salesContractNo", "salesContractNumber", "閿�鍞悎鍚屽彿", "閿�鍞崟鍙�", "閿�鍞鍗曞彿");
+ if (StringUtils.hasText(productSalesContractNo)
+ && StringUtils.hasText(dto.getSalesContractNo())
+ && productSalesContractNo.trim().equals(dto.getSalesContractNo().trim())) {
+ return true;
+ }
+
+ String ledgerSalesContractNo = stringValue(ledgerMap, "salesContractNo", "salesContractNumber", "閿�鍞悎鍚屽彿", "閿�鍞崟鍙�", "閿�鍞鍗曞彿");
+ if (StringUtils.hasText(productSalesContractNo)
+ && StringUtils.hasText(ledgerSalesContractNo)
+ && productSalesContractNo.trim().equals(ledgerSalesContractNo.trim())) {
+ return true;
+ }
+
+ String productSupplierName = stringValue(productMap, "supplierName", "渚涘簲鍟嗗悕绉�");
+ return StringUtils.hasText(productSupplierName)
+ && StringUtils.hasText(dto.getSupplierName())
+ && productSupplierName.trim().equals(dto.getSupplierName().trim());
+ }
+
+ private Map<String, Object> normalizePurchaseLedgerMap(Map<String, Object> source) {
+ Map<String, Object> target = new LinkedHashMap<>();
+ copyPurchaseLedgerDtoFields(source, target);
+ putDtoFieldIfPresent(source, target, "entryDateStart", "褰曞叆寮�濮嬫棩鏈�", "褰曞叆鏃ユ湡寮�濮�");
+ putDtoFieldIfPresent(source, target, "entryDateEnd", "褰曞叆缁撴潫鏃ユ湡", "褰曞叆鏃ユ湡缁撴潫");
+ putDtoFieldIfPresent(source, target, "id", "閲囪喘鍙拌处id", "閲囪喘璁㈠崟id", "涓婚敭");
+ putDtoFieldIfPresent(source, target, "purchaseContractNumber", "purchaseContractNo", "閲囪喘鍚堝悓鍙�", "閲囪喘鍗曞彿", "閲囪喘璁㈠崟鍙�");
+ putDtoFieldIfPresent(source, target, "supplierId", "渚涘簲鍟唅d", "渚涘簲鍟咺D", "渚涘簲鍟嗗悕绉癷d", "渚涘簲鍟嗗悕绉癐D");
+ putDtoFieldIfPresent(source, target, "supplierName", "渚涘簲鍟�", "渚涘簲鍟嗗悕绉�");
+ putDtoFieldIfPresent(source, target, "isWhite", "鏄惁鐧藉悕鍗�");
+ putDtoFieldIfPresent(source, target, "recorderId", "褰曞叆浜篿d", "褰曞叆浜篒D", "褰曞叆浜哄鍚峣d", "褰曞叆浜哄鍚岻D");
+ putDtoFieldIfPresent(source, target, "recorderName", "褰曞叆浜�", "褰曞叆浜哄鍚�");
+ putDtoFieldIfPresent(source, target, "salesContractNo", "salesContractNumber", "閿�鍞悎鍚屽彿", "閿�鍞崟鍙�", "閿�鍞鍗曞彿");
+ putDtoFieldIfPresent(source, target, "salesContractNoId", "閿�鍞悎鍚屽彿id", "閿�鍞悎鍚屽彿ID", "閿�鍞崟鍙穒d", "閿�鍞崟鍙稩D");
+ putDtoFieldIfPresent(source, target, "projectName", "椤圭洰", "椤圭洰鍚嶇О");
+ putDtoFieldIfPresent(source, target, "entryDate", "褰曞叆鏃ユ湡");
+ putDtoFieldIfPresent(source, target, "executionDate", "绛捐鏃ユ湡", "鍚堝悓绛捐鏃ユ湡");
+ putDtoFieldIfPresent(source, target, "remarks", "澶囨敞", "璇存槑");
+ putDtoFieldIfPresent(source, target, "attachmentMaterials", "闄勪欢鏉愭枡", "闄勪欢鏉愭枡璺緞鎴栧悕绉�");
+ putDtoFieldIfPresent(source, target, "createdAt", "鍒涘缓鏃堕棿", "璁板綍鍒涘缓鏃堕棿");
+ putDtoFieldIfPresent(source, target, "updatedAt", "鏇存柊鏃堕棿", "璁板綍鏈�鍚庢洿鏂版椂闂�");
+ putDtoFieldIfPresent(source, target, "salesLedgerId", "閿�鍞彴璐d", "閿�鍞彴璐D", "鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�");
+ putDtoFieldIfPresent(source, target, "hasChildren", "鏄惁鏈夊瓙绾�", "鏄惁鏈夋槑缁�");
+ putDtoFieldIfPresent(source, target, "Type", "鍙拌处绫诲瀷", "涓氬姟绫诲瀷");
+ putDtoFieldIfPresent(source, target, "productData", "products", "浜у搧鏄庣粏", "閲囪喘浜у搧鏄庣粏");
+ putDtoFieldIfPresent(source, target, "tempFileIds", "涓存椂鏂囦欢id", "涓存椂鏂囦欢ID", "涓存椂鏂囦欢ids");
+ putDtoFieldIfPresent(source, target, "SalesLedgerFiles", "闄勪欢鍒楄〃", "閿�鍞彴璐﹂檮浠�");
+ putDtoFieldIfPresent(source, target, "phoneNumber", "涓氬姟鍛樻墜鏈哄彿", "鎵嬫満鍙�");
+ putDtoFieldIfPresent(source, target, "businessPersonId", "涓氬姟鍛榠d", "涓氬姟鍛業D");
+ putDtoFieldIfPresent(source, target, "productId", "浜у搧id", "浜у搧ID");
+ putDtoFieldIfPresent(source, target, "productModelId", "浜у搧瑙勬牸id", "浜у搧瑙勬牸ID");
+ putDtoFieldIfPresent(source, target, "invoiceNumber", "鍙戠エ鍙�", "鍙戠エ鍙风爜");
+ putDtoFieldIfPresent(source, target, "invoiceAmount", "鍙戠エ閲戦", "鍙戠エ閲戦锛堝厓锛�");
+ putDtoFieldIfPresent(source, target, "ticketRegistrationId", "鏉ョエ鐧昏id", "鏉ョエ鐧昏ID");
+ putDtoFieldIfPresent(source, target, "contractAmount", "鍚堝悓閲戦", "鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�");
+ putDtoFieldIfPresent(source, target, "receiptPaymentAmount", "鏉ョエ閲戦", "宸叉潵绁ㄩ噾棰�", "宸叉潵绁ㄩ噾棰�(鍏�)");
+ putDtoFieldIfPresent(source, target, "unReceiptPaymentAmount", "鏈潵绁ㄩ噾棰�", "鏈潵绁ㄩ噾棰�(鍏�)");
+ putDtoFieldIfPresent(source, target, "type", "鏂囦欢绫诲瀷");
+ putDtoFieldIfPresent(source, target, "paymentMethod", "浠樻鏂瑰紡");
+ putDtoFieldIfPresent(source, target, "approvalStatus", "瀹℃壒鐘舵��");
+ putDtoFieldIfPresent(source, target, "templateName", "妯℃澘鍚嶇О");
+ target.remove("approveUserIds");
+ target.remove("approverId");
+ normalizeNestedProductData(target);
+ attachImportStyleProductData(source, target);
+ if (target.get("type") == null) {
+ target.put("type", 2);
+ }
+ target.putIfAbsent("entryDate", LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE));
+ normalizePurchaseLedgerDateFields(target);
+ return target;
+ }
+
+ private void attachImportStyleProductData(Map<String, Object> source, Map<String, Object> target) {
+ if (target.get("productData") != null) {
+ return;
+ }
+ Map<String, Object> productMap = normalizeSalesLedgerProductMap(source);
+ if (hasImportStyleProductData(productMap)) {
+ target.put("productData", List.of(productMap));
+ }
+ }
+
+ private boolean hasImportStyleProductData(Map<String, Object> productMap) {
+ return hasMapText(productMap, "productCategory")
+ || hasMapText(productMap, "specificationModel")
+ || productMap.get("quantity") != null
+ || productMap.get("taxInclusiveUnitPrice") != null
+ || productMap.get("taxInclusiveTotalPrice") != null;
+ }
+
+ private boolean hasMapText(Map<String, Object> map, String key) {
+ Object value = map.get(key);
+ return value != null && StringUtils.hasText(String.valueOf(value));
+ }
+
+ private void normalizeNestedProductData(Map<String, Object> target) {
+ Object productDataValue = target.get("productData");
+ if (productDataValue == null) {
+ return;
+ }
+ List<Map<String, Object>> productMaps = toMapList(productDataValue);
+ List<Map<String, Object>> normalizedProducts = new ArrayList<>();
+ for (Map<String, Object> productMap : productMaps) {
+ normalizedProducts.add(normalizeSalesLedgerProductMap(productMap));
+ }
+ target.put("productData", normalizedProducts);
+ }
+
+ private Map<String, Object> normalizeSalesLedgerProductMap(Map<String, Object> source) {
+ Map<String, Object> target = new LinkedHashMap<>();
+ copySalesLedgerProductFields(source, target);
+ putDtoFieldIfPresent(source, target, "productCategory", "浜у搧澶х被", "浜у搧鍚嶇О", "浜у搧", "鍝佸悕", "鐗╂枡鍚嶇О");
+ putDtoFieldIfPresent(source, target, "specificationModel", "瑙勬牸鍨嬪彿", "鍨嬪彿", "瑙勬牸", "浜у搧瑙勬牸");
+ putDtoFieldIfPresent(source, target, "unit", "鍗曚綅");
+ putDtoFieldIfPresent(source, target, "quantity", "鏁伴噺", "閲囪喘鏁伴噺");
+ putDtoFieldIfPresent(source, target, "taxRate", "绋庣巼");
+ putDtoFieldIfPresent(source, target, "taxInclusiveUnitPrice", "鍚◣鍗曚环", "鍗曚环", "閲囪喘鍗曚环", "鍚◣浠锋牸");
+ putDtoFieldIfPresent(source, target, "taxInclusiveTotalPrice", "鍚◣鎬讳环", "鎬讳环", "閲囪喘閲戦", "閲戦", "鍚堝悓閲戦");
+ putDtoFieldIfPresent(source, target, "taxExclusiveTotalPrice", "涓嶅惈绋庢�讳环");
+ putDtoFieldIfPresent(source, target, "invoiceType", "鍙戠エ绫诲瀷", "鍙戠エ绫诲埆");
+ putDtoFieldIfPresent(source, target, "productId", "浜у搧id", "浜у搧ID");
+ putDtoFieldIfPresent(source, target, "productModelId", "浜у搧瑙勬牸id", "浜у搧瑙勬牸ID", "鍨嬪彿id", "鍨嬪彿ID");
+ putDtoFieldIfPresent(source, target, "isChecked", "鏄惁璐ㄦ", "鏄惁璐ㄦ楠�", "璐ㄦ");
+ putDtoFieldIfPresent(source, target, "type", "鍙拌处绫诲瀷");
+ normalizeProductAmounts(target);
+ target.putIfAbsent("type", 2);
+ return target;
+ }
+
+ private void copySalesLedgerProductFields(Map<String, Object> source, Map<String, Object> target) {
+ String[] productFields = {
+ "id", "salesLedgerId", "warnNum", "productCategory", "specificationModel", "unit",
+ "speculativeTradingName", "quantity", "minStock", "taxRate", "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice", "taxExclusiveTotalPrice", "invoiceType", "type", "ticketsNum",
+ "ticketsAmount", "futureTickets", "futureTicketsAmount", "invoiceNum", "noInvoiceNum",
+ "invoiceAmount", "noInvoiceAmount", "productId", "productModelId", "register", "registerDate",
+ "approveStatus", "pendingInvoiceTotal", "invoiceTotal", "pendingTicketsTotal", "ticketsTotal",
+ "isChecked", "isProduction"
+ };
+ for (String field : productFields) {
+ if (source.containsKey(field)) {
+ target.put(field, source.get(field));
+ }
+ }
+ }
+
+ private void normalizeProductAmounts(Map<String, Object> target) {
+ BigDecimal quantity = decimalValue(target.get("quantity"));
+ BigDecimal unitPrice = decimalValue(target.get("taxInclusiveUnitPrice"));
+ BigDecimal totalPrice = decimalValue(target.get("taxInclusiveTotalPrice"));
+ if (unitPrice == null && totalPrice != null && quantity != null && quantity.compareTo(BigDecimal.ZERO) != 0) {
+ target.put("taxInclusiveUnitPrice", totalPrice.divide(quantity, 6, RoundingMode.HALF_UP));
+ }
+ if (totalPrice == null && unitPrice != null && quantity != null) {
+ target.put("taxInclusiveTotalPrice", unitPrice.multiply(quantity));
+ }
+ BigDecimal taxRate = decimalValue(target.get("taxRate"));
+ totalPrice = decimalValue(target.get("taxInclusiveTotalPrice"));
+ if (target.get("taxExclusiveTotalPrice") == null && totalPrice != null && taxRate != null) {
+ BigDecimal divisor = BigDecimal.ONE.add(taxRate.divide(new BigDecimal("100"), 6, RoundingMode.HALF_UP));
+ target.put("taxExclusiveTotalPrice", totalPrice.divide(divisor, 2, RoundingMode.HALF_UP));
+ }
+ }
+
+ private AjaxResult validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) {
+ if (products == null || products.isEmpty()) {
+ return null;
+ }
+ for (int i = 0; i < products.size(); i++) {
+ SalesLedgerProduct product = products.get(i);
+ String prefix = "绗�" + (ledgerIndex + 1) + "涓噰璐彴璐︾殑绗�" + (i + 1) + "鏉′骇鍝�";
+ if (!StringUtils.hasText(product.getProductCategory())) {
+ return AjaxResult.error(prefix + "缂哄皯浜у搧鍚嶇О锛岃琛ュ厖鍚庡啀纭");
+ }
+ if (!StringUtils.hasText(product.getSpecificationModel())) {
+ return AjaxResult.error(prefix + "缂哄皯瑙勬牸鍨嬪彿锛岃琛ュ厖鍚庡啀纭");
+ }
+ if (!StringUtils.hasText(product.getUnit())) {
+ return AjaxResult.error(prefix + "缂哄皯鍗曚綅锛岃琛ュ厖鍚庡啀纭");
+ }
+ if (product.getQuantity() == null) {
+ return AjaxResult.error(prefix + "缂哄皯鏁伴噺");
+ }
+ if (product.getTaxInclusiveUnitPrice() == null) {
+ return AjaxResult.error(prefix + "缂哄皯鍚◣鍗曚环锛岃琛ュ厖鍚庡啀纭");
+ }
+ if (product.getTaxInclusiveTotalPrice() == null) {
+ return AjaxResult.error(prefix + "缂哄皯鍚◣鎬讳环锛岃琛ュ厖鍚庡啀纭");
+ }
+ }
+ return null;
+ }
+
+ private AjaxResult validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) {
+ String prefix = "绗�" + (ledgerIndex + 1) + "涓噰璐彴璐�";
+ if (!StringUtils.hasText(dto.getPurchaseContractNumber())) {
+ return AjaxResult.error(prefix + "缂哄皯閲囪喘鍚堝悓鍙凤紝璇疯ˉ鍏呭悗鍐嶇‘璁�");
+ }
+ if (dto.getSupplierId() == null && !StringUtils.hasText(dto.getSupplierName())) {
+ return AjaxResult.error(prefix + "缂哄皯渚涘簲鍟嗗悕绉帮紝璇疯ˉ鍏呭悗鍐嶇‘璁�");
+ }
+ return null;
+ }
+
+ private void normalizePurchaseLedgerDateFields(Map<String, Object> target) {
+ normalizeDateField(target, "entryDate");
+ normalizeDateField(target, "executionDate");
+ normalizeDateField(target, "createdAt");
+ normalizeDateField(target, "updatedAt");
+ }
+
+ private void normalizeDateField(Map<String, Object> target, String fieldName) {
+ Object value = target.get(fieldName);
+ if (value == null) {
+ return;
+ }
+ String normalizedDate = normalizeDateValue(value);
+ if (StringUtils.hasText(normalizedDate)) {
+ target.put(fieldName, normalizedDate);
+ }
+ }
+
+ private String normalizeDateValue(Object value) {
+ if (value instanceof Date date) {
+ return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().format(DateTimeFormatter.ISO_LOCAL_DATE);
+ }
+ if (value instanceof Number number) {
+ return LocalDate.of(1899, 12, 30)
+ .plusDays(number.longValue())
+ .format(DateTimeFormatter.ISO_LOCAL_DATE);
+ }
+
+ String text = String.valueOf(value).trim();
+ if (!StringUtils.hasText(text)) {
+ return null;
+ }
+ if (text.length() >= 10 && text.charAt(4) == '-' && text.charAt(7) == '-') {
+ return text.substring(0, 10);
+ }
+
+ String normalizedText = text.replace("骞�", "-")
+ .replace("鏈�", "-")
+ .replace("鏃�", "")
+ .replace(".", "-")
+ .replace("/", "-")
+ .trim();
+ DateTimeFormatter[] formatters = {
+ DateTimeFormatter.ofPattern("yyyy-M-d"),
+ DateTimeFormatter.ofPattern("M-d-yyyy"),
+ DateTimeFormatter.ofPattern("M-d-yy")
+ };
+ for (DateTimeFormatter formatter : formatters) {
+ try {
+ return LocalDate.parse(normalizedText, formatter).format(DateTimeFormatter.ISO_LOCAL_DATE);
+ } catch (DateTimeParseException ignored) {
+ // Try the next supported input pattern.
+ }
+ }
+ return text;
+ }
+
+ private void copyPurchaseLedgerDtoFields(Map<String, Object> source, Map<String, Object> target) {
+ String[] dtoFields = {
+ "entryDateStart", "entryDateEnd", "id", "purchaseContractNumber",
+ "supplierId", "supplierName", "isWhite", "recorderId", "recorderName", "salesContractNo",
+ "salesContractNoId", "projectName", "entryDate", "executionDate", "remarks", "attachmentMaterials",
+ "createdAt", "updatedAt", "salesLedgerId", "hasChildren", "Type", "productData", "tempFileIds",
+ "SalesLedgerFiles", "phoneNumber", "businessPersonId", "productId", "productModelId", "invoiceNumber",
+ "invoiceAmount", "ticketRegistrationId", "contractAmount", "receiptPaymentAmount",
+ "unReceiptPaymentAmount", "type", "paymentMethod", "approvalStatus", "templateName"
+ };
+ for (String field : dtoFields) {
+ if (source.containsKey(field)) {
+ target.put(field, source.get(field));
+ }
+ }
+ }
+
+ private void putDtoFieldIfPresent(Map<String, Object> source, Map<String, Object> target, String dtoField, String... aliases) {
+ if (target.containsKey(dtoField) && target.get(dtoField) != null) {
+ return;
+ }
+ for (String alias : aliases) {
+ Object value = source.get(alias);
+ if (value != null && StringUtils.hasText(String.valueOf(value))) {
+ target.put(dtoField, value);
+ return;
+ }
+ }
+ }
+
+ private List<Map<String, Object>> toMapList(Object value) {
+ if (value == null) {
+ return List.of();
+ }
+ return objectMapper.convertValue(value, new TypeReference<List<Map<String, Object>>>() {
+ });
+ }
+
+ private String stringValue(Map<String, Object> map, String... keys) {
+ for (String key : keys) {
+ Object value = map.get(key);
+ if (value != null && StringUtils.hasText(String.valueOf(value))) {
+ return String.valueOf(value);
+ }
+ }
+ return null;
+ }
+
+ private Long longValue(Map<String, Object> map, String... keys) {
+ String value = stringValue(map, keys);
+ if (!StringUtils.hasText(value)) {
+ return null;
+ }
+ try {
+ return Long.parseLong(value.trim());
+ } catch (NumberFormatException ignored) {
+ return null;
+ }
+ }
+
+ private BigDecimal decimalValue(Object value) {
+ if (value == null) {
+ return null;
+ }
+ if (value instanceof BigDecimal decimal) {
+ return decimal;
+ }
+ if (value instanceof Number number) {
+ return new BigDecimal(String.valueOf(number));
+ }
+ String text = String.valueOf(value)
+ .replace(",", "")
+ .replace("锛�", "")
+ .replace("鍏�", "")
+ .replace("锟�", "")
+ .trim();
+ if (!StringUtils.hasText(text)) {
+ return null;
+ }
+ try {
+ return new BigDecimal(text);
+ } catch (NumberFormatException ignored) {
+ return null;
+ }
+ }
+
+ private String toCustomerMessage(Exception ex) {
+ String message = ex.getMessage();
+ if (!StringUtils.hasText(message)) {
+ return "澶勭悊澶辫触锛岃妫�鏌ョ‘璁ゆ暟鎹悗閲嶈瘯";
+ }
+ if (message.contains("tax_inclusive_unit_price")) {
+ return "澶勭悊澶辫触锛氫骇鍝佹槑缁嗙己灏戝惈绋庡崟浠凤紝璇疯ˉ鍏呭悗鍐嶇‘璁�";
+ }
+ if (message.contains("tax_inclusive_total_price")) {
+ return "澶勭悊澶辫触锛氫骇鍝佹槑缁嗙己灏戝惈绋庢�讳环锛岃琛ュ厖鍚庡啀纭";
+ }
+ if (message.contains("entryDate")) {
+ return "澶勭悊澶辫触锛氬綍鍏ユ棩鏈熸牸寮忎笉姝g‘锛岃浣跨敤 yyyy-MM-dd锛屼緥濡� 2026-04-30";
+ }
+ if (message.contains("supplier")) {
+ return "澶勭悊澶辫触锛氫緵搴斿晢淇℃伅涓嶅畬鏁达紝璇风‘璁や緵搴斿晢鍚嶇О鎴栦緵搴斿晢ID";
+ }
+ if (message.contains("SQL") || message.contains("java.") || message.contains("Exception")) {
+ return "澶勭悊澶辫触锛氱‘璁ゆ暟鎹笉瀹屾暣鎴栨牸寮忎笉姝g‘锛岃妫�鏌ュ繀濉瓧娈靛悗閲嶈瘯";
+ }
+ return "澶勭悊澶辫触锛�" + message;
+ }
+
+ private AjaxResult fillSupplierIdByName(PurchaseLedgerDto dto) {
+ if (dto.getSupplierId() != null) {
+ return null;
+ }
+ if (!StringUtils.hasText(dto.getSupplierName())) {
+ return AjaxResult.error("渚涘簲鍟咺D涓嶈兘涓虹┖锛涙湭璇嗗埆鍒颁緵搴斿晢鍚嶇О锛屾棤娉曡嚜鍔ㄥ尮閰嶄緵搴斿晢ID");
+ }
+
+ SupplierManage supplier = supplierManageMapper.selectOne(new LambdaQueryWrapper<SupplierManage>()
+ .eq(SupplierManage::getSupplierName, dto.getSupplierName().trim())
+ .last("limit 1"));
+ if (supplier == null) {
+ return AjaxResult.error("鏈壘鍒颁緵搴斿晢锛�" + dto.getSupplierName() + "锛岃鍏堢淮鎶や緵搴斿晢鎴栨墜鍔ㄩ�夋嫨渚涘簲鍟咺D");
+ }
+ dto.setSupplierId(supplier.getId());
+ return null;
+ }
+
+ private AjaxResult processPurchaseReturnOrder(Map<String, Object> payload) {
+ PurchaseReturnOrderDto dto = objectMapper.convertValue(payload, PurchaseReturnOrderDto.class);
+ Boolean result = purchaseReturnOrdersService.add(dto);
+ return AjaxResult.success("閲囪喘閫�璐у崟宸插鐞�", result);
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/service/impl/AiChatSessionServiceImpl.java b/src/main/java/com/ruoyi/ai/service/impl/AiChatSessionServiceImpl.java
index 6d8c945..0ea436d 100644
--- a/src/main/java/com/ruoyi/ai/service/impl/AiChatSessionServiceImpl.java
+++ b/src/main/java/com/ruoyi/ai/service/impl/AiChatSessionServiceImpl.java
@@ -114,7 +114,10 @@
return new LinkedList<>();
}
List<ChatMessage> messages = mongoChatMemoryStore.getMessages(memoryId);
- return messages.stream().map(this::convertMessage).collect(Collectors.toList());
+ List<AiChatMessageDto> messageDtos = messages.stream().map(this::convertMessage).collect(Collectors.toList());
+ List<List<String>> analyzeFilePathGroups = mongoChatMemoryStore.getAnalyzeFilePathGroups(memoryId);
+ attachAnalyzeFilePaths(messageDtos, analyzeFilePathGroups);
+ return messageDtos;
}
@Override
@@ -188,4 +191,22 @@
}
return new AiChatMessageDto("unknown", String.valueOf(message));
}
+
+ private void attachAnalyzeFilePaths(List<AiChatMessageDto> messages,
+ List<List<String>> analyzeFilePathGroups) {
+ if (StringUtils.isEmpty(messages) || StringUtils.isEmpty(analyzeFilePathGroups)) {
+ return;
+ }
+ int analyzeIndex = 0;
+ for (AiChatMessageDto message : messages) {
+ if (!"user".equals(message.getRole()) || analyzeIndex >= analyzeFilePathGroups.size()) {
+ continue;
+ }
+ List<String> filePaths = analyzeFilePathGroups.get(analyzeIndex);
+ if (!StringUtils.isEmpty(filePaths)) {
+ message.setFilePaths(filePaths);
+ }
+ analyzeIndex++;
+ }
+ }
}
diff --git a/src/main/java/com/ruoyi/ai/service/impl/KnowledgeRagServiceImpl.java b/src/main/java/com/ruoyi/ai/service/impl/KnowledgeRagServiceImpl.java
new file mode 100644
index 0000000..db8f308
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/service/impl/KnowledgeRagServiceImpl.java
@@ -0,0 +1,342 @@
+package com.ruoyi.ai.service.impl;
+
+import com.ruoyi.ai.service.KnowledgeRagService;
+import com.ruoyi.approve.pojo.KnowledgeBaseVector;
+import com.ruoyi.approve.service.KnowledgeBaseVectorService;
+import com.ruoyi.basic.pojo.StorageBlob;
+import com.ruoyi.basic.service.StorageBlobService;
+import com.ruoyi.common.config.FileProperties;
+import com.google.protobuf.Struct;
+import com.google.protobuf.Value;
+import dev.langchain4j.data.embedding.Embedding;
+import dev.langchain4j.data.segment.TextSegment;
+import dev.langchain4j.model.embedding.EmbeddingModel;
+import dev.langchain4j.store.embedding.EmbeddingSearchRequest;
+import dev.langchain4j.store.embedding.EmbeddingSearchResult;
+import dev.langchain4j.store.embedding.EmbeddingStore;
+import io.pinecone.clients.Index;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 鐭ヨ瘑搴揜AG鏈嶅姟瀹炵幇
+ */
+@Slf4j
+@Service
+public class KnowledgeRagServiceImpl implements KnowledgeRagService {
+
+ private final KnowledgeBaseVectorService knowledgeBaseVectorService;
+ private final StorageBlobService storageBlobService;
+ private final EmbeddingModel embeddingModel;
+ private final EmbeddingStore<TextSegment> embeddingStore;
+ private final FileProperties fileProperties;
+ private final Index pineconeIndex;
+
+ @org.springframework.beans.factory.annotation.Value("${pinecone.namespace:knowledge-base}")
+ private String namespace;
+
+ public KnowledgeRagServiceImpl(
+ KnowledgeBaseVectorService knowledgeBaseVectorService,
+ StorageBlobService storageBlobService,
+ EmbeddingModel embeddingModel,
+ EmbeddingStore<TextSegment> embeddingStore,
+ FileProperties fileProperties,
+ Index pineconeIndex) {
+ this.knowledgeBaseVectorService = knowledgeBaseVectorService;
+ this.storageBlobService = storageBlobService;
+ this.embeddingModel = embeddingModel;
+ this.embeddingStore = embeddingStore;
+ this.fileProperties = fileProperties;
+ this.pineconeIndex = pineconeIndex;
+ }
+
+ private static final int CHUNK_SIZE = 500;
+ private static final int CHUNK_OVERLAP = 100;
+ private static final long CHUNK_THRESHOLD_BYTES = 80L * 1024 * 1024;
+ private static final int EMBEDDING_MAX_LENGTH = 8000;
+
+ @Override
+ @Async("threadPoolTaskExecutor")
+ public void processVectorAsync(Long vectorId) {
+ log.info("寮�濮嬪紓姝ュ悜閲忓寲澶勭悊: vectorId={}, thread={}", vectorId, Thread.currentThread().getName());
+ processVector(vectorId);
+ }
+
+ @Override
+ public void processVector(Long vectorId) {
+ log.info("寮�濮嬪鐞嗗悜閲忓寲: vectorId={}", vectorId);
+ KnowledgeBaseVector vector = knowledgeBaseVectorService.getById(vectorId);
+ if (vector == null) {
+ log.error("鍚戦噺璁板綍涓嶅瓨鍦�: {}", vectorId);
+ return;
+ }
+
+ try {
+ knowledgeBaseVectorService.updateVectorStatus(vectorId,
+ KnowledgeBaseVector.STATUS_PROCESSING, null, null);
+
+ StorageBlob blob = storageBlobService.getById(vector.getStorageBlobId());
+ if (blob == null) {
+ throw new RuntimeException("鏂囦欢涓嶅瓨鍦�: " + vector.getStorageBlobId());
+ }
+
+ File file = getFile(blob);
+ log.info("鏂囦欢璺緞: {}, 鏄惁瀛樺湪: {}", file.getAbsolutePath(), file.exists());
+ long fileSize = file.length();
+
+ String content = extractFileContent(file, vector.getFileName());
+ log.info("鏂囦欢鍐呭闀垮害: {}", content != null ? content.length() : 0);
+
+ if (content == null || content.trim().isEmpty()) {
+ throw new RuntimeException("鏂囦欢鍐呭涓虹┖");
+ }
+
+ List<TextSegment> chunks;
+ boolean needChunk = fileSize > CHUNK_THRESHOLD_BYTES || content.length() > EMBEDDING_MAX_LENGTH;
+ if (needChunk) {
+ log.info("寮�濮嬪垏鐗�: fileSize={}, contentLength={}", fileSize, content.length());
+ chunks = splitText(content, vector);
+ log.info("鍒囩墖瀹屾垚锛屽叡 {} 涓潡", chunks.size());
+ } else {
+ log.info("鏂囦欢杈冨皬锛屼笉杩涜鍒囩墖");
+ Map<String, Object> metadata = buildMetadata(vector);
+ chunks = List.of(TextSegment.from(content, new dev.langchain4j.data.document.Metadata(metadata)));
+ }
+
+ int chunkCount = 0;
+ for (TextSegment chunk : chunks) {
+ Embedding embedding = embeddingModel.embed(chunk).content();
+ embeddingStore.add(embedding, chunk);
+ chunkCount++;
+ }
+
+ knowledgeBaseVectorService.updateVectorStatus(vectorId,
+ KnowledgeBaseVector.STATUS_COMPLETED, chunkCount, null);
+
+ log.info("鍚戦噺鍖栧鐞嗗畬鎴�: vectorId={}, chunkCount={}", vectorId, chunkCount);
+
+ } catch (Exception e) {
+ log.error("鍚戦噺鍖栧鐞嗗け璐�: vectorId={}", vectorId, e);
+ knowledgeBaseVectorService.updateVectorStatus(vectorId,
+ KnowledgeBaseVector.STATUS_FAILED, null, e.getMessage());
+ }
+ }
+
+ @Override
+ public List<String> searchRelevantContent(String namespace, String query, int maxResults) {
+ try {
+ Embedding queryEmbedding = embeddingModel.embed(query).content();
+
+ EmbeddingSearchRequest searchRequest = EmbeddingSearchRequest.builder()
+ .queryEmbedding(queryEmbedding)
+ .maxResults(maxResults)
+ .minScore(0.7)
+ .build();
+
+ EmbeddingSearchResult<TextSegment> searchResult = embeddingStore.search(searchRequest);
+
+ return searchResult.matches().stream()
+ .map(match -> match.embedded().text())
+ .collect(Collectors.toList());
+
+ } catch (Exception e) {
+ log.error("鍚戦噺妫�绱㈠け璐�: namespace={}", namespace, e);
+ return new ArrayList<>();
+ }
+ }
+
+ @Override
+ public void deleteEmbeddings(String namespace, Long storageBlobId) {
+ log.info("鍒犻櫎鍚戦噺鏁版嵁: namespace={}, storageBlobId={}", namespace, storageBlobId);
+ try {
+ Struct filter = Struct.newBuilder()
+ .putFields("storageBlobId", Value.newBuilder()
+ .setStructValue(Struct.newBuilder()
+ .putFields("$eq", Value.newBuilder()
+ .setNumberValue(storageBlobId.doubleValue())
+ .build()))
+ .build())
+ .build();
+
+ List<String> emptyIds = new ArrayList<>();
+ pineconeIndex.delete(emptyIds, false, this.namespace, filter);
+ log.info("鍚戦噺鍒犻櫎瀹屾垚: storageBlobId={}", storageBlobId);
+ } catch (Exception e) {
+ log.error("鍒犻櫎鍚戦噺鏁版嵁澶辫触: namespace={}, storageBlobId={}", namespace, storageBlobId, e);
+ }
+ }
+
+ private File getFile(StorageBlob blob) {
+ String path = blob.getPath();
+ if (path != null && !path.isEmpty()) {
+ return new File(new File(fileProperties.getPath(), path), blob.getUidFilename());
+ }
+ return new File(fileProperties.getPath(), blob.getUidFilename());
+ }
+
+ private String extractFileContent(File file, String fileName) throws Exception {
+ String ext = getFileExtension(fileName);
+
+ if (isPlainText(ext)) {
+ return readFileWithEncoding(file);
+ }
+
+ if ("docx".equals(ext)) {
+ return extractDocx(file);
+ }
+
+ if ("xlsx".equals(ext)) {
+ return extractXlsx(file);
+ }
+
+ if ("xls".equals(ext)) {
+ return extractXls(file);
+ }
+
+ return readFileWithEncoding(file);
+ }
+
+ private String readFileWithEncoding(File file) throws Exception {
+ byte[] bytes = Files.readAllBytes(file.toPath());
+
+ String utf8Content = new String(bytes, StandardCharsets.UTF_8);
+ if (isValidUtf8(utf8Content)) {
+ log.debug("鏂囦欢缂栫爜: UTF-8");
+ return utf8Content;
+ }
+
+ try {
+ Charset gbk = Charset.forName("GBK");
+ String gbkContent = new String(bytes, gbk);
+ log.debug("鏂囦欢缂栫爜: GBK");
+ return gbkContent;
+ } catch (Exception e) {
+ log.warn("缂栫爜妫�娴嬪け璐ワ紝浣跨敤 UTF-8");
+ return utf8Content;
+ }
+ }
+
+ private boolean isValidUtf8(String decoded) {
+ // 妫�鏌ユ浛鎹㈠瓧绗� U+FFFD (UTF-8 瑙g爜澶辫触鏃跺嚭鐜�)
+ if (decoded.contains("锟�")) {
+ return false;
+ }
+ int invalidCount = 0;
+ int checkLen = Math.min(decoded.length(), 1000);
+ for (int i = 0; i < checkLen; i++) {
+ char c = decoded.charAt(i);
+ // 妫�鏌ョ鏈変娇鐢ㄥ尯鍩� (U+E000-U+F8FF) 鎴栧紓甯告帶鍒跺瓧绗�
+ if ((c >= '顎�' && c <= '铮�') || (c < ' ' && c != '\n' && c != '\r' && c != '\t')) {
+ invalidCount++;
+ }
+ }
+ return invalidCount < checkLen * 0.05;
+ }
+
+ private String getFileExtension(String fileName) {
+ if (fileName == null || !fileName.contains(".")) {
+ return "";
+ }
+ return fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
+ }
+
+ private boolean isPlainText(String ext) {
+ return "txt".equals(ext) || "md".equals(ext) || "json".equals(ext)
+ || "csv".equals(ext) || "xml".equals(ext) || "yaml".equals(ext)
+ || "yml".equals(ext);
+ }
+
+ private String extractDocx(File file) throws Exception {
+ try (var doc = new org.apache.poi.xwpf.usermodel.XWPFDocument(new java.io.FileInputStream(file));
+ var extractor = new org.apache.poi.xwpf.extractor.XWPFWordExtractor(doc)) {
+ return extractor.getText();
+ }
+ }
+
+ private String extractXlsx(File file) throws Exception {
+ try (var workbook = new org.apache.poi.xssf.usermodel.XSSFWorkbook(file)) {
+ return extractWorkbook(workbook);
+ }
+ }
+
+ private String extractXls(File file) throws Exception {
+ try (var workbook = new org.apache.poi.hssf.usermodel.HSSFWorkbook(new java.io.FileInputStream(file))) {
+ return extractWorkbook(workbook);
+ }
+ }
+
+ private String extractWorkbook(org.apache.poi.ss.usermodel.Workbook workbook) {
+ StringBuilder text = new StringBuilder();
+ var formatter = new org.apache.poi.ss.usermodel.DataFormatter();
+ for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
+ var sheet = workbook.getSheetAt(i);
+ text.append("Sheet: ").append(sheet.getSheetName()).append("\n");
+ for (var row : sheet) {
+ for (var cell : row) {
+ text.append(formatter.formatCellValue(cell)).append("\t");
+ }
+ text.append("\n");
+ }
+ }
+ return text.toString();
+ }
+
+ private List<TextSegment> splitText(String content, KnowledgeBaseVector vector) {
+ List<TextSegment> chunks = new ArrayList<>();
+
+ if (content.length() <= CHUNK_SIZE) {
+ Map<String, Object> metadata = buildMetadata(vector);
+ chunks.add(TextSegment.from(content, new dev.langchain4j.data.document.Metadata(metadata)));
+ return chunks;
+ }
+
+ int start = 0;
+ int chunkIndex = 0;
+ while (start < content.length()) {
+ int end = Math.min(start + CHUNK_SIZE, content.length());
+
+ if (end < content.length()) {
+ int lastPeriod = content.lastIndexOf('銆�', end);
+ int lastNewline = content.lastIndexOf('\n', end);
+ int boundary = Math.max(lastPeriod, lastNewline);
+ if (boundary > start + CHUNK_SIZE / 2) {
+ end = boundary + 1;
+ }
+ }
+
+ String chunkText = content.substring(start, end).trim();
+ if (!chunkText.isEmpty()) {
+ Map<String, Object> metadata = buildMetadata(vector);
+ metadata.put("chunkIndex", chunkIndex);
+ chunks.add(TextSegment.from(chunkText, new dev.langchain4j.data.document.Metadata(metadata)));
+ chunkIndex++;
+ }
+
+ start = end - CHUNK_OVERLAP;
+ if (start < 0) start = 0;
+ if (start >= content.length() - CHUNK_OVERLAP) break;
+ }
+
+ return chunks;
+ }
+
+ private Map<String, Object> buildMetadata(KnowledgeBaseVector vector) {
+ Map<String, Object> metadata = new HashMap<>();
+ metadata.put("knowledgeBaseId", vector.getKnowledgeBaseId());
+ metadata.put("storageBlobId", vector.getStorageBlobId());
+ metadata.put("fileName", vector.getFileName());
+ metadata.put("namespace", vector.getNamespace());
+ return metadata;
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/store/MongoChatMemoryStore.java b/src/main/java/com/ruoyi/ai/store/MongoChatMemoryStore.java
index e88f0e9..e6bcadb 100644
--- a/src/main/java/com/ruoyi/ai/store/MongoChatMemoryStore.java
+++ b/src/main/java/com/ruoyi/ai/store/MongoChatMemoryStore.java
@@ -11,6 +11,8 @@
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.LinkedList;
@@ -24,8 +26,7 @@
@Override
public List<ChatMessage> getMessages(Object memoryId) {
- Query query = Query.query(Criteria.where("memoryId").is(memoryIdString(memoryId)));
- ChatMessages chatMessages = mongoTemplate.findOne(query, ChatMessages.class);
+ ChatMessages chatMessages = findChatMessages(memoryId);
if (chatMessages == null || chatMessages.getContent() == null) {
return new LinkedList<>();
}
@@ -56,7 +57,75 @@
updateMessages(memoryId, messages);
}
+ public void appendAnalyzeFileContext(Object memoryId, String userQuestion, List<String> filePaths) {
+ String memoryIdValue = memoryIdString(memoryId);
+ if (!StringUtils.hasText(memoryIdValue)) {
+ return;
+ }
+ List<String> validFilePaths = new LinkedList<>();
+ if (!CollectionUtils.isEmpty(filePaths)) {
+ for (String filePath : filePaths) {
+ if (StringUtils.hasText(filePath)) {
+ validFilePaths.add(filePath);
+ }
+ }
+ }
+ if (!StringUtils.hasText(userQuestion) && validFilePaths.isEmpty()) {
+ return;
+ }
+ Query query = Query.query(Criteria.where("memoryId").is(memoryIdValue));
+ Update update = new Update();
+ update.set("memoryId", memoryIdValue);
+ update.set("updateTime", new Date());
+ update.setOnInsert("createTime", new Date());
+ if (StringUtils.hasText(userQuestion)) {
+ update.push("analyzeUserQuestions", userQuestion);
+ }
+ if (!validFilePaths.isEmpty()) {
+ update.push("analyzeFilePaths").each(validFilePaths.toArray());
+ update.push("analyzeFilePathGroups", validFilePaths);
+ }
+ mongoTemplate.upsert(query, update, ChatMessages.class);
+ }
+
+ public List<String> getAnalyzeUserQuestions(Object memoryId) {
+ ChatMessages chatMessages = findChatMessages(memoryId);
+ if (chatMessages == null || CollectionUtils.isEmpty(chatMessages.getAnalyzeUserQuestions())) {
+ return new LinkedList<>();
+ }
+ return new LinkedList<>(chatMessages.getAnalyzeUserQuestions());
+ }
+
+ public List<List<String>> getAnalyzeFilePathGroups(Object memoryId) {
+ ChatMessages chatMessages = findChatMessages(memoryId);
+ if (chatMessages == null) {
+ return new LinkedList<>();
+ }
+ if (CollectionUtils.isEmpty(chatMessages.getAnalyzeFilePathGroups())) {
+ if (CollectionUtils.isEmpty(chatMessages.getAnalyzeFilePaths())) {
+ return new LinkedList<>();
+ }
+ List<List<String>> fallback = new LinkedList<>();
+ fallback.add(new LinkedList<>(chatMessages.getAnalyzeFilePaths()));
+ return fallback;
+ }
+ List<List<String>> groups = new LinkedList<>();
+ for (List<String> group : chatMessages.getAnalyzeFilePathGroups()) {
+ if (CollectionUtils.isEmpty(group)) {
+ groups.add(new LinkedList<>());
+ } else {
+ groups.add(new LinkedList<>(group));
+ }
+ }
+ return groups;
+ }
+
private String memoryIdString(Object memoryId) {
return memoryId == null ? "" : memoryId.toString();
}
+
+ private ChatMessages findChatMessages(Object memoryId) {
+ Query query = Query.query(Criteria.where("memoryId").is(memoryIdString(memoryId)));
+ return mongoTemplate.findOne(query, ChatMessages.class);
+ }
}
diff --git a/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java b/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
index cd3e933..e947ec1 100644
--- a/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
+++ b/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
@@ -22,11 +22,10 @@
import java.io.IOException;
import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
+import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
@@ -46,7 +45,7 @@
private static final int DEFAULT_LIMIT = 10;
private static final int MAX_LIMIT = 20;
- private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
+ private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private final ApproveProcessMapper approveProcessMapper;
@@ -76,12 +75,17 @@
@P(value = "瀹℃壒绫诲瀷缂栧彿锛屽彲涓嶄紶", required = false) Integer approveType,
@P(value = "鍏抽敭瀛楋紝鍙尮閰嶆祦绋嬬紪鍙枫�佹爣棰樸�佺敵璇蜂汉銆佸綋鍓嶅鎵逛汉", required = false) String keyword,
@P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�20", required = false) Integer limit,
- @P(value = "鏌ヨ鑼冨洿锛屽彲閫夊�硷細related銆乤pplicant銆乤pprover锛況elated 琛ㄧず褰撳墠鐢ㄦ埛鐩稿叧锛宎pplicant 琛ㄧず鎴戝彂璧风殑锛宎pprover 琛ㄧず寰呮垜澶勭悊鐨�", required = false) String scope) {
+ @P(value = "鏌ヨ鑼冨洿锛屽彲閫夊�硷細related銆乤pplicant銆乤pprover锛況elated 琛ㄧず褰撳墠鐢ㄦ埛鐩稿叧锛宎pplicant 琛ㄧず鎴戝彂璧风殑锛宎pprover 琛ㄧず寰呮垜澶勭悊鐨�", required = false) String scope,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd锛屽彲涓嶄紶", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd锛屽彲涓嶄紶", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屼緥濡� 浠婂ぉ銆佹湰鏈堛�佽繎30澶╋紝鍙笉浼�", required = false) String timeRange) {
LoginUser loginUser = currentLoginUser(memoryId);
Long userId = loginUser.getUserId();
Integer statusCode = parseStatus(status);
String normalizedScope = normalizeScope(scope);
+ boolean hasDateFilter = StringUtils.hasText(startDate) || StringUtils.hasText(endDate) || StringUtils.hasText(timeRange);
+ DateRange dateRange = hasDateFilter ? resolveDateRange(startDate, endDate, timeRange) : null;
LambdaQueryWrapper<ApproveProcess> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ApproveProcess::getApproveDelete, 0);
@@ -120,6 +124,11 @@
}
}
+ if (dateRange != null) {
+ wrapper.ge(ApproveProcess::getCreateTime, dateRange.start().atStartOfDay())
+ .lt(ApproveProcess::getCreateTime, dateRange.end().plusDays(1).atStartOfDay());
+ }
+
wrapper.orderByDesc(ApproveProcess::getCreateTime)
.last("limit " + normalizeLimit(limit));
@@ -156,7 +165,10 @@
"statusFilter", StringUtils.hasText(status) ? status : "all",
"approveType", approveType == null ? "" : approveType,
"keyword", keyword == null ? "" : keyword,
- "scope", normalizedScope
+ "scope", normalizedScope,
+ "timeRange", dateRange == null ? "all" : dateRange.label(),
+ "startDate", dateRange == null ? "" : dateRange.start().toString(),
+ "endDate", dateRange == null ? "" : dateRange.end().toString()
),
Map.of("columns", todoColumns(), "items", items),
Map.of());
@@ -727,7 +739,10 @@
}
private String formatDate(Date value) {
- return value == null ? "" : DATE_FORMAT.format(value);
+ if (value == null) {
+ return "";
+ }
+ return value.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().format(DATE_FORMATTER);
}
private long countByStatus(List<ApproveProcess> processes, int status) {
@@ -811,8 +826,9 @@
private Date parseDate(String dateText) {
try {
- return DATE_FORMAT.parse(dateText);
- } catch (ParseException e) {
+ LocalDate localDate = LocalDate.parse(dateText, DATE_FORMATTER);
+ return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
+ } catch (Exception e) {
throw new IllegalArgumentException("鏃ユ湡鏍煎紡蹇呴』鏄� yyyy-MM-dd");
}
}
diff --git a/src/main/java/com/ruoyi/ai/tools/FinancialAgentTools.java b/src/main/java/com/ruoyi/ai/tools/FinancialAgentTools.java
new file mode 100644
index 0000000..e907aff
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/tools/FinancialAgentTools.java
@@ -0,0 +1,2311 @@
+package com.ruoyi.ai.tools;
+
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.account.mapper.AccountStatementMapper;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.AccountStatement;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.account.service.impl.AccountingServiceImpl;
+import com.ruoyi.ai.context.AiSessionUserContext;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.mapper.ProductMapper;
+import com.ruoyi.basic.mapper.ProductModelMapper;
+import com.ruoyi.basic.mapper.SupplierManageMapper;
+import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.pojo.Product;
+import com.ruoyi.basic.pojo.ProductModel;
+import com.ruoyi.basic.pojo.SupplierManage;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.device.mapper.DeviceLedgerMapper;
+import com.ruoyi.device.mapper.DeviceRepairMapper;
+import com.ruoyi.device.pojo.DeviceLedger;
+import com.ruoyi.device.pojo.DeviceRepair;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
+import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
+import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut;
+import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
+import com.ruoyi.production.mapper.ProductionAccountMapper;
+import com.ruoyi.production.mapper.ProductionOperationTaskMapper;
+import com.ruoyi.production.mapper.ProductionOrderMapper;
+import com.ruoyi.production.mapper.ProductionPlanMapper;
+import com.ruoyi.production.mapper.ProductionProductMainMapper;
+import com.ruoyi.production.mapper.ProductionProductOutputMapper;
+import com.ruoyi.production.pojo.ProductionAccount;
+import com.ruoyi.production.pojo.ProductionOperationTask;
+import com.ruoyi.production.pojo.ProductionOrder;
+import com.ruoyi.production.pojo.ProductionPlan;
+import com.ruoyi.production.pojo.ProductionProductMain;
+import com.ruoyi.production.pojo.ProductionProductOutput;
+import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
+import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.stock.mapper.StockInventoryMapper;
+import com.ruoyi.stock.pojo.StockInventory;
+import com.ruoyi.technology.mapper.TechnologyOperationMapper;
+import com.ruoyi.technology.pojo.TechnologyOperation;
+import dev.langchain4j.agent.tool.P;
+import dev.langchain4j.agent.tool.Tool;
+import dev.langchain4j.agent.tool.ToolMemoryId;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.YearMonth;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+@Component
+public class FinancialAgentTools {
+
+ private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final Pattern RELATIVE_PATTERN = Pattern.compile("(杩憒鏈�杩�)?\\s*(\\d+)\\s*(澶﹟鍛▅涓湀|鏈坾骞�)");
+ private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})");
+ private static final BigDecimal ONE_HUNDRED = new BigDecimal("100");
+ private static final int DEFAULT_LIMIT = 10;
+ private static final int MAX_LIMIT = 50;
+
+ private static final BigDecimal DEFAULT_FALLBACK_MATERIAL_COST_RATE = new BigDecimal("0.60");
+ private static final BigDecimal DEFAULT_LABOR_COST_RATE = new BigDecimal("0.15");
+ private static final BigDecimal DEFAULT_OVERHEAD_COST_RATE = new BigDecimal("0.10");
+
+ private static final BigDecimal SME_RECEIVABLE_RISK_THRESHOLD = new BigDecimal("500000");
+ private static final BigDecimal SME_INVENTORY_RISK_THRESHOLD = new BigDecimal("1000000");
+ private static final BigDecimal SME_PROFIT_WARNING_RATE = new BigDecimal("0.08");
+
+ private final SalesLedgerMapper salesLedgerMapper;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final ProductionAccountMapper productionAccountMapper;
+ private final ProductionProductMainMapper productionProductMainMapper;
+ private final ProductionOperationTaskMapper productionOperationTaskMapper;
+ private final ProductionOrderMapper productionOrderMapper;
+ private final ProductionPlanMapper productionPlanMapper;
+ private final ProductionProductOutputMapper productionProductOutputMapper;
+ private final TechnologyOperationMapper technologyOperationMapper;
+ private final DeviceLedgerMapper deviceLedgerMapper;
+ private final DeviceRepairMapper deviceRepairMapper;
+ private final ProcurementRecordMapper procurementRecordMapper;
+ private final ProcurementRecordOutMapper procurementRecordOutMapper;
+ private final StockInventoryMapper stockInventoryMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private final AccountStatementMapper accountStatementMapper;
+ private final CustomerMapper customerMapper;
+ private final SupplierManageMapper supplierManageMapper;
+ private final ProductModelMapper productModelMapper;
+ private final ProductMapper productMapper;
+ private final AiSessionUserContext aiSessionUserContext;
+
+ public FinancialAgentTools(SalesLedgerMapper salesLedgerMapper,
+ SalesLedgerProductMapper salesLedgerProductMapper,
+ ProductionAccountMapper productionAccountMapper,
+ ProductionProductMainMapper productionProductMainMapper,
+ ProductionOperationTaskMapper productionOperationTaskMapper,
+ ProductionOrderMapper productionOrderMapper,
+ ProductionPlanMapper productionPlanMapper,
+ ProductionProductOutputMapper productionProductOutputMapper,
+ TechnologyOperationMapper technologyOperationMapper,
+ DeviceLedgerMapper deviceLedgerMapper,
+ DeviceRepairMapper deviceRepairMapper,
+ ProcurementRecordMapper procurementRecordMapper,
+ ProcurementRecordOutMapper procurementRecordOutMapper,
+ StockInventoryMapper stockInventoryMapper,
+ AccountSalesCollectionMapper accountSalesCollectionMapper,
+ AccountPurchasePaymentMapper accountPurchasePaymentMapper,
+ AccountStatementMapper accountStatementMapper,
+ CustomerMapper customerMapper,
+ SupplierManageMapper supplierManageMapper,
+ ProductModelMapper productModelMapper,
+ ProductMapper productMapper,
+ AiSessionUserContext aiSessionUserContext) {
+ this.salesLedgerMapper = salesLedgerMapper;
+ this.salesLedgerProductMapper = salesLedgerProductMapper;
+ this.productionAccountMapper = productionAccountMapper;
+ this.productionProductMainMapper = productionProductMainMapper;
+ this.productionOperationTaskMapper = productionOperationTaskMapper;
+ this.productionOrderMapper = productionOrderMapper;
+ this.productionPlanMapper = productionPlanMapper;
+ this.productionProductOutputMapper = productionProductOutputMapper;
+ this.technologyOperationMapper = technologyOperationMapper;
+ this.deviceLedgerMapper = deviceLedgerMapper;
+ this.deviceRepairMapper = deviceRepairMapper;
+ this.procurementRecordMapper = procurementRecordMapper;
+ this.procurementRecordOutMapper = procurementRecordOutMapper;
+ this.stockInventoryMapper = stockInventoryMapper;
+ this.accountSalesCollectionMapper = accountSalesCollectionMapper;
+ this.accountPurchasePaymentMapper = accountPurchasePaymentMapper;
+ this.accountStatementMapper = accountStatementMapper;
+ this.customerMapper = customerMapper;
+ this.supplierManageMapper = supplierManageMapper;
+ this.productModelMapper = productModelMapper;
+ this.productMapper = productMapper;
+ this.aiSessionUserContext = aiSessionUserContext;
+ }
+
+ @Tool(name = "璐㈠姟鐭ヨ瘑妫�绱�", value = "鎸夎储鍔$粡钀ラ棶棰樻绱笟璐㈣瀺鍚堢煡璇嗙墖娈典笌鎸囨爣鍙e緞锛屼綔涓篟AG涓婁笅鏂囥��")
+ public String retrieveFinancialKnowledge(@ToolMemoryId String memoryId,
+ @P(value = "闂鎴栧叧閿瘝锛屼緥濡傚埄娑︿笅闄嶃�佸簱瀛樺懆杞�佽祫閲戠己鍙�") String question) {
+ List<KnowledgeDoc> knowledgeDocs = financeKnowledgeBase();
+ String normalized = normalizeForMatch(question);
+ List<KnowledgeDoc> ranked = knowledgeDocs.stream()
+ .sorted(Comparator.comparingInt((KnowledgeDoc doc) -> keywordHitCount(doc.keywords(), normalized)).reversed())
+ .filter(doc -> keywordHitCount(doc.keywords(), normalized) > 0 || !StringUtils.hasText(normalized))
+ .limit(5)
+ .toList();
+
+ List<Map<String, Object>> items = ranked.stream().map(doc -> {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("topic", doc.topic());
+ map.put("knowledge", doc.knowledge());
+ map.put("relatedTables", doc.relatedTables());
+ map.put("suggestedQuestions", doc.suggestedQuestions());
+ return map;
+ }).toList();
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("question", safe(question));
+ summary.put("hitCount", items.size());
+ summary.put("retrievalMode", "keyword_rag");
+ return jsonResponse(true, "financial_rag_knowledge", "宸茶繑鍥炶储鍔$煡璇嗘绱㈢粨鏋�", summary, Map.of("items", items), Map.of());
+ }
+
+ @Tool(name = "鏅鸿兘鎴愭湰鏍哥畻", value = "鑷姩鏍哥畻浜у搧鎴愭湰銆佸伐搴忔垚鏈�佷汉宸ユ垚鏈�佽澶囨姌鏃с�佹潗鏂欐崯鑰椾笌璁㈠崟鍒╂鼎銆�")
+ public String calculateIntelligentCost(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽鏈湀銆佽繎30澶�", required = false) String timeRange,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶅悎鍚屽彿/瀹㈡埛/椤圭洰", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�50", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ if (loginUser == null) {
+ return jsonResponse(false, "financial_cost_accounting", "鐢ㄦ埛淇℃伅鑾峰彇澶辫触", Map.of(), Map.of(), Map.of());
+ }
+
+ DateRange range = resolveDateRange(startDate, endDate, timeRange, "杩�30澶�");
+ AnalysisBundle bundle = buildOrderProfitBundle(loginUser, range, keyword, limit);
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", displayDate(range.start()));
+ summary.put("endDate", displayDate(range.end()));
+ summary.put("orderCount", bundle.orderMetrics().size());
+ summary.put("totalRevenue", bundle.totalRevenue());
+ summary.put("totalMaterialCost", bundle.totalMaterialCost());
+ summary.put("totalLaborCost", bundle.totalLaborCost());
+ summary.put("totalDepreciationCost", bundle.totalDepreciationCost());
+ summary.put("totalScrapCost", bundle.totalScrapCost());
+ summary.put("totalCost", bundle.totalCost());
+ summary.put("totalProfit", bundle.totalProfit());
+ summary.put("profitRate", toPercent(rate(bundle.totalProfit(), bundle.totalRevenue())));
+
+ List<Map<String, Object>> orderItems = bundle.orderMetrics().stream()
+ .map(this::toOrderCostItem)
+ .toList();
+ List<Map<String, Object>> processItems = bundle.processCostRanking().entrySet().stream()
+ .map(entry -> {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("processName", entry.getKey());
+ map.put("cost", entry.getValue());
+ return map;
+ }).toList();
+
+ List<Map<String, Object>> topCustomerItems = buildCustomerProfitTop(bundle.orderMetrics(), 5);
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("costCompositionPieOption",
+ buildCostCompositionPie(bundle.totalMaterialCost(), bundle.totalLaborCost(), bundle.totalDepreciationCost(), bundle.totalScrapCost()));
+ charts.put("orderProfitBarOption", buildOrderProfitBar(bundle.orderMetrics()));
+ charts.put("processCostBarOption", buildProcessCostBar(bundle.processCostRanking()));
+
+ return jsonResponse(true, "financial_cost_accounting", "宸插畬鎴愭櫤鑳芥垚鏈牳绠�", summary,
+ Map.of(
+ "orders", orderItems,
+ "processCostRanking", processItems,
+ "topCustomers", topCustomerItems
+ ),
+ charts
+ );
+ }
+
+ @Tool(name = "璁㈠崟鍒╂鼎鍒嗘瀽", value = "璇嗗埆浣庡埄娑�/浜忔崯璁㈠崟锛岃緭鍑哄師鍥犲垎鏋愬拰浼樺寲寤鸿銆�")
+ public String analyzeOrderProfit(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽鏈湀銆佽繎30澶�", required = false) String timeRange,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶅悎鍚屽彿/瀹㈡埛/椤圭洰", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�50", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ if (loginUser == null) {
+ return jsonResponse(false, "financial_order_profit_analysis", "鐢ㄦ埛淇℃伅鑾峰彇澶辫触", Map.of(), Map.of(), Map.of());
+ }
+
+ DateRange range = resolveDateRange(startDate, endDate, timeRange, "杩�30澶�");
+ AnalysisBundle bundle = buildOrderProfitBundle(loginUser, range, keyword, limit);
+ List<OrderProfitMetric> metrics = bundle.orderMetrics();
+
+ List<OrderProfitMetric> riskyOrders = metrics.stream()
+ .filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0 || item.profitRate().compareTo(SME_PROFIT_WARNING_RATE) < 0)
+ .sorted(Comparator.comparing(OrderProfitMetric::profitRate)
+ .thenComparing(OrderProfitMetric::profit))
+ .toList();
+
+ Map<String, BigDecimal> customerProfitMap = new LinkedHashMap<>();
+ for (OrderProfitMetric metric : metrics) {
+ customerProfitMap.merge(metric.customerName(), metric.profit(), BigDecimal::add);
+ }
+ Map.Entry<String, BigDecimal> topCustomer = customerProfitMap.entrySet().stream()
+ .max(Map.Entry.comparingByValue())
+ .orElse(Map.entry("鏆傛棤鏁版嵁", BigDecimal.ZERO));
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", displayDate(range.start()));
+ summary.put("endDate", displayDate(range.end()));
+ summary.put("orderCount", metrics.size());
+ summary.put("lossOrderCount", metrics.stream().filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0).count());
+ summary.put("lowProfitOrderCount", riskyOrders.size());
+ summary.put("avgProfitRate", toPercent(avgRate(metrics)));
+ summary.put("topCustomerByProfit", topCustomer.getKey());
+ summary.put("topCustomerProfit", topCustomer.getValue());
+
+ List<Map<String, Object>> riskyItems = riskyOrders.stream()
+ .limit(normalizeLimit(limit))
+ .map(this::toRiskOrderItem)
+ .toList();
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("profitDistributionOption", buildProfitDistributionBar(metrics));
+ charts.put("lossOrderTrendOption", buildLossOrderTrendLine(metrics));
+ charts.put("customerProfitTopOption", buildCustomerProfitBar(customerProfitMap));
+
+ return jsonResponse(true, "financial_order_profit_analysis", "宸插畬鎴愯鍗曞埄娑﹀垎鏋�", summary,
+ Map.of(
+ "riskOrders", riskyItems,
+ "allOrders", metrics.stream().map(this::toOrderCostItem).toList(),
+ "customerProfitTop", buildCustomerProfitTop(metrics, 10)
+ ),
+ charts
+ );
+ }
+
+ @Tool(name = "搴撳瓨璧勯噾鍒嗘瀽", value = "鍒嗘瀽搴撳瓨绉帇銆佸憜婊炲簱瀛樸�佽祫閲戝崰鐢ㄤ笌鍛ㄨ浆鐜囥��")
+ public String analyzeInventoryCapital(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽鏈湀銆佽繎30澶�", required = false) String timeRange,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶄骇鍝佸悕绉�/鍨嬪彿", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�50", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange, "杩�30澶�");
+ int finalLimit = normalizeLimit(limit);
+
+ List<StockInventory> inventoryRows = queryStockInventory(loginUser);
+ if (inventoryRows.isEmpty()) {
+ return jsonResponse(true, "financial_inventory_capital_analysis", "褰撳墠鏃犲簱瀛樻暟鎹�",
+ rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of());
+ }
+
+ Set<Long> modelIds = inventoryRows.stream()
+ .map(StockInventory::getProductModelId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ Map<Long, ProductModel> productModelMap = queryProductModels(modelIds);
+ Map<Long, Product> productMap = queryProducts(productModelMap.values());
+ Map<Long, BigDecimal> avgUnitCostByModelId = queryAverageUnitCostByModel(loginUser, modelIds);
+ OutboundStats outboundStats = queryOutboundStats(loginUser, modelIds, range);
+
+ List<InventoryMetric> metrics = buildInventoryMetrics(inventoryRows, productModelMap, productMap, avgUnitCostByModelId, outboundStats)
+ .stream()
+ .filter(metric -> matchInventoryKeyword(metric, keyword))
+ .sorted(Comparator.comparing(InventoryMetric::inventoryValue).reversed())
+ .toList();
+
+ BigDecimal totalInventoryValue = metrics.stream().map(InventoryMetric::inventoryValue).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal stagnantValue = metrics.stream()
+ .filter(metric -> metric.stagnantDays() >= 90)
+ .map(InventoryMetric::inventoryValue)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ long stagnantCount = metrics.stream().filter(metric -> metric.stagnantDays() >= 90).count();
+ long overstockCount = metrics.stream().filter(InventoryMetric::overstock).count();
+ BigDecimal totalOutboundCost = outboundStats.totalOutboundCost();
+ BigDecimal turnoverDays = totalOutboundCost.compareTo(BigDecimal.ZERO) > 0
+ ? totalInventoryValue.multiply(BigDecimal.valueOf(daysBetween(range.start(), range.end()) + 1L))
+ .divide(totalOutboundCost, 2, RoundingMode.HALF_UP)
+ : BigDecimal.ZERO;
+
+ List<Map<String, Object>> items = metrics.stream()
+ .limit(finalLimit)
+ .map(this::toInventoryItem)
+ .toList();
+
+ Map<String, Object> summary = rangeSummary(range, metrics.size(), keyword);
+ summary.put("totalInventoryValue", totalInventoryValue);
+ summary.put("stagnantValue", stagnantValue);
+ summary.put("stagnantCount", stagnantCount);
+ summary.put("overstockCount", overstockCount);
+ summary.put("turnoverDays", turnoverDays);
+ summary.put("capitalOccupation", totalInventoryValue);
+ summary.put("totalOutboundCost", totalOutboundCost);
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("inventoryValueTopOption", buildInventoryTopBar(metrics));
+ charts.put("inventoryAgingPieOption", buildInventoryAgingPie(metrics));
+ charts.put("inventoryTurnoverGauge", buildTurnoverGauge(turnoverDays));
+
+ return jsonResponse(true, "financial_inventory_capital_analysis", "宸插畬鎴愬簱瀛樿祫閲戝垎鏋�", summary, Map.of("items", items), charts);
+ }
+
+ @Tool(name = "搴旀敹搴斾粯涓庣幇閲戞祦棰勬祴", value = "棰勬祴鏈潵鐜伴噾娴併�佸洖娆鹃闄┿�佷粯娆惧帇鍔涗笌璧勯噾缂哄彛銆�")
+ public String forecastCashFlow(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽杩�90澶┿�佹湰骞�", required = false) String timeRange,
+ @P(value = "棰勬祴鏈堜唤鏁帮紝榛樿3锛屾渶澶�6", required = false) Integer forecastMonths) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange, "杩�90澶�");
+ int months = forecastMonths == null || forecastMonths <= 0 ? 3 : Math.min(forecastMonths, 6);
+
+ List<AccountSalesCollection> collections = queryCollections(loginUser, range);
+ List<AccountPurchasePayment> payments = queryPayments(loginUser, range);
+ List<MonthlyCashFlow> monthlyActual = buildMonthlyCashFlow(range, collections, payments);
+ List<MonthlyCashFlow> monthlyForecast = forecastMonthlyCashFlow(monthlyActual, months);
+
+ StatementSnapshot snapshot = buildStatementSnapshot(loginUser);
+ BigDecimal receivableTotal = snapshot.receivableTotal();
+ BigDecimal payableTotal = snapshot.payableTotal();
+ BigDecimal forecastNetSum = monthlyForecast.stream().map(MonthlyCashFlow::netFlow).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal coverage = receivableTotal.add(maxZero(forecastNetSum));
+ BigDecimal fundGap = maxZero(payableTotal.subtract(coverage));
+
+ Map<String, String> customerNameMap = queryCustomerNameMap(snapshot.receivableTop().stream().map(StatementMetric::entityId).collect(Collectors.toSet()));
+ Map<String, String> supplierNameMap = querySupplierNameMap(snapshot.payableTop().stream().map(StatementMetric::entityId).collect(Collectors.toSet()));
+
+ List<Map<String, Object>> receivableRiskItems = snapshot.receivableTop().stream().map(item -> toStatementRiskItem(item, customerNameMap, "customer")).toList();
+ List<Map<String, Object>> payablePressureItems = snapshot.payableTop().stream().map(item -> toStatementRiskItem(item, supplierNameMap, "supplier")).toList();
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", displayDate(range.start()));
+ summary.put("endDate", displayDate(range.end()));
+ summary.put("actualIncomeTotal", collections.stream().map(AccountSalesCollection::getCollectionAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+ summary.put("actualExpenseTotal", payments.stream().map(AccountPurchasePayment::getPaymentAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+ summary.put("receivableBalance", receivableTotal);
+ summary.put("payableBalance", payableTotal);
+ summary.put("forecastNetSum", forecastNetSum);
+ summary.put("fundGap", fundGap);
+ summary.put("forecastMonths", months);
+ summary.put("collectionRiskLevel", riskLevelByAmount(receivableTotal));
+ summary.put("paymentPressureLevel", riskLevelByAmount(payableTotal));
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("cashFlowTrendOption", buildCashflowTrend(monthlyActual, monthlyForecast));
+ charts.put("receivablePayableBarOption", buildReceivablePayableBar(receivableTotal, payableTotal));
+ charts.put("fundGapGaugeOption", buildFundGapGauge(fundGap));
+
+ return jsonResponse(true, "financial_cashflow_forecast", "宸插畬鎴愬簲鏀跺簲浠樹笌鐜伴噾娴侀娴�", summary,
+ Map.of(
+ "actualMonthly", monthlyActual.stream().map(this::toMonthlyCashFlowItem).toList(),
+ "forecastMonthly", monthlyForecast.stream().map(this::toMonthlyCashFlowItem).toList(),
+ "receivableRiskTop", receivableRiskItems,
+ "payablePressureTop", payablePressureItems
+ ),
+ charts
+ );
+ }
+
+ @Tool(name = "缁忚惀寮傚父棰勮", value = "璇嗗埆鎴愭湰寮傚父銆佸埄娑﹀紓甯搞�佸洖娆惧紓甯搞�佽鍗曢闄┿�佸簱瀛樺紓甯搞��")
+ public String detectBusinessAnomalies(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽杩�30澶�", required = false) String timeRange,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�50", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange, "杩�30澶�");
+ int finalLimit = normalizeLimit(limit);
+
+ AnalysisBundle currentBundle = buildOrderProfitBundle(loginUser, range, null, Math.max(finalLimit, 30));
+ DateRange prevRange = previousSameLengthRange(range);
+ AnalysisBundle prevBundle = buildOrderProfitBundle(loginUser, prevRange, null, 50);
+
+ BigDecimal currentCostRate = rate(currentBundle.totalCost(), currentBundle.totalRevenue());
+ BigDecimal prevCostRate = rate(prevBundle.totalCost(), prevBundle.totalRevenue());
+ BigDecimal costRateDiff = currentCostRate.subtract(prevCostRate);
+
+ StatementSnapshot snapshot = buildStatementSnapshot(loginUser);
+ List<InventoryMetric> inventoryMetrics = buildInventoryMetrics(
+ queryStockInventory(loginUser),
+ queryProductModels(Collections.emptySet()),
+ Map.of(),
+ queryAverageUnitCostByModel(loginUser, Collections.emptySet()),
+ queryOutboundStats(loginUser, Collections.emptySet(), range)
+ );
+
+ List<Map<String, Object>> anomalyItems = new ArrayList<>();
+ if (costRateDiff.compareTo(new BigDecimal("0.10")) > 0) {
+ anomalyItems.add(anomalyItem("high", "鎴愭湰寮傚父", "鍗曚綅鏀跺叆鎴愭湰鐜囪緝涓婂懆鏈熶笂鍗囪秴杩�10%", Map.of(
+ "currentCostRate", toPercent(currentCostRate),
+ "previousCostRate", toPercent(prevCostRate),
+ "delta", toPercent(costRateDiff)
+ )));
+ }
+ long lossCount = currentBundle.orderMetrics().stream().filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0).count();
+ if (lossCount > 0) {
+ anomalyItems.add(anomalyItem("high", "鍒╂鼎寮傚父", "妫�娴嬪埌浜忔崯璁㈠崟", Map.of("lossOrderCount", lossCount)));
+ }
+ if (snapshot.receivableTotal().compareTo(snapshot.payableTotal().multiply(new BigDecimal("1.2"))) > 0) {
+ anomalyItems.add(anomalyItem("medium", "鍥炴寮傚父", "搴旀敹浣欓鏄捐憲楂樹簬搴斾粯锛屽洖娆惧帇鍔涘亸澶�", Map.of(
+ "receivableBalance", snapshot.receivableTotal(),
+ "payableBalance", snapshot.payableTotal()
+ )));
+ }
+ long overdueOrderCount = currentBundle.orderMetrics().stream()
+ .filter(item -> item.deliveryDate() != null && item.deliveryDate().isBefore(LocalDate.now()) && item.profitRate().compareTo(new BigDecimal("0.10")) < 0)
+ .count();
+ if (overdueOrderCount > 0) {
+ anomalyItems.add(anomalyItem("medium", "璁㈠崟椋庨櫓", "瀛樺湪浣庡埄娑︿笖浜や粯宸查�炬湡璁㈠崟", Map.of("overdueRiskOrderCount", overdueOrderCount)));
+ }
+ long stagnantCount = inventoryMetrics.stream().filter(item -> item.stagnantDays() >= 90).count();
+ if (stagnantCount > 0) {
+ anomalyItems.add(anomalyItem("medium", "搴撳瓨寮傚父", "瀛樺湪瓒呰繃90澶╂湭鍛ㄨ浆搴撳瓨", Map.of("stagnantCount", stagnantCount)));
+ }
+
+ List<Map<String, Object>> topAnomalies = anomalyItems.stream().limit(finalLimit).toList();
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", displayDate(range.start()));
+ summary.put("endDate", displayDate(range.end()));
+ summary.put("anomalyCount", topAnomalies.size());
+ summary.put("highRiskCount", topAnomalies.stream().filter(item -> "high".equals(item.get("riskLevel"))).count());
+ summary.put("mediumRiskCount", topAnomalies.stream().filter(item -> "medium".equals(item.get("riskLevel"))).count());
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("anomalyLevelPieOption", buildAnomalyLevelPie(topAnomalies));
+ charts.put("anomalyTypeBarOption", buildAnomalyTypeBar(topAnomalies));
+ return jsonResponse(true, "financial_business_anomaly_warning", "宸插畬鎴愮粡钀ュ紓甯搁璀﹀垎鏋�", summary,
+ Map.of("items", topAnomalies), charts);
+ }
+
+ @Tool(name = "AI缁忚惀椹鹃┒鑸�", value = "瀹炴椂灞曠ず浜у�笺�佸埄娑︺�佸簱瀛樸�佸洖娆俱�佽澶囧埄鐢ㄧ巼銆佽鍗曞埄娑︾巼绛夋牳蹇冪粡钀ユ寚鏍囥��")
+ public String getBusinessCockpit(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽鏈湀銆佽繎30澶�", required = false) String timeRange) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange, "鏈湀");
+
+ AnalysisBundle profitBundle = buildOrderProfitBundle(loginUser, range, null, 30);
+ StatementSnapshot snapshot = buildStatementSnapshot(loginUser);
+ List<StockInventory> inventories = queryStockInventory(loginUser);
+ BigDecimal inventoryValue = estimateInventoryValue(loginUser, inventories);
+
+ long deviceTotal = countDevices(loginUser);
+ long repairingCount = countRepairingDevices(loginUser);
+ BigDecimal deviceUtilization = deviceTotal > 0
+ ? new BigDecimal(deviceTotal - repairingCount).multiply(ONE_HUNDRED).divide(new BigDecimal(deviceTotal), 2, RoundingMode.HALF_UP)
+ : BigDecimal.ZERO;
+
+ BigDecimal outputValue = profitBundle.totalRevenue();
+ BigDecimal profitRate = rate(profitBundle.totalProfit(), profitBundle.totalRevenue());
+ BigDecimal collectionRate = snapshot.receivableTotal().compareTo(BigDecimal.ZERO) > 0
+ ? ONE_HUNDRED.subtract(rate(snapshot.receivableTotal(), snapshot.receivableTotal().add(snapshot.payableTotal())).multiply(ONE_HUNDRED))
+ : BigDecimal.ZERO;
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", displayDate(range.start()));
+ summary.put("endDate", displayDate(range.end()));
+ summary.put("outputValue", outputValue);
+ summary.put("profit", profitBundle.totalProfit());
+ summary.put("profitRate", toPercent(profitRate));
+ summary.put("inventoryValue", inventoryValue);
+ summary.put("receivableBalance", snapshot.receivableTotal());
+ summary.put("payableBalance", snapshot.payableTotal());
+ summary.put("collectionRate", toPercent(collectionRate.divide(ONE_HUNDRED, 4, RoundingMode.HALF_UP)));
+ summary.put("deviceUtilizationRate", deviceUtilization + "%");
+ summary.put("orderProfitRate", toPercent(avgRate(profitBundle.orderMetrics())));
+
+ Map<String, Object> indicators = new LinkedHashMap<>();
+ indicators.put("浜у��", outputValue);
+ indicators.put("鍒╂鼎", profitBundle.totalProfit());
+ indicators.put("搴撳瓨璧勯噾鍗犵敤", inventoryValue);
+ indicators.put("搴旀敹浣欓", snapshot.receivableTotal());
+ indicators.put("璁惧鍒╃敤鐜�", deviceUtilization + "%");
+ indicators.put("璁㈠崟骞冲潎鍒╂鼎鐜�", toPercent(avgRate(profitBundle.orderMetrics())));
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("kpiCardData", indicators);
+ charts.put("profitTrendOption", buildOrderProfitBar(profitBundle.orderMetrics()));
+ charts.put("receivablePayableBarOption", buildReceivablePayableBar(snapshot.receivableTotal(), snapshot.payableTotal()));
+ charts.put("inventoryProfitGaugeOption", buildInventoryProfitGauge(inventoryValue, profitBundle.totalProfit()));
+
+ return jsonResponse(true, "financial_business_cockpit", "宸茬敓鎴怉I缁忚惀椹鹃┒鑸辨暟鎹�", summary,
+ Map.of(
+ "orderProfitTop", profitBundle.orderMetrics().stream()
+ .sorted(Comparator.comparing(OrderProfitMetric::profit).reversed())
+ .limit(10)
+ .map(this::toOrderCostItem)
+ .toList(),
+ "indicators", indicators
+ ),
+ charts
+ );
+ }
+
+ @Tool(name = "鏃ユ姤鍛ㄦ姤鑷姩鐢熸垚", value = "鑷姩杈撳嚭缁忚惀鍒嗘瀽鏃ユ姤/鍛ㄦ姤涓庨闄╁缓璁��")
+ public String generateOperationReport(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽浠婂ぉ銆佹湰鍛�", required = false) String timeRange,
+ @P(value = "鎶ュ憡绫诲瀷 daily/weekly", required = false) String reportType) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange,
+ "weekly".equalsIgnoreCase(reportType) ? "鏈懆" : "浠婂ぉ");
+ String type = "weekly".equalsIgnoreCase(reportType) ? "weekly" : "daily";
+
+ AnalysisBundle bundle = buildOrderProfitBundle(loginUser, range, null, 30);
+ StatementSnapshot snapshot = buildStatementSnapshot(loginUser);
+ BigDecimal inventoryValue = estimateInventoryValue(loginUser, queryStockInventory(loginUser));
+ long lossCount = bundle.orderMetrics().stream().filter(item -> item.profit().compareTo(BigDecimal.ZERO) < 0).count();
+
+ List<String> conclusions = new ArrayList<>();
+ conclusions.add("钀ユ敹" + bundle.totalRevenue() + "锛屽埄娑�" + bundle.totalProfit() + "锛屽埄娑︾巼" + toPercent(rate(bundle.totalProfit(), bundle.totalRevenue())) + "銆�");
+ conclusions.add("搴旀敹浣欓" + snapshot.receivableTotal() + "锛屽簲浠樹綑棰�" + snapshot.payableTotal() + "锛屽簱瀛樿祫閲戝崰鐢�" + inventoryValue + "銆�");
+ if (lossCount > 0) {
+ conclusions.add("鍙戠幇浜忔崯璁㈠崟" + lossCount + "涓紝寤鸿浼樺厛澶嶆牳鏉愭枡鎹熻�楀拰宸ュ簭浜哄伐鏁堢巼銆�");
+ } else {
+ conclusions.add("褰撳墠鏈彂鐜颁簭鎹熻鍗曪紝寤鸿鎸佺画璺熻釜浣庝簬8%鍒╂鼎鐜囪鍗曘��");
+ }
+ if (snapshot.receivableTotal().compareTo(snapshot.payableTotal()) > 0) {
+ conclusions.add("鍥炴鍘嬪姏鍋忛珮锛屽缓璁拡瀵归珮搴旀敹瀹㈡埛鎵ц鍒嗗眰鍌敹涓庤处鏈熶紭鍖栥��");
+ } else {
+ conclusions.add("璧勯噾鍘嬪姏鍙帶锛屽缓璁繚鎸佷粯娆捐鍒掍笌閲囪喘鑺傚鑱斿姩銆�");
+ }
+
+ List<Map<String, Object>> riskSuggestions = new ArrayList<>();
+ if (lossCount > 0) {
+ riskSuggestions.add(riskSuggestion("鍒╂鼎椋庨櫓", "楂�", "澶嶆牳浜忔崯璁㈠崟BOM鍜屽伐搴忓伐璧勫畾棰濓紝蹇呰鏃惰皟鏁存姤浠蜂笌浜や粯鑺傚銆�"));
+ }
+ if (snapshot.receivableTotal().compareTo(SME_RECEIVABLE_RISK_THRESHOLD) > 0) {
+ riskSuggestions.add(riskSuggestion("鍥炴椋庨櫓", "涓�", "瀵瑰簲鏀禩OP瀹㈡埛寤虹珛鍛ㄥ害鍥炴璁″垝锛屽苟璁剧疆棰勮闃堝�笺��"));
+ }
+ if (inventoryValue.compareTo(SME_INVENTORY_RISK_THRESHOLD) > 0) {
+ riskSuggestions.add(riskSuggestion("搴撳瓨椋庨櫓", "涓�", "瀵归珮閲戦鍛嗘粸搴撳瓨鎵ц闄嶄环銆佹浛浠e拰鐢熶骇娑堣�楃瓥鐣ャ��"));
+ }
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("reportType", type);
+ summary.put("timeRange", range.label());
+ summary.put("startDate", displayDate(range.start()));
+ summary.put("endDate", displayDate(range.end()));
+ summary.put("orderCount", bundle.orderMetrics().size());
+ summary.put("lossOrderCount", lossCount);
+ summary.put("riskSuggestionCount", riskSuggestions.size());
+
+ Map<String, Object> data = new LinkedHashMap<>();
+ data.put("headline", "weekly".equals(type) ? "缁忚惀鍛ㄦ姤" : "缁忚惀鏃ユ姤");
+ data.put("conclusions", conclusions);
+ data.put("riskSuggestions", riskSuggestions);
+ data.put("orderProfitTop", bundle.orderMetrics().stream()
+ .sorted(Comparator.comparing(OrderProfitMetric::profitRate))
+ .limit(10)
+ .map(this::toRiskOrderItem)
+ .toList());
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("reportProfitBarOption", buildOrderProfitBar(bundle.orderMetrics()));
+ charts.put("reportReceivablePayableOption", buildReceivablePayableBar(snapshot.receivableTotal(), snapshot.payableTotal()));
+ return jsonResponse(true, "financial_operation_report", "宸茶嚜鍔ㄧ敓鎴愮粡钀ュ垎鏋愭姤鍛�", summary, data, charts);
+ }
+
+ private AnalysisBundle buildOrderProfitBundle(LoginUser loginUser, DateRange range, String keyword, Integer limit) {
+ List<SalesLedger> ledgers = querySalesLedgers(loginUser, range, keyword, limit);
+ if (ledgers.isEmpty()) {
+ return AnalysisBundle.empty();
+ }
+
+ List<Long> ledgerIds = ledgers.stream().map(SalesLedger::getId).filter(Objects::nonNull).toList();
+ List<SalesLedgerProduct> ledgerProducts = queryLedgerProducts(loginUser, ledgerIds);
+ Map<Long, List<SalesLedgerProduct>> productsByLedgerId = ledgerProducts.stream()
+ .collect(Collectors.groupingBy(SalesLedgerProduct::getSalesLedgerId));
+
+ MaterialCostResult materialCostResult = calculateMaterialCost(loginUser, range, ledgerProducts);
+ ProductionCostContext productionCostContext = calculateProductionCost(loginUser, range, ledgers, ledgerProducts, materialCostResult.avgUnitCostByModelId());
+ BigDecimal totalDepreciation = calculateTotalDepreciation(loginUser);
+
+ BigDecimal totalRevenue = ledgers.stream()
+ .map(SalesLedger::getContractAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ Map<Long, BigDecimal> depreciationCostByLedger = allocateDepreciation(ledgers, totalDepreciation, totalRevenue);
+
+ List<OrderProfitMetric> metrics = new ArrayList<>();
+ for (SalesLedger ledger : ledgers) {
+ BigDecimal revenue = defaultDecimal(ledger.getContractAmount());
+ BigDecimal materialCost = materialCostResult.materialCostByLedgerId().getOrDefault(ledger.getId(), fallbackMaterialCost(productsByLedgerId.get(ledger.getId()), revenue));
+ BigDecimal laborCost = productionCostContext.laborCostByLedgerId().getOrDefault(ledger.getId(), BigDecimal.ZERO);
+ BigDecimal scrapCost = productionCostContext.scrapCostByLedgerId().getOrDefault(ledger.getId(), BigDecimal.ZERO);
+ BigDecimal depreciationCost = depreciationCostByLedger.getOrDefault(ledger.getId(), BigDecimal.ZERO);
+ BigDecimal totalCost = materialCost.add(laborCost).add(scrapCost).add(depreciationCost);
+ BigDecimal profit = revenue.subtract(totalCost);
+ BigDecimal profitRate = rate(profit, revenue);
+ String riskLevel = profit.compareTo(BigDecimal.ZERO) < 0
+ ? "high"
+ : (profitRate.compareTo(new BigDecimal("0.08")) < 0 ? "medium" : "low");
+ List<String> reasons = buildProfitReasons(revenue, materialCost, laborCost, scrapCost, profit, profitRate);
+ String suggestion = buildProfitSuggestion(riskLevel, reasons);
+
+ metrics.add(new OrderProfitMetric(
+ ledger.getId(),
+ safe(ledger.getSalesContractNo()),
+ safe(ledger.getCustomerName()),
+ safe(ledger.getProjectName()),
+ toLocalDate(ledger.getEntryDate()),
+ ledger.getDeliveryDate(),
+ revenue,
+ materialCost,
+ laborCost,
+ depreciationCost,
+ scrapCost,
+ totalCost,
+ profit,
+ profitRate,
+ riskLevel,
+ reasons,
+ suggestion
+ ));
+ }
+
+ metrics.sort(Comparator.comparing(OrderProfitMetric::entryDate, Comparator.nullsLast(Comparator.reverseOrder()))
+ .thenComparing(OrderProfitMetric::ledgerId, Comparator.nullsLast(Comparator.reverseOrder())));
+ BigDecimal totalMaterialCost = metrics.stream().map(OrderProfitMetric::materialCost).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal totalLaborCost = metrics.stream().map(OrderProfitMetric::laborCost).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal totalScrapCost = metrics.stream().map(OrderProfitMetric::scrapCost).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal totalDepreciationCost = metrics.stream().map(OrderProfitMetric::depreciationCost).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal totalCost = metrics.stream().map(OrderProfitMetric::totalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal totalProfit = metrics.stream().map(OrderProfitMetric::profit).reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ return new AnalysisBundle(
+ metrics,
+ productionCostContext.processCostRanking(),
+ totalRevenue,
+ totalMaterialCost,
+ totalLaborCost,
+ totalDepreciationCost,
+ totalScrapCost,
+ totalCost,
+ totalProfit
+ );
+ }
+
+ private MaterialCostResult calculateMaterialCost(LoginUser loginUser, DateRange range, List<SalesLedgerProduct> ledgerProducts) {
+ if (ledgerProducts.isEmpty()) {
+ return new MaterialCostResult(Map.of(), Map.of());
+ }
+ List<Long> ledgerProductIds = ledgerProducts.stream().map(SalesLedgerProduct::getId).filter(Objects::nonNull).toList();
+ Set<Long> productModelIds = ledgerProducts.stream().map(SalesLedgerProduct::getProductModelId).filter(Objects::nonNull).collect(Collectors.toSet());
+ Map<Long, Long> productIdToLedgerId = ledgerProducts.stream()
+ .filter(item -> item.getId() != null && item.getSalesLedgerId() != null)
+ .collect(Collectors.toMap(SalesLedgerProduct::getId, SalesLedgerProduct::getSalesLedgerId, (a, b) -> a));
+
+ Map<Long, BigDecimal> avgUnitCostByModelId = queryAverageUnitCostByModel(loginUser, productModelIds);
+ LambdaQueryWrapper<ProcurementRecordOut> outWrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(outWrapper, loginUser.getTenantId(), ProcurementRecordOut::getTenantId);
+ applyDeptFilter(outWrapper, loginUser.getCurrentDeptId(), ProcurementRecordOut::getDeptId);
+ outWrapper.eq(ProcurementRecordOut::getType, 2)
+ .in(ProcurementRecordOut::getSalesLedgerProductId, ledgerProductIds);
+ if (range.hasDateFilter()) {
+ outWrapper.ge(ProcurementRecordOut::getCreateTime, range.start().atStartOfDay())
+ .lt(ProcurementRecordOut::getCreateTime, range.end().plusDays(1).atStartOfDay());
+ }
+ List<ProcurementRecordOut> outList = defaultList(procurementRecordOutMapper.selectList(outWrapper));
+
+ Set<Integer> storageIds = outList.stream()
+ .map(ProcurementRecordOut::getProcurementRecordStorageId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ Map<Integer, ProcurementRecordStorage> storageMap = storageIds.isEmpty()
+ ? Map.of()
+ : defaultList(procurementRecordMapper.selectBatchIds(storageIds)).stream()
+ .collect(Collectors.toMap(ProcurementRecordStorage::getId, item -> item, (a, b) -> a));
+
+ Map<Long, BigDecimal> materialCostByLedgerId = new HashMap<>();
+ for (ProcurementRecordOut out : outList) {
+ Long ledgerId = productIdToLedgerId.get(out.getSalesLedgerProductId());
+ if (ledgerId == null) {
+ continue;
+ }
+ ProcurementRecordStorage storage = storageMap.get(out.getProcurementRecordStorageId());
+ BigDecimal unitPrice = storage == null ? BigDecimal.ZERO : defaultDecimal(storage.getUnitPrice());
+ BigDecimal quantity = defaultDecimal(out.getInboundNum());
+ BigDecimal cost = quantity.multiply(unitPrice);
+ materialCostByLedgerId.merge(ledgerId, cost, BigDecimal::add);
+ }
+ return new MaterialCostResult(materialCostByLedgerId, avgUnitCostByModelId);
+ }
+
+ private ProductionCostContext calculateProductionCost(LoginUser loginUser,
+ DateRange range,
+ List<SalesLedger> ledgers,
+ List<SalesLedgerProduct> ledgerProducts,
+ Map<Long, BigDecimal> avgUnitCostByModelId) {
+ if (ledgers.isEmpty()) {
+ return ProductionCostContext.empty();
+ }
+
+ Set<Long> ledgerIds = ledgers.stream().map(SalesLedger::getId).filter(Objects::nonNull).collect(Collectors.toSet());
+ Map<Long, Set<Long>> productModelToLedgerIds = new HashMap<>();
+ for (SalesLedgerProduct product : ledgerProducts) {
+ if (product.getProductModelId() == null || product.getSalesLedgerId() == null) {
+ continue;
+ }
+ productModelToLedgerIds.computeIfAbsent(product.getProductModelId(), key -> new HashSet<>()).add(product.getSalesLedgerId());
+ }
+
+ LambdaQueryWrapper<ProductionPlan> planWrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(planWrapper, loginUser.getCurrentDeptId(), ProductionPlan::getDeptId);
+ planWrapper.in(ProductionPlan::getSalesLedgerId, ledgerIds);
+ List<ProductionPlan> plans = defaultList(productionPlanMapper.selectList(planWrapper));
+ Map<Long, Long> planIdToLedgerId = plans.stream()
+ .filter(item -> item.getId() != null && item.getSalesLedgerId() != null)
+ .collect(Collectors.toMap(ProductionPlan::getId, ProductionPlan::getSalesLedgerId, (a, b) -> a));
+
+ LambdaQueryWrapper<ProductionOrder> orderWrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(orderWrapper, loginUser.getCurrentDeptId(), ProductionOrder::getDeptId);
+ if (range.hasDateFilter()) {
+ orderWrapper.ge(ProductionOrder::getCreateTime, range.start().atStartOfDay().minusMonths(2))
+ .lt(ProductionOrder::getCreateTime, range.end().plusDays(1).atStartOfDay().plusMonths(1));
+ }
+ List<ProductionOrder> orders = defaultList(productionOrderMapper.selectList(orderWrapper));
+
+ Map<Long, Set<Long>> orderIdToLedgerIds = new HashMap<>();
+ for (ProductionOrder order : orders) {
+ Set<Long> orderLedgers = new HashSet<>();
+ for (Long planId : parseIdList(order.getProductionPlanIds())) {
+ Long ledgerId = planIdToLedgerId.get(planId);
+ if (ledgerId != null) {
+ orderLedgers.add(ledgerId);
+ }
+ }
+ if (orderLedgers.isEmpty() && order.getProductModelId() != null) {
+ orderLedgers.addAll(productModelToLedgerIds.getOrDefault(order.getProductModelId(), Set.of()));
+ }
+ if (!orderLedgers.isEmpty()) {
+ orderIdToLedgerIds.put(order.getId(), orderLedgers);
+ }
+ }
+ if (orderIdToLedgerIds.isEmpty()) {
+ return ProductionCostContext.empty();
+ }
+
+ LambdaQueryWrapper<ProductionOperationTask> taskWrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(taskWrapper, loginUser.getCurrentDeptId(), ProductionOperationTask::getDeptId);
+ taskWrapper.in(ProductionOperationTask::getProductionOrderId, orderIdToLedgerIds.keySet());
+ List<ProductionOperationTask> tasks = defaultList(productionOperationTaskMapper.selectList(taskWrapper));
+ Map<Long, Long> taskIdToOrderId = tasks.stream()
+ .filter(item -> item.getId() != null && item.getProductionOrderId() != null)
+ .collect(Collectors.toMap(ProductionOperationTask::getId, ProductionOperationTask::getProductionOrderId, (a, b) -> a));
+ if (taskIdToOrderId.isEmpty()) {
+ return ProductionCostContext.empty();
+ }
+
+ LambdaQueryWrapper<ProductionProductMain> mainWrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(mainWrapper, loginUser.getCurrentDeptId(), ProductionProductMain::getDeptId);
+ mainWrapper.in(ProductionProductMain::getProductionOperationTaskId, taskIdToOrderId.keySet());
+ if (range.hasDateFilter()) {
+ mainWrapper.ge(ProductionProductMain::getCreateTime, range.start().atStartOfDay().minusMonths(2))
+ .lt(ProductionProductMain::getCreateTime, range.end().plusDays(1).atStartOfDay().plusMonths(1));
+ }
+ List<ProductionProductMain> mainList = defaultList(productionProductMainMapper.selectList(mainWrapper));
+ Map<Long, Set<Long>> mainIdToLedgers = new HashMap<>();
+ for (ProductionProductMain main : mainList) {
+ Long orderId = taskIdToOrderId.get(main.getProductionOperationTaskId());
+ if (orderId == null) {
+ continue;
+ }
+ Set<Long> ledgerSet = orderIdToLedgerIds.get(orderId);
+ if (ledgerSet == null || ledgerSet.isEmpty()) {
+ continue;
+ }
+ mainIdToLedgers.put(main.getId(), ledgerSet);
+ }
+ if (mainIdToLedgers.isEmpty()) {
+ return ProductionCostContext.empty();
+ }
+
+ LambdaQueryWrapper<ProductionAccount> accountWrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(accountWrapper, loginUser.getCurrentDeptId(), ProductionAccount::getDeptId);
+ accountWrapper.in(ProductionAccount::getProductionProductMainId, mainIdToLedgers.keySet());
+ if (range.hasDateFilter()) {
+ accountWrapper.ge(ProductionAccount::getSchedulingDate, range.start().atStartOfDay())
+ .lt(ProductionAccount::getSchedulingDate, range.end().plusDays(1).atStartOfDay());
+ }
+ List<ProductionAccount> accountList = defaultList(productionAccountMapper.selectList(accountWrapper));
+
+ Map<String, BigDecimal> salaryQuotaByOperation = defaultList(technologyOperationMapper.selectList(new LambdaQueryWrapper<TechnologyOperation>()
+ .select(TechnologyOperation::getName, TechnologyOperation::getSalaryQuota)))
+ .stream()
+ .filter(item -> StringUtils.hasText(item.getName()))
+ .collect(Collectors.toMap(TechnologyOperation::getName, item -> defaultDecimal(item.getSalaryQuota()), (a, b) -> a));
+
+ Map<Long, BigDecimal> laborCostByLedger = new HashMap<>();
+ Map<String, BigDecimal> processCostMap = new HashMap<>();
+ for (ProductionAccount account : accountList) {
+ Set<Long> ledgerSet = mainIdToLedgers.get(account.getProductionProductMainId());
+ if (ledgerSet == null || ledgerSet.isEmpty()) {
+ continue;
+ }
+ BigDecimal cost = estimateLaborCost(account, salaryQuotaByOperation);
+ if (cost.compareTo(BigDecimal.ZERO) <= 0) {
+ continue;
+ }
+ BigDecimal split = cost.divide(new BigDecimal(ledgerSet.size()), 4, RoundingMode.HALF_UP);
+ for (Long ledgerId : ledgerSet) {
+ laborCostByLedger.merge(ledgerId, split, BigDecimal::add);
+ }
+ processCostMap.merge(safe(account.getTechnologyOperationName()), cost, BigDecimal::add);
+ }
+
+ LambdaQueryWrapper<ProductionProductOutput> outputWrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(outputWrapper, loginUser.getCurrentDeptId(), ProductionProductOutput::getDeptId);
+ outputWrapper.in(ProductionProductOutput::getProductionProductMainId, mainIdToLedgers.keySet());
+ if (range.hasDateFilter()) {
+ outputWrapper.ge(ProductionProductOutput::getCreateTime, range.start().atStartOfDay())
+ .lt(ProductionProductOutput::getCreateTime, range.end().plusDays(1).atStartOfDay());
+ }
+ List<ProductionProductOutput> outputList = defaultList(productionProductOutputMapper.selectList(outputWrapper));
+ Map<Long, BigDecimal> scrapCostByLedger = new HashMap<>();
+ for (ProductionProductOutput output : outputList) {
+ Set<Long> ledgerSet = mainIdToLedgers.get(output.getProductionProductMainId());
+ if (ledgerSet == null || ledgerSet.isEmpty()) {
+ continue;
+ }
+ BigDecimal scrapQty = defaultDecimal(output.getScrapQty());
+ if (scrapQty.compareTo(BigDecimal.ZERO) <= 0) {
+ continue;
+ }
+ BigDecimal unitCost = avgUnitCostByModelId.getOrDefault(output.getProductModelId(), BigDecimal.ZERO);
+ BigDecimal scrapCost = scrapQty.multiply(unitCost);
+ BigDecimal split = scrapCost.divide(new BigDecimal(ledgerSet.size()), 4, RoundingMode.HALF_UP);
+ for (Long ledgerId : ledgerSet) {
+ scrapCostByLedger.merge(ledgerId, split, BigDecimal::add);
+ }
+ }
+
+ Map<String, BigDecimal> processCostRanking = processCostMap.entrySet().stream()
+ .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed())
+ .limit(10)
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new));
+
+ return new ProductionCostContext(laborCostByLedger, scrapCostByLedger, processCostRanking);
+ }
+
+ private List<SalesLedger> querySalesLedgers(LoginUser loginUser, DateRange range, String keyword, Integer limit) {
+ LambdaQueryWrapper<SalesLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), SalesLedger::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesLedger::getDeptId);
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(SalesLedger::getSalesContractNo, keyword)
+ .or().like(SalesLedger::getCustomerContractNo, keyword)
+ .or().like(SalesLedger::getCustomerName, keyword)
+ .or().like(SalesLedger::getProjectName, keyword)
+ .or().like(SalesLedger::getSalesman, keyword));
+ }
+ if (range.hasDateFilter()) {
+ wrapper.ge(SalesLedger::getEntryDate, toDate(range.start()))
+ .lt(SalesLedger::getEntryDate, toExclusiveEndDate(range.end()));
+ }
+ wrapper.orderByDesc(SalesLedger::getEntryDate, SalesLedger::getId);
+ if (limit != null && limit > 0) {
+ wrapper.last("limit " + normalizeLimit(limit));
+ }
+ return defaultList(salesLedgerMapper.selectList(wrapper));
+ }
+
+ private List<SalesLedgerProduct> queryLedgerProducts(LoginUser loginUser, List<Long> ledgerIds) {
+ if (ledgerIds == null || ledgerIds.isEmpty()) {
+ return List.of();
+ }
+ LambdaQueryWrapper<SalesLedgerProduct> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesLedgerProduct::getDeptId);
+ wrapper.in(SalesLedgerProduct::getSalesLedgerId, ledgerIds)
+ .eq(SalesLedgerProduct::getType, 1);
+ return defaultList(salesLedgerProductMapper.selectList(wrapper));
+ }
+
+ private List<StockInventory> queryStockInventory(LoginUser loginUser) {
+ LambdaQueryWrapper<StockInventory> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), StockInventory::getDeptId);
+ return defaultList(stockInventoryMapper.selectList(wrapper));
+ }
+
+ private Map<Long, ProductModel> queryProductModels(Set<Long> modelIds) {
+ if (modelIds == null || modelIds.isEmpty()) {
+ return defaultList(productModelMapper.selectList(null)).stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(ProductModel::getId, item -> item, (a, b) -> a));
+ }
+ LambdaQueryWrapper<ProductModel> wrapper = new LambdaQueryWrapper<>();
+ wrapper.in(ProductModel::getId, modelIds);
+ return defaultList(productModelMapper.selectList(wrapper)).stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(ProductModel::getId, item -> item, (a, b) -> a));
+ }
+
+ private Map<Long, Product> queryProducts(Collection<ProductModel> models) {
+ Set<Long> productIds = models == null ? Set.of() : models.stream()
+ .map(ProductModel::getProductId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ if (productIds.isEmpty()) {
+ return Map.of();
+ }
+ LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
+ wrapper.in(Product::getId, productIds);
+ return defaultList(productMapper.selectList(wrapper)).stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(Product::getId, item -> item, (a, b) -> a));
+ }
+
+ private Map<Long, BigDecimal> queryAverageUnitCostByModel(LoginUser loginUser, Set<Long> productModelIds) {
+ LambdaQueryWrapper<ProcurementRecordStorage> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), ProcurementRecordStorage::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProcurementRecordStorage::getDeptId);
+ wrapper.in(ProcurementRecordStorage::getType, List.of(1, 2));
+ if (productModelIds != null && !productModelIds.isEmpty()) {
+ wrapper.in(ProcurementRecordStorage::getProductModelId, productModelIds);
+ }
+ List<ProcurementRecordStorage> rows = defaultList(procurementRecordMapper.selectList(wrapper));
+ Map<Long, BigDecimal> amountByModel = new HashMap<>();
+ Map<Long, BigDecimal> qtyByModel = new HashMap<>();
+ for (ProcurementRecordStorage row : rows) {
+ if (row.getProductModelId() == null) {
+ continue;
+ }
+ BigDecimal qty = defaultDecimal(row.getInboundNum());
+ if (qty.compareTo(BigDecimal.ZERO) <= 0) {
+ continue;
+ }
+ BigDecimal amount = defaultDecimal(row.getUnitPrice()).multiply(qty);
+ amountByModel.merge(row.getProductModelId(), amount, BigDecimal::add);
+ qtyByModel.merge(row.getProductModelId(), qty, BigDecimal::add);
+ }
+ Map<Long, BigDecimal> result = new HashMap<>();
+ for (Map.Entry<Long, BigDecimal> entry : amountByModel.entrySet()) {
+ BigDecimal qty = qtyByModel.get(entry.getKey());
+ if (qty == null || qty.compareTo(BigDecimal.ZERO) <= 0) {
+ continue;
+ }
+ result.put(entry.getKey(), entry.getValue().divide(qty, 6, RoundingMode.HALF_UP));
+ }
+ return result;
+ }
+
+ private OutboundStats queryOutboundStats(LoginUser loginUser, Set<Long> productModelIds, DateRange range) {
+ LambdaQueryWrapper<ProcurementRecordOut> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), ProcurementRecordOut::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProcurementRecordOut::getDeptId);
+ if (productModelIds != null && !productModelIds.isEmpty()) {
+ wrapper.in(ProcurementRecordOut::getProductModelId, productModelIds);
+ }
+ if (range.hasDateFilter()) {
+ wrapper.ge(ProcurementRecordOut::getCreateTime, range.start().atStartOfDay())
+ .lt(ProcurementRecordOut::getCreateTime, range.end().plusDays(1).atStartOfDay());
+ }
+ List<ProcurementRecordOut> outList = defaultList(procurementRecordOutMapper.selectList(wrapper));
+ if (outList.isEmpty()) {
+ return OutboundStats.empty();
+ }
+ Set<Integer> storageIds = outList.stream()
+ .map(ProcurementRecordOut::getProcurementRecordStorageId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ Map<Integer, ProcurementRecordStorage> storageMap = storageIds.isEmpty()
+ ? Map.of()
+ : defaultList(procurementRecordMapper.selectBatchIds(storageIds)).stream()
+ .collect(Collectors.toMap(ProcurementRecordStorage::getId, item -> item, (a, b) -> a));
+
+ Map<Long, BigDecimal> outboundQtyByModel = new HashMap<>();
+ Map<Long, LocalDateTime> lastOutboundTimeByModel = new HashMap<>();
+ BigDecimal totalOutboundCost = BigDecimal.ZERO;
+ for (ProcurementRecordOut out : outList) {
+ Long modelId = out.getProductModelId();
+ if (modelId == null) {
+ continue;
+ }
+ BigDecimal qty = defaultDecimal(out.getInboundNum());
+ outboundQtyByModel.merge(modelId, qty, BigDecimal::add);
+ if (out.getCreateTime() != null) {
+ LocalDateTime existing = lastOutboundTimeByModel.get(modelId);
+ if (existing == null || out.getCreateTime().isAfter(existing)) {
+ lastOutboundTimeByModel.put(modelId, out.getCreateTime());
+ }
+ }
+ ProcurementRecordStorage storage = storageMap.get(out.getProcurementRecordStorageId());
+ BigDecimal unitPrice = storage == null ? BigDecimal.ZERO : defaultDecimal(storage.getUnitPrice());
+ totalOutboundCost = totalOutboundCost.add(unitPrice.multiply(qty));
+ }
+ return new OutboundStats(outboundQtyByModel, lastOutboundTimeByModel, totalOutboundCost);
+ }
+
+ private List<InventoryMetric> buildInventoryMetrics(List<StockInventory> inventoryRows,
+ Map<Long, ProductModel> productModelMap,
+ Map<Long, Product> productMap,
+ Map<Long, BigDecimal> avgUnitCostByModelId,
+ OutboundStats outboundStats) {
+ Map<Long, InventoryMetricBuilder> metricBuilderByModel = new HashMap<>();
+ for (StockInventory row : inventoryRows) {
+ if (row.getProductModelId() == null) {
+ continue;
+ }
+ InventoryMetricBuilder builder = metricBuilderByModel.computeIfAbsent(row.getProductModelId(), InventoryMetricBuilder::new);
+ builder.addQuantity(maxZero(defaultDecimal(row.getQualitity()).subtract(defaultDecimal(row.getLockedQuantity()))));
+ builder.addLockedQuantity(defaultDecimal(row.getLockedQuantity()));
+ builder.addWarnNum(defaultDecimal(row.getWarnNum()));
+ if (row.getCreateTime() != null) {
+ builder.updateFirstInTime(row.getCreateTime());
+ }
+ }
+
+ List<InventoryMetric> result = new ArrayList<>();
+ LocalDate today = LocalDate.now();
+ for (InventoryMetricBuilder builder : metricBuilderByModel.values()) {
+ Long modelId = builder.modelId();
+ ProductModel model = productModelMap.get(modelId);
+ Product product = model == null ? null : productMap.get(model.getProductId());
+ BigDecimal unitCost = avgUnitCostByModelId.getOrDefault(modelId, BigDecimal.ZERO);
+ BigDecimal value = builder.quantity().multiply(unitCost);
+ LocalDateTime lastOutTime = outboundStats.lastOutboundTimeByModel().get(modelId);
+ long stagnantDays;
+ if (lastOutTime != null) {
+ stagnantDays = daysBetween(lastOutTime.toLocalDate(), today);
+ } else if (builder.firstInTime() != null) {
+ stagnantDays = daysBetween(builder.firstInTime().toLocalDate(), today);
+ } else {
+ stagnantDays = 0;
+ }
+ BigDecimal outQty = outboundStats.outboundQtyByModel().getOrDefault(modelId, BigDecimal.ZERO);
+ boolean overstock = builder.warnNum().compareTo(BigDecimal.ZERO) > 0
+ && builder.quantity().compareTo(builder.warnNum().multiply(new BigDecimal("3"))) > 0;
+ result.add(new InventoryMetric(
+ modelId,
+ product == null ? "鏈煡浜у搧" : safe(product.getProductName()),
+ model == null ? "鏈煡鍨嬪彿" : safe(model.getModel()),
+ builder.quantity(),
+ builder.lockedQuantity(),
+ unitCost,
+ value,
+ outQty,
+ stagnantDays,
+ overstock
+ ));
+ }
+ return result;
+ }
+
+ private List<AccountSalesCollection> queryCollections(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId);
+ if (range.hasDateFilter()) {
+ wrapper.ge(AccountSalesCollection::getCollectionDate, range.start())
+ .le(AccountSalesCollection::getCollectionDate, range.end());
+ }
+ wrapper.orderByAsc(AccountSalesCollection::getCollectionDate);
+ return defaultList(accountSalesCollectionMapper.selectList(wrapper));
+ }
+
+ private List<AccountPurchasePayment> queryPayments(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<AccountPurchasePayment> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchasePayment::getDeptId);
+ if (range.hasDateFilter()) {
+ wrapper.ge(AccountPurchasePayment::getPaymentDate, range.start())
+ .le(AccountPurchasePayment::getPaymentDate, range.end());
+ }
+ wrapper.orderByAsc(AccountPurchasePayment::getPaymentDate);
+ return defaultList(accountPurchasePaymentMapper.selectList(wrapper));
+ }
+
+ private List<MonthlyCashFlow> buildMonthlyCashFlow(DateRange range,
+ List<AccountSalesCollection> collections,
+ List<AccountPurchasePayment> payments) {
+ Map<YearMonth, BigDecimal> incomeByMonth = new LinkedHashMap<>();
+ Map<YearMonth, BigDecimal> expenseByMonth = new LinkedHashMap<>();
+ DateRange monthlyRange = range.hasDateFilter() ? range : inferCashFlowRange(collections, payments);
+ if (!monthlyRange.hasDateFilter()) {
+ return List.of();
+ }
+ YearMonth startMonth = YearMonth.from(monthlyRange.start());
+ YearMonth endMonth = YearMonth.from(monthlyRange.end());
+ for (YearMonth month = startMonth; !month.isAfter(endMonth); month = month.plusMonths(1)) {
+ incomeByMonth.put(month, BigDecimal.ZERO);
+ expenseByMonth.put(month, BigDecimal.ZERO);
+ }
+
+ for (AccountSalesCollection row : collections) {
+ if (row.getCollectionDate() == null) {
+ continue;
+ }
+ YearMonth month = YearMonth.from(row.getCollectionDate());
+ if (incomeByMonth.containsKey(month)) {
+ incomeByMonth.put(month, incomeByMonth.get(month).add(defaultDecimal(row.getCollectionAmount())));
+ }
+ }
+ for (AccountPurchasePayment row : payments) {
+ if (row.getPaymentDate() == null) {
+ continue;
+ }
+ YearMonth month = YearMonth.from(row.getPaymentDate());
+ if (expenseByMonth.containsKey(month)) {
+ expenseByMonth.put(month, expenseByMonth.get(month).add(defaultDecimal(row.getPaymentAmount())));
+ }
+ }
+
+ List<MonthlyCashFlow> result = new ArrayList<>();
+ for (YearMonth month : incomeByMonth.keySet()) {
+ BigDecimal income = incomeByMonth.get(month);
+ BigDecimal expense = expenseByMonth.getOrDefault(month, BigDecimal.ZERO);
+ result.add(new MonthlyCashFlow(month.toString(), income, expense, income.subtract(expense)));
+ }
+ return result;
+ }
+
+ private DateRange inferCashFlowRange(List<AccountSalesCollection> collections,
+ List<AccountPurchasePayment> payments) {
+ LocalDate min = null;
+ LocalDate max = null;
+ for (AccountSalesCollection row : defaultList(collections)) {
+ if (row.getCollectionDate() == null) {
+ continue;
+ }
+ min = min == null || row.getCollectionDate().isBefore(min) ? row.getCollectionDate() : min;
+ max = max == null || row.getCollectionDate().isAfter(max) ? row.getCollectionDate() : max;
+ }
+ for (AccountPurchasePayment row : defaultList(payments)) {
+ if (row.getPaymentDate() == null) {
+ continue;
+ }
+ min = min == null || row.getPaymentDate().isBefore(min) ? row.getPaymentDate() : min;
+ max = max == null || row.getPaymentDate().isAfter(max) ? row.getPaymentDate() : max;
+ }
+ return min == null || max == null ? new DateRange(null, null, "鍏ㄩ儴") : new DateRange(min, max, "鍏ㄩ儴");
+ }
+
+ private List<MonthlyCashFlow> forecastMonthlyCashFlow(List<MonthlyCashFlow> actual, int forecastMonths) {
+ if (actual.isEmpty()) {
+ List<MonthlyCashFlow> defaults = new ArrayList<>();
+ YearMonth now = YearMonth.now();
+ for (int i = 1; i <= forecastMonths; i++) {
+ YearMonth month = now.plusMonths(i);
+ defaults.add(new MonthlyCashFlow(month.toString(), BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO));
+ }
+ return defaults;
+ }
+ List<BigDecimal> series = actual.stream().map(MonthlyCashFlow::netFlow).toList();
+ BigDecimal avg = series.stream().reduce(BigDecimal.ZERO, BigDecimal::add)
+ .divide(new BigDecimal(series.size()), 4, RoundingMode.HALF_UP);
+ BigDecimal slope = BigDecimal.ZERO;
+ if (series.size() > 1) {
+ slope = series.get(series.size() - 1).subtract(series.get(0))
+ .divide(new BigDecimal(series.size() - 1), 4, RoundingMode.HALF_UP);
+ }
+ YearMonth lastMonth = YearMonth.parse(actual.get(actual.size() - 1).month());
+ List<MonthlyCashFlow> forecast = new ArrayList<>();
+ for (int i = 1; i <= forecastMonths; i++) {
+ YearMonth month = lastMonth.plusMonths(i);
+ BigDecimal net = avg.add(slope.multiply(new BigDecimal(i))).setScale(2, RoundingMode.HALF_UP);
+ BigDecimal income = net.compareTo(BigDecimal.ZERO) >= 0 ? net : BigDecimal.ZERO;
+ BigDecimal expense = net.compareTo(BigDecimal.ZERO) >= 0 ? BigDecimal.ZERO : net.abs();
+ forecast.add(new MonthlyCashFlow(month.toString(), income, expense, net));
+ }
+ return forecast;
+ }
+
+ private StatementSnapshot buildStatementSnapshot(LoginUser loginUser) {
+ LambdaQueryWrapper<AccountStatement> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountStatement::getDeptId);
+ wrapper.orderByDesc(AccountStatement::getStatementMonth);
+ List<AccountStatement> rows = defaultList(accountStatementMapper.selectList(wrapper));
+ if (rows.isEmpty()) {
+ return StatementSnapshot.empty();
+ }
+
+ Map<String, AccountStatement> latestByEntity = new HashMap<>();
+ for (AccountStatement row : rows) {
+ if (row.getAccountType() == null || row.getCustomerId() == null || !StringUtils.hasText(row.getStatementMonth())) {
+ continue;
+ }
+ String key = row.getAccountType() + "::" + row.getCustomerId();
+ AccountStatement existing = latestByEntity.get(key);
+ if (existing == null || row.getStatementMonth().compareTo(existing.getStatementMonth()) > 0) {
+ latestByEntity.put(key, row);
+ }
+ }
+
+ BigDecimal receivableTotal = BigDecimal.ZERO;
+ BigDecimal payableTotal = BigDecimal.ZERO;
+ List<StatementMetric> receivableMetrics = new ArrayList<>();
+ List<StatementMetric> payableMetrics = new ArrayList<>();
+ for (AccountStatement row : latestByEntity.values()) {
+ BigDecimal closing = defaultDecimal(row.getClosingBalance());
+ if (Objects.equals(row.getAccountType(), 1)) {
+ receivableTotal = receivableTotal.add(closing);
+ receivableMetrics.add(new StatementMetric(String.valueOf(row.getCustomerId()), closing,
+ defaultDecimal(row.getCurrentPlan()), defaultDecimal(row.getCurrentActually()), safe(row.getStatementMonth())));
+ } else if (Objects.equals(row.getAccountType(), 2)) {
+ payableTotal = payableTotal.add(closing);
+ payableMetrics.add(new StatementMetric(String.valueOf(row.getCustomerId()), closing,
+ defaultDecimal(row.getCurrentPlan()), defaultDecimal(row.getCurrentActually()), safe(row.getStatementMonth())));
+ }
+ }
+ receivableMetrics.sort(Comparator.comparing(StatementMetric::closingBalance).reversed());
+ payableMetrics.sort(Comparator.comparing(StatementMetric::closingBalance).reversed());
+
+ return new StatementSnapshot(
+ receivableTotal,
+ payableTotal,
+ receivableMetrics.stream().limit(10).toList(),
+ payableMetrics.stream().limit(10).toList()
+ );
+ }
+
+ private BigDecimal calculateTotalDepreciation(LoginUser loginUser) {
+ LambdaQueryWrapper<DeviceLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceLedger::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceLedger::getDeptId);
+ wrapper.eq(DeviceLedger::getIsDepr, 1);
+ List<DeviceLedger> devices = defaultList(deviceLedgerMapper.selectList(wrapper));
+ BigDecimal total = BigDecimal.ZERO;
+ for (DeviceLedger device : devices) {
+ total = total.add(defaultDecimal(AccountingServiceImpl.calculatePreciseDepreciation(device)));
+ }
+ return total;
+ }
+
+ private Map<Long, BigDecimal> allocateDepreciation(List<SalesLedger> ledgers, BigDecimal totalDepreciation, BigDecimal totalRevenue) {
+ if (ledgers.isEmpty() || totalDepreciation.compareTo(BigDecimal.ZERO) <= 0) {
+ return Map.of();
+ }
+ Map<Long, BigDecimal> result = new HashMap<>();
+ if (totalRevenue.compareTo(BigDecimal.ZERO) <= 0) {
+ BigDecimal avg = totalDepreciation.divide(new BigDecimal(ledgers.size()), 4, RoundingMode.HALF_UP);
+ for (SalesLedger ledger : ledgers) {
+ result.put(ledger.getId(), avg);
+ }
+ return result;
+ }
+ for (SalesLedger ledger : ledgers) {
+ BigDecimal revenue = defaultDecimal(ledger.getContractAmount());
+ BigDecimal ratio = revenue.divide(totalRevenue, 6, RoundingMode.HALF_UP);
+ result.put(ledger.getId(), totalDepreciation.multiply(ratio));
+ }
+ return result;
+ }
+
+ private BigDecimal fallbackMaterialCost(List<SalesLedgerProduct> products, BigDecimal revenue) {
+ if (products != null && !products.isEmpty()) {
+ BigDecimal productAmount = products.stream()
+ .map(SalesLedgerProduct::getTaxExclusiveTotalPrice)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ if (productAmount.compareTo(BigDecimal.ZERO) > 0) {
+ return productAmount;
+ }
+ }
+
+ BigDecimal materialCost = revenue.multiply(DEFAULT_FALLBACK_MATERIAL_COST_RATE);
+ BigDecimal laborCost = revenue.multiply(DEFAULT_LABOR_COST_RATE);
+ BigDecimal overheadCost = revenue.multiply(DEFAULT_OVERHEAD_COST_RATE);
+
+ return materialCost.add(laborCost).add(overheadCost);
+ }
+
+ private BigDecimal estimateTotalCost(BigDecimal revenue, List<SalesLedgerProduct> products) {
+ if (revenue == null || revenue.compareTo(BigDecimal.ZERO) <= 0) {
+ return BigDecimal.ZERO;
+ }
+
+ BigDecimal materialCost = BigDecimal.ZERO;
+ if (products != null && !products.isEmpty()) {
+ materialCost = products.stream()
+ .map(SalesLedgerProduct::getTaxExclusiveTotalPrice)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ }
+
+ if (materialCost.compareTo(BigDecimal.ZERO) <= 0) {
+ materialCost = revenue.multiply(DEFAULT_FALLBACK_MATERIAL_COST_RATE);
+ }
+
+ BigDecimal laborCost = revenue.multiply(DEFAULT_LABOR_COST_RATE);
+ BigDecimal overheadCost = revenue.multiply(DEFAULT_OVERHEAD_COST_RATE);
+
+ return materialCost.add(laborCost).add(overheadCost);
+ }
+
+ private Map<String, String> queryCustomerNameMap(Set<String> idSet) {
+ if (idSet == null || idSet.isEmpty()) {
+ return Map.of();
+ }
+ Set<Long> ids = idSet.stream()
+ .map(this::toLongOrNull)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ if (ids.isEmpty()) {
+ return Map.of();
+ }
+ LambdaQueryWrapper<Customer> wrapper = new LambdaQueryWrapper<>();
+ wrapper.in(Customer::getId, ids);
+ return defaultList(customerMapper.selectList(wrapper)).stream()
+ .collect(Collectors.toMap(item -> String.valueOf(item.getId()), Customer::getCustomerName, (a, b) -> a));
+ }
+
+ private Map<String, String> querySupplierNameMap(Set<String> idSet) {
+ if (idSet == null || idSet.isEmpty()) {
+ return Map.of();
+ }
+ Set<Long> ids = idSet.stream()
+ .map(this::toLongOrNull)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ if (ids.isEmpty()) {
+ return Map.of();
+ }
+ LambdaQueryWrapper<SupplierManage> wrapper = new LambdaQueryWrapper<>();
+ wrapper.in(SupplierManage::getId, ids);
+ return defaultList(supplierManageMapper.selectList(wrapper)).stream()
+ .collect(Collectors.toMap(item -> String.valueOf(item.getId()), SupplierManage::getSupplierName, (a, b) -> a));
+ }
+
+ private String riskLevelByAmount(BigDecimal amount) {
+ if (amount.compareTo(new BigDecimal("5000000")) >= 0) {
+ return "high";
+ }
+ if (amount.compareTo(new BigDecimal("1000000")) >= 0) {
+ return "medium";
+ }
+ return "low";
+ }
+
+ private long countDevices(LoginUser loginUser) {
+ LambdaQueryWrapper<DeviceLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceLedger::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceLedger::getDeptId);
+ return deviceLedgerMapper.selectCount(wrapper);
+ }
+
+ private long countRepairingDevices(LoginUser loginUser) {
+ LambdaQueryWrapper<DeviceRepair> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceRepair::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceRepair::getDeptId);
+ wrapper.in(DeviceRepair::getStatus, List.of(0, 3));
+ return deviceRepairMapper.selectCount(wrapper);
+ }
+
+ private BigDecimal estimateInventoryValue(LoginUser loginUser, List<StockInventory> inventories) {
+ if (inventories == null || inventories.isEmpty()) {
+ return BigDecimal.ZERO;
+ }
+ Set<Long> modelIds = inventories.stream().map(StockInventory::getProductModelId).filter(Objects::nonNull).collect(Collectors.toSet());
+ Map<Long, BigDecimal> costMap = queryAverageUnitCostByModel(loginUser, modelIds);
+ BigDecimal total = BigDecimal.ZERO;
+ for (StockInventory inventory : inventories) {
+ BigDecimal qty = maxZero(defaultDecimal(inventory.getQualitity()).subtract(defaultDecimal(inventory.getLockedQuantity())));
+ BigDecimal unit = costMap.getOrDefault(inventory.getProductModelId(), BigDecimal.ZERO);
+ total = total.add(qty.multiply(unit));
+ }
+ return total;
+ }
+
+ private DateRange previousSameLengthRange(DateRange range) {
+ if (!range.hasDateFilter()) {
+ return new DateRange(null, null, "鍏ㄩ儴");
+ }
+ long days = daysBetween(range.start(), range.end()) + 1L;
+ LocalDate prevEnd = range.start().minusDays(1);
+ LocalDate prevStart = prevEnd.minusDays(days - 1L);
+ return new DateRange(prevStart, prevEnd, prevStart + "鑷�" + prevEnd);
+ }
+
+ private List<String> buildProfitReasons(BigDecimal revenue,
+ BigDecimal materialCost,
+ BigDecimal laborCost,
+ BigDecimal scrapCost,
+ BigDecimal profit,
+ BigDecimal profitRate) {
+ List<String> reasons = new ArrayList<>();
+ BigDecimal materialRate = rate(materialCost, revenue);
+ if (materialRate.compareTo(new BigDecimal("0.70")) >= 0) {
+ reasons.add("鏉愭枡鎴愭湰鍗犳瘮瓒呰繃70%");
+ } else if (materialRate.compareTo(new BigDecimal("0.55")) >= 0) {
+ reasons.add("鏉愭枡鎴愭湰鍗犳瘮鍋忛珮");
+ }
+ BigDecimal laborRate = rate(laborCost, revenue);
+ if (laborRate.compareTo(new BigDecimal("0.20")) >= 0) {
+ reasons.add("浜哄伐鎴愭湰鍗犳瘮瓒呰繃20%");
+ } else if (laborRate.compareTo(new BigDecimal("0.12")) >= 0) {
+ reasons.add("浜哄伐鎴愭湰澧為暱鍋忓揩");
+ }
+ BigDecimal scrapRate = rate(scrapCost, revenue);
+ if (scrapRate.compareTo(new BigDecimal("0.05")) >= 0) {
+ reasons.add("鎶ュ簾鎹熻�楀崰姣斿亸楂�");
+ }
+ if (profit.compareTo(BigDecimal.ZERO) < 0) {
+ reasons.add("璁㈠崟澶勪簬浜忔崯鐘舵��");
+ } else if (profitRate.compareTo(new BigDecimal("0.08")) < 0) {
+ reasons.add("鍒╂鼎鐜囦綆浜�8%");
+ }
+ if (reasons.isEmpty()) {
+ reasons.add("鎴愭湰缁撴瀯澶勪簬鍚堢悊鍖洪棿");
+ }
+ return reasons;
+ }
+
+ private String buildProfitSuggestion(String riskLevel, List<String> reasons) {
+ if ("high".equals(riskLevel)) {
+ return "浼樺厛澶嶆牳BOM鐢ㄩ噺涓庡伐搴忓畾棰濓紝蹇呰鏃惰皟鏁存姤浠峰拰浠樻鏉℃锛屽苟闄愬埗瓒呰处鏈熶氦浠樸��";
+ }
+ if ("medium".equals(riskLevel)) {
+ return "寤鸿浼樺寲閲囪喘鎵规鍜屽伐搴忔帓浜э紝鎻愬崌涓�娆″悎鏍肩巼骞跺悓姝ユ墽琛屾瘺鍒╅璀︺��";
+ }
+ if (reasons.stream().anyMatch(item -> item.contains("鏉愭枡"))) {
+ return "淇濇寔鏉愭枡閲囪喘鎴愭湰鐪嬫澘锛屾寜鍛ㄨ窡韪富瑕佹潗鏂欏崟浠锋尝鍔ㄣ��";
+ }
+ return "缁存寔褰撳墠缁忚惀鑺傚锛岀户缁窡韪鍗曞埄娑︾巼鍜屽洖娆炬晥鐜囥��";
+ }
+
+ private Map<String, Object> toOrderCostItem(OrderProfitMetric metric) {
+ Map<String, Object> item = new LinkedHashMap<>();
+ item.put("ledgerId", metric.ledgerId());
+ item.put("salesContractNo", metric.salesContractNo());
+ item.put("customerName", metric.customerName());
+ item.put("projectName", metric.projectName());
+ item.put("entryDate", formatDate(metric.entryDate()));
+ item.put("deliveryDate", formatDate(metric.deliveryDate()));
+ item.put("revenue", metric.revenue());
+ item.put("materialCost", metric.materialCost());
+ item.put("laborCost", metric.laborCost());
+ item.put("depreciationCost", metric.depreciationCost());
+ item.put("scrapCost", metric.scrapCost());
+ item.put("totalCost", metric.totalCost());
+ item.put("profit", metric.profit());
+ item.put("profitRate", toPercent(metric.profitRate()));
+ item.put("riskLevel", metric.riskLevel());
+ item.put("reasons", metric.reasons());
+ item.put("suggestion", metric.suggestion());
+ return item;
+ }
+
+ private Map<String, Object> toRiskOrderItem(OrderProfitMetric metric) {
+ Map<String, Object> map = toOrderCostItem(metric);
+ map.put("priority", "high".equals(metric.riskLevel()) ? "high" : ("medium".equals(metric.riskLevel()) ? "medium" : "low"));
+ return map;
+ }
+
+ private List<Map<String, Object>> buildCustomerProfitTop(List<OrderProfitMetric> metrics, int topN) {
+ Map<String, BigDecimal> customerProfitMap = new HashMap<>();
+ Map<String, BigDecimal> customerRevenueMap = new HashMap<>();
+ for (OrderProfitMetric metric : metrics) {
+ customerProfitMap.merge(metric.customerName(), metric.profit(), BigDecimal::add);
+ customerRevenueMap.merge(metric.customerName(), metric.revenue(), BigDecimal::add);
+ }
+ return customerProfitMap.entrySet().stream()
+ .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed())
+ .limit(topN)
+ .map(entry -> {
+ Map<String, Object> map = new LinkedHashMap<>();
+ BigDecimal revenue = customerRevenueMap.getOrDefault(entry.getKey(), BigDecimal.ZERO);
+ map.put("customerName", entry.getKey());
+ map.put("profit", entry.getValue());
+ map.put("revenue", revenue);
+ map.put("profitRate", toPercent(rate(entry.getValue(), revenue)));
+ return map;
+ })
+ .toList();
+ }
+
+ private Map<String, Object> toInventoryItem(InventoryMetric metric) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("productModelId", metric.modelId());
+ map.put("productName", metric.productName());
+ map.put("model", metric.modelName());
+ map.put("quantity", metric.quantity());
+ map.put("lockedQuantity", metric.lockedQuantity());
+ map.put("avgUnitCost", metric.avgUnitCost());
+ map.put("inventoryValue", metric.inventoryValue());
+ map.put("outboundQuantity", metric.outboundQuantity());
+ map.put("stagnantDays", metric.stagnantDays());
+ map.put("overstock", metric.overstock());
+ map.put("riskLevel", metric.stagnantDays() >= 90 ? "high" : (metric.stagnantDays() >= 30 ? "medium" : "low"));
+ return map;
+ }
+
+ private boolean matchInventoryKeyword(InventoryMetric metric, String keyword) {
+ if (!StringUtils.hasText(keyword)) {
+ return true;
+ }
+ return metric.productName().contains(keyword.trim()) || metric.modelName().contains(keyword.trim());
+ }
+
+ private Map<String, Object> toMonthlyCashFlowItem(MonthlyCashFlow flow) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("month", flow.month());
+ map.put("income", flow.income());
+ map.put("expense", flow.expense());
+ map.put("netFlow", flow.netFlow());
+ return map;
+ }
+
+ private Map<String, Object> toStatementRiskItem(StatementMetric metric, Map<String, String> nameMap, String type) {
+ BigDecimal actualRate = rate(metric.actualAmount(), metric.planAmount());
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put(type + "Id", metric.entityId());
+ map.put(type + "Name", safe(nameMap.get(metric.entityId())));
+ map.put("statementMonth", metric.statementMonth());
+ map.put("closingBalance", metric.closingBalance());
+ map.put("planAmount", metric.planAmount());
+ map.put("actualAmount", metric.actualAmount());
+ map.put("actualRate", toPercent(actualRate));
+ map.put("riskLevel", metric.closingBalance().compareTo(new BigDecimal("1000000")) > 0 || actualRate.compareTo(new BigDecimal("0.50")) < 0 ? "high" : "medium");
+ return map;
+ }
+
+ private Map<String, Object> anomalyItem(String level, String type, String message, Map<String, Object> detail) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("riskLevel", level);
+ map.put("type", type);
+ map.put("message", message);
+ map.put("detail", detail);
+ return map;
+ }
+
+ private Map<String, Object> riskSuggestion(String type, String level, String suggestion) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("type", type);
+ map.put("level", level);
+ map.put("suggestion", suggestion);
+ return map;
+ }
+
+ private Map<String, Object> buildCostCompositionPie(BigDecimal material, BigDecimal labor, BigDecimal depreciation, BigDecimal scrap) {
+ List<Map<String, Object>> data = List.of(
+ Map.of("name", "鏉愭枡鎴愭湰", "value", material),
+ Map.of("name", "浜哄伐鎴愭湰", "value", labor),
+ Map.of("name", "鎶樻棫鎴愭湰", "value", depreciation),
+ Map.of("name", "鎹熻�楁垚鏈�", "value", scrap)
+ );
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "鎴愭湰鏋勬垚", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "item"));
+ option.put("series", List.of(Map.of("name", "鎴愭湰鏋勬垚", "type", "pie", "radius", "60%", "data", data)));
+ return option;
+ }
+
+ private Map<String, Object> buildOrderProfitBar(List<OrderProfitMetric> metrics) {
+ List<OrderProfitMetric> top = metrics.stream()
+ .sorted(Comparator.comparing(OrderProfitMetric::profit))
+ .limit(10)
+ .toList();
+ List<String> xData = top.stream().map(OrderProfitMetric::salesContractNo).toList();
+ List<BigDecimal> yData = top.stream().map(OrderProfitMetric::profit).toList();
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "璁㈠崟鍒╂鼎鍒嗗竷", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "鍒╂鼎", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildProcessCostBar(Map<String, BigDecimal> processCosts) {
+ List<String> xData = new ArrayList<>(processCosts.keySet());
+ List<BigDecimal> yData = new ArrayList<>(processCosts.values());
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "宸ュ簭鎴愭湰鎺掑悕", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "鎴愭湰", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildProfitDistributionBar(List<OrderProfitMetric> metrics) {
+ List<OrderProfitMetric> sorted = metrics.stream()
+ .sorted(Comparator.comparing(OrderProfitMetric::profitRate))
+ .limit(15)
+ .toList();
+ List<String> xData = sorted.stream().map(OrderProfitMetric::salesContractNo).toList();
+ List<BigDecimal> yData = sorted.stream().map(metric -> metric.profitRate().multiply(ONE_HUNDRED).setScale(2, RoundingMode.HALF_UP)).toList();
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "璁㈠崟鍒╂鼎鐜囧垎甯�", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value", "name", "%"));
+ option.put("series", List.of(Map.of("name", "鍒╂鼎鐜�", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildLossOrderTrendLine(List<OrderProfitMetric> metrics) {
+ Map<String, Long> lossByDate = new LinkedHashMap<>();
+ List<OrderProfitMetric> sorted = metrics.stream()
+ .filter(metric -> metric.entryDate() != null)
+ .sorted(Comparator.comparing(OrderProfitMetric::entryDate))
+ .toList();
+ for (OrderProfitMetric metric : sorted) {
+ String day = formatDate(metric.entryDate());
+ long inc = metric.profit().compareTo(BigDecimal.ZERO) < 0 ? 1L : 0L;
+ lossByDate.merge(day, inc, Long::sum);
+ }
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "浜忔崯璁㈠崟瓒嬪娍", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", new ArrayList<>(lossByDate.keySet())));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "浜忔崯璁㈠崟鏁�", "type", "line", "smooth", true, "data", new ArrayList<>(lossByDate.values()))));
+ return option;
+ }
+
+ private Map<String, Object> buildCustomerProfitBar(Map<String, BigDecimal> customerProfitMap) {
+ List<Map.Entry<String, BigDecimal>> top = customerProfitMap.entrySet().stream()
+ .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed())
+ .limit(10)
+ .toList();
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "瀹㈡埛鍒╂鼎璐$尞TOP10", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", top.stream().map(Map.Entry::getKey).toList()));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "鍒╂鼎", "type", "bar", "data", top.stream().map(Map.Entry::getValue).toList())));
+ return option;
+ }
+
+ private Map<String, Object> buildInventoryTopBar(List<InventoryMetric> metrics) {
+ List<InventoryMetric> top = metrics.stream()
+ .sorted(Comparator.comparing(InventoryMetric::inventoryValue).reversed())
+ .limit(10)
+ .toList();
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "搴撳瓨璧勯噾鍗犵敤TOP10", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", top.stream().map(item -> item.productName() + "/" + item.modelName()).toList()));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "璧勯噾鍗犵敤", "type", "bar", "data", top.stream().map(InventoryMetric::inventoryValue).toList())));
+ return option;
+ }
+
+ private Map<String, Object> buildInventoryAgingPie(List<InventoryMetric> metrics) {
+ long normal = metrics.stream().filter(item -> item.stagnantDays() < 30).count();
+ long slow = metrics.stream().filter(item -> item.stagnantDays() >= 30 && item.stagnantDays() < 90).count();
+ long stagnant = metrics.stream().filter(item -> item.stagnantDays() >= 90).count();
+ List<Map<String, Object>> data = List.of(
+ Map.of("name", "姝e父", "value", normal),
+ Map.of("name", "缂撴參", "value", slow),
+ Map.of("name", "鍛嗘粸", "value", stagnant)
+ );
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "搴撳瓨搴撻緞鍒嗗竷", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "item"));
+ option.put("series", List.of(Map.of("type", "pie", "radius", "60%", "data", data)));
+ return option;
+ }
+
+ private Map<String, Object> buildTurnoverGauge(BigDecimal turnoverDays) {
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "搴撳瓨鍛ㄨ浆澶╂暟", "left", "center"));
+ option.put("series", List.of(Map.of(
+ "type", "gauge",
+ "min", 0,
+ "max", 180,
+ "detail", Map.of("formatter", "{value}澶�"),
+ "data", List.of(Map.of("value", turnoverDays, "name", "鍛ㄨ浆澶╂暟"))
+ )));
+ return option;
+ }
+
+ private Map<String, Object> buildCashflowTrend(List<MonthlyCashFlow> actual, List<MonthlyCashFlow> forecast) {
+ List<String> labels = new ArrayList<>();
+ List<BigDecimal> netActual = new ArrayList<>();
+ List<BigDecimal> netForecast = new ArrayList<>();
+ for (MonthlyCashFlow point : actual) {
+ labels.add(point.month());
+ netActual.add(point.netFlow());
+ netForecast.add(null);
+ }
+ for (MonthlyCashFlow point : forecast) {
+ labels.add(point.month());
+ netActual.add(null);
+ netForecast.add(point.netFlow());
+ }
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "鐜伴噾娴佽秼鍔匡紙瀹為檯+棰勬祴锛�", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", labels));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(
+ Map.of("name", "瀹為檯鍑�鐜伴噾娴�", "type", "line", "smooth", true, "data", netActual),
+ Map.of("name", "棰勬祴鍑�鐜伴噾娴�", "type", "line", "smooth", true, "data", netForecast)
+ ));
+ return option;
+ }
+
+ private Map<String, Object> buildReceivablePayableBar(BigDecimal receivable, BigDecimal payable) {
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "搴旀敹搴斾粯浣欓瀵规瘮", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", List.of("搴旀敹", "搴斾粯")));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "浣欓", "type", "bar", "data", List.of(receivable, payable))));
+ return option;
+ }
+
+ private Map<String, Object> buildFundGapGauge(BigDecimal fundGap) {
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "璧勯噾缂哄彛", "left", "center"));
+ option.put("series", List.of(Map.of(
+ "type", "gauge",
+ "min", 0,
+ "max", 10000000,
+ "detail", Map.of("formatter", "{value}"),
+ "data", List.of(Map.of("value", fundGap, "name", "璧勯噾缂哄彛"))
+ )));
+ return option;
+ }
+
+ private Map<String, Object> buildAnomalyLevelPie(List<Map<String, Object>> anomalies) {
+ long high = anomalies.stream().filter(item -> "high".equals(item.get("riskLevel"))).count();
+ long medium = anomalies.stream().filter(item -> "medium".equals(item.get("riskLevel"))).count();
+ long low = anomalies.stream().filter(item -> "low".equals(item.get("riskLevel"))).count();
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "寮傚父绛夌骇鍒嗗竷", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "item"));
+ option.put("series", List.of(Map.of("type", "pie", "radius", "60%", "data", List.of(
+ Map.of("name", "楂橀闄�", "value", high),
+ Map.of("name", "涓闄�", "value", medium),
+ Map.of("name", "浣庨闄�", "value", low)
+ ))));
+ return option;
+ }
+
+ private Map<String, Object> buildAnomalyTypeBar(List<Map<String, Object>> anomalies) {
+ Map<String, Long> countByType = new LinkedHashMap<>();
+ for (Map<String, Object> anomaly : anomalies) {
+ countByType.merge(String.valueOf(anomaly.get("type")), 1L, Long::sum);
+ }
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "寮傚父绫诲瀷鍒嗗竷", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", new ArrayList<>(countByType.keySet())));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "寮傚父鏁�", "type", "bar", "data", new ArrayList<>(countByType.values()))));
+ return option;
+ }
+
+ private Map<String, Object> buildInventoryProfitGauge(BigDecimal inventoryValue, BigDecimal profit) {
+ BigDecimal ratio = inventoryValue.compareTo(BigDecimal.ZERO) <= 0
+ ? BigDecimal.ZERO
+ : profit.divide(inventoryValue, 4, RoundingMode.HALF_UP).multiply(ONE_HUNDRED);
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "鍒╂鼎/搴撳瓨璧勯噾姣�", "left", "center"));
+ option.put("series", List.of(Map.of(
+ "type", "gauge",
+ "min", -100,
+ "max", 100,
+ "detail", Map.of("formatter", "{value}%"),
+ "data", List.of(Map.of("value", ratio.setScale(2, RoundingMode.HALF_UP), "name", "鍒╂鼎璧勯噾姣�"))
+ )));
+ return option;
+ }
+
+ private int normalizeLimit(Integer limit) {
+ if (limit == null || limit <= 0) {
+ return DEFAULT_LIMIT;
+ }
+ return Math.min(limit, MAX_LIMIT);
+ }
+
+ private DateRange resolveDateRange(String startDate, String endDate, String timeRange, String defaultLabel) {
+ LocalDate today = LocalDate.now();
+ LocalDate explicitStart = parseLocalDate(startDate);
+ LocalDate explicitEnd = parseLocalDate(endDate);
+ if (explicitStart != null || explicitEnd != null) {
+ LocalDate start = explicitStart != null ? explicitStart : explicitEnd;
+ LocalDate end = explicitEnd != null ? explicitEnd : explicitStart;
+ if (start.isAfter(end)) {
+ LocalDate temp = start;
+ start = end;
+ end = temp;
+ }
+ return new DateRange(start, end, start + "鑷�" + end);
+ }
+
+ if (!StringUtils.hasText(timeRange)) {
+ return new DateRange(null, null, "鍏ㄩ儴");
+ }
+
+ String text = timeRange.trim();
+ if (text.contains("浠婂ぉ")) {
+ return new DateRange(today, today, "浠婂ぉ");
+ }
+ if (text.contains("鏄ㄥぉ") || text.contains("鏄ㄦ棩")) {
+ LocalDate day = today.minusDays(1);
+ return new DateRange(day, day, "鏄ㄥぉ");
+ }
+ if (text.contains("鏈懆")) {
+ LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ return new DateRange(start, today, "鏈懆");
+ }
+ if (text.contains("涓婂懆")) {
+ LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ LocalDate start = thisWeekStart.minusWeeks(1);
+ LocalDate end = thisWeekStart.minusDays(1);
+ return new DateRange(start, end, "涓婂懆");
+ }
+ if (text.contains("鏈湀")) {
+ return new DateRange(today.withDayOfMonth(1), today, "鏈湀");
+ }
+ if (text.contains("涓婃湀")) {
+ YearMonth lastMonth = YearMonth.from(today).minusMonths(1);
+ return new DateRange(lastMonth.atDay(1), lastMonth.atEndOfMonth(), "涓婃湀");
+ }
+ if (text.contains("浠婂勾") || text.contains("鏈勾")) {
+ return new DateRange(today.withDayOfYear(1), today, "浠婂勾");
+ }
+ Matcher relativeMatcher = RELATIVE_PATTERN.matcher(text);
+ if (relativeMatcher.find()) {
+ int amount = Integer.parseInt(relativeMatcher.group(2));
+ String unit = relativeMatcher.group(3);
+ LocalDate start = switch (unit) {
+ case "澶�" -> today.minusDays(Math.max(amount - 1L, 0));
+ case "鍛�" -> today.minusWeeks(Math.max(amount, 1)).plusDays(1);
+ case "涓湀", "鏈�" -> today.minusMonths(Math.max(amount, 1)).plusDays(1);
+ case "骞�" -> today.minusYears(Math.max(amount, 1)).plusDays(1);
+ default -> today.minusDays(29);
+ };
+ return new DateRange(start, today, "杩�" + amount + unit);
+ }
+ Matcher dateMatcher = DATE_PATTERN.matcher(text);
+ if (dateMatcher.find()) {
+ LocalDate start = parseLocalDate(dateMatcher.group(1));
+ LocalDate end = dateMatcher.find() ? parseLocalDate(dateMatcher.group(1)) : start;
+ if (start != null && end != null) {
+ if (start.isAfter(end)) {
+ LocalDate temp = start;
+ start = end;
+ end = temp;
+ }
+ return new DateRange(start, end, start + "鑷�" + end);
+ }
+ }
+ return new DateRange(null, null, "鍏ㄩ儴");
+ }
+
+ private LocalDate parseLocalDate(String text) {
+ if (!StringUtils.hasText(text)) {
+ return null;
+ }
+ try {
+ return LocalDate.parse(text.trim(), DATE_FMT);
+ } catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ private Date toDate(LocalDate localDate) {
+ return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private Date toExclusiveEndDate(LocalDate localDate) {
+ return Date.from(localDate.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private LocalDate toLocalDate(Date date) {
+ if (date == null) {
+ return null;
+ }
+ return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+ }
+
+ private String formatDate(LocalDate date) {
+ return date == null ? "" : date.format(DATE_FMT);
+ }
+
+ private String displayDate(LocalDate date) {
+ return date == null ? "" : date.format(DATE_FMT);
+ }
+
+ private long daysBetween(LocalDate start, LocalDate end) {
+ if (start == null || end == null || start.isAfter(end)) {
+ return 0;
+ }
+ return end.toEpochDay() - start.toEpochDay();
+ }
+
+ private BigDecimal defaultDecimal(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ private BigDecimal maxZero(BigDecimal value) {
+ return value == null || value.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : value;
+ }
+
+ private BigDecimal rate(BigDecimal numerator, BigDecimal denominator) {
+ if (denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) {
+ return BigDecimal.ZERO;
+ }
+ return defaultDecimal(numerator).divide(denominator, 6, RoundingMode.HALF_UP);
+ }
+
+ private String toPercent(BigDecimal decimal) {
+ if (decimal == null) {
+ return "0.00%";
+ }
+ BigDecimal rate = decimal.multiply(ONE_HUNDRED).setScale(2, RoundingMode.HALF_UP);
+ return rate.toPlainString() + "%";
+ }
+
+ private BigDecimal avgRate(List<OrderProfitMetric> metrics) {
+ if (metrics == null || metrics.isEmpty()) {
+ return BigDecimal.ZERO;
+ }
+ BigDecimal sum = metrics.stream().map(OrderProfitMetric::profitRate).reduce(BigDecimal.ZERO, BigDecimal::add);
+ return sum.divide(new BigDecimal(metrics.size()), 6, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal estimateLaborCost(ProductionAccount account, Map<String, BigDecimal> salaryQuotaByOperation) {
+ BigDecimal salaryQuota = salaryQuotaByOperation.getOrDefault(safe(account.getTechnologyOperationName()), BigDecimal.ZERO);
+ BigDecimal finishedNum = defaultDecimal(account.getFinishedNum());
+ BigDecimal workHours = defaultDecimal(account.getWorkHours());
+ if (salaryQuota.compareTo(BigDecimal.ZERO) > 0 && finishedNum.compareTo(BigDecimal.ZERO) > 0) {
+ return finishedNum.multiply(salaryQuota);
+ }
+ if (salaryQuota.compareTo(BigDecimal.ZERO) > 0 && workHours.compareTo(BigDecimal.ZERO) > 0) {
+ return workHours.multiply(salaryQuota);
+ }
+ if (workHours.compareTo(BigDecimal.ZERO) > 0) {
+ return workHours;
+ }
+ return finishedNum;
+ }
+
+ private List<Long> parseIdList(String raw) {
+ if (!StringUtils.hasText(raw)) {
+ return List.of();
+ }
+ String text = raw.replace("[", "").replace("]", "").replace(" ", "");
+ if (!StringUtils.hasText(text)) {
+ return List.of();
+ }
+ List<Long> result = new ArrayList<>();
+ for (String part : text.split(",")) {
+ if (!StringUtils.hasText(part)) {
+ continue;
+ }
+ try {
+ result.add(Long.parseLong(part.trim()));
+ } catch (Exception ignored) {
+ }
+ }
+ return result;
+ }
+
+ private int keywordHitCount(List<String> keywords, String question) {
+ if (!StringUtils.hasText(question) || keywords == null) {
+ return 0;
+ }
+ int count = 0;
+ for (String keyword : keywords) {
+ if (question.contains(keyword)) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ private String normalizeForMatch(String text) {
+ if (!StringUtils.hasText(text)) {
+ return "";
+ }
+ return text.replace("锛�", "")
+ .replace(",", "")
+ .replace("銆�", "")
+ .replace(".", "")
+ .replace("锛�", "")
+ .replace("!", "")
+ .replace("锛�", "")
+ .replace("?", "")
+ .replace("锛�", "")
+ .replace(":", "")
+ .replace("锛�", "")
+ .replace(";", "")
+ .replace(" ", "")
+ .trim();
+ }
+
+ private String safe(Object value) {
+ return value == null ? "" : String.valueOf(value).replace('\n', ' ').replace('\r', ' ').trim();
+ }
+
+ private LoginUser currentLoginUser(String memoryId) {
+ LoginUser loginUser = aiSessionUserContext.get(memoryId);
+ if (loginUser != null) {
+ return loginUser;
+ }
+ return SecurityUtils.getLoginUser();
+ }
+
+ private Map<String, Object> rangeSummary(DateRange range, int count, String keyword) {
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", displayDate(range.start()));
+ summary.put("endDate", displayDate(range.end()));
+ summary.put("count", count);
+ summary.put("keyword", safe(keyword));
+ return summary;
+ }
+
+ private Long toLongOrNull(String value) {
+ if (!StringUtils.hasText(value)) {
+ return null;
+ }
+ try {
+ return Long.valueOf(value.trim());
+ } catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ private <T> List<T> defaultList(List<T> list) {
+ return list == null ? List.of() : list;
+ }
+
+ private <T> void applyTenantFilter(LambdaQueryWrapper<T> wrapper, Long tenantId, SFunction<T, Long> field) {
+ if (tenantId != null) {
+ wrapper.eq(field, tenantId);
+ }
+ }
+
+ private <T> void applyDeptFilter(LambdaQueryWrapper<T> wrapper, Long deptId, SFunction<T, Long> field) {
+ if (deptId != null) {
+ wrapper.eq(field, deptId);
+ }
+ }
+
+ private List<KnowledgeDoc> financeKnowledgeBase() {
+ return List.of(
+ new KnowledgeDoc(
+ "鍒╂鼎涓嬮檷鍒嗘瀽妗嗘灦",
+ List.of("鍒╂鼎涓嬮檷", "浜忔崯璁㈠崟", "姣涘埄鐜�", "鍑�鍒╃巼"),
+ "鍏堢湅鏀跺叆绔紙璁㈠崟缁撴瀯銆佸崟浠枫�佷氦浠樺欢杩燂級锛屽啀鐪嬫垚鏈锛堟潗鏂欍�佷汉宸ャ�佹姌鏃с�佹崯鑰楋級锛屾渶鍚庣湅鐜伴噾绔紙鍥炴銆佽处鏈熴�佸潖璐﹂闄╋級銆�",
+ List.of("sales_ledger", "sales_ledger_product", "production_account", "device_ledger", "account_statement"),
+ List.of("涓轰粈涔堟湰鏈堝埄娑︿笅闄嶏紵", "鍝簺璁㈠崟浜忔崯鏈�涓ラ噸锛�", "鎴愭湰涓婂崌鏉ヨ嚜鍝釜宸ュ簭锛�")
+ ),
+ new KnowledgeDoc(
+ "搴撳瓨璧勯噾鍗犵敤璇婃柇",
+ List.of("搴撳瓨绉帇", "鍛嗘粸搴撳瓨", "鍛ㄨ浆鐜�", "璧勯噾鍗犵敤"),
+ "搴撳瓨璧勯噾璇婃柇閲嶇偣鐪嬶細搴撳瓨浠峰�笺�佽繎30澶╁嚭搴撴垚鏈�佸憜婊炲ぉ鏁般�佽秴鍌ㄦ瘮渚嬶紝褰㈡垚鍘诲簱瀛樹笌閲囪喘鑺傚鑱斿姩绛栫暐銆�",
+ List.of("stock_inventory", "procurement_record_storage", "procurement_record_out"),
+ List.of("鍝簺鐗╂枡璧勯噾鍗犵敤鏈�楂橈紵", "鍝簺搴撳瓨瓒呰繃90澶╂湭鍛ㄨ浆锛�", "搴撳瓨鍛ㄨ浆澶╂暟鏄惁寮傚父锛�")
+ ),
+ new KnowledgeDoc(
+ "鐜伴噾娴佷笌璐︽椋庨櫓",
+ List.of("鐜伴噾娴�", "搴旀敹", "搴斾粯", "鍥炴", "璧勯噾缂哄彛"),
+ "鐜伴噾娴佸垽鏂缁撳悎鏀舵銆佷粯娆俱�佸簲鏀跺簲浠樹綑棰濅笌棰勬祴鍑�娴侀噺锛岄噸鐐瑰叧娉ㄩ珮浣欓瀹㈡埛鍜岄珮闆嗕腑浠樻渚涘簲鍟嗐��",
+ List.of("account_sales_collection", "account_purchase_payment", "account_statement"),
+ List.of("鏈潵涓変釜鏈堟槸鍚︽湁璧勯噾缂哄彛锛�", "鍝釜瀹㈡埛鍥炴椋庨櫓鏈�楂橈紵", "浠樻鍘嬪姏鏈�澶х殑鏄摢浜涗緵搴斿晢锛�")
+ ),
+ new KnowledgeDoc(
+ "涓氳储涓�浣撳寲鍙e緞",
+ List.of("涓氳储铻嶅悎", "涓氳储鑱斿姩", "鍙e緞", "椹鹃┒鑸�"),
+ "璁㈠崟鍒╂鼎鍙e緞=閿�鍞敹鍏�-鏉愭枡鎴愭湰-浜哄伐鎴愭湰-璁惧鎶樻棫-鎹熻�楁垚鏈紱缁忚惀椹鹃┒鑸辫仈鍔ㄨ鍗曘�佺敓浜с�佸簱瀛樸�佽澶囥�佽处娆炬暟鎹��",
+ List.of("sales_ledger", "production_operation_task", "production_product_main", "device_ledger", "stock_inventory", "account_statement"),
+ List.of("璁㈠崟鍒╂鼎鐜囧浣曡绠楋紵", "缁忚惀椹鹃┒鑸辨牳蹇冩寚鏍囨湁鍝簺锛�")
+ )
+ );
+ }
+
+ private String jsonResponse(boolean success,
+ String type,
+ String description,
+ Map<String, Object> summary,
+ Map<String, Object> data,
+ Map<String, Object> charts) {
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("success", success);
+ result.put("type", type);
+ result.put("description", description);
+ result.put("summary", summary == null ? Map.of() : summary);
+ result.put("data", data == null ? Map.of() : data);
+ result.put("charts", charts == null ? Map.of() : charts);
+ return JSON.toJSONString(result);
+ }
+
+ private record DateRange(LocalDate start, LocalDate end, String label) {
+ private boolean hasDateFilter() {
+ return start != null && end != null;
+ }
+ }
+
+ private record OrderProfitMetric(Long ledgerId,
+ String salesContractNo,
+ String customerName,
+ String projectName,
+ LocalDate entryDate,
+ LocalDate deliveryDate,
+ BigDecimal revenue,
+ BigDecimal materialCost,
+ BigDecimal laborCost,
+ BigDecimal depreciationCost,
+ BigDecimal scrapCost,
+ BigDecimal totalCost,
+ BigDecimal profit,
+ BigDecimal profitRate,
+ String riskLevel,
+ List<String> reasons,
+ String suggestion) {
+ }
+
+ private record AnalysisBundle(List<OrderProfitMetric> orderMetrics,
+ Map<String, BigDecimal> processCostRanking,
+ BigDecimal totalRevenue,
+ BigDecimal totalMaterialCost,
+ BigDecimal totalLaborCost,
+ BigDecimal totalDepreciationCost,
+ BigDecimal totalScrapCost,
+ BigDecimal totalCost,
+ BigDecimal totalProfit) {
+ private static AnalysisBundle empty() {
+ return new AnalysisBundle(List.of(), Map.of(), BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO,
+ BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO);
+ }
+ }
+
+ private record MaterialCostResult(Map<Long, BigDecimal> materialCostByLedgerId,
+ Map<Long, BigDecimal> avgUnitCostByModelId) {
+ }
+
+ private record ProductionCostContext(Map<Long, BigDecimal> laborCostByLedgerId,
+ Map<Long, BigDecimal> scrapCostByLedgerId,
+ Map<String, BigDecimal> processCostRanking) {
+ private static ProductionCostContext empty() {
+ return new ProductionCostContext(Map.of(), Map.of(), Map.of());
+ }
+ }
+
+ private record InventoryMetric(Long modelId,
+ String productName,
+ String modelName,
+ BigDecimal quantity,
+ BigDecimal lockedQuantity,
+ BigDecimal avgUnitCost,
+ BigDecimal inventoryValue,
+ BigDecimal outboundQuantity,
+ long stagnantDays,
+ boolean overstock) {
+ }
+
+ private static class InventoryMetricBuilder {
+ private final Long modelId;
+ private BigDecimal quantity = BigDecimal.ZERO;
+ private BigDecimal lockedQuantity = BigDecimal.ZERO;
+ private BigDecimal warnNum = BigDecimal.ZERO;
+ private LocalDateTime firstInTime;
+
+ private InventoryMetricBuilder(Long modelId) {
+ this.modelId = modelId;
+ }
+
+ private void addQuantity(BigDecimal quantity) {
+ this.quantity = this.quantity.add(quantity);
+ }
+
+ private void addLockedQuantity(BigDecimal lockedQuantity) {
+ this.lockedQuantity = this.lockedQuantity.add(lockedQuantity);
+ }
+
+ private void addWarnNum(BigDecimal warnNum) {
+ this.warnNum = this.warnNum.max(warnNum);
+ }
+
+ private void updateFirstInTime(LocalDateTime createTime) {
+ if (this.firstInTime == null || createTime.isBefore(this.firstInTime)) {
+ this.firstInTime = createTime;
+ }
+ }
+
+ private Long modelId() {
+ return modelId;
+ }
+
+ private BigDecimal quantity() {
+ return quantity;
+ }
+
+ private BigDecimal lockedQuantity() {
+ return lockedQuantity;
+ }
+
+ private BigDecimal warnNum() {
+ return warnNum;
+ }
+
+ private LocalDateTime firstInTime() {
+ return firstInTime;
+ }
+ }
+
+ private record OutboundStats(Map<Long, BigDecimal> outboundQtyByModel,
+ Map<Long, LocalDateTime> lastOutboundTimeByModel,
+ BigDecimal totalOutboundCost) {
+ private static OutboundStats empty() {
+ return new OutboundStats(Map.of(), Map.of(), BigDecimal.ZERO);
+ }
+ }
+
+ private record MonthlyCashFlow(String month, BigDecimal income, BigDecimal expense, BigDecimal netFlow) {
+ }
+
+ private record StatementMetric(String entityId,
+ BigDecimal closingBalance,
+ BigDecimal planAmount,
+ BigDecimal actualAmount,
+ String statementMonth) {
+ }
+
+ private record StatementSnapshot(BigDecimal receivableTotal,
+ BigDecimal payableTotal,
+ List<StatementMetric> receivableTop,
+ List<StatementMetric> payableTop) {
+ private static StatementSnapshot empty() {
+ return new StatementSnapshot(BigDecimal.ZERO, BigDecimal.ZERO, List.of(), List.of());
+ }
+ }
+
+ private record KnowledgeDoc(String topic,
+ List<String> keywords,
+ String knowledge,
+ List<String> relatedTables,
+ List<String> suggestedQuestions) {
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/tools/ManufacturingAgentTools.java b/src/main/java/com/ruoyi/ai/tools/ManufacturingAgentTools.java
new file mode 100644
index 0000000..1ff96c1
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/tools/ManufacturingAgentTools.java
@@ -0,0 +1,1035 @@
+package com.ruoyi.ai.tools;
+
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.ai.context.AiSessionUserContext;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.device.mapper.DeviceDefectRecordMapper;
+import com.ruoyi.device.mapper.DeviceLedgerMapper;
+import com.ruoyi.device.mapper.DeviceRepairMapper;
+import com.ruoyi.device.pojo.DeviceDefectRecord;
+import com.ruoyi.device.pojo.DeviceLedger;
+import com.ruoyi.device.pojo.DeviceRepair;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.procurementrecord.mapper.ProcurementExceptionRecordMapper;
+import com.ruoyi.procurementrecord.pojo.ProcurementExceptionRecord;
+import com.ruoyi.production.mapper.ProductionOperationTaskMapper;
+import com.ruoyi.production.mapper.ProductionOrderMapper;
+import com.ruoyi.production.mapper.ProductionPlanMapper;
+import com.ruoyi.production.mapper.ProductionProductMainMapper;
+import com.ruoyi.production.pojo.ProductionOperationTask;
+import com.ruoyi.production.pojo.ProductionOrder;
+import com.ruoyi.production.pojo.ProductionPlan;
+import com.ruoyi.production.pojo.ProductionProductMain;
+import com.ruoyi.quality.mapper.QualityInspectMapper;
+import com.ruoyi.quality.mapper.QualityUnqualifiedMapper;
+import com.ruoyi.quality.pojo.QualityInspect;
+import com.ruoyi.quality.pojo.QualityUnqualified;
+import com.ruoyi.stock.mapper.StockInventoryMapper;
+import com.ruoyi.stock.pojo.StockInventory;
+import dev.langchain4j.agent.tool.P;
+import dev.langchain4j.agent.tool.Tool;
+import dev.langchain4j.agent.tool.ToolMemoryId;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Component
+public class ManufacturingAgentTools {
+
+ private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final int DEFAULT_LIMIT = 10;
+ private static final int MAX_LIMIT = 30;
+ private static final int DEVICE_REPAIR_STATUS_PENDING = 0;
+
+ private final ProductionPlanMapper productionPlanMapper;
+ private final ProductionOrderMapper productionOrderMapper;
+ private final ProductionOperationTaskMapper productionOperationTaskMapper;
+ private final ProductionProductMainMapper productionProductMainMapper;
+ private final DeviceLedgerMapper deviceLedgerMapper;
+ private final DeviceRepairMapper deviceRepairMapper;
+ private final DeviceDefectRecordMapper deviceDefectRecordMapper;
+ private final QualityInspectMapper qualityInspectMapper;
+ private final QualityUnqualifiedMapper qualityUnqualifiedMapper;
+ private final StockInventoryMapper stockInventoryMapper;
+ private final ProcurementExceptionRecordMapper procurementExceptionRecordMapper;
+ private final AiSessionUserContext aiSessionUserContext;
+
+ public ManufacturingAgentTools(ProductionPlanMapper productionPlanMapper,
+ ProductionOrderMapper productionOrderMapper,
+ ProductionOperationTaskMapper productionOperationTaskMapper,
+ ProductionProductMainMapper productionProductMainMapper,
+ DeviceLedgerMapper deviceLedgerMapper,
+ DeviceRepairMapper deviceRepairMapper,
+ DeviceDefectRecordMapper deviceDefectRecordMapper,
+ QualityInspectMapper qualityInspectMapper,
+ QualityUnqualifiedMapper qualityUnqualifiedMapper,
+ StockInventoryMapper stockInventoryMapper,
+ ProcurementExceptionRecordMapper procurementExceptionRecordMapper,
+ AiSessionUserContext aiSessionUserContext) {
+ this.productionPlanMapper = productionPlanMapper;
+ this.productionOrderMapper = productionOrderMapper;
+ this.productionOperationTaskMapper = productionOperationTaskMapper;
+ this.productionProductMainMapper = productionProductMainMapper;
+ this.deviceLedgerMapper = deviceLedgerMapper;
+ this.deviceRepairMapper = deviceRepairMapper;
+ this.deviceDefectRecordMapper = deviceDefectRecordMapper;
+ this.qualityInspectMapper = qualityInspectMapper;
+ this.qualityUnqualifiedMapper = qualityUnqualifiedMapper;
+ this.stockInventoryMapper = stockInventoryMapper;
+ this.procurementExceptionRecordMapper = procurementExceptionRecordMapper;
+ this.aiSessionUserContext = aiSessionUserContext;
+ }
+
+ @Tool(name = "鏌ヨ鍒堕�犱笟鍔″煙鏁版嵁", value = "鎸変笟鍔″煙鏌ヨ鐢熶骇鐜板満銆佽鍒掋�佸伐鍗曘�佽澶囥�佽川閲忋�佺墿鏂欍�佸紓甯稿鐞嗙浉鍏虫暟鎹��")
+ public String queryDomain(@ToolMemoryId String memoryId,
+ @P(value = "涓氬姟鍩燂紝site/plan/workorder/device/quality/material/exception") String domain,
+ @P(value = "鍏抽敭瀛楋紝鍙笉浼�", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd锛屽彲涓嶄紶", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd锛屽彲涓嶄紶", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屼緥濡備粖骞淬�佹湰鏈堛�佽繎30澶�", required = false) String timeRange) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ int finalLimit = normalizeLimit(limit);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange);
+ boolean hasTimeConstraint = hasTimeConstraint(startDate, endDate, timeRange);
+ String normalizedDomain = normalizeDomain(domain);
+
+ return switch (normalizedDomain) {
+ case "site" -> siteSnapshot(loginUser, range);
+ case "plan" -> listProductionPlans(loginUser, keyword, finalLimit, range);
+ case "workorder" -> listWorkOrders(loginUser, keyword, finalLimit, range);
+ case "device" -> isRepairIntent(keyword, timeRange)
+ ? listDeviceRepairs(loginUser, normalizeDeviceQueryKeyword(keyword, timeRange), finalLimit, range, hasTimeConstraint)
+ : listDevices(loginUser, normalizeDeviceQueryKeyword(keyword, timeRange), finalLimit);
+ case "repair" -> listDeviceRepairs(loginUser, normalizeDeviceQueryKeyword(keyword, timeRange), finalLimit, range, hasTimeConstraint);
+ case "quality" -> listQualityIssues(loginUser, keyword, finalLimit, range);
+ case "material" -> listMaterialInventory(loginUser, keyword, finalLimit);
+ case "exception" -> listExceptions(loginUser, keyword, finalLimit, range);
+ default -> jsonResponse(false, "manufacturing_query", "涓嶆敮鎸佺殑涓氬姟鍩�: " + safe(domain), Map.of(), Map.of(), Map.of());
+ };
+ }
+
+ @Tool(name = "鍒堕�犻璀︾湅鏉�", value = "璁$畻璁″垝銆佸伐鍗曘�佽澶囥�佽川閲忋�佺墿鏂欍�佸紓甯稿鐞嗙殑棰勮淇℃伅銆�")
+ public String getWarningBoard(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd锛屽彲涓嶄紶", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd锛屽彲涓嶄紶", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屼緥濡備粖澶┿�佹湰鍛ㄣ�佹湰鏈堛�佽繎30澶�", required = false) String timeRange) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange);
+ LocalDate today = LocalDate.now();
+
+ long overduePlanCount = countOverduePlans(loginUser, today);
+ long overdueWorkOrderCount = countOverdueWorkOrders(loginUser, today);
+ long pendingRepairCount = countPendingRepairs(loginUser);
+ long qualityOpenCount = countOpenQualityIssues(loginUser, range);
+ long lowStockCount = countLowStock(loginUser);
+ long exceptionCount = countExceptionRecords(loginUser, range);
+
+ List<Map<String, Object>> warningItems = new ArrayList<>();
+ if (overduePlanCount > 0) {
+ warningItems.add(warningItem("high", "璁″垝閫炬湡", overduePlanCount, "鏈夌敓浜ц鍒掕秴杩囬渶姹傛棩鏈熶粛鏈畬鎴�"));
+ }
+ if (overdueWorkOrderCount > 0) {
+ warningItems.add(warningItem("high", "宸ュ崟閫炬湡", overdueWorkOrderCount, "鏈夊伐鍗曡鍒掔粨鏉熸棩鏈熷凡杩囦粛鏈畬宸�"));
+ }
+ if (pendingRepairCount > 0) {
+ warningItems.add(warningItem("medium", "璁惧寰呯淮淇�", pendingRepairCount, "瀛樺湪寰呯淮淇�/缁翠慨涓殑璁惧"));
+ }
+ if (qualityOpenCount > 0) {
+ warningItems.add(warningItem("high", "璐ㄩ噺鏈棴鐜�", qualityOpenCount, "瀛樺湪鏈鐞嗗畬鎴愮殑涓嶅悎鏍艰褰�"));
+ }
+ if (lowStockCount > 0) {
+ warningItems.add(warningItem("medium", "鐗╂枡浣庡簱瀛�", lowStockCount, "搴撳瓨鏁伴噺浣庝簬鎴栫瓑浜庨璀﹂槇鍊�"));
+ }
+ if (exceptionCount > 0) {
+ warningItems.add(warningItem("medium", "寮傚父璁板綍", exceptionCount, "鏃堕棿鑼冨洿鍐呭瓨鍦ㄥ紓甯稿鐞嗚褰�"));
+ }
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", range.start().toString());
+ summary.put("endDate", range.end().toString());
+ summary.put("warningCount", warningItems.size());
+ summary.put("overduePlanCount", overduePlanCount);
+ summary.put("overdueWorkOrderCount", overdueWorkOrderCount);
+ summary.put("pendingRepairCount", pendingRepairCount);
+ summary.put("qualityOpenCount", qualityOpenCount);
+ summary.put("lowStockCount", lowStockCount);
+ summary.put("exceptionCount", exceptionCount);
+
+ return jsonResponse(true, "manufacturing_warning", "宸茶繑鍥炲埗閫犻璀︾湅鏉裤��", summary,
+ Map.of("items", warningItems), Map.of());
+ }
+
+ @Tool(name = "鍒堕�犵粡钀ュ垎鏋�", value = "鎸夋椂闂磋寖鍥磋緭鍑哄埗閫犲叧閿寚鏍囷紝鏀寔鏌ャ�侀棶銆佸垎鏋愬満鏅��")
+ public String analyzeFactory(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd锛屽彲涓嶄紶", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd锛屽彲涓嶄紶", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屼緥濡傛湰鏈堛�佽繎30澶�", required = false) String timeRange) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange);
+
+ long planTotal = countPlans(loginUser, range);
+ long planCompleted = countPlansByStatus(loginUser, range, 2);
+ long workOrderTotal = countWorkOrders(loginUser, range);
+ long workOrderCompleted = countWorkOrdersByStatus(loginUser, range, 2);
+ long workOrderInProgress = countWorkOrdersByStatus(loginUser, range, 1);
+
+ long outputCount = countOutputs(loginUser, range);
+ long deviceTotal = countDevices(loginUser);
+ long pendingRepairCount = countPendingRepairs(loginUser);
+ long qualityInspectTotal = countQualityInspect(loginUser, range);
+ long qualityNgCount = countOpenQualityIssues(loginUser, range);
+ long materialSkuCount = countInventorySku(loginUser);
+ long lowStockCount = countLowStock(loginUser);
+ long exceptionCount = countExceptionRecords(loginUser, range);
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", range.start().toString());
+ summary.put("endDate", range.end().toString());
+ summary.put("planTotal", planTotal);
+ summary.put("planCompleted", planCompleted);
+ summary.put("planCompletionRate", toRate(planCompleted, planTotal));
+ summary.put("workOrderTotal", workOrderTotal);
+ summary.put("workOrderCompleted", workOrderCompleted);
+ summary.put("workOrderInProgress", workOrderInProgress);
+ summary.put("workOrderCompletionRate", toRate(workOrderCompleted, workOrderTotal));
+ summary.put("outputCount", outputCount);
+ summary.put("deviceTotal", deviceTotal);
+ summary.put("pendingRepairCount", pendingRepairCount);
+ summary.put("qualityInspectTotal", qualityInspectTotal);
+ summary.put("qualityNgCount", qualityNgCount);
+ summary.put("qualityIssueRate", toRate(qualityNgCount, qualityInspectTotal));
+ summary.put("materialSkuCount", materialSkuCount);
+ summary.put("lowStockCount", lowStockCount);
+ summary.put("exceptionCount", exceptionCount);
+
+ List<Map<String, Object>> coreMetrics = List.of(
+ metric("璁″垝瀹屾垚鐜�", toRate(planCompleted, planTotal)),
+ metric("宸ュ崟瀹屾垚鐜�", toRate(workOrderCompleted, workOrderTotal)),
+ metric("璐ㄩ噺寮傚父鐜�", toRate(qualityNgCount, qualityInspectTotal)),
+ metric("浣庡簱瀛樺崰姣�", toRate(lowStockCount, materialSkuCount))
+ );
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("domainBarOption", buildDomainBarOption(summary));
+ charts.put("qualityPieOption", buildQualityPieOption(qualityInspectTotal, qualityNgCount));
+
+ return jsonResponse(true, "manufacturing_analysis", "宸茶繑鍥炲埗閫犲垎鏋愮粨鏋溿��", summary,
+ Map.of("coreMetrics", coreMetrics), charts);
+ }
+
+ @Tool(name = "鐢熸垚鍒堕�犲姙鐞嗗缓璁�", value = "鏍规嵁鐢ㄦ埛闂杈撳嚭鍙墽琛岀殑鍔炵悊鍔ㄤ綔寤鸿锛屽寘鎷洰鏍囦笟鍔℃帴鍙c�佸繀濉瓧娈靛拰绀轰緥銆�")
+ public String planActions(@ToolMemoryId String memoryId,
+ @P("鐢ㄦ埛璇夋眰鍘熸枃") String userQuery) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ List<Map<String, Object>> actionCards = new ArrayList<>();
+
+ if (!StringUtils.hasText(userQuery) || containsAny(userQuery, "宸ュ崟", "娲惧伐", "浣滀笟")) {
+ actionCards.add(actionCard(
+ "workorder_assign",
+ "宸ュ崟娲惧伐",
+ "POST",
+ "/productionOperationTask/assign",
+ List.of("id", "userIds"),
+ Map.of("id", 10001, "userIds", "12,13"),
+ "灏嗗伐鍗曞垎閰嶇粰鎸囧畾浜哄憳锛岄�傜敤浜庣幇鍦鸿皟搴︺��"));
+ }
+ if (!StringUtils.hasText(userQuery) || containsAny(userQuery, "璁惧", "缁翠慨", "鏁呴殰")) {
+ actionCards.add(actionCard(
+ "device_repair_create",
+ "鍒涘缓璁惧缁翠慨鍗�",
+ "POST",
+ "/device/repair",
+ List.of("deviceLedgerId", "deviceName", "repairName", "remark"),
+ Map.of("deviceLedgerId", 1001, "deviceName", "绌哄帇鏈篈-01", "repairName", "寮犱笁", "remark", "寮傚搷骞朵即闅忔俯鍗�"),
+ "鏂板缓缁翠慨鍗曪紝杩涘叆璁惧寮傚父澶勭悊闂幆銆�"));
+ }
+ if (!StringUtils.hasText(userQuery) || containsAny(userQuery, "璐ㄩ噺", "涓嶅悎鏍�", "闂幆")) {
+ actionCards.add(actionCard(
+ "quality_unqualified_deal",
+ "澶勭悊涓嶅悎鏍煎崟",
+ "POST",
+ "/quality/qualityUnqualified/deal",
+ List.of("id", "dealResult", "dealName"),
+ Map.of("id", 3001, "dealResult", "杩斿伐鍚庡妫�", "dealName", "鏉庡洓"),
+ "瀵逛笉鍚堟牸璁板綍鎵ц澶勭疆骞堕棴鐜��"));
+ }
+ if (!StringUtils.hasText(userQuery) || containsAny(userQuery, "鐗╂枡", "搴撳瓨", "琛ユ枡")) {
+ actionCards.add(actionCard(
+ "material_inbound",
+ "琛ュ厖搴撳瓨",
+ "POST",
+ "/stockInventory/addstockInventory",
+ List.of("productModelId", "batchNo", "qualitity"),
+ Map.of("productModelId", 5001, "batchNo", "B2026051601", "qualitity", 120),
+ "褰撲綆搴撳瓨棰勮瑙﹀彂鏃讹紝澧炲姞搴撳瓨鏁伴噺銆�"));
+ }
+ if (!StringUtils.hasText(userQuery) || containsAny(userQuery, "寮傚父", "閲囪喘寮傚父", "鏉ユ枡寮傚父")) {
+ actionCards.add(actionCard(
+ "procurement_exception_add",
+ "鐧昏寮傚父璁板綍",
+ "POST",
+ "/procurementExceptionRecord/add",
+ List.of("purchaseLedgerId", "exceptionReason", "exceptionNum"),
+ Map.of("purchaseLedgerId", 888, "exceptionReason", "鍒版枡鐭己", "exceptionNum", 24),
+ "鐧昏閲囪喘/鏉ユ枡寮傚父锛屼究浜庡悗缁拷韪拰鍒嗘瀽銆�"));
+ }
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("actionCount", actionCards.size());
+ summary.put("userId", loginUser.getUserId());
+ summary.put("tenantId", loginUser.getTenantId());
+
+ return jsonResponse(true, "manufacturing_action_plan", "宸茬敓鎴愬姙鐞嗗缓璁紝璇峰墠绔紩瀵肩敤鎴风‘璁ゅ悗璋冪敤鐩爣涓氬姟鎺ュ彛銆�",
+ summary, Map.of("actionCards", actionCards), Map.of());
+ }
+
+ private String siteSnapshot(LoginUser loginUser, DateRange range) {
+ long planTotal = countPlans(loginUser, range);
+ long workOrderTotal = countWorkOrders(loginUser, range);
+ long outputCount = countOutputs(loginUser, range);
+ long deviceTotal = countDevices(loginUser);
+ long pendingRepairCount = countPendingRepairs(loginUser);
+ long qualityOpenCount = countOpenQualityIssues(loginUser, range);
+ long lowStockCount = countLowStock(loginUser);
+ long exceptionCount = countExceptionRecords(loginUser, range);
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", range.start().toString());
+ summary.put("endDate", range.end().toString());
+ summary.put("planTotal", planTotal);
+ summary.put("workOrderTotal", workOrderTotal);
+ summary.put("outputCount", outputCount);
+ summary.put("deviceTotal", deviceTotal);
+ summary.put("pendingRepairCount", pendingRepairCount);
+ summary.put("qualityOpenCount", qualityOpenCount);
+ summary.put("lowStockCount", lowStockCount);
+ summary.put("exceptionCount", exceptionCount);
+
+ return jsonResponse(true, "manufacturing_site_snapshot", "宸茶繑鍥炵敓浜х幇鍦烘瑙堛��", summary, Map.of(), Map.of());
+ }
+
+ private String listProductionPlans(LoginUser loginUser, String keyword, int limit, DateRange range) {
+ LambdaQueryWrapper<ProductionPlan> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionPlan::getDeptId);
+ wrapper.ge(ProductionPlan::getRequiredDate, range.start()).le(ProductionPlan::getRequiredDate, range.end());
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(ProductionPlan::getMpsNo, keyword)
+ .or().like(ProductionPlan::getRemark, keyword)
+ .or().like(ProductionPlan::getSource, keyword));
+ }
+ wrapper.orderByDesc(ProductionPlan::getRequiredDate, ProductionPlan::getId).last("limit " + limit);
+
+ List<Map<String, Object>> items = defaultList(productionPlanMapper.selectList(wrapper)).stream()
+ .map(this::toPlanItem)
+ .collect(Collectors.toList());
+ return jsonResponse(true, "manufacturing_plan_list", "宸茶繑鍥炵敓浜ц鍒掑垪琛ㄣ��",
+ rangeSummary(range, items.size(), keyword), Map.of("items", items), Map.of());
+ }
+
+ private String listWorkOrders(LoginUser loginUser, String keyword, int limit, DateRange range) {
+ LambdaQueryWrapper<ProductionOperationTask> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionOperationTask::getDeptId);
+ wrapper.ge(ProductionOperationTask::getPlanStartTime, range.start())
+ .le(ProductionOperationTask::getPlanEndTime, range.end());
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(ProductionOperationTask::getWorkOrderNo, keyword)
+ .or().like(ProductionOperationTask::getUserIds, keyword));
+ }
+ wrapper.orderByDesc(ProductionOperationTask::getPlanEndTime, ProductionOperationTask::getId)
+ .last("limit " + limit);
+
+ List<Map<String, Object>> items = defaultList(productionOperationTaskMapper.selectList(wrapper)).stream()
+ .map(this::toWorkOrderItem)
+ .collect(Collectors.toList());
+ return jsonResponse(true, "manufacturing_workorder_list", "宸茶繑鍥炲伐鍗曞垪琛ㄣ��",
+ rangeSummary(range, items.size(), keyword), Map.of("items", items), Map.of());
+ }
+
+ private String listDevices(LoginUser loginUser, String keyword, int limit) {
+ LambdaQueryWrapper<DeviceLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceLedger::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceLedger::getDeptId);
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(DeviceLedger::getDeviceName, keyword)
+ .or().like(DeviceLedger::getDeviceModel, keyword)
+ .or().like(DeviceLedger::getDeviceBrand, keyword));
+ }
+ wrapper.orderByDesc(DeviceLedger::getId).last("limit " + limit);
+
+ Map<Long, Long> pendingRepairMap = pendingRepairCountByDevice(loginUser);
+ List<Map<String, Object>> items = defaultList(deviceLedgerMapper.selectList(wrapper)).stream()
+ .map(item -> toDeviceItem(item, pendingRepairMap.getOrDefault(item.getId(), 0L)))
+ .collect(Collectors.toList());
+ return jsonResponse(true, "manufacturing_device_list", "宸茶繑鍥炶澶囧垪琛ㄣ��",
+ Map.of("count", items.size(), "keyword", safe(keyword)), Map.of("items", items), Map.of());
+ }
+
+ private String listDeviceRepairs(LoginUser loginUser, String keyword, int limit, DateRange range, boolean hasTimeConstraint) {
+ LambdaQueryWrapper<DeviceRepair> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceRepair::getTenantId);
+ Long currentDeptId = loginUser.getCurrentDeptId();
+ if (currentDeptId != null) {
+ wrapper.and(w -> w.eq(DeviceRepair::getDeptId, currentDeptId).or().isNull(DeviceRepair::getDeptId));
+ }
+ if (hasTimeConstraint) {
+ wrapper.ge(DeviceRepair::getCreateTime, range.start().atStartOfDay())
+ .lt(DeviceRepair::getCreateTime, range.end().plusDays(1).atStartOfDay());
+ }
+ if (StringUtils.hasText(keyword)) {
+ List<Long> matchedDeviceIds = findDeviceLedgerIdsByKeyword(loginUser, keyword);
+ wrapper.and(w -> {
+ w.like(DeviceRepair::getDeviceName, keyword)
+ .or().like(DeviceRepair::getDeviceModel, keyword)
+ .or().like(DeviceRepair::getRemark, keyword)
+ .or().like(DeviceRepair::getRepairName, keyword)
+ .or().like(DeviceRepair::getMaintenanceName, keyword);
+ if (!matchedDeviceIds.isEmpty()) {
+ w.or().in(DeviceRepair::getDeviceLedgerId, matchedDeviceIds);
+ }
+ });
+ }
+ wrapper.orderByDesc(DeviceRepair::getCreateTime, DeviceRepair::getId).last("limit " + limit);
+
+ List<Map<String, Object>> items = defaultList(deviceRepairMapper.selectList(wrapper)).stream()
+ .map(this::toDeviceRepairItem)
+ .collect(Collectors.toList());
+ return jsonResponse(true, "manufacturing_device_repair_list", "宸茶繑鍥炶澶囩淮淇褰曘��",
+ rangeSummary(range, items.size(), keyword), Map.of("items", items), Map.of());
+ }
+
+ private String listQualityIssues(LoginUser loginUser, String keyword, int limit, DateRange range) {
+ LambdaQueryWrapper<QualityUnqualified> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), QualityUnqualified::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), QualityUnqualified::getDeptId);
+ wrapper.ge(QualityUnqualified::getCheckTime, toDate(range.start()))
+ .lt(QualityUnqualified::getCheckTime, toExclusiveEndDate(range.end()));
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(QualityUnqualified::getProductName, keyword)
+ .or().like(QualityUnqualified::getDefectivePhenomena, keyword)
+ .or().like(QualityUnqualified::getDealResult, keyword));
+ }
+ wrapper.orderByDesc(QualityUnqualified::getCheckTime, QualityUnqualified::getId).last("limit " + limit);
+
+ List<Map<String, Object>> items = defaultList(qualityUnqualifiedMapper.selectList(wrapper)).stream()
+ .map(this::toQualityItem)
+ .collect(Collectors.toList());
+ return jsonResponse(true, "manufacturing_quality_list", "宸茶繑鍥炶川閲忓紓甯稿垪琛ㄣ��",
+ rangeSummary(range, items.size(), keyword), Map.of("items", items), Map.of());
+ }
+
+ private String listMaterialInventory(LoginUser loginUser, String keyword, int limit) {
+ LambdaQueryWrapper<StockInventory> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), StockInventory::getDeptId);
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(StockInventory::getBatchNo, keyword)
+ .or().like(StockInventory::getProductModelId, keyword));
+ }
+ wrapper.orderByDesc(StockInventory::getId).last("limit " + limit);
+
+ List<Map<String, Object>> items = defaultList(stockInventoryMapper.selectList(wrapper)).stream()
+ .map(this::toMaterialItem)
+ .collect(Collectors.toList());
+ return jsonResponse(true, "manufacturing_material_list", "宸茶繑鍥炵墿鏂欏簱瀛樺垪琛ㄣ��",
+ Map.of("count", items.size(), "keyword", safe(keyword)), Map.of("items", items), Map.of());
+ }
+
+ private String listExceptions(LoginUser loginUser, String keyword, int limit, DateRange range) {
+ LambdaQueryWrapper<ProcurementExceptionRecord> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), ProcurementExceptionRecord::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProcurementExceptionRecord::getDeptId);
+ wrapper.ge(ProcurementExceptionRecord::getCreateTime, range.start().atStartOfDay())
+ .lt(ProcurementExceptionRecord::getCreateTime, range.end().plusDays(1).atStartOfDay());
+ if (StringUtils.hasText(keyword)) {
+ wrapper.like(ProcurementExceptionRecord::getExceptionReason, keyword);
+ }
+ wrapper.orderByDesc(ProcurementExceptionRecord::getCreateTime, ProcurementExceptionRecord::getId)
+ .last("limit " + limit);
+
+ List<Map<String, Object>> items = defaultList(procurementExceptionRecordMapper.selectList(wrapper)).stream()
+ .map(this::toExceptionItem)
+ .collect(Collectors.toList());
+ return jsonResponse(true, "manufacturing_exception_list", "宸茶繑鍥炲紓甯稿鐞嗗垪琛ㄣ��",
+ rangeSummary(range, items.size(), keyword), Map.of("items", items), Map.of());
+ }
+
+ private long countPlans(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<ProductionPlan> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionPlan::getDeptId);
+ wrapper.ge(ProductionPlan::getRequiredDate, range.start()).le(ProductionPlan::getRequiredDate, range.end());
+ return productionPlanMapper.selectCount(wrapper);
+ }
+
+ private long countPlansByStatus(LoginUser loginUser, DateRange range, int status) {
+ LambdaQueryWrapper<ProductionPlan> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionPlan::getDeptId);
+ wrapper.ge(ProductionPlan::getRequiredDate, range.start())
+ .le(ProductionPlan::getRequiredDate, range.end())
+ .eq(ProductionPlan::getStatus, status);
+ return productionPlanMapper.selectCount(wrapper);
+ }
+
+ private long countWorkOrders(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<ProductionOperationTask> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionOperationTask::getDeptId);
+ wrapper.ge(ProductionOperationTask::getPlanStartTime, range.start())
+ .le(ProductionOperationTask::getPlanEndTime, range.end());
+ return productionOperationTaskMapper.selectCount(wrapper);
+ }
+
+ private long countWorkOrdersByStatus(LoginUser loginUser, DateRange range, int status) {
+ LambdaQueryWrapper<ProductionOperationTask> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionOperationTask::getDeptId);
+ wrapper.ge(ProductionOperationTask::getPlanStartTime, range.start())
+ .le(ProductionOperationTask::getPlanEndTime, range.end())
+ .eq(ProductionOperationTask::getStatus, status);
+ return productionOperationTaskMapper.selectCount(wrapper);
+ }
+
+ private long countOutputs(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<ProductionProductMain> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionProductMain::getDeptId);
+ wrapper.ge(ProductionProductMain::getCreateTime, range.start().atStartOfDay())
+ .lt(ProductionProductMain::getCreateTime, range.end().plusDays(1).atStartOfDay());
+ return productionProductMainMapper.selectCount(wrapper);
+ }
+
+ private long countDevices(LoginUser loginUser) {
+ LambdaQueryWrapper<DeviceLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceLedger::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceLedger::getDeptId);
+ return deviceLedgerMapper.selectCount(wrapper);
+ }
+
+ private long countPendingRepairs(LoginUser loginUser) {
+ LambdaQueryWrapper<DeviceRepair> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceRepair::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceRepair::getDeptId);
+ wrapper.eq(DeviceRepair::getStatus, DEVICE_REPAIR_STATUS_PENDING);
+ return deviceRepairMapper.selectCount(wrapper);
+ }
+
+ private long countQualityInspect(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<QualityInspect> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), QualityInspect::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), QualityInspect::getDeptId);
+ wrapper.ge(QualityInspect::getCheckTime, toDate(range.start()))
+ .lt(QualityInspect::getCheckTime, toExclusiveEndDate(range.end()));
+ return qualityInspectMapper.selectCount(wrapper);
+ }
+
+ private long countOpenQualityIssues(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<QualityUnqualified> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), QualityUnqualified::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), QualityUnqualified::getDeptId);
+ wrapper.ge(QualityUnqualified::getCheckTime, toDate(range.start()))
+ .lt(QualityUnqualified::getCheckTime, toExclusiveEndDate(range.end()))
+ .ne(QualityUnqualified::getInspectState, 2);
+ return qualityUnqualifiedMapper.selectCount(wrapper);
+ }
+
+ private long countInventorySku(LoginUser loginUser) {
+ LambdaQueryWrapper<StockInventory> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), StockInventory::getDeptId);
+ return stockInventoryMapper.selectCount(wrapper);
+ }
+
+ private long countLowStock(LoginUser loginUser) {
+ LambdaQueryWrapper<StockInventory> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), StockInventory::getDeptId);
+ wrapper.isNotNull(StockInventory::getWarnNum);
+ List<StockInventory> stocks = defaultList(stockInventoryMapper.selectList(wrapper));
+ return stocks.stream()
+ .filter(this::isLowStock)
+ .count();
+ }
+
+ private long countExceptionRecords(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<ProcurementExceptionRecord> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), ProcurementExceptionRecord::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProcurementExceptionRecord::getDeptId);
+ wrapper.ge(ProcurementExceptionRecord::getCreateTime, range.start().atStartOfDay())
+ .lt(ProcurementExceptionRecord::getCreateTime, range.end().plusDays(1).atStartOfDay());
+ return procurementExceptionRecordMapper.selectCount(wrapper);
+ }
+
+ private long countOverduePlans(LoginUser loginUser, LocalDate today) {
+ LambdaQueryWrapper<ProductionPlan> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionPlan::getDeptId);
+ wrapper.lt(ProductionPlan::getRequiredDate, today).ne(ProductionPlan::getStatus, 2);
+ return productionPlanMapper.selectCount(wrapper);
+ }
+
+ private long countOverdueWorkOrders(LoginUser loginUser, LocalDate today) {
+ LambdaQueryWrapper<ProductionOperationTask> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ProductionOperationTask::getDeptId);
+ wrapper.lt(ProductionOperationTask::getPlanEndTime, today).ne(ProductionOperationTask::getStatus, 2);
+ return productionOperationTaskMapper.selectCount(wrapper);
+ }
+
+ private Map<Long, Long> pendingRepairCountByDevice(LoginUser loginUser) {
+ LambdaQueryWrapper<DeviceRepair> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceRepair::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), DeviceRepair::getDeptId);
+ wrapper.eq(DeviceRepair::getStatus, DEVICE_REPAIR_STATUS_PENDING);
+ return defaultList(deviceRepairMapper.selectList(wrapper)).stream()
+ .filter(item -> item.getDeviceLedgerId() != null)
+ .collect(Collectors.groupingBy(DeviceRepair::getDeviceLedgerId, Collectors.counting()));
+ }
+
+ private Map<String, Object> toPlanItem(ProductionPlan item) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("mpsNo", safe(item.getMpsNo()));
+ map.put("requiredDate", formatDate(item.getRequiredDate()));
+ map.put("promisedDeliveryDate", formatDate(item.getPromisedDeliveryDate()));
+ map.put("qtyRequired", item.getQtyRequired());
+ map.put("quantityIssued", item.getQuantityIssued());
+ map.put("status", item.getStatus());
+ map.put("source", safe(item.getSource()));
+ map.put("remark", safe(item.getRemark()));
+ return map;
+ }
+
+ private Map<String, Object> toWorkOrderItem(ProductionOperationTask item) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("workOrderNo", safe(item.getWorkOrderNo()));
+ map.put("productionOrderId", item.getProductionOrderId());
+ map.put("planStartTime", formatDate(item.getPlanStartTime()));
+ map.put("planEndTime", formatDate(item.getPlanEndTime()));
+ map.put("actualStartTime", formatDate(item.getActualStartTime()));
+ map.put("actualEndTime", formatDate(item.getActualEndTime()));
+ map.put("planQuantity", item.getPlanQuantity());
+ map.put("completeQuantity", item.getCompleteQuantity());
+ map.put("status", item.getStatus());
+ map.put("userIds", safe(item.getUserIds()));
+ return map;
+ }
+
+ private Map<String, Object> toDeviceItem(DeviceLedger item, long pendingRepairCount) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("deviceName", safe(item.getDeviceName()));
+ map.put("deviceModel", safe(item.getDeviceModel()));
+ map.put("deviceBrand", safe(item.getDeviceBrand()));
+ map.put("status", safe(item.getStatus()));
+ map.put("storageLocation", safe(item.getStorageLocation()));
+ map.put("supplierName", safe(item.getSupplierName()));
+ map.put("pendingRepairCount", pendingRepairCount);
+ return map;
+ }
+
+ private Map<String, Object> toDeviceRepairItem(DeviceRepair item) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("deviceLedgerId", item.getDeviceLedgerId());
+ map.put("deviceName", safe(item.getDeviceName()));
+ map.put("deviceModel", safe(item.getDeviceModel()));
+ map.put("repairTime", formatDate(item.getRepairTime()));
+ map.put("repairName", safe(item.getRepairName()));
+ map.put("maintenanceName", safe(item.getMaintenanceName()));
+ map.put("maintenanceTime", formatDateTime(item.getMaintenanceTime()));
+ map.put("maintenanceResult", safe(item.getMaintenanceResult()));
+ map.put("acceptanceName", safe(item.getAcceptanceName()));
+ map.put("acceptanceTime", formatDateTime(item.getAcceptanceTime()));
+ map.put("status", item.getStatus());
+ map.put("remark", safe(item.getRemark()));
+ map.put("createTime", formatDateTime(item.getCreateTime()));
+ return map;
+ }
+
+ private Map<String, Object> toQualityItem(QualityUnqualified item) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("checkTime", formatDate(item.getCheckTime()));
+ map.put("inspectState", item.getInspectState());
+ map.put("productId", item.getProductId());
+ map.put("productName", safe(item.getProductName()));
+ map.put("model", safe(item.getModel()));
+ map.put("quantity", item.getQuantity());
+ map.put("defectivePhenomena", safe(item.getDefectivePhenomena()));
+ map.put("dealResult", safe(item.getDealResult()));
+ map.put("dealName", safe(item.getDealName()));
+ map.put("dealTime", formatDate(item.getDealTime()));
+ return map;
+ }
+
+ private Map<String, Object> toMaterialItem(StockInventory item) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("productModelId", item.getProductModelId());
+ map.put("batchNo", safe(item.getBatchNo()));
+ map.put("qualitity", item.getQualitity());
+ map.put("lockedQuantity", item.getLockedQuantity());
+ map.put("warnNum", item.getWarnNum());
+ map.put("lowStock", isLowStock(item));
+ map.put("remark", safe(item.getRemark()));
+ return map;
+ }
+
+ private Map<String, Object> toExceptionItem(ProcurementExceptionRecord item) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("purchaseLedgerId", item.getPurchaseLedgerId());
+ map.put("exceptionReason", safe(item.getExceptionReason()));
+ map.put("exceptionNum", item.getExceptionNum());
+ map.put("createTime", formatDateTime(item.getCreateTime()));
+ return map;
+ }
+
+ private boolean isLowStock(StockInventory item) {
+ BigDecimal quantity = item.getQualitity();
+ BigDecimal warnNum = item.getWarnNum();
+ if (quantity == null || warnNum == null) {
+ return false;
+ }
+ return quantity.compareTo(warnNum) <= 0;
+ }
+
+ private Map<String, Object> warningItem(String level, String title, long count, String detail) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("level", level);
+ map.put("title", title);
+ map.put("count", count);
+ map.put("detail", detail);
+ return map;
+ }
+
+ private Map<String, Object> actionCard(String code,
+ String name,
+ String method,
+ String targetApi,
+ List<String> requiredFields,
+ Map<String, Object> examplePayload,
+ String description) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("code", code);
+ map.put("name", name);
+ map.put("method", method);
+ map.put("targetApi", targetApi);
+ map.put("requiredFields", requiredFields);
+ map.put("examplePayload", examplePayload);
+ map.put("description", description);
+ return map;
+ }
+
+ private Map<String, Object> metric(String label, String value) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("label", label);
+ map.put("value", value);
+ return map;
+ }
+
+ private Map<String, Object> rangeSummary(DateRange range, int count, String keyword) {
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", range.start().toString());
+ summary.put("endDate", range.end().toString());
+ summary.put("count", count);
+ summary.put("keyword", safe(keyword));
+ return summary;
+ }
+
+ private Map<String, Object> buildDomainBarOption(Map<String, Object> summary) {
+ List<String> xData = List.of("璁″垝", "宸ュ崟", "璁惧", "璐ㄩ噺", "鐗╂枡", "寮傚父");
+ List<Number> yData = List.of(
+ numberValue(summary.get("planTotal")),
+ numberValue(summary.get("workOrderTotal")),
+ numberValue(summary.get("deviceTotal")),
+ numberValue(summary.get("qualityNgCount")),
+ numberValue(summary.get("lowStockCount")),
+ numberValue(summary.get("exceptionCount"))
+ );
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "鍒堕�犲煙鍏抽敭鏁伴噺", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "鏁伴噺", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildQualityPieOption(long inspectTotal, long ngCount) {
+ long passCount = Math.max(inspectTotal - ngCount, 0);
+ List<Map<String, Object>> data = List.of(
+ Map.of("name", "涓嶅悎鏍�", "value", ngCount),
+ Map.of("name", "闈炰笉鍚堟牸", "value", passCount)
+ );
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "璐ㄩ噺缁撴灉鍒嗗竷", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "item"));
+ option.put("series", List.of(Map.of("name", "璐ㄩ噺", "type", "pie", "radius", "60%", "data", data)));
+ return option;
+ }
+
+ private int numberValue(Object value) {
+ if (value instanceof Number number) {
+ return number.intValue();
+ }
+ return 0;
+ }
+
+ private String toRate(long numerator, long denominator) {
+ if (denominator <= 0) {
+ return "0.00%";
+ }
+ BigDecimal rate = new BigDecimal(numerator)
+ .multiply(new BigDecimal("100"))
+ .divide(new BigDecimal(denominator), 2, RoundingMode.HALF_UP);
+ return rate.toPlainString() + "%";
+ }
+
+ private String normalizeDomain(String domain) {
+ if (!StringUtils.hasText(domain)) {
+ return "";
+ }
+ String value = domain.trim().toLowerCase();
+ return switch (value) {
+ case "鐢熶骇鐜板満", "site", "factory", "workshop" -> "site";
+ case "璁″垝", "plan", "schedule" -> "plan";
+ case "宸ュ崟", "workorder", "work_order", "task" -> "workorder";
+ case "璁惧", "device", "equipment" -> "device";
+ case "缁翠慨", "repair", "maintenance" -> "repair";
+ case "璐ㄩ噺", "quality", "qc" -> "quality";
+ case "鐗╂枡", "material", "inventory", "stock" -> "material";
+ case "寮傚父", "exception", "abnormal" -> "exception";
+ default -> value;
+ };
+ }
+
+ private boolean isRepairIntent(String keyword, String userQuery) {
+ String query = safe(userQuery);
+ return containsAny(safe(keyword), "缁翠慨", "鎶ヤ慨", "妫�淇�", "缁存姢")
+ || containsAny(query, "缁翠慨", "鎶ヤ慨", "妫�淇�", "缁存姢");
+ }
+
+ private String normalizeDeviceQueryKeyword(String keyword, String userQuery) {
+ String source = StringUtils.hasText(keyword) ? keyword : userQuery;
+ if (!StringUtils.hasText(source)) {
+ return null;
+ }
+ String cleaned = source
+ .replace("鏌ヨ", "")
+ .replace("鏌ョ湅", "")
+ .replace("甯垜", "")
+ .replace("璇�", "")
+ .replace("鏌�", "")
+ .replace("璁惧", "")
+ .replace("缁翠慨璁板綍", "")
+ .replace("缁翠慨鎯呭喌", "")
+ .replace("鎶ヤ慨璁板綍", "")
+ .replace("鎶ヤ慨鎯呭喌", "")
+ .replace("缁翠慨", "")
+ .replace("鎶ヤ慨", "")
+ .replace("鎯呭喌", "")
+ .replace("璁板綍", "")
+ .replace("淇℃伅", "")
+ .replace("鐨�", "")
+ .replace("涓�涓�", "")
+ .trim();
+ return cleaned.length() >= 2 ? cleaned : null;
+ }
+
+ private List<Long> findDeviceLedgerIdsByKeyword(LoginUser loginUser, String keyword) {
+ if (!StringUtils.hasText(keyword)) {
+ return List.of();
+ }
+ LambdaQueryWrapper<DeviceLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), DeviceLedger::getTenantId);
+ Long currentDeptId = loginUser.getCurrentDeptId();
+ if (currentDeptId != null) {
+ wrapper.and(w -> w.eq(DeviceLedger::getDeptId, currentDeptId).or().isNull(DeviceLedger::getDeptId));
+ }
+ wrapper.and(w -> w.like(DeviceLedger::getDeviceName, keyword)
+ .or().like(DeviceLedger::getDeviceModel, keyword)
+ .or().like(DeviceLedger::getDeviceBrand, keyword));
+ wrapper.orderByDesc(DeviceLedger::getId).last("limit 200");
+ return defaultList(deviceLedgerMapper.selectList(wrapper)).stream()
+ .map(DeviceLedger::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ }
+
+ private boolean hasTimeConstraint(String startDate, String endDate, String userQuery) {
+ if (StringUtils.hasText(startDate) || StringUtils.hasText(endDate)) {
+ return true;
+ }
+ if (!StringUtils.hasText(userQuery)) {
+ return false;
+ }
+ String text = userQuery.trim();
+ return containsAny(text, "浠婂ぉ", "鏄ㄥぉ", "鏈懆", "涓婂懆", "鏈湀", "涓婃湀", "浠婂勾", "鍘诲勾", "杩�", "鏈�杩�");
+ }
+
+ private DateRange resolveDateRange(String startDate, String endDate, String timeRange) {
+ LocalDate today = LocalDate.now();
+ LocalDate start = parseLocalDate(startDate);
+ LocalDate end = parseLocalDate(endDate);
+ if (start != null || end != null) {
+ LocalDate s = start != null ? start : end;
+ LocalDate e = end != null ? end : start;
+ if (s.isAfter(e)) {
+ LocalDate temp = s;
+ s = e;
+ e = temp;
+ }
+ return new DateRange(s, e, s + "鑷�" + e);
+ }
+ if (!StringUtils.hasText(timeRange)) {
+ return new DateRange(today.minusDays(29), today, "杩�30澶�");
+ }
+ String text = timeRange.trim();
+ if (text.contains("浠婂ぉ")) {
+ return new DateRange(today, today, "浠婂ぉ");
+ }
+ if (text.contains("鏈懆")) {
+ LocalDate startOfWeek = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ return new DateRange(startOfWeek, today, "鏈懆");
+ }
+ if (text.contains("鏈湀")) {
+ return new DateRange(today.withDayOfMonth(1), today, "鏈湀");
+ }
+ if (text.contains("鏈勾") || text.contains("浠婂勾")) {
+ return new DateRange(today.withDayOfYear(1), today, "浠婂勾");
+ }
+ if (text.contains("鍘诲勾")) {
+ LocalDate firstDay = today.minusYears(1).withDayOfYear(1);
+ LocalDate lastDay = today.minusYears(1).withMonth(12).withDayOfMonth(31);
+ return new DateRange(firstDay, lastDay, "鍘诲勾");
+ }
+ if (text.contains("涓婃湀")) {
+ LocalDate startOfLastMonth = today.minusMonths(1).withDayOfMonth(1);
+ return new DateRange(startOfLastMonth, startOfLastMonth.withDayOfMonth(startOfLastMonth.lengthOfMonth()), "涓婃湀");
+ }
+ java.util.regex.Matcher matcher = java.util.regex.Pattern.compile("(杩憒鏈�杩�)(\\d+)(澶﹟鍛▅涓湀|鏈坾骞�)").matcher(text);
+ if (matcher.find()) {
+ int amount = Integer.parseInt(matcher.group(2));
+ String unit = matcher.group(3);
+ LocalDate relativeStart = switch (unit) {
+ case "澶�" -> today.minusDays(Math.max(amount - 1L, 0));
+ case "鍛�" -> today.minusWeeks(Math.max(amount, 1)).plusDays(1);
+ case "涓湀", "鏈�" -> today.minusMonths(Math.max(amount, 1)).plusDays(1);
+ case "骞�" -> today.minusYears(Math.max(amount, 1)).plusDays(1);
+ default -> today.minusDays(29);
+ };
+ return new DateRange(relativeStart, today, "杩�" + amount + unit);
+ }
+ return new DateRange(today.minusDays(29), today, "杩�30澶�");
+ }
+
+ private LocalDate parseLocalDate(String text) {
+ if (!StringUtils.hasText(text)) {
+ return null;
+ }
+ return LocalDate.parse(text.trim(), DATE_FMT);
+ }
+
+ private Date toDate(LocalDate date) {
+ return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private Date toExclusiveEndDate(LocalDate date) {
+ return Date.from(date.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private String formatDate(LocalDate date) {
+ return date == null ? "" : DATE_FMT.format(date);
+ }
+
+ private String formatDate(Date date) {
+ if (date == null) {
+ return "";
+ }
+ return DATE_FMT.format(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
+ }
+
+ private String formatDateTime(LocalDateTime time) {
+ if (time == null) {
+ return "";
+ }
+ return time.truncatedTo(ChronoUnit.SECONDS).toString().replace('T', ' ');
+ }
+
+ private int normalizeLimit(Integer limit) {
+ if (limit == null || limit <= 0) {
+ return DEFAULT_LIMIT;
+ }
+ return Math.min(limit, MAX_LIMIT);
+ }
+
+ private boolean containsAny(String text, String... values) {
+ for (String value : values) {
+ if (text.contains(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private <T> void applyTenantFilter(LambdaQueryWrapper<T> wrapper, Long tenantId, SFunction<T, Long> field) {
+ if (tenantId != null) {
+ wrapper.eq(field, tenantId);
+ }
+ }
+
+ private <T> void applyDeptFilter(LambdaQueryWrapper<T> wrapper, Long deptId, SFunction<T, Long> field) {
+ if (deptId != null) {
+ wrapper.eq(field, deptId);
+ }
+ }
+
+ private LoginUser currentLoginUser(String memoryId) {
+ LoginUser loginUser = aiSessionUserContext.get(memoryId);
+ if (loginUser != null) {
+ return loginUser;
+ }
+ return SecurityUtils.getLoginUser();
+ }
+
+ private String safe(Object value) {
+ return value == null ? "" : String.valueOf(value).replace('\n', ' ').replace('\r', ' ');
+ }
+
+ private <T> List<T> defaultList(List<T> list) {
+ return list == null ? List.of() : list;
+ }
+
+ private String jsonResponse(boolean success,
+ String type,
+ String description,
+ Map<String, Object> summary,
+ Map<String, Object> data,
+ Map<String, Object> charts) {
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("success", success);
+ result.put("type", type);
+ result.put("description", description);
+ result.put("summary", summary == null ? Map.of() : summary);
+ result.put("data", data == null ? Map.of() : data);
+ result.put("charts", charts == null ? Map.of() : charts);
+ return JSON.toJSONString(result);
+ }
+
+ private record DateRange(LocalDate start, LocalDate end, String label) {
+ }
+}
diff --git a/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java b/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java
index 17b6868..bdd1f1f 100644
--- a/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java
+++ b/src/main/java/com/ruoyi/ai/tools/PurchaseAgentTools.java
@@ -2,23 +2,29 @@
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.account.mapper.purchase.AccountPaymentApplicationMapper;
+import com.ruoyi.account.mapper.purchase.AccountPurchaseInvoiceMapper;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.pojo.purchase.AccountPaymentApplication;
+import com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
import com.ruoyi.ai.context.AiSessionUserContext;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.purchase.mapper.InvoicePurchaseMapper;
-import com.ruoyi.purchase.mapper.PaymentRegistrationMapper;
-import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
-import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
-import com.ruoyi.purchase.pojo.InvoicePurchase;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import com.ruoyi.purchase.pojo.PurchaseLedger;
-import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import com.ruoyi.procurementrecord.mapper.InboundManagementMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.pojo.InboundManagement;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
+import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
+import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
+import com.ruoyi.purchase.pojo.PurchaseLedger;
+import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
+import com.ruoyi.quality.mapper.QualityInspectMapper;
+import com.ruoyi.quality.pojo.QualityInspect;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.stock.mapper.StockInRecordMapper;
+import com.ruoyi.stock.pojo.StockInRecord;
import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
@@ -27,48 +33,52 @@
import java.math.BigDecimal;
import java.time.LocalDate;
-import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Comparator;
+import java.util.*;
import java.util.stream.Collectors;
@Component
public class PurchaseAgentTools {
private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
private static final int DEFAULT_LIMIT = 10;
private static final int MAX_LIMIT = 30;
private final PurchaseLedgerMapper purchaseLedgerMapper;
- private final PaymentRegistrationMapper paymentRegistrationMapper;
- private final InvoicePurchaseMapper invoicePurchaseMapper;
private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
private final SalesLedgerProductMapper salesLedgerProductMapper;
private final ProcurementRecordMapper procurementRecordMapper;
private final InboundManagementMapper inboundManagementMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private final AccountPaymentApplicationMapper accountPaymentApplicationMapper;
+ private final AccountPurchaseInvoiceMapper accountPurchaseInvoiceMapper;
+ private final StockInRecordMapper stockInRecordMapper;
+ private final QualityInspectMapper qualityInspectMapper;
private final AiSessionUserContext aiSessionUserContext;
public PurchaseAgentTools(PurchaseLedgerMapper purchaseLedgerMapper,
- PaymentRegistrationMapper paymentRegistrationMapper,
- InvoicePurchaseMapper invoicePurchaseMapper,
PurchaseReturnOrdersMapper purchaseReturnOrdersMapper,
SalesLedgerProductMapper salesLedgerProductMapper,
ProcurementRecordMapper procurementRecordMapper,
InboundManagementMapper inboundManagementMapper,
+ AccountPurchasePaymentMapper accountPurchasePaymentMapper,
+ AccountPaymentApplicationMapper accountPaymentApplicationMapper,
+ AccountPurchaseInvoiceMapper accountPurchaseInvoiceMapper,
+ StockInRecordMapper stockInRecordMapper,
+ QualityInspectMapper qualityInspectMapper,
AiSessionUserContext aiSessionUserContext) {
this.purchaseLedgerMapper = purchaseLedgerMapper;
- this.paymentRegistrationMapper = paymentRegistrationMapper;
- this.invoicePurchaseMapper = invoicePurchaseMapper;
this.purchaseReturnOrdersMapper = purchaseReturnOrdersMapper;
this.salesLedgerProductMapper = salesLedgerProductMapper;
this.procurementRecordMapper = procurementRecordMapper;
this.inboundManagementMapper = inboundManagementMapper;
+ this.accountPurchasePaymentMapper = accountPurchasePaymentMapper;
+ this.accountPaymentApplicationMapper = accountPaymentApplicationMapper;
+ this.accountPurchaseInvoiceMapper = accountPurchaseInvoiceMapper;
+ this.stockInRecordMapper = stockInRecordMapper;
+ this.qualityInspectMapper = qualityInspectMapper;
this.aiSessionUserContext = aiSessionUserContext;
}
@@ -130,8 +140,8 @@
DateRange range = resolveDateRange(startDate, endDate, timeRange);
List<PurchaseLedger> ledgers = queryLedgers(loginUser, range);
- List<PaymentRegistration> payments = queryPayments(loginUser, range);
- List<InvoicePurchase> invoices = queryInvoices(loginUser, range);
+ List<AccountPurchasePayment> payments = queryPayments(loginUser, range);
+ List<AccountPurchaseInvoice> invoices = queryInvoices(loginUser, range);
List<PurchaseReturnOrders> returns = queryReturns(loginUser, range);
BigDecimal contractAmount = ledgers.stream()
@@ -139,11 +149,11 @@
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal paymentAmount = payments.stream()
- .map(PaymentRegistration::getCurrentPaymentAmount)
+ .map(AccountPurchasePayment::getPaymentAmount)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal invoiceAmount = invoices.stream()
- .map(InvoicePurchase::getInvoiceAmount)
+ .map(this::invoiceAmountOf)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal returnAmount = returns.stream()
@@ -279,15 +289,37 @@
@P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
LoginUser loginUser = currentLoginUser(memoryId);
DateRange range = resolveDateRange(startDate, endDate, null);
- List<Map<String, Object>> items = queryLedgers(loginUser, range).stream()
+ List<PurchaseLedger> matchedLedgers = queryLedgers(loginUser, range).stream()
.filter(ledger -> matchLedgerKeyword(ledger, keyword))
- .map(ledger -> toPendingPaymentItem(loginUser, ledger))
+ .collect(Collectors.toList());
+ Map<Long, BigDecimal> paidAmountByLedgerId = sumPaymentAmountByLedgerId(loginUser, matchedLedgers.stream()
+ .map(PurchaseLedger::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList()));
+ List<Map<String, Object>> items = matchedLedgers.stream()
+ .map(ledger -> toPendingPaymentItem(ledger, paidAmountByLedgerId.getOrDefault(ledger.getId(), BigDecimal.ZERO)))
.filter(Objects::nonNull)
.sorted(Comparator.comparing(item -> (BigDecimal) item.get("pendingAmount"), Comparator.reverseOrder()))
.limit(normalizeLimit(limit))
.collect(Collectors.toList());
+
+ BigDecimal totalContractAmount = items.stream()
+ .map(item -> asBigDecimal(item.get("contractAmount")))
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal totalPaidAmount = items.stream()
+ .map(item -> asBigDecimal(item.get("paidAmount")))
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal totalPendingAmount = items.stream()
+ .map(item -> asBigDecimal(item.get("pendingAmount")))
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ Map<String, Object> summary = rangeSummary(range, items.size());
+ summary.put("pendingOrderCount", items.size());
+ summary.put("totalContractAmount", totalContractAmount);
+ summary.put("totalPaidAmount", totalPaidAmount);
+ summary.put("totalPendingAmount", totalPendingAmount);
+
return jsonResponse(true, "purchase_pending_payment_list", "宸茶繑鍥炲緟浠樻閲囪喘鍗曘��",
- rangeSummary(range, items.size()), Map.of("items", items), Map.of());
+ summary, Map.of("items", items), Map.of());
}
@Tool(name = "鏌ヨ閲囪喘閫�璐ф儏鍐�", value = "鎸夋椂闂磋寖鍥存煡璇㈤噰璐��璐у崟鍒楄〃鍜岄��璐ч噾棰濄��")
@@ -406,27 +438,58 @@
return map;
}
- private Map<String, Object> toPendingPaymentItem(LoginUser loginUser, PurchaseLedger ledger) {
+ private Map<String, Object> toPendingPaymentItem(PurchaseLedger ledger, BigDecimal paidAmount) {
BigDecimal contractAmount = defaultDecimal(ledger.getContractAmount());
- BigDecimal paidAmount = sumPaymentAmount(loginUser, ledger.getId());
- BigDecimal pendingAmount = contractAmount.subtract(paidAmount);
+ BigDecimal safePaidAmount = defaultDecimal(paidAmount);
+ BigDecimal pendingAmount = contractAmount.subtract(safePaidAmount);
if (pendingAmount.compareTo(BigDecimal.ZERO) <= 0) {
return null;
}
Map<String, Object> item = toLedgerItem(ledger);
- item.put("paidAmount", paidAmount);
+ item.put("paidAmount", safePaidAmount);
item.put("pendingAmount", pendingAmount);
return item;
}
- private BigDecimal sumPaymentAmount(LoginUser loginUser, Long purchaseLedgerId) {
- LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>();
- applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId);
- wrapper.eq(PaymentRegistration::getPurchaseLedgerId, purchaseLedgerId);
- return defaultList(paymentRegistrationMapper.selectList(wrapper)).stream()
- .map(PaymentRegistration::getCurrentPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
+ private Map<Long, BigDecimal> sumPaymentAmountByLedgerId(LoginUser loginUser, List<Long> purchaseLedgerIds) {
+ if (purchaseLedgerIds == null || purchaseLedgerIds.isEmpty()) {
+ return Map.of();
+ }
+ List<AccountPurchasePayment> payments = queryPayments(loginUser);
+ if (payments.isEmpty()) {
+ return Map.of();
+ }
+
+ Map<Integer, AccountPaymentApplication> applicationById = queryPaymentApplications(payments);
+ if (applicationById.isEmpty()) {
+ return Map.of();
+ }
+
+ Map<Long, StockInRecord> stockInRecordById = queryStockInRecords(applicationById.values());
+ Map<Long, Long> purchaseLedgerIdByQualityInspectId = queryPurchaseLedgerIdByQualityInspectId(stockInRecordById.values());
+ Set<Long> targetLedgerIdSet = new HashSet<>(purchaseLedgerIds);
+ Map<Long, BigDecimal> result = new HashMap<>();
+
+ for (AccountPurchasePayment payment : payments) {
+ if (payment.getAccountPaymentApplicationId() == null) {
+ continue;
+ }
+ AccountPaymentApplication application = applicationById.get(payment.getAccountPaymentApplicationId());
+ if (application == null) {
+ continue;
+ }
+ Set<Long> ledgerIds = resolvePurchaseLedgerIds(application, stockInRecordById, purchaseLedgerIdByQualityInspectId);
+ if (ledgerIds.isEmpty()) {
+ continue;
+ }
+ BigDecimal amount = defaultDecimal(payment.getPaymentAmount());
+ for (Long ledgerId : ledgerIds) {
+ if (targetLedgerIdSet.contains(ledgerId)) {
+ result.merge(ledgerId, amount, BigDecimal::add);
+ }
+ }
+ }
+ return result;
}
private Map<String, Object> toReturnItem(PurchaseReturnOrders item) {
@@ -446,21 +509,141 @@
return value == null ? BigDecimal.ZERO : value;
}
- private List<PaymentRegistration> queryPayments(LoginUser loginUser, DateRange range) {
- LambdaQueryWrapper<PaymentRegistration> wrapper = new LambdaQueryWrapper<>();
- applyTenantFilter(wrapper, loginUser.getTenantId(), PaymentRegistration::getTenantId);
- wrapper.ge(PaymentRegistration::getPaymentDate, toDate(range.start()))
- .lt(PaymentRegistration::getPaymentDate, toExclusiveEndDate(range.end()));
- return defaultList(paymentRegistrationMapper.selectList(wrapper));
+ private BigDecimal asBigDecimal(Object value) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ if (value instanceof BigDecimal decimal) {
+ return decimal;
+ }
+ if (value instanceof Number number) {
+ return new BigDecimal(String.valueOf(number));
+ }
+ try {
+ return new BigDecimal(String.valueOf(value));
+ } catch (Exception ignored) {
+ return BigDecimal.ZERO;
+ }
}
- private List<InvoicePurchase> queryInvoices(LoginUser loginUser, DateRange range) {
- LambdaQueryWrapper<InvoicePurchase> wrapper = new LambdaQueryWrapper<>();
- applyTenantFilter(wrapper, loginUser.getTenantId(), InvoicePurchase::getTenantId);
- wrapper.ge(InvoicePurchase::getIssueDate, range.start())
- .le(InvoicePurchase::getIssueDate, range.end());
- return defaultList(invoicePurchaseMapper.selectList(wrapper));
+ private BigDecimal invoiceAmountOf(AccountPurchaseInvoice invoice) {
+ if (invoice == null) {
+ return BigDecimal.ZERO;
+ }
+ BigDecimal amount = defaultDecimal(invoice.getTaxInclusivePrice());
+ if (amount.compareTo(BigDecimal.ZERO) > 0) {
+ return amount;
+ }
+ return defaultDecimal(invoice.getTaxExclusivelPrice()).add(defaultDecimal(invoice.getTaxPrice()));
}
+
+ private List<AccountPurchasePayment> queryPayments(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<AccountPurchasePayment> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchasePayment::getDeptId);
+ wrapper.ge(AccountPurchasePayment::getPaymentDate, range.start())
+ .le(AccountPurchasePayment::getPaymentDate, range.end())
+ .orderByDesc(AccountPurchasePayment::getPaymentDate, AccountPurchasePayment::getId);
+ return defaultList(accountPurchasePaymentMapper.selectList(wrapper));
+ }
+
+ private List<AccountPurchasePayment> queryPayments(LoginUser loginUser) {
+ LambdaQueryWrapper<AccountPurchasePayment> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchasePayment::getDeptId);
+ return defaultList(accountPurchasePaymentMapper.selectList(wrapper));
+ }
+
+ private List<AccountPurchaseInvoice> queryInvoices(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<AccountPurchaseInvoice> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountPurchaseInvoice::getDeptId);
+ wrapper.ge(AccountPurchaseInvoice::getIssueDate, range.start())
+ .le(AccountPurchaseInvoice::getIssueDate, range.end())
+ .orderByDesc(AccountPurchaseInvoice::getIssueDate, AccountPurchaseInvoice::getId);
+ return defaultList(accountPurchaseInvoiceMapper.selectList(wrapper));
+ }
+
+ private Map<Integer, AccountPaymentApplication> queryPaymentApplications(List<AccountPurchasePayment> payments) {
+ List<Integer> ids = payments.stream()
+ .map(AccountPurchasePayment::getAccountPaymentApplicationId)
+ .filter(Objects::nonNull)
+ .distinct()
+ .collect(Collectors.toList());
+ if (ids.isEmpty()) {
+ return Map.of();
+ }
+ return defaultList(accountPaymentApplicationMapper.selectBatchIds(ids)).stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(AccountPaymentApplication::getId, item -> item, (a, b) -> a));
+ }
+
+ private Map<Long, StockInRecord> queryStockInRecords(Collection<AccountPaymentApplication> applications) {
+ Set<Long> stockInRecordIds = new HashSet<>();
+ for (AccountPaymentApplication application : applications) {
+ stockInRecordIds.addAll(parseLongIds(application.getStockInRecordIds()));
+ }
+ if (stockInRecordIds.isEmpty()) {
+ return Map.of();
+ }
+ return defaultList(stockInRecordMapper.selectBatchIds(stockInRecordIds)).stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(StockInRecord::getId, item -> item, (a, b) -> a));
+ }
+
+ private Map<Long, Long> queryPurchaseLedgerIdByQualityInspectId(Collection<StockInRecord> stockInRecords) {
+ Set<Long> qualityInspectIds = stockInRecords.stream()
+ .filter(Objects::nonNull)
+ .filter(item -> item.getRecordId() != null && "10".equals(safe(item.getRecordType()).trim()))
+ .map(StockInRecord::getRecordId)
+ .collect(Collectors.toSet());
+ if (qualityInspectIds.isEmpty()) {
+ return Map.of();
+ }
+ return defaultList(qualityInspectMapper.selectBatchIds(qualityInspectIds)).stream()
+ .filter(item -> item.getId() != null && item.getPurchaseLedgerId() != null)
+ .collect(Collectors.toMap(QualityInspect::getId, QualityInspect::getPurchaseLedgerId, (a, b) -> a));
+ }
+
+ private Set<Long> resolvePurchaseLedgerIds(AccountPaymentApplication application,
+ Map<Long, StockInRecord> stockInRecordById,
+ Map<Long, Long> purchaseLedgerIdByQualityInspectId) {
+ Set<Long> result = new LinkedHashSet<>();
+ for (Long stockInRecordId : parseLongIds(application.getStockInRecordIds())) {
+ StockInRecord stockInRecord = stockInRecordById.get(stockInRecordId);
+ if (stockInRecord == null || stockInRecord.getRecordId() == null) {
+ continue;
+ }
+ if (stockInRecord.getApprovalStatus() != null && stockInRecord.getApprovalStatus() != 1) {
+ continue;
+ }
+ String recordType = safe(stockInRecord.getRecordType()).trim();
+ if ("7".equals(recordType)) {
+ result.add(stockInRecord.getRecordId());
+ } else if ("10".equals(recordType)) {
+ Long purchaseLedgerId = purchaseLedgerIdByQualityInspectId.get(stockInRecord.getRecordId());
+ if (purchaseLedgerId != null) {
+ result.add(purchaseLedgerId);
+ }
+ }
+ }
+ return result;
+ }
+
+ private List<Long> parseLongIds(String raw) {
+ if (!StringUtils.hasText(raw)) {
+ return List.of();
+ }
+ List<Long> result = new ArrayList<>();
+ for (String part : raw.split(",")) {
+ if (!StringUtils.hasText(part)) {
+ continue;
+ }
+ try {
+ result.add(Long.parseLong(part.trim()));
+ } catch (Exception ignored) {
+ }
+ }
+ return result;
+ }
+
private List<PurchaseReturnOrders> queryReturns(LoginUser loginUser, DateRange range) {
LambdaQueryWrapper<PurchaseReturnOrders> wrapper = new LambdaQueryWrapper<>();
@@ -484,7 +667,7 @@
}
private DateRange resolveDateRange(String startDate, String endDate, String timeRange) {
- LocalDate today = LocalDate.now();
+ LocalDate today = LocalDate.now(CHINA_ZONE_ID);
LocalDate start = parseLocalDate(startDate);
LocalDate end = parseLocalDate(endDate);
if (start != null || end != null) {
@@ -501,6 +684,22 @@
return new DateRange(today.minusDays(29), today, "杩�30澶�");
}
String text = timeRange.trim();
+ if (text.contains("浠婂ぉ")) {
+ return new DateRange(today, today, "浠婂ぉ");
+ }
+ if (text.contains("鏄ㄥぉ")) {
+ LocalDate yesterday = today.minusDays(1);
+ return new DateRange(yesterday, yesterday, "鏄ㄥぉ");
+ }
+ if (text.contains("鏈懆")) {
+ LocalDate startOfWeek = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ return new DateRange(startOfWeek, today, "鏈懆");
+ }
+ if (text.contains("涓婂懆")) {
+ LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ LocalDate startOfLastWeek = thisWeekStart.minusWeeks(1);
+ return new DateRange(startOfLastWeek, startOfLastWeek.plusDays(6), "涓婂懆");
+ }
if (text.contains("浠婂勾") || text.contains("鏈勾")) {
return new DateRange(today.withDayOfYear(1), today, "浠婂勾");
}
@@ -538,7 +737,11 @@
if (!StringUtils.hasText(text)) {
return null;
}
- return LocalDate.parse(text.trim(), DATE_FMT);
+ try {
+ return LocalDate.parse(text.trim(), DATE_FMT);
+ } catch (Exception ignored) {
+ return null;
+ }
}
private Date toDate(LocalDate localDate) {
diff --git a/src/main/java/com/ruoyi/ai/tools/SalesAgentTools.java b/src/main/java/com/ruoyi/ai/tools/SalesAgentTools.java
new file mode 100644
index 0000000..0f7e586
--- /dev/null
+++ b/src/main/java/com/ruoyi/ai/tools/SalesAgentTools.java
@@ -0,0 +1,1633 @@
+package com.ruoyi.ai.tools;
+
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.ai.context.AiSessionUserContext;
+import com.ruoyi.basic.dto.CustomerDto;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.vo.CustomerVo;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import com.ruoyi.sales.mapper.SalesQuotationMapper;
+import com.ruoyi.sales.mapper.ShippingInfoMapper;
+import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.SalesQuotation;
+import com.ruoyi.sales.pojo.ShippingInfo;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
+import com.ruoyi.stock.pojo.StockOutRecord;
+import dev.langchain4j.agent.tool.P;
+import dev.langchain4j.agent.tool.Tool;
+import dev.langchain4j.agent.tool.ToolMemoryId;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.YearMonth;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+@Component
+public class SalesAgentTools {
+
+ private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final int DEFAULT_LIMIT = 10;
+ private static final int MAX_LIMIT = 30;
+ private static final BigDecimal ONE_HUNDRED = new BigDecimal("100");
+ private static final Pattern RELATIVE_PATTERN = Pattern.compile("(杩憒鏈�杩�)?\\s*(\\d+)\\s*(澶﹟鍛▅涓湀|鏈坾骞�)");
+ private static final Pattern DATE_PATTERN = Pattern.compile("(\\d{4}-\\d{2}-\\d{2})");
+
+ private final CustomerMapper customerMapper;
+ private final SalesLedgerMapper salesLedgerMapper;
+ private final SalesQuotationMapper salesQuotationMapper;
+ private final ShippingInfoMapper shippingInfoMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final StockOutRecordMapper stockOutRecordMapper;
+ private final AiSessionUserContext aiSessionUserContext;
+
+ public SalesAgentTools(CustomerMapper customerMapper,
+ SalesLedgerMapper salesLedgerMapper,
+ SalesQuotationMapper salesQuotationMapper,
+ ShippingInfoMapper shippingInfoMapper,
+ AccountSalesCollectionMapper accountSalesCollectionMapper,
+ StockOutRecordMapper stockOutRecordMapper,
+ AiSessionUserContext aiSessionUserContext) {
+ this.customerMapper = customerMapper;
+ this.salesLedgerMapper = salesLedgerMapper;
+ this.salesQuotationMapper = salesQuotationMapper;
+ this.shippingInfoMapper = shippingInfoMapper;
+ this.accountSalesCollectionMapper = accountSalesCollectionMapper;
+ this.stockOutRecordMapper = stockOutRecordMapper;
+ this.aiSessionUserContext = aiSessionUserContext;
+ }
+
+ @Tool(name = "鏌ヨ瀹㈡埛妗f", value = "鎸夌娴�/鍏捣绫诲瀷鍜屽叧閿瘝鏌ヨ瀹㈡埛妗f鍒楄〃")
+ public String listCustomerProfiles(@ToolMemoryId String memoryId,
+ @P(value = "瀹㈡埛姹犵被鍨嬶紝鍙�� private/public", required = false) String seaType,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶅鎴峰悕绉�/鑱旂郴浜�/鐢佃瘽", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ CustomerDto customerDto = new CustomerDto();
+ customerDto.setType(normalizeSeaType(seaType));
+ customerDto.setUsageStatus(1L);
+
+ List<CustomerVo> rows = defaultList(customerMapper.list(customerDto, loginUser.getUserId()));
+ List<CustomerVo> filtered = rows.stream()
+ .filter(item -> matchCustomerKeyword(item, keyword))
+ .sorted(Comparator.comparing(CustomerVo::getId, Comparator.nullsLast(Comparator.reverseOrder())))
+ .limit(normalizeLimit(limit))
+ .collect(Collectors.toList());
+
+ List<Map<String, Object>> items = filtered.stream().map(item -> {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("customerName", safe(item.getCustomerName()));
+ map.put("customerType", safe(item.getCustomerType()));
+ map.put("contactPerson", safe(item.getContactPerson()));
+ map.put("contactPhone", safe(item.getContactPhone()));
+ map.put("companyPhone", safe(item.getCompanyPhone()));
+ map.put("maintainer", safe(item.getMaintainer()));
+ map.put("maintenanceTime", formatDate(item.getMaintenanceTime()));
+ map.put("usageUserName", safe(item.getUsageUserName()));
+ map.put("seaType", customerSeaTypeName(item.getType()));
+ map.put("isAssigned", item.getIsAssigned());
+ return map;
+ }).collect(Collectors.toList());
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("count", items.size());
+ summary.put("seaType", seaType == null ? "all" : seaType);
+ summary.put("keyword", safe(keyword));
+ summary.put("userId", loginUser.getUserId());
+
+ return jsonResponse(true, "sales_customer_profile_list", "宸茶繑鍥炲鎴锋。妗堝垪琛�", summary, Map.of("items", items), Map.of());
+ }
+
+ @Tool(name = "鏌ヨ閿�鍞姤浠�", value = "鎸夊叧閿瘝鍜屾椂闂磋寖鍥存煡璇㈤攢鍞姤浠峰崟")
+ public String listSalesQuotations(@ToolMemoryId String memoryId,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶆姤浠峰崟鍙�/瀹㈡埛/涓氬姟鍛�/鐘舵��", required = false) String keyword,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, null);
+ LambdaQueryWrapper<SalesQuotation> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), SalesQuotation::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesQuotation::getDeptId);
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(SalesQuotation::getQuotationNo, keyword)
+ .or().like(SalesQuotation::getCustomer, keyword)
+ .or().like(SalesQuotation::getSalesperson, keyword)
+ .or().like(SalesQuotation::getStatus, keyword));
+ }
+ wrapper.ge(SalesQuotation::getQuotationDate, range.start())
+ .le(SalesQuotation::getQuotationDate, range.end())
+ .orderByDesc(SalesQuotation::getQuotationDate, SalesQuotation::getId)
+ .last("limit " + normalizeLimit(limit));
+
+ List<SalesQuotation> rows = defaultList(salesQuotationMapper.selectList(wrapper));
+ BigDecimal quotationAmountTotal = rows.stream()
+ .map(SalesQuotation::getTotalAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ List<Map<String, Object>> items = rows.stream().map(item -> {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("quotationNo", safe(item.getQuotationNo()));
+ map.put("customer", safe(item.getCustomer()));
+ map.put("salesperson", safe(item.getSalesperson()));
+ map.put("quotationDate", formatDate(item.getQuotationDate()));
+ map.put("validDate", formatDate(item.getValidDate()));
+ map.put("status", safe(item.getStatus()));
+ map.put("paymentMethod", safe(item.getPaymentMethod()));
+ map.put("deliveryPeriod", safe(item.getDeliveryPeriod()));
+ map.put("totalAmount", item.getTotalAmount());
+ return map;
+ }).collect(Collectors.toList());
+
+ Map<String, Object> summary = rangeSummary(range, items.size(), keyword);
+ summary.put("quotationAmountTotal", quotationAmountTotal);
+ return jsonResponse(true, "sales_quotation_list", "宸茶繑鍥為攢鍞姤浠峰垪琛�", summary, Map.of("items", items), Map.of());
+ }
+
+ @Tool(name = "鏌ヨ閿�鍞彴璐�", value = "鎸夊叧閿瘝鍜屾椂闂磋寖鍥存煡璇㈤攢鍞彴璐︼紝骞惰繑鍥炲紑绁ㄥ洖娆句笌鍙戣揣鐘舵��")
+ public String listSalesLedgers(@ToolMemoryId String memoryId,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶉攢鍞悎鍚屽彿/瀹㈡埛鍚堝悓鍙�/瀹㈡埛/椤圭洰", required = false) String keyword,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, null);
+ LambdaQueryWrapper<SalesLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), SalesLedger::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesLedger::getDeptId);
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(SalesLedger::getSalesContractNo, keyword)
+ .or().like(SalesLedger::getCustomerContractNo, keyword)
+ .or().like(SalesLedger::getCustomerName, keyword)
+ .or().like(SalesLedger::getProjectName, keyword)
+ .or().like(SalesLedger::getSalesman, keyword));
+ }
+ wrapper.ge(SalesLedger::getEntryDate, toDate(range.start()))
+ .lt(SalesLedger::getEntryDate, toExclusiveEndDate(range.end()))
+ .orderByDesc(SalesLedger::getEntryDate, SalesLedger::getId)
+ .last("limit " + normalizeLimit(limit));
+ List<SalesLedger> rows = defaultList(salesLedgerMapper.selectList(wrapper));
+ if (rows.isEmpty()) {
+ return jsonResponse(true, "sales_ledger_list", "鏈煡璇㈠埌绗﹀悎鏉′欢鐨勯攢鍞彴璐�", rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of());
+ }
+
+ List<Long> ledgerIds = rows.stream().map(SalesLedger::getId).filter(Objects::nonNull).collect(Collectors.toList());
+ Map<Long, BigDecimal> invoiceAmountByLedgerId = sumInvoiceAmounts(ledgerIds);
+ Map<Long, BigDecimal> receiptAmountByLedgerId = sumReceiptAmounts(loginUser, ledgerIds);
+ Map<Long, List<ShippingInfo>> shippingByLedgerId = queryShippingsByLedgerIds(loginUser, ledgerIds).stream()
+ .collect(Collectors.groupingBy(ShippingInfo::getSalesLedgerId));
+
+ BigDecimal contractAmountTotal = BigDecimal.ZERO;
+ BigDecimal invoicedAmountTotal = BigDecimal.ZERO;
+ BigDecimal receivedAmountTotal = BigDecimal.ZERO;
+ BigDecimal pendingAmountTotal = BigDecimal.ZERO;
+
+ List<Map<String, Object>> items = new ArrayList<>();
+ for (SalesLedger ledger : rows) {
+ BigDecimal contractAmount = defaultDecimal(ledger.getContractAmount());
+ BigDecimal invoicedAmount = invoiceAmountByLedgerId.getOrDefault(ledger.getId(), BigDecimal.ZERO);
+ BigDecimal receivedAmount = receiptAmountByLedgerId.getOrDefault(ledger.getId(), BigDecimal.ZERO);
+ BigDecimal unbilledAmount = maxZero(contractAmount.subtract(invoicedAmount));
+ BigDecimal pendingAmount = maxZero(invoicedAmount.subtract(receivedAmount));
+
+ contractAmountTotal = contractAmountTotal.add(contractAmount);
+ invoicedAmountTotal = invoicedAmountTotal.add(invoicedAmount);
+ receivedAmountTotal = receivedAmountTotal.add(receivedAmount);
+ pendingAmountTotal = pendingAmountTotal.add(pendingAmount);
+
+ Map<String, Object> item = new LinkedHashMap<>();
+ item.put("id", ledger.getId());
+ item.put("salesContractNo", safe(ledger.getSalesContractNo()));
+ item.put("customerContractNo", safe(ledger.getCustomerContractNo()));
+ item.put("customerName", safe(ledger.getCustomerName()));
+ item.put("projectName", safe(ledger.getProjectName()));
+ item.put("salesman", safe(ledger.getSalesman()));
+ item.put("entryDate", formatDate(ledger.getEntryDate()));
+ item.put("executionDate", formatDate(ledger.getExecutionDate()));
+ item.put("deliveryDate", formatDate(ledger.getDeliveryDate()));
+ item.put("contractAmount", contractAmount);
+ item.put("invoicedAmount", invoicedAmount);
+ item.put("receivedAmount", receivedAmount);
+ item.put("unbilledAmount", unbilledAmount);
+ item.put("pendingAmount", pendingAmount);
+ item.put("shippingStatus", calcLedgerShippingStatus(shippingByLedgerId.get(ledger.getId())));
+ items.add(item);
+ }
+
+ Map<String, Object> summary = rangeSummary(range, items.size(), keyword);
+ summary.put("contractAmountTotal", contractAmountTotal);
+ summary.put("invoicedAmountTotal", invoicedAmountTotal);
+ summary.put("receivedAmountTotal", receivedAmountTotal);
+ summary.put("pendingAmountTotal", pendingAmountTotal);
+ return jsonResponse(true, "sales_ledger_list", "宸茶繑鍥為攢鍞彴璐﹀垪琛�", summary, Map.of("items", items), Map.of());
+ }
+
+ @Tool(name = "鏌ヨ閿�鍞��璐�", value = "鎸夋椂闂磋寖鍥村拰鍏抽敭璇嶆煡璇㈤攢鍞��璐ц褰�")
+ public String listSalesReturns(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶉��娆惧崟鍙�/浜ゆ槗鍙�/浠樻璐︽埛", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, null);
+ LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId);
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(AccountSalesCollection::getCollectionNumber, keyword)
+ .or().like(AccountSalesCollection::getCollectionMethod, keyword)
+ .or().like(AccountSalesCollection::getRemark, keyword));
+ }
+ wrapper.ge(AccountSalesCollection::getCollectionDate, range.start())
+ .le(AccountSalesCollection::getCollectionDate, range.end())
+ .orderByDesc(AccountSalesCollection::getCollectionDate, AccountSalesCollection::getId)
+ .last("limit " + normalizeLimit(limit));
+ List<AccountSalesCollection> rows = defaultList(accountSalesCollectionMapper.selectList(wrapper));
+
+ BigDecimal returnAmount = rows.stream()
+ .map(AccountSalesCollection::getCollectionAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ List<Map<String, Object>> items = rows.stream().map(item -> {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("refundId", safe(item.getCollectionNumber()));
+ map.put("collectionNumber", safe(item.getCollectionNumber()));
+ map.put("paymentMethod", safe(item.getCollectionMethod()));
+ map.put("actualAmount", item.getCollectionAmount());
+ map.put("collectionAmount", item.getCollectionAmount());
+ map.put("customerId", item.getCustomerId());
+ map.put("remark", safe(item.getRemark()));
+ map.put("createTime", formatDate(item.getCollectionDate()));
+ return map;
+ }).collect(Collectors.toList());
+
+ Map<String, Object> summary = rangeSummary(range, items.size(), keyword);
+ summary.put("returnAmount", returnAmount);
+ return jsonResponse(true, "sales_return_list", "宸茶繑鍥為攢鍞��璐ц褰�", summary, Map.of("items", items), Map.of());
+ }
+
+ @Tool(name = "鏌ヨ瀹㈡埛寰�鏉�", value = "鎸夋椂闂磋寖鍥村拰鍏抽敭璇嶆煡璇㈠鎴峰洖娆惧線鏉ユ槑缁�")
+ public String listCustomerInteractions(@ToolMemoryId String memoryId,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶅鎴峰悕绉�/閿�鍞悎鍚屽彿/椤圭洰鍚�", required = false) String keyword,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, null);
+ List<AccountSalesCollection> collections = queryCollections(loginUser, range);
+ if (collections.isEmpty()) {
+ return jsonResponse(true, "sales_customer_interaction_list", "no_customer_interactions", rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of());
+ }
+
+ Map<Integer, Set<Long>> ledgerIdsByCollectionId = mapCollectionLedgerIds(loginUser, collections);
+ Set<Long> ledgerIds = ledgerIdsByCollectionId.values().stream()
+ .flatMap(Collection::stream)
+ .collect(Collectors.toSet());
+ Map<Long, SalesLedger> ledgerMap = defaultList(salesLedgerMapper.selectBatchIds(ledgerIds)).stream()
+ .filter(ledger -> tenantMatched(ledger.getTenantId(), loginUser.getTenantId()))
+ .collect(Collectors.toMap(SalesLedger::getId, item -> item, (a, b) -> a, LinkedHashMap::new));
+
+ int finalLimit = normalizeLimit(limit);
+ List<Map<String, Object>> items = new ArrayList<>();
+ for (AccountSalesCollection collection : collections) {
+ Set<Long> relatedLedgerIds = ledgerIdsByCollectionId.get(collection.getId());
+ if (relatedLedgerIds == null || relatedLedgerIds.isEmpty()) {
+ if (!matchInteractionKeyword(collection, null, keyword)) {
+ continue;
+ }
+ items.add(toInteractionItem(collection, null));
+ if (items.size() >= finalLimit) {
+ break;
+ }
+ continue;
+ }
+ for (Long ledgerId : relatedLedgerIds) {
+ SalesLedger ledger = ledgerMap.get(ledgerId);
+ if (ledger == null || !matchInteractionKeyword(collection, ledger, keyword)) {
+ continue;
+ }
+ items.add(toInteractionItem(collection, ledger));
+ if (items.size() >= finalLimit) {
+ break;
+ }
+ }
+ if (items.size() >= finalLimit) {
+ break;
+ }
+ }
+
+ BigDecimal totalReceiptAmount = items.stream()
+ .map(item -> asBigDecimal(item.get("receiptPaymentAmount")))
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ Map<String, Object> summary = rangeSummary(range, items.size(), keyword);
+ summary.put("totalReceiptAmount", totalReceiptAmount);
+ summary.put("customerCount", items.stream()
+ .map(item -> String.valueOf(item.get("customerName")))
+ .filter(StringUtils::hasText)
+ .distinct()
+ .count());
+ return jsonResponse(true, "sales_customer_interaction_list", "ok", summary, Map.of("items", items), Map.of());
+ }
+
+ @Tool(name = "鏌ヨ鍙戣揣鍙拌处", value = "鎸夊叧閿瘝鍜屾椂闂磋寖鍥存煡璇㈠彂璐у彴璐�")
+ public String listShippingLedgers(@ToolMemoryId String memoryId,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶅彂璐у崟鍙�/蹇�掑崟鍙�/鐗╂祦鍏徃/杞︾墝鍙�", required = false) String keyword,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, null);
+ LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), ShippingInfo::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId);
+ if (StringUtils.hasText(keyword)) {
+ wrapper.and(w -> w.like(ShippingInfo::getShippingNo, keyword)
+ .or().like(ShippingInfo::getExpressNumber, keyword)
+ .or().like(ShippingInfo::getExpressCompany, keyword)
+ .or().like(ShippingInfo::getShippingCarNumber, keyword)
+ .or().like(ShippingInfo::getStatus, keyword));
+ }
+ wrapper.ge(ShippingInfo::getShippingDate, toDate(range.start()))
+ .lt(ShippingInfo::getShippingDate, toExclusiveEndDate(range.end()))
+ .orderByDesc(ShippingInfo::getShippingDate, ShippingInfo::getId)
+ .last("limit " + normalizeLimit(limit));
+ List<ShippingInfo> rows = defaultList(shippingInfoMapper.selectList(wrapper));
+ if (rows.isEmpty()) {
+ return jsonResponse(true, "sales_shipping_list", "鏈煡璇㈠埌鍙戣揣鍙拌处璁板綍", rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of());
+ }
+
+ List<Long> ledgerIds = rows.stream().map(ShippingInfo::getSalesLedgerId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+ Map<Long, SalesLedger> ledgerMap = defaultList(salesLedgerMapper.selectBatchIds(ledgerIds)).stream()
+ .filter(ledger -> tenantMatched(ledger.getTenantId(), loginUser.getTenantId()))
+ .collect(Collectors.toMap(SalesLedger::getId, item -> item, (a, b) -> a, LinkedHashMap::new));
+
+ long shippedCount = rows.stream().filter(item -> isShippedStatus(item.getStatus())).count();
+ List<Map<String, Object>> items = rows.stream().map(item -> {
+ SalesLedger ledger = ledgerMap.get(item.getSalesLedgerId());
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", item.getId());
+ map.put("salesLedgerId", item.getSalesLedgerId());
+ map.put("salesContractNo", ledger == null ? "" : safe(ledger.getSalesContractNo()));
+ map.put("customerName", ledger == null ? "" : safe(ledger.getCustomerName()));
+ map.put("shippingNo", safe(item.getShippingNo()));
+ map.put("status", safe(item.getStatus()));
+ map.put("shippingDate", formatDate(item.getShippingDate()));
+ map.put("type", safe(item.getType()));
+ map.put("shippingCarNumber", safe(item.getShippingCarNumber()));
+ map.put("expressCompany", safe(item.getExpressCompany()));
+ map.put("expressNumber", safe(item.getExpressNumber()));
+ return map;
+ }).collect(Collectors.toList());
+
+ Map<String, Object> summary = rangeSummary(range, items.size(), keyword);
+ summary.put("shippingCount", rows.size());
+ summary.put("shippedCount", shippedCount);
+ summary.put("pendingCount", Math.max(rows.size() - shippedCount, 0));
+ return jsonResponse(true, "sales_shipping_list", "宸茶繑鍥炲彂璐у彴璐﹁褰�", summary, Map.of("items", items), Map.of());
+ }
+
+ @Tool(name = "鏌ヨ閿�鍞寚鏍囩粺璁�", value = "鎸夋椂闂磋寖鍥寸粺璁¢攢鍞悎鍚屻�佹姤浠枫�佸彂璐с�佸洖娆剧瓑鍏抽敭鎸囨爣")
+ public String getSalesDashboard(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽鏈湀銆佹湰骞淬�佽繎30澶�", required = false) String timeRange) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, timeRange);
+
+ List<SalesLedger> ledgers = querySalesLedgers(loginUser, range);
+ List<SalesQuotation> quotations = querySalesQuotations(loginUser, range);
+ List<ShippingInfo> shippings = queryShippings(loginUser, range);
+
+
+ BigDecimal contractAmountTotal = ledgers.stream()
+ .map(SalesLedger::getContractAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal quotationAmountTotal = quotations.stream()
+ .map(SalesQuotation::getTotalAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ long shippingCount = shippings.size();
+ long shippedCount = shippings.stream().filter(item -> isShippedStatus(item.getStatus())).count();
+ String shipRate = toRate(shippedCount, shippingCount);
+
+ List<Map<String, Object>> topCustomers = buildTopCustomers(ledgers);
+ TrendData trendData = buildContractTrendData(ledgers, range);
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", range.start().toString());
+ summary.put("endDate", range.end().toString());
+ summary.put("orderCount", ledgers.size());
+ summary.put("quotationCount", quotations.size());
+ summary.put("shippingCount", shippingCount);
+ summary.put("shippedCount", shippedCount);
+ summary.put("shipRate", shipRate);
+ summary.put("contractAmountTotal", contractAmountTotal);
+ summary.put("quotationAmountTotal", quotationAmountTotal);
+ summary.put("receivedAmountTotal", BigDecimal.ZERO);
+ summary.put("pendingAmountTotal", BigDecimal.ZERO);
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+// charts.put("amountBarOption", buildAmountBarOption(contractAmountTotal, quotationAmountTotal, receivedAmountTotal, pendingAmountTotal));
+ charts.put("amountBarOption", buildAmountBarOption(contractAmountTotal, quotationAmountTotal, BigDecimal.ONE, BigDecimal.ONE));
+ charts.put("shippingPieOption", buildShippingPieOption(shippedCount, Math.max(shippingCount - shippedCount, 0)));
+ charts.put("customerTopBarOption", buildCustomerTopBarOption(topCustomers));
+ charts.put("contractTrendLineOption", buildContractTrendLineOption(trendData.labels(), trendData.values()));
+
+ Map<String, Object> data = new LinkedHashMap<>();
+ data.put("topCustomers", topCustomers);
+ data.put("contractTrend", trendData.toItemList());
+
+ return jsonResponse(true, "sales_dashboard", "宸茶繑鍥為攢鍞寚鏍囩粺璁�", summary, data, charts);
+ }
+
+ @Tool(name = "瀹㈡埛娴佸け椋庨櫓鍒嗘瀽", value = "鎸夊鎴风淮搴﹁瘎浼版祦澶遍闄╋紝杈撳嚭椋庨櫓鍒嗙骇銆佸師鍥犲拰寤鸿浼樺厛绾�")
+ public String analyzeCustomerChurnRisk(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽杩�90澶┿�佹湰骞�", required = false) String timeRange,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶅鎴峰悕绉�", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, StringUtils.hasText(timeRange) ? timeRange : "杩�180澶�");
+ List<CustomerRiskMetric> metrics = buildCustomerRiskMetrics(loginUser, range, keyword);
+ if (metrics.isEmpty()) {
+ return jsonResponse(true, "sales_customer_churn_risk", "褰撳墠鑼冨洿鍐呮湭鏌ヨ鍒板彲鍒嗘瀽鐨勫鎴锋暟鎹�",
+ rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of());
+ }
+
+ List<CustomerRiskMetric> sorted = metrics.stream()
+ .sorted(Comparator.comparing(CustomerRiskMetric::getRiskScore).reversed()
+ .thenComparing(CustomerRiskMetric::getPendingAmount, Comparator.reverseOrder()))
+ .limit(normalizeLimit(limit))
+ .collect(Collectors.toList());
+
+ long highCount = sorted.stream().filter(item -> "high".equals(item.getRiskLevel())).count();
+ long mediumCount = sorted.stream().filter(item -> "medium".equals(item.getRiskLevel())).count();
+ long lowCount = sorted.stream().filter(item -> "low".equals(item.getRiskLevel())).count();
+
+ List<Map<String, Object>> items = sorted.stream().map(this::toRiskItem).collect(Collectors.toList());
+ Map<String, Object> summary = rangeSummary(range, items.size(), keyword);
+ summary.put("highRiskCount", highCount);
+ summary.put("mediumRiskCount", mediumCount);
+ summary.put("lowRiskCount", lowCount);
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("riskLevelPieOption", buildRiskLevelPieOption(highCount, mediumCount, lowCount));
+ charts.put("riskScoreBarOption", buildRiskScoreBarOption(sorted));
+
+ return jsonResponse(true, "sales_customer_churn_risk", "宸插畬鎴愬鎴锋祦澶遍闄╁垎鏋�", summary, Map.of("items", items), charts);
+ }
+
+ @Tool(name = "鍥炴涓庢姤浠风瓥鐣ュ缓璁�", value = "鍩轰簬瀹㈡埛椋庨櫓銆佸洖娆惧拰鎶ヤ环鎯呭喌鐢熸垚鍙墽琛岀殑璺熻繘绛栫暐")
+ public String suggestCollectionAndQuotationStrategy(@ToolMemoryId String memoryId,
+ @P(value = "寮�濮嬫棩鏈� yyyy-MM-dd", required = false) String startDate,
+ @P(value = "缁撴潫鏃ユ湡 yyyy-MM-dd", required = false) String endDate,
+ @P(value = "鏃堕棿鑼冨洿鎻忚堪锛屽杩�90澶┿�佹湰鏈�", required = false) String timeRange,
+ @P(value = "鍏抽敭璇嶏紝鍙尮閰嶅鎴峰悕绉�", required = false) String keyword,
+ @P(value = "杩斿洖鏉℃暟锛岄粯璁�10锛屾渶澶�30", required = false) Integer limit,
+ @P(value = "鏄惁浼樺厛楂橀闄╁鎴凤紝true 琛ㄧず楂橀闄╀紭鍏�", required = false) Boolean prioritizeHighRisk) {
+ LoginUser loginUser = currentLoginUser(memoryId);
+ DateRange range = resolveDateRange(startDate, endDate, StringUtils.hasText(timeRange) ? timeRange : "杩�90澶�");
+ List<CustomerRiskMetric> metrics = buildCustomerRiskMetrics(loginUser, range, keyword);
+ if (metrics.isEmpty()) {
+ return jsonResponse(true, "sales_collection_quote_strategy", "褰撳墠鑼冨洿鍐呮湭鏌ヨ鍒板彲鐢熸垚绛栫暐鐨勫鎴锋暟鎹�",
+ rangeSummary(range, 0, keyword), Map.of("items", List.of()), Map.of());
+ }
+
+ boolean highRiskFirst = Boolean.TRUE.equals(prioritizeHighRisk);
+ Comparator<CustomerRiskMetric> sortComparator;
+ if (highRiskFirst) {
+ sortComparator = Comparator
+ .comparingInt((CustomerRiskMetric metric) -> riskLevelRank(metric.getRiskLevel())).reversed()
+ .thenComparing(CustomerRiskMetric::getRiskScore, Comparator.reverseOrder())
+ .thenComparing(CustomerRiskMetric::getPendingAmount, Comparator.reverseOrder());
+ } else {
+ sortComparator = Comparator
+ .comparing(CustomerRiskMetric::getPendingAmount, Comparator.reverseOrder())
+ .thenComparing(CustomerRiskMetric::getRiskScore, Comparator.reverseOrder());
+ }
+
+ List<CustomerRiskMetric> sorted = metrics.stream()
+ .sorted(sortComparator)
+ .limit(normalizeLimit(limit))
+ .collect(Collectors.toList());
+
+ List<Map<String, Object>> items = sorted.stream().map(this::toStrategyItem).collect(Collectors.toList());
+ long highPriorityCount = items.stream().filter(item -> "high".equals(item.get("priority"))).count();
+ long mediumPriorityCount = items.stream().filter(item -> "medium".equals(item.get("priority"))).count();
+ long lowPriorityCount = items.stream().filter(item -> "low".equals(item.get("priority"))).count();
+
+ Map<String, Object> summary = rangeSummary(range, items.size(), keyword);
+ summary.put("highPriorityCount", highPriorityCount);
+ summary.put("mediumPriorityCount", mediumPriorityCount);
+ summary.put("lowPriorityCount", lowPriorityCount);
+ summary.put("prioritizeHighRisk", highRiskFirst);
+ summary.put("priorityMode", highRiskFirst ? "high_risk_first" : "pending_amount_first");
+
+ Map<String, Object> charts = new LinkedHashMap<>();
+ charts.put("pendingAmountBarOption", buildPendingAmountBarOption(sorted));
+ charts.put("priorityPieOption", buildPriorityPieOption(highPriorityCount, mediumPriorityCount, lowPriorityCount));
+
+ return jsonResponse(true, "sales_collection_quote_strategy", "宸茬敓鎴愬洖娆句笌鎶ヤ环绛栫暐寤鸿", summary, Map.of("items", items), charts);
+ }
+
+ private List<CustomerRiskMetric> buildCustomerRiskMetrics(LoginUser loginUser, DateRange range, String keyword) {
+ List<SalesLedger> ledgers = querySalesLedgers(loginUser, range).stream()
+ .filter(item -> matchLedgerCustomerKeyword(item, keyword))
+ .collect(Collectors.toList());
+ if (ledgers.isEmpty()) {
+ return List.of();
+ }
+
+ Map<String, CustomerRiskMetric> metricMap = new LinkedHashMap<>();
+ for (SalesLedger ledger : ledgers) {
+ String customerName = StringUtils.hasText(ledger.getCustomerName()) ? ledger.getCustomerName().trim() : "鏈煡瀹㈡埛";
+ CustomerRiskMetric metric = metricMap.computeIfAbsent(customerName, CustomerRiskMetric::new);
+ metric.setOrderCount(metric.getOrderCount() + 1);
+ metric.setContractAmount(metric.getContractAmount().add(defaultDecimal(ledger.getContractAmount())));
+ metric.setTopSingleOrderAmount(metric.getTopSingleOrderAmount().max(defaultDecimal(ledger.getContractAmount())));
+ LocalDate entryDate = toLocalDate(ledger.getEntryDate());
+ if (entryDate != null && (metric.getLastOrderDate() == null || entryDate.isAfter(metric.getLastOrderDate()))) {
+ metric.setLastOrderDate(entryDate);
+ }
+ if (ledger.getId() != null) {
+ metric.getLedgerIds().add(ledger.getId());
+ if (ledger.getDeliveryDate() != null) {
+ metric.getDeliveryDateByLedgerId().put(ledger.getId(), ledger.getDeliveryDate());
+ }
+ }
+ }
+
+ List<Long> allLedgerIds = metricMap.values().stream()
+ .flatMap(metric -> metric.getLedgerIds().stream())
+ .distinct()
+ .collect(Collectors.toList());
+ Map<Long, BigDecimal> receiptAmountByLedgerId = sumReceiptAmounts(loginUser, allLedgerIds);
+ Map<Long, List<ShippingInfo>> shippingByLedgerId = queryShippingsByLedgerIds(loginUser, allLedgerIds).stream()
+ .collect(Collectors.groupingBy(ShippingInfo::getSalesLedgerId));
+
+ List<SalesQuotation> quotations = querySalesQuotations(loginUser, range);
+ for (SalesQuotation quotation : quotations) {
+ String customerName = safe(quotation.getCustomer());
+ CustomerRiskMetric metric = metricMap.get(customerName);
+ if (metric == null) {
+ continue;
+ }
+ metric.setQuoteCount(metric.getQuoteCount() + 1);
+ metric.setQuoteAmount(metric.getQuoteAmount().add(defaultDecimal(quotation.getTotalAmount())));
+ }
+
+ LocalDate today = LocalDate.now();
+ for (CustomerRiskMetric metric : metricMap.values()) {
+ BigDecimal receivedAmount = BigDecimal.ZERO;
+ long overdueDeliveryCount = 0;
+ for (Long ledgerId : metric.getLedgerIds()) {
+ receivedAmount = receivedAmount.add(receiptAmountByLedgerId.getOrDefault(ledgerId, BigDecimal.ZERO));
+ LocalDate deliveryDate = metric.getDeliveryDateByLedgerId().get(ledgerId);
+ if (deliveryDate != null && deliveryDate.isBefore(today) && !isLedgerFullyShipped(ledgerId, shippingByLedgerId)) {
+ overdueDeliveryCount++;
+ }
+ }
+ metric.setReceivedAmount(receivedAmount);
+ metric.setPendingAmount(maxZero(metric.getContractAmount().subtract(receivedAmount)));
+ if (metric.getContractAmount().compareTo(BigDecimal.ZERO) > 0) {
+ metric.setPendingRate(metric.getPendingAmount()
+ .divide(metric.getContractAmount(), 4, RoundingMode.HALF_UP));
+ } else {
+ metric.setPendingRate(BigDecimal.ZERO);
+ }
+ metric.setOverdueDeliveryCount(overdueDeliveryCount);
+ if (metric.getLastOrderDate() == null) {
+ metric.setDaysSinceLastOrder(999);
+ } else {
+ metric.setDaysSinceLastOrder(Math.max(today.toEpochDay() - metric.getLastOrderDate().toEpochDay(), 0));
+ }
+ evaluateRiskMetric(metric);
+ }
+ return new ArrayList<>(metricMap.values());
+ }
+
+ private void evaluateRiskMetric(CustomerRiskMetric metric) {
+ int score = 0;
+ List<String> reasons = new ArrayList<>();
+ if (metric.getDaysSinceLastOrder() >= 90) {
+ score += 35;
+ reasons.add("杩�90澶╂棤鏂板璁㈠崟");
+ } else if (metric.getDaysSinceLastOrder() >= 60) {
+ score += 25;
+ reasons.add("杩�60澶╄鍗曟椿璺冨害涓嬮檷");
+ } else if (metric.getDaysSinceLastOrder() >= 30) {
+ score += 12;
+ reasons.add("杩�30澶╄鍗曟尝鍔ㄥ亸寮�");
+ }
+
+ if (metric.getPendingRate().compareTo(new BigDecimal("0.60")) >= 0) {
+ score += 30;
+ reasons.add("寰呭洖娆惧崰姣旈珮浜�60%");
+ } else if (metric.getPendingRate().compareTo(new BigDecimal("0.30")) >= 0) {
+ score += 20;
+ reasons.add("寰呭洖娆惧崰姣旈珮浜�30%");
+ } else if (metric.getPendingRate().compareTo(new BigDecimal("0.10")) >= 0) {
+ score += 10;
+ reasons.add("瀛樺湪寰呭洖娆鹃闄�");
+ }
+
+ if (metric.getOverdueDeliveryCount() > 0) {
+ score += Math.min((int) metric.getOverdueDeliveryCount() * 6, 20);
+ reasons.add("瀛樺湪浜ゆ湡閫炬湡璁㈠崟");
+ }
+
+ if (metric.getOrderCount() <= 1) {
+ score += 8;
+ reasons.add("璁㈠崟鍩烘暟鍋忎綆");
+ }
+
+ if (metric.getQuoteCount() > 0 && metric.getOrderCount() == 0) {
+ score += 10;
+ reasons.add("鎶ヤ环鏈舰鎴愯鍗曡浆鍖�");
+ }
+
+ score = Math.min(score, 100);
+ metric.setRiskScore(score);
+ if (score >= 70) {
+ metric.setRiskLevel("high");
+ } else if (score >= 40) {
+ metric.setRiskLevel("medium");
+ } else {
+ metric.setRiskLevel("low");
+ }
+ metric.setRiskReasons(reasons);
+ }
+
+ private Map<String, Object> toRiskItem(CustomerRiskMetric metric) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("customerName", metric.getCustomerName());
+ map.put("riskLevel", metric.getRiskLevel());
+ map.put("riskScore", metric.getRiskScore());
+ map.put("contractAmount", metric.getContractAmount());
+ map.put("receivedAmount", metric.getReceivedAmount());
+ map.put("pendingAmount", metric.getPendingAmount());
+ map.put("pendingRate", toPercent(metric.getPendingRate()));
+ map.put("orderCount", metric.getOrderCount());
+ map.put("quoteCount", metric.getQuoteCount());
+ map.put("overdueDeliveryCount", metric.getOverdueDeliveryCount());
+ map.put("daysSinceLastOrder", metric.getDaysSinceLastOrder());
+ map.put("lastOrderDate", formatDate(metric.getLastOrderDate()));
+ map.put("riskReasons", metric.getRiskReasons());
+ return map;
+ }
+
+ private Map<String, Object> toStrategyItem(CustomerRiskMetric metric) {
+ String priority = strategyPriority(metric);
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("customerName", metric.getCustomerName());
+ map.put("riskLevel", metric.getRiskLevel());
+ map.put("riskScore", metric.getRiskScore());
+ map.put("priority", priority);
+ map.put("pendingAmount", metric.getPendingAmount());
+ map.put("pendingRate", toPercent(metric.getPendingRate()));
+ map.put("quoteCount", metric.getQuoteCount());
+ map.put("orderCount", metric.getOrderCount());
+ map.put("quoteConversionRate", toRate(metric.getOrderCount(), Math.max(metric.getQuoteCount(), 1)));
+ map.put("collectionStrategy", buildCollectionStrategy(metric));
+ map.put("quotationStrategy", buildQuotationStrategy(metric));
+ map.put("nextAction", buildNextAction(priority));
+ map.put("topSingleOrderAmount", metric.getTopSingleOrderAmount());
+ return map;
+ }
+
+ private String buildCollectionStrategy(CustomerRiskMetric metric) {
+ if (metric.getPendingAmount().compareTo(BigDecimal.ZERO) <= 0) {
+ return "淇濇寔姝e父鏈堝害瀵硅处涓庡洖娆剧‘璁わ紝缁存寔瀹㈡埛鍥炴鑺傚銆�";
+ }
+ if (metric.getPendingRate().compareTo(new BigDecimal("0.60")) >= 0) {
+ return "浼樺厛閿佸畾鍥炴璁″垝锛屾寜鍛ㄦ媶鍒嗗洖娆捐妭鐐瑰苟缁戝畾鍙戣揣鏉′欢锛岄伩鍏嶆柊澧炰俊鐢ㄦ暈鍙c��";
+ }
+ if (metric.getPendingRate().compareTo(new BigDecimal("0.30")) >= 0) {
+ return "寤鸿鎵ц鍙屽懆鍌敹鏈哄埗锛屽悓姝ヨ储鍔′笌涓氬姟鑱斿悎璺熻繘閲嶇偣鍚堝悓銆�";
+ }
+ return "淇濇寔姝e父鍌敹鑺傚锛屾寜鍚堝悓鑺傜偣鎻愬墠3澶╂彁閱掑鎴蜂粯娆俱��";
+ }
+
+ private String buildQuotationStrategy(CustomerRiskMetric metric) {
+ if ("high".equals(metric.getRiskLevel())) {
+ return "鎶ヤ环浼樺厛淇濇瘺鍒╀笌鍥炴鏉℃锛屽噺灏戣秴闀胯处鏈燂紝蹇呰鏃堕噰鐢ㄥ垎闃舵鎶ヤ环銆�";
+ }
+ if (metric.getQuoteCount() > 0 && metric.getOrderCount() < metric.getQuoteCount()) {
+ return "浼樺寲鎶ヤ环缁撴瀯锛屽缓璁彁渚涘熀纭�鐗�+鍗囩骇鐗堢粍鍚堟姤浠凤紝鎻愰珮杞寲鐜囥��";
+ }
+ if (metric.getOrderCount() <= 1) {
+ return "鍔犲己闇�姹傛寲鎺橈紝鍥寸粫瀹㈡埛鍦烘櫙琛ュ厖澧炲�奸」涓庝氦浠樹繚闅滄潯娆俱��";
+ }
+ return "淇濇寔褰撳墠鎶ヤ环绛栫暐锛岄噸鐐瑰洿缁曚氦鏈熷拰鏈嶅姟鑳藉姏鍋氬樊寮傚寲鍛堢幇銆�";
+ }
+
+ private String buildNextAction(String priority) {
+ return switch (priority) {
+ case "high" -> "48灏忔椂鍐呭畬鎴愬鎴峰洖璁匡紝纭鍥炴璁″垝骞跺鏍告姤浠锋湁鏁堟湡銆�";
+ case "medium" -> "鏈懆鍐呭畬鎴愬鎴烽渶姹傚鐩橈紝鏇存柊鎶ヤ环鐗堟湰骞跺悓姝ュ洖娆捐妭鐐广��";
+ default -> "淇濇寔鏈堝害渚嬭璺熻繘锛屾寔缁拷韪鎴烽噰璐鍒掑彉鍖栥��";
+ };
+ }
+
+ private String strategyPriority(CustomerRiskMetric metric) {
+ if ("high".equals(metric.getRiskLevel()) || metric.getPendingRate().compareTo(new BigDecimal("0.50")) >= 0) {
+ return "high";
+ }
+ if ("medium".equals(metric.getRiskLevel()) || metric.getPendingRate().compareTo(new BigDecimal("0.30")) >= 0) {
+ return "medium";
+ }
+ return "low";
+ }
+
+ private int riskLevelRank(String riskLevel) {
+ if ("high".equals(riskLevel)) {
+ return 3;
+ }
+ if ("medium".equals(riskLevel)) {
+ return 2;
+ }
+ return 1;
+ }
+
+ private List<Map<String, Object>> buildTopCustomers(List<SalesLedger> ledgers) {
+ Map<String, BigDecimal> grouped = new LinkedHashMap<>();
+ for (SalesLedger ledger : ledgers) {
+ String customerName = StringUtils.hasText(ledger.getCustomerName()) ? ledger.getCustomerName().trim() : "鏈煡瀹㈡埛";
+ grouped.merge(customerName, defaultDecimal(ledger.getContractAmount()), BigDecimal::add);
+ }
+ return grouped.entrySet().stream()
+ .sorted(Map.Entry.<String, BigDecimal>comparingByValue().reversed())
+ .limit(5)
+ .map(entry -> {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("customerName", entry.getKey());
+ map.put("contractAmount", entry.getValue());
+ return map;
+ })
+ .collect(Collectors.toList());
+ }
+
+ private TrendData buildContractTrendData(List<SalesLedger> ledgers, DateRange range) {
+ Map<String, BigDecimal> amountByMonth = new LinkedHashMap<>();
+ YearMonth startMonth = YearMonth.from(range.start());
+ YearMonth endMonth = YearMonth.from(range.end());
+ for (YearMonth month = startMonth; !month.isAfter(endMonth); month = month.plusMonths(1)) {
+ amountByMonth.put(month.toString(), BigDecimal.ZERO);
+ }
+ for (SalesLedger ledger : ledgers) {
+ LocalDate entryDate = toLocalDate(ledger.getEntryDate());
+ if (entryDate == null) {
+ continue;
+ }
+ String monthKey = YearMonth.from(entryDate).toString();
+ if (!amountByMonth.containsKey(monthKey)) {
+ continue;
+ }
+ amountByMonth.put(monthKey, amountByMonth.get(monthKey).add(defaultDecimal(ledger.getContractAmount())));
+ }
+ return new TrendData(new ArrayList<>(amountByMonth.keySet()), new ArrayList<>(amountByMonth.values()));
+ }
+
+ private List<SalesLedger> querySalesLedgers(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<SalesLedger> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), SalesLedger::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesLedger::getDeptId);
+ if (range != null) {
+ wrapper.ge(SalesLedger::getEntryDate, toDate(range.start()))
+ .lt(SalesLedger::getEntryDate, toExclusiveEndDate(range.end()));
+ }
+ return defaultList(salesLedgerMapper.selectList(wrapper));
+ }
+
+ private List<SalesQuotation> querySalesQuotations(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<SalesQuotation> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), SalesQuotation::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), SalesQuotation::getDeptId);
+ if (range != null) {
+ wrapper.ge(SalesQuotation::getQuotationDate, range.start())
+ .le(SalesQuotation::getQuotationDate, range.end());
+ }
+ return defaultList(salesQuotationMapper.selectList(wrapper));
+ }
+
+ private List<ShippingInfo> queryShippings(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), ShippingInfo::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId);
+ if (range != null) {
+ wrapper.ge(ShippingInfo::getShippingDate, toDate(range.start()))
+ .lt(ShippingInfo::getShippingDate, toExclusiveEndDate(range.end()));
+ }
+ return defaultList(shippingInfoMapper.selectList(wrapper));
+ }
+
+ private List<ShippingInfo> queryShippingsByLedgerIds(LoginUser loginUser, List<Long> ledgerIds) {
+ if (ledgerIds == null || ledgerIds.isEmpty()) {
+ return List.of();
+ }
+ LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(wrapper, loginUser.getTenantId(), ShippingInfo::getTenantId);
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId);
+ wrapper.in(ShippingInfo::getSalesLedgerId, ledgerIds);
+ return defaultList(shippingInfoMapper.selectList(wrapper));
+ }
+
+ private Map<Long, BigDecimal> sumInvoiceAmounts(List<Long> ledgerIds) {
+ if (ledgerIds == null || ledgerIds.isEmpty()) {
+ return Map.of();
+ }
+ Map<Long, BigDecimal> result = new HashMap<>();
+ return result;
+ }
+
+ private Map<Long, BigDecimal> sumReceiptAmounts(LoginUser loginUser, List<Long> ledgerIds) {
+ if (ledgerIds == null || ledgerIds.isEmpty()) {
+ return Map.of();
+ }
+ List<SalesLedger> ledgers = defaultList(salesLedgerMapper.selectBatchIds(ledgerIds)).stream()
+ .filter(ledger -> tenantMatched(ledger.getTenantId(), loginUser.getTenantId()))
+ .collect(Collectors.toList());
+ if (ledgers.isEmpty()) {
+ return Map.of();
+ }
+
+ Set<Integer> customerIds = ledgers.stream()
+ .map(SalesLedger::getCustomerId)
+ .filter(Objects::nonNull)
+ .map(Long::intValue)
+ .collect(Collectors.toSet());
+ if (customerIds.isEmpty()) {
+ return Map.of();
+ }
+
+ LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId);
+ wrapper.in(AccountSalesCollection::getCustomerId, customerIds);
+ List<AccountSalesCollection> collections = defaultList(accountSalesCollectionMapper.selectList(wrapper));
+ if (collections.isEmpty()) {
+ return Map.of();
+ }
+
+ Map<Integer, Set<Long>> ledgerIdsByCollectionId = mapCollectionLedgerIds(loginUser, collections);
+ Map<Long, List<Long>> ledgerIdsByCustomerId = ledgers.stream()
+ .filter(item -> item.getId() != null && item.getCustomerId() != null)
+ .collect(Collectors.groupingBy(item -> item.getCustomerId().longValue(),
+ Collectors.mapping(SalesLedger::getId, Collectors.toList())));
+ Set<Long> targetLedgerIdSet = new HashSet<>(ledgerIds);
+
+ Map<Long, BigDecimal> result = new HashMap<>();
+ for (AccountSalesCollection collection : collections) {
+ BigDecimal amount = defaultDecimal(collection.getCollectionAmount());
+ if (amount.compareTo(BigDecimal.ZERO) == 0) {
+ continue;
+ }
+ Set<Long> relatedLedgerIds = ledgerIdsByCollectionId.getOrDefault(collection.getId(), Set.of());
+ if (!relatedLedgerIds.isEmpty()) {
+ for (Long ledgerId : relatedLedgerIds) {
+ if (targetLedgerIdSet.contains(ledgerId)) {
+ result.merge(ledgerId, amount, BigDecimal::add);
+ }
+ }
+ continue;
+ }
+ if (collection.getCustomerId() == null) {
+ continue;
+ }
+ List<Long> customerLedgerIds = ledgerIdsByCustomerId.get(collection.getCustomerId().longValue());
+ if (customerLedgerIds == null || customerLedgerIds.isEmpty()) {
+ continue;
+ }
+ for (Long ledgerId : customerLedgerIds) {
+ if (targetLedgerIdSet.contains(ledgerId)) {
+ result.merge(ledgerId, amount, BigDecimal::add);
+ }
+ }
+ }
+ return result;
+ }
+
+ private List<AccountSalesCollection> queryCollections(LoginUser loginUser, DateRange range) {
+ LambdaQueryWrapper<AccountSalesCollection> wrapper = new LambdaQueryWrapper<>();
+ applyDeptFilter(wrapper, loginUser.getCurrentDeptId(), AccountSalesCollection::getDeptId);
+ if (range != null) {
+ wrapper.ge(AccountSalesCollection::getCollectionDate, range.start())
+ .le(AccountSalesCollection::getCollectionDate, range.end());
+ }
+ wrapper.orderByDesc(AccountSalesCollection::getCollectionDate, AccountSalesCollection::getId);
+ return defaultList(accountSalesCollectionMapper.selectList(wrapper));
+ }
+
+ private Map<Integer, Set<Long>> mapCollectionLedgerIds(LoginUser loginUser, List<AccountSalesCollection> collections) {
+ Map<Integer, Set<Long>> result = new HashMap<>();
+ if (collections == null || collections.isEmpty()) {
+ return result;
+ }
+
+ Map<Integer, List<Long>> stockOutRecordIdsByCollection = new HashMap<>();
+ Set<Long> allStockOutRecordIds = new HashSet<>();
+ for (AccountSalesCollection collection : collections) {
+ if (collection.getId() == null) {
+ continue;
+ }
+ List<Long> stockOutRecordIds = parseLongIds(collection.getStockOutRecordIds());
+ if (stockOutRecordIds.isEmpty()) {
+ continue;
+ }
+ stockOutRecordIdsByCollection.put(collection.getId(), stockOutRecordIds);
+ allStockOutRecordIds.addAll(stockOutRecordIds);
+ }
+ if (allStockOutRecordIds.isEmpty()) {
+ return result;
+ }
+
+ List<StockOutRecord> stockOutRecords = defaultList(stockOutRecordMapper.selectList(new LambdaQueryWrapper<StockOutRecord>()
+ .in(StockOutRecord::getId, allStockOutRecordIds)));
+ if (stockOutRecords.isEmpty()) {
+ return result;
+ }
+ Map<Long, StockOutRecord> stockOutRecordMap = stockOutRecords.stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(StockOutRecord::getId, item -> item, (a, b) -> a));
+
+ Set<Long> shippingIds = stockOutRecords.stream()
+ .filter(this::isSalesOutboundRecord)
+ .map(StockOutRecord::getRecordId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ if (shippingIds.isEmpty()) {
+ return result;
+ }
+
+ LambdaQueryWrapper<ShippingInfo> shippingWrapper = new LambdaQueryWrapper<>();
+ applyTenantFilter(shippingWrapper, loginUser.getTenantId(), ShippingInfo::getTenantId);
+ applyDeptFilter(shippingWrapper, loginUser.getCurrentDeptId(), ShippingInfo::getDeptId);
+ shippingWrapper.in(ShippingInfo::getId, shippingIds);
+ Map<Long, Long> ledgerIdByShippingId = defaultList(shippingInfoMapper.selectList(shippingWrapper)).stream()
+ .filter(item -> item.getId() != null && item.getSalesLedgerId() != null)
+ .collect(Collectors.toMap(ShippingInfo::getId, ShippingInfo::getSalesLedgerId, (a, b) -> a));
+
+ for (Map.Entry<Integer, List<Long>> entry : stockOutRecordIdsByCollection.entrySet()) {
+ Set<Long> ledgerIds = new LinkedHashSet<>();
+ for (Long stockOutRecordId : entry.getValue()) {
+ StockOutRecord stockOutRecord = stockOutRecordMap.get(stockOutRecordId);
+ if (!isSalesOutboundRecord(stockOutRecord)) {
+ continue;
+ }
+ Long ledgerId = ledgerIdByShippingId.get(stockOutRecord.getRecordId());
+ if (ledgerId != null) {
+ ledgerIds.add(ledgerId);
+ }
+ }
+ if (!ledgerIds.isEmpty()) {
+ result.put(entry.getKey(), ledgerIds);
+ }
+ }
+ return result;
+ }
+
+ private boolean isSalesOutboundRecord(StockOutRecord stockOutRecord) {
+ if (stockOutRecord == null || !StringUtils.hasText(stockOutRecord.getRecordType())) {
+ return false;
+ }
+ if (stockOutRecord.getApprovalStatus() != null && stockOutRecord.getApprovalStatus() != 1) {
+ return false;
+ }
+ return "13".equals(stockOutRecord.getRecordType().trim());
+ }
+
+ private List<Long> parseLongIds(String raw) {
+ if (!StringUtils.hasText(raw)) {
+ return List.of();
+ }
+ List<Long> result = new ArrayList<>();
+ for (String part : raw.split(",")) {
+ if (!StringUtils.hasText(part)) {
+ continue;
+ }
+ try {
+ result.add(Long.parseLong(part.trim()));
+ } catch (Exception ignored) {
+ }
+ }
+ return result;
+ }
+
+ private boolean matchInteractionKeyword(AccountSalesCollection collection, SalesLedger ledger, String keyword) {
+ if (!StringUtils.hasText(keyword)) {
+ return true;
+ }
+ String text = keyword.trim();
+ if (safe(collection.getCollectionNumber()).contains(text)
+ || safe(collection.getCollectionMethod()).contains(text)
+ || safe(collection.getRemark()).contains(text)) {
+ return true;
+ }
+ if (ledger == null) {
+ return false;
+ }
+ return safe(ledger.getSalesContractNo()).contains(text)
+ || safe(ledger.getCustomerName()).contains(text)
+ || safe(ledger.getProjectName()).contains(text);
+ }
+
+ private Map<String, Object> toInteractionItem(AccountSalesCollection collection, SalesLedger ledger) {
+ Map<String, Object> map = new LinkedHashMap<>();
+ map.put("id", collection.getId());
+ map.put("salesLedgerId", ledger == null ? null : ledger.getId());
+ map.put("salesContractNo", ledger == null ? "" : safe(ledger.getSalesContractNo()));
+ map.put("customerName", ledger == null ? "" : safe(ledger.getCustomerName()));
+ map.put("projectName", ledger == null ? "" : safe(ledger.getProjectName()));
+ map.put("receiptPaymentDate", formatDate(collection.getCollectionDate()));
+ map.put("receiptPaymentAmount", collection.getCollectionAmount());
+ map.put("receiptPaymentType", safe(collection.getCollectionMethod()));
+ map.put("collectionNumber", safe(collection.getCollectionNumber()));
+ map.put("registrant", collection.getCreateUser());
+ map.put("remark", safe(collection.getRemark()));
+ return map;
+ }
+
+ private boolean isLedgerFullyShipped(Long ledgerId, Map<Long, List<ShippingInfo>> shippingByLedgerId) {
+ List<ShippingInfo> shippingInfos = shippingByLedgerId.get(ledgerId);
+ if (shippingInfos == null || shippingInfos.isEmpty()) {
+ return false;
+ }
+ return shippingInfos.stream().allMatch(item -> isShippedStatus(item.getStatus()));
+ }
+
+ private String calcLedgerShippingStatus(List<ShippingInfo> shippingInfos) {
+ if (shippingInfos == null || shippingInfos.isEmpty()) {
+ return "鏈彂璐�";
+ }
+ long shippedCount = shippingInfos.stream().filter(item -> isShippedStatus(item.getStatus())).count();
+ if (shippedCount == 0) {
+ return "寰呭彂璐�";
+ }
+ if (shippedCount == shippingInfos.size()) {
+ return "宸插彂璐�";
+ }
+ return "閮ㄥ垎鍙戣揣";
+ }
+
+ private boolean isShippedStatus(String status) {
+ return StringUtils.hasText(status) && status.contains("宸插彂璐�");
+ }
+
+ private boolean matchCustomerKeyword(CustomerVo customer, String keyword) {
+ if (!StringUtils.hasText(keyword)) {
+ return true;
+ }
+ String text = keyword.trim();
+ return safe(customer.getCustomerName()).contains(text)
+ || safe(customer.getContactPerson()).contains(text)
+ || safe(customer.getContactPhone()).contains(text)
+ || safe(customer.getCompanyPhone()).contains(text)
+ || safe(customer.getUsageUserName()).contains(text);
+ }
+
+ private boolean matchLedgerCustomerKeyword(SalesLedger ledger, String keyword) {
+ if (!StringUtils.hasText(keyword)) {
+ return true;
+ }
+ String text = keyword.trim();
+ return safe(ledger.getCustomerName()).contains(text)
+ || safe(ledger.getSalesContractNo()).contains(text)
+ || safe(ledger.getProjectName()).contains(text);
+ }
+
+ private Integer normalizeSeaType(String seaType) {
+ if (!StringUtils.hasText(seaType)) {
+ return null;
+ }
+ String value = seaType.trim().toLowerCase(Locale.ROOT);
+ return switch (value) {
+ case "private", "绉佹捣", "0" -> 0;
+ case "public", "鍏捣", "1" -> 1;
+ default -> null;
+ };
+ }
+
+ private String customerSeaTypeName(Integer type) {
+ if (type == null) {
+ return "鏈煡";
+ }
+ return type == 1 ? "鍏捣" : "绉佹捣";
+ }
+
+ private int normalizeLimit(Integer limit) {
+ if (limit == null || limit <= 0) {
+ return DEFAULT_LIMIT;
+ }
+ return Math.min(limit, MAX_LIMIT);
+ }
+
+ private boolean tenantMatched(Long dataTenantId, Long userTenantId) {
+ if (userTenantId == null) {
+ return true;
+ }
+ return Objects.equals(dataTenantId, userTenantId);
+ }
+
+ private <T> void applyTenantFilter(LambdaQueryWrapper<T> wrapper, Long tenantId, SFunction<T, Long> field) {
+ if (tenantId != null) {
+ wrapper.eq(field, tenantId);
+ }
+ }
+
+ private <T> void applyDeptFilter(LambdaQueryWrapper<T> wrapper, Long deptId, SFunction<T, Long> field) {
+ if (deptId != null) {
+ wrapper.eq(field, deptId);
+ }
+ }
+
+ private LoginUser currentLoginUser(String memoryId) {
+ LoginUser loginUser = aiSessionUserContext.get(memoryId);
+ if (loginUser != null) {
+ return loginUser;
+ }
+ return SecurityUtils.getLoginUser();
+ }
+
+ private DateRange resolveDateRange(String startDate, String endDate, String timeRange) {
+ LocalDate today = LocalDate.now();
+ LocalDate explicitStart = parseLocalDate(startDate);
+ LocalDate explicitEnd = parseLocalDate(endDate);
+ if (explicitStart != null || explicitEnd != null) {
+ LocalDate start = explicitStart != null ? explicitStart : explicitEnd;
+ LocalDate end = explicitEnd != null ? explicitEnd : explicitStart;
+ if (start.isAfter(end)) {
+ LocalDate temp = start;
+ start = end;
+ end = temp;
+ }
+ return new DateRange(start, end, start + "鑷�" + end);
+ }
+ if (!StringUtils.hasText(timeRange)) {
+ return new DateRange(today.minusDays(29), today, "杩�30澶�");
+ }
+ String text = timeRange.trim();
+ if (text.contains("浠婂ぉ")) {
+ return new DateRange(today, today, "浠婂ぉ");
+ }
+ if (text.contains("鏄ㄥぉ") || text.contains("鏄ㄦ棩")) {
+ LocalDate day = today.minusDays(1);
+ return new DateRange(day, day, "鏄ㄥぉ");
+ }
+ if (text.contains("鏈懆")) {
+ LocalDate start = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ return new DateRange(start, today, "鏈懆");
+ }
+ if (text.contains("涓婂懆")) {
+ LocalDate thisWeekStart = today.minusDays(today.getDayOfWeek().getValue() - 1L);
+ LocalDate start = thisWeekStart.minusWeeks(1);
+ LocalDate end = thisWeekStart.minusDays(1);
+ return new DateRange(start, end, "涓婂懆");
+ }
+ if (text.contains("鏈湀")) {
+ return new DateRange(today.withDayOfMonth(1), today, "鏈湀");
+ }
+ if (text.contains("涓婃湀")) {
+ YearMonth lastMonth = YearMonth.from(today).minusMonths(1);
+ return new DateRange(lastMonth.atDay(1), lastMonth.atEndOfMonth(), "涓婃湀");
+ }
+ if (text.contains("浠婂勾") || text.contains("鏈勾")) {
+ return new DateRange(today.withDayOfYear(1), today, "浠婂勾");
+ }
+ if (text.contains("鍘诲勾")) {
+ LocalDate start = today.minusYears(1).withDayOfYear(1);
+ LocalDate end = today.minusYears(1).withMonth(12).withDayOfMonth(31);
+ return new DateRange(start, end, "鍘诲勾");
+ }
+ Matcher relativeMatcher = RELATIVE_PATTERN.matcher(text);
+ if (relativeMatcher.find()) {
+ int amount = Integer.parseInt(relativeMatcher.group(2));
+ String unit = relativeMatcher.group(3);
+ LocalDate start = switch (unit) {
+ case "澶�" -> today.minusDays(Math.max(amount - 1L, 0));
+ case "鍛�" -> today.minusWeeks(Math.max(amount, 1)).plusDays(1);
+ case "涓湀", "鏈�" -> today.minusMonths(Math.max(amount, 1)).plusDays(1);
+ case "骞�" -> today.minusYears(Math.max(amount, 1)).plusDays(1);
+ default -> today.minusDays(29);
+ };
+ return new DateRange(start, today, "杩�" + amount + unit);
+ }
+ Matcher dateMatcher = DATE_PATTERN.matcher(text);
+ if (dateMatcher.find()) {
+ LocalDate start = parseLocalDate(dateMatcher.group(1));
+ LocalDate end = dateMatcher.find() ? parseLocalDate(dateMatcher.group(1)) : start;
+ if (start != null && end != null) {
+ if (start.isAfter(end)) {
+ LocalDate temp = start;
+ start = end;
+ end = temp;
+ }
+ return new DateRange(start, end, start + "鑷�" + end);
+ }
+ }
+ return new DateRange(today.minusDays(29), today, "杩�30澶�");
+ }
+
+ private LocalDate parseLocalDate(String text) {
+ if (!StringUtils.hasText(text)) {
+ return null;
+ }
+ try {
+ return LocalDate.parse(text.trim(), DATE_FMT);
+ } catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ private Date toDate(LocalDate localDate) {
+ return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private Date toExclusiveEndDate(LocalDate localDate) {
+ return Date.from(localDate.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private LocalDate toLocalDate(Date date) {
+ if (date == null) {
+ return null;
+ }
+ return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+ }
+
+ private String formatDate(Date date) {
+ LocalDate localDate = toLocalDate(date);
+ return formatDate(localDate);
+ }
+
+ private String formatDate(LocalDate date) {
+ return date == null ? "" : date.format(DATE_FMT);
+ }
+
+ private String formatDateTime(LocalDateTime time) {
+ return time == null ? "" : time.toString().replace('T', ' ');
+ }
+
+ private BigDecimal defaultDecimal(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ private BigDecimal asBigDecimal(Object value) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ if (value instanceof BigDecimal decimal) {
+ return decimal;
+ }
+ if (value instanceof Number number) {
+ return new BigDecimal(String.valueOf(number));
+ }
+ try {
+ return new BigDecimal(String.valueOf(value));
+ } catch (Exception ignored) {
+ return BigDecimal.ZERO;
+ }
+ }
+
+ private BigDecimal maxZero(BigDecimal value) {
+ return value == null || value.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : value;
+ }
+
+ private String toRate(long numerator, long denominator) {
+ if (denominator <= 0) {
+ return "0.00%";
+ }
+ BigDecimal rate = new BigDecimal(numerator)
+ .multiply(ONE_HUNDRED)
+ .divide(new BigDecimal(denominator), 2, RoundingMode.HALF_UP);
+ return rate.toPlainString() + "%";
+ }
+
+ private String toPercent(BigDecimal decimal) {
+ if (decimal == null) {
+ return "0.00%";
+ }
+ BigDecimal rate = decimal.multiply(ONE_HUNDRED).setScale(2, RoundingMode.HALF_UP);
+ return rate.toPlainString() + "%";
+ }
+
+ private String safe(Object value) {
+ return value == null ? "" : String.valueOf(value).replace('\n', ' ').replace('\r', ' ').trim();
+ }
+
+ private <T> List<T> defaultList(List<T> list) {
+ return list == null ? List.of() : list;
+ }
+
+ private Map<String, Object> rangeSummary(DateRange range, int count, String keyword) {
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("timeRange", range.label());
+ summary.put("startDate", range.start().toString());
+ summary.put("endDate", range.end().toString());
+ summary.put("count", count);
+ summary.put("keyword", safe(keyword));
+ return summary;
+ }
+
+ private Map<String, Object> buildAmountBarOption(BigDecimal contractAmount,
+ BigDecimal quotationAmount,
+ BigDecimal receivedAmount,
+ BigDecimal pendingAmount) {
+ List<String> xData = List.of("鍚堝悓棰�", "鎶ヤ环棰�", "鍥炴棰�", "寰呭洖娆�");
+ List<BigDecimal> yData = List.of(contractAmount, quotationAmount, receivedAmount, pendingAmount);
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "閿�鍞粡钀ラ噾棰濇瑙�", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "閲戦", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildShippingPieOption(long shippedCount, long pendingCount) {
+ List<Map<String, Object>> data = List.of(
+ Map.of("name", "宸插彂璐�", "value", shippedCount),
+ Map.of("name", "鏈彂璐�", "value", pendingCount)
+ );
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "鍙戣揣鐘舵�佸垎甯�", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "item"));
+ option.put("series", List.of(Map.of("type", "pie", "radius", "60%", "data", data)));
+ return option;
+ }
+
+ private Map<String, Object> buildCustomerTopBarOption(List<Map<String, Object>> topCustomers) {
+ List<String> xData = new ArrayList<>();
+ List<BigDecimal> yData = new ArrayList<>();
+ for (Map<String, Object> item : topCustomers) {
+ xData.add(String.valueOf(item.get("customerName")));
+ yData.add((BigDecimal) item.get("contractAmount"));
+ }
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "瀹㈡埛鍚堝悓棰漈OP5", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "鍚堝悓棰�", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildContractTrendLineOption(List<String> labels, List<BigDecimal> values) {
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "鍚堝悓棰濇湀搴﹁秼鍔�", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", labels));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "鍚堝悓棰�", "type", "line", "smooth", true, "data", values)));
+ return option;
+ }
+
+ private Map<String, Object> buildRiskLevelPieOption(long highCount, long mediumCount, long lowCount) {
+ List<Map<String, Object>> data = List.of(
+ Map.of("name", "楂橀闄�", "value", highCount),
+ Map.of("name", "涓闄�", "value", mediumCount),
+ Map.of("name", "浣庨闄�", "value", lowCount)
+ );
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "瀹㈡埛椋庨櫓绛夌骇鍒嗗竷", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "item"));
+ option.put("series", List.of(Map.of("name", "椋庨櫓绛夌骇", "type", "pie", "radius", "60%", "data", data)));
+ return option;
+ }
+
+ private Map<String, Object> buildRiskScoreBarOption(List<CustomerRiskMetric> metrics) {
+ List<String> xData = metrics.stream().map(CustomerRiskMetric::getCustomerName).collect(Collectors.toList());
+ List<Integer> yData = metrics.stream().map(CustomerRiskMetric::getRiskScore).collect(Collectors.toList());
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "瀹㈡埛椋庨櫓鍒嗗��", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value", "max", 100));
+ option.put("series", List.of(Map.of("name", "椋庨櫓鍒嗗��", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildPendingAmountBarOption(List<CustomerRiskMetric> metrics) {
+ List<String> xData = metrics.stream().map(CustomerRiskMetric::getCustomerName).collect(Collectors.toList());
+ List<BigDecimal> yData = metrics.stream().map(CustomerRiskMetric::getPendingAmount).collect(Collectors.toList());
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "瀹㈡埛寰呭洖娆炬帓鍚�", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "axis"));
+ option.put("xAxis", Map.of("type", "category", "data", xData));
+ option.put("yAxis", Map.of("type", "value"));
+ option.put("series", List.of(Map.of("name", "寰呭洖娆�", "type", "bar", "data", yData)));
+ return option;
+ }
+
+ private Map<String, Object> buildPriorityPieOption(long high, long medium, long low) {
+ List<Map<String, Object>> data = List.of(
+ Map.of("name", "楂樹紭鍏堢骇", "value", high),
+ Map.of("name", "涓紭鍏堢骇", "value", medium),
+ Map.of("name", "浣庝紭鍏堢骇", "value", low)
+ );
+ Map<String, Object> option = new LinkedHashMap<>();
+ option.put("title", Map.of("text", "绛栫暐浼樺厛绾у垎甯�", "left", "center"));
+ option.put("tooltip", Map.of("trigger", "item"));
+ option.put("series", List.of(Map.of("name", "浼樺厛绾�", "type", "pie", "radius", "60%", "data", data)));
+ return option;
+ }
+
+ private String jsonResponse(boolean success,
+ String type,
+ String description,
+ Map<String, Object> summary,
+ Map<String, Object> data,
+ Map<String, Object> charts) {
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("success", success);
+ result.put("type", type);
+ result.put("description", description);
+ result.put("summary", summary == null ? Map.of() : summary);
+ result.put("data", data == null ? Map.of() : data);
+ result.put("charts", charts == null ? Map.of() : charts);
+ return JSON.toJSONString(result);
+ }
+
+ private record DateRange(LocalDate start, LocalDate end, String label) {
+ }
+
+ private record TrendData(List<String> labels, List<BigDecimal> values) {
+ private List<Map<String, Object>> toItemList() {
+ List<Map<String, Object>> items = new LinkedList<>();
+ for (int i = 0; i < labels.size(); i++) {
+ Map<String, Object> item = new LinkedHashMap<>();
+ item.put("month", labels.get(i));
+ item.put("amount", values.get(i));
+ items.add(item);
+ }
+ return items;
+ }
+ }
+
+ private static class CustomerRiskMetric {
+ private final String customerName;
+ private final List<Long> ledgerIds = new ArrayList<>();
+ private final Map<Long, LocalDate> deliveryDateByLedgerId = new HashMap<>();
+ private BigDecimal contractAmount = BigDecimal.ZERO;
+ private BigDecimal receivedAmount = BigDecimal.ZERO;
+ private BigDecimal pendingAmount = BigDecimal.ZERO;
+ private BigDecimal pendingRate = BigDecimal.ZERO;
+ private BigDecimal quoteAmount = BigDecimal.ZERO;
+ private BigDecimal topSingleOrderAmount = BigDecimal.ZERO;
+ private int orderCount;
+ private int quoteCount;
+ private LocalDate lastOrderDate;
+ private long daysSinceLastOrder;
+ private long overdueDeliveryCount;
+ private int riskScore;
+ private String riskLevel = "low";
+ private List<String> riskReasons = new ArrayList<>();
+
+ private CustomerRiskMetric(String customerName) {
+ this.customerName = customerName;
+ }
+
+ private String getCustomerName() {
+ return customerName;
+ }
+
+ private List<Long> getLedgerIds() {
+ return ledgerIds;
+ }
+
+ private Map<Long, LocalDate> getDeliveryDateByLedgerId() {
+ return deliveryDateByLedgerId;
+ }
+
+ private BigDecimal getContractAmount() {
+ return contractAmount;
+ }
+
+ private void setContractAmount(BigDecimal contractAmount) {
+ this.contractAmount = contractAmount;
+ }
+
+ private BigDecimal getReceivedAmount() {
+ return receivedAmount;
+ }
+
+ private void setReceivedAmount(BigDecimal receivedAmount) {
+ this.receivedAmount = receivedAmount;
+ }
+
+ private BigDecimal getPendingAmount() {
+ return pendingAmount;
+ }
+
+ private void setPendingAmount(BigDecimal pendingAmount) {
+ this.pendingAmount = pendingAmount;
+ }
+
+ private BigDecimal getPendingRate() {
+ return pendingRate;
+ }
+
+ private void setPendingRate(BigDecimal pendingRate) {
+ this.pendingRate = pendingRate;
+ }
+
+ private BigDecimal getQuoteAmount() {
+ return quoteAmount;
+ }
+
+ private void setQuoteAmount(BigDecimal quoteAmount) {
+ this.quoteAmount = quoteAmount;
+ }
+
+ private BigDecimal getTopSingleOrderAmount() {
+ return topSingleOrderAmount;
+ }
+
+ private void setTopSingleOrderAmount(BigDecimal topSingleOrderAmount) {
+ this.topSingleOrderAmount = topSingleOrderAmount;
+ }
+
+ private int getOrderCount() {
+ return orderCount;
+ }
+
+ private void setOrderCount(int orderCount) {
+ this.orderCount = orderCount;
+ }
+
+ private int getQuoteCount() {
+ return quoteCount;
+ }
+
+ private void setQuoteCount(int quoteCount) {
+ this.quoteCount = quoteCount;
+ }
+
+ private LocalDate getLastOrderDate() {
+ return lastOrderDate;
+ }
+
+ private void setLastOrderDate(LocalDate lastOrderDate) {
+ this.lastOrderDate = lastOrderDate;
+ }
+
+ private long getDaysSinceLastOrder() {
+ return daysSinceLastOrder;
+ }
+
+ private void setDaysSinceLastOrder(long daysSinceLastOrder) {
+ this.daysSinceLastOrder = daysSinceLastOrder;
+ }
+
+ private long getOverdueDeliveryCount() {
+ return overdueDeliveryCount;
+ }
+
+ private void setOverdueDeliveryCount(long overdueDeliveryCount) {
+ this.overdueDeliveryCount = overdueDeliveryCount;
+ }
+
+ private int getRiskScore() {
+ return riskScore;
+ }
+
+ private void setRiskScore(int riskScore) {
+ this.riskScore = riskScore;
+ }
+
+ private String getRiskLevel() {
+ return riskLevel;
+ }
+
+ private void setRiskLevel(String riskLevel) {
+ this.riskLevel = riskLevel;
+ }
+
+ private List<String> getRiskReasons() {
+ return riskReasons;
+ }
+
+ private void setRiskReasons(List<String> riskReasons) {
+ this.riskReasons = riskReasons;
+ }
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/dto/ApprovalInstanceDto.java b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalInstanceDto.java
new file mode 100644
index 0000000..a2df482
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalInstanceDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.approve.bean.dto;
+
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ApprovalInstanceDto extends ApprovalInstance {
+
+ private String approveAction;
+
+ private String approveComment;
+
+ private String createTimeEnd;
+
+ private String createTimeStart;
+
+ private List<StorageBlobDTO> storageBlobDTOs;
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateDto.java b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateDto.java
new file mode 100644
index 0000000..668bc8c
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateDto.java
@@ -0,0 +1,15 @@
+package com.ruoyi.approve.bean.dto;
+
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ApprovalTemplateDto extends ApprovalTemplate {
+
+ private List<ApprovalTemplateNodeDto> nodes;
+
+ private List<StorageBlobDTO> storageBlobDTOs;
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeApproverDto.java b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeApproverDto.java
new file mode 100644
index 0000000..8382619
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeApproverDto.java
@@ -0,0 +1,8 @@
+package com.ruoyi.approve.bean.dto;
+
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import lombok.Data;
+
+@Data
+public class ApprovalTemplateNodeApproverDto extends ApprovalTemplateNodeApprover {
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeDto.java b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeDto.java
new file mode 100644
index 0000000..e85aee9
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/dto/ApprovalTemplateNodeDto.java
@@ -0,0 +1,12 @@
+package com.ruoyi.approve.bean.dto;
+
+import com.ruoyi.approve.pojo.ApprovalTemplateNode;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ApprovalTemplateNodeDto extends ApprovalTemplateNode {
+
+ private List<ApprovalTemplateNodeApproverDto> approvers;
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/dto/FinReimbursementDto.java b/src/main/java/com/ruoyi/approve/bean/dto/FinReimbursementDto.java
new file mode 100644
index 0000000..2f14376
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/dto/FinReimbursementDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.approve.bean.dto;
+
+import com.ruoyi.approve.pojo.FinReimbursement;
+import com.ruoyi.approve.pojo.FinReimbursementDetail;
+import com.ruoyi.approve.pojo.FinReimbursementTravel;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class FinReimbursementDto extends FinReimbursement {
+
+ private String createTimeStart;
+ private String createTimeEnd;
+
+ private FinReimbursementTravel travel;
+ private List<FinReimbursementDetail> details;
+ private List<ApprovalTemplateNodeDto> nodes;
+ private List<StorageBlobDTO> storageBlobDTOs;
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/ApprovalInstanceVo.java b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalInstanceVo.java
new file mode 100644
index 0000000..41ad4e4
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalInstanceVo.java
@@ -0,0 +1,37 @@
+package com.ruoyi.approve.bean.vo;
+
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalRecord;
+import com.ruoyi.approve.pojo.ApprovalTask;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ApprovalInstanceVo extends ApprovalInstance {
+ //褰撳墠鐢ㄦ埛鏄惁鍙互瀹℃壒
+ @Schema(description = "褰撳墠鐢ㄦ埛鏄惁鍙互瀹℃壒")
+ private Boolean isApprove;
+
+ //瀹℃壒娴佺▼
+ private List<ApprovalTask> tasks;
+
+ //瀹℃壒璁板綍
+ private List<ApprovalRecord> records;
+
+ @Schema(description = "涓氬姟鍚嶇О")
+ private String businessName;
+
+ @Schema(description = "鎶ヤ环鍗曞彿")
+ private String quotationNo;
+
+ @Schema(description = "閲囪喘鍗曞彿")
+ private String purchaseContractNumber;
+
+ @Schema(description = "鍙戣揣鍗曞彿")
+ private String shippingNo;
+
+ private List<StorageBlobVO> storageBlobVOList;
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeApproverVo.java b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeApproverVo.java
new file mode 100644
index 0000000..4c0ce0f
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeApproverVo.java
@@ -0,0 +1,9 @@
+package com.ruoyi.approve.bean.vo;
+
+
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import lombok.Data;
+
+@Data
+public class ApprovalTemplateNodeApproverVo extends ApprovalTemplateNodeApprover {
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeVo.java b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeVo.java
new file mode 100644
index 0000000..9acd0af
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateNodeVo.java
@@ -0,0 +1,13 @@
+package com.ruoyi.approve.bean.vo;
+
+
+import com.ruoyi.approve.pojo.ApprovalTemplateNode;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ApprovalTemplateNodeVo extends ApprovalTemplateNode {
+
+ private List<ApprovalTemplateNodeApproverVo> approvers;
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateVo.java b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateVo.java
new file mode 100644
index 0000000..84a6904
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/vo/ApprovalTemplateVo.java
@@ -0,0 +1,17 @@
+package com.ruoyi.approve.bean.vo;
+
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ApprovalTemplateVo extends ApprovalTemplate {
+
+ private List<ApprovalTemplateNodeVo> nodes;
+
+ private String createdUserName;
+
+ private List<StorageBlobVO> storageBlobDTOs;
+}
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/ApproveGetAndUpdateVo.java b/src/main/java/com/ruoyi/approve/bean/vo/ApproveGetAndUpdateVo.java
index f43ecac..4bf8d2f 100644
--- a/src/main/java/com/ruoyi/approve/bean/vo/ApproveGetAndUpdateVo.java
+++ b/src/main/java/com/ruoyi/approve/bean/vo/ApproveGetAndUpdateVo.java
@@ -9,6 +9,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
+import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@@ -45,6 +46,14 @@
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endDate;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @Schema(description = "鍑哄樊寮�濮嬫椂闂�")
+ private LocalDateTime startDateTime;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @Schema(description = "鍑哄樊缁撴潫鏃堕棿")
+ private LocalDateTime endDateTime;
+
private BigDecimal price;
private String location;
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java b/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java
index 56d420e..8e730ff 100644
--- a/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java
+++ b/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java
@@ -8,6 +8,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
+import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@@ -58,6 +59,14 @@
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endDate;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @Schema(description = "鍑哄樊寮�濮嬫椂闂�")
+ private LocalDateTime startDateTime;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @Schema(description = "鍑哄樊缁撴潫鏃堕棿")
+ private LocalDateTime endDateTime;
+
private BigDecimal price;
private String location;
@@ -75,5 +84,5 @@
*/
private BigDecimal maintenancePrice;
- private List<StorageBlobDTO> storageBlobDTOList;
+ private List<StorageBlobDTO> storageBlobDTOS;
}
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/FinReimbursementVo.java b/src/main/java/com/ruoyi/approve/bean/vo/FinReimbursementVo.java
new file mode 100644
index 0000000..5706ff3
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/bean/vo/FinReimbursementVo.java
@@ -0,0 +1,34 @@
+package com.ruoyi.approve.bean.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.approve.pojo.*;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Data
+public class FinReimbursementVo extends FinReimbursement {
+
+
+ private String createTimeStart;
+ private String createTimeEnd;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime startTime;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime endTime;
+
+ private FinReimbursementTravel travel;
+ private List<FinReimbursementDetail> details;
+ //瀹℃壒娴佺▼
+ private List<ApprovalTask> tasks;
+
+ //瀹℃壒璁板綍
+ private List<ApprovalRecord> records;
+ private List<StorageBlobVO> storageBlobVOList;
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/ApprovalInstanceController.java b/src/main/java/com/ruoyi/approve/controller/ApprovalInstanceController.java
new file mode 100644
index 0000000..36dcfc3
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/ApprovalInstanceController.java
@@ -0,0 +1,67 @@
+package com.ruoyi.approve.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
+import com.ruoyi.approve.bean.vo.ApprovalInstanceVo;
+import com.ruoyi.approve.service.ApprovalInstanceService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 瀹℃壒瀹炰緥琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:46
+ */
+@RestController
+@RequestMapping("/approvalInstance")
+@Tag(name = "瀹℃壒瀹炰緥琛�")
+@AllArgsConstructor
+public class ApprovalInstanceController extends BaseController {
+
+ private final ApprovalInstanceService approvalInstanceService;
+ @GetMapping("/listPage")
+ @Operation(summary = "鍒嗛〉鏌ヨ")
+ @Log(title = "瀹℃壒鍒楄〃鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
+ public R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto) {
+ return approvalInstanceService.listPage(page, approvalInstanceDto);
+ }
+
+ @PostMapping("/save")
+ @Operation(summary = "淇濆瓨")
+ @Log(title = "瀹℃壒鍒楄〃淇濆瓨", businessType = BusinessType.INSERT)
+ public R save(@RequestBody ApprovalInstanceDto approvalInstanceDto) {
+ return approvalInstanceService.add(approvalInstanceDto) ? R.ok() : R.fail();
+ }
+
+ @PutMapping("/update")
+ @Operation(summary = "鏇存柊")
+ @Log(title = "瀹℃壒鍒楄〃鏇存柊", businessType = BusinessType.UPDATE)
+ public R update(@RequestBody ApprovalInstanceDto approvalInstanceDto) {
+ return approvalInstanceService.update(approvalInstanceDto) ? R.ok() : R.fail();
+ }
+
+ @DeleteMapping("/delete")
+ @Log(title = "瀹℃壒鍒楄〃鍒犻櫎", businessType = BusinessType.DELETE)
+ @Operation(summary = "鍒犻櫎")
+ public R delete(@RequestBody List<Long> ids) {
+ return approvalInstanceService.delete(ids) ? R.ok() : R.fail();
+ }
+
+ @Operation(summary = "瀹℃壒")
+ @PostMapping("/approve")
+ @Log(title = "瀹℃壒鍒楄〃瀹℃壒", businessType = BusinessType.UPDATE)
+ public R approve(@RequestBody ApprovalInstanceDto approvalInstanceDto) {
+ return approvalInstanceService.approve(approvalInstanceDto);
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/ApprovalInstanceNodeController.java b/src/main/java/com/ruoyi/approve/controller/ApprovalInstanceNodeController.java
new file mode 100644
index 0000000..e42af42
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/ApprovalInstanceNodeController.java
@@ -0,0 +1,19 @@
+package com.ruoyi.approve.controller;
+
+import com.ruoyi.framework.web.controller.BaseController;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 瀹℃壒鑺傜偣瀹炰緥琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:54
+ */
+@RestController
+@RequestMapping("/approvalInstanceNode")
+public class ApprovalInstanceNodeController extends BaseController {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/ApprovalRecordController.java b/src/main/java/com/ruoyi/approve/controller/ApprovalRecordController.java
new file mode 100644
index 0000000..2d6f9dd
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/ApprovalRecordController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 瀹℃壒璁板綍琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:28:21
+ */
+@RestController
+@RequestMapping("/approvalRecord")
+public class ApprovalRecordController {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/ApprovalTaskController.java b/src/main/java/com/ruoyi/approve/controller/ApprovalTaskController.java
new file mode 100644
index 0000000..8682caa
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/ApprovalTaskController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 瀹℃壒浠诲姟琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:32:37
+ */
+@RestController
+@RequestMapping("/approvalTask")
+public class ApprovalTaskController {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateController.java b/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateController.java
new file mode 100644
index 0000000..674d278
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateController.java
@@ -0,0 +1,74 @@
+package com.ruoyi.approve.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateDto;
+import com.ruoyi.approve.bean.vo.ApprovalTemplateVo;
+import com.ruoyi.approve.service.ApprovalTemplateService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺嬮亾杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:08
+ */
+@RestController
+@RequestMapping("/approvalTemplate")
+@Tag(name = "瀹℃壒妯℃澘琛�")
+@AllArgsConstructor
+public class ApprovalTemplateController extends BaseController {
+
+ private final ApprovalTemplateService approvalTemplateService;
+
+ @GetMapping("/listPage")
+ @Operation(summary = "鍒嗛〉鏌ヨ")
+ @Log(title = "瀹℃壒妯℃澘鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
+ public R listPage(Page<ApprovalTemplateVo> page, ApprovalTemplateDto approvalTemplateDto) {
+ return R.ok(approvalTemplateService.listPage(page, approvalTemplateDto));
+ }
+
+ @PostMapping("/add")
+ @Operation(summary = "娣诲姞")
+ @Log(title = "娣诲姞瀹℃壒妯℃澘", businessType = BusinessType.INSERT)
+ public R add(@RequestBody ApprovalTemplateDto approvalTemplateDto) {
+ return R.ok(approvalTemplateService.saveApprovalTemplateDto(approvalTemplateDto));
+ }
+
+ @PutMapping("/update")
+ @Operation(summary = "淇敼")
+ @Log(title = "淇敼瀹℃壒妯℃澘", businessType = BusinessType.UPDATE)
+ public R update(@RequestBody ApprovalTemplateDto approvalTemplateDto) {
+ return R.ok(approvalTemplateService.updateApprovalTemplateDto(approvalTemplateDto));
+ }
+
+ @PostMapping("/delete")
+ @Operation(summary = "鍒犻櫎")
+ @Log(title = "鍒犻櫎瀹℃壒妯℃澘", businessType = BusinessType.DELETE)
+ public R delete(@RequestBody List<Long> ids) {
+ return R.ok(approvalTemplateService.delete(ids));
+ }
+
+ @GetMapping("/list/{type}")
+ @Operation(summary = "鏌ヨ鎵�鏈夊鎵规ā鏉�")
+ public R list(@PathVariable("type") Integer type) {
+ return R.ok(approvalTemplateService.listApprovalTemplateVo(type));
+ }
+
+ @GetMapping("/detail/{id}")
+ @Operation(summary = "鏌ヨ瀹℃壒妯℃澘璇︽儏")
+ @Log(title = "鏌ヨ瀹℃壒妯℃澘璇︽儏", businessType = BusinessType.OTHER)
+ public R detail(@PathVariable("id") Long id) {
+ return R.ok(approvalTemplateService.getApprovalTemplateVoById(id));
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeApproverController.java b/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeApproverController.java
new file mode 100644
index 0000000..b0e2bff
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeApproverController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣瀹℃壒浜鸿〃 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:30
+ */
+@RestController
+@RequestMapping("/approvalTemplateNodeApprover")
+public class ApprovalTemplateNodeApproverController {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeController.java b/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeController.java
new file mode 100644
index 0000000..5a1ed88
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/ApprovalTemplateNodeController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:19
+ */
+@RestController
+@RequestMapping("/approvalTemplateNode")
+public class ApprovalTemplateNodeController {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/FinReimbursementController.java b/src/main/java/com/ruoyi/approve/controller/FinReimbursementController.java
new file mode 100644
index 0000000..a2eecdb
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/FinReimbursementController.java
@@ -0,0 +1,60 @@
+package com.ruoyi.approve.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.FinReimbursementDto;
+import com.ruoyi.approve.bean.vo.FinReimbursementVo;
+import com.ruoyi.approve.service.FinReimbursementService;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曚富琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:15
+ */
+@RestController
+@RequestMapping("/finReimbursement")
+@Tag(name = "鎶ラ攢鍗曚富琛�", description = "鎶ラ攢鍗曚富琛�")
+@AllArgsConstructor
+public class FinReimbursementController {
+
+ private final FinReimbursementService finReimbursementService;
+
+ @GetMapping("/listPage")
+ @Operation(summary = "鍒嗛〉鏌ヨ")
+ public R listPage(Page<FinReimbursementVo> page, FinReimbursementDto finReimbursementDto) {
+ return R.ok(finReimbursementService.listPage(finReimbursementDto, page));
+ }
+
+ @PostMapping("/save")
+ @Operation(summary = "淇濆瓨")
+ public R save(@RequestBody FinReimbursementDto finReimbursementDto) {
+ return R.ok(finReimbursementService.add(finReimbursementDto));
+ }
+
+ @GetMapping("/detail")
+ @Operation(summary = "璇︽儏")
+ public R detail(Long id) {
+ return R.ok(finReimbursementService.detail(id));
+ }
+
+ @PostMapping("/update")
+ @Operation(summary = "淇敼")
+ public R update(@RequestBody FinReimbursementDto finReimbursementDto) {
+ return R.ok(finReimbursementService.update(finReimbursementDto));
+ }
+
+ @DeleteMapping("/delete")
+ @Operation(summary = "鍒犻櫎")
+ public R delete(@RequestBody List<Long> ids) {
+ return R.ok(finReimbursementService.delete(ids));
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/FinReimbursementDetailController.java b/src/main/java/com/ruoyi/approve/controller/FinReimbursementDetailController.java
new file mode 100644
index 0000000..18e4f73
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/FinReimbursementDetailController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曟槑缁嗚〃 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:38
+ */
+@RestController
+@RequestMapping("/finReimbursementDetail")
+public class FinReimbursementDetailController {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/FinReimbursementTravelController.java b/src/main/java/com/ruoyi/approve/controller/FinReimbursementTravelController.java
new file mode 100644
index 0000000..0e67feb
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/controller/FinReimbursementTravelController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 宸梾鎶ラ攢鎵╁睍琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:47
+ */
+@RestController
+@RequestMapping("/finReimbursementTravel")
+public class FinReimbursementTravelController {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/controller/KnowledgeBaseController.java b/src/main/java/com/ruoyi/approve/controller/KnowledgeBaseController.java
index 3ebb782..ba93fb4 100644
--- a/src/main/java/com/ruoyi/approve/controller/KnowledgeBaseController.java
+++ b/src/main/java/com/ruoyi/approve/controller/KnowledgeBaseController.java
@@ -2,16 +2,25 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.dto.KnowledgeBaseVectorVO;
import com.ruoyi.approve.pojo.KnowledgeBase;
+import com.ruoyi.approve.pojo.KnowledgeBaseVector;
import com.ruoyi.approve.service.KnowledgeBaseService;
+import com.ruoyi.approve.service.KnowledgeBaseVectorService;
+import com.ruoyi.basic.dto.StorageAttachmentDTO;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.pojo.StorageBlob;
+import com.ruoyi.basic.service.StorageAttachmentService;
+import com.ruoyi.basic.service.StorageBlobService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.AjaxResult;
-import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
@RestController
@@ -20,40 +29,42 @@
@Tag(name = "鐭ヨ瘑搴撶鐞�")
public class KnowledgeBaseController {
private KnowledgeBaseService knowledgeBaseService;
+ private KnowledgeBaseVectorService knowledgeBaseVectorService;
+ private StorageAttachmentService storageAttachmentService;
+ private StorageBlobService storageBlobService;
- /**銆�
+ /**
* 鑾峰彇鍒楄〃
- * @return
*/
@GetMapping("/getList")
public AjaxResult getList(@RequestParam(defaultValue = "1") long current,
@RequestParam(defaultValue = "10") long size, KnowledgeBase knowledgeBase) {
Page page = new Page(current, size);
- return AjaxResult.success(knowledgeBaseService.listpage(page,knowledgeBase));
+ return AjaxResult.success(knowledgeBaseService.listpage(page, knowledgeBase));
}
- /**銆�
- * 澧炴坊
- * @return
+
+ /**
+ * 鏂板鐭ヨ瘑搴�
*/
@PostMapping("/add")
- public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase){
+ public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase) {
return AjaxResult.success(knowledgeBaseService.save(knowledgeBase));
}
+
/**
- * 鏇存柊
- * @return
+ * 鏇存柊鐭ヨ瘑搴�
*/
@PostMapping("/update")
- public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase){
+ public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase) {
return AjaxResult.success(knowledgeBaseService.updateById(knowledgeBase));
}
+
/**
- * 鍒犻櫎
- * @return
+ * 鍒犻櫎鐭ヨ瘑搴�
*/
@DeleteMapping("/delete")
- public AjaxResult delete(@RequestBody List<Long> ids){
- if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
+ public AjaxResult delete(@RequestBody List<Long> ids) {
+ if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
return AjaxResult.success(knowledgeBaseService.removeByIds(ids));
}
@@ -65,4 +76,101 @@
util.exportExcel(response, accountExpenses, "鐭ヨ瘑搴撶鐞嗗鍑�");
}
-}
+ /**
+ * 鏌ヨ鐭ヨ瘑搴撴枃浠跺悜閲忓寲鐘舵��
+ */
+ @GetMapping("/vector/status/{knowledgeBaseId}")
+ @Operation(summary = "鏌ヨ鐭ヨ瘑搴撴枃浠跺悜閲忓寲鐘舵��")
+ public AjaxResult getVectorStatus(@PathVariable Long knowledgeBaseId) {
+ List<KnowledgeBaseVectorVO> list = knowledgeBaseVectorService.getVectorStatusByKnowledgeBaseId(knowledgeBaseId);
+ return AjaxResult.success(list);
+ }
+
+ /**
+ * 閲嶆柊鍚戦噺鍖栨枃浠�
+ */
+ @PostMapping("/vector/reprocess/{vectorId}")
+ @Operation(summary = "閲嶆柊鍚戦噺鍖栨枃浠�")
+ public AjaxResult reprocessVector(@PathVariable Long vectorId) {
+ knowledgeBaseVectorService.reprocessVector(vectorId);
+ return AjaxResult.success("宸查噸鏂版彁浜ゅ悜閲忓寲浠诲姟");
+ }
+
+ /**
+ * 淇濆瓨鐭ヨ瘑搴撴枃浠跺叧鑱旓紙鏂囦欢涓婁紶鍚庤皟鐢級
+ * 涓婁紶娴佺▼锛�
+ * 1. 鍏堣皟鐢� /common/upload 涓婁紶鏂囦欢锛岃幏鍙� storageBlobDTOs
+ * 2. 鍐嶈皟鐢ㄦ鎺ュ彛鍏宠仈鏂囦欢鍒扮煡璇嗗簱骞惰Е鍙戝悜閲忓寲
+ */
+ @PostMapping("/file/save")
+ @Operation(summary = "淇濆瓨鐭ヨ瘑搴撴枃浠跺叧鑱�")
+ public AjaxResult saveKnowledgeBaseFiles(@RequestBody KnowledgeBaseFileDTO dto) {
+ if (dto.getKnowledgeBaseId() == null) {
+ return AjaxResult.error("鐭ヨ瘑搴揑D涓嶈兘涓虹┖");
+ }
+ if (CollectionUtils.isEmpty(dto.getStorageBlobIds())) {
+ return AjaxResult.error("鏂囦欢ID涓嶈兘涓虹┖");
+ }
+
+ // 淇濆瓨闄勪欢鍏宠仈
+ StorageAttachmentDTO attachmentDTO = new StorageAttachmentDTO();
+ attachmentDTO.setRecordType("knowledge_base");
+ attachmentDTO.setRecordId(dto.getKnowledgeBaseId());
+ attachmentDTO.setApplication("rag_file");
+ List<StorageBlobDTO> blobDTOs = new ArrayList<>();
+ for (Long blobId : dto.getStorageBlobIds()) {
+ StorageBlobDTO blobDTO = new StorageBlobDTO();
+ blobDTO.setId(blobId);
+ blobDTOs.add(blobDTO);
+ }
+ attachmentDTO.setStorageBlobDTOs(blobDTOs);
+ storageAttachmentService.saveStorageAttachment(attachmentDTO);
+
+ // 鍒涘缓鍚戦噺璁板綍骞惰Е鍙戝悜閲忓寲
+ for (Long blobId : dto.getStorageBlobIds()) {
+ StorageBlob blob = storageBlobService.getById(blobId);
+ if (blob != null) {
+ String fileName = blob.getOriginalFilename();
+ String fileType = getFileExtension(fileName);
+
+ knowledgeBaseVectorService.createVectorRecord(
+ dto.getKnowledgeBaseId(),
+ blobId,
+ fileName,
+ fileType
+ );
+ }
+ }
+
+ return AjaxResult.success();
+ }
+
+ private String getFileExtension(String fileName) {
+ if (fileName == null || !fileName.contains(".")) {
+ return "unknown";
+ }
+ return fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
+ }
+
+ /**
+ * 鍒犻櫎鐭ヨ瘑搴撴枃浠�
+ */
+ @DeleteMapping("/file/delete")
+ @Operation(summary = "鍒犻櫎鐭ヨ瘑搴撴枃浠�")
+ public AjaxResult deleteKnowledgeBaseFiles(@RequestBody List<Long> vectorIds) {
+ if (CollectionUtils.isEmpty(vectorIds)) {
+ return AjaxResult.error("璇烽�夋嫨瑕佸垹闄ょ殑鏂囦欢");
+ }
+ knowledgeBaseVectorService.deleteVectors(vectorIds);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 鐭ヨ瘑搴撴枃浠禗TO
+ */
+ @lombok.Data
+ public static class KnowledgeBaseFileDTO {
+ private Long knowledgeBaseId;
+ private List<Long> storageBlobIds;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/approve/dto/KnowledgeBaseVectorVO.java b/src/main/java/com/ruoyi/approve/dto/KnowledgeBaseVectorVO.java
new file mode 100644
index 0000000..9cfb721
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/dto/KnowledgeBaseVectorVO.java
@@ -0,0 +1,21 @@
+package com.ruoyi.approve.dto;
+
+import com.ruoyi.approve.pojo.KnowledgeBaseVector;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 鐭ヨ瘑搴撴枃浠跺悜閲忕姸鎬乂O
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "鐭ヨ瘑搴撴枃浠跺悜閲忕姸鎬乂O")
+public class KnowledgeBaseVectorVO extends KnowledgeBaseVector {
+
+ @Schema(description = "鏂囦欢棰勮URL")
+ private String previewUrl;
+
+ @Schema(description = "鏂囦欢涓嬭浇URL")
+ private String downloadUrl;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceMapper.java b/src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceMapper.java
new file mode 100644
index 0000000..a541b90
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceMapper.java
@@ -0,0 +1,24 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
+import com.ruoyi.approve.bean.vo.ApprovalInstanceVo;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 瀹℃壒瀹炰緥琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:46
+ */
+@Mapper
+public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance> {
+
+ IPage<ApprovalInstanceVo> listPage(Page<ApprovalInstanceVo> page,@Param("ew") ApprovalInstanceDto approvalInstanceDto);
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceNodeMapper.java b/src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceNodeMapper.java
new file mode 100644
index 0000000..8787e55
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/ApprovalInstanceNodeMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.pojo.ApprovalInstanceNode;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 瀹℃壒鑺傜偣瀹炰緥琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:54
+ */
+@Mapper
+public interface ApprovalInstanceNodeMapper extends BaseMapper<ApprovalInstanceNode> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/ApprovalRecordMapper.java b/src/main/java/com/ruoyi/approve/mapper/ApprovalRecordMapper.java
new file mode 100644
index 0000000..fcf5ec6
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/ApprovalRecordMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.pojo.ApprovalRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 瀹℃壒璁板綍琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:28:21
+ */
+@Mapper
+public interface ApprovalRecordMapper extends BaseMapper<ApprovalRecord> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/ApprovalTaskMapper.java b/src/main/java/com/ruoyi/approve/mapper/ApprovalTaskMapper.java
new file mode 100644
index 0000000..2531d8e
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/ApprovalTaskMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.pojo.ApprovalTask;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 瀹℃壒浠诲姟琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:32:37
+ */
+@Mapper
+public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateMapper.java b/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateMapper.java
new file mode 100644
index 0000000..693f4b2
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateMapper.java
@@ -0,0 +1,24 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateDto;
+import com.ruoyi.approve.bean.vo.ApprovalTemplateVo;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:08
+ */
+@Mapper
+public interface ApprovalTemplateMapper extends BaseMapper<ApprovalTemplate> {
+
+ IPage<ApprovalTemplateVo> listPage(Page<ApprovalTemplateVo> page,@Param("ew") ApprovalTemplateDto approvalTemplateDto);
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeApproverMapper.java b/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeApproverMapper.java
new file mode 100644
index 0000000..d96f1e3
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeApproverMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣瀹℃壒浜鸿〃 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:30
+ */
+@Mapper
+public interface ApprovalTemplateNodeApproverMapper extends BaseMapper<ApprovalTemplateNodeApprover> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeMapper.java b/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeMapper.java
new file mode 100644
index 0000000..dc4a67f
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/ApprovalTemplateNodeMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.pojo.ApprovalTemplateNode;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:19
+ */
+@Mapper
+public interface ApprovalTemplateNodeMapper extends BaseMapper<ApprovalTemplateNode> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/FinReimbursementDetailMapper.java b/src/main/java/com/ruoyi/approve/mapper/FinReimbursementDetailMapper.java
new file mode 100644
index 0000000..edc039a
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/FinReimbursementDetailMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.pojo.FinReimbursementDetail;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曟槑缁嗚〃 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:38
+ */
+@Mapper
+public interface FinReimbursementDetailMapper extends BaseMapper<FinReimbursementDetail> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/FinReimbursementMapper.java b/src/main/java/com/ruoyi/approve/mapper/FinReimbursementMapper.java
new file mode 100644
index 0000000..19ac354
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/FinReimbursementMapper.java
@@ -0,0 +1,24 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.FinReimbursementDto;
+import com.ruoyi.approve.bean.vo.FinReimbursementVo;
+import com.ruoyi.approve.pojo.FinReimbursement;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曚富琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:15
+ */
+@Mapper
+public interface FinReimbursementMapper extends BaseMapper<FinReimbursement> {
+
+ IPage<FinReimbursementVo> listPage(@Param("ew") FinReimbursementDto finReimbursementDto, Page<FinReimbursementVo> page);
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/FinReimbursementTravelMapper.java b/src/main/java/com/ruoyi/approve/mapper/FinReimbursementTravelMapper.java
new file mode 100644
index 0000000..bc5e1b8
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/FinReimbursementTravelMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.pojo.FinReimbursementTravel;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 宸梾鎶ラ攢鎵╁睍琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:47
+ */
+@Mapper
+public interface FinReimbursementTravelMapper extends BaseMapper<FinReimbursementTravel> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/mapper/KnowledgeBaseVectorMapper.java b/src/main/java/com/ruoyi/approve/mapper/KnowledgeBaseVectorMapper.java
new file mode 100644
index 0000000..5fb19fe
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/mapper/KnowledgeBaseVectorMapper.java
@@ -0,0 +1,39 @@
+package com.ruoyi.approve.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.approve.dto.KnowledgeBaseVectorVO;
+import com.ruoyi.approve.pojo.KnowledgeBaseVector;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+/**
+ * 鐭ヨ瘑搴撴枃浠跺悜閲忚褰� Mapper
+ */
+@Mapper
+public interface KnowledgeBaseVectorMapper extends BaseMapper<KnowledgeBaseVector> {
+
+ /**
+ * 鏌ヨ鐭ヨ瘑搴撶殑鏂囦欢鍚戦噺鐘舵�佸垪琛�
+ */
+ @Select("SELECT v.*, b.path as previewUrl " +
+ "FROM knowledge_base_vector v " +
+ "LEFT JOIN storage_blob b ON v.storage_blob_id = b.id " +
+ "WHERE v.knowledge_base_id = #{knowledgeBaseId} " +
+ "ORDER BY v.create_time DESC")
+ List<KnowledgeBaseVectorVO> selectByKnowledgeBaseId(@Param("knowledgeBaseId") Long knowledgeBaseId);
+
+ /**
+ * 缁熻鐭ヨ瘑搴撶殑鏂囦欢鏁伴噺
+ */
+ @Select("SELECT COUNT(*) FROM knowledge_base_vector WHERE knowledge_base_id = #{knowledgeBaseId}")
+ int countByKnowledgeBaseId(@Param("knowledgeBaseId") Long knowledgeBaseId);
+
+ /**
+ * 缁熻鐭ヨ瘑搴撶殑鎬诲垏鐗囨暟閲�
+ */
+ @Select("SELECT COALESCE(SUM(chunk_count), 0) FROM knowledge_base_vector WHERE knowledge_base_id = #{knowledgeBaseId} AND vector_status = 2")
+ int sumChunkCountByKnowledgeBaseId(@Param("knowledgeBaseId") Long knowledgeBaseId);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApprovalInstance.java b/src/main/java/com/ruoyi/approve/pojo/ApprovalInstance.java
new file mode 100644
index 0000000..5bac3a9
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/ApprovalInstance.java
@@ -0,0 +1,151 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 瀹℃壒瀹炰緥琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:46
+ */
+@Getter
+@Setter
+@ToString
+@TableName("approval_instance")
+@ApiModel(value = "ApprovalInstance瀵硅薄", description = "瀹℃壒瀹炰緥琛�")
+public class ApprovalInstance implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 瀹℃壒瀹炰緥ID
+ */
+ @Schema(description ="瀹℃壒瀹炰緥ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹℃壒缂栧彿
+ */
+ @Schema(description ="瀹℃壒缂栧彿")
+ private String instanceNo;
+
+ /**
+ * 妯℃澘ID
+ */
+ @Schema(description ="妯℃澘ID")
+ private Long templateId;
+
+ /**
+ * 妯℃澘鍚嶇О
+ */
+ @Schema(description ="妯℃澘鍚嶇О")
+ private String templateName;
+
+ /**
+ * 涓氬姟ID
+ */
+ @Schema(description ="涓氬姟ID")
+ private Long businessId;
+
+ /**
+ * 涓氬姟绫诲瀷
+ */
+ @Schema(description ="涓氬姟绫诲瀷")
+ private Long businessType;
+
+ /**
+ * 瀹℃壒鏍囬
+ */
+ @Schema(description ="瀹℃壒鏍囬")
+ private String title;
+
+ /**
+ * 瀹℃壒鐘舵��
+ */
+ @Schema(description ="瀹℃壒鐘舵�� PENDING - 寰呭鎵�/杩涜涓� APPROVED - 宸查�氳繃/宸插畬鎴� REJECTED - 宸查┏鍥�")
+ private String status;
+
+ /**
+ * 褰撳墠瀹℃壒绾у埆
+ */
+ @Schema(description ="褰撳墠瀹℃壒绾у埆")
+ private Integer currentLevel;
+
+ /**
+ * 鐢宠浜篒D
+ */
+ @Schema(description ="鐢宠浜篒D")
+ private Long applicantId;
+
+ /**
+ * 鐢宠浜哄悕绉�
+ */
+ @Schema(description ="鐢宠浜哄悕绉�")
+ private String applicantName;
+
+ /**
+ * 鐢宠鏃堕棿
+ */
+ @Schema(description ="鐢宠鏃堕棿")
+ private LocalDateTime applyTime;
+
+ /**
+ * 瀹屾垚鏃堕棿
+ */
+ @Schema(description ="瀹屾垚鏃堕棿")
+ private LocalDateTime finishTime;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description ="鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description ="鍒涘缓鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description ="鏇存柊浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description ="鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+ /**
+ * 閫昏緫鍒犻櫎
+ */
+ @Schema(description ="閫昏緫鍒犻櫎")
+ private Byte deleted;
+
+ @Schema(description = "琛ㄥ崟鏁版嵁")
+ private String formConfig;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApprovalInstanceNode.java b/src/main/java/com/ruoyi/approve/pojo/ApprovalInstanceNode.java
new file mode 100644
index 0000000..621ce1f
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/ApprovalInstanceNode.java
@@ -0,0 +1,106 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 瀹℃壒鑺傜偣瀹炰緥琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:54
+ */
+@Getter
+@Setter
+@ToString
+@TableName("approval_instance_node")
+@ApiModel(value = "ApprovalInstanceNode瀵硅薄", description = "瀹℃壒鑺傜偣瀹炰緥琛�")
+public class ApprovalInstanceNode implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 鑺傜偣瀹炰緥ID
+ */
+ @Schema(description ="鑺傜偣瀹炰緥ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹℃壒瀹炰緥ID
+ */
+ @Schema(description ="瀹℃壒瀹炰緥ID")
+ private Long instanceId;
+
+ /**
+ * 瀹℃壒绾у埆
+ */
+ @Schema(description ="瀹℃壒绾у埆")
+ private Integer levelNo;
+
+ /**
+ * 瀹℃壒绫诲瀷
+ */
+ @Schema(description ="瀹℃壒绫诲瀷")
+ private String approveType;
+
+ /**
+ * 鑺傜偣鐘舵��
+ */
+ @Schema(description ="鑺傜偣鐘舵�� PENDING - 寰呭鐞� APPROVED - 宸查�氳繃 REJECTED - 宸查┏鍥�")
+ private String status;
+
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ @Schema(description ="寮�濮嬫椂闂�")
+ private LocalDateTime startTime;
+
+ /**
+ * 瀹屾垚鏃堕棿
+ */
+ @Schema(description ="瀹屾垚鏃堕棿")
+ private LocalDateTime finishTime;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description ="鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description ="鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description ="鏇存柊浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description ="鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ /**
+ * 閫昏緫鍒犻櫎
+ */
+ @Schema(description ="閫昏緫鍒犻櫎")
+ private Byte deleted;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApprovalRecord.java b/src/main/java/com/ruoyi/approve/pojo/ApprovalRecord.java
new file mode 100644
index 0000000..21bc52b
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/ApprovalRecord.java
@@ -0,0 +1,98 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 瀹℃壒璁板綍琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:28:21
+ */
+@Getter
+@Setter
+@ToString
+@TableName("approval_record")
+@ApiModel(value = "ApprovalRecord瀵硅薄", description = "瀹℃壒璁板綍琛�")
+public class ApprovalRecord implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 瀹℃壒璁板綍ID
+ */
+ @Schema(description ="瀹℃壒璁板綍ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹℃壒瀹炰緥ID
+ */
+ @Schema(description ="瀹℃壒瀹炰緥ID")
+ private Long instanceId;
+
+ /**
+ * 鑺傜偣瀹炰緥ID
+ */
+ @Schema(description ="鑺傜偣瀹炰緥ID")
+ private Long nodeId;
+
+ /**
+ * 瀹℃壒浠诲姟ID
+ */
+ @Schema(description ="瀹℃壒浠诲姟ID")
+ private Long taskId;
+
+ /**
+ * 鎿嶄綔浜篒D
+ */
+ @Schema(description ="鎿嶄綔浜篒D")
+ private Long operatorId;
+
+ /**
+ * 鎿嶄綔浜哄悕绉�
+ */
+ @Schema(description ="鎿嶄綔浜哄悕绉�")
+ private String operatorName;
+
+ /**
+ * 鎿嶄綔绫诲瀷
+ */
+ @Schema(description ="鎿嶄綔绫诲瀷")
+ private String action;
+
+ /**
+ * 瀹℃壒鎰忚
+ */
+ @Schema(description ="瀹℃壒鎰忚")
+ private String comment;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description ="鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description ="鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ /**
+ * 閫昏緫鍒犻櫎
+ */
+ @Schema(description ="閫昏緫鍒犻櫎")
+ private Byte deleted;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApprovalTask.java b/src/main/java/com/ruoyi/approve/pojo/ApprovalTask.java
new file mode 100644
index 0000000..d78c964
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/ApprovalTask.java
@@ -0,0 +1,128 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 瀹℃壒浠诲姟琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:32:37
+ */
+@Getter
+@Setter
+@ToString
+@TableName("approval_task")
+@ApiModel(value = "ApprovalTask瀵硅薄", description = "瀹℃壒浠诲姟琛�")
+public class ApprovalTask implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 瀹℃壒浠诲姟ID
+ */
+ @Schema(description ="瀹℃壒浠诲姟ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹℃壒瀹炰緥ID
+ */
+ @Schema(description ="瀹℃壒瀹炰緥ID")
+ private Long instanceId;
+
+ /**
+ * 鑺傜偣瀹炰緥ID
+ */
+ @Schema(description ="鑺傜偣瀹炰緥ID")
+ private Long nodeId;
+
+ /**
+ * 瀹℃壒绾у埆
+ */
+ @Schema(description ="瀹℃壒绾у埆")
+ private Integer levelNo;
+
+ /**
+ * 瀹℃壒浜篒D
+ */
+ @Schema(description ="瀹℃壒浜篒D")
+ private Long approverId;
+
+ /**
+ * 瀹℃壒浜哄悕绉�
+ */
+ @Schema(description ="瀹℃壒浜哄悕绉�")
+ private String approverName;
+
+ /**
+ * 浠诲姟鐘舵��
+ */
+ @Schema(description ="浠诲姟鐘舵�� PENDING - 寰呭鎵� APPROVED - 宸插悓鎰� REJECTED - 宸叉嫆缁�")
+ private String taskStatus;
+
+ /**
+ * 瀹℃壒鏃堕棿
+ */
+ @Schema(description ="瀹℃壒鏃堕棿")
+ private LocalDateTime approveTime;
+
+ /**
+ * 瀹℃壒鎰忚
+ */
+ @Schema(description ="瀹℃壒鎰忚")
+ private String comment;
+
+ /**
+ * 鏄惁宸茶
+ */
+ @Schema(description ="鏄惁宸茶")
+ private Byte isRead;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description ="鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description ="鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description ="鏇存柊浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description ="鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ /**
+ * 閫昏緫鍒犻櫎
+ */
+ @Schema(description ="閫昏緫鍒犻櫎")
+ private Byte deleted;
+
+ @Schema(description ="閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplate.java b/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplate.java
new file mode 100644
index 0000000..272b945
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplate.java
@@ -0,0 +1,107 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:08
+ */
+@Getter
+@Setter
+@ToString
+@TableName("approval_template")
+@ApiModel(value = "ApprovalTemplate瀵硅薄", description = "瀹℃壒妯℃澘琛�")
+public class ApprovalTemplate implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 妯℃澘ID
+ */
+ @Schema(description ="妯℃澘ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 妯℃澘鍚嶇О
+ */
+ @Schema(description ="妯℃澘鍚嶇О")
+ private String templateName;
+
+ /**
+ * 鍚敤鐘舵�侊細1鍚敤锛�0鍋滅敤
+ */
+ @Schema(description ="鍚敤鐘舵�侊細1鍚敤锛�0鍋滅敤")
+ private Byte enabled;
+
+ /**
+ * 妯℃澘璇存槑
+ */
+ @Schema(description ="妯℃澘璇存槑")
+ private String description;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description ="鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description ="鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description ="鏇存柊浜�")
+ @TableField(fill = FieldFill.UPDATE)
+ private Long updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description ="鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ /**
+ * 閫昏緫鍒犻櫎锛�0鍚︼紝1鏄�
+ */
+ @Schema(description ="閫昏緫鍒犻櫎锛�0鍚︼紝1鏄�")
+ private Integer deleted;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ @Schema(description = "琛ㄥ崟閰嶇疆")
+ private String formConfig;
+
+ @Schema(description = "妯℃澘绫诲瀷锛�0绯荤粺鍐呯疆锛�1鑷畾涔�")
+ private Integer templateType;
+
+ @Schema(description = "涓氬姟绫诲瀷")
+ private Long businessType;
+
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNode.java b/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNode.java
new file mode 100644
index 0000000..cd77198
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNode.java
@@ -0,0 +1,66 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:19
+ */
+@Getter
+@Setter
+@ToString
+@TableName("approval_template_node")
+@ApiModel(value = "ApprovalTemplateNode瀵硅薄", description = "瀹℃壒妯℃澘鑺傜偣琛�")
+public class ApprovalTemplateNode implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 鑺傜偣ID
+ */
+ @Schema(description ="鑺傜偣ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹℃壒妯℃澘ID
+ */
+ @Schema(description ="瀹℃壒妯℃澘ID")
+ private Long templateId;
+
+ /**
+ * 瀹℃壒绾у埆锛屼粠1寮�濮�
+ */
+ @Schema(description ="瀹℃壒绾у埆锛屼粠1寮�濮�")
+ private Integer levelNo;
+
+ /**
+ * 瀹℃壒鏂瑰紡锛欰ND浼氱锛孫R鎴栫
+ */
+ @Schema(description ="瀹℃壒鏂瑰紡锛欰ND浼氱锛孫R鎴栫")
+ private String approveType;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.UPDATE)
+ private LocalDateTime updateTime;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNodeApprover.java b/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNodeApprover.java
new file mode 100644
index 0000000..4113bff
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/ApprovalTemplateNodeApprover.java
@@ -0,0 +1,76 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣瀹℃壒浜鸿〃
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:30
+ */
+@Getter
+@Setter
+@ToString
+@TableName("approval_template_node_approver")
+@ApiModel(value = "ApprovalTemplateNodeApprover瀵硅薄", description = "瀹℃壒妯℃澘鑺傜偣瀹℃壒浜鸿〃")
+public class ApprovalTemplateNodeApprover implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @Schema(description = "涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 瀹℃壒鑺傜偣ID
+ */
+ @Schema(description ="瀹℃壒鑺傜偣ID")
+ private Long nodeId;
+
+ /**
+ * 瀹℃壒妯℃澘ID
+ */
+ @Schema(description ="瀹℃壒妯℃澘ID")
+ private Long templateId;
+
+ /**
+ * 瀹℃壒浜篒D
+ */
+ @Schema(description ="瀹℃壒浜篒D")
+ private Long approverId;
+
+ /**
+ * 瀹℃壒浜哄悕绉板啑浣�
+ */
+ @Schema(description ="瀹℃壒浜哄悕绉板啑浣�")
+ private String approverName;
+
+ /**
+ * 瀹℃壒浜烘帓搴�
+ */
+ @Schema(description ="瀹℃壒浜烘帓搴�")
+ private Integer sortNo;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+ @TableField(fill = FieldFill.INSERT)
+ private Long deleted ;
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/ApproveProcess.java b/src/main/java/com/ruoyi/approve/pojo/ApproveProcess.java
index bd56b0f..728878b 100644
--- a/src/main/java/com/ruoyi/approve/pojo/ApproveProcess.java
+++ b/src/main/java/com/ruoyi/approve/pojo/ApproveProcess.java
@@ -151,6 +151,16 @@
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endDate;
+ @Excel(name = "鍑哄樊寮�濮嬫椂闂�", dateFormat = "yyyy-MM-dd HH:mm", width = 30)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @Schema(description = "鍑哄樊寮�濮嬫椂闂�")
+ private LocalDateTime startDateTime;
+
+ @Excel(name = "鍑哄樊缁撴潫鏃堕棿", dateFormat = "yyyy-MM-dd HH:mm", width = 30)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @Schema(description = "鍑哄樊缁撴潫鏃堕棿")
+ private LocalDateTime endDateTime;
+
private BigDecimal price;
private String location;
diff --git a/src/main/java/com/ruoyi/approve/pojo/FinReimbursement.java b/src/main/java/com/ruoyi/approve/pojo/FinReimbursement.java
new file mode 100644
index 0000000..7e5c81f
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/FinReimbursement.java
@@ -0,0 +1,209 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曚富琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:15
+ */
+@Getter
+@Setter
+@ToString
+@TableName("fin_reimbursement")
+@ApiModel(value = "FinReimbursement瀵硅薄", description = "鎶ラ攢鍗曚富琛�")
+public class FinReimbursement implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @Schema(description = "涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鎶ラ攢鍗曞彿
+ */
+ @Schema(description = "鎶ラ攢鍗曞彿")
+ private String billNo;
+
+ /**
+ * 鎶ラ攢绫诲瀷锛�1-宸梾鎶ラ攢锛�2-璐圭敤鎶ラ攢
+ */
+ @Schema(description = "鎶ラ攢绫诲瀷锛�1-宸梾鎶ラ攢锛�2-璐圭敤鎶ラ攢")
+ private Byte reimbursementType;
+
+ /**
+ * 璐圭敤绫诲瀷锛氬樊鏃呰垂/鍔炲叕閲囪喘/涓氬姟鎷涘緟/浜ら�氳垂/閫氳璐�/鍏朵粬
+ */
+ @Schema(description = "璐圭敤绫诲瀷锛氬樊鏃呰垂/鍔炲叕閲囪喘/涓氬姟鎷涘緟/浜ら�氳垂/閫氳璐�/鍏朵粬")
+ private String expenseType;
+
+ /**
+ * 鐢宠浜篒D
+ */
+ @Schema(description = "鐢宠浜篒D")
+ private Long applicantId;
+
+ /**
+ * 鍛樺伐缂栧彿
+ */
+ @Schema(description = "鍛樺伐缂栧彿")
+ private String applicantCode;
+
+ /**
+ * 鍛樺伐濮撳悕
+ */
+ @Schema(description = "鍛樺伐濮撳悕")
+ private String applicantName;
+
+ /**
+ * 鐢宠閮ㄩ棬ID
+ */
+ @Schema(description = "鐢宠閮ㄩ棬ID")
+ private Long applicantDeptId;
+
+ /**
+ * 鐢宠閮ㄩ棬鍚嶇О
+ */
+ @Schema(description = "鐢宠閮ㄩ棬鍚嶇О")
+ private String applicantDeptName;
+
+ /**
+ * 鎶ラ攢鍘熷洜
+ */
+ @Schema(description = "鎶ラ攢鍘熷洜")
+ private String reason;
+
+ /**
+ * 鐢宠閲戦
+ */
+ @Schema(description = "鐢宠閲戦")
+ private BigDecimal applyAmount;
+
+ /**
+ * 鏄庣粏姹囨�婚噾棰�
+ */
+ @Schema(description = "鏄庣粏姹囨�婚噾棰�")
+ private BigDecimal detailTotalAmount;
+
+ /**
+ * 鏀舵浜�
+ */
+ @Schema(description = "鏀舵浜�")
+ private String payeeName;
+
+ /**
+ * 鏀舵璐﹀彿
+ */
+ @Schema(description = "鏀舵璐﹀彿")
+ private String payeeAccount;
+
+ /**
+ * 寮�鎴锋敮琛�
+ */
+ @Schema(description = "寮�鎴锋敮琛�")
+ private String payeeBank;
+
+ /**
+ * 瀹℃壒瀹炰緥ID锛屽搴� approval_instance.id
+ */
+ @Schema(description = "瀹℃壒瀹炰緥ID锛屽搴� approval_instance.id")
+ private Long approvalInstanceId;
+
+ /**
+ * 瀹℃壒娴佺▼ID锛屽搴� approve_process.id
+ */
+ @Schema(description = "瀹℃壒娴佺▼ID锛屽搴� approve_process.id")
+ private Long approveProcessId;
+
+ /**
+ * 鍗曟嵁鐘舵�侊細DRAFT-鑽夌锛孖N_APPROVAL-瀹℃壒涓紝APPROVED-瀹℃壒閫氳繃锛孯EJECTED-瀹℃壒椹冲洖锛學ITHDRAWN-宸叉挙鍥烇紝PAID-宸蹭粯娆�
+ */
+ @Schema(description = "鍗曟嵁鐘舵�侊細DRAFT-鑽夌锛孖N_APPROVAL-瀹℃壒涓紝APPROVED-瀹℃壒閫氳繃锛孯EJECTED-瀹℃壒椹冲洖锛學ITHDRAWN-宸叉挙鍥烇紝PAID-宸蹭粯娆�")
+ private String billStatus;
+
+ /**
+ * 瀹℃壒閫氳繃鏃堕棿
+ */
+ @Schema(description = "瀹℃壒閫氳繃鏃堕棿")
+ private LocalDateTime approvedTime;
+
+ /**
+ * 浠樻鏃堕棿
+ */
+ @Schema(description = "浠樻鏃堕棿")
+ private LocalDateTime paidTime;
+
+ /**
+ * 鐢熸垚鐨勮储鍔℃敮鍑鸿褰旾D锛屽搴� account_expense.id
+ */
+ @Schema(description = "鐢熸垚鐨勮储鍔℃敮鍑鸿褰旾D锛屽搴� account_expense.id")
+ private Long accountExpenseId;
+
+ /**
+ * 澶囨敞
+ */
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ /**
+ * 绉熸埛ID
+ */
+ @Schema(description = "绉熸埛ID")
+ private Long tenantId;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description = "鍒涘缓鏃堕棿")
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description = "鏇存柊浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ /**
+ * 褰掑睘閮ㄩ棬ID
+ */
+ @Schema(description = "褰掑睘閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 閫昏緫鍒犻櫎锛�0-鍚︼紝1-鏄�
+ */
+ @Schema(description = "閫昏緫鍒犻櫎锛�0-鍚︼紝1-鏄�")
+ private Byte deleted;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/FinReimbursementDetail.java b/src/main/java/com/ruoyi/approve/pojo/FinReimbursementDetail.java
new file mode 100644
index 0000000..5d0220e
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/FinReimbursementDetail.java
@@ -0,0 +1,157 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曟槑缁嗚〃
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:38
+ */
+@Getter
+@Setter
+@ToString
+@TableName("fin_reimbursement_detail")
+@ApiModel(value = "FinReimbursementDetail瀵硅薄", description = "鎶ラ攢鍗曟槑缁嗚〃")
+public class FinReimbursementDetail implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @Schema(description = "涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鎶ラ攢鍗旾D锛屽搴� fin_reimbursement.id
+ */
+ @Schema(description = "鎶ラ攢鍗旾D锛屽搴� fin_reimbursement.id")
+ private Long reimbursementId;
+
+ /**
+ * 鏄庣粏琛屽彿
+ */
+ @Schema(description = "鏄庣粏琛屽彿")
+ private Integer rowNo;
+
+ /**
+ * 鍙戠エ鏃ユ湡
+ */
+ @Schema(description = "鍙戠エ鏃ユ湡")
+ private LocalDate invoiceDate;
+
+ /**
+ * 璐圭敤绉戠洰
+ */
+ @Schema(description = "璐圭敤绉戠洰")
+ private String expenseCategory;
+
+ /**
+ * 閲戦
+ */
+ @Schema(description = "閲戦")
+ private BigDecimal amount;
+
+ /**
+ * 鎻忚堪
+ */
+ @Schema(description = "鎻忚堪")
+ private String description;
+
+ /**
+ * 鍙戠エ鍙风爜
+ */
+ @Schema(description = "鍙戠エ鍙风爜")
+ private String invoiceNo;
+
+ /**
+ * 鍙戠エ绫诲瀷
+ */
+ @Schema(description = "鍙戠エ绫诲瀷")
+ private String invoiceType;
+
+ /**
+ * 绁ㄩ潰閲戦
+ */
+ @Schema(description = "绁ㄩ潰閲戦")
+ private BigDecimal invoiceAmount;
+
+ /**
+ * 绋庣巼
+ */
+ @Schema(description = "绋庣巼")
+ private BigDecimal taxRate;
+
+ /**
+ * 绋庨
+ */
+ @Schema(description = "绋庨")
+ private BigDecimal taxAmount;
+
+ /**
+ * 澶囨敞
+ */
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ /**
+ * 绉熸埛ID
+ */
+ @Schema(description = "绉熸埛ID")
+ private Long tenantId;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description = "鏇存柊浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ /**
+ * 褰掑睘閮ㄩ棬ID
+ */
+ @Schema(description = "褰掑睘閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+ /**
+ * 閫昏緫鍒犻櫎锛�0-鍚︼紝1-鏄�
+ */
+ @Schema(description = "閫昏緫鍒犻櫎锛�0-鍚︼紝1-鏄�")
+ private Byte deleted;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/FinReimbursementTravel.java b/src/main/java/com/ruoyi/approve/pojo/FinReimbursementTravel.java
new file mode 100644
index 0000000..10c607c
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/FinReimbursementTravel.java
@@ -0,0 +1,162 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 宸梾鎶ラ攢鎵╁睍琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:47
+ */
+@Getter
+@Setter
+@ToString
+@TableName("fin_reimbursement_travel")
+@ApiModel(value = "FinReimbursementTravel瀵硅薄", description = "宸梾鎶ラ攢鎵╁睍琛�")
+public class FinReimbursementTravel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @Schema(description = "涓婚敭ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鎶ラ攢鍗旾D锛屽搴� fin_reimbursement.id
+ */
+ @Schema(description = "鎶ラ攢鍗旾D锛屽搴� fin_reimbursement.id")
+ private Long reimbursementId;
+
+ /**
+ * 鍑哄樊寮�濮嬫椂闂�
+ */
+ @Schema(description = "鍑哄樊寮�濮嬫椂闂�")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime startTime;
+
+ /**
+ * 鍑哄樊缁撴潫鏃堕棿
+ */
+ @Schema(description = "鍑哄樊缁撴潫鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime endTime;
+
+ /**
+ * 鍑哄樊澶╂暟
+ */
+ @Schema(description = "鍑哄樊澶╂暟")
+ private BigDecimal travelDays;
+
+ /**
+ * 鍑哄樊鍦�/鍑哄彂鍩庡競
+ */
+ @Schema(description = "鍑哄樊鍦�/鍑哄彂鍩庡競")
+ private String departureCity;
+
+ /**
+ * 鐩殑鍦�/鐩殑鍩庡競
+ */
+ @Schema(description = "鐩殑鍦�/鐩殑鍩庡競")
+ private String destinationCity;
+
+ /**
+ * 閰掑簵鏍囧噯
+ */
+ @Schema(description = "閰掑簵鏍囧噯")
+ private BigDecimal hotelStandard;
+
+ /**
+ * 浣忓澶╂暟
+ */
+ @Schema(description = "浣忓澶╂暟")
+ private BigDecimal lodgingDays;
+
+ /**
+ * 鐢熸椿琛ヨ创
+ */
+ @Schema(description = "鐢熸椿琛ヨ创")
+ private BigDecimal mealAllowance;
+
+ /**
+ * 浜ら�氳ˉ璐�
+ */
+ @Schema(description = "浜ら�氳ˉ璐�")
+ private BigDecimal transportAllowance;
+
+ /**
+ * 浣忓闄愰
+ */
+ @Schema(description = "浣忓闄愰")
+ private BigDecimal lodgingLimit;
+
+ /**
+ * 鐗规壒鏍囪鏂囨湰锛屽鍦ㄦ爣鍑嗚寖鍥村唴/瓒呮爣鐗规壒
+ */
+ @Schema(description = "鐗规壒鏍囪鏂囨湰锛屽鍦ㄦ爣鍑嗚寖鍥村唴/瓒呮爣鐗规壒")
+ private String standardTag;
+
+ /**
+ * 鏄惁鍦ㄦ爣鍑嗗唴锛�1-鏄紝0-鍚�
+ */
+ @Schema(description = "鏄惁鍦ㄦ爣鍑嗗唴锛�1-鏄紝0-鍚�")
+ private Byte withinStandard;
+
+ /**
+ * 绉熸埛ID
+ */
+ @Schema(description = "绉熸埛ID")
+ private Long tenantId;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ @Schema(description = "鍒涘缓浜�")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @Schema(description = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊浜�
+ */
+ @Schema(description = "鏇存柊浜�")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @Schema(description = "鏇存柊鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ /**
+ * 褰掑睘閮ㄩ棬ID
+ */
+ @Schema(description = "褰掑睘閮ㄩ棬ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/approve/pojo/KnowledgeBase.java b/src/main/java/com/ruoyi/approve/pojo/KnowledgeBase.java
index 06dec8e..b15da7a 100644
--- a/src/main/java/com/ruoyi/approve/pojo/KnowledgeBase.java
+++ b/src/main/java/com/ruoyi/approve/pojo/KnowledgeBase.java
@@ -91,4 +91,19 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+ /**
+ * 鏂囦欢鏁伴噺
+ */
+ private Integer fileCount;
+
+ /**
+ * 鎬诲垏鐗囨暟閲�
+ */
+ private Integer totalChunkCount;
+
+ /**
+ * 鐭ヨ瘑搴撴弿杩�
+ */
+ private String description;
+
}
diff --git a/src/main/java/com/ruoyi/approve/pojo/KnowledgeBaseVector.java b/src/main/java/com/ruoyi/approve/pojo/KnowledgeBaseVector.java
new file mode 100644
index 0000000..1db31fc
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/pojo/KnowledgeBaseVector.java
@@ -0,0 +1,80 @@
+package com.ruoyi.approve.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 鐭ヨ瘑搴撴枃浠跺悜閲忚褰曡〃
+ * knowledge_base_vector
+ */
+@Data
+@TableName("knowledge_base_vector")
+@Schema(description = "鐭ヨ瘑搴撴枃浠跺悜閲忚褰�")
+public class KnowledgeBaseVector implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @TableId(type = IdType.AUTO)
+ @Schema(description = "涓婚敭ID")
+ private Long id;
+
+ @Schema(description = "鍏宠仈鐭ヨ瘑搴揑D")
+ private Long knowledgeBaseId;
+
+ @Schema(description = "鍏宠仈鏂囦欢blob ID")
+ private Long storageBlobId;
+
+ @Schema(description = "鏂囦欢鍚嶇О")
+ private String fileName;
+
+ @Schema(description = "鏂囦欢绫诲瀷(docx/pdf/xlsx/txt绛�)")
+ private String fileType;
+
+ @Schema(description = "鍚戦噺鍖栫姸鎬�: 0-寰呭鐞�, 1-澶勭悊涓�, 2-宸插畬鎴�, 3-澶辫触")
+ private Integer vectorStatus;
+
+ @Schema(description = "鍚戦噺鍖栧け璐ュ師鍥�")
+ private String vectorError;
+
+ @Schema(description = "鍒囩墖鏁伴噺")
+ private Integer chunkCount;
+
+ @Schema(description = "鍚戦噺鍛藉悕绌洪棿")
+ private String namespace;
+
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Schema(description = "鍒涘缓鏃堕棿")
+ private LocalDateTime createTime;
+
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "鍒涘缓浜�")
+ private Integer createUser;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Schema(description = "鏇存柊鏃堕棿")
+ private LocalDateTime updateTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @Schema(description = "鏇存柊浜�")
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "绉熸埛ID")
+ private Long tenantId;
+
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "閮ㄩ棬ID")
+ private Long deptId;
+
+ // 鍚戦噺鍖栫姸鎬佸父閲�
+ public static final int STATUS_PENDING = 0;
+ public static final int STATUS_PROCESSING = 1;
+ public static final int STATUS_COMPLETED = 2;
+ public static final int STATUS_FAILED = 3;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/approve/service/ApprovalInstanceNodeService.java b/src/main/java/com/ruoyi/approve/service/ApprovalInstanceNodeService.java
new file mode 100644
index 0000000..8fa7c60
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/ApprovalInstanceNodeService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.approve.service;
+
+import com.ruoyi.approve.pojo.ApprovalInstanceNode;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 瀹℃壒鑺傜偣瀹炰緥琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:54
+ */
+public interface ApprovalInstanceNodeService extends IService<ApprovalInstanceNode> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/ApprovalInstanceService.java b/src/main/java/com/ruoyi/approve/service/ApprovalInstanceService.java
new file mode 100644
index 0000000..005795d
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/ApprovalInstanceService.java
@@ -0,0 +1,33 @@
+package com.ruoyi.approve.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
+import com.ruoyi.approve.bean.vo.ApprovalInstanceVo;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.framework.web.domain.R;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 瀹℃壒瀹炰緥琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:46
+ */
+public interface ApprovalInstanceService extends IService<ApprovalInstance> {
+
+ R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto);
+
+ Boolean add(ApprovalInstanceDto approvalInstanceDto);
+
+ Boolean update(ApprovalInstanceDto approvalInstanceDto);
+
+ Boolean delete(List<Long> ids);
+
+ R approve(ApprovalInstanceDto approvalInstanceDto);
+
+ R autoApprove(Long instanceId);
+}
diff --git a/src/main/java/com/ruoyi/approve/service/ApprovalRecordService.java b/src/main/java/com/ruoyi/approve/service/ApprovalRecordService.java
new file mode 100644
index 0000000..041571c
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/ApprovalRecordService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.approve.service;
+
+import com.ruoyi.approve.pojo.ApprovalRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 瀹℃壒璁板綍琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:28:21
+ */
+public interface ApprovalRecordService extends IService<ApprovalRecord> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/ApprovalTaskService.java b/src/main/java/com/ruoyi/approve/service/ApprovalTaskService.java
new file mode 100644
index 0000000..491e57d
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/ApprovalTaskService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.approve.service;
+
+import com.ruoyi.approve.pojo.ApprovalTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 瀹℃壒浠诲姟琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:32:37
+ */
+public interface ApprovalTaskService extends IService<ApprovalTask> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeApproverService.java b/src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeApproverService.java
new file mode 100644
index 0000000..e335276
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeApproverService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.approve.service;
+
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣瀹℃壒浜鸿〃 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:30
+ */
+public interface ApprovalTemplateNodeApproverService extends IService<ApprovalTemplateNodeApprover> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeService.java b/src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeService.java
new file mode 100644
index 0000000..4a8d6a8
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/ApprovalTemplateNodeService.java
@@ -0,0 +1,20 @@
+package com.ruoyi.approve.service;
+
+import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeDto;
+import com.ruoyi.approve.pojo.ApprovalTemplateNode;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:19
+ */
+public interface ApprovalTemplateNodeService extends IService<ApprovalTemplateNode> {
+
+ Boolean saveApprovalTemplateNode(Long id, List<ApprovalTemplateNodeDto> nodes);
+}
diff --git a/src/main/java/com/ruoyi/approve/service/ApprovalTemplateService.java b/src/main/java/com/ruoyi/approve/service/ApprovalTemplateService.java
new file mode 100644
index 0000000..38bbabc
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/ApprovalTemplateService.java
@@ -0,0 +1,34 @@
+package com.ruoyi.approve.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateDto;
+import com.ruoyi.approve.bean.vo.ApprovalTemplateVo;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:08
+ */
+public interface ApprovalTemplateService extends IService<ApprovalTemplate> {
+
+ IPage<ApprovalTemplateVo> listPage(Page<ApprovalTemplateVo> page, ApprovalTemplateDto approvalTemplateDto);
+
+ Boolean saveApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto);
+
+ Boolean updateApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto);
+
+ Boolean delete(List<Long> ids);
+
+ List<ApprovalTemplateVo> listApprovalTemplateVo(Integer type);
+
+ ApprovalTemplateVo getApprovalTemplateVoById(Long id);
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/FinReimbursementDetailService.java b/src/main/java/com/ruoyi/approve/service/FinReimbursementDetailService.java
new file mode 100644
index 0000000..0279c25
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/FinReimbursementDetailService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.approve.service;
+
+import com.ruoyi.approve.pojo.FinReimbursementDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曟槑缁嗚〃 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:38
+ */
+public interface FinReimbursementDetailService extends IService<FinReimbursementDetail> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/FinReimbursementService.java b/src/main/java/com/ruoyi/approve/service/FinReimbursementService.java
new file mode 100644
index 0000000..c14b943
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/FinReimbursementService.java
@@ -0,0 +1,31 @@
+package com.ruoyi.approve.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.approve.bean.dto.FinReimbursementDto;
+import com.ruoyi.approve.bean.vo.FinReimbursementVo;
+import com.ruoyi.approve.pojo.FinReimbursement;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曚富琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:15
+ */
+public interface FinReimbursementService extends IService<FinReimbursement> {
+
+ IPage<FinReimbursementVo> listPage(FinReimbursementDto finReimbursementDto, Page<FinReimbursementVo> page);
+
+ Boolean add(FinReimbursementDto finReimbursementDto);
+
+ FinReimbursementVo detail(Long id);
+
+ Boolean update(FinReimbursementDto finReimbursementDto);
+
+ Boolean delete(List<Long> ids);
+}
diff --git a/src/main/java/com/ruoyi/approve/service/FinReimbursementTravelService.java b/src/main/java/com/ruoyi/approve/service/FinReimbursementTravelService.java
new file mode 100644
index 0000000..0733d1b
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/FinReimbursementTravelService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.approve.service;
+
+import com.ruoyi.approve.pojo.FinReimbursementTravel;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 宸梾鎶ラ攢鎵╁睍琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:47
+ */
+public interface FinReimbursementTravelService extends IService<FinReimbursementTravel> {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/KnowledgeBaseVectorService.java b/src/main/java/com/ruoyi/approve/service/KnowledgeBaseVectorService.java
new file mode 100644
index 0000000..10f2ca9
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/KnowledgeBaseVectorService.java
@@ -0,0 +1,43 @@
+package com.ruoyi.approve.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.approve.dto.KnowledgeBaseVectorVO;
+import com.ruoyi.approve.pojo.KnowledgeBaseVector;
+
+import java.util.List;
+
+/**
+ * 鐭ヨ瘑搴撴枃浠跺悜閲忚褰� Service
+ */
+public interface KnowledgeBaseVectorService extends IService<KnowledgeBaseVector> {
+
+ /**
+ * 鏌ヨ鐭ヨ瘑搴撶殑鏂囦欢鍚戦噺鐘舵�佸垪琛�
+ */
+ List<KnowledgeBaseVectorVO> getVectorStatusByKnowledgeBaseId(Long knowledgeBaseId);
+
+ /**
+ * 鍒涘缓鍚戦噺璁板綍骞惰Е鍙戝紓姝ュ悜閲忓寲
+ */
+ KnowledgeBaseVector createVectorRecord(Long knowledgeBaseId, Long storageBlobId, String fileName, String fileType);
+
+ /**
+ * 鏇存柊鍚戦噺鐘舵��
+ */
+ void updateVectorStatus(Long id, Integer status, Integer chunkCount, String error);
+
+ /**
+ * 閲嶆柊澶勭悊鍚戦噺鍖�
+ */
+ void reprocessVector(Long id);
+
+ /**
+ * 鍒犻櫎鍚戦噺璁板綍鍙婄浉鍏冲悜閲忔暟鎹�
+ */
+ void deleteVector(Long id);
+
+ /**
+ * 鎵归噺鍒犻櫎鍚戦噺璁板綍
+ */
+ void deleteVectors(List<Long> ids);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceNodeServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceNodeServiceImpl.java
new file mode 100644
index 0000000..9ea1963
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceNodeServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.approve.service.impl;
+
+import com.ruoyi.approve.pojo.ApprovalInstanceNode;
+import com.ruoyi.approve.mapper.ApprovalInstanceNodeMapper;
+import com.ruoyi.approve.service.ApprovalInstanceNodeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 瀹℃壒鑺傜偣瀹炰緥琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:27:54
+ */
+@Service
+public class ApprovalInstanceNodeServiceImpl extends ServiceImpl<ApprovalInstanceNodeMapper, ApprovalInstanceNode> implements ApprovalInstanceNodeService {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
new file mode 100644
index 0000000..62d083d
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
@@ -0,0 +1,876 @@
+package com.ruoyi.approve.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
+import com.ruoyi.approve.bean.vo.ApprovalInstanceVo;
+import com.ruoyi.approve.mapper.ApprovalInstanceMapper;
+import com.ruoyi.approve.mapper.ApprovalTemplateNodeApproverMapper;
+import com.ruoyi.approve.mapper.FinReimbursementMapper;
+import com.ruoyi.approve.pojo.*;
+import com.ruoyi.approve.service.*;
+import com.ruoyi.approve.utils.ApproveProcessConfigNodeUtils;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
+import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsMapper;
+import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeDeptMapper;
+import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeUserMapper;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser;
+import com.ruoyi.common.enums.*;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.procurementrecord.utils.StockUtils;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.mapper.SysDeptMapper;
+import com.ruoyi.project.system.mapper.SysUserDeptMapper;
+import com.ruoyi.project.system.mapper.SysUserMapper;
+import com.ruoyi.project.system.service.ISysNoticeService;
+import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
+import com.ruoyi.purchase.pojo.PurchaseLedger;
+import com.ruoyi.quality.utils.QualityInspectHelper;
+import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
+import com.ruoyi.sales.mapper.SalesQuotationMapper;
+import com.ruoyi.sales.mapper.ShippingInfoMapper;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.pojo.SalesQuotation;
+import com.ruoyi.sales.pojo.ShippingInfo;
+import com.ruoyi.staff.mapper.HolidayApplicationMapper;
+import com.ruoyi.staff.pojo.HolidayApplication;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 瀹℃壒瀹炰緥鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @since 2026-05-18 03:27:46
+ */
+@Service
+@RequiredArgsConstructor
+public class ApprovalInstanceServiceImpl extends ServiceImpl<ApprovalInstanceMapper, ApprovalInstance> implements ApprovalInstanceService {
+
+ private static final String ENTERPRISE_NEWS_STATUS_PUBLISHED = "PUBLISHED";
+ private static final String ENTERPRISE_NEWS_STATUS_REJECTED = "REJECTED";
+
+ private final ApprovalInstanceMapper approvalInstanceMapper;
+ private final ApproveProcessConfigNodeUtils approveProcessConfigNodeUtils;
+ private final ApprovalInstanceNodeService approvalInstanceNodeService;
+ private final ApprovalTaskService approvalTaskService;
+ private final ApprovalRecordService approvalRecordService;
+ private final ApprovalTemplateNodeService approvalTemplateNodeService;
+ private final FinReimbursementMapper finReimbursementMapper;
+ private final FileUtil fileUtil;
+ private final ISysNoticeService sysNoticeService;
+ private final PurchaseLedgerMapper purchaseLedgerMapper;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final StockUtils stockUtils;
+ private final SalesQuotationMapper salesQuotationMapper;
+ private final ShippingInfoMapper shippingInfoMapper;
+ private final QualityInspectHelper qualityInspectHelper;
+ private final EnterpriseNewsScopeUserMapper enterpriseNewsScopeUserMapper;
+ private final SysUserMapper sysUserMapper;
+ private final SysUserDeptMapper sysUserDeptMapper;
+ private final SysDeptMapper sysDeptMapper;
+ private final HolidayApplicationMapper holidayApplicationMapper;
+ private final EnterpriseNewsMapper enterpriseNewsMapper;
+ private final EnterpriseNewsScopeDeptMapper enterpriseNewsScopeDeptMapper;
+ private final ApprovalTemplateNodeApproverMapper approvalTemplateNodeApproverMapper;
+
+ @Override
+ public R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto) {
+ IPage<ApprovalInstanceVo> approvalInstanceVoIPage = approvalInstanceMapper.listPage(page, approvalInstanceDto);
+
+ List<ApprovalInstanceVo> records = approvalInstanceVoIPage.getRecords();
+ if (records == null || records.isEmpty()) {
+ return R.ok(approvalInstanceVoIPage);
+ }
+ records.forEach(vo -> {
+ vo.setBusinessName(TypeEnums.getLabelByValue(vo.getBusinessType()));
+
+ // 鏍规嵁涓氬姟绫诲瀷鏌ヨ瀵瑰簲鐨勫崟鍙�
+ if (vo.getBusinessType() != null && vo.getBusinessId() != null) {
+ if (TypeEnums.PURCHASE_APPROVAL.getCode().equals(vo.getBusinessType())) {
+ // 閲囪喘瀹℃壒 - 鏌ヨ閲囪喘鍗曞彿
+ PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(vo.getBusinessId());
+ if (purchaseLedger != null) {
+ vo.setPurchaseContractNumber(purchaseLedger.getPurchaseContractNumber());
+ }
+ } else if (TypeEnums.QUOTATION_APPROVAL.getCode().equals(vo.getBusinessType())) {
+ // 鎶ヤ环瀹℃壒 - 鏌ヨ鎶ヤ环鍗曞彿
+ SalesQuotation salesQuotation = salesQuotationMapper.selectById(vo.getBusinessId());
+ if (salesQuotation != null) {
+ vo.setQuotationNo(salesQuotation.getQuotationNo());
+ }
+ } else if (TypeEnums.SHIPPING_APPROVAL.getCode().equals(vo.getBusinessType())) {
+ // 鍙戣揣瀹℃壒 - 鏌ヨ鍙戣揣鍗曞彿
+ ShippingInfo shippingInfo = shippingInfoMapper.selectById(vo.getBusinessId());
+ if (shippingInfo != null) {
+ vo.setShippingNo(shippingInfo.getShippingNo());
+ }
+ }
+ }
+ });
+ Long currentUserId = SecurityUtils.getUserId();
+
+ List<Long> instanceIds = records.stream()
+ .map(ApprovalInstanceVo::getId)
+ .filter(id -> id != null)
+ .distinct()
+ .collect(Collectors.toList());
+
+ if (!instanceIds.isEmpty()) {
+ Map<Long, List<ApprovalRecord>> recordMap = approvalRecordService.list(
+ Wrappers.<ApprovalRecord>lambdaQuery()
+ .in(ApprovalRecord::getInstanceId, instanceIds)
+ .eq(ApprovalRecord::getDeleted, 0)
+ ).stream().collect(Collectors.groupingBy(ApprovalRecord::getInstanceId));
+ Map<Long, List<ApprovalTask>> taskMap = approvalTaskService.list(
+ Wrappers.<ApprovalTask>lambdaQuery()
+ .in(ApprovalTask::getInstanceId, instanceIds)
+ .eq(ApprovalTask::getDeleted, 0)
+ ).stream().collect(Collectors.groupingBy(ApprovalTask::getInstanceId));
+
+ for (ApprovalInstanceVo vo : records) {
+ vo.setIsApprove(approveProcessConfigNodeUtils.isCurrentApprover(vo.getId(), currentUserId));
+ vo.setRecords(recordMap.getOrDefault(vo.getId(), new ArrayList<>()));
+ vo.setTasks(taskMap.getOrDefault(vo.getId(), new ArrayList<>()));
+ vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.APPROVAL_INSTANCE, vo.getId()));
+ }
+
+ }
+ return R.ok(approvalInstanceVoIPage);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean add(ApprovalInstanceDto approvalInstanceDto) {
+ String instanceNo = OrderUtils.countTodayByCreateTime(approvalInstanceMapper, "SP", "instance_no", approvalInstanceDto.getCreateTime() != null ? approvalInstanceDto.getCreateTime() : LocalDateTime.now());
+ approvalInstanceDto.setInstanceNo(instanceNo);
+ approvalInstanceDto.setStatus("PENDING");
+ approvalInstanceDto.setCurrentLevel(1);
+ boolean saved = this.save(approvalInstanceDto);
+ if (!saved) {
+ return false;
+ }
+ approveProcessConfigNodeUtils.createCurrentNodeAndTasks(approvalInstanceDto);
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_INSTANCE, approvalInstanceDto.getId(), approvalInstanceDto.getStorageBlobDTOs());
+ sendApproveNotice(approvalInstanceDto, approveProcessConfigNodeUtils.getCurrentPendingTasks(approvalInstanceDto.getId()));
+ return true;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean update(ApprovalInstanceDto approvalInstanceDto) {
+ if (approvalInstanceDto == null || approvalInstanceDto.getId() == null) {
+ return false;
+ }
+ // 鍒ゆ柇鏄惁鏈夋鍦ㄨ繘琛岀殑瀹℃壒浠诲姟锛屾湁鍒欎笉鍏佽淇敼
+ long pendingTaskCount = approvalTaskService.count(
+ Wrappers.<ApprovalTask>lambdaQuery()
+ .eq(ApprovalTask::getInstanceId, approvalInstanceDto.getId())
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ );
+ if (pendingTaskCount > 0) {
+ throw new ServiceException("璇ュ鎵瑰崟鏈夋鍦ㄨ繘琛岀殑瀹℃壒浠诲姟锛屼笉鍏佽淇敼");
+ }
+ boolean updated = this.updateById(approvalInstanceDto);
+ if (!updated) {
+ return false;
+ }
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_INSTANCE, approvalInstanceDto.getId(), approvalInstanceDto.getStorageBlobDTOs());
+ return true;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean delete(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ return false;
+ }
+ fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_INSTANCE, ids);
+
+ int instanceRows = approvalInstanceMapper.update(
+ null,
+ Wrappers.<ApprovalInstance>lambdaUpdate()
+ .in(ApprovalInstance::getId, ids)
+ .eq(ApprovalInstance::getDeleted, 0)
+ .set(ApprovalInstance::getDeleted, (byte) 1)
+ );
+
+ LambdaUpdateWrapper<ApprovalInstanceNode> nodeUpdateWrapper = Wrappers.lambdaUpdate();
+ nodeUpdateWrapper.in(ApprovalInstanceNode::getInstanceId, ids)
+ .eq(ApprovalInstanceNode::getDeleted, 0)
+ .set(ApprovalInstanceNode::getDeleted, (byte) 1);
+ approvalInstanceNodeService.update(nodeUpdateWrapper);
+
+ LambdaUpdateWrapper<ApprovalTask> taskUpdateWrapper = Wrappers.lambdaUpdate();
+ taskUpdateWrapper.in(ApprovalTask::getInstanceId, ids)
+ .eq(ApprovalTask::getDeleted, 0)
+ .set(ApprovalTask::getDeleted, (byte) 1);
+ approvalTaskService.update(taskUpdateWrapper);
+
+ LambdaUpdateWrapper<ApprovalRecord> recordUpdateWrapper = Wrappers.lambdaUpdate();
+ recordUpdateWrapper.in(ApprovalRecord::getInstanceId, ids)
+ .eq(ApprovalRecord::getDeleted, 0)
+ .set(ApprovalRecord::getDeleted, (byte) 1);
+ approvalRecordService.update(recordUpdateWrapper);
+
+ return instanceRows > 0;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R approve(ApprovalInstanceDto approvalInstanceDto) {
+ if (approvalInstanceDto == null || approvalInstanceDto.getId() == null) {
+ return R.fail("瀹℃壒瀹炰緥 ID 涓嶈兘涓虹┖");
+ }
+ String approveAction = normalizeApproveAction(approvalInstanceDto.getApproveAction());
+ if (approveAction == null) {
+ return R.fail("瀹℃壒鍔ㄤ綔鍙敮鎸� APPROVED 鎴� REJECTED");
+ }
+
+ ApprovalInstance instance = getPendingApprovalInstance(approvalInstanceDto.getId());
+ if (instance == null) {
+ return R.fail("瀹℃壒瀹炰緥涓嶅瓨鍦�");
+ }
+
+ ApprovalInstanceNode currentNode = approveProcessConfigNodeUtils.getCurrentNode(instance.getId());
+ if (currentNode == null) {
+ return R.fail("褰撳墠娌℃湁寰呭鐞嗙殑瀹℃壒鑺傜偣");
+ }
+
+ Long currentUserId = SecurityUtils.getUserId();
+ ApprovalTask currentTask = approveProcessConfigNodeUtils.getCurrentUserTask(instance.getId(), currentUserId);
+ if (currentTask == null) {
+ return R.fail("褰撳墠鐢ㄦ埛娌℃湁鍙鎵逛换鍔�");
+ }
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ String operatorName = loginUser.getUser() != null ? loginUser.getUser().getNickName() : SecurityUtils.getUsername();
+ LocalDateTime now = LocalDateTime.now();
+
+ if (!updateCurrentTask(approvalInstanceDto, approveAction, currentTask, now)) {
+ return R.fail("褰撳墠浠诲姟宸茶澶勭悊锛岃鍒锋柊鍚庨噸璇�");
+ }
+
+ saveApprovalRecord(
+ instance.getId(),
+ currentNode.getId(),
+ currentTask.getId(),
+ currentUserId,
+ operatorName,
+ approveAction,
+ approvalInstanceDto.getApproveComment()
+ );
+ //瀹℃壒鎷掔粷鐨勫鐞�
+ if ("REJECTED".equals(approveAction)) {
+ return rejectCurrentNode(instance, currentNode, now);
+ }
+ if (!approveProcessConfigNodeUtils.canProceedToNextLevel(instance.getId(), currentNode.getApproveType())) {
+ return R.ok("瀹℃壒鎴愬姛锛岀瓑寰呭叾浠栧鎵逛汉澶勭悊");
+ }
+
+ return approveAndMoveNext(instance, currentNode, approvalInstanceDto, now);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R autoApprove(Long instanceId) {
+ if (instanceId == null) {
+ return R.fail("瀹℃壒瀹炰緥 ID 涓嶈兘涓虹┖");
+ }
+
+ ApprovalInstance instance = getPendingApprovalInstance(instanceId);
+ if (instance == null) {
+ return R.fail("瀹℃壒瀹炰緥涓嶅瓨鍦�");
+ }
+ if ("REJECTED".equals(instance.getStatus())) {
+ return R.fail("瀹℃壒宸查┏鍥烇紝鏃犳硶鑷姩閫氳繃");
+ }
+ if ("APPROVED".equals(instance.getStatus())) {
+ return R.ok("瀹℃壒宸插畬鎴�");
+ }
+
+ ApprovalInstanceDto autoApproveDto = new ApprovalInstanceDto();
+ autoApproveDto.setId(instanceId);
+ autoApproveDto.setApproveComment("绯荤粺鑷姩瀹℃壒");
+
+ int loopCount = 0;
+ while (loopCount++ < 20) {
+ ApprovalInstance currentInstance = getPendingApprovalInstance(instanceId);
+ if (currentInstance == null) {
+ return R.fail("瀹℃壒瀹炰緥涓嶅瓨鍦�");
+ }
+ if ("APPROVED".equals(currentInstance.getStatus())) {
+ return R.ok("瀹℃壒宸插畬鎴�");
+ }
+ if ("REJECTED".equals(currentInstance.getStatus())) {
+ return R.fail("瀹℃壒宸查┏鍥烇紝鏃犳硶鑷姩閫氳繃");
+ }
+
+ ApprovalInstanceNode currentNode = approveProcessConfigNodeUtils.getCurrentNode(currentInstance.getId());
+ if (currentNode == null) {
+ currentInstance.setStatus("APPROVED");
+ currentInstance.setFinishTime(LocalDateTime.now());
+ this.updateById(currentInstance);
+ handleBusinessAfterApprovalFinished(currentInstance);
+ return R.ok("瀹℃壒宸插畬鎴�");
+ }
+
+ List<ApprovalTask> pendingTasks = approvalTaskService.list(
+ Wrappers.<ApprovalTask>lambdaQuery()
+ .eq(ApprovalTask::getInstanceId, currentInstance.getId())
+ .eq(ApprovalTask::getNodeId, currentNode.getId())
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ );
+
+ LocalDateTime now = LocalDateTime.now();
+ for (ApprovalTask currentTask : pendingTasks) {
+ if (!updateCurrentTask(autoApproveDto, "APPROVED", currentTask, now)) {
+ return R.fail("褰撳墠浠诲姟宸茶澶勭悊锛岃鍒锋柊鍚庨噸璇�");
+ }
+ saveApprovalRecord(
+ currentInstance.getId(),
+ currentNode.getId(),
+ currentTask.getId(),
+ 0L,
+ "绯荤粺鑷姩瀹℃壒",
+ "APPROVED",
+ autoApproveDto.getApproveComment()
+ );
+ }
+
+ if (!approveProcessConfigNodeUtils.canProceedToNextLevel(currentInstance.getId(), currentNode.getApproveType())) {
+ return R.ok("瀹℃壒鎴愬姛锛岀瓑寰呭叾浠栧鎵逛汉澶勭悊");
+ }
+
+ R moveResult = moveToNextLevel(currentInstance, currentNode, autoApproveDto, now, false);
+ if (!R.isSuccess(moveResult)) {
+ return moveResult;
+ }
+ }
+
+ return R.fail("鑷姩瀹℃壒寰幆娆℃暟瓒呴檺");
+ }
+
+ private String normalizeApproveAction(String approveAction) {
+ if (!StringUtils.hasText(approveAction)) {
+ return null;
+ }
+ String normalizedAction = approveAction.trim().toUpperCase(Locale.ROOT);
+ return "APPROVED".equals(normalizedAction) || "REJECTED".equals(normalizedAction)
+ ? normalizedAction
+ : null;
+ }
+
+ private ApprovalInstance getPendingApprovalInstance(Long instanceId) {
+ return this.getOne(
+ new LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getId, instanceId)
+ .eq(ApprovalInstance::getDeleted, 0)
+ .last("LIMIT 1")
+ );
+ }
+
+ private boolean updateCurrentTask(ApprovalInstanceDto approvalInstanceDto,
+ String approveAction,
+ ApprovalTask currentTask,
+ LocalDateTime now) {
+ // 浠呭厑璁稿緟瀹℃壒浠诲姟琚垚鍔熷鐞嗕竴娆★紝閬垮厤骞跺彂涓嬮噸澶嶅鎵规垚鍔熴��
+ return approvalTaskService.update(
+ Wrappers.<ApprovalTask>lambdaUpdate()
+ .eq(ApprovalTask::getId, currentTask.getId())
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ .set(ApprovalTask::getTaskStatus, approveAction)
+ .set(ApprovalTask::getComment, approvalInstanceDto.getApproveComment())
+ .set(ApprovalTask::getApproveTime, now)
+ .set(ApprovalTask::getIsRead, (byte) 1)
+ );
+ }
+
+ private R rejectCurrentNode(ApprovalInstance instance, ApprovalInstanceNode currentNode, LocalDateTime now) {
+ if (!updateCurrentNodeStatus(currentNode.getId(), "REJECTED", now)) {
+ return R.ok("褰撳墠鑺傜偣宸插鐞嗗畬鎴�");
+ }
+
+ closePendingTasks(instance.getId(), currentNode.getId());
+ instance.setStatus("REJECTED");
+ instance.setFinishTime(now);
+ this.updateById(instance);
+ // 缁熶竴澶勭悊涓氬姟鐘舵�佹洿鏂�
+ handleBusinessAfterApprovalFinished(instance);
+ return R.ok("瀹℃壒宸查┏鍥�");
+ }
+
+ private R approveAndMoveNext(ApprovalInstance instance,
+ ApprovalInstanceNode currentNode,
+ ApprovalInstanceDto approvalInstanceDto,
+ LocalDateTime now) {
+ return moveToNextLevel(instance, currentNode, approvalInstanceDto, now, true);
+ }
+
+ private R moveToNextLevel(ApprovalInstance instance,
+ ApprovalInstanceNode currentNode,
+ ApprovalInstanceDto approvalInstanceDto,
+ LocalDateTime now,
+ boolean notifyNextNode) {
+ if (!updateCurrentNodeStatus(currentNode.getId(), "APPROVED", now)) {
+ return R.ok("褰撳墠鑺傜偣宸插鐞嗗畬鎴�");
+ }
+
+ closePendingTasks(instance.getId(), currentNode.getId());
+
+ int nextLevel = currentNode.getLevelNo() + 1;
+ ApprovalInstanceNode nextInstanceNode = approvalInstanceNodeService.getOne(
+ new LambdaQueryWrapper<ApprovalInstanceNode>()
+ .eq(ApprovalInstanceNode::getInstanceId, instance.getId())
+ .eq(ApprovalInstanceNode::getLevelNo, nextLevel)
+ .eq(ApprovalInstanceNode::getDeleted, 0)
+ .orderByAsc(ApprovalInstanceNode::getId)
+ .last("LIMIT 1")
+ );
+
+ if (nextInstanceNode != null) {
+ if (!activateNextInstanceNode(nextInstanceNode.getId(), now)) {
+ return R.ok("涓嬩竴瀹℃壒鑺傜偣宸茶婵�娲伙紝璇峰埛鏂板悗閲嶈瘯");
+ }
+ instance.setCurrentLevel(nextLevel);
+ instance.setStatus("PENDING");
+ this.updateById(instance);
+ if (notifyNextNode) {
+ List<ApprovalTask> nextTasks = approvalTaskService.list(
+ Wrappers.<ApprovalTask>lambdaQuery()
+ .eq(ApprovalTask::getInstanceId, instance.getId())
+ .eq(ApprovalTask::getNodeId, nextInstanceNode.getId())
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ );
+ sendApproveNotice(instance, nextTasks);
+ }
+ return R.ok("瀹℃壒鎴愬姛锛屽凡娴佽浆鍒颁笅涓�鑺傜偣");
+ }
+
+ ApprovalTemplateNode nextTemplateNode = approvalTemplateNodeService.getOne(
+ new LambdaQueryWrapper<ApprovalTemplateNode>()
+ .eq(ApprovalTemplateNode::getTemplateId, instance.getTemplateId())
+ .eq(ApprovalTemplateNode::getLevelNo, nextLevel)
+ .orderByAsc(ApprovalTemplateNode::getId)
+ .last("LIMIT 1")
+ );
+
+ if (nextTemplateNode == null) {
+ instance.setStatus("APPROVED");
+ instance.setFinishTime(now);
+ this.updateById(instance);
+ handleBusinessAfterApprovalFinished(instance);
+ return R.ok("瀹℃壒宸插畬鎴�");
+ }
+
+ instance.setCurrentLevel(nextLevel);
+ instance.setStatus("PENDING");
+ this.updateById(instance);
+ approveProcessConfigNodeUtils.createCurrentNodeAndTasks(instance, false);
+ if (notifyNextNode) {
+ sendApproveNotice(instance, approveProcessConfigNodeUtils.getCurrentPendingTasks(approvalInstanceDto.getId()));
+ }
+ return R.ok("瀹℃壒鎴愬姛锛屽凡娴佽浆鍒颁笅涓�鑺傜偣");
+ }
+
+ private boolean activateNextInstanceNode(Long nodeId, LocalDateTime now) {
+ return approvalInstanceNodeService.update(
+ Wrappers.<ApprovalInstanceNode>lambdaUpdate()
+ .eq(ApprovalInstanceNode::getId, nodeId)
+ .eq(ApprovalInstanceNode::getStatus, "WAITING")
+ .eq(ApprovalInstanceNode::getDeleted, 0)
+ .set(ApprovalInstanceNode::getStatus, "PENDING")
+ .set(ApprovalInstanceNode::getStartTime, now)
+ );
+ }
+
+ private boolean updateCurrentNodeStatus(Long nodeId, String targetStatus, LocalDateTime now) {
+ // 浠呭厑璁镐竴涓姹傚皢褰撳墠鑺傜偣浠庡緟澶勭悊鎺ㄨ繘鍒扮洰鏍囩姸鎬侊紝閬垮厤閲嶅娴佽浆銆�
+ return approvalInstanceNodeService.update(
+ Wrappers.<ApprovalInstanceNode>lambdaUpdate()
+ .eq(ApprovalInstanceNode::getId, nodeId)
+ .eq(ApprovalInstanceNode::getStatus, "PENDING")
+ .eq(ApprovalInstanceNode::getDeleted, 0)
+ .set(ApprovalInstanceNode::getStatus, targetStatus)
+ .set(ApprovalInstanceNode::getFinishTime, now)
+ );
+ }
+
+ private void handleBusinessAfterApprovalFinished(ApprovalInstance instance) {
+ String status = instance.getStatus();
+ Long businessType = instance.getBusinessType();
+ if (TypeEnums.PURCHASE_APPROVAL.getCode().equals(businessType)) {
+ handlePurchaseApprovalFinished(instance, status);
+ return;
+ }
+ if (TypeEnums.QUOTATION_APPROVAL.getCode().equals(businessType)) {
+ handleSalesQuotationApprovalFinished(instance, status);
+ return;
+ }
+ if (TypeEnums.SHIPPING_APPROVAL.getCode().equals(businessType)) {
+ handleShippingApprovalFinished(instance, status);
+ return;
+ }
+ if (TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode().equals(businessType)
+ || TypeEnums.EXPENSE_APPROVAL.getCode().equals(businessType)) {
+ handleReimbursementApprovalFinished(instance, status);
+ return;
+ }
+ // 椹冲洖瀵瑰簲鐨勪紒涓氭柊闂汇�佸姞鐝敵璇枫�佽鍋囩敵璇峰彲浠ラ噸鏂板啀鎻愪氦
+ if (TypeEnums.LEAVE_APPROVAL.getCode().equals(businessType)
+ || TypeEnums.OVERTIME_APPROVAL.getCode().equals(businessType)) {
+ handleHolidayApplicationApprovalFinished(instance, status);
+ return;
+ }
+ if (TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode().equals(businessType)) {
+ handleNewsApprovalFinished(instance, status);
+ }
+ }
+
+ private void handleReimbursementApprovalFinished(ApprovalInstance instance, String status) {
+ if (instance == null || instance.getBusinessId() == null) {
+ return;
+ }
+
+ FinReimbursement reimbursement = new FinReimbursement();
+ reimbursement.setId(instance.getBusinessId());
+ if ("APPROVED".equals(status)) {
+ reimbursement.setBillStatus("APPROVED");
+ reimbursement.setApprovedTime(instance.getFinishTime());
+ } else if ("REJECTED".equals(status)) {
+ reimbursement.setBillStatus("REJECTED");
+ } else if ("PENDING".equals(status)) {
+ reimbursement.setBillStatus("IN_APPROVAL");
+ } else {
+ return;
+ }
+ finReimbursementMapper.updateById(reimbursement);
+ }
+
+ private void handleNewsApprovalFinished(ApprovalInstance instance, String status) {
+ if (instance == null || instance.getBusinessId() == null) {
+ return;
+ }
+ EnterpriseNews enterpriseNews = new EnterpriseNews();
+ enterpriseNews.setId(instance.getBusinessId());
+ if ("APPROVED".equals(status)) {
+ enterpriseNews.setStatus(ENTERPRISE_NEWS_STATUS_PUBLISHED);
+ enterpriseNewsMapper.updateById(enterpriseNews);
+ sendEnterpriseNewsNotice(instance.getBusinessId());
+ return;
+ }
+ if ("REJECTED".equals(status)) {
+ enterpriseNews.setStatus(ENTERPRISE_NEWS_STATUS_REJECTED);
+ enterpriseNewsMapper.updateById(enterpriseNews);
+ }
+ }
+
+ private void handleHolidayApplicationApprovalFinished(ApprovalInstance instance, String status) {
+ if (instance == null || instance.getBusinessId() == null) {
+ return;
+ }
+ HolidayApplication holidayApplication = new HolidayApplication();
+ holidayApplication.setId(instance.getBusinessId());
+ if ("APPROVED".equals(status)) {
+ holidayApplication.setStatus("APPROVED");
+ } else if ("REJECTED".equals(status)) {
+ holidayApplication.setStatus("REJECTED");
+ } else if ("PENDING".equals(status)) {
+ holidayApplication.setStatus("PENDING");
+ } else {
+ return;
+ }
+ holidayApplicationMapper.updateById(holidayApplication);
+ }
+
+ private void handlePurchaseApprovalFinished(ApprovalInstance instance, String status) {
+ PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(
+ new LambdaQueryWrapper<PurchaseLedger>()
+ .eq(PurchaseLedger::getId, instance.getBusinessId())
+ .last("limit 1")
+ );
+ if (purchaseLedger == null) {
+ return;
+ }
+
+ if ("APPROVED".equals(status)) {
+ purchaseLedger.setApprovalStatus(ApprovalStatusEnum.APPROVED.getCode());
+ List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(
+ new QueryWrapper<SalesLedgerProduct>().lambda()
+ .eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId())
+ .eq(SalesLedgerProduct::getType, 2)
+ );
+ for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) {
+ if (salesLedgerProduct.getIsChecked()) {
+ qualityInspectHelper.addQualityInspect(purchaseLedger, salesLedgerProduct);
+ } else {
+ stockUtils.addStockWithBatchNo(
+ salesLedgerProduct.getProductModelId(),
+ salesLedgerProduct.getQuantity(),
+ StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
+ purchaseLedger.getId(),
+ purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId()
+ );
+ }
+ }
+ } else if ("REJECTED".equals(status)) {
+ purchaseLedger.setApprovalStatus(ApprovalStatusEnum.REJECTED.getCode());
+ } else if ("PENDING".equals(status)) {
+ purchaseLedger.setApprovalStatus(ApprovalStatusEnum.IN_PROGRESS.getCode());
+ }
+ purchaseLedgerMapper.updateById(purchaseLedger);
+ }
+
+ private void handleSalesQuotationApprovalFinished(ApprovalInstance instance, String status) {
+ SalesQuotation salesQuote = salesQuotationMapper.selectOne(
+ new LambdaQueryWrapper<SalesQuotation>()
+ .eq(SalesQuotation::getId, instance.getBusinessId())
+ .last("limit 1")
+ );
+ if (salesQuote == null) {
+ return;
+ }
+
+ if ("APPROVED".equals(status)) {
+ salesQuote.setStatus(SalesQuotationStatusEnum.APPROVED.getCode());
+ } else if ("REJECTED".equals(status)) {
+ salesQuote.setStatus(SalesQuotationStatusEnum.REJECTED.getCode());
+ } else if ("PENDING".equals(status)) {
+ salesQuote.setStatus(SalesQuotationStatusEnum.IN_PROGRESS.getCode());
+ }
+ salesQuotationMapper.updateById(salesQuote);
+ }
+
+ private void handleShippingApprovalFinished(ApprovalInstance instance, String status) {
+ ShippingInfo shippingInfo = shippingInfoMapper.selectOne(
+ new LambdaQueryWrapper<ShippingInfo>()
+ .eq(ShippingInfo::getShippingNo, instance.getTitle())
+ .orderByDesc(ShippingInfo::getCreateTime)
+ .last("limit 1")
+ );
+ if (shippingInfo == null) {
+ return;
+ }
+
+ if ("APPROVED".equals(status)) {
+ shippingInfo.setStatus(ShippingStatusEnum.APPROVED.getCode());
+ shippingInfo.setShippingDate(new Date());
+ stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId());
+ } else if ("REJECTED".equals(status)) {
+ stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode());
+ shippingInfo.setStatus(ShippingStatusEnum.REJECTED.getCode());
+ } else if ("PENDING".equals(status)) {
+ shippingInfo.setStatus(ShippingStatusEnum.IN_PROGRESS.getCode());
+ }
+ shippingInfoMapper.updateById(shippingInfo);
+ }
+
+ private List<ApprovalTask> createNodeAndTasks(ApprovalInstance instance, ApprovalTemplateNode templateNode) {
+ List<ApprovalTemplateNodeApprover> approvers = approvalTemplateNodeApproverMapper.selectList(
+ new LambdaQueryWrapper<ApprovalTemplateNodeApprover>()
+ .eq(ApprovalTemplateNodeApprover::getTemplateId, instance.getTemplateId())
+ .eq(ApprovalTemplateNodeApprover::getNodeId, templateNode.getId())
+ .eq(ApprovalTemplateNodeApprover::getDeleted, 0L)
+ .orderByAsc(ApprovalTemplateNodeApprover::getSortNo)
+ );
+ if (approvers == null || approvers.isEmpty()) {
+ throw new RuntimeException("涓嬩竴瀹℃壒鑺傜偣鏈厤缃鎵逛汉");
+ }
+
+ ApprovalInstanceNode instanceNode = new ApprovalInstanceNode();
+ instanceNode.setInstanceId(instance.getId());
+ instanceNode.setLevelNo(templateNode.getLevelNo());
+ instanceNode.setApproveType(templateNode.getApproveType());
+ instanceNode.setStatus("PENDING");
+ instanceNode.setStartTime(LocalDateTime.now());
+ instanceNode.setDeleted((byte) 0);
+ approvalInstanceNodeService.save(instanceNode);
+
+ List<ApprovalTask> taskList = new ArrayList<>(approvers.size());
+ for (ApprovalTemplateNodeApprover approver : approvers) {
+ ApprovalTask task = new ApprovalTask();
+ task.setInstanceId(instance.getId());
+ task.setNodeId(instanceNode.getId());
+ task.setLevelNo(instanceNode.getLevelNo());
+ task.setApproverId(approver.getApproverId());
+ task.setApproverName(approver.getApproverName());
+ task.setTaskStatus("PENDING");
+ task.setIsRead((byte) 0);
+ task.setDeleted((byte) 0);
+ taskList.add(task);
+ }
+ approvalTaskService.saveBatch(taskList);
+ return taskList;
+ }
+
+ private void sendApproveNotice(ApprovalInstance instance, List<ApprovalTask> tasks) {
+ if (instance == null || tasks == null || tasks.isEmpty()) {
+ return;
+ }
+
+ List<Long> approverIds = tasks.stream()
+ .map(ApprovalTask::getApproverId)
+ .filter(id -> id != null && id > 0)
+ .distinct()
+ .collect(Collectors.toList());
+ if (approverIds.isEmpty()) {
+ return;
+ }
+
+ String title = StringUtils.hasText(instance.getTemplateName()) ? instance.getTemplateName() : "瀹℃壒鎻愰啋";
+ String message = "瀹℃壒鍗曞彿 " + instance.getInstanceNo() + " 闇�瑕佹偍瀹℃壒";
+ String jumpPath = getJumpPathByBusinessType(instance.getBusinessType(), instance.getId());
+ sysNoticeService.simpleNoticeByUser(title, message, approverIds, jumpPath);
+ }
+
+ private String getJumpPathByBusinessType(Long businessType, Long instanceId) {
+ if (businessType == null) {
+ return "/collaborativeApproval/approve-list?id=" + instanceId;
+ }
+ if (TypeEnums.LEAVE_APPROVAL.getCode().equals(businessType)) {
+ return "/collaborativeApproval/AttendManage/leave-apply?id=" + instanceId;
+ }
+ if (TypeEnums.OVERTIME_APPROVAL.getCode().equals(businessType)) {
+ return "/collaborativeApproval/AttendManage/overtime-apply?id=" + instanceId;
+ }
+ if (TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode().equals(businessType)) {
+ return "/collaborativeApproval/ReimburseManage/travel-reimburse?id=" + instanceId;
+ }
+ if (TypeEnums.EXPENSE_APPROVAL.getCode().equals(businessType)) {
+ return "/collaborativeApproval/ReimburseManage/cost-reimburse?id=" + instanceId;
+ }
+ return "/collaborativeApproval/approve-list?id=" + instanceId;
+ }
+
+ private void sendEnterpriseNewsNotice(Long newsId) {
+ EnterpriseNews enterpriseNews = enterpriseNewsMapper.selectById(newsId);
+ if (enterpriseNews == null) {
+ return;
+ }
+ List<Long> userIds = getEnterpriseNewsNoticeUserIds(enterpriseNews);
+ if (userIds == null || userIds.isEmpty()) {
+ return;
+ }
+ String title = "浼佷笟鏂伴椈";
+ String message = "鎮ㄦ湁鏂扮殑浼佷笟鏂伴椈銆�" + enterpriseNews.getTitle() + "銆嬭鍙婃椂鏌ラ槄";
+ String jumpPath = "/officeProcessAutomation/EnterpriseNews?id=" + newsId;
+ sysNoticeService.simpleNoticeByUser(title, message, userIds, jumpPath);
+ }
+
+ private List<Long> getEnterpriseNewsNoticeUserIds(EnterpriseNews enterpriseNews) {
+ if (enterpriseNews == null || !org.springframework.util.StringUtils.hasText(enterpriseNews.getReadScope())) {
+ return Collections.emptyList();
+ }
+ String readScope = enterpriseNews.getReadScope().trim();
+ if ("all".equals(readScope)) {
+ return sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
+ .select(SysUser::getUserId)
+ .eq(SysUser::getDelFlag, "0"))
+ .stream()
+ .map(SysUser::getUserId)
+ .filter(id -> id != null && id > 0)
+ .distinct()
+ .collect(Collectors.toList());
+ }
+ if ("dept".equals(readScope)) {
+ List<Long> deptIds = enterpriseNewsScopeDeptMapper.selectList(
+ new LambdaQueryWrapper<EnterpriseNewsScopeDept>()
+ .eq(EnterpriseNewsScopeDept::getNewsId, enterpriseNews.getId()))
+ .stream()
+ .map(EnterpriseNewsScopeDept::getDeptId)
+ .filter(id -> id != null && id > 0)
+ .distinct()
+ .collect(Collectors.toList());
+ if (deptIds.isEmpty()) {
+ return Collections.emptyList();
+ }
+ return sysUserDeptMapper.selectDistinctUserIdsByDeptIds(collectDeptIdsWithChildren(deptIds));
+ }
+ if ("custom".equals(readScope)) {
+ return enterpriseNewsScopeUserMapper.selectList(
+ new LambdaQueryWrapper<EnterpriseNewsScopeUser>()
+ .eq(EnterpriseNewsScopeUser::getNewsId, enterpriseNews.getId()))
+ .stream()
+ .map(EnterpriseNewsScopeUser::getUserId)
+ .filter(id -> id != null && id > 0)
+ .distinct()
+ .collect(Collectors.toList());
+ }
+ return Collections.emptyList();
+ }
+
+ private List<Long> collectDeptIdsWithChildren(List<Long> deptIds) {
+ Set<Long> allDeptIds = new LinkedHashSet<>();
+ for (Long deptId : deptIds) {
+ if (deptId == null) {
+ continue;
+ }
+ allDeptIds.add(deptId);
+ List<SysDept> children = sysDeptMapper.selectChildrenDeptById(deptId);
+ if (children != null && !children.isEmpty()) {
+ for (SysDept child : children) {
+ if (child != null && child.getDeptId() != null) {
+ allDeptIds.add(child.getDeptId());
+ }
+ }
+ }
+ }
+ return new ArrayList<>(allDeptIds);
+ }
+
+ private void closePendingTasks(Long instanceId, Long nodeId) {
+ LambdaUpdateWrapper<ApprovalTask> updateWrapper = Wrappers.lambdaUpdate();
+ updateWrapper.eq(ApprovalTask::getInstanceId, instanceId)
+ .eq(ApprovalTask::getNodeId, nodeId)
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ .set(ApprovalTask::getDeleted, (byte) 1);
+ approvalTaskService.update(updateWrapper);
+ }
+
+ private void saveApprovalRecord(Long instanceId,
+ Long nodeId,
+ Long taskId,
+ Long operatorId,
+ String operatorName,
+ String action,
+ String comment) {
+ ApprovalRecord record = new ApprovalRecord();
+ record.setInstanceId(instanceId);
+ record.setNodeId(nodeId);
+ record.setTaskId(taskId);
+ record.setOperatorId(operatorId);
+ record.setOperatorName(operatorName);
+ record.setAction(action);
+ record.setComment(comment);
+ record.setDeleted((byte) 0);
+ approvalRecordService.save(record);
+ }
+
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalRecordServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalRecordServiceImpl.java
new file mode 100644
index 0000000..50911e4
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalRecordServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.approve.service.impl;
+
+import com.ruoyi.approve.pojo.ApprovalRecord;
+import com.ruoyi.approve.mapper.ApprovalRecordMapper;
+import com.ruoyi.approve.service.ApprovalRecordService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 瀹℃壒璁板綍琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:28:21
+ */
+@Service
+public class ApprovalRecordServiceImpl extends ServiceImpl<ApprovalRecordMapper, ApprovalRecord> implements ApprovalRecordService {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalTaskServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTaskServiceImpl.java
new file mode 100644
index 0000000..14e10ca
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTaskServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.approve.service.impl;
+
+import com.ruoyi.approve.pojo.ApprovalTask;
+import com.ruoyi.approve.mapper.ApprovalTaskMapper;
+import com.ruoyi.approve.service.ApprovalTaskService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 瀹℃壒浠诲姟琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 03:32:37
+ */
+@Service
+public class ApprovalTaskServiceImpl extends ServiceImpl<ApprovalTaskMapper, ApprovalTask> implements ApprovalTaskService {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeApproverServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeApproverServiceImpl.java
new file mode 100644
index 0000000..0921c35
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeApproverServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.approve.service.impl;
+
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import com.ruoyi.approve.mapper.ApprovalTemplateNodeApproverMapper;
+import com.ruoyi.approve.service.ApprovalTemplateNodeApproverService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣瀹℃壒浜鸿〃 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:30
+ */
+@Service
+public class ApprovalTemplateNodeApproverServiceImpl extends ServiceImpl<ApprovalTemplateNodeApproverMapper, ApprovalTemplateNodeApprover> implements ApprovalTemplateNodeApproverService {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeServiceImpl.java
new file mode 100644
index 0000000..ca65a5f
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateNodeServiceImpl.java
@@ -0,0 +1,62 @@
+package com.ruoyi.approve.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeApproverDto;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeDto;
+import com.ruoyi.approve.mapper.ApprovalTemplateNodeMapper;
+import com.ruoyi.approve.pojo.ApprovalTemplateNode;
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import com.ruoyi.approve.service.ApprovalTemplateNodeApproverService;
+import com.ruoyi.approve.service.ApprovalTemplateNodeService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鑺傜偣琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-18 11:20:19
+ */
+@Service
+@RequiredArgsConstructor
+public class ApprovalTemplateNodeServiceImpl extends ServiceImpl<ApprovalTemplateNodeMapper, ApprovalTemplateNode> implements ApprovalTemplateNodeService {
+
+ private final ApprovalTemplateNodeMapper approvalTemplateNodeMapper;
+ private final ApprovalTemplateNodeApproverService approvalTemplateNodeApproverService;
+ @Override
+ public Boolean saveApprovalTemplateNode(Long templateId, List<ApprovalTemplateNodeDto> nodes) {
+ if (nodes == null || nodes.isEmpty()) {
+ throw new RuntimeException("鑺傜偣鍒楄〃涓嶈兘涓虹┖");
+ }
+
+ List<ApprovalTemplateNodeApprover> approverList = new ArrayList<>();
+
+ for (ApprovalTemplateNodeDto nodeDto : nodes) {
+ ApprovalTemplateNode node = new ApprovalTemplateNode();
+ BeanUtils.copyProperties(nodeDto, node);
+ node.setTemplateId(templateId);
+ approvalTemplateNodeMapper.insert(node);
+
+ List<ApprovalTemplateNodeApproverDto> approvers = nodeDto.getApprovers();
+ if (approvers == null || approvers.isEmpty()) {
+ throw new RuntimeException("鑺傜偣瀹℃壒浜轰笉鑳戒负绌�");
+ }
+ for (ApprovalTemplateNodeApproverDto approverDto : approvers) {
+ ApprovalTemplateNodeApprover approver = new ApprovalTemplateNodeApprover();
+ BeanUtils.copyProperties(approverDto, approver);
+ approver.setNodeId(node.getId());
+ approver.setTemplateId(templateId);
+ approver.setDeleted(0L);
+ approverList.add(approver);
+ }
+ }
+ approvalTemplateNodeApproverService.saveBatch(approverList);
+ return true;
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateServiceImpl.java
new file mode 100644
index 0000000..9a5f0b8
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalTemplateServiceImpl.java
@@ -0,0 +1,308 @@
+package com.ruoyi.approve.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateDto;
+import com.ruoyi.approve.bean.vo.ApprovalTemplateNodeApproverVo;
+import com.ruoyi.approve.bean.vo.ApprovalTemplateNodeVo;
+import com.ruoyi.approve.bean.vo.ApprovalTemplateVo;
+import com.ruoyi.approve.mapper.ApprovalTemplateMapper;
+import com.ruoyi.approve.mapper.ApprovalTemplateNodeApproverMapper;
+import com.ruoyi.approve.mapper.ApprovalInstanceMapper;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import com.ruoyi.approve.pojo.ApprovalTemplateNode;
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import com.ruoyi.approve.service.ApprovalTemplateNodeService;
+import com.ruoyi.approve.service.ApprovalTemplateService;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 瀹℃壒妯℃澘鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @since 2026-05-18 11:20:08
+ */
+@Service
+@RequiredArgsConstructor
+public class ApprovalTemplateServiceImpl extends ServiceImpl<ApprovalTemplateMapper, ApprovalTemplate> implements ApprovalTemplateService {
+
+ private final ApprovalTemplateMapper approvalTemplateMapper;
+ private final ApprovalTemplateNodeService approvalTemplateNodeService;
+ private final ApprovalTemplateNodeApproverMapper approvalTemplateNodeApproverMapper;
+ private final ApprovalInstanceMapper approvalInstanceMapper;
+ private final FileUtil fileUtil;
+
+ @Override
+ public IPage<ApprovalTemplateVo> listPage(Page<ApprovalTemplateVo> page, ApprovalTemplateDto approvalTemplateDto) {
+ IPage<ApprovalTemplateVo> approvalTemplateVoIPage = approvalTemplateMapper.listPage(page, approvalTemplateDto);
+ fillTemplateVoNodes(approvalTemplateVoIPage.getRecords());
+ return approvalTemplateVoIPage;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean saveApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto) {
+ approvalTemplateMapper.insert(approvalTemplateDto);
+ approvalTemplateNodeService.remove(
+ new LambdaQueryWrapper<ApprovalTemplateNode>()
+ .eq(ApprovalTemplateNode::getTemplateId, approvalTemplateDto.getId())
+ );
+ approvalTemplateNodeApproverMapper.delete(
+ new LambdaQueryWrapper<ApprovalTemplateNodeApprover>()
+ .eq(ApprovalTemplateNodeApprover::getTemplateId, approvalTemplateDto.getId())
+ );
+ // 淇濆瓨闄勪欢
+ List<StorageBlobDTO> storageBlobDTOs = approvalTemplateDto.getStorageBlobDTOs();
+ if (!CollectionUtils.isEmpty(storageBlobDTOs)) {
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_TEMPLATE, approvalTemplateDto.getId(), storageBlobDTOs);
+ }
+ return approvalTemplateNodeService.saveApprovalTemplateNode(
+ approvalTemplateDto.getId(),
+ approvalTemplateDto.getNodes()
+ );
+ }
+
+ @Override
+ public Boolean updateApprovalTemplateDto(ApprovalTemplateDto approvalTemplateDto) {
+ // 妫�鏌ユā鏉挎槸鍚﹁瀹℃壒瀹炰緥寮曠敤
+ if (isTemplateReferenced(approvalTemplateDto.getId())) {
+ throw new RuntimeException("璇ュ鎵规ā鏉垮凡琚鎵规祦绋嬪紩鐢紝鏃犳硶缂栬緫");
+ }
+ approvalTemplateMapper.updateById(approvalTemplateDto);
+ approvalTemplateNodeService.remove(
+ new LambdaQueryWrapper<ApprovalTemplateNode>()
+ .eq(ApprovalTemplateNode::getTemplateId, approvalTemplateDto.getId())
+ );
+ approvalTemplateNodeApproverMapper.delete(
+ new LambdaQueryWrapper<ApprovalTemplateNodeApprover>()
+ .eq(ApprovalTemplateNodeApprover::getTemplateId, approvalTemplateDto.getId())
+ );
+ // 淇濆瓨闄勪欢锛堜細鍏堝垹闄ゆ棫闄勪欢锛�
+ List<StorageBlobDTO> storageBlobDTOs = approvalTemplateDto.getStorageBlobDTOs();
+ if (!CollectionUtils.isEmpty(storageBlobDTOs)) {
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_TEMPLATE, approvalTemplateDto.getId(), storageBlobDTOs);
+ } else {
+ // 濡傛灉鍓嶇浼犵┖鏁扮粍锛屽垹闄ゆ棫闄勪欢
+ fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(
+ ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_TEMPLATE, approvalTemplateDto.getId()
+ );
+ }
+ return approvalTemplateNodeService.saveApprovalTemplateNode(
+ approvalTemplateDto.getId(),
+ approvalTemplateDto.getNodes()
+ );
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean delete(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ return false;
+ }
+ // 妫�鏌ユā鏉挎槸鍚﹁瀹℃壒瀹炰緥寮曠敤
+ for (Long id : ids) {
+ if (isTemplateReferenced(id)) {
+ throw new RuntimeException("瀹℃壒妯℃澘锛圛D: " + id + "锛夊凡琚鎵规祦绋嬪紩鐢紝鏃犳硶鍒犻櫎");
+ }
+ }
+ ApprovalTemplate updateEntity = new ApprovalTemplate();
+ updateEntity.setDeleted(1);
+ LambdaUpdateWrapper<ApprovalTemplate> updateWrapper = Wrappers.lambdaUpdate();
+ updateWrapper.in(ApprovalTemplate::getId, ids)
+ .eq(ApprovalTemplate::getDeleted, 0);
+
+ int rows = approvalTemplateMapper.update(updateEntity, updateWrapper);
+ return rows == ids.size();
+ }
+
+ @Override
+ public List<ApprovalTemplateVo> listApprovalTemplateVo(Integer type) {
+ List<ApprovalTemplate> templateList = this.list(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getDeleted, 0)
+ .eq(ApprovalTemplate::getEnabled, 1)
+ .notIn(ApprovalTemplate::getBusinessType, List.of(5L, 6L, 7L))
+ .orderByDesc(ApprovalTemplate::getTemplateType)
+ .orderByDesc(ApprovalTemplate::getId)
+ );
+ if (CollUtil.isEmpty(templateList)) {
+ return Collections.emptyList();
+ }
+
+ List<ApprovalTemplateVo> templateVos = templateList.stream()
+ .map(template -> {
+ ApprovalTemplateVo templateVo = new ApprovalTemplateVo();
+ BeanUtils.copyProperties(template, templateVo);
+ return templateVo;
+ })
+ .collect(Collectors.toList());
+ fillTemplateVoNodes(templateVos);
+ return templateVos;
+ }
+
+ @Override
+ public ApprovalTemplateVo getApprovalTemplateVoById(Long id) {
+ if (id == null) {
+ throw new IllegalArgumentException("鍙傛暟 id 涓嶈兘涓虹┖");
+ }
+
+ ApprovalTemplate template = this.getOne(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getId, id)
+ .eq(ApprovalTemplate::getDeleted, 0)
+ );
+ if (template == null) {
+ throw new IllegalArgumentException("妯℃澘涓嶅瓨鍦�");
+ }
+
+ List<ApprovalTemplateNode> nodeList = approvalTemplateNodeService.list(
+ new LambdaQueryWrapper<ApprovalTemplateNode>()
+ .eq(ApprovalTemplateNode::getTemplateId, id)
+ .orderByAsc(ApprovalTemplateNode::getLevelNo)
+ );
+
+ List<ApprovalTemplateNodeApprover> approverList = approvalTemplateNodeApproverMapper.selectList(
+ new LambdaQueryWrapper<ApprovalTemplateNodeApprover>()
+ .eq(ApprovalTemplateNodeApprover::getTemplateId, id)
+ .eq(ApprovalTemplateNodeApprover::getDeleted, 0L)
+ );
+
+ Map<Long, List<ApprovalTemplateNode>> nodeMap = nodeList.stream()
+ .collect(Collectors.groupingBy(ApprovalTemplateNode::getTemplateId));
+
+ Map<Long, List<ApprovalTemplateNodeApprover>> approverMap = approverList.stream()
+ .collect(Collectors.groupingBy(ApprovalTemplateNodeApprover::getNodeId));
+
+ return buildTemplateVo(template, nodeMap, approverMap);
+ }
+
+ /**
+ * 鎵归噺濉厖妯℃澘鑺傜偣鍙婅妭鐐瑰鎵逛汉锛岄伩鍏嶅惊鐜煡搴撱��
+ */
+ private void fillTemplateVoNodes(List<ApprovalTemplateVo> templateVos) {
+ if (CollUtil.isEmpty(templateVos)) {
+ return;
+ }
+
+ List<Long> templateIds = templateVos.stream()
+ .map(ApprovalTemplateVo::getId)
+ .collect(Collectors.toList());
+
+ List<ApprovalTemplateNode> nodeList = approvalTemplateNodeService.list(
+ new LambdaQueryWrapper<ApprovalTemplateNode>()
+ .in(ApprovalTemplateNode::getTemplateId, templateIds)
+ .orderByAsc(ApprovalTemplateNode::getLevelNo)
+ );
+
+ List<ApprovalTemplateNodeApprover> approverList = approvalTemplateNodeApproverMapper.selectList(
+ new LambdaQueryWrapper<ApprovalTemplateNodeApprover>()
+ .in(ApprovalTemplateNodeApprover::getTemplateId, templateIds)
+ .eq(ApprovalTemplateNodeApprover::getDeleted, 0L)
+ );
+
+ Map<Long, List<ApprovalTemplateNode>> nodeMap = nodeList.stream()
+ .collect(Collectors.groupingBy(ApprovalTemplateNode::getTemplateId));
+
+ Map<Long, List<ApprovalTemplateNodeApprover>> approverMap = approverList.stream()
+ .collect(Collectors.groupingBy(ApprovalTemplateNodeApprover::getNodeId));
+
+ templateVos.forEach(templateVo -> templateVo.setNodes(
+ nodeMap.getOrDefault(templateVo.getId(), Collections.emptyList())
+ .stream()
+ .sorted(Comparator.comparing(
+ ApprovalTemplateNode::getLevelNo,
+ Comparator.nullsLast(Integer::compareTo)
+ ))
+ .map(node -> buildNodeVo(node, approverMap))
+ .collect(Collectors.toList())
+ ));
+ }
+
+ private ApprovalTemplateVo buildTemplateVo(ApprovalTemplate template,
+ Map<Long, List<ApprovalTemplateNode>> nodeMap,
+ Map<Long, List<ApprovalTemplateNodeApprover>> approverMap) {
+ ApprovalTemplateVo templateVo = new ApprovalTemplateVo();
+ BeanUtils.copyProperties(template, templateVo);
+
+ List<ApprovalTemplateNodeVo> nodeVos = nodeMap
+ .getOrDefault(template.getId(), Collections.emptyList())
+ .stream()
+ .sorted(Comparator.comparing(
+ ApprovalTemplateNode::getLevelNo,
+ Comparator.nullsLast(Integer::compareTo)
+ ))
+ .map(node -> buildNodeVo(node, approverMap))
+ .collect(Collectors.toList());
+
+ templateVo.setNodes(nodeVos);
+ // 鏌ヨ闄勪欢
+ templateVo.setStorageBlobDTOs(
+ fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(
+ ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVAL_TEMPLATE, template.getId()
+ )
+ );
+ return templateVo;
+ }
+
+ private ApprovalTemplateNodeVo buildNodeVo(ApprovalTemplateNode node,
+ Map<Long, List<ApprovalTemplateNodeApprover>> approverMap) {
+ ApprovalTemplateNodeVo nodeVo = new ApprovalTemplateNodeVo();
+ BeanUtils.copyProperties(node, nodeVo);
+
+ List<ApprovalTemplateNodeApproverVo> approverVos = approverMap
+ .getOrDefault(node.getId(), Collections.emptyList())
+ .stream()
+ .sorted(Comparator.comparing(
+ ApprovalTemplateNodeApprover::getSortNo,
+ Comparator.nullsLast(Integer::compareTo)
+ ))
+ .map(this::buildApproverVo)
+ .collect(Collectors.toList());
+
+ nodeVo.setApprovers(approverVos);
+ return nodeVo;
+ }
+
+ private ApprovalTemplateNodeApproverVo buildApproverVo(ApprovalTemplateNodeApprover approver) {
+ ApprovalTemplateNodeApproverVo approverVo = new ApprovalTemplateNodeApproverVo();
+ BeanUtils.copyProperties(approver, approverVo);
+ return approverVo;
+ }
+
+ /**
+ * 妫�鏌ュ鎵规ā鏉挎槸鍚﹁瀹℃壒瀹炰緥寮曠敤
+ * @param templateId 妯℃澘ID
+ * @return true 琛ㄧず琚紩鐢紝false 琛ㄧず鏈寮曠敤
+ */
+ private boolean isTemplateReferenced(Long templateId) {
+ if (templateId == null) {
+ return false;
+ }
+ Long count = approvalInstanceMapper.selectCount(
+ new LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getTemplateId, templateId)
+ .eq(ApprovalInstance::getDeleted, 0)
+ );
+ return count != null && count > 0;
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveBusinessStatusService.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveBusinessStatusService.java
new file mode 100644
index 0000000..8135c3a
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveBusinessStatusService.java
@@ -0,0 +1,175 @@
+package com.ruoyi.approve.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
+import com.ruoyi.procurementrecord.utils.StockUtils;
+import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
+import com.ruoyi.purchase.pojo.PurchaseLedger;
+import com.ruoyi.quality.mapper.QualityInspectMapper;
+import com.ruoyi.quality.mapper.QualityInspectParamMapper;
+import com.ruoyi.quality.mapper.QualityTestStandardMapper;
+import com.ruoyi.quality.mapper.QualityTestStandardParamMapper;
+import com.ruoyi.quality.pojo.QualityInspect;
+import com.ruoyi.quality.pojo.QualityInspectParam;
+import com.ruoyi.quality.pojo.QualityTestStandard;
+import com.ruoyi.quality.pojo.QualityTestStandardParam;
+import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
+import com.ruoyi.sales.mapper.SalesQuotationMapper;
+import com.ruoyi.sales.mapper.ShippingInfoMapper;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.pojo.SalesQuotation;
+import com.ruoyi.sales.pojo.ShippingInfo;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.Date;
+import java.util.List;
+
+@Service
+@RequiredArgsConstructor
+public class ApproveBusinessStatusService {
+
+ private final PurchaseLedgerMapper purchaseLedgerMapper;
+ private final SalesQuotationMapper salesQuotationMapper;
+ private final ShippingInfoMapper shippingInfoMapper;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final StockUtils stockUtils;
+ private final QualityInspectMapper qualityInspectMapper;
+ private final QualityTestStandardMapper qualityTestStandardMapper;
+ private final QualityTestStandardParamMapper qualityTestStandardParamMapper;
+ private final QualityInspectParamMapper qualityInspectParamMapper;
+
+ /**
+ * 缁熶竴鍚屾瀹℃壒缁撴灉瀵瑰簲鐨勪笟鍔″崟鎹姸鎬併��
+ * status锛�1-瀹℃牳涓紝2-瀹℃牳瀹屾垚锛�3-瀹℃牳鏈�氳繃銆�
+ */
+ public void syncBusinessStatus(Integer approveType, String approveReason, Integer status) {
+ if (approveType == null || status == null || !StringUtils.hasText(approveReason)) {
+ return;
+ }
+ switch (approveType) {
+ case 5:
+ syncPurchaseStatus(approveReason, status);
+ break;
+ case 6:
+ syncSalesQuotationStatus(approveReason, status);
+ break;
+ case 7:
+ syncShippingStatus(approveReason, status);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // 閲囪喘瀹℃壒閫氳繃鏃讹紝鎸変骇鍝佽川妫�閰嶇疆鍐冲畾鐢熸垚璐ㄦ鍗曟垨鐩存帴鍏ュ簱銆�
+ private void syncPurchaseStatus(String approveReason, Integer status) {
+ PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>()
+ .eq(PurchaseLedger::getPurchaseContractNumber, approveReason)
+ .last("limit 1"));
+ if (purchaseLedger == null) {
+ return;
+ }
+ if (status.equals(2)) {
+ purchaseLedger.setApprovalStatus(3);
+ List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>()
+ .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2));
+ for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) {
+ if (Boolean.TRUE.equals(salesLedgerProduct.getIsChecked())) {
+ addQualityInspect(purchaseLedger, salesLedgerProduct);
+ } else {
+ stockUtils.addStockWithBatchNo(
+ salesLedgerProduct.getProductModelId(),
+ salesLedgerProduct.getQuantity(),
+ StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
+ purchaseLedger.getId(),
+ purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId());
+ }
+ }
+ } else if (status.equals(3)) {
+ purchaseLedger.setApprovalStatus(4);
+ } else if (status.equals(1)) {
+ purchaseLedger.setApprovalStatus(2);
+ } else {
+ return;
+ }
+ purchaseLedgerMapper.updateById(purchaseLedger);
+ }
+
+ // 鎶ヤ环瀹℃壒鐘舵�佸洖鍐欏埌閿�鍞姤浠峰崟鐘舵�併��
+ private void syncSalesQuotationStatus(String approveReason, Integer status) {
+ SalesQuotation salesQuote = salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>()
+ .eq(SalesQuotation::getQuotationNo, approveReason)
+ .last("limit 1"));
+ if (salesQuote == null) {
+ return;
+ }
+ if (status.equals(2)) {
+ salesQuote.setStatus("閫氳繃");
+ } else if (status.equals(3)) {
+ salesQuote.setStatus("鎷掔粷");
+ } else if (status.equals(1)) {
+ salesQuote.setStatus("瀹℃牳涓�");
+ } else {
+ return;
+ }
+ salesQuotationMapper.updateById(salesQuote);
+ }
+
+ // 鍙戣揣瀹℃壒閫氳繃鏃跺悓姝ュ彂璐х姸鎬佸拰鍑哄簱瀹℃壒鐘舵�侊紱鎷掔粷鏃跺垹闄ゅ緟纭鍑哄簱璁板綍銆�
+ private void syncShippingStatus(String approveReason, Integer status) {
+ ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
+ .eq(ShippingInfo::getShippingNo, approveReason)
+ .orderByDesc(ShippingInfo::getCreateTime)
+ .last("limit 1"));
+ if (shippingInfo == null) {
+ return;
+ }
+ if (status.equals(2)) {
+ shippingInfo.setStatus("瀹℃牳閫氳繃");
+ shippingInfo.setShippingDate(new Date());
+ stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId());
+ } else if (status.equals(3)) {
+ stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode());
+ shippingInfo.setStatus("瀹℃牳鎷掔粷");
+ } else if (status.equals(1)) {
+ shippingInfo.setStatus("瀹℃牳涓�");
+ } else {
+ return;
+ }
+ shippingInfoMapper.updateById(shippingInfo);
+ }
+
+ // 鐢熸垚閲囪喘璐ㄦ鍗曪紝骞舵寜浜у搧璐ㄦ鏍囧噯鍒濆鍖栬川妫�鍙傛暟銆�
+ private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) {
+ QualityInspect qualityInspect = new QualityInspect();
+ qualityInspect.setInspectType(0);
+ qualityInspect.setSupplier(purchaseLedger.getSupplierName());
+ qualityInspect.setPurchaseLedgerId(purchaseLedger.getId());
+ qualityInspect.setProductId(saleProduct.getProductId());
+ qualityInspect.setProductName(saleProduct.getProductCategory());
+ qualityInspect.setModel(saleProduct.getSpecificationModel());
+ qualityInspect.setProductModelId(saleProduct.getProductModelId());
+ qualityInspect.setUnit(saleProduct.getUnit());
+ qualityInspect.setQuantity(saleProduct.getQuantity());
+ qualityInspectMapper.insert(qualityInspect);
+ List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null);
+ if (qualityTestStandard.size() > 0) {
+ qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId());
+ qualityInspectMapper.updateById(qualityInspect);
+ qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery()
+ .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))
+ .forEach(qualityTestStandardParam -> {
+ QualityInspectParam param = new QualityInspectParam();
+ com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param);
+ param.setId(null);
+ param.setInspectId(qualityInspect.getId());
+ qualityInspectParamMapper.insert(param);
+ });
+ }
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
index 3caf7cf..964be23 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -1,7 +1,6 @@
package com.ruoyi.approve.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,31 +13,12 @@
import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.enums.FileNameType;
-import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.device.mapper.DeviceRepairMapper;
-import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.project.system.service.ISysNoticeService;
-import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
-import com.ruoyi.purchase.pojo.PurchaseLedger;
-import com.ruoyi.quality.mapper.QualityInspectMapper;
-import com.ruoyi.quality.mapper.QualityInspectParamMapper;
-import com.ruoyi.quality.mapper.QualityTestStandardMapper;
-import com.ruoyi.quality.mapper.QualityTestStandardParamMapper;
-import com.ruoyi.quality.pojo.QualityInspect;
-import com.ruoyi.quality.pojo.QualityInspectParam;
-import com.ruoyi.quality.pojo.QualityTestStandard;
-import com.ruoyi.quality.pojo.QualityTestStandardParam;
import com.ruoyi.sales.mapper.CommonFileMapper;
-import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.mapper.SalesQuotationMapper;
-import com.ruoyi.sales.mapper.ShippingInfoMapper;
import com.ruoyi.sales.pojo.CommonFile;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import com.ruoyi.sales.pojo.SalesQuotation;
-import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -60,17 +40,8 @@
private final SysUserMapper sysUserMapper;
private final ISysNoticeService sysNoticeService;
private final CommonFileMapper fileMapper;
- private final DeviceRepairMapper deviceRepairMapper;
- private final PurchaseLedgerMapper purchaseLedgerMapper;
- private final SalesQuotationMapper salesQuotationMapper;
- private final ShippingInfoMapper shippingInfoMapper;
private final CommonFileServiceImpl commonFileService;
- private final StockUtils stockUtils;
- private final SalesLedgerProductMapper salesLedgerProductMapper;
- private final QualityInspectMapper qualityInspectMapper;
- private final QualityTestStandardMapper qualityTestStandardMapper;
- private final QualityTestStandardParamMapper qualityTestStandardParamMapper;
- private final QualityInspectParamMapper qualityInspectParamMapper;
+ private final ApproveBusinessStatusService approveBusinessStatusService;
private final FileUtil fileUtil;
@@ -166,70 +137,7 @@
}
approveProcessMapper.updateById(approveProcess);
- //閲囪喘瀹℃牳
- if (approveProcess.getApproveType().equals(5)) {
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>()
- .eq(PurchaseLedger::getPurchaseContractNumber, approveProcess.getApproveReason())
- .last("limit 1"));
- if (purchaseLedger != null) {
- if (status.equals(2)) {
- // 鍚屾剰
- purchaseLedger.setApprovalStatus(3);
- List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>()
- .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2));
- for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) {
- // 璐ㄦ
- if (salesLedgerProduct.getIsChecked()) {
- addQualityInspect(purchaseLedger, salesLedgerProduct);
- } else {
- //鐩存帴鍏ュ簱
- stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId());
- }
- }
- } else if (status.equals(3)) {
- // 鎷掔粷
- purchaseLedger.setApprovalStatus(4);
- } else if (status.equals(1)) {
- // 瀹℃牳涓�
- purchaseLedger.setApprovalStatus(2);
- }
- purchaseLedgerMapper.updateById(purchaseLedger);
- }
- }
- // 閿�鍞姤浠风姸鎬佷慨鏀�
- if (approveProcess.getApproveType().equals(6)) {
- SalesQuotation salesQuote = salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>()
- .eq(SalesQuotation::getQuotationNo, approveProcess.getApproveReason())
- .last("limit 1"));
- // 鍚屾剰
- if (status.equals(2) && salesQuote != null) {
- salesQuote.setStatus("閫氳繃");
- } else if (status.equals(3) && salesQuote != null) {
- salesQuote.setStatus("鎷掔粷");
- } else if (status.equals(1) && salesQuote != null) {
- salesQuote.setStatus("瀹℃牳涓�");
- }
- salesQuotationMapper.updateById(salesQuote);
- }
- // 鍑哄簱瀹℃壒淇敼
- if (approveProcess.getApproveType().equals(7)) {
- String[] split = approveProcess.getApproveReason().split(":");
- ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
- .eq(ShippingInfo::getShippingNo, split[1])
- .orderByDesc(ShippingInfo::getCreateTime)
- .last("limit 1"));
- if (shippingInfo != null) {
- if (status.equals(2)) {
- shippingInfo.setStatus("瀹℃牳閫氳繃");
- } else if (status.equals(3)) {
- shippingInfo.setStatus("瀹℃牳鎷掔粷");
- } else if (status.equals(1)) {
- shippingInfo.setStatus("瀹℃牳涓�");
- }
- shippingInfoMapper.updateById(shippingInfo);
- }
-
- }
+ approveBusinessStatusService.syncBusinessStatus(approveProcess.getApproveType(), approveProcess.getApproveReason(), status);
fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_NODE, approveNode.getId(), approveNode.getStorageBlobDTOS());
}
@@ -305,34 +213,6 @@
return "鍔炲叕鐢ㄥ搧瀹℃壒";
}
return null;
- }
-
- private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) {
- QualityInspect qualityInspect = new QualityInspect();
- qualityInspect.setInspectType(0);
- qualityInspect.setSupplier(purchaseLedger.getSupplierName());
- qualityInspect.setPurchaseLedgerId(purchaseLedger.getId());
- qualityInspect.setProductId(saleProduct.getProductId());
- qualityInspect.setProductName(saleProduct.getProductCategory());
- qualityInspect.setModel(saleProduct.getSpecificationModel());
- qualityInspect.setProductModelId(saleProduct.getProductModelId());
- qualityInspect.setUnit(saleProduct.getUnit());
- qualityInspect.setQuantity(saleProduct.getQuantity());
- qualityInspectMapper.insert(qualityInspect);
- List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null);
- if (qualityTestStandard.size() > 0) {
- qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId());
- qualityInspectMapper.updateById(qualityInspect);
- qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery()
- .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))
- .forEach(qualityTestStandardParam -> {
- QualityInspectParam param = new QualityInspectParam();
- com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param);
- param.setId(null);
- param.setInspectId(qualityInspect.getId());
- qualityInspectParamMapper.insert(param);
- });
- }
}
}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
index c8c6af0..41f71e8 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
@@ -1,7 +1,6 @@
package com.ruoyi.approve.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -48,15 +47,12 @@
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
public class ApproveProcessServiceImpl extends ServiceImpl<ApproveProcessMapper, ApproveProcess> implements IApproveProcessService {
- private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd");
-
private final SysDeptMapper sysDeptMapper;
private final IApproveNodeService approveNodeService;
private final SysUserMapper sysUserMapper;
@@ -68,6 +64,7 @@
private final ShippingInfoMapper shippingInfoMapper;
private final ApproveNodeMapper approveNodeMapper;
private final ApproveProcessConfigNodeService approveProcessConfigNodeService;
+ private final ApproveBusinessStatusService approveBusinessStatusService;
private final FileUtil fileUtil;
private final ApproveProcessConfigNodeMapper approveProcessConfigNodeMapper;
@@ -75,68 +72,36 @@
public void addApprove(ApproveProcessVO approveProcessVO) throws Exception {
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
SysDept sysDept = sysDeptMapper.selectDeptById(SecurityUtils.getLoginUser().getCurrentDeptId());
- List<ApproveProcessConfigNodeVo> list = approveProcessConfigNodeService.listNode(approveProcessVO.getApproveType());
+ if (sysDept == null) throw new RuntimeException("閮ㄩ棬涓嶅瓨鍦�");
+ if (sysUser == null) throw new RuntimeException("鐢宠浜轰笉瀛樺湪");
+
+ List<ApproveProcessConfigNodeVo> list = Optional.ofNullable(approveProcessConfigNodeService.listNode(approveProcessVO.getApproveType()))
+ .orElse(Collections.emptyList());
List<Long> nodeIds = list.stream()
.map(ApproveProcessConfigNodeVo::getApproverId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
- // 鏃犲鏍镐汉閫昏緫娣诲姞
+
+ // 瀹℃壒閰嶇疆娌℃湁鏈夋晥瀹℃牳浜烘椂锛屼笉鏂板鍗忓悓瀹℃壒娴佺▼锛岀洿鎺ユ墽琛屼笟鍔″鏍搁�氳繃閫昏緫銆�
if (CollectionUtils.isEmpty(nodeIds)) {
- autoPassPurchaseApproveIfNoApprover(approveProcessVO); // 閲囪喘鍗曟棤瀹℃牳浜洪�昏緫
+ approveBusinessStatusService.syncBusinessStatus(approveProcessVO.getApproveType(), approveProcessVO.getApproveReason(), 2);
return;
}
+
List<SysUser> sysUsers = sysUserMapper.selectUserByIds(nodeIds);
if (CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("瀹℃牳鐢ㄦ埛涓嶅瓨鍦�");
- if (sysDept == null) throw new RuntimeException("閮ㄩ棬涓嶅瓨鍦�");
- if (sysUser == null) throw new RuntimeException("鐢宠浜轰笉瀛樺湪");
-// String today = LocalDate.now().format(DATE_FORMAT);
-// Long approveId = dailyRedisCounter.incrementAndGetByDb();
-// String formattedCount = String.format("%03d", approveId);
-// //娴佺▼ ID
-// String approveID = today + formattedCount;
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
- ApproveProcess approveProcess = new ApproveProcess();
- String no = OrderUtils.countTodayByCreateTime(approveProcessMapper, "", "approve_id");
- approveProcess.setApproveId(no);
- approveProcess.setApproveUser(sysUser.getUserId());
- approveProcess.setApproveUserName(sysUser.getNickName());
- approveProcess.setApproveDeptId(sysDept.getDeptId());
- approveProcess.setApproveUserIds(nodeIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
- approveProcess.setApproveDeptName(sysDept.getDeptName());
- approveProcess.setApproveUserNames(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.joining(",")));
- approveProcess.setApproveTime(StringUtils.isEmpty(approveProcessVO.getApproveTime()) ? new Date() : dateFormat.parse(approveProcessVO.getApproveTime()));
- approveProcess.setApproveReason(approveProcessVO.getApproveReason());
- approveProcess.setDeviceRepairId(approveProcessVO.getDeviceRepairId());
- approveProcess.setMaintenancePrice(approveProcessVO.getMaintenancePrice());
- approveProcess.setPrice(approveProcessVO.getPrice());
- approveProcess.setStartDate(approveProcessVO.getStartDate());
- approveProcess.setEndDate(approveProcessVO.getEndDate());
- approveProcess.setApproveStatus(0);
- approveProcess.setApproveDelete(0);
- approveProcess.setApproveType(approveProcessVO.getApproveType());
- approveProcess.setCreateTime(LocalDateTime.now());
- approveProcess.setTenantId(approveProcessVO.getApproveDeptId());
- approveProcess.setApproveUserCurrentId(nodeIds.get(0));
- approveProcess.setApproveUserCurrentName(sysUsers
- .stream()
- .filter(SysUser -> SysUser.getUserId().equals(nodeIds.get(0)))
- .collect(Collectors.toList())
- .get(0)
- .getNickName());
- // 璁剧疆鐘舵�佷负閲嶆柊鎻愪氦
- if (approveProcessVO.getId() != null) {
- ApproveProcess approveProcess1 = approveProcessMapper.selectById(approveProcessVO.getId());
- approveProcess1.setApproveStatus(4);
- approveProcessMapper.updateById(approveProcess1);
- }
+
+ // 鏈夊鏍镐汉鏃讹紝鎸夋甯稿崗鍚屽鎵规祦绋嬪垱寤哄鎵逛富琛ㄣ�佸鎵硅妭鐐瑰苟閫氱煡棣栦釜瀹℃牳浜恒��
+ ApproveProcess approveProcess = buildApproveProcess(approveProcessVO, sysUser, sysDept, nodeIds, sysUsers, 0);
+ markResubmitted(approveProcessVO);
save(approveProcess);
//鍒濆鍖栧鎵硅妭鐐�
String nodeIdStr = nodeIds.stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
- approveNodeService.initApproveNodes(nodeIdStr, no, approveProcessVO.getApproveDeptId());
+ approveNodeService.initApproveNodes(nodeIdStr, approveProcess.getApproveId(), approveProcessVO.getApproveDeptId());
// 闄勪欢缁戝畾
- fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_PROCESS, approveProcess.getId(), approveProcessVO.getStorageBlobDTOList());
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_PROCESS, approveProcess.getId(), approveProcessVO.getStorageBlobDTOS());
/*娑堟伅閫氱煡*/
Long id = nodeIds.getFirst();
if (approveProcess.getApproveType() == 8) {
@@ -152,14 +117,56 @@
}
}
- private void autoPassPurchaseApproveIfNoApprover(ApproveProcessVO approveProcessVO) {
- if (!Objects.equals(approveProcessVO.getApproveType(), 5)
- || !StringUtils.hasText(approveProcessVO.getApproveReason())) {
- throw new RuntimeException("瀹℃牳鐢ㄦ埛涓嶅瓨鍦�");
+ private ApproveProcess buildApproveProcess(ApproveProcessVO approveProcessVO, SysUser sysUser, SysDept sysDept,
+ List<Long> nodeIds, List<SysUser> sysUsers, Integer approveStatus) throws Exception {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ ApproveProcess approveProcess = new ApproveProcess();
+ String no = OrderUtils.countTodayByCreateTime(approveProcessMapper, "", "approve_id", approveProcess.getCreateTime() != null ? approveProcess.getCreateTime() : LocalDateTime.now());
+ approveProcess.setApproveId(no);
+ approveProcess.setApproveUser(sysUser.getUserId());
+ approveProcess.setApproveUserName(sysUser.getNickName());
+ approveProcess.setApproveDeptId(sysDept.getDeptId());
+ approveProcess.setApproveDeptName(sysDept.getDeptName());
+ approveProcess.setApproveUserIds(nodeIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
+ approveProcess.setApproveUserNames(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.joining(",")));
+ approveProcess.setApproveTime(StringUtils.isEmpty(approveProcessVO.getApproveTime()) ? new Date() : dateFormat.parse(approveProcessVO.getApproveTime()));
+ approveProcess.setApproveReason(approveProcessVO.getApproveReason());
+ approveProcess.setDeviceRepairId(approveProcessVO.getDeviceRepairId());
+ approveProcess.setMaintenancePrice(approveProcessVO.getMaintenancePrice());
+ approveProcess.setPrice(approveProcessVO.getPrice());
+ approveProcess.setStartDate(approveProcessVO.getStartDate());
+ approveProcess.setEndDate(approveProcessVO.getEndDate());
+ approveProcess.setStartDateTime(approveProcessVO.getStartDateTime());
+ approveProcess.setEndDateTime(approveProcessVO.getEndDateTime());
+ approveProcess.setApproveStatus(approveStatus);
+ approveProcess.setApproveDelete(0);
+ approveProcess.setApproveType(approveProcessVO.getApproveType());
+ approveProcess.setCreateTime(LocalDateTime.now());
+ approveProcess.setTenantId(approveProcessVO.getApproveDeptId());
+ if (!CollectionUtils.isEmpty(nodeIds)) {
+ SysUser currentUser = sysUsers.stream()
+ .filter(user -> user.getUserId().equals(nodeIds.get(0)))
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("瀹℃牳鐢ㄦ埛涓嶅瓨鍦�"));
+ approveProcess.setApproveUserCurrentId(currentUser.getUserId());
+ approveProcess.setApproveUserCurrentName(currentUser.getNickName());
}
- purchaseLedgerMapper.update(null, new LambdaUpdateWrapper<PurchaseLedger>()
- .eq(PurchaseLedger::getPurchaseContractNumber, approveProcessVO.getApproveReason())
- .set(PurchaseLedger::getApprovalStatus, 3));
+ if (approveStatus.equals(2) || approveStatus.equals(3) || approveStatus.equals(4)) {
+ approveProcess.setApproveOverTime(new Date());
+ }
+ return approveProcess;
+ }
+
+ private void markResubmitted(ApproveProcessVO approveProcessVO) {
+ if (approveProcessVO.getId() == null) {
+ return;
+ }
+ ApproveProcess approveProcess = approveProcessMapper.selectById(approveProcessVO.getId());
+ if (approveProcess == null) {
+ return;
+ }
+ approveProcess.setApproveStatus(4);
+ approveProcessMapper.updateById(approveProcess);
}
@Override
diff --git a/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementDetailServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementDetailServiceImpl.java
new file mode 100644
index 0000000..1897440
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementDetailServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.approve.service.impl;
+
+import com.ruoyi.approve.pojo.FinReimbursementDetail;
+import com.ruoyi.approve.mapper.FinReimbursementDetailMapper;
+import com.ruoyi.approve.service.FinReimbursementDetailService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曟槑缁嗚〃 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:38
+ */
+@Service
+public class FinReimbursementDetailServiceImpl extends ServiceImpl<FinReimbursementDetailMapper, FinReimbursementDetail> implements FinReimbursementDetailService {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementServiceImpl.java
new file mode 100644
index 0000000..a3d33f4
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementServiceImpl.java
@@ -0,0 +1,574 @@
+package com.ruoyi.approve.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeApproverDto;
+import com.ruoyi.approve.bean.dto.ApprovalTemplateNodeDto;
+import com.ruoyi.approve.bean.dto.FinReimbursementDto;
+import com.ruoyi.approve.bean.vo.FinReimbursementVo;
+import com.ruoyi.approve.mapper.ApprovalInstanceMapper;
+import com.ruoyi.approve.mapper.FinReimbursementDetailMapper;
+import com.ruoyi.approve.mapper.FinReimbursementMapper;
+import com.ruoyi.approve.mapper.FinReimbursementTravelMapper;
+import com.ruoyi.approve.pojo.*;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
+import com.ruoyi.approve.service.*;
+import com.ruoyi.common.enums.TypeEnums;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.project.system.service.ISysNoticeService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 鎶ラ攢鍗曚富琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:15
+ */
+@Service
+@RequiredArgsConstructor
+public class FinReimbursementServiceImpl extends ServiceImpl<FinReimbursementMapper, FinReimbursement> implements FinReimbursementService {
+
+ private static final String BILL_STATUS_DRAFT = "DRAFT";
+ private static final String BILL_STATUS_IN_APPROVAL = "IN_APPROVAL";
+ private static final String NODE_STATUS_WAITING = "WAITING";
+
+ private final ApprovalInstanceMapper approvalInstanceMapper;
+ private final ApprovalInstanceService approvalInstanceService;
+ private final ApprovalInstanceNodeService approvalInstanceNodeService;
+ private final ApprovalTaskService approvalTaskService;
+ private final ApprovalRecordService approvalRecordService;
+ private final FinReimbursementMapper finReimbursementMapper;
+ private final FinReimbursementTravelMapper finReimbursementTravelMapper;
+ private final FinReimbursementDetailMapper finReimbursementDetailMapper;
+ private final FileUtil fileUtil;
+ private final ISysNoticeService sysNoticeService;
+ @Override
+ public IPage<FinReimbursementVo> listPage(FinReimbursementDto finReimbursementDto, Page<FinReimbursementVo> page) {
+ IPage<FinReimbursementVo> finReimbursementVoIPage = finReimbursementMapper.listPage(finReimbursementDto, page);
+ finReimbursementVoIPage.getRecords().forEach(vo -> {
+ vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.FIN_REIMBURSEMENT, vo.getId()));
+ });
+
+ return finReimbursementVoIPage;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean add(FinReimbursementDto finReimbursementDto) {
+ String billStatus = validateAddParam(finReimbursementDto);
+
+ // 鐢熸垚鎶ラ攢鍗曞彿
+ String billNo = OrderUtils.countTodayByCreateTime(finReimbursementMapper, "BXD", "bill_no", finReimbursementDto.getCreateTime() != null ? finReimbursementDto.getCreateTime() : LocalDateTime.now());
+ List<FinReimbursementDetail> details = finReimbursementDto.getDetails();
+ BigDecimal totalAmount = details.stream()
+ .map(FinReimbursementDetail::getAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ FinReimbursement reimbursement = buildReimbursement(finReimbursementDto, billNo, totalAmount, billStatus);
+ // 淇濆瓨鎶ラ攢鍗曚富琛�
+ boolean saved = this.save(reimbursement);
+ if (!saved || reimbursement.getId() == null) {
+ throw new ServiceException("鏂板鎶ラ攢鍗曞け璐�");
+ }
+ Long reimbursementId = reimbursement.getId();
+
+ // 淇濆瓨宸梾鎶ラ攢鎵╁睍淇℃伅锛堟姤閿�绫诲瀷涓哄樊鏃呮姤閿�鏃讹級
+ FinReimbursementTravel travel = finReimbursementDto.getTravel();
+ if (isTravelReimbursement(finReimbursementDto.getReimbursementType())) {
+ travel.setReimbursementId(reimbursementId);
+ int travelRows = finReimbursementTravelMapper.insert(travel);
+ if (travelRows != 1) {
+ throw new ServiceException("鏂板宸梾鎶ラ攢鎵╁睍淇℃伅澶辫触");
+ }
+ }
+
+ // 淇濆瓨鎶ラ攢鍗曟槑缁�
+ for (int i = 0; i < details.size(); i++) {
+ FinReimbursementDetail detail = details.get(i);
+ detail.setId(null);
+ detail.setReimbursementId(reimbursementId);
+ detail.setRowNo(i + 1);
+ int detailRows = finReimbursementDetailMapper.insert(detail);
+ if (detailRows != 1) {
+ throw new ServiceException("鏂板鎶ラ攢鍗曟槑缁嗗け璐�");
+ }
+ }
+
+ if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) {
+ startApproval(reimbursement, finReimbursementDto);
+ }
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_REIMBURSEMENT, reimbursementId, finReimbursementDto.getStorageBlobDTOs());
+ return true;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean update(FinReimbursementDto finReimbursementDto) {
+ String billStatus = validateUpdateParam(finReimbursementDto);
+
+ Long reimbursementId = finReimbursementDto.getId();
+ FinReimbursement existing = finReimbursementMapper.selectById(reimbursementId);
+ if (existing == null) {
+ throw new ServiceException("鎶ラ攢鍗曚笉瀛樺湪");
+ }
+
+ // 璁$畻鏄庣粏姹囨�婚噾棰�
+ List<FinReimbursementDetail> details = finReimbursementDto.getDetails();
+ BigDecimal totalAmount = details.stream()
+ .map(FinReimbursementDetail::getAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ // 鏇存柊涓昏〃
+ FinReimbursement reimbursement = buildReimbursement(
+ finReimbursementDto,
+ existing.getBillNo(),
+ totalAmount,
+ billStatus
+ );
+ reimbursement.setId(reimbursementId);
+ int mainRows = finReimbursementMapper.updateById(reimbursement);
+ if (mainRows != 1) {
+ throw new ServiceException("鏇存柊鎶ラ攢鍗曚富琛ㄥけ璐�");
+ }
+
+ // 鏌ヨ鏁版嵁搴撲腑宸叉湁鐨勬槑缁�
+ List<FinReimbursementDetail> existingDetails = finReimbursementDetailMapper.selectList(
+ new LambdaQueryWrapper<FinReimbursementDetail>()
+ .eq(FinReimbursementDetail::getReimbursementId, reimbursementId));
+ Set<Long> existingDetailIds = existingDetails.stream()
+ .map(FinReimbursementDetail::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+
+ // 鏂版槑缁嗕腑鏈塈D鐨� 鈫� 鏇存柊锛涙棤ID鐨� 鈫� 鏂板
+ Set<Long> submittedDetailIds = new HashSet<>();
+ for (int i = 0; i < details.size(); i++) {
+ FinReimbursementDetail detail = details.get(i);
+ detail.setReimbursementId(reimbursementId);
+ detail.setRowNo(i + 1);
+ if (detail.getId() != null && existingDetailIds.contains(detail.getId())) {
+ finReimbursementDetailMapper.updateById(detail);
+ submittedDetailIds.add(detail.getId());
+ } else {
+ detail.setId(null);
+ finReimbursementDetailMapper.insert(detail);
+ }
+ }
+
+ // 鏁版嵁搴撲腑宸叉湁浣嗘柊鏄庣粏涓病鏈夌殑 鈫� 鍒犻櫎
+ for (Long existingId : existingDetailIds) {
+ if (!submittedDetailIds.contains(existingId)) {
+ finReimbursementDetailMapper.deleteById(existingId);
+ }
+ }
+
+ // 宸梾鎵╁睍锛氭湁鍒欐洿鏂帮紝鏃犲垯鏂板
+ FinReimbursementTravel existingTravel = finReimbursementTravelMapper.selectOne(
+ new LambdaQueryWrapper<FinReimbursementTravel>()
+ .eq(FinReimbursementTravel::getReimbursementId, reimbursementId)
+ .last("LIMIT 1"));
+ FinReimbursementTravel travel = finReimbursementDto.getTravel();
+ if (isTravelReimbursement(finReimbursementDto.getReimbursementType()) && travel != null) {
+ travel.setReimbursementId(reimbursementId);
+ if (existingTravel != null) {
+ travel.setId(existingTravel.getId());
+ finReimbursementTravelMapper.updateById(travel);
+ } else {
+ travel.setId(null);
+ finReimbursementTravelMapper.insert(travel);
+ }
+ }
+
+ resetApprovalFlow(existing, reimbursementId);
+ if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) {
+ reimbursement.setApprovalInstanceId(null);
+ startApproval(reimbursement, finReimbursementDto);
+ }
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_REIMBURSEMENT, reimbursementId, finReimbursementDto.getStorageBlobDTOs());
+
+ return true;
+ }
+
+ @Override
+ public FinReimbursementVo detail(Long id) {
+ if (id == null ) {
+ throw new ServiceException("鎶ラ攢鍗旾D涓嶈兘涓虹┖");
+ }
+
+ FinReimbursement reimbursement = finReimbursementMapper.selectById(id);
+ if (reimbursement == null) {
+ throw new ServiceException("鎶ラ攢鍗曚笉瀛樺湪");
+ }
+
+ FinReimbursementVo vo = new FinReimbursementVo();
+ vo.setId(reimbursement.getId());
+ vo.setBillNo(reimbursement.getBillNo());
+ vo.setReimbursementType(reimbursement.getReimbursementType());
+ vo.setExpenseType(reimbursement.getExpenseType());
+ vo.setApplicantId(reimbursement.getApplicantId());
+ vo.setApplicantCode(reimbursement.getApplicantCode());
+ vo.setApplicantName(reimbursement.getApplicantName());
+ vo.setApplicantDeptId(reimbursement.getApplicantDeptId());
+ vo.setApplicantDeptName(reimbursement.getApplicantDeptName());
+ vo.setReason(reimbursement.getReason());
+ vo.setApplyAmount(reimbursement.getApplyAmount());
+ vo.setDetailTotalAmount(reimbursement.getDetailTotalAmount());
+ vo.setPayeeName(reimbursement.getPayeeName());
+ vo.setPayeeAccount(reimbursement.getPayeeAccount());
+ vo.setPayeeBank(reimbursement.getPayeeBank());
+ vo.setApprovalInstanceId(reimbursement.getApprovalInstanceId());
+ vo.setApproveProcessId(reimbursement.getApproveProcessId());
+ vo.setBillStatus(reimbursement.getBillStatus());
+ vo.setApprovedTime(reimbursement.getApprovedTime());
+ vo.setPaidTime(reimbursement.getPaidTime());
+ vo.setAccountExpenseId(reimbursement.getAccountExpenseId());
+ vo.setRemark(reimbursement.getRemark());
+ vo.setTenantId(reimbursement.getTenantId());
+ vo.setCreateUser(reimbursement.getCreateUser());
+ vo.setCreateTime(reimbursement.getCreateTime());
+ vo.setUpdateUser(reimbursement.getUpdateUser());
+ vo.setUpdateTime(reimbursement.getUpdateTime());
+ vo.setDeptId(reimbursement.getDeptId());
+ vo.setDeleted(reimbursement.getDeleted());
+
+ vo.setDetails(finReimbursementDetailMapper.selectList(
+ new LambdaQueryWrapper<FinReimbursementDetail>()
+ .eq(FinReimbursementDetail::getReimbursementId, reimbursement.getId())
+ .orderByAsc(FinReimbursementDetail::getRowNo)
+ ));
+
+ if (isTravelReimbursement(reimbursement.getReimbursementType())) {
+ vo.setTravel(finReimbursementTravelMapper.selectOne(
+ new LambdaQueryWrapper<FinReimbursementTravel>()
+ .eq(FinReimbursementTravel::getReimbursementId, reimbursement.getId())
+ .last("LIMIT 1")
+ ));
+ }
+ vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.FIN_REIMBURSEMENT, reimbursement.getId()));
+ //瀹℃壒璁板綍杩斿洖
+ vo.setTasks(approvalTaskService.list(new LambdaQueryWrapper<ApprovalTask>().eq(ApprovalTask::getInstanceId, reimbursement.getApprovalInstanceId())));
+ vo.setRecords(approvalRecordService.list(new LambdaQueryWrapper<ApprovalRecord>().eq(ApprovalRecord::getInstanceId, reimbursement.getApprovalInstanceId())));
+ return vo;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean delete(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ throw new ServiceException("鍒犻櫎澶辫触锛岃閫夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ }
+ // 鏌ヨ鎶ラ攢鍗曞叧鑱旂殑瀹℃壒瀹炰緥ID
+ List<FinReimbursement> reimbursements = finReimbursementMapper.selectList(
+ new LambdaQueryWrapper<FinReimbursement>()
+ .in(FinReimbursement::getId, ids)
+ .isNotNull(FinReimbursement::getApprovalInstanceId)
+ );
+ List<Long> approvalInstanceIds = reimbursements.stream()
+ .map(FinReimbursement::getApprovalInstanceId)
+ .filter(Objects::nonNull)
+ .distinct()
+ .collect(Collectors.toList());
+
+ // 鍒犻櫎鍏宠仈鐨勫鎵硅褰�
+ if (!approvalInstanceIds.isEmpty()) {
+ approvalInstanceService.delete(approvalInstanceIds);
+ }
+
+ fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_REIMBURSEMENT, ids);
+ //鍏堝垹闄ゆ槑缁�
+ finReimbursementDetailMapper.delete(new LambdaQueryWrapper<FinReimbursementDetail>().in(FinReimbursementDetail::getReimbursementId, ids));
+ //鍒犻櫎宸梾
+ finReimbursementTravelMapper.delete(new LambdaQueryWrapper<FinReimbursementTravel>().in(FinReimbursementTravel::getReimbursementId, ids));
+ //鍒犻櫎涓昏〃
+ int rows = finReimbursementMapper.delete(new LambdaQueryWrapper<FinReimbursement>().in(FinReimbursement::getId, ids));
+ return rows == ids.size();
+ }
+
+ private String validateUpdateParam(FinReimbursementDto finReimbursementDto) {
+ if (finReimbursementDto == null || finReimbursementDto.getId() == null) {
+ throw new ServiceException("鎶ラ攢鍗旾D涓嶈兘涓虹┖");
+ }
+ if (finReimbursementDto.getReimbursementType() == null) {
+ throw new ServiceException("鎶ラ攢绫诲瀷涓嶈兘涓虹┖");
+ }
+ String billStatus = normalizeBillStatus(finReimbursementDto.getBillStatus());
+ if (billStatus == null) {
+ throw new ServiceException("鍗曟嵁鐘舵�佸彧鏀寔 DRAFT 鎴� IN_APPROVAL");
+ }
+ if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) {
+ validateApprovalNodes(finReimbursementDto.getNodes());
+ }
+ List<FinReimbursementDetail> details = finReimbursementDto.getDetails();
+ if (details == null || details.isEmpty()) {
+ throw new ServiceException("鎶ラ攢鍗曟槑缁嗕笉鑳戒负绌�");
+ }
+ for (FinReimbursementDetail detail : details) {
+ if (detail == null) {
+ throw new ServiceException("鎶ラ攢鍗曟槑缁嗕笉鑳戒负绌�");
+ }
+ if (detail.getAmount() == null || detail.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("鎶ラ攢鍗曟槑缁嗛噾棰濆繀椤诲ぇ浜�0");
+ }
+ }
+ if (isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() == null) {
+ throw new ServiceException("宸梾鎶ラ攢蹇呴』濉啓宸梾鎵╁睍淇℃伅");
+ }
+ if (!isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() != null) {
+ throw new ServiceException("闈炲樊鏃呮姤閿�涓嶅厑璁稿~鍐欏樊鏃呮墿灞曚俊鎭�");
+ }
+ return billStatus;
+ }
+
+ private String validateAddParam(FinReimbursementDto finReimbursementDto) {
+ if (finReimbursementDto == null) {
+ throw new ServiceException("鎶ラ攢鍗曟暟鎹笉鑳戒负绌�");
+ }
+ if (finReimbursementDto.getReimbursementType() == null) {
+ throw new ServiceException("鎶ラ攢绫诲瀷涓嶈兘涓虹┖");
+ }
+ String billStatus = normalizeBillStatus(finReimbursementDto.getBillStatus());
+ if (billStatus == null) {
+ throw new ServiceException("鍗曟嵁鐘舵�佸彧鏀寔 DRAFT 鎴� IN_APPROVAL");
+ }
+ if (BILL_STATUS_IN_APPROVAL.equals(billStatus)) {
+ validateApprovalNodes(finReimbursementDto.getNodes());
+ }
+ List<FinReimbursementDetail> details = finReimbursementDto.getDetails();
+ if (details == null || details.isEmpty()) {
+ throw new ServiceException("鎶ラ攢鍗曟槑缁嗕笉鑳戒负绌�");
+ }
+ for (FinReimbursementDetail detail : details) {
+ if (detail == null) {
+ throw new ServiceException("鎶ラ攢鍗曟槑缁嗕笉鑳戒负绌�");
+ }
+ if (detail.getAmount() == null || detail.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("鎶ラ攢鍗曟槑缁嗛噾棰濆繀椤诲ぇ浜�0");
+ }
+ }
+ if (isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() == null) {
+ throw new ServiceException("宸梾鎶ラ攢蹇呴』濉啓宸梾鎵╁睍淇℃伅");
+ }
+ if (!isTravelReimbursement(finReimbursementDto.getReimbursementType()) && finReimbursementDto.getTravel() != null) {
+ throw new ServiceException("闈炲樊鏃呮姤閿�涓嶅厑璁稿~鍐欏樊鏃呮墿灞曚俊鎭�");
+ }
+ return billStatus;
+ }
+
+ private FinReimbursement buildReimbursement(FinReimbursementDto finReimbursementDto, String billNo, BigDecimal totalAmount, String billStatus) {
+ FinReimbursement reimbursement = new FinReimbursement();
+ reimbursement.setId(null);
+ reimbursement.setBillNo(billNo);
+ reimbursement.setReimbursementType(finReimbursementDto.getReimbursementType());
+ reimbursement.setExpenseType(finReimbursementDto.getExpenseType());
+ reimbursement.setApplicantId(finReimbursementDto.getApplicantId());
+ reimbursement.setApplicantCode(finReimbursementDto.getApplicantCode());
+ reimbursement.setApplicantName(finReimbursementDto.getApplicantName());
+ reimbursement.setApplicantDeptId(finReimbursementDto.getApplicantDeptId());
+ reimbursement.setApplicantDeptName(finReimbursementDto.getApplicantDeptName());
+ reimbursement.setReason(finReimbursementDto.getReason());
+ reimbursement.setApplyAmount(finReimbursementDto.getApplyAmount());
+ reimbursement.setDetailTotalAmount(totalAmount);
+ reimbursement.setPayeeName(finReimbursementDto.getPayeeName());
+ reimbursement.setPayeeAccount(finReimbursementDto.getPayeeAccount());
+ reimbursement.setPayeeBank(finReimbursementDto.getPayeeBank());
+ reimbursement.setRemark(finReimbursementDto.getRemark());
+ reimbursement.setTenantId(finReimbursementDto.getTenantId());
+ reimbursement.setApproveProcessId(null);
+ reimbursement.setBillStatus(billStatus);
+ return reimbursement;
+ }
+
+ private void startApproval(FinReimbursement reimbursement, FinReimbursementDto finReimbursementDto) {
+ Long businessType = resolveBusinessType(finReimbursementDto.getReimbursementType());
+ ApprovalInstanceDto approvalInstanceDto = new ApprovalInstanceDto();
+ approvalInstanceDto.setInstanceNo(OrderUtils.countTodayByCreateTime(approvalInstanceMapper, "SP", "instance_no", approvalInstanceDto.getCreateTime() != null ? approvalInstanceDto.getCreateTime() : LocalDateTime.now()));
+ approvalInstanceDto.setBusinessId(reimbursement.getId());
+ approvalInstanceDto.setTemplateId(null);
+ approvalInstanceDto.setTemplateName(TypeEnums.getLabelByValue(businessType) + "瀹℃壒");
+ approvalInstanceDto.setBusinessType(businessType);
+ approvalInstanceDto.setTitle("鎶ラ攢鍗曞彿锛�" + reimbursement.getBillNo());
+ approvalInstanceDto.setApplicantId(reimbursement.getApplicantId() != null ? reimbursement.getApplicantId() : SecurityUtils.getUserId());
+ approvalInstanceDto.setApplicantName(reimbursement.getApplicantName() != null ? reimbursement.getApplicantName() : SecurityUtils.getLoginUser().getNickName());
+ approvalInstanceDto.setApplyTime(LocalDateTime.now());
+ approvalInstanceDto.setStatus("PENDING");
+ approvalInstanceDto.setCurrentLevel(1);
+
+ boolean approvalSaved = approvalInstanceService.save(approvalInstanceDto);
+ if (!approvalSaved || approvalInstanceDto.getId() == null) {
+ throw new ServiceException("鍙戣捣瀹℃壒澶辫触");
+ }
+ List<ApprovalTask> firstTasks = createApprovalNodes(approvalInstanceDto, finReimbursementDto.getNodes());
+ sendApproveNotice(approvalInstanceDto, firstTasks);
+
+ FinReimbursement update = new FinReimbursement();
+ update.setId(reimbursement.getId());
+ update.setApprovalInstanceId(approvalInstanceDto.getId());
+ update.setBillStatus(BILL_STATUS_IN_APPROVAL);
+ int rows = finReimbursementMapper.updateById(update);
+ if (rows != 1) {
+ throw new ServiceException("鍥炲~瀹℃壒瀹炰緥澶辫触");
+ }
+ }
+
+ private List<ApprovalTask> createApprovalNodes(ApprovalInstanceDto approvalInstanceDto, List<ApprovalTemplateNodeDto> nodes) {
+ List<ApprovalTask> firstTasks = Collections.emptyList();
+ for (int i = 0; i < nodes.size(); i++) {
+ ApprovalTemplateNodeDto nodeDto = nodes.get(i);
+ ApprovalInstanceNode instanceNode = new ApprovalInstanceNode();
+ instanceNode.setInstanceId(approvalInstanceDto.getId());
+ instanceNode.setLevelNo(nodeDto.getLevelNo());
+ instanceNode.setApproveType(nodeDto.getApproveType());
+ instanceNode.setStatus(i == 0 ? "PENDING" : NODE_STATUS_WAITING);
+ instanceNode.setStartTime(i == 0 ? LocalDateTime.now() : null);
+ instanceNode.setDeleted((byte) 0);
+ approvalInstanceNodeService.save(instanceNode);
+
+ List<ApprovalTask> tasks = nodeDto.getApprovers().stream().map(approver -> {
+ ApprovalTask task = new ApprovalTask();
+ task.setInstanceId(approvalInstanceDto.getId());
+ task.setNodeId(instanceNode.getId());
+ task.setLevelNo(instanceNode.getLevelNo());
+ task.setApproverId(approver.getApproverId());
+ task.setApproverName(approver.getApproverName());
+ task.setTaskStatus("PENDING");
+ task.setIsRead((byte) 0);
+ task.setDeleted((byte) 0);
+ return task;
+ }).collect(Collectors.toList());
+ approvalTaskService.saveBatch(tasks);
+
+ if (i == 0) {
+ firstTasks = tasks;
+ ApprovalRecord record = new ApprovalRecord();
+ record.setInstanceId(approvalInstanceDto.getId());
+ record.setNodeId(instanceNode.getId());
+ record.setOperatorId(approvalInstanceDto.getApplicantId());
+ record.setOperatorName(approvalInstanceDto.getApplicantName());
+ record.setAction("SUBMIT");
+ record.setComment("鍙戣捣瀹℃壒");
+ record.setDeleted((byte) 0);
+ approvalRecordService.save(record);
+ }
+ }
+ return firstTasks;
+ }
+
+ private void validateApprovalNodes(List<ApprovalTemplateNodeDto> nodes) {
+ if (nodes == null || nodes.isEmpty()) {
+ throw new ServiceException("鎻愪氦瀹℃壒鏃跺鎵硅妭鐐逛笉鑳戒负绌�");
+ }
+ for (int i = 0; i < nodes.size(); i++) {
+ ApprovalTemplateNodeDto node = nodes.get(i);
+ if (node == null) {
+ throw new ServiceException("瀹℃壒鑺傜偣涓嶈兘涓虹┖");
+ }
+ if (node.getLevelNo() == null) {
+ node.setLevelNo(i + 1);
+ }
+ if (!StringUtils.hasText(node.getApproveType())) {
+ throw new ServiceException("瀹℃壒鑺傜偣瀹℃壒鏂瑰紡涓嶈兘涓虹┖");
+ }
+ List<ApprovalTemplateNodeApproverDto> approvers = node.getApprovers();
+ if (approvers == null || approvers.isEmpty()) {
+ throw new ServiceException("瀹℃壒鑺傜偣瀹℃壒浜轰笉鑳戒负绌�");
+ }
+ for (ApprovalTemplateNodeApproverDto approver : approvers) {
+ if (approver == null || approver.getApproverId() == null) {
+ throw new ServiceException("瀹℃壒浜轰笉鑳戒负绌�");
+ }
+ }
+ }
+ }
+
+ private void sendApproveNotice(ApprovalInstanceDto instance, List<ApprovalTask> tasks) {
+ if (instance == null || tasks == null || tasks.isEmpty()) {
+ return;
+ }
+ List<Long> approverIds = tasks.stream()
+ .map(ApprovalTask::getApproverId)
+ .filter(id -> id != null && id > 0)
+ .distinct()
+ .collect(Collectors.toList());
+ if (approverIds.isEmpty()) {
+ return;
+ }
+ String title = "鎶ラ攢瀹℃壒";
+ String message = "瀹℃壒鍗曞彿 " + instance.getInstanceNo() + " 闇�瑕佹偍瀹℃壒";
+ String jumpPath = getJumpPathByBusinessType(instance.getBusinessType(), instance.getId());
+ sysNoticeService.simpleNoticeByUser(title, message, approverIds, jumpPath);
+ }
+
+ private String getJumpPathByBusinessType(Long businessType, Long instanceId) {
+ if (TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode().equals(businessType)) {
+ return "/collaborativeApproval/ReimburseManage/travel-reimburse?id=" + instanceId;
+ }
+ if (TypeEnums.EXPENSE_APPROVAL.getCode().equals(businessType)) {
+ return "/collaborativeApproval/ReimburseManage/cost-reimburse?id=" + instanceId;
+ }
+ return "/approvalInstance?id=" + instanceId;
+ }
+
+ private void resetApprovalFlow(FinReimbursement existing, Long reimbursementId) {
+ if (existing == null || existing.getApprovalInstanceId() == null) {
+ return;
+ }
+ Long approvalInstanceId = existing.getApprovalInstanceId();
+ if (!"REJECTED".equals(existing.getBillStatus())) {
+ approvalInstanceService.delete(Collections.singletonList(approvalInstanceId));
+ }
+ clearApprovalBinding(reimbursementId);
+ }
+
+ private void clearApprovalBinding(Long reimbursementId) {
+ int rows = finReimbursementMapper.update(
+ null,
+ Wrappers.<FinReimbursement>lambdaUpdate()
+ .eq(FinReimbursement::getId, reimbursementId)
+ .set(FinReimbursement::getApprovalInstanceId, null)
+ );
+ if (rows != 1) {
+ throw new ServiceException("閲嶇疆瀹℃壒娴佺▼澶辫触");
+ }
+ }
+
+ private Long resolveBusinessType(Byte reimbursementType) {
+ return isTravelReimbursement(reimbursementType)
+ ? TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode()
+ : TypeEnums.EXPENSE_APPROVAL.getCode();
+ }
+
+ private String normalizeBillStatus(String billStatus) {
+ if (billStatus == null) {
+ return BILL_STATUS_DRAFT;
+ }
+ String normalized = billStatus.trim().toUpperCase();
+ if (BILL_STATUS_DRAFT.equals(normalized) || BILL_STATUS_IN_APPROVAL.equals(normalized)) {
+ return normalized;
+ }
+ return null;
+ }
+
+ private boolean isTravelReimbursement(Byte reimbursementType) {
+ return Byte.valueOf((byte) 1).equals(reimbursementType);
+ }
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementTravelServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementTravelServiceImpl.java
new file mode 100644
index 0000000..3329f9a
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/FinReimbursementTravelServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.approve.service.impl;
+
+import com.ruoyi.approve.pojo.FinReimbursementTravel;
+import com.ruoyi.approve.mapper.FinReimbursementTravelMapper;
+import com.ruoyi.approve.service.FinReimbursementTravelService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 宸梾鎶ラ攢鎵╁睍琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-21 09:56:47
+ */
+@Service
+public class FinReimbursementTravelServiceImpl extends ServiceImpl<FinReimbursementTravelMapper, FinReimbursementTravel> implements FinReimbursementTravelService {
+
+}
diff --git a/src/main/java/com/ruoyi/approve/service/impl/KnowledgeBaseVectorServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/KnowledgeBaseVectorServiceImpl.java
new file mode 100644
index 0000000..52bc0b5
--- /dev/null
+++ b/src/main/java/com/ruoyi/approve/service/impl/KnowledgeBaseVectorServiceImpl.java
@@ -0,0 +1,144 @@
+package com.ruoyi.approve.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.approve.dto.KnowledgeBaseVectorVO;
+import com.ruoyi.approve.mapper.KnowledgeBaseVectorMapper;
+import com.ruoyi.approve.pojo.KnowledgeBase;
+import com.ruoyi.approve.pojo.KnowledgeBaseVector;
+import com.ruoyi.approve.service.KnowledgeBaseService;
+import com.ruoyi.approve.service.KnowledgeBaseVectorService;
+import com.ruoyi.ai.service.KnowledgeRagService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 鐭ヨ瘑搴撴枃浠跺悜閲忚褰� Service瀹炵幇
+ */
+@Slf4j
+@Service
+public class KnowledgeBaseVectorServiceImpl extends ServiceImpl<KnowledgeBaseVectorMapper, KnowledgeBaseVector>
+ implements KnowledgeBaseVectorService {
+
+ private final KnowledgeBaseService knowledgeBaseService;
+ private final KnowledgeRagService knowledgeRagService;
+
+ public KnowledgeBaseVectorServiceImpl(
+ KnowledgeBaseService knowledgeBaseService,
+ @Lazy KnowledgeRagService knowledgeRagService) {
+ this.knowledgeBaseService = knowledgeBaseService;
+ this.knowledgeRagService = knowledgeRagService;
+ }
+
+ @Override
+ public List<KnowledgeBaseVectorVO> getVectorStatusByKnowledgeBaseId(Long knowledgeBaseId) {
+ return baseMapper.selectByKnowledgeBaseId(knowledgeBaseId);
+ }
+
+ @Override
+ public KnowledgeBaseVector createVectorRecord(Long knowledgeBaseId, Long storageBlobId,
+ String fileName, String fileType) {
+ KnowledgeBase knowledgeBase = knowledgeBaseService.getById(knowledgeBaseId);
+ if (knowledgeBase == null) {
+ throw new RuntimeException("鐭ヨ瘑搴撲笉瀛樺湪: " + knowledgeBaseId);
+ }
+
+ KnowledgeBaseVector vector = new KnowledgeBaseVector();
+ vector.setKnowledgeBaseId(knowledgeBaseId);
+ vector.setStorageBlobId(storageBlobId);
+ vector.setFileName(fileName);
+ vector.setFileType(fileType);
+ vector.setVectorStatus(KnowledgeBaseVector.STATUS_PENDING);
+ vector.setNamespace("kb-" + knowledgeBaseId);
+ vector.setChunkCount(0);
+ save(vector);
+
+ // 寮傛瑙﹀彂鍚戦噺鍖栧鐞�
+ knowledgeRagService.processVectorAsync(vector.getId());
+
+ return vector;
+ }
+
+ @Override
+ public void updateVectorStatus(Long id, Integer status, Integer chunkCount, String error) {
+ KnowledgeBaseVector vector = getById(id);
+ if (vector == null) {
+ return;
+ }
+ vector.setVectorStatus(status);
+ if (chunkCount != null) {
+ vector.setChunkCount(chunkCount);
+ }
+ if (error != null) {
+ vector.setVectorError(error);
+ }
+ updateById(vector);
+
+ // 濡傛灉瀹屾垚锛屾洿鏂扮煡璇嗗簱缁熻
+ if (status == KnowledgeBaseVector.STATUS_COMPLETED) {
+ updateKnowledgeBaseStats(vector.getKnowledgeBaseId());
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void reprocessVector(Long id) {
+ KnowledgeBaseVector vector = getById(id);
+ if (vector == null) {
+ throw new RuntimeException("鍚戦噺璁板綍涓嶅瓨鍦�: " + id);
+ }
+ vector.setVectorStatus(KnowledgeBaseVector.STATUS_PENDING);
+ vector.setVectorError(null);
+ vector.setChunkCount(0);
+ updateById(vector);
+
+ // 寮傛閲嶆柊澶勭悊
+ knowledgeRagService.processVectorAsync(id);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteVector(Long id) {
+ KnowledgeBaseVector vector = getById(id);
+ if (vector == null) {
+ return;
+ }
+
+ // 鍒犻櫎鍚戦噺搴撲腑鐨勬暟鎹�
+ try {
+ knowledgeRagService.deleteEmbeddings(vector.getNamespace(), vector.getStorageBlobId());
+ } catch (Exception e) {
+ log.error("鍒犻櫎鍚戦噺搴撴暟鎹け璐�", e);
+ }
+
+ // 鍒犻櫎璁板綍
+ removeById(id);
+
+ // 鏇存柊鐭ヨ瘑搴撶粺璁�
+ updateKnowledgeBaseStats(vector.getKnowledgeBaseId());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteVectors(List<Long> ids) {
+ for (Long id : ids) {
+ deleteVector(id);
+ }
+ }
+
+ private void updateKnowledgeBaseStats(Long knowledgeBaseId) {
+ KnowledgeBase knowledgeBase = knowledgeBaseService.getById(knowledgeBaseId);
+ if (knowledgeBase == null) {
+ return;
+ }
+ int fileCount = baseMapper.countByKnowledgeBaseId(knowledgeBaseId);
+ int totalChunkCount = baseMapper.sumChunkCountByKnowledgeBaseId(knowledgeBaseId);
+ knowledgeBase.setFileCount(fileCount);
+ knowledgeBase.setTotalChunkCount(totalChunkCount);
+ knowledgeBaseService.updateById(knowledgeBase);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/approve/utils/ApproveProcessConfigNodeUtils.java b/src/main/java/com/ruoyi/approve/utils/ApproveProcessConfigNodeUtils.java
index 4ae03e6..239726a 100644
--- a/src/main/java/com/ruoyi/approve/utils/ApproveProcessConfigNodeUtils.java
+++ b/src/main/java/com/ruoyi/approve/utils/ApproveProcessConfigNodeUtils.java
@@ -1,9 +1,370 @@
package com.ruoyi.approve.utils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalInstanceNode;
+import com.ruoyi.approve.pojo.ApprovalRecord;
+import com.ruoyi.approve.pojo.ApprovalTask;
+import com.ruoyi.approve.pojo.ApprovalTemplateNode;
+import com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover;
+import com.ruoyi.approve.service.ApprovalInstanceNodeService;
+import com.ruoyi.approve.service.ApprovalRecordService;
+import com.ruoyi.approve.service.ApprovalTaskService;
+import com.ruoyi.approve.service.ApprovalTemplateNodeApproverService;
+import com.ruoyi.approve.service.ApprovalTemplateNodeService;
import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 瀹℃壒娴佺▼鑺傜偣宸ュ叿绫�
+ */
+@Component
@RequiredArgsConstructor
public class ApproveProcessConfigNodeUtils {
+ private final ApprovalInstanceNodeService instanceNodeService;
+ private final ApprovalTaskService approvalTaskService;
+ private final ApprovalRecordService approvalRecordService;
+ private final ApprovalTemplateNodeService approvalTemplateNodeService;
+ private final ApprovalTemplateNodeApproverService approvalTemplateNodeApproverService;
-}
+ /**
+ * 鎸夊綋鍓嶅眰绾у垱寤哄鎵硅妭鐐瑰拰瀹℃壒浠诲姟銆�
+ * 璇ラ噸杞戒細鍚屾椂鍐欏叆涓�鏉″彂璧峰鎵硅褰曘��
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public ApprovalInstanceNode createCurrentNodeAndTasks(ApprovalInstance instance) {
+ return createCurrentNodeAndTasks(instance, true);
+ }
+
+ /**
+ * 鎸夊綋鍓嶅眰绾у垱寤哄鎵硅妭鐐瑰拰瀹℃壒浠诲姟銆�
+ *
+ * @param instance 瀹℃壒瀹炰緥
+ * @param createSubmitRecord 鏄惁鍒涘缓鍙戣捣瀹℃壒璁板綍
+ * @return 鍒涘缓鍑虹殑褰撳墠鑺傜偣瀹炰緥
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public ApprovalInstanceNode createCurrentNodeAndTasks(ApprovalInstance instance, boolean createSubmitRecord) {
+ if (instance == null || instance.getId() == null) {
+ throw new RuntimeException("瀹℃壒瀹炰緥涓嶈兘涓虹┖");
+ }
+ if (instance.getTemplateId() == null) {
+ throw new RuntimeException("瀹℃壒妯℃澘涓嶈兘涓虹┖");
+ }
+
+ Integer currentLevel = instance.getCurrentLevel() == null ? 1 : instance.getCurrentLevel();
+
+ ApprovalInstanceNode existsNode = instanceNodeService.getOne(
+ new LambdaQueryWrapper<ApprovalInstanceNode>()
+ .eq(ApprovalInstanceNode::getInstanceId, instance.getId())
+ .eq(ApprovalInstanceNode::getLevelNo, currentLevel)
+ .eq(ApprovalInstanceNode::getDeleted, 0)
+ .last("LIMIT 1")
+ );
+ if (existsNode != null) {
+ return existsNode;
+ }
+
+ ApprovalTemplateNode templateNode = approvalTemplateNodeService.getOne(
+ new LambdaQueryWrapper<ApprovalTemplateNode>()
+ .eq(ApprovalTemplateNode::getTemplateId, instance.getTemplateId())
+ .eq(ApprovalTemplateNode::getLevelNo, currentLevel)
+ .orderByAsc(ApprovalTemplateNode::getId)
+ .last("LIMIT 1")
+ );
+ if (templateNode == null) {
+ throw new RuntimeException("鏈壘鍒板綋鍓嶅眰绾у搴旂殑瀹℃壒妯℃澘鑺傜偣");
+ }
+
+ List<ApprovalTemplateNodeApprover> approvers = approvalTemplateNodeApproverService.list(
+ new LambdaQueryWrapper<ApprovalTemplateNodeApprover>()
+ .eq(ApprovalTemplateNodeApprover::getTemplateId, instance.getTemplateId())
+ .eq(ApprovalTemplateNodeApprover::getNodeId, templateNode.getId())
+ .eq(ApprovalTemplateNodeApprover::getDeleted, 0L)
+ .orderByAsc(ApprovalTemplateNodeApprover::getSortNo)
+ );
+ if (approvers == null || approvers.isEmpty()) {
+ throw new RuntimeException("褰撳墠瀹℃壒鑺傜偣鏈厤缃鎵逛汉");
+ }
+
+ ApprovalInstanceNode instanceNode = new ApprovalInstanceNode();
+ instanceNode.setInstanceId(instance.getId());
+ instanceNode.setLevelNo(templateNode.getLevelNo());
+ instanceNode.setApproveType(templateNode.getApproveType());
+ instanceNode.setStatus("PENDING");
+ instanceNode.setStartTime(LocalDateTime.now());
+ instanceNode.setDeleted((byte) 0);
+ instanceNodeService.save(instanceNode);
+
+ List<ApprovalTask> taskList = new ArrayList<>(approvers.size());
+ for (ApprovalTemplateNodeApprover approver : approvers) {
+ ApprovalTask task = new ApprovalTask();
+ task.setInstanceId(instance.getId());
+ task.setNodeId(instanceNode.getId());
+ task.setLevelNo(instanceNode.getLevelNo());
+ task.setApproverId(approver.getApproverId());
+ task.setApproverName(approver.getApproverName());
+ task.setTaskStatus("PENDING");
+ task.setIsRead((byte) 0);
+ task.setDeleted((byte) 0);
+ taskList.add(task);
+ }
+ approvalTaskService.saveBatch(taskList);
+
+ if (createSubmitRecord) {
+ ApprovalRecord record = new ApprovalRecord();
+ record.setInstanceId(instance.getId());
+ record.setNodeId(instanceNode.getId());
+ record.setOperatorId(instance.getApplicantId());
+ record.setOperatorName(instance.getApplicantName());
+ record.setAction("SUBMIT");
+ record.setComment("鍙戣捣瀹℃壒");
+ record.setDeleted((byte) 0);
+ approvalRecordService.save(record);
+ }
+
+ return instanceNode;
+ }
+
+ /**
+ * 鏌ヨ褰撳墠寰呭鐞嗚妭鐐广��
+ */
+ public ApprovalInstanceNode getCurrentNode(Long instanceId) {
+ if (instanceId == null) {
+ return null;
+ }
+
+ return instanceNodeService.getOne(
+ new LambdaQueryWrapper<ApprovalInstanceNode>()
+ .eq(ApprovalInstanceNode::getInstanceId, instanceId)
+ .eq(ApprovalInstanceNode::getStatus, "PENDING")
+ .eq(ApprovalInstanceNode::getDeleted, 0)
+ .orderByAsc(ApprovalInstanceNode::getLevelNo)
+ .last("LIMIT 1")
+ );
+ }
+
+ /**
+ * 鏌ヨ褰撳墠瀹℃壒灞傜骇銆�
+ */
+ public Integer getCurrentLevel(Long instanceId) {
+ ApprovalInstanceNode currentNode = getCurrentNode(instanceId);
+ return currentNode != null ? currentNode.getLevelNo() : null;
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鑺傜偣涓嬬殑寰呭鎵逛换鍔°��
+ */
+ public List<ApprovalTask> getCurrentPendingTasks(Long instanceId) {
+ if (instanceId == null) {
+ return List.of();
+ }
+
+ ApprovalInstanceNode currentNode = getCurrentNode(instanceId);
+ if (currentNode == null) {
+ return List.of();
+ }
+
+ return approvalTaskService.list(
+ new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getInstanceId, instanceId)
+ .eq(ApprovalTask::getNodeId, currentNode.getId())
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ .orderByAsc(ApprovalTask::getLevelNo)
+ );
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鐢ㄦ埛鍦ㄥ綋鍓嶈妭鐐逛笂鐨勫緟瀹℃壒浠诲姟銆�
+ */
+ public ApprovalTask getCurrentUserTask(Long instanceId, Long userId) {
+ if (instanceId == null || userId == null) {
+ return null;
+ }
+
+ ApprovalInstanceNode currentNode = getCurrentNode(instanceId);
+ if (currentNode == null) {
+ return null;
+ }
+
+ return approvalTaskService.getOne(
+ new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getInstanceId, instanceId)
+ .eq(ApprovalTask::getNodeId, currentNode.getId())
+ .eq(ApprovalTask::getApproverId, userId)
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ .last("LIMIT 1")
+ );
+ }
+
+ /**
+ * 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏄綋鍓嶅鎵逛汉銆�
+ */
+ public boolean isCurrentApprover(Long instanceId, Long userId) {
+ return getCurrentUserTask(instanceId, userId) != null;
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鑺傜偣鐨勫鎵逛汉 ID 鍒楄〃銆�
+ */
+ public List<Long> getCurrentNodeApproverIds(Long instanceId) {
+ return getCurrentPendingTasks(instanceId).stream()
+ .map(ApprovalTask::getApproverId)
+ .distinct()
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鑺傜偣鍓╀綑寰呭鎵逛汉鏁般��
+ */
+ public int getRemainingApproverCount(Long instanceId) {
+ return getCurrentPendingTasks(instanceId).size();
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鑺傜偣宸插悓鎰忎汉鏁般��
+ */
+ public int getApprovedCount(Long instanceId) {
+ if (instanceId == null) {
+ return 0;
+ }
+
+ ApprovalInstanceNode currentNode = getCurrentNode(instanceId);
+ if (currentNode == null) {
+ return 0;
+ }
+
+ return Math.toIntExact(approvalTaskService.count(
+ new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getInstanceId, instanceId)
+ .eq(ApprovalTask::getNodeId, currentNode.getId())
+ .eq(ApprovalTask::getTaskStatus, "APPROVED")
+ .eq(ApprovalTask::getDeleted, 0)
+ ));
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鑺傜偣宸叉嫆缁濅汉鏁般��
+ */
+ public int getRejectedCount(Long instanceId) {
+ if (instanceId == null) {
+ return 0;
+ }
+
+ ApprovalInstanceNode currentNode = getCurrentNode(instanceId);
+ if (currentNode == null) {
+ return 0;
+ }
+
+ return Math.toIntExact(approvalTaskService.count(
+ new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getInstanceId, instanceId)
+ .eq(ApprovalTask::getNodeId, currentNode.getId())
+ .eq(ApprovalTask::getTaskStatus, "REJECTED")
+ .eq(ApprovalTask::getDeleted, 0)
+ ));
+ }
+
+ /**
+ * 鍒ゆ柇褰撳墠鑺傜偣鏄惁鍙互娴佽浆鍒颁笅涓�灞傘��
+ */
+ public boolean canProceedToNextLevel(Long instanceId, String approveType) {
+ if (instanceId == null || approveType == null) {
+ return false;
+ }
+
+ if (getRejectedCount(instanceId) > 0) {
+ return false;
+ }
+
+ int totalApproverCount = getCurrentPendingTasks(instanceId).size() + getApprovedCount(instanceId);
+ int approvedCount = getApprovedCount(instanceId);
+
+ if ("AND".equalsIgnoreCase(approveType)) {
+ return approvedCount > 0 && approvedCount == totalApproverCount;
+ }
+ if ("OR".equalsIgnoreCase(approveType)) {
+ return approvedCount > 0;
+ }
+ return false;
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鐢ㄦ埛鍦ㄥ綋鍓嶈妭鐐逛笂鐨勪换鍔$姸鎬併��
+ */
+ public String getUserTaskStatus(Long instanceId, Long userId) {
+ if (instanceId == null || userId == null) {
+ return null;
+ }
+
+ ApprovalInstanceNode currentNode = getCurrentNode(instanceId);
+ if (currentNode == null) {
+ return null;
+ }
+
+ ApprovalTask task = approvalTaskService.getOne(
+ new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getInstanceId, instanceId)
+ .eq(ApprovalTask::getNodeId, currentNode.getId())
+ .eq(ApprovalTask::getApproverId, userId)
+ .eq(ApprovalTask::getDeleted, 0)
+ .last("LIMIT 1")
+ );
+
+ return task != null ? task.getTaskStatus() : null;
+ }
+
+ /**
+ * 鏌ヨ鎸囧畾鐢ㄦ埛鐨勫叏閮ㄥ緟瀹℃壒浠诲姟銆�
+ */
+ public List<ApprovalTask> getUserAllPendingTasks(Long userId) {
+ if (userId == null) {
+ return List.of();
+ }
+
+ return approvalTaskService.list(
+ new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getApproverId, userId)
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0)
+ .orderByDesc(ApprovalTask::getCreateTime)
+ );
+ }
+
+ /**
+ * 鏌ヨ瀹℃壒瀹炰緥鐨勮繘搴︽憳瑕併��
+ */
+ public String getApprovalProgress(Long instanceId) {
+ if (instanceId == null) {
+ return "鏃犳晥鐨勫鎵瑰疄渚�";
+ }
+
+ ApprovalInstanceNode currentNode = getCurrentNode(instanceId);
+ if (currentNode == null) {
+ return "瀹℃壒宸插畬鎴愭垨灏氭湭寮�濮�";
+ }
+
+ int approvedCount = getApprovedCount(instanceId);
+ int rejectedCount = getRejectedCount(instanceId);
+ int pendingCount = getRemainingApproverCount(instanceId);
+ int totalCount = approvedCount + rejectedCount + pendingCount;
+
+ return String.format(
+ "绗�%d绾у鎵癸細鎬讳汉鏁�=%d锛屽凡鍚屾剰=%d锛屽凡鎷掔粷=%d锛屽緟瀹℃壒=%d",
+ currentNode.getLevelNo(),
+ totalCount,
+ approvedCount,
+ rejectedCount,
+ pendingCount
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 9090d34..2130007 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -148,8 +148,8 @@
* 绉佹捣瀹㈡埛娴佸洖鍏捣
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
- @PostMapping("/back")
- public R back(Long id) {
+ @PostMapping("/back/{id}")
+ public R back(@PathVariable("id") Long id) {
return R.ok(customerService.back(id));
}
}
diff --git a/src/main/java/com/ruoyi/basic/dto/ProductModelDto.java b/src/main/java/com/ruoyi/basic/dto/ProductModelDto.java
index 4a88508..15e428d 100644
--- a/src/main/java/com/ruoyi/basic/dto/ProductModelDto.java
+++ b/src/main/java/com/ruoyi/basic/dto/ProductModelDto.java
@@ -3,9 +3,11 @@
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.production.bean.dto.ProductStructureDto;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import java.util.List;
+@EqualsAndHashCode(callSuper = true)
@Data
public class ProductModelDto extends ProductModel {
private List<ProductStructureDto> productStructureList;
diff --git a/src/main/java/com/ruoyi/basic/dto/ProductModelExportDto.java b/src/main/java/com/ruoyi/basic/dto/ProductModelExportDto.java
index c8c838a..4e5688f 100644
--- a/src/main/java/com/ruoyi/basic/dto/ProductModelExportDto.java
+++ b/src/main/java/com/ruoyi/basic/dto/ProductModelExportDto.java
@@ -15,6 +15,9 @@
@Data
public class ProductModelExportDto {
+ @Excel(name = "浜у搧缂栫爜")
+ private String productCode;
+
@Excel(name = "瑙勬牸鍨嬪彿")
private String model;
diff --git a/src/main/java/com/ruoyi/basic/dto/StorageBlobVO.java b/src/main/java/com/ruoyi/basic/dto/StorageBlobVO.java
index 75eed4f..c9be475 100644
--- a/src/main/java/com/ruoyi/basic/dto/StorageBlobVO.java
+++ b/src/main/java/com/ruoyi/basic/dto/StorageBlobVO.java
@@ -10,6 +10,10 @@
*/
private String previewURL;
+
+ private String url;
+ private String name;
+
/**
* 涓嬭浇鍦板潃
*/
diff --git a/src/main/java/com/ruoyi/basic/enums/ApplicationTypeEnum.java b/src/main/java/com/ruoyi/basic/enums/ApplicationTypeEnum.java
index 8cdf321..8b069a0 100644
--- a/src/main/java/com/ruoyi/basic/enums/ApplicationTypeEnum.java
+++ b/src/main/java/com/ruoyi/basic/enums/ApplicationTypeEnum.java
@@ -5,7 +5,8 @@
FILE("file"),
AFTER_FILE("after_file"),
BEFORE_FILE("before_file"),
- APK("apk");
+ APK("apk"),
+ RAG_FILE("rag_file");
private final String type;
diff --git a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
index d7d0649..b0c01bb 100644
--- a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
+++ b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
@@ -57,11 +57,8 @@
SALES_QUOTATION("sales_quotation"),
SALES_LEDGER_PRODUCT("sales_ledger_product"),
PURCHASE_LEDGER_FILE("purchase_ledger_file"),
- RECEIPT_PAYMENT("receipt_payment"),
PAYMENT_SHIPPING("payment_shipping"),
- INVOICE_REGISTRATION_PRODUCT("invoice_registration_product"),
LOSS("loss"),
- INVOICE_REGISTRATION("invoice_registration"),
INVOICE_LEDGER_FILE("invoice_ledger_file"),
INVOICE_LEDGER("invoice_ledger"),
COMMON_FILE("common_file"),
@@ -86,15 +83,11 @@
QUALITY_INSPECT_PARAM("quality_inspect_param"),
QUALITY_INSPECT("quality_inspect"),
// Purchase
- TICKET_REGISTRATION("ticket_registration"),
PURCHASE_RETURN_ORDER_PRODUCTS("purchase_return_order_products"),
PURCHASE_RETURN_ORDERS("purchase_return_orders"),
SALES_LEDGER_PRODUCT_TEMPLATE("sales_ledger_product_template"),
PURCHASE_LEDGER("purchase_ledger"),
PURCHASE_LEDGER_TEMPLATE("purchase_ledger_template"),
- PRODUCT_RECORD("product_record"),
- PAYMENT_REGISTRATION("payment_registration"),
- INVOICE_PURCHASE("invoice_purchase"),
// Project Management
SHIPPING_ADDRESS("shipping_address"),
ROLES("roles"),
@@ -132,10 +125,6 @@
INBOUND_MANAGEMENT("inbound_management"),
// Office Supplies
OFFICE_SUPPLIES("office_supplies"),
- // OA
- OA_PROJECT_PHASE_TASK("oa_project_phase_task"),
- OA_PROJECT("oa_project"),
- OA_PROJECT_PHASE("oa_project_phase"),
// Measuring Instrument Ledger
SPARE_PARTS("spare_parts"),
MEASURING_INSTRUMENT_LEDGER_RECORD("measuring_instrument_ledger_record"),
@@ -203,12 +192,17 @@
AFTER_SALES_SERVICE_FILE("after_sales_service_file"),
AFTER_SALES_NEAR_EXPIRY("after_sales_near_expiry"),
// Account
- ACCOUNT_INCOME("account_income"),
- BORROW_INFO("borrow_info"),
SALES_REFUND_AMOUNT_ORDER("sales_refund_amount_order"),
SALES_RECEIPT_RETURN("sales_receipt_return"),
ACCOUNT_EXPENSE("account_expense"),
- ACCOUNT_FILE("account_file");
+ FIN_REIMBURSEMENT("fin_reimbursement"),
+ FIN_VOUCHER("fin_voucher"),
+ ACCOUNT_FILE("account_file"),
+ ENTERPRISE_NEWS("enterprise_news"),
+ APPROVAL_INSTANCE("approval_instance"),
+ ACCOUNT_INVOICE_APPLICATION("account_invoice_application"),
+ ACCOUNT_PURCHASE_INVOICE("account_purchase_invoice"),
+ APPROVAL_TEMPLATE("approval_template");
private final String type;
RecordTypeEnum(String type) { this.type = type; }
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
index 2605737..f871b91 100644
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
@@ -6,6 +6,8 @@
import com.ruoyi.basic.dto.CustomerDto;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.vo.CustomerVo;
+import com.ruoyi.sales.vo.CustomerTransactionsDetailsVo;
+import com.ruoyi.sales.vo.CustomerTransactionsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -13,7 +15,7 @@
/**
* 瀹㈡埛妗fMapper鎺ュ彛
- *
+ *
* @author ruoyi
* @date 2025-05-07
*/
@@ -22,7 +24,7 @@
{
/**
* 鏌ヨ瀹㈡埛妗f
- *
+ *
* @param id 瀹㈡埛妗f涓婚敭
* @return 瀹㈡埛妗f
*/
@@ -30,7 +32,7 @@
/**
* 鏌ヨ瀹㈡埛妗f鍒楄〃
- *
+ *
* @param customer 瀹㈡埛妗f
* @return 瀹㈡埛妗f闆嗗悎
*/
@@ -38,7 +40,7 @@
/**
* 鏂板瀹㈡埛妗f
- *
+ *
* @param customer 瀹㈡埛妗f
* @return 缁撴灉
*/
@@ -46,7 +48,7 @@
/**
* 淇敼瀹㈡埛妗f
- *
+ *
* @param customer 瀹㈡埛妗f
* @return 缁撴灉
*/
@@ -54,7 +56,7 @@
/**
* 鍒犻櫎瀹㈡埛妗f
- *
+ *
* @param id 瀹㈡埛妗f涓婚敭
* @return 缁撴灉
*/
@@ -62,7 +64,7 @@
/**
* 鎵归噺鍒犻櫎瀹㈡埛妗f
- *
+ *
* @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
* @return 缁撴灉
*/
@@ -71,4 +73,8 @@
IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
-}
\ No newline at end of file
+
+ IPage<CustomerTransactionsVo> customewTransactions(Page page, @Param("customerName") String customerName);
+
+ IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, @Param("customerId") Long customerId);
+}
diff --git a/src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java b/src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java
index 36876d0..b245741 100644
--- a/src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java
+++ b/src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java
@@ -5,7 +5,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.vo.ProductModelVo;
-import com.ruoyi.procurementrecord.dto.ProcurementPageDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
diff --git a/src/main/java/com/ruoyi/basic/mapper/SupplierManageMapper.java b/src/main/java/com/ruoyi/basic/mapper/SupplierManageMapper.java
index 1ba05a6..beea9c3 100644
--- a/src/main/java/com/ruoyi/basic/mapper/SupplierManageMapper.java
+++ b/src/main/java/com/ruoyi/basic/mapper/SupplierManageMapper.java
@@ -6,6 +6,8 @@
import com.ruoyi.basic.dto.SupplierManageDto;
import com.ruoyi.basic.excel.SupplierManageExcelDto;
import com.ruoyi.basic.pojo.SupplierManage;
+import com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo;
+import com.ruoyi.purchase.vo.SupplierTransactionsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -17,4 +19,8 @@
IPage<SupplierManage> supplierListPage(Page page, @Param("supplierManageDto") SupplierManageDto supplierManageDto);
List<SupplierManageExcelDto> supplierExportList(@Param("supplierManageDto") SupplierManageDto supplierManageDto);
+
+ IPage<SupplierTransactionsVo> supplierTransactions(Page page, @Param("supplierName") String supplierName);
+
+ IPage<SupplierTransactionsDetailsVo> supplierTransactionsDetails(Page page, @Param("supplierId") Long supplierId);
}
diff --git a/src/main/java/com/ruoyi/basic/pojo/ProductModel.java b/src/main/java/com/ruoyi/basic/pojo/ProductModel.java
index f0e9470..dc7201c 100644
--- a/src/main/java/com/ruoyi/basic/pojo/ProductModel.java
+++ b/src/main/java/com/ruoyi/basic/pojo/ProductModel.java
@@ -38,7 +38,6 @@
private String model;
@Excel(name = "浜у搧缂栫爜")
- @TableField("product_code")
private String productCode;
/**
@@ -46,12 +45,6 @@
*/
@Excel(name = "鍗曚綅")
private String unit;
-
- /**
- * 鐢熶骇鐐掓満
- */
- @Excel(name = "鐢熶骇鐐掓満")
- private String speculativeTradingName;
@Schema(description = "绉熸埛ID")
@TableField(fill = FieldFill.INSERT)
diff --git a/src/main/java/com/ruoyi/basic/service/ICustomerService.java b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
index b725216..27e4739 100644
--- a/src/main/java/com/ruoyi/basic/service/ICustomerService.java
+++ b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
@@ -7,6 +7,8 @@
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.vo.CustomerVo;
import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.sales.vo.CustomerTransactionsDetailsVo;
+import com.ruoyi.sales.vo.CustomerTransactionsVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -93,4 +95,20 @@
void together(CustomerDto customerDto);
Boolean back(Long id);
+
+ /**
+ * 鏌ヨ瀹㈡埛寰�鏉ュ垪琛�
+ * @param page
+ * @param customerName
+ * @return
+ */
+ IPage<CustomerTransactionsVo> customewTransactions(Page page, String customerName);
+
+ /**
+ * 鏌ヨ瀹㈡埛寰�鏉ユ槑缁嗗垪琛�
+ * @param page
+ * @param customerId
+ * @return
+ */
+ IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, Long customerId);
}
diff --git a/src/main/java/com/ruoyi/basic/service/ISupplierService.java b/src/main/java/com/ruoyi/basic/service/ISupplierService.java
index b54c2ad..ce6d832 100644
--- a/src/main/java/com/ruoyi/basic/service/ISupplierService.java
+++ b/src/main/java/com/ruoyi/basic/service/ISupplierService.java
@@ -5,10 +5,11 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.SupplierManageDto;
import com.ruoyi.basic.pojo.SupplierManage;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo;
+import com.ruoyi.purchase.vo.SupplierTransactionsVo;
+import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
-import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
public interface ISupplierService extends IService<SupplierManage> {
@@ -57,4 +58,20 @@
void supplierExport(HttpServletResponse response, SupplierManageDto supplierManageDto);
Boolean importData(MultipartFile file);
+
+ /**
+ * 渚涘簲鍟嗗線鏉�
+ * @param page
+ * @param supplierName
+ * @return
+ */
+ IPage<SupplierTransactionsVo> supplierTransactions(Page page, String supplierName);
+
+ /**
+ * 渚涘簲鍟嗗線鏉ヨ鎯�
+ * @param page
+ * @param supplierId
+ * @return
+ */
+ IPage<SupplierTransactionsDetailsVo> supplierTransactionsDetails(Page page, Long supplierId);
}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
index 52d01ec..0b0c6cd 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -21,8 +21,14 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
+import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import com.ruoyi.sales.mapper.SalesQuotationMapper;
import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.SalesQuotation;
+import com.ruoyi.sales.vo.CustomerTransactionsDetailsVo;
+import com.ruoyi.sales.vo.CustomerTransactionsVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -48,7 +54,11 @@
@Slf4j
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {
@Autowired
- private SalesLedgerMapper salesLedgerMapper;
+ private SalesLedgerMapper salesLedgerMapper;
+ @Autowired
+ private SalesQuotationMapper salesQuotationMapper;
+ @Autowired
+ private ReturnManagementMapper returnManagementMapper;
@Autowired
private CustomerMapper customerMapper;
@@ -202,6 +212,7 @@
public int updateCustomer(Customer customer) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long tenantId = loginUser.getTenantId();
+ validateCustomerEditPermission(customer.getId());
customer.setTenantId(tenantId);
return customerMapper.updateById(customer);
}
@@ -216,10 +227,24 @@
@Transactional(rollbackFor = Exception.class)
public int deleteCustomerByIds(Long[] ids) {
List<Long> idList = Arrays.asList(ids);
+ // 妫�鏌ユ槸鍚︽湁閿�鍞彴璐﹀叧鑱�
List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, idList));
if (!salesLedgers.isEmpty()) {
- throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
+ throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞彴璐︼紝璇峰厛鍒犻櫎閿�鍞彴璐�");
}
+
+ // 妫�鏌ユ槸鍚︽湁閿�鍞��璐у叧鑱�
+ List<ReturnManagement> returnManagements = returnManagementMapper.selectList(new QueryWrapper<ReturnManagement>().lambda().in(ReturnManagement::getCustomerId, idList));
+ if (!returnManagements.isEmpty()) {
+ throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞��璐э紝璇峰厛鍒犻櫎閿�鍞��璐�");
+ }
+
+ // 妫�鏌ユ槸鍚︽湁閿�鍞姤浠峰叧鑱�
+ List<SalesQuotation> salesQuotations = salesQuotationMapper.selectList(new QueryWrapper<SalesQuotation>().lambda().in(SalesQuotation::getCustomerId, idList));
+ if (!salesQuotations.isEmpty()) {
+ throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞姤浠凤紝璇峰厛鍒犻櫎閿�鍞姤浠�");
+ }
+
// 鏌ヨ鏄惁鏈夊凡鍒嗛厤鐨勫叕娴峰鎴�
List<Customer> assignedPools = customerMapper.selectList(
new QueryWrapper<Customer>().lambda()
@@ -317,6 +342,7 @@
public void recycleCustomer(CustomerDto customerDto) {
Customer customer = customerMapper.selectById(customerDto.getId());
if (customer.getType() == 1 && customer.getIsAssigned() == 1) { // 鍏捣涓斿凡鍒嗛厤
+ validatePublicSeaRecyclePermission(customer.getId());
customer.setIsAssigned(0);
customer.setUsageStatus(0L);
customer.setUsageUser(0L);
@@ -375,10 +401,58 @@
//灏嗗鎴风殑type鏀逛负1 涓旂洿鎺ュ垎閰嶇粰褰撳墠鐢ㄦ埛
Customer customer = customerMapper.selectById(id);
customer.setType(1);
- customer.setIsAssigned(1);
+ customer.setIsAssigned(0);
return this.updateById(customer);
}
+ private void validateCustomerEditPermission(Long customerId) {
+ Customer customer = customerMapper.selectById(customerId);
+ if (customer == null) {
+ throw new RuntimeException("瀹㈡埛妗f涓嶅瓨鍦�");
+ }
+ if (!hasSalesModuleReference(customerId)) {
+ return;
+ }
+ if (Objects.equals(customer.getType(), 0)) {
+ throw new RuntimeException("宸茶閿�鍞ā鍧楀紩鐢ㄧ殑绉佹捣瀹㈡埛涓嶈兘缂栬緫");
+ }
+ if (Objects.equals(customer.getType(), 1) && Objects.equals(customer.getIsAssigned(), 1)) {
+ throw new RuntimeException("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘缂栬緫");
+ }
+ }
+
+ private void validatePublicSeaRecyclePermission(Long customerId) {
+ if (hasSalesModuleReference(customerId)) {
+ throw new RuntimeException("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘鍥炴敹");
+ }
+ }
+
+ private boolean hasSalesModuleReference(Long customerId) {
+ Long salesLedgerCount = salesLedgerMapper.selectCount(new QueryWrapper<SalesLedger>().lambda()
+ .eq(SalesLedger::getCustomerId, customerId));
+ if (salesLedgerCount != null && salesLedgerCount > 0) {
+ return true;
+ }
+ Long salesQuotationCount = salesQuotationMapper.selectCount(new QueryWrapper<SalesQuotation>().lambda()
+ .eq(SalesQuotation::getCustomerId, customerId));
+ if (salesQuotationCount != null && salesQuotationCount > 0) {
+ return true;
+ }
+ Long returnManagementCount = returnManagementMapper.selectCount(new QueryWrapper<ReturnManagement>().lambda()
+ .eq(ReturnManagement::getCustomerId, customerId));
+ return returnManagementCount != null && returnManagementCount > 0;
+ }
+
+ @Override
+ public IPage<CustomerTransactionsVo> customewTransactions(Page page, String customerName) {
+ return customerMapper.customewTransactions(page, customerName);
+ }
+
+ @Override
+ public IPage<CustomerTransactionsDetailsVo> customewTransactionsDetails(Page page, Long customerId) {
+ return customerMapper.customewTransactionsDetails(page, customerId);
+ }
+
/**
* 涓嬪垝绾垮懡鍚嶈浆椹煎嘲鍛藉悕
*/
diff --git a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
index ce0ba64..be34fc0 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
@@ -18,8 +18,11 @@
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.sales.dto.LossProductModelDto;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.technology.mapper.TechnologyBomMapper;
+import com.ruoyi.technology.pojo.TechnologyBom;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -43,10 +46,16 @@
private final ProductMapper productMapper;
private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final TechnologyBomMapper technologyBomMapper;
private ProductModelMapper productModelMapper;
@Override
public int addOrEditProductModel(ProductModelDto productModelDto) {
+ String model = StringUtils.trim(productModelDto.getModel());
+ String productCode = StringUtils.trim(productModelDto.getProductCode());
+ productModelDto.setModel(model);
+ productModelDto.setProductCode(productCode);
+ checkModelAndProductCodeUnique(model, productCode, productModelDto.getId());
if (productModelDto.getId() == null) {
ProductModel productModel = new ProductModel();
@@ -54,6 +63,21 @@
return productModelMapper.insert(productModel);
} else {
return productModelMapper.updateById(productModelDto);
+ }
+ }
+
+ private void checkModelAndProductCodeUnique(String model, String productCode, Long currentId) {
+ if (StringUtils.isEmpty(model) || StringUtils.isEmpty(productCode)) {
+ return;
+ }
+ LambdaQueryWrapper<ProductModel> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(ProductModel::getModel, model)
+ .eq(ProductModel::getProductCode, productCode)
+ .ne(currentId != null, ProductModel::getId, currentId)
+ .last("limit 1");
+ ProductModel duplicateProductModel = productModelMapper.selectOne(queryWrapper);
+ if (duplicateProductModel != null) {
+ throw new ServiceException("瀵瑰簲鐨勫瀷鍙�" + model + "鐨勪骇鍝佺紪鐮�" + productCode + "宸茬粡瀛樺湪");
}
}
@@ -66,6 +90,14 @@
throw new RuntimeException("宸茬粡瀛樺湪璇ヤ骇鍝佺殑閿�鍞彴璐﹀拰閲囪喘鍙拌处");
}
+
+ // 鏄惁瀛樺湪BOM
+ List<TechnologyBom> technologyBoms = technologyBomMapper.selectList(new QueryWrapper<TechnologyBom>()
+ .lambda().in(TechnologyBom::getProductModelId, ids));
+ if (CollectionUtils.isNotEmpty(technologyBoms)) {
+ throw new RuntimeException("宸茬粡瀛樺湪璇ヤ骇鍝佺殑BOM鏁版嵁");
+ }
+
return productModelMapper.deleteBatchIds(Arrays.asList(ids));
}
@@ -121,6 +153,9 @@
ProductModel item = productModelList.get(i);
int rowNum = i + 2;
+ if (StringUtils.isEmpty(item.getProductCode())) {
+ return AjaxResult.error("绗� " + rowNum + " 琛屽鍏ュけ璐�: [浜у搧缂栫爜] 涓嶈兘涓虹┖");
+ }
if (StringUtils.isEmpty(item.getModel())) {
return AjaxResult.error("绗� " + rowNum + " 琛屽鍏ュけ璐�: [瑙勬牸鍨嬪彿] 涓嶈兘涓虹┖");
}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java
index 5a7f679..2b9eb40 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java
@@ -13,12 +13,10 @@
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.service.IProductService;
import com.ruoyi.basic.vo.ProductModelVo;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.web.domain.AjaxResult;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Arrays;
@@ -94,17 +92,18 @@
if (ObjectUtils.isEmpty(productDto.getParentId())) {
throw new IllegalArgumentException("璇烽�夋嫨鐖惰妭鐐�");
}
+ String productName = StringUtils.trim(productDto.getProductName());
+ if (StringUtils.isEmpty(productName)) {
+ throw new IllegalArgumentException("浜у搧鍚嶇О涓嶈兘涓虹┖");
+ }
+ productDto.setProductName(productName);
+ checkProductNameUnique(productDto.getParentId(), productName, productDto.getId());
if (productDto.getId() == null) {
// 鏂板浜у搧閫昏緫
- if (productDto.getParentId() == null) {
- // 鑻ユ湭鎸囧畾鐖惰妭鐐癸紝榛樿涓烘牴鑺傜偣锛坧arentId 璁句负 null锛�
- productDto.setParentId(null);
- } else {
- // 妫�鏌ョ埗鑺傜偣鏄惁瀛樺湪锛堝彲閫夛紝鏍规嵁涓氬姟闇�姹傦級
- Product parent = productMapper.selectById(productDto.getParentId());
- if (parent == null) {
- throw new IllegalArgumentException("鐖惰妭鐐逛笉瀛樺湪锛屾棤娉曟坊鍔犲瓙浜у搧");
- }
+ // 妫�鏌ョ埗鑺傜偣鏄惁瀛樺湪锛堝彲閫夛紝鏍规嵁涓氬姟闇�姹傦級
+ Product parent = productMapper.selectById(productDto.getParentId());
+ if (parent == null) {
+ throw new IllegalArgumentException("鐖惰妭鐐逛笉瀛樺湪锛屾棤娉曟坊鍔犲瓙浜у搧");
}
return productMapper.insert(productDto);
} else {
@@ -118,6 +117,18 @@
}
}
+ private void checkProductNameUnique(Long parentId, String productName, Long currentId) {
+ LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(Product::getParentId, parentId)
+ .eq(Product::getProductName, productName)
+ .ne(currentId != null, Product::getId, currentId)
+ .last("limit 1");
+ Product duplicateProduct = productMapper.selectOne(queryWrapper);
+ if (duplicateProduct != null) {
+ throw new IllegalArgumentException("瀵瑰簲鐨�" + productName + "宸茬粡瀛樺湪");
+ }
+ }
+
@Override
public int delProductByIds(Long[] ids) {
// 1. 鍒犻櫎瀛愯〃 product_model 涓叧鑱旂殑鏁版嵁
diff --git a/src/main/java/com/ruoyi/basic/service/impl/SupplierServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/SupplierServiceImpl.java
index 6adaf2a..613bde2 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/SupplierServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/SupplierServiceImpl.java
@@ -14,6 +14,8 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
import com.ruoyi.purchase.pojo.PurchaseLedger;
+import com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo;
+import com.ruoyi.purchase.vo.SupplierTransactionsVo;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
@@ -130,4 +132,14 @@
}
return false;
}
+
+ @Override
+ public IPage<SupplierTransactionsVo> supplierTransactions(Page page, String supplierName) {
+ return supplierMapper.supplierTransactions(page,supplierName);
+ }
+
+ @Override
+ public IPage<SupplierTransactionsDetailsVo> supplierTransactionsDetails(Page page, Long supplierId) {
+ return supplierMapper.supplierTransactionsDetails(page,supplierId);
+ }
}
diff --git a/src/main/java/com/ruoyi/basic/utils/FileUtil.java b/src/main/java/com/ruoyi/basic/utils/FileUtil.java
index c57468a..6ad5d77 100644
--- a/src/main/java/com/ruoyi/basic/utils/FileUtil.java
+++ b/src/main/java/com/ruoyi/basic/utils/FileUtil.java
@@ -98,8 +98,11 @@
}
// 鍒犻櫎鏃ч檮浠朵俊鎭�
- if (application == null) {
+ if (application == null || application.trim().isEmpty()) {
for (StorageBlobDTO storageBlobDTO : storageBlobDTOS) {
+ if (storageBlobDTO.getApplication() == null || storageBlobDTO.getApplication().trim().isEmpty()) {
+ throw new RuntimeException("鏂囦欢鐢ㄩ�斾笉鑳戒负绌�");
+ }
deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.getByType(storageBlobDTO.getApplication()), recordType, recordId);
}
} else {
@@ -344,6 +347,8 @@
StorageBlobVO storageBlobVO = new StorageBlobVO();
BeanUtils.copyProperties(storageBlob, storageBlobVO);
storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO));
+ storageBlobVO.setUrl(buildSignedPreviewUrl(storageBlobVO));
+ storageBlobVO.setName(storageBlob.getOriginalFilename());
storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO));
storageBlobVO.setStorageAttachmentId(blobIdToAttachmentIdMap.get(storageBlob.getId()));
storageBlobDTOS.add(storageBlobVO);
@@ -392,6 +397,8 @@
StorageBlobVO storageBlobVO = new StorageBlobVO();
BeanUtils.copyProperties(storageBlob, storageBlobVO);
storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO));
+ storageBlobVO.setUrl(buildSignedPreviewUrl(storageBlobVO));
+ storageBlobVO.setName(storageBlob.getOriginalFilename());
storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO));
storageBlobVO.setStorageAttachmentId(blobIdToAttachmentIdMap.get(storageBlob.getId()));
storageBlobDTOS.add(storageBlobVO);
@@ -417,6 +424,8 @@
StorageBlobVO storageBlobVO = new StorageBlobVO();
BeanUtils.copyProperties(storageBlob, storageBlobVO);
storageBlobVO.setPreviewURL(buildSignedPreviewUrl(storageBlobVO));
+ storageBlobVO.setUrl(buildSignedPreviewUrl(storageBlobVO));
+ storageBlobVO.setName(storageBlob.getOriginalFilename());
storageBlobVO.setDownloadURL(buildSignedDownloadUrl(storageBlobVO));
storageBlobDTOS.add(storageBlobVO);
}
diff --git a/src/main/java/com/ruoyi/basic/vo/CustomerVo.java b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
index 3d4c8cb..0f72a2f 100644
--- a/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
+++ b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
@@ -25,4 +25,9 @@
* 鍏变韩鐢ㄦ埛ID瀛楃涓诧紙SQL鏌ヨ杩斿洖锛岀敤浜庤浆鎹负List锛�
*/
private String userIdsStr;
+
+ /**
+ * 鏄惁琚攢鍞ā鍧楀紩鐢細0-鍚︼紝1-鏄�
+ */
+ private Integer salesReferenceFlag;
}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsController.java b/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsController.java
new file mode 100644
index 0000000..36f1e21
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsController.java
@@ -0,0 +1,61 @@
+package com.ruoyi.collaborativeApproval.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto;
+import com.ruoyi.collaborativeApproval.service.EnterpriseNewsService;
+import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:50:59
+ */
+@RestController
+@RequestMapping("/enterpriseNews")
+@Tag(name = "浼佷笟鏂伴椈琛�")
+@AllArgsConstructor
+public class EnterpriseNewsController {
+
+ private final EnterpriseNewsService enterpriseNewsService;
+
+ @Operation(summary = "鍒嗛〉鏌ヨ")
+ @GetMapping("/listPage")
+ @Log(title = "浼佷笟鏂伴椈鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
+ public R listPage(Page<EnterpriseNewsVo> page , EnterpriseNewsDto enterpriseNewsDto) {
+ return R.ok(enterpriseNewsService.listPage(page, enterpriseNewsDto));
+ }
+
+ @PostMapping("/save")
+ @Operation(summary = "淇濆瓨")
+ @Log(title = "淇濆瓨浼佷笟鏂伴椈", businessType = BusinessType.INSERT)
+ public R save(@RequestBody EnterpriseNewsDto enterpriseNewsDto) {
+ return R.ok(enterpriseNewsService.add(enterpriseNewsDto));
+ }
+
+ @PutMapping("/update")
+ @Operation(summary = "鏇存柊")
+ @Log(title = "鏇存柊浼佷笟鏂伴椈", businessType = BusinessType.UPDATE)
+ public R update(@RequestBody EnterpriseNewsDto enterpriseNewsDto) {
+ return R.ok(enterpriseNewsService.updateEnterpriseNewsDto(enterpriseNewsDto));
+ }
+
+ @DeleteMapping("/delete")
+ @Operation(summary = "鍒犻櫎")
+ @Log(title = "鍒犻櫎浼佷笟鏂伴椈", businessType = BusinessType.DELETE)
+ public R delete(@RequestBody List<Long> ids) {
+ return R.ok(enterpriseNewsService.delete(ids));
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeDeptController.java b/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeDeptController.java
new file mode 100644
index 0000000..8c68d1a
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeDeptController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.collaborativeApproval.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿閮ㄩ棬琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:12
+ */
+@RestController
+@RequestMapping("/enterpriseNewsScopeDept")
+public class EnterpriseNewsScopeDeptController {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeUserController.java b/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeUserController.java
new file mode 100644
index 0000000..7ceba13
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/controller/EnterpriseNewsScopeUserController.java
@@ -0,0 +1,18 @@
+package com.ruoyi.collaborativeApproval.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿鐢ㄦ埛琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:23
+ */
+@RestController
+@RequestMapping("/enterpriseNewsScopeUser")
+public class EnterpriseNewsScopeUserController {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java b/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java
index 6a3824d..dc6a64e 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java
@@ -2,6 +2,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.approve.pojo.KnowledgeBase;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
+import com.ruoyi.collaborativeApproval.dto.SealApplicationManagementDTO;
import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement;
import com.ruoyi.collaborativeApproval.service.SealApplicationManagementService;
import com.ruoyi.common.utils.SecurityUtils;
@@ -27,6 +31,7 @@
public class SealApplicationManagementController {
private SealApplicationManagementService sealApplicationManagementService;
private ISysNoticeService sysNoticeService;
+ private FileUtil fileUtil;
@GetMapping("/getList")
@Operation(summary = "鍒嗛〉鏌ヨ")
@@ -36,8 +41,13 @@
@PostMapping("/add")
@Operation(summary = "鏂板")
- public AjaxResult add(@RequestBody SealApplicationManagement sealApplicationManagement){
+ public AjaxResult add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){
sealApplicationManagementService.save(sealApplicationManagement);
+ // 5. 淇濆瓨閿�鍞彴璐﹂檮浠�
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE,
+ RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT,
+ sealApplicationManagement.getId(),
+ sealApplicationManagement.getStorageBlobDTOs());
//娑堟伅閫氱煡
sysNoticeService.simpleNoticeByUser("鐢ㄥ嵃瀹℃壒",
"鐢宠缂栧彿锛�"+sealApplicationManagement.getApplicationNum()+"\t"
@@ -49,7 +59,12 @@
@PostMapping("/update")
@Operation(summary = "淇敼")
- public AjaxResult update(@RequestBody SealApplicationManagement sealApplicationManagement){
+ public AjaxResult update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){
+ // 5. 淇濆瓨閿�鍞彴璐﹂檮浠�
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE,
+ RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT,
+ sealApplicationManagement.getId(),
+ sealApplicationManagement.getStorageBlobDTOs());
return AjaxResult.success(sealApplicationManagementService.updateById(sealApplicationManagement));
}
@@ -59,6 +74,9 @@
if (CollectionUtils.isEmpty(ids)) {
throw new RuntimeException("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
}
+ fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE,
+ RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT,
+ ids);
return AjaxResult.success(sealApplicationManagementService.removeBatchByIds(ids));
}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/dto/EnterpriseNewsDto.java b/src/main/java/com/ruoyi/collaborativeApproval/dto/EnterpriseNewsDto.java
new file mode 100644
index 0000000..108cf66
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/dto/EnterpriseNewsDto.java
@@ -0,0 +1,26 @@
+package com.ruoyi.collaborativeApproval.dto;
+
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class EnterpriseNewsDto extends EnterpriseNews {
+
+ private String createUserName;
+
+ private List<Long> deptIds;
+
+ private List<Long> userIds;
+
+ private Long templateId;
+ private String templateName;
+
+ private String createTimeStart;
+ private String createTimeEnd;
+
+ private List<StorageBlobDTO> storageBlobDTOs;
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java b/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java
index 8dc8454..7757490 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java
@@ -1,7 +1,11 @@
package com.ruoyi.collaborativeApproval.dto;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.dto.StorageBlobVO;
import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement;
import lombok.Data;
+
+import java.util.List;
@Data
public class SealApplicationManagementDTO extends SealApplicationManagement {
@@ -11,4 +15,8 @@
//瀹℃壒浜�
private String approveUserName;
+
+ private List<StorageBlobDTO> storageBlobDTOs;
+ private List<StorageBlobVO> storageBlobVOList;
+
}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsMapper.java b/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsMapper.java
new file mode 100644
index 0000000..799ae82
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsMapper.java
@@ -0,0 +1,24 @@
+package com.ruoyi.collaborativeApproval.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews;
+import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:50:59
+ */
+@Mapper
+public interface EnterpriseNewsMapper extends BaseMapper<EnterpriseNews> {
+
+ IPage<EnterpriseNewsVo> listPage(Page<EnterpriseNewsVo> page,@Param("enterpriseNewsDto") EnterpriseNewsDto enterpriseNewsDto);
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeDeptMapper.java b/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeDeptMapper.java
new file mode 100644
index 0000000..5b4639f
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeDeptMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.collaborativeApproval.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿閮ㄩ棬琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:12
+ */
+@Mapper
+public interface EnterpriseNewsScopeDeptMapper extends BaseMapper<EnterpriseNewsScopeDept> {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeUserMapper.java b/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeUserMapper.java
new file mode 100644
index 0000000..ab9a64f
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/mapper/EnterpriseNewsScopeUserMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.collaborativeApproval.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿鐢ㄦ埛琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:23
+ */
+@Mapper
+public interface EnterpriseNewsScopeUserMapper extends BaseMapper<EnterpriseNewsScopeUser> {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNews.java b/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNews.java
new file mode 100644
index 0000000..f5e001b
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNews.java
@@ -0,0 +1,88 @@
+package com.ruoyi.collaborativeApproval.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 浼佷笟鏂伴椈琛�
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:50:59
+ */
+@Getter
+@Setter
+@ToString
+@TableName("enterprise_news")
+@ApiModel(value = "EnterpriseNews瀵硅薄", description = "浼佷笟鏂伴椈琛�")
+public class EnterpriseNews implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Schema(description = "缂栧彿 ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ @Schema(description = "鏍囬 Title")
+ private String title;
+
+ @Schema(description = "鎽樿 Summary")
+ private String summary;
+
+ @Schema(description = "姝f枃 Content")
+ private String content;
+
+ @Schema(description = "鍒嗙被 Category")
+ private String category;
+
+ @Schema(description = "闃呰鑼冨洿 Read scope: all 鍏ㄥ憳, dept 閮ㄩ棬, custom 鑷畾涔�")
+ private String readScope;
+
+ @Schema(description = "鏄惁蹇呰 Required flag: 0 鍚�, 1 鏄�")
+ private Byte isRequired;
+
+ @Schema(description = "鐘舵�� Status: DRAFT 鑽夌, PENDING 寰呭鎵�, PUBLISHED 宸插彂甯�, REJECTED 椹冲洖, OFFLINE 宸蹭笅绾�")
+ private String status;
+
+ @Schema(description = "搴旇浜烘暟 Required read count")
+ private Integer requiredReadCount;
+
+ @Schema(description = "宸茶浜烘暟 Read count")
+ private Integer readCount;
+
+ @Schema(description = "鍒涘缓浜� Create user")
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ @Schema(description = "鍒涘缓鏃堕棿 Create time")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
+ private LocalDateTime createTime;
+
+ @Schema(description = "鏇存柊浜� Update user")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ @Schema(description = "鏇存柊鏃堕棿 Update time")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
+ private LocalDateTime updateTime;
+
+ @Schema(description = "閮ㄩ棬ID Dept ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeDept.java b/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeDept.java
new file mode 100644
index 0000000..97ff9de
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeDept.java
@@ -0,0 +1,59 @@
+package com.ruoyi.collaborativeApproval.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿閮ㄩ棬琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:12
+ */
+@Getter
+@Setter
+@ToString
+@TableName("enterprise_news_scope_dept")
+@ApiModel(value = "EnterpriseNewsScopeDept瀵硅薄", description = "浼佷笟鏂伴椈闃呰鑼冨洿閮ㄩ棬琛�")
+public class EnterpriseNewsScopeDept implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 缂栧彿
+ */
+ @ApiModelProperty("缂栧彿")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 浼佷笟鏂伴椈ID
+ */
+ @ApiModelProperty("浼佷笟鏂伴椈ID")
+ private Long newsId;
+
+ /**
+ * 閮ㄩ棬ID
+ */
+ @ApiModelProperty("閮ㄩ棬ID")
+ private Long deptId;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeUser.java b/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeUser.java
new file mode 100644
index 0000000..9d43df2
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/pojo/EnterpriseNewsScopeUser.java
@@ -0,0 +1,59 @@
+package com.ruoyi.collaborativeApproval.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿鐢ㄦ埛琛�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:23
+ */
+@Getter
+@Setter
+@ToString
+@TableName("enterprise_news_scope_user")
+@ApiModel(value = "EnterpriseNewsScopeUser瀵硅薄", description = "浼佷笟鏂伴椈闃呰鑼冨洿鐢ㄦ埛琛�")
+public class EnterpriseNewsScopeUser implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 缂栧彿
+ */
+ @ApiModelProperty("缂栧彿")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 浼佷笟鏂伴椈ID
+ */
+ @ApiModelProperty("浼佷笟鏂伴椈ID")
+ private Long newsId;
+
+ /**
+ * 鐢ㄦ埛ID
+ */
+ @ApiModelProperty("鐢ㄦ埛ID")
+ private Long userId;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @ApiModelProperty("鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeDeptService.java b/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeDeptService.java
new file mode 100644
index 0000000..b41a7d8
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeDeptService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.collaborativeApproval.service;
+
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿閮ㄩ棬琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:12
+ */
+public interface EnterpriseNewsScopeDeptService extends IService<EnterpriseNewsScopeDept> {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeUserService.java b/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeUserService.java
new file mode 100644
index 0000000..28ac6c7
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsScopeUserService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.collaborativeApproval.service;
+
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿鐢ㄦ埛琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:23
+ */
+public interface EnterpriseNewsScopeUserService extends IService<EnterpriseNewsScopeUser> {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsService.java b/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsService.java
new file mode 100644
index 0000000..21e7e6c
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/EnterpriseNewsService.java
@@ -0,0 +1,29 @@
+package com.ruoyi.collaborativeApproval.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:50:59
+ */
+public interface EnterpriseNewsService extends IService<EnterpriseNews> {
+
+ IPage<EnterpriseNewsVo> listPage(Page<EnterpriseNewsVo> page, EnterpriseNewsDto enterpriseNewsDto);
+
+ Boolean add(EnterpriseNewsDto enterpriseNewsDto);
+
+ Boolean updateEnterpriseNewsDto(EnterpriseNewsDto enterpriseNewsDto);
+
+ Boolean delete(List<Long> ids);
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeDeptServiceImpl.java b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeDeptServiceImpl.java
new file mode 100644
index 0000000..22283c7
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeDeptServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.collaborativeApproval.service.impl;
+
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept;
+import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeDeptMapper;
+import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeDeptService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿閮ㄩ棬琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:12
+ */
+@Service
+public class EnterpriseNewsScopeDeptServiceImpl extends ServiceImpl<EnterpriseNewsScopeDeptMapper, EnterpriseNewsScopeDept> implements EnterpriseNewsScopeDeptService {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeUserServiceImpl.java b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeUserServiceImpl.java
new file mode 100644
index 0000000..db1521e
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsScopeUserServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.collaborativeApproval.service.impl;
+
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser;
+import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeUserMapper;
+import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 浼佷笟鏂伴椈闃呰鑼冨洿鐢ㄦ埛琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:51:23
+ */
+@Service
+public class EnterpriseNewsScopeUserServiceImpl extends ServiceImpl<EnterpriseNewsScopeUserMapper, EnterpriseNewsScopeUser> implements EnterpriseNewsScopeUserService {
+
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsServiceImpl.java b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsServiceImpl.java
new file mode 100644
index 0000000..daa1c89
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/EnterpriseNewsServiceImpl.java
@@ -0,0 +1,409 @@
+package com.ruoyi.collaborativeApproval.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.approve.mapper.ApprovalInstanceMapper;
+import com.ruoyi.approve.mapper.ApprovalTemplateMapper;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalTask;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import com.ruoyi.approve.service.ApprovalInstanceService;
+import com.ruoyi.approve.utils.ApproveProcessConfigNodeUtils;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
+import com.ruoyi.collaborativeApproval.dto.EnterpriseNewsDto;
+import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsMapper;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser;
+import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeDeptService;
+import com.ruoyi.collaborativeApproval.service.EnterpriseNewsScopeUserService;
+import com.ruoyi.collaborativeApproval.service.EnterpriseNewsService;
+import com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo;
+import com.ruoyi.common.enums.TypeEnums;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.mapper.SysDeptMapper;
+import com.ruoyi.project.system.mapper.SysUserDeptMapper;
+import com.ruoyi.project.system.mapper.SysUserMapper;
+import com.ruoyi.project.system.service.ISysNoticeService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * 浼佷笟鏂伴椈琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-20 11:50:59
+ */
+@Service
+@RequiredArgsConstructor
+public class EnterpriseNewsServiceImpl extends ServiceImpl<EnterpriseNewsMapper, EnterpriseNews> implements EnterpriseNewsService {
+
+ private static final String READ_SCOPE_ALL = "all";
+ private static final String READ_SCOPE_DEPT = "dept";
+ private static final String READ_SCOPE_CUSTOM = "custom";
+
+ private static final String STATUS_DRAFT = "DRAFT";
+ private static final String STATUS_PENDING = "PENDING";
+ private static final String STATUS_PUBLISHED = "PUBLISHED";
+ private static final String STATUS_REJECTED = "REJECTED";
+ private static final String STATUS_OFFLINE = "OFFLINE";
+
+ private final EnterpriseNewsMapper enterpriseNewsMapper;
+ private final EnterpriseNewsScopeDeptService enterpriseNewsScopeDeptService;
+ private final EnterpriseNewsScopeUserService enterpriseNewsScopeUserService;
+ private final SysUserMapper sysUserMapper;
+ private final SysDeptMapper sysDeptMapper;
+ private final SysUserDeptMapper sysUserDeptMapper;
+ private final ApprovalInstanceMapper approvalInstanceMapper;
+ private final ApprovalInstanceService approvalInstanceService;
+ private final ApprovalTemplateMapper approvalTemplateMapper;
+ private final ApproveProcessConfigNodeUtils approveProcessConfigNodeUtils;
+ private final ISysNoticeService sysNoticeService;
+ private final FileUtil fileUtil;
+
+ @Override
+ public IPage<EnterpriseNewsVo> listPage(Page<EnterpriseNewsVo> page, EnterpriseNewsDto enterpriseNewsDto) {
+ IPage<EnterpriseNewsVo> enterpriseNewsVoIPage = enterpriseNewsMapper.listPage(page, enterpriseNewsDto);
+ enterpriseNewsVoIPage.getRecords().forEach(enterpriseNewsVo -> {
+ enterpriseNewsVo.setStorageBlobDTOs(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.ENTERPRISE_NEWS, enterpriseNewsVo.getId()));
+ });
+ return enterpriseNewsVoIPage;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean add(EnterpriseNewsDto enterpriseNewsDto) {
+ validateForSave(enterpriseNewsDto);
+ String readScope = normalizeReadScope(enterpriseNewsDto.getReadScope());
+ List<Long> deptIds = distinctIds(enterpriseNewsDto.getDeptIds());
+ List<Long> userIds = distinctIds(enterpriseNewsDto.getUserIds());
+
+ EnterpriseNews enterpriseNews = new EnterpriseNews();
+ BeanUtils.copyProperties(enterpriseNewsDto, enterpriseNews);
+ enterpriseNews.setReadScope(readScope);
+ enterpriseNews.setIsRequired(enterpriseNewsDto.getIsRequired() == null ? (byte) 0 : enterpriseNewsDto.getIsRequired());
+ enterpriseNews.setStatus(normalizeStatus(enterpriseNewsDto.getStatus(), STATUS_DRAFT));
+ enterpriseNews.setReadCount(0);
+ enterpriseNews.setRequiredReadCount(calculateRequiredReadCount(readScope, deptIds, userIds));
+
+ Long[] loginDeptIds = SecurityUtils.getDeptId();
+ if (StringUtils.isNotEmpty(loginDeptIds)) {
+ enterpriseNews.setDeptId(loginDeptIds[0]);
+ }
+
+ if (!save(enterpriseNews) || enterpriseNews.getId() == null) {
+ throw new ServiceException("鏂板浼佷笟鏂伴椈澶辫触");
+ }
+
+ saveReadScopeRelations(enterpriseNews.getId(), readScope, deptIds, userIds);
+ if (STATUS_PENDING.equals(enterpriseNews.getStatus())) {
+ startEnterpriseNewsApproval(enterpriseNews, enterpriseNewsDto);
+ }
+ //娣诲姞闄勪欢
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.ENTERPRISE_NEWS, enterpriseNews.getId(), enterpriseNewsDto.getStorageBlobDTOs());
+ return true;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean updateEnterpriseNewsDto(EnterpriseNewsDto enterpriseNewsDto) {
+ if (enterpriseNewsDto == null || enterpriseNewsDto.getId() == null) {
+ throw new ServiceException("浼佷笟鏂伴椈ID涓嶈兘涓虹┖");
+ }
+
+ EnterpriseNews oldEnterpriseNews = getById(enterpriseNewsDto.getId());
+ if (oldEnterpriseNews == null) {
+ throw new ServiceException("浼佷笟鏂伴椈涓嶅瓨鍦�");
+ }
+ if (!STATUS_DRAFT.equals(oldEnterpriseNews.getStatus())
+ && !STATUS_REJECTED.equals(oldEnterpriseNews.getStatus())) {
+ throw new ServiceException("寰呭鎵规垨宸插彂甯冪殑浼佷笟鏂伴椈涓嶅厑璁镐慨鏀�");
+ }
+
+ validateForSave(enterpriseNewsDto);
+ String readScope = normalizeReadScope(enterpriseNewsDto.getReadScope());
+ List<Long> deptIds = distinctIds(enterpriseNewsDto.getDeptIds());
+ List<Long> userIds = distinctIds(enterpriseNewsDto.getUserIds());
+
+ EnterpriseNews enterpriseNews = new EnterpriseNews();
+ BeanUtils.copyProperties(enterpriseNewsDto, enterpriseNews);
+ enterpriseNews.setReadScope(readScope);
+ enterpriseNews.setIsRequired(enterpriseNewsDto.getIsRequired() == null ? oldEnterpriseNews.getIsRequired() : enterpriseNewsDto.getIsRequired());
+ enterpriseNews.setStatus(normalizeStatus(enterpriseNewsDto.getStatus(), oldEnterpriseNews.getStatus()));
+ enterpriseNews.setReadCount(oldEnterpriseNews.getReadCount());
+ enterpriseNews.setRequiredReadCount(calculateRequiredReadCount(readScope, deptIds, userIds));
+ enterpriseNews.setCreateUser(oldEnterpriseNews.getCreateUser());
+ enterpriseNews.setCreateTime(oldEnterpriseNews.getCreateTime());
+ enterpriseNews.setDeptId(oldEnterpriseNews.getDeptId());
+
+ if (!updateById(enterpriseNews)) {
+ throw new ServiceException("淇敼浼佷笟鏂伴椈澶辫触");
+ }
+
+ clearReadScopeRelations(enterpriseNews.getId());
+ saveReadScopeRelations(enterpriseNews.getId(), readScope, deptIds, userIds);
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.ENTERPRISE_NEWS, enterpriseNews.getId(), enterpriseNewsDto.getStorageBlobDTOs());
+ if (STATUS_PENDING.equals(enterpriseNews.getStatus())) {
+ resetEnterpriseNewsApprovalFlow(oldEnterpriseNews);
+ startEnterpriseNewsApproval(enterpriseNews, enterpriseNewsDto);
+ }
+ return true;
+ }
+
+ @Override
+ public Boolean delete(List<Long> ids) {
+ if (ids == null || ids.isEmpty()) {
+ return false;
+ }
+ if (!removeByIds(ids)) {
+ throw new ServiceException("鍒犻櫎浼佷笟鏂伴椈澶辫触");
+ }
+ ids.forEach(this::clearReadScopeRelations);
+ return true;
+ }
+
+ private void validateForSave(EnterpriseNewsDto enterpriseNewsDto) {
+ if (enterpriseNewsDto == null) {
+ throw new ServiceException("浼佷笟鏂伴椈鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(enterpriseNewsDto.getTitle())) {
+ throw new ServiceException("鏍囬涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(enterpriseNewsDto.getContent())) {
+ throw new ServiceException("姝f枃涓嶈兘涓虹┖");
+ }
+
+ normalizeStatus(enterpriseNewsDto.getStatus(), STATUS_DRAFT);
+ String readScope = normalizeReadScope(enterpriseNewsDto.getReadScope());
+ List<Long> deptIds = distinctIds(enterpriseNewsDto.getDeptIds());
+ List<Long> userIds = distinctIds(enterpriseNewsDto.getUserIds());
+
+ if (READ_SCOPE_DEPT.equals(readScope) && StringUtils.isEmpty(deptIds)) {
+ throw new ServiceException("璇烽�夋嫨闃呰鑼冨洿閮ㄩ棬");
+ }
+ if (READ_SCOPE_CUSTOM.equals(readScope) && StringUtils.isEmpty(userIds)) {
+ throw new ServiceException("璇烽�夋嫨鑷畾涔夐槄璇讳汉鍛�");
+ }
+
+ validateDeptIds(deptIds);
+ validateUserIds(userIds);
+ }
+
+ private String normalizeReadScope(String readScope) {
+ String normalized = StringUtils.isEmpty(readScope) ? READ_SCOPE_ALL : readScope.trim();
+ if (!READ_SCOPE_ALL.equals(normalized)
+ && !READ_SCOPE_DEPT.equals(normalized)
+ && !READ_SCOPE_CUSTOM.equals(normalized)) {
+ throw new ServiceException("闃呰鑼冨洿涓嶅悎娉�");
+ }
+ return normalized;
+ }
+
+ private String normalizeStatus(String status, String defaultStatus) {
+ String normalized = StringUtils.isEmpty(status) ? defaultStatus : status.trim().toUpperCase();
+ if (!STATUS_DRAFT.equals(normalized)
+ && !STATUS_PENDING.equals(normalized)
+ && !STATUS_PUBLISHED.equals(normalized)
+ && !STATUS_REJECTED.equals(normalized)
+ && !STATUS_OFFLINE.equals(normalized)) {
+ throw new ServiceException("浼佷笟鏂伴椈鐘舵�佷笉鍚堟硶");
+ }
+ return normalized;
+ }
+
+ private void validateDeptIds(List<Long> deptIds) {
+ if (StringUtils.isEmpty(deptIds)) {
+ return;
+ }
+ for (Long deptId : deptIds) {
+ SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
+ if (deptId == null || sysDept == null) {
+ throw new ServiceException("闃呰鑼冨洿閮ㄩ棬涓嶅瓨鍦�");
+ }
+ }
+ }
+
+ private void validateUserIds(List<Long> userIds) {
+ if (StringUtils.isEmpty(userIds)) {
+ return;
+ }
+ List<SysUser> users = sysUserMapper.selectUsersByIds(userIds);
+ if (users.size() != userIds.size()) {
+ throw new ServiceException("鑷畾涔夐槄璇讳汉鍛樺寘鍚棤鏁堢敤鎴�");
+ }
+ }
+
+ private Integer calculateRequiredReadCount(String readScope, List<Long> deptIds, List<Long> userIds) {
+ if (READ_SCOPE_ALL.equals(readScope)) {
+ Long count = sysUserMapper.selectCount(new LambdaQueryWrapper<SysUser>()
+ .eq(SysUser::getDelFlag, "0"));
+ return count == null ? 0 : count.intValue();
+ }
+ if (READ_SCOPE_DEPT.equals(readScope)) {
+ List<Long> allDeptIds = collectDeptIdsWithChildren(deptIds);
+ if (StringUtils.isEmpty(allDeptIds)) {
+ return 0;
+ }
+ Long count = sysUserDeptMapper.countDistinctUserIdsByDeptIds(allDeptIds);
+ return count == null ? 0 : count.intValue();
+ }
+ return userIds.size();
+ }
+
+ private List<Long> collectDeptIdsWithChildren(List<Long> deptIds) {
+ Set<Long> allDeptIds = new LinkedHashSet<>();
+ for (Long deptId : deptIds) {
+ if (deptId == null) {
+ continue;
+ }
+ allDeptIds.add(deptId);
+ List<SysDept> children = sysDeptMapper.selectChildrenDeptById(deptId);
+ if (StringUtils.isNotEmpty(children)) {
+ for (SysDept child : children) {
+ allDeptIds.add(child.getDeptId());
+ }
+ }
+ }
+ return new ArrayList<>(allDeptIds);
+ }
+
+ private void saveReadScopeRelations(Long newsId, String readScope, List<Long> deptIds, List<Long> userIds) {
+ if (READ_SCOPE_DEPT.equals(readScope)) {
+ List<EnterpriseNewsScopeDept> scopeDeptList = new ArrayList<>();
+ for (Long deptId : deptIds) {
+ EnterpriseNewsScopeDept scopeDept = new EnterpriseNewsScopeDept();
+ scopeDept.setNewsId(newsId);
+ scopeDept.setDeptId(deptId);
+ scopeDeptList.add(scopeDept);
+ }
+ if (StringUtils.isNotEmpty(scopeDeptList)) {
+ enterpriseNewsScopeDeptService.saveBatch(scopeDeptList);
+ }
+ return;
+ }
+
+ if (READ_SCOPE_CUSTOM.equals(readScope)) {
+ List<EnterpriseNewsScopeUser> scopeUserList = new ArrayList<>();
+ for (Long userId : userIds) {
+ EnterpriseNewsScopeUser scopeUser = new EnterpriseNewsScopeUser();
+ scopeUser.setNewsId(newsId);
+ scopeUser.setUserId(userId);
+ scopeUserList.add(scopeUser);
+ }
+ if (StringUtils.isNotEmpty(scopeUserList)) {
+ enterpriseNewsScopeUserService.saveBatch(scopeUserList);
+ }
+ }
+ }
+
+ private void clearReadScopeRelations(Long newsId) {
+ enterpriseNewsScopeDeptService.remove(new LambdaQueryWrapper<EnterpriseNewsScopeDept>()
+ .eq(EnterpriseNewsScopeDept::getNewsId, newsId));
+ enterpriseNewsScopeUserService.remove(new LambdaQueryWrapper<EnterpriseNewsScopeUser>()
+ .eq(EnterpriseNewsScopeUser::getNewsId, newsId));
+ }
+
+ private void resetEnterpriseNewsApprovalFlow(EnterpriseNews oldEnterpriseNews) {
+ if (oldEnterpriseNews == null || !STATUS_DRAFT.equals(oldEnterpriseNews.getStatus())) {
+ return;
+ }
+ List<Long> approvalInstanceIds = approvalInstanceMapper.selectList(new LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getBusinessId, oldEnterpriseNews.getId())
+ .eq(ApprovalInstance::getBusinessType, TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode())
+ .eq(ApprovalInstance::getDeleted, (byte) 0))
+ .stream()
+ .map(ApprovalInstance::getId)
+ .filter(id -> id != null && id > 0)
+ .collect(Collectors.toList());
+ if (StringUtils.isEmpty(approvalInstanceIds)) {
+ return;
+ }
+ approvalInstanceService.delete(approvalInstanceIds);
+ }
+
+ private List<Long> distinctIds(List<Long> ids) {
+ if (StringUtils.isEmpty(ids)) {
+ return new ArrayList<>();
+ }
+ Set<Long> distinctSet = new LinkedHashSet<>();
+ for (Long id : ids) {
+ if (id != null) {
+ distinctSet.add(id);
+ }
+ }
+ return new ArrayList<>(distinctSet);
+ }
+
+ private void startEnterpriseNewsApproval(EnterpriseNews enterpriseNews, EnterpriseNewsDto enterpriseNewsDto) {
+ if (enterpriseNewsDto.getTemplateId() == null) {
+ throw new ServiceException("瀹℃壒妯℃澘涓嶈兘涓虹┖");
+ }
+
+ String templateName = enterpriseNewsDto.getTemplateName();
+ if (StringUtils.isEmpty(templateName)) {
+ ApprovalTemplate approvalTemplate = approvalTemplateMapper.selectById(enterpriseNewsDto.getTemplateId());
+ if (approvalTemplate == null) {
+ throw new ServiceException("瀹℃壒妯℃澘涓嶅瓨鍦�");
+ }
+ templateName = approvalTemplate.getTemplateName();
+ }
+
+ ApprovalInstance approvalInstance = new ApprovalInstance();
+ approvalInstance.setInstanceNo(OrderUtils.countTodayByCreateTime(approvalInstanceMapper, "SP", "instance_no", enterpriseNews.getCreateTime() != null ? enterpriseNews.getCreateTime() : LocalDateTime.now()));
+ approvalInstance.setTemplateId(enterpriseNewsDto.getTemplateId());
+ approvalInstance.setTemplateName(templateName);
+ approvalInstance.setBusinessId(enterpriseNews.getId());
+ approvalInstance.setBusinessType(TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode());
+ approvalInstance.setTitle(enterpriseNews.getTitle());
+ approvalInstance.setStatus("PENDING");
+ approvalInstance.setCurrentLevel(1);
+ approvalInstance.setApplicantId(SecurityUtils.getUserId());
+ approvalInstance.setApplicantName(SecurityUtils.getLoginUser().getNickName());
+ approvalInstance.setApplyTime(LocalDateTime.now());
+ approvalInstance.setDeleted((byte) 0);
+ approvalInstance.setCreateUser(SecurityUtils.getUserId());
+ approvalInstance.setUpdateUser(SecurityUtils.getUserId());
+ approvalInstance.setDeptId(enterpriseNews.getDeptId());
+ approvalInstanceMapper.insert(approvalInstance);
+
+ approveProcessConfigNodeUtils.createCurrentNodeAndTasks(approvalInstance);
+ sendApproveNotice(approvalInstance, approveProcessConfigNodeUtils.getCurrentPendingTasks(approvalInstance.getId()));
+ }
+
+ private void sendApproveNotice(ApprovalInstance instance, List<ApprovalTask> tasks) {
+ if (instance == null || tasks == null || tasks.isEmpty()) {
+ return;
+ }
+ List<Long> approverIds = tasks.stream()
+ .map(ApprovalTask::getApproverId)
+ .filter(id -> id != null && id > 0)
+ .distinct()
+ .collect(Collectors.toList());
+ if (approverIds.isEmpty()) {
+ return;
+ }
+
+ String title = StringUtils.isNotEmpty(instance.getTemplateName()) ? instance.getTemplateName() : "瀹℃壒鎻愰啋";
+ String message = "瀹℃壒鍗曞彿 " + instance.getInstanceNo() + " 闇�瑕佹偍瀹℃壒";
+ String jumpPath = "/collaborativeApproval/approve-list/?id=" + instance.getId();
+ sysNoticeService.simpleNoticeByUser(title, message, approverIds, jumpPath);
+ }
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/MeetingServiceImpl.java b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/MeetingServiceImpl.java
index 636130a..baa8d02 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/MeetingServiceImpl.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/MeetingServiceImpl.java
@@ -238,9 +238,9 @@
.or()
.eq(MeetApplication::getApplicationType, "notification");
});
- if (Objects.nonNull(vo.getMeetingDate())) {
+ if (Objects.nonNull(vo.getDate())) {
alWrapper.and(wrapper -> {
- wrapper.eq(MeetApplication::getMeetingDate, vo.getMeetingDate());
+ wrapper.eq(MeetApplication::getMeetingDate, vo.getDate());
});
}
alWrapper.orderByAsc(MeetApplication::getStartTime);
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java
index d63f2d2..ba20ae2 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.collaborativeApproval.dto.SealApplicationManagementDTO;
import com.ruoyi.collaborativeApproval.mapper.SealApplicationManagementMapper;
import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement;
@@ -14,9 +16,14 @@
@RequiredArgsConstructor
public class SealApplicationManagementServiceImpl extends ServiceImpl<SealApplicationManagementMapper, SealApplicationManagement> implements SealApplicationManagementService {
private final SealApplicationManagementMapper sealApplicationManagementMapper;
+ private final FileUtil fileUtil;
@Override
public IPage<SealApplicationManagementDTO> listPage(Page page, SealApplicationManagement sealApplicationManagement) {
- return sealApplicationManagementMapper.listPage(page, sealApplicationManagement);
+ IPage<SealApplicationManagementDTO> sealApplicationManagementDTOIPage = sealApplicationManagementMapper.listPage(page, sealApplicationManagement);
+ sealApplicationManagementDTOIPage.getRecords().forEach(item -> {
+ item.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, item.getId()));
+ });
+ return sealApplicationManagementDTOIPage;
}
}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/vo/EnterpriseNewsVo.java b/src/main/java/com/ruoyi/collaborativeApproval/vo/EnterpriseNewsVo.java
new file mode 100644
index 0000000..66123b9
--- /dev/null
+++ b/src/main/java/com/ruoyi/collaborativeApproval/vo/EnterpriseNewsVo.java
@@ -0,0 +1,15 @@
+package com.ruoyi.collaborativeApproval.vo;
+
+import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class EnterpriseNewsVo extends EnterpriseNews {
+
+ private String createUserName;
+
+ private List<StorageBlobVO> storageBlobDTOs;
+}
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingUseVo.java b/src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingUseVo.java
index a782b19..6676876 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingUseVo.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/vo/SearchMeetingUseVo.java
@@ -16,4 +16,6 @@
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date meetingDate;
+
+ private String date;
}
diff --git a/src/main/java/com/ruoyi/common/enums/ApprovalStatusEnum.java b/src/main/java/com/ruoyi/common/enums/ApprovalStatusEnum.java
new file mode 100644
index 0000000..8913ebd
--- /dev/null
+++ b/src/main/java/com/ruoyi/common/enums/ApprovalStatusEnum.java
@@ -0,0 +1,49 @@
+package com.ruoyi.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 瀹℃壒鐘舵�佹灇涓�
+ */
+@Getter
+@AllArgsConstructor
+public enum ApprovalStatusEnum implements BaseEnum<Integer> {
+
+ DRAFT(0, "鑽夌"),
+ PENDING(1, "寰呭鎵�"),
+ IN_PROGRESS(2, "瀹℃壒涓�"),
+ APPROVED(3, "宸查�氳繃"),
+ REJECTED(4, "宸查┏鍥�");
+
+
+ private final Integer value;
+ private final String label;
+
+ @Override
+ public Integer getCode() {
+ return value;
+ }
+
+ @Override
+ public String getValue() {
+ return label;
+ }
+
+ public static ApprovalStatusEnum fromValue(Integer value) {
+ if (value == null) {
+ return null;
+ }
+ for (ApprovalStatusEnum status : values()) {
+ if (status.getCode().equals(value)) {
+ return status;
+ }
+ }
+ return null;
+ }
+
+ public static String getLabelByValue(Integer value) {
+ ApprovalStatusEnum statusEnum = fromValue(value);
+ return statusEnum != null ? statusEnum.getValue() : "鏈煡鐘舵��";
+ }
+}
diff --git a/src/main/java/com/ruoyi/common/enums/EnterpriseNewsStatusEnum.java b/src/main/java/com/ruoyi/common/enums/EnterpriseNewsStatusEnum.java
new file mode 100644
index 0000000..8e6e480
--- /dev/null
+++ b/src/main/java/com/ruoyi/common/enums/EnterpriseNewsStatusEnum.java
@@ -0,0 +1,143 @@
+package com.ruoyi.common.enums;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+
+/**
+ * 浼佷笟鏂伴椈鐘舵�佹灇涓剧被
+ *
+ * @author ruoyi
+ * @date 2026-05-20
+ */
+@Schema(description = "浼佷笟鏂伴椈鐘舵�佹灇涓�")
+public enum EnterpriseNewsStatusEnum implements BaseEnum<String> {
+
+ /**
+ * 鑽夌
+ */
+ @Schema(description = "鑽夌")
+ DRAFT("DRAFT", "鑽夌"),
+
+ /**
+ * 寰呭鎵�
+ */
+ @Schema(description = "寰呭鎵�")
+ PENDING("PENDING", "寰呭鎵�"),
+
+ /**
+ * 宸插彂甯�
+ */
+ @Schema(description = "宸插彂甯�")
+ PUBLISHED("PUBLISHED", "宸插彂甯�"),
+
+ /**
+ * 椹冲洖
+ */
+ @Schema(description = "椹冲洖")
+ REJECTED("REJECTED", "椹冲洖"),
+
+ /**
+ * 宸蹭笅绾�
+ */
+ @Schema(description = "宸蹭笅绾�")
+ OFFLINE("OFFLINE", "宸蹭笅绾�");
+
+ /**
+ * 鐘舵�佺爜
+ */
+ private final String code;
+
+ /**
+ * 鐘舵�佹弿杩�
+ * -- GETTER --
+ * 鑾峰彇鐘舵�佹弿杩�
+ *
+ * @return 鐘舵�佹弿杩�
+
+ */
+ @Getter
+ private final String description;
+
+ EnterpriseNewsStatusEnum(String code, String description) {
+ this.code = code;
+ this.description = description;
+ }
+
+ /**
+ * 鑾峰彇鐘舵�佺爜
+ *
+ * @return 鐘舵�佺爜
+ */
+ @JsonValue
+ public String getCode() {
+ return code;
+ }
+
+ @Override
+ public String getValue() {
+ return "";
+ }
+
+ /**
+ * 鏍规嵁鐘舵�佺爜鑾峰彇鏋氫妇
+ *
+ * @param code 鐘舵�佺爜
+ * @return 鏋氫妇鍊�
+ */
+ @JsonCreator
+ public static EnterpriseNewsStatusEnum getByCode(String code) {
+ for (EnterpriseNewsStatusEnum status : values()) {
+ if (status.code.equals(code)) {
+ return status;
+ }
+ }
+ throw new IllegalArgumentException("Invalid enterprise news status code: " + code);
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁涓鸿崏绋跨姸鎬�
+ *
+ * @return 鏄惁涓鸿崏绋跨姸鎬�
+ */
+ public boolean isDraft() {
+ return DRAFT.equals(this);
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁涓哄緟瀹℃壒鐘舵��
+ *
+ * @return 鏄惁涓哄緟瀹℃壒鐘舵��
+ */
+ public boolean isPending() {
+ return PENDING.equals(this);
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁涓哄凡鍙戝竷鐘舵��
+ *
+ * @return 鏄惁涓哄凡鍙戝竷鐘舵��
+ */
+ public boolean isPublished() {
+ return PUBLISHED.equals(this);
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁涓洪┏鍥炵姸鎬�
+ *
+ * @return 鏄惁涓洪┏鍥炵姸鎬�
+ */
+ public boolean isRejected() {
+ return REJECTED.equals(this);
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁涓哄凡涓嬬嚎鐘舵��
+ *
+ * @return 鏄惁涓哄凡涓嬬嚎鐘舵��
+ */
+ public boolean isOffline() {
+ return OFFLINE.equals(this);
+ }
+}
diff --git a/src/main/java/com/ruoyi/common/enums/SalesQuotationStatusEnum.java b/src/main/java/com/ruoyi/common/enums/SalesQuotationStatusEnum.java
new file mode 100644
index 0000000..0789c26
--- /dev/null
+++ b/src/main/java/com/ruoyi/common/enums/SalesQuotationStatusEnum.java
@@ -0,0 +1,43 @@
+package com.ruoyi.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 閿�鍞姤浠风姸鎬佹灇涓�
+ */
+@Getter
+@AllArgsConstructor
+public enum SalesQuotationStatusEnum implements BaseEnum<String> {
+
+ DRAFT("鑽夌", "鑽夌"),
+ PENDING("寰呭鎵�", "寰呭鎵�"),
+ IN_PROGRESS("瀹℃牳涓�", "瀹℃牳涓�"),
+ APPROVED("閫氳繃", "閫氳繃"),
+ REJECTED("鎷掔粷", "鎷掔粷");
+
+ private final String value;
+ private final String label;
+
+ @Override
+ public String getCode() {
+ return value;
+ }
+
+ @Override
+ public String getValue() {
+ return label;
+ }
+
+ public static SalesQuotationStatusEnum fromValue(String value) {
+ if (value == null) {
+ return null;
+ }
+ for (SalesQuotationStatusEnum status : values()) {
+ if (status.getCode().equals(value)) {
+ return status;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/com/ruoyi/common/enums/ShippingStatusEnum.java b/src/main/java/com/ruoyi/common/enums/ShippingStatusEnum.java
new file mode 100644
index 0000000..e8155f2
--- /dev/null
+++ b/src/main/java/com/ruoyi/common/enums/ShippingStatusEnum.java
@@ -0,0 +1,42 @@
+package com.ruoyi.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 鍙戣揣瀹℃壒鐘舵�佹灇涓�
+ */
+@Getter
+@AllArgsConstructor
+public enum ShippingStatusEnum implements BaseEnum<String> {
+
+ PENDING("寰呯‘璁�", "寰呯‘璁�"),
+ IN_PROGRESS("瀹℃牳涓�", "瀹℃牳涓�"),
+ APPROVED("瀹℃牳閫氳繃", "瀹℃牳閫氳繃"),
+ REJECTED("瀹℃牳鎷掔粷", "瀹℃牳鎷掔粷");
+
+ private final String value;
+ private final String label;
+
+ @Override
+ public String getCode() {
+ return value;
+ }
+
+ @Override
+ public String getValue() {
+ return label;
+ }
+
+ public static ShippingStatusEnum fromValue(String value) {
+ if (value == null) {
+ return null;
+ }
+ for (ShippingStatusEnum status : values()) {
+ if (status.getCode().equals(value)) {
+ return status;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/com/ruoyi/common/enums/StockInQualifiedRecordTypeEnum.java b/src/main/java/com/ruoyi/common/enums/StockInQualifiedRecordTypeEnum.java
index 367710b..7c149bc 100644
--- a/src/main/java/com/ruoyi/common/enums/StockInQualifiedRecordTypeEnum.java
+++ b/src/main/java/com/ruoyi/common/enums/StockInQualifiedRecordTypeEnum.java
@@ -2,29 +2,24 @@
import lombok.Getter;
-
+//鍏ュ簱鏋氫妇
@Getter
public enum StockInQualifiedRecordTypeEnum implements BaseEnum<String> {
CUSTOMIZATION_STOCK_IN("0", "鍚堟牸鑷畾涔夊叆搴�"),
- CUSTOMIZATION_STOCK_OUT("1", "鍚堟牸鑷畾涔夊嚭搴�"),
PRODUCTION_REPORT_STOCK_IN("2", "鐢熶骇鎶ュ伐-鍏ュ簱"),
- PRODUCTION_REPORT_STOCK_OUT("3", "鐢熶骇鎶ュ伐-鍑哄簱"),
DEFECTIVE_SCRAP("4", "涓嶅悎鏍煎鐞�-鎶ュ簾"),
PRODUCTION_SCRAP("5", "鐢熶骇鎶ュ伐-鎶ュ簾"),
QUALITYINSPECT_STOCK_IN("6", "璐ㄦ-鍚堟牸鍏ュ簱"),
PURCHASE_STOCK_IN("7", "閲囪喘-鍏ュ簱"),
- SALE_STOCK_OUT("8", "閿�鍞�-鍑哄簱"),
CUSTOMIZATION_UNSTOCK_IN("9", "涓嶅悎鏍艰嚜瀹氫箟鍏ュ簱"),
- CUSTOMIZATION_UNSTOCK_OUT("10", "涓嶅悎鏍艰嚜瀹氫箟鍑哄簱"),
+ CUSTOMIZATION_UNSTOCK_OUT("10", "閲囪喘-璐ㄦ-鍚堟牸鍏ュ簱"),
DEFECTIVE_PASS("11", "涓嶅悎鏍�-璁╂鏀捐"),
- QUALITYINSPECT_UNSTOCK_IN("12", "璐ㄦ-涓嶅悎鏍煎叆搴�"),
- SALE_SHIP_STOCK_OUT("13", "閿�鍞�-鍙戣揣鍑哄簱"),
RETURN_HE_IN("14", "閿�鍞��璐�-鍚堟牸鍏ュ簱"),
RETURN_UNSTOCK_IN("15", "閿�鍞��璐�-涓嶅悎鏍煎叆搴�"),
- PICK_RETURN_IN("20", "閿�鍞��璐�-鍚堟牸鍏ュ簱"),
- PURCHASE_RETURN_STOCK_OUT("21", "閲囪喘閫�璐�");
+ PICK_RETURN_IN("20", "棰嗘枡閫�鏂�-鍚堟牸鍏ュ簱"),
+ FEED_RETURN_IN("22", "鐢熶骇閫�鏂�-鍚堟牸鍏ュ簱");
diff --git a/src/main/java/com/ruoyi/common/enums/StockInUnQualifiedRecordTypeEnum.java b/src/main/java/com/ruoyi/common/enums/StockInUnQualifiedRecordTypeEnum.java
deleted file mode 100644
index a03e6bd..0000000
--- a/src/main/java/com/ruoyi/common/enums/StockInUnQualifiedRecordTypeEnum.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.ruoyi.common.enums;
-
-import lombok.Getter;
-
-
-@Getter
-public enum StockInUnQualifiedRecordTypeEnum implements BaseEnum<String> {
-
-
- DEFECTIVE_SCRAP("4", "涓嶅悎鏍煎鐞�-鎶ュ簾"),
- PRODUCTION_SCRAP("5", "鐢熶骇鎶ュ伐-鎶ュ簾"),
- CUSTOMIZATION_UNSTOCK_IN("9", "涓嶅悎鏍艰嚜瀹氫箟鍏ュ簱"),
- QUALITYINSPECT_UNSTOCK_IN("12", "璐ㄦ-涓嶅悎鏍煎叆搴�"),
- RETURN_UNSTOCK_IN("15", "閿�鍞��璐�-涓嶅悎鏍煎叆搴�");
-
-
- private final String code;
- private final String value;
-
- StockInUnQualifiedRecordTypeEnum(String code, String value) {
- this.code = code;
- this.value = value;
- }
-
-}
diff --git a/src/main/java/com/ruoyi/common/enums/StockOutQualifiedRecordTypeEnum.java b/src/main/java/com/ruoyi/common/enums/StockOutQualifiedRecordTypeEnum.java
index 5e8fe53..a27680a 100644
--- a/src/main/java/com/ruoyi/common/enums/StockOutQualifiedRecordTypeEnum.java
+++ b/src/main/java/com/ruoyi/common/enums/StockOutQualifiedRecordTypeEnum.java
@@ -7,9 +7,11 @@
public enum StockOutQualifiedRecordTypeEnum implements BaseEnum<String> {
CUSTOMIZATION_STOCK_OUT("1", "鍚堟牸鑷畾涔夊嚭搴�"),
PRODUCTION_REPORT_STOCK_OUT("3", "鐢熶骇鎶ュ伐-鍑哄簱"),
- SALE_STOCK_OUT("8", "閿�鍞�-鍑哄簱"),
PURCHASE_RETURN_STOCK_OUT("9", "閲囪喘閫�璐�"),
- SALE_SHIP_STOCK_OUT("13", "閿�鍞�-鍙戣揣鍑哄簱");
+ CUSTOMIZATION_UNSTOCK_OUT("10", "涓嶅悎鏍艰嚜瀹氫箟鍑哄簱"),
+ SALE_SHIP_STOCK_OUT("13", "閿�鍞�-鍙戣揣鍑哄簱"),
+ PICK_STOCK_OUT("14", "鐢熶骇棰嗘枡鍑哄簱"),
+ FEED_STOCK_OUT("15", "鐢熶骇琛ユ枡鍑哄簱");
private final String code;
private final String value;
diff --git a/src/main/java/com/ruoyi/common/enums/StockOutUnQualifiedRecordTypeEnum.java b/src/main/java/com/ruoyi/common/enums/StockOutUnQualifiedRecordTypeEnum.java
deleted file mode 100644
index 2ee40bd..0000000
--- a/src/main/java/com/ruoyi/common/enums/StockOutUnQualifiedRecordTypeEnum.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.ruoyi.common.enums;
-
-import lombok.Getter;
-
-
-@Getter
-public enum StockOutUnQualifiedRecordTypeEnum implements BaseEnum<String> {
-
-
- CUSTOMIZATION_UNSTOCK_OUT("10", "涓嶅悎鏍艰嚜瀹氫箟鍑哄簱");
-
-
- private final String code;
- private final String value;
-
- StockOutUnQualifiedRecordTypeEnum(String code, String value) {
- this.code = code;
- this.value = value;
- }
-
-}
diff --git a/src/main/java/com/ruoyi/common/enums/TypeEnums.java b/src/main/java/com/ruoyi/common/enums/TypeEnums.java
new file mode 100644
index 0000000..ba1c1f3
--- /dev/null
+++ b/src/main/java/com/ruoyi/common/enums/TypeEnums.java
@@ -0,0 +1,70 @@
+package com.ruoyi.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum TypeEnums implements BaseEnum<Long> {
+
+ PUBLIC_OUT(1L, "鍏嚭绠$悊"),
+ LEAVE(2L, "璇峰亣绠$悊"),
+ BUSINESS_TRIP(3L, "鍑哄樊绠$悊"),
+ REIMBURSEMENT(4L, "鎶ラ攢绠$悊"),
+ PURCHASE_APPROVAL(5L, "閲囪喘瀹℃壒"),
+ QUOTATION_APPROVAL(6L, "鎶ヤ环瀹℃壒"),
+ SHIPPING_APPROVAL(7L, "鍙戣揣瀹℃壒"),
+ DANGEROUS_OPERATION(8L, "鍗遍櫓浣滀笟瀹℃壒"),
+ OFFICE_SUPPLIES(9L, "鍔炲叕鐢ㄥ搧瀹℃壒"),
+ REGULARIZATION_APPROVAL(10L, "杞瀹℃壒"),
+ TRANSFER_APPROVAL(11L, "璋冨姩瀹℃壒"),
+ RESIGNATION_APPROVAL(12L, "绂昏亴瀹℃壒"),
+ WORK_HANDOVER_APPROVAL(13L, "宸ヤ綔浜ゆ帴瀹℃壒"),
+ LEAVE_APPROVAL(14L, "璇峰亣瀹℃壒"),
+ OVERTIME_APPROVAL(15L, "鍔犵彮瀹℃壒"),
+ TRAVEL_REIMBURSEMENT_APPROVAL(16L, "鍑哄樊鎶ラ攢瀹℃壒"),
+ EXPENSE_APPROVAL(17L, "璐圭敤瀹℃壒"),
+ ENTERPRISE_NEWS_APPROVAL(18L, "浼佷笟鏂伴椈瀹℃壒");
+
+
+
+ private final Long value;
+ private final String label;
+
+ @Override
+ public Long getCode() {
+ return value;
+ }
+
+ @Override
+ public String getValue() {
+ return label;
+ }
+
+ /**
+ * 鏍规嵁鍊艰幏鍙栧搴旂殑鏋氫妇
+ * @param value 涓氬姟绫诲瀷鍊�
+ * @return 瀵瑰簲鐨勬灇涓撅紝鏈尮閰嶈繑鍥瀗ull
+ */
+ public static TypeEnums fromValue(Long value) {
+ if (value == null) {
+ return null;
+ }
+ for (TypeEnums type : values()) {
+ if (type.getCode().equals(value)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 鏍规嵁鍊艰幏鍙栨弿杩�
+ * @param value 涓氬姟绫诲瀷鍊�
+ * @return 涓氬姟绫诲瀷鎻忚堪锛屾湭鍖归厤杩斿洖"鑷畾涔夊鎵�"
+ */
+ public static String getLabelByValue(Long value) {
+ TypeEnums typeEnum = fromValue(value);
+ return typeEnum != null ? typeEnum.getValue() : "鑷畾涔夊鎵�";
+ }
+}
diff --git a/src/main/java/com/ruoyi/common/utils/DateUtils.java b/src/main/java/com/ruoyi/common/utils/DateUtils.java
index 0fa7e5a..f0b14f9 100644
--- a/src/main/java/com/ruoyi/common/utils/DateUtils.java
+++ b/src/main/java/com/ruoyi/common/utils/DateUtils.java
@@ -3,17 +3,13 @@
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
+import java.time.*;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
/**
* 鏃堕棿宸ュ叿绫�
- *
+ *
* @author ruoyi
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
@@ -29,13 +25,13 @@
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = {
- "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
+ "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
/**
* 鑾峰彇褰撳墠Date鍨嬫棩鏈�
- *
+ *
* @return Date() 褰撳墠鏃ユ湡
*/
public static Date getNowDate()
@@ -45,16 +41,15 @@
public static LocalDate toLocalDate(Date date){
if(date == null) return LocalDate.now();
- // 2. 鎸囧畾鍥哄畾鏃跺尯杞崲锛堝涓滃叓鍖篣TC+8銆乁TC闆舵椂鍖猴級
- return date.toInstant()
- .atZone(ZoneId.of("Asia/Shanghai")) // 涓滃叓鍖猴紙鍖椾含/涓婃捣鏃跺尯锛�
- // .atZone(ZoneId.of("UTC")) // 鍙�夛細UTC闆舵椂鍖�
+ // java.sql.Date.toInstant() 浼氭姏 UnsupportedOperationException锛岄渶鍏堣浆涓� java.util.Date
+ Instant instant = new java.util.Date(date.getTime()).toInstant();
+ return instant.atZone(ZoneId.of("Asia/Shanghai"))
.toLocalDate();
}
/**
* 鑾峰彇褰撳墠鏃ユ湡, 榛樿鏍煎紡涓簓yyy-MM-dd
- *
+ *
* @return String
*/
public static String getDate()
diff --git a/src/main/java/com/ruoyi/common/utils/OrderUtils.java b/src/main/java/com/ruoyi/common/utils/OrderUtils.java
index a110ec9..6f47375 100644
--- a/src/main/java/com/ruoyi/common/utils/OrderUtils.java
+++ b/src/main/java/com/ruoyi/common/utils/OrderUtils.java
@@ -61,8 +61,11 @@
* @param <T> 瀹炰綋绫诲瀷
* @return 璁㈠崟缂栧彿
*/
- public static <T> String countTodayByCreateTime(BaseMapper<T> mapper,String preFix,String code) {
- LocalDate today = LocalDate.now();
+ public static <T> String countTodayByCreateTime(BaseMapper<T> mapper,String preFix,String code, LocalDateTime createTime) {
+ if (createTime == null) {
+ createTime = LocalDateTime.now();
+ }
+ LocalDate today = createTime.toLocalDate();
LocalDateTime todayStart = today.atStartOfDay();
LocalDateTime tomorrowStart = today.plusDays(1).atStartOfDay();
String dateStr = today.format(DateTimeFormatter.BASIC_ISO_DATE);
@@ -109,13 +112,17 @@
* @param <T> 瀹炰綋绫绘硾鍨�
* @return 褰撳ぉ璁板綍鏁伴噺
*/
- public static <T> String countAfterServiceTodayByCreateTime(BaseMapper<T> mapper,String preFix) {
+ public static <T> String countAfterServiceTodayByCreateTime(BaseMapper<T> mapper,String preFix, LocalDateTime createTime) {
+ if (createTime == null) {
+ createTime = LocalDateTime.now();
+ }
+ LocalDate localDate = createTime.toLocalDate();
LocalDateTime todayStart = LocalDateTime.of(
- LocalDateTime.now().toLocalDate(),
+ localDate,
LocalTime.MIN
);
LocalDateTime todayEnd = LocalDateTime.of(
- LocalDateTime.now().toLocalDate(),
+ localDate,
LocalTime.MAX
);
@@ -127,6 +134,6 @@
.lt("create_time", endDate);
Long aLong = mapper.selectCount(queryWrapper);
- return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1));
+ return preFix + localDate.format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1));
}
}
diff --git a/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
index bb2ebb5..d103265 100644
--- a/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+++ b/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -465,21 +465,37 @@
{
val = Convert.toBigDecimal(val);
}
- else if (Date.class == fieldType)
- {
- if (val instanceof String)
- {
- val = DateUtils.parseDate(val);
+ else if (Date.class == fieldType)
+ {
+ if (val instanceof String)
+ {
+ val = DateUtils.parseDate(val);
}
else if (val instanceof Double)
- {
- val = DateUtil.getJavaDate((Double) val);
- }
- }
- else if (Boolean.TYPE == fieldType || Boolean.class == fieldType)
- {
- val = Convert.toBool(val, false);
- }
+ {
+ val = DateUtil.getJavaDate((Double) val);
+ }
+ }
+ else if (LocalDate.class == fieldType)
+ {
+ if (val instanceof String)
+ {
+ Date date = DateUtils.parseDate(val);
+ val = StringUtils.isNull(date) ? null : DateUtils.toLocalDate(date);
+ }
+ else if (val instanceof Date)
+ {
+ val = DateUtils.toLocalDate((Date) val);
+ }
+ else if (val instanceof Double)
+ {
+ val = DateUtils.toLocalDate(DateUtil.getJavaDate((Double) val));
+ }
+ }
+ else if (Boolean.TYPE == fieldType || Boolean.class == fieldType)
+ {
+ val = Convert.toBool(val, false);
+ }
if (StringUtils.isNotNull(fieldType))
{
String propertyName = field.getName();
@@ -651,15 +667,24 @@
val = Convert.toFloat(val);
} else if (BigDecimal.class == fieldType) {
val = Convert.toBigDecimal(val);
- } else if (Date.class == fieldType) {
- if (val instanceof String) {
- val = DateUtils.parseDate(val);
- } else if (val instanceof Double) {
- val = DateUtil.getJavaDate((Double) val);
- }
- } else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) {
- val = Convert.toBool(val, false);
- }
+ } else if (Date.class == fieldType) {
+ if (val instanceof String) {
+ val = DateUtils.parseDate(val);
+ } else if (val instanceof Double) {
+ val = DateUtil.getJavaDate((Double) val);
+ }
+ } else if (LocalDate.class == fieldType) {
+ if (val instanceof String) {
+ Date date = DateUtils.parseDate(val);
+ val = StringUtils.isNull(date) ? null : DateUtils.toLocalDate(date);
+ } else if (val instanceof Date) {
+ val = DateUtils.toLocalDate((Date) val);
+ } else if (val instanceof Double) {
+ val = DateUtils.toLocalDate(DateUtil.getJavaDate((Double) val));
+ }
+ } else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) {
+ val = Convert.toBool(val, false);
+ }
if (StringUtils.isNotNull(fieldType)) {
String propertyName = field.getName();
diff --git a/src/main/java/com/ruoyi/customervisits/service/impl/CustomerVisitsServiceImpl.java b/src/main/java/com/ruoyi/customervisits/service/impl/CustomerVisitsServiceImpl.java
index 2e0a0b0..55c00b9 100644
--- a/src/main/java/com/ruoyi/customervisits/service/impl/CustomerVisitsServiceImpl.java
+++ b/src/main/java/com/ruoyi/customervisits/service/impl/CustomerVisitsServiceImpl.java
@@ -37,7 +37,7 @@
wrapper.like(CustomerVisits::getVisitingPeople, customerVisits.getVisitingPeople());
}
}
-
+ wrapper.orderByDesc(CustomerVisits::getId);
return customerVisitsMapper.selectPage(page, wrapper);
}
diff --git a/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java b/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
index f4b807d..298980e 100644
--- a/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
+++ b/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
@@ -35,30 +35,29 @@
private DeviceMaintenanceMapper deviceMaintenanceMapper;
-
@Operation(summary = "璁惧鍙拌处鍒楄〃")
@GetMapping("/page")
- public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) {
- return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger));
+ public AjaxResult page(Page page, DeviceLedgerDto deviceLedger) {
+ return AjaxResult.success(deviceLedgerService.queryPage(page, deviceLedger));
}
@PostMapping()
@Operation(summary = "娣诲姞璁惧鍙拌处")
- public AjaxResult add(@RequestBody DeviceLedger deviceLedger) {
-
- return deviceLedgerService.saveDeviceLedger(deviceLedger);
+ public AjaxResult add(@RequestBody DeviceLedgerDto deviceLedgerDto) {
+ return deviceLedgerService.saveDeviceLedger(deviceLedgerDto);
}
@Operation(summary = "鏍规嵁id鏌ヨ璁惧鍙拌处")
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id) {
- return AjaxResult.success(deviceLedgerService.getById(id));
+ DeviceLedgerDto deviceLedgerDto = deviceLedgerService.getDeviceLedgerDetail(id);
+ return AjaxResult.success(deviceLedgerDto);
}
- @PutMapping ()
+ @PutMapping()
@Operation(summary = "淇敼璁惧鍙拌处")
- public AjaxResult update(@RequestBody DeviceLedger deviceLedger) {
- return deviceLedgerService.updateDeviceLedger(deviceLedger);
+ public AjaxResult update(@RequestBody DeviceLedgerDto deviceLedgerDto) {
+ return deviceLedgerService.updateDeviceLedger(deviceLedgerDto);
}
@DeleteMapping("/{ids}")
@@ -74,7 +73,7 @@
@PostMapping("export")
@Operation(summary = "瀵煎嚭璁惧鍙拌处")
public void export(HttpServletResponse response, Long[] ids) {
- deviceLedgerService.export(response, ids);
+ deviceLedgerService.export(response, ids);
}
@Operation(summary = "涓嬭浇妯℃澘")
@@ -97,9 +96,9 @@
@GetMapping("getDeviceLedger")
@Operation(summary = "鑾峰彇璁惧鍙拌处")
- public AjaxResult getDeviceLedger( ) {
+ public AjaxResult getDeviceLedger() {
return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda()
- .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel)));
+ .select(DeviceLedger::getId, DeviceLedger::getDeviceName, DeviceLedger::getDeviceModel)));
}
@GetMapping("scanDevice")
@@ -108,8 +107,8 @@
public AjaxResult scanDevice(Long id) {
List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id);
DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id);
- if (list.size()>0){
- deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//鏈�鍚庣淮鎶ゆ椂闂�
+ if (!list.isEmpty()) {
+ deviceLedger.setUpdateTime(list.getFirst().getMaintenanceActuallyTime());//鏈�鍚庣淮鎶ゆ椂闂�
}
deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//涓嬫缁存姢鏃堕棿
return AjaxResult.success(deviceLedger);
diff --git a/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java b/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
index d3c19bb..7df7c26 100644
--- a/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
+++ b/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
@@ -46,10 +46,16 @@
return deviceRepairService.updateDeviceRepair(deviceRepairDto);
}
- @PostMapping ("repair")
+ @PostMapping ("/repair")
@Operation(summary = "璁惧缁翠慨")
public AjaxResult repair( @RequestBody DeviceRepairDto deviceRepairDto) {
- return deviceRepairService.updateDeviceRepair(deviceRepairDto);
+ return deviceRepairService.confirmRepair(deviceRepairDto);
+ }
+
+ @PostMapping ("/acceptance")
+ @Operation(summary = "璁惧鎶ヤ慨楠屾敹瀹℃壒")
+ public AjaxResult acceptance(@RequestBody DeviceRepairDto deviceRepairDto) {
+ return deviceRepairService.approveRepairAcceptance(deviceRepairDto);
}
@DeleteMapping("/{ids}")
diff --git a/src/main/java/com/ruoyi/device/dto/DeviceLedgerDto.java b/src/main/java/com/ruoyi/device/dto/DeviceLedgerDto.java
index 79e0aff..8ceb915 100644
--- a/src/main/java/com/ruoyi/device/dto/DeviceLedgerDto.java
+++ b/src/main/java/com/ruoyi/device/dto/DeviceLedgerDto.java
@@ -12,6 +12,9 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.util.List;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.dto.StorageBlobVO;
/**
* 璁惧鍙拌处瀹炰綋绫�
@@ -55,6 +58,20 @@
private String supplierName;
/**
+ * 璁惧闄勪欢(鐢ㄤ簬鎺ユ敹)
+ */
+ @TableField(exist = false)
+ @Schema(description = "璁惧闄勪欢鎺ユ敹鍒楄〃")
+ private List<StorageBlobDTO> storageBlobDTOs;
+
+ /**
+ * 璁惧闄勪欢(鐢ㄤ簬杩斿洖)
+ */
+ @TableField(exist = false)
+ @Schema(description = "璁惧闄勪欢灞曠ず鍒楄〃")
+ private List<StorageBlobVO> storageBlobVOs;
+
+ /**
* 鍗曚綅
*/
private String unit;
diff --git a/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java b/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java
index c782da2..caf5c1a 100644
--- a/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java
+++ b/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java
@@ -47,6 +47,18 @@
@Excel(name = "缁翠慨缁撴灉")
private String maintenanceResult;
+ @Schema(description = "楠屾敹浜�")
+ @Excel(name = "楠屾敹浜�")
+ private String acceptanceName;
+
+ @Schema(description = "楠屾敹鏃堕棿")
+ @Excel(name = "楠屾敹鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime acceptanceTime;
+
+ @Schema(description = "楠屾敹澶囨敞")
+ @Excel(name = "楠屾敹澶囨敞")
+ private String acceptanceRemark;
+
@Schema(description = "鐘舵��")
@Excel(name = "鐘舵��")
private String statusStr;
diff --git a/src/main/java/com/ruoyi/device/mapper/DeviceLedgerMapper.java b/src/main/java/com/ruoyi/device/mapper/DeviceLedgerMapper.java
index a7d1a37..dc43e78 100644
--- a/src/main/java/com/ruoyi/device/mapper/DeviceLedgerMapper.java
+++ b/src/main/java/com/ruoyi/device/mapper/DeviceLedgerMapper.java
@@ -4,8 +4,8 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.dto.DeviceTypeDetail;
-import com.ruoyi.account.dto.DeviceTypeDistributionVO;
+import com.ruoyi.account.bean.dto.DeviceTypeDetail;
+import com.ruoyi.account.bean.dto.DeviceTypeDistributionVO;
import com.ruoyi.device.dto.DeviceLedgerDto;
import com.ruoyi.device.execl.DeviceLedgerExeclDto;
import com.ruoyi.device.pojo.DeviceLedger;
diff --git a/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java b/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java
index 9db134e..c9efa55 100644
--- a/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java
+++ b/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java
@@ -50,7 +50,19 @@
@Schema(description = "缁翠慨缁撴灉")
private String maintenanceResult;
+ @Schema(description = "楠屾敹浜�")
+ private String acceptanceName;
+
+ @Schema(description = "楠屾敹鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime acceptanceTime;
+
+ @Schema(description = "楠屾敹澶囨敞")
+ private String acceptanceRemark;
+
@Schema(description = "鐘舵�� 0 寰呯淮淇� 1瀹岀粨 2 澶辫触")
+ // 0:寰呯淮淇� 1:瀹岀粨 2:澶辫触 3:寰呴獙鏀�
private Integer status;
@Schema(description = "鍒涘缓鏃堕棿")
diff --git a/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java b/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java
index 0edfc7b..350a09d 100644
--- a/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java
+++ b/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java
@@ -28,6 +28,9 @@
@Schema(description = "瑙勬牸鍨嬪彿")
private String deviceModel;
+ @Schema(description = "璁惧椤圭洰")
+ private String machineryCategory;
+
/**
* 涓婚敭ID
*/
@@ -41,6 +44,10 @@
@Schema(description = "璁惧id")
private Long taskId;
+ @Schema(description = "淇濆吇浜�")
+ @Excel(name = "淇濆吇浜�")
+ private String maintenancePerson;
+
@Schema(description = "棰戞")
@Excel(name = "棰戞")
private String frequencyType;
diff --git a/src/main/java/com/ruoyi/device/service/IDeviceLedgerService.java b/src/main/java/com/ruoyi/device/service/IDeviceLedgerService.java
index d34ea65..78dfcac 100644
--- a/src/main/java/com/ruoyi/device/service/IDeviceLedgerService.java
+++ b/src/main/java/com/ruoyi/device/service/IDeviceLedgerService.java
@@ -14,9 +14,11 @@
public interface IDeviceLedgerService extends IService<DeviceLedger> {
IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger);
- AjaxResult saveDeviceLedger(DeviceLedger deviceLedger);
+ AjaxResult saveDeviceLedger(DeviceLedgerDto deviceLedgerDto);
- AjaxResult updateDeviceLedger(DeviceLedger deviceLedger);
+ AjaxResult updateDeviceLedger(DeviceLedgerDto deviceLedgerDto);
+
+ DeviceLedgerDto getDeviceLedgerDetail(Long id);
void export(HttpServletResponse response, Long[] ids);
diff --git a/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java b/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java
index 8d20acd..ae0b913 100644
--- a/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java
+++ b/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java
@@ -19,6 +19,10 @@
AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto);
+ AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto);
+
+ AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto);
+
void export(HttpServletResponse response, Long[] ids);
DeviceRepairVo detailById(Long id);
diff --git a/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java b/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
index b4c5d65..154923d 100644
--- a/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
@@ -12,6 +12,9 @@
import com.ruoyi.device.execl.DeviceLedgerExeclDto;
import com.ruoyi.device.mapper.DeviceLedgerMapper;
import com.ruoyi.device.pojo.DeviceLedger;
+import com.ruoyi.basic.dto.StorageAttachmentDTO;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.service.StorageAttachmentService;
import com.ruoyi.device.service.IDeviceLedgerService;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.SysUser;
@@ -36,6 +39,7 @@
private final DeviceLedgerMapper deviceLedgerMapper;
private final SysUserMapper sysUserMapper;
+ private final StorageAttachmentService storageAttachmentService;
@Override
public IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger) {
@@ -44,25 +48,61 @@
}
@Override
- public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) {
+ public AjaxResult saveDeviceLedger(DeviceLedgerDto deviceLedgerDto) {
LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
- deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName());
+ deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedgerDto.getDeviceName());
if (this.count(deviceLedgerLambdaQueryWrapper) > 0) {
return AjaxResult.error("璁惧鍚嶇О宸插瓨鍦�");
}
+ DeviceLedger deviceLedger = new DeviceLedger();
+ BeanUtils.copyProperties(deviceLedgerDto, deviceLedger);
boolean save = this.save(deviceLedger);
if (save){
+ if (deviceLedgerDto.getStorageBlobDTOs() != null) {
+ StorageAttachmentDTO attachmentDTO = new StorageAttachmentDTO();
+ attachmentDTO.setApplication("image");
+ attachmentDTO.setRecordType(RecordTypeEnum.DEVICE_LEDGER.getType());
+ attachmentDTO.setRecordId(deviceLedger.getId());
+ attachmentDTO.setStorageBlobDTOs(deviceLedgerDto.getStorageBlobDTOs());
+ storageAttachmentService.saveStorageAttachment(attachmentDTO);
+ }
return AjaxResult.success();
}
return AjaxResult.error();
}
@Override
- public AjaxResult updateDeviceLedger(DeviceLedger deviceLedger) {
+ public AjaxResult updateDeviceLedger(DeviceLedgerDto deviceLedgerDto) {
+ DeviceLedger deviceLedger = new DeviceLedger();
+ BeanUtils.copyProperties(deviceLedgerDto, deviceLedger);
if (this.updateById(deviceLedger)) {
+ if (deviceLedgerDto.getStorageBlobDTOs() != null) {
+ StorageAttachmentDTO attachmentDTO = new StorageAttachmentDTO();
+ attachmentDTO.setApplication("image");
+ attachmentDTO.setRecordType(RecordTypeEnum.DEVICE_LEDGER.getType());
+ attachmentDTO.setRecordId(deviceLedger.getId());
+ attachmentDTO.setStorageBlobDTOs(deviceLedgerDto.getStorageBlobDTOs());
+ storageAttachmentService.saveStorageAttachment(attachmentDTO);
+ }
return AjaxResult.success();
}
return AjaxResult.error();
+ }
+
+ @Override
+ public DeviceLedgerDto getDeviceLedgerDetail(Long id) {
+ DeviceLedger deviceLedger = this.getById(id);
+ if (deviceLedger != null) {
+ DeviceLedgerDto deviceLedgerDto = new DeviceLedgerDto();
+ BeanUtils.copyProperties(deviceLedger, deviceLedgerDto);
+ StorageAttachmentDTO dto = new StorageAttachmentDTO();
+ dto.setRecordType(RecordTypeEnum.DEVICE_LEDGER.getType());
+ dto.setRecordId(id);
+ dto.setApplication("image");
+ deviceLedgerDto.setStorageBlobVOs(storageAttachmentService.list(dto));
+ return deviceLedgerDto;
+ }
+ return null;
}
@Override
@@ -82,9 +122,7 @@
util.exportExcel(response, deviceLedgerExeclDtos, "璁惧鍙拌处瀵煎嚭");
}else {
ArrayList<Long> arrayList = new ArrayList<>();
- Arrays.stream(ids).map(id -> {
- return arrayList.add( id);
- });
+ Arrays.stream(ids).map(arrayList::add);
List<DeviceLedger> supplierManageList = deviceLedgerMapper.selectBatchIds(arrayList);
ArrayList<DeviceLedgerExeclDto> deviceLedgerExeclDtos = new ArrayList<>();
supplierManageList.stream().forEach(deviceLedger -> {
@@ -116,7 +154,10 @@
deviceLedger.setTaxIncludingPriceTotal(c.getTaxIncludingPriceUnit());
deviceLedger.setNumber(BigDecimal.ONE);
deviceLedger.setPlanRuntimeTime(DateUtils.toLocalDate(c.getPlanRuntimeTime()));
- deviceLedger.setUnTaxIncludingPriceTotal(deviceLedger.getTaxIncludingPriceTotal().divide(BigDecimal.ONE.add(c.getTaxRate()),2, RoundingMode.HALF_UP));
+ // 璁$畻涓嶅惈绋庢�讳环锛屽鐞嗙┖鍊兼儏鍐�
+ if (deviceLedger.getTaxIncludingPriceTotal() != null && c.getTaxRate() != null) {
+ deviceLedger.setUnTaxIncludingPriceTotal(deviceLedger.getTaxIncludingPriceTotal().divide(BigDecimal.ONE.add(c.getTaxRate()), 2, RoundingMode.HALF_UP));
+ }
deviceLedgerMapper.insert(deviceLedger);
});
diff --git a/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java b/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java
index 897e569..e5a73ac 100644
--- a/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java
+++ b/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java
@@ -4,7 +4,6 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
-import com.ruoyi.basic.enums.ApplicationTypeEnum;
import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.utils.bean.BeanUtils;
@@ -48,6 +47,11 @@
private final SparePartsRequisitionRecordService sparePartsRequisitionRecordService;
private final FileUtil fileUtil;
+ private static final int STATUS_PENDING_REPAIR = 0;
+ private static final int STATUS_COMPLETED = 1;
+ private static final int STATUS_FAILED = 2;
+ private static final int STATUS_PENDING_ACCEPTANCE = 3;
+
@Override
public IPage<DeviceRepairVo> queryPage(Page page, DeviceRepairDto deviceRepairDto) {
IPage<DeviceRepairVo> pageDto = deviceRepairMapper.queryPage(page, deviceRepairDto);
@@ -63,6 +67,9 @@
DeviceLedger byId = deviceLedgerService.getById(deviceRepairDto.getDeviceLedgerId());
deviceRepairDto.setDeviceName(byId.getDeviceName());
deviceRepairDto.setDeviceModel(byId.getDeviceModel());
+ if (deviceRepairDto.getStatus() == null) {
+ deviceRepairDto.setStatus(STATUS_PENDING_REPAIR);
+ }
boolean save = this.save(deviceRepairDto);
if (save) {
// 澶勭悊鍥剧墖涓婁紶
@@ -76,6 +83,15 @@
@Transactional(rollbackFor = Exception.class)
public AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto) {
DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId());
+ if (oldDeviceRepair == null) {
+ return AjaxResult.error("鎶ヤ慨璁板綍涓嶅瓨鍦�");
+ }
+ if (deviceRepairDto.getStatus() != null
+ && deviceRepairDto.getStatus() == STATUS_COMPLETED
+ && (oldDeviceRepair.getStatus() == null
+ || oldDeviceRepair.getStatus() != STATUS_COMPLETED)) {
+ return AjaxResult.error("璇峰厛鎻愪氦楠屾敹瀹℃壒锛岄獙鏀堕�氳繃鍚庢墠鍙畬缁�");
+ }
// 澶勭悊澶囦欢浣跨敤鎯呭喌
if (CollectionUtils.isNotEmpty(deviceRepairDto.getSparePartsUseList())) {
List<Long> sparePartIds = new ArrayList<>();
@@ -123,10 +139,64 @@
});
}
// 澶勭悊鍥剧墖涓婁紶
- fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, id, deviceRepairDto.getStorageBlobDTOs());
+ if (deviceRepairDto.getStorageBlobDTOs() != null) {
+ fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, id, deviceRepairDto.getStorageBlobDTOs());
+ }
return AjaxResult.success();
}
return AjaxResult.error();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto) {
+ DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId());
+ if (oldDeviceRepair == null) {
+ return AjaxResult.error("鎶ヤ慨璁板綍涓嶅瓨鍦�");
+ }
+ if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_COMPLETED) {
+ return AjaxResult.error("璇ユ姤淇凡瀹岀粨锛屼笉鑳介噸澶嶇‘璁ょ淮淇�");
+ }
+ if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_PENDING_ACCEPTANCE) {
+ return AjaxResult.error("璇ユ姤淇凡鎻愪氦楠屾敹瀹℃壒");
+ }
+ deviceRepairDto.setStatus(STATUS_PENDING_ACCEPTANCE);
+ return updateDeviceRepair(deviceRepairDto);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto) {
+ if (deviceRepairDto.getId() == null) {
+ return AjaxResult.error("鎶ヤ慨璁板綍id涓嶈兘涓虹┖");
+ }
+ DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId());
+ if (oldDeviceRepair == null) {
+ return AjaxResult.error("鎶ヤ慨璁板綍涓嶅瓨鍦�");
+ }
+ if (oldDeviceRepair.getStatus() == null || oldDeviceRepair.getStatus() != STATUS_PENDING_ACCEPTANCE) {
+ return AjaxResult.error("璇ユ姤淇湭杩涘叆寰呴獙鏀剁姸鎬侊紝涓嶈兘瀹℃壒");
+ }
+ if (StringUtils.isBlank(deviceRepairDto.getAcceptanceName())) {
+ return AjaxResult.error("楠屾敹浜轰笉鑳戒负绌�");
+ }
+ if (deviceRepairDto.getAcceptanceTime() == null) {
+ return AjaxResult.error("楠屾敹鏃堕棿涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isBlank(deviceRepairDto.getAcceptanceRemark())) {
+ return AjaxResult.error("楠屾敹澶囨敞涓嶈兘涓虹┖");
+ }
+
+ DeviceRepair update = new DeviceRepair();
+ update.setId(deviceRepairDto.getId());
+ update.setAcceptanceName(deviceRepairDto.getAcceptanceName());
+ update.setAcceptanceTime(deviceRepairDto.getAcceptanceTime());
+ update.setAcceptanceRemark(deviceRepairDto.getAcceptanceRemark());
+ update.setStatus(STATUS_COMPLETED);
+ if (this.updateById(update)) {
+ return AjaxResult.success();
+ }
+ return AjaxResult.error("楠屾敹瀹℃壒澶辫触");
}
@Override
@@ -137,24 +207,19 @@
supplierManageList.stream().forEach(deviceRepair -> {
DeviceRepairExeclDto deviceRepairExeclDto = new DeviceRepairExeclDto();
BeanUtils.copyProperties(deviceRepair,deviceRepairExeclDto);
- deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "寰呯淮淇�" : deviceRepair.getStatus() == 1 ? "瀹岀粨" : "澶辫触");
-
+ deviceRepairExeclDto.setStatusStr(resolveStatusText(deviceRepair.getStatus()));
deviceLedgerExeclDtos.add(deviceRepairExeclDto);
});
ExcelUtil<DeviceRepairExeclDto> util = new ExcelUtil<DeviceRepairExeclDto>(DeviceRepairExeclDto.class);
util.exportExcel(response, deviceLedgerExeclDtos, "璁惧鎶ヤ慨瀵煎嚭");
}else {
- ArrayList<Long> arrayList = new ArrayList<>();
- Arrays.stream(ids).map(id -> {
- return arrayList.add( id);
- });
+ ArrayList<Long> arrayList = new ArrayList<>(Arrays.asList(ids));
List<DeviceRepair> supplierManageList = deviceRepairMapper.selectBatchIds(arrayList);
ArrayList<DeviceRepairExeclDto> deviceLedgerExeclDtos = new ArrayList<>();
supplierManageList.stream().forEach(deviceRepair -> {
DeviceRepairExeclDto deviceRepairExeclDto = new DeviceRepairExeclDto();
BeanUtils.copyProperties(deviceRepair,deviceRepairExeclDto);
- deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "寰呯淮淇�" : deviceRepair.getStatus() == 1 ? "瀹岀粨" : "澶辫触");
-
+ deviceRepairExeclDto.setStatusStr(resolveStatusText(deviceRepair.getStatus()));
deviceLedgerExeclDtos.add(deviceRepairExeclDto);
});
ExcelUtil<DeviceRepairExeclDto> util = new ExcelUtil<DeviceRepairExeclDto>(DeviceRepairExeclDto.class);
@@ -163,6 +228,25 @@
}
+ private String resolveStatusText(Integer status) {
+ if (status == null) {
+ return "";
+ }
+ if (status == STATUS_PENDING_REPAIR) {
+ return "寰呯淮淇�";
+ }
+ if (status == STATUS_COMPLETED) {
+ return "瀹岀粨";
+ }
+ if (status == STATUS_FAILED) {
+ return "澶辫触";
+ }
+ if (status == STATUS_PENDING_ACCEPTANCE) {
+ return "寰呴獙鏀�";
+ }
+ return "鏈煡";
+ }
+
@Override
public DeviceRepairVo detailById(Long id) {
DeviceRepairVo vo = deviceRepairMapper.detailById(id);
diff --git a/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java b/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java
index b9deb2d..204667b 100644
--- a/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java
+++ b/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java
@@ -4,6 +4,7 @@
import com.ruoyi.device.pojo.MaintenanceTask;
import lombok.RequiredArgsConstructor;
import org.quartz.*;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@@ -18,14 +19,15 @@
import java.util.Set;
@Component
-@DisallowConcurrentExecution // 绂佹骞跺彂鎵ц鍚屼竴涓狫ob
-@RequiredArgsConstructor
+@DisallowConcurrentExecution
public class MaintenanceTaskJob implements Job, Serializable {
- private static final long serialVersionUID = 1L; // 蹇呴』瀹氫箟搴忓垪鍖朓D
+ private static final long serialVersionUID = 1L;
- private final DeviceMaintenanceServiceImpl deviceMaintenanceService;
+ @Autowired
+ private DeviceMaintenanceServiceImpl deviceMaintenanceService;
- private final JdbcTemplate jdbcTemplate;
+ @Autowired
+ private JdbcTemplate jdbcTemplate;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
@@ -91,11 +93,13 @@
inspectionTask.setMaintenanceTaskId(timingTask.getId());
inspectionTask.setDeviceLedgerId(timingTask.getTaskId());
inspectionTask.setMaintenancePlanTime(LocalDateTime.now());
+ inspectionTask.setMaintenanceActuallyName(timingTask.getMaintenancePerson());
inspectionTask.setFrequencyType(timingTask.getFrequencyType());
inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail());
inspectionTask.setTenantId(timingTask.getTenantId());
inspectionTask.setStatus(0);
inspectionTask.setDeviceModel(timingTask.getDeviceModel());
+ inspectionTask.setMachineryCategory(timingTask.getMachineryCategory());
inspectionTask.setCreateUser(Integer.parseInt(timingTask.getRegistrantId().toString()));
inspectionTask.setUpdateTime(LocalDateTime.now());
inspectionTask.setCreateTime(LocalDateTime.now());
diff --git a/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskServiceImpl.java b/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskServiceImpl.java
index 3aaac94..d0ba21f 100644
--- a/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.device.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.bean.BeanUtils;
@@ -34,7 +35,7 @@
@Override
public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) {
- Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, null);
+ Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, new QueryWrapper<MaintenanceTask>().orderByDesc("create_time"));
// 2. 濡傛灉娌℃湁鏁版嵁锛岀洿鎺ヨ繑鍥炵┖鍒嗛〉
if (taskPage.getRecords().isEmpty()) {
return AjaxResult.success(taskPage);
diff --git a/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java b/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
index 66a00e7..2cc50ba 100644
--- a/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
+++ b/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
@@ -1,30 +1,64 @@
-package com.ruoyi.framework.config;
-
-import java.util.TimeZone;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-
-/**
- * 绋嬪簭娉ㄨВ閰嶇疆
- *
- * @author ruoyi
- */
-@Configuration
-// 琛ㄧず閫氳繃aop妗嗘灦鏆撮湶璇ヤ唬鐞嗗璞�,AopContext鑳藉璁块棶
-@EnableAspectJAutoProxy(exposeProxy = true)
-// 鎸囧畾瑕佹壂鎻忕殑Mapper绫荤殑鍖呯殑璺緞
-@MapperScan("com.ruoyi.**.mapper")
-public class ApplicationConfig
-{
- /**
- * 鏃跺尯閰嶇疆
- */
- @Bean
- public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
- {
- return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
- }
-}
+package com.ruoyi.framework.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.TimeZone;
+
+/**
+ * 绋嬪簭娉ㄨВ閰嶇疆
+ *
+ * @author ruoyi
+ */
+@Configuration
+// 琛ㄧず閫氳繃aop妗嗘灦鏆撮湶璇ヤ唬鐞嗗璞�,AopContext鑳藉璁块棶
+@EnableAspectJAutoProxy(exposeProxy = true)
+// 鎸囧畾瑕佹壂鎻忕殑Mapper绫荤殑鍖呯殑璺緞
+@MapperScan("com.ruoyi.**.mapper")
+public class ApplicationConfig {
+ /**
+ * 鏃跺尯閰嶇疆
+ */
+ @Bean
+ public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() {
+ return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
+ }
+
+ @Bean
+ public ObjectMapper objectMapper() {
+ ObjectMapper mapper = new ObjectMapper();
+ // 鍏ㄥ眬蹇界暐鏈煡瀛楁
+ mapper.configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JavaTimeModule module = new JavaTimeModule();
+ // LocalDateTime锛氭敮鎸� yyyy-MM-dd HH:mm:ss
+ DateTimeFormatter dateTimeFormatter =
+ DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ module.addDeserializer(LocalDateTime.class,
+ new LocalDateTimeDeserializer(dateTimeFormatter));
+ module.addSerializer(LocalDateTime.class,
+ new LocalDateTimeSerializer(dateTimeFormatter));
+ // LocalDate锛氭敮鎸� yyyy-MM-dd
+ DateTimeFormatter dateFormatter =
+ DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ module.addDeserializer(LocalDate.class,
+ new LocalDateDeserializer(dateFormatter));
+ module.addSerializer(LocalDate.class,
+ new LocalDateSerializer(dateFormatter));
+ mapper.registerModule(module);
+ mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+ return mapper;
+ }
+}
diff --git a/src/main/java/com/ruoyi/framework/security/LoginUser.java b/src/main/java/com/ruoyi/framework/security/LoginUser.java
index 330ae43..aad84a9 100644
--- a/src/main/java/com/ruoyi/framework/security/LoginUser.java
+++ b/src/main/java/com/ruoyi/framework/security/LoginUser.java
@@ -301,7 +301,10 @@
public void setUser(SysUser user)
{
this.user = user;
- this.aiEnabled = user == null ? null : user.getAiEnabled();
+ if (user != null && user.getAiEnabled() != null)
+ {
+ this.aiEnabled = user.getAiEnabled();
+ }
}
@Override
diff --git a/src/main/java/com/ruoyi/home/controller/HomeController.java b/src/main/java/com/ruoyi/home/controller/HomeController.java
index 41ae224..35c3954 100644
--- a/src/main/java/com/ruoyi/home/controller/HomeController.java
+++ b/src/main/java/com/ruoyi/home/controller/HomeController.java
@@ -1,14 +1,21 @@
package com.ruoyi.home.controller;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.approve.pojo.ApproveProcess;
+import com.ruoyi.device.mapper.DeviceLedgerMapper;
+import com.ruoyi.device.mapper.DeviceRepairMapper;
+import com.ruoyi.device.pojo.DeviceRepair;
import com.ruoyi.dto.MapDto;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.home.annotation.DefaultType;
import com.ruoyi.home.dto.*;
import com.ruoyi.home.service.HomeService;
+import com.ruoyi.production.mapper.ProductionOrderMapper;
+import com.ruoyi.production.mapper.ProductionProductOutputMapper;
+import com.ruoyi.production.pojo.ProductionOrder;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
@@ -17,9 +24,21 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.ParseException;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.*;
/**
* @author :yys
@@ -32,293 +51,700 @@
public class HomeController extends BaseController {
private final HomeService homeService;
+ private final ProductionOrderMapper productionOrderMapper;
+ private final ProductionProductOutputMapper productionProductOutputMapper;
+ private final DeviceLedgerMapper deviceLedgerMapper;
+ private final DeviceRepairMapper deviceRepairMapper;
+
+ private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final Integer ORDER_STATUS_WAIT = 1;
+ private static final Integer ORDER_STATUS_RUNNING = 2;
+ private static final Integer ORDER_STATUS_COMPLETED = 3;
+ //private static final Integer ORDER_STATUS_END = 4; // 宸插彇娑�
+ private static final Integer ORDER_STATUS_END = 5;
/********************************************************鍩虹绫�*****************************************************/
@GetMapping("/todos")
@Log(title = "寰呭姙浜嬮」", businessType = BusinessType.OTHER)
@Operation(summary = "寰呭姙浜嬮」")
- public AjaxResult todos(ApproveProcess req) throws ParseException {
+ public R todos() throws ParseException {
List<ApproveProcess> approveProcessList = homeService.todos();
- return AjaxResult.success(approveProcessList);
+ return R.ok(approveProcessList);
}
@GetMapping("/approveAndDeviceTodos")
@Operation(summary = "瀹℃壒鍗忓悓锛岃澶囨姤淇緟鍔炰簨椤�")
- public AjaxResult approveAndDeviceTodos(){
+ public R approveAndDeviceTodos(){
Map<String, Object> map = homeService.approveAndDeviceTodos();
- return AjaxResult.success(map);
+ return R.ok(map);
}
@GetMapping("/noticesCount")
@Operation(summary = "鏈繃鏈熺殑鍏憡鏁伴噺")
- public AjaxResult noticesCount(){
+ public R noticesCount(){
Long count = homeService.noticesCount();
- return AjaxResult.success(count);
+ return R.ok(count);
}
@GetMapping("/deptStaffDistribution")
@Operation(summary = "鍚勯儴闂ㄤ汉鍛樺垎甯�")
- public AjaxResult deptStaffDistribution() {
+ public R deptStaffDistribution() {
DeptStaffDistributionDto dto = homeService.deptStaffDistribution();
- return AjaxResult.success(dto);
+ return R.ok(dto);
}
@GetMapping("/summaryStatistics")
@Operation(summary = "鍛樺伐-瀹㈡埛-渚涘簲鍟嗘�绘暟")
- public AjaxResult summaryStatistics() {
+ public R summaryStatistics() {
HomeSummaryDto homeSummaryDto = homeService.summaryStatistics();
- return AjaxResult.success(homeSummaryDto);
+ return R.ok(homeSummaryDto);
}
/********************************************************钀ラ攢閲囪喘绫�**************************************************/
@GetMapping("/supplierPurchaseRanking")
@Operation(summary = "渚涘簲鍟嗛噰璐帓鍚�")
- public AjaxResult supplierPurchaseRanking(@DefaultType Integer type) {
+ public R supplierPurchaseRanking(@DefaultType Integer type) {
List<SupplierPurchaseRankingDto> list = homeService.supplierPurchaseRanking(type);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/customerRevenueAnalysis")
@Operation(summary = "瀹㈡埛钀ユ敹璐$尞鏁板�煎垎鏋�")
- public AjaxResult customerRevenueAnalysis(Long customerId, @DefaultType Integer type) {
+ public R customerRevenueAnalysis(Long customerId, @DefaultType Integer type) {
CustomerRevenueAnalysisDto dto = homeService.customerRevenueAnalysis(customerId, type);
- return AjaxResult.success(dto);
+ return R.ok(dto);
}
@GetMapping("/customerContributionRanking")
@Operation(summary = "瀹㈡埛閲戦璐$尞鎺掑悕")
- public AjaxResult customerContributionRanking(@DefaultType Integer type) {
+ public R customerContributionRanking(@DefaultType Integer type) {
List<CustomerContributionRankingDto> list = homeService.customerContributionRanking(type);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/productSalesAnalysis")
@Operation(summary = "鍚勪骇鍝侀攢鍞噾棰濆垎鏋�")
- public AjaxResult productSalesAnalysis() {
+ public R productSalesAnalysis() {
List<MapDto> list = homeService.productSalesAnalysis();
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/rawMaterialPurchaseAmountRatio")
@Operation(summary = "鍘熸潗鏂欓噰璐噾棰濆崰姣�")
- public AjaxResult rawMaterialPurchaseAmountRatio(){
+ public R rawMaterialPurchaseAmountRatio(){
List<MapDto> list = homeService.rawMaterialPurchaseAmountRatio();
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/business")
@Log(title = "閿�鍞�-閲囪喘-搴撳瓨鏁版嵁", businessType = BusinessType.OTHER)
@Operation(summary = "閿�鍞�-閲囪喘-搴撳瓨鏁版嵁")
- public AjaxResult business(HomeBusinessDto req) {
+ public R business() {
HomeBusinessDto homeBusinessDto = homeService.business();
- return AjaxResult.success(homeBusinessDto);
+ return R.ok(homeBusinessDto);
}
@GetMapping("/analysisCustomerContractAmounts")
@Log(title = "瀹㈡埛鍚堝悓閲戦鍒嗘瀽", businessType = BusinessType.OTHER)
@Operation(summary = "瀹㈡埛鍚堝悓閲戦鍒嗘瀽")
- public AjaxResult analysisCustomerContractAmounts(AnalysisCustomerContractAmountsDto req) {
+ public R analysisCustomerContractAmounts() {
AnalysisCustomerContractAmountsDto analysisCustomerContractAmounts = homeService.analysisCustomerContractAmounts();
- return AjaxResult.success(analysisCustomerContractAmounts);
+ return R.ok(analysisCustomerContractAmounts);
}
/********************************************************鐢熶骇绫�*****************************************************/
@GetMapping("/inputOutputAnalysis")
@Operation(summary = "鎶曞叆浜у嚭鍒嗘瀽")
- public AjaxResult inputOutputAnalysis(@DefaultType Integer type){
+ public R inputOutputAnalysis(@DefaultType Integer type){
List<InputOutputAnalysisDto> list = homeService.inputOutputAnalysis(type);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/processOutputAnalysis")
@Operation(summary = "宸ュ簭浜у嚭鍒嗘瀽")
- public AjaxResult processOutputAnalysis(@DefaultType Integer type){
+ public R processOutputAnalysis(@DefaultType Integer type){
List<MapDto> list = homeService.processOutputAnalysis(type);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/workOrderEfficiencyAnalysis")
@Operation(summary = "宸ュ崟鎵ц鏁堢巼鍒嗘瀽")
- public AjaxResult workOrderEfficiencyAnalysis(@DefaultType Integer type){
+ public R workOrderEfficiencyAnalysis(@DefaultType Integer type){
List<WorkOrderEfficiencyDto> list = homeService.workOrderEfficiencyAnalysis(type);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/productionAccountingAnalysis")
@Operation(summary = "鐢熶骇鏍哥畻鍒嗘瀽")
- public AjaxResult productionAccountingAnalysis(@DefaultType Integer type){
+ public R productionAccountingAnalysis(@DefaultType Integer type){
List<ProductionAccountingDto> list = homeService.productionAccountingAnalysis(type);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/orderCount")
@Operation(summary = "璁㈠崟鏁�")
- public AjaxResult orderCount(){
- return AjaxResult.success(homeService.orderCount());
+ public R orderCount(){
+ return R.ok(homeService.orderCount());
}
@GetMapping("/progressStatistics")
@Operation(summary = "鍚勭敓浜ц鍗曠殑瀹屾垚杩涘害缁熻")
- public AjaxResult progressStatistics(){
+ public R progressStatistics(){
ProductionProgressDto productionProgressDto = homeService.productionProgress();
- return AjaxResult.success(productionProgressDto);
+ return R.ok(productionProgressDto);
}
@GetMapping("/workInProcessTurnover")
@Operation(summary = "鍦ㄥ埗鍝佸懆杞儏鍐�")
- public AjaxResult workInProcessTurnover(){
+ public R workInProcessTurnover(){
ProductionTurnoverDto productionTurnoverDto = homeService.workInProcessTurnover();
- return AjaxResult.success(productionTurnoverDto);
+ return R.ok(productionTurnoverDto);
}
@GetMapping("/processDataProductionStatistics")
@Operation(summary = "宸ュ簭鏁版嵁鐢熶骇缁熻鏁版嵁")
- public AjaxResult processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processIds) {
+ public R processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processIds) {
List<processDataProductionStatisticsDto> list = homeService.processDataProductionStatistics(type, processIds);
- return AjaxResult.success(list);
+ return R.ok(list);
}
/********************************************************璐ㄩ噺绫�*****************************************************/
+ @GetMapping("/productionOverview")
+ @Operation(summary = "Production Overview")
+ public R productionOverview() {
+ LocalDate today = LocalDate.now();
+ Map<String, BigDecimal> totalStats = loadOutputStats(LocalDate.of(2000, 1, 1), today.plusDays(1));
+ BigDecimal totalOutput = totalStats.get("quantity");
+ BigDecimal totalScrap = totalStats.get("scrapQty");
+ BigDecimal yieldRate = calcRate(totalOutput, totalOutput.add(totalScrap));
+
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("totalOutput", scale(totalOutput));
+ result.put("totalScrap", scale(totalScrap));
+ result.put("yieldRate", scale(yieldRate));
+ return R.ok(result);
+ }
+
+ @GetMapping("/productionRealtimeBoard")
+ @Operation(summary = "Production Realtime Board")
+ public R productionRealtimeBoard() {
+ LocalDate today = LocalDate.now();
+ LocalDate yesterday = today.minusDays(1);
+
+ BigDecimal todayDeviceOee = calcDeviceOee(today);
+ BigDecimal yesterdayDeviceOee = calcDeviceOee(yesterday);
+
+ BigDecimal todayOrderAchievementRate = calcOrderAchievementRate(today);
+ BigDecimal yesterdayOrderAchievementRate = calcOrderAchievementRate(yesterday);
+
+ BigDecimal todayDefectRate = calcDefectRate(today);
+ BigDecimal yesterdayDefectRate = calcDefectRate(yesterday);
+
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("deviceOee", buildRealtimeMetric(todayDeviceOee, todayDeviceOee.subtract(yesterdayDeviceOee)));
+ result.put("orderAchievementRate", buildRealtimeMetric(todayOrderAchievementRate, todayOrderAchievementRate.subtract(yesterdayOrderAchievementRate)));
+ result.put("defectRate", buildRealtimeMetric(todayDefectRate, todayDefectRate.subtract(yesterdayDefectRate)));
+ return R.ok(result);
+ }
+
+ @GetMapping("/productionOrderProgress")
+ @Operation(summary = "Production Order Progress")
+ public R productionOrderProgress(@RequestParam(defaultValue = "all") String tab,
+ @RequestParam(required = false) String status,
+ @RequestParam(required = false) String bizDate,
+ @RequestParam(defaultValue = "1") Long pageNum,
+ @RequestParam(defaultValue = "10") Long pageSize) {
+ LocalDate queryDate = parseDateOrNull(bizDate);
+ if (!isBlank(bizDate) && queryDate == null) {
+ return R.fail("bizDate鏍煎紡閿欒锛岃浣跨敤yyyy-MM-dd");
+ }
+ Integer statusFromParam = parseOrderStatus(status);
+ if (!isBlank(status) && statusFromParam == null && !"all".equalsIgnoreCase(status.trim())) {
+ return R.fail("status鍙傛暟涓嶅悎娉曪紝鍙�夊�硷細all/waiting/inProgress/completed/end 鎴� 1/2/3/5");
+ }
+ Integer queryStatus = resolveOrderStatus(status, tab);
+
+ long safePageNum = pageNum == null || pageNum < 1 ? 1 : pageNum;
+ boolean queryAll = pageSize != null && pageSize == -1;
+ long safePageSize = queryAll ? -1 : (pageSize == null || pageSize < 1 ? 10 : Math.min(pageSize, 50));
+ long offset = queryAll ? 0 : (safePageNum - 1) * safePageSize;
+ LocalDateTime startTime = queryDate == null ? null : queryDate.atStartOfDay();
+ LocalDateTime endTime = queryDate == null ? null : queryDate.plusDays(1).atStartOfDay();
+
+ List<Map<String, Object>> rawRows = productionOrderMapper.selectHomeOrderProgressPage(queryStatus, offset, safePageSize, startTime, endTime);
+ List<Map<String, Object>> records = new ArrayList<>();
+ if (rawRows != null) {
+ for (Map<String, Object> rawRow : rawRows) {
+ records.add(buildOrderProgressRow(rawRow));
+ }
+ }
+
+ long waitingCount = 0L;
+ long inProgressCount = 0L;
+ long completedCount = 0L;
+ long endCount = 0L;
+ List<Map<String, Object>> statusCountRows = productionOrderMapper.countHomeOrderProgressByStatus(startTime, endTime);
+ if (statusCountRows != null) {
+ for (Map<String, Object> countRow : statusCountRows) {
+ Integer statusKey = toInteger(countRow.get("status"));
+ long cnt = toLong(countRow.get("cnt"));
+ if (Objects.equals(statusKey, ORDER_STATUS_WAIT)) {
+ waitingCount = cnt;
+ } else if (Objects.equals(statusKey, ORDER_STATUS_RUNNING)) {
+ inProgressCount = cnt;
+ } else if (Objects.equals(statusKey, ORDER_STATUS_COMPLETED)) {
+ completedCount = cnt;
+ } else if (Objects.equals(statusKey, ORDER_STATUS_END)) {
+ endCount = cnt;
+ }
+ }
+ }
+
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("tab", mapOrderTab(queryStatus));
+ result.put("status", mapOrderStatus(queryStatus));
+ result.put("bizDate", queryDate == null ? null : queryDate.format(DATE_FORMATTER));
+ result.put("total", toLong(productionOrderMapper.countHomeOrderProgress(null, startTime, endTime)));
+ result.put("pageNum", safePageNum);
+ result.put("pageSize", safePageSize);
+ result.put("waitingCount", waitingCount);
+ result.put("inProgressCount", inProgressCount);
+ result.put("completedCount", completedCount);
+ result.put("endCount", endCount);
+ result.put("records", records);
+ return R.ok(result);
+ }
+
+ @GetMapping("/todayProductionPlan")
+ @Operation(summary = "Today Production Plan")
+ public R todayProductionPlan(@RequestParam(defaultValue = "4") Long limit,
+ @RequestParam(required = false) String planDate) {
+ LocalDate queryDate = parseDateOrNull(planDate);
+ if (!isBlank(planDate) && queryDate == null) {
+ return R.fail("planDate鏍煎紡閿欒锛岃浣跨敤yyyy-MM-dd");
+ }
+
+ long safeLimit = limit == null || limit < 1 ? 4 : Math.min(limit, 20);
+ LocalDateTime planStart = queryDate == null ? null : queryDate.atStartOfDay();
+ LocalDateTime planEnd = queryDate == null ? null : queryDate.plusDays(1).atStartOfDay();
+ List<Map<String, Object>> records = new ArrayList<>();
+ List<Map<String, Object>> rawRows = productionOrderMapper.selectHomeTodayProductionPlan(safeLimit, planStart, planEnd);
+ if (rawRows != null) {
+ for (Map<String, Object> rawRow : rawRows) {
+ Map<String, Object> row = new LinkedHashMap<>();
+ Integer rowStatus = toInteger(rawRow.get("status"));
+ row.put("orderNo", rawRow.get("orderNo"));
+ row.put("productName", rawRow.get("productName"));
+ row.put("plannedQuantity", scale(toBigDecimal(rawRow.get("plannedQuantity"))));
+ row.put("dueDate", rawRow.get("dueDate"));
+ row.put("status", rowStatus);
+ row.put("statusLabel", mapOrderStatusLabel(rowStatus));
+ records.add(row);
+ }
+ }
+
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("planDate", queryDate == null ? null : queryDate.format(DATE_FORMATTER));
+ result.put("total", toLong(productionOrderMapper.countHomeTodayProductionPlan(planStart, planEnd)));
+ result.put("records", records);
+ return R.ok(result);
+ }
+
@GetMapping("/rawMaterialDetection")
@Operation(summary = "鍘熸潗鏂欐娴�")
- public AjaxResult rawMaterialDetection(@DefaultType Integer type){
- return AjaxResult.success(homeService.rawMaterialDetection(type));
+ public R rawMaterialDetection(@DefaultType Integer type){
+ return R.ok(homeService.rawMaterialDetection(type));
}
@GetMapping("/processDetection")
@Operation(summary = "杩囩▼妫�娴�")
- public AjaxResult processDetection(@DefaultType Integer type){
- return AjaxResult.success(homeService.processDetection(type));
+ public R processDetection(@DefaultType Integer type){
+ return R.ok(homeService.processDetection(type));
}
@GetMapping("/factoryDetection")
@Operation(summary = "鎴愬搧鍑哄巶妫�娴�")
- public AjaxResult factoryDetection(@DefaultType Integer type){
- return AjaxResult.success(homeService.factoryDetection(type));
+ public R factoryDetection(@DefaultType Integer type){
+ return R.ok(homeService.factoryDetection(type));
}
@GetMapping("/qualityInspectionCount")
@Operation(summary = "璐ㄩ噺妫�楠屾暟閲�")
- public AjaxResult qualityInspectionCount(){
+ public R qualityInspectionCount(){
QualityInspectionCountDto qualityInspectionCountDto = homeService.qualityInspectionCount();
- return AjaxResult.success(qualityInspectionCountDto);
+ return R.ok(qualityInspectionCountDto);
}
@GetMapping("/nonComplianceWarning")
@Operation(summary = "涓嶅悎鏍奸璀�")
- public AjaxResult nonComplianceWarning(){
+ public R nonComplianceWarning(){
NonComplianceWarningDto nonComplianceWarningDto = homeService.nonComplianceWarning();
- return AjaxResult.success(nonComplianceWarningDto);
+ return R.ok(nonComplianceWarningDto);
}
@GetMapping("/completedInspectionCount")
@Operation(summary = "瀹屾垚妫�楠屾暟")
- public AjaxResult completedInspectionCount(){
+ public R completedInspectionCount(){
List<CompletedInspectionCountDto> list = homeService.completedInspectionCount();
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/unqualifiedProductRanking")
@Operation(summary = "涓嶅悎鏍间骇鍝佹帓鍚�")
- public AjaxResult unqualifiedProductRanking(){
+ public R unqualifiedProductRanking(){
List<UnqualifiedProductRankDto> list = homeService.unqualifiedProductRanking();
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/unqualifiedProductProcessingAnalysis")
@Operation(summary = "涓嶅悎鏍兼鍝佸鐞嗗垎鏋�")
- public AjaxResult unqualifiedProductProcessingAnalysis(){
+ public R unqualifiedProductProcessingAnalysis(){
List<MapDto> list = homeService.unqualifiedProductProcessingAnalysis();
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/qualityStatistics")
@Log(title = "璐ㄩ噺鍒嗘瀽", businessType = BusinessType.OTHER)
@Operation(summary = "璐ㄩ噺鍒嗘瀽")
- public AjaxResult qualityStatistics(QualityStatisticsDto req) {
+ public R qualityStatistics() {
QualityStatisticsDto qualityStatisticsDto = homeService.qualityStatistics();
- return AjaxResult.success(qualityStatisticsDto);
+ return R.ok(qualityStatisticsDto);
}
@GetMapping("/qualityInspectionStatistics")
@Operation(summary = "璐ㄩ噺缁熻")
- public AjaxResult qualityInspectionStatistics(@DefaultType Integer type) {
+ public R qualityInspectionStatistics(@DefaultType Integer type) {
QualityStatisticsDto dto = homeService.qualityInspectionStatistics(type);
- return AjaxResult.success(dto);
+ return R.ok(dto);
}
/********************************************************璐㈠姟绫�*****************************************************/
@GetMapping("/incomeExpenseAnalysis")
@Operation(summary = "鏀敹瀵规瘮鍒嗘瀽")
- public AjaxResult incomeExpenseAnalysis(@DefaultType Integer type) {
+ public R incomeExpenseAnalysis(@DefaultType Integer type) {
List<Map<String, Object>> result = homeService.incomeExpenseAnalysis(type);
- return AjaxResult.success(result);
+ return R.ok(result);
}
@GetMapping("/profitTrendAnalysis")
@Operation(summary = "鍒╂鼎瓒嬪娍鍒嗘瀽")
- public AjaxResult profitTrendAnalysis(){
+ public R profitTrendAnalysis(){
List<MapDto> list = homeService.profitTrendAnalysis();
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/expenseCompositionAnalysis")
@Operation(summary = "鏋勬垚鍒嗘瀽")
- public AjaxResult expenseCompositionAnalysis(@DefaultType Integer type) {
+ public R expenseCompositionAnalysis(@DefaultType Integer type) {
List<MapDto> list = homeService.expenseCompositionAnalysis(type);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/monthlyIncome")
@Operation(summary = "鏈堝害鏀跺叆")
- public AjaxResult monthlyIncome(){
+ public R monthlyIncome(){
MonthlyIncomeDto dto = homeService.monthlyIncome();
- return AjaxResult.success(dto);
+ return R.ok(dto);
}
@GetMapping("/monthlyExpenditure")
@Operation(summary = "鏈堝害鏀嚭")
- public AjaxResult monthlyExpenditure(){
+ public R monthlyExpenditure(){
MonthlyExpenditureDto dto = homeService.monthlyExpenditure();
- return AjaxResult.success(dto);
+ return R.ok(dto);
}
@GetMapping("/statisticsReceivablePayable")
@Log(title = "搴旀敹搴斾粯缁熻", businessType = BusinessType.OTHER)
@Operation(summary = "搴旀敹搴斾粯缁熻")
- public AjaxResult statisticsReceivablePayable(StatisticsReceivablePayableDto req, @DefaultType Integer type ) {
+ public R statisticsReceivablePayable(@DefaultType Integer type ) {
StatisticsReceivablePayableDto statisticsReceivablePayable = homeService.statisticsReceivablePayable(type);
- return AjaxResult.success(statisticsReceivablePayable);
+ return R.ok(statisticsReceivablePayable);
}
/********************************************************浠撳偍绫�*****************************************************/
@GetMapping("/productCategoryDistribution")
@Operation(summary = "浜у搧澶х被鍒嗗竷")
- public AjaxResult productCategoryDistribution() {
+ public R productCategoryDistribution() {
ProductCategoryDistributionDto dto = homeService.productCategoryDistribution();
- return AjaxResult.success(dto);
+ return R.ok(dto);
}
@GetMapping("/salesPurchaseStorageProductCount")
@Operation(summary = "閿�鍞�-閲囪喘-鍌ㄥ瓨浜у搧鏁�")
- public AjaxResult salesPurchaseStorageProductCount(){
+ public R salesPurchaseStorageProductCount(){
List<MapDto> list = homeService.salesPurchaseStorageProductCount();
- return AjaxResult.success(list);
+ return R.ok(list);
}
@GetMapping("/productInOutAnalysis")
@Operation(summary = "浜у搧鍑哄叆搴撳垎鏋�")
- public AjaxResult productInOutAnalysis(@DefaultType Integer type){
+ public R productInOutAnalysis(@DefaultType Integer type){
List<Map<String, Object>> result = homeService.productInOutAnalysis(type);
- return AjaxResult.success(result);
+ return R.ok(result);
}
@GetMapping("/productTurnoverDays")
@Operation(summary = "浜у搧鍛ㄨ浆澶╂暟")
- public AjaxResult productTurnoverDays(){
+ public R productTurnoverDays(){
List<MapDto> list = homeService.productTurnoverDays();
- return AjaxResult.success(list);
+ return R.ok(list);
+ }
+
+ private Map<String, Object> buildOrderProgressRow(Map<String, Object> rawRow) {
+ Map<String, Object> row = new LinkedHashMap<>();
+ Integer rowStatus = toInteger(rawRow.get("status"));
+ row.put("orderNo", rawRow.get("orderNo"));
+ row.put("productName", rawRow.get("productName"));
+ row.put("plannedQuantity", scale(toBigDecimal(rawRow.get("plannedQuantity"))));
+ row.put("completedQuantity", scale(toBigDecimal(rawRow.get("completedQuantity"))));
+ row.put("completionRate", scale(toBigDecimal(rawRow.get("completionRate"))));
+ row.put("dueDate", rawRow.get("dueDate"));
+ row.put("status", rowStatus);
+ row.put("statusLabel", mapOrderStatusLabel(rowStatus));
+ return row;
+ }
+
+ private Integer resolveOrderStatus(String status, String tab) {
+ if (!isBlank(status)) {
+ return parseOrderStatus(status);
+ }
+ return parseOrderStatus(tab);
+ }
+
+ private Integer parseOrderStatus(String rawStatus) {
+ if (isBlank(rawStatus)) {
+ return null;
+ }
+ String normalized = rawStatus.trim().toLowerCase();
+ if ("all".equals(normalized)) {
+ return null;
+ }
+ if ("1".equals(normalized) || "waiting".equals(normalized) || "wait".equals(normalized)) {
+ return ORDER_STATUS_WAIT;
+ }
+ if ("2".equals(normalized) || "inprogress".equals(normalized) || "running".equals(normalized)) {
+ return ORDER_STATUS_RUNNING;
+ }
+ if ("3".equals(normalized) || "completed".equals(normalized)) {
+ return ORDER_STATUS_COMPLETED;
+ }
+ if ("5".equals(normalized) || "end".equals(normalized)) {
+ return ORDER_STATUS_END;
+ }
+ return null;
+ }
+
+ private String mapOrderTab(Integer status) {
+ if (Objects.equals(status, ORDER_STATUS_RUNNING)) {
+ return "inProgress";
+ }
+ if (Objects.equals(status, ORDER_STATUS_COMPLETED)) {
+ return "completed";
+ }
+ if (Objects.equals(status, ORDER_STATUS_END)) {
+ return "end";
+ }
+ if (Objects.equals(status, ORDER_STATUS_WAIT)) {
+ return "waiting";
+ }
+ return "all";
+ }
+
+ private String mapOrderStatus(Integer status) {
+ if (Objects.equals(status, ORDER_STATUS_WAIT)) {
+ return "waiting";
+ }
+ if (Objects.equals(status, ORDER_STATUS_RUNNING)) {
+ return "inProgress";
+ }
+ if (Objects.equals(status, ORDER_STATUS_COMPLETED)) {
+ return "completed";
+ }
+ if (Objects.equals(status, ORDER_STATUS_END)) {
+ return "end";
+ }
+ return "all";
+ }
+
+ private String mapOrderStatusLabel(Integer status) {
+ if (Objects.equals(status, ORDER_STATUS_WAIT)) {
+ return "寰呭紑濮�";
+ }
+ if (Objects.equals(status, ORDER_STATUS_RUNNING)) {
+ return "杩涜涓�";
+ }
+ if (Objects.equals(status, ORDER_STATUS_COMPLETED)) {
+ return "宸插畬鎴�";
+ }
+ if (Objects.equals(status, ORDER_STATUS_END)) {
+ return "宸茬粨鏉�";
+ }
+ return "鏈煡";
+ }
+
+ private Map<String, BigDecimal> loadOutputStats(LocalDate startDate, LocalDate endDateExclusive) {
+ String start = startDate.atStartOfDay().format(DATE_TIME_FORMATTER);
+ String end = endDateExclusive.atStartOfDay().format(DATE_TIME_FORMATTER);
+
+ BigDecimal quantity = BigDecimal.ZERO;
+ BigDecimal scrapQty = BigDecimal.ZERO;
+ List<Map<String, Object>> rows = productionProductOutputMapper.selectDailyOutputStats(start, end);
+ if (rows != null) {
+ for (Map<String, Object> row : rows) {
+ quantity = quantity.add(toBigDecimal(row.get("quantity")));
+ scrapQty = scrapQty.add(toBigDecimal(row.get("scrapQty")));
+ }
+ }
+
+ Map<String, BigDecimal> stats = new LinkedHashMap<>();
+ stats.put("quantity", quantity);
+ stats.put("scrapQty", scrapQty);
+ return stats;
+ }
+
+ private BigDecimal calcDeviceOee(LocalDate day) {
+ long totalDeviceCount = deviceLedgerMapper.selectCount(new LambdaQueryWrapper<>());
+ if (totalDeviceCount <= 0) {
+ return BigDecimal.ZERO;
+ }
+
+ Date start = Date.from(day.atStartOfDay(ZoneId.systemDefault()).toInstant());
+ Date end = Date.from(day.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
+
+ List<DeviceRepair> repairList = deviceRepairMapper.selectList(new LambdaQueryWrapper<DeviceRepair>()
+ .select(DeviceRepair::getDeviceLedgerId)
+ .ge(DeviceRepair::getRepairTime, start)
+ .lt(DeviceRepair::getRepairTime, end)
+ .in(DeviceRepair::getStatus, 0, 3));
+
+ long repairingDeviceCount = repairList == null ? 0 : repairList.stream()
+ .map(DeviceRepair::getDeviceLedgerId)
+ .filter(Objects::nonNull)
+ .distinct()
+ .count();
+
+ long availableDeviceCount = Math.max(totalDeviceCount - repairingDeviceCount, 0);
+ return new BigDecimal(availableDeviceCount)
+ .multiply(new BigDecimal("100"))
+ .divide(new BigDecimal(totalDeviceCount), 2, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal calcOrderAchievementRate(LocalDate day) {
+ List<ProductionOrder> orderList = productionOrderMapper.selectList(new LambdaQueryWrapper<ProductionOrder>()
+ .select(ProductionOrder::getQuantity, ProductionOrder::getCompleteQuantity)
+ .ge(ProductionOrder::getCreateTime, day.atStartOfDay())
+ .lt(ProductionOrder::getCreateTime, day.plusDays(1).atStartOfDay())
+ .ne(ProductionOrder::getStatus, ORDER_STATUS_END));
+
+ BigDecimal totalQuantity = BigDecimal.ZERO;
+ BigDecimal totalCompleteQuantity = BigDecimal.ZERO;
+ if (orderList != null) {
+ for (ProductionOrder order : orderList) {
+ totalQuantity = totalQuantity.add(zeroIfNull(order.getQuantity()));
+ totalCompleteQuantity = totalCompleteQuantity.add(zeroIfNull(order.getCompleteQuantity()));
+ }
+ }
+ return calcRate(totalCompleteQuantity, totalQuantity);
+ }
+
+ private BigDecimal calcDefectRate(LocalDate day) {
+ Map<String, BigDecimal> stats = loadOutputStats(day, day.plusDays(1));
+ BigDecimal quantity = stats.get("quantity");
+ BigDecimal scrapQty = stats.get("scrapQty");
+ return calcRate(scrapQty, quantity.add(scrapQty));
+ }
+
+ private Map<String, Object> buildRealtimeMetric(BigDecimal value, BigDecimal change) {
+ Map<String, Object> metric = new LinkedHashMap<>();
+ metric.put("value", scale(value));
+ metric.put("compareYesterday", scale(change));
+ return metric;
+ }
+
+ private BigDecimal calcRate(BigDecimal numerator, BigDecimal denominator) {
+ if (denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) {
+ return BigDecimal.ZERO;
+ }
+ return zeroIfNull(numerator)
+ .multiply(new BigDecimal("100"))
+ .divide(denominator, 2, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal toBigDecimal(Object value) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ if (value instanceof BigDecimal) {
+ return (BigDecimal) value;
+ }
+ if (value instanceof Number) {
+ return BigDecimal.valueOf(((Number) value).doubleValue());
+ }
+ try {
+ return new BigDecimal(String.valueOf(value));
+ } catch (Exception ex) {
+ return BigDecimal.ZERO;
+ }
+ }
+
+ private Integer toInteger(Object value) {
+ if (value == null) {
+ return null;
+ }
+ if (value instanceof Integer) {
+ return (Integer) value;
+ }
+ if (value instanceof Number) {
+ return ((Number) value).intValue();
+ }
+ try {
+ return Integer.valueOf(String.valueOf(value));
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
+ private long toLong(Object value) {
+ if (value == null) {
+ return 0L;
+ }
+ if (value instanceof Long) {
+ return (Long) value;
+ }
+ if (value instanceof Number) {
+ return ((Number) value).longValue();
+ }
+ try {
+ return Long.parseLong(String.valueOf(value));
+ } catch (Exception ex) {
+ return 0L;
+ }
+ }
+
+ private LocalDate parseDateOrNull(String rawDate) {
+ if (isBlank(rawDate)) {
+ return null;
+ }
+ try {
+ return LocalDate.parse(rawDate.trim(), DATE_FORMATTER);
+ } catch (DateTimeParseException ex) {
+ return null;
+ }
+ }
+
+ private boolean isBlank(String value) {
+ return value == null || value.trim().isEmpty();
+ }
+
+ private BigDecimal zeroIfNull(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ private BigDecimal scale(BigDecimal value) {
+ return zeroIfNull(value).setScale(2, RoundingMode.HALF_UP);
}
}
diff --git a/src/main/java/com/ruoyi/home/dto/StatisticsReceivablePayableDto.java b/src/main/java/com/ruoyi/home/dto/StatisticsReceivablePayableDto.java
index a16390c..4f1509b 100644
--- a/src/main/java/com/ruoyi/home/dto/StatisticsReceivablePayableDto.java
+++ b/src/main/java/com/ruoyi/home/dto/StatisticsReceivablePayableDto.java
@@ -19,10 +19,10 @@
@Schema(description = "搴斾粯閲戦")
private BigDecimal payableMoney;
- @Schema(description = "棰勬敹閲戦")
+ @Schema(description = "鏀舵閲戦")
private BigDecimal advanceMoney;
- @Schema(description = "棰勪粯閲戦")
+ @Schema(description = "浠樻閲戦")
private BigDecimal prepayMoney;
}
diff --git a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
index e01927c..8aa7871 100644
--- a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
+++ b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -3,11 +3,26 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.ruoyi.account.mapper.AccountExpenseMapper;
-import com.ruoyi.account.mapper.AccountIncomeMapper;
-import com.ruoyi.account.pojo.AccountExpense;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto;
+import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto;
+import com.ruoyi.account.bean.dto.sales.SalesOutboundDto;
+import com.ruoyi.account.bean.dto.sales.SalesReturnDto;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
+import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
+import com.ruoyi.account.bean.vo.sales.SalesReturnVo;
+import com.ruoyi.account.mapper.AccountStatementMapper;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
import com.ruoyi.approve.mapper.ApproveProcessMapper;
+import com.ruoyi.approve.mapper.ApprovalInstanceMapper;
+import com.ruoyi.approve.mapper.ApprovalTaskMapper;
import com.ruoyi.approve.pojo.ApproveProcess;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalTask;
import com.ruoyi.basic.mapper.CustomerMapper;
import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.SupplierManageMapper;
@@ -17,6 +32,7 @@
import com.ruoyi.collaborativeApproval.mapper.NoticeMapper;
import com.ruoyi.collaborativeApproval.pojo.Notice;
import com.ruoyi.common.enums.ApproveTypeEnum;
+import com.ruoyi.common.enums.TypeEnums;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.device.mapper.DeviceRepairMapper;
@@ -26,27 +42,27 @@
import com.ruoyi.home.dto.*;
import com.ruoyi.home.mapper.HomeMapper;
import com.ruoyi.home.service.HomeService;
+import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
import com.ruoyi.production.bean.dto.ProductionProductOutputDto;
import com.ruoyi.production.mapper.*;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.mapper.SysDeptMapper;
-import com.ruoyi.purchase.mapper.PaymentRegistrationMapper;
import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
+import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.quality.mapper.QualityInspectMapper;
import com.ruoyi.quality.mapper.QualityUnqualifiedMapper;
import com.ruoyi.quality.pojo.QualityInspect;
import com.ruoyi.quality.pojo.QualityUnqualified;
-import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.ReceiptPayment;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.staff.mapper.StaffOnJobMapper;
import com.ruoyi.staff.pojo.StaffOnJob;
+import com.ruoyi.stock.mapper.StockInRecordMapper;
import com.ruoyi.stock.mapper.StockInventoryMapper;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -72,6 +88,10 @@
public class HomeServiceImpl implements HomeService {
private final SalesLedgerMapper salesLedgerMapper;
+ private final StockOutRecordMapper stockOutRecordMapper;
+ private final ReturnManagementMapper returnManagementMapper;
+ private final StockInRecordMapper stockInRecordMapper;
+ private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
private final PurchaseLedgerMapper purchaseLedgerMapper;
@@ -83,9 +103,9 @@
private final ApproveProcessMapper approveProcessMapper;
- private final ReceiptPaymentMapper receiptPaymentMapper;
+ private final ApprovalTaskMapper approvalTaskMapper;
- private final PaymentRegistrationMapper paymentRegistrationMapper;
+ private final ApprovalInstanceMapper approvalInstanceMapper;
private final SysDeptMapper sysDeptMapper;
@@ -111,9 +131,9 @@
private final ProductionOperationTaskMapper productionOperationTaskMapper;
- private final AccountExpenseMapper accountExpenseMapper;
-
- private final AccountIncomeMapper accountIncomeMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final AccountStatementMapper accountStatementMapper;
private final ProductionAccountMapper productionAccountMapper;
@@ -141,12 +161,8 @@
salesLedgers.stream().map(SalesLedger::getId).collect(Collectors.toList()));
List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper
.selectList(salesLedgerProductMapperLambdaQueryWrapper);
- // 鏈紑绁ㄩ噾棰�
- BigDecimal noInvoiceAmountTotal = salesLedgerProducts.stream().map(SalesLedgerProduct::getNoInvoiceAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
homeBusinessDto.setMonthSaleMoney(contractAmount.setScale(2, RoundingMode.HALF_UP).toString());
- homeBusinessDto.setMonthSaleHaveMoney(noInvoiceAmountTotal.setScale(2, RoundingMode.HALF_UP).toString());
+ homeBusinessDto.setMonthSaleHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
}
// 鍒涘缓LambdaQueryWrapper
LambdaQueryWrapper<PurchaseLedger> queryWrapper = new LambdaQueryWrapper<>();
@@ -169,14 +185,8 @@
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
- // 寰呬粯娆炬�婚噾棰�
- BigDecimal unReceiptPaymentAmount = salesLedgerProductsCopy.stream()
- .map(SalesLedgerProduct::getPendingTicketsTotal)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString());
- homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString());
+ homeBusinessDto.setMonthPurchaseHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
}
// 缁熻搴撳瓨
BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal();
@@ -312,19 +322,35 @@
queryWrapper.ge(QualityInspect::getCheckTime, monthStart.toString())
.le(QualityInspect::getCheckTime, monthEnd.toString());
List<QualityInspect> monthInspects = qualityStatisticsMapper.selectList(queryWrapper);
+
+ // 缁熻鎬绘暟閲忥紙鍚堟牸鏁伴噺 + 涓嶅悎鏍兼暟閲忥級
BigDecimal reduce = monthInspects.stream()
.filter(inspect -> inspect.getInspectType().equals(0))
- .map(QualityInspect::getQuantity)
+ .map(inspect -> {
+ BigDecimal qualified = inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO;
+ BigDecimal unqualified = inspect.getUnqualifiedQuantity() != null ? inspect.getUnqualifiedQuantity() : BigDecimal.ZERO;
+ return qualified.add(unqualified);
+ })
.reduce(BigDecimal.ZERO, BigDecimal::add);
supplierNum = supplierNum.add(reduce);
+
BigDecimal reduce1 = monthInspects.stream()
.filter(inspect -> inspect.getInspectType().equals(1))
- .map(QualityInspect::getQuantity)
+ .map(inspect -> {
+ BigDecimal qualified = inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO;
+ BigDecimal unqualified = inspect.getUnqualifiedQuantity() != null ? inspect.getUnqualifiedQuantity() : BigDecimal.ZERO;
+ return qualified.add(unqualified);
+ })
.reduce(BigDecimal.ZERO, BigDecimal::add);
processNum = processNum.add(reduce1);
+
BigDecimal reduce2 = monthInspects.stream()
.filter(inspect -> inspect.getInspectType().equals(2))
- .map(QualityInspect::getQuantity)
+ .map(inspect -> {
+ BigDecimal qualified = inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO;
+ BigDecimal unqualified = inspect.getUnqualifiedQuantity() != null ? inspect.getUnqualifiedQuantity() : BigDecimal.ZERO;
+ return qualified.add(unqualified);
+ })
.reduce(BigDecimal.ZERO, BigDecimal::add);
factoryNum = factoryNum.add(reduce2);
@@ -334,25 +360,22 @@
// 1. 渚涘簲鍟嗘楠岋紙绫诲瀷0锛�- 鍚堟牸鏁伴噺
BigDecimal supplierQualified = monthInspects.stream()
- .filter(inspect -> inspect.getInspectType().equals(0)
- && "鍚堟牸".equals(inspect.getCheckResult()))
- .map(QualityInspect::getQuantity)
+ .filter(inspect -> inspect.getInspectType().equals(0))
+ .map(inspect -> inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
item.setSupplierNum(supplierQualified);
// 2. 宸ュ簭妫�楠岋紙绫诲瀷1锛�- 鍚堟牸鏁伴噺
BigDecimal processQualified = monthInspects.stream()
- .filter(inspect -> inspect.getInspectType().equals(1)
- && "鍚堟牸".equals(inspect.getCheckResult()))
- .map(QualityInspect::getQuantity)
+ .filter(inspect -> inspect.getInspectType().equals(1))
+ .map(inspect -> inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
item.setProcessNum(processQualified);
// 3. 宸ュ巶妫�楠岋紙绫诲瀷2锛�- 鍚堟牸鏁伴噺
BigDecimal factoryQualified = monthInspects.stream()
- .filter(inspect -> inspect.getInspectType().equals(2)
- && "鍚堟牸".equals(inspect.getCheckResult()))
- .map(QualityInspect::getQuantity)
+ .filter(inspect -> inspect.getInspectType().equals(2))
+ .map(inspect -> inspect.getQualifiedQuantity() != null ? inspect.getQualifiedQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
item.setFactoryNum(factoryQualified);
@@ -370,40 +393,58 @@
@Override
public List<ApproveProcess> todos() throws ParseException {
LoginUser loginUser = SecurityUtils.getLoginUser();
+ List<ApproveProcess> approveProcesses = new ArrayList<>();
+
+ // 鏌ヨ鏃у鎵硅〃锛坅pprove_process锛�
LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>();
approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveDelete, 0)
.eq(ApproveProcess::getApproveUserCurrentId, loginUser.getUserId())
.ne(ApproveProcess::getApproveStatus, 2);
- // .eq(ApproveProcess::getTenantId, loginUser.getTenantId());
- List<ApproveProcess> approveProcesses = approveProcessMapper.selectList(approveProcessLambdaQueryWrapper);
- if (CollectionUtils.isEmpty(approveProcesses)) {
- approveProcesses = new ArrayList<>();
+ List<ApproveProcess> oldList = approveProcessMapper.selectList(approveProcessLambdaQueryWrapper);
+ if (!CollectionUtils.isEmpty(oldList)) {
+ oldList.forEach(a -> {
+ if (a.getApproveType() != null) {
+ a.setApproveTypeName(ApproveTypeEnum.getNameByCode(a.getApproveType()));
+ }
+ });
+ approveProcesses.addAll(oldList);
}
- approveProcesses.forEach(a -> {
- if (a.getApproveType() != null) {
- a.setApproveTypeName(ApproveTypeEnum.getNameByCode(a.getApproveType()));
+ // 鏌ヨ鏂板鎵硅〃锛坅pproval_task + approval_instance锛�
+ List<ApprovalTask> pendingTasks = approvalTaskMapper.selectList(new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getApproverId, loginUser.getUserId())
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0));
+ if (!CollectionUtils.isEmpty(pendingTasks)) {
+ List<Long> instanceIds = pendingTasks.stream()
+ .map(ApprovalTask::getInstanceId)
+ .distinct()
+ .collect(Collectors.toList());
+ List<ApprovalInstance> instances = approvalInstanceMapper.selectList(new LambdaQueryWrapper<ApprovalInstance>()
+ .in(ApprovalInstance::getId, instanceIds)
+ .eq(ApprovalInstance::getDeleted, 0));
+ Map<Long, ApprovalInstance> instanceMap = instances.stream()
+ .collect(Collectors.toMap(ApprovalInstance::getId, i -> i, (a, b) -> a));
+
+ for (ApprovalTask task : pendingTasks) {
+ ApprovalInstance instance = instanceMap.get(task.getInstanceId());
+ if (instance == null) {
+ continue;
+ }
+ ApproveProcess ap = new ApproveProcess();
+ ap.setId(instance.getId());
+ ap.setApproveId(instance.getInstanceNo());
+ ap.setApproveReason(instance.getTitle());
+ ap.setApproveTime(instance.getApplyTime() != null ? java.sql.Timestamp.valueOf(instance.getApplyTime()) : null);
+ ap.setApproveUserName(instance.getApplicantName());
+ ap.setApproveDeptName(instance.getTemplateName());
+ if (instance.getBusinessType() != null) {
+ ap.setApproveType(instance.getBusinessType().intValue());
+ ap.setApproveTypeName(TypeEnums.getLabelByValue(instance.getBusinessType()));
+ }
+ approveProcesses.add(ap);
}
- });
- // // 鏌ヨ鏈鐢ㄥ姵淇濊褰�
- // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- //
- // LaborIssue laborIssue1 = new LaborIssue();
- // laborIssue1.setAdoptedDate(new Date());
- // laborIssue1.setIssueDate(sdf.parse(sdf.format(new Date())));
- // List<LaborIssue> laborIssues = lavorIssueMapper.list(laborIssue1);
- // //staff_join_leave_record琛ㄨ鍒犻櫎
- // if(!CollectionUtils.isEmpty(laborIssues)){
- // for (LaborIssue laborIssue : laborIssues) {
- // ApproveProcess approveProcess = new ApproveProcess();
- // approveProcess.setApproveId(laborIssue.getOrderNo());
- // approveProcess.setApproveDeptName(sysDeptMapper.selectDeptById(loginUser.getTenantId()).getDeptName());
- // approveProcess.setApproveTime(laborIssue.getIssueDate());
- // approveProcess.setApproveReason(laborIssue.getDictTypeName() + "-" +
- // laborIssue.getDictName() + "瓒呮椂鏈鍙�");
- // approveProcesses.add(approveProcess);
- // }
- // }
+ }
return approveProcesses;
}
@@ -414,76 +455,33 @@
*/
@Override
public StatisticsReceivablePayableDto statisticsReceivablePayable(Integer type) {
- LocalDate today = LocalDate.now();
- LocalDate startDate = null;
- LocalDate endDate = null;
- switch (type) {
- case 1:
- // 鑾峰彇鏈懆鍛ㄤ竴
- startDate = today.with(DayOfWeek.MONDAY);
- // 鑾峰彇鏈懆鍛ㄦ棩
- endDate = today.with(DayOfWeek.SUNDAY);
- break;
- case 2:
- startDate = today.with(TemporalAdjusters.firstDayOfMonth());
- endDate = today.with(TemporalAdjusters.lastDayOfMonth());
- break;
- case 3:
- Month currentMonth = today.getMonth();
- Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter();
- Month lastMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2);
+ StatisticsReceivablePayableDto dto = new StatisticsReceivablePayableDto();
+ LocalDate[] range = resolveFinanceRange(type);
+ LocalDate startDate = range[0];
+ LocalDate endDate = range[1];
- startDate = today.withMonth(firstMonthOfQuarter.getValue())
- .with(TemporalAdjusters.firstDayOfMonth());
- endDate = today.withMonth(lastMonthOfQuarter.getValue())
- .with(TemporalAdjusters.lastDayOfMonth());
- break;
- }
- // 搴旀敹
- List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new LambdaQueryWrapper<SalesLedger>()
- // .ge(SalesLedger::getEntryDate, startDate)
- // .lt(SalesLedger::getEntryDate, endDate)
- );
- // BigDecimal receivableMoney =
- // salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO,
- // BigDecimal::add);
- BigDecimal receivableMoney = sumAmount(salesLedgers, SalesLedger::getContractAmount);
- // 搴斾粯
- List<PurchaseLedger> procurementRecords = purchaseLedgerMapper
- .selectList(new LambdaQueryWrapper<PurchaseLedger>()
- // .ge(PurchaseLedger::getEntryDate, startDate)
- // .lt(PurchaseLedger::getEntryDate, endDate)
- );
- // BigDecimal payableMoney =
- // procurementRecords.stream().map(PurchaseLedger::getContractAmount).reduce(BigDecimal.ZERO,
- // BigDecimal::add);
- BigDecimal payableMoney = sumAmount(procurementRecords, PurchaseLedger::getContractAmount);
- // 棰勬敹
- List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(new LambdaQueryWrapper<ReceiptPayment>()
- // .ge(ReceiptPayment::getReceiptPaymentDate, startDate)
- // .lt(ReceiptPayment::getReceiptPaymentDate, endDate)
- );
- // BigDecimal advanceMoney =
- // receiptPayments.stream().map(ReceiptPayment::getReceiptPaymentAmount).reduce(BigDecimal.ZERO,
- // BigDecimal::add);
- BigDecimal advanceMoney = sumAmount(receiptPayments, ReceiptPayment::getReceiptPaymentAmount);
- // 棰勪粯
- List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper
- .selectList(new LambdaQueryWrapper<PaymentRegistration>()
- // .ge(PaymentRegistration::getPaymentDate, startDate)
- // .lt(PaymentRegistration::getPaymentDate, endDate)
- );
- // BigDecimal prepayMoney =
- // paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO,
- // BigDecimal::add);
- BigDecimal prepayMoney = sumAmount(paymentRegistrations, PaymentRegistration::getCurrentPaymentAmount);
- StatisticsReceivablePayableDto statisticsReceivablePayableDto = new StatisticsReceivablePayableDto();
- statisticsReceivablePayableDto.setPayableMoney(payableMoney.subtract(prepayMoney));
- statisticsReceivablePayableDto.setReceivableMoney(receivableMoney.subtract(advanceMoney));
- statisticsReceivablePayableDto.setAdvanceMoney(advanceMoney);
- statisticsReceivablePayableDto.setPrepayMoney(prepayMoney);
+ //閿�鍞嚭搴�
+ BigDecimal receivableBase = sumSalesContractAmount(startDate, endDate);
+ //閿�鍞��璐�
+ BigDecimal salesReturnAmount = sumSalesReturnAmount(startDate, endDate);
+ //閲囪喘鍏ュ簱
+ BigDecimal payableBase = sumPurchaseContractAmount(startDate, endDate);
+ //閲囪喘閫�璐�
+ BigDecimal purchaseReturnAmount = sumPurchaseReturnAmount(startDate, endDate);
+ //鏀舵
+ BigDecimal advanceMoney = sumCollectionAmount(startDate, endDate);
+ //浠樻
+ BigDecimal prepayMoney = sumPaymentAmount(startDate, endDate);
- return statisticsReceivablePayableDto;
+ //搴旀敹閲戦=閿�鍞嚭搴�-閿�鍞��璐�
+ dto.setReceivableMoney(scaleMoney(maxZero(receivableBase.subtract(salesReturnAmount))));
+ //搴斾粯閲戦=閲囪喘鍏ュ簱-閲囪喘閫�璐�
+ dto.setPayableMoney(scaleMoney(maxZero(payableBase.subtract(purchaseReturnAmount))));
+ //鏀舵閲戦=鏀舵鍗�
+ dto.setAdvanceMoney(scaleMoney(advanceMoney));
+ //浠樻閲戦=浠樻鍗�
+ dto.setPrepayMoney(scaleMoney(prepayMoney));
+ return dto;
}
public static <T> BigDecimal sumAmount(List<T> list, java.util.function.Function<T, BigDecimal> amountExtractor) {
@@ -499,18 +497,23 @@
@Override
public Map<String, Object> approveAndDeviceTodos() {
- // 瀹℃壒鍗忓悓寰呭姙
- Long aLong = approveProcessMapper.selectCount(new LambdaQueryWrapper<ApproveProcess>()
+ // 鏃у鎵硅〃寰呭姙
+ Long oldCount = approveProcessMapper.selectCount(new LambdaQueryWrapper<ApproveProcess>()
.eq(ApproveProcess::getApproveUserCurrentId, SecurityUtils.getUserId())
.eq(ApproveProcess::getApproveDelete, 0)
.in(ApproveProcess::getApproveStatus, 0, 1, 3));
+ // 鏂板鎵硅〃寰呭姙
+ Long newCount = approvalTaskMapper.selectCount(new LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getApproverId, SecurityUtils.getUserId())
+ .eq(ApprovalTask::getTaskStatus, "PENDING")
+ .eq(ApprovalTask::getDeleted, 0));
// 璁惧鎶ヤ慨寰呭姙
Long aLong1 = deviceRepairMapper.selectCount(new LambdaQueryWrapper<DeviceRepair>()
.eq(DeviceRepair::getStatus, 0)
.eq(DeviceRepair::getRepairName, SecurityUtils.getLoginUser().getNickName()));
return new HashMap<String, Object>() {
{
- put("approveTodo", aLong);
+ put("approveTodo", oldCount + newCount);
put("deviceRepairTodo", aLong1);
}
};
@@ -1164,13 +1167,9 @@
String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// 2. 鏌ヨ鏁版嵁
- List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> incomeList = accountSalesCollectionMapper.selectIncomeStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> expenseList = accountPurchasePaymentMapper.selectPayment(startStr, endStr, dateFormat);
- // List<IncomeExpenseAnalysisDto> purchaseList =
- // purchaseLedgerMapper.selectPurchaseStats(startStr, endStr, dateFormat);
-
- List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr,
- dateFormat);
// 3. 杞� Map锛堣嚜鍔ㄥ悎骞讹級
Map<String, BigDecimal> incomeMap = incomeList.stream()
@@ -1179,11 +1178,7 @@
IncomeExpenseAnalysisDto::getAmount,
BigDecimal::add));
- // Map<String, BigDecimal> purchaseMap = purchaseList.stream()
- // .collect(Collectors.toMap(
- // IncomeExpenseAnalysisDto::getDateStr,
- // IncomeExpenseAnalysisDto::getAmount,
- // BigDecimal::add));
+
Map<String, BigDecimal> expenseMap = expenseList.stream()
.collect(Collectors.toMap(
@@ -1197,18 +1192,12 @@
for (String dateStr : xAxis) {
Map<String, Object> item = new HashMap<>();
item.put("date", dateStr);
-
// 鏀跺叆
BigDecimal income = incomeMap.getOrDefault(dateStr, BigDecimal.ZERO);
item.put("income", income.setScale(2, RoundingMode.HALF_UP));
-
- // 鏀嚭 = 閲囪喘 + 璐㈠姟鏀嚭
- // BigDecimal purchase = purchaseMap.getOrDefault(dateStr, BigDecimal.ZERO);
+ // 鏀嚭
BigDecimal expense = expenseMap.getOrDefault(dateStr, BigDecimal.ZERO);
- // BigDecimal totalExpense = purchase.add(expense);
- BigDecimal totalExpense = expense;
-
- item.put("expense", totalExpense.setScale(2, RoundingMode.HALF_UP));
+ item.put("expense", expense.setScale(2, RoundingMode.HALF_UP));
result.add(item);
}
@@ -1235,8 +1224,8 @@
String startStr = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
- List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat);
- List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> incomeList = accountSalesCollectionMapper.selectIncomeStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> expenseList = accountPurchasePaymentMapper.selectPayment(startStr, endStr, dateFormat);
Map<String, BigDecimal> incomeMap = incomeList.stream().collect(Collectors
.toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add));
@@ -1272,11 +1261,6 @@
rawMaterialDto.setName("鍘熸潗鏂�");
rawMaterialDto.setValue(rawMaterialAmount != null ? rawMaterialAmount.toString() : "0");
result.add(rawMaterialDto);
-
- List<MapDto> expenseList = accountExpenseMapper.selectExpenseComposition(null, null);
- if (expenseList != null) {
- result.addAll(expenseList);
- }
}
BigDecimal total = BigDecimal.ZERO;
@@ -1311,161 +1295,55 @@
@Override
public MonthlyIncomeDto monthlyIncome() {
MonthlyIncomeDto dto = new MonthlyIncomeDto();
- LocalDate now = LocalDate.now();
- YearMonth currentMonth = YearMonth.from(now);
- LocalDateTime startOfMonth = currentMonth.atDay(1).atStartOfDay();
- LocalDateTime endOfMonth = currentMonth.atEndOfMonth().atTime(23, 59, 59);
-
- LambdaQueryWrapper<SalesLedgerProduct> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(SalesLedgerProduct::getType, 1);
- wrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth);
- wrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth);
-
- List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(wrapper);
-
- if (CollectionUtils.isEmpty(products)) {
- return dto;
- }
-
- BigDecimal collected = products.stream()
- .map(SalesLedgerProduct::getInvoiceTotal)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- dto.setMonthlyIncome(collected);
-
- BigDecimal overdue = products.stream()
- .map(SalesLedgerProduct::getPendingInvoiceTotal)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- dto.setOverdueNum(overdue);
-
- BigDecimal total = collected.add(overdue);
-
- if (total.compareTo(BigDecimal.ZERO) > 0) {
- String collectionRate = collected.divide(total, 4, RoundingMode.HALF_UP)
- .multiply(new BigDecimal("100"))
- .setScale(2, RoundingMode.HALF_UP)
- .toString();
- dto.setCollectionRate(collectionRate);
-
- String overdueRate = overdue.divide(total, 4, RoundingMode.HALF_UP)
- .multiply(new BigDecimal("100"))
- .setScale(2, RoundingMode.HALF_UP)
- .toString();
- dto.setOverdueRate(overdueRate);
- }
-
+ LocalDate today = LocalDate.now();
+ YearMonth currentMonth = YearMonth.from(today);
+ LocalDate startDate = currentMonth.atDay(1);
+ LocalDate endDate = currentMonth.atEndOfMonth();
+ //鏀舵
+ BigDecimal monthlyIncome = sumCollectionAmount(startDate, endDate);
+ //閿�鍞嚭搴�
+ BigDecimal receivableBase = sumSalesContractAmount(startDate, endDate);
+ //閿�鍞��璐�
+ BigDecimal salesReturnAmount = sumSalesReturnAmount(startDate, endDate);
+ //鍥炴鐜�=鏀舵/(閿�鍞嚭搴�-閿�鍞��璐�)搴旀敹
+ String collectionRate = toRateString(monthlyIncome, receivableBase.subtract(salesReturnAmount));
+ //閫炬湡鏁�=(閿�鍞嚭搴撻噾棰�-閿�鍞��璐ч噾棰�)搴旀敹閲戦-鏀舵閲戦
+ BigDecimal overdueAmount = receivableBase.subtract(salesReturnAmount).subtract(monthlyIncome);
+ //閫炬湡鐜�=閫炬湡鏁�/搴旀敹閲戦
+ String overdueRate = toRateString(overdueAmount, receivableBase);
+ dto.setMonthlyIncome(scaleMoney(monthlyIncome));
+ dto.setCollectionRate(collectionRate);
+ dto.setOverdueNum(overdueAmount);
+ dto.setOverdueRate(overdueRate);
return dto;
}
+ @Override
public MonthlyExpenditureDto monthlyExpenditure() {
-
MonthlyExpenditureDto dto = new MonthlyExpenditureDto();
+ LocalDate today = LocalDate.now();
+ YearMonth currentMonth = YearMonth.from(today);
+ LocalDate startDate = currentMonth.atDay(1);
+ LocalDate endDate = currentMonth.atEndOfMonth();
+ //鏀嚭
+ BigDecimal monthlyExpenditure = sumPaymentAmount(startDate, endDate);
+ //閲囪喘鍏ュ簱
+ BigDecimal payableBase = sumPurchaseContractAmount(startDate, endDate);
+ //閲囪喘閫�璐�
+ BigDecimal purchaseReturnAmount = sumPurchaseReturnAmount(startDate, endDate);
+ //浠樻鐜�=浠樻/(閲囪喘鍏ュ簱-閲囪喘閫�璐�)搴斾粯
+ String paymentRate = toRateString(monthlyExpenditure, payableBase.subtract(purchaseReturnAmount));
+ //鏀舵
+ BigDecimal monthlyIncome = sumCollectionAmount(startDate, endDate);
+ //姣涘埄娑�= 鏀舵-鏀嚭
+ BigDecimal grossProfit = monthlyIncome.subtract(monthlyExpenditure);
+ //鍒╂鼎鐜�=姣涘埄娑�/鏀舵
+ String profitMarginRate = toRateString(grossProfit, monthlyIncome);
- // 褰撴湀鏃堕棿鑼冨洿
- LocalDate now = LocalDate.now();
- YearMonth currentMonth = YearMonth.from(now);
- LocalDateTime startOfMonth = currentMonth.atDay(1).atStartOfDay();
- LocalDateTime endOfMonth = currentMonth.atEndOfMonth().atTime(23, 59, 59);
-
- // 閲囪喘鍙拌处锛坱ype = 2锛�
- LambdaQueryWrapper<SalesLedgerProduct> purchaseWrapper = new LambdaQueryWrapper<>();
- purchaseWrapper.eq(SalesLedgerProduct::getType, 2);
- purchaseWrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth);
- purchaseWrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth);
-
- List<SalesLedgerProduct> purchaseProducts = salesLedgerProductMapper.selectList(purchaseWrapper);
-
- BigDecimal rawMaterialCost = BigDecimal.ZERO; // 鍘熸潗鏂欐垚鏈�
- BigDecimal paidAmount = BigDecimal.ZERO; // 宸蹭粯娆鹃噾棰�
- BigDecimal pendingAmount = BigDecimal.ZERO; // 寰呬粯娆鹃噾棰�
-
- if (!CollectionUtils.isEmpty(purchaseProducts)) {
- for (SalesLedgerProduct p : purchaseProducts) {
-
- if (p.getTaxInclusiveTotalPrice() != null) {
- rawMaterialCost = rawMaterialCost.add(p.getTaxInclusiveTotalPrice());
- }
-
- if (p.getTicketsTotal() != null) {
- paidAmount = paidAmount.add(p.getTicketsTotal());
- }
-
- if (p.getPendingTicketsTotal() != null) {
- pendingAmount = pendingAmount.add(p.getPendingTicketsTotal());
- }
- }
- }
-
- // 鍏朵粬璐圭敤
- LambdaQueryWrapper<AccountExpense> expenseWrapper = new LambdaQueryWrapper<>();
- expenseWrapper.ge(AccountExpense::getExpenseDate,
- java.sql.Date.valueOf(currentMonth.atDay(1)));
- expenseWrapper.le(AccountExpense::getExpenseDate,
- java.sql.Date.valueOf(currentMonth.atEndOfMonth()));
-
- List<AccountExpense> expenses = accountExpenseMapper.selectList(expenseWrapper);
-
- BigDecimal otherExpense = BigDecimal.ZERO;
- if (!CollectionUtils.isEmpty(expenses)) {
- for (AccountExpense e : expenses) {
- if (e.getExpenseMoney() != null) {
- otherExpense = otherExpense.add(e.getExpenseMoney());
- }
- }
- }
-
- // 鏈堝害鎬绘敮鍑�
- // BigDecimal monthlyExpenditure = rawMaterialCost.add(otherExpense);
- BigDecimal monthlyExpenditure = otherExpense;
- dto.setMonthlyExpenditure(monthlyExpenditure);
-
- // 宸蹭粯娆� 梅锛堝凡浠樻 + 寰呬粯娆撅級
- BigDecimal totalPayable = paidAmount.add(pendingAmount);
- if (totalPayable.compareTo(BigDecimal.ZERO) > 0) {
- String paymentRate = paidAmount
- .divide(totalPayable, 4, RoundingMode.HALF_UP)
- .multiply(BigDecimal.valueOf(100))
- .setScale(2, RoundingMode.HALF_UP)
- .toString();
- dto.setPaymentRate(paymentRate);
- }
-
- // 鍞彴璐︼紙type = 1锛�
- LambdaQueryWrapper<SalesLedgerProduct> salesWrapper = new LambdaQueryWrapper<>();
- salesWrapper.eq(SalesLedgerProduct::getType, 1);
- salesWrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth);
- salesWrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth);
-
- List<SalesLedgerProduct> salesProducts = salesLedgerProductMapper.selectList(salesWrapper);
-
- BigDecimal revenue = BigDecimal.ZERO;
- if (!CollectionUtils.isEmpty(salesProducts)) {
- for (SalesLedgerProduct s : salesProducts) {
- if (s.getInvoiceAmount() != null) {
- revenue = revenue.add(s.getInvoiceAmount());
- }
- }
- }
-
- // 姣涘埄娑� & 鍒╂鼎鐜�
- if (revenue.compareTo(BigDecimal.ZERO) > 0) {
-
- // 姣涘埄娑� = 閿�鍞敹鍏� - 鍘熸潗鏂欐垚鏈�
- BigDecimal grossProfit = revenue.subtract(rawMaterialCost);
- dto.setGrossProfit(grossProfit);
-
- // 鍒╂鼎鐜� = (閿�鍞敹鍏� - 鏈堝害鎬绘敮鍑�) / 閿�鍞敹鍏�
- BigDecimal profit = revenue.subtract(monthlyExpenditure);
- String profitMarginRate = profit
- .divide(revenue, 4, RoundingMode.HALF_UP)
- .multiply(BigDecimal.valueOf(100))
- .setScale(2, RoundingMode.HALF_UP)
- .toString();
-
- dto.setProfitMarginRate(profitMarginRate);
- }
-
+ dto.setMonthlyExpenditure(scaleMoney(monthlyExpenditure));
+ dto.setPaymentRate(paymentRate);
+ dto.setGrossProfit(scaleMoney(grossProfit));
+ dto.setProfitMarginRate(profitMarginRate);
return dto;
}
@@ -1904,11 +1782,8 @@
BigDecimal unqualifiedCount = BigDecimal.ZERO;
for (QualityInspect item : list) {
- if ("鍚堟牸".equals(item.getCheckResult())) {
- qualifiedCount = qualifiedCount.add(item.getQuantity());
- } else {
- unqualifiedCount = unqualifiedCount.add(item.getQuantity());
- }
+ qualifiedCount = qualifiedCount.add(item.getQualifiedQuantity() != null ? item.getQualifiedQuantity() : BigDecimal.ZERO);
+ unqualifiedCount = unqualifiedCount.add(item.getUnqualifiedQuantity() != null ? item.getUnqualifiedQuantity() : BigDecimal.ZERO);
}
BigDecimal totalCount = qualifiedCount.add(unqualifiedCount);
@@ -2177,13 +2052,11 @@
continue;
}
- BigDecimal quantity = item.getQuantity();
+ BigDecimal qualifiedQty = item.getQualifiedQuantity() != null ? item.getQualifiedQuantity() : BigDecimal.ZERO;
+ BigDecimal unqualifiedQty = item.getUnqualifiedQuantity() != null ? item.getUnqualifiedQuantity() : BigDecimal.ZERO;
- if ("鍚堟牸".equals(item.getCheckResult())) {
- dto.setQualifiedCount(dto.getQualifiedCount().add(quantity));
- } else {
- dto.setUnqualifiedCount(dto.getUnqualifiedCount().add(quantity));
- }
+ dto.setQualifiedCount(dto.getQualifiedCount().add(qualifiedQty));
+ dto.setUnqualifiedCount(dto.getUnqualifiedCount().add(unqualifiedQty));
}
// 璁$畻鍚堟牸鐜�
@@ -2224,14 +2097,12 @@
BigDecimal unqualifiedCount = BigDecimal.ZERO;
for (QualityInspect item : items) {
- BigDecimal qty = item.getQuantity();
- totalCount = totalCount.add(qty);
+ BigDecimal qualifiedQty = item.getQualifiedQuantity() != null ? item.getQualifiedQuantity() : BigDecimal.ZERO;
+ BigDecimal unqualifiedQty = item.getUnqualifiedQuantity() != null ? item.getUnqualifiedQuantity() : BigDecimal.ZERO;
- if ("鍚堟牸".equals(item.getCheckResult())) {
- qualifiedCount = qualifiedCount.add(qty);
- } else {
- unqualifiedCount = unqualifiedCount.add(qty);
- }
+ totalCount = totalCount.add(qualifiedQty.add(unqualifiedQty));
+ qualifiedCount = qualifiedCount.add(qualifiedQty);
+ unqualifiedCount = unqualifiedCount.add(unqualifiedQty);
}
if (totalCount.compareTo(BigDecimal.ZERO) == 0) {
@@ -2360,13 +2231,17 @@
dto.setProcessNum(sumQuantity(qualityInspectList, 1)); // 杩囩▼
dto.setFactoryNum(sumQuantity(qualityInspectList, 2)); // 鍑哄巶
- // 鍋囪 qualityInspectList 鏄竴涓� List<QualityInspect> 绫诲瀷鐨勯泦鍚�
- Map<String, List<QualityInspect>> groupedByCheckResult = qualityInspectList.stream()
- .collect(Collectors.groupingBy(QualityInspect::getCheckResult));
- List<QualityInspect> qualityInspects = groupedByCheckResult.get("涓嶅悎鏍�");
- if (ObjectUtils.isNull(qualityInspects) || qualityInspects.size() == 0) {
- return null;
+ // 鏍规嵁 unqualifiedQuantity > 0 绛涢�変笉鍚堟牸璁板綍
+ List<QualityInspect> qualityInspects = qualityInspectList.stream()
+ .filter(i -> i.getUnqualifiedQuantity() != null && i.getUnqualifiedQuantity().compareTo(BigDecimal.ZERO) > 0)
+ .collect(Collectors.toList());
+
+ if (ObjectUtils.isEmpty(qualityInspects)) {
+ // 鍗充娇娌℃湁涓嶅悎鏍艰褰曪紝涔熷簲璇ヨ繑鍥炵粺璁℃暟鎹紝鍙槸鍥捐〃椤逛负绌�
+ dto.setItem(new ArrayList<>());
+ return dto;
}
+
// 4. 澶勭悊鍥捐〃椤� (Item)
List<QualityStatisticsItem> itemList = new ArrayList<>();
@@ -2409,8 +2284,11 @@
private BigDecimal sumQuantity(List<QualityInspect> list, Integer type) {
return list.stream()
.filter(i -> i.getInspectType().equals(type))
- .map(QualityInspect::getQuantity)
- .filter(Objects::nonNull)
+ .map(i -> {
+ BigDecimal qualified = i.getQualifiedQuantity() != null ? i.getQualifiedQuantity() : BigDecimal.ZERO;
+ BigDecimal unqualified = i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO;
+ return qualified.add(unqualified);
+ })
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
@@ -2418,11 +2296,18 @@
QualityStatisticsItem item = new QualityStatisticsItem();
item.setDate(dateLabel);
- item.setSupplierNum(list.stream().filter(i -> i.getInspectType() == 0).map(QualityInspect::getQuantity)
+ // 缁熻姣忕妫�楠岀被鍨嬬殑涓嶅悎鏍兼暟閲�
+ item.setSupplierNum(list.stream()
+ .filter(i -> i.getInspectType() == 0)
+ .map(i -> i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add));
- item.setProcessNum(list.stream().filter(i -> i.getInspectType() == 1).map(QualityInspect::getQuantity)
+ item.setProcessNum(list.stream()
+ .filter(i -> i.getInspectType() == 1)
+ .map(i -> i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add));
- item.setFactoryNum(list.stream().filter(i -> i.getInspectType() == 2).map(QualityInspect::getQuantity)
+ item.setFactoryNum(list.stream()
+ .filter(i -> i.getInspectType() == 2)
+ .map(i -> i.getUnqualifiedQuantity() != null ? i.getUnqualifiedQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add));
return item;
@@ -2462,6 +2347,121 @@
return productionOperationTaskMapper.calculateProductionStatistics(startDateTime, endDateTime, userId, processIds);
}
+ private LocalDate[] resolveFinanceRange(Integer type) {
+ LocalDate today = LocalDate.now();
+ int safeType = type == null ? 1 : type;
+ LocalDate startDate;
+ LocalDate endDate;
+ switch (safeType) {
+ case 1:
+ startDate = today.with(DayOfWeek.MONDAY);
+ endDate = today.with(DayOfWeek.SUNDAY);
+ break;
+ case 2:
+ startDate = today.with(TemporalAdjusters.firstDayOfMonth());
+ endDate = today.with(TemporalAdjusters.lastDayOfMonth());
+ break;
+ case 3:
+ Month firstMonthOfQuarter = today.getMonth().firstMonthOfQuarter();
+ startDate = LocalDate.of(today.getYear(), firstMonthOfQuarter, 1);
+ endDate = startDate.plusMonths(2).with(TemporalAdjusters.lastDayOfMonth());
+ break;
+ default:
+ startDate = today.with(DayOfWeek.MONDAY);
+ endDate = today.with(DayOfWeek.SUNDAY);
+ break;
+ }
+ return new LocalDate[]{startDate, endDate};
+ }
+
+ //璁$畻鏃ユ湡鍐呯殑閿�鍞嚭搴撻噾棰�
+ private BigDecimal sumSalesContractAmount(LocalDate startDate, LocalDate endDate) {
+ SalesOutboundDto salesOutboundDto = new SalesOutboundDto();
+ salesOutboundDto.setStartDate(startDate);
+ salesOutboundDto.setEndDate(endDate);
+ List<SalesOutboundVo> salesOutboundVos = stockOutRecordMapper.listPageAccountSales(new Page(1, -1), salesOutboundDto).getRecords();
+ return sumAmount(salesOutboundVos, SalesOutboundVo::getOutboundAmount);
+ }
+
+ //璁$畻鏃ユ湡鍐呯殑閿�鍞��璐ч噾棰�
+ private BigDecimal sumSalesReturnAmount(LocalDate startDate, LocalDate endDate) {
+ SalesReturnDto salesReturnDto = new SalesReturnDto();
+ salesReturnDto.setStartDate(startDate);
+ salesReturnDto.setEndDate(endDate);
+ List<SalesReturnVo> salesReturnVos = returnManagementMapper.listPageAccountSalesReturn(new Page(1, -1), salesReturnDto).getRecords();
+ return sumAmount(salesReturnVos, SalesReturnVo::getRefundAmount);
+ }
+
+ //璁$畻鏃ユ湡鍐呯殑閲囪喘鍏ュ簱閲戦
+ private BigDecimal sumPurchaseContractAmount(LocalDate startDate, LocalDate endDate) {
+ PurchaseInboundDto purchaseInboundDto = new PurchaseInboundDto();
+ purchaseInboundDto.setStartDate(startDate);
+ purchaseInboundDto.setEndDate(endDate);
+ List<PurchaseInboundVo> purchaseInboundVos = stockInRecordMapper.listPageAccountPurchase(new Page(1, -1), purchaseInboundDto).getRecords();
+ return sumAmount(purchaseInboundVos, PurchaseInboundVo::getInboundAmount);
+ }
+
+ //璁$畻鏃ユ湡鍐呯殑閲囪喘閫�璐ч噾棰�
+ private BigDecimal sumPurchaseReturnAmount(LocalDate startDate, LocalDate endDate) {
+ PurchaseReturnDto purchaseReturnDto = new PurchaseReturnDto();
+ purchaseReturnDto.setStartDate(startDate);
+ purchaseReturnDto.setEndDate(endDate);
+ List<PurchaseReturnVo> purchaseReturnVos = purchaseReturnOrdersMapper.listPageAccountPurchaseReturn(new Page(1, -1), purchaseReturnDto).getRecords();
+ return sumAmount(purchaseReturnVos, PurchaseReturnVo::getTotalAmount);
+ }
+
+ //璁$畻鏃ユ湡鍐呯殑鎬绘敹娆鹃噾棰�
+ private BigDecimal sumCollectionAmount(LocalDate startDate, LocalDate endDate) {
+ List<AccountSalesCollection> collections = defaultList(accountSalesCollectionMapper.selectList(
+ new LambdaQueryWrapper<AccountSalesCollection>()
+ .ge(AccountSalesCollection::getCollectionDate, startDate)
+ .le(AccountSalesCollection::getCollectionDate, endDate)));
+ return sumAmount(collections, AccountSalesCollection::getCollectionAmount);
+ }
+
+ //璁$畻鏃ユ湡鍐呯殑鎬讳粯娆鹃噾棰�
+ private BigDecimal sumPaymentAmount(LocalDate startDate, LocalDate endDate) {
+ List<AccountPurchasePayment> payments = defaultList(accountPurchasePaymentMapper.selectList(
+ new LambdaQueryWrapper<AccountPurchasePayment>()
+ .ge(AccountPurchasePayment::getPaymentDate, startDate)
+ .le(AccountPurchasePayment::getPaymentDate, endDate)));
+ return sumAmount(payments, AccountPurchasePayment::getPaymentAmount);
+ }
+
+ private Date toDate(LocalDate localDate) {
+ return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private Date toExclusiveEndDate(LocalDate localDate) {
+ return Date.from(localDate.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
+ }
+
+ private String toRateString(BigDecimal numerator, BigDecimal denominator) {
+ if (denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) {
+ return "0.00";
+ }
+ return defaultDecimal(numerator)
+ .divide(denominator, 4, RoundingMode.HALF_UP)
+ .multiply(BigDecimal.valueOf(100))
+ .setScale(2, RoundingMode.HALF_UP)
+ .toString();
+ }
+
+ private BigDecimal maxZero(BigDecimal value) {
+ if (value == null) {
+ return BigDecimal.ZERO;
+ }
+ return value.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : value;
+ }
+
+ private BigDecimal scaleMoney(BigDecimal value) {
+ return defaultDecimal(value).setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private <T> List<T> defaultList(List<T> list) {
+ return list == null ? List.of() : list;
+ }
+
private BigDecimal defaultDecimal(BigDecimal value) {
return value == null ? BigDecimal.ZERO : value;
}
diff --git a/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java b/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java
index c41d626..4e7efad 100644
--- a/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java
+++ b/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java
@@ -30,6 +30,10 @@
@Excel(name = "宸℃浠诲姟鍚嶇О")
private String taskName;
+ @Schema(description = "宸℃椤圭洰")
+ @Excel(name = "宸℃椤圭洰")
+ private String inspectionProject;
+
@Schema(description = "璁惧id")
private Integer taskId;
@@ -44,6 +48,22 @@
@Excel(name = "澶囨敞")
private String remarks;
+ @Schema(description = "宸℃缁撴灉 0 寮傚父 1 姝e父")
+ private String inspectionResult;
+
+ @Schema(description = "寮傚父鎻忚堪")
+ private String abnormalDescription;
+
+ @Schema(description = "鍏宠仈缁翠慨鍗旾D")
+ private Long deviceRepairId;
+
+ @Schema(description = "楠屾敹浜篒D")
+ private Long acceptanceUserId;
+
+ @Schema(description = "楠屾敹浜�")
+ @Excel(name = "楠屾敹浜�")
+ private String acceptanceName;
+
@Schema(description = "浠诲姟鐧昏浜篒D")
private Long registrantId;
diff --git a/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java b/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java
index 2d8722e..43a3edc 100644
--- a/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java
+++ b/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java
@@ -33,6 +33,10 @@
@Excel(name = "宸℃浠诲姟鍚嶇О")
private String taskName;
+ @Schema(description = "宸℃椤圭洰")
+ @Excel(name = "宸℃椤圭洰")
+ private String inspectionProject;
+
@Schema(description = "璁惧id")
private Integer taskId;
@@ -60,6 +64,10 @@
@Schema(description = "鏄惁婵�娲�")
private boolean isActive;
+ @Schema(description = "鏄惁鍚敤 0鍚� 1鏄�")
+ @Excel(name = "鏄惁鍚敤", readConverterExp = "0=鍚�,1=鏄�")
+ private Integer isEnabled;
+
@Schema(description = "澶囨敞")
@Excel(name = "澶囨敞")
private String remarks;
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
index 410336e..9729b40 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
@@ -5,12 +5,17 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.StorageBlobDTO;
import com.ruoyi.basic.enums.ApplicationTypeEnum;
import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.device.mapper.DeviceLedgerMapper;
+import com.ruoyi.device.mapper.DeviceRepairMapper;
+import com.ruoyi.device.pojo.DeviceLedger;
+import com.ruoyi.device.pojo.DeviceRepair;
import com.ruoyi.inspectiontask.dto.InspectionTaskDto;
import com.ruoyi.inspectiontask.mapper.InspectionTaskMapper;
import com.ruoyi.inspectiontask.pojo.InspectionTask;
@@ -23,6 +28,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.time.format.DateTimeFormatter;
+import java.util.Date;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -43,6 +49,14 @@
private final FileUtil fileUtil;
+ private final DeviceRepairMapper deviceRepairMapper;
+
+ private final DeviceLedgerMapper deviceLedgerMapper;
+
+ private static final String INSPECTION_RESULT_ABNORMAL = "0";
+ private static final String INSPECTION_RESULT_NORMAL = "1";
+ private static final int REPAIR_STATUS_PENDING = 0;
+
@Override
public IPage<InspectionTaskDto> selectInspectionTaskList(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto) {
LambdaQueryWrapper<InspectionTask> queryWrapper = new LambdaQueryWrapper<>();
@@ -50,14 +64,16 @@
if (StringUtils.isNotBlank(inspectionTaskDto.getTaskName())) {
queryWrapper.like(InspectionTask::getTaskName, inspectionTaskDto.getTaskName());
}
+ if (StringUtils.isNotBlank(inspectionTaskDto.getInspectionProject())) {
+ queryWrapper.like(InspectionTask::getInspectionProject, inspectionTaskDto.getInspectionProject());
+ }
+ queryWrapper.orderByDesc(InspectionTask::getCreateTime);
IPage<InspectionTask> entityPage = inspectionTaskMapper.selectPage(page, queryWrapper);
// 鏃犳暟鎹彁鍓嶈繑鍥�
if (CollectionUtils.isEmpty(entityPage.getRecords())) {
return new Page<>(entityPage.getCurrent(), entityPage.getSize(), entityPage.getTotal());
}
- // 鑾峰彇id闆嗗悎
- List<Long> ids = entityPage.getRecords().stream().map(InspectionTask::getId).collect(Collectors.toList());
//鐧昏浜篿ds
List<Long> registrantIds = entityPage.getRecords().stream().map(InspectionTask::getRegistrantId).collect(Collectors.toList());
// 鎵归噺鏌ヨ鐧昏浜�
@@ -68,9 +84,6 @@
} else {
sysUserMap = new HashMap<>();
}
- //宸℃浜篿ds
- List<String> inspectorIds = entityPage.getRecords().stream().map(InspectionTask::getInspectorId).collect(Collectors.toList());
-
//鑾峰彇鎵�鏈変笉閲嶅鐨勭敤鎴稩D
Set<Long> allUserIds = entityPage.getRecords().stream()
.map(InspectionTask::getInspectorId) // 鑾峰彇"2,3"杩欐牱鐨勫瓧绗︿覆
@@ -140,24 +153,230 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto) {
+ InspectionTask oldInspectionTask = null;
+ if (Objects.nonNull(inspectionTaskDto.getId())) {
+ oldInspectionTask = inspectionTaskMapper.selectById(inspectionTaskDto.getId());
+ if (oldInspectionTask == null) {
+ throw new IllegalArgumentException("宸℃浠诲姟涓嶅瓨鍦�");
+ }
+ }
+ validateInspectionInput(inspectionTaskDto, oldInspectionTask);
+
InspectionTask inspectionTask = new InspectionTask();
BeanUtils.copyProperties(inspectionTaskDto, inspectionTask);
inspectionTask.setRegistrantId(SecurityUtils.getLoginUser().getUserId());
inspectionTask.setRegistrant(SecurityUtils.getLoginUser().getUsername());
+ fillAcceptanceInfo(inspectionTask, oldInspectionTask);
int i;
if (Objects.isNull(inspectionTaskDto.getId())) {
i = inspectionTaskMapper.insert(inspectionTask);
} else {
i = inspectionTaskMapper.updateById(inspectionTask);
}
- // 淇濆瓨鏂囦欢
- fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.INSPECTION_TASK, inspectionTask.getId(), inspectionTaskDto.getCommonFileListDTO());
- fileUtil.saveStorageAttachment(ApplicationTypeEnum.AFTER_FILE, RecordTypeEnum.INSPECTION_TASK, inspectionTask.getId(), inspectionTaskDto.getCommonFileListAfterDTO());
- fileUtil.saveStorageAttachment(ApplicationTypeEnum.BEFORE_FILE, RecordTypeEnum.INSPECTION_TASK, inspectionTask.getId(), inspectionTaskDto.getCommonFileListBeforeDTO());
+ if (i <= 0) {
+ return i;
+ }
+ Long linkedRepairId = syncRepairOrderIfAbnormal(inspectionTask, oldInspectionTask);
+ if (linkedRepairId != null && !Objects.equals(linkedRepairId, inspectionTask.getDeviceRepairId())) {
+ InspectionTask relationUpdate = new InspectionTask();
+ relationUpdate.setId(inspectionTask.getId());
+ relationUpdate.setDeviceRepairId(linkedRepairId);
+ inspectionTaskMapper.updateById(relationUpdate);
+ inspectionTask.setDeviceRepairId(linkedRepairId);
+ }
+ // 淇濆瓨鏂囦欢锛堝瓧娈典笉浼犲垯淇濈暀鍘嗗彶锛�
+ saveInspectionAttachments(inspectionTask.getId(), inspectionTaskDto);
return i;
}
+ private void validateInspectionInput(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) {
+ String inspectionResult = inspectionTaskDto.getInspectionResult();
+ if (StringUtils.isBlank(inspectionResult) && oldInspectionTask != null) {
+ inspectionResult = oldInspectionTask.getInspectionResult();
+ }
+ if (StringUtils.isBlank(inspectionResult)) {
+ throw new IllegalArgumentException("璇烽�夋嫨宸℃缁撴灉");
+ }
+ if (!INSPECTION_RESULT_ABNORMAL.equals(inspectionResult) && !INSPECTION_RESULT_NORMAL.equals(inspectionResult)) {
+ throw new IllegalArgumentException("宸℃缁撴灉浠呮敮鎸侊細0-寮傚父锛�1-姝e父");
+ }
+ inspectionTaskDto.setInspectionResult(inspectionResult);
+
+ if (!INSPECTION_RESULT_ABNORMAL.equals(inspectionResult)) {
+ return;
+ }
+
+ String abnormalDescription = inspectionTaskDto.getAbnormalDescription();
+ if (StringUtils.isBlank(abnormalDescription) && oldInspectionTask != null) {
+ abnormalDescription = oldInspectionTask.getAbnormalDescription();
+ }
+ if (StringUtils.isBlank(abnormalDescription)) {
+ throw new IllegalArgumentException("宸℃缁撴灉涓哄紓甯告椂锛屽紓甯告弿杩颁笉鑳戒负绌�");
+ }
+ inspectionTaskDto.setAbnormalDescription(abnormalDescription);
+
+ if (!hasAnyInspectionPhotoAfterSave(inspectionTaskDto, oldInspectionTask)) {
+ throw new IllegalArgumentException("宸℃缁撴灉涓哄紓甯告椂锛屽繀椤讳笂浼犺嚦灏戜竴寮犵収鐗�");
+ }
+ }
+
+ private boolean hasAnyInspectionPhotoAfterSave(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) {
+ Long recordId = oldInspectionTask == null ? null : oldInspectionTask.getId();
+ return hasApplicationPhotoAfterSave(inspectionTaskDto.getCommonFileListDTO(), ApplicationTypeEnum.FILE, recordId)
+ || hasApplicationPhotoAfterSave(inspectionTaskDto.getCommonFileListAfterDTO(), ApplicationTypeEnum.AFTER_FILE, recordId)
+ || hasApplicationPhotoAfterSave(inspectionTaskDto.getCommonFileListBeforeDTO(), ApplicationTypeEnum.BEFORE_FILE, recordId);
+ }
+
+ private boolean hasApplicationPhotoAfterSave(List<StorageBlobDTO> requestPhotos, ApplicationTypeEnum applicationType, Long recordId) {
+ if (requestPhotos != null) {
+ return !requestPhotos.isEmpty();
+ }
+ if (recordId == null) {
+ return false;
+ }
+ return CollectionUtils.isNotEmpty(fileUtil.getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(applicationType, RecordTypeEnum.INSPECTION_TASK, recordId));
+ }
+
+ private void fillAcceptanceInfo(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+ Long acceptanceUserId = inspectionTask.getAcceptanceUserId();
+ if (acceptanceUserId == null && oldInspectionTask != null) {
+ acceptanceUserId = oldInspectionTask.getAcceptanceUserId();
+ }
+ if (acceptanceUserId != null) {
+ inspectionTask.setAcceptanceUserId(acceptanceUserId);
+ }
+
+ String acceptanceName = inspectionTask.getAcceptanceName();
+ if (StringUtils.isBlank(acceptanceName) && acceptanceUserId != null) {
+ SysUser acceptanceUser = sysUserMapper.selectUserById(acceptanceUserId);
+ if (acceptanceUser != null) {
+ acceptanceName = acceptanceUser.getNickName();
+ }
+ }
+ if (StringUtils.isBlank(acceptanceName) && oldInspectionTask != null) {
+ acceptanceName = oldInspectionTask.getAcceptanceName();
+ }
+ inspectionTask.setAcceptanceName(acceptanceName);
+ }
+
+ private Long syncRepairOrderIfAbnormal(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+ if (!INSPECTION_RESULT_ABNORMAL.equals(inspectionTask.getInspectionResult())) {
+ return inspectionTask.getDeviceRepairId();
+ }
+ Long linkedRepairId = inspectionTask.getDeviceRepairId();
+ if (linkedRepairId == null && oldInspectionTask != null) {
+ linkedRepairId = oldInspectionTask.getDeviceRepairId();
+ }
+
+ if (linkedRepairId != null) {
+ DeviceRepair updateRepair = new DeviceRepair();
+ updateRepair.setId(linkedRepairId);
+ updateRepair.setRemark(inspectionTask.getAbnormalDescription());
+ deviceRepairMapper.updateById(updateRepair);
+ return linkedRepairId;
+ }
+
+ DeviceRepair deviceRepair = buildDeviceRepair(inspectionTask, oldInspectionTask);
+ deviceRepairMapper.insert(deviceRepair);
+ return deviceRepair.getId();
+ }
+
+ private DeviceRepair buildDeviceRepair(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+ DeviceRepair deviceRepair = new DeviceRepair();
+ Long deviceLedgerId = resolveDeviceLedgerId(inspectionTask, oldInspectionTask);
+ DeviceLedger deviceLedger = resolveDeviceLedger(deviceLedgerId);
+ deviceRepair.setDeviceLedgerId(deviceLedgerId);
+ deviceRepair.setDeviceName(resolveDeviceName(inspectionTask, oldInspectionTask, deviceLedger));
+ deviceRepair.setDeviceModel(deviceLedger == null ? null : deviceLedger.getDeviceModel());
+ deviceRepair.setRepairName(resolveRepairReporter(inspectionTask, oldInspectionTask));
+ deviceRepair.setRepairTime(new Date());
+ deviceRepair.setRemark(inspectionTask.getAbnormalDescription());
+ deviceRepair.setMachineryCategory(deviceLedger == null ? null : deviceLedger.getType());
+ deviceRepair.setStatus(REPAIR_STATUS_PENDING);
+ return deviceRepair;
+ }
+
+ private Long resolveDeviceLedgerId(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+ Integer taskId = inspectionTask.getTaskId();
+ if (taskId == null && oldInspectionTask != null) {
+ taskId = oldInspectionTask.getTaskId();
+ }
+ if (taskId == null || taskId <= 0) {
+ return null;
+ }
+ return taskId.longValue();
+ }
+
+ private DeviceLedger resolveDeviceLedger(Long deviceLedgerId) {
+ if (deviceLedgerId == null) {
+ return null;
+ }
+ return deviceLedgerMapper.selectById(deviceLedgerId);
+ }
+
+ private String resolveDeviceName(InspectionTask inspectionTask, InspectionTask oldInspectionTask, DeviceLedger deviceLedger) {
+ String taskName = inspectionTask.getTaskName();
+ if (StringUtils.isBlank(taskName) && oldInspectionTask != null) {
+ taskName = oldInspectionTask.getTaskName();
+ }
+ if (StringUtils.isNotBlank(taskName)) {
+ return taskName;
+ }
+ return deviceLedger == null ? null : deviceLedger.getDeviceName();
+ }
+
+ private String resolveRepairReporter(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+ String reporter = inspectionTask.getInspector();
+ if (StringUtils.isBlank(reporter) && oldInspectionTask != null) {
+ reporter = oldInspectionTask.getInspector();
+ }
+ if (StringUtils.isNotBlank(reporter)) {
+ return reporter;
+ }
+ String inspectorNameByUserId = resolveInspectorNameByUserId(inspectionTask.getInspectorId());
+ if (StringUtils.isBlank(inspectorNameByUserId) && oldInspectionTask != null) {
+ inspectorNameByUserId = resolveInspectorNameByUserId(oldInspectionTask.getInspectorId());
+ }
+ if (StringUtils.isNotBlank(inspectorNameByUserId)) {
+ return inspectorNameByUserId;
+ }
+ try {
+ return SecurityUtils.getUsername();
+ } catch (Exception ignored) {
+ return "system";
+ }
+ }
+
+ private String resolveInspectorNameByUserId(String inspectorIds) {
+ if (StringUtils.isBlank(inspectorIds)) {
+ return null;
+ }
+ String firstInspectorId = Arrays.stream(inspectorIds.split(","))
+ .map(String::trim)
+ .filter(StringUtils::isNotBlank)
+ .findFirst()
+ .orElse(null);
+ if (!StringUtils.isNumeric(firstInspectorId)) {
+ return null;
+ }
+ SysUser sysUser = sysUserMapper.selectUserById(Long.parseLong(firstInspectorId));
+ return sysUser == null ? null : sysUser.getNickName();
+ }
+
+ private void saveInspectionAttachments(Long inspectionTaskId, InspectionTaskDto inspectionTaskDto) {
+ saveAttachmentIfPresent(inspectionTaskId, ApplicationTypeEnum.FILE, inspectionTaskDto.getCommonFileListDTO());
+ saveAttachmentIfPresent(inspectionTaskId, ApplicationTypeEnum.AFTER_FILE, inspectionTaskDto.getCommonFileListAfterDTO());
+ saveAttachmentIfPresent(inspectionTaskId, ApplicationTypeEnum.BEFORE_FILE, inspectionTaskDto.getCommonFileListBeforeDTO());
+ }
+
+ private void saveAttachmentIfPresent(Long inspectionTaskId, ApplicationTypeEnum applicationTypeEnum, List<StorageBlobDTO> storageBlobDTOS) {
+ if (storageBlobDTOS == null) {
+ return;
+ }
+ fileUtil.saveStorageAttachment(applicationTypeEnum, RecordTypeEnum.INSPECTION_TASK, inspectionTaskId, storageBlobDTOS);
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public int delByIds(Long[] ids) {
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java
index 389eda9..adc2416 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java
@@ -3,8 +3,9 @@
import com.ruoyi.inspectiontask.mapper.InspectionTaskMapper;
import com.ruoyi.inspectiontask.pojo.InspectionTask;
import com.ruoyi.inspectiontask.pojo.TimingTask;
-import lombok.RequiredArgsConstructor;
+import com.ruoyi.common.utils.StringUtils;
import org.quartz.*;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@@ -20,12 +21,13 @@
@Component
@DisallowConcurrentExecution // 绂佹骞跺彂鎵ц鍚屼竴涓狫ob
-@RequiredArgsConstructor
public class TimingTaskJob implements Job, Serializable {
private static final long serialVersionUID = 1L; // 蹇呴』瀹氫箟搴忓垪鍖朓D
- private final InspectionTaskMapper inspectionTaskMapper;
- private final JdbcTemplate jdbcTemplate;
+ @Autowired
+ private InspectionTaskMapper inspectionTaskMapper;
+ @Autowired
+ private JdbcTemplate jdbcTemplate;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
@@ -46,7 +48,10 @@
if (timingTask == null) {
throw new JobExecutionException("鎵句笉鍒板畾鏃朵换鍔�: " + taskId);
}
-
+ if (timingTask.getIsEnabled() != null && timingTask.getIsEnabled() == 0) {
+ return;
+ }
+
// if (!timingTask.isActive()) {
// throw new JobExecutionException("瀹氭椂浠诲姟宸茬鐢�: " + taskId);
// }
@@ -98,10 +103,15 @@
// 澶嶅埗鍩烘湰灞炴��
inspectionTask.setTaskName(timingTask.getTaskName());
+ inspectionTask.setInspectionProject(timingTask.getInspectionProject());
inspectionTask.setTaskId(timingTask.getTaskId());
inspectionTask.setInspectorId(timingTask.getInspectorIds());
inspectionTask.setInspectionLocation(timingTask.getInspectionLocation());
- inspectionTask.setRemarks("鑷姩鐢熸垚鑷畾鏃朵换鍔D: " + timingTask.getId());
+ String remarks = "鑷姩鐢熸垚鑷畾鏃朵换鍔D: " + timingTask.getId();
+ if (StringUtils.isNotBlank(timingTask.getRemarks())) {
+ remarks = remarks + "锛�" + timingTask.getRemarks();
+ }
+ inspectionTask.setRemarks(remarks);
inspectionTask.setRegistrantId(timingTask.getRegistrantId());
inspectionTask.setFrequencyType(timingTask.getFrequencyType());
inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail());
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java
index 8772f48..ebe615d 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java
@@ -35,6 +35,8 @@
private final TimingTaskMapper timingTaskMapper;
private final TimingTaskScheduler timingTaskScheduler;
private final SysUserMapper sysUserMapper;
+ private static final int ENABLED = 1;
+ private static final int DISABLED = 0;
@Override
@@ -45,6 +47,13 @@
if (StringUtils.isNotBlank(timingTask.getTaskName())) {
queryWrapper.like(TimingTask::getTaskName, timingTask.getTaskName());
}
+ if (StringUtils.isNotBlank(timingTask.getInspectionProject())) {
+ queryWrapper.like(TimingTask::getInspectionProject, timingTask.getInspectionProject());
+ }
+ if (timingTask.getIsEnabled() != null) {
+ queryWrapper.eq(TimingTask::getIsEnabled, timingTask.getIsEnabled());
+ }
+ queryWrapper.orderByDesc(TimingTask::getCreateTime);
IPage<TimingTask> taskPage = timingTaskMapper.selectPage(page, queryWrapper);
// 2. 濡傛灉娌℃湁鏁版嵁锛岀洿鎺ヨ繑鍥炵┖鍒嗛〉
@@ -115,8 +124,17 @@
@Override
@Transactional
public int addOrEditTimingTask(TimingTaskDto timingTaskDto) throws SchedulerException {
+ TimingTask oldTimingTask = null;
+ if (Objects.nonNull(timingTaskDto.getId())) {
+ oldTimingTask = timingTaskMapper.selectById(timingTaskDto.getId());
+ if (oldTimingTask == null) {
+ throw new IllegalArgumentException("瀹氭椂浠诲姟涓嶅瓨鍦�");
+ }
+ }
TimingTask timingTask = new TimingTask();
BeanUtils.copyProperties(timingTaskDto, timingTask);
+ timingTask.setIsEnabled(resolveEnabledValue(timingTask.getIsEnabled(), oldTimingTask));
+ timingTask.setActive(ENABLED == timingTask.getIsEnabled());
// 1. 瑙f瀽瀛楃涓蹭负 LocalDate锛堝彧鍖呭惈骞存湀鏃ワ級
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate localDate = LocalDate.now();
@@ -132,13 +150,12 @@
// 璁剧疆鍒涘缓浜轰俊鎭拰榛樿鍊�
if (Objects.isNull(timingTaskDto.getId())) {
timingTask.setRegistrationDate(LocalDate.now());
- timingTask.setActive(true);
// 璁$畻棣栨鎵ц鏃堕棿
LocalDateTime firstExecutionTime = calculateFirstExecutionTime(timingTask);
timingTask.setNextExecutionTime(firstExecutionTime);
int result = timingTaskMapper.insert(timingTask);
- if (result > 0) {
+ if (result > 0 && isEnabled(timingTask.getIsEnabled(), timingTask.isActive())) {
// 鏂板鎴愬姛鍚庢坊鍔犲埌璋冨害鍣�
timingTaskScheduler.scheduleTimingTask(timingTask);
}
@@ -148,8 +165,17 @@
int result = timingTaskMapper.updateById(timingTask);
if (result > 0) {
- // 鏇存柊鎴愬姛鍚庨噸鏂拌皟搴︿换鍔�
- timingTaskScheduler.rescheduleTimingTask(timingTask);
+ boolean oldEnabled = isEnabled(oldTimingTask == null ? null : oldTimingTask.getIsEnabled(), oldTimingTask != null && oldTimingTask.isActive());
+ boolean newEnabled = isEnabled(timingTask.getIsEnabled(), timingTask.isActive());
+ if (!newEnabled) {
+ timingTaskScheduler.unscheduleTimingTask(timingTask.getId());
+ } else if (oldEnabled) {
+ // 鏇存柊鎴愬姛鍚庨噸鏂拌皟搴︿换鍔�
+ timingTaskScheduler.rescheduleTimingTask(timingTask);
+ } else {
+ // 浠庣鐢ㄦ敼涓哄惎鐢ㄦ椂閲嶆柊鍒涘缓璋冨害浠诲姟
+ timingTaskScheduler.scheduleTimingTask(timingTask);
+ }
}
return result;
}
@@ -451,6 +477,26 @@
return days;
}
+ private Integer resolveEnabledValue(Integer requestEnabled, TimingTask oldTimingTask) {
+ if (requestEnabled != null) {
+ return requestEnabled;
+ }
+ if (oldTimingTask != null) {
+ if (oldTimingTask.getIsEnabled() != null) {
+ return oldTimingTask.getIsEnabled();
+ }
+ return oldTimingTask.isActive() ? ENABLED : DISABLED;
+ }
+ return ENABLED;
+ }
+
+ private boolean isEnabled(Integer enabledValue, boolean activeFallback) {
+ if (enabledValue != null) {
+ return ENABLED == enabledValue;
+ }
+ return activeFallback;
+ }
+
@Override
diff --git a/src/main/java/com/ruoyi/mock/controller/DataCheckController.java b/src/main/java/com/ruoyi/mock/controller/DataCheckController.java
new file mode 100644
index 0000000..e8c0b8d
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/controller/DataCheckController.java
@@ -0,0 +1,54 @@
+package com.ruoyi.mock.controller;
+
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.mock.dto.DataCheckRequest;
+import com.ruoyi.mock.dto.DataGenerateRequest;
+import com.ruoyi.mock.service.DataCheckService;
+import com.ruoyi.mock.service.DataGenerateService;
+import com.ruoyi.mock.vo.DataCheckResult;
+import com.ruoyi.mock.vo.DataCheckResult.CheckItem;
+import com.ruoyi.mock.vo.DataGenerateResult;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/mock")
+@RequiredArgsConstructor
+@Tag(name = "鏁版嵁妯℃嫙")
+public class DataCheckController {
+
+ private final DataCheckService dataCheckService;
+ private final DataGenerateService dataGenerateService;
+
+ @PostMapping("/dataCheck")
+ @Operation(summary = "妫�娴嬪熀纭�鏁版嵁")
+ public R<DataCheckResult> dataCheck(@RequestBody DataCheckRequest request) {
+ DataCheckResult result = dataCheckService.check(request);
+ return R.ok(result);
+ }
+
+ @PostMapping("/generate")
+ @Operation(summary = "AI鐢熸垚妯℃嫙鏁版嵁")
+ public R<?> generate(@RequestBody DataGenerateRequest request) {
+ // 鍏堟牎楠屽熀纭�鏁版嵁
+ DataCheckRequest checkRequest = new DataCheckRequest();
+ checkRequest.setModules(request.getModules());
+ DataCheckResult checkResult = dataCheckService.check(checkRequest);
+
+ boolean allPassed = checkResult.getItems().stream().allMatch(CheckItem::isPassed);
+ if (!allPassed) {
+ DataGenerateResult failResult = new DataGenerateResult();
+ failResult.setStatus("CHECK_FAILED");
+ failResult.setCheckResult(checkResult);
+ return R.fail(failResult, "鍩虹鏁版嵁涓嶈冻锛岃鍏堣ˉ鍏呭悗鍐嶇敓鎴�");
+ }
+
+ DataGenerateResult result = dataGenerateService.generate(request);
+ return R.ok(result);
+ }
+}
diff --git a/src/main/java/com/ruoyi/mock/dto/DataCheckRequest.java b/src/main/java/com/ruoyi/mock/dto/DataCheckRequest.java
new file mode 100644
index 0000000..9e1d7db
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/dto/DataCheckRequest.java
@@ -0,0 +1,15 @@
+package com.ruoyi.mock.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 鍩虹鏁版嵁妫�娴嬭姹�
+ */
+@Data
+public class DataCheckRequest {
+
+ /** 闇�瑕佹娴嬬殑妯″潡: sales / purchase / quality */
+ private List<String> modules;
+}
diff --git a/src/main/java/com/ruoyi/mock/dto/DataGenerateRequest.java b/src/main/java/com/ruoyi/mock/dto/DataGenerateRequest.java
new file mode 100644
index 0000000..9f9522c
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/dto/DataGenerateRequest.java
@@ -0,0 +1,33 @@
+package com.ruoyi.mock.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * AI鏁版嵁鐢熸垚璇锋眰
+ */
+@Data
+public class DataGenerateRequest {
+
+ /** 瑕佺敓鎴愭暟鎹殑妯″潡: sales / purchase / quality / production / stock */
+ private List<String> modules;
+
+ /** 琛屼笟锛堝涓級锛屽: ["鏈烘鍒堕��", "椋熷搧鍔犲伐", "鐢靛瓙瑁呴厤"] */
+ private List<String> industries;
+
+ /** 姣忎釜瀹炰綋鐢熸垚鏁伴噺鐨勬渶灏忓�� */
+ private int countMin;
+
+ /** 姣忎釜瀹炰綋鐢熸垚鏁伴噺鐨勬渶澶у�� */
+ private int countMax;
+
+ /** 鏃堕棿鑼冨洿-寮�濮�, yyyy-MM-dd */
+ private String dateStart;
+
+ /** 鏃堕棿鑼冨洿-缁撴潫, yyyy-MM-dd */
+ private String dateEnd;
+
+ /** 鍏朵粬琛ュ厖鎻忚堪 */
+ private String additionalInfo;
+}
diff --git a/src/main/java/com/ruoyi/mock/prompt/MockDataPrompt.java b/src/main/java/com/ruoyi/mock/prompt/MockDataPrompt.java
new file mode 100644
index 0000000..2743445
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/prompt/MockDataPrompt.java
@@ -0,0 +1,242 @@
+package com.ruoyi.mock.prompt;
+
+import com.ruoyi.project.system.domain.SysUser;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 鍚勬ā鍧楃殑 AI Prompt 妯℃澘
+ */
+public final class MockDataPrompt {
+
+ private MockDataPrompt() {}
+
+ public static String buildSystemPrompt() {
+ return """
+ 浣犳槸涓�涓紒涓欵RP绯荤粺鐨勬暟鎹ā鎷熶笓瀹躲��
+
+ 鏍稿績瑙勫垯锛堝繀椤讳弗鏍奸伒瀹堬級锛�
+ 1. 杈撳嚭蹇呴』鏄函JSON鏁扮粍锛屼笉瑕佺敤markdown浠g爜鍧楀寘瑁癸紝涓嶈鏈変换浣曞叾浠栨枃瀛�
+ 2. 姣忎釜JSON瀵硅薄蹇呴』鍖呭惈 "entity" 瀛楁锛屽�间负瀹炰綋绫诲瀷鍚�
+ 3. 鏁版嵁鍐呭瑕佺鍚堟寚瀹氳涓氱殑鐗瑰緛
+ 4. 閲戦銆佹暟閲忕瓑鏁板�煎瓧娈佃鍚堢悊
+ 5. 鍚屼竴妯″潡鍐呯殑瀹炰綋涔嬮棿瑕佹湁寮曠敤鍏崇郴
+ 6. 涓嶈浣跨敤emoji鎴栫壒娈妘nicode瀛楃
+ 7. 鏈�閲嶈锛氭棩鏈熷彧浠�"鎸囧畾鏃堕棿鑼冨洿"涓彇锛岀粷瀵逛笉瑕佺敤鍏朵粬骞翠唤锛�
+ 8. 浜哄憳瀛楁锛堝entryPerson銆乻alesman绛夛級蹇呴』浠�"绯荤粺鐢ㄦ埛鍒楄〃"涓�夊彇锛屾牴鎹鑹插拰閮ㄩ棬鍖归厤瀵瑰簲妯″潡锛屼笉瑕佺紪閫犱汉鍚嶏紒
+ """;
+ }
+
+ public static String buildUserMessage(List<String> modules, List<String> industries,
+ int countMin, int countMax,
+ String dateStart, String dateEnd,
+ String additionalInfo,
+ Map<Long, String> productModelIdToCategory,
+ List<SysUser> systemUsers,
+ List<String> existingCustomerNames,
+ List<String> existingSupplierNames) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("鎸囧畾琛屼笟: ").append(String.join("銆�", industries)).append("\n");
+ sb.append("姣忕瀹炰綋鐢熸垚: ").append(countMin).append("-").append(countMax).append(" 鏉n");
+ sb.append("鎸囧畾鏃堕棿鑼冨洿: ").append(dateStart).append(" 鍒� ").append(dateEnd);
+ sb.append("锛堟墍鏈夋棩鏈熷瓧娈靛繀椤诲湪杩欎釜鑼冨洿鍐咃紒绂佹浣跨敤2023銆�2024銆�2025绛変换浣曡秴鍑鸿寖鍥寸殑骞翠唤锛侊級\n");
+ if (additionalInfo != null && !additionalInfo.isBlank()) {
+ sb.append("琛ュ厖淇℃伅: ").append(additionalInfo).append("\n");
+ }
+ sb.append("\n");
+
+ // 鎸夐《绾т骇鍝佸垎绫伙紙鎴愬搧/鍘熸潗鏂�/鍗婃垚鍝侊級鍒嗙粍鍒楀嚭浜у搧瑙勬牸
+ Map<String, List<Map.Entry<Long, String>>> grouped = productModelIdToCategory.entrySet().stream()
+ .collect(Collectors.groupingBy(
+ e -> categorize(e.getValue()),
+ java.util.LinkedHashMap::new,
+ Collectors.toList()));
+
+ sb.append("=== 浜у搧瑙勬牸鍒楄〃 ===\n");
+ for (Map.Entry<String, List<Map.Entry<Long, String>>> entry : grouped.entrySet()) {
+ String label = entry.getKey();
+ List<Map.Entry<Long, String>> items = entry.getValue();
+ sb.append("銆�").append(label).append("銆�: ");
+ sb.append(items.stream()
+ .map(e -> e.getKey() + "(" + e.getValue() + ")")
+ .collect(Collectors.joining(", "))).append("\n");
+ }
+ sb.append("閿�鍞彴璐︾殑productData鍙兘閫夈�愭垚鍝佺被銆戣鏍硷紝閲囪喘鍙拌处鍙兘閫夈�愬師鏉愭枡绫汇�戣鏍笺�俓n\n");
+
+ // 绯荤粺鐢ㄦ埛鍒楄〃锛堝惈瑙掕壊鍜岄儴闂級
+ sb.append("=== 绯荤粺鐢ㄦ埛鍒楄〃锛堜汉鍛樺瓧娈靛繀椤讳粠涓�夊彇锛屼笉瑕佺紪閫犱汉鍚嶏級===\n");
+ for (SysUser u : systemUsers) {
+ String roleNames = u.getRoleNames() != null && !u.getRoleNames().isBlank() ? u.getRoleNames() : "鏃犺鑹�";
+ String deptNames = u.getDeptNames() != null && !u.getDeptNames().isBlank() ? u.getDeptNames() : "鏃犻儴闂�";
+ sb.append(u.getNickName()).append("锛堣鑹�: ").append(roleNames).append(", 閮ㄩ棬: ").append(deptNames).append("锛塡n");
+ }
+ sb.append("閫夋嫨瑙勫垯锛歕n");
+ sb.append("- 閿�鍞ā鍧楃殑浜哄憳(entryPerson銆乻alesman)閫夎鑹叉垨閮ㄩ棬鍚玕"閿�鍞甛"鐨勭敤鎴穃n");
+ sb.append("- 閲囪喘妯″潡鐨勪汉鍛橀�夎鑹叉垨閮ㄩ棬鍚玕"閲囪喘\"鐨勭敤鎴穃n");
+ sb.append("- 鐢熶骇妯″潡鐨勪汉鍛橀�夎鑹叉垨閮ㄩ棬鍚玕"鐢熶骇\"鐨勭敤鎴穃n");
+ sb.append("- 璐ㄩ噺妯″潡鐨勪汉鍛橀�夎鑹叉垨閮ㄩ棬鍚玕"璐ㄩ噺\"鎴朶"璐ㄦ\"鐨勭敤鎴穃n");
+ sb.append("- 浠撳簱妯″潡鐨勪汉鍛橀�夎鑹叉垨閮ㄩ棬鍚玕"浠撳簱\"鎴朶"搴撳瓨\"鐨勭敤鎴穃n\n");
+
+ if (!existingCustomerNames.isEmpty()) {
+ sb.append("=== 宸叉湁瀹㈡埛锛堝彧鑳藉紩鐢紝涓嶈鐢熸垚鏂癱ustomer瀹炰綋锛�===\n");
+ sb.append(String.join("銆�", existingCustomerNames)).append("\n\n");
+ }
+ if (!existingSupplierNames.isEmpty()) {
+ sb.append("=== 宸叉湁渚涘簲鍟嗭紙鍙兘寮曠敤锛屼笉瑕佺敓鎴愭柊supplier瀹炰綋锛�===\n");
+ sb.append(String.join("銆�", existingSupplierNames)).append("\n\n");
+ }
+
+ sb.append("鏁版嵁妯″潡: ").append(String.join("銆�", modules)).append("\n\n");
+
+ if (modules.contains("sales")) {
+ sb.append(buildSalesPrompt(countMin, countMax, dateStart, dateEnd, existingCustomerNames));
+ }
+ if (modules.contains("purchase")) {
+ sb.append(buildPurchasePrompt(countMin, countMax, dateStart, dateEnd, existingSupplierNames));
+ }
+ if (modules.contains("quality")) {
+ sb.append(buildQualityPrompt(countMin, countMax, dateStart));
+ }
+ if (modules.contains("production")) {
+ sb.append(buildProductionPrompt(countMin, countMax, dateStart, dateEnd));
+ }
+ if (modules.contains("stock")) {
+ sb.append(buildStockPrompt(countMin, countMax, dateStart));
+ }
+
+ sb.append("\n璇风洿鎺ヨ緭鍑篔SON鏁扮粍:");
+ return sb.toString();
+ }
+
+ /**
+ * 灏嗛《绾т骇鍝佸悕绉版槧灏勪负鍒嗙被鏍囩
+ */
+ private static String categorize(String rootProductName) {
+ if (rootProductName == null) return "鍏朵粬绫�";
+ if (rootProductName.contains("鎴愬搧") || rootProductName.contains("浜ф垚鍝�")) return "鎴愬搧绫�-閿�鍞紭鍏堥�夎繖浜�";
+ if (rootProductName.contains("鍘熸枡") || rootProductName.contains("鍘熸潗鏂�") || rootProductName.contains("鏉愭枡")) return "鍘熸潗鏂欑被-閲囪喘浼樺厛閫夎繖浜�";
+ if (rootProductName.contains("鍗婃垚鍝�")) return "鍗婃垚鍝佺被";
+ return "鍏朵粬绫�";
+ }
+
+ private static String buildSalesPrompt(int min, int max, String dateStart, String dateEnd,
+ List<String> existingCustomerNames) {
+ String namesHint = existingCustomerNames.isEmpty() ? ""
+ : "customerName蹇呴』浠庝互涓嬪凡鏈夊鎴蜂腑閫夋嫨: " + String.join("銆�", existingCustomerNames) + "\n";
+ return """
+ 閿�鍞ā鍧楁牸寮忥紙鎵�鏈夋棩鏈熷繀椤诲湪 %s ~ %s 鑼冨洿鍐咃級:
+ %s娉ㄦ剰锛氫笉瑕佺敓鎴恈ustomer瀹炰綋锛屽彧鐢熸垚salesLedger锛�
+ productData涓殑productModelId蹇呴』閫夈�愭垚鍝佺被銆戣鏍糏D锛�
+ entryPerson鍜宻alesman蹇呴』浠庣郴缁熺敤鎴峰垪琛ㄤ腑瑙掕壊鎴栭儴闂ㄥ惈"閿�鍞�"鐨勭敤鎴蜂腑閫夊彇锛�
+ {
+ "entity": "salesLedger",
+ "customerName": "寮曠敤涓婇潰鐢熸垚鐨勫鎴峰悕绉�",
+ "salesContractNo": "XS-YYYYMMDD-001",
+ "projectName": "XX椤圭洰",
+ "entryDate": "%s",
+ "entryPerson": "浠庣敤鎴峰垪琛ㄤ腑閫�",
+ "salesman": "浠庣敤鎴峰垪琛ㄤ腑閫�",
+ "contractAmount": 50000.00,
+ "paymentMethod": "鏈堢粨30澶�",
+ "executionDate": "%s",
+ "deliveryDate": "%s",
+ "type": 1,
+ "productData": [{
+ "productId": 1, "productModelId": 1, "quantity": 100,
+ "taxInclusiveUnitPrice": 500.00, "taxInclusiveTotalPrice": 50000.00,
+ "taxExclusiveTotalPrice": 44247.79, "taxRate": 13.00, "unit": "浠�", "type": 1
+ }]
+ }
+ salesContractNo涓璝YYYMMDD鏇挎崲涓篹ntryDate鐨勬棩鏈熴��%d-%d鏉°��
+ """.formatted(dateStart, dateEnd, namesHint, dateStart, dateStart, dateEnd, min, max);
+ }
+
+ private static String buildPurchasePrompt(int min, int max, String dateStart, String dateEnd,
+ List<String> existingSupplierNames) {
+ String namesHint = existingSupplierNames.isEmpty() ? ""
+ : "supplierName蹇呴』浠庝互涓嬪凡鏈変緵搴斿晢涓�夋嫨: " + String.join("銆�", existingSupplierNames) + "\n";
+ return """
+ 閲囪喘妯″潡鏍煎紡锛堟墍鏈夋棩鏈熷繀椤诲湪 %s ~ %s 鑼冨洿鍐咃級:
+ %s娉ㄦ剰锛氫笉瑕佺敓鎴恠upplier瀹炰綋锛屽彧鐢熸垚purchaseLedger锛�
+ productData涓殑productModelId蹇呴』閫夈�愬師鏉愭枡绫汇�戣鏍糏D锛�
+ 浜哄憳瀛楁蹇呴』浠庣郴缁熺敤鎴峰垪琛ㄤ腑瑙掕壊鎴栭儴闂ㄥ惈"閲囪喘"鐨勭敤鎴蜂腑閫夊彇锛�
+ {
+ "entity": "purchaseLedger",
+ "supplierName": "浠庡凡鏈変緵搴斿晢涓�夋嫨",
+ "purchaseContractNumber": "CG-YYYYMMDD-001",
+ "projectName": "XX閲囪喘椤圭洰",
+ "entryDate": "%s",
+ "contractAmount": 30000.00,
+ "paymentMethod": "璐у埌浠樻",
+ "executionDate": "%s",
+ "productData": [{
+ "productId": 1, "productModelId": 1, "quantity": 50,
+ "taxInclusiveUnitPrice": 600.00, "taxInclusiveTotalPrice": 30000.00,
+ "taxExclusiveTotalPrice": 26548.67, "taxRate": 13.00, "unit": "浠�", "type": 2
+ }]
+ }
+ purchaseContractNumber涓璝YYYMMDD鏇挎崲涓篹ntryDate鐨勬棩鏈熴��%d-%d鏉°��
+ """.formatted(dateStart, dateEnd, namesHint, dateStart, dateStart, min, max);
+ }
+
+ private static String buildQualityPrompt(int min, int max, String dateStart) {
+ return """
+ 璐ㄩ噺妯″潡鏍煎紡:
+ {
+ "entity": "qualityTestStandard",
+ "standardNo": "QTS-YYYYMMDD-001",
+ "standardName": "XX浜у搧妫�楠屾爣鍑�",
+ "inspectType": 0,
+ "remark": "閫傜敤浜嶺X琛屼笟鐨勮川閲忔楠屾爣鍑�"
+ }
+ inspectType: 0=鍘熸潗鏂欐楠�, 1=杩囩▼妫�楠�, 2=鍑哄巶妫�楠屻�備笁绉嶇被鍨嬮兘瑕佽鐩栥��
+ standardNo涓璝YYYMMDD鏇挎崲涓� %s銆�%d-%d鏉°��
+ {
+ "entity": "qualityTestStandardBinding",
+ "productId": 1,
+ "testStandardId": 1
+ }
+ %d-%d鏉°��
+ """.formatted(dateStart.replace("-", ""), min, max, min, max);
+ }
+
+ private static String buildProductionPrompt(int min, int max, String dateStart, String dateEnd) {
+ return """
+ 鐢熶骇妯″潡鏍煎紡锛堟墍鏈夋棩鏈熷繀椤诲湪 %s ~ %s 鑼冨洿鍐咃級:
+ {
+ "entity": "productionPlan",
+ "productModelId": 1,
+ "qtyRequired": 200,
+ "requiredDate": "%s",
+ "source": "閿�鍞�",
+ "promisedDeliveryDate": "%s",
+ "remark": "XX瀹㈡埛璁㈠崟闇�姹�"
+ }
+ {
+ "entity": "productionOrder",
+ "productModelId": 1,
+ "quantity": 200,
+ "planCompleteTime": "%s",
+ "remark": "鏍规嵁鐢熶骇璁″垝XX鐢熸垚"
+ }
+ source鍙��"閿�鍞�"鎴�"鍐呴儴"銆�%d-%d鏉°��
+ """.formatted(dateStart, dateEnd, dateStart, dateEnd, dateEnd, min, max);
+ }
+
+ private static String buildStockPrompt(int min, int max, String dateStart) {
+ return """
+ 搴撳瓨妯″潡鏍煎紡:
+ {
+ "entity": "stockInventory",
+ "productModelId": 1,
+ "qualitity": 500,
+ "batchNo": "BATCH-YYYYMMDD-001",
+ "warnNum": 50,
+ "remark": "瀹夊叏搴撳瓨"
+ }
+ batchNo涓璝YYYMMDD鏇挎崲涓� %s銆�%d-%d鏉°��
+ """.formatted(dateStart.replace("-", ""), min, max);
+ }
+}
diff --git a/src/main/java/com/ruoyi/mock/service/DataCheckService.java b/src/main/java/com/ruoyi/mock/service/DataCheckService.java
new file mode 100644
index 0000000..ac3b652
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/service/DataCheckService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.mock.service;
+
+import com.ruoyi.mock.dto.DataCheckRequest;
+import com.ruoyi.mock.vo.DataCheckResult;
+
+/**
+ * 鍩虹鏁版嵁妫�娴嬫湇鍔�
+ */
+public interface DataCheckService {
+
+ /**
+ * 妫�娴嬫寚瀹氭ā鍧楃殑鍩虹鏁版嵁鏄惁灏辩华
+ */
+ DataCheckResult check(DataCheckRequest request);
+}
diff --git a/src/main/java/com/ruoyi/mock/service/DataGenerateService.java b/src/main/java/com/ruoyi/mock/service/DataGenerateService.java
new file mode 100644
index 0000000..1b0b6b0
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/service/DataGenerateService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.mock.service;
+
+import com.ruoyi.mock.dto.DataGenerateRequest;
+import com.ruoyi.mock.vo.DataGenerateResult;
+
+/**
+ * AI鏁版嵁鐢熸垚鏈嶅姟
+ */
+public interface DataGenerateService {
+
+ /**
+ * 鏍规嵁璇锋眰鍙傛暟璋冪敤AI鐢熸垚妯℃嫙鏁版嵁骞跺垱寤�
+ */
+ DataGenerateResult generate(DataGenerateRequest request);
+}
diff --git a/src/main/java/com/ruoyi/mock/service/impl/DataCheckServiceImpl.java b/src/main/java/com/ruoyi/mock/service/impl/DataCheckServiceImpl.java
new file mode 100644
index 0000000..0fc4718
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/service/impl/DataCheckServiceImpl.java
@@ -0,0 +1,282 @@
+package com.ruoyi.mock.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import com.ruoyi.approve.mapper.ApprovalTemplateMapper;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.mapper.ProductMapper;
+import com.ruoyi.basic.mapper.ProductModelMapper;
+import com.ruoyi.basic.mapper.SupplierManageMapper;
+import com.ruoyi.common.enums.TypeEnums;
+import com.ruoyi.mock.dto.DataCheckRequest;
+import com.ruoyi.mock.service.DataCheckService;
+import com.ruoyi.mock.vo.DataCheckResult;
+import com.ruoyi.mock.vo.DataCheckResult.CheckItem;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.mapper.SysUserMapper;
+import com.ruoyi.quality.mapper.QualityTestStandardBindingMapper;
+import com.ruoyi.quality.mapper.QualityTestStandardMapper;
+import com.ruoyi.technology.mapper.TechnologyBomMapper;
+import com.ruoyi.technology.mapper.TechnologyBomStructureMapper;
+import com.ruoyi.technology.mapper.TechnologyOperationMapper;
+import com.ruoyi.technology.mapper.TechnologyRoutingMapper;
+import com.ruoyi.technology.mapper.TechnologyRoutingOperationMapper;
+import com.ruoyi.technology.pojo.TechnologyBom;
+import com.ruoyi.technology.pojo.TechnologyBomStructure;
+import com.ruoyi.technology.pojo.TechnologyRouting;
+import com.ruoyi.technology.pojo.TechnologyRoutingOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@RequiredArgsConstructor
+public class DataCheckServiceImpl implements DataCheckService {
+
+ private final ProductMapper productMapper;
+ private final ProductModelMapper productModelMapper;
+ private final CustomerMapper customerMapper;
+ private final SupplierManageMapper supplierManageMapper;
+ private final ApprovalTemplateMapper approvalTemplateMapper;
+ private final QualityTestStandardMapper qualityTestStandardMapper;
+ private final QualityTestStandardBindingMapper qualityTestStandardBindingMapper;
+ private final TechnologyRoutingMapper technologyRoutingMapper;
+ private final TechnologyRoutingOperationMapper technologyRoutingOperationMapper;
+ private final TechnologyOperationMapper technologyOperationMapper;
+ private final TechnologyBomMapper technologyBomMapper;
+ private final TechnologyBomStructureMapper technologyBomStructureMapper;
+ private final SysUserMapper sysUserMapper;
+
+ @Override
+ public DataCheckResult check(DataCheckRequest request) {
+ List<String> modules = request.getModules();
+ if (modules == null) {
+ modules = List.of();
+ }
+
+ Map<String, CheckItem> itemMap = new LinkedHashMap<>();
+
+ if (!modules.isEmpty()) {
+ addProductCheck(itemMap);
+ addUserChecks(itemMap);
+ }
+
+ for (String module : modules) {
+ switch (module) {
+ case "sales" -> addSalesChecks(itemMap);
+ case "purchase" -> addPurchaseChecks(itemMap);
+ case "quality" -> addQualityChecks(itemMap);
+ case "production" -> addProductionChecks(itemMap);
+ }
+ }
+
+ List<CheckItem> items = new ArrayList<>(itemMap.values());
+
+ DataCheckResult result = new DataCheckResult();
+ result.setItems(items);
+ result.setTotalItems(items.size());
+ result.setPassedItems((int) items.stream().filter(CheckItem::isPassed).count());
+ return result;
+ }
+
+ private void addProductCheck(Map<String, CheckItem> itemMap) {
+ String key = "common:浜у搧鏁版嵁";
+ if (itemMap.containsKey(key)) {
+ return;
+ }
+ long count = productMapper.selectCount(null);
+ itemMap.put(key, buildItem("common", "浜у搧鏁版嵁", 1, (int) count,
+ "缂哄皯浜у搧鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-浜у搧绠$悊銆戜腑娣诲姞鑷冲皯1鏉′骇鍝�"));
+ }
+
+ private void addUserChecks(Map<String, CheckItem> itemMap) {
+ // 1. 绯荤粺鐢ㄦ埛
+ String userKey = "common:绯荤粺鐢ㄦ埛";
+ if (!itemMap.containsKey(userKey)) {
+ List<SysUser> users = sysUserMapper.selectUserListWithDetail();
+ itemMap.put(userKey, buildItem("common", "绯荤粺鐢ㄦ埛", 1, (int) users.size(),
+ "缂哄皯绯荤粺鐢ㄦ埛锛岃鍏堝湪銆愮郴缁熺鐞�-鐢ㄦ埛绠$悊銆戜腑娣诲姞鐢ㄦ埛"));
+ }
+
+ // 2. 鏈夎鑹茬殑鐢ㄦ埛
+ String userWithRoleKey = "common:鐢ㄦ埛瑙掕壊閰嶇疆";
+ if (!itemMap.containsKey(userWithRoleKey)) {
+ List<SysUser> users = sysUserMapper.selectUserListWithDetail();
+ long withRole = users.stream().filter(u -> u.getRoleNames() != null && !u.getRoleNames().isBlank()).count();
+ itemMap.put(userWithRoleKey, buildItem("common", "鐢ㄦ埛瑙掕壊閰嶇疆", 1, (int) withRole,
+ "娌℃湁鐢ㄦ埛鍒嗛厤瑙掕壊锛岃鍏堝湪銆愮郴缁熺鐞�-鐢ㄦ埛绠$悊銆戜腑涓虹敤鎴峰垎閰嶈鑹�"));
+ }
+
+ // 3. 鏈夐儴闂ㄧ殑鐢ㄦ埛
+ String userWithDeptKey = "common:鐢ㄦ埛閮ㄩ棬閰嶇疆";
+ if (!itemMap.containsKey(userWithDeptKey)) {
+ List<SysUser> users = sysUserMapper.selectUserListWithDetail();
+ long withDept = users.stream().filter(u -> u.getDeptNames() != null && !u.getDeptNames().isBlank()).count();
+ itemMap.put(userWithDeptKey, buildItem("common", "鐢ㄦ埛閮ㄩ棬閰嶇疆", 1, (int) withDept,
+ "娌℃湁鐢ㄦ埛鍒嗛厤閮ㄩ棬锛岃鍏堝湪銆愮郴缁熺鐞�-鐢ㄦ埛绠$悊銆戜腑涓虹敤鎴峰垎閰嶉儴闂�"));
+ }
+ }
+
+ private void addSalesChecks(Map<String, CheckItem> itemMap) {
+ String customerKey = "sales:瀹㈡埛鏁版嵁";
+ if (!itemMap.containsKey(customerKey)) {
+ long count = customerMapper.selectCount(null);
+ itemMap.put(customerKey, buildItem("sales", "瀹㈡埛鏁版嵁", 1, (int) count,
+ "缂哄皯瀹㈡埛鏁版嵁锛岃鍏堝湪銆愬熀纭�鏁版嵁-瀹㈡埛绠$悊銆戜腑娣诲姞鑷冲皯1鏉″鎴�"));
+ }
+
+ String quotationKey = "sales:鎶ヤ环瀹℃壒妯℃澘";
+ if (!itemMap.containsKey(quotationKey)) {
+ long count = approvalTemplateMapper.selectCount(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getBusinessType, TypeEnums.QUOTATION_APPROVAL.getCode()));
+ itemMap.put(quotationKey, buildItem("sales", "鎶ヤ环瀹℃壒妯℃澘", 1, (int) count,
+ "缂哄皯鎶ヤ环瀹℃壒妯℃澘锛岃鍏堝湪銆愮郴缁熺鐞�-瀹℃壒妯℃澘銆戜腑鍒涘缓鎶ヤ环瀹℃壒妯℃澘"));
+ }
+
+ String shippingKey = "sales:鍙戣揣瀹℃壒妯℃澘";
+ if (!itemMap.containsKey(shippingKey)) {
+ long count = approvalTemplateMapper.selectCount(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getBusinessType, TypeEnums.SHIPPING_APPROVAL.getCode()));
+ itemMap.put(shippingKey, buildItem("sales", "鍙戣揣瀹℃壒妯℃澘", 1, (int) count,
+ "缂哄皯鍙戣揣瀹℃壒妯℃澘锛岃鍏堝湪銆愮郴缁熺鐞�-瀹℃壒妯℃澘銆戜腑鍒涘缓鍙戣揣瀹℃壒妯℃澘"));
+ }
+ }
+
+ private void addPurchaseChecks(Map<String, CheckItem> itemMap) {
+ String supplierKey = "purchase:渚涘簲鍟嗘暟鎹�";
+ if (!itemMap.containsKey(supplierKey)) {
+ long count = supplierManageMapper.selectCount(null);
+ itemMap.put(supplierKey, buildItem("purchase", "渚涘簲鍟嗘暟鎹�", 1, (int) count,
+ "缂哄皯渚涘簲鍟嗘暟鎹紝璇峰厛鍦ㄣ�愬熀纭�鏁版嵁-渚涘簲鍟嗙鐞嗐�戜腑娣诲姞鑷冲皯1鏉′緵搴斿晢"));
+ }
+
+ String tplKey = "purchase:閲囪喘瀹℃壒妯℃澘";
+ if (!itemMap.containsKey(tplKey)) {
+ long count = approvalTemplateMapper.selectCount(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getBusinessType, TypeEnums.PURCHASE_APPROVAL.getCode()));
+ itemMap.put(tplKey, buildItem("purchase", "閲囪喘瀹℃壒妯℃澘", 1, (int) count,
+ "缂哄皯閲囪喘瀹℃壒妯℃澘锛岃鍏堝湪銆愮郴缁熺鐞�-瀹℃壒妯℃澘銆戜腑鍒涘缓閲囪喘瀹℃壒妯℃澘"));
+ }
+ }
+
+ private void addQualityChecks(Map<String, CheckItem> itemMap) {
+ String standardKey = "quality:妫�娴嬫爣鍑�";
+ if (!itemMap.containsKey(standardKey)) {
+ long count = qualityTestStandardMapper.selectCount(null);
+ itemMap.put(standardKey, buildItem("quality", "妫�娴嬫爣鍑�", 1, (int) count,
+ "缂哄皯妫�娴嬫爣鍑嗭紝璇峰厛鍦ㄣ�愯川閲忕鐞�-妫�娴嬫爣鍑嗐�戜腑鍒涘缓妫�娴嬫爣鍑�"));
+ }
+
+ String bindingKey = "quality:鎸囨爣缁戝畾";
+ if (!itemMap.containsKey(bindingKey)) {
+ long count = qualityTestStandardBindingMapper.selectCount(null);
+ itemMap.put(bindingKey, buildItem("quality", "鎸囨爣缁戝畾", 1, (int) count,
+ "缂哄皯鎸囨爣缁戝畾锛岃鍏堝湪銆愯川閲忕鐞�-妫�娴嬫爣鍑嗙粦瀹氥�戜腑灏嗘娴嬫爣鍑嗕笌浜у搧缁戝畾"));
+ }
+ }
+
+ private void addProductionChecks(Map<String, CheckItem> itemMap) {
+ // 1. 浜у搧瑙勬牸
+ String modelKey = "production:浜у搧瑙勬牸";
+ if (!itemMap.containsKey(modelKey)) {
+ long count = productModelMapper.selectCount(null);
+ itemMap.put(modelKey, buildItem("production", "浜у搧瑙勬牸", 1, (int) count,
+ "缂哄皯浜у搧瑙勬牸锛岃鍏堝湪銆愬熀纭�鏁版嵁-浜у搧绠$悊銆戜腑涓轰骇鍝佹坊鍔犺鏍煎瀷鍙�"));
+ }
+
+ // 2. 宸ュ簭
+ String operationKey = "production:宸ュ簭";
+ if (!itemMap.containsKey(operationKey)) {
+ long count = technologyOperationMapper.selectCount(null);
+ itemMap.put(operationKey, buildItem("production", "宸ュ簭", 1, (int) count,
+ "缂哄皯宸ュ簭锛岃鍏堝湪銆愬伐鑹鸿璁�-宸ュ簭绠$悊銆戜腑鍒涘缓宸ュ簭"));
+ }
+
+ // 3. BOM
+ String bomKey = "production:BOM";
+ if (!itemMap.containsKey(bomKey)) {
+ long count = technologyBomMapper.selectCount(null);
+ itemMap.put(bomKey, buildItem("production", "BOM", 1, (int) count,
+ "缂哄皯BOM锛岃鍏堝湪銆愬伐鑹鸿璁�-BOM绠$悊銆戜腑鍒涘缓BOM"));
+ }
+
+ // 4. BOM浜у搧缁撴瀯
+ String bomStructureKey = "production:BOM浜у搧缁撴瀯";
+ if (!itemMap.containsKey(bomStructureKey)) {
+ long count = technologyBomStructureMapper.selectCount(null);
+ itemMap.put(bomStructureKey, buildItem("production", "BOM浜у搧缁撴瀯", 1, (int) count,
+ "缂哄皯BOM浜у搧缁撴瀯锛岃鍏堝湪銆愬伐鑹鸿璁�-BOM绠$悊銆戜腑涓築OM娣诲姞浜у搧缁撴瀯鑺傜偣"));
+ }
+
+ // 5. 宸ヨ壓璺嚎
+ String routingKey = "production:宸ヨ壓璺嚎";
+ if (!itemMap.containsKey(routingKey)) {
+ long count = technologyRoutingMapper.selectCount(null);
+ itemMap.put(routingKey, buildItem("production", "宸ヨ壓璺嚎", 1, (int) count,
+ "缂哄皯宸ヨ壓璺嚎锛岃鍏堝湪銆愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑鍒涘缓宸ヨ壓璺嚎"));
+ }
+
+ // 6. 宸ヨ壓璺嚎宸ュ簭
+ String routingOpKey = "production:宸ヨ壓璺嚎宸ュ簭";
+ if (!itemMap.containsKey(routingOpKey)) {
+ long count = technologyRoutingOperationMapper.selectCount(null);
+ itemMap.put(routingOpKey, buildItem("production", "宸ヨ壓璺嚎宸ュ簭", 1, (int) count,
+ "缂哄皯宸ヨ壓璺嚎宸ュ簭锛岃鍏堝湪銆愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑涓哄伐鑹鸿矾绾挎坊鍔犲伐搴�"));
+ }
+
+ // 7. 鍏宠仈鎬ф娴嬶細鏈変骇鍝佽鏍间絾鏃犲伐鑹鸿矾绾跨殑
+ String linkageKey = "production:浜у搧-宸ヨ壓璺嚎鍏宠仈";
+ if (!itemMap.containsKey(linkageKey)) {
+ long modelCount = productModelMapper.selectCount(null);
+ long routedCount = technologyRoutingMapper.selectCount(
+ new LambdaQueryWrapper<TechnologyRouting>()
+ .isNotNull(TechnologyRouting::getProductModelId)
+ .gt(TechnologyRouting::getProductModelId, 0));
+ itemMap.put(linkageKey, buildItem("production", "浜у搧-宸ヨ壓璺嚎鍏宠仈",
+ (int) Math.min(modelCount, 1), (int) routedCount,
+ "閮ㄥ垎浜у搧瑙勬牸鏈叧鑱斿伐鑹鸿矾绾匡紝璇峰厛鍦ㄣ�愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑涓轰骇鍝佽鏍煎垱寤哄伐鑹鸿矾绾�"));
+ }
+
+ // 8. 鍏宠仈鎬ф娴嬶細鏈夊伐鑹鸿矾绾夸絾鏃犲伐搴忕殑
+ String routingOpLinkKey = "production:宸ヨ壓璺嚎-宸ュ簭鍏宠仈";
+ if (!itemMap.containsKey(routingOpLinkKey)) {
+ long routingCount = technologyRoutingMapper.selectCount(null);
+ long routedOpCount = technologyRoutingOperationMapper.selectCount(
+ new LambdaQueryWrapper<TechnologyRoutingOperation>()
+ .gt(TechnologyRoutingOperation::getTechnologyRoutingId, 0));
+ itemMap.put(routingOpLinkKey, buildItem("production", "宸ヨ壓璺嚎-宸ュ簭鍏宠仈",
+ (int) Math.min(routingCount, 1), (int) routedOpCount,
+ "閮ㄥ垎宸ヨ壓璺嚎鏈坊鍔犲伐搴忥紝璇峰厛鍦ㄣ�愬伐鑹鸿璁�-宸ヨ壓璺嚎銆戜腑涓哄伐鑹鸿矾绾挎坊鍔犲伐搴�"));
+ }
+
+ // 9. 鍏宠仈鎬ф娴嬶細鏈塀OM浣嗘棤浜у搧缁撴瀯鐨�
+ String bomStructureLinkKey = "production:BOM-浜у搧缁撴瀯鍏宠仈";
+ if (!itemMap.containsKey(bomStructureLinkKey)) {
+ long bomCount = technologyBomMapper.selectCount(null);
+ long structureCount = technologyBomStructureMapper.selectCount(
+ new LambdaQueryWrapper<TechnologyBomStructure>()
+ .gt(TechnologyBomStructure::getBomId, 0));
+ itemMap.put(bomStructureLinkKey, buildItem("production", "BOM-浜у搧缁撴瀯鍏宠仈",
+ (int) Math.min(bomCount, 1), (int) structureCount,
+ "閮ㄥ垎BOM鏈坊鍔犱骇鍝佺粨鏋勶紝璇峰厛鍦ㄣ�愬伐鑹鸿璁�-BOM绠$悊銆戜腑涓築OM娣诲姞浜у搧缁撴瀯鑺傜偣"));
+ }
+ }
+
+ private CheckItem buildItem(String module, String itemName, int minRequired, int currentCount, String failMessage) {
+ CheckItem item = new CheckItem();
+ item.setModule(module);
+ item.setItemName(itemName);
+ item.setMinRequired(minRequired);
+ item.setCurrentCount(currentCount);
+ item.setPassed(currentCount >= minRequired);
+ item.setMessage(item.isPassed() ? "閫氳繃" : failMessage);
+ return item;
+ }
+}
diff --git a/src/main/java/com/ruoyi/mock/service/impl/DataGenerateServiceImpl.java b/src/main/java/com/ruoyi/mock/service/impl/DataGenerateServiceImpl.java
new file mode 100644
index 0000000..92b7cb8
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/service/impl/DataGenerateServiceImpl.java
@@ -0,0 +1,1745 @@
+package com.ruoyi.mock.service.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.ai.assistant.Assistant;
+import com.ruoyi.approve.mapper.ApprovalInstanceMapper;
+import com.ruoyi.approve.mapper.ApprovalInstanceNodeMapper;
+import com.ruoyi.approve.mapper.ApprovalRecordMapper;
+import com.ruoyi.approve.mapper.ApprovalTaskMapper;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalInstanceNode;
+import com.ruoyi.approve.pojo.ApprovalRecord;
+import com.ruoyi.approve.pojo.ApprovalTask;
+import com.ruoyi.approve.service.ApprovalInstanceService;
+import com.ruoyi.basic.mapper.ProductMapper;
+import com.ruoyi.basic.mapper.ProductModelMapper;
+import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.pojo.Product;
+import com.ruoyi.basic.pojo.ProductModel;
+import com.ruoyi.basic.pojo.SupplierManage;
+import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.basic.service.ISupplierService;
+import com.ruoyi.common.enums.ReviewStatusEnum;
+import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
+import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.mock.dto.DataGenerateRequest;
+import com.ruoyi.mock.prompt.MockDataPrompt;
+import com.ruoyi.mock.service.DataGenerateService;
+import com.ruoyi.mock.vo.DataGenerateResult;
+import com.ruoyi.mock.vo.DataGenerateResult.ModuleSummary;
+import com.ruoyi.procurementrecord.utils.StockUtils;
+import com.ruoyi.production.bean.dto.ProductionOrderPickDto;
+import com.ruoyi.production.bean.dto.ProductionPlanDto;
+import com.ruoyi.production.bean.dto.ProductionProductMainDto;
+import com.ruoyi.production.bean.vo.ProductionBomStructureVo;
+import com.ruoyi.production.mapper.*;
+import com.ruoyi.production.pojo.*;
+import com.ruoyi.production.service.ProductionOrderPickService;
+import com.ruoyi.production.service.ProductionOrderService;
+import com.ruoyi.production.service.ProductionPlanService;
+import com.ruoyi.production.service.ProductionProductMainService;
+import com.ruoyi.purchase.dto.PurchaseLedgerDto;
+import com.ruoyi.purchase.pojo.PurchaseLedger;
+import com.ruoyi.purchase.service.IPurchaseLedgerService;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.mapper.SysDeptMapper;
+import com.ruoyi.project.system.mapper.SysUserDeptMapper;
+import com.ruoyi.project.system.mapper.SysUserMapper;
+import com.ruoyi.quality.mapper.QualityInspectMapper;
+import com.ruoyi.quality.pojo.QualityInspect;
+import com.ruoyi.quality.pojo.QualityTestStandard;
+import com.ruoyi.quality.pojo.QualityTestStandardBinding;
+import com.ruoyi.quality.service.IQualityInspectService;
+import com.ruoyi.quality.service.IQualityTestStandardService;
+import com.ruoyi.quality.service.QualityTestStandardBindingService;
+import com.ruoyi.sales.dto.SalesLedgerDto;
+import com.ruoyi.sales.dto.ShippingInfoDto;
+import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
+import com.ruoyi.sales.mapper.ShippingInfoMapper;
+import com.ruoyi.sales.mapper.ShippingProductDetailMapper;
+import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.pojo.ShippingInfo;
+import com.ruoyi.sales.pojo.ShippingProductDetail;
+import com.ruoyi.sales.service.ISalesLedgerService;
+import com.ruoyi.sales.service.ShippingInfoService;
+import com.ruoyi.stock.mapper.StockInRecordMapper;
+import com.ruoyi.stock.mapper.StockInventoryMapper;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
+import com.ruoyi.stock.pojo.StockInventory;
+import com.ruoyi.stock.pojo.StockOutRecord;
+import com.ruoyi.stock.dto.StockInventoryDto;
+import com.ruoyi.stock.service.StockInRecordService;
+import com.ruoyi.stock.service.StockOutRecordService;
+import com.ruoyi.stock.service.StockInventoryService;
+import com.ruoyi.technology.mapper.TechnologyBomStructureMapper;
+import com.ruoyi.technology.mapper.TechnologyRoutingMapper;
+import com.ruoyi.technology.mapper.TechnologyRoutingOperationMapper;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class DataGenerateServiceImpl implements DataGenerateService {
+
+ private final Assistant assistant;
+ private final ProductMapper productMapper;
+ private final ProductModelMapper productModelMapper;
+
+ private final ICustomerService customerService;
+ private final ISalesLedgerService salesLedgerService;
+ private final ISupplierService supplierService;
+ private final IPurchaseLedgerService purchaseLedgerService;
+ private final IQualityTestStandardService qualityTestStandardService;
+ private final QualityTestStandardBindingService qualityTestStandardBindingService;
+ private final ProductionPlanService productionPlanService;
+ private final ProductionOrderService productionOrderService;
+ private final StockInventoryService stockInventoryService;
+
+ // 閲囪喘瀹屾暣娴佺▼闇�瑕佺殑service
+ private final ApprovalInstanceService approvalInstanceService;
+ private final ApprovalInstanceMapper approvalInstanceMapper;
+ private final ApprovalInstanceNodeMapper approvalInstanceNodeMapper;
+ private final ApprovalTaskMapper approvalTaskMapper;
+ private final ApprovalRecordMapper approvalRecordMapper;
+ private final IQualityInspectService qualityInspectService;
+ private final QualityInspectMapper qualityInspectMapper;
+ private final StockInRecordService stockInRecordService;
+ private final StockInRecordMapper stockInRecordMapper;
+
+ // 閿�鍞畬鏁存祦绋嬮渶瑕佺殑service/mapper
+ private final SalesLedgerMapper salesLedgerMapper;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final ProductionPlanMapper productionPlanMapper;
+ private final ProductionOrderMapper productionOrderMapper;
+ private final ProductionOperationTaskMapper productionOperationTaskMapper;
+ private final ProductionProductMainService productionProductMainService;
+ private final ShippingInfoService shippingInfoService;
+ private final ShippingInfoMapper shippingInfoMapper;
+ private final ShippingProductDetailMapper shippingProductDetailMapper;
+ private final StockUtils stockUtils;
+ private final StockOutRecordMapper stockOutRecordMapper;
+ private final StockOutRecordService stockOutRecordService;
+ private final StockInventoryMapper stockInventoryMapper;
+
+ // 宸ヨ壓鏁版嵁妫�娴�
+ private final TechnologyRoutingMapper technologyRoutingMapper;
+ private final TechnologyRoutingOperationMapper technologyRoutingOperationMapper;
+ private final TechnologyBomStructureMapper technologyBomStructureMapper;
+
+ // 棰嗘枡
+ private final ProductionOrderPickService productionOrderPickService;
+ private final ProductionOrderBomMapper productionOrderBomMapper;
+ private final ProductionBomStructureMapper productionBomStructureMapper;
+
+ // 鐢ㄦ埛/瑙掕壊鏌ヨ
+ private final SysUserMapper sysUserMapper;
+ private final SysDeptMapper sysDeptMapper;
+ private final SysUserDeptMapper sysUserDeptMapper;
+
+ @Override
+ public DataGenerateResult generate(DataGenerateRequest request) {
+ DataGenerateResult result = new DataGenerateResult();
+ List<ModuleSummary> summaries = new ArrayList<>();
+ List<String> errors = new ArrayList<>();
+ int totalGenerated = 0;
+
+ try {
+ // 鏋勫缓浜у搧瑙勬牸鍒嗙被锛氶�氳繃Product鏍戞牴鑺傜偣鍒ゆ柇鎴愬搧/鍘熸潗鏂�
+ Map<Long, String> productModelIdToCategory = buildProductModelCategoryMap();
+ List<Long> productModelIds = new ArrayList<>(productModelIdToCategory.keySet());
+
+ // 鍔犺浇宸叉湁瀹㈡埛/渚涘簲鍟嗭紙涓嶆柊澧烇紝浣跨敤宸叉湁鏁版嵁锛�
+ Map<String, Long> customerNameToId = loadExistingCustomers();
+ Map<String, Long> supplierNameToId = loadExistingSuppliers();
+ List<String> existingCustomerNames = new ArrayList<>(customerNameToId.keySet());
+ List<String> existingSupplierNames = new ArrayList<>(supplierNameToId.keySet());
+
+ // 鍔犺浇绯荤粺鐢ㄦ埛淇℃伅锛堟樀绉般�佽鑹层�侀儴闂級
+ List<SysUser> systemUsers = loadSystemUsersWithDetail();
+
+ String systemPrompt = MockDataPrompt.buildSystemPrompt();
+ String userMessage = MockDataPrompt.buildUserMessage(
+ request.getModules(), request.getIndustries(),
+ request.getCountMin(), request.getCountMax(),
+ request.getDateStart(), request.getDateEnd(),
+ request.getAdditionalInfo(),
+ productModelIdToCategory,
+ systemUsers,
+ existingCustomerNames, existingSupplierNames);
+
+ String fullPrompt = systemPrompt + "\n\n" + userMessage;
+ log.info("璋冪敤AI鐢熸垚妯℃嫙鏁版嵁, modules={}, industries={}", request.getModules(), request.getIndustries());
+ String llmResponse = assistant.chat(fullPrompt);
+ log.info("AI杩斿洖鏁版嵁闀垮害: {}", llmResponse != null ? llmResponse.length() : 0);
+
+ if (llmResponse == null || llmResponse.isBlank()) {
+ result.setStatus("FAILED");
+ errors.add("AI鏈繑鍥炰换浣曟暟鎹�");
+ result.setErrors(errors);
+ return result;
+ }
+
+ List<JSONObject> entities = parseJsonResponse(llmResponse);
+ if (entities.isEmpty()) {
+ result.setStatus("FAILED");
+ errors.add("鏃犳硶瑙f瀽AI杩斿洖鐨勬暟鎹�");
+ result.setErrors(errors);
+ return result;
+ }
+
+ // 淇AI鐢熸垚鐨勬棩鏈熷埌鎸囧畾鏃堕棿鑼冨洿鍐�
+ String dateStart = request.getDateStart();
+ String dateEnd = request.getDateEnd();
+ if (dateStart != null && dateEnd != null) {
+ fixDatesInRange(entities, dateStart, dateEnd);
+ }
+
+ Map<String, List<JSONObject>> grouped = entities.stream()
+ .collect(Collectors.groupingBy(e -> e.getString("entity")));
+
+ // Tier 0: 鍩虹鏁版嵁锛堝鎴峰拰渚涘簲鍟嗕笉鑷姩鐢熸垚锛屼娇鐢ㄥ凡鏈夋暟鎹級
+ if (grouped.containsKey("qualityTestStandard")) {
+ ModuleSummary s = createQualityStandards(grouped.get("qualityTestStandard"));
+ summaries.add(s);
+ totalGenerated += s.getSuccessCount();
+ }
+
+ // Tier 1: 涓氬姟鍗曟嵁
+ if (grouped.containsKey("salesLedger")) {
+ ModuleSummary s = createSalesLedgers(grouped.get("salesLedger"), customerNameToId, request.getDateStart());
+ summaries.add(s);
+ totalGenerated += s.getSuccessCount();
+ }
+ if (grouped.containsKey("purchaseLedger")) {
+ ModuleSummary s = createPurchaseLedgers(grouped.get("purchaseLedger"), supplierNameToId,
+ request.getAdditionalInfo(), request.getDateStart(), request.getDateEnd());
+ summaries.add(s);
+ totalGenerated += s.getSuccessCount();
+ }
+ if (grouped.containsKey("productionPlan")) {
+ ModuleSummary s = createProductionPlans(grouped.get("productionPlan"));
+ summaries.add(s);
+ totalGenerated += s.getSuccessCount();
+ }
+
+ // Tier 2
+ if (grouped.containsKey("productionOrder")) {
+ ModuleSummary s = createProductionOrders(grouped.get("productionOrder"));
+ summaries.add(s);
+ totalGenerated += s.getSuccessCount();
+ }
+ if (grouped.containsKey("qualityTestStandardBinding")) {
+ ModuleSummary s = createQualityBindings(grouped.get("qualityTestStandardBinding"));
+ summaries.add(s);
+ totalGenerated += s.getSuccessCount();
+ }
+ if (grouped.containsKey("stockInventory")) {
+ ModuleSummary s = createStockInventories(grouped.get("stockInventory"));
+ summaries.add(s);
+ totalGenerated += s.getSuccessCount();
+ }
+
+ result.setStatus(errors.isEmpty() ? "SUCCESS" : "PARTIAL");
+ result.setTotalGenerated(totalGenerated);
+ result.setModuleSummaries(summaries);
+ result.setErrors(errors);
+
+ } catch (Exception e) {
+ log.error("鏁版嵁鐢熸垚澶辫触", e);
+ result.setStatus("FAILED");
+ errors.add("鏁版嵁鐢熸垚寮傚父: " + e.getMessage());
+ result.setErrors(errors);
+ }
+
+ return result;
+ }
+
+ private List<JSONObject> parseJsonResponse(String response) {
+ try {
+ String trimmed = response.trim();
+ if (trimmed.startsWith("```")) {
+ int start = trimmed.indexOf("\n");
+ int end = trimmed.lastIndexOf("```");
+ if (start > 0 && end > start) {
+ trimmed = trimmed.substring(start + 1, end).trim();
+ }
+ }
+ return JSON.parseArray(trimmed, JSONObject.class);
+ } catch (Exception e) {
+ log.warn("JSON瑙f瀽澶辫触锛屽皾璇曟彁鍙栨暟缁勭墖娈�: {}", e.getMessage());
+ int start = response.indexOf('[');
+ int end = response.lastIndexOf(']');
+ if (start >= 0 && end > start) {
+ return JSON.parseArray(response.substring(start, end + 1), JSONObject.class);
+ }
+ return List.of();
+ }
+ }
+
+ /**
+ * 淇AI鐢熸垚鐨勬棩鏈熷埌鎸囧畾鏃堕棿鑼冨洿鍐呫��
+ * 閬嶅巻鎵�鏈夊疄浣撶殑鎵�鏈夊瓧娈碉紝濡傛灉鍙戠幇鏃ユ湡瀛楃涓诧紙yyyy-MM-dd鏍煎紡锛夎秴鍑鸿寖鍥达紝鏇挎崲涓鸿寖鍥村唴鐨勯殢鏈烘棩鏈熴��
+ */
+ private void fixDatesInRange(List<JSONObject> entities, String dateStart, String dateEnd) {
+ LocalDate start;
+ LocalDate end;
+ try {
+ start = LocalDate.parse(dateStart);
+ end = LocalDate.parse(dateEnd);
+ } catch (Exception e) {
+ log.warn("鏃ユ湡鑼冨洿瑙f瀽澶辫触: {} ~ {}", dateStart, dateEnd);
+ return;
+ }
+ long daysBetween = ChronoUnit.DAYS.between(start, end);
+ if (daysBetween <= 0) {
+ daysBetween = 1;
+ }
+
+ // 鎵�鏈夊凡鐭ョ殑鏃ユ湡瀛楁鍚�
+ java.util.Set<String> dateFields = java.util.Set.of(
+ "entryDate", "executionDate", "deliveryDate", "requiredDate",
+ "promisedDeliveryDate", "planCompleteTime", "maintenanceTime",
+ "checkTime", "registerDate"
+ );
+
+ for (JSONObject entity : entities) {
+ for (String key : dateFields) {
+ String val = entity.getString(key);
+ if (val != null && val.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ try {
+ LocalDate d = LocalDate.parse(val);
+ if (d.isBefore(start) || d.isAfter(end)) {
+ LocalDate fixed = start.plusDays(ThreadLocalRandom.current().nextLong(daysBetween + 1));
+ entity.put(key, fixed.toString());
+ log.debug("淇鏃ユ湡 {}: {} -> {}", key, val, fixed);
+ }
+ } catch (Exception ignored) {
+ }
+ } else if (val != null && !val.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ // AI杩斿洖浜嗘棤鏁堟棩鏈熸牸寮忥紝鐩存帴鏇挎崲涓鸿寖鍥村唴鐨勯殢鏈烘棩鏈�
+ LocalDate fixed = start.plusDays(ThreadLocalRandom.current().nextLong(daysBetween + 1));
+ entity.put(key, fixed.toString());
+ log.debug("淇鏃犳晥鏃ユ湡 {}: {} -> {}", key, val, fixed);
+ }
+ }
+ // 淇鍚堝悓缂栧彿涓殑鏃ユ湡: CG-20230601-001 -> CG-YYYYMMDD-001
+ for (String key : java.util.Set.of("purchaseContractNumber", "salesContractNo", "standardNo", "batchNo")) {
+ String val = entity.getString(key);
+ if (val != null && val.matches(".*\\d{8}.*")) {
+ String datePart = val.replaceAll(".*?(\\d{8}).*", "$1");
+ try {
+ // 楠岃瘉鎻愬彇鍒扮殑鏄湁鏁堟棩鏈�
+ String dateStr = datePart.substring(0, 4) + "-" + datePart.substring(4, 6) + "-" + datePart.substring(6, 8);
+ LocalDate d = LocalDate.parse(dateStr);
+ if (d.isBefore(start) || d.isAfter(end)) {
+ LocalDate fixed = start.plusDays(ThreadLocalRandom.current().nextLong(daysBetween + 1));
+ String newDatePart = fixed.format(java.time.format.DateTimeFormatter.BASIC_ISO_DATE);
+ String newVal = val.replace(datePart, newDatePart);
+ entity.put(key, newVal);
+ log.debug("淇缂栧彿 {}: {} -> {}", key, val, newVal);
+ }
+ } catch (Exception ignored) {
+ }
+ }
+ }
+ }
+ }
+
+ // ---- Tier 0: 鍩虹鏁版嵁 ----
+
+ /**
+ * 浠庢暟鎹簱鍔犺浇宸叉湁瀹㈡埛鍚嶇О鈫扞D鏄犲皠
+ */
+ private Map<String, Long> loadExistingCustomers() {
+ Map<String, Long> map = new HashMap<>();
+ List<Customer> customers = customerService.list();
+ for (Customer c : customers) {
+ if (c.getCustomerName() != null) {
+ map.put(c.getCustomerName(), c.getId());
+ }
+ }
+ return map;
+ }
+
+ /**
+ * 浠庢暟鎹簱鍔犺浇宸叉湁渚涘簲鍟嗗悕绉扳啋ID鏄犲皠
+ */
+ private Map<String, Long> loadExistingSuppliers() {
+ Map<String, Long> map = new HashMap<>();
+ List<SupplierManage> suppliers = supplierService.list();
+ for (SupplierManage s : suppliers) {
+ if (s.getSupplierName() != null) {
+ map.put(s.getSupplierName(), s.getId());
+ }
+ }
+ return map;
+ }
+
+ /**
+ * 鍔犺浇绯荤粺鐢ㄦ埛淇℃伅锛堝惈瑙掕壊鍜岄儴闂ㄥ悕绉帮級
+ */
+ private List<SysUser> loadSystemUsersWithDetail() {
+ return sysUserMapper.selectUserListWithDetail();
+ }
+
+ /**
+ * 鏋勫缓浜у搧瑙勬牸ID鈫掗《绾т骇鍝佸垎绫诲悕绉扮殑鏄犲皠
+ * 閫氳繃Product鏍戝悜涓婃壘鍒版牴鑺傜偣锛屽垽鏂�"鎴愬搧"/"鍘熸潗鏂�"/"鍗婃垚鍝�"
+ */
+ private Map<Long, String> buildProductModelCategoryMap() {
+ // 鍔犺浇鎵�鏈塒roduct鑺傜偣
+ List<Product> allProducts = productMapper.selectList(null);
+ Map<Long, Product> productMap = allProducts.stream()
+ .collect(Collectors.toMap(Product::getId, p -> p, (a, b) -> a));
+
+ // 瀵规瘡涓狿roduct锛屾部parentId鍚戜笂鎵惧埌鏍硅妭鐐瑰悕绉�
+ Map<Long, String> productIdToRootName = new HashMap<>();
+ for (Product p : allProducts) {
+ if (productIdToRootName.containsKey(p.getId())) continue;
+ // 鍚戜笂閬嶅巻鎵炬牴
+ List<Long> chain = new ArrayList<>();
+ Long currentId = p.getId();
+ while (currentId != null) {
+ chain.add(currentId);
+ Product current = productMap.get(currentId);
+ if (current == null || current.getParentId() == null) break;
+ currentId = current.getParentId();
+ }
+ // 鏍硅妭鐐圭殑productName灏辨槸鍒嗙被鍚�
+ Product root = productMap.get(chain.get(chain.size() - 1));
+ String rootName = root != null ? root.getProductName() : "鍏朵粬";
+ for (Long id : chain) {
+ productIdToRootName.put(id, rootName);
+ }
+ }
+
+ // 瀵规瘡涓狿roductModel锛岄�氳繃productId鎵惧埌鍏舵墍灞炲垎绫�
+ List<ProductModel> allModels = productModelMapper.selectList(null);
+ Map<Long, String> result = new HashMap<>();
+ for (ProductModel m : allModels) {
+ String category = m.getProductId() != null
+ ? productIdToRootName.getOrDefault(m.getProductId(), "鍏朵粬")
+ : "鍏朵粬";
+ result.put(m.getId(), category);
+ }
+ return result;
+ }
+
+ private ModuleSummary createCustomers(List<JSONObject> items, Map<String, Long> nameToId) {
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ Customer c = new Customer();
+ c.setCustomerName(item.getString("customerName"));
+ c.setCustomerType(item.getString("customerType"));
+ c.setContactPerson(item.getString("contactPerson"));
+ c.setContactPhone(item.getString("contactPhone"));
+ c.setCompanyAddress(item.getString("companyAddress"));
+ c.setCompanyPhone(item.getString("companyPhone"));
+ c.setTaxpayerIdentificationNumber(item.getString("taxpayerIdentificationNumber"));
+ c.setMaintainer(item.getString("maintainer"));
+ if (item.containsKey("maintenanceTime")) {
+ String mtStr = item.getString("maintenanceTime");
+ if (mtStr != null && mtStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ c.setMaintenanceTime(java.sql.Date.valueOf(mtStr));
+ }
+ } else {
+ c.setMaintenanceTime(new java.sql.Date(System.currentTimeMillis()));
+ }
+ if (item.containsKey("bankAccount")) {
+ c.setBankAccount(item.getString("bankAccount"));
+ }
+ if (item.containsKey("basicBankAccount")) {
+ c.setBasicBankAccount(item.getString("basicBankAccount"));
+ }
+ if (item.containsKey("bankCode")) {
+ c.setBankCode(item.getString("bankCode"));
+ }
+ customerService.insertCustomer(c);
+ if (c.getId() != null) {
+ nameToId.put(c.getCustomerName(), c.getId());
+ }
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓瀹㈡埛澶辫触: {}", e.getMessage());
+ fail++;
+ }
+ }
+ return summary("sales", "瀹㈡埛", items.size(), success, fail);
+ }
+
+ private ModuleSummary createSuppliers(List<JSONObject> items, Map<String, Long> nameToId) {
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ SupplierManage s = new SupplierManage();
+ s.setSupplierName(item.getString("supplierName"));
+ s.setSupplierType(item.getString("supplierType"));
+ s.setContactUserName(item.getString("contactUserName"));
+ s.setContactUserPhone(item.getString("contactUserPhone"));
+ s.setCompanyAddress(item.getString("companyAddress"));
+ s.setCompanyPhone(item.getString("companyPhone"));
+ s.setTaxpayerIdentificationNum(item.getString("taxpayerIdentificationNum"));
+ s.setBankAccountName(item.getString("bankAccountName"));
+ s.setBankAccountNum(item.getString("bankAccountNum"));
+ if (item.containsKey("isWhite")) {
+ s.setIsWhite(item.getInteger("isWhite"));
+ }
+ supplierService.saveSupplier(s);
+ if (s.getId() != null) {
+ nameToId.put(s.getSupplierName(), s.getId());
+ }
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓渚涘簲鍟嗗け璐�: {}", e.getMessage());
+ fail++;
+ }
+ }
+ return summary("purchase", "渚涘簲鍟�", items.size(), success, fail);
+ }
+
+ private ModuleSummary createQualityStandards(List<JSONObject> items) {
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ QualityTestStandard std = new QualityTestStandard();
+ std.setStandardNo(item.getString("standardNo"));
+ std.setStandardName(item.getString("standardName"));
+ std.setInspectType(item.getInteger("inspectType"));
+ std.setRemark(item.getString("remark"));
+ qualityTestStandardService.save(std);
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓妫�娴嬫爣鍑嗗け璐�: {}", e.getMessage());
+ fail++;
+ }
+ }
+ return summary("quality", "妫�娴嬫爣鍑�", items.size(), success, fail);
+ }
+
+ // ---- Tier 1: 涓氬姟鍗曟嵁 ----
+
+ private ModuleSummary createSalesLedgers(List<JSONObject> items, Map<String, Long> customerNameToId, String dateStart) {
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ String customerName = item.getString("customerName");
+ Long customerId = customerNameToId.get(customerName);
+
+ SalesLedgerDto dto = new SalesLedgerDto();
+ dto.setCustomerId(customerId);
+ dto.setCustomerName(customerName);
+ dto.setProjectName(item.getString("projectName"));
+ dto.setSalesman(item.getString("salesman"));
+ dto.setPaymentMethod(item.getString("paymentMethod"));
+ dto.setType(item.getInteger("type"));
+
+ // 褰曞叆浜猴細浼樺厛鐢ˋI杩斿洖鐨勶紝鍚﹀垯浠�"閿�鍞�"瑙掕壊/閮ㄩ棬闅忔満閫�
+ String entryPerson = item.getString("entryPerson");
+ if (entryPerson == null || entryPerson.isBlank()) {
+ SysUser salesUser = randomUserByKeyword("閿�鍞�");
+ entryPerson = salesUser != null ? salesUser.getNickName() : "绯荤粺";
+ }
+ dto.setEntryPerson(entryPerson);
+
+ // 涓氬姟鍛橈細浼樺厛鐢ˋI杩斿洖鐨勶紝鍚﹀垯浠�"閿�鍞�"瑙掕壊/閮ㄩ棬闅忔満閫�
+ String salesman = dto.getSalesman();
+ if (salesman == null || salesman.isBlank()) {
+ SysUser salesUser = randomUserByKeyword("閿�鍞�");
+ salesman = salesUser != null ? salesUser.getNickName() : "绯荤粺";
+ dto.setSalesman(salesman);
+ }
+ // customerId涓簄ull浼氬鑷�"瀹㈡埛涓嶅瓨鍦�"寮傚父锛岃烦杩�
+ if (customerId == null) {
+ log.warn("璺宠繃閿�鍞彴璐︼紝瀹㈡埛[{}]涓嶅瓨鍦�", customerName);
+ fail++;
+ continue;
+ }
+ LocalDate entryDate = null;
+ if (item.containsKey("entryDate")) {
+ String entryDateStr = item.getString("entryDate");
+ if (entryDateStr != null && entryDateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ entryDate = LocalDate.parse(entryDateStr);
+ dto.setEntryDate(java.sql.Date.valueOf(entryDateStr));
+ } else {
+ dto.setEntryDate(java.sql.Date.valueOf(dateStart));
+ }
+ }
+ if (item.containsKey("executionDate")) {
+ String execDateStr = item.getString("executionDate");
+ if (execDateStr != null && execDateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ dto.setExecutionDate(LocalDate.parse(execDateStr));
+ } else {
+ dto.setExecutionDate(LocalDate.parse(dateStart));
+ }
+ }
+ if (item.containsKey("deliveryDate")) {
+ String delDateStr = item.getString("deliveryDate");
+ if (delDateStr != null && delDateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ dto.setDeliveryDate(LocalDate.parse(delDateStr));
+ } else {
+ dto.setDeliveryDate(LocalDate.parse(dateStart));
+ }
+ }
+ JSONArray productData = item.getJSONArray("productData");
+ boolean hasProduction = false;
+ if (productData != null) {
+ List<SalesLedgerProduct> products = new ArrayList<>();
+ for (int i = 0; i < productData.size(); i++) {
+ JSONObject pd = productData.getJSONObject(i);
+ SalesLedgerProduct slp = new SalesLedgerProduct();
+ slp.setProductId(pd.getLong("productId"));
+ slp.setProductModelId(pd.getLong("productModelId"));
+ slp.setQuantity(pd.getBigDecimal("quantity"));
+ slp.setTaxInclusiveUnitPrice(pd.getBigDecimal("taxInclusiveUnitPrice"));
+ slp.setTaxInclusiveTotalPrice(pd.getBigDecimal("taxInclusiveTotalPrice"));
+ slp.setTaxRate(pd.getBigDecimal("taxRate"));
+ slp.setUnit(pd.getString("unit"));
+ slp.setType(pd.getInteger("type"));
+ if (pd.containsKey("taxExclusiveTotalPrice")) {
+ slp.setTaxExclusiveTotalPrice(pd.getBigDecimal("taxExclusiveTotalPrice"));
+ } else if (pd.getBigDecimal("taxInclusiveTotalPrice") != null && pd.getBigDecimal("taxRate") != null) {
+ slp.setTaxExclusiveTotalPrice(
+ pd.getBigDecimal("taxInclusiveTotalPrice").divide(
+ BigDecimal.ONE.add(pd.getBigDecimal("taxRate").divide(new BigDecimal("100"), 4, RoundingMode.HALF_UP)),
+ 2, RoundingMode.HALF_UP));
+ } else {
+ slp.setTaxExclusiveTotalPrice(BigDecimal.ZERO);
+ }
+ slp.setIsProduction(true);
+ products.add(slp);
+ hasProduction = true;
+ }
+ dto.setProductData(products);
+ }
+ salesLedgerService.addOrUpdateSalesLedger(dto);
+ // addOrUpdateSalesLedger鍐呴儴浼氳嚜鍔ㄧ敓鎴愬悎鍚屽彿骞秈nsert锛屼絾dto涓婃病鏈夊洖鍐�
+ // 鐩存帴鐢╠to鐨別ntryDate鍜宑ustomerId鏌ユ渶鏂板垱寤虹殑璁板綍
+ SalesLedger savedLedger = salesLedgerMapper.selectOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<SalesLedger>()
+ .eq(SalesLedger::getCustomerId, dto.getCustomerId())
+ .orderByDesc(SalesLedger::getId)
+ .last("limit 1"));
+ if (savedLedger != null && hasProduction) {
+ processSalesFullFlow(savedLedger, entryDate);
+ }
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓閿�鍞彴璐﹀け璐�: {}", e.getMessage(), e);
+ fail++;
+ }
+ }
+ return summary("sales", "閿�鍞彴璐�", items.size(), success, fail);
+ }
+
+ // ==================== 閿�鍞畬鏁存祦绋� ====================
+
+ /**
+ * 閿�鍞畬鏁存祦绋�: 鐢熶骇璁″垝鍚堝苟涓嬪彂 鈫� 棰嗘枡 鈫� 鎶ュ伐 鈫� 璐ㄦ(鍙��) 鈫� 鍏ュ簱 鈫� 鍙戣揣 鈫� 鍑哄簱
+ * 鏃堕棿浠ラ攢鍞綍鍏ユ棩鏈熶负鍩哄噯锛屽悇鐜妭閫掓帹0-3澶�
+ */
+ private void processSalesFullFlow(SalesLedger salesLedger, LocalDate entryDate) {
+ try {
+ LocalDate baseDate = entryDate != null ? entryDate : LocalDate.now();
+
+ // 1. 鏌ヨ閿�鍞彴璐︿骇鍝侊紙鍚敓浜ц鍒掞級
+ List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<SalesLedgerProduct>()
+ .eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId())
+ .eq(SalesLedgerProduct::getIsProduction, true));
+ if (products.isEmpty()) {
+ log.info("閿�鍞彴璐{}]鏃犻渶鐢熶骇锛岃烦杩囩敓浜ф祦绋�", salesLedger.getSalesContractNo());
+ return;
+ }
+
+ // 妫�鏌ヤ骇鍝佹槸鍚﹀叿澶囧畬鏁寸殑宸ヨ壓鏁版嵁锛堝伐鑹鸿矾绾裤�佸伐搴忋�丅OM锛�
+ List<Long> missingTechProductIds = checkTechnologyDataReadiness(products);
+ if (!missingTechProductIds.isEmpty()) {
+ log.warn("閿�鍞彴璐{}]浠ヤ笅浜у搧缂哄皯宸ヨ壓鏁版嵁锛堝伐鑹鸿矾绾�/宸ュ簭/BOM锛夛紝璺宠繃鐢熶骇娴佺▼: {}",
+ salesLedger.getSalesContractNo(), missingTechProductIds);
+ return;
+ }
+
+ // 2. 鐢熶骇璁″垝鍚堝苟涓嬪彂 鈫� 鐢熶骇璁㈠崟
+ LocalDate planDate = baseDate.plusDays(ThreadLocalRandom.current().nextInt(0, 4));
+ processProductionCombine(salesLedger, planDate);
+
+ // 3. 棰嗘枡锛堢墿鏂欎笉瓒宠嚜鍔ㄥ叆搴撳悗鍐嶉锛�
+ LocalDate pickDate = planDate.plusDays(ThreadLocalRandom.current().nextInt(0, 3));
+ processMaterialPick(salesLedger, pickDate);
+
+ // 4. 鐢熶骇鎶ュ伐
+ LocalDate reportDate = pickDate.plusDays(ThreadLocalRandom.current().nextInt(1, 4));
+ processProductionReport(salesLedger, reportDate);
+
+ // 5. 璐ㄦ鎻愪氦 + 鍏ュ簱瀹℃壒
+ LocalDate qualityDate = reportDate.plusDays(ThreadLocalRandom.current().nextInt(0, 4));
+ processSalesQualityAndStockIn(salesLedger, qualityDate);
+
+ // 6. 鍙戣揣 + 鍙戣揣瀹℃壒 + 鍑哄簱瀹℃壒
+ LocalDate shipDate = qualityDate.plusDays(ThreadLocalRandom.current().nextInt(0, 4));
+ processSalesShipping(salesLedger, shipDate);
+
+ log.info("閿�鍞彴璐{}]瀹屾暣娴佺▼澶勭悊瀹屾瘯", salesLedger.getSalesContractNo());
+ } catch (Exception e) {
+ log.warn("閿�鍞畬鏁存祦绋嬪鐞嗗け璐{}]: {}", salesLedger.getSalesContractNo(), e.getMessage());
+ }
+ }
+
+ /**
+ * 鏌ヨ瑙掕壊鎴栭儴闂ㄥ惈鎸囧畾鍏抽敭瀛楃殑鐢ㄦ埛锛岄殢鏈鸿繑鍥炰竴涓�
+ */
+ private SysUser randomUserByKeyword(String keyword) {
+ try {
+ List<Long> userIds = new ArrayList<>(sysUserMapper.getUserByRole(keyword));
+
+ List<SysDept> depts = sysDeptMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<SysDept>()
+ .like(SysDept::getDeptName, keyword)
+ .eq(SysDept::getDelFlag, "0")
+ .eq(SysDept::getStatus, "0"));
+ if (!depts.isEmpty()) {
+ List<Long> deptIds = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
+ List<Long> deptUserIds = sysUserDeptMapper.selectDistinctUserIdsByDeptIds(deptIds);
+ userIds.addAll(deptUserIds);
+ }
+
+ if (userIds.isEmpty()) {
+ return null;
+ }
+ List<Long> distinctIds = userIds.stream().distinct().collect(Collectors.toList());
+ Long randomId = distinctIds.get(ThreadLocalRandom.current().nextInt(distinctIds.size()));
+ return sysUserMapper.selectUserById(randomId);
+ } catch (Exception e) {
+ log.warn("鏌ヨ[{}]瑙掕壊/閮ㄩ棬鐢ㄦ埛澶辫触: {}", keyword, e.getMessage());
+ return null;
+ }
+ }
+
+ /**
+ * 鏌ヨ瑙掕壊鎴栭儴闂ㄥ惈"鐢熶骇"鐨勭敤鎴凤紝闅忔満杩斿洖涓�涓�
+ */
+ private SysUser randomProductionUser() {
+ return randomUserByKeyword("鐢熶骇");
+ }
+
+ /**
+ * 妫�鏌ヤ骇鍝佹槸鍚﹀叿澶囧畬鏁寸殑宸ヨ壓鏁版嵁锛堝伐鑹鸿矾绾裤�佸伐搴忋�丅OM锛�
+ * @return 缂哄皯宸ヨ壓鏁版嵁鐨勪骇鍝佽鏍糏D鍒楄〃锛堢┖鍒楄〃琛ㄧず鍏ㄩ儴灏辩华锛�
+ */
+ private List<Long> checkTechnologyDataReadiness(List<SalesLedgerProduct> products) {
+ List<Long> missingIds = new ArrayList<>();
+ for (SalesLedgerProduct slp : products) {
+ Long productModelId = slp.getProductModelId();
+ if (productModelId == null) continue;
+
+ // 1. 妫�鏌ュ伐鑹鸿矾绾�
+ List<com.ruoyi.technology.pojo.TechnologyRouting> routings =
+ technologyRoutingMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.technology.pojo.TechnologyRouting>()
+ .eq(com.ruoyi.technology.pojo.TechnologyRouting::getProductModelId, productModelId));
+ if (routings.isEmpty()) {
+ log.warn("浜у搧瑙勬牸[{}]缂哄皯宸ヨ壓璺嚎", productModelId);
+ missingIds.add(productModelId);
+ continue;
+ }
+ Long routingId = routings.get(0).getId();
+
+ // 2. 妫�鏌ュ伐鑹鸿矾绾挎槸鍚︽湁鍏宠仈宸ュ簭
+ List<com.ruoyi.technology.pojo.TechnologyRoutingOperation> routingOps =
+ technologyRoutingOperationMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.technology.pojo.TechnologyRoutingOperation>()
+ .eq(com.ruoyi.technology.pojo.TechnologyRoutingOperation::getTechnologyRoutingId, routingId));
+ if (routingOps.isEmpty()) {
+ log.warn("浜у搧瑙勬牸[{}]宸ヨ壓璺嚎[{}]缂哄皯宸ュ簭", productModelId, routingId);
+ missingIds.add(productModelId);
+ continue;
+ }
+
+ // 3. 妫�鏌OM锛堝彲閫変絾鏈夋洿濂斤級
+ com.ruoyi.technology.pojo.TechnologyRouting routing = routings.get(0);
+ if (routing.getBomId() != null) {
+ List<com.ruoyi.technology.pojo.TechnologyBomStructure> bomStructures =
+ technologyBomStructureMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.technology.pojo.TechnologyBomStructure>()
+ .eq(com.ruoyi.technology.pojo.TechnologyBomStructure::getBomId, routing.getBomId()));
+ if (bomStructures.isEmpty()) {
+ log.warn("浜у搧瑙勬牸[{}]BOM[{}]缂哄皯浜у搧缁撴瀯", productModelId, routing.getBomId());
+ missingIds.add(productModelId);
+ }
+ }
+ }
+ return missingIds;
+ }
+
+ /**
+ * 鐢熶骇璁″垝鍚堝苟涓嬪彂 鈫� 鐢熶骇璁㈠崟锛堟寜productModelId鍒嗙粍锛屽悓鍨嬪彿鍚堝苟涓嬪彂锛�
+ */
+ private void processProductionCombine(SalesLedger salesLedger, LocalDate planDate) {
+ try {
+ List<ProductionPlan> plans = productionPlanMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ProductionPlan>()
+ .eq(ProductionPlan::getSalesLedgerId, salesLedger.getId())
+ .and(w -> w.eq(ProductionPlan::getStatus, 0).or().isNull(ProductionPlan::getStatus)));
+ if (plans.isEmpty()) {
+ log.info("閿�鍞彴璐{}]鏃犲緟涓嬪彂鐢熶骇璁″垝", salesLedger.getSalesContractNo());
+ return;
+ }
+
+ // 鎸塸roductModelId鍒嗙粍锛屽悓鍨嬪彿鎵嶈兘鍚堝苟涓嬪彂锛沺roductModelId涓簄ull鐨勫崟鐙�愪釜涓嬪彂
+ Map<Long, List<ProductionPlan>> grouped = plans.stream()
+ .filter(p -> p.getProductModelId() != null)
+ .collect(Collectors.groupingBy(ProductionPlan::getProductModelId));
+
+ for (Map.Entry<Long, List<ProductionPlan>> entry : grouped.entrySet()) {
+ try {
+ List<ProductionPlan> sameModelPlans = entry.getValue();
+ BigDecimal totalQty = sameModelPlans.stream()
+ .map(p -> Optional.ofNullable(p.getQtyRequired()).orElse(BigDecimal.ZERO))
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ ProductionPlanDto combineDto = new ProductionPlanDto();
+ combineDto.setIds(sameModelPlans.stream().map(ProductionPlan::getId).collect(Collectors.toList()));
+ combineDto.setTotalAssignedQuantity(totalQty);
+ combineDto.setPlanCompleteTime(planDate.plusDays(ThreadLocalRandom.current().nextInt(3, 7)));
+ productionPlanService.combine(combineDto);
+
+ // 淇鐢熶骇璁㈠崟鐨刾lanCompleteTime
+ List<ProductionOrder> orders = productionOrderMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ProductionOrder>()
+ .like(ProductionOrder::getProductionPlanIds, String.valueOf(sameModelPlans.get(0).getId())));
+ for (ProductionOrder order : orders) {
+ order.setPlanCompleteTime(planDate.plusDays(ThreadLocalRandom.current().nextInt(3, 7)));
+ order.setStartTime(planDate.atStartOfDay());
+ productionOrderMapper.updateById(order);
+ }
+ log.info("閿�鍞彴璐{}]鐢熶骇璁″垝涓嬪彂鎴愬姛, productModelId={}, 璁″垝鏁�: {}",
+ salesLedger.getSalesContractNo(), entry.getKey(), sameModelPlans.size());
+ } catch (Exception e) {
+ log.warn("閿�鍞彴璐{}]鐢熶骇璁″垝涓嬪彂澶辫触, productModelId={}: {}",
+ salesLedger.getSalesContractNo(), entry.getKey(), e.getMessage());
+ }
+ }
+ } catch (Exception e) {
+ log.warn("鐢熶骇璁″垝涓嬪彂澶辫触[{}]: {}", salesLedger.getSalesContractNo(), e.getMessage());
+ }
+ }
+
+ /**
+ * 棰嗘枡: 鏌ヨ鐢熶骇璁㈠崟鐨凚OM棰嗘枡娓呭崟锛屾鏌ュ簱瀛橈紝涓嶈冻鍒欏厛鑷姩鍏ュ簱瀹℃壒鍚庡啀棰嗘枡
+ */
+ private void processMaterialPick(SalesLedger salesLedger, LocalDate pickDate) {
+ try {
+ List<ProductionOrder> orders = findOrdersForSalesLedger(salesLedger);
+ if (orders.isEmpty()) {
+ log.info("閿�鍞彴璐{}]鏃犵敓浜ц鍗曪紝璺宠繃棰嗘枡", salesLedger.getSalesContractNo());
+ return;
+ }
+
+ for (ProductionOrder order : orders) {
+ try {
+ // 鏌ヨ璁㈠崟BOM棰嗘枡娓呭崟
+ List<com.ruoyi.production.bean.vo.ProductionOrderPickVo> pickList = productionOrderService.pick(order.getId());
+ if (pickList == null || pickList.isEmpty()) {
+ log.info("鐢熶骇璁㈠崟[{}]鏃犻鏂欐竻鍗�", order.getId());
+ continue;
+ }
+
+ // 妫�鏌ュ簱瀛樹笉瓒崇殑鐗╂枡锛屽厛鑷姩鍏ュ簱
+ ensureMaterialStock(pickList, pickDate);
+
+ // 閲嶆柊鑾峰彇棰嗘枡娓呭崟锛堝叆搴撳悗鎵瑰彿鍜屽簱瀛橀噺宸叉洿鏂帮級
+ pickList = productionOrderService.pick(order.getId());
+ if (pickList == null || pickList.isEmpty()) {
+ log.info("鐢熶骇璁㈠崟[{}]閲嶆柊鑾峰彇棰嗘枡娓呭崟涓虹┖", order.getId());
+ continue;
+ }
+
+ // 鎵ц棰嗘枡
+ List<ProductionOrderPickDto> pickDtoList = new ArrayList<>();
+ for (com.ruoyi.production.bean.vo.ProductionOrderPickVo pickVo : pickList) {
+ ProductionOrderPickDto pickDto = new ProductionOrderPickDto();
+ pickDto.setProductionOrderId(order.getId());
+ pickDto.setProductModelId(pickVo.getProductModelId());
+ pickDto.setPickQuantity(pickVo.getDemandedQuantity());
+ pickDto.setPickType((byte) 1);
+ pickDto.setOperationName(pickVo.getOperationName());
+ pickDto.setTechnologyOperationId(pickVo.getTechnologyOperationId());
+ pickDto.setDemandedQuantity(pickVo.getDemandedQuantity());
+ pickDto.setBom(pickVo.getBom());
+ // 璁剧疆鎵瑰彿锛堢敤鏇存柊鍚庣殑鎵瑰彿鍒楄〃锛�
+ if (pickVo.getBatchNoList() != null && !pickVo.getBatchNoList().isEmpty()) {
+ pickDto.setBatchNoList(pickVo.getBatchNoList());
+ pickDto.setBatchNo(pickVo.getBatchNoList().get(0));
+ }
+ pickDtoList.add(pickDto);
+ }
+
+ if (!pickDtoList.isEmpty()) {
+ ProductionOrderPickDto batchDto = new ProductionOrderPickDto();
+ batchDto.setPickList(pickDtoList);
+ productionOrderPickService.savePick(batchDto);
+ log.info("鐢熶骇璁㈠崟[{}]棰嗘枡鎴愬姛, 棰嗘枡椤规暟: {}", order.getId(), pickDtoList.size());
+ }
+ } catch (Exception e) {
+ log.warn("鐢熶骇璁㈠崟[{}]棰嗘枡澶辫触: {}", order.getId(), e.getMessage());
+ }
+ }
+ } catch (Exception e) {
+ log.warn("棰嗘枡娴佺▼澶辫触[{}]: {}", salesLedger.getSalesContractNo(), e.getMessage());
+ }
+ }
+
+ /**
+ * 纭繚鐗╂枡搴撳瓨鍏呰冻锛屼笉瓒冲垯鍏堣嚜鍔ㄥ叆搴撳鎵�
+ */
+ private void ensureMaterialStock(List<com.ruoyi.production.bean.vo.ProductionOrderPickVo> pickList, LocalDate pickDate) {
+ LocalDateTime pickDateTime = pickDate.atTime(9, 0, 0).plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+ String pickDateStr = pickDate.format(DateTimeFormatter.BASIC_ISO_DATE);
+
+ for (com.ruoyi.production.bean.vo.ProductionOrderPickVo pickVo : pickList) {
+ BigDecimal demanded = pickVo.getDemandedQuantity() != null ? pickVo.getDemandedQuantity() : BigDecimal.ZERO;
+ BigDecimal stockQty = pickVo.getStockQuantity() != null ? pickVo.getStockQuantity() : BigDecimal.ZERO;
+ BigDecimal shortage = demanded.subtract(stockQty);
+
+ if (shortage.compareTo(BigDecimal.ZERO) <= 0) {
+ continue; // 搴撳瓨鍏呰冻
+ }
+
+ // 搴撳瓨涓嶈冻锛岃嚜鍔ㄥ叆搴撹ˉ鍏�
+ try {
+ StockInventoryDto dto = new StockInventoryDto();
+ dto.setProductModelId(pickVo.getProductModelId());
+ dto.setQualitity(shortage);
+ dto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode());
+ dto.setRecordId(0L);
+ stockInventoryService.addStockInRecordOnly(dto);
+
+ // 鏌ユ壘鍒氬垱寤虹殑鍏ュ簱璁板綍
+ List<com.ruoyi.stock.pojo.StockInRecord> records = stockInRecordService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.stock.pojo.StockInRecord>()
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getProductModelId, pickVo.getProductModelId())
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getApprovalStatus, 0)
+ .orderByDesc(com.ruoyi.stock.pojo.StockInRecord::getId)
+ .last("limit 1"));
+ if (!records.isEmpty()) {
+ com.ruoyi.stock.pojo.StockInRecord record = records.get(0);
+ record.setCreateTime(pickDateTime);
+ record.setBatchNo(fixBatchNoDate(record.getBatchNo(), pickDateStr));
+ record.setInboundBatches(fixBatchNoDate(record.getInboundBatches(), pickDateStr));
+ stockInRecordMapper.updateById(record);
+ // 瀹℃壒閫氳繃
+ stockInRecordService.batchApprove(List.of(record.getId()), ReviewStatusEnum.APPROVED.getCode());
+ log.info("鐗╂枡[{}]鑷姩鍏ュ簱瀹℃壒瀹屾垚, 鍏ュ簱鏁伴噺: {}", pickVo.getProductModelId(), shortage);
+ }
+ } catch (Exception e) {
+ log.warn("鐗╂枡[{}]鑷姩鍏ュ簱澶辫触: {}", pickVo.getProductModelId(), e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * 鐢熶骇鎶ュ伐: 閬嶅巻宸ュ崟閫愪釜鎶ュ伐锛屼粠鐢熶骇瑙掕壊鐢ㄦ埛涓殢鏈洪�夊彇鎶ュ伐浜�
+ */
+ private void processProductionReport(SalesLedger salesLedger, LocalDate reportDate) {
+ try {
+ List<ProductionOrder> orders = findOrdersForSalesLedger(salesLedger);
+ if (orders.isEmpty()) {
+ log.info("閿�鍞彴璐{}]鏃犵敓浜ц鍗�", salesLedger.getSalesContractNo());
+ return;
+ }
+
+ for (ProductionOrder order : orders) {
+ List<ProductionOperationTask> tasks = productionOperationTaskMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ProductionOperationTask>()
+ .eq(ProductionOperationTask::getProductionOrderId, order.getId())
+ .orderByAsc(ProductionOperationTask::getId));
+ for (ProductionOperationTask task : tasks) {
+ if (task.getStatus() != null && task.getStatus() >= 3) continue;
+
+ // 姣忔鎶ュ伐闅忔満閫変竴涓敓浜х敤鎴�
+ SysUser productionUser = randomProductionUser();
+ Long userId = productionUser != null ? productionUser.getUserId() : 1L;
+ String userName = productionUser != null ? productionUser.getNickName() : "绯荤粺";
+
+ // 鎶ュ伐
+ ProductionProductMainDto reportDto = new ProductionProductMainDto();
+ reportDto.setProductionOperationTaskId(task.getId());
+ reportDto.setQuantity(task.getPlanQuantity());
+ reportDto.setScrapQty(BigDecimal.ZERO);
+ reportDto.setUserId(userId);
+ reportDto.setUserName(userName);
+ productionProductMainService.addProductMain(reportDto);
+
+ // 淇鎶ュ伐鏃堕棿锛堥噸鏂颁粠DB璇诲彇锛岄伩鍏嶈鐩朼ddProductMain鏇存柊鐨刢ompleteQuantity锛�
+ fixProductionReportTimes(task.getId(), reportDate);
+ }
+ // 淇鐢熶骇璁㈠崟鏃堕棿锛堥噸鏂颁粠DB璇诲彇锛岄伩鍏嶈鐩朼ddProductMain鏇存柊鐨刢ompleteQuantity锛�
+ fixProductionOrderTimes(order.getId(), reportDate);
+ }
+ log.info("閿�鍞彴璐{}]鐢熶骇鎶ュ伐瀹屾垚, 璁㈠崟鏁�: {}", salesLedger.getSalesContractNo(), orders.size());
+ } catch (Exception e) {
+ log.warn("鐢熶骇鎶ュ伐澶辫触[{}]: {}", salesLedger.getSalesContractNo(), e.getMessage());
+ }
+ }
+
+ /**
+ * 鏌ユ壘閿�鍞彴璐﹀叧鑱旂殑鐢熶骇璁㈠崟
+ */
+ private List<ProductionOrder> findOrdersForSalesLedger(SalesLedger salesLedger) {
+ List<ProductionOrder> orders = new ArrayList<>();
+ List<ProductionPlan> plans = productionPlanMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ProductionPlan>()
+ .eq(ProductionPlan::getSalesLedgerId, salesLedger.getId()));
+ for (ProductionPlan plan : plans) {
+ List<ProductionOrder> po = productionOrderMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ProductionOrder>()
+ .like(ProductionOrder::getProductionPlanIds, String.valueOf(plan.getId())));
+ orders.addAll(po);
+ }
+ // 鍘婚噸
+ return orders.stream()
+ .collect(Collectors.toMap(ProductionOrder::getId, o -> o, (a, b) -> a))
+ .values().stream().collect(Collectors.toList());
+ }
+
+ /**
+ * 淇鐢熶骇鎶ュ伐鐩稿叧鏃堕棿锛堥噸鏂颁粠DB璇诲彇task锛岄伩鍏嶈鐩朼ddProductMain宸叉洿鏂扮殑completeQuantity锛�
+ */
+ private void fixProductionReportTimes(Long taskId, LocalDate reportDate) {
+ try {
+ ProductionOperationTask freshTask = productionOperationTaskMapper.selectById(taskId);
+ if (freshTask != null) {
+ freshTask.setActualStartTime(reportDate);
+ freshTask.setActualEndTime(reportDate);
+ freshTask.setStatus(4);
+ productionOperationTaskMapper.updateById(freshTask);
+ }
+ } catch (Exception e) {
+ log.warn("淇鐢熶骇鎶ュ伐鏃堕棿澶辫触: {}", e.getMessage());
+ }
+ }
+
+ /**
+ * 淇鐢熶骇璁㈠崟鏃堕棿锛堥噸鏂颁粠DB璇诲彇order锛岄伩鍏嶈鐩朼ddProductMain宸叉洿鏂扮殑completeQuantity锛�
+ */
+ private void fixProductionOrderTimes(Long orderId, LocalDate reportDate) {
+ try {
+ ProductionOrder freshOrder = productionOrderMapper.selectById(orderId);
+ if (freshOrder != null) {
+ freshOrder.setStartTime(reportDate.minusDays(1).atStartOfDay());
+ freshOrder.setEndTime(reportDate.plusDays(1).atStartOfDay());
+ freshOrder.setStatus(3);
+ productionOrderMapper.updateById(freshOrder);
+ }
+ } catch (Exception e) {
+ log.warn("淇鐢熶骇璁㈠崟鏃堕棿澶辫触: {}", e.getMessage());
+ }
+ }
+
+ /**
+ * 閿�鍞川妫�鎻愪氦 + 鍏ュ簱瀹℃壒
+ */
+ private void processSalesQualityAndStockIn(SalesLedger salesLedger, LocalDate qualityDate) {
+ try {
+ LocalDateTime qualityDateTime = qualityDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+
+ // 鏌ユ墍鏈夋湭鎻愪氦鐨勮川妫�鍗曪紙inspectType=1杩囩▼妫�楠�, 2=鍑哄巶妫�楠岋紝鐢辩敓浜ф姤宸ョ敓鎴愶級
+ List<QualityInspect> allUnsubmitted = qualityInspectService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<QualityInspect>()
+ .eq(QualityInspect::getInspectState, 0)
+ .in(QualityInspect::getInspectType, java.util.Arrays.asList(1, 2)));
+ for (QualityInspect qi : allUnsubmitted) {
+ qualityInspectService.autoSubmit(qi.getId());
+ qi.setCreateTime(qualityDateTime);
+ qualityInspectMapper.updateById(qi);
+ }
+ log.info("閿�鍞彴璐{}]璐ㄦ鎻愪氦瀹屾垚, 璐ㄦ鍗曟暟: {}", salesLedger.getSalesContractNo(), allUnsubmitted.size());
+
+ // 鍏ュ簱瀹℃壒锛氬鎵规墍鏈夊緟瀹℃壒鐨勫叆搴撹褰�
+ LocalDate stockDate = qualityDate.plusDays(ThreadLocalRandom.current().nextInt(0, 3));
+ LocalDateTime stockDateTime = stockDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+ String stockDateStr = stockDate.format(DateTimeFormatter.BASIC_ISO_DATE);
+ List<com.ruoyi.stock.pojo.StockInRecord> stockRecords = stockInRecordService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.stock.pojo.StockInRecord>()
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getApprovalStatus, 0));
+ List<Long> recordIds = stockRecords.stream()
+ .map(com.ruoyi.stock.pojo.StockInRecord::getId)
+ .collect(Collectors.toList());
+ if (!recordIds.isEmpty()) {
+ for (com.ruoyi.stock.pojo.StockInRecord sr : stockRecords) {
+ sr.setCreateTime(stockDateTime);
+ sr.setBatchNo(fixBatchNoDate(sr.getBatchNo(), stockDateStr));
+ sr.setInboundBatches(fixBatchNoDate(sr.getInboundBatches(), stockDateStr));
+ stockInRecordMapper.updateById(sr);
+ }
+ stockInRecordService.batchApprove(recordIds, ReviewStatusEnum.APPROVED.getCode());
+ for (com.ruoyi.stock.pojo.StockInRecord sr : stockRecords) {
+ StockInventory si = stockInventoryMapper.selectOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<StockInventory>()
+ .eq(StockInventory::getProductModelId, sr.getProductModelId())
+ .eq(StockInventory::getBatchNo, sr.getBatchNo()));
+ if (si != null) {
+ si.setBatchNo(fixBatchNoDate(si.getBatchNo(), stockDateStr));
+ stockInventoryMapper.updateById(si);
+ }
+ }
+ log.info("閿�鍞彴璐{}]鍏ュ簱瀹℃壒瀹屾垚, 鍏ュ簱璁板綍鏁�: {}", salesLedger.getSalesContractNo(), recordIds.size());
+ }
+ } catch (Exception e) {
+ log.warn("閿�鍞川妫�鍏ュ簱澶辫触[{}]: {}", salesLedger.getSalesContractNo(), e.getMessage());
+ }
+ }
+
+ /**
+ * 鍙戣揣 + 鍙戣揣瀹℃壒閫氳繃 + 鍑哄簱瀹℃壒
+ */
+ private void processSalesShipping(SalesLedger salesLedger, LocalDate shipDate) {
+ try {
+ LocalDateTime shipDateTime = shipDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+ String shipDateStr = shipDate.format(DateTimeFormatter.BASIC_ISO_DATE);
+
+ // 鏌ユ壘鏈夊簱瀛樼殑浜у搧瑙勬牸
+ List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<SalesLedgerProduct>()
+ .eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId()));
+
+ List<ShippingProductDetail> details = new ArrayList<>();
+ for (SalesLedgerProduct slp : products) {
+ StockInventory si = stockInventoryMapper.selectOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<StockInventory>()
+ .eq(StockInventory::getProductModelId, slp.getProductModelId())
+ .gt(StockInventory::getQualitity, BigDecimal.ZERO)
+ .orderByDesc(StockInventory::getId)
+ .last("limit 1"));
+ if (si != null) {
+ ShippingProductDetail detail = new ShippingProductDetail();
+ detail.setStockInventoryId(si.getId());
+ detail.setProductModelId(slp.getProductModelId());
+ detail.setBatchNo(si.getBatchNo());
+ detail.setQuantity(slp.getQuantity());
+ details.add(detail);
+ }
+ }
+ if (details.isEmpty()) {
+ log.info("閿�鍞彴璐{}]鏃犲彲鐢ㄥ簱瀛橈紝璺宠繃鍙戣揣", salesLedger.getSalesContractNo());
+ return;
+ }
+
+ // 鍒涘缓鍙戣揣鍗�
+ ShippingInfoDto shipDto = new ShippingInfoDto();
+ shipDto.setSalesLedgerId(salesLedger.getId());
+ shipDto.setSalesLedgerProductId(products.get(0).getId());
+ shipDto.setCreateTime(shipDateTime);
+ shipDto.setBatchNoDetailList(details);
+ shippingInfoService.addReq(shipDto);
+
+ // 鎵惧埌鍙戣揣鍗曞拰瀹℃壒瀹炰緥
+ ShippingInfo shippingInfo = shippingInfoMapper.selectOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ShippingInfo>()
+ .eq(ShippingInfo::getShippingNo, shipDto.getShippingNo())
+ .last("limit 1"));
+ if (shippingInfo != null) {
+ shippingInfo.setCreateTime(shipDateTime);
+ shippingInfo.setShippingDate(java.sql.Date.valueOf(shipDate));
+ // 鏍规嵁瀹㈡埛鍦板潃鐢熸垚鍙戣揣杞︾墝鍙�
+ shippingInfo.setShippingCarNumber(generateCarNumber(salesLedger.getCustomerName()));
+ shippingInfoMapper.updateById(shippingInfo);
+
+ // 鍙戣揣瀹℃壒鑷姩閫氳繃
+ ApprovalInstance shipApproval = approvalInstanceMapper.selectOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getBusinessId, shippingInfo.getId())
+ .eq(ApprovalInstance::getBusinessType, 7L)
+ .eq(ApprovalInstance::getDeleted, 0)
+ .orderByDesc(ApprovalInstance::getId)
+ .last("limit 1"));
+ if (shipApproval != null) {
+ LocalDate shipApproveDate = shipDate.plusDays(ThreadLocalRandom.current().nextInt(0, 3));
+ LocalDateTime shipApproveDateTime = shipApproveDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+ approvalInstanceService.autoApprove(shipApproval.getId());
+ fixApprovalTimes(shipApproval.getId(), shipApproveDateTime);
+
+ shippingInfo.setStatus("宸插彂璐�");
+ shippingInfo.setShippingDate(java.sql.Date.valueOf(shipApproveDate));
+ shippingInfoMapper.updateById(shippingInfo);
+ }
+
+ // 鍑哄簱瀹℃壒
+ LocalDate outDate = shipDate.plusDays(ThreadLocalRandom.current().nextInt(0, 3));
+ LocalDateTime outDateTime = outDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+ String outDateStr = outDate.format(DateTimeFormatter.BASIC_ISO_DATE);
+ List<StockOutRecord> outRecords = stockOutRecordMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<StockOutRecord>()
+ .eq(StockOutRecord::getRecordId, shippingInfo.getId())
+ .eq(StockOutRecord::getRecordType,
+ String.valueOf(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode())));
+ List<Long> outIds = new ArrayList<>();
+ for (StockOutRecord sr : outRecords) {
+ if (sr.getApprovalStatus() == null || sr.getApprovalStatus() == 0 || sr.getApprovalStatus() == 3) {
+ sr.setCreateTime(outDateTime);
+ sr.setOutboundBatches(fixBatchNoDate(sr.getOutboundBatches(), outDateStr));
+ sr.setBatchNo(fixBatchNoDate(sr.getBatchNo(), outDateStr));
+ stockOutRecordMapper.updateById(sr);
+ outIds.add(sr.getId());
+ }
+ }
+ if (!outIds.isEmpty()) {
+ // 鍑哄簱瀹℃壒閫氳繃锛堣蛋姝e紡瀹℃壒娴佺▼锛屽唴閮ㄤ細鎵e噺搴撳瓨锛�
+ stockOutRecordService.batchApprove(outIds, ReviewStatusEnum.APPROVED.getCode());
+ log.info("閿�鍞彴璐{}]鍑哄簱瀹℃壒瀹屾垚, 鍑哄簱璁板綍鏁�: {}",
+ salesLedger.getSalesContractNo(), outIds.size());
+ }
+ }
+ log.info("閿�鍞彴璐{}]鍙戣揣娴佺▼瀹屾垚", salesLedger.getSalesContractNo());
+ } catch (Exception e) {
+ log.warn("閿�鍞彂璐ф祦绋嬪け璐{}]: {}", salesLedger.getSalesContractNo(), e.getMessage());
+ }
+ }
+
+ private ModuleSummary createPurchaseLedgers(List<JSONObject> items, Map<String, Long> supplierNameToId,
+ String additionalInfo, String dateStart, String dateEnd) {
+ // 鏄惁闇�瑕佽川妫�锛屼粠琛ュ厖淇℃伅鍒ゆ柇锛岄粯璁や笉闇�瑕�
+ boolean needQualityInspect = additionalInfo != null
+ && (additionalInfo.contains("璐ㄦ") || additionalInfo.contains("闇�瑕佹楠�"));
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ String supplierName = item.getString("supplierName");
+ Long supplierId = supplierNameToId.get(supplierName);
+
+ PurchaseLedgerDto dto = new PurchaseLedgerDto();
+ dto.setSupplierId(supplierId);
+ dto.setSupplierName(supplierName);
+ dto.setPurchaseContractNumber(item.getString("purchaseContractNumber"));
+ dto.setProjectName(item.getString("projectName"));
+ dto.setContractAmount(item.getBigDecimal("contractAmount"));
+ dto.setPaymentMethod(item.getString("paymentMethod"));
+
+ String entryDateStr = item.getString("entryDate");
+ LocalDate entryDate = null;
+ if (item.containsKey("entryDate") && entryDateStr != null && entryDateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ entryDate = LocalDate.parse(entryDateStr);
+ dto.setEntryDate(java.sql.Date.valueOf(entryDateStr));
+ } else {
+ dto.setEntryDate(java.sql.Date.valueOf(dateStart));
+ }
+ if (item.containsKey("executionDate")) {
+ String execDateStr = item.getString("executionDate");
+ if (execDateStr != null && execDateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ dto.setExecutionDate(java.sql.Date.valueOf(execDateStr));
+ } else {
+ dto.setExecutionDate(java.sql.Date.valueOf(dateStart));
+ }
+ }
+ JSONArray productData = item.getJSONArray("productData");
+ if (productData != null) {
+ List<SalesLedgerProduct> products = new ArrayList<>();
+ for (int i = 0; i < productData.size(); i++) {
+ JSONObject pd = productData.getJSONObject(i);
+ SalesLedgerProduct slp = new SalesLedgerProduct();
+ slp.setProductId(pd.getLong("productId"));
+ slp.setProductModelId(pd.getLong("productModelId"));
+ slp.setQuantity(pd.getBigDecimal("quantity"));
+ slp.setTaxInclusiveUnitPrice(pd.getBigDecimal("taxInclusiveUnitPrice"));
+ slp.setTaxInclusiveTotalPrice(pd.getBigDecimal("taxInclusiveTotalPrice"));
+ slp.setTaxRate(pd.getBigDecimal("taxRate"));
+ slp.setUnit(pd.getString("unit"));
+ slp.setType(2);
+ // 鏄惁璐ㄦ锛氫粠琛ュ厖淇℃伅鍒ゆ柇锛岄粯璁や笉闇�瑕�
+ slp.setIsChecked(needQualityInspect);
+ if (pd.containsKey("taxExclusiveTotalPrice")) {
+ slp.setTaxExclusiveTotalPrice(pd.getBigDecimal("taxExclusiveTotalPrice"));
+ } else if (pd.getBigDecimal("taxInclusiveTotalPrice") != null && pd.getBigDecimal("taxRate") != null) {
+ slp.setTaxExclusiveTotalPrice(
+ pd.getBigDecimal("taxInclusiveTotalPrice").divide(
+ BigDecimal.ONE.add(pd.getBigDecimal("taxRate").divide(new BigDecimal("100"), 4, RoundingMode.HALF_UP)),
+ 2, RoundingMode.HALF_UP));
+ } else {
+ slp.setTaxExclusiveTotalPrice(BigDecimal.ZERO);
+ }
+ products.add(slp);
+ }
+ dto.setProductData(products);
+ }
+ purchaseLedgerService.addOrEditPurchase(dto);
+ // 閫氳繃鍚堝悓鍙锋壘鍒板垰鍒涘缓鐨勯噰璐彴璐�
+ PurchaseLedger savedLedger = purchaseLedgerService.getOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<PurchaseLedger>()
+ .eq(PurchaseLedger::getPurchaseContractNumber, dto.getPurchaseContractNumber())
+ .last("limit 1"));
+ if (savedLedger != null) {
+ // 璧板畬鏁存祦绋嬶細瀹℃牳閫氳繃 鈫� 璐ㄦ(鍙��) 鈫� 鍏ュ簱 + 鍏ュ簱瀹℃牳閫氳繃
+ processPurchaseFullFlow(savedLedger, needQualityInspect, entryDate, dateEnd);
+ }
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓閲囪喘鍙拌处澶辫触: {}", e.getMessage(), e);
+ fail++;
+ }
+ }
+ return summary("purchase", "閲囪喘鍙拌处", items.size(), success, fail);
+ }
+
+ /**
+ * 閲囪喘瀹屾暣娴佺▼: 瀹℃牳閫氳繃 鈫� 璐ㄦ(鍙��) 鈫� 鍏ュ簱瀹℃牳閫氳繃
+ * 鍚勭幆鑺傛椂闂翠互閲囪喘褰曞叆鏃ユ湡涓哄熀鍑嗭紝鍋跺皵鎺ㄨ繜1-3澶�
+ */
+ private void processPurchaseFullFlow(PurchaseLedger purchaseLedger, boolean needQualityInspect,
+ LocalDate entryDate, String dateEnd) {
+ try {
+ // 鍩哄噯鏃ユ湡锛氶噰璐綍鍏ユ棩鏈燂紝涓虹┖鍒欑敤褰撳ぉ
+ LocalDate baseDate = entryDate != null ? entryDate : LocalDate.now();
+ // 瀹℃壒鏃堕棿锛氬熀浜庡綍鍏ユ棩鏈燂紝闅忔満鎺�0-3澶�
+ LocalDate approveDate = baseDate.plusDays(ThreadLocalRandom.current().nextInt(0, 4));
+ LocalDateTime approveDateTime = approveDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+
+ // 1. 瀹℃壒鑷姩閫氳繃
+ ApprovalInstance approvalInstance = approvalInstanceMapper.selectOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getBusinessId, purchaseLedger.getId())
+ .eq(ApprovalInstance::getBusinessType, 5L)
+ .eq(ApprovalInstance::getDeleted, 0)
+ .orderByDesc(ApprovalInstance::getId)
+ .last("limit 1"));
+ if (approvalInstance != null) {
+ approvalInstanceService.autoApprove(approvalInstance.getId());
+ // 淇瀹℃壒鐩稿叧鏃堕棿涓洪噰璐綍鍏ユ棩鏈熻寖鍥�
+ fixApprovalTimes(approvalInstance.getId(), approveDateTime);
+ log.info("閲囪喘鍙拌处[{}]瀹℃壒閫氳繃, 瀹℃壒鏃ユ湡: {}", purchaseLedger.getPurchaseContractNumber(), approveDate);
+ }
+
+ // 2. 璐ㄦ娴佺▼锛堝鏋滈渶瑕佽川妫�锛�
+ if (needQualityInspect) {
+ // 璐ㄦ鏃堕棿锛氬鎵逛箣鍚庡啀鎺�0-3澶�
+ LocalDate inspectDate = approveDate.plusDays(ThreadLocalRandom.current().nextInt(0, 4));
+ processQualityInspect(purchaseLedger, inspectDate);
+ }
+
+ // 3. 鍏ュ簱瀹℃壒閫氳繃
+ // 鍏ュ簱鏃堕棿锛氳川妫�鏃堕棿锛堟湁璐ㄦ锛夋垨瀹℃壒鏃堕棿涔嬪悗鍐嶆帹0-3澶�
+ LocalDate stockBaseDate = needQualityInspect
+ ? approveDate.plusDays(ThreadLocalRandom.current().nextInt(1, 4))
+ : approveDate.plusDays(ThreadLocalRandom.current().nextInt(0, 4));
+ processStockInApprove(purchaseLedger, stockBaseDate);
+
+ } catch (Exception e) {
+ log.warn("閲囪喘瀹屾暣娴佺▼澶勭悊澶辫触[{}]: {}", purchaseLedger.getPurchaseContractNumber(), e.getMessage());
+ }
+ }
+
+ /**
+ * 淇瀹℃壒瀹炰緥鍙婂叧鑱旇妭鐐广�佷换鍔°�佽褰曠殑鏃堕棿
+ */
+ private void fixApprovalTimes(Long instanceId, LocalDateTime dateTime) {
+ try {
+ // 鏇存柊瀹℃壒瀹炰緥鐨刦inishTime鍜宑reateTime
+ ApprovalInstance instance = approvalInstanceMapper.selectById(instanceId);
+ if (instance != null) {
+ instance.setFinishTime(dateTime);
+ instance.setCreateTime(dateTime.minusHours(1));
+ approvalInstanceMapper.updateById(instance);
+ }
+
+ // 鏇存柊瀹℃壒瀹炰緥鑺傜偣鐨刦inishTime
+ List<ApprovalInstanceNode> nodes = approvalInstanceNodeMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ApprovalInstanceNode>()
+ .eq(ApprovalInstanceNode::getInstanceId, instanceId));
+ for (ApprovalInstanceNode node : nodes) {
+ node.setFinishTime(dateTime);
+ node.setCreateTime(dateTime.minusHours(1));
+ approvalInstanceNodeMapper.updateById(node);
+ }
+
+ // 鏇存柊瀹℃壒浠诲姟鐨刢reateTime
+ List<ApprovalTask> tasks = approvalTaskMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ApprovalTask>()
+ .eq(ApprovalTask::getInstanceId, instanceId));
+ for (ApprovalTask task : tasks) {
+ task.setCreateTime(dateTime.minusMinutes(30));
+ approvalTaskMapper.updateById(task);
+ }
+
+ // 鏇存柊瀹℃壒璁板綍鐨刢reateTime
+ List<ApprovalRecord> records = approvalRecordMapper.selectList(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ApprovalRecord>()
+ .eq(ApprovalRecord::getInstanceId, instanceId));
+ for (ApprovalRecord record : records) {
+ record.setCreateTime(dateTime.minusMinutes(10));
+ approvalRecordMapper.updateById(record);
+ }
+ } catch (Exception e) {
+ log.warn("淇瀹℃壒鏃堕棿澶辫触: {}", e.getMessage());
+ }
+ }
+
+ /**
+ * 璐ㄦ: 鎵惧埌閲囪喘鍏宠仈鐨勮川妫�鍗曪紝鑷姩鎻愪氦涓哄悎鏍�
+ */
+ private void processQualityInspect(PurchaseLedger purchaseLedger, LocalDate inspectDate) {
+ try {
+ LocalDateTime inspectDateTime = inspectDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+ List<QualityInspect> inspectList = qualityInspectService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<QualityInspect>()
+ .eq(QualityInspect::getPurchaseLedgerId, purchaseLedger.getId()));
+ for (QualityInspect qi : inspectList) {
+ if (qi.getInspectState() == null || qi.getInspectState() == 0) {
+ qualityInspectService.autoSubmit(qi.getId());
+ // 淇璐ㄦ鏃堕棿
+ qi.setCreateTime(inspectDateTime);
+ qualityInspectMapper.updateById(qi);
+ log.info("閲囪喘鍙拌处[{}]璐ㄦ鍗昜{}]鑷姩鎻愪氦鍚堟牸, 璐ㄦ鏃ユ湡: {}",
+ purchaseLedger.getPurchaseContractNumber(), qi.getId(), inspectDate);
+ }
+ }
+ } catch (Exception e) {
+ log.warn("璐ㄦ娴佺▼澶勭悊澶辫触[{}]: {}", purchaseLedger.getPurchaseContractNumber(), e.getMessage());
+ }
+ }
+
+ /**
+ * 鍏ュ簱瀹℃牳: 鎵惧埌鍏ュ簱璁板綍骞跺鎵归�氳繃锛屽苟淇鏃堕棿涓庢壒鍙锋棩鏈�
+ */
+ private void processStockInApprove(PurchaseLedger purchaseLedger, LocalDate stockDate) {
+ try {
+ LocalDateTime stockDateTime = stockDate.atTime(9, 0, 0)
+ .plusMinutes(ThreadLocalRandom.current().nextInt(0, 480));
+ String stockDateStr = stockDate.format(java.time.format.DateTimeFormatter.BASIC_ISO_DATE);
+
+ List<com.ruoyi.stock.pojo.StockInRecord> stockRecords = stockInRecordService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.stock.pojo.StockInRecord>()
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getRecordId, purchaseLedger.getId())
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getRecordType,
+ String.valueOf(com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode())));
+ if (stockRecords.isEmpty()) {
+ stockRecords = stockInRecordService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.stock.pojo.StockInRecord>()
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getRecordId, purchaseLedger.getId())
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getRecordType,
+ String.valueOf(com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())));
+ }
+ for (QualityInspect qi : qualityInspectService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<QualityInspect>()
+ .eq(QualityInspect::getPurchaseLedgerId, purchaseLedger.getId()))) {
+ List<com.ruoyi.stock.pojo.StockInRecord> qiRecords = stockInRecordService.list(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.stock.pojo.StockInRecord>()
+ .eq(com.ruoyi.stock.pojo.StockInRecord::getRecordId, qi.getId()));
+ stockRecords.addAll(qiRecords);
+ }
+ stockRecords = stockRecords.stream()
+ .collect(Collectors.toMap(com.ruoyi.stock.pojo.StockInRecord::getId, r -> r, (a, b) -> a))
+ .values().stream().collect(Collectors.toList());
+
+ if (!stockRecords.isEmpty()) {
+ List<Long> recordIds = stockRecords.stream()
+ .filter(r -> r.getApprovalStatus() == null || r.getApprovalStatus() == 0)
+ .map(com.ruoyi.stock.pojo.StockInRecord::getId)
+ .collect(Collectors.toList());
+ if (!recordIds.isEmpty()) {
+ // 鍏堜慨姝e叆搴撹褰曠殑createTime鍜屾壒鍙锋棩鏈燂紙batchApprove鍐呴儴浼氱敤batchNo鍒涘缓StockInventory锛�
+ for (Long recordId : recordIds) {
+ com.ruoyi.stock.pojo.StockInRecord sr = stockInRecordMapper.selectById(recordId);
+ if (sr != null) {
+ sr.setCreateTime(stockDateTime);
+ sr.setBatchNo(fixBatchNoDate(sr.getBatchNo(), stockDateStr));
+ String s = OrderUtils.countTodayByCreateTime(stockInRecordMapper, "RK", "inbound_batches", stockDateTime);
+ sr.setInboundBatches(s);
+ stockInRecordMapper.updateById(sr);
+ }
+ }
+ stockInRecordService.batchApprove(recordIds, ReviewStatusEnum.APPROVED.getCode());
+ log.info("閲囪喘鍙拌处[{}]鍏ュ簱瀹℃壒閫氳繃, 鍏ュ簱鏃ユ湡: {}, 鍏ュ簱璁板綍鏁�: {}",
+ purchaseLedger.getPurchaseContractNumber(), stockDate, recordIds.size());
+ }
+ }
+ } catch (Exception e) {
+ log.warn("鍏ュ簱瀹℃壒澶辫触[{}]: {}", purchaseLedger.getPurchaseContractNumber(), e.getMessage());
+ }
+ }
+
+ /**
+ * 鏇挎崲鎵瑰彿涓殑鏃ユ湡閮ㄥ垎锛坹yyyMMdd 鈫� 鎸囧畾鏃ユ湡锛�
+ */
+ /**
+ * 鏍规嵁瀹㈡埛鍚嶇О鏌ュ湴鍧�锛屾帹鏂渷浠界畝绉扮敓鎴愯溅鐗屽彿
+ * 鏍煎紡: 鐪佷唤绠�绉� + 瀛楁瘝 + 5浣嶉殢鏈烘暟瀛楀瓧姣�, 濡� 鑻廇12345
+ */
+ private String generateCarNumber(String customerName) {
+ // 鐪佷唤绠�绉板埌鍩庡競瀛楁瘝鐨勫父瑙佹槧灏�
+ Map<String, String[]> provinceCityMap = new HashMap<>();
+ provinceCityMap.put("浜�", new String[]{"A", "B", "C", "E", "F", "G"});
+ provinceCityMap.put("娌�", new String[]{"A", "B", "D", "E", "F"});
+ provinceCityMap.put("绮�", new String[]{"A", "B", "E", "F", "G", "H", "J", "K"});
+ provinceCityMap.put("鑻�", new String[]{"A", "B", "E", "F", "G", "H", "J", "K", "L", "M"});
+ provinceCityMap.put("娴�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L"});
+ provinceCityMap.put("椴�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "Y"});
+ provinceCityMap.put("璞�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "U"});
+ provinceCityMap.put("宸�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"});
+ provinceCityMap.put("娓�", new String[]{"A", "B", "C", "D"});
+ provinceCityMap.put("閯�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S"});
+ provinceCityMap.put("婀�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "S"});
+ provinceCityMap.put("闂�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K"});
+ provinceCityMap.put("璧�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M"});
+ provinceCityMap.put("鐨�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S"});
+ provinceCityMap.put("鍐�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "R", "T"});
+ provinceCityMap.put("杈�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P"});
+ provinceCityMap.put("鍚�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K"});
+ provinceCityMap.put("榛�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R"});
+ provinceCityMap.put("鏅�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M"});
+ provinceCityMap.put("闄�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "V"});
+ provinceCityMap.put("妗�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R"});
+ provinceCityMap.put("浜�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S"});
+ provinceCityMap.put("璐�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J"});
+ provinceCityMap.put("鐢�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P"});
+ provinceCityMap.put("鐞�", new String[]{"A", "B", "C", "D", "E", "F"});
+ provinceCityMap.put("瀹�", new String[]{"A", "B", "C", "D", "E"});
+ provinceCityMap.put("闈�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H"});
+ provinceCityMap.put("钘�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J"});
+ provinceCityMap.put("钂�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M"});
+ provinceCityMap.put("鏂�", new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R"});
+ provinceCityMap.put("娲�", new String[]{"A", "B", "C", "E", "F", "G", "H", "J", "K", "L", "M", "N", "Q", "R"});
+
+ // 鍦板潃鍏抽敭璇嶅埌鐪佷唤绠�绉扮殑鏄犲皠
+ Map<String, String> addressToProvince = new HashMap<>();
+ addressToProvince.put("鍖椾含", "浜�"); addressToProvince.put("涓婃捣", "娌�");
+ addressToProvince.put("骞垮窞", "绮�"); addressToProvince.put("娣卞湷", "绮�");
+ addressToProvince.put("涓滆帪", "绮�"); addressToProvince.put("浣涘北", "绮�");
+ addressToProvince.put("鍗椾含", "鑻�"); addressToProvince.put("鑻忓窞", "鑻�");
+ addressToProvince.put("鏃犻敗", "鑻�"); addressToProvince.put("鍗楅��", "鑻�");
+ addressToProvince.put("甯稿窞", "鑻�"); addressToProvince.put("寰愬窞", "鑻�");
+ addressToProvince.put("鏉窞", "娴�"); addressToProvince.put("瀹佹尝", "娴�");
+ addressToProvince.put("娓╁窞", "娴�"); addressToProvince.put("鍢夊叴", "娴�");
+ addressToProvince.put("娴庡崡", "椴�"); addressToProvince.put("闈掑矝", "椴�");
+ addressToProvince.put("閮戝窞", "璞�"); addressToProvince.put("鎴愰兘", "宸�");
+ addressToProvince.put("閲嶅簡", "娓�"); addressToProvince.put("姝︽眽", "閯�");
+ addressToProvince.put("闀挎矙", "婀�"); addressToProvince.put("绂忓窞", "闂�");
+ addressToProvince.put("鍘﹂棬", "闂�"); addressToProvince.put("鍗楁槍", "璧�");
+ addressToProvince.put("鍚堣偉", "鐨�"); addressToProvince.put("鐭冲搴�", "鍐�");
+ addressToProvince.put("娌堥槼", "杈�"); addressToProvince.put("澶ц繛", "杈�");
+ addressToProvince.put("闀挎槬", "鍚�"); addressToProvince.put("鍝堝皵婊�", "榛�");
+ addressToProvince.put("澶師", "鏅�"); addressToProvince.put("瑗垮畨", "闄�");
+ addressToProvince.put("鍗楀畞", "妗�"); addressToProvince.put("鏄嗘槑", "浜�");
+ addressToProvince.put("璐甸槼", "璐�"); addressToProvince.put("鍏板窞", "鐢�");
+ addressToProvince.put("娴峰彛", "鐞�"); addressToProvince.put("閾跺窛", "瀹�");
+ addressToProvince.put("瑗垮畞", "闈�"); addressToProvince.put("鎷夎惃", "钘�");
+ addressToProvince.put("鍛煎拰娴╃壒", "钂�"); addressToProvince.put("涔岄瞾鏈ㄩ綈", "鏂�");
+ addressToProvince.put("澶╂触", "娲�");
+ // 鐪佸悕鏄犲皠
+ addressToProvince.put("姹熻嫃", "鑻�"); addressToProvince.put("娴欐睙", "娴�");
+ addressToProvince.put("灞变笢", "椴�"); addressToProvince.put("娌冲崡", "璞�");
+ addressToProvince.put("鍥涘窛", "宸�"); addressToProvince.put("婀栧寳", "閯�");
+ addressToProvince.put("婀栧崡", "婀�"); addressToProvince.put("绂忓缓", "闂�");
+ addressToProvince.put("姹熻タ", "璧�"); addressToProvince.put("瀹夊窘", "鐨�");
+ addressToProvince.put("娌冲寳", "鍐�"); addressToProvince.put("杈藉畞", "杈�");
+ addressToProvince.put("鍚夋灄", "鍚�"); addressToProvince.put("榛戦緳姹�", "榛�");
+ addressToProvince.put("灞辫タ", "鏅�"); addressToProvince.put("闄曡タ", "闄�");
+ addressToProvince.put("骞夸笢", "绮�"); addressToProvince.put("骞胯タ", "妗�");
+ addressToProvince.put("浜戝崡", "浜�"); addressToProvince.put("璐靛窞", "璐�");
+ addressToProvince.put("鐢樿們", "鐢�"); addressToProvince.put("娴峰崡", "鐞�");
+ addressToProvince.put("瀹佸", "瀹�"); addressToProvince.put("闈掓捣", "闈�");
+ addressToProvince.put("瑗胯棌", "钘�"); addressToProvince.put("鍐呰挋鍙�", "钂�");
+ addressToProvince.put("鏂扮枂", "鏂�");
+
+ String province = "鑻�"; // 榛樿姹熻嫃
+ // 灏濊瘯浠庡鎴峰湴鍧�鎺ㄦ柇鐪佷唤
+ if (customerName != null) {
+ try {
+ Customer customer = customerService.getOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Customer>()
+ .eq(Customer::getCustomerName, customerName)
+ .last("limit 1"));
+ if (customer != null && customer.getCompanyAddress() != null) {
+ String addr = customer.getCompanyAddress();
+ for (Map.Entry<String, String> e : addressToProvince.entrySet()) {
+ if (addr.contains(e.getKey())) {
+ province = e.getValue();
+ break;
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.debug("鏌ュ鎴峰湴鍧�澶辫触: {}", e.getMessage());
+ }
+ }
+
+ // 鐢熸垚杞︾墝鍙�: 鐪佷唤绠�绉� + 鍩庡競瀛楁瘝 + 5浣嶉殢鏈哄瓧绗�(鏁板瓧+澶у啓瀛楁瘝)
+ String[] cities = provinceCityMap.getOrDefault(province, new String[]{"A", "B", "C"});
+ String city = cities[ThreadLocalRandom.current().nextInt(cities.length)];
+ String chars = "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789";
+ StringBuilder suffix = new StringBuilder();
+ for (int i = 0; i < 5; i++) {
+ suffix.append(chars.charAt(ThreadLocalRandom.current().nextInt(chars.length())));
+ }
+ return province + city + suffix;
+ }
+
+ private String fixBatchNoDate(String batchNo, String newDate) {
+ if (batchNo == null || batchNo.length() < 8) {
+ return batchNo;
+ }
+ // 鎵瑰彿鏍煎紡: yyyyMMdd-浜у搧缂栫爜-NNN
+ String prefix = batchNo.substring(0, 8);
+ if (prefix.matches("\\d{8}")) {
+ return newDate + batchNo.substring(8);
+ }
+ return batchNo;
+ }
+
+ private ModuleSummary createProductionPlans(List<JSONObject> items) {
+ int success = 0, fail = 0;
+ List<ProductionPlan> createdPlans = new ArrayList<>();
+ for (JSONObject item : items) {
+ try {
+ ProductionPlan plan = new ProductionPlan();
+ plan.setProductModelId(item.getLong("productModelId"));
+ plan.setQtyRequired(item.getBigDecimal("qtyRequired"));
+ plan.setSource(item.getString("source"));
+ plan.setRemark(item.getString("remark"));
+ if (item.containsKey("requiredDate")) {
+ String dateStr = item.getString("requiredDate");
+ if (dateStr != null && dateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ plan.setRequiredDate(LocalDate.parse(dateStr));
+ }
+ }
+ if (item.containsKey("promisedDeliveryDate")) {
+ String dateStr = item.getString("promisedDeliveryDate");
+ if (dateStr != null && dateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ plan.setPromisedDeliveryDate(LocalDate.parse(dateStr));
+ }
+ }
+ productionPlanService.save(plan);
+ createdPlans.add(plan);
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓鐢熶骇璁″垝澶辫触: {}", e.getMessage());
+ fail++;
+ }
+ }
+
+ // 鎸塸roductModelId鍒嗙粍锛岃嚜鍔ㄥ悎骞朵笅鍙�
+ Map<Long, List<ProductionPlan>> grouped = createdPlans.stream()
+ .filter(p -> p.getProductModelId() != null)
+ .collect(Collectors.groupingBy(ProductionPlan::getProductModelId));
+ for (Map.Entry<Long, List<ProductionPlan>> entry : grouped.entrySet()) {
+ try {
+ List<Long> planIds = entry.getValue().stream().map(ProductionPlan::getId).collect(Collectors.toList());
+ BigDecimal totalQty = entry.getValue().stream()
+ .map(ProductionPlan::getQtyRequired)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ ProductionPlanDto combineDto = new ProductionPlanDto();
+ combineDto.setIds(planIds);
+ combineDto.setTotalAssignedQuantity(totalQty);
+ combineDto.setPlanCompleteTime(LocalDate.now().plusDays(ThreadLocalRandom.current().nextInt(3, 10)));
+ productionPlanService.combine(combineDto);
+ log.info("鐢熶骇璁″垝鑷姩涓嬪彂鎴愬姛, productModelId={}, 璁″垝鏁�: {}, 涓嬪彂鏁伴噺: {}",
+ entry.getKey(), planIds.size(), totalQty);
+ } catch (Exception e) {
+ log.warn("鐢熶骇璁″垝鑷姩涓嬪彂澶辫触, productModelId={}: {}", entry.getKey(), e.getMessage());
+ }
+ }
+
+ return summary("production", "鐢熶骇璁″垝", items.size(), success, fail);
+ }
+
+ // ---- Tier 2: 鍚庣画鍗曟嵁 ----
+
+ private ModuleSummary createProductionOrders(List<JSONObject> items) {
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ ProductionOrder order = new ProductionOrder();
+ order.setProductModelId(item.getLong("productModelId"));
+ order.setQuantity(item.getBigDecimal("quantity"));
+ if (item.containsKey("planCompleteTime")) {
+ String dateStr = item.getString("planCompleteTime");
+ if (dateStr != null && dateStr.matches("\\d{4}-\\d{2}-\\d{2}")) {
+ order.setPlanCompleteTime(LocalDate.parse(dateStr));
+ }
+ }
+ productionOrderService.saveProductionOrder(order);
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓鐢熶骇璁㈠崟澶辫触: {}", e.getMessage());
+ fail++;
+ }
+ }
+ return summary("production", "鐢熶骇璁㈠崟", items.size(), success, fail);
+ }
+
+ private ModuleSummary createQualityBindings(List<JSONObject> items) {
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ QualityTestStandardBinding binding = new QualityTestStandardBinding();
+ binding.setProductId(item.getLong("productId"));
+ binding.setTestStandardId(item.getInteger("testStandardId"));
+ qualityTestStandardBindingService.add(List.of(binding));
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓鎸囨爣缁戝畾澶辫触: {}", e.getMessage());
+ fail++;
+ }
+ }
+ return summary("quality", "鎸囨爣缁戝畾", items.size(), success, fail);
+ }
+
+ private ModuleSummary createStockInventories(List<JSONObject> items) {
+ int success = 0, fail = 0;
+ for (JSONObject item : items) {
+ try {
+ StockInventoryDto dto = new StockInventoryDto();
+ dto.setProductModelId(item.getLong("productModelId"));
+ dto.setQualitity(item.getBigDecimal("qualitity"));
+ dto.setBatchNo(item.getString("batchNo"));
+ dto.setWarnNum(item.getBigDecimal("warnNum"));
+ dto.setRemark(item.getString("remark"));
+ stockInventoryService.addstockInventory(dto);
+ success++;
+ } catch (Exception e) {
+ log.warn("鍒涘缓搴撳瓨璁板綍澶辫触: {}", e.getMessage());
+ fail++;
+ }
+ }
+ return summary("stock", "搴撳瓨璁板綍", items.size(), success, fail);
+ }
+
+ private ModuleSummary summary(String module, String entityName, int total, int success, int fail) {
+ ModuleSummary s = new ModuleSummary();
+ s.setModule(module);
+ s.setEntityName(entityName);
+ s.setGeneratedCount(total);
+ s.setSuccessCount(success);
+ s.setFailCount(fail);
+ return s;
+ }
+}
diff --git a/src/main/java/com/ruoyi/mock/vo/DataCheckResult.java b/src/main/java/com/ruoyi/mock/vo/DataCheckResult.java
new file mode 100644
index 0000000..ed48b72
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/vo/DataCheckResult.java
@@ -0,0 +1,36 @@
+package com.ruoyi.mock.vo;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 鍩虹鏁版嵁妫�娴嬬粨鏋�
+ */
+@Data
+public class DataCheckResult {
+
+ /** 妫�娴嬮」鎬绘暟 */
+ private int totalItems;
+ /** 宸查�氳繃鐨勬娴嬮」鏁伴噺 */
+ private int passedItems;
+ /** 妫�娴嬫槑缁� */
+ private List<CheckItem> items = new ArrayList<>();
+
+ @Data
+ public static class CheckItem {
+ /** 妯″潡锛歴ales / purchase / quality / common */
+ private String module;
+ /** 妫�娴嬮」鍚嶇О */
+ private String itemName;
+ /** 鎵�闇�鏈�浣庢暟閲� */
+ private int minRequired;
+ /** 褰撳墠瀹為檯鏁伴噺 */
+ private int currentCount;
+ /** 鏄惁閫氳繃 */
+ private boolean passed;
+ /** 鎻愮ず淇℃伅 */
+ private String message;
+ }
+}
diff --git a/src/main/java/com/ruoyi/mock/vo/DataGenerateResult.java b/src/main/java/com/ruoyi/mock/vo/DataGenerateResult.java
new file mode 100644
index 0000000..e4487fc
--- /dev/null
+++ b/src/main/java/com/ruoyi/mock/vo/DataGenerateResult.java
@@ -0,0 +1,37 @@
+package com.ruoyi.mock.vo;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * AI鏁版嵁鐢熸垚缁撴灉
+ */
+@Data
+public class DataGenerateResult {
+
+ /** 鐢熸垚鐘舵��: SUCCESS / PARTIAL / FAILED */
+ private String status;
+
+ /** 鎬昏鐢熸垚鏉℃暟 */
+ private int totalGenerated;
+
+ /** 鍚勬ā鍧楃敓鎴愭憳瑕� */
+ private List<ModuleSummary> moduleSummaries = new ArrayList<>();
+
+ /** 閿欒淇℃伅锛堝鏈夛級 */
+ private List<String> errors = new ArrayList<>();
+
+ /** 鍩虹鏁版嵁妫�娴嬬粨鏋滐紙鍓嶇疆鏍¢獙鏈�氳繃鏃惰繑鍥烇級 */
+ private DataCheckResult checkResult;
+
+ @Data
+ public static class ModuleSummary {
+ private String module;
+ private String entityName;
+ private int generatedCount;
+ private int successCount;
+ private int failCount;
+ }
+}
diff --git a/src/main/java/com/ruoyi/oA/controller/OaProjectController.java b/src/main/java/com/ruoyi/oA/controller/OaProjectController.java
deleted file mode 100644
index b7ecc7a..0000000
--- a/src/main/java/com/ruoyi/oA/controller/OaProjectController.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.ruoyi.oA.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.oA.dto.OaProjectDto;
-import com.ruoyi.oA.pojo.OaProject;
-import com.ruoyi.oA.service.OaProjectService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.List;
-
-@Tag(name = "oA椤圭洰绠$悊")
-@RestController
-@AllArgsConstructor
-@RequestMapping("/oA/project")
-public class OaProjectController {
- private final OaProjectService oaProjectService;
-
- @Operation(summary = "鑾峰彇椤圭洰鍒楄〃")
- @GetMapping("/listPage")
- public AjaxResult listPage(Page page, OaProjectDto oaProjectDto) {
- IPage<OaProjectDto> listPage = oaProjectService.listPage(page, oaProjectDto);
- return AjaxResult.success(listPage);
- }
- @Operation(summary = "鑾峰彇椤圭洰鍒楄〃璇︽儏")
- @GetMapping("/getList")
- public AjaxResult getList(Page page, OaProjectDto oaProjectDto) {
- IPage<OaProjectDto> listPage = oaProjectService.listPage(page, oaProjectDto);
- HashMap<Object, Object> Map = new HashMap<>();
- listPage.getRecords().forEach(item -> {
- Map.put(item.getProjectId(), item);
- });
- return AjaxResult.success(Map);
- }
- @Operation(summary = "澧炴坊椤圭洰")
- @PostMapping("/add")
- public AjaxResult add(@RequestBody OaProject oaProject) {
- boolean save = oaProjectService.save(oaProject);
- return AjaxResult.success(save);
- }
- @Operation(summary = "鍒犻櫎椤圭洰")
- @DeleteMapping("/delete/{id}")
- public AjaxResult delete(@PathVariable Long id) {
- boolean remove = oaProjectService.deleteById(id);
- return AjaxResult.success(remove);
- }
- @Operation(summary = "鏇存柊椤圭洰")
- @PostMapping("/update")
- public AjaxResult update(@RequestBody OaProject oaProject) {
- boolean update = oaProjectService.updateById(oaProject);
- return AjaxResult.success(update);
- }
-// @Operation(summary = "鏍规嵁ID鑾峰彇椤圭洰璇︽儏")
-// @GetMapping("/getById")
-// public AjaxResult getById(Long id) {
-// OaProject oaProject = oaProjectService.getById(id);
-// return AjaxResult.success(oaProject);
-// }
- @Operation(summary = "瀵煎嚭鎵�閫夐」鐩�")
- @PostMapping("/export/{ids}")
- public void export(HttpServletResponse response, @PathVariable("ids") List<Long> ids) {
- if (CollectionUtils.isEmpty(ids)) {
- throw new IllegalArgumentException("瀵煎嚭椤圭洰鍒楄〃涓嶈兘涓虹┖");
- }
- oaProjectService.export(response, ids);
- }
-
-}
diff --git a/src/main/java/com/ruoyi/oA/controller/OaProjectPhaseController.java b/src/main/java/com/ruoyi/oA/controller/OaProjectPhaseController.java
deleted file mode 100644
index a4a05bb..0000000
--- a/src/main/java/com/ruoyi/oA/controller/OaProjectPhaseController.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.ruoyi.oA.controller;
-
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.oA.pojo.OaProjectPhase;
-import com.ruoyi.oA.service.OaProjectPhaseService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-@Tag(name = "oA椤圭洰闃舵绠$悊")
-@RestController
-@RequestMapping("/oA/projectPhase")
-@AllArgsConstructor
-public class OaProjectPhaseController {
- private final OaProjectPhaseService oaProjectPhaseService;
-
- @Operation(summary = "鏂板椤圭洰闃舵")
- @PostMapping("/add")
- public AjaxResult add(@RequestBody OaProjectPhase oaProjectPhase) {
- return AjaxResult.success(oaProjectPhaseService.save(oaProjectPhase));
- }
-
- @Operation(summary = "鍒犻櫎椤圭洰闃舵")
- @DeleteMapping("/delete/{phaseId}")
- public AjaxResult delete(@PathVariable Integer phaseId) {
- return AjaxResult.success(oaProjectPhaseService.deleteById(phaseId));
- }
-
- @Operation(summary = "鏇存柊椤圭洰闃舵")
- @PostMapping("/update")
- public AjaxResult update(@RequestBody OaProjectPhase oaProjectPhase) {
- return AjaxResult.success(oaProjectPhaseService.updateById(oaProjectPhase));
- }
-
- @Operation(summary = "鏍规嵁椤圭洰id鏌ヨ椤圭洰闃舵鍒楄〃")
- @GetMapping("/listByProjectId/{projectId}")
- public AjaxResult listByProjectId(@PathVariable Integer projectId) {
- return AjaxResult.success(oaProjectPhaseService.listByProjectId(projectId));
- }
-}
diff --git a/src/main/java/com/ruoyi/oA/controller/OaProjectPhaseTaskController.java b/src/main/java/com/ruoyi/oA/controller/OaProjectPhaseTaskController.java
deleted file mode 100644
index 91a846e..0000000
--- a/src/main/java/com/ruoyi/oA/controller/OaProjectPhaseTaskController.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.ruoyi.oA.controller;
-
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.oA.pojo.OaProjectPhaseTask;
-import com.ruoyi.oA.service.OaProjectPhaseTaskService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-@Tag(name = "oA椤圭洰闃舵浠诲姟绠$悊")
-@RestController
-@RequestMapping("/oA/projectPhaseTask")
-@AllArgsConstructor
-public class OaProjectPhaseTaskController {
- private final OaProjectPhaseTaskService oaProjectPhaseTaskService;
-
- @Operation(summary = "鏂板椤圭洰闃舵浠诲姟")
- @PostMapping("/add")
- public AjaxResult add(@RequestBody OaProjectPhaseTask oaProjectPhaseTask) {
- return AjaxResult.success(oaProjectPhaseTaskService.save(oaProjectPhaseTask));
- }
-
- @Operation(summary = "鏍规嵁椤圭洰闃舵id鏌ヨ椤圭洰闃舵浠诲姟鍒楄〃")
- @GetMapping("/listByPhaseId/{phaseId}")
- public AjaxResult listByPhaseId(@PathVariable Integer phaseId) {
- return AjaxResult.success(oaProjectPhaseTaskService.listByPhaseId(phaseId));
- }
-
- @Operation(summary = "鍒犻櫎椤圭洰闃舵浠诲姟")
- @DeleteMapping("/delete/{taskId}")
- public AjaxResult delete(@PathVariable Integer taskId) {
- return AjaxResult.success(oaProjectPhaseTaskService.removeById(taskId));
- }
-
- @Operation(summary = "鏇存柊椤圭洰闃舵浠诲姟")
- @PostMapping("/update")
- public AjaxResult update(@RequestBody OaProjectPhaseTask oaProjectPhaseTask) {
- return AjaxResult.success(oaProjectPhaseTaskService.updateById(oaProjectPhaseTask));
- }
-}
diff --git a/src/main/java/com/ruoyi/oA/dto/OaProjectDto.java b/src/main/java/com/ruoyi/oA/dto/OaProjectDto.java
deleted file mode 100644
index 0f90faf..0000000
--- a/src/main/java/com/ruoyi/oA/dto/OaProjectDto.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.ruoyi.oA.dto;
-
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import com.ruoyi.oA.pojo.OaProject;
-import com.ruoyi.oA.pojo.OaProjectPhase;
-import com.ruoyi.oA.pojo.OaProjectPhaseTask;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class OaProjectDto extends OaProject {
- /**
- * 璐熻矗浜哄悕绉�
- */
- @Excel(name = "璐熻矗浜哄悕绉�")
- private String managerName;
- /**
- * 椤圭洰闃舵鍒楄〃
- */
- private List<OaProjectPhaseDto> oaProjectPhasesDto;
-// /**
-// * 椤圭洰闃舵浠诲姟鍒楄〃
-// */
-// private List<OaProjectPhaseTask> oaProjectPhaseTasks;
-}
diff --git a/src/main/java/com/ruoyi/oA/dto/OaProjectPhaseDto.java b/src/main/java/com/ruoyi/oA/dto/OaProjectPhaseDto.java
deleted file mode 100644
index 4ef163e..0000000
--- a/src/main/java/com/ruoyi/oA/dto/OaProjectPhaseDto.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ruoyi.oA.dto;
-
-import com.ruoyi.oA.pojo.OaProjectPhase;
-import com.ruoyi.oA.pojo.OaProjectPhaseTask;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class OaProjectPhaseDto extends OaProjectPhase {
- private List<OaProjectPhaseTask> oaProjectPhaseTasks;
-}
diff --git a/src/main/java/com/ruoyi/oA/mapper/OaProjectMapper.java b/src/main/java/com/ruoyi/oA/mapper/OaProjectMapper.java
deleted file mode 100644
index 2114cef..0000000
--- a/src/main/java/com/ruoyi/oA/mapper/OaProjectMapper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.ruoyi.oA.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.oA.dto.OaProjectDto;
-import com.ruoyi.oA.pojo.OaProject;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project(OA绯荤粺-椤圭洰浠诲姟鍗忓悓-椤圭洰琛�)銆戠殑鏁版嵁搴撴搷浣淢apper
-* @createDate 2025-09-24 09:18:46
-* @Entity com.ruoyi.oA.pojo.OaProject
-*/
-public interface OaProjectMapper extends BaseMapper<OaProject> {
-
- IPage<OaProjectDto> listPage(Page page,@Param("req") OaProjectDto oaProjectDto);
-
- List<OaProjectDto> selectByIds(List<Long> ids);
-}
-
-
-
-
diff --git a/src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseMapper.java b/src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseMapper.java
deleted file mode 100644
index 41f6ab0..0000000
--- a/src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.oA.mapper;
-
-import com.ruoyi.oA.pojo.OaProjectPhase;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project_phase(OA绯荤粺-椤圭洰闃舵琛�)銆戠殑鏁版嵁搴撴搷浣淢apper
-* @createDate 2025-09-24 09:18:46
-* @Entity com.ruoyi.oA.pojo.OaProjectPhase
-*/
-public interface OaProjectPhaseMapper extends BaseMapper<OaProjectPhase> {
-
-}
-
-
-
-
diff --git a/src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseTaskMapper.java b/src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseTaskMapper.java
deleted file mode 100644
index b357c76..0000000
--- a/src/main/java/com/ruoyi/oA/mapper/OaProjectPhaseTaskMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.oA.mapper;
-
-import com.ruoyi.oA.pojo.OaProjectPhaseTask;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project_phase_task(OA绯荤粺-椤圭洰闃舵-浠诲姟琛�)銆戠殑鏁版嵁搴撴搷浣淢apper
-* @createDate 2025-09-24 09:18:46
-* @Entity com.ruoyi.oA.pojo.OaProjectPhaseTask
-*/
-public interface OaProjectPhaseTaskMapper extends BaseMapper<OaProjectPhaseTask> {
-
-}
-
-
-
-
diff --git a/src/main/java/com/ruoyi/oA/pojo/OaProject.java b/src/main/java/com/ruoyi/oA/pojo/OaProject.java
deleted file mode 100644
index 4a5af5b..0000000
--- a/src/main/java/com/ruoyi/oA/pojo/OaProject.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.ruoyi.oA.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-/**
- * OA绯荤粺-椤圭洰浠诲姟鍗忓悓-椤圭洰琛�
- * @TableName oa_project
- */
-@TableName(value ="oa_project")
-@Data
-public class OaProject implements Serializable {
- /**
- *
- */
- @TableId(type = IdType.AUTO)
- private Integer projectId;
-
- /**
- * 椤圭洰鍚嶇О
- */
- @Excel(name = "椤圭洰鍚嶇О")
- private String projectName;
-
- /**
- * 椤圭洰鎻忚堪
- */
- @Excel(name = "椤圭洰鎻忚堪")
- private String description;
-
- /**
- * 寮�濮嬫椂闂�
- */
- @Excel(name = "寮�濮嬫椂闂�")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate startDate;
-
- /**
- * 缁撴潫鏃堕棿
- */
- @Excel(name = "缁撴潫鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate endDate;
-
- /**
- * 鐘舵��
- */
- @Excel(name = "鐘舵��")
- private String status;
-
- /**
- * 瀹屾垚搴�
- */
- @Excel(name = "瀹屾垚搴�")
- private Integer completionRate;
-
- /**
- * 璐熻矗浜篿d
- */
- private Long managerId;
-
- /**
- * 鍒涘缓鐢ㄦ埛
- */
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- /**
- * 鍒涘缓鏃堕棿
- */
- @TableField(fill = FieldFill.INSERT)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime createTime;
-
- /**
- * 淇敼鐢ㄦ埛
- */
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- /**
- * 淇敼鏃堕棿
- */
- @TableField(fill = FieldFill.INSERT_UPDATE)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime updateTime;
-
- /**
- * 绉熸埛ID
- */
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/oA/pojo/OaProjectPhase.java b/src/main/java/com/ruoyi/oA/pojo/OaProjectPhase.java
deleted file mode 100644
index b26bb9d..0000000
--- a/src/main/java/com/ruoyi/oA/pojo/OaProjectPhase.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.ruoyi.oA.pojo;
-
-
-import com.baomidou.mybatisplus.annotation.*;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.Date;
-
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-/**
- * OA绯荤粺-椤圭洰闃舵琛�
- * @TableName oa_project_phase
- */
-@TableName(value ="oa_project_phase")
-@Data
-public class OaProjectPhase implements Serializable {
- /**
- *
- */
- @TableId(type = IdType.AUTO)
- private Integer phaseId;
-
- /**
- * 椤圭洰闃舵鍚嶇О
- */
- private String phaseName;
-
- /**
- * oa_project琛╥d
- */
- private Integer oaProjectId;
-
- /**
- * 寮�濮嬫椂闂�
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate startDate;
-
- /**
- * 缁撴潫鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate endDate;
-
- /**
- * 鐘舵��
- */
- private String status;
-
- /**
- * 鍒涘缓鐢ㄦ埛
- */
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- /**
- * 鍒涘缓鏃堕棿
- */
- @TableField(fill = FieldFill.INSERT)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime createTime;
-
- /**
- * 淇敼鐢ㄦ埛
- */
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- /**
- * 淇敼鏃堕棿
- */
- @TableField(fill = FieldFill.INSERT_UPDATE)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime updateTime;
-
- /**
- * 绉熸埛ID
- */
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/oA/pojo/OaProjectPhaseTask.java b/src/main/java/com/ruoyi/oA/pojo/OaProjectPhaseTask.java
deleted file mode 100644
index 1b81069..0000000
--- a/src/main/java/com/ruoyi/oA/pojo/OaProjectPhaseTask.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package com.ruoyi.oA.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-/**
- * OA绯荤粺-椤圭洰闃舵-浠诲姟琛�
- * @TableName oa_project_phase_task
- */
-@TableName(value ="oa_project_phase_task")
-@Data
-public class OaProjectPhaseTask implements Serializable {
- /**
- *
- */
- @TableId(type = IdType.AUTO)
- private Integer taskId;
-
- /**
- * 椤圭洰闃舵浠诲姟鍚嶇О
- */
- private String taskName;
-
- /**
- * oa_project_phase琛╥d
- */
- private Integer phaseId;
-
- /**
- * 寮�濮嬫椂闂�
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate startDate;
-
- /**
- * 缁撴潫鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate endDate;
-
- /**
- * 鐩爣浠诲姟瀹屾垚鏃ユ湡
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate targetDate;
-
- /**
- * 鐩爣鍊�
- */
- private Integer targetValue;
-
- /**
- * 褰撳墠鍊�
- */
- private Integer currentValue;
-
- /**
- * 鍗曚綅
- */
- private String unit;
-
- /**
- * 鐘舵��
- */
- private String status;
-
- /**
- * 瀹屾垚搴�
- */
- private Integer completionRate;
-
- /**
- * 鍒涘缓鐢ㄦ埛
- */
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- /**
- * 鍒涘缓鏃堕棿
- */
- @TableField(fill = FieldFill.INSERT)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime createTime;
-
- /**
- * 淇敼鐢ㄦ埛
- */
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- /**
- * 淇敼鏃堕棿
- */
- @TableField(fill = FieldFill.INSERT_UPDATE)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private LocalDateTime updateTime;
-
- /**
- * 绉熸埛ID
- */
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/oA/service/OaProjectPhaseService.java b/src/main/java/com/ruoyi/oA/service/OaProjectPhaseService.java
deleted file mode 100644
index 7914080..0000000
--- a/src/main/java/com/ruoyi/oA/service/OaProjectPhaseService.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.ruoyi.oA.service;
-
-import com.ruoyi.oA.dto.OaProjectPhaseDto;
-import com.ruoyi.oA.pojo.OaProjectPhase;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
-import java.util.List;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project_phase(OA绯荤粺-椤圭洰闃舵琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice
-* @createDate 2025-09-24 09:18:46
-*/
-public interface OaProjectPhaseService extends IService<OaProjectPhase> {
-
- List<OaProjectPhaseDto> listByProjectId(Integer oaProjectId);
-
- boolean deleteById(Integer phaseId);
-}
diff --git a/src/main/java/com/ruoyi/oA/service/OaProjectPhaseTaskService.java b/src/main/java/com/ruoyi/oA/service/OaProjectPhaseTaskService.java
deleted file mode 100644
index 225d12e..0000000
--- a/src/main/java/com/ruoyi/oA/service/OaProjectPhaseTaskService.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.ruoyi.oA.service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.oA.pojo.OaProjectPhaseTask;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project_phase_task(OA绯荤粺-椤圭洰闃舵-浠诲姟琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice
-* @createDate 2025-09-24 09:18:46
-*/
-public interface OaProjectPhaseTaskService extends IService<OaProjectPhaseTask> {
-
- List<OaProjectPhaseTask> listByPhaseId(Integer phaseId);
-}
diff --git a/src/main/java/com/ruoyi/oA/service/OaProjectService.java b/src/main/java/com/ruoyi/oA/service/OaProjectService.java
deleted file mode 100644
index 9f8e474..0000000
--- a/src/main/java/com/ruoyi/oA/service/OaProjectService.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.ruoyi.oA.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.oA.dto.OaProjectDto;
-import com.ruoyi.oA.pojo.OaProject;
-import jakarta.servlet.http.HttpServletResponse;
-
-import java.util.List;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project(OA绯荤粺-椤圭洰浠诲姟鍗忓悓-椤圭洰琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice
-* @createDate 2025-09-24 09:18:46
-*/
-public interface OaProjectService extends IService<OaProject> {
-
- IPage<OaProjectDto> listPage(Page page, OaProjectDto oaProjectDto);
-
- void export(HttpServletResponse response, List<Long> ids);
-
- boolean deleteById(Long id);
-}
diff --git a/src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseServiceImpl.java b/src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseServiceImpl.java
deleted file mode 100644
index 640ec42..0000000
--- a/src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseServiceImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.ruoyi.oA.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.oA.dto.OaProjectPhaseDto;
-import com.ruoyi.oA.mapper.OaProjectPhaseMapper;
-import com.ruoyi.oA.pojo.OaProjectPhase;
-import com.ruoyi.oA.pojo.OaProjectPhaseTask;
-import com.ruoyi.oA.service.OaProjectPhaseService;
-import com.ruoyi.oA.service.OaProjectPhaseTaskService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project_phase(OA绯荤粺-椤圭洰闃舵琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
-* @createDate 2025-09-24 09:18:46
-*/
-@Service
-@RequiredArgsConstructor
-@Transactional(rollbackFor = Exception.class)
-public class OaProjectPhaseServiceImpl extends ServiceImpl<OaProjectPhaseMapper, OaProjectPhase>
- implements OaProjectPhaseService{
- private final OaProjectPhaseMapper oaProjectPhaseMapper;
- private final OaProjectPhaseTaskService oaProjectPhaseTaskService;
-
- @Override
- public List<OaProjectPhaseDto> listByProjectId(Integer oaProjectId) {
- List<OaProjectPhase> oaProjectPhases = oaProjectPhaseMapper.selectList(new LambdaQueryWrapper<OaProjectPhase>()
- .eq(OaProjectPhase::getOaProjectId, oaProjectId));
- List<OaProjectPhaseDto> collect = oaProjectPhases.stream().map(oaProjectPhase -> {
- OaProjectPhaseDto oaProjectPhaseDto = new OaProjectPhaseDto();
- BeanUtils.copyProperties(oaProjectPhase, oaProjectPhaseDto);
-// List<OaProjectPhaseTask> oaProjectPhaseTasks = oaProjectPhaseTaskService.listByPhaseId(oaProjectPhaseDto.getPhaseId());
- oaProjectPhaseDto.setOaProjectPhaseTasks(oaProjectPhaseTaskService.listByPhaseId(oaProjectPhaseDto.getPhaseId()));
- return oaProjectPhaseDto;
- }).collect(Collectors.toList());
- return collect;
- }
-
- @Override
- public boolean deleteById(Integer phaseId) {
- // 鍏堝垹闄ら」鐩樁娈典笅鐨勪换鍔�
- oaProjectPhaseTaskService.remove(new LambdaQueryWrapper<OaProjectPhaseTask>()
- .eq(OaProjectPhaseTask::getPhaseId, phaseId));
- return oaProjectPhaseMapper.deleteById(phaseId) > 0;
- }
-}
-
-
-
-
diff --git a/src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseTaskServiceImpl.java b/src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseTaskServiceImpl.java
deleted file mode 100644
index 625e8d8..0000000
--- a/src/main/java/com/ruoyi/oA/service/impl/OaProjectPhaseTaskServiceImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.ruoyi.oA.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.oA.pojo.OaProjectPhaseTask;
-import com.ruoyi.oA.service.OaProjectPhaseTaskService;
-import com.ruoyi.oA.mapper.OaProjectPhaseTaskMapper;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project_phase_task(OA绯荤粺-椤圭洰闃舵-浠诲姟琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
-* @createDate 2025-09-24 09:18:46
-*/
-@Service
-public class OaProjectPhaseTaskServiceImpl extends ServiceImpl<OaProjectPhaseTaskMapper, OaProjectPhaseTask>
- implements OaProjectPhaseTaskService{
-
-
- @Override
- public List<OaProjectPhaseTask> listByPhaseId(Integer phaseId) {
- return baseMapper.selectList(new LambdaQueryWrapper<OaProjectPhaseTask>()
- .eq(OaProjectPhaseTask::getPhaseId, phaseId));
- }
-}
-
-
-
-
diff --git a/src/main/java/com/ruoyi/oA/service/impl/OaProjectServiceImpl.java b/src/main/java/com/ruoyi/oA/service/impl/OaProjectServiceImpl.java
deleted file mode 100644
index afe125a..0000000
--- a/src/main/java/com/ruoyi/oA/service/impl/OaProjectServiceImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.ruoyi.oA.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.oA.dto.OaProjectDto;
-import com.ruoyi.oA.mapper.OaProjectMapper;
-import com.ruoyi.oA.pojo.OaProject;
-import com.ruoyi.oA.pojo.OaProjectPhase;
-import com.ruoyi.oA.service.OaProjectPhaseService;
-import com.ruoyi.oA.service.OaProjectService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
-* @author ywx
-* @description 閽堝琛ㄣ�恛a_project(OA绯荤粺-椤圭洰浠诲姟鍗忓悓-椤圭洰琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
-* @createDate 2025-09-24 09:18:45
-*/
-@Service
-@Transactional(rollbackFor = Exception.class)
-@RequiredArgsConstructor
-public class OaProjectServiceImpl extends ServiceImpl<OaProjectMapper, OaProject>
- implements OaProjectService{
- private final OaProjectMapper oaProjectMapper;
- private final OaProjectPhaseService oaProjectPhaseService;
-
- @Override
- public IPage<OaProjectDto> listPage(Page page, OaProjectDto oaProjectDto) {
- IPage<OaProjectDto> iPage = oaProjectMapper.listPage(page, oaProjectDto);
- // 椤圭洰闃舵鍒楄〃
- for (OaProjectDto projectDto : iPage.getRecords()) {
- projectDto.setOaProjectPhasesDto(oaProjectPhaseService.listByProjectId(projectDto.getProjectId()));
- }
- return iPage;
- }
-
- @Override
- public void export(HttpServletResponse response, List<Long> ids) {
- List<OaProjectDto> list = oaProjectMapper.selectByIds(ids);
- ExcelUtil<OaProjectDto> util = new ExcelUtil<OaProjectDto>(OaProjectDto.class);
- util.exportExcel(response, list , "椤圭洰鏁版嵁");
- }
-
- @Override
- public boolean deleteById(Long id) {
- // 鍏堝垹闄ら」鐩笅鐨勯樁娈�
- List<OaProjectPhase> oaProjectPhases = oaProjectPhaseService.list(new LambdaQueryWrapper<OaProjectPhase>()
- .eq(OaProjectPhase::getOaProjectId, id));
- if (!oaProjectPhases.isEmpty()) {
- oaProjectPhases.forEach(oaProjectPhase -> {
- oaProjectPhaseService.deleteById(oaProjectPhase.getPhaseId());
- });
- }
- return oaProjectMapper.deleteById(id) > 0;
- }
-}
-
-
-
-
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/Details.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/Details.java
new file mode 100644
index 0000000..ba226d1
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/Details.java
@@ -0,0 +1,20 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author :yys
+ * @date : 2025/7/7 16:17
+ */
+@Data
+public class Details {
+ private Integer id; // 鍙拌处浜у搧id
+ private BigDecimal inboundQuantity; // 鍏ュ簱鏁伴噺
+ private BigDecimal warnNum; // 棰勮鏁伴噺锛堥噰璐叆搴撴墠鏈夛級
+ //鍗曚环
+ private BigDecimal unitPrice;
+ private BigDecimal totalPrice;
+ private Long productModelId; // 鍩虹浜у搧id
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/InventoryInformationDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/InventoryInformationDto.java
new file mode 100644
index 0000000..b45b5b9
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/InventoryInformationDto.java
@@ -0,0 +1,28 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 瀛樿揣鏍哥畻淇℃伅Dto-璧勪骇鎶ヨ〃
+ */
+@Data
+public class InventoryInformationDto {
+ /**
+ * 鎬诲簱瀛樻暟閲�
+ */
+ private Integer totalInventoryCount;
+ /**
+ * 鎬诲簱瀛橀噾棰�
+ */
+ private BigDecimal totalInventoryValue;
+ /**
+ * 搴撳瓨鍙樺姩鏁伴噺
+ */
+ private Integer inventoryChangeCount;
+ /**
+ * 搴撳瓨鍙樺姩閲戦
+ */
+ private BigDecimal inventoryChangeValue;
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementAddDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementAddDto.java
new file mode 100644
index 0000000..e231348
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementAddDto.java
@@ -0,0 +1,27 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author :yys
+ * @date : 2025/7/7 16:07
+ */
+@Data
+public class ProcurementAddDto {
+
+ private List<Details> details;
+
+ private String nickName;
+
+ /**
+ * 鍏ュ簱绫诲瀷 1-閲囪喘 2-鐢熶骇 3-鑷畾涔�
+ */
+ private Integer type;
+
+ private String typeName;
+ private Integer purchaseLedgerId;
+ private Long qualityInspectId;
+
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementDto.java
new file mode 100644
index 0000000..aa88d45
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementDto.java
@@ -0,0 +1,96 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @author :yys
+ * @date : 2025/7/7 14:46
+ */
+@Data
+public class ProcurementDto {
+
+ private String purchaseContractNumber;
+
+ private Integer id;
+
+ private Integer recordId;
+
+ private BigDecimal warnNum;
+
+ /**
+ * 鍏ュ簱鏁伴噺
+ */
+ private Integer quantityStock;
+
+ /**
+ * 渚涘簲鍟嗗悕绉�
+ */
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+
+ /**
+ * 浜у搧澶х被
+ */
+ @Excel(name = "浜у搧澶х被")
+ private String productCategory;
+
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ @Excel(name = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ /**
+ * 鍗曚綅
+ */
+ @Excel(name = "鍗曚綅")
+ private String unit;
+
+ /**
+ * 鏁伴噺
+ */
+ @Excel(name = "鏁伴噺")
+ private BigDecimal quantity;
+
+ /**
+ * 鏈�浣庡簱瀛樻暟閲�
+ */
+ @Excel(name = "鏈�浣庡簱瀛樻暟閲�")
+ private BigDecimal minStock;
+ /**
+ * 寰呭叆搴撴暟閲�
+ */
+ @Excel(name = "寰呭叆搴撴暟閲�")
+ private BigDecimal quantity0;
+
+ /**
+ * 绋庣巼
+ */
+ @Excel(name = "绋庣巼")
+ private BigDecimal taxRate;
+
+ /**
+ * 鍚◣鍗曚环
+ */
+ @Excel(name = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ /**
+ * 鍚◣鎬讳环
+ */
+ @Excel(name = "鍚◣鎬讳环")
+ private BigDecimal taxInclusiveTotalPrice;
+
+ /**
+ * 涓嶅惈绋庢�讳环
+ */
+ @Excel(name = "涓嶅惈绋庢�讳环")
+ private BigDecimal taxExclusiveTotalPrice;
+
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementManagementUpdateDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementManagementUpdateDto.java
new file mode 100644
index 0000000..f9fc9ff
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementManagementUpdateDto.java
@@ -0,0 +1,44 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @author :yys
+ * @date : 2025/7/9 9:41
+ */
+@Data
+public class ProcurementManagementUpdateDto {
+
+ private String createBy;
+ private BigDecimal minStock;
+
+
+ /**
+ * 鍗曚环
+ */
+ private BigDecimal unitPrice;
+
+ /**
+ * 鎬讳环
+ */
+ private BigDecimal totalPrice;
+
+ // 鍗曚环
+ private BigDecimal taxInclusiveUnitPrice;
+ // 鎬讳环
+ private BigDecimal taxInclusiveTotalPrice;
+
+ private Long createUser;
+
+ private String createTime;
+
+ private String entryDate;
+
+ private Integer id;
+ private Integer salesLedgerProductId;
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDto.java
new file mode 100644
index 0000000..fa3e337
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDto.java
@@ -0,0 +1,197 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * @author :yys
+ * @date : 2025/7/7 17:00
+ */
+@Data
+public class ProcurementPageDto {
+
+ private Integer id;
+
+ private Long createUser;
+
+ /**
+ * 鍏ュ簱绫诲瀷 1-閲囪喘 2-鐢熶骇
+ */
+ private Integer type;
+
+ /**
+ * 鍏ュ簱鎵规
+ */
+ @Excel(name = "鍏ュ簱鎵规")
+ private String inboundBatches;
+
+ /**
+ * 閲囪喘鍚堝悓鍙�
+ */
+ private String purchaseContractNumber;
+
+ /**
+ * 閿�鍞悎鍚屽彿
+ */
+ private String salesContractNo;
+
+ /**
+ * 瀹㈡埛鍚堝悓鍙�
+ */
+ private String customerContractNo;
+
+ /**
+ * 瀹㈡埛鍚嶇О
+ */
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ private Long salesLedgerProductId;
+
+ /**
+ * 鍑哄叆搴撴暟閲�
+ */
+ @Excel(name = "鍏ュ簱鏁伴噺")
+ private BigDecimal inboundNum;
+
+ /**
+ * 鍏ュ簱鍗曚环
+ */
+ @Schema(description = "鍏ュ簱鍗曚环")
+ @Excel(name = "鍏ュ簱鍗曚环")
+ private BigDecimal unitPrice;
+
+ /**
+ * 鍏ュ簱鎬讳环
+ */
+ @Schema(description = "鍏ュ簱鎬讳环")
+ @Excel(name = "鍏ュ簱鎬讳环")
+ private BigDecimal totalPrice;
+
+ @Excel(name = "棰勮鏁伴噺")
+ private BigDecimal warnNum;
+
+ /**
+ * 寰呭嚭搴撴暟閲�
+ */
+// @Excel(name = "寰呭嚭搴撴暟閲�")
+ private BigDecimal inboundNum0;
+
+
+ /**
+ * 鍑哄叆搴撴椂闂�
+ */
+// @Excel(name = "鍏ュ簱鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ private String timeStr;
+
+ /**
+ * 鍑哄叆搴撴椂闂�
+ */
+ @Excel(name = "鍏ュ簱鏃堕棿")
+ private String time;
+
+
+ /**
+ * 鍑哄叆搴撶敤鎴�
+ */
+ @Excel(name = "鍏ュ簱浜�")
+ private String createBy;
+
+ /**
+ * 渚涘簲鍟嗗悕绉�
+ */
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+
+ /**
+ * 浜у搧澶х被
+ */
+ @Excel(name = "浜у搧澶х被")
+ private String productCategory;
+ /**
+ * 浜у搧id
+ */
+ @Excel(name = "浜у搧id")
+ private Long productId;
+
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ @Excel(name = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ /**
+ * 鍗曚綅
+ */
+ @Excel(name = "鍗曚綅")
+ private String unit;
+
+ /**
+ * 绋庣巼
+ */
+ @Excel(name = "绋庣巼(%)")
+ private BigDecimal taxRate;
+
+ /**
+ * 鍚◣鍗曚环
+ */
+ @Excel(name = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ /**
+ * 鍚◣鎬讳环
+ */
+ @Excel(name = "鍚◣鎬讳环")
+ private BigDecimal taxInclusiveTotalPrice;
+
+ /**
+ * 涓嶅惈绋庢�讳环
+ */
+ @Excel(name = "涓嶅惈绋庢�讳环")
+ private BigDecimal taxExclusiveTotalPrice;
+ /**
+ * 鎶ヨ〃鏃ユ姤
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate reportDate;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startMonth;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endMonth;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate startDate;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate endDate;
+
+ private Long productModelId;
+
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDtoCopy.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDtoCopy.java
new file mode 100644
index 0000000..8e89c2f
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementPageDtoCopy.java
@@ -0,0 +1,206 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * @author :yys
+ * @date : 2025/7/9 10:34
+ */
+@Data
+public class ProcurementPageDtoCopy {
+
+ private Integer id;
+
+ private Long createUser;
+
+ /**
+ * 鍏ュ簱鎵规
+ */
+ @Excel(name = "鍏ュ簱鎵规")
+ private String inboundBatches;
+
+ private BigDecimal warnNum;
+
+ /**
+ * 鍚堝悓鍙�
+ */
+ private String purchaseContractNumber;
+
+
+ /**
+ * 閿�鍞悎鍚屽彿
+ */
+ private String salesContractNo;
+
+ /**
+ * 瀹㈡埛鍚堝悓鍙�
+ */
+ private String customerContractNo;
+
+ /**
+ * 瀹㈡埛鍚嶇О
+ */
+ private String customerName;
+
+ private Long salesLedgerProductId;
+
+ /**
+ * 鍑哄叆搴撴暟閲�
+ */
+ @Excel(name = "鍏ュ簱鏁伴噺")
+ private BigDecimal inboundNum;
+
+ /**
+ * 鍏ュ簱鍗曚环
+ */
+ @Schema(description = "鍏ュ簱鍗曚环")
+ @Excel(name = "鍏ュ簱鍗曚环")
+ private BigDecimal unitPrice;
+
+ /**
+ * 鍏ュ簱鎬讳环
+ */
+ @Schema(description = "鍏ュ簱鎬讳环")
+ @Excel(name = "鍏ュ簱鎬讳环")
+ private BigDecimal totalPrice;
+
+ /**
+ * 寰呭嚭搴撴暟閲�
+ */
+ @Excel(name = "寰呭嚭搴撴暟閲�")
+ private BigDecimal inboundNum0;
+ /**
+ * 鍑哄簱鏁伴噺
+ */
+ @Excel(name = "鍑哄簱鏁伴噺")
+ private BigDecimal totalInboundNum = BigDecimal.ZERO;
+
+ /**
+ * 鏈�浣庡簱瀛樻暟閲�
+ */
+ @Excel(name = "鏈�浣庡簱瀛樻暟閲�")
+ private BigDecimal minStock;
+ /**
+ * 鍑哄叆搴撴椂闂�
+ */
+// @Excel(name = "鍏ュ簱鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 鍑哄叆搴撴椂闂�
+ */
+ @Excel(name = "鍏ュ簱鏃堕棿")
+ private String cTime;
+
+ /**
+ * 鍑哄叆搴撴椂闂�
+ */
+// @Excel(name = "搴撳瓨鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+
+ /**
+ * 鍑哄叆搴撴椂闂�
+ */
+ @Excel(name = "搴撳瓨鏃堕棿")
+ private String uTime;
+
+ /**
+ * 鍑哄叆搴撶敤鎴�
+ */
+ @Excel(name = "鍏ュ簱浜�")
+ private String createBy;
+
+ /**
+ * 渚涘簲鍟嗗悕绉�
+ */
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+
+ /**
+ * 浜у搧澶х被
+ */
+ @Excel(name = "浜у搧澶х被")
+ private String productCategory;
+ /**
+ * 浜у搧id
+ */
+ @Excel(name = "浜у搧id")
+ private Long productId;
+
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ @Excel(name = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ /**
+ * 鍗曚綅
+ */
+ @Excel(name = "鍗曚綅")
+ private String unit;
+
+ /**
+ * 绋庣巼
+ */
+ @Excel(name = "绋庣巼(%)")
+ private BigDecimal taxRate;
+
+ /**
+ * 鍚◣鍗曚环
+ */
+ @Excel(name = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ /**
+ * 鍚◣鎬讳环
+ */
+ @Excel(name = "鍚◣鎬讳环")
+ private BigDecimal taxInclusiveTotalPrice;
+
+ /**
+ * 涓嶅惈绋庢�讳环
+ */
+ @Excel(name = "涓嶅惈绋庢�讳环")
+ private BigDecimal taxExclusiveTotalPrice;
+ /**
+ * 鎶ヨ〃鏃ユ姤
+ */
+ @Excel(name = "鎶ヨ〃鏃ユ姤")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDate reportDate;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @Excel(name = "鎶ヨ〃鏈堟姤寮�濮嬫椂闂�")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDate startMonth;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @Excel(name = "鎶ヨ〃鏈堟姤缁撴潫鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDate endMonth;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @Excel(name = "鎶ヨ〃浣滀笟寮�濮嬫椂闂�")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDate startDate;
+ /**
+ * 鎶ヨ〃鏈堟姤
+ */
+ @Excel(name = "鎶ヨ〃浣滀笟缁撴潫鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDate endDate;
+
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutAdd.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutAdd.java
new file mode 100644
index 0000000..09272c4
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutAdd.java
@@ -0,0 +1,29 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import lombok.Data;
+
+/**
+ * @author :yys
+ * @date : 2025/7/8 13:34
+ */
+@Data
+public class ProcurementRecordOutAdd {
+
+ private String quantity;
+
+ private String time;
+
+ private Integer id;
+
+ private Integer userId;
+
+ private Long salesLedgerProductId;
+
+ /**
+ * 鍑哄簱绫诲瀷 1-閲囪喘鍑哄簱 2-閿�鍞嚭搴� 3-鑷畾涔�
+ */
+ private Integer type;
+
+ private Long productModelId;// 鍩虹浜у搧ID
+
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutPageDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutPageDto.java
new file mode 100644
index 0000000..a5dd8d6
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementRecordOutPageDto.java
@@ -0,0 +1,132 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * @author :yys
+ * @date : 2025/7/8 14:13
+ */
+@Data
+public class ProcurementRecordOutPageDto {
+
+ @Excel(name = "鍑哄簱缂栧彿")
+ private String code;
+
+ private Integer id;
+
+ private BigDecimal warnNum;
+ /**
+ * 閿�鍞悎鍚屽彿
+ */
+ private String salesContractNo;
+
+ /**
+ * 瀹㈡埛鍚堝悓鍙�
+ */
+ private String customerContractNo;
+
+ /**
+ * 瀹㈡埛鍚嶇О
+ */
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+
+ /**
+ * 鍑哄叆搴撴暟閲�
+ */
+ @Excel(name = "鍑哄簱鏁伴噺")
+ private BigDecimal inboundNum;
+
+ /**
+ * 鍗曚环
+ */
+ @Excel(name = "鍗曚环")
+ private BigDecimal unitPrice;
+
+ /**
+ * 鎬讳环
+ */
+ @Excel(name = "鎬讳环")
+ private BigDecimal totalPrice;
+
+ /**
+ * 鍑哄叆搴撴椂闂�
+ */
+// @Excel(name = "鍑哄簱鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ private String timeStr;
+
+ @Excel(name = "鍑哄簱鏃堕棿")
+ private String time;
+
+ /**
+ * 鍑哄叆搴撶敤鎴�
+ */
+ @Excel(name = "鍑哄簱浜�")
+ private String createBy;
+
+ /**
+ * 渚涘簲鍟嗗悕绉�
+ */
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+
+
+
+ /**
+ * 浜у搧澶х被
+ */
+ @Excel(name = "浜у搧澶х被")
+ private String productCategory;
+
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ @Excel(name = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ /**
+ * 鍗曚綅
+ */
+ @Excel(name = "鍗曚綅")
+ private String unit;
+
+ /**
+ * 绋庣巼
+ */
+ @Excel(name = "绋庣巼(%)")
+ private BigDecimal taxRate;
+
+ /**
+ * 鍚◣鍗曚环
+ */
+ @Excel(name = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ /**
+ * 鍚◣鎬讳环
+ */
+ @Excel(name = "鍚◣鎬讳环")
+ private BigDecimal taxInclusiveTotalPrice;
+
+ /**
+ * 涓嶅惈绋庢�讳环
+ */
+ @Excel(name = "涓嶅惈绋庢�讳环")
+ private BigDecimal taxExclusiveTotalPrice;
+
+ /**
+ * 鐗╁搧绫诲瀷
+ */
+ private String itemType;
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementUpdateDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementUpdateDto.java
new file mode 100644
index 0000000..cf9320d
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ProcurementUpdateDto.java
@@ -0,0 +1,32 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author :yys
+ * @date : 2025/7/8 10:40
+ */
+@Data
+public class ProcurementUpdateDto {
+
+ private Integer id;
+
+ private BigDecimal warnNum;
+
+ private BigDecimal quantityStock;
+
+ private BigDecimal unitPrice;
+
+ private BigDecimal totalPrice;
+
+ private List<Integer> ids;
+
+ /**
+ * 鍑哄簱绫诲瀷 1-閲囪喘 2-閿�鍞� 3-鑷畾涔�
+ */
+ private Integer type;
+
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnManagementDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnManagementDto.java
new file mode 100644
index 0000000..98eb5da
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnManagementDto.java
@@ -0,0 +1,54 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import com.ruoyi.procurementrecord.pojo.ReturnManagement;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author :yys
+ * @date : 2025/9/17 10:28
+ */
+@Data
+public class ReturnManagementDto extends ReturnManagement {
+
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "閿�鍞崟鍙�")
+ private String salesContractNo;
+
+ @Schema(description = "涓氬姟鍛�")
+ private String salesman;
+
+
+ @Schema(description = "鍏宠仈鍑哄簱鍗曞彿")
+ private String shippingNo;
+
+ @Schema(description = "鍙戣揣绫诲瀷")
+ private Integer shippingType;
+
+ @Schema(description = "鍙戣揣杞︾墝鍙�")
+ private String truckPlateNo;
+
+ @Schema(description = "蹇�掑叕鍙�")
+ private String expressCompany;
+
+ @Schema(description = "蹇�掑崟鍙�")
+ private String expressNo;
+
+ @Schema(description = "椤圭洰鍚嶇О")
+ private String projectName;
+
+ @Schema(description = "閿�鍞彴璐d")
+ private Long salesLedgerId;
+
+ @Schema(description = "閿�鍞骇鍝佸璞℃暟缁�")
+ private List<ReturnSaleProductDto> returnSaleProducts;
+
+ @Schema(description = "閿�鍞��璐у叆搴撳鎵圭姸鎬�")
+ private Integer stockInApprovalStatus;
+
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnSaleProductDto.java b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnSaleProductDto.java
new file mode 100644
index 0000000..b24ad14
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/dto/ReturnSaleProductDto.java
@@ -0,0 +1,41 @@
+package com.ruoyi.procurementrecord.bean.dto;
+
+import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ReturnSaleProductDto extends ReturnSaleProduct {
+
+ private String productName;
+
+ private String model;
+
+ private String unit;
+
+ //鏈��璐ф暟閲�
+ private BigDecimal unQuantity;
+
+ //鎬婚��璐ф暟閲�
+ private BigDecimal totalReturnNum;
+
+ // 閫�璐ф�讳环
+ private BigDecimal price;
+
+ // 閫�璐ф�讳环
+ private BigDecimal taxInclusiveUnitPrice;
+
+ @Schema(description = "鍑哄簱鍗曞彿")
+ private String outboundBatches;
+
+ @Schema(description = "鎵规鍙�")
+ private String batchNo;
+
+ @Schema(description = "鍙戣揣鍑哄簱鏁伴噺")
+ private BigDecimal stockOutNum;
+
+ @Schema(description = "寰呭鐞嗛��璐ф暟閲�")
+ private BigDecimal pendingReturnNum;
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingInfoVo.java b/src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingInfoVo.java
new file mode 100644
index 0000000..d442c63
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingInfoVo.java
@@ -0,0 +1,17 @@
+package com.ruoyi.procurementrecord.bean.vo;
+
+import com.ruoyi.sales.pojo.ShippingInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(name = "ShippingInfoVo", description = "钀ラ攢绠$悊--鍙戣揣淇℃伅")
+public class ShippingInfoVo {
+
+ private ShippingInfo shippingInfo;
+
+ @Schema(description = "鍙戣揣浜у搧鍒楄〃")
+ private List<ShippingProductVo> shippingProductVoList;
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingProductVo.java b/src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingProductVo.java
new file mode 100644
index 0000000..760d83f
--- /dev/null
+++ b/src/main/java/com/ruoyi/procurementrecord/bean/vo/ShippingProductVo.java
@@ -0,0 +1,46 @@
+package com.ruoyi.procurementrecord.bean.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@Schema(name = "ShippingProductVo", description = "钀ラ攢绠$悊--鍙戣揣鍑哄簱浜у搧鍒楄〃")
+public class ShippingProductVo {
+ @Schema(description = "鍑哄簱鍗昳d")
+ private Long id;
+
+ @Schema(description = "浜у搧瑙勬牸id")
+ private Long productModelId;
+
+ @Schema(description = "浜у搧澶х被")
+ private String productCategory;
+
+ @Schema(description = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ @Schema(description = "鍗曚綅")
+ private String unit;
+
+ @Schema(description = "鍑哄簱鍗曞彿")
+ private String outboundBatches;
+
+ @Schema(description = "鍙戣揣鍑哄簱鏁伴噺")
+ private BigDecimal stockOutNum;
+
+ @Schema(description = "鎵规鍙�")
+ private String batchNo;
+
+ @Schema(description = "鏈��璐ф暟")
+ private BigDecimal unQuantity;
+
+ @Schema(description = "閫�璐ф�绘暟")
+ private BigDecimal totalReturnNum;
+
+ @Schema(description = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ @Schema(description = "寰呭鐞嗛��璐ф暟閲�")
+ private BigDecimal pendingReturnNum;
+}
diff --git a/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementExceptionRecordController.java b/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementExceptionRecordController.java
index c594994..bb14493 100644
--- a/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementExceptionRecordController.java
+++ b/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementExceptionRecordController.java
@@ -1,24 +1,13 @@
package com.ruoyi.procurementrecord.controller;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.procurementrecord.dto.*;
import com.ruoyi.procurementrecord.mapper.ProcurementExceptionRecordMapper;
import com.ruoyi.procurementrecord.pojo.ProcurementExceptionRecord;
-import com.ruoyi.procurementrecord.service.ProcurementRecordService;
import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.List;
/**
* @author :yys
diff --git a/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java b/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java
index e567eea..7e49990 100644
--- a/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java
+++ b/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java
@@ -8,7 +8,7 @@
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.procurementrecord.dto.*;
+import com.ruoyi.procurementrecord.bean.dto.*;
import com.ruoyi.procurementrecord.mapper.CustomStorageMapper;
import com.ruoyi.procurementrecord.pojo.CustomStorage;
import com.ruoyi.procurementrecord.service.ProcurementRecordService;
@@ -16,7 +16,6 @@
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.apache.ibatis.annotations.Delete;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
diff --git a/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordOutController.java b/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordOutController.java
index f024bfe..c86d3e6 100644
--- a/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordOutController.java
+++ b/src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordOutController.java
@@ -7,9 +7,9 @@
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutAdd;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto;
-import com.ruoyi.procurementrecord.dto.ProcurementUpdateDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
import com.ruoyi.procurementrecord.service.ProcurementRecordOutService;
import io.swagger.v3.oas.annotations.tags.Tag;
diff --git a/src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java b/src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java
index 22882f4..6387006 100644
--- a/src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java
+++ b/src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java
@@ -3,22 +3,22 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.ruoyi.account.service.AccountStatementDetailsService;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
-import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
+import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto;
+import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.ruoyi.procurementrecord.service.ReturnManagementService;
import com.ruoyi.procurementrecord.service.ReturnSaleProductService;
-import com.ruoyi.procurementrecord.service.impl.ReturnSaleProductServiceImpl;
-import com.ruoyi.sales.dto.SalesLedgerDto;
-import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -36,6 +36,7 @@
private ReturnManagementService returnManagementService;
private ReturnSaleProductService returnSaleProductService;
+ private final AccountStatementDetailsService accountStatementDetailsService;
@GetMapping("/listPage")
@Operation(summary = "閿�鍞��璐�-鏌ヨ")
@@ -72,6 +73,14 @@
@Transactional(rollbackFor = Exception.class)
public AjaxResult del(@RequestBody List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) return error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ //濡傛灉璇ラ攢鍞��璐у凡缁忕敓鎴愬璐﹀崟鍒欐棤娉曞垹闄�
+ List<ReturnManagement> returnManagements = returnManagementService.listByIds(ids);
+ List<String> strings = returnManagements.stream().map(ReturnManagement::getReturnNo).toList();
+ List<AccountStatementDetails> accountStatementDetails = accountStatementDetailsService.list(Wrappers.<AccountStatementDetails>lambdaQuery()
+ .in(AccountStatementDetails::getReceiptNumber, strings));
+ if (CollectionUtils.isNotEmpty(accountStatementDetails)){
+ throw new ServiceException("璇ラ攢鍞��璐у崟宸茬粡鐢熸垚瀵硅处鍗曪紝鏃犳硶鍒犻櫎");
+ }
returnSaleProductService.remove(new QueryWrapper<ReturnSaleProduct>()
.lambda()
.in(ReturnSaleProduct::getReturnManagementId, ids));
@@ -87,10 +96,10 @@
}
@GetMapping("/getByShippingId")
- @Operation(summary = "閿�鍞��璐�-鏍规嵁鍑哄簱鍗曟煡璇㈤攢鍞鍗曚互鍙婁骇鍝佷俊鎭�")
+ @Operation(summary = "閿�鍞��璐�-鏍规嵁鍙戣揣鍗曟煡璇㈤攢鍞鍗曚互鍙婂嚭搴撶殑浜у搧淇℃伅")
public AjaxResult getByShippingId(Long shippingId) {
- SalesLedgerDto salesLedgerDto = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId);
- return success(salesLedgerDto);
+ ShippingInfoVo shippingInfoVo = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId);
+ return success(shippingInfoVo);
}
}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/Details.java b/src/main/java/com/ruoyi/procurementrecord/dto/Details.java
deleted file mode 100644
index 08dd6af..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/Details.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author :yys
- * @date : 2025/7/7 16:17
- */
-@Data
-public class Details {
- private Integer id; // 鍙拌处浜у搧id
- private BigDecimal inboundQuantity; // 鍏ュ簱鏁伴噺
- private BigDecimal warnNum; // 棰勮鏁伴噺锛堥噰璐叆搴撴墠鏈夛級
- //鍗曚环
- private BigDecimal unitPrice;
- private BigDecimal totalPrice;
- private Long productModelId; // 鍩虹浜у搧id
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/InventoryInformationDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/InventoryInformationDto.java
deleted file mode 100644
index 2396b29..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/InventoryInformationDto.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * 瀛樿揣鏍哥畻淇℃伅Dto-璧勪骇鎶ヨ〃
- */
-@Data
-public class InventoryInformationDto {
- /**
- * 鎬诲簱瀛樻暟閲�
- */
- private Integer totalInventoryCount;
- /**
- * 鎬诲簱瀛橀噾棰�
- */
- private BigDecimal totalInventoryValue;
- /**
- * 搴撳瓨鍙樺姩鏁伴噺
- */
- private Integer inventoryChangeCount;
- /**
- * 搴撳瓨鍙樺姩閲戦
- */
- private BigDecimal inventoryChangeValue;
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementAddDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementAddDto.java
deleted file mode 100644
index 6bb4e47..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementAddDto.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @author :yys
- * @date : 2025/7/7 16:07
- */
-@Data
-public class ProcurementAddDto {
-
- private List<Details> details;
-
- private String nickName;
-
- /**
- * 鍏ュ簱绫诲瀷 1-閲囪喘 2-鐢熶骇 3-鑷畾涔�
- */
- private Integer type;
-
- private String typeName;
- private Integer purchaseLedgerId;
- private Long qualityInspectId;
-
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementDto.java
deleted file mode 100644
index d8004b4..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementDto.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
-/**
- * @author :yys
- * @date : 2025/7/7 14:46
- */
-@Data
-public class ProcurementDto {
-
- private String purchaseContractNumber;
-
- private Integer id;
-
- private Integer recordId;
-
- private BigDecimal warnNum;
-
- /**
- * 鍏ュ簱鏁伴噺
- */
- private Integer quantityStock;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
-
- /**
- * 浜у搧澶х被
- */
- @Excel(name = "浜у搧澶х被")
- private String productCategory;
-
- /**
- * 瑙勬牸鍨嬪彿
- */
- @Excel(name = "瑙勬牸鍨嬪彿")
- private String specificationModel;
-
- /**
- * 鍗曚綅
- */
- @Excel(name = "鍗曚綅")
- private String unit;
-
- /**
- * 鏁伴噺
- */
- @Excel(name = "鏁伴噺")
- private BigDecimal quantity;
-
- /**
- * 鏈�浣庡簱瀛樻暟閲�
- */
- @Excel(name = "鏈�浣庡簱瀛樻暟閲�")
- private BigDecimal minStock;
- /**
- * 寰呭叆搴撴暟閲�
- */
- @Excel(name = "寰呭叆搴撴暟閲�")
- private BigDecimal quantity0;
-
- /**
- * 绋庣巼
- */
- @Excel(name = "绋庣巼")
- private BigDecimal taxRate;
-
- /**
- * 鍚◣鍗曚环
- */
- @Excel(name = "鍚◣鍗曚环")
- private BigDecimal taxInclusiveUnitPrice;
-
- /**
- * 鍚◣鎬讳环
- */
- @Excel(name = "鍚◣鎬讳环")
- private BigDecimal taxInclusiveTotalPrice;
-
- /**
- * 涓嶅惈绋庢�讳环
- */
- @Excel(name = "涓嶅惈绋庢�讳环")
- private BigDecimal taxExclusiveTotalPrice;
-
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementManagementUpdateDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementManagementUpdateDto.java
deleted file mode 100644
index ac896a2..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementManagementUpdateDto.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
-/**
- * @author :yys
- * @date : 2025/7/9 9:41
- */
-@Data
-public class ProcurementManagementUpdateDto {
-
- private String createBy;
- private BigDecimal minStock;
-
-
- /**
- * 鍗曚环
- */
- private BigDecimal unitPrice;
-
- /**
- * 鎬讳环
- */
- private BigDecimal totalPrice;
-
- // 鍗曚环
- private BigDecimal taxInclusiveUnitPrice;
- // 鎬讳环
- private BigDecimal taxInclusiveTotalPrice;
-
- private Long createUser;
-
- private String createTime;
-
- private String entryDate;
-
- private Integer id;
- private Integer salesLedgerProductId;
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDto.java
deleted file mode 100644
index 57c2dbb..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDto.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-
-/**
- * @author :yys
- * @date : 2025/7/7 17:00
- */
-@Data
-public class ProcurementPageDto {
-
- private Integer id;
-
- private Long createUser;
-
- /**
- * 鍏ュ簱绫诲瀷 1-閲囪喘 2-鐢熶骇
- */
- private Integer type;
-
- /**
- * 鍏ュ簱鎵规
- */
- @Excel(name = "鍏ュ簱鎵规")
- private String inboundBatches;
-
- /**
- * 閲囪喘鍚堝悓鍙�
- */
- private String purchaseContractNumber;
-
- /**
- * 閿�鍞悎鍚屽彿
- */
- private String salesContractNo;
-
- /**
- * 瀹㈡埛鍚堝悓鍙�
- */
- private String customerContractNo;
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- private Long salesLedgerProductId;
-
- /**
- * 鍑哄叆搴撴暟閲�
- */
- @Excel(name = "鍏ュ簱鏁伴噺")
- private BigDecimal inboundNum;
-
- /**
- * 鍏ュ簱鍗曚环
- */
- @Schema(description = "鍏ュ簱鍗曚环")
- @Excel(name = "鍏ュ簱鍗曚环")
- private BigDecimal unitPrice;
-
- /**
- * 鍏ュ簱鎬讳环
- */
- @Schema(description = "鍏ュ簱鎬讳环")
- @Excel(name = "鍏ュ簱鎬讳环")
- private BigDecimal totalPrice;
-
- @Excel(name = "棰勮鏁伴噺")
- private BigDecimal warnNum;
-
- /**
- * 寰呭嚭搴撴暟閲�
- */
-// @Excel(name = "寰呭嚭搴撴暟閲�")
- private BigDecimal inboundNum0;
-
-
- /**
- * 鍑哄叆搴撴椂闂�
- */
-// @Excel(name = "鍏ュ簱鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDateTime createTime;
-
- private String timeStr;
-
- /**
- * 鍑哄叆搴撴椂闂�
- */
- @Excel(name = "鍏ュ簱鏃堕棿")
- private String time;
-
-
- /**
- * 鍑哄叆搴撶敤鎴�
- */
- @Excel(name = "鍏ュ簱浜�")
- private String createBy;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
-
- /**
- * 浜у搧澶х被
- */
- @Excel(name = "浜у搧澶х被")
- private String productCategory;
- /**
- * 浜у搧id
- */
- @Excel(name = "浜у搧id")
- private Long productId;
-
- /**
- * 瑙勬牸鍨嬪彿
- */
- @Excel(name = "瑙勬牸鍨嬪彿")
- private String specificationModel;
-
- /**
- * 鍗曚綅
- */
- @Excel(name = "鍗曚綅")
- private String unit;
-
- /**
- * 绋庣巼
- */
- @Excel(name = "绋庣巼(%)")
- private BigDecimal taxRate;
-
- /**
- * 鍚◣鍗曚环
- */
- @Excel(name = "鍚◣鍗曚环")
- private BigDecimal taxInclusiveUnitPrice;
-
- /**
- * 鍚◣鎬讳环
- */
- @Excel(name = "鍚◣鎬讳环")
- private BigDecimal taxInclusiveTotalPrice;
-
- /**
- * 涓嶅惈绋庢�讳环
- */
- @Excel(name = "涓嶅惈绋庢�讳环")
- private BigDecimal taxExclusiveTotalPrice;
- /**
- * 鎶ヨ〃鏃ユ姤
- */
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate reportDate;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate startMonth;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate endMonth;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate startDate;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate endDate;
-
- private Long productModelId;
-
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDtoCopy.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDtoCopy.java
deleted file mode 100644
index 9173ce3..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementPageDtoCopy.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-
-/**
- * @author :yys
- * @date : 2025/7/9 10:34
- */
-@Data
-public class ProcurementPageDtoCopy {
-
- private Integer id;
-
- private Long createUser;
-
- /**
- * 鍏ュ簱鎵规
- */
- @Excel(name = "鍏ュ簱鎵规")
- private String inboundBatches;
-
- private BigDecimal warnNum;
-
- /**
- * 鍚堝悓鍙�
- */
- private String purchaseContractNumber;
-
-
- /**
- * 閿�鍞悎鍚屽彿
- */
- private String salesContractNo;
-
- /**
- * 瀹㈡埛鍚堝悓鍙�
- */
- private String customerContractNo;
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- private String customerName;
-
- private Long salesLedgerProductId;
-
- /**
- * 鍑哄叆搴撴暟閲�
- */
- @Excel(name = "鍏ュ簱鏁伴噺")
- private BigDecimal inboundNum;
-
- /**
- * 鍏ュ簱鍗曚环
- */
- @Schema(description = "鍏ュ簱鍗曚环")
- @Excel(name = "鍏ュ簱鍗曚环")
- private BigDecimal unitPrice;
-
- /**
- * 鍏ュ簱鎬讳环
- */
- @Schema(description = "鍏ュ簱鎬讳环")
- @Excel(name = "鍏ュ簱鎬讳环")
- private BigDecimal totalPrice;
-
- /**
- * 寰呭嚭搴撴暟閲�
- */
- @Excel(name = "寰呭嚭搴撴暟閲�")
- private BigDecimal inboundNum0;
- /**
- * 鍑哄簱鏁伴噺
- */
- @Excel(name = "鍑哄簱鏁伴噺")
- private BigDecimal totalInboundNum = BigDecimal.ZERO;
-
- /**
- * 鏈�浣庡簱瀛樻暟閲�
- */
- @Excel(name = "鏈�浣庡簱瀛樻暟閲�")
- private BigDecimal minStock;
- /**
- * 鍑哄叆搴撴椂闂�
- */
-// @Excel(name = "鍏ュ簱鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDateTime createTime;
-
- /**
- * 鍑哄叆搴撴椂闂�
- */
- @Excel(name = "鍏ュ簱鏃堕棿")
- private String cTime;
-
- /**
- * 鍑哄叆搴撴椂闂�
- */
-// @Excel(name = "搴撳瓨鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDateTime updateTime;
-
- /**
- * 鍑哄叆搴撴椂闂�
- */
- @Excel(name = "搴撳瓨鏃堕棿")
- private String uTime;
-
- /**
- * 鍑哄叆搴撶敤鎴�
- */
- @Excel(name = "鍏ュ簱浜�")
- private String createBy;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
-
- /**
- * 浜у搧澶х被
- */
- @Excel(name = "浜у搧澶х被")
- private String productCategory;
- /**
- * 浜у搧id
- */
- @Excel(name = "浜у搧id")
- private Long productId;
-
- /**
- * 瑙勬牸鍨嬪彿
- */
- @Excel(name = "瑙勬牸鍨嬪彿")
- private String specificationModel;
-
- /**
- * 鍗曚綅
- */
- @Excel(name = "鍗曚綅")
- private String unit;
-
- /**
- * 绋庣巼
- */
- @Excel(name = "绋庣巼(%)")
- private BigDecimal taxRate;
-
- /**
- * 鍚◣鍗曚环
- */
- @Excel(name = "鍚◣鍗曚环")
- private BigDecimal taxInclusiveUnitPrice;
-
- /**
- * 鍚◣鎬讳环
- */
- @Excel(name = "鍚◣鎬讳环")
- private BigDecimal taxInclusiveTotalPrice;
-
- /**
- * 涓嶅惈绋庢�讳环
- */
- @Excel(name = "涓嶅惈绋庢�讳环")
- private BigDecimal taxExclusiveTotalPrice;
- /**
- * 鎶ヨ〃鏃ユ姤
- */
- @Excel(name = "鎶ヨ〃鏃ユ姤")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDate reportDate;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @Excel(name = "鎶ヨ〃鏈堟姤寮�濮嬫椂闂�")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDate startMonth;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @Excel(name = "鎶ヨ〃鏈堟姤缁撴潫鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDate endMonth;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @Excel(name = "鎶ヨ〃浣滀笟寮�濮嬫椂闂�")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDate startDate;
- /**
- * 鎶ヨ〃鏈堟姤
- */
- @Excel(name = "鎶ヨ〃浣滀笟缁撴潫鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDate endDate;
-
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutAdd.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutAdd.java
deleted file mode 100644
index 58fba64..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutAdd.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import lombok.Data;
-
-/**
- * @author :yys
- * @date : 2025/7/8 13:34
- */
-@Data
-public class ProcurementRecordOutAdd {
-
- private String quantity;
-
- private String time;
-
- private Integer id;
-
- private Integer userId;
-
- private Long salesLedgerProductId;
-
- /**
- * 鍑哄簱绫诲瀷 1-閲囪喘鍑哄簱 2-閿�鍞嚭搴� 3-鑷畾涔�
- */
- private Integer type;
-
- private Long productModelId;// 鍩虹浜у搧ID
-
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutPageDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutPageDto.java
deleted file mode 100644
index 6b57f2a..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementRecordOutPageDto.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.Date;
-
-/**
- * @author :yys
- * @date : 2025/7/8 14:13
- */
-@Data
-public class ProcurementRecordOutPageDto {
-
- @Excel(name = "鍑哄簱缂栧彿")
- private String code;
-
- private Integer id;
-
- private BigDecimal warnNum;
- /**
- * 閿�鍞悎鍚屽彿
- */
- private String salesContractNo;
-
- /**
- * 瀹㈡埛鍚堝悓鍙�
- */
- private String customerContractNo;
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
-
- /**
- * 鍑哄叆搴撴暟閲�
- */
- @Excel(name = "鍑哄簱鏁伴噺")
- private BigDecimal inboundNum;
-
- /**
- * 鍗曚环
- */
- @Excel(name = "鍗曚环")
- private BigDecimal unitPrice;
-
- /**
- * 鎬讳环
- */
- @Excel(name = "鎬讳环")
- private BigDecimal totalPrice;
-
- /**
- * 鍑哄叆搴撴椂闂�
- */
-// @Excel(name = "鍑哄簱鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- private LocalDateTime createTime;
-
- private String timeStr;
-
- @Excel(name = "鍑哄簱鏃堕棿")
- private String time;
-
- /**
- * 鍑哄叆搴撶敤鎴�
- */
- @Excel(name = "鍑哄簱浜�")
- private String createBy;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
-
-
-
- /**
- * 浜у搧澶х被
- */
- @Excel(name = "浜у搧澶х被")
- private String productCategory;
-
- /**
- * 瑙勬牸鍨嬪彿
- */
- @Excel(name = "瑙勬牸鍨嬪彿")
- private String specificationModel;
-
- /**
- * 鍗曚綅
- */
- @Excel(name = "鍗曚綅")
- private String unit;
-
- /**
- * 绋庣巼
- */
- @Excel(name = "绋庣巼(%)")
- private BigDecimal taxRate;
-
- /**
- * 鍚◣鍗曚环
- */
- @Excel(name = "鍚◣鍗曚环")
- private BigDecimal taxInclusiveUnitPrice;
-
- /**
- * 鍚◣鎬讳环
- */
- @Excel(name = "鍚◣鎬讳环")
- private BigDecimal taxInclusiveTotalPrice;
-
- /**
- * 涓嶅惈绋庢�讳环
- */
- @Excel(name = "涓嶅惈绋庢�讳环")
- private BigDecimal taxExclusiveTotalPrice;
-
- /**
- * 鐗╁搧绫诲瀷
- */
- private String itemType;
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementUpdateDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementUpdateDto.java
deleted file mode 100644
index 1a51301..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ProcurementUpdateDto.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * @author :yys
- * @date : 2025/7/8 10:40
- */
-@Data
-public class ProcurementUpdateDto {
-
- private Integer id;
-
- private BigDecimal warnNum;
-
- private BigDecimal quantityStock;
-
- private BigDecimal unitPrice;
-
- private BigDecimal totalPrice;
-
- private List<Integer> ids;
-
- /**
- * 鍑哄簱绫诲瀷 1-閲囪喘 2-閿�鍞� 3-鑷畾涔�
- */
- private Integer type;
-
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ReturnManagementDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ReturnManagementDto.java
deleted file mode 100644
index b69f241..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ReturnManagementDto.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.procurementrecord.pojo.ReturnManagement;
-import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-/**
- * @author :yys
- * @date : 2025/9/17 10:28
- */
-@Data
-public class ReturnManagementDto extends ReturnManagement {
-
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Schema(description = "閿�鍞崟鍙�")
- private String salesContractNo;
-
- @Schema(description = "涓氬姟鍛�")
- private String salesman;
-
-
- @Schema(description = "鍏宠仈鍑哄簱鍗曞彿")
- private String shippingNo;
-
- @Schema(description = "椤圭洰鍚嶇О")
- private String projectName;
-
- @Schema(description = "閿�鍞彴璐d")
- private Long salesLedgerId;
-
- @Schema(description = "閿�鍞骇鍝佸璞℃暟缁�")
- private List<ReturnSaleProductDto> returnSaleProducts;
-
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/dto/ReturnSaleProductDto.java b/src/main/java/com/ruoyi/procurementrecord/dto/ReturnSaleProductDto.java
deleted file mode 100644
index 51cb040..0000000
--- a/src/main/java/com/ruoyi/procurementrecord/dto/ReturnSaleProductDto.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.ruoyi.procurementrecord.dto;
-
-import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-@Data
-public class ReturnSaleProductDto extends ReturnSaleProduct {
-
- private String productName;
-
- private String model;
-
- private String unit;
-
- //鏈��璐ф暟閲�
- private BigDecimal unQuantity;
-
- private BigDecimal totalReturnNum;
-
- // 閫�璐ф�讳环
- private BigDecimal price;
-
- // 閫�璐ф�讳环
- private BigDecimal taxInclusiveUnitPrice;
-}
diff --git a/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordMapper.java b/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordMapper.java
index b41cf62..f37f6d8 100644
--- a/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordMapper.java
+++ b/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordMapper.java
@@ -3,9 +3,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.procurementrecord.dto.ProcurementDto;
-import com.ruoyi.procurementrecord.dto.ProcurementPageDto;
-import com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
import org.apache.ibatis.annotations.Param;
diff --git a/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordOutMapper.java b/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordOutMapper.java
index eebd7cc..a1e003e 100644
--- a/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordOutMapper.java
+++ b/src/main/java/com/ruoyi/procurementrecord/mapper/ProcurementRecordOutMapper.java
@@ -3,7 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut;
import org.apache.ibatis.annotations.Param;
diff --git a/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java b/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java
index 4392109..e0eae1a 100644
--- a/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java
+++ b/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java
@@ -3,7 +3,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
+import com.ruoyi.account.bean.dto.sales.SalesReturnDto;
+import com.ruoyi.account.bean.vo.sales.SalesReturnVo;
+import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import org.apache.ibatis.annotations.Param;
@@ -22,4 +24,6 @@
IPage<ReturnManagementDto> listPage(Page page, @Param("req") ReturnManagementDto returnManagement);
ReturnManagementDto getReturnManagementDtoById(Long id);
+
+ IPage<SalesReturnVo> listPageAccountSalesReturn(Page page, @Param("req") SalesReturnDto salesReturnDto);
}
diff --git a/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnSaleProductMapper.java b/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnSaleProductMapper.java
index 879a074..d185189 100644
--- a/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnSaleProductMapper.java
+++ b/src/main/java/com/ruoyi/procurementrecord/mapper/ReturnSaleProductMapper.java
@@ -1,6 +1,6 @@
package com.ruoyi.procurementrecord.mapper;
-import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
+import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
diff --git a/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java b/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java
index f4e6709..934552e 100644
--- a/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java
+++ b/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java
@@ -97,7 +97,6 @@
/**
* 鍏ュ簱鏃堕棿
*/
- @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDateTime createTime;
diff --git a/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java b/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java
index f5d8c79..5f04de8 100644
--- a/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java
+++ b/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java
@@ -8,7 +8,6 @@
import java.math.BigDecimal;
import java.time.LocalDateTime;
-import java.util.Date;
/**
* @author :yys
@@ -34,6 +33,18 @@
@Schema(description = "鍏宠仈鍑哄簱鍗曞彿Id")
private Long shippingId;
+
+ @Schema(description = "鍙戣揣绫诲瀷 1璐ц溅 2蹇��")
+ private Integer shippingType;
+
+ @Schema(description = "鍙戣揣杞︾墝鍙�")
+ private String truckPlateNo;
+
+ @Schema(description = "蹇�掑叕鍙�")
+ private String expressCompany;
+
+ @Schema(description = "蹇�掑崟鍙�")
+ private String expressNo;
@Schema(description = "椤圭洰id")
private Long projectId;
@@ -68,6 +79,7 @@
@Schema(description = "鏇存柊鏃堕棿")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@Schema(description = "鍒涘缓鐢ㄦ埛")
diff --git a/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnSaleProduct.java b/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnSaleProduct.java
index b7b0efa..2afeaa4 100644
--- a/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnSaleProduct.java
+++ b/src/main/java/com/ruoyi/procurementrecord/pojo/ReturnSaleProduct.java
@@ -1,15 +1,12 @@
package com.ruoyi.procurementrecord.pojo;
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
/**
* <p>
@@ -37,8 +34,8 @@
@Schema(description = "閫�璐у崟id")
private Long returnManagementId;
- @Schema(description = "閫�璐т骇鍝乮d")
- private Long returnsalesLedgerProductId;
+ @Schema(description = "鍏宠仈鍑哄簱鍗昳d")
+ private Long stockOutRecordId;
@Schema(description = "閫�璐т骇鍝佹暟閲�")
private BigDecimal num;
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordOutService.java b/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordOutService.java
index 202ce88..803c03f 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordOutService.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordOutService.java
@@ -3,9 +3,9 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutAdd;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto;
-import com.ruoyi.procurementrecord.dto.ProcurementUpdateDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut;
import jakarta.servlet.http.HttpServletResponse;
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java b/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java
index da23205..a209cf9 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java
@@ -5,7 +5,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.procurementrecord.dto.*;
+import com.ruoyi.procurementrecord.bean.dto.*;
import com.ruoyi.procurementrecord.pojo.CustomStorage;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java b/src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java
index 1a2de96..4e7555a 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java
@@ -3,9 +3,9 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
+import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto;
+import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
-import com.ruoyi.sales.dto.SalesLedgerDto;
/**
* @author :yys
@@ -26,7 +26,7 @@
boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto);
- SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId);
+ ShippingInfoVo getReturnManagementDtoByShippingIdId(Long shippingId);
boolean handle(Long returnManagementId);
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/ReturnSaleProductService.java b/src/main/java/com/ruoyi/procurementrecord/service/ReturnSaleProductService.java
index 07c080f..d16b527 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/ReturnSaleProductService.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/ReturnSaleProductService.java
@@ -1,6 +1,6 @@
package com.ruoyi.procurementrecord.service;
-import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
+import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.baomidou.mybatisplus.extension.service.IService;
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java
index 8b6b33d..8b73f4a 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordOutServiceImpl.java
@@ -5,9 +5,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutAdd;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto;
-import com.ruoyi.procurementrecord.dto.ProcurementUpdateDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto;
+import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut;
import com.ruoyi.procurementrecord.service.ProcurementRecordOutService;
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
index 8a3c4ba..eeeda2f 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
@@ -12,7 +12,7 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.procurementrecord.dto.*;
+import com.ruoyi.procurementrecord.bean.dto.*;
import com.ruoyi.procurementrecord.mapper.CustomStorageMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
@@ -535,7 +535,7 @@
Long aLong = customStorageMapper.selectCount(null);
item.setInboundBatches(aLong.equals(0L) ? "绗�1鎵规(鑷畾涔夊叆搴�)" : "绗�"+ (aLong + 1) + "鎵规(鑷畾涔夊叆搴�)" );
item.setCreateBy(loginUser.getNickName());
- item.setCode(OrderUtils.countTodayByCreateTime(customStorageMapper, "", "code"));
+ item.setCode(OrderUtils.countTodayByCreateTime(customStorageMapper, "", "code", item.getCreateTime() != null ? item.getCreateTime() : LocalDateTime.now()));
customStorageMapper.insert(item);
});
return AjaxResult.success("鑷畾涔夊叆搴撴垚鍔�");
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java b/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java
index e9b2615..6420622 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java
@@ -3,26 +3,23 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.dto.SalesRefundAmountOrderDto;
-import com.ruoyi.account.mapper.AccountExpenseMapper;
-import com.ruoyi.account.pojo.AccountExpense;
+import com.ruoyi.account.bean.dto.SalesRefundAmountOrderDto;
import com.ruoyi.account.service.SalesRefundAmountOrderService;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
-import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
+
+import java.time.LocalDateTime;
+import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto;
+import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto;
+import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo;
+import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo;
import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.ruoyi.procurementrecord.service.ReturnManagementService;
import com.ruoyi.procurementrecord.service.ReturnSaleProductService;
import com.ruoyi.procurementrecord.utils.StockUtils;
-import com.ruoyi.sales.dto.SalesLedgerDto;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.sales.service.ShippingInfoService;
import lombok.RequiredArgsConstructor;
@@ -30,11 +27,11 @@
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
+import java.util.stream.Collectors;
/**
* @author :yys
@@ -48,10 +45,8 @@
private final ReturnManagementMapper returnManagementMapper;
private final ReturnSaleProductService returnSaleProductService;
private final ShippingInfoService shippingInfoService;
- private final SalesLedgerMapper salesLedgerMapper;
private final SalesRefundAmountOrderService salesRefundAmountOrderService;
private final StockUtils stockUtils;
- private final AccountExpenseMapper accountExpenseMapper;
@Override
public IPage<ReturnManagementDto> listPage(Page page, ReturnManagementDto returnManagement) {
@@ -61,8 +56,10 @@
@Override
public boolean addReturnManagementDto(ReturnManagementDto returnManagementDto) {
- String rt = OrderUtils.countTodayByCreateTime(returnManagementMapper, "RT","return_no");
- returnManagementDto.setReturnNo(rt);
+ if (ObjectUtils.isEmpty(returnManagementDto.getReturnNo())){
+ String rt = OrderUtils.countTodayByCreateTime(returnManagementMapper, "RT","return_no", returnManagementDto.getCreateTime() != null ? returnManagementDto.getCreateTime() : LocalDateTime.now());
+ returnManagementDto.setReturnNo(rt);
+ }
save(returnManagementDto);
for (ReturnSaleProduct returnSaleProduct : returnManagementDto.getReturnSaleProducts()) {
returnSaleProduct.setReturnManagementId(returnManagementDto.getId());
@@ -74,71 +71,64 @@
@Override
public boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto) {
- List<ReturnSaleProduct> returnSaleProducts = new ArrayList<>();
if (!CollectionUtils.isEmpty(returnManagementDto.getReturnSaleProducts())) {
returnManagementDto.getReturnSaleProducts().stream().forEach(returnSaleProductDto -> {
ReturnSaleProduct returnSaleProduct = new ReturnSaleProduct();
BeanUtils.copyProperties(returnSaleProductDto, returnSaleProduct);
- returnSaleProducts.add(returnSaleProduct);
+ if (returnSaleProductDto.getId() == null){
+ returnSaleProduct.setReturnManagementId(returnManagementDto.getId());
+ returnSaleProduct.setStatus(0);
+ returnSaleProductService.save(returnSaleProduct);
+ }else returnSaleProductService.updateById(returnSaleProduct);
});
}
- returnSaleProductService.updateBatchById(returnSaleProducts);
return updateById(returnManagementDto);
}
@Override
- public SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId) {
+ public ShippingInfoVo getReturnManagementDtoByShippingIdId(Long shippingId) {
ShippingInfo byId = shippingInfoService.getById(shippingId);
- SalesLedger salesLedger = salesLedgerMapper.selectById(byId.getSalesLedgerId());
- SalesLedgerDto salesLedgerDto = new SalesLedgerDto();
- BeanUtils.copyProperties(salesLedger, salesLedgerDto);
-
- List<SalesLedgerProductDto> salesLedgerProductDtos = shippingInfoService.getReturnManagementDtoById(byId.getId());
- salesLedgerDto.setProductDtoData(salesLedgerProductDtos);
- return salesLedgerDto;
+ ShippingInfoVo shippingInfoVo = new ShippingInfoVo();
+ shippingInfoVo.setShippingInfo(byId);
+ List<ShippingProductVo> shippingProductVos = shippingInfoService.getReturnManagementDtoById(byId.getId());
+ shippingInfoVo.setShippingProductVoList(shippingProductVos);
+ return shippingInfoVo;
}
@Override
public boolean handle(Long returnManagementId) {
ReturnManagement byId = this.getById(returnManagementId);
List<ReturnSaleProductDto> list = returnSaleProductService.listReturnSaleProduct(returnManagementId);
- byId.setStatus(1);
- updateById(byId);
- SalesRefundAmountOrderDto salesRefundAmountOrder = new SalesRefundAmountOrderDto();
- salesRefundAmountOrder.setReturnManagementId(returnManagementId);
- salesRefundAmountOrder.setStatus(0);
- salesRefundAmountOrder.setCreateTime(byId.getCreateTime());
- salesRefundAmountOrder.setCreateUserId(SecurityUtils.getUserId());
- BigDecimal bigDecimal = new BigDecimal(0);
+
+ // 1. 璁$畻姝g‘鐨勯��娆炬�婚锛堥噾棰�=鍗曚环脳鏁伴噺锛�
+ BigDecimal totalRefund = BigDecimal.ZERO;
for (ReturnSaleProductDto returnSaleProduct : list) {
- bigDecimal = bigDecimal.add(returnSaleProduct.getPrice());
- salesRefundAmountOrder.setRefundedAmount(new BigDecimal(0));
+ BigDecimal itemAmount = returnSaleProduct.getAmount() != null
+ ? returnSaleProduct.getAmount()
+ : BigDecimal.ZERO;
+ totalRefund = totalRefund.add(itemAmount);
// 鏄惁鏈夎川閲忛棶棰�
if (returnSaleProduct.getIsQuality() == 1) {
- // 鏈夎川閲忛棶棰橈紝鍏ヤ笉鍚堟牸搴�
- stockUtils.addUnStock(returnSaleProduct.getProductModelId(),returnSaleProduct.getNum(), StockInUnQualifiedRecordTypeEnum.RETURN_UNSTOCK_IN.getCode(),returnSaleProduct.getId());
- }else{
- // 鏃犺川閲忛棶棰橈紝鍏ュ悎鏍煎簱
- stockUtils.addStock(returnSaleProduct.getProductModelId(),returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_HE_IN.getCode(),returnSaleProduct.getId());
+ stockUtils.addUnStockWithBatchNo(returnSaleProduct.getProductModelId(), returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_UNSTOCK_IN.getCode(), returnSaleProduct.getId(), returnSaleProduct.getBatchNo());
+ } else {
+ stockUtils.addStockWithBatchNo(returnSaleProduct.getProductModelId(), returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_HE_IN.getCode(), returnSaleProduct.getId(), returnSaleProduct.getBatchNo());
}
}
- salesRefundAmountOrder.setRefundAmount(bigDecimal);
- salesRefundAmountOrder.setNotRefundedAmount(salesRefundAmountOrder.getRefundedAmount());
- // 鍒嗘壒閫�娆�
-// salesRefundAmountOrderService.addSalesRefundAmountOrderDto(salesRefundAmountOrder);
- // 鍜岃储鍔¤仈鍔紝鏂板鏀嚭
- AccountExpense accountExpense = new AccountExpense();
- accountExpense.setBusinessType(3);
- accountExpense.setExpenseMoney(byId.getRefundAmount());
- accountExpense.setBusinessId(byId.getId());
- accountExpense.setExpenseDate(new Date());
- accountExpense.setExpenseMethod("3");
- accountExpense.setExpenseType("5");
- accountExpense.setExpenseDescribed("閿�鍞��璐ч��娆�");
- accountExpense.setNote(byId.getReturnReason());
- accountExpense.setInputUser(SecurityUtils.getLoginUser().getNickName());
- accountExpense.setInputTime(new Date());
- accountExpenseMapper.insert(accountExpense);
+
+ // 2. 鏇存柊閫�璐у崟鐘舵�佸拰閫�娆炬�婚
+ byId.setStatus(1);
+ byId.setSettler(SecurityUtils.getLoginUser().getNickName());
+ byId.setRefundAmount(totalRefund);
+ updateById(byId);
+ //鏇存柊閫�璐т骇鍝佸垪琛ㄧ殑鐘舵��
+ List<ReturnSaleProduct> updateList = list.stream().map(m -> {
+ ReturnSaleProduct returnSaleProduct = new ReturnSaleProduct();
+ returnSaleProduct.setId(m.getId());
+ returnSaleProduct.setStatus(1);
+ return returnSaleProduct;
+ }).collect(Collectors.toList());
+ returnSaleProductService.updateBatchById(updateList);
+
return true;
}
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java b/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java
index 4809674..29a9ee7 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java
@@ -1,7 +1,7 @@
package com.ruoyi.procurementrecord.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
+import com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto;
import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.ruoyi.procurementrecord.service.ReturnSaleProductService;
diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index f561b49..6c56359 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -1,12 +1,13 @@
package com.ruoyi.procurementrecord.utils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.ruoyi.common.enums.ReviewStatusEnum;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
-import com.ruoyi.stock.mapper.StockInventoryMapper;
import com.ruoyi.stock.pojo.StockInRecord;
import com.ruoyi.stock.pojo.StockOutRecord;
import com.ruoyi.stock.service.StockInRecordService;
@@ -17,7 +18,9 @@
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
+import java.time.LocalDateTime;
import java.util.Collections;
+import java.util.List;
@Component
@RequiredArgsConstructor
@@ -28,7 +31,6 @@
private final StockInventoryService stockInventoryService;
private final StockInRecordService stockInRecordService;
private final StockOutRecordService stockOutRecordService;
- private final StockInventoryMapper stockInventoryMapper;
/**
* 涓嶅悎鏍煎叆搴�
@@ -44,6 +46,24 @@
stockUninventoryDto.setRecordType(String.valueOf(recordType));
stockUninventoryDto.setQualitity(quantity);
stockUninventoryDto.setProductModelId(productModelId);
+ stockUninventoryService.addStockInRecordOnly(stockUninventoryDto);
+ }
+
+ /**
+ * 涓嶅悎鏍煎叆搴撳甫鎵规鍙�
+ *
+ * @param productModelId
+ * @param quantity
+ * @param recordType
+ * @param recordId
+ */
+ public void addUnStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) {
+ StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
+ stockUninventoryDto.setRecordId(recordId);
+ stockUninventoryDto.setRecordType(String.valueOf(recordType));
+ stockUninventoryDto.setQualitity(quantity);
+ stockUninventoryDto.setProductModelId(productModelId);
+ stockUninventoryDto.setBatchNo(batchNo);
stockUninventoryService.addStockInRecordOnly(stockUninventoryDto);
}
@@ -66,17 +86,52 @@
/**
* 鍚堟牸鍏ュ簱
- * @param productModelId
- * @param quantity
* @param recordType
* @param recordId
*/
public void addStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
+ addStock(productModelId, quantity, recordType, recordId, null);
+ }
+
+ /**
+ * 鍚堟牸鍏ュ簱
+ * @param recordType
+ * @param recordId
+ */
+ public void addStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, LocalDateTime createTime) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
stockInventoryDto.setRecordType(String.valueOf(recordType));
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setCreateTime(createTime);
+ stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+ }
+
+ /**
+ * 鍚堟牸鍏ュ簱甯︽壒娆″彿
+ * @param productModelId
+ * @param quantity
+ * @param recordType
+ * @param recordId
+ */
+ public void addStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) {
+ addStockWithBatchNo(productModelId, quantity, recordType, recordId, batchNo, null);
+ }
+
+ /**
+ * 鍚堟牸鍏ュ簱甯︽壒娆″彿
+ * @param recordType
+ * @param recordId
+ */
+ public void addStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo, LocalDateTime createTime) {
+ StockInventoryDto stockInventoryDto = new StockInventoryDto();
+ stockInventoryDto.setRecordId(recordId);
+ stockInventoryDto.setRecordType(String.valueOf(recordType));
+ stockInventoryDto.setQualitity(quantity);
+ stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setBatchNo(batchNo);
+ stockInventoryDto.setCreateTime(createTime);
stockInventoryService.addStockInRecordOnly(stockInventoryDto);
}
@@ -88,15 +143,6 @@
* @param recordType
* @param recordId
*/
- public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
- StockInventoryDto stockInventoryDto = new StockInventoryDto();
- stockInventoryDto.setRecordId(recordId);
- stockInventoryDto.setRecordType(String.valueOf(recordType));
- stockInventoryDto.setQualitity(quantity);
- stockInventoryDto.setProductModelId(productModelId);
- stockInventoryService.subtractStockInventory(stockInventoryDto);
- }
-
public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) {
StockInventoryDto stockInventoryDto = new StockInventoryDto();
stockInventoryDto.setRecordId(recordId);
@@ -104,38 +150,59 @@
stockInventoryDto.setQualitity(quantity);
stockInventoryDto.setProductModelId(productModelId);
stockInventoryDto.setBatchNo(batchNo);
- stockInventoryService.subtractStockInventory(stockInventoryDto);
+ stockInventoryService.addStockOutRecordOnly(stockInventoryDto);
+ }
+
+ /**
+ * 鍙戣揣瀹℃壒鐘舵�佹洿鏀�
+ * @param recordType
+ * @param recordId
+ */
+ public void shipmentStatus(String recordType, Long recordId) {
+ LambdaQueryWrapper<StockOutRecord> queryWrapper = new LambdaQueryWrapper<StockOutRecord>().eq(StockOutRecord::getRecordType, recordType)
+ .eq(StockOutRecord::getRecordId, recordId);
+ stockOutRecordService.list(queryWrapper).stream().forEach(stockOutRecord -> {
+ stockOutRecord.setApprovalStatus(0);
+ stockOutRecordService.updateById(stockOutRecord);
+ });
}
//涓嶅悎鏍煎簱瀛樺垹闄�
public void deleteStockInRecord(Long recordId, String recordType) {
StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>()
.lambda().eq(StockInRecord::getRecordId, recordId)
- .eq(StockInRecord::getRecordType, recordType));
+ .eq(StockInRecord::getRecordType, recordType), false);
if (ObjectUtils.isNotEmpty(one)) {
- stockInRecordService.batchDelete(Collections.singletonList(one.getId()));
- //灏嗗簱瀛樺噺鍥炴潵
- StockInventoryDto stockInventoryDto = new StockInventoryDto();
- stockInventoryDto.setRecordId(recordId);
- stockInventoryDto.setRecordType(recordType);
- stockInventoryDto.setQualitity(one.getStockInNum());
- stockInventoryMapper.updateSubtractStockInventory((stockInventoryDto));
+ if (ReviewStatusEnum.APPROVED.getCode().equals(one.getApprovalStatus())) {
+ stockInRecordService.batchDelete(Collections.singletonList(one.getId()));
+ } else {
+ stockInRecordService.removeById(one.getId());
+ }
}
}
+ //鍒犻櫎鍑哄簱璁板綍
public void deleteStockOutRecord(Long recordId, String recordType) {
- StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>()
+ List<StockOutRecord> records = stockOutRecordService.list(new QueryWrapper<StockOutRecord>()
.lambda().eq(StockOutRecord::getRecordId, recordId)
.eq(StockOutRecord::getRecordType, recordType));
- if (ObjectUtils.isNotEmpty(one)) {
- stockOutRecordService.batchDelete(Collections.singletonList(one.getId()));
- //灏嗗簱瀛樺姞鍥炴潵
- StockInventoryDto stockInventoryDto = new StockInventoryDto();
- stockInventoryDto.setRecordId(recordId);
- stockInventoryDto.setRecordType(recordType);
- stockInventoryDto.setQualitity(one.getStockOutNum());
- stockInventoryMapper.updateAddStockInventory((stockInventoryDto));
+ if (ObjectUtils.isEmpty(records)) {
+ return;
+ }
+ List<Long> approvedIds = records.stream()
+ .filter(one -> ReviewStatusEnum.APPROVED.getCode().equals(one.getApprovalStatus()))
+ .map(StockOutRecord::getId)
+ .toList();
+ List<Long> pendingIds = records.stream()
+ .filter(one -> !ReviewStatusEnum.APPROVED.getCode().equals(one.getApprovalStatus()))
+ .map(StockOutRecord::getId)
+ .toList();
+ if (!approvedIds.isEmpty()) {
+ stockOutRecordService.batchDelete(approvedIds);
+ }
+ if (!pendingIds.isEmpty()) {
+ stockOutRecordService.removeByIds(pendingIds);
}
}
diff --git a/src/main/java/com/ruoyi/production/bean/dto/ProductionAccountDto.java b/src/main/java/com/ruoyi/production/bean/dto/ProductionAccountDto.java
index 91b97ef..5bd2fd1 100644
--- a/src/main/java/com/ruoyi/production/bean/dto/ProductionAccountDto.java
+++ b/src/main/java/com/ruoyi/production/bean/dto/ProductionAccountDto.java
@@ -9,54 +9,54 @@
import java.time.LocalDate;
@Data
-@Schema(name = "ProductionAccountDto", description = "production account query dto")
+@Schema(name = "ProductionAccountDto", description = "鐢熶骇鏍哥畻鏌ヨ鍙傛暟")
public class ProductionAccountDto extends ProductionAccount {
- @Schema(description = "sales contract no")
+ @Schema(description = "閿�鍞悎鍚屽彿")
private String salesContractNo;
- @Schema(description = "customer contract no")
+ @Schema(description = "瀹㈡埛鍚堝悓鍙�")
private String customerContractNo;
- @Schema(description = "project name")
+ @Schema(description = "椤圭洰鍚嶇О")
private String projectName;
- @Schema(description = "customer name")
+ @Schema(description = "瀹㈡埛鍚嶇О")
private String customerName;
- @Schema(description = "product category")
+ @Schema(description = "浜у搧绫诲埆")
private String productCategory;
- @Schema(description = "specification model")
+ @Schema(description = "瑙勬牸鍨嬪彿")
private String specificationModel;
- @Schema(description = "scheduling user id")
+ @Schema(description = "鎺掍骇浜哄憳ID")
private Long schedulingUserId;
- @Schema(description = "scheduling user name")
+ @Schema(description = "鎺掍骇浜哄憳鍚嶇О")
private String schedulingUserName;
- @Schema(description = "process")
+ @Schema(description = "宸ュ簭")
private String process;
- @Schema(description = "date type(day/month)")
+ @Schema(description = "鏃ユ湡绫诲瀷锛堟寜澶�/鎸夋湀锛�")
private String dateType;
- @Schema(description = "day query date")
+ @Schema(description = "鎸夊ぉ鏌ヨ鏃ユ湡")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate entryDate;
- @Schema(description = "date range")
+ @Schema(description = "鏃ユ湡鑼冨洿")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate[] dateRange;
- @Schema(description = "start date")
+ @Schema(description = "寮�濮嬫棩鏈�")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate entryDateStart;
- @Schema(description = "end date")
+ @Schema(description = "缁撴潫鏃ユ湡")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate entryDateEnd;
diff --git a/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java b/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java
index 965cbf3..8a75dcd 100644
--- a/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java
+++ b/src/main/java/com/ruoyi/production/bean/dto/ProductionOperationTaskDto.java
@@ -44,4 +44,7 @@
@Schema(description = "缁撴潫鏃ユ湡")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate endDate;
+
+ @Schema(description = "鏄惁鐢熶骇")
+ private Integer isProduction;
}
diff --git a/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanDto.java b/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanDto.java
index 60ab542..c4363a8 100644
--- a/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanDto.java
+++ b/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanDto.java
@@ -52,4 +52,7 @@
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate requiredDateEnd;
+ @Schema(description = "閿�鍞悎鍚屽彿")
+ private String salesContractNo;
+
}
diff --git a/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanImportDto.java b/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanImportDto.java
index 5dd5160..62b50da 100644
--- a/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanImportDto.java
+++ b/src/main/java/com/ruoyi/production/bean/dto/ProductionPlanImportDto.java
@@ -36,10 +36,6 @@
@Excel(name = "闇�姹傛暟閲�")
private BigDecimal qtyRequired;
- @Schema(description = "鏉ユ簮 閿�鍞�/鍐呴儴")
- @Excel(name = "鏉ユ簮 閿�鍞�/鍐呴儴")
- private String source;
-
@Schema(description = "鎵胯鏃ユ湡")
@Excel(name = "鎵胯鏃ユ湡")
private LocalDate promisedDeliveryDate;
diff --git a/src/main/java/com/ruoyi/production/bean/dto/ProductionProductMainDto.java b/src/main/java/com/ruoyi/production/bean/dto/ProductionProductMainDto.java
index 9fc8d86..cbac4b5 100644
--- a/src/main/java/com/ruoyi/production/bean/dto/ProductionProductMainDto.java
+++ b/src/main/java/com/ruoyi/production/bean/dto/ProductionProductMainDto.java
@@ -12,63 +12,63 @@
@EqualsAndHashCode(callSuper = true)
@Data
-@Schema(name = "ProductionProductMainDto", description = "production report query dto")
+@Schema(name = "ProductionProductMainDto", description = "鐢熶骇鎶ュ伐鏌ヨ鍙傛暟")
public class ProductionProductMainDto extends ProductionProductMain {
- @Schema(description = "product process route item id")
+ @Schema(description = "浜у搧宸ヨ壓璺嚎宸ュ簭ID")
private Long productProcessRouteItemId;
- @Schema(description = "production report id")
+ @Schema(description = "鎶ュ伐ID")
private Long productMainId;
- @Schema(description = "tenant id")
+ @Schema(description = "绉熸埛ID")
private Long tenantId;
- @Schema(description = "work order no")
+ @Schema(description = "宸ュ崟缂栧彿")
private String workOrderNo;
- @Schema(description = "work order status")
+ @Schema(description = "宸ュ崟鐘舵��")
private String workOrderStatus;
- @Schema(description = "nick name")
+ @Schema(description = "鏄电О")
private String nickName;
- @Schema(description = "quantity")
+ @Schema(description = "鏁伴噺")
private BigDecimal quantity;
- @Schema(description = "scrap quantity")
+ @Schema(description = "鎶ュ簾鏁伴噺")
private BigDecimal scrapQty;
- @Schema(description = "product name")
+ @Schema(description = "浜у搧鍚嶇О")
private String productName;
- @Schema(description = "product model name")
+ @Schema(description = "浜у搧瑙勬牸鍨嬪彿")
private String productModelName;
- @Schema(description = "unit")
+ @Schema(description = "鍗曚綅")
private String unit;
- @Schema(description = "sales contract no")
+ @Schema(description = "閿�鍞悎鍚屽彿")
private String salesContractNo;
- @Schema(description = "scheduling date")
+ @Schema(description = "鎺掍骇鏃ユ湡")
private LocalDate schedulingDate;
- @Schema(description = "scheduling user name")
+ @Schema(description = "鎺掍骇浜哄憳鍚嶇О")
private String schedulingUserName;
- @Schema(description = "customer name")
+ @Schema(description = "瀹㈡埛鍚嶇О")
private String customerName;
- @Schema(description = "process")
+ @Schema(description = "宸ュ簭")
private String process;
- @Schema(description = "salary quota")
+ @Schema(description = "宸ヨ祫瀹氶")
private BigDecimal workHours;
- @Schema(description = "wages")
+ @Schema(description = "宸ヨ祫")
private BigDecimal wages;
- @Schema(description = "operation param list")
+ @Schema(description = "宸ュ簭鍙傛暟鍒楄〃")
private List<ProductionOrderRoutingOperationParam> productionOperationParamList;
}
diff --git a/src/main/java/com/ruoyi/production/bean/vo/ProductionAccountVo.java b/src/main/java/com/ruoyi/production/bean/vo/ProductionAccountVo.java
index 5d86e7c..68bcb23 100644
--- a/src/main/java/com/ruoyi/production/bean/vo/ProductionAccountVo.java
+++ b/src/main/java/com/ruoyi/production/bean/vo/ProductionAccountVo.java
@@ -8,52 +8,55 @@
import java.time.LocalDate;
@Data
-@Schema(name = "ProductionAccountVo", description = "production account page result")
+@Schema(name = "ProductionAccountVo", description = "鐢熶骇鏍哥畻鍒嗛〉缁撴灉")
public class ProductionAccountVo {
- @Schema(description = "customer contract no")
+ @Schema(description = "瀹㈡埛鍚堝悓鍙�")
private String customerContractNo;
- @Schema(description = "project name")
+ @Schema(description = "椤圭洰鍚嶇О")
private String projectName;
- @Schema(description = "customer name")
+ @Schema(description = "瀹㈡埛鍚嶇О")
private String customerName;
- @Schema(description = "product category")
+ @Schema(description = "浜у搧绫诲埆")
private String productCategory;
- @Schema(description = "specification model")
+ @Schema(description = "瑙勬牸鍨嬪彿")
private String specificationModel;
- @Schema(description = "unit")
+ @Schema(description = "鍗曚綅")
private String unit;
- @Schema(description = "scheduling user id")
+ @Schema(description = "鎺掍骇浜哄憳ID")
private Long schedulingUserId;
- @Schema(description = "scheduling user name")
+ @Schema(description = "鎺掍骇浜哄憳鍚嶇О")
private String schedulingUserName;
- @Schema(description = "wages")
+ @Schema(description = "宸ヨ祫")
private BigDecimal wages;
- @Schema(description = "finished quantity")
+ @Schema(description = "瀹屾垚鏁伴噺")
private BigDecimal finishedNum;
- @Schema(description = "salary quota")
+ @Schema(description = "宸ヨ祫瀹氶")
private BigDecimal workHours;
- @Schema(description = "output rate")
+ @Schema(description = "宸ユ椂")
+ private BigDecimal workHour;
+
+ @Schema(description = "浜у嚭鐜�")
private String outputRate;
- @Schema(description = "process")
+ @Schema(description = "宸ュ簭")
private String process;
- @Schema(description = "scheduling date")
+ @Schema(description = "鎺掍骇鏃ユ湡")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate schedulingDate;
- @Schema(description = "scheduling month(yyyy-MM)")
+ @Schema(description = "鎺掍骇鏈堜唤(yyyy-MM)")
private String schedulingMonth;
}
diff --git a/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java b/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java
index 6c7c5a7..9929f19 100644
--- a/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java
+++ b/src/main/java/com/ruoyi/production/bean/vo/ProductionOperationTaskVo.java
@@ -46,4 +46,7 @@
@Schema(description = "鏄惁缁撴潫锛�")
private Boolean endOrder;
+
+ @Schema(description = "绫诲瀷 鍖哄垎璁℃椂鍜岃浠�(0璁℃椂1璁′欢)")
+ private Integer type;
}
diff --git a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java
index 1bb26a4..01ef33a 100644
--- a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java
+++ b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderVo.java
@@ -1,6 +1,7 @@
package com.ruoyi.production.bean.vo;
import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.production.pojo.ProductionOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -20,12 +21,15 @@
private String customerName;
@Schema(description = "浜у搧鍚嶇О")
+ @Excel(name = "浜у搧鍚嶇О",sort = 2)
private String productName;
@Schema(description = "瑙勬牸鍨嬪彿")
+ @Excel(name = "瑙勬牸",sort = 3)
private String model;
@Schema(description = "宸ヨ壓璺嚎缂栫爜")
+ @Excel(name = "宸ヨ壓璺嚎缂栧彿",sort = 4)
private String processRouteCode;
@Schema(description = "浜у搧鍥剧墖")
@@ -35,6 +39,7 @@
private String bomNo;
@Schema(description = "瀹屾垚杩涘害")
+ @Excel(name = "瀹屾垚杩涘害",sort = 7)
private BigDecimal completionStatus;
@Schema(description = "鏄惁宸查��鏂�")
diff --git a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java
index 2a0571d..646d3cb 100644
--- a/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java
+++ b/src/main/java/com/ruoyi/production/bean/vo/ProductionOrderWorkOrderDetailVo.java
@@ -9,6 +9,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import java.math.BigDecimal;
import java.util.List;
@Data
@@ -42,6 +43,9 @@
@Schema(description = "鎶ュ伐涓讳俊鎭�")
private ProductionProductMain reportMain;
+ @Schema(description = "宸ユ椂")
+ private BigDecimal workHour;
+
@Schema(description = "鎶ュ伐浜у嚭鏄庣粏")
private List<ProductionProductOutput> reportOutputList;
@@ -62,6 +66,9 @@
@Schema(description = "鎶ュ伐涓讳俊鎭�")
private ProductionProductMain reportMain;
+ @Schema(description = "宸ユ椂")
+ private BigDecimal workHour;
+
@Schema(description = "璐ㄦ涓讳俊鎭�")
private QualityInspect inspect;
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java b/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java
index b5f7b97..0a68875 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionOrderController.java
@@ -1,7 +1,11 @@
package com.ruoyi.production.controller;
+import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.production.bean.dto.ProductionOrderDto;
import com.ruoyi.production.bean.vo.ProductionOrderPickVo;
@@ -10,13 +14,17 @@
import com.ruoyi.production.bean.vo.ProductionOrderWorkOrderDetailVo;
import com.ruoyi.production.pojo.ProductionOrder;
import com.ruoyi.production.service.ProductionOrderService;
+import com.ruoyi.sales.dto.SalesLedgerDto;
+import com.ruoyi.sales.vo.SalesLedgerVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
@RestController
@@ -95,4 +103,14 @@
public R updateOrder(@RequestBody ProductionOrderDto productionOrderDto) {
return R.ok(productionOrderService.updateOrder(productionOrderDto));
}
+
+
+ @Log(title = "鐢熶骇璁㈠崟瀵煎嚭", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ProductionOrderDto dto) {
+ IPage<ProductionOrderVo> productionOrderVoIPage = productionOrderService.pageProductionOrder(new Page<>(-1, -1), dto);
+ List<ProductionOrderVo> records = productionOrderVoIPage.getRecords();
+ ExcelUtil<ProductionOrderVo> util = new ExcelUtil<>(ProductionOrderVo.class);
+ util.exportExcel(response, records, "鐢熶骇璁㈠崟鏁版嵁");
+ }
}
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingController.java b/src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingController.java
index dda1aa0..833e737 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionOrderRoutingController.java
@@ -39,7 +39,7 @@
@PostMapping("/updateRouteItem")
@Operation(summary = "淇敼鐢熶骇璁㈠崟鐨勫伐鑹鸿矾绾胯鎯�")
public R updateRouteItem(@RequestBody ProductionOrderRoutingOperation productionOrderRoutingOperation) {
- return R.ok(productionOrderRoutingOperationService.updateById(productionOrderRoutingOperation));
+ return productionOrderRoutingOperationService.updateRouteItem(productionOrderRoutingOperation);
}
@DeleteMapping("/deleteRouteItem/{id}")
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionPlanController.java b/src/main/java/com/ruoyi/production/controller/ProductionPlanController.java
index 6190a47..923f95c 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionPlanController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionPlanController.java
@@ -14,6 +14,7 @@
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
+import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -85,10 +86,10 @@
excelUtil.importTemplateExcel(response, "涓荤敓浜ц鍒掑鍏ユā鏉�");
}
- @PostMapping("/import")
+ @PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@Operation(summary = "涓荤敓浜ц鍒掓暟鎹鍏�")
@Log(title = "涓荤敓浜ц鍒掓暟鎹鍏�", businessType = BusinessType.IMPORT)
- public R importProdData(@RequestParam("file") MultipartFile file) {
+ public R importProdData(@RequestPart("file") MultipartFile file) {
productionPlanService.importProdData(file);
return R.ok("瀵煎叆鎴愬姛");
}
@@ -96,8 +97,8 @@
@PostMapping("/export")
@Operation(summary = "涓荤敓浜ц鍒掓暟鎹鍑�")
@Log(title = "涓荤敓浜ц鍒掓暟鎹鍑�", businessType = BusinessType.EXPORT)
- public void exportProdData(HttpServletResponse response, @RequestBody(required = false) List<Long> ids) {
- productionPlanService.exportProdData(response, ids);
+ public void exportProdData(HttpServletResponse response, @RequestBody(required = false) ProductionPlanDto requestDto) {
+ productionPlanService.exportProdData(response, requestDto);
}
}
diff --git a/src/main/java/com/ruoyi/production/enums/ProductOrderStatusEnum.java b/src/main/java/com/ruoyi/production/enums/ProductOrderStatusEnum.java
index 5ad55c3..631b2b0 100644
--- a/src/main/java/com/ruoyi/production/enums/ProductOrderStatusEnum.java
+++ b/src/main/java/com/ruoyi/production/enums/ProductOrderStatusEnum.java
@@ -17,7 +17,8 @@
WAIT(1, "寰呭紑濮�"),
RUNNING(2, "杩涜涓�"),
FINISHED(3, "宸插畬鎴�"),
- CANCEL(4, "宸插彇娑�");
+ //CANCEL(4, "宸插彇娑�"),
+ END(5, "宸茬粨鏉�");
private final Integer code;
private final String desc;
@@ -43,10 +44,10 @@
}
/**
- * 鍒ゆ柇鏄惁鍏佽鍒犻櫎锛�4锛�
+ * 鍒ゆ柇鏄惁鍏佽鍒犻櫎锛�1锛�
*/
public static boolean canDelete(Integer code) {
- return WAIT.getCode().equals(code) || CANCEL.getCode().equals(code);
+ return WAIT.getCode().equals(code);
}
/**
@@ -57,9 +58,9 @@
}
/**
- * 鍒ゆ柇鏄惁宸插紑濮嬬敓浜э紙2銆�3锛�
+ * 鍒ゆ柇鏄惁宸插紑濮嬬敓浜э紙2銆�3銆�5锛�
*/
public static boolean isStarted(Integer code) {
- return RUNNING.getCode().equals(code) || FINISHED.getCode().equals(code);
+ return RUNNING.getCode().equals(code) || FINISHED.getCode().equals(code) || END.getCode().equals(code);
}
}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/production/mapper/ProductionOrderMapper.java b/src/main/java/com/ruoyi/production/mapper/ProductionOrderMapper.java
index e52df0c..cec7ca5 100644
--- a/src/main/java/com/ruoyi/production/mapper/ProductionOrderMapper.java
+++ b/src/main/java/com/ruoyi/production/mapper/ProductionOrderMapper.java
@@ -12,6 +12,7 @@
import java.time.LocalDateTime;
import java.util.List;
+import java.util.Map;
/**
* <p>
@@ -39,4 +40,24 @@
Integer countPending(@Param("startDate") String startDate, @Param("endDate") String endDate);
+ List<Map<String, Object>> selectHomeOrderProgressPage(@Param("status") Integer status,
+ @Param("offset") Long offset,
+ @Param("size") Long size,
+ @Param("startTime") LocalDateTime startTime,
+ @Param("endTime") LocalDateTime endTime);
+
+ Long countHomeOrderProgress(@Param("status") Integer status,
+ @Param("startTime") LocalDateTime startTime,
+ @Param("endTime") LocalDateTime endTime);
+
+ List<Map<String, Object>> countHomeOrderProgressByStatus(@Param("startTime") LocalDateTime startTime,
+ @Param("endTime") LocalDateTime endTime);
+
+ List<Map<String, Object>> selectHomeTodayProductionPlan(@Param("size") Long size,
+ @Param("planStart") LocalDateTime planStart,
+ @Param("planEnd") LocalDateTime planEnd);
+
+ Long countHomeTodayProductionPlan(@Param("planStart") LocalDateTime planStart,
+ @Param("planEnd") LocalDateTime planEnd);
+
}
diff --git a/src/main/java/com/ruoyi/production/pojo/ProductionAccount.java b/src/main/java/com/ruoyi/production/pojo/ProductionAccount.java
index e205db2..c53f138 100644
--- a/src/main/java/com/ruoyi/production/pojo/ProductionAccount.java
+++ b/src/main/java/com/ruoyi/production/pojo/ProductionAccount.java
@@ -27,12 +27,6 @@
@TableId(value = "id", type = IdType.AUTO)
private Long id;
- @Schema(description = "閿�鍞彴璐d")
- private Long salesLedgerId;
-
- @Schema(description = "閿�鍞骇鍝佽鏍糹d")
- private Long salesLedgerProductId;
-
@Schema(description = "鎶ュ伐琛╥d")
private Long productionProductMainId;
diff --git a/src/main/java/com/ruoyi/production/pojo/ProductionOrder.java b/src/main/java/com/ruoyi/production/pojo/ProductionOrder.java
index 1f882b1..6208146 100644
--- a/src/main/java/com/ruoyi/production/pojo/ProductionOrder.java
+++ b/src/main/java/com/ruoyi/production/pojo/ProductionOrder.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -36,10 +37,10 @@
private Long productModelId;
@Schema(description = "鐢熶骇璁㈠崟鍙�")
+ @Excel(name = "鐢熶骇璁㈠崟",sort = 0)
private String npsNo;
@Schema(description = "褰曞叆鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@Schema(description = "鏇存柊鏃堕棿")
@@ -50,15 +51,19 @@
private Long technologyRoutingId;
@Schema(description = "闇�姹傛暟閲忋�傛墜鍔ㄦ柊澧炴椂蹇呭~涓斿繀椤诲ぇ浜� 0锛涘鏋滀紶浜� productionPlanIds锛屽垯鍙敱绯荤粺鑷姩甯﹀嚭銆�")
+ @Excel(name = "闇�姹傛暟閲�",sort = 5)
private BigDecimal quantity;
@Schema(description = "瀹屾垚鏁伴噺")
+ @Excel(name = "瀹屾垚鏁伴噺",sort = 6)
private BigDecimal completeQuantity;
@Schema(description = "寮�濮嬫棩鏈�")
+ @Excel(name = "寮�濮嬫棩鏈�",sort = 8,dateFormat = "yyyy-MM-dd")
private LocalDateTime startTime;
@Schema(description = "缁撴潫鏃ユ湡")
+ @Excel(name = "缁撴潫鏃ユ湡",sort = 9,dateFormat = "yyyy-MM-dd")
private LocalDateTime endTime;
@Schema(description = "鍒涘缓浜篒D")
@@ -72,9 +77,11 @@
@Schema(description = "璁″垝瀹屾垚鏃堕棿")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "璁″垝瀹屾垚鏃堕棿",sort = 10,dateFormat = "yyyy-MM-dd")
private LocalDate planCompleteTime;
@Schema(description = "鐘舵�侊紙1.寰呭紑濮� 2.杩涜涓� 3.宸插畬鎴� 4.宸插彇娑� 5.宸茬粨鏉燂級")
+ @Excel(name = "鐘舵��",sort = 1,readConverterExp = "1=寰呭紑濮�,2=杩涜涓�,3=宸插畬鎴�,4=宸插彇娑�,5=宸茬粨鏉�")
private Integer status;
@Schema(description = "鏄惁缁撴潫锛�")
diff --git a/src/main/java/com/ruoyi/production/pojo/ProductionOrderRoutingOperation.java b/src/main/java/com/ruoyi/production/pojo/ProductionOrderRoutingOperation.java
index fc36725..d784109 100644
--- a/src/main/java/com/ruoyi/production/pojo/ProductionOrderRoutingOperation.java
+++ b/src/main/java/com/ruoyi/production/pojo/ProductionOrderRoutingOperation.java
@@ -67,4 +67,7 @@
@Schema(description = "宸ュ簭琛╥d")
private Long technologyOperationId;
+
+ @Schema(description = "绫诲瀷 鍖哄垎璁℃椂鍜岃浠讹紝0璁℃椂锛�1璁′欢")
+ private Integer type;
}
diff --git a/src/main/java/com/ruoyi/production/pojo/ProductionProductInput.java b/src/main/java/com/ruoyi/production/pojo/ProductionProductInput.java
index 9c6e9d1..5171aa7 100644
--- a/src/main/java/com/ruoyi/production/pojo/ProductionProductInput.java
+++ b/src/main/java/com/ruoyi/production/pojo/ProductionProductInput.java
@@ -14,9 +14,6 @@
@TableId(type = IdType.AUTO)
private Long id;
- @Schema(description = "鎶ュ伐id")
- private Long productMainId;
-
@Schema(description = "鐢熶骇鎶ュ伐涓昏〃id")
private Long productionProductMainId;
diff --git a/src/main/java/com/ruoyi/production/pojo/ProductionProductMain.java b/src/main/java/com/ruoyi/production/pojo/ProductionProductMain.java
index 0fa00eb..9de89fb 100644
--- a/src/main/java/com/ruoyi/production/pojo/ProductionProductMain.java
+++ b/src/main/java/com/ruoyi/production/pojo/ProductionProductMain.java
@@ -7,6 +7,7 @@
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
+import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@@ -56,4 +57,7 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+ @Schema(description = "宸ユ椂")
+ private BigDecimal workHour;
+
}
diff --git a/src/main/java/com/ruoyi/production/pojo/ProductionProductOutput.java b/src/main/java/com/ruoyi/production/pojo/ProductionProductOutput.java
index 5e1daef..40f9a41 100644
--- a/src/main/java/com/ruoyi/production/pojo/ProductionProductOutput.java
+++ b/src/main/java/com/ruoyi/production/pojo/ProductionProductOutput.java
@@ -14,9 +14,6 @@
@TableId(type = IdType.AUTO)
private Long id;
- @Schema(description = "鎶ュ伐id")
- private Long productMainId;
-
@Schema(description = "鐢熶骇鎶ュ伐涓昏〃id")
private Long productionProductMainId;
diff --git a/src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationService.java b/src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationService.java
index 2377dc3..e14b36f 100644
--- a/src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationService.java
+++ b/src/main/java/com/ruoyi/production/service/ProductionOrderRoutingOperationService.java
@@ -8,7 +8,10 @@
R addRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation);
+ R updateRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation);
+
R deleteRouteItem(Long id);
int sortRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation);
+
}
diff --git a/src/main/java/com/ruoyi/production/service/ProductionPlanService.java b/src/main/java/com/ruoyi/production/service/ProductionPlanService.java
index 052676b..715e221 100644
--- a/src/main/java/com/ruoyi/production/service/ProductionPlanService.java
+++ b/src/main/java/com/ruoyi/production/service/ProductionPlanService.java
@@ -51,6 +51,6 @@
/**
* 瀵煎嚭鏁版嵁
*/
- void exportProdData(HttpServletResponse response, List<Long> ids);
+ void exportProdData(HttpServletResponse response, ProductionPlanDto requestDto);
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionAccountServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionAccountServiceImpl.java
index 9c1843c..c35c757 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionAccountServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionAccountServiceImpl.java
@@ -24,16 +24,19 @@
@Override
public IPage<ProductionAccountVo> listPage(Page<ProductionAccountDto> page, ProductionAccountDto dto) {
+ // 鍒嗛〉鏌ヨ鐢熶骇鏍哥畻鏁版嵁
ProductionAccountDto queryDto = normalizeDateQuery(dto);
return baseMapper.listPage(page, queryDto);
}
@Override
public IPage<ProductionProductMainDto> listProductionDetails(ProductionAccountDto dto, Page page) {
+ // 鏌ヨ鐢熶骇鏍哥畻鏄庣粏
return productionProductMainMapper.listProductionDetails(normalizeDateQuery(dto), page);
}
private ProductionAccountDto normalizeDateQuery(ProductionAccountDto dto) {
+ // 瑙勮寖鏃ユ湡鏌ヨ鑼冨洿锛岃ˉ榻愮己澶辩殑寮�濮嬫垨缁撴潫鏃堕棿
if (dto == null) {
return new ProductionAccountDto();
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
index cbae0dc..0513bdc 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
@@ -1,18 +1,45 @@
package com.ruoyi.production.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.production.bean.dto.ProductionBomStructureDto;
import com.ruoyi.production.bean.vo.ProductionBomStructureVo;
import com.ruoyi.production.mapper.ProductionBomStructureMapper;
+import com.ruoyi.production.mapper.ProductionOperationTaskMapper;
+import com.ruoyi.production.mapper.ProductionOrderBomMapper;
+import com.ruoyi.production.mapper.ProductionOrderMapper;
+import com.ruoyi.production.mapper.ProductionOrderRoutingMapper;
+import com.ruoyi.production.mapper.ProductionOrderRoutingOperationMapper;
+import com.ruoyi.production.mapper.ProductionOrderRoutingOperationParamMapper;
+import com.ruoyi.production.mapper.ProductionProductMainMapper;
import com.ruoyi.production.pojo.ProductionBomStructure;
+import com.ruoyi.production.pojo.ProductionOperationTask;
+import com.ruoyi.production.pojo.ProductionOrder;
+import com.ruoyi.production.pojo.ProductionOrderBom;
+import com.ruoyi.production.pojo.ProductionOrderRouting;
+import com.ruoyi.production.pojo.ProductionOrderRoutingOperation;
+import com.ruoyi.production.pojo.ProductionOrderRoutingOperationParam;
+import com.ruoyi.production.pojo.ProductionProductMain;
import com.ruoyi.production.service.ProductionBomStructureService;
+import com.ruoyi.production.util.TaskPlanQuantityUtil;
+import com.ruoyi.technology.mapper.TechnologyOperationMapper;
+import com.ruoyi.technology.mapper.TechnologyOperationParamMapper;
+import com.ruoyi.technology.mapper.TechnologyParamMapper;
+import com.ruoyi.technology.pojo.TechnologyOperation;
+import com.ruoyi.technology.pojo.TechnologyOperationParam;
+import com.ruoyi.technology.pojo.TechnologyParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
import java.util.*;
+import java.util.stream.Collectors;
/**
* <p>
@@ -26,13 +53,24 @@
@RequiredArgsConstructor()
public class ProductionBomStructureServiceImpl extends ServiceImpl<ProductionBomStructureMapper, ProductionBomStructure> implements ProductionBomStructureService {
- private final ProductionBomStructureMapper productionBomStructureMapper;
+ private final ProductionBomStructureMapper productionBomStructureMapper;
+ private final ProductionOrderBomMapper productionOrderBomMapper;
+ private final ProductionOrderMapper productionOrderMapper;
+ private final ProductionOrderRoutingMapper productionOrderRoutingMapper;
+ private final ProductionOrderRoutingOperationMapper productionOrderRoutingOperationMapper;
+ private final ProductionOrderRoutingOperationParamMapper productionOrderRoutingOperationParamMapper;
+ private final ProductionOperationTaskMapper productionOperationTaskMapper;
+ private final ProductionProductMainMapper productionProductMainMapper;
+ private final TechnologyOperationMapper technologyOperationMapper;
+ private final TechnologyOperationParamMapper technologyOperationParamMapper;
+ private final TechnologyParamMapper technologyParamMapper;
/**
* 鏍规嵁BOM鏌ヨ骞剁粍瑁呯粨鏋勬爲銆�
*/
@Override
public List<ProductionBomStructureVo> listByBomId(Long bomId) {
+ // 鎸塀OMID鏌ヨ鐢熶骇缁撴瀯鏁版嵁
List<ProductionBomStructureVo> list = productionBomStructureMapper.listByBomId(bomId);
Map<Long, ProductionBomStructureVo> map = new HashMap<>();
for (ProductionBomStructureVo node : list) {
@@ -58,13 +96,17 @@
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean addProductionBomStructure(ProductionBomStructureDto dto) {
+ // 鏂板鐢熶骇BOM缁撴瀯
+ // 璇诲彇褰撳墠璁㈠崟BOM涓婚敭锛屽苟鎶婂墠绔爲缁撴瀯鎷嶅钩鎴愬垪琛�
Long orderBomId = dto.getProductionOrderBomId();
List<ProductionBomStructureDto> flatDtoList = new ArrayList<>();
flattenTree(dto.getChildren(), flatDtoList);
+ // 鏌ヨ鏁版嵁搴撳凡鏈夌粨鏋勶紝鐢ㄤ簬鍚庣画鍋氬鍒犳敼瀵规瘮
List<ProductionBomStructure> dbList = this.list(new LambdaQueryWrapper<ProductionBomStructure>()
.eq(ProductionBomStructure::getProductionOrderBomId, orderBomId));
+ // 鏀堕泦鍓嶇浠嶇劧瀛樺湪鐨勮妭鐐笽D
Set<Long> frontendIds = new HashSet<>();
for (ProductionBomStructureDto item : flatDtoList) {
if (item.getId() != null) {
@@ -72,16 +114,19 @@
}
}
+ // 璁$畻闇�瑕佸垹闄ょ殑鑺傜偣锛堟暟鎹簱鏈夈�佸墠绔凡鍒犻櫎锛�
Set<Long> deleteIds = new HashSet<>();
for (ProductionBomStructure dbItem : dbList) {
if (!frontendIds.contains(dbItem.getId())) {
deleteIds.add(dbItem.getId());
}
}
+ // 鍏堝垹鎺夊墠绔凡缁忕Щ闄ょ殑鑺傜偣
if (!deleteIds.isEmpty()) {
this.removeByIds(deleteIds);
}
+ // 鎸夋槸鍚︽湁ID鎷嗗垎涓烘柊澧炲拰鏇存柊锛屽悓鏃剁紦瀛樻柊澧炶妭鐐圭殑涓存椂ID鏄犲皠
List<ProductionBomStructure> insertList = new ArrayList<>();
List<ProductionBomStructure> updateList = new ArrayList<>();
Map<String, ProductionBomStructure> tempEntityMap = new HashMap<>();
@@ -99,10 +144,12 @@
}
}
+ // 鎵归噺鏂板锛屾嬁鍒版暟鎹簱鐢熸垚鐨勭湡瀹濱D
if (!insertList.isEmpty()) {
this.saveBatch(insertList);
}
+ // 鏂板鑺傜偣浜屾鍥炲啓鐖禝D锛堝墠绔紶鐨勬槸涓存椂鐖禝D锛�
List<ProductionBomStructure> parentFixList = new ArrayList<>();
for (ProductionBomStructureDto item : flatDtoList) {
if (item.getId() == null && item.getParentTempId() != null) {
@@ -111,25 +158,725 @@
continue;
}
ProductionBomStructure parent = tempEntityMap.get(item.getParentTempId());
+ // 鐖惰妭鐐规槸鏈鏂板鏃讹紝鐩存帴鐢ㄦ柊澧炲悗鐨勭湡瀹濱D锛涘惁鍒欏洖閫�涓哄墠绔紶鍏ョ埗ID
Long realParentId = parent != null ? parent.getId() : Long.valueOf(item.getParentTempId());
child.setParentId(realParentId);
parentFixList.add(child);
}
}
+ // 鍥炲啓鏂板鑺傜偣鐨勭埗瀛愬叧绯�
if (!parentFixList.isEmpty()) {
this.updateBatchById(parentFixList);
+ }
+ // 鎵归噺鏇存柊宸叉湁鑺傜偣
+ if (!updateList.isEmpty()) {
+ this.updateBatchById(updateList);
+ }
+ syncDemandedQuantityAndTaskPlanQuantity(orderBomId, dto.getProductionOrderId());
+ return true;
+ }
+
+ private void syncDemandedQuantityAndTaskPlanQuantity(Long orderBomId, Long productionOrderId) {
+ if (orderBomId == null) {
+ return;
+ }
+ ProductionOrderBom orderBom = productionOrderBomMapper.selectById(orderBomId);
+ if (orderBom == null) {
+ return;
+ }
+ Long currentProductionOrderId = productionOrderId != null ? productionOrderId : orderBom.getProductionOrderId();
+ if (currentProductionOrderId == null) {
+ return;
+ }
+ ProductionOrder productionOrder = productionOrderMapper.selectById(currentProductionOrderId);
+ if (productionOrder == null) {
+ return;
+ }
+
+ BigDecimal orderQuantity = defaultDecimal(productionOrder.getQuantity());
+ List<ProductionBomStructure> structureList = this.list(
+ Wrappers.<ProductionBomStructure>lambdaQuery()
+ .eq(ProductionBomStructure::getProductionOrderBomId, orderBomId)
+ .orderByAsc(ProductionBomStructure::getId));
+ //鍚屾闇�姹傛暟閲�
+ syncStructureDemandedQuantity(structureList, orderQuantity);
+ Long rootProductModelId = orderBom.getProductModelId() != null ? orderBom.getProductModelId() : productionOrder.getProductModelId();
+ //鍚屾鐢熶骇宸ヨ壓璺嚎
+ syncRoutingOperationsByBom(currentProductionOrderId, productionOrder, orderBom, structureList, rootProductModelId);
+ //鍚屾宸ュ崟
+ syncTaskPlanQuantity(
+ currentProductionOrderId,
+ structureList,
+ orderQuantity,
+ rootProductModelId);
+ }
+
+ private void syncStructureDemandedQuantity(List<ProductionBomStructure> structureList, BigDecimal orderQuantity) {
+ if (structureList == null || structureList.isEmpty()) {
+ return;
+ }
+ List<ProductionBomStructure> updateList = new ArrayList<>();
+ BigDecimal lastProcessDemandedQuantity = orderQuantity;
+ for (ProductionBomStructure structure : structureList) {
+ if (structure == null || structure.getId() == null) {
+ continue;
+ }
+
+ BigDecimal demandedQuantity = lastProcessDemandedQuantity.multiply(defaultDecimal(structure.getUnitQuantity()));
+// if (compareDecimal(structure.getDemandedQuantity(), demandedQuantity) == 0) {
+// continue;
+// }
+ ProductionBomStructure update = new ProductionBomStructure();
+ update.setId(structure.getId());
+ update.setDemandedQuantity(demandedQuantity);
+ updateList.add(update);
+ structure.setDemandedQuantity(demandedQuantity);
+ lastProcessDemandedQuantity = demandedQuantity;
}
if (!updateList.isEmpty()) {
this.updateBatchById(updateList);
}
- return true;
+ }
+
+ private void syncTaskPlanQuantity(Long productionOrderId,
+ List<ProductionBomStructure> structureList,
+ BigDecimal orderQuantity,
+ Long rootProductModelId) {
+ List<ProductionOperationTask> taskList = productionOperationTaskMapper.selectList(
+ Wrappers.<ProductionOperationTask>lambdaQuery()
+ .eq(ProductionOperationTask::getProductionOrderId, productionOrderId)
+ .orderByAsc(ProductionOperationTask::getId));
+ if (taskList == null || taskList.isEmpty()) {
+ return;
+ }
+ Set<Long> routingOperationIds = taskList.stream()
+ .map(ProductionOperationTask::getProductionOrderRoutingOperationId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ if (routingOperationIds.isEmpty()) {
+ return;
+ }
+ Map<Long, ProductionOrderRoutingOperation> routingOperationMap = productionOrderRoutingOperationMapper
+ .selectBatchIds(routingOperationIds)
+ .stream()
+ .filter(item -> item != null && item.getId() != null)
+ .collect(Collectors.toMap(ProductionOrderRoutingOperation::getId, item -> item, (left, right) -> left));
+ // Keep task plan quantities aligned with the same order BOM snapshot demand used during snapshot creation.
+ Map<String, BigDecimal> demandedQuantityMap = TaskPlanQuantityUtil.buildOperationDemandedQuantityMap(structureList, rootProductModelId);
+ for (ProductionOperationTask task : taskList) {
+ if (task == null || task.getId() == null || task.getProductionOrderRoutingOperationId() == null) {
+ continue;
+ }
+ ProductionOrderRoutingOperation routingOperation = routingOperationMap.get(task.getProductionOrderRoutingOperationId());
+ if (routingOperation == null) {
+ continue;
+ }
+ BigDecimal planQuantity = resolveTaskPlanQuantity(
+ routingOperation,
+ demandedQuantityMap,
+ orderQuantity,
+ rootProductModelId);
+ if (compareDecimal(task.getPlanQuantity(), planQuantity) == 0) {
+ continue;
+ }
+ ProductionOperationTask update = new ProductionOperationTask();
+ update.setId(task.getId());
+ update.setPlanQuantity(planQuantity);
+ productionOperationTaskMapper.updateById(update);
+ }
+ }
+
+ private void syncRoutingOperationsByBom(Long productionOrderId,
+ ProductionOrder productionOrder,
+ ProductionOrderBom orderBom,
+ List<ProductionBomStructure> structureList,
+ Long rootProductModelId) {
+ ProductionOrderRouting orderRouting = getOrCreateOrderRoutingSnapshot(productionOrderId, productionOrder, orderBom, rootProductModelId);
+ List<ProductionOrderRoutingOperation> desiredOperationList = buildDesiredRoutingOperationList(structureList, rootProductModelId);
+ List<ProductionOrderRoutingOperation> existingOperationList = productionOrderRoutingOperationMapper.selectList(
+ Wrappers.<ProductionOrderRoutingOperation>lambdaQuery()
+ .eq(ProductionOrderRoutingOperation::getOrderRoutingId, orderRouting.getId())
+ .eq(ProductionOrderRoutingOperation::getProductionOrderId, productionOrderId)
+ .orderByAsc(ProductionOrderRoutingOperation::getDragSort)
+ .orderByAsc(ProductionOrderRoutingOperation::getId));
+ Map<String, Deque<ProductionOrderRoutingOperation>> existingBucketMap = buildExistingRoutingOperationBucketMap(existingOperationList);
+ List<ProductionOrderRoutingOperation> finalOperationList = new ArrayList<>();
+ for (ProductionOrderRoutingOperation desiredOperation : desiredOperationList) {
+ String bucketKey = buildRoutingOperationBucketKey(
+ desiredOperation.getTechnologyOperationId(),
+ desiredOperation.getProductModelId());
+ Deque<ProductionOrderRoutingOperation> matchedQueue = existingBucketMap.get(bucketKey);
+ ProductionOrderRoutingOperation matchedOperation = matchedQueue == null ? null : matchedQueue.pollFirst();
+ if (matchedOperation == null) {
+ matchedOperation = insertRoutingOperationSnapshot(orderRouting.getId(), productionOrderId, desiredOperation);
+ } else {
+ updateRoutingOperationSnapshotIfNecessary(matchedOperation, orderRouting.getId(), productionOrderId, desiredOperation);
+ }
+ finalOperationList.add(matchedOperation);
+ }
+ for (Deque<ProductionOrderRoutingOperation> queue : existingBucketMap.values()) {
+ while (queue != null && !queue.isEmpty()) {
+ removeRoutingOperationSnapshot(queue.pollFirst());
+ }
+ }
+ syncRoutingOperationTasks(productionOrderId, finalOperationList);
+ }
+
+ private ProductionOrderRouting getOrCreateOrderRoutingSnapshot(Long productionOrderId,
+ ProductionOrder productionOrder,
+ ProductionOrderBom orderBom,
+ Long rootProductModelId) {
+ ProductionOrderRouting orderRouting = productionOrderRoutingMapper.selectOne(
+ Wrappers.<ProductionOrderRouting>lambdaQuery()
+ .eq(ProductionOrderRouting::getProductionOrderId, productionOrderId)
+ .orderByDesc(ProductionOrderRouting::getId)
+ .last("limit 1"));
+ if (orderRouting == null) {
+ orderRouting = new ProductionOrderRouting();
+ orderRouting.setProductionOrderId(productionOrderId);
+ orderRouting.setProductModelId(rootProductModelId);
+ orderRouting.setTechnologyRoutingId(productionOrder == null ? null : productionOrder.getTechnologyRoutingId());
+ orderRouting.setBomId(orderBom == null ? null : orderBom.getBomId());
+ orderRouting.setOrderBomId(orderBom == null ? null : orderBom.getId());
+ productionOrderRoutingMapper.insert(orderRouting);
+ return orderRouting;
+ }
+ ProductionOrderRouting update = new ProductionOrderRouting();
+ update.setId(orderRouting.getId());
+ boolean changed = false;
+ if (!Objects.equals(orderRouting.getProductModelId(), rootProductModelId)) {
+ update.setProductModelId(rootProductModelId);
+ orderRouting.setProductModelId(rootProductModelId);
+ changed = true;
+ }
+ Long technologyRoutingId = productionOrder == null ? null : productionOrder.getTechnologyRoutingId();
+ if (!Objects.equals(orderRouting.getTechnologyRoutingId(), technologyRoutingId)) {
+ update.setTechnologyRoutingId(technologyRoutingId);
+ orderRouting.setTechnologyRoutingId(technologyRoutingId);
+ changed = true;
+ }
+ Long bomId = orderBom == null ? null : orderBom.getBomId();
+ if (!Objects.equals(orderRouting.getBomId(), bomId)) {
+ update.setBomId(bomId);
+ orderRouting.setBomId(bomId);
+ changed = true;
+ }
+ Long orderBomId = orderBom == null ? null : orderBom.getId();
+ if (!Objects.equals(orderRouting.getOrderBomId(), orderBomId)) {
+ update.setOrderBomId(orderBomId);
+ orderRouting.setOrderBomId(orderBomId);
+ changed = true;
+ }
+ if (changed) {
+ productionOrderRoutingMapper.updateById(update);
+ }
+ return orderRouting;
+ }
+
+ private List<ProductionOrderRoutingOperation> buildDesiredRoutingOperationList(List<ProductionBomStructure> structureList,
+ Long rootProductModelId) {
+ if (structureList == null || structureList.isEmpty()) {
+ return Collections.emptyList();
+ }
+ Map<Long, ProductionBomStructure> structureById = structureList.stream()
+ .filter(item -> item != null && item.getId() != null)
+ .collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left));
+
+ // 鏋勫缓鐖�-瀛愭槧灏勫叧绯�
+ Map<Long, List<ProductionBomStructure>> treeMap = buildParentChildMap(structureList);
+
+ // 浣跨敤鍚庡簭閬嶅巻鏋勫缓鎿嶄綔鍒楄〃锛堝厛瀛愬悗鐖讹紝纭繚宸ヨ壓璺嚎椤哄簭姝g‘锛�
+ // 浣跨敤娣卞害浣滀负鎺掑簭渚濇嵁鐨勮緟鍔╃粨鏋�
+ Map<String, ProductionBomStructure> operationMap = new LinkedHashMap<>();
+ Map<String, Integer> depthMap = new HashMap<>();
+ buildOperationListPostOrderWithDepth(null, treeMap, operationMap, depthMap, structureById, rootProductModelId, 1);
+
+ // 鎸夋繁搴︽帓搴忥紝娣卞害澶х殑鎺掑墠闈�
+ List<Map.Entry<String, ProductionBomStructure>> sortedEntries = new ArrayList<>(operationMap.entrySet());
+ sortedEntries.sort((a, b) -> {
+ int depthCompare = Integer.compare(
+ depthMap.getOrDefault(b.getKey(), 0),
+ depthMap.getOrDefault(a.getKey(), 0));
+ if (depthCompare != 0) {
+ return depthCompare;
+ }
+ return 0;
+ });
+
+ List<ProductionOrderRoutingOperation> desiredOperationList = new ArrayList<>();
+ int dragSort = 1;
+ for (Map.Entry<String, ProductionBomStructure> entry : sortedEntries) {
+ ProductionBomStructure bomStructure = entry.getValue();
+ Long outputProductModelId = resolveOutputProductModelId(resolveOperationOutputNode(bomStructure, structureById), rootProductModelId);
+ TechnologyOperation technologyOperation = getTechnologyOperation(bomStructure.getTechnologyOperationId());
+ ProductionOrderRoutingOperation routingOperation = new ProductionOrderRoutingOperation();
+ routingOperation.setProductModelId(outputProductModelId);
+ routingOperation.setTechnologyOperationId(bomStructure.getTechnologyOperationId());
+ routingOperation.setOperationName(technologyOperation == null ? null : technologyOperation.getName());
+ routingOperation.setIsQuality(technologyOperation == null ? null : technologyOperation.getIsQuality());
+ routingOperation.setIsProduction(technologyOperation == null ? null : technologyOperation.getIsProduction());
+ routingOperation.setType(technologyOperation == null ? null : technologyOperation.getType());
+ routingOperation.setDragSort(dragSort++);
+ desiredOperationList.add(routingOperation);
+ }
+ return desiredOperationList;
+ }
+
+ private void buildOperationListPostOrderWithDepth(Long parentId,
+ Map<Long, List<ProductionBomStructure>> treeMap,
+ Map<String, ProductionBomStructure> operationMap,
+ Map<String, Integer> depthMap,
+ Map<Long, ProductionBomStructure> structureById,
+ Long rootProductModelId,
+ int currentDepth) {
+ List<ProductionBomStructure> children = treeMap.get(parentId);
+ if (children == null || children.isEmpty()) {
+ return;
+ }
+ for (ProductionBomStructure child : children) {
+ // 鍏堥�掑綊澶勭悊瀛愯妭鐐�
+ buildOperationListPostOrderWithDepth(child.getId(), treeMap, operationMap, depthMap, structureById, rootProductModelId, currentDepth + 1);
+
+ // 鍐嶅鐞嗗綋鍓嶈妭鐐�
+ if (child.getTechnologyOperationId() != null) {
+ Long outputProductModelId = resolveOutputProductModelId(resolveOperationOutputNode(child, structureById), rootProductModelId);
+ String key = buildBomOperationDedupKey(child, outputProductModelId);
+ // 淇濈暀娣卞害鏈�澶х殑鎿嶄綔
+ Integer existingDepth = depthMap.get(key);
+ if (existingDepth == null || currentDepth > existingDepth) {
+ operationMap.put(key, child);
+ depthMap.put(key, currentDepth);
+ }
+ }
+ }
+ }
+
+ private Map<Long, List<ProductionBomStructure>> buildParentChildMap(List<ProductionBomStructure> structureList) {
+ Map<Long, List<ProductionBomStructure>> treeMap = new LinkedHashMap<>();
+ Map<Long, ProductionBomStructure> structureById = new HashMap<>();
+
+ // 鏋勫缓鐖�-瀛愭槧灏勫拰ID鏄犲皠
+ for (ProductionBomStructure structure : structureList) {
+ if (structure == null) continue;
+ Long parentId = structure.getParentId();
+ treeMap.computeIfAbsent(parentId, k -> new ArrayList<>()).add(structure);
+ if (structure.getId() != null) {
+ structureById.put(structure.getId(), structure);
+ }
+ }
+
+ // 璁$畻姣忎釜鑺傜偣鐨勬繁搴︼紙浠庢牴鑺傜偣鍒板綋鍓嶈妭鐐圭殑璺濈锛屾牴鑺傜偣娣卞害涓�1锛�
+ Map<Long, Integer> depthMap = new HashMap<>();
+ for (ProductionBomStructure structure : structureList) {
+ if (structure == null || structure.getId() == null) continue;
+ computeDepthFromRoot(structure.getId(), structureById, depthMap);
+ }
+
+ // 瀵规瘡涓埗鑺傜偣涓嬬殑瀛愯妭鐐规寜娣卞害鍊掑簭鎺掑簭锛堟渶娣卞眰鐨勪紭鍏堬級
+ for (Map.Entry<Long, List<ProductionBomStructure>> entry : treeMap.entrySet()) {
+ List<ProductionBomStructure> children = entry.getValue();
+ children.sort((a, b) -> {
+ // 浼樺厛鎸夋繁搴︽帓搴忥紝娣卞害澶х殑鎺掑墠闈紙鏈�娣卞眰浼樺厛锛�
+ int depthCompare = Integer.compare(
+ depthMap.getOrDefault(b.getId(), 0),
+ depthMap.getOrDefault(a.getId(), 0));
+ if (depthCompare != 0) {
+ return depthCompare;
+ }
+ // 娣卞害鐩稿悓鏃舵寜ID鎺掑簭淇濊瘉绋冲畾鎬�
+ return Long.compare(a.getId(), b.getId());
+ });
+ }
+
+ return treeMap;
+ }
+
+ /**
+ * 璁$畻鑺傜偣娣卞害锛堜粠鏍硅妭鐐瑰埌褰撳墠鑺傜偣鐨勮窛绂伙級
+ * 鏍硅妭鐐规繁搴︿负1锛屾瘡鍚戜笅涓�灞傛繁搴﹀姞1
+ */
+ private int computeDepthFromRoot(Long nodeId, Map<Long, ProductionBomStructure> structureById, Map<Long, Integer> depthMap) {
+ if (depthMap.containsKey(nodeId)) {
+ return depthMap.get(nodeId);
+ }
+
+ ProductionBomStructure structure = structureById.get(nodeId);
+ if (structure == null) {
+ depthMap.put(nodeId, 1);
+ return 1;
+ }
+
+ Long parentId = structure.getParentId();
+ if (parentId == null || parentId == 0L) {
+ // 鏍硅妭鐐规繁搴︿负1
+ depthMap.put(nodeId, 1);
+ return 1;
+ }
+
+ // 瀛愯妭鐐规繁搴� = 鐖惰妭鐐规繁搴� + 1
+ int parentDepth = computeDepthFromRoot(parentId, structureById, depthMap);
+ int depth = parentDepth + 1;
+ depthMap.put(nodeId, depth);
+ return depth;
+ }
+
+ private void buildOperationListPostOrder(Long parentId,
+ Map<Long, List<ProductionBomStructure>> treeMap,
+ Map<String, ProductionBomStructure> uniqueOperationMap,
+ Map<Long, ProductionBomStructure> structureById,
+ Long rootProductModelId) {
+ List<ProductionBomStructure> children = treeMap.get(parentId);
+ if (children == null || children.isEmpty()) {
+ return;
+ }
+ for (ProductionBomStructure child : children) {
+ // 鍏堥�掑綊澶勭悊瀛愯妭鐐�
+ buildOperationListPostOrder(child.getId(), treeMap, uniqueOperationMap, structureById, rootProductModelId);
+
+ // 鍐嶅鐞嗗綋鍓嶈妭鐐�
+ if (child.getTechnologyOperationId() != null) {
+ Long outputProductModelId = resolveOutputProductModelId(resolveOperationOutputNode(child, structureById), rootProductModelId);
+ String key = buildBomOperationDedupKey(child, outputProductModelId);
+ // 鍘婚噸鏃朵繚鐣欐繁搴︽渶澶х殑鎿嶄綔锛堝悗搴忛亶鍘嗗厛閬囧埌娣卞眰鑺傜偣锛屾墍浠ョ洿鎺ヨ鐩栧嵆鍙級
+ uniqueOperationMap.put(key, child);
+ }
+ }
+ }
+
+ private Map<String, Deque<ProductionOrderRoutingOperation>> buildExistingRoutingOperationBucketMap(List<ProductionOrderRoutingOperation> existingOperationList) {
+ Map<String, Deque<ProductionOrderRoutingOperation>> existingBucketMap = new LinkedHashMap<>();
+ if (existingOperationList == null || existingOperationList.isEmpty()) {
+ return existingBucketMap;
+ }
+ for (ProductionOrderRoutingOperation routingOperation : existingOperationList) {
+ String bucketKey = buildRoutingOperationBucketKey(
+ routingOperation.getTechnologyOperationId(),
+ routingOperation.getProductModelId());
+ existingBucketMap.computeIfAbsent(bucketKey, key -> new ArrayDeque<>()).addLast(routingOperation);
+ }
+ return existingBucketMap;
+ }
+
+ private ProductionOrderRoutingOperation insertRoutingOperationSnapshot(Long orderRoutingId,
+ Long productionOrderId,
+ ProductionOrderRoutingOperation desiredOperation) {
+ ProductionOrderRoutingOperation insert = new ProductionOrderRoutingOperation();
+ insert.setOrderRoutingId(orderRoutingId);
+ insert.setProductionOrderId(productionOrderId);
+ insert.setProductModelId(desiredOperation.getProductModelId());
+ insert.setTechnologyOperationId(desiredOperation.getTechnologyOperationId());
+ insert.setOperationName(desiredOperation.getOperationName());
+ insert.setIsQuality(desiredOperation.getIsQuality());
+ insert.setIsProduction(desiredOperation.getIsProduction());
+ insert.setType(desiredOperation.getType());
+ insert.setDragSort(desiredOperation.getDragSort());
+ productionOrderRoutingOperationMapper.insert(insert);
+ syncRoutingOperationParams(insert.getId(), productionOrderId, insert.getTechnologyOperationId());
+ return insert;
+ }
+
+ private void updateRoutingOperationSnapshotIfNecessary(ProductionOrderRoutingOperation currentOperation,
+ Long orderRoutingId,
+ Long productionOrderId,
+ ProductionOrderRoutingOperation desiredOperation) {
+ if (currentOperation == null || currentOperation.getId() == null) {
+ return;
+ }
+ ProductionOrderRoutingOperation update = new ProductionOrderRoutingOperation();
+ update.setId(currentOperation.getId());
+ boolean changed = false;
+ if (!Objects.equals(currentOperation.getOrderRoutingId(), orderRoutingId)) {
+ update.setOrderRoutingId(orderRoutingId);
+ currentOperation.setOrderRoutingId(orderRoutingId);
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getProductionOrderId(), productionOrderId)) {
+ update.setProductionOrderId(productionOrderId);
+ currentOperation.setProductionOrderId(productionOrderId);
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getProductModelId(), desiredOperation.getProductModelId())) {
+ update.setProductModelId(desiredOperation.getProductModelId());
+ currentOperation.setProductModelId(desiredOperation.getProductModelId());
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getTechnologyOperationId(), desiredOperation.getTechnologyOperationId())) {
+ update.setTechnologyOperationId(desiredOperation.getTechnologyOperationId());
+ currentOperation.setTechnologyOperationId(desiredOperation.getTechnologyOperationId());
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getOperationName(), desiredOperation.getOperationName())) {
+ update.setOperationName(desiredOperation.getOperationName());
+ currentOperation.setOperationName(desiredOperation.getOperationName());
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getIsQuality(), desiredOperation.getIsQuality())) {
+ update.setIsQuality(desiredOperation.getIsQuality());
+ currentOperation.setIsQuality(desiredOperation.getIsQuality());
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getIsProduction(), desiredOperation.getIsProduction())) {
+ update.setIsProduction(desiredOperation.getIsProduction());
+ currentOperation.setIsProduction(desiredOperation.getIsProduction());
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getType(), desiredOperation.getType())) {
+ update.setType(desiredOperation.getType());
+ currentOperation.setType(desiredOperation.getType());
+ changed = true;
+ }
+ if (!Objects.equals(currentOperation.getDragSort(), desiredOperation.getDragSort())) {
+ update.setDragSort(desiredOperation.getDragSort());
+ currentOperation.setDragSort(desiredOperation.getDragSort());
+ changed = true;
+ }
+ if (changed) {
+ productionOrderRoutingOperationMapper.updateById(update);
+ }
+ }
+
+ private void removeRoutingOperationSnapshot(ProductionOrderRoutingOperation routingOperation) {
+ if (routingOperation == null || routingOperation.getId() == null) {
+ return;
+ }
+ ProductionOperationTask task = productionOperationTaskMapper.selectOne(
+ Wrappers.<ProductionOperationTask>lambdaQuery()
+ .eq(ProductionOperationTask::getProductionOrderRoutingOperationId, routingOperation.getId())
+ .last("limit 1"));
+ if (task != null) {
+ validateTaskCanRemove(task);
+ productionOperationTaskMapper.deleteById(task.getId());
+ }
+ productionOrderRoutingOperationParamMapper.delete(
+ Wrappers.<ProductionOrderRoutingOperationParam>lambdaQuery()
+ .eq(ProductionOrderRoutingOperationParam::getProductionOrderRoutingOperationId, routingOperation.getId()));
+ productionOrderRoutingOperationMapper.deleteById(routingOperation.getId());
+ }
+
+ private void syncRoutingOperationTasks(Long productionOrderId, List<ProductionOrderRoutingOperation> routingOperationList) {
+ if (routingOperationList == null || routingOperationList.isEmpty()) {
+ return;
+ }
+ List<Long> routingOperationIdList = routingOperationList.stream()
+ .map(ProductionOrderRoutingOperation::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ if (routingOperationIdList.isEmpty()) {
+ return;
+ }
+ Map<Long, ProductionOperationTask> taskByRoutingOperationId = productionOperationTaskMapper.selectList(
+ Wrappers.<ProductionOperationTask>lambdaQuery()
+ .in(ProductionOperationTask::getProductionOrderRoutingOperationId, routingOperationIdList)
+ .orderByAsc(ProductionOperationTask::getId))
+ .stream()
+ .filter(item -> item != null && item.getProductionOrderRoutingOperationId() != null)
+ .collect(Collectors.toMap(
+ ProductionOperationTask::getProductionOrderRoutingOperationId,
+ item -> item,
+ (left, right) -> left,
+ LinkedHashMap::new));
+ for (int i = 0; i < routingOperationList.size(); i++) {
+ ProductionOrderRoutingOperation routingOperation = routingOperationList.get(i);
+ if (routingOperation == null || routingOperation.getId() == null) {
+ continue;
+ }
+ boolean shouldHaveTask = i == routingOperationList.size() - 1 || Boolean.TRUE.equals(routingOperation.getIsProduction());
+ ProductionOperationTask existingTask = taskByRoutingOperationId.get(routingOperation.getId());
+ if (shouldHaveTask) {
+ if (existingTask == null) {
+ ProductionOperationTask task = new ProductionOperationTask();
+ task.setProductionOrderId(productionOrderId);
+ task.setProductionOrderRoutingOperationId(routingOperation.getId());
+ task.setPlanQuantity(BigDecimal.ZERO);
+ task.setCompleteQuantity(BigDecimal.ZERO);
+ task.setWorkOrderNo(generateNextTaskNo());
+ task.setStatus(2);
+ productionOperationTaskMapper.insert(task);
+ }
+ continue;
+ }
+ if (existingTask != null) {
+ validateTaskCanRemove(existingTask);
+ productionOperationTaskMapper.deleteById(existingTask.getId());
+ }
+ }
+ }
+
+ private void validateTaskCanRemove(ProductionOperationTask task) {
+ if (task == null || task.getId() == null) {
+ return;
+ }
+ if (defaultDecimal(task.getCompleteQuantity()).compareTo(BigDecimal.ZERO) > 0) {
+ throw new ServiceException("宸ュ簭宸蹭骇鐢熸姤宸ヨ褰曪紝鏃犳硶鏍规嵁 BOM 鍙樻洿鍒犻櫎瀵瑰簲宸ュ簭蹇収" + task.getWorkOrderNo());
+ }
+ long reportCount = productionProductMainMapper.selectCount(
+ Wrappers.<ProductionProductMain>lambdaQuery()
+ .eq(ProductionProductMain::getProductionOperationTaskId, task.getId()));
+ if (reportCount > 0) {
+ throw new ServiceException("宸ュ簭宸蹭骇鐢熸姤宸ヨ褰曪紝鏃犳硶鏍规嵁 BOM 鍙樻洿鍒犻櫎瀵瑰簲宸ュ崟");
+ }
+ }
+
+ private void syncRoutingOperationParams(Long routingOperationId, Long productionOrderId, Long technologyOperationId) {
+ if (routingOperationId == null || technologyOperationId == null) {
+ return;
+ }
+ List<TechnologyOperationParam> operationParamList = technologyOperationParamMapper.selectList(
+ Wrappers.<TechnologyOperationParam>lambdaQuery()
+ .eq(TechnologyOperationParam::getTechnologyOperationId, technologyOperationId)
+ .orderByAsc(TechnologyOperationParam::getId));
+ for (TechnologyOperationParam operationParam : operationParamList) {
+ TechnologyParam technologyParam = technologyParamMapper.selectById(operationParam.getTechnologyParamId());
+ if (technologyParam == null) {
+ continue;
+ }
+ ProductionOrderRoutingOperationParam snapshot = new ProductionOrderRoutingOperationParam();
+ snapshot.setProductionOrderId(productionOrderId);
+ snapshot.setProductionOrderRoutingOperationId(routingOperationId);
+ snapshot.setTechnologyOperationId(operationParam.getTechnologyOperationId());
+ snapshot.setTechnologyOperationParamId(operationParam.getId());
+ snapshot.setParamId(technologyParam.getId());
+ snapshot.setParamCode(technologyParam.getParamCode());
+ snapshot.setParamName(technologyParam.getParamName());
+ snapshot.setParamType(technologyParam.getParamType());
+ snapshot.setParamFormat(technologyParam.getParamFormat());
+ snapshot.setUnit(technologyParam.getUnit());
+ snapshot.setIsRequired(technologyParam.getIsRequired());
+ snapshot.setRemark(technologyParam.getRemark());
+ snapshot.setStandardValue(operationParam.getStandardValue());
+ productionOrderRoutingOperationParamMapper.insert(snapshot);
+ }
+ }
+
+ private Map<String, BigDecimal> buildOperationDemandedQuantityMap(List<ProductionBomStructure> structureList,
+ Long rootProductModelId) {
+ if (structureList == null || structureList.isEmpty()) {
+ return Collections.emptyMap();
+ }
+ Map<Long, ProductionBomStructure> structureById = structureList.stream()
+ .filter(item -> item != null && item.getId() != null)
+ .collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left));
+ Map<String, BigDecimal> demandedQuantityMap = new HashMap<>();
+ Set<String> mergedOutputNodeKeySet = new HashSet<>();
+ for (ProductionBomStructure bomStructure : structureList) {
+ if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) {
+ continue;
+ }
+ // Resolve the output node first, then read the output node demand for the task plan quantity.
+ ProductionBomStructure outputNode = resolveOperationOutputNode(bomStructure, structureById);
+ Long outputProductModelId = resolveOutputProductModelId(outputNode, rootProductModelId);
+ if (outputProductModelId == null) {
+ continue;
+ }
+ String mergedOutputNodeKey = buildOperationOutputNodeKey(
+ bomStructure.getTechnologyOperationId(),
+ outputNode == null ? null : outputNode.getId(),
+ outputProductModelId);
+ if (!mergedOutputNodeKeySet.add(mergedOutputNodeKey)) {
+ continue;
+ }
+ // Multiple input rows can point to the same output node, so only count that output demand once.
+ String key = buildOperationDemandedQuantityKey(bomStructure.getTechnologyOperationId(), outputProductModelId);
+ demandedQuantityMap.merge(key, defaultDecimal(outputNode == null ? null : outputNode.getDemandedQuantity()), BigDecimal::add);
+ }
+ return demandedQuantityMap;
+ }
+
+ private BigDecimal resolveTaskPlanQuantity(ProductionOrderRoutingOperation routingOperation,
+ Map<String, BigDecimal> demandedQuantityMap,
+ BigDecimal orderQuantity,
+ Long rootProductModelId) {
+ if (routingOperation == null || demandedQuantityMap == null || demandedQuantityMap.isEmpty()) {
+ return orderQuantity;
+ }
+ Long outputProductModelId = routingOperation.getProductModelId() != null
+ ? routingOperation.getProductModelId()
+ : rootProductModelId;
+ String key = buildOperationDemandedQuantityKey(
+ routingOperation.getTechnologyOperationId(),
+ outputProductModelId);
+ BigDecimal planQuantity = demandedQuantityMap.get(key);
+ return planQuantity != null ? planQuantity : orderQuantity;
+ }
+
+ private String buildOperationDemandedQuantityKey(Long operationId, Long outputProductModelId) {
+ return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId);
+ }
+
+ private String buildRoutingOperationBucketKey(Long operationId, Long outputProductModelId) {
+ return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId);
+ }
+
+ private String buildBomOperationDedupKey(ProductionBomStructure bomStructure, Long outputProductModelId) {
+ Long operationId = bomStructure == null ? null : bomStructure.getTechnologyOperationId();
+ Long parentId = bomStructure == null ? null : bomStructure.getParentId();
+ return operationId + "#" + outputProductModelId + "#" + parentId;
+ }
+
+ private String buildOperationOutputNodeKey(Long operationId, Long outputNodeId, Long outputProductModelId) {
+ return String.valueOf(operationId) + "#" + String.valueOf(outputNodeId) + "#" + String.valueOf(outputProductModelId);
+ }
+
+ private ProductionBomStructure resolveOperationOutputNode(ProductionBomStructure bomStructure,
+ Map<Long, ProductionBomStructure> structureById) {
+ if (bomStructure == null) {
+ return null;
+ }
+ // The root node is the first output node; other rows use their direct parent as the current operation output.
+ if (bomStructure.getParentId() == null) {
+ return bomStructure;
+ }
+ ProductionBomStructure parent = structureById.get(bomStructure.getParentId());
+ return parent != null ? parent : bomStructure;
+ }
+
+ private Long resolveOutputProductModelId(ProductionBomStructure outputNode,
+ Long rootProductModelId) {
+ if (outputNode == null) {
+ return rootProductModelId;
+ }
+ return outputNode.getProductModelId() != null ? outputNode.getProductModelId() : rootProductModelId;
+ }
+
+ private TechnologyOperation getTechnologyOperation(Long technologyOperationId) {
+ if (technologyOperationId == null) {
+ return null;
+ }
+ return technologyOperationMapper.selectById(technologyOperationId);
+ }
+
+ private String generateNextTaskNo() {
+ String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+ ProductionOperationTask latestTask = productionOperationTaskMapper.selectOne(
+ Wrappers.<ProductionOperationTask>lambdaQuery()
+ .likeRight(ProductionOperationTask::getWorkOrderNo, "GD" + datePrefix)
+ .orderByDesc(ProductionOperationTask::getWorkOrderNo)
+ .last("limit 1"));
+ int sequenceNumber = 1;
+ if (latestTask != null && latestTask.getWorkOrderNo() != null && latestTask.getWorkOrderNo().startsWith("GD" + datePrefix)) {
+ try {
+ sequenceNumber = Integer.parseInt(latestTask.getWorkOrderNo().substring(("GD" + datePrefix).length())) + 1;
+ } catch (NumberFormatException ignored) {
+ sequenceNumber = 1;
+ }
+ }
+ return "GD" + String.format("%s%03d", datePrefix, sequenceNumber);
+ }
+
+ private BigDecimal defaultDecimal(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ private int compareDecimal(BigDecimal left, BigDecimal right) {
+ return defaultDecimal(left).compareTo(defaultDecimal(right));
}
/**
* 灏嗘爲褰㈢粨鏋勬媿骞虫垚鍒楄〃锛屼究浜庣粺涓�淇濆瓨銆�
*/
private void flattenTree(List<ProductionBomStructureDto> source, List<ProductionBomStructureDto> result) {
+ // 鎵佸钩鍖栧鐞嗘爲
if (source == null) {
return;
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java
index 383193b..bd6f2df 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOperationTaskServiceImpl.java
@@ -23,9 +23,11 @@
import com.ruoyi.production.bean.dto.ProductionOperationTaskDto;
import com.ruoyi.production.bean.vo.ProductionOperationTaskVo;
import com.ruoyi.production.mapper.ProductionOrderMapper;
+import com.ruoyi.production.mapper.ProductionOrderRoutingOperationMapper;
import com.ruoyi.production.mapper.ProductionOperationTaskMapper;
import com.ruoyi.production.pojo.ProductionOrder;
import com.ruoyi.production.pojo.ProductionOperationTask;
+import com.ruoyi.production.pojo.ProductionOrderRoutingOperation;
import com.ruoyi.production.service.ProductionOperationTaskService;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
@@ -48,6 +50,7 @@
private final SysUserMapper sysUserMapper;
private final ProductionOrderMapper productionOrderMapper;
+ private final ProductionOrderRoutingOperationMapper productionOrderRoutingOperationMapper;
private final FileUtil fileUtil;
@@ -58,26 +61,32 @@
@Override
public IPage<ProductionOperationTaskVo> pageProductionOperationTask(Page<ProductionOperationTaskDto> page, ProductionOperationTaskDto dto) {
+ // 鍒嗛〉鏌ヨ鐢熶骇宸ュ簭浠诲姟
Page<ProductionOperationTaskVo> voPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
IPage<ProductionOperationTaskVo> result = baseMapper.pageProductionOperationTask(voPage, dto);
+ fillOperationTypes(result.getRecords());
fillUserNames(result.getRecords());
return result;
}
@Override
public List<ProductionOperationTaskVo> listProductionOperationTask(ProductionOperationTaskDto dto) {
+ // 鏌ヨ宸ュ簭浠诲姟鍒楄〃
List<ProductionOperationTaskVo> result = BeanUtil.copyToList(this.list(buildQueryWrapper(dto)), ProductionOperationTaskVo.class);
+ fillOperationTypes(result);
fillUserNames(result);
return result;
}
@Override
public ProductionOperationTaskVo getProductionOperationTaskInfo(Long id) {
+ // 鑾峰彇鐢熶骇宸ュ簭浠诲姟璇︽儏
ProductionOperationTask item = this.getById(id);
if (item == null) {
return null;
}
ProductionOperationTaskVo vo = BeanUtil.copyProperties(item, ProductionOperationTaskVo.class);
+ fillOperationTypes(Collections.singletonList(vo));
if (item.getProductionOrderId() != null) {
ProductionOrder productionOrder = productionOrderMapper.selectById(item.getProductionOrderId());
if (productionOrder != null) {
@@ -90,21 +99,25 @@
@Override
public boolean saveProductionOperationTask(ProductionOperationTask productionOperationTask) {
+ // 淇濆瓨鐢熶骇宸ュ簭浠诲姟
return this.saveOrUpdate(productionOperationTask);
}
@Override
public boolean removeProductionOperationTask(List<Long> ids) {
+ // 鍒犻櫎鐢熶骇宸ュ簭浠诲姟
return ids != null && !ids.isEmpty() && this.removeByIds(ids);
}
@Override
public int updateProductWorkOrder(ProductionOperationTaskDto dto) {
+ // 鏇存柊宸ュ簭浠诲姟瀵瑰簲鐨勫伐鍗曚俊鎭�
return baseMapper.updateById(dto);
}
@Override
public boolean assign(ProductionOperationTaskDto dto) {
+ // 鍒嗛厤宸ュ簭浠诲姟鎵ц浜�
if (dto == null || dto.getId() == null) {
throw new ServiceException("宸ュ崟ID涓嶈兘涓虹┖");
}
@@ -120,6 +133,7 @@
}
private LambdaQueryWrapper<ProductionOperationTask> buildQueryWrapper(ProductionOperationTaskDto dto) {
+ // 鎸夋潯浠跺姩鎬佹瀯寤烘暟鎹簱鏌ヨ鏉′欢
ProductionOperationTask query = dto == null ? new ProductionOperationTask() : dto;
return Wrappers.<ProductionOperationTask>lambdaQuery()
.eq(query.getId() != null, ProductionOperationTask::getId, query.getId())
@@ -133,10 +147,12 @@
}
private void fillUserNames(List<ProductionOperationTaskVo> voList) {
+ // 濉厖鐢ㄦ埛鍚嶇О
if (voList == null || voList.isEmpty()) {
return;
}
Set<Long> userIdSet = new LinkedHashSet<>();
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
for (ProductionOperationTaskVo vo : voList) {
if (vo == null) {
continue;
@@ -172,6 +188,7 @@
}
private List<Long> parseUserIdList(String userIds, boolean strict) {
+ // 瑙f瀽骞舵牎楠岀敤鎴稩D鏁扮粍瀛楃涓�
if (StringUtils.isBlank(userIds)) {
if (strict) {
throw new ServiceException("userIds鏍煎紡涓嶆纭紝蹇呴』涓篔SON鏁板瓧鏁扮粍");
@@ -199,6 +216,7 @@
@Override
public void down(HttpServletResponse response, ProductionOperationTaskDto dto) {
+ // 瀵煎嚭宸ュ簭浠诲姟鏁版嵁
if (dto == null || dto.getId() == null) {
throw new ServiceException("宸ュ崟ID涓嶈兘涓虹┖");
}
@@ -250,15 +268,18 @@
}
private List<Map<String, Object>> buildTaskAttachmentImages(Long taskId) {
+ // 缁勮浠诲姟闄勪欢鍥剧墖鏁版嵁鐢ㄤ簬瀵煎嚭
List<Map<String, Object>> images = new ArrayList<>();
StorageAttachmentDTO storageAttachmentDTO = new StorageAttachmentDTO();
storageAttachmentDTO.setRecordType(RecordTypeEnum.PRODUCTION_OPERATION_TASK.getType());
storageAttachmentDTO.setRecordId(taskId);
List<StorageBlobVO> taskWorkOrderFiles =
fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(storageAttachmentDTO);
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (CollectionUtils.isEmpty(taskWorkOrderFiles)) {
return images;
}
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
for (StorageBlobVO blobVO : taskWorkOrderFiles) {
if (blobVO == null) {
continue;
@@ -286,6 +307,7 @@
}
private File resolveImageFile(StorageBlobVO blobVO) {
+ // 灏嗛檮浠朵俊鎭В鏋愪负鏈湴鍥剧墖鏂囦欢瀵硅薄
if (blobVO == null || StringUtils.isBlank(blobVO.getUidFilename())) {
return null;
}
@@ -296,6 +318,7 @@
}
private PictureType resolvePictureType(StorageBlobVO blobVO) {
+ // 鎸夋枃浠跺悕鎴栧唴瀹圭被鍨嬭瘑鍒浘鐗囨牸寮�
if (blobVO == null) {
return null;
}
@@ -311,6 +334,7 @@
}
private PictureType parsePictureTypeByFileName(String fileName) {
+ // 鏍规嵁鏂囦欢鍚庣紑瑙f瀽鍥剧墖鏍煎紡
if (StringUtils.isBlank(fileName) || !fileName.contains(".")) {
return null;
}
@@ -322,6 +346,7 @@
}
private PictureType parsePictureTypeByContentType(String contentType) {
+ // 鏍规嵁Content-Type瑙f瀽鍥剧墖鏍煎紡
if (StringUtils.isBlank(contentType)) {
return null;
}
@@ -350,6 +375,39 @@
@Override
public List<ProductionOperationTaskVo> getOperation(ProductionOperationTaskDto dto) {
- return baseMapper.getOperation(dto);
+ // 鏌ヨ宸ュ簭浠诲姟鍒楄〃
+ List<ProductionOperationTaskVo> result = baseMapper.getOperation(dto);
+ fillOperationTypes(result);
+ return result;
+ }
+
+ private void fillOperationTypes(List<ProductionOperationTaskVo> voList) {
+ // 鍥炲~宸ュ簭绫诲瀷锛�0 璁℃椂 / 1 璁′欢锛�
+ if (voList == null || voList.isEmpty()) {
+ return;
+ }
+ Set<Long> operationIds = voList.stream()
+ .filter(Objects::nonNull)
+ .map(ProductionOperationTaskVo::getProductionOrderRoutingOperationId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toCollection(LinkedHashSet::new));
+ if (operationIds.isEmpty()) {
+ return;
+ }
+ Map<Long, Integer> typeByOperationId = productionOrderRoutingOperationMapper
+ .selectBatchIds(new ArrayList<>(operationIds))
+ .stream()
+ .filter(Objects::nonNull)
+ .collect(Collectors.toMap(
+ ProductionOrderRoutingOperation::getId,
+ ProductionOrderRoutingOperation::getType,
+ (left, right) -> left
+ ));
+ for (ProductionOperationTaskVo vo : voList) {
+ if (vo == null || vo.getType() != null || vo.getProductionOrderRoutingOperationId() == null) {
+ continue;
+ }
+ vo.setType(typeByOperationId.get(vo.getProductionOrderRoutingOperationId()));
+ }
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickRecordServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickRecordServiceImpl.java
index 1cf7c1e..4b71eb3 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickRecordServiceImpl.java
@@ -24,6 +24,7 @@
@Override
public List<ProductionOrderPickRecordVo> listFeedingRecord(ProductionOrderPickRecordDto dto) {
+ // 鏌ヨ鎶曟枡璁板綍
if (dto == null || dto.getProductionOrderId() == null || dto.getPickId() == null) {
return Collections.emptyList();
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
index f45c117..554b95e 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
@@ -3,7 +3,9 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.enums.ReviewStatusEnum;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.production.bean.dto.ProductionOrderPickDto;
@@ -18,8 +20,12 @@
import com.ruoyi.production.service.ProductionOrderPickService;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.mapper.StockInventoryMapper;
+import com.ruoyi.stock.pojo.StockInRecord;
import com.ruoyi.stock.pojo.StockInventory;
+import com.ruoyi.stock.pojo.StockOutRecord;
import com.ruoyi.stock.service.StockInventoryService;
+import com.ruoyi.stock.service.StockInRecordService;
+import com.ruoyi.stock.service.StockOutRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -30,12 +36,8 @@
import java.util.stream.Collectors;
/**
- * <p>
- * 鐠併垹宕熸0鍡樻灐缁捐儻绔熸禒?閺堝秴濮熺�圭偟骞囩猾?
- * </p>
- *
- * @author 閼侯垰顕辨潪顖欐閿涘牊鐫欓懟蹇ョ礆閺堝妾洪崗顒�寰�
- * @since 2026-04-21 03:55:52
+ * 鐢熶骇璁㈠崟棰嗘枡鏈嶅姟瀹炵幇銆�
+ * 璐熻矗棰嗘枡鏂板銆佹洿鏂般�佽ˉ鏂欍�侀��鏂欏強搴撳瓨鑱斿姩銆�
*/
@Service
@RequiredArgsConstructor
@@ -43,27 +45,42 @@
private static final byte PICK_TYPE_NORMAL = 1;
private static final byte PICK_TYPE_FEEDING = 2;
+ private static final String PICK_STOCK_OUT_RECORD_TYPE = StockOutQualifiedRecordTypeEnum.PICK_STOCK_OUT.getCode();
+ private static final String FEED_STOCK_OUT_RECORD_TYPE = StockOutQualifiedRecordTypeEnum.FEED_STOCK_OUT.getCode();
+ private static final String PICK_RETURN_IN_RECORD_TYPE = StockInQualifiedRecordTypeEnum.PICK_RETURN_IN.getCode();
+ private static final String FEED_RETURN_IN_RECORD_TYPE = StockInQualifiedRecordTypeEnum.FEED_RETURN_IN.getCode();
private final ProductionOrderMapper productionOrderMapper;
private final ProductionOperationTaskMapper productionOperationTaskMapper;
private final ProductionOrderPickRecordMapper productionOrderPickRecordMapper;
private final StockInventoryMapper stockInventoryMapper;
private final StockInventoryService stockInventoryService;
+ private final StockInRecordService stockInRecordService;
+ private final StockOutRecordService stockOutRecordService;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean savePick(ProductionOrderPickDto dto) {
+ // 棰嗘枡鏂板鎬绘祦绋嬶細
+ // 1) 瑙f瀽鍓嶇琛屾暟鎹苟閫愯鍚堝苟鍙傛暟锛�
+ // 2) 鏍¢獙鍙傛暟涓庢壒娆★紱
+ // 3) 鍏堜繚瀛橀鏂欎富璁板綍锛�
+ // 4) 鍐嶈蛋鈥滃嚭搴撶敵璇� + 瀹℃壒閫氳繃鈥濆畬鎴愬簱瀛樻墸鍑忥紱
+ // 5) 鍐欏叆棰嗘枡娴佹按锛岃褰曟暟閲忓彉鍖栬建杩广��
List<ProductionOrderPickDto> pickItems = resolvePickItems(dto);
+ // 閫愯澶勭悊棰嗘枡鏁版嵁锛岃鍙风敤浜庢嫾瑁呯簿纭殑鎶ラ敊淇℃伅銆�
for (int i = 0; i < pickItems.size(); i++) {
int rowNo = i + 1;
ProductionOrderPickDto resolvedDto = mergeDto(dto, pickItems.get(i));
+ // 姣忚閮藉仛瀹屾暣鏍¢獙锛屽紓甯镐俊鎭甫琛屽彿銆�
validatePickParam(resolvedDto, rowNo);
+ // 缁熶竴澶勭悊鎵规锛堟敮鎸佸崟鎵规/澶氭壒娆★級銆�
List<String> batchNoList = resolveBatchNoList(resolvedDto);
String inventoryBatchNo = pickInventoryBatchNo(batchNoList);
String storedBatchNo = formatBatchNoStorage(batchNoList);
- subtractInventory(resolvedDto.getProductModelId(), storedBatchNo, resolvedDto.getPickQuantity(), rowNo);
+ // 淇濆瓨棰嗘枡涓昏褰曞揩鐓с��
ProductionOrderPick orderPick = new ProductionOrderPick();
orderPick.setProductionOrderId(resolvedDto.getProductionOrderId());
orderPick.setProductModelId(resolvedDto.getProductModelId());
@@ -75,8 +92,13 @@
orderPick.setDemandedQuantity(resolvedDto.getDemandedQuantity());
orderPick.setBom(resolvedDto.getBom());
orderPick.setReturned(false);
+ // 鏂板涓昏褰曘��
baseMapper.insert(orderPick);
+ // 鍏堟柊澧炲嚭搴撶敵璇凤紝鍐嶅鎵归�氳繃锛屽畬鎴愬簱瀛樻墸鍑忋��
+ subtractInventory(orderPick.getId(), resolvedDto.getProductModelId(), storedBatchNo, resolvedDto.getPickQuantity(), rowNo, PICK_STOCK_OUT_RECORD_TYPE);
+
+ // 璁板綍鏈棰嗘枡娴佹按锛坆efore=0锛宎fter=鏈棰嗘枡閲忥級銆�
insertPickRecord(orderPick.getId(),
resolvedDto.getProductionOrderId(),
resolvedDto.getProductionOperationTaskId(),
@@ -95,8 +117,12 @@
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updatePick(ProductionOrderPickDto dto) {
+ // 棰嗘枡鏇存柊鍏ュ彛锛堝悓鎺ュ彛鍏煎涓夌被涓氬姟锛夛細
+ // 1) 鏅�氶鏂欐敼閲�/澧炲垹锛�
+ // 2) 琛ユ枡锛坧ickType=2锛夛紱
+ // 3) 閫�鏂欙紙returned=true锛夈��
if (dto == null) {
- throw new ServiceException("鍙樻洿鍙傛暟涓嶈兘涓虹┖");
+ throw new ServiceException("鍙傛暟涓嶈兘涓虹┖");
}
Long productionOrderId = resolveProductionOrderId(dto);
if (productionOrderId == null) {
@@ -107,26 +133,32 @@
throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
}
+ // 鏌ヨ璁㈠崟涓嬬幇鏈夐鏂欒褰曞苟鏋勫缓ID绱㈠紩銆�
List<ProductionOrderPick> existingPickList = baseMapper.selectList(
Wrappers.<ProductionOrderPick>lambdaQuery()
.eq(ProductionOrderPick::getProductionOrderId, productionOrderId));
+ // 杞垚Map渚夸簬鍚庣画鎸塈D蹇�熸牎楠屼笌鏇存柊銆�
Map<Long, ProductionOrderPick> existingPickMap = existingPickList.stream()
.filter(item -> item.getId() != null)
.collect(Collectors.toMap(ProductionOrderPick::getId, Function.identity(), (a, b) -> a));
+ // 琛ユ枡璇锋眰鍗曠嫭璧拌ˉ鏂欏垎鏀��
if (isFeedingRequest(dto)) {
processFeedingPickItems(dto, existingPickMap, productionOrderId);
return true;
}
+ // 閫�鏂欒姹傚崟鐙蛋閫�鏂欏垎鏀��
if (isReturnRequest(dto)) {
processReturnPickItems(dto, existingPickMap, productionOrderId);
return true;
}
+ // 鏅�氭洿鏂板満鏅厛澶勭悊鏄惧紡鍒犻櫎銆�
processDeletePickIds(dto, existingPickMap, productionOrderId);
List<ProductionOrderPickDto> pickItems = resolveUpdateItems(dto);
Set<Long> keepPickIdSet = new HashSet<>();
+ // keepPickIdSet 鐢ㄤ簬鏍囪鏈鍓嶇浠嶇劧淇濈暀鐨勬棫璁板綍锛屽悗缁敤浜庤瘑鍒�滄湭鍥炰紶鍗冲垹闄も�濈殑琛屻��
for (int i = 0; i < pickItems.size(); i++) {
int rowNo = i + 1;
ProductionOrderPickDto resolvedDto = mergeDto(dto, pickItems.get(i));
@@ -145,12 +177,14 @@
keepPickIdSet.add(resolvedDto.getId());
updateExistingPick(resolvedDto, rowNo, existingPickMap);
}
+ // 娓呯悊鍓嶇鏈洖浼犳棫琛屽苟鍥炶ˉ搴撳瓨銆�
processMissingPickItems(dto, existingPickMap, productionOrderId, keepPickIdSet);
return true;
}
@Override
public List<ProductionOrderPickVo> listPickedDetail(Long productionOrderId) {
+ // 鏌ヨ璁㈠崟棰嗘枡鏄庣粏锛屽苟琛ラ綈鎵规灞曠ず瀛楁銆�
if (productionOrderId == null) {
return Collections.emptyList();
}
@@ -163,6 +197,11 @@
private void processDeletePickIds(ProductionOrderPickDto rootDto,
Map<Long, ProductionOrderPick> existingPickMap,
Long productionOrderId) {
+ // 澶勭悊鍓嶇鏄惧紡鍒犻櫎ID锛�
+ // 1) 鏍¢獙鍒犻櫎鐩爣鏄惁灞炰簬褰撳墠璁㈠崟锛�
+ // 2) 鍥炶ˉ搴撳瓨锛�
+ // 3) 鍒犻櫎涓昏褰曪紱
+ // 4) 璁板綍鍒犻櫎娴佹按銆�
if (rootDto.getDeletePickIds() == null || rootDto.getDeletePickIds().isEmpty()) {
return;
}
@@ -173,14 +212,19 @@
}
ProductionOrderPick existingPick = existingPickMap.get(deleteId);
if (existingPick == null || !Objects.equals(existingPick.getProductionOrderId(), productionOrderId)) {
- throw new ServiceException("瑕佸垹闄ょ殑棰嗘枡璁板綍涓嶅瓨鍦ㄦ垨涓嶅睘浜庡綋鍓嶈鍗曪紝ID=" + deleteId);
+ throw new ServiceException("鍒犻櫎澶辫触锛氶鏂欒褰曚笉瀛樺湪鎴栦笉灞炰簬褰撳墠璁㈠崟锛孖D=" + deleteId);
}
String oldBatchNo = resolveInventoryBatchNoFromStored(existingPick.getBatchNo());
BigDecimal oldQuantity = defaultDecimal(existingPick.getQuantity());
- addInventory(existingPick.getProductModelId(), oldBatchNo, oldQuantity);
+ addInventory(existingPick.getId(), existingPick.getProductModelId(), oldBatchNo, oldQuantity, PICK_RETURN_IN_RECORD_TYPE);
+ // 鍒犻櫎鍏宠仈棰嗘枡娴佹按锛岄伩鍏嶉仐鐣欐棤涓昏褰曘��
+ productionOrderPickRecordMapper.delete(
+ Wrappers.<ProductionOrderPickRecord>lambdaQuery()
+ .eq(ProductionOrderPickRecord::getPickId, existingPick.getId())
+ );
int affected = baseMapper.deleteById(deleteId);
if (affected <= 0) {
- throw new ServiceException("鍒犻櫎棰嗘枡澶辫触锛孖D=" + deleteId);
+ throw new ServiceException("鍒犻櫎棰嗘枡璁板綍澶辫触锛孖D=" + deleteId);
}
insertPickRecord(existingPick.getId(),
existingPick.getProductionOrderId(),
@@ -201,6 +245,9 @@
Map<Long, ProductionOrderPick> existingPickMap,
Long productionOrderId,
Set<Long> keepPickIdSet) {
+ // 澶勭悊鈥滃墠绔湭鍥炰紶鈥濈殑鏃ц锛�
+ // 瀵瑰簲鍦烘櫙鏄敤鎴峰湪鍓嶇鍒犻櫎琛屼絾鏈斁鍏� deletePickIds銆�
+ // 杩欓噷鍏滃簳璇嗗埆骞舵墽琛屽洖琛ュ簱瀛� + 鍒犻櫎涓昏褰� + 鍐欐祦姘淬��
if (rootDto.getPickList() == null) {
return;
}
@@ -213,10 +260,15 @@
for (ProductionOrderPick missingPick : missingPickList) {
String oldBatchNo = resolveInventoryBatchNoFromStored(missingPick.getBatchNo());
BigDecimal oldQuantity = defaultDecimal(missingPick.getQuantity());
- addInventory(missingPick.getProductModelId(), oldBatchNo, oldQuantity);
+ addInventory(missingPick.getId(), missingPick.getProductModelId(), oldBatchNo, oldQuantity, PICK_RETURN_IN_RECORD_TYPE);
+ // 鍒犻櫎鍏宠仈棰嗘枡娴佹按锛岄伩鍏嶉仐鐣欐棤涓昏褰曘��
+ productionOrderPickRecordMapper.delete(
+ Wrappers.<ProductionOrderPickRecord>lambdaQuery()
+ .eq(ProductionOrderPickRecord::getPickId, missingPick.getId())
+ );
int affected = baseMapper.deleteById(missingPick.getId());
if (affected <= 0) {
- throw new ServiceException("鍒犻櫎棰嗘枡澶辫触锛孖D=" + missingPick.getId());
+ throw new ServiceException("鍒犻櫎鏈洖浼犻鏂欒褰曞け璐ワ紝ID=" + missingPick.getId());
}
insertPickRecord(missingPick.getId(),
missingPick.getProductionOrderId(),
@@ -234,10 +286,11 @@
}
private void addNewPickInUpdate(ProductionOrderPickDto dto, int rowNo) {
+ // 鏇存柊鍦烘櫙涓嬫柊澧炰竴鏉¢鏂欙細
+ // 鏂板涓昏褰� -> 鍑哄簱鐢宠骞跺鎵� -> 鍐欐祦姘淬��
List<String> batchNoList = resolveBatchNoList(dto);
String inventoryBatchNo = pickInventoryBatchNo(batchNoList);
String storedBatchNo = formatBatchNoStorage(batchNoList);
- subtractInventory(dto.getProductModelId(), storedBatchNo, dto.getPickQuantity(), rowNo);
ProductionOrderPick orderPick = new ProductionOrderPick();
orderPick.setProductionOrderId(dto.getProductionOrderId());
@@ -251,6 +304,9 @@
orderPick.setBom(dto.getBom());
orderPick.setReturned(false);
baseMapper.insert(orderPick);
+
+ // 鍏堟柊澧炲嚭搴撶敵璇凤紝鍐嶅鎵归�氳繃锛屽畬鎴愬簱瀛樻墸鍑忋��
+ subtractInventory(orderPick.getId(), dto.getProductModelId(), storedBatchNo, dto.getPickQuantity(), rowNo, PICK_STOCK_OUT_RECORD_TYPE);
insertPickRecord(orderPick.getId(),
dto.getProductionOrderId(),
@@ -268,6 +324,8 @@
private void processFeedingPickItems(ProductionOrderPickDto rootDto,
Map<Long, ProductionOrderPick> existingPickMap,
Long productionOrderId) {
+ // 琛ユ枡娴佺▼鍏ュ彛锛�
+ // 閫愯鏍¢獙琛ユ枡鍙傛暟锛屾牎楠屽師棰嗘枡褰掑睘锛屽啀鎵ц琛ユ枡搴撳瓨鎵e噺鍜屼富璁板綍鍥炲啓銆�
List<ProductionOrderPickDto> pickItems = resolveUpdateItems(rootDto);
for (int i = 0; i < pickItems.size(); i++) {
int rowNo = i + 1;
@@ -276,7 +334,7 @@
continue;
}
if (!isFeedingPick(resolvedDto)) {
- throw new ServiceException("琛ユ枡璇锋眰涓殑棰嗘枡绫诲瀷蹇呴』鍏ㄩ儴涓�2");
+ throw new ServiceException("琛ユ枡璇锋眰涓瓨鍦ㄩ潪琛ユ枡绫诲瀷鏁版嵁");
}
if (resolvedDto.getProductionOrderId() == null) {
resolvedDto.setProductionOrderId(productionOrderId);
@@ -285,15 +343,20 @@
ProductionOrderPick oldPick = existingPickMap.get(resolvedDto.getId());
if (oldPick == null || !Objects.equals(oldPick.getProductionOrderId(), productionOrderId)) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欒褰曚笉瀛樺湪鎴栦笉灞炰簬褰撳墠璁㈠崟");
+ throw new ServiceException("绗�" + rowNo + "琛岃ˉ鏂欏け璐ワ細鏈壘鍒板搴旂殑棰嗘枡璁板綍");
}
addFeedingPick(resolvedDto, oldPick, rowNo);
}
}
private void addFeedingPick(ProductionOrderPickDto dto, ProductionOrderPick oldPick, int rowNo) {
+ // 琛ユ枡鏍稿績锛�
+ // 1) 鏍¢獙瑙勬牸涓�鑷达紱
+ // 2) 鎵e噺琛ユ枡搴撳瓨锛�
+ // 3) 鍐欒ˉ鏂欐祦姘达紱
+ // 4) 鍥炲啓涓诲崟绱琛ユ枡閲忓拰瀹為檯閲忋��
if (dto.getProductModelId() != null && !Objects.equals(dto.getProductModelId(), oldPick.getProductModelId())) {
- throw new ServiceException("绗�" + rowNo + "鏉¤ˉ鏂欎骇鍝佽鏍间笌棰嗘枡璁板綍涓嶄竴鑷�");
+ throw new ServiceException("绗�" + rowNo + "琛岃ˉ鏂欏け璐ワ細浜у搧瑙勬牸涓庡師棰嗘枡璁板綍涓嶄竴鑷�");
}
Long productModelId = oldPick.getProductModelId();
List<String> batchNoList = resolveBatchNoList(dto);
@@ -302,8 +365,9 @@
: formatBatchNoStorage(batchNoList);
BigDecimal feedingQuantity = dto.getFeedingQuantity();
- subtractInventory(productModelId, inventoryBatchNo, feedingQuantity, rowNo);
+ subtractInventory(oldPick.getId(), productModelId, inventoryBatchNo, feedingQuantity, rowNo, FEED_STOCK_OUT_RECORD_TYPE);
+ // 璁$畻琛ユ枡鍓嶅悗鏁伴噺骞跺啓琛ユ枡娴佹按銆�
BigDecimal beforeFeedingQty = sumFeedingQuantity(dto.getProductionOrderId(), oldPick.getId());
BigDecimal afterFeedingQty = beforeFeedingQty.add(feedingQuantity);
insertPickRecord(oldPick.getId(),
@@ -322,9 +386,10 @@
updatePick.setId(oldPick.getId());
updatePick.setFeedingQty(afterFeedingQty);
updatePick.setActualQty(calculateActualQty(oldPick, afterFeedingQty));
+ // 鍥炲啓涓昏褰曠殑琛ユ枡绱鍊间笌瀹為檯鐢ㄩ噺銆�
int affected = baseMapper.updateById(updatePick);
if (affected <= 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¤ˉ鏂欐�婚噺鏇存柊澶辫触");
+ throw new ServiceException("绗�" + rowNo + "琛岃ˉ鏂欏け璐ワ細鏇存柊棰嗘枡涓昏褰曞け璐�");
}
oldPick.setFeedingQty(afterFeedingQty);
oldPick.setActualQty(updatePick.getActualQty());
@@ -333,6 +398,8 @@
private void processReturnPickItems(ProductionOrderPickDto rootDto,
Map<Long, ProductionOrderPick> existingPickMap,
Long productionOrderId) {
+ // 閫�鏂欐祦绋嬪叆鍙o細
+ // 閫愯鏍¢獙閫�鏂欏弬鏁颁笌棰嗘枡褰掑睘锛屽啀鏇存柊閫�鏂欓噺涓庡疄闄呴噺瀛楁銆�
List<ProductionOrderPickDto> pickItems = resolveUpdateItems(rootDto);
for (int i = 0; i < pickItems.size(); i++) {
int rowNo = i + 1;
@@ -347,33 +414,56 @@
ProductionOrderPick oldPick = existingPickMap.get(resolvedDto.getId());
if (oldPick == null || !Objects.equals(oldPick.getProductionOrderId(), productionOrderId)) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欒褰曚笉瀛樺湪鎴栦笉灞炰簬褰撳墠璁㈠崟");
+ throw new ServiceException("绗�" + rowNo + "琛岄��鏂欏け璐ワ細鏈壘鍒板搴旂殑棰嗘枡璁板綍");
}
updateReturnPick(resolvedDto, oldPick, rowNo);
}
}
private void updateReturnPick(ProductionOrderPickDto dto, ProductionOrderPick oldPick, int rowNo) {
+ // 閫�鏂欐洿鏂帮細
+ // 1) returnQty 鎸夆�滄湰娆¢��鏂欓噺鈥濆鐞嗭紱
+ // 2) 鏈閫�鏂欓噺鍥炶ˉ鍒扳�滅敓浜ч��鏂欏叆搴撯�濓紱
+ // 3) 绱姞涓昏褰曢��鏂欐�婚噺骞堕噸绠楀疄闄呴噺銆�
+ BigDecimal oldReturnQty = defaultDecimal(oldPick.getReturnQty());
+ BigDecimal currentReturnQty = defaultDecimal(dto.getReturnQty());
+ BigDecimal totalReturnQty = oldReturnQty.add(currentReturnQty);
+ if (currentReturnQty.compareTo(BigDecimal.ZERO) > 0) {
+ String returnBatchNo = resolveInventoryBatchNoFromStored(oldPick.getBatchNo());
+ addInventoryRecordOnly(oldPick.getId(), oldPick.getProductModelId(), returnBatchNo, currentReturnQty, FEED_RETURN_IN_RECORD_TYPE);
+ }
+
+ BigDecimal actualQty = defaultDecimal(oldPick.getQuantity())
+ .add(defaultDecimal(oldPick.getFeedingQty()))
+ .subtract(totalReturnQty);
+ if (actualQty.compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("绗�" + rowNo + "琛岄��鏂欏け璐ワ細绱閫�鏂欐暟閲忎笉鑳藉ぇ浜庡彲鐢ㄦ暟閲�");
+ }
ProductionOrderPick updatePick = new ProductionOrderPick();
updatePick.setId(oldPick.getId());
- updatePick.setReturnQty(dto.getReturnQty());
- updatePick.setActualQty(dto.getActualQty());
- updatePick.setReturned(true);
+ updatePick.setReturnQty(totalReturnQty);
+ updatePick.setActualQty(actualQty);
+ updatePick.setReturned(totalReturnQty.compareTo(BigDecimal.ZERO) > 0);
int affected = baseMapper.updateById(updatePick);
if (affected <= 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¢��鏂欎俊鎭洿鏂板け璐�");
+ throw new ServiceException("绗�" + rowNo + "琛岄��鏂欏け璐ワ細鏇存柊棰嗘枡涓昏褰曞け璐�");
}
oldPick.setReturnQty(updatePick.getReturnQty());
oldPick.setActualQty(updatePick.getActualQty());
- oldPick.setReturned(true);
+ oldPick.setReturned(updatePick.getReturned());
}
private void updateExistingPick(ProductionOrderPickDto dto,
int rowNo,
Map<Long, ProductionOrderPick> existingPickMap) {
+ // 鏅�氭洿鏂板崟琛屾牳蹇冩祦绋嬶細
+ // 1) 鏍¢獙鏃ц褰曞瓨鍦ㄤ笖灞炰簬褰撳墠璁㈠崟锛�
+ // 2) 姣旇緝鏂版棫鈥滆鏍�+鎵规鈥濓紝鍐冲畾搴撳瓨澶勭悊绛栫暐锛�
+ // 3) 鏇存柊涓昏褰曪紱
+ // 4) 鍐欏彉鏇存祦姘达紙璁板綍鍓嶅悗鏁伴噺鍙樺寲锛夈��
ProductionOrderPick oldPick = existingPickMap.get(dto.getId());
if (oldPick == null || !Objects.equals(oldPick.getProductionOrderId(), dto.getProductionOrderId())) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欒褰曚笉瀛樺湪鎴栦笉灞炰簬褰撳墠璁㈠崟");
+ throw new ServiceException("绗�" + rowNo + "琛屾洿鏂板け璐ワ細鏈壘鍒板搴旂殑棰嗘枡璁板綍");
}
Long oldProductModelId = oldPick.getProductModelId();
@@ -386,18 +476,30 @@
String newStoredBatchNo = formatBatchNoStorage(newBatchNoList);
BigDecimal newQuantity = dto.getPickQuantity();
+ // 鍒ゆ柇瑙勬牸+鎵规鎴栨暟閲忔槸鍚﹀彉鍖栵紝骞舵寜鍦烘櫙澶勭悊搴撳瓨锛�
+ // 1) 鍚岃鏍煎悓鎵规锛氭寜宸�煎鐞嗭紙澧為噺鎵e噺 / 鍑忛噺鍥為��锛夛紱
+ // 2) 瑙勬牸鎴栨壒娆″彉鍖栵細鍥為��鏃ч鏂欏悗鍐嶉噸鎻愭柊棰嗘枡銆�
boolean sameStockKey = Objects.equals(oldProductModelId, newProductModelId)
&& Objects.equals(oldBatchNo, newBatchNo);
+ boolean quantityChanged = oldQuantity.compareTo(newQuantity) != 0;
+ boolean needReissuePickRecord = !sameStockKey || quantityChanged;
if (sameStockKey) {
- BigDecimal delta = newQuantity.subtract(oldQuantity);
- if (delta.compareTo(BigDecimal.ZERO) > 0) {
- subtractInventory(newProductModelId, newStoredBatchNo, delta, rowNo);
- } else if (delta.compareTo(BigDecimal.ZERO) < 0) {
- addInventory(oldProductModelId, oldBatchNo, delta.abs());
+ BigDecimal deltaQuantity = newQuantity.subtract(oldQuantity);
+ if (deltaQuantity.compareTo(BigDecimal.ZERO) > 0) {
+ // 鏁伴噺澧炲姞锛屽彧鎵e噺鏂板閮ㄥ垎銆�
+ subtractInventory(oldPick.getId(), newProductModelId, newStoredBatchNo, deltaQuantity, rowNo, PICK_STOCK_OUT_RECORD_TYPE);
+ } else if (deltaQuantity.compareTo(BigDecimal.ZERO) < 0) {
+ // 鏁伴噺鍑忓皯锛屽彧鍥為��宸�奸儴鍒嗐��
+ addInventory(oldPick.getId(), oldProductModelId, oldBatchNo, deltaQuantity.abs(), PICK_RETURN_IN_RECORD_TYPE);
}
} else {
- addInventory(oldProductModelId, oldBatchNo, oldQuantity);
- subtractInventory(newProductModelId, newStoredBatchNo, newQuantity, rowNo);
+ // 瑙勬牸鎴栨壒娆″彉鍖栵細鍏堝叏閲忓洖閫�鏃ч鏂欙紝鍐嶅叏閲忔墸鍑忔柊棰嗘枡銆�
+ addInventory(oldPick.getId(), oldProductModelId, oldBatchNo, oldQuantity, PICK_RETURN_IN_RECORD_TYPE);
+ subtractInventory(oldPick.getId(), newProductModelId, newStoredBatchNo, newQuantity, rowNo, PICK_STOCK_OUT_RECORD_TYPE);
+ }
+ if (needReissuePickRecord) {
+ // 姝e父棰嗘枡娴佹按鎸夆�滄渶鏂伴鏂欓噺鈥濋噸寤猴紝閬垮厤淇濈暀鍘嗗彶鏃у�笺��
+ deleteNormalPickRecord(oldPick.getId());
}
oldPick.setProductModelId(newProductModelId);
@@ -406,6 +508,9 @@
oldPick.setRemark(dto.getRemark());
oldPick.setOperationName(dto.getOperationName());
oldPick.setTechnologyOperationId(dto.getTechnologyOperationId());
+ // 鏅�氭洿鏂颁篃瑕佸悓姝ラ噸绠楀疄闄呯敤閲忥紝閬垮厤娌跨敤鏃у�笺��
+ // 瑙勫垯锛氬疄闄呯敤閲� = 棰嗘枡鏁伴噺 + 琛ユ枡鏁伴噺 - 閫�鏂欐暟閲忋��
+ oldPick.setActualQty(calculateActualQty(oldPick, oldPick.getFeedingQty()));
if (dto.getDemandedQuantity() != null) {
oldPick.setDemandedQuantity(dto.getDemandedQuantity());
}
@@ -414,18 +519,18 @@
}
int affected = baseMapper.updateById(oldPick);
if (affected <= 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欐洿鏂板け璐�");
+ throw new ServiceException("绗�" + rowNo + "琛屾洿鏂板け璐ワ細鏇存柊棰嗘枡璁板綍澶辫触");
}
- BigDecimal recordQuantity = sameStockKey ? oldQuantity.subtract(newQuantity).abs() : newQuantity;
- if (recordQuantity.compareTo(BigDecimal.ZERO) > 0 || oldQuantity.compareTo(newQuantity) != 0 || !sameStockKey) {
+ // 濡傛灉鍙戠敓棰嗘枡閲嶆彁锛岃ˉ鍐欎竴鏉℃柊鐨勬甯搁鏂欐祦姘淬��
+ if (needReissuePickRecord) {
insertPickRecord(oldPick.getId(),
dto.getProductionOrderId(),
dto.getProductionOperationTaskId(),
newProductModelId,
newBatchNo,
- recordQuantity,
- oldQuantity,
+ newQuantity,
+ BigDecimal.ZERO,
newQuantity,
dto.getPickType(),
dto.getRemark(),
@@ -444,6 +549,7 @@
Byte pickType,
String remark,
String feedingReason) {
+ // 鍐欓鏂欐祦姘磋褰曪細缁熶竴璁板綍棰嗘枡/琛ユ枡/閫�鏂欐暟閲忓彉鍖栬建杩广��
ProductionOrderPickRecord pickRecord = new ProductionOrderPickRecord();
pickRecord.setPickId(pickId);
pickRecord.setProductionOrderId(productionOrderId);
@@ -459,8 +565,31 @@
productionOrderPickRecordMapper.insert(pickRecord);
}
- private void subtractInventory(Long productModelId, String batchNo, BigDecimal quantity, int rowNo) {
+ private void deleteNormalPickRecord(Long pickId) {
+ // 鍒犻櫎璇ラ鏂欏崟鍘嗗彶涓婄殑鈥滄甯搁鏂欌�濇祦姘达紝淇濈暀琛ユ枡/閫�鏂欐祦姘淬��
+ if (pickId == null) {
+ return;
+ }
+ productionOrderPickRecordMapper.delete(
+ Wrappers.<ProductionOrderPickRecord>lambdaQuery()
+ .eq(ProductionOrderPickRecord::getPickId, pickId)
+ .eq(ProductionOrderPickRecord::getPickType, PICK_TYPE_NORMAL)
+ );
+ }
+
+ private void subtractInventory(Long recordId,
+ Long productModelId,
+ String batchNo,
+ BigDecimal quantity,
+ int rowNo,
+ String stockOutRecordType) {
+ // 鎵e噺搴撳瓨鎬绘祦绋嬶細
+ // 1) 瑙f瀽鎵规鍒楄〃锛�
+ // 2) 璁$畻姣忎釜鎵规鍙敤閲忎笌鎬诲彲鐢ㄩ噺锛�
+ // 3) 鎸夋壒娆¢『搴忛�愮瑪鈥滄柊澧炲嚭搴撹褰曞苟瀹℃壒閫氳繃鈥濓紝鐩村埌鎵e畬鐩爣鏁伴噺锛�
+ // 4) 浠讳竴姝ュけ璐ュ嵆鎶涢敊骞跺洖婊氫簨鍔°��
BigDecimal deductQuantity = defaultDecimal(quantity);
+ // 棰嗘枡鏁伴噺灏忎簬绛変簬0鏃讹紝涓嶉渶瑕佹墽琛屽簱瀛樻墸鍑忋��
if (deductQuantity.compareTo(BigDecimal.ZERO) <= 0) {
return;
}
@@ -470,9 +599,12 @@
batchNoList = Collections.singletonList(null);
}
+ // 鍏堣绠楀悇鎵规鍙敤閲忥紝閬垮厤杈规墸杈圭畻瀵艰嚧鍒ゆ柇涓嶄竴鑷淬��
Map<String, BigDecimal> availableQuantityMap = new LinkedHashMap<>();
BigDecimal totalAvailableQuantity = BigDecimal.ZERO;
+ // 閬嶅巻鎵规锛岃绠楁瘡涓壒娆″彲鐢ㄥ簱瀛樸��
for (String currentBatchNo : batchNoList) {
+ // 鏌ヨ褰撳墠瑙勬牸+鎵规鐨勫簱瀛樿褰曘��
StockInventory stockInventory = stockInventoryMapper.selectOne(buildStockWrapper(productModelId, currentBatchNo));
BigDecimal availableQuantity = BigDecimal.ZERO;
if (stockInventory != null) {
@@ -488,10 +620,11 @@
if (deductQuantity.compareTo(totalAvailableQuantity) > 0) {
BigDecimal shortQuantity = deductQuantity.subtract(totalAvailableQuantity);
- throw new ServiceException("棰嗘枡鍙敤搴撳瓨涓嶈冻锛屽彲鐢ㄥ簱瀛樹负" + formatQuantity(totalAvailableQuantity)
- + "锛岃繕宸�" + formatQuantity(shortQuantity));
+ throw new ServiceException("绗�" + rowNo + "琛屾墸鍑忓簱瀛樺け璐ワ細鍙敤搴撳瓨涓嶈冻锛屽綋鍓嶅彲鐢�"
+ + formatQuantity(totalAvailableQuantity) + "锛屼粛缂哄皯" + formatQuantity(shortQuantity));
}
+ // 鎸夋壒娆¢『搴忛�愮瑪鎵e噺搴撳瓨銆�
BigDecimal remainingQuantity = deductQuantity;
for (Map.Entry<String, BigDecimal> entry : availableQuantityMap.entrySet()) {
if (remainingQuantity.compareTo(BigDecimal.ZERO) <= 0) {
@@ -502,39 +635,137 @@
continue;
}
BigDecimal currentDeductQuantity = remainingQuantity.min(availableQuantity);
- StockInventoryDto stockInventoryDto = new StockInventoryDto();
- stockInventoryDto.setProductModelId(productModelId);
- stockInventoryDto.setBatchNo(entry.getKey());
- stockInventoryDto.setQualitity(currentDeductQuantity);
- int affected = stockInventoryMapper.updateSubtractStockInventory(stockInventoryDto);
- if (affected <= 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欐墸鍑忓簱瀛樺け璐�");
- }
+ createAndApproveStockOutRecord(recordId, productModelId, entry.getKey(), currentDeductQuantity, rowNo, stockOutRecordType);
remainingQuantity = remainingQuantity.subtract(currentDeductQuantity);
}
if (remainingQuantity.compareTo(BigDecimal.ZERO) > 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欐墸鍑忓簱瀛樺け璐ワ紝鍓╀綑寰呮墸鍑忔暟閲忎负" + formatQuantity(remainingQuantity));
+ throw new ServiceException("绗�" + rowNo + "琛屾墸鍑忓簱瀛樺け璐ワ細浠嶆湁鏈墸鍑忔暟閲�" + formatQuantity(remainingQuantity));
}
}
- private void addInventory(Long productModelId, String batchNo, BigDecimal quantity) {
+ private void createAndApproveStockOutRecord(Long recordId,
+ Long productModelId,
+ String batchNo,
+ BigDecimal quantity,
+ int rowNo,
+ String stockOutRecordType) {
+ // 搴撳瓨鎵e噺鏀逛负涓ゆ锛�
+ // 1) 鍏堣皟鐢� addStockOutRecordOnly 鏂板寰呭鎵瑰嚭搴撹褰曪紱
+ // 2) 鍐嶈皟鐢ㄥ嚭搴撳鎵癸紝瀹℃壒鐘舵�佸浐瀹氫紶 1锛堥�氳繃锛夈��
+ try {
+ StockInventoryDto stockInventoryDto = new StockInventoryDto();
+ stockInventoryDto.setRecordId(recordId == null ? 0L : recordId);
+ stockInventoryDto.setRecordType(stockOutRecordType);
+ stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setBatchNo(batchNo);
+ stockInventoryDto.setQualitity(quantity);
+ stockInventoryService.addStockOutRecordOnly(stockInventoryDto);
+
+ LambdaQueryWrapper<StockOutRecord> recordWrapper = Wrappers.<StockOutRecord>lambdaQuery()
+ .eq(StockOutRecord::getRecordId, stockInventoryDto.getRecordId())
+ .eq(StockOutRecord::getRecordType, stockOutRecordType)
+ .eq(StockOutRecord::getProductModelId, productModelId)
+ .eq(StockOutRecord::getType, "0")
+ .orderByDesc(StockOutRecord::getId)
+ .last("limit 1");
+ if (StringUtils.isEmpty(batchNo)) {
+ recordWrapper.isNull(StockOutRecord::getBatchNo);
+ } else {
+ recordWrapper.eq(StockOutRecord::getBatchNo, batchNo);
+ }
+ StockOutRecord stockOutRecord = stockOutRecordService.getOne(recordWrapper, false);
+ if (stockOutRecord == null || stockOutRecord.getId() == null) {
+ throw new ServiceException("绗�" + rowNo + "琛屾墸鍑忓簱瀛樺け璐ワ細鏈壘鍒板搴斿嚭搴撶敵璇疯褰�");
+ }
+ stockOutRecordService.batchApprove(
+ Collections.singletonList(stockOutRecord.getId()),
+ ReviewStatusEnum.APPROVED.getCode()
+ );
+ } catch (ServiceException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServiceException("绗�" + rowNo + "琛屾墸鍑忓簱瀛樺け璐ワ細" + ex.getMessage());
+ }
+ }
+
+ private void addInventory(Long recordId,
+ Long productModelId,
+ String batchNo,
+ BigDecimal quantity,
+ String stockInRecordType) {
+ // 鍥炶ˉ搴撳瓨鏀逛负涓ゆ锛�
+ // 1) 鍏堟柊澧炲叆搴撶敵璇凤紱
+ // 2) 鍐嶅鎵归�氳繃锛岀‘淇濆簱瀛樼珛鍒诲洖琛ョ敓鏁堛��
BigDecimal addQuantity = defaultDecimal(quantity);
if (addQuantity.compareTo(BigDecimal.ZERO) <= 0) {
return;
}
- StockInventoryDto stockInventoryDto = new StockInventoryDto();
- stockInventoryDto.setProductModelId(productModelId);
- stockInventoryDto.setBatchNo(batchNo);
- stockInventoryDto.setQualitity(addQuantity);
- stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.PICK_RETURN_IN.getCode()));
- stockInventoryDto.setRecordId(0L);
- stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+ try {
+ StockInventoryDto stockInventoryDto = new StockInventoryDto();
+ stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setBatchNo(batchNo);
+ stockInventoryDto.setQualitity(addQuantity);
+ stockInventoryDto.setRecordType(stockInRecordType);
+ stockInventoryDto.setRecordId(recordId == null ? 0L : recordId);
+ stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+
+ LambdaQueryWrapper<StockInRecord> recordWrapper = Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordId, stockInventoryDto.getRecordId())
+ .eq(StockInRecord::getRecordType, stockInventoryDto.getRecordType())
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .eq(StockInRecord::getType, "0")
+ .orderByDesc(StockInRecord::getId)
+ .last("limit 1");
+ if (StringUtils.isEmpty(batchNo)) {
+ recordWrapper.isNull(StockInRecord::getBatchNo);
+ } else {
+ recordWrapper.eq(StockInRecord::getBatchNo, batchNo);
+ }
+ StockInRecord stockInRecord = stockInRecordService.getOne(recordWrapper, false);
+ if (stockInRecord == null || stockInRecord.getId() == null) {
+ throw new ServiceException("鍥炶ˉ搴撳瓨澶辫触锛氭湭鎵惧埌瀵瑰簲鍏ュ簱鐢宠璁板綍");
+ }
+ stockInRecordService.batchApprove(
+ Collections.singletonList(stockInRecord.getId()),
+ ReviewStatusEnum.APPROVED.getCode()
+ );
+ } catch (ServiceException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServiceException("鍥炶ˉ搴撳瓨澶辫触锛�" + ex.getMessage());
+ }
+ }
+
+ private void addInventoryRecordOnly(Long recordId,
+ Long productModelId,
+ String batchNo,
+ BigDecimal quantity,
+ String stockInRecordType) {
+ // 浠呰褰曞叆搴撶敵璇凤紝涓嶅仛瀹℃牳閫氳繃銆�
+ BigDecimal addQuantity = defaultDecimal(quantity);
+ if (addQuantity.compareTo(BigDecimal.ZERO) <= 0) {
+ return;
+ }
+ try {
+ StockInventoryDto stockInventoryDto = new StockInventoryDto();
+ stockInventoryDto.setProductModelId(productModelId);
+ stockInventoryDto.setBatchNo(batchNo);
+ stockInventoryDto.setQualitity(addQuantity);
+ stockInventoryDto.setRecordType(stockInRecordType);
+ stockInventoryDto.setRecordId(recordId == null ? 0L : recordId);
+ stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+ } catch (ServiceException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServiceException("閫�鏂欏叆搴撹褰曚繚瀛樺け璐ワ細" + ex.getMessage());
+ }
}
private List<ProductionOrderPickDto> resolvePickItems(ProductionOrderPickDto dto) {
+ // 瑙f瀽鏂板鍦烘櫙鐨勯鏂欐槑缁嗛泦鍚堛��
if (dto == null) {
- throw new ServiceException("棰嗘枡鍙傛暟涓嶈兘涓虹┖");
+ throw new ServiceException("鍙傛暟涓嶈兘涓虹┖");
}
if (dto.getPickList() != null && !dto.getPickList().isEmpty()) {
return dto.getPickList();
@@ -543,6 +774,7 @@
}
private List<ProductionOrderPickDto> resolveUpdateItems(ProductionOrderPickDto dto) {
+ // 瑙f瀽鏇存柊鍦烘櫙鐨勯鏂欐槑缁嗛泦鍚堛��
if (dto.getPickList() != null) {
return dto.getPickList();
}
@@ -553,6 +785,7 @@
}
private boolean isEmptyUpdateItem(ProductionOrderPickDto dto) {
+ // 鍒ゆ柇鏇存柊琛屾槸鍚︿负绌虹櫧鍗犱綅琛屻��
return dto.getId() == null
&& dto.getProductModelId() == null
&& dto.getPickQuantity() == null
@@ -573,6 +806,7 @@
}
private Long resolveProductionOrderId(ProductionOrderPickDto dto) {
+ // 浼樺厛浠庝富DTO瑙f瀽璁㈠崟ID锛屼笉瀛樺湪鏃跺啀浠庡瓙椤逛腑鍥為��鏌ユ壘銆�
if (dto.getProductionOrderId() != null) {
return dto.getProductionOrderId();
}
@@ -588,7 +822,12 @@
}
private ProductionOrderPickDto mergeDto(ProductionOrderPickDto rootDto, ProductionOrderPickDto itemDto) {
+ // 鍚堝苟瑙勫垯锛�
+ // - itemDto 浼樺厛鎵胯浇琛岀骇杈撳叆锛�
+ // - itemDto 缂哄け瀛楁浠� rootDto 鍏滃簳缁ф壙锛�
+ // - 杈撳嚭 merged 浣滀负缁熶竴涓氬姟鍏ュ弬銆�
ProductionOrderPickDto merged = new ProductionOrderPickDto();
+ // 鍏堟嫹璐濊绾у瓧娈点��
if (itemDto != null) {
merged.setId(itemDto.getId());
merged.setProductionOrderId(itemDto.getProductionOrderId());
@@ -667,51 +906,52 @@
}
private void validatePickParam(ProductionOrderPickDto dto, int rowNo) {
+ // 鏍¢獙鏅�氶鏂欏弬鏁帮紙璁㈠崟銆佽鏍笺�佹暟閲忋�佺被鍨嬶級銆�
if (dto.getProductionOrderId() == null) {
- throw new ServiceException("绗�" + rowNo + "鏉$敓浜ц鍗旾D涓嶈兘涓虹┖");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細鐢熶骇璁㈠崟ID涓嶈兘涓虹┖");
}
if (dto.getProductModelId() == null) {
- throw new ServiceException("绗�" + rowNo + "鏉′骇鍝佽鏍糏D涓嶈兘涓虹┖");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細浜у搧瑙勬牸涓嶈兘涓虹┖");
}
if (dto.getPickQuantity() == null || dto.getPickQuantity().compareTo(BigDecimal.ZERO) < 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欐暟閲忎笉鑳藉皬浜�0");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細棰嗘枡鏁伴噺涓嶈兘灏忎簬0");
}
if (dto.getPickType() != null && dto.getPickType() != PICK_TYPE_NORMAL && dto.getPickType() != PICK_TYPE_FEEDING) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂欑被鍨嬪彧鑳芥槸1鎴�2");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細棰嗘枡绫诲瀷浠呮敮鎸�1(棰嗘枡)鎴�2(琛ユ枡)");
}
}
private void validateFeedingParam(ProductionOrderPickDto dto, int rowNo) {
+ // 鏍¢獙琛ユ枡鍙傛暟锛堣鍗曘�侀鏂橧D銆佽ˉ鏂欐暟閲忋�佺被鍨嬶級銆�
if (dto.getProductionOrderId() == null) {
- throw new ServiceException("绗�" + rowNo + "鏉$敓浜ц鍗旾D涓嶈兘涓虹┖");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細鐢熶骇璁㈠崟ID涓嶈兘涓虹┖");
}
if (dto.getId() == null) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂橧D涓嶈兘涓虹┖");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細棰嗘枡璁板綍ID涓嶈兘涓虹┖");
}
if (dto.getFeedingQuantity() == null || dto.getFeedingQuantity().compareTo(BigDecimal.ZERO) < 0) {
- throw new ServiceException("绗�" + rowNo + "鏉℃湰娆¤ˉ鏂欐暟閲忎笉鑳藉皬浜�0");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細琛ユ枡鏁伴噺涓嶈兘灏忎簬0");
}
if (!isFeedingPick(dto)) {
- throw new ServiceException("绗�" + rowNo + "鏉¤ˉ鏂欑被鍨嬪繀椤讳负2");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細琛ユ枡鍦烘櫙涓嬮鏂欑被鍨嬪繀椤讳负2");
}
}
private void validateReturnParam(ProductionOrderPickDto dto, int rowNo) {
+ // 鏍¢獙閫�鏂欏弬鏁帮紙璁㈠崟銆侀鏂橧D銆侀��鏂欓噺锛夈��
if (dto.getProductionOrderId() == null) {
- throw new ServiceException("绗�" + rowNo + "鏉$敓浜ц鍗旾D涓嶈兘涓虹┖");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細鐢熶骇璁㈠崟ID涓嶈兘涓虹┖");
}
if (dto.getId() == null) {
- throw new ServiceException("绗�" + rowNo + "鏉¢鏂橧D涓嶈兘涓虹┖");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細棰嗘枡璁板綍ID涓嶈兘涓虹┖");
}
if (dto.getReturnQty() == null || dto.getReturnQty().compareTo(BigDecimal.ZERO) < 0) {
- throw new ServiceException("绗�" + rowNo + "鏉¢��鏂欐暟閲忎笉鑳戒负绌轰笖涓嶈兘灏忎簬0");
- }
- if (dto.getActualQty() == null || dto.getActualQty().compareTo(BigDecimal.ZERO) < 0) {
- throw new ServiceException("绗�" + rowNo + "鏉″疄闄呮暟閲忎笉鑳戒负绌轰笖涓嶈兘灏忎簬0");
+ throw new ServiceException("绗�" + rowNo + "琛屽弬鏁伴敊璇細閫�鏂欐暟閲忎笉鑳藉皬浜�0");
}
}
private boolean isFeedingRequest(ProductionOrderPickDto dto) {
+ // 鍒ゆ柇褰撳墠璇锋眰鏄惁灞炰簬琛ユ枡娴佺▼銆�
if (isFeedingPick(dto)) {
return true;
}
@@ -724,10 +964,12 @@
}
private boolean isFeedingPick(ProductionOrderPickDto dto) {
+ // 鍒ゆ柇褰撳墠琛屾槸鍚︿负琛ユ枡绫诲瀷銆�
return dto != null && Objects.equals(dto.getPickType(), PICK_TYPE_FEEDING);
}
private boolean isReturnRequest(ProductionOrderPickDto dto) {
+ // 鍒ゆ柇褰撳墠璇锋眰鏄惁灞炰簬閫�鏂欐祦绋嬨��
if (isReturnPick(dto)) {
return true;
}
@@ -740,10 +982,12 @@
}
private boolean isReturnPick(ProductionOrderPickDto dto) {
+ // 鍒ゆ柇褰撳墠琛屾槸鍚︿负閫�鏂欑被鍨嬨��
return dto != null && Boolean.TRUE.equals(dto.getReturned());
}
private BigDecimal sumFeedingQuantity(Long productionOrderId, Long pickId) {
+ // 姹囨�绘寚瀹氶鏂欏崟鐨勫巻鍙茶ˉ鏂欐�婚噺銆�
List<ProductionOrderPickRecord> feedingRecords = productionOrderPickRecordMapper.selectList(
Wrappers.<ProductionOrderPickRecord>lambdaQuery()
.eq(ProductionOrderPickRecord::getProductionOrderId, productionOrderId)
@@ -756,12 +1000,14 @@
}
private BigDecimal calculateActualQty(ProductionOrderPick pick, BigDecimal feedingQty) {
+ // 鎸夆�滈鏂�+琛ユ枡-閫�鏂欌�濊绠楀疄闄呯敤閲忋��
return defaultDecimal(pick.getQuantity())
.add(defaultDecimal(feedingQty))
.subtract(defaultDecimal(pick.getReturnQty()));
}
private String normalizeBatchNo(String batchNo) {
+ // 鏍囧噯鍖栨壒娆″彿锛堝幓绌虹櫧銆佺┖涓茶浆null锛夈��
if (StringUtils.isEmpty(batchNo)) {
return null;
}
@@ -769,6 +1015,7 @@
return trimBatchNo.isEmpty() ? null : trimBatchNo;
}
private List<String> resolveBatchNoList(ProductionOrderPickDto dto) {
+ // 浼樺厛瑙f瀽 batchNoList锛岀┖鍒欏洖閫�瑙f瀽 batchNo 瀛楃涓层��
List<String> normalizedBatchNoList = normalizeBatchNoList(dto.getBatchNoList());
if (!normalizedBatchNoList.isEmpty()) {
return normalizedBatchNoList;
@@ -777,6 +1024,7 @@
}
private String pickInventoryBatchNo(List<String> batchNoList) {
+ // 浠庢壒娆¢泦鍚堜腑鍙栧簱瀛樻墸鍑忎娇鐢ㄧ殑鎵规銆�
if (batchNoList == null || batchNoList.isEmpty()) {
return null;
}
@@ -784,10 +1032,12 @@
}
private String resolveInventoryBatchNoFromStored(String storedBatchNo) {
+ // 浠庢暟鎹簱瀛樺偍鎵规瀛楁涓弽瑙e彲鐢ㄦ壒娆°��
return pickInventoryBatchNo(parseBatchNoValue(storedBatchNo));
}
private String formatBatchNoStorage(List<String> batchNoList) {
+ // 灏嗘壒娆¢泦鍚堟牸寮忓寲涓烘暟鎹簱瀛樺偍鍊笺��
if (batchNoList == null || batchNoList.isEmpty()) {
return null;
}
@@ -798,6 +1048,7 @@
}
private List<String> normalizeBatchNoList(List<String> batchNoList) {
+ // 鎵归噺鏍囧噯鍖栨壒娆″彿骞跺幓閲嶃��
if (batchNoList == null || batchNoList.isEmpty()) {
return Collections.emptyList();
}
@@ -812,6 +1063,7 @@
}
private void fillBatchNoList(List<ProductionOrderPickVo> detailList) {
+ // 灏嗗悓璁㈠崟+鍚岃鏍�+鍚屽伐搴忕殑鏁版嵁鎸夌粍鑱氬悎鎵规锛屼究浜庡墠绔粺涓�灞曠ず銆�
if (detailList == null || detailList.isEmpty()) {
return;
}
@@ -832,9 +1084,11 @@
}
private void fillSelectableBatchNoList(List<ProductionOrderPickVo> detailList) {
+ // 鍚堝苟鈥滃凡閫夋壒娆♀�濆拰鈥滃簱瀛樺彲閫夋壒娆♀�濓紝鐢ㄤ簬鍓嶇涓嬫媺銆�
if (detailList == null || detailList.isEmpty()) {
return;
}
+ // 鍏堟敹闆嗘槑缁嗕腑娑夊強鐨勮鏍糏D锛屾壒閲忔煡璇㈠簱瀛樻壒娆°��
Set<Long> productModelIdSet = detailList.stream()
.map(ProductionOrderPickVo::getProductModelId)
.filter(Objects::nonNull)
@@ -868,30 +1122,35 @@
}
private String buildBatchNoGroupKey(ProductionOrderPickVo detail) {
- return String.valueOf(detail.getProductionOrderId()) + "|"
- + String.valueOf(detail.getProductModelId()) + "|"
- + String.valueOf(detail.getTechnologyOperationId()) + "|"
- + String.valueOf(detail.getOperationName());
+ // 鏋勫缓鎵规鑱氬悎鍒嗙粍閿��
+ return detail.getProductionOrderId() + "|"
+ + detail.getProductModelId() + "|"
+ + detail.getTechnologyOperationId() + "|"
+ + detail.getOperationName();
}
private List<String> parseBatchNoValue(String rawBatchNoValue) {
+ // 鎵规瑙f瀽鍏煎涓夌鏍煎紡锛�
+ // 1) 鍗曞�硷細A001
+ // 2) 閫楀彿鍒嗛殧锛欰001,A002
+ // 3) 绫籎SON鏁扮粍瀛楃涓诧細["A001","A002"]
String normalizedValue = normalizeBatchNo(rawBatchNoValue);
if (StringUtils.isEmpty(normalizedValue)) {
return Collections.emptyList();
}
- if (normalizedValue.startsWith("[") && normalizedValue.endsWith("]")) {
+ if (normalizedValue != null && normalizedValue.startsWith("[") && normalizedValue.endsWith("]")) {
String value = normalizedValue.substring(1, normalizedValue.length() - 1);
if (StringUtils.isEmpty(value)) {
return Collections.emptyList();
}
List<String> parsed = Arrays.stream(value.split(","))
- .map(item -> item == null ? null : item.trim().replace("\"", "").replace("'", ""))
+ .map(item -> item.trim().replace("\"", "").replace("'", ""))
.collect(Collectors.toList());
return normalizeBatchNoList(parsed);
}
- if (normalizedValue.contains(",")) {
+ if (normalizedValue != null && normalizedValue.contains(",")) {
List<String> parsed = Arrays.stream(normalizedValue.split(","))
- .map(item -> item == null ? null : item.trim())
+ .map(item -> item.trim())
.collect(Collectors.toList());
return normalizeBatchNoList(parsed);
}
@@ -899,6 +1158,7 @@
}
private LambdaQueryWrapper<StockInventory> buildStockWrapper(Long productModelId, String batchNo) {
+ // 鏋勫缓搴撳瓨鏌ヨ鏉′欢锛堣鏍� + 鎵规锛夈��
LambdaQueryWrapper<StockInventory> wrapper = Wrappers.<StockInventory>lambdaQuery()
.eq(StockInventory::getProductModelId, productModelId);
if (StringUtils.isEmpty(batchNo)) {
@@ -910,10 +1170,12 @@
}
private BigDecimal defaultDecimal(BigDecimal value) {
+ // BigDecimal 绌哄�煎厹搴曪紝缁熶竴鎸�0澶勭悊銆�
return value == null ? BigDecimal.ZERO : value;
}
private String formatQuantity(BigDecimal value) {
+ // 鏁伴噺鏍煎紡鍖栬緭鍑猴紙鍘婚櫎鏈熬鏃犳晥0锛夈��
return defaultDecimal(value).stripTrailingZeros().toPlainString();
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationParamServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationParamServiceImpl.java
index a99b194..a792b35 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationParamServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationParamServiceImpl.java
@@ -48,17 +48,20 @@
@Override
public List<ProductionOrderRoutingOperationParamVo> listProductionOrderRoutingOperationParam(ProductionOrderRoutingOperationParamDto dto) {
+ // 鏌ヨ鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭鍙傛暟
return BeanUtil.copyToList(this.list(buildQueryWrapper(dto)), ProductionOrderRoutingOperationParamVo.class);
}
@Override
public ProductionOrderRoutingOperationParamVo getProductionOrderRoutingOperationParamInfo(Long id) {
+ // 鑾峰彇鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭鍙傛暟璇︽儏
ProductionOrderRoutingOperationParam item = this.getById(id);
return item == null ? null : BeanUtil.copyProperties(item, ProductionOrderRoutingOperationParamVo.class);
}
@Override
public boolean saveProductionOrderRoutingOperationParam(ProductionOrderRoutingOperationParam item) {
+ // 淇濆瓨鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭鍙傛暟
ProductionOrderRoutingOperation routingOperation = getRoutingOperation(item.getProductionOrderRoutingOperationId());
fillFromSourceParam(item, routingOperation);
validateManualFields(item);
@@ -68,10 +71,12 @@
@Override
public boolean removeProductionOrderRoutingOperationParam(Long id) {
+ // 鍒犻櫎鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭鍙傛暟
return this.removeById(id);
}
private LambdaQueryWrapper<ProductionOrderRoutingOperationParam> buildQueryWrapper(ProductionOrderRoutingOperationParamDto dto) {
+ // 鎸夋潯浠跺姩鎬佹瀯寤烘暟鎹簱鏌ヨ鏉′欢
ProductionOrderRoutingOperationParam query = dto == null ? new ProductionOrderRoutingOperationParam() : dto;
return Wrappers.<ProductionOrderRoutingOperationParam>lambdaQuery()
.eq(query.getId() != null, ProductionOrderRoutingOperationParam::getId, query.getId())
@@ -96,29 +101,31 @@
}
private ProductionOrderRoutingOperation getRoutingOperation(Long productionOrderRoutingOperationId) {
+ // 鑾峰彇宸ヨ壓璺嚎宸ュ簭
if (productionOrderRoutingOperationId == null) {
- throw new ServiceException("productionOrderRoutingOperationId is required");
+ throw new ServiceException("鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭ID涓嶈兘涓虹┖");
}
ProductionOrderRoutingOperation routingOperation = productionOrderRoutingOperationMapper.selectById(productionOrderRoutingOperationId);
if (routingOperation == null) {
- throw new ServiceException("Production order routing operation not found");
+ throw new ServiceException("鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭涓嶅瓨鍦�");
}
return routingOperation;
}
private void fillFromSourceParam(ProductionOrderRoutingOperationParam item, ProductionOrderRoutingOperation routingOperation) {
+ // 浠庢潵婧愬弬鏁板洖濉綋鍓嶅弬鏁伴粯璁ゅ��
item.setProductionOrderId(routingOperation.getProductionOrderId());
item.setProductionOrderRoutingOperationId(routingOperation.getId());
ProductionOrder productionOrder = productionOrderMapper.selectById(routingOperation.getProductionOrderId());
if (productionOrder == null) {
- throw new ServiceException("Production order not found");
+ throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
}
if (item.getParamId() == null) {
return;
}
TechnologyParam sourceParam = technologyParamMapper.selectById(item.getParamId());
if (sourceParam == null) {
- throw new ServiceException("Technology param not found");
+ throw new ServiceException("宸ヨ壓鍙傛暟涓嶅瓨鍦�");
}
if (item.getTechnologyOperationParamId() != null) {
TechnologyRoutingOperationParam sourceRoutingOperationParam = technologyRoutingOperationParamMapper.selectById(item.getTechnologyOperationParamId());
@@ -141,27 +148,39 @@
}
private void validateManualFields(ProductionOrderRoutingOperationParam item) {
+ // 鏍¢獙鎵嬪伐褰曞叆瀛楁鐨勫繀濉笌鏍煎紡
if (item.getParamCode() == null || item.getParamCode().trim().isEmpty()) {
- throw new ServiceException("paramCode is required");
+ throw new ServiceException("鍙傛暟缂栫爜涓嶈兘涓虹┖");
}
if (item.getParamName() == null || item.getParamName().trim().isEmpty()) {
- throw new ServiceException("paramName is required");
+ throw new ServiceException("鍙傛暟鍚嶇О涓嶈兘涓虹┖");
}
}
private void checkDuplicate(ProductionOrderRoutingOperationParam item) {
+ // 妫�鏌ユ暟鎹槸鍚﹂噸澶嶏紝閬垮厤閲嶅淇濆瓨
boolean duplicate = productionOrderRoutingOperationParamMapper.selectCount(
Wrappers.<ProductionOrderRoutingOperationParam>lambdaQuery()
+ .eq(ProductionOrderRoutingOperationParam::getProductionOrderId, item.getProductionOrderId())
.isNull(ProductionOrderRoutingOperationParam::getProductionProductMainId)
.eq(ProductionOrderRoutingOperationParam::getProductionOrderRoutingOperationId, item.getProductionOrderRoutingOperationId())
.eq(item.getTechnologyRoutingOperationParamId() != null,
ProductionOrderRoutingOperationParam::getTechnologyRoutingOperationParamId, item.getTechnologyRoutingOperationParamId())
- .eq(item.getTechnologyRoutingOperationParamId() == null && item.getParamCode() != null,
+ .eq(item.getTechnologyRoutingOperationParamId() == null && item.getTechnologyOperationParamId() != null,
+ ProductionOrderRoutingOperationParam::getTechnologyOperationParamId, item.getTechnologyOperationParamId())
+ .eq(item.getTechnologyRoutingOperationParamId() == null
+ && item.getTechnologyOperationParamId() == null
+ && item.getParamId() != null,
+ ProductionOrderRoutingOperationParam::getParamId, item.getParamId())
+ .eq(item.getTechnologyRoutingOperationParamId() == null
+ && item.getTechnologyOperationParamId() == null
+ && item.getParamId() == null
+ && item.getParamCode() != null,
ProductionOrderRoutingOperationParam::getParamCode, item.getParamCode())
.ne(item.getId() != null, ProductionOrderRoutingOperationParam::getId, item.getId())
) > 0;
if (duplicate) {
- throw new ServiceException("Duplicate production order routing operation param");
+ throw new ServiceException("鐢熶骇璁㈠崟宸ヨ壓璺嚎宸ュ簭鍙傛暟閲嶅");
}
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationServiceImpl.java
index 886da11..75d0696 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingOperationServiceImpl.java
@@ -4,21 +4,15 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.production.mapper.ProductionOperationTaskMapper;
-import com.ruoyi.production.mapper.ProductionOrderRoutingOperationMapper;
-import com.ruoyi.production.mapper.ProductionOrderRoutingOperationParamMapper;
-import com.ruoyi.production.mapper.ProductionProductMainMapper;
-import com.ruoyi.production.pojo.ProductionOperationTask;
-import com.ruoyi.production.pojo.ProductionOrderRoutingOperation;
-import com.ruoyi.production.pojo.ProductionOrderRoutingOperationParam;
-import com.ruoyi.production.pojo.ProductionProductMain;
+import com.ruoyi.production.mapper.*;
+import com.ruoyi.production.util.TaskPlanQuantityUtil;
+import com.ruoyi.technology.mapper.*;
+import com.ruoyi.production.pojo.*;
import com.ruoyi.production.service.ProductionOrderRoutingOperationService;
import com.ruoyi.production.service.ProductionProductMainService;
-import com.ruoyi.technology.mapper.TechnologyOperationParamMapper;
-import com.ruoyi.technology.mapper.TechnologyParamMapper;
-import com.ruoyi.technology.pojo.TechnologyOperationParam;
-import com.ruoyi.technology.pojo.TechnologyParam;
+import com.ruoyi.technology.pojo.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -26,8 +20,7 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
@Service
@Transactional(rollbackFor = Exception.class)
@@ -42,15 +35,23 @@
private final TechnologyOperationParamMapper technologyOperationParamMapper;
private final TechnologyParamMapper technologyParamMapper;
private final ProductionOrderRoutingOperationParamMapper productionOrderRoutingOperationParamMapper;
+ private final ProductionOrderMapper productionOrderMapper;
+ private final ProductionOrderRoutingMapper productionOrderRoutingMapper;
+ private final ProductionOrderBomMapper productionOrderBomMapper;
+ private final ProductionBomStructureMapper productionBomStructureMapper;
+ private final TechnologyRoutingOperationMapper technologyRoutingOperationMapper;
@Override
public R addRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation) {
+ // 鏂板宸ヨ壓璺嚎
int insert = productionOrderRoutingOperationMapper.insert(productionOrderRoutingOperation);
//宸ュ簭鍏宠仈鐨勫弬鏁伴渶瑕佸悓姝ユ柊澧�
List<TechnologyOperationParam> technologyOperationParams = technologyOperationParamMapper.selectList(Wrappers.<TechnologyOperationParam>lambdaQuery()
.eq(TechnologyOperationParam::getTechnologyOperationId, productionOrderRoutingOperation.getTechnologyOperationId()));
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (CollectionUtils.isNotEmpty(technologyOperationParams)){
ArrayList<ProductionOrderRoutingOperationParam> productionOrderRoutingOperationParams = new ArrayList<>();
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
for (TechnologyOperationParam technologyOperationParam : technologyOperationParams) {
TechnologyParam technologyParam = technologyParamMapper.selectById(technologyOperationParam.getTechnologyParamId());
ProductionOrderRoutingOperationParam productionOrderRoutingOperationParam = new ProductionOrderRoutingOperationParam();
@@ -102,12 +103,118 @@
}
@Override
+ @Transactional(rollbackFor = Exception.class)
+ public R updateRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation) {
+ Long operationId = productionOrderRoutingOperation.getId();
+
+ // 鏇存柊宸ヨ壓璺嚎宸ュ簭
+ productionOrderRoutingOperationMapper.updateById(productionOrderRoutingOperation);
+
+ // 閲嶆柊鏌ヨ瀹屾暣璁板綍锛堝墠绔彲鑳芥病鏈変紶閫掓墍鏈夊瓧娈碉紝濡� productionOrderId锛�
+ ProductionOrderRoutingOperation updatedOperation = productionOrderRoutingOperationMapper.selectById(operationId);
+ if (updatedOperation == null) {
+ throw new ServiceException("宸ヨ壓璺嚎宸ュ簭涓嶅瓨鍦�");
+ }
+
+ // 鏌ヨ鏄惁瀛樺湪宸ュ崟
+ ProductionOperationTask productionOperationTask = productionOperationTaskMapper.selectOne(
+ new LambdaQueryWrapper<ProductionOperationTask>()
+ .eq(ProductionOperationTask::getProductionOrderRoutingOperationId, operationId)
+ .last("limit 1"));
+
+ // 鏍规嵁鏄惁闇�瑕佺敓浜ц繘琛屽鐞�
+ Boolean isProduction = updatedOperation.getIsProduction();
+
+ if (Boolean.TRUE.equals(isProduction)) {
+ // 闇�瑕佺敓浜э細妫�鏌ュ伐鍗曟槸鍚﹀瓨鍦紝涓嶅瓨鍦ㄥ垯鐢熸垚
+ if (productionOperationTask == null) {
+ ProductionOperationTask task = new ProductionOperationTask();
+ task.setProductionOrderRoutingOperationId(updatedOperation.getId());
+ task.setProductionOrderId(updatedOperation.getProductionOrderId());
+ // 鑾峰彇鐢熶骇璁㈠崟
+ ProductionOrder productionOrder = productionOrderMapper.selectById(updatedOperation.getProductionOrderId());
+ if (productionOrder == null) {
+ throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
+ }
+
+ // 鑾峰彇璁㈠崟BOM
+ ProductionOrderBom orderBom = productionOrderBomMapper.selectOne(
+ Wrappers.<ProductionOrderBom>lambdaQuery()
+ .eq(ProductionOrderBom::getProductionOrderId, productionOrder.getId()));
+
+ // 纭畾鏍逛骇鍝佽鏍糏D
+ Long rootProductModelId = orderBom != null && orderBom.getProductModelId() != null
+ ? orderBom.getProductModelId()
+ : productionOrder.getProductModelId();
+
+ // 鑾峰彇BOM缁撴瀯鍒楄〃
+ List<ProductionBomStructure> orderBomStructureList = orderBom == null || orderBom.getId() == null
+ ? Collections.emptyList()
+ : productionBomStructureMapper.selectList(
+ Wrappers.<ProductionBomStructure>lambdaQuery()
+ .eq(ProductionBomStructure::getProductionOrderBomId, orderBom.getId())
+ .orderByAsc(ProductionBomStructure::getId));
+
+ // 鏋勫缓宸ュ簭闇�姹傞噺鏄犲皠
+ Map<String, BigDecimal> operationDemandedQuantityMap =
+ TaskPlanQuantityUtil.buildOperationDemandedQuantityMap(orderBomStructureList, rootProductModelId);
+
+ // 鑾峰彇宸ヨ壓璺嚎宸ュ簭锛堢敤浜庤绠楄鍒掓暟閲忥級
+ TechnologyRoutingOperation sourceOperation = technologyRoutingOperationMapper.selectById(
+ updatedOperation.getTechnologyRoutingOperationId());
+ // 灏嗗師鏉ョ殑绉佹湁鏂规硶鏇挎崲涓鸿皟鐢ㄥ伐鍏风被
+ BigDecimal planQuantity = TaskPlanQuantityUtil.resolveTaskPlanQuantity(
+ sourceOperation,
+ operationDemandedQuantityMap,
+ productionOrder,
+ rootProductModelId);
+ task.setPlanQuantity(planQuantity);
+ task.setCompleteQuantity(BigDecimal.ZERO);
+ task.setWorkOrderNo(generateNextTaskNo());
+ task.setStatus(2);
+ productionOperationTaskMapper.insert(task);
+ }
+ } else {
+ // 涓嶉渶瑕佺敓浜э細妫�鏌ュ伐鍗曟槸鍚﹀瓨鍦�
+ if (productionOperationTask != null) {
+ validateTaskCanRemove(productionOperationTask);
+ // 娌℃湁鎶ュ伐锛屽垯鍒犻櫎宸ュ崟
+ productionOperationTaskMapper.deleteById(productionOperationTask.getId());
+ }
+ }
+
+ return R.ok();
+ }
+
+ private void validateTaskCanRemove(ProductionOperationTask task) {
+ if (task == null || task.getId() == null) {
+ return;
+ }
+ if (defaultDecimal(task.getCompleteQuantity()).compareTo(BigDecimal.ZERO) > 0) {
+ throw new ServiceException("宸ュ簭宸蹭骇鐢熸姤宸ヨ褰曪紝鏃犳硶鏍规嵁 BOM 鍙樻洿鍒犻櫎瀵瑰簲宸ュ簭蹇収");
+ }
+ long reportCount = productionProductMainMapper.selectCount(
+ Wrappers.<ProductionProductMain>lambdaQuery()
+ .eq(ProductionProductMain::getProductionOperationTaskId, task.getId()));
+ if (reportCount > 0) {
+ throw new ServiceException("宸ュ簭宸蹭骇鐢熸姤宸ヨ褰曪紝鏃犳硶鏍规嵁 BOM 鍙樻洿鍒犻櫎瀵瑰簲宸ュ崟");
+ }
+ }
+
+ private BigDecimal defaultDecimal(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ @Override
public R deleteRouteItem(Long id) {
+ // 鍒犻櫎宸ヨ壓璺嚎
try {
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
ProductionOperationTask productionOperationTask = productionOperationTaskMapper.selectOne(
new LambdaQueryWrapper<ProductionOperationTask>()
.eq(ProductionOperationTask::getProductionOrderRoutingOperationId, id)
.last("limit 1"));
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (productionOperationTask == null) {
throw new RuntimeException("鍒犻櫎澶辫触锛氭湭鎵惧埌鍏宠仈鐨勭敓浜у伐鍗�");
}
@@ -118,6 +225,7 @@
List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList(
new LambdaQueryWrapper<ProductionProductMain>()
.eq(ProductionProductMain::getProductionOperationTaskId, productionOperationTask.getId()));
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
for (ProductionProductMain main : productionProductMains) {
productionProductMainService.removeProductMain(main.getId());
}
@@ -140,6 +248,7 @@
ProductionOrderRoutingOperation item = operationList.get(i);
if (!Integer.valueOf(i + 1).equals(item.getDragSort())) {
item.setDragSort(i + 1);
+ // 鎸佷箙鍖栨垨杈撳嚭澶勭悊缁撴灉
productionOrderRoutingOperationMapper.updateById(item);
}
}
@@ -152,6 +261,7 @@
@Override
public int sortRouteItem(ProductionOrderRoutingOperation productionOrderRoutingOperation) {
+ // 鎺掑簭宸ヨ壓璺嚎
ProductionOrderRoutingOperation oldItem = productionOrderRoutingOperationMapper.selectById(productionOrderRoutingOperation.getId());
List<ProductionOrderRoutingOperation> operationList = productionOrderRoutingOperationMapper.selectList(
Wrappers.<ProductionOrderRoutingOperation>lambdaQuery()
@@ -173,4 +283,24 @@
}
return 0;
}
+
+ private String generateNextTaskNo() {
+ // 鐢熸垚涓嬩竴涓敓浜у伐鍗曞彿
+ String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+ String prefix = "GD" + datePrefix;
+ ProductionOperationTask lastTask = productionOperationTaskMapper.selectOne(
+ Wrappers.<ProductionOperationTask>lambdaQuery()
+ .likeRight(ProductionOperationTask::getWorkOrderNo, prefix)
+ .orderByDesc(ProductionOperationTask::getWorkOrderNo)
+ .last("limit 1"));
+ int sequence = 1;
+ if (lastTask != null && lastTask.getWorkOrderNo() != null && lastTask.getWorkOrderNo().startsWith(prefix)) {
+ try {
+ sequence = Integer.parseInt(lastTask.getWorkOrderNo().substring(prefix.length())) + 1;
+ } catch (NumberFormatException ignored) {
+ sequence = 1;
+ }
+ }
+ return prefix + String.format("%03d", sequence);
+ }
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingServiceImpl.java
index 10443c1..0ffb34f 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderRoutingServiceImpl.java
@@ -21,6 +21,7 @@
@Override
public ProductionOrderRouting listMain(Long orderId) {
+ // 鏌ヨ涓昏〃ID闆嗗悎
return productionOrderRoutingMapper.selectOne(
Wrappers.<ProductionOrderRouting>lambdaQuery()
.eq(ProductionOrderRouting::getProductionOrderId, orderId)
@@ -30,6 +31,7 @@
@Override
public List<ProductionOrderRoutingOperationVo> listItem(Long orderId) {
+ // 鏌ヨ宸ヨ壓璺嚎宸ュ簭鏄庣粏
return productionOrderRoutingOperationMapper.selectVoListByOrderId(orderId);
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
index 9973d98..1905d4a 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
@@ -44,6 +44,7 @@
import java.math.BigDecimal;
import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@@ -59,6 +60,7 @@
private final ProductionOperationTaskMapper productionOperationTaskMapper;
private final ProductionOrderBomMapper productionOrderBomMapper;
private final ProductionBomStructureMapper productionBomStructureMapper;
+ private final ProductionOrderMapper productionOrderMapper;
private final ProductionProductMainMapper productionProductMainMapper;
private final ProductionProductOutputMapper productionProductOutputMapper;
private final ProductionOrderPickMapper productionOrderPickMapper;
@@ -82,6 +84,7 @@
@Override
public IPage<ProductionOrderVo> pageProductionOrder(Page<ProductionOrderDto> page, ProductionOrderDto dto) {
+ // 鍒嗛〉鏌ヨ鐢熶骇璁㈠崟
Page<ProductionOrderVo> result = (Page<ProductionOrderVo>) baseMapper.pageProductionOrder(page, dto);
fillProductImages(result.getRecords());
return result;
@@ -89,6 +92,7 @@
@Override
public List<ProductionOrderVo> listProductionOrder(ProductionOrderDto dto) {
+ // 鏌ヨ鐢熶骇璁㈠崟鍒楄〃
List<ProductionOrderVo> records = baseMapper.listProductionOrder(dto);
fillProductImages(records);
return records;
@@ -96,6 +100,7 @@
@Override
public ProductionOrderVo getProductionOrderInfo(Long id) {
+ // 鑾峰彇鐢熶骇璁㈠崟璇︽儏
ProductionOrderVo item = baseMapper.getProductionOrderInfo(id);
if (item == null) {
return null;
@@ -106,11 +111,12 @@
@Override
public boolean saveProductionOrder(ProductionOrder productionOrder) {
+ // 淇濆瓨鐢熶骇璁㈠崟
ProductionOrder oldOrder = productionOrder.getId() == null ? null : this.getById(productionOrder.getId());
// 涓嬪崟鍏ュ彛缁熶竴琛ラ綈鏉ユ簮鍗曟嵁銆佽鍒掑拰宸ヨ壓淇℃伅锛岄伩鍏嶅墠绔垎鍒紶澶氬瀛楁銆�
validateAndFillOrder(productionOrder, oldOrder);
if (productionOrder.getNpsNo() == null || productionOrder.getNpsNo().trim().isEmpty()) {
- productionOrder.setNpsNo(generateNextOrderNo());
+ productionOrder.setNpsNo(generateNextOrderNo(productionOrder.getCreateTime() != null ? productionOrder.getCreateTime() : LocalDateTime.now()));
}
if (productionOrder.getCompleteQuantity() == null) {
productionOrder.setCompleteQuantity(BigDecimal.ZERO);
@@ -137,6 +143,7 @@
@Override
public boolean removeProductionOrder(List<Long> ids) {
+ // 鍒犻櫎鐢熶骇璁㈠崟
if (ids == null || ids.isEmpty()) {
return false;
}
@@ -150,6 +157,7 @@
@Override
public Integer bindingRoute(ProductionOrderDto productionOrderDto) {
+ // 涓鸿鍗曠粦瀹氬伐鑹鸿矾绾�
if (productionOrderDto == null || productionOrderDto.getId() == null) {
throw new ServiceException("鐢熶骇璁㈠崟ID涓嶈兘涓虹┖");
}
@@ -193,6 +201,7 @@
@Override
public List<ProductionPlanVo> getSource(Long id) {
+ // 鏌ヨ璁㈠崟鍏宠仈鏉ユ簮璁″垝
ProductionOrder productionOrder = baseMapper.selectById(id);
if (productionOrder != null && productionOrder.getProductionPlanIds() != null) {
List<Long> planIds = parsePlanIds(productionOrder.getProductionPlanIds());
@@ -203,7 +212,9 @@
@Override
public int syncProductionOrderSnapshot(Long productionOrderId) {
+ // 鍚屾璁㈠崟宸ヨ壓銆佸伐搴忋�佸弬鏁板拰BOM蹇収
ProductionOrder productionOrder = this.getById(productionOrderId);
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (productionOrder == null) {
throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
}
@@ -218,6 +229,7 @@
clearProductionSnapshot(productionOrderId);
ProductionOrderBom orderBom = syncProductionOrderBomSnapshot(productionOrder, technologyRouting);
+ //鐢熶骇璁㈠崟宸ヨ壓璺嚎琛�
ProductionOrderRouting orderRouting = new ProductionOrderRouting();
orderRouting.setProductionOrderId(productionOrder.getId());
orderRouting.setTechnologyRoutingId(technologyRouting.getId());
@@ -229,12 +241,26 @@
productionOrderRoutingMapper.insert(orderRouting);
int syncedParamCount = 0;
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
List<TechnologyRoutingOperation> routingOperations = technologyRoutingOperationMapper.selectList(
Wrappers.<TechnologyRoutingOperation>lambdaQuery()
.eq(TechnologyRoutingOperation::getTechnologyRoutingId, technologyRouting.getId())
.orderByDesc(TechnologyRoutingOperation::getDragSort)
.orderByDesc(TechnologyRoutingOperation::getId));
+ // Build task plan quantities from order BOM snapshot demand instead of recomputing from technology BOM units.
+ Long rootProductModelId = orderBom != null && orderBom.getProductModelId() != null
+ ? orderBom.getProductModelId()
+ : productionOrder.getProductModelId();
+ List<ProductionBomStructure> orderBomStructureList = orderBom == null || orderBom.getId() == null
+ ? Collections.emptyList()
+ : productionBomStructureMapper.selectList(
+ Wrappers.<ProductionBomStructure>lambdaQuery()
+ .eq(ProductionBomStructure::getProductionOrderBomId, orderBom.getId())
+ .orderByAsc(ProductionBomStructure::getId));
+ Map<String, BigDecimal> operationDemandedQuantityMap =
+ buildOperationDemandedQuantityMap(orderBomStructureList, rootProductModelId);
Map<Long, String> operationNameMap = technologyOperationMapper.selectBatchIds(
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
routingOperations.stream()
.map(TechnologyRoutingOperation::getTechnologyOperationId)
.filter(Objects::nonNull)
@@ -258,6 +284,7 @@
targetOperation.setIsQuality(sourceOperation.getIsQuality());
targetOperation.setOperationName(operationNameMap.get(sourceOperation.getTechnologyOperationId()));
targetOperation.setTechnologyOperationId(sourceOperation.getTechnologyOperationId());
+ targetOperation.setType(sourceOperation.getType());
productionOrderRoutingOperationMapper.insert(targetOperation);
boolean isLastOperation = lastDragSort != null && Objects.equals(sourceOperation.getDragSort(), lastDragSort);
@@ -265,7 +292,11 @@
ProductionOperationTask task = new ProductionOperationTask();
task.setProductionOrderRoutingOperationId(targetOperation.getId());
task.setProductionOrderId(productionOrder.getId());
- task.setPlanQuantity(defaultDecimal(productionOrder.getQuantity()));
+ task.setPlanQuantity(resolveTaskPlanQuantity(
+ sourceOperation,
+ operationDemandedQuantityMap,
+ productionOrder,
+ rootProductModelId));
task.setCompleteQuantity(BigDecimal.ZERO);
task.setWorkOrderNo(generateNextTaskNo());
task.setStatus(2);
@@ -300,7 +331,87 @@
return syncedParamCount;
}
+ private Map<String, BigDecimal> buildOperationDemandedQuantityMap(List<ProductionBomStructure> bomStructures,
+ Long rootProductModelId) {
+ if (bomStructures == null || bomStructures.isEmpty()) {
+ return Collections.emptyMap();
+ }
+ Map<Long, ProductionBomStructure> structureById = bomStructures.stream()
+ .filter(item -> item != null && item.getId() != null)
+ .collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left));
+ Map<String, BigDecimal> demandedQuantityMap = new HashMap<>();
+ Set<String> mergedOutputNodeKeySet = new HashSet<>();
+ for (ProductionBomStructure bomStructure : bomStructures) {
+ if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) {
+ continue;
+ }
+ // The BOM row points to the producing operation; task quantity should come from that operation's output node.
+ ProductionBomStructure outputNode = resolveOperationOutputNode(bomStructure, structureById);
+ Long outputProductModelId = resolveOutputProductModelId(outputNode, rootProductModelId);
+ if (outputProductModelId == null) {
+ continue;
+ }
+ String mergedOutputNodeKey = buildOperationOutputNodeKey(
+ bomStructure.getTechnologyOperationId(),
+ outputNode == null ? null : outputNode.getId(),
+ outputProductModelId);
+ if (!mergedOutputNodeKeySet.add(mergedOutputNodeKey)) {
+ continue;
+ }
+ // demandedQuantity is already the order-level required output quantity for the current output node.
+ BigDecimal demandedQuantity = defaultDecimal(outputNode == null ? null : outputNode.getDemandedQuantity());
+ String key = buildOperationDemandedQuantityKey(bomStructure.getTechnologyOperationId(), outputProductModelId);
+ demandedQuantityMap.merge(key, demandedQuantity, BigDecimal::add);
+ }
+ return demandedQuantityMap;
+ }
+
+ private BigDecimal resolveTaskPlanQuantity(TechnologyRoutingOperation sourceOperation,
+ Map<String, BigDecimal> operationDemandedQuantityMap,
+ ProductionOrder productionOrder,
+ Long rootProductModelId) {
+ if (sourceOperation == null || operationDemandedQuantityMap == null || operationDemandedQuantityMap.isEmpty()) {
+ return defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity());
+ }
+ Long outputProductModelId = sourceOperation.getProductModelId() != null
+ ? sourceOperation.getProductModelId()
+ : rootProductModelId;
+ String key = buildOperationDemandedQuantityKey(sourceOperation.getTechnologyOperationId(), outputProductModelId);
+ BigDecimal planQuantity = operationDemandedQuantityMap.get(key);
+ return planQuantity != null ? planQuantity : defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity());
+ }
+
+ private String buildOperationDemandedQuantityKey(Long operationId, Long outputProductModelId) {
+ return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId);
+ }
+
+ private String buildOperationOutputNodeKey(Long operationId, Long outputNodeId, Long outputProductModelId) {
+ return String.valueOf(operationId) + "#" + String.valueOf(outputNodeId) + "#" + String.valueOf(outputProductModelId);
+ }
+
+ private ProductionBomStructure resolveOperationOutputNode(ProductionBomStructure bomStructure,
+ Map<Long, ProductionBomStructure> structureById) {
+ if (bomStructure == null) {
+ return null;
+ }
+ // The root node is the first output node; child rows use their direct parent as the current operation output.
+ if (bomStructure.getParentId() == null) {
+ return bomStructure;
+ }
+ ProductionBomStructure parent = structureById.get(bomStructure.getParentId());
+ return parent != null ? parent : bomStructure;
+ }
+
+ private Long resolveOutputProductModelId(ProductionBomStructure outputNode,
+ Long rootProductModelId) {
+ if (outputNode == null) {
+ return rootProductModelId;
+ }
+ return outputNode.getProductModelId() != null ? outputNode.getProductModelId() : rootProductModelId;
+ }
+
private ProductionOrderBom syncProductionOrderBomSnapshot(ProductionOrder productionOrder, TechnologyRouting technologyRouting) {
+ // 鍚屾璁㈠崟BOM蹇収缁撴瀯
if (technologyRouting.getBomId() == null) {
return null;
}
@@ -308,10 +419,12 @@
if (technologyBom == null) {
throw new ServiceException("宸ヨ壓BOM涓嶅瓨鍦�");
}
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
List<TechnologyBomStructure> structureList = technologyBomStructureMapper.selectList(
Wrappers.<TechnologyBomStructure>lambdaQuery()
.eq(TechnologyBomStructure::getBomId, technologyBom.getId())
.orderByAsc(TechnologyBomStructure::getId));
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
TechnologyBomStructure root = structureList.stream().filter(item -> item.getParentId() == null).findFirst().orElse(null);
BigDecimal orderQuantity = defaultDecimal(productionOrder.getQuantity());
@@ -322,9 +435,11 @@
orderBom.setRemark(technologyBom.getRemark());
orderBom.setBomNo(technologyBom.getBomNo());
orderBom.setVersion(technologyBom.getVersion());
+ // 鎸佷箙鍖栨垨杈撳嚭澶勭悊缁撴灉
productionOrderBomMapper.insert(orderBom);
Map<Long, Long> idMap = new HashMap<>();
+ BigDecimal lastProcessDemandedQuantity = orderQuantity;
for (TechnologyBomStructure source : structureList) {
// 瀛愯妭鐐� parentId 闇�瑕佹槧灏勬垚鏂板揩鐓ц妭鐐� id锛屾墠鑳戒繚鐣欏師濮� BOM 灞傜骇銆�
ProductionBomStructure target = new ProductionBomStructure();
@@ -334,25 +449,29 @@
target.setProductModelId(source.getProductModelId());
target.setTechnologyOperationId(source.getOperationId());
target.setUnitQuantity(source.getUnitQuantity());
- target.setDemandedQuantity(source.getUnitQuantity().multiply(orderQuantity));
+ target.setDemandedQuantity(lastProcessDemandedQuantity.multiply(source.getUnitQuantity()));
target.setUnit(source.getUnit());
productionBomStructureMapper.insert(target);
idMap.put(source.getId(), target.getId());
+ lastProcessDemandedQuantity = target.getDemandedQuantity();
}
return orderBom;
}
private void clearProductionSnapshot(Long productionOrderId) {
- // 宸蹭骇鐢熼鏂欒褰曞悗绂佹閲嶅缓锛岄伩鍏嶅鏂�/鎶曟枡渚濇嵁涓庤鍗曞揩鐓ц劚鑺傘��
+ // 娓呯悊璁㈠崟宸茬敓鎴愮殑宸ヨ壓涓嶣OM蹇収鏁版嵁
boolean hasPickRecord = productionOrderPickRecordMapper.selectCount(
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
Wrappers.<ProductionOrderPickRecord>lambdaQuery()
.eq(ProductionOrderPickRecord::getProductionOrderId, productionOrderId)) > 0;
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (hasPickRecord) {
throw new ServiceException("鐢熶骇璁㈠崟宸插瓨鍦ㄩ鏂欒褰曪紝涓嶈兘閲嶆柊鐢熸垚蹇収");
}
List<Long> taskIds = productionOperationTaskMapper.selectList(
Wrappers.<ProductionOperationTask>lambdaQuery()
.eq(ProductionOperationTask::getProductionOrderId, productionOrderId))
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
.stream().map(ProductionOperationTask::getId).collect(Collectors.toList());
if (!taskIds.isEmpty()) {
// 宸叉湁鎶ュ伐璁板綍璇存槑璁㈠崟宸插紑宸ワ紝姝ゆ椂涓嶅厑璁稿啀閲嶅缓蹇収銆�
@@ -380,6 +499,7 @@
}
private LambdaQueryWrapper<ProductionOrder> buildQueryWrapper(ProductionOrderDto dto) {
+ // 鎸夋潯浠跺姩鎬佹瀯寤烘暟鎹簱鏌ヨ鏉′欢
ProductionOrder query = dto == null ? new ProductionOrder() : dto;
return Wrappers.<ProductionOrder>lambdaQuery()
.eq(query.getId() != null, ProductionOrder::getId, query.getId())
@@ -389,8 +509,10 @@
.orderByDesc(ProductionOrder::getId);
}
- private String generateNextOrderNo() {
- String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+ private String generateNextOrderNo(LocalDateTime createTime) {
+ // 鐢熸垚涓嬩竴涓敓浜ц鍗曞彿
+ LocalDate localDate = createTime.toLocalDate();
+ String datePrefix = localDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String prefix = "SC" + datePrefix;
ProductionOrder latestOrder = this.getOne(Wrappers.<ProductionOrder>lambdaQuery()
.likeRight(ProductionOrder::getNpsNo, prefix)
@@ -408,6 +530,7 @@
}
private String generateNextTaskNo() {
+ // 鐢熸垚涓嬩竴涓敓浜у伐鍗曞彿
String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String prefix = "GD" + datePrefix;
ProductionOperationTask lastTask = productionOperationTaskMapper.selectOne(
@@ -427,10 +550,12 @@
}
private BigDecimal defaultDecimal(BigDecimal value) {
+ // 灏嗙┖鏁伴噺鍏滃簳涓�0锛岄伩鍏嶇┖鎸囬拡寮傚父
return value == null ? BigDecimal.ZERO : value;
}
private void validateAndFillOrder(ProductionOrder productionOrder, ProductionOrder oldOrder) {
+ // 鏍¢獙璁㈠崟鍙傛暟骞惰ˉ榻愰粯璁ゅ��
if (productionOrder == null) {
throw new ServiceException("鐢熶骇璁㈠崟涓嶈兘涓虹┖");
}
@@ -463,7 +588,9 @@
}
private void fillFromProductionPlans(ProductionOrder productionOrder) {
+ // 浠庡叧鑱旂敓浜ц鍒掑洖濉鍗曞叧閿瓧娈�
List<Long> planIds = parsePlanIds(productionOrder.getProductionPlanIds());
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (planIds.isEmpty()) {
return;
}
@@ -472,6 +599,7 @@
if (productionPlans.size() != planIds.size()) {
throw new ServiceException("閮ㄥ垎鐢熶骇璁″垝涓嶅瓨鍦�");
}
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
Map<Long, ProductionPlan> planMap = productionPlans.stream()
.collect(Collectors.toMap(ProductionPlan::getId, item -> item, (left, right) -> left));
ProductionPlan mainPlan = planMap.get(planIds.get(0));
@@ -510,6 +638,7 @@
}
private void releaseProductionPlanIssueStatus(ProductionOrder productionOrder) {
+ // 鍥為��鐢熶骇璁″垝涓嬪彂鐘舵��
if (productionOrder == null) {
return;
}
@@ -522,6 +651,7 @@
//鐢熶骇璁㈠崟鍒犻櫎锛岀敓浜ц鍒掔殑宸蹭笅鍙戞暟閲忓搴斿彉鏇�
private void updatePlanIssuedFlag(List<Long> planIds, BigDecimal remainingAssignedQuantity) {
+ // 鏇存柊璁″垝涓嬪彂鏍囪鍜屼笅鍙戞暟閲�
if (planIds == null || planIds.isEmpty()) {
return;
}
@@ -551,6 +681,7 @@
}
private BigDecimal resolveRemainingQuantity(ProductionPlan plan) {
+ // 璁$畻褰撳墠璁″垝鎴栬褰曠殑鍓╀綑鏁伴噺
if (plan == null) {
return BigDecimal.ZERO;
}
@@ -569,6 +700,7 @@
}
private int resolvePlanStatus(BigDecimal requiredQuantity, BigDecimal issuedQuantity) {
+ // 鏍规嵁闇�姹傞噺鍜屼笅鍙戦噺鎺ㄥ璁″垝鐘舵��
if (requiredQuantity == null || requiredQuantity.compareTo(BigDecimal.ZERO) <= 0) {
return 0;
}
@@ -579,6 +711,7 @@
}
private List<Long> parsePlanIds(String productionPlanIds) {
+ // 灏嗚鍒扞D瀛楃涓茶В鏋愪负Long鍒楄〃
if (productionPlanIds == null || productionPlanIds.trim().isEmpty()) {
return new ArrayList<>();
}
@@ -595,6 +728,7 @@
}
private String formatPlanIds(List<Long> planIds) {
+ // 灏嗚鍒扞D闆嗗悎鏍煎紡鍖栦负[1,2,3]瀛楃涓�
if (planIds == null || planIds.isEmpty()) {
return null;
}
@@ -605,6 +739,7 @@
}
private LocalDate resolvePlanCompleteDate(ProductionPlan productionPlan) {
+ // 瑙f瀽璁″垝瀹屾垚鏃ユ湡
if (productionPlan == null) {
return null;
}
@@ -618,13 +753,16 @@
}
private int compareDecimal(BigDecimal left, BigDecimal right) {
+ // 瀹夊叏姣旇緝涓や釜鏁伴噺鍊煎ぇ灏�
return defaultDecimal(left).compareTo(defaultDecimal(right));
}
private void fillProductImages(List<ProductionOrderVo> records) {
+ // 濉厖浜у搧鍥剧墖
if (records == null || records.isEmpty()) {
return;
}
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
List<Long> productModelIds = records.stream()
.map(ProductionOrderVo::getProductModelId)
.filter(Objects::nonNull)
@@ -634,6 +772,7 @@
return;
}
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
List<StorageAttachment> attachments = storageAttachmentMapper.selectList(
Wrappers.<StorageAttachment>lambdaQuery()
.in(StorageAttachment::getRecordId, productModelIds)
@@ -676,6 +815,7 @@
}
private StorageBlobVO toStorageBlobVO(StorageBlob blob) {
+ // 灏嗗瓨鍌ㄦ枃浠跺璞¤浆鎹负VO
StorageBlobVO vo = BeanUtil.copyProperties(blob, StorageBlobVO.class);
vo.setPreviewURL(fileUtil.buildSignedPreviewUrl(vo));
vo.setDownloadURL(fileUtil.buildSignedDownloadUrl(vo));
@@ -684,8 +824,10 @@
@Override
public ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(ProductionOrderDto dto) {
+ // 鑾峰彇宸ュ崟璁㈠崟鎶ュ伐璐ㄦ鏄庣粏
Long productionOrderId = resolveProductionOrderId(dto);
ProductionOrderVo orderInfo = getProductionOrderInfo(productionOrderId);
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (orderInfo == null) {
throw new ServiceException("鐢熶骇璁㈠崟涓嶅瓨鍦�");
}
@@ -699,11 +841,12 @@
new Page<ProductionOperationTaskVo>(1, -1), taskQuery);
List<ProductionOperationTaskVo> workOrderList = workOrderPage == null || workOrderPage.getRecords() == null
? Collections.emptyList()
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
: workOrderPage.getRecords().stream()
.filter(Objects::nonNull)
.sorted(Comparator.comparing(ProductionOperationTaskVo::getId, Comparator.nullsLast(Comparator.naturalOrder())))
- .collect(Collectors.toList());
- if (workOrderList == null || workOrderList.isEmpty()) {
+ .toList();
+ if (workOrderList.isEmpty()) {
detailVo.setWorkOrderList(Collections.emptyList());
return detailVo;
}
@@ -714,6 +857,7 @@
.collect(Collectors.toList());
List<ProductionProductMain> reportMainList = workOrderIdList.isEmpty()
? Collections.emptyList()
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
: productionProductMainMapper.selectList(
Wrappers.<ProductionProductMain>lambdaQuery()
.in(ProductionProductMain::getProductionOperationTaskId, workOrderIdList)
@@ -744,12 +888,10 @@
if (reportOutput == null) {
continue;
}
- Long reportMainId = reportOutput.getProductionProductMainId() != null
- ? reportOutput.getProductionProductMainId()
- : reportOutput.getProductMainId();
- if (reportMainId == null) {
+ if (reportOutput.getProductionProductMainId() == null) {
continue;
}
+ Long reportMainId = reportOutput.getProductionProductMainId();
reportOutputMap.computeIfAbsent(reportMainId, k -> new ArrayList<>()).add(reportOutput);
}
@@ -824,6 +966,7 @@
ProductionOrderWorkOrderDetailVo.ReportDetail reportDetail = new ProductionOrderWorkOrderDetailVo.ReportDetail();
reportDetail.setReportMain(reportMain);
+ reportDetail.setWorkHour(reportMain.getWorkHour());
reportDetail.setReportOutputList(reportOutputMap.getOrDefault(reportMainId, Collections.emptyList()));
reportDetail.setReportParamList(reportParamMap.getOrDefault(reportMainId, Collections.emptyList()));
reportDetailList.add(reportDetail);
@@ -834,6 +977,7 @@
inspectDetail.setReportId(reportMainId);
inspectDetail.setReportNo(reportMain.getProductNo());
inspectDetail.setReportMain(reportMain);
+ inspectDetail.setWorkHour(reportMain.getWorkHour());
inspectDetail.setInspect(inspect);
inspectDetail.setInspectParamList(inspectParamMap.getOrDefault(inspect.getId(), Collections.emptyList()));
inspectDetail.setInspectFileList(inspectFileMap.getOrDefault(inspect.getId(), Collections.emptyList()));
@@ -851,6 +995,7 @@
}
private Long resolveProductionOrderId(ProductionOrderDto dto) {
+ // 浠庡叆鍙備腑瑙f瀽鐢熶骇璁㈠崟ID骞舵牎楠�
if (dto == null) {
throw new ServiceException("璇蜂紶鍏ョ敓浜ц鍗旾D鎴栫敓浜ц鍗曞彿");
}
@@ -872,10 +1017,12 @@
@Override
public List<ProductionOrderPickVo> pick(Long productionOrderId) {
+ // 鏌ヨ璁㈠崟棰嗘枡銆佹姇鏂欎笌閫�鏂欐槑缁�
if (productionOrderId == null) {
return Collections.emptyList();
}
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
ProductionOrderBom orderBom = productionOrderBomMapper.selectOne(
Wrappers.<ProductionOrderBom>lambdaQuery()
.eq(ProductionOrderBom::getProductionOrderId, productionOrderId)
@@ -885,12 +1032,57 @@
return Collections.emptyList();
}
- List<ProductionBomStructureVo> bomStructureList = productionBomStructureMapper.pickByBomId(orderBom.getId());
+ // 鏌ヨ瀹屾暣鐨凚OM缁撴瀯锛堝寘鎷牴鑺傜偣锛夛紝鐢ㄤ簬璁$畻灞傜骇闇�姹傛暟閲�
+ List<ProductionBomStructureVo> bomStructureList = productionBomStructureMapper.listByBomId(orderBom.getId());
if (bomStructureList == null || bomStructureList.isEmpty()) {
return Collections.emptyList();
}
- List<Long> productModelIds = bomStructureList.stream()
+ // 鏌ヨ鐢熶骇璁㈠崟鑾峰彇璁㈠崟鏁伴噺
+ ProductionOrder productionOrder = productionOrderMapper.selectById(productionOrderId);
+ BigDecimal orderQuantity = productionOrder != null ? defaultDecimal(productionOrder.getQuantity()) : BigDecimal.ZERO;
+
+ // 鏋勫缓鏍戝舰缁撴瀯骞惰绠楀眰绾ч渶姹傛暟閲�
+ Map<Long, ProductionBomStructureVo> structureByIdMap = bomStructureList.stream()
+ .filter(s -> s != null && s.getId() != null)
+ .collect(Collectors.toMap(ProductionBomStructureVo::getId, s -> s));
+
+ // 鎸夊眰绾ц绠楅渶姹傛暟閲忥細瀛愮骇闇�姹傛暟閲� = 鐖剁骇闇�姹傛暟閲� 脳 瀛愮骇鍗曚綅浜у嚭鎵�闇�鏁伴噺
+ for (ProductionBomStructureVo structure : bomStructureList) {
+ if (structure == null) continue;
+
+ if (structure.getParentId() == null || structure.getParentId() == 0) {
+ // 鏍硅妭鐐癸細闇�姹傛暟閲� = 璁㈠崟鏁伴噺
+ structure.setDemandedQuantity(orderQuantity);
+ } else {
+ // 瀛愯妭鐐癸細闇�姹傛暟閲� = 鐖剁骇闇�姹傛暟閲� 脳 瀛愮骇鍗曚綅浜у嚭鎵�闇�鏁伴噺
+ ProductionBomStructureVo parent = structureByIdMap.get(structure.getParentId());
+ if (parent != null) {
+ BigDecimal parentDemandedQty = defaultDecimal(parent.getDemandedQuantity());
+ BigDecimal unitQuantity = defaultDecimal(structure.getUnitQuantity());
+ structure.setDemandedQuantity(parentDemandedQty.multiply(unitQuantity));
+ }
+ }
+ }
+
+ // 杩囨护鍑洪潪鏍硅妭鐐癸紙瀹為檯棰嗘枡椤癸級
+ // 鎺掗櫎鎶曞叆鍝佷笌浜у嚭鍝佺浉鍚屼笖姣斾緥涓�1鐨勬儏鍐碉紙鑷韩鍔犲伐锛屼笉闇�瑕侀鏂欙級
+ List<ProductionBomStructureVo> childStructureList = bomStructureList.stream()
+ .filter(s -> s != null && s.getParentId() != null && s.getParentId() != 0)
+ .filter(s -> {
+ ProductionBomStructureVo parent = structureByIdMap.get(s.getParentId());
+ if (parent == null) {
+ return true;
+ }
+ // 鎶曞叆鍝佷笌浜у嚭鍝佺浉鍚屼笖姣斾緥涓�1鏃讹紝涓嶉渶瑕侀鏂�
+ boolean sameProduct = Objects.equals(s.getProductModelId(), parent.getProductModelId());
+ boolean unitRatio = BigDecimal.ONE.compareTo(defaultDecimal(s.getUnitQuantity())) == 0;
+ return !(sameProduct && unitRatio);
+ })
+ .collect(Collectors.toList());
+
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
+ List<Long> productModelIds = childStructureList.stream()
.map(ProductionBomStructureVo::getProductModelId)
.filter(Objects::nonNull)
.distinct()
@@ -914,39 +1106,35 @@
}
}
- Map<String, ProductionOrderPickVo> mergedPickMap = new LinkedHashMap<>();
- for (ProductionBomStructureVo structure : bomStructureList) {
+ List<ProductionOrderPickVo> pickList = new ArrayList<>();
+ for (ProductionBomStructureVo structure : childStructureList) {
if (structure == null || structure.getProductModelId() == null) {
continue;
}
Long productModelId = structure.getProductModelId();
- String mergeKey = String.valueOf(structure.getTechnologyOperationId()) + "#" + productModelId;
- ProductionOrderPickVo vo = mergedPickMap.get(mergeKey);
- if (vo == null) {
- vo = new ProductionOrderPickVo();
- vo.setProductModelId(productModelId);
- vo.setOperationName(structure.getOperationName());
- vo.setTechnologyOperationId(structure.getTechnologyOperationId());
- vo.setProductName(structure.getProductName());
- vo.setModel(structure.getModel());
- vo.setDemandedQuantity(BigDecimal.ZERO);
- vo.setUnit(structure.getUnit());
- List<String> batchNoList = stockBatchNoMap.get(productModelId) == null
- ? Collections.emptyList()
- : new ArrayList<>(stockBatchNoMap.get(productModelId));
- vo.setBatchNoList(batchNoList);
- vo.setStockQuantity(stockQuantityMap.getOrDefault(productModelId, BigDecimal.ZERO));
- vo.setBom(true);
- mergedPickMap.put(mergeKey, vo);
- }
- vo.setDemandedQuantity(defaultDecimal(vo.getDemandedQuantity()).add(defaultDecimal(structure.getDemandedQuantity())));
+ ProductionOrderPickVo vo = new ProductionOrderPickVo();
+ vo.setProductModelId(productModelId);
+ vo.setOperationName(structure.getOperationName());
+ vo.setTechnologyOperationId(structure.getTechnologyOperationId());
+ vo.setProductName(structure.getProductName());
+ vo.setModel(structure.getModel());
+ vo.setDemandedQuantity(defaultDecimal(structure.getDemandedQuantity()));
+ vo.setUnit(structure.getUnit());
+ List<String> batchNoList = stockBatchNoMap.get(productModelId) == null
+ ? Collections.emptyList()
+ : new ArrayList<>(stockBatchNoMap.get(productModelId));
+ vo.setBatchNoList(batchNoList);
+ vo.setStockQuantity(stockQuantityMap.getOrDefault(productModelId, BigDecimal.ZERO));
+ vo.setBom(true);
+ pickList.add(vo);
}
- return new ArrayList<>(mergedPickMap.values());
+ return pickList;
}
@Override
public int updateOrder(ProductionOrderDto productionOrderDto) {
- productionOrderDto.setStatus(5);
+ // 鏇存柊鐢熶骇璁㈠崟涓绘暟鎹�
+ productionOrderDto.setStatus(ProductOrderStatusEnum.END.getCode());
return baseMapper.updateById(productionOrderDto);
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionPlanServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionPlanServiceImpl.java
index b3ad742..53b1ee9 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionPlanServiceImpl.java
@@ -6,6 +6,10 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.ProductMapper;
+import com.ruoyi.basic.mapper.ProductModelMapper;
+import com.ruoyi.basic.pojo.Product;
+import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
@@ -44,27 +48,32 @@
private final ProductionPlanMapper productionPlanMapper;
private final ProductionOrderMapper productionOrderMapper;
private final ProductionOrderService productionOrderService;
+ private final ProductModelMapper productModelMapper;
+ private final ProductMapper productMapper;
@Override
public IPage<ProductionPlanVo> listPage(Page<ProductionPlanDto> page, ProductionPlanDto productionPlanDto) {
+ // 鍒嗛〉鏌ヨ涓荤敓浜ц鍒掑垪琛�
return productionPlanMapper.listPage(page, productionPlanDto);
}
/**
* 鍚堝苟鐢熶骇璁″垝骞朵笅鍙戠敓浜ц鍗曘��
- * 涓氬姟绾︽潫锛�
+ * 绾︽潫锛�
* 1. 浠呭厑璁稿悓涓�浜у搧鍨嬪彿鐨勮鍒掑悎骞讹紱
- * 2. 宸蹭笅鍙戞垨閮ㄥ垎涓嬪彂鐨勮鍒掔姝㈠啀娆″悎骞讹紱
- * 3. 涓嬪彂鏁伴噺涓嶈兘澶т簬鎵�閫夎鍒掗渶姹傛�婚噺锛�
- * 4. 璁㈠崟鍒涘缓缁熶竴澶嶇敤 ProductionOrderService.saveProductionOrder锛岀‘淇濆伐鑹�/BOM/棰嗘枡涓诲崟绛夊悗缁�昏緫涓�鑷淬��
+ * 2. 宸蹭笅鍙戞垨閮ㄥ垎涓嬪彂鐨勮鍒掍笉鍏佽鍐嶆鍚堝苟锛�
+ * 3. 涓嬪彂鏁伴噺涓嶈兘澶т簬鎵�閫夎鍒掑墿浣欓渶姹傛�婚噺锛�
+ * 4. 涓嬪彂鏃剁粺涓�璋冪敤 ProductionOrderService.saveProductionOrder锛岀‘淇濆悗缁伐鑹�/BOM/棰嗘枡閫昏緫涓�鑷淬��
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean combine(ProductionPlanDto productionPlanDto) {
+ // 鍩虹鍏ュ弬鏍¢獙锛氭病鏈夊彲涓嬪彂璁″垝鍒欑洿鎺ヨ繑鍥� false
if (productionPlanDto == null || productionPlanDto.getIds() == null || productionPlanDto.getIds().isEmpty()) {
return false;
}
+ // 鍘荤┖銆佸幓閲嶏紝寰楀埌鏈鍙備笌鍚堝苟鐨勮鍒� ID
List<Long> planIds = productionPlanDto.getIds().stream()
.filter(Objects::nonNull)
.distinct()
@@ -73,43 +82,52 @@
throw new ServiceException("涓嬪彂澶辫触锛屾湭閫夋嫨鐢熶骇璁″垝");
}
+ // 鏌ヨ骞舵牎楠岃鍒掓槸鍚﹂兘瀛樺湪
List<ProductionPlanDto> planLists = productionPlanMapper.selectWithMaterialByIds(planIds);
if (planLists == null || planLists.isEmpty() || planLists.size() != planIds.size()) {
throw new ServiceException("涓嬪彂澶辫触锛岀敓浜ц鍒掍笉瀛樺湪鎴栧凡琚垹闄�");
}
+ // 浠ョ涓�鏉¤鍒掍綔涓哄瀷鍙峰熀鍑�
ProductionPlanDto firstPlan = planLists.getFirst();
if (firstPlan.getProductModelId() == null) {
throw new ServiceException("涓嬪彂澶辫触锛岀敓浜ц鍒掔己灏戜骇鍝佸瀷鍙�");
}
+ // 浠呭厑璁稿悓鍨嬪彿璁″垝鍚堝苟涓嬪彂
boolean hasDifferentModel = planLists.stream()
.anyMatch(item -> !Objects.equals(item.getProductModelId(), firstPlan.getProductModelId()));
if (hasDifferentModel) {
throw new BaseException("鍚堝苟澶辫触锛屾墍閫夌敓浜ц鍒掔殑浜у搧鍨嬪彿涓嶄竴鑷�");
}
- boolean hasIssuedPlan = planLists.stream()
- .anyMatch(item -> item.getStatus() != null && item.getStatus() == PLAN_STATUS_ISSUED);
- if (hasIssuedPlan) {
- throw new BaseException("鍚堝苟澶辫触锛屾墍閫夌敓浜ц鍒掑瓨鍦ㄥ凡涓嬪彂鎴栭儴鍒嗕笅鍙戞暟鎹�");
+ // 浠呪�滃凡涓嬪彂鈥濊鍒掍笉鍏佽鍐嶆鍙備笌鍚堝苟涓嬪彂锛�
+ // 鈥滃緟涓嬪彂/閮ㄥ垎涓嬪彂鈥濆厑璁哥户缁笅鍙戝墿浣欐暟閲忋��
+ boolean hasFullyIssuedPlan = planLists.stream()
+ .anyMatch(item -> item.getStatus() != null
+ && item.getStatus() == PLAN_STATUS_ISSUED);
+ if (hasFullyIssuedPlan) {
+ throw new BaseException("鍚堝苟澶辫触锛屾墍閫夌敓浜ц鍒掑瓨鍦ㄥ凡涓嬪彂鐨勬暟鎹�");
}
+ // 璁$畻鏈鍙笅鍙戠殑鍓╀綑闇�姹傛�婚噺
BigDecimal totalRequiredQuantity = planLists.stream()
.map(this::resolveRemainingQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (totalRequiredQuantity.compareTo(BigDecimal.ZERO) <= 0) {
- throw new ServiceException("涓嬪彂澶辫触锛屾墍閫夌敓浜ц鍒掗渶姹傛�婚噺蹇呴』澶т簬0");
+ throw new ServiceException("涓嬪彂澶辫触锛屾墍閫夌敓浜ц鍒掑墿浣欓渶姹傛�婚噺蹇呴』澶т簬0");
}
+ // 鏍¢獙涓嬪彂鏁伴噺
BigDecimal assignedQuantity = productionPlanDto.getTotalAssignedQuantity();
if (assignedQuantity == null || assignedQuantity.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("涓嬪彂澶辫触锛屼笅鍙戞暟閲忓繀椤诲ぇ浜�0");
}
if (assignedQuantity.compareTo(totalRequiredQuantity) > 0) {
- throw new ServiceException("涓嬪彂澶辫触锛屼笅鍙戞暟閲忎笉鑳藉ぇ浜庤鍒掗渶姹傛�婚噺");
+ throw new ServiceException("涓嬪彂澶辫触锛屼笅鍙戞暟閲忎笉鑳藉ぇ浜庤鍒掑墿浣欓渶姹傛�婚噺");
}
+ // 鎸夎鍒掗『搴忓垎鎽婁笅鍙戞暟閲忥紝鏀堕泦瀹為檯鍙備笌涓嬪彂鐨勮鍒� ID
BigDecimal remainingForOrderBind = assignedQuantity;
List<Long> issuedPlanIds = new ArrayList<>();
for (ProductionPlanDto plan : planLists) {
@@ -124,21 +142,20 @@
}
}
if (issuedPlanIds.isEmpty()) {
- throw new ServiceException("Issue failed, no quantity available for dispatch");
+ throw new ServiceException("涓嬪彂澶辫触锛屾棤鍙笅鍙戞暟閲�");
}
+ // 鐢熸垚鐢熶骇璁㈠崟涓诲崟锛屽苟缁戝畾鏈涓嬪彂鍏宠仈鐨勮鍒�
ProductionOrder productionOrder = new ProductionOrder();
productionOrder.setProductionPlanIds(formatPlanIds(issuedPlanIds));
productionOrder.setProductModelId(firstPlan.getProductModelId());
productionOrder.setQuantity(assignedQuantity);
productionOrder.setPlanCompleteTime(productionPlanDto.getPlanCompleteTime());
-
- boolean saved = productionOrderService.saveProductionOrder(productionOrder);
- if (!saved) {
+ if (!productionOrderService.saveProductionOrder(productionOrder)) {
throw new ServiceException("涓嬪彂澶辫触锛岀敓浜ц鍗曚繚瀛樺け璐�");
}
- //宸蹭笅鍙戞暟閲�
+ // 鍥炲啓姣忔潯璁″垝鐨勭疮璁′笅鍙戦噺鍜岀姸鎬�
BigDecimal remainingAssignedQuantity = assignedQuantity;
List<ProductionPlan> updates = new ArrayList<>();
for (ProductionPlanDto plan : planLists) {
@@ -163,6 +180,7 @@
updates.add(update);
}
if (!updates.isEmpty()) {
+ // 鎵归噺鏇存柊璁″垝鐘舵�佷笌鏁伴噺
this.updateBatchById(updates);
}
return true;
@@ -171,17 +189,24 @@
@Override
@Transactional(rollbackFor = Exception.class)
public boolean add(ProductionPlanDto dto) {
+ // 鏂板涓荤敓浜ц鍒�
if (StringUtils.isBlank(dto.getMpsNo())) {
- dto.setMpsNo(generateNextPlanNo(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))));
- }else checkMpsNoUnique(dto.getMpsNo(), null);
+ String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+ dto.setMpsNo(buildPlanNo(datePrefix, resolveNextPlanSequence(datePrefix)));
+ } else {
+ checkMpsNoUnique(dto.getMpsNo(), null);
+ }
dto.setStatus(PLAN_STATUS_WAIT);
- dto.setSource("鍐呴儴");
+ if (StringUtils.isBlank(dto.getSource())) {
+ dto.setSource("鍐呴儴");
+ }
return productionPlanMapper.insert(dto) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean update(ProductionPlanDto dto) {
+ // 鏇存柊涓荤敓浜ц鍒�
if (dto == null || dto.getId() == null) {
throw new ServiceException("缂栬緫澶辫触锛屾暟鎹笉鑳戒负绌�");
}
@@ -202,20 +227,10 @@
return productionPlanMapper.updateById(dto) > 0;
}
- private void checkMpsNoUnique(String mpsNo, Long excludeId) {
- LambdaQueryWrapper<ProductionPlan> wrapper = Wrappers.lambdaQuery();
- wrapper.eq(ProductionPlan::getMpsNo, mpsNo);
- if (excludeId != null) {
- wrapper.ne(ProductionPlan::getId, excludeId);
- }
- if (productionPlanMapper.selectCount(wrapper) > 0) {
- throw new ServiceException("鐢熶骇璁″垝鍙� " + mpsNo + " 宸插瓨鍦�");
- }
- }
-
@Override
@Transactional(rollbackFor = Exception.class)
public boolean delete(List<Long> ids) {
+ // 鍒犻櫎涓荤敓浜ц鍒�
if (productionPlanMapper.selectList(Wrappers.<ProductionPlan>lambdaQuery().in(ProductionPlan::getId, ids))
.stream()
.anyMatch(p -> p.getStatus() == PLAN_STATUS_PARTIAL || p.getStatus() == PLAN_STATUS_ISSUED)) {
@@ -234,6 +249,7 @@
@Override
@Transactional(rollbackFor = Exception.class)
public void importProdData(MultipartFile file) {
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (file == null || file.isEmpty()) {
throw new ServiceException("瀵煎叆鏁版嵁涓嶈兘涓虹┖");
}
@@ -247,104 +263,251 @@
if (list == null || list.isEmpty()) {
throw new ServiceException("Excel娌℃湁鏁版嵁");
}
+
+ String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+ int nextSequence = resolveNextPlanSequence(datePrefix);
Set<String> mpsNos = new HashSet<>();
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
for (int i = 0; i < list.size(); i++) {
ProductionPlanImportDto dto = list.get(i);
- String mpsNo = dto.getMpsNo();
+ String mpsNo = StringUtils.trim(dto.getMpsNo());
if (StringUtils.isEmpty(mpsNo)) {
- generateNextPlanNo(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
+ mpsNo = buildPlanNo(datePrefix, nextSequence++);
}
+ dto.setMpsNo(mpsNo);
if (!mpsNos.add(mpsNo)) {
- throw new ServiceException("瀵煎叆澶辫触锛欵xcel 涓瓨鍦ㄩ噸澶嶇殑鐢宠鍗曠紪鍙� " + mpsNo);
+ throw new ServiceException("瀵煎叆澶辫触锛孍xcel涓瓨鍦ㄩ噸澶嶇殑涓荤敓浜ц鍒掑彿 " + mpsNo);
+ }
+ if (dto.getQtyRequired() == null || dto.getQtyRequired().compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("瀵煎叆澶辫触锛氱" + (i + 2) + "琛岄渶姹傛暟閲忓繀椤诲ぇ浜�0");
}
}
- Long existApplyNoCount = baseMapper.selectCount(Wrappers.<ProductionPlan>lambdaQuery()
- .in(ProductionPlan::getMpsNo, mpsNos));
+
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
+ Long existApplyNoCount = baseMapper.selectCount(Wrappers.<ProductionPlan>lambdaQuery().in(ProductionPlan::getMpsNo, mpsNos));
if (existApplyNoCount > 0) {
- List<String> existMpsNos = baseMapper.selectList(Wrappers.<ProductionPlan>lambdaQuery()
- .in(ProductionPlan::getMpsNo, mpsNos))
+ List<String> existMpsNos = baseMapper.selectList(Wrappers.<ProductionPlan>lambdaQuery().in(ProductionPlan::getMpsNo, mpsNos))
.stream()
.map(ProductionPlan::getMpsNo)
.collect(Collectors.toList());
- throw new ServiceException("瀵煎叆澶辫触锛岀敓浜ц鍒掑彿宸插瓨鍦�: " + String.join(", ", existMpsNos));
+ throw new ServiceException("瀵煎叆澶辫触锛屼富鐢熶骇璁″垝鍙峰凡瀛樺湪: " + String.join(", ", existMpsNos));
}
+
+ List<ProductModel> allModels = productModelMapper.selectList(Wrappers.<ProductModel>lambdaQuery());
+ Set<Long> productIds = allModels.stream()
+ .map(ProductModel::getProductId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toSet());
+ Map<Long, String> productNameById = productIds.isEmpty()
+ ? Collections.emptyMap()
+ : productMapper.selectBatchIds(productIds).stream()
+ .collect(Collectors.toMap(Product::getId, Product::getProductName, (a, b) -> a));
+
LocalDateTime now = LocalDateTime.now();
- List<ProductionPlan> entityList = list.stream().map(dto -> {
+ List<ProductionPlan> entityList = new ArrayList<>();
+ for (int i = 0; i < list.size(); i++) {
+ ProductionPlanImportDto dto = list.get(i);
ProductionPlan entity = new ProductionPlan();
BeanUtils.copyProperties(dto, entity);
+ entity.setProductModelId(resolveProductModelId(dto, i + 2, allModels, productNameById));
entity.setStatus(PLAN_STATUS_WAIT);
entity.setSource("鍐呴儴");
+ entity.setQuantityIssued(BigDecimal.ZERO);
entity.setCreateTime(now);
entity.setUpdateTime(now);
- return entity;
- }).collect(Collectors.toList());
- this.saveBatch(entityList);
+ entityList.add(entity);
+ }
+ // 鎸佷箙鍖栨垨杈撳嚭澶勭悊缁撴灉
+ if (!this.saveBatch(entityList)) {
+ throw new ServiceException("瀵煎叆澶辫触锛屼繚瀛樼敓浜ц鍒掓暟鎹け璐�");
+ }
}
@Override
- public void exportProdData(HttpServletResponse response, List<Long> ids) {
- List<ProductionPlanDto> list = productionPlanMapper.selectWithMaterialByIds(ids);
+ public void exportProdData(HttpServletResponse response, ProductionPlanDto requestDto) {
+ // 瀵煎嚭涓荤敓浜ц鍒掓暟鎹�
+ List<Long> ids = requestDto == null || requestDto.getIds() == null
+ ? Collections.emptyList()
+ : requestDto.getIds().stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
+
List<ProductionPlanImportDto> exportList = new ArrayList<>();
- for (ProductionPlanDto entity : list) {
- ProductionPlanImportDto dto = new ProductionPlanImportDto();
- BeanUtils.copyProperties(entity, dto);
- exportList.add(dto);
+ if (!ids.isEmpty()) {
+ List<ProductionPlanDto> list = productionPlanMapper.selectWithMaterialByIds(ids);
+ for (ProductionPlanDto item : list) {
+ ProductionPlanImportDto dto = new ProductionPlanImportDto();
+ BeanUtils.copyProperties(item, dto);
+ dto.setAssignedQuantity(item.getQuantityIssued());
+ exportList.add(dto);
+ }
+ } else {
+ ProductionPlanDto query = new ProductionPlanDto();
+ if (requestDto != null) {
+ BeanUtils.copyProperties(requestDto, query);
+ }
+ IPage<ProductionPlanVo> page = productionPlanMapper.listPage(new Page<>(1, -1), query);
+ if (page != null && page.getRecords() != null) {
+ for (ProductionPlanVo item : page.getRecords()) {
+ ProductionPlanImportDto dto = new ProductionPlanImportDto();
+ BeanUtils.copyProperties(item, dto);
+ dto.setAssignedQuantity(item.getQuantityIssued());
+ exportList.add(dto);
+ }
+ }
}
+
ExcelUtil<ProductionPlanImportDto> util = new ExcelUtil<>(ProductionPlanImportDto.class);
util.exportExcel(response, exportList, "涓荤敓浜ц鍒�");
}
- private BigDecimal resolveRemainingQuantity(ProductionPlan plan) {
- if (plan == null) {
- return BigDecimal.ZERO;
+ /**
+ * 鏍¢獙涓荤敓浜ц鍒掑彿鍞竴鎬э紝鍙�氳繃 excludeId 鎺掗櫎褰撳墠璁板綍銆�
+ */
+ private void checkMpsNoUnique(String mpsNo, Long excludeId) {
+ // 鎸変富鐢熶骇璁″垝鍙锋煡璇㈤噸澶嶈褰�
+ LambdaQueryWrapper<ProductionPlan> wrapper = Wrappers.lambdaQuery();
+ wrapper.eq(ProductionPlan::getMpsNo, mpsNo);
+ if (excludeId != null) {
+ // 鏇存柊鏃舵帓闄ゅ綋鍓嶈褰曟湰韬�
+ wrapper.ne(ProductionPlan::getId, excludeId);
}
- BigDecimal requiredQuantity = Optional.ofNullable(plan.getQtyRequired()).orElse(BigDecimal.ZERO);
- if (requiredQuantity.compareTo(BigDecimal.ZERO) <= 0) {
- return BigDecimal.ZERO;
+ if (productionPlanMapper.selectCount(wrapper) > 0) {
+ // 瀛樺湪閲嶅璁″垝鍙凤紝鐩存帴鎷︽埅
+ throw new ServiceException("鐢熶骇璁″垝鍙� " + mpsNo + " 宸插瓨鍦�");
}
- BigDecimal issuedQuantity = Optional.ofNullable(plan.getQuantityIssued()).orElse(BigDecimal.ZERO);
- if (issuedQuantity.compareTo(BigDecimal.ZERO) <= 0) {
- return requiredQuantity;
- }
- if (issuedQuantity.compareTo(requiredQuantity) >= 0) {
- return BigDecimal.ZERO;
- }
- return requiredQuantity.subtract(issuedQuantity);
}
- private int resolvePlanStatus(BigDecimal requiredQuantity, BigDecimal issuedQuantity) {
- if (requiredQuantity == null || requiredQuantity.compareTo(BigDecimal.ZERO) <= 0) {
- return PLAN_STATUS_WAIT;
+ /**
+ * 鏍规嵁瀵煎叆琛岀殑鍨嬪彿銆佷骇鍝佸悕绉般�佸崟浣嶅畾浣嶅敮涓�鐨勪骇鍝佸瀷鍙� ID銆�
+ */
+ private Long resolveProductModelId(ProductionPlanImportDto dto, int rowNo, List<ProductModel> allModels,
+ Map<Long, String> productNameById) {
+ // 鍏堟寜瑙勬牸鍨嬪彿鍋氱涓�杞繃婊�
+ String model = StringUtils.trim(dto.getModel());
+ if (StringUtils.isEmpty(model)) {
+ throw new ServiceException("瀵煎叆澶辫触锛氱" + rowNo + "琛岃鏍煎瀷鍙蜂笉鑳戒负绌�");
}
- if (issuedQuantity == null || issuedQuantity.compareTo(BigDecimal.ZERO) <= 0) {
- return PLAN_STATUS_WAIT;
+
+ List<ProductModel> candidates = allModels.stream()
+ .filter(item -> model.equals(StringUtils.trim(item.getModel())))
+ .collect(Collectors.toList());
+ if (candidates.isEmpty()) {
+ throw new ServiceException("瀵煎叆澶辫触锛氱" + rowNo + "琛岃鏍煎瀷鍙蜂笉瀛樺湪锛屽瀷鍙凤細" + model);
}
- return issuedQuantity.compareTo(requiredQuantity) < 0 ? PLAN_STATUS_PARTIAL : PLAN_STATUS_ISSUED;
+
+ // 鑻ヤ紶浜嗕骇鍝佸悕绉帮紝鍐嶅仛绗簩杞繃婊�
+ String productName = StringUtils.trim(dto.getProductName());
+ if (StringUtils.isNotEmpty(productName)) {
+ candidates = candidates.stream()
+ .filter(item -> productName.equals(StringUtils.trim(productNameById.get(item.getProductId()))))
+ .collect(Collectors.toList());
+ if (candidates.isEmpty()) {
+ throw new ServiceException("瀵煎叆澶辫触锛氱" + rowNo + "琛屼骇鍝佸悕绉颁笌瑙勬牸鍨嬪彿涓嶅尮閰�");
+ }
+ }
+
+ // 鑻ヤ紶浜嗗崟浣嶏紝鍐嶅仛绗笁杞繃婊�
+ String unit = StringUtils.trim(dto.getUnit());
+ if (StringUtils.isNotEmpty(unit)) {
+ candidates = candidates.stream()
+ .filter(item -> unit.equals(StringUtils.trim(item.getUnit())))
+ .collect(Collectors.toList());
+ if (candidates.isEmpty()) {
+ throw new ServiceException("瀵煎叆澶辫触锛氱" + rowNo + "琛屽崟浣嶄笌瑙勬牸鍨嬪彿涓嶅尮閰�");
+ }
+ }
+
+ // 浠嶇劧澶氭潯璇存槑淇℃伅涓嶈冻浠ュ敮涓�瀹氫綅
+ if (candidates.size() > 1) {
+ throw new ServiceException("瀵煎叆澶辫触锛氱" + rowNo + "琛岃鏍煎瀷鍙峰尮閰嶅埌澶氫釜浜у搧锛岃琛ュ厖浜у搧鍚嶇О鎴栧崟浣�");
+ }
+ return candidates.get(0).getId();
}
- private String formatPlanIds(List<Long> planIds) {
- return planIds.stream()
- .filter(Objects::nonNull)
- .distinct()
- .map(String::valueOf)
- .collect(Collectors.joining(",", "[", "]"));
+ /**
+ * 鐢熸垚涓荤敓浜ц鍒掑彿锛屾牸寮忥細JH + yyyyMMdd + 4浣嶆祦姘村彿銆�
+ */
+ private String buildPlanNo(String datePrefix, int sequence) {
+ // 缁熶竴璁″垝鍙锋牸寮忥細JH + 鏃ユ湡 + 4浣嶆祦姘村彿
+ return "JH" + datePrefix + String.format("%04d", sequence);
}
- private String generateNextPlanNo(String datePrefix) {
+ /**
+ * 鏌ヨ褰撴棩宸插瓨鍦ㄧ殑鏈�澶ф祦姘村彿锛屽苟杩斿洖涓嬩竴涓彲鐢ㄦ祦姘村彿銆�
+ */
+ private int resolveNextPlanSequence(String datePrefix) {
+ // 鏌ヨ褰撴棩鏈�鏂颁竴鏉¤鍒掑彿
QueryWrapper<ProductionPlan> queryWrapper = new QueryWrapper<>();
queryWrapper.likeRight("mps_no", "JH" + datePrefix);
queryWrapper.orderByDesc("mps_no");
queryWrapper.last("LIMIT 1");
ProductionPlan latestPlan = productionPlanMapper.selectOne(queryWrapper);
+
+ // 榛樿浠� 0001 寮�濮�
int sequence = 1;
- if (latestPlan != null && latestPlan.getMpsNo() != null && !latestPlan.getMpsNo().isEmpty()) {
+ if (latestPlan != null && StringUtils.isNotEmpty(latestPlan.getMpsNo())) {
+ // 鎴彇鏈熬娴佹按鍙峰苟閫掑
String sequenceStr = latestPlan.getMpsNo().substring(("JH" + datePrefix).length());
try {
sequence = Integer.parseInt(sequenceStr) + 1;
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException ignored) {
+ // 鍘嗗彶鏁版嵁鏍煎紡寮傚父鏃跺洖閫�鍒� 0001
sequence = 1;
}
}
- return "JH" + datePrefix + String.format("%04d", sequence);
+ return sequence;
+ }
+
+ /**
+ * 璁$畻鐢熶骇璁″垝鐨勫墿浣欐湭涓嬪彂鏁伴噺锛堥渶姹傞噺 - 宸蹭笅鍙戦噺锛屾渶灏忎负 0锛夈��
+ */
+ private BigDecimal resolveRemainingQuantity(ProductionPlan plan) {
+ // 绌哄璞℃寜 0 澶勭悊
+ if (plan == null) {
+ return BigDecimal.ZERO;
+ }
+ // 闇�姹傞噺涓虹┖鎴栧皬浜庣瓑浜� 0锛岃涓烘棤鍓╀綑
+ BigDecimal requiredQuantity = Optional.ofNullable(plan.getQtyRequired()).orElse(BigDecimal.ZERO);
+ if (requiredQuantity.compareTo(BigDecimal.ZERO) <= 0) {
+ return BigDecimal.ZERO;
+ }
+ // 宸蹭笅鍙戦噺涓虹┖鎴栧皬浜庣瓑浜� 0锛屽墿浣欏嵆闇�姹傞噺
+ BigDecimal issuedQuantity = Optional.ofNullable(plan.getQuantityIssued()).orElse(BigDecimal.ZERO);
+ if (issuedQuantity.compareTo(BigDecimal.ZERO) <= 0) {
+ return requiredQuantity;
+ }
+ // 宸蹭笅鍙戦噺澶т簬绛変簬闇�姹傞噺锛屽墿浣欏綊闆�
+ if (issuedQuantity.compareTo(requiredQuantity) >= 0) {
+ return BigDecimal.ZERO;
+ }
+ // 姝e父鍦烘櫙杩斿洖宸��
+ return requiredQuantity.subtract(issuedQuantity);
+ }
+
+ /**
+ * 鎸夐渶姹傞噺涓庣疮璁′笅鍙戦噺鎺ㄥ璁″垝鐘舵�併��
+ */
+ private int resolvePlanStatus(BigDecimal requiredQuantity, BigDecimal issuedQuantity) {
+ // 鏃犳湁鏁堥渶姹傞噺鏃讹紝鐘舵�佷繚鎸佸緟涓嬪彂
+ if (requiredQuantity == null || requiredQuantity.compareTo(BigDecimal.ZERO) <= 0) {
+ return PLAN_STATUS_WAIT;
+ }
+ // 鏈夐渶姹備絾鏈笅鍙戯紝鐘舵�佷粛涓哄緟涓嬪彂
+ if (issuedQuantity == null || issuedQuantity.compareTo(BigDecimal.ZERO) <= 0) {
+ return PLAN_STATUS_WAIT;
+ }
+ // 宸蹭笅鍙戦噺灏忎簬闇�姹傞噺涓洪儴鍒嗕笅鍙戯紝鍚﹀垯涓哄凡涓嬪彂
+ return issuedQuantity.compareTo(requiredQuantity) < 0 ? PLAN_STATUS_PARTIAL : PLAN_STATUS_ISSUED;
+ }
+
+ /**
+ * 灏嗚鍒� ID 闆嗗悎杞垚 [1,2,3] 褰㈠紡锛屽啓鍏ョ敓浜ц鍗曞叧鑱斿瓧娈点��
+ */
+ private String formatPlanIds(List<Long> planIds) {
+ // 鍘婚噸骞舵嫾鎺ヤ负 [1,2,3] 褰㈠紡鐨勫瓧绗︿覆
+ return planIds.stream()
+ .filter(Objects::nonNull)
+ .distinct()
+ .map(String::valueOf)
+ .collect(Collectors.joining(",", "[", "]"));
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductInputServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductInputServiceImpl.java
index 38e0baf..64d78fb 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductInputServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductInputServiceImpl.java
@@ -17,6 +17,7 @@
@Override
public IPage<ProductionProductInputDto> listPageProductionProductInputDto(Page page, ProductionProductInputDto productionProductInputDto) {
+ // 鍒嗛〉鏌ヨ鐢熶骇浜у搧鍏ュ簱
return productionProductInputMapper.listPageProductionProductInputDto(page, productionProductInputDto);
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
index 150fc89..4a8366a 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -12,7 +12,6 @@
import com.ruoyi.basic.pojo.Product;
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.bean.BeanUtils;
@@ -27,6 +26,8 @@
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.quality.mapper.*;
import com.ruoyi.quality.pojo.*;
+import com.ruoyi.stock.pojo.StockInRecord;
+import com.ruoyi.stock.service.StockInRecordService;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.service.StockInventoryService;
import com.ruoyi.technology.mapper.TechnologyOperationMapper;
@@ -78,10 +79,12 @@
private final TechnologyRoutingOperationMapper technologyRoutingOperationMapper;
private final TechnologyOperationMapper technologyOperationMapper;
private final StockUtils stockUtils;
+ private final StockInRecordService stockInRecordService;
private final StockInventoryService stockInventoryService;
@Override
public IPage<ProductionProductMainDto> listPageProductionProductMainDto(Page page, ProductionProductMainDto productionProductMainDto) {
+ // 鍒嗛〉鏌ヨ鐢熶骇鎶ュ伐涓昏〃
IPage<ProductionProductMainDto> result = productionProductMainMapper.listPageProductionProductMainDto(page, productionProductMainDto);
fillOperationParamList(result.getRecords());
return result;
@@ -89,20 +92,24 @@
@Override
public IPage<ProductionProductMainDto> pageProductionProductMain(Page page, ProductionProductMainDto productionProductMainDto) {
+ // 鍒嗛〉鏌ヨ鐢熶骇鎶ュ伐涓昏〃
return listPageProductionProductMainDto(page, productionProductMainDto);
}
@Override
public ProductionProductMainDto getProductionProductMainInfo(Long id) {
+ // 鑾峰彇鐢熶骇浜у搧涓昏〃璇︽儏
return listPageProductionProductMainDto(new Page<>(1, 1), new ProductionProductMainDto() {{
setId(id);
}}).getRecords().stream().findFirst().orElse(null);
}
private void fillOperationParamList(List<ProductionProductMainDto> recordList) {
+ // 濉厖宸ュ簭鍙傛暟鍒楄〃
if (recordList == null || recordList.isEmpty()) {
return;
}
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
Set<Long> mainIdSet = recordList.stream()
.map(ProductionProductMainDto::getId)
.filter(Objects::nonNull)
@@ -112,6 +119,7 @@
return;
}
+ // 鏌ヨ骞跺噯澶囦笟鍔℃暟鎹�
List<ProductionOrderRoutingOperationParam> paramList = productionOrderRoutingOperationParamMapper.selectList(
Wrappers.<ProductionOrderRoutingOperationParam>lambdaQuery()
.in(ProductionOrderRoutingOperationParam::getProductionProductMainId, mainIdSet)
@@ -211,6 +219,7 @@
@Override
public Boolean addProductMain(ProductionProductMainDto dto) {
+ // 鏂板鐢熶骇鎶ュ伐涓昏褰�
Long taskId = resolveTaskId(dto);
if (taskId == null) {
throw new ServiceException("璇蜂紶鍏ョ敓浜у伐鍗旾D");
@@ -220,11 +229,13 @@
@Override
public Boolean saveProductionProductMain(ProductionProductMainDto productionProductMainDto) {
+ // 淇濆瓨鐢熶骇鎶ュ伐涓昏褰�
return addProductMain(productionProductMainDto);
}
@Override
public Boolean removeProductMain(Long id) {
+ // 鍒犻櫎鐢熶骇鎶ュ伐涓昏褰�
ProductionProductMain currentMain = productionProductMainMapper.selectById(id);
if (currentMain == null) {
return true;
@@ -233,10 +244,10 @@
}
private Boolean addProductMainByProductionTask(ProductionProductMainDto dto) {
- // 鎶ュ伐浠ヨ鍗曞伐搴忓揩鐓т负鍑嗭紝閬垮厤宸ヨ壓涓绘暟鎹彉鏇村悗褰卞搷鍘嗗彶宸ュ崟鎵ц銆�
+ // 鎸夌敓浜т换鍔℃柊澧炴姤宸ヤ富璁板綍
Long taskId = resolveTaskId(dto);
if (taskId == null) {
- throw new ServiceException("productionOperationTaskId can not be null");
+ throw new ServiceException("鐢熶骇宸ュ崟ID涓嶈兘涓虹┖");
}
SysUser user = userMapper.selectUserById(dto.getUserId());
ProductionOperationTask productionOperationTask = productionOperationTaskMapper.selectById(taskId);
@@ -266,6 +277,7 @@
productionProductMain.setUserName(user == null ? dto.getUserName() : user.getNickName());
productionProductMain.setProductionOperationTaskId(taskId);
productionProductMain.setStatus(0);
+ productionProductMain.setWorkHour(dto.getWorkHour());
productionProductMainMapper.insert(productionProductMain);
syncOperationParamInputValue(dto, routingOperation.getId(), productionProductMain.getId());
@@ -282,7 +294,6 @@
// 褰撳墠瀹炵幇鎸夊伐搴忔垚鍝佺洿鎺ヤ綔涓烘姇鍏ワ紝鍚庣画鑻ユ帴鍏ラ鏂欒褰曞彲鍦ㄨ繖閲屾浛鎹㈡潵婧愩��
ProductionProductInput productionProductInput = new ProductionProductInput();
productionProductInput.setProductionProductMainId(productionProductMain.getId());
- productionProductInput.setProductMainId(productionProductMain.getId());
productionProductInput.setProductModelId(item.getProductModelId());
productionProductInput.setInputQuantity(item.getUnitQuantity().multiply(defaultDecimal(dto.getQuantity())));
productionProductInput.setQuantity(productionProductInput.getInputQuantity());
@@ -291,13 +302,14 @@
ProductionProductOutput productionProductOutput = new ProductionProductOutput();
productionProductOutput.setProductionProductMainId(productionProductMain.getId());
- productionProductOutput.setProductMainId(productionProductMain.getId());
productionProductOutput.setProductModelId(productModel.getId());
productionProductOutput.setQuantity(defaultDecimal(dto.getQuantity()));
productionProductOutput.setScrapQty(defaultDecimal(dto.getScrapQty()));
productionProductOutputMapper.insert(productionProductOutput);
BigDecimal reportQty = defaultDecimal(productionProductOutput.getQuantity());
+ BigDecimal scrapQty = defaultDecimal(productionProductOutput.getScrapQty());
BigDecimal productQty = reportQty;
+ String qualifiedBatchNo = null;
List<ProductionOrderRoutingOperation> routingOperationList = productionOrderRoutingOperationMapper.selectList(
Wrappers.<ProductionOrderRoutingOperation>lambdaQuery()
@@ -343,6 +355,11 @@
stockInventoryDto.setQualitity(productQty);
stockInventoryDto.setProductModelId(productModel.getId());
stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+ qualifiedBatchNo = resolveLatestStockInBatchNo(
+ productionProductMain.getId(),
+ StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(),
+ productModel.getId(),
+ "0");
}
productionOperationTask.setCompleteQuantity(defaultDecimal(productionOperationTask.getCompleteQuantity()).add(productQty));
@@ -361,8 +378,10 @@
if (ObjectUtils.isNull(productionOrder.getStartTime())) {
productionOrder.setStartTime(LocalDateTime.now());
}
- // 璁㈠崟鐘舵�佺敱鏈�鍚庝竴閬撳伐搴忕殑鍚堟牸浜у嚭鎺ㄥ姩锛岄伩鍏嶄腑闂村伐搴忔彁鍓嶅畬宸ャ��
- productionOrder.setStatus(ProductOrderStatusEnum.RUNNING.getCode());
+ // 浠呭緟寮�濮嬬姸鎬佹墠鎺ㄨ繘鍒拌繘琛屼腑锛岄伩鍏嶉潪鏈亾宸ュ簭鎶ュ伐鏃惰鐩栧凡瀹屾垚鐘舵�併��
+ if (ProductOrderStatusEnum.WAIT.getCode().equals(productionOrder.getStatus())) {
+ productionOrder.setStatus(ProductOrderStatusEnum.RUNNING.getCode());
+ }
if (isLastOperation) {
productionOrder.setCompleteQuantity(defaultDecimal(productionOrder.getCompleteQuantity()).add(productQty));
if (productionOrder.getQuantity() != null
@@ -381,21 +400,45 @@
}
ProductionAccount productionAccount = new ProductionAccount();
productionAccount.setProductionProductMainId(productionProductMain.getId());
-// productionAccount.setSalesLedgerId(productionOrder.getSalesLedgerId());
-// productionAccount.setSalesLedgerProductId(productionOrder.getSalesLedgerProductId() == null ? null : productionOrder.getSalesLedgerProductId().longValue());
productionAccount.setSchedulingUserId(user == null ? null : user.getUserId());
productionAccount.setSchedulingUserName(user == null ? dto.getUserName() : user.getNickName());
productionAccount.setFinishedNum(productQty);
- productionAccount.setWorkHours(workHours);
+ productionAccount.setWorkHours(technologyOperation != null ? technologyOperation.getSalaryQuota() : null);
productionAccount.setTechnologyOperationName(technologyOperation == null ? null : technologyOperation.getName());
productionAccount.setSchedulingDate(LocalDateTime.now());
productionAccountMapper.insert(productionAccount);
}
-// if (defaultDecimal(dto.getScrapQty()).compareTo(BigDecimal.ZERO) > 0) {
-// stockUtils.addUnStock(productModel.getId(), dto.getScrapQty(),
-// StockInUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), productionProductMain.getId());
-// }
+ if (scrapQty.compareTo(BigDecimal.ZERO) > 0) {
+ stockUtils.addUnStockWithBatchNo(
+ productModel.getId(),
+ scrapQty,
+ StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(),
+ productionProductMain.getId(),
+ qualifiedBatchNo);
+ }
return true;
+ }
+
+ private String resolveLatestStockInBatchNo(Long recordId,
+ String recordType,
+ Long productModelId,
+ String stockType) {
+ if (recordId == null || productModelId == null) {
+ return null;
+ }
+ StockInRecord stockInRecord = stockInRecordService.getOne(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordId, recordId)
+ .eq(StockInRecord::getRecordType, recordType)
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .eq(StockInRecord::getType, stockType)
+ .orderByDesc(StockInRecord::getId)
+ .last("limit 1"),
+ false);
+ if (stockInRecord == null) {
+ throw new ServiceException("鏈壘鍒板搴旂殑鍏ュ簱鐢宠璁板綍");
+ }
+ return stockInRecord.getBatchNo();
}
private void syncOperationParamInputValue(ProductionProductMainDto dto,
@@ -522,12 +565,14 @@
}
private Boolean removeProductMainByProductionTask(ProductionProductMain productionProductMain) {
- // 鍒犻櫎鎶ュ伐闇�瑕佸悓姝ュ洖婊氳川妫�銆佸簱瀛樸�佸伐鏃舵牳绠楀拰璁㈠崟/宸ュ崟杩涘害銆�
+ // 鎸夌敓浜т换鍔″洖婊氬苟鍒犻櫎鎶ュ伐涓昏褰�
List<QualityInspect> qualityInspects = qualityInspectMapper.selectList(
Wrappers.<QualityInspect>lambdaQuery().eq(QualityInspect::getProductMainId, productionProductMain.getId()));
+ // 鍙傛暟涓庡墠缃潯浠舵牎楠�
if (qualityInspects.size() > 0) {
List<QualityUnqualified> qualityUnqualifieds = qualityUnqualifiedMapper.selectList(
Wrappers.<QualityUnqualified>lambdaQuery()
+ // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
.in(QualityUnqualified::getInspectId, qualityInspects.stream().map(QualityInspect::getId).collect(Collectors.toList())));
if (qualityUnqualifieds.size() > 0 && qualityUnqualifieds.get(0).getInspectState() == 1) {
throw new ServiceException("璇ユ潯鎶ュ伐宸茬粡涓嶅悎鏍煎鐞嗕簡锛屼笉鍏佽鍒犻櫎");
@@ -552,6 +597,7 @@
} else {
productionOperationTask.setStatus(3);
}
+ // 鎸佷箙鍖栨垨杈撳嚭澶勭悊缁撴灉
productionOperationTaskMapper.updateById(productionOperationTask);
ProductionOrder productionOrder = productionOrderMapper.selectById(productionOperationTask.getProductionOrderId());
@@ -592,7 +638,7 @@
productionOrderRoutingOperationParamMapper.delete(
Wrappers.<ProductionOrderRoutingOperationParam>lambdaQuery()
.eq(ProductionOrderRoutingOperationParam::getProductionProductMainId, productionProductMain.getId()));
- stockUtils.deleteStockInRecord(productionProductMain.getId(), StockInUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode());
+ stockUtils.deleteStockInRecord(productionProductMain.getId(), StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode());
stockUtils.deleteStockInRecord(productionProductMain.getId(), StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode());
stockUtils.deleteStockOutRecord(productionProductMain.getId(), StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode());
productionProductMainMapper.deleteById(productionProductMain.getId());
@@ -600,6 +646,7 @@
}
private String generateProductNo() {
+ // 鐢熸垚涓嬩竴涓敓浜т骇鍝佺紪鍙�
String datePrefix = "BG" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyMMdd"));
QueryWrapper<ProductionProductMain> queryWrapper = new QueryWrapper<>();
queryWrapper.select("MAX(product_no) as maxNo").likeRight("product_no", datePrefix);
@@ -622,10 +669,12 @@
}
private BigDecimal defaultDecimal(BigDecimal value) {
+ // 灏嗙┖鏁伴噺鍏滃簳涓�0锛岄伩鍏嶇┖鎸囬拡寮傚父
return value == null ? BigDecimal.ZERO : value;
}
private Long resolveTaskId(ProductionProductMainDto dto) {
+ // 浠庡叆鍙備腑瑙f瀽鐢熶骇宸ュ崟ID骞舵牎楠�
if (dto == null) {
return null;
}
@@ -634,6 +683,7 @@
@Override
public ArrayList<Long> listMain(List<Long> idList) {
+ // 鏌ヨ涓昏〃ID闆嗗悎
return productionProductMainMapper.listMain(idList);
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductOutputServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductOutputServiceImpl.java
index fb2aa26..904c8cc 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductOutputServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductOutputServiceImpl.java
@@ -17,6 +17,7 @@
@Override
public IPage<ProductionProductOutputDto> listPageProductionProductOutputDto(Page page, ProductionProductOutputDto productionProductOutputDto) {
+ // 鍒嗛〉鏌ヨ鐢熶骇浜у搧鍑哄簱
return productionProductOutputMapper.listPageProductionProductOutputDto(page, productionProductOutputDto);
}
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java
index f06284d..e937ba4 100644
--- a/src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java
@@ -15,6 +15,7 @@
@Override
public UserAccountDto getByUserId(UserProductionAccountingDto dto) {
+ // 鎸夌敤鎴锋煡璇㈢敓浜ф牳绠椾俊鎭�
if (dto == null || dto.getUserId() == null || dto.getDate() == null || dto.getDate().trim().isEmpty()) {
return new UserAccountDto();
}
diff --git a/src/main/java/com/ruoyi/production/util/TaskPlanQuantityUtil.java b/src/main/java/com/ruoyi/production/util/TaskPlanQuantityUtil.java
new file mode 100644
index 0000000..e82d7e4
--- /dev/null
+++ b/src/main/java/com/ruoyi/production/util/TaskPlanQuantityUtil.java
@@ -0,0 +1,137 @@
+package com.ruoyi.production.util;
+
+import com.ruoyi.production.pojo.ProductionBomStructure;
+import com.ruoyi.production.pojo.ProductionOrder;
+import com.ruoyi.production.pojo.ProductionOrderRoutingOperation;
+import com.ruoyi.technology.pojo.TechnologyRoutingOperation;
+import lombok.experimental.UtilityClass;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 宸ュ崟璁″垝鏁伴噺璁$畻宸ュ叿绫�
+ */
+@UtilityClass
+public class TaskPlanQuantityUtil {
+
+ /**
+ * 璁$畻宸ュ崟璁″垝鏁伴噺锛堜娇鐢� TechnologyRoutingOperation锛�
+ */
+ public BigDecimal resolveTaskPlanQuantity(TechnologyRoutingOperation sourceOperation,
+ Map<String, BigDecimal> operationDemandedQuantityMap,
+ ProductionOrder productionOrder,
+ Long rootProductModelId) {
+ if (sourceOperation == null || operationDemandedQuantityMap == null || operationDemandedQuantityMap.isEmpty()) {
+ return defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity());
+ }
+ Long outputProductModelId = sourceOperation.getProductModelId() != null
+ ? sourceOperation.getProductModelId()
+ : rootProductModelId;
+ String key = buildOperationDemandedQuantityKey(sourceOperation.getTechnologyOperationId(), outputProductModelId);
+ BigDecimal planQuantity = operationDemandedQuantityMap.get(key);
+ return planQuantity != null ? planQuantity : defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity());
+ }
+
+ /**
+ * 璁$畻宸ュ崟璁″垝鏁伴噺锛堜娇鐢� ProductionOrderRoutingOperation锛�
+ */
+ public BigDecimal resolveTaskPlanQuantity(ProductionOrderRoutingOperation routingOperation,
+ Map<String, BigDecimal> demandedQuantityMap,
+ BigDecimal orderQuantity,
+ Long rootProductModelId) {
+ if (routingOperation == null || demandedQuantityMap == null || demandedQuantityMap.isEmpty()) {
+ return orderQuantity;
+ }
+ Long outputProductModelId = routingOperation.getProductModelId() != null
+ ? routingOperation.getProductModelId()
+ : rootProductModelId;
+ String key = buildOperationDemandedQuantityKey(routingOperation.getTechnologyOperationId(), outputProductModelId);
+ BigDecimal planQuantity = demandedQuantityMap.get(key);
+ return planQuantity != null ? planQuantity : orderQuantity;
+ }
+
+ /**
+ * 鏋勫缓宸ュ簭闇�姹傞噺鏄犲皠琛�
+ */
+ public Map<String, BigDecimal> buildOperationDemandedQuantityMap(List<ProductionBomStructure> bomStructures, Long rootProductModelId) {
+ if (bomStructures == null || bomStructures.isEmpty()) {
+ return Collections.emptyMap();
+ }
+ Map<Long, ProductionBomStructure> structureById = new HashMap<>();
+ for (ProductionBomStructure item : bomStructures) {
+ if (item != null && item.getId() != null) {
+ structureById.put(item.getId(), item);
+ }
+ }
+ Map<String, BigDecimal> demandedQuantityMap = new HashMap<>();
+ Set<String> mergedOutputNodeKeySet = new HashSet<>();
+ for (ProductionBomStructure bomStructure : bomStructures) {
+ if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) {
+ continue;
+ }
+ ProductionBomStructure outputNode = resolveOperationOutputNode(bomStructure, structureById);
+ Long outputProductModelId = resolveOutputProductModelId(outputNode, rootProductModelId);
+ if (outputProductModelId == null) {
+ continue;
+ }
+ String mergedOutputNodeKey = buildOperationOutputNodeKey(bomStructure.getTechnologyOperationId(),
+ outputNode == null ? null : outputNode.getId(), outputProductModelId);
+ if (!mergedOutputNodeKeySet.add(mergedOutputNodeKey)) {
+ continue;
+ }
+ BigDecimal demandedQuantity = defaultDecimal(outputNode == null ? null : outputNode.getDemandedQuantity());
+ String key = buildOperationDemandedQuantityKey(bomStructure.getTechnologyOperationId(), outputProductModelId);
+ demandedQuantityMap.merge(key, demandedQuantity, BigDecimal::add);
+ }
+ return demandedQuantityMap;
+ }
+
+ /**
+ * 鏋勫缓宸ュ簭闇�姹傞噺key
+ */
+ public String buildOperationDemandedQuantityKey(Long operationId, Long outputProductModelId) {
+ return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId);
+ }
+
+ /**
+ * 鏋勫缓杈撳嚭鑺傜偣key
+ */
+ public String buildOperationOutputNodeKey(Long operationId, Long outputNodeId, Long outputProductModelId) {
+ return String.valueOf(operationId) + "#" + String.valueOf(outputNodeId) + "#" + String.valueOf(outputProductModelId);
+ }
+
+ /**
+ * 瑙f瀽宸ュ簭杈撳嚭鑺傜偣
+ */
+ public ProductionBomStructure resolveOperationOutputNode(ProductionBomStructure bomStructure,
+ Map<Long, ProductionBomStructure> structureById) {
+ if (bomStructure == null) {
+ return null;
+ }
+ if (bomStructure.getParentId() == null) {
+ return bomStructure;
+ }
+ ProductionBomStructure parent = structureById.get(bomStructure.getParentId());
+ return parent != null ? parent : bomStructure;
+ }
+
+ /**
+ * 瑙f瀽杈撳嚭浜у搧瑙勬牸ID
+ */
+ public Long resolveOutputProductModelId(ProductionBomStructure outputNode, Long rootProductModelId) {
+ if (outputNode == null) {
+ return rootProductModelId;
+ }
+ return outputNode.getProductModelId() != null ? outputNode.getProductModelId() : rootProductModelId;
+ }
+
+ /**
+ * 榛樿BigDecimal鍊�
+ */
+ public BigDecimal defaultDecimal(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/project/common/CaptchaController.java b/src/main/java/com/ruoyi/project/common/CaptchaController.java
index 40255cb..5966fb5 100644
--- a/src/main/java/com/ruoyi/project/common/CaptchaController.java
+++ b/src/main/java/com/ruoyi/project/common/CaptchaController.java
@@ -1,98 +1,98 @@
-package com.ruoyi.project.common;
-
-import com.google.code.kaptcha.Producer;
-import com.ruoyi.common.constant.CacheConstants;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.utils.sign.Base64;
-import com.ruoyi.common.utils.uuid.IdUtils;
-import com.ruoyi.framework.redis.RedisCache;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.service.ISysConfigService;
-import jakarta.annotation.Resource;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.util.FastByteArrayOutputStream;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 楠岃瘉鐮佹搷浣滃鐞�
- *
- * @author ruoyi
- */
-@RestController
-@RequiredArgsConstructor
-public class CaptchaController
-{
- @Resource(name = "captchaProducer")
- private Producer captchaProducer;
-
- @Resource(name = "captchaProducerMath")
- private Producer captchaProducerMath;
-
- private final RedisCache redisCache;
-
- // 楠岃瘉鐮佺被鍨�
- @Value("${ruoyi.captchaType}")
- private String captchaType;
-
- private final ISysConfigService configService;
-
- /**
- * 鐢熸垚楠岃瘉鐮�
- */
- @GetMapping("/captchaImage")
- public AjaxResult getCode(HttpServletResponse response) throws IOException
- {
- AjaxResult ajax = AjaxResult.success();
- boolean captchaEnabled = configService.selectCaptchaEnabled();
- ajax.put("captchaEnabled", captchaEnabled);
- if (!captchaEnabled)
- {
- return ajax;
- }
-
- // 淇濆瓨楠岃瘉鐮佷俊鎭�
- String uuid = IdUtils.simpleUUID();
- String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
-
- String capStr = null, code = null;
- BufferedImage image = null;
-
- // 鐢熸垚楠岃瘉鐮�
- if ("math".equals(captchaType))
- {
- String capText = captchaProducerMath.createText();
- capStr = capText.substring(0, capText.lastIndexOf("@"));
- code = capText.substring(capText.lastIndexOf("@") + 1);
- image = captchaProducerMath.createImage(capStr);
- }
- else if ("char".equals(captchaType))
- {
- capStr = code = captchaProducer.createText();
- image = captchaProducer.createImage(capStr);
- }
-
- redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
- // 杞崲娴佷俊鎭啓鍑�
- FastByteArrayOutputStream os = new FastByteArrayOutputStream();
- try
- {
- ImageIO.write(image, "jpg", os);
- }
- catch (IOException e)
- {
- return AjaxResult.error(e.getMessage());
- }
-
- ajax.put("uuid", uuid);
- ajax.put("img", Base64.encode(os.toByteArray()));
- return ajax;
- }
-}
+package com.ruoyi.project.common;
+
+import com.google.code.kaptcha.Producer;
+import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.utils.sign.Base64;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.framework.redis.RedisCache;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.system.service.ISysConfigService;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.FastByteArrayOutputStream;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 楠岃瘉鐮佹搷浣滃鐞�
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequiredArgsConstructor
+public class CaptchaController
+{
+ @Resource(name = "captchaProducer")
+ private Producer captchaProducer;
+
+ @Resource(name = "captchaProducerMath")
+ private Producer captchaProducerMath;
+
+ private final RedisCache redisCache;
+
+ // 楠岃瘉鐮佺被鍨�
+ @Value("${ruoyi.captchaType}")
+ private String captchaType;
+
+ private final ISysConfigService configService;
+
+ /**
+ * 鐢熸垚楠岃瘉鐮�
+ */
+ @GetMapping("/captchaImage")
+ public AjaxResult getCode(HttpServletResponse response) throws IOException
+ {
+ AjaxResult ajax = AjaxResult.success();
+ boolean captchaEnabled = configService.selectCaptchaEnabled();
+ ajax.put("captchaEnabled", captchaEnabled);
+ if (!captchaEnabled)
+ {
+ return ajax;
+ }
+
+ // 淇濆瓨楠岃瘉鐮佷俊鎭�
+ String uuid = IdUtils.simpleUUID();
+ String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
+
+ String capStr = null, code = null;
+ BufferedImage image = null;
+
+ // 鐢熸垚楠岃瘉鐮�
+ if ("math".equals(captchaType))
+ {
+ String capText = captchaProducerMath.createText();
+ capStr = capText.substring(0, capText.lastIndexOf("@"));
+ code = capText.substring(capText.lastIndexOf("@") + 1);
+ image = captchaProducerMath.createImage(capStr);
+ }
+ else if ("char".equals(captchaType))
+ {
+ capStr = code = captchaProducer.createText();
+ image = captchaProducer.createImage(capStr);
+ }
+
+ redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
+ // 杞崲娴佷俊鎭啓鍑�
+ FastByteArrayOutputStream os = new FastByteArrayOutputStream();
+ try
+ {
+ ImageIO.write(image, "jpg", os);
+ }
+ catch (IOException e)
+ {
+ return AjaxResult.error(e.getMessage());
+ }
+
+ ajax.put("uuid", uuid);
+ ajax.put("img", Base64.encode(os.toByteArray()));
+ return ajax;
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java b/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java
index 63fe76b..ac29662 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java
@@ -1,111 +1,111 @@
-package com.ruoyi.project.monitor.controller;
-
-import com.ruoyi.common.constant.CacheConstants;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.monitor.domain.SysCache;
-import lombok.AllArgsConstructor;
-import org.springframework.data.redis.core.RedisCallback;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-/**
- * 缂撳瓨鐩戞帶
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/cache")
-@AllArgsConstructor
-public class CacheController
-{
- private RedisTemplate<String, String> redisTemplate;
-
- private final static List<SysCache> caches = new ArrayList<SysCache>();
- {
- caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "鐢ㄦ埛淇℃伅"));
- caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "閰嶇疆淇℃伅"));
- caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "鏁版嵁瀛楀吀"));
- caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "楠岃瘉鐮�"));
- caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "闃查噸鎻愪氦"));
- caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "闄愭祦澶勭悊"));
- caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "瀵嗙爜閿欒娆℃暟"));
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
- @GetMapping()
- public AjaxResult getInfo() throws Exception
- {
- Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
- Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
- Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
-
- Map<String, Object> result = new HashMap<>(3);
- result.put("info", info);
- result.put("dbSize", dbSize);
-
- List<Map<String, String>> pieList = new ArrayList<>();
- commandStats.stringPropertyNames().forEach(key -> {
- Map<String, String> data = new HashMap<>(2);
- String property = commandStats.getProperty(key);
- data.put("name", StringUtils.removeStart(key, "cmdstat_"));
- data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
- pieList.add(data);
- });
- result.put("commandStats", pieList);
- return AjaxResult.success(result);
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
- @GetMapping("/getNames")
- public AjaxResult cache()
- {
- return AjaxResult.success(caches);
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
- @GetMapping("/getKeys/{cacheName}")
- public AjaxResult getCacheKeys(@PathVariable String cacheName)
- {
- Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
- return AjaxResult.success(new TreeSet<>(cacheKeys));
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
- @GetMapping("/getValue/{cacheName}/{cacheKey}")
- public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
- {
- String cacheValue = redisTemplate.opsForValue().get(cacheKey);
- SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
- return AjaxResult.success(sysCache);
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
- @DeleteMapping("/clearCacheName/{cacheName}")
- public AjaxResult clearCacheName(@PathVariable String cacheName)
- {
- Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
- redisTemplate.delete(cacheKeys);
- return AjaxResult.success();
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
- @DeleteMapping("/clearCacheKey/{cacheKey}")
- public AjaxResult clearCacheKey(@PathVariable String cacheKey)
- {
- redisTemplate.delete(cacheKey);
- return AjaxResult.success();
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
- @DeleteMapping("/clearCacheAll")
- public AjaxResult clearCacheAll()
- {
- Collection<String> cacheKeys = redisTemplate.keys("*");
- redisTemplate.delete(cacheKeys);
- return AjaxResult.success();
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.monitor.domain.SysCache;
+import lombok.AllArgsConstructor;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ * 缂撳瓨鐩戞帶
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/cache")
+@AllArgsConstructor
+public class CacheController
+{
+ private RedisTemplate<String, String> redisTemplate;
+
+ private final static List<SysCache> caches = new ArrayList<SysCache>();
+ {
+ caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "鐢ㄦ埛淇℃伅"));
+ caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "閰嶇疆淇℃伅"));
+ caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "鏁版嵁瀛楀吀"));
+ caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "楠岃瘉鐮�"));
+ caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "闃查噸鎻愪氦"));
+ caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "闄愭祦澶勭悊"));
+ caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "瀵嗙爜閿欒娆℃暟"));
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+ @GetMapping()
+ public AjaxResult getInfo() throws Exception
+ {
+ Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
+ Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
+ Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
+
+ Map<String, Object> result = new HashMap<>(3);
+ result.put("info", info);
+ result.put("dbSize", dbSize);
+
+ List<Map<String, String>> pieList = new ArrayList<>();
+ commandStats.stringPropertyNames().forEach(key -> {
+ Map<String, String> data = new HashMap<>(2);
+ String property = commandStats.getProperty(key);
+ data.put("name", StringUtils.removeStart(key, "cmdstat_"));
+ data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
+ pieList.add(data);
+ });
+ result.put("commandStats", pieList);
+ return AjaxResult.success(result);
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+ @GetMapping("/getNames")
+ public AjaxResult cache()
+ {
+ return AjaxResult.success(caches);
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+ @GetMapping("/getKeys/{cacheName}")
+ public AjaxResult getCacheKeys(@PathVariable String cacheName)
+ {
+ Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
+ return AjaxResult.success(new TreeSet<>(cacheKeys));
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+ @GetMapping("/getValue/{cacheName}/{cacheKey}")
+ public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
+ {
+ String cacheValue = redisTemplate.opsForValue().get(cacheKey);
+ SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
+ return AjaxResult.success(sysCache);
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+ @DeleteMapping("/clearCacheName/{cacheName}")
+ public AjaxResult clearCacheName(@PathVariable String cacheName)
+ {
+ Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
+ redisTemplate.delete(cacheKeys);
+ return AjaxResult.success();
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+ @DeleteMapping("/clearCacheKey/{cacheKey}")
+ public AjaxResult clearCacheKey(@PathVariable String cacheKey)
+ {
+ redisTemplate.delete(cacheKey);
+ return AjaxResult.success();
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
+ @DeleteMapping("/clearCacheAll")
+ public AjaxResult clearCacheAll()
+ {
+ Collection<String> cacheKeys = redisTemplate.keys("*");
+ redisTemplate.delete(cacheKeys);
+ return AjaxResult.success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/ServerController.java b/src/main/java/com/ruoyi/project/monitor/controller/ServerController.java
index 9a50b05..e1f55f1 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/ServerController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/ServerController.java
@@ -1,27 +1,27 @@
-package com.ruoyi.project.monitor.controller;
-
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.domain.Server;
-
-/**
- * 鏈嶅姟鍣ㄧ洃鎺�
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/server")
-public class ServerController
-{
- @PreAuthorize("@ss.hasPermi('monitor:server:list')")
- @GetMapping()
- public AjaxResult getInfo() throws Exception
- {
- Server server = new Server();
- server.copyTo();
- return AjaxResult.success(server);
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.Server;
+
+/**
+ * 鏈嶅姟鍣ㄧ洃鎺�
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/server")
+public class ServerController
+{
+ @PreAuthorize("@ss.hasPermi('monitor:server:list')")
+ @GetMapping()
+ public AjaxResult getInfo() throws Exception
+ {
+ Server server = new Server();
+ server.copyTo();
+ return AjaxResult.success(server);
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/SysJobController.java b/src/main/java/com/ruoyi/project/monitor/controller/SysJobController.java
index ee2c058..7abc9bd 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/SysJobController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/SysJobController.java
@@ -1,186 +1,186 @@
-package com.ruoyi.project.monitor.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.quartz.SchedulerException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.exception.job.TaskException;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.job.CronUtils;
-import com.ruoyi.common.utils.job.ScheduleUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.monitor.domain.SysJob;
-import com.ruoyi.project.monitor.service.ISysJobService;
-
-/**
- * 璋冨害浠诲姟淇℃伅鎿嶄綔澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/job")
-@AllArgsConstructor
-public class SysJobController extends BaseController
-{
- private ISysJobService jobService;
-
- /**
- * 鏌ヨ瀹氭椂浠诲姟鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysJob sysJob)
- {
- startPage();
- List<SysJob> list = jobService.selectJobList(sysJob);
- return getDataTable(list);
- }
-
- /**
- * 瀵煎嚭瀹氭椂浠诲姟鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:export')")
- @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysJob sysJob)
- {
- List<SysJob> list = jobService.selectJobList(sysJob);
- ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
- util.exportExcel(response, list, "瀹氭椂浠诲姟");
- }
-
- /**
- * 鑾峰彇瀹氭椂浠诲姟璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:query')")
- @GetMapping(value = "/{jobId}")
- public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
- {
- return success(jobService.selectJobById(jobId));
- }
-
- /**
- * 鏂板瀹氭椂浠诲姟
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:add')")
- @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException
- {
- if (!CronUtils.isValid(job.getCronExpression()))
- {
- return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛孋ron琛ㄨ揪寮忎笉姝g‘");
- }
- else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
- {
- return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'rmi'璋冪敤");
- }
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
- {
- return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'ldap(s)'璋冪敤");
- }
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
- {
- return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'http(s)'璋冪敤");
- }
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
- {
- return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆瀛樺湪杩濊");
- }
- else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
- {
- return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅湪鐧藉悕鍗曞唴");
- }
- job.setCreateBy(getUsername());
- return toAjax(jobService.insertJob(job));
- }
-
- /**
- * 淇敼瀹氭椂浠诲姟
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:edit')")
- @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException
- {
- if (!CronUtils.isValid(job.getCronExpression()))
- {
- return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛孋ron琛ㄨ揪寮忎笉姝g‘");
- }
- else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
- {
- return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'rmi'璋冪敤");
- }
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
- {
- return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'ldap(s)'璋冪敤");
- }
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
- {
- return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'http(s)'璋冪敤");
- }
- else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
- {
- return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆瀛樺湪杩濊");
- }
- else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
- {
- return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅湪鐧藉悕鍗曞唴");
- }
- job.setUpdateBy(getUsername());
- return toAjax(jobService.updateJob(job));
- }
-
- /**
- * 瀹氭椂浠诲姟鐘舵�佷慨鏀�
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
- @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE)
- @PutMapping("/changeStatus")
- public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException
- {
- SysJob newJob = jobService.selectJobById(job.getJobId());
- newJob.setStatus(job.getStatus());
- return toAjax(jobService.changeStatus(newJob));
- }
-
- /**
- * 瀹氭椂浠诲姟绔嬪嵆鎵ц涓�娆�
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
- @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE)
- @PutMapping("/run")
- public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
- {
- boolean result = jobService.run(job);
- return result ? success() : error("浠诲姟涓嶅瓨鍦ㄦ垨宸茶繃鏈燂紒");
- }
-
- /**
- * 鍒犻櫎瀹氭椂浠诲姟
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
- @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.DELETE)
- @DeleteMapping("/{jobIds}")
- public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException
- {
- jobService.deleteJobByIds(jobIds);
- return success();
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.quartz.SchedulerException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.exception.job.TaskException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.job.CronUtils;
+import com.ruoyi.common.utils.job.ScheduleUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.monitor.domain.SysJob;
+import com.ruoyi.project.monitor.service.ISysJobService;
+
+/**
+ * 璋冨害浠诲姟淇℃伅鎿嶄綔澶勭悊
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/job")
+@AllArgsConstructor
+public class SysJobController extends BaseController
+{
+ private ISysJobService jobService;
+
+ /**
+ * 鏌ヨ瀹氭椂浠诲姟鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysJob sysJob)
+ {
+ startPage();
+ List<SysJob> list = jobService.selectJobList(sysJob);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭瀹氭椂浠诲姟鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:export')")
+ @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysJob sysJob)
+ {
+ List<SysJob> list = jobService.selectJobList(sysJob);
+ ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
+ util.exportExcel(response, list, "瀹氭椂浠诲姟");
+ }
+
+ /**
+ * 鑾峰彇瀹氭椂浠诲姟璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:query')")
+ @GetMapping(value = "/{jobId}")
+ public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
+ {
+ return success(jobService.selectJobById(jobId));
+ }
+
+ /**
+ * 鏂板瀹氭椂浠诲姟
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:add')")
+ @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException
+ {
+ if (!CronUtils.isValid(job.getCronExpression()))
+ {
+ return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛孋ron琛ㄨ揪寮忎笉姝g‘");
+ }
+ else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
+ {
+ return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'rmi'璋冪敤");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
+ {
+ return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'ldap(s)'璋冪敤");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
+ {
+ return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'http(s)'璋冪敤");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
+ {
+ return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆瀛樺湪杩濊");
+ }
+ else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
+ {
+ return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅湪鐧藉悕鍗曞唴");
+ }
+ job.setCreateBy(getUsername());
+ return toAjax(jobService.insertJob(job));
+ }
+
+ /**
+ * 淇敼瀹氭椂浠诲姟
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:edit')")
+ @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException
+ {
+ if (!CronUtils.isValid(job.getCronExpression()))
+ {
+ return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛孋ron琛ㄨ揪寮忎笉姝g‘");
+ }
+ else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
+ {
+ return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'rmi'璋冪敤");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
+ {
+ return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'ldap(s)'璋冪敤");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
+ {
+ return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'http(s)'璋冪敤");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
+ {
+ return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆瀛樺湪杩濊");
+ }
+ else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
+ {
+ return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅湪鐧藉悕鍗曞唴");
+ }
+ job.setUpdateBy(getUsername());
+ return toAjax(jobService.updateJob(job));
+ }
+
+ /**
+ * 瀹氭椂浠诲姟鐘舵�佷慨鏀�
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
+ @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE)
+ @PutMapping("/changeStatus")
+ public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException
+ {
+ SysJob newJob = jobService.selectJobById(job.getJobId());
+ newJob.setStatus(job.getStatus());
+ return toAjax(jobService.changeStatus(newJob));
+ }
+
+ /**
+ * 瀹氭椂浠诲姟绔嬪嵆鎵ц涓�娆�
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
+ @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE)
+ @PutMapping("/run")
+ public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
+ {
+ boolean result = jobService.run(job);
+ return result ? success() : error("浠诲姟涓嶅瓨鍦ㄦ垨宸茶繃鏈燂紒");
+ }
+
+ /**
+ * 鍒犻櫎瀹氭椂浠诲姟
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
+ @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{jobIds}")
+ public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException
+ {
+ jobService.deleteJobByIds(jobIds);
+ return success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java b/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java
index 0c29d22..9ed3059 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java
@@ -1,93 +1,93 @@
-package com.ruoyi.project.monitor.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.monitor.domain.SysJobLog;
-import com.ruoyi.project.monitor.service.ISysJobLogService;
-
-/**
- * 璋冨害鏃ュ織鎿嶄綔澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/jobLog")
-@AllArgsConstructor
-public class SysJobLogController extends BaseController
-{
- private ISysJobLogService jobLogService;
-
- /**
- * 鏌ヨ瀹氭椂浠诲姟璋冨害鏃ュ織鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysJobLog sysJobLog)
- {
- startPage();
- List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
- return getDataTable(list);
- }
-
- /**
- * 瀵煎嚭瀹氭椂浠诲姟璋冨害鏃ュ織鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:export')")
- @Log(title = "浠诲姟璋冨害鏃ュ織", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysJobLog sysJobLog)
- {
- List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
- ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
- util.exportExcel(response, list, "璋冨害鏃ュ織");
- }
-
- /**
- * 鏍规嵁璋冨害缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:query')")
- @GetMapping(value = "/{jobLogId}")
- public AjaxResult getInfo(@PathVariable Long jobLogId)
- {
- return success(jobLogService.selectJobLogById(jobLogId));
- }
-
-
- /**
- * 鍒犻櫎瀹氭椂浠诲姟璋冨害鏃ュ織
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
- @Log(title = "瀹氭椂浠诲姟璋冨害鏃ュ織", businessType = BusinessType.DELETE)
- @DeleteMapping("/{jobLogIds}")
- public AjaxResult remove(@PathVariable Long[] jobLogIds)
- {
- return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
- }
-
- /**
- * 娓呯┖瀹氭椂浠诲姟璋冨害鏃ュ織
- */
- @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
- @Log(title = "璋冨害鏃ュ織", businessType = BusinessType.CLEAN)
- @DeleteMapping("/clean")
- public AjaxResult clean()
- {
- jobLogService.cleanJobLog();
- return success();
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.monitor.domain.SysJobLog;
+import com.ruoyi.project.monitor.service.ISysJobLogService;
+
+/**
+ * 璋冨害鏃ュ織鎿嶄綔澶勭悊
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/jobLog")
+@AllArgsConstructor
+public class SysJobLogController extends BaseController
+{
+ private ISysJobLogService jobLogService;
+
+ /**
+ * 鏌ヨ瀹氭椂浠诲姟璋冨害鏃ュ織鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysJobLog sysJobLog)
+ {
+ startPage();
+ List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭瀹氭椂浠诲姟璋冨害鏃ュ織鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:export')")
+ @Log(title = "浠诲姟璋冨害鏃ュ織", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysJobLog sysJobLog)
+ {
+ List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
+ ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
+ util.exportExcel(response, list, "璋冨害鏃ュ織");
+ }
+
+ /**
+ * 鏍规嵁璋冨害缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:query')")
+ @GetMapping(value = "/{jobLogId}")
+ public AjaxResult getInfo(@PathVariable Long jobLogId)
+ {
+ return success(jobLogService.selectJobLogById(jobLogId));
+ }
+
+
+ /**
+ * 鍒犻櫎瀹氭椂浠诲姟璋冨害鏃ュ織
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
+ @Log(title = "瀹氭椂浠诲姟璋冨害鏃ュ織", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{jobLogIds}")
+ public AjaxResult remove(@PathVariable Long[] jobLogIds)
+ {
+ return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
+ }
+
+ /**
+ * 娓呯┖瀹氭椂浠诲姟璋冨害鏃ュ織
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
+ @Log(title = "璋冨害鏃ュ織", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/clean")
+ public AjaxResult clean()
+ {
+ jobLogService.cleanJobLog();
+ return success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/SysLogininforController.java b/src/main/java/com/ruoyi/project/monitor/controller/SysLogininforController.java
index 7f5085d..0c96a9d 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/SysLogininforController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/SysLogininforController.java
@@ -1,70 +1,70 @@
-package com.ruoyi.project.monitor.controller;
-
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.security.service.SysPasswordService;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.monitor.domain.SysLogininfor;
-import com.ruoyi.project.monitor.service.ISysLogininforService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 绯荤粺璁块棶璁板綍
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/logininfor")
-@AllArgsConstructor
-public class SysLogininforController extends BaseController {
- private ISysLogininforService logininforService;
- private SysPasswordService passwordService;
-
- @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysLogininfor logininfor) {
- startPage();
- List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
- return getDataTable(list);
- }
-
- @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysLogininfor logininfor) {
- List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
- ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
- util.exportExcel(response, list, "鐧诲綍鏃ュ織");
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
- @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.DELETE)
- @DeleteMapping("/{infoIds}")
- public AjaxResult remove(@PathVariable Long[] infoIds) {
- return toAjax(logininforService.deleteLogininforByIds(infoIds));
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
- @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.CLEAN)
- @DeleteMapping("/clean")
- public AjaxResult clean() {
- logininforService.cleanLogininfor();
- return success();
- }
-
- @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
- @Log(title = "璐︽埛瑙i攣", businessType = BusinessType.OTHER)
- @GetMapping("/unlock/{userName}")
- public AjaxResult unlock(@PathVariable("userName") String userName) {
- passwordService.clearLoginRecordCache(userName);
- return success();
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.security.service.SysPasswordService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.monitor.domain.SysLogininfor;
+import com.ruoyi.project.monitor.service.ISysLogininforService;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 绯荤粺璁块棶璁板綍
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/logininfor")
+@AllArgsConstructor
+public class SysLogininforController extends BaseController {
+ private ISysLogininforService logininforService;
+ private SysPasswordService passwordService;
+
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysLogininfor logininfor) {
+ startPage();
+ List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
+ return getDataTable(list);
+ }
+
+ @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysLogininfor logininfor) {
+ List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
+ ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
+ util.exportExcel(response, list, "鐧诲綍鏃ュ織");
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
+ @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{infoIds}")
+ public AjaxResult remove(@PathVariable Long[] infoIds) {
+ return toAjax(logininforService.deleteLogininforByIds(infoIds));
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
+ @Log(title = "鐧诲綍鏃ュ織", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/clean")
+ public AjaxResult clean() {
+ logininforService.cleanLogininfor();
+ return success();
+ }
+
+ @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
+ @Log(title = "璐︽埛瑙i攣", businessType = BusinessType.OTHER)
+ @GetMapping("/unlock/{userName}")
+ public AjaxResult unlock(@PathVariable("userName") String userName) {
+ passwordService.clearLoginRecordCache(userName);
+ return success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java b/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java
index 81bab02..091a5a6 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/SysOperlogController.java
@@ -1,70 +1,70 @@
-package com.ruoyi.project.monitor.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.monitor.domain.SysOperLog;
-import com.ruoyi.project.monitor.service.ISysOperLogService;
-
-/**
- * 鎿嶄綔鏃ュ織璁板綍
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/operlog")
-@AllArgsConstructor
-public class SysOperlogController extends BaseController
-{
- private ISysOperLogService operLogService;
-
- @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysOperLog operLog)
- {
- startPage();
- List<SysOperLog> list = operLogService.selectOperLogList(operLog);
- return getDataTable(list);
- }
-
- @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysOperLog operLog)
- {
- List<SysOperLog> list = operLogService.selectOperLogList(operLog);
- ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
- util.exportExcel(response, list, "鎿嶄綔鏃ュ織");
- }
-
- @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE)
- @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
- @DeleteMapping("/{operIds}")
- public AjaxResult remove(@PathVariable Long[] operIds)
- {
- return toAjax(operLogService.deleteOperLogByIds(operIds));
- }
-
- @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.CLEAN)
- @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
- @DeleteMapping("/clean")
- public AjaxResult clean()
- {
- operLogService.cleanOperLog();
- return success();
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.monitor.domain.SysOperLog;
+import com.ruoyi.project.monitor.service.ISysOperLogService;
+
+/**
+ * 鎿嶄綔鏃ュ織璁板綍
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/operlog")
+@AllArgsConstructor
+public class SysOperlogController extends BaseController
+{
+ private ISysOperLogService operLogService;
+
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysOperLog operLog)
+ {
+ startPage();
+ List<SysOperLog> list = operLogService.selectOperLogList(operLog);
+ return getDataTable(list);
+ }
+
+ @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysOperLog operLog)
+ {
+ List<SysOperLog> list = operLogService.selectOperLogList(operLog);
+ ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
+ util.exportExcel(response, list, "鎿嶄綔鏃ュ織");
+ }
+
+ @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
+ @DeleteMapping("/{operIds}")
+ public AjaxResult remove(@PathVariable Long[] operIds)
+ {
+ return toAjax(operLogService.deleteOperLogByIds(operIds));
+ }
+
+ @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.CLEAN)
+ @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
+ @DeleteMapping("/clean")
+ public AjaxResult clean()
+ {
+ operLogService.cleanOperLog();
+ return success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/SysUserOnlineController.java b/src/main/java/com/ruoyi/project/monitor/controller/SysUserOnlineController.java
index aa8c824..944656b 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/SysUserOnlineController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/SysUserOnlineController.java
@@ -1,83 +1,83 @@
-package com.ruoyi.project.monitor.controller;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.constant.CacheConstants;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.redis.RedisCache;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.monitor.domain.SysUserOnline;
-import com.ruoyi.project.system.service.ISysUserOnlineService;
-
-/**
- * 鍦ㄧ嚎鐢ㄦ埛鐩戞帶
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/online")
-@AllArgsConstructor
-public class SysUserOnlineController extends BaseController
-{
- private ISysUserOnlineService userOnlineService;
- private RedisCache redisCache;
-
- @PreAuthorize("@ss.hasPermi('monitor:online:list')")
- @GetMapping("/list")
- public TableDataInfo list(String ipaddr, String userName)
- {
- Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
- List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
- for (String key : keys)
- {
- LoginUser user = redisCache.getCacheObject(key);
- if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
- {
- userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
- }
- else if (StringUtils.isNotEmpty(ipaddr))
- {
- userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
- }
- else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
- {
- userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
- }
- else
- {
- userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
- }
- }
- Collections.reverse(userOnlineList);
- userOnlineList.removeAll(Collections.singleton(null));
- return getDataTable(userOnlineList);
- }
-
- /**
- * 寮洪��鐢ㄦ埛
- */
- @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
- @Log(title = "鍦ㄧ嚎鐢ㄦ埛", businessType = BusinessType.FORCE)
- @DeleteMapping("/{tokenId}")
- public AjaxResult forceLogout(@PathVariable String tokenId)
- {
- redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
- return success();
- }
-}
+package com.ruoyi.project.monitor.controller;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.redis.RedisCache;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.monitor.domain.SysUserOnline;
+import com.ruoyi.project.system.service.ISysUserOnlineService;
+
+/**
+ * 鍦ㄧ嚎鐢ㄦ埛鐩戞帶
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/monitor/online")
+@AllArgsConstructor
+public class SysUserOnlineController extends BaseController
+{
+ private ISysUserOnlineService userOnlineService;
+ private RedisCache redisCache;
+
+ @PreAuthorize("@ss.hasPermi('monitor:online:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(String ipaddr, String userName)
+ {
+ Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
+ List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
+ for (String key : keys)
+ {
+ LoginUser user = redisCache.getCacheObject(key);
+ if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
+ {
+ userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
+ }
+ else if (StringUtils.isNotEmpty(ipaddr))
+ {
+ userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
+ }
+ else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
+ {
+ userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
+ }
+ else
+ {
+ userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
+ }
+ }
+ Collections.reverse(userOnlineList);
+ userOnlineList.removeAll(Collections.singleton(null));
+ return getDataTable(userOnlineList);
+ }
+
+ /**
+ * 寮洪��鐢ㄦ埛
+ */
+ @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
+ @Log(title = "鍦ㄧ嚎鐢ㄦ埛", businessType = BusinessType.FORCE)
+ @DeleteMapping("/{tokenId}")
+ public AjaxResult forceLogout(@PathVariable String tokenId)
+ {
+ redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
+ return success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysConfigController.java b/src/main/java/com/ruoyi/project/system/controller/SysConfigController.java
index a10687b..e73d60e 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysConfigController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysConfigController.java
@@ -1,127 +1,127 @@
-package com.ruoyi.project.system.controller;
-
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.system.domain.SysConfig;
-import com.ruoyi.project.system.service.ISysConfigService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 鍙傛暟閰嶇疆 淇℃伅鎿嶄綔澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/config")
-@AllArgsConstructor
-public class SysConfigController extends BaseController
-{
- private ISysConfigService configService;
-
- /**
- * 鑾峰彇鍙傛暟閰嶇疆鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('system:config:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysConfig config)
- {
- startPage();
- List<SysConfig> list = configService.selectConfigList(config);
- return getDataTable(list);
- }
-
- @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('system:config:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysConfig config)
- {
- List<SysConfig> list = configService.selectConfigList(config);
- ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
- util.exportExcel(response, list, "鍙傛暟鏁版嵁");
- }
-
- /**
- * 鏍规嵁鍙傛暟缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('system:config:query')")
- @GetMapping(value = "/{configId}")
- public AjaxResult getInfo(@PathVariable Long configId)
- {
- return success(configService.selectConfigById(configId));
- }
-
- /**
- * 鏍规嵁鍙傛暟閿悕鏌ヨ鍙傛暟鍊�
- */
- @GetMapping(value = "/configKey/{configKey}")
- public AjaxResult getConfigKey(@PathVariable String configKey)
- {
- return success(configService.selectConfigByKey(configKey));
- }
-
- /**
- * 鏂板鍙傛暟閰嶇疆
- */
- @PreAuthorize("@ss.hasPermi('system:config:add')")
- @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysConfig config)
- {
- if (!configService.checkConfigKeyUnique(config))
- {
- return error("鏂板鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪");
- }
- config.setCreateBy(getUsername());
- return toAjax(configService.insertConfig(config));
- }
-
- /**
- * 淇敼鍙傛暟閰嶇疆
- */
- @PreAuthorize("@ss.hasPermi('system:config:edit')")
- @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysConfig config)
- {
- if (!configService.checkConfigKeyUnique(config))
- {
- return error("淇敼鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪");
- }
- config.setUpdateBy(getUsername());
- return toAjax(configService.updateConfig(config));
- }
-
- /**
- * 鍒犻櫎鍙傛暟閰嶇疆
- */
- @PreAuthorize("@ss.hasPermi('system:config:remove')")
- @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.DELETE)
- @DeleteMapping("/{configIds}")
- public AjaxResult remove(@PathVariable Long[] configIds)
- {
- configService.deleteConfigByIds(configIds);
- return success();
- }
-
- /**
- * 鍒锋柊鍙傛暟缂撳瓨
- */
- @PreAuthorize("@ss.hasPermi('system:config:remove')")
- @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.CLEAN)
- @DeleteMapping("/refreshCache")
- public AjaxResult refreshCache()
- {
- configService.resetConfigCache();
- return success();
- }
-}
+package com.ruoyi.project.system.controller;
+
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysConfig;
+import com.ruoyi.project.system.service.ISysConfigService;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 鍙傛暟閰嶇疆 淇℃伅鎿嶄綔澶勭悊
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/config")
+@AllArgsConstructor
+public class SysConfigController extends BaseController
+{
+ private ISysConfigService configService;
+
+ /**
+ * 鑾峰彇鍙傛暟閰嶇疆鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysConfig config)
+ {
+ startPage();
+ List<SysConfig> list = configService.selectConfigList(config);
+ return getDataTable(list);
+ }
+
+ @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:config:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysConfig config)
+ {
+ List<SysConfig> list = configService.selectConfigList(config);
+ ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
+ util.exportExcel(response, list, "鍙傛暟鏁版嵁");
+ }
+
+ /**
+ * 鏍规嵁鍙傛暟缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:query')")
+ @GetMapping(value = "/{configId}")
+ public AjaxResult getInfo(@PathVariable Long configId)
+ {
+ return success(configService.selectConfigById(configId));
+ }
+
+ /**
+ * 鏍规嵁鍙傛暟閿悕鏌ヨ鍙傛暟鍊�
+ */
+ @GetMapping(value = "/configKey/{configKey}")
+ public AjaxResult getConfigKey(@PathVariable String configKey)
+ {
+ return success(configService.selectConfigByKey(configKey));
+ }
+
+ /**
+ * 鏂板鍙傛暟閰嶇疆
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:add')")
+ @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysConfig config)
+ {
+ if (!configService.checkConfigKeyUnique(config))
+ {
+ return error("鏂板鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪");
+ }
+ config.setCreateBy(getUsername());
+ return toAjax(configService.insertConfig(config));
+ }
+
+ /**
+ * 淇敼鍙傛暟閰嶇疆
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:edit')")
+ @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysConfig config)
+ {
+ if (!configService.checkConfigKeyUnique(config))
+ {
+ return error("淇敼鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪");
+ }
+ config.setUpdateBy(getUsername());
+ return toAjax(configService.updateConfig(config));
+ }
+
+ /**
+ * 鍒犻櫎鍙傛暟閰嶇疆
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:remove')")
+ @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{configIds}")
+ public AjaxResult remove(@PathVariable Long[] configIds)
+ {
+ configService.deleteConfigByIds(configIds);
+ return success();
+ }
+
+ /**
+ * 鍒锋柊鍙傛暟缂撳瓨
+ */
+ @PreAuthorize("@ss.hasPermi('system:config:remove')")
+ @Log(title = "鍙傛暟绠$悊", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/refreshCache")
+ public AjaxResult refreshCache()
+ {
+ configService.resetConfigCache();
+ return success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java b/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
index f61e42f..24e6c71 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
@@ -1,134 +1,134 @@
-package com.ruoyi.project.system.controller;
-
-import java.util.List;
-
-import lombok.AllArgsConstructor;
-import org.apache.commons.lang3.ArrayUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.constant.UserConstants;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.domain.SysDept;
-import com.ruoyi.project.system.service.ISysDeptService;
-
-/**
- * 閮ㄩ棬淇℃伅
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/dept")
-@AllArgsConstructor
-public class SysDeptController extends BaseController
-{
- private ISysDeptService deptService;
-
- /**
- * 鑾峰彇閮ㄩ棬鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('system:dept:list')")
- @GetMapping("/list")
- public AjaxResult list(SysDept dept)
- {
- List<SysDept> depts = deptService.selectDeptList(dept);
- return success(depts);
- }
-
- /**
- * 鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級
- */
- @PreAuthorize("@ss.hasPermi('system:dept:list')")
- @GetMapping("/list/exclude/{deptId}")
- public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
- {
- List<SysDept> depts = deptService.selectDeptList(new SysDept());
- depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
- return success(depts);
- }
-
- /**
- * 鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('system:dept:query')")
- @GetMapping(value = "/{deptId}")
- public AjaxResult getInfo(@PathVariable Long deptId)
- {
- deptService.checkDeptDataScope(deptId);
- return success(deptService.selectDeptById(deptId));
- }
-
- /**
- * 鏂板閮ㄩ棬
- */
- @PreAuthorize("@ss.hasPermi('system:dept:add')")
- @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysDept dept)
- {
- if (!deptService.checkDeptNameUnique(dept))
- {
- return error("鏂板閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪");
- }
- dept.setCreateBy(getUsername());
- return toAjax(deptService.insertDept(dept));
- }
-
- /**
- * 淇敼閮ㄩ棬
- */
- @PreAuthorize("@ss.hasPermi('system:dept:edit')")
- @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysDept dept)
- {
- Long deptId = dept.getDeptId();
- deptService.checkDeptDataScope(deptId);
- if (!deptService.checkDeptNameUnique(dept))
- {
- return error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪");
- }
- else if (dept.getParentId().equals(deptId))
- {
- return error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛屼笂绾ч儴闂ㄤ笉鑳芥槸鑷繁");
- }
- else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
- {
- return error("璇ラ儴闂ㄥ寘鍚湭鍋滅敤鐨勫瓙閮ㄩ棬锛�");
- }
- dept.setUpdateBy(getUsername());
- return toAjax(deptService.updateDept(dept));
- }
-
- /**
- * 鍒犻櫎閮ㄩ棬
- */
- @PreAuthorize("@ss.hasPermi('system:dept:remove')")
- @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.DELETE)
- @DeleteMapping("/{deptId}")
- public AjaxResult remove(@PathVariable Long deptId)
- {
- if (deptService.hasChildByDeptId(deptId))
- {
- return warn("瀛樺湪涓嬬骇閮ㄩ棬,涓嶅厑璁稿垹闄�");
- }
- if (deptService.checkDeptExistUser(deptId))
- {
- return warn("閮ㄩ棬瀛樺湪鐢ㄦ埛,涓嶅厑璁稿垹闄�");
- }
- deptService.checkDeptDataScope(deptId);
- return toAjax(deptService.deleteDeptById(deptId));
- }
-}
+package com.ruoyi.project.system.controller;
+
+import java.util.List;
+
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.service.ISysDeptService;
+
+/**
+ * 閮ㄩ棬淇℃伅
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/dept")
+@AllArgsConstructor
+public class SysDeptController extends BaseController
+{
+ private ISysDeptService deptService;
+
+ /**
+ * 鑾峰彇閮ㄩ棬鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:list')")
+ @GetMapping("/list")
+ public AjaxResult list(SysDept dept)
+ {
+ List<SysDept> depts = deptService.selectDeptList(dept);
+ return success(depts);
+ }
+
+ /**
+ * 鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:list')")
+ @GetMapping("/list/exclude/{deptId}")
+ public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
+ {
+ List<SysDept> depts = deptService.selectDeptList(new SysDept());
+ depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
+ return success(depts);
+ }
+
+ /**
+ * 鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:query')")
+ @GetMapping(value = "/{deptId}")
+ public AjaxResult getInfo(@PathVariable Long deptId)
+ {
+ deptService.checkDeptDataScope(deptId);
+ return success(deptService.selectDeptById(deptId));
+ }
+
+ /**
+ * 鏂板閮ㄩ棬
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:add')")
+ @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysDept dept)
+ {
+ if (!deptService.checkDeptNameUnique(dept))
+ {
+ return error("鏂板閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪");
+ }
+ dept.setCreateBy(getUsername());
+ return toAjax(deptService.insertDept(dept));
+ }
+
+ /**
+ * 淇敼閮ㄩ棬
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:edit')")
+ @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysDept dept)
+ {
+ Long deptId = dept.getDeptId();
+ deptService.checkDeptDataScope(deptId);
+ if (!deptService.checkDeptNameUnique(dept))
+ {
+ return error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛岄儴闂ㄥ悕绉板凡瀛樺湪");
+ }
+ else if (dept.getParentId().equals(deptId))
+ {
+ return error("淇敼閮ㄩ棬'" + dept.getDeptName() + "'澶辫触锛屼笂绾ч儴闂ㄤ笉鑳芥槸鑷繁");
+ }
+ else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
+ {
+ return error("璇ラ儴闂ㄥ寘鍚湭鍋滅敤鐨勫瓙閮ㄩ棬锛�");
+ }
+ dept.setUpdateBy(getUsername());
+ return toAjax(deptService.updateDept(dept));
+ }
+
+ /**
+ * 鍒犻櫎閮ㄩ棬
+ */
+ @PreAuthorize("@ss.hasPermi('system:dept:remove')")
+ @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{deptId}")
+ public AjaxResult remove(@PathVariable Long deptId)
+ {
+ if (deptService.hasChildByDeptId(deptId))
+ {
+ return warn("瀛樺湪涓嬬骇閮ㄩ棬,涓嶅厑璁稿垹闄�");
+ }
+ if (deptService.checkDeptExistUser(deptId))
+ {
+ return warn("閮ㄩ棬瀛樺湪鐢ㄦ埛,涓嶅厑璁稿垹闄�");
+ }
+ deptService.checkDeptDataScope(deptId);
+ return toAjax(deptService.deleteDeptById(deptId));
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysDictDataController.java b/src/main/java/com/ruoyi/project/system/controller/SysDictDataController.java
index 58cb4c1..56c44c1 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysDictDataController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysDictDataController.java
@@ -1,120 +1,120 @@
-package com.ruoyi.project.system.controller;
-
-import java.util.ArrayList;
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.system.domain.SysDictData;
-import com.ruoyi.project.system.service.ISysDictDataService;
-import com.ruoyi.project.system.service.ISysDictTypeService;
-
-/**
- * 鏁版嵁瀛楀吀淇℃伅
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/dict/data")
-@AllArgsConstructor
-public class SysDictDataController extends BaseController
-{
- private ISysDictDataService dictDataService;
- private ISysDictTypeService dictTypeService;
-
- @PreAuthorize("@ss.hasPermi('system:dict:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysDictData dictData)
- {
- startPage();
- List<SysDictData> list = dictDataService.selectDictDataList(dictData);
- return getDataTable(list);
- }
-
- @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('system:dict:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysDictData dictData)
- {
- List<SysDictData> list = dictDataService.selectDictDataList(dictData);
- ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
- util.exportExcel(response, list, "瀛楀吀鏁版嵁");
- }
-
- /**
- * 鏌ヨ瀛楀吀鏁版嵁璇︾粏
- */
- @PreAuthorize("@ss.hasPermi('system:dict:query')")
- @GetMapping(value = "/{dictCode}")
- public AjaxResult getInfo(@PathVariable Long dictCode)
- {
- return success(dictDataService.selectDictDataById(dictCode));
- }
-
- /**
- * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅
- */
- @GetMapping(value = "/type/{dictType}")
- public AjaxResult dictType(@PathVariable String dictType)
- {
- List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
- if (StringUtils.isNull(data))
- {
- data = new ArrayList<SysDictData>();
- }
- return success(data);
- }
-
- /**
- * 鏂板瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:add')")
- @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysDictData dict)
- {
- dict.setCreateBy(getUsername());
- return toAjax(dictDataService.insertDictData(dict));
- }
-
- /**
- * 淇敼淇濆瓨瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:edit')")
- @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysDictData dict)
- {
- dict.setUpdateBy(getUsername());
- return toAjax(dictDataService.updateDictData(dict));
- }
-
- /**
- * 鍒犻櫎瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:remove')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
- @DeleteMapping("/{dictCodes}")
- public AjaxResult remove(@PathVariable Long[] dictCodes)
- {
- dictDataService.deleteDictDataByIds(dictCodes);
- return success();
- }
-}
+package com.ruoyi.project.system.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysDictData;
+import com.ruoyi.project.system.service.ISysDictDataService;
+import com.ruoyi.project.system.service.ISysDictTypeService;
+
+/**
+ * 鏁版嵁瀛楀吀淇℃伅
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/dict/data")
+@AllArgsConstructor
+public class SysDictDataController extends BaseController
+{
+ private ISysDictDataService dictDataService;
+ private ISysDictTypeService dictTypeService;
+
+ @PreAuthorize("@ss.hasPermi('system:dict:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysDictData dictData)
+ {
+ startPage();
+ List<SysDictData> list = dictDataService.selectDictDataList(dictData);
+ return getDataTable(list);
+ }
+
+ @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:dict:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysDictData dictData)
+ {
+ List<SysDictData> list = dictDataService.selectDictDataList(dictData);
+ ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
+ util.exportExcel(response, list, "瀛楀吀鏁版嵁");
+ }
+
+ /**
+ * 鏌ヨ瀛楀吀鏁版嵁璇︾粏
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:query')")
+ @GetMapping(value = "/{dictCode}")
+ public AjaxResult getInfo(@PathVariable Long dictCode)
+ {
+ return success(dictDataService.selectDictDataById(dictCode));
+ }
+
+ /**
+ * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅
+ */
+ @GetMapping(value = "/type/{dictType}")
+ public AjaxResult dictType(@PathVariable String dictType)
+ {
+ List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
+ if (StringUtils.isNull(data))
+ {
+ data = new ArrayList<SysDictData>();
+ }
+ return success(data);
+ }
+
+ /**
+ * 鏂板瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:add')")
+ @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysDictData dict)
+ {
+ dict.setCreateBy(getUsername());
+ return toAjax(dictDataService.insertDictData(dict));
+ }
+
+ /**
+ * 淇敼淇濆瓨瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:edit')")
+ @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysDictData dict)
+ {
+ dict.setUpdateBy(getUsername());
+ return toAjax(dictDataService.updateDictData(dict));
+ }
+
+ /**
+ * 鍒犻櫎瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{dictCodes}")
+ public AjaxResult remove(@PathVariable Long[] dictCodes)
+ {
+ dictDataService.deleteDictDataByIds(dictCodes);
+ return success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java b/src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java
index f1a026f..a385016 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java
@@ -1,132 +1,132 @@
-package com.ruoyi.project.system.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.system.domain.SysDictType;
-import com.ruoyi.project.system.service.ISysDictTypeService;
-
-/**
- * 鏁版嵁瀛楀吀淇℃伅
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/dict/type")
-@AllArgsConstructor
-public class SysDictTypeController extends BaseController
-{
- private ISysDictTypeService dictTypeService;
-
- @PreAuthorize("@ss.hasPermi('system:dict:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysDictType dictType)
- {
- startPage();
- List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
- return getDataTable(list);
- }
-
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('system:dict:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysDictType dictType)
- {
- List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
- ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
- util.exportExcel(response, list, "瀛楀吀绫诲瀷");
- }
-
- /**
- * 鏌ヨ瀛楀吀绫诲瀷璇︾粏
- */
- @PreAuthorize("@ss.hasPermi('system:dict:query')")
- @GetMapping(value = "/{dictId}")
- public AjaxResult getInfo(@PathVariable Long dictId)
- {
- return success(dictTypeService.selectDictTypeById(dictId));
- }
-
- /**
- * 鏂板瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:add')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysDictType dict)
- {
- if (!dictTypeService.checkDictTypeUnique(dict))
- {
- return error("鏂板瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
- }
- dict.setCreateBy(getUsername());
- return toAjax(dictTypeService.insertDictType(dict));
- }
-
- /**
- * 淇敼瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:edit')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysDictType dict)
- {
- if (!dictTypeService.checkDictTypeUnique(dict))
- {
- return error("淇敼瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
- }
- dict.setUpdateBy(getUsername());
- return toAjax(dictTypeService.updateDictType(dict));
- }
-
- /**
- * 鍒犻櫎瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:remove')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
- @DeleteMapping("/{dictIds}")
- public AjaxResult remove(@PathVariable Long[] dictIds)
- {
- dictTypeService.deleteDictTypeByIds(dictIds);
- return success();
- }
-
- /**
- * 鍒锋柊瀛楀吀缂撳瓨
- */
- @PreAuthorize("@ss.hasPermi('system:dict:remove')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.CLEAN)
- @DeleteMapping("/refreshCache")
- public AjaxResult refreshCache()
- {
- dictTypeService.resetDictCache();
- return success();
- }
-
- /**
- * 鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛�
- */
- @GetMapping("/optionselect")
- public AjaxResult optionselect()
- {
- List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
- return success(dictTypes);
- }
-}
+package com.ruoyi.project.system.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysDictType;
+import com.ruoyi.project.system.service.ISysDictTypeService;
+
+/**
+ * 鏁版嵁瀛楀吀淇℃伅
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/dict/type")
+@AllArgsConstructor
+public class SysDictTypeController extends BaseController
+{
+ private ISysDictTypeService dictTypeService;
+
+ @PreAuthorize("@ss.hasPermi('system:dict:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysDictType dictType)
+ {
+ startPage();
+ List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
+ return getDataTable(list);
+ }
+
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:dict:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysDictType dictType)
+ {
+ List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
+ ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
+ util.exportExcel(response, list, "瀛楀吀绫诲瀷");
+ }
+
+ /**
+ * 鏌ヨ瀛楀吀绫诲瀷璇︾粏
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:query')")
+ @GetMapping(value = "/{dictId}")
+ public AjaxResult getInfo(@PathVariable Long dictId)
+ {
+ return success(dictTypeService.selectDictTypeById(dictId));
+ }
+
+ /**
+ * 鏂板瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:add')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysDictType dict)
+ {
+ if (!dictTypeService.checkDictTypeUnique(dict))
+ {
+ return error("鏂板瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
+ }
+ dict.setCreateBy(getUsername());
+ return toAjax(dictTypeService.insertDictType(dict));
+ }
+
+ /**
+ * 淇敼瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:edit')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysDictType dict)
+ {
+ if (!dictTypeService.checkDictTypeUnique(dict))
+ {
+ return error("淇敼瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
+ }
+ dict.setUpdateBy(getUsername());
+ return toAjax(dictTypeService.updateDictType(dict));
+ }
+
+ /**
+ * 鍒犻櫎瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{dictIds}")
+ public AjaxResult remove(@PathVariable Long[] dictIds)
+ {
+ dictTypeService.deleteDictTypeByIds(dictIds);
+ return success();
+ }
+
+ /**
+ * 鍒锋柊瀛楀吀缂撳瓨
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/refreshCache")
+ public AjaxResult refreshCache()
+ {
+ dictTypeService.resetDictCache();
+ return success();
+ }
+
+ /**
+ * 鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛�
+ */
+ @GetMapping("/optionselect")
+ public AjaxResult optionselect()
+ {
+ List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
+ return success(dictTypes);
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysLoginController.java b/src/main/java/com/ruoyi/project/system/controller/SysLoginController.java
index e08c368..3334a07 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysLoginController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysLoginController.java
@@ -1,165 +1,155 @@
-package com.ruoyi.project.system.controller;
-
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.security.LoginBody;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.security.service.SysLoginService;
-import com.ruoyi.framework.security.service.SysPermissionService;
-import com.ruoyi.framework.security.service.TokenService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.domain.SysDept;
-import com.ruoyi.project.system.domain.SysMenu;
-import com.ruoyi.project.system.domain.SysUser;
-import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
+package com.ruoyi.project.system.controller;
+
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.framework.security.LoginBody;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.security.service.SysLoginService;
+import com.ruoyi.framework.security.service.SysPermissionService;
+import com.ruoyi.framework.security.service.TokenService;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.domain.SysMenu;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
import com.ruoyi.project.system.mapper.SysDeptMapper;
import com.ruoyi.project.system.service.ISysMenuService;
import com.ruoyi.project.system.service.ISysUserDeptService;
import com.ruoyi.project.system.service.ISysUserService;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * 鐧诲綍楠岃瘉
- *
- * @author ruoyi
- */
-@RestController
-@AllArgsConstructor
-public class SysLoginController
-{
- private SysLoginService loginService;
- private ISysMenuService menuService;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * 鐧诲綍楠岃瘉
+ *
+ * @author ruoyi
+ */
+@RestController
+@AllArgsConstructor
+public class SysLoginController
+{
+ private SysLoginService loginService;
+ private ISysMenuService menuService;
private SysPermissionService permissionService;
private TokenService tokenService;
private ISysUserDeptService userDeptService;
private ISysUserService userService;
private SysDeptMapper sysDeptMapper;
-
- /**
- * 鐧诲綍鏂规硶
- *
- * @param loginBody 鐧诲綍淇℃伅
- * @return 缁撴灉
- */
- @PostMapping("/login")
- public AjaxResult login(@RequestBody LoginBody loginBody)
- {
- AjaxResult ajax = AjaxResult.success();
- // 鐢熸垚浠ょ墝
- String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
- loginBody.getUuid());
- ajax.put(Constants.TOKEN, token);
- return ajax;
- }
-
- /**
- * 鑾峰彇鐢ㄦ埛淇℃伅
- *
- * @return 鐢ㄦ埛淇℃伅
- */
- @GetMapping("/getInfo")
- public AjaxResult getInfo()
- {
- LoginUser loginUser = SecurityUtils.getLoginUser();
- SysUser user = userService.selectUserById(loginUser.getUserId());
- if (user == null)
- {
- user = loginUser.getUser();
+
+ /**
+ * 鐧诲綍鏂规硶
+ *
+ * @param loginBody 鐧诲綍淇℃伅
+ * @return 缁撴灉
+ */
+ @PostMapping("/login")
+ public AjaxResult login(@RequestBody LoginBody loginBody)
+ {
+ AjaxResult ajax = AjaxResult.success();
+ // 鐢熸垚浠ょ墝
+ String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
+ loginBody.getUuid());
+ ajax.put(Constants.TOKEN, token);
+ return ajax;
+ }
+
+ /**
+ * 鑾峰彇鐢ㄦ埛淇℃伅
+ *
+ * @return 鐢ㄦ埛淇℃伅
+ */
+ @GetMapping("/getInfo")
+ public AjaxResult getInfo()
+ {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ SysUser user = loginUser.getUser();
+ // 鑾峰彇褰撳墠鐧诲綍鍏徃
+ Long tenantId = loginUser.getTenantId();
+ if(null != tenantId){
+ user.setTenantId(tenantId);
+ SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue());
+ if(!ObjectUtils.isEmpty(sysDept)){
+ user.setCurrentFactoryName(sysDept.getDeptName());
+ }
}
- else
+ // 瑙掕壊闆嗗悎
+ Set<String> roles = permissionService.getRolePermission(user);
+ // 鏉冮檺闆嗗悎
+ Set<String> permissions = permissionService.getMenuPermission(user);
+ if (!loginUser.getPermissions().equals(permissions))
{
- loginUser.setUser(user);
- loginUser.setAiEnabled(user.getAiEnabled());
- tokenService.setLoginUser(loginUser);
+ loginUser.setPermissions(permissions);
+ tokenService.refreshToken(loginUser);
}
- // 鑾峰彇褰撳墠鐧诲綍鍏徃
- Long tenantId = loginUser.getTenantId();
- if(null != tenantId){
- user.setTenantId(tenantId);
- SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue());
- if(!ObjectUtils.isEmpty(sysDept)){
- user.setCurrentFactoryName(sysDept.getDeptName());
- }
- }
- // 瑙掕壊闆嗗悎
- Set<String> roles = permissionService.getRolePermission(user);
- // 鏉冮檺闆嗗悎
- Set<String> permissions = permissionService.getMenuPermission(user);
- if (!loginUser.getPermissions().equals(permissions))
- {
- loginUser.setPermissions(permissions);
- tokenService.refreshToken(loginUser);
- }
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("aiEnabled", loginUser.getAiEnabled());
ajax.put("roles", roles);
ajax.put("permissions", permissions);
return ajax;
- }
-
- /**
- * 鑾峰彇璺敱淇℃伅
- *
- * @return 璺敱淇℃伅
- */
- @GetMapping("getRouters")
- public AjaxResult getRouters()
- {
- Long userId = SecurityUtils.getUserId();
- List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
- return AjaxResult.success(menuService.buildMenus(menus));
- }
-
- @PostMapping("/loginCheck")
- public AjaxResult loginCheck(@RequestBody LoginBody loginBody)
- {
- try {
- Long userId = loginService.loginCheck(loginBody.getUsername(), loginBody.getPassword());
- return AjaxResult.success(userId);
- }catch (Exception e) {
- return AjaxResult.error(e.getMessage());
- }
- }
-
- @GetMapping("/userLoginFacotryList")
- public AjaxResult userLoginFacotryList(SysUserDeptVo sysUserDeptVo){
- List<SysUserDeptVo> sysUserDeptVoList = userDeptService.userLoginFacotryList(sysUserDeptVo);
- Map<Long, SysUserDeptVo> map = sysUserDeptVoList.stream()
- .collect(Collectors.toMap(
- SysUserDeptVo::getDeptId,
- item -> item,
- (existing, replacement) -> existing // 濡傛灉閲嶅锛屼繚鐣欑涓�涓�
- ));
- List<SysUserDeptVo> uniqueList = new ArrayList<>(map.values());
- return AjaxResult.success(uniqueList);
- }
-
- /**
- * 閫夋嫨鍏徃鐧诲綍
- *
- * @param loginBody 鐧诲綍淇℃伅
- * @return 缁撴灉
- */
- @PostMapping("/loginCheckFactory")
- public AjaxResult loginCheckFactory(@RequestBody LoginBody loginBody)
- {
- AjaxResult ajax = AjaxResult.success();
- // 鐢熸垚浠ょ墝
- String token = loginService.loginCheckFactory(loginBody.getUsername(), loginBody.getPassword(),loginBody.getFactoryId());
- ajax.put(Constants.TOKEN, token);
- return ajax;
- }
-}
+ }
+
+ /**
+ * 鑾峰彇璺敱淇℃伅
+ *
+ * @return 璺敱淇℃伅
+ */
+ @GetMapping("getRouters")
+ public AjaxResult getRouters()
+ {
+ Long userId = SecurityUtils.getUserId();
+ List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
+ return AjaxResult.success(menuService.buildMenus(menus));
+ }
+
+ @PostMapping("/loginCheck")
+ public AjaxResult loginCheck(@RequestBody LoginBody loginBody)
+ {
+ try {
+ Long userId = loginService.loginCheck(loginBody.getUsername(), loginBody.getPassword());
+ return AjaxResult.success(userId);
+ }catch (Exception e) {
+ return AjaxResult.error(e.getMessage());
+ }
+ }
+
+ @GetMapping("/userLoginFacotryList")
+ public AjaxResult userLoginFacotryList(SysUserDeptVo sysUserDeptVo){
+ List<SysUserDeptVo> sysUserDeptVoList = userDeptService.userLoginFacotryList(sysUserDeptVo);
+ Map<Long, SysUserDeptVo> map = sysUserDeptVoList.stream()
+ .collect(Collectors.toMap(
+ SysUserDeptVo::getDeptId,
+ item -> item,
+ (existing, replacement) -> existing // 濡傛灉閲嶅锛屼繚鐣欑涓�涓�
+ ));
+ List<SysUserDeptVo> uniqueList = new ArrayList<>(map.values());
+ return AjaxResult.success(uniqueList);
+ }
+
+ /**
+ * 閫夋嫨鍏徃鐧诲綍
+ *
+ * @param loginBody 鐧诲綍淇℃伅
+ * @return 缁撴灉
+ */
+ @PostMapping("/loginCheckFactory")
+ public AjaxResult loginCheckFactory(@RequestBody LoginBody loginBody)
+ {
+ AjaxResult ajax = AjaxResult.success();
+ // 鐢熸垚浠ょ墝
+ String token = loginService.loginCheckFactory(loginBody.getUsername(), loginBody.getPassword(),loginBody.getFactoryId());
+ ajax.put(Constants.TOKEN, token);
+ return ajax;
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java b/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java
index 865e8a4..a59bdb3 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java
@@ -1,136 +1,136 @@
-package com.ruoyi.project.system.controller;
-
-import com.ruoyi.common.constant.UserConstants;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.domain.SysMenu;
-import com.ruoyi.project.system.service.ISysMenuService;
-import lombok.AllArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 鑿滃崟淇℃伅
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/menu")
-@AllArgsConstructor
-public class SysMenuController extends BaseController
-{
- private ISysMenuService menuService;
-
- /**
- * 鑾峰彇鑿滃崟鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('system:menu:list')")
- @GetMapping("/list")
- public AjaxResult list(SysMenu menu)
- {
- List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
- return success(menus);
- }
-
- /**
- * 鏍规嵁鑿滃崟缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('system:menu:query')")
- @GetMapping(value = "/{menuId}")
- public AjaxResult getInfo(@PathVariable Long menuId)
- {
- return success(menuService.selectMenuById(menuId));
- }
-
- /**
- * 鑾峰彇鑿滃崟涓嬫媺鏍戝垪琛�
- */
- @GetMapping("/treeselect")
- public AjaxResult treeselect(SysMenu menu)
- {
- List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
- return success(menuService.buildMenuTreeSelect(menus));
- }
-
- /**
- * 鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍�
- */
- @GetMapping(value = "/roleMenuTreeselect/{roleId}")
- public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
- {
- List<SysMenu> menus = menuService.selectMenuList(getUserId());
- AjaxResult ajax = AjaxResult.success();
- ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
- ajax.put("menus", menuService.buildMenuTreeSelect(menus));
- return ajax;
- }
-
- /**
- * 鏂板鑿滃崟
- */
- @PreAuthorize("@ss.hasPermi('system:menu:add')")
- @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysMenu menu)
- {
- if (!menuService.checkMenuNameUnique(menu))
- {
- return error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
- }
- else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
- {
- return error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
- }
- menu.setCreateBy(getUsername());
- return toAjax(menuService.insertMenu(menu));
- }
-
- /**
- * 淇敼鑿滃崟
- */
- @PreAuthorize("@ss.hasPermi('system:menu:edit')")
- @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysMenu menu)
- {
- if (!menuService.checkMenuNameUnique(menu))
- {
- return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
- }
- else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
- {
- return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
- }
- else if (menu.getMenuId().equals(menu.getParentId()))
- {
- return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介�夋嫨鑷繁");
- }
- menu.setUpdateBy(getUsername());
- return toAjax(menuService.updateMenu(menu));
- }
-
- /**
- * 鍒犻櫎鑿滃崟
- */
- @PreAuthorize("@ss.hasPermi('system:menu:remove')")
- @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.DELETE)
- @DeleteMapping("/{menuId}")
- public AjaxResult remove(@PathVariable("menuId") Long menuId)
- {
- if (menuService.hasChildByMenuId(menuId))
- {
- return warn("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�");
- }
- if (menuService.checkMenuExistRole(menuId))
- {
- return warn("鑿滃崟宸插垎閰�,涓嶅厑璁稿垹闄�");
- }
- return toAjax(menuService.deleteMenuById(menuId));
- }
+package com.ruoyi.project.system.controller;
+
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.system.domain.SysMenu;
+import com.ruoyi.project.system.service.ISysMenuService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 鑿滃崟淇℃伅
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/menu")
+@AllArgsConstructor
+public class SysMenuController extends BaseController
+{
+ private ISysMenuService menuService;
+
+ /**
+ * 鑾峰彇鑿滃崟鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:list')")
+ @GetMapping("/list")
+ public AjaxResult list(SysMenu menu)
+ {
+ List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
+ return success(menus);
+ }
+
+ /**
+ * 鏍规嵁鑿滃崟缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:query')")
+ @GetMapping(value = "/{menuId}")
+ public AjaxResult getInfo(@PathVariable Long menuId)
+ {
+ return success(menuService.selectMenuById(menuId));
+ }
+
+ /**
+ * 鑾峰彇鑿滃崟涓嬫媺鏍戝垪琛�
+ */
+ @GetMapping("/treeselect")
+ public AjaxResult treeselect(SysMenu menu)
+ {
+ List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
+ return success(menuService.buildMenuTreeSelect(menus));
+ }
+
+ /**
+ * 鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍�
+ */
+ @GetMapping(value = "/roleMenuTreeselect/{roleId}")
+ public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
+ {
+ List<SysMenu> menus = menuService.selectMenuList(getUserId());
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
+ ajax.put("menus", menuService.buildMenuTreeSelect(menus));
+ return ajax;
+ }
+
+ /**
+ * 鏂板鑿滃崟
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:add')")
+ @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysMenu menu)
+ {
+ if (!menuService.checkMenuNameUnique(menu))
+ {
+ return error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
+ }
+ else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
+ {
+ return error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
+ }
+ menu.setCreateBy(getUsername());
+ return toAjax(menuService.insertMenu(menu));
+ }
+
+ /**
+ * 淇敼鑿滃崟
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:edit')")
+ @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysMenu menu)
+ {
+ if (!menuService.checkMenuNameUnique(menu))
+ {
+ return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
+ }
+ else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
+ {
+ return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
+ }
+ else if (menu.getMenuId().equals(menu.getParentId()))
+ {
+ return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介�夋嫨鑷繁");
+ }
+ menu.setUpdateBy(getUsername());
+ return toAjax(menuService.updateMenu(menu));
+ }
+
+ /**
+ * 鍒犻櫎鑿滃崟
+ */
+ @PreAuthorize("@ss.hasPermi('system:menu:remove')")
+ @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{menuId}")
+ public AjaxResult remove(@PathVariable("menuId") Long menuId)
+ {
+ if (menuService.hasChildByMenuId(menuId))
+ {
+ return warn("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�");
+ }
+ if (menuService.checkMenuExistRole(menuId))
+ {
+ return warn("鑿滃崟宸插垎閰�,涓嶅厑璁稿垹闄�");
+ }
+ return toAjax(menuService.deleteMenuById(menuId));
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java b/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
index 5aa3413..eaba7d0 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java
@@ -1,96 +1,96 @@
-package com.ruoyi.project.system.controller;
-
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.R;
-import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.system.domain.SysNotice;
-import com.ruoyi.project.system.service.ISysNoticeService;
-
-/**
- * 鍏憡 淇℃伅鎿嶄綔澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/notice")
-@AllArgsConstructor
-public class SysNoticeController extends BaseController {
- private ISysNoticeService noticeService;
-
- /**
- * 鑾峰彇閫氱煡鍏憡鍒楄〃
- */
- @GetMapping("/list")
- public R<IPage<SysNotice>> list(SysNotice notice, Page page) {
- IPage<SysNotice> list = noticeService.selectNoticeList(notice, page);
- return R.ok(list);
- }
-
- /**
- * 鑾峰彇鏈鏁伴噺
- */
- @GetMapping("/getCount")
- public R getCount(Long consigneeId) {
- return R.ok(noticeService.getCount(consigneeId));
- }
-
- /**
- * 鏍规嵁閫氱煡鍏憡缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @GetMapping(value = "/{noticeId}")
- public AjaxResult getInfo(@PathVariable Long noticeId) {
- return success(noticeService.selectNoticeById(noticeId));
- }
-
- /**
- * 鏂板閫氱煡鍏憡
- */
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysNotice notice) {
- return toAjax(noticeService.insertNotice(notice));
- }
-
- /**
- * 淇敼閫氱煡鍏憡
- */
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
- return toAjax(noticeService.updateNotice(notice));
- }
-
- /**
- * 鍒犻櫎閫氱煡鍏憡
- */
- @DeleteMapping("/{noticeIds}")
- public AjaxResult remove(@PathVariable Long[] noticeIds) {
- return toAjax(noticeService.deleteNoticeByIds(noticeIds));
- }
-
- /**
- * 涓�閿凡璇�
- */
- @PostMapping("/readAll")
- public AjaxResult readAll() {
- return toAjax(noticeService.readAll());
- }
-
- @PostMapping("appReadNotice")
- @Operation(summary = "绉诲姩绔牴鎹秷鎭疘D杩涜宸茶")
- public AjaxResult appReadNotice(@RequestParam("noticeId") Long noticeId) {
- boolean result = noticeService.appReadNotice(noticeId);
- return toAjax(result);
- }
-}
+package com.ruoyi.project.system.controller;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysNotice;
+import com.ruoyi.project.system.service.ISysNoticeService;
+
+/**
+ * 鍏憡 淇℃伅鎿嶄綔澶勭悊
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/notice")
+@AllArgsConstructor
+public class SysNoticeController extends BaseController {
+ private ISysNoticeService noticeService;
+
+ /**
+ * 鑾峰彇閫氱煡鍏憡鍒楄〃
+ */
+ @GetMapping("/list")
+ public R<IPage<SysNotice>> list(SysNotice notice, Page page) {
+ IPage<SysNotice> list = noticeService.selectNoticeList(notice, page);
+ return R.ok(list);
+ }
+
+ /**
+ * 鑾峰彇鏈鏁伴噺
+ */
+ @GetMapping("/getCount")
+ public R getCount(Long consigneeId) {
+ return R.ok(noticeService.getCount(consigneeId));
+ }
+
+ /**
+ * 鏍规嵁閫氱煡鍏憡缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @GetMapping(value = "/{noticeId}")
+ public AjaxResult getInfo(@PathVariable Long noticeId) {
+ return success(noticeService.selectNoticeById(noticeId));
+ }
+
+ /**
+ * 鏂板閫氱煡鍏憡
+ */
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysNotice notice) {
+ return toAjax(noticeService.insertNotice(notice));
+ }
+
+ /**
+ * 淇敼閫氱煡鍏憡
+ */
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
+ return toAjax(noticeService.updateNotice(notice));
+ }
+
+ /**
+ * 鍒犻櫎閫氱煡鍏憡
+ */
+ @DeleteMapping("/{noticeIds}")
+ public AjaxResult remove(@PathVariable Long[] noticeIds) {
+ return toAjax(noticeService.deleteNoticeByIds(noticeIds));
+ }
+
+ /**
+ * 涓�閿凡璇�
+ */
+ @PostMapping("/readAll")
+ public AjaxResult readAll() {
+ return toAjax(noticeService.readAll());
+ }
+
+ @PostMapping("appReadNotice")
+ @Operation(summary = "绉诲姩绔牴鎹秷鎭疘D杩涜宸茶")
+ public AjaxResult appReadNotice(@RequestParam("noticeId") Long noticeId) {
+ boolean result = noticeService.appReadNotice(noticeId);
+ return toAjax(result);
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysPostController.java b/src/main/java/com/ruoyi/project/system/controller/SysPostController.java
index a4776c4..45c5bcc 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysPostController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysPostController.java
@@ -1,133 +1,133 @@
-package com.ruoyi.project.system.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.system.domain.SysPost;
-import com.ruoyi.project.system.service.ISysPostService;
-
-/**
- * 宀椾綅淇℃伅鎿嶄綔澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/post")
-@AllArgsConstructor
-public class SysPostController extends BaseController
-{
- private ISysPostService postService;
-
- /**
- * 鑾峰彇宀椾綅鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('system:post:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysPost post)
- {
- startPage();
- List<SysPost> list = postService.selectPostList(post);
- return getDataTable(list);
- }
- /**
- * 瀵煎嚭宀椾綅鍒楄〃
- */
-
- @Log(title = "宀椾綅绠$悊", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('system:post:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysPost post)
- {
- List<SysPost> list = postService.selectPostList(post);
- ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
- util.exportExcel(response, list, "宀椾綅鏁版嵁");
- }
-
- /**
- * 鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('system:post:query')")
- @GetMapping(value = "/{postId}")
- public AjaxResult getInfo(@PathVariable Long postId)
- {
- return success(postService.selectPostById(postId));
- }
-
- /**
- * 鏂板宀椾綅
- */
- @PreAuthorize("@ss.hasPermi('system:post:add')")
- @Log(title = "宀椾綅绠$悊", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysPost post)
- {
- if (!postService.checkPostNameUnique(post))
- {
- return error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
- }
- else if (!postService.checkPostCodeUnique(post))
- {
- return error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
- }
- post.setCreateBy(getUsername());
- return toAjax(postService.insertPost(post));
- }
-
- /**
- * 淇敼宀椾綅
- */
- @PreAuthorize("@ss.hasPermi('system:post:edit')")
- @Log(title = "宀椾綅绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysPost post)
- {
- if (!postService.checkPostNameUnique(post))
- {
- return error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
- }
- else if (!postService.checkPostCodeUnique(post))
- {
- return error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
- }
- post.setUpdateBy(getUsername());
- return toAjax(postService.updatePost(post));
- }
-
- /**
- * 鍒犻櫎宀椾綅
- */
- @PreAuthorize("@ss.hasPermi('system:post:remove')")
- @Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE)
- @DeleteMapping("/{postIds}")
- public AjaxResult remove(@PathVariable Long[] postIds)
- {
- return toAjax(postService.deletePostByIds(postIds));
- }
-
- /**
- * 鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�
- */
- @GetMapping("/optionselect")
- public AjaxResult optionselect()
- {
- List<SysPost> posts = postService.selectPostAll();
- return success(posts);
- }
-}
+package com.ruoyi.project.system.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysPost;
+import com.ruoyi.project.system.service.ISysPostService;
+
+/**
+ * 宀椾綅淇℃伅鎿嶄綔澶勭悊
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/post")
+@AllArgsConstructor
+public class SysPostController extends BaseController
+{
+ private ISysPostService postService;
+
+ /**
+ * 鑾峰彇宀椾綅鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysPost post)
+ {
+ startPage();
+ List<SysPost> list = postService.selectPostList(post);
+ return getDataTable(list);
+ }
+ /**
+ * 瀵煎嚭宀椾綅鍒楄〃
+ */
+
+ @Log(title = "宀椾綅绠$悊", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:post:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysPost post)
+ {
+ List<SysPost> list = postService.selectPostList(post);
+ ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
+ util.exportExcel(response, list, "宀椾綅鏁版嵁");
+ }
+
+ /**
+ * 鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:query')")
+ @GetMapping(value = "/{postId}")
+ public AjaxResult getInfo(@PathVariable Long postId)
+ {
+ return success(postService.selectPostById(postId));
+ }
+
+ /**
+ * 鏂板宀椾綅
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:add')")
+ @Log(title = "宀椾綅绠$悊", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysPost post)
+ {
+ if (!postService.checkPostNameUnique(post))
+ {
+ return error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
+ }
+ else if (!postService.checkPostCodeUnique(post))
+ {
+ return error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
+ }
+ post.setCreateBy(getUsername());
+ return toAjax(postService.insertPost(post));
+ }
+
+ /**
+ * 淇敼宀椾綅
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:edit')")
+ @Log(title = "宀椾綅绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysPost post)
+ {
+ if (!postService.checkPostNameUnique(post))
+ {
+ return error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
+ }
+ else if (!postService.checkPostCodeUnique(post))
+ {
+ return error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
+ }
+ post.setUpdateBy(getUsername());
+ return toAjax(postService.updatePost(post));
+ }
+
+ /**
+ * 鍒犻櫎宀椾綅
+ */
+ @PreAuthorize("@ss.hasPermi('system:post:remove')")
+ @Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{postIds}")
+ public AjaxResult remove(@PathVariable Long[] postIds)
+ {
+ return toAjax(postService.deletePostByIds(postIds));
+ }
+
+ /**
+ * 鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�
+ */
+ @GetMapping("/optionselect")
+ public AjaxResult optionselect()
+ {
+ List<SysPost> posts = postService.selectPostAll();
+ return success(posts);
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java b/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java
index 62f6db5..66e89e2 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java
@@ -1,133 +1,133 @@
-package com.ruoyi.project.system.controller;
-
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.common.utils.file.MimeTypeUtils;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.config.RuoYiConfig;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.security.service.TokenService;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.domain.SysUser;
-import com.ruoyi.project.system.service.ISysUserService;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.Map;
-
-/**
- * 涓汉淇℃伅 涓氬姟澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/user/profile")
-@AllArgsConstructor
-public class SysProfileController extends BaseController
-{
- private ISysUserService userService;
- private TokenService tokenService;
-
- /**
- * 涓汉淇℃伅
- */
- @GetMapping
- public AjaxResult profile()
- {
- LoginUser loginUser = getLoginUser();
- SysUser user = loginUser.getUser();
- AjaxResult ajax = AjaxResult.success(user);
- ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
- ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
- return ajax;
- }
-
- /**
- * 淇敼鐢ㄦ埛
- */
- @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult updateProfile(@RequestBody SysUser user)
- {
- LoginUser loginUser = getLoginUser();
- SysUser currentUser = loginUser.getUser();
- currentUser.setNickName(user.getNickName());
- currentUser.setEmail(user.getEmail());
- currentUser.setPhonenumber(user.getPhonenumber());
- currentUser.setSex(user.getSex());
- if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
- {
- return error("淇敼鐢ㄦ埛'" + loginUser.getUsername() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
- }
- if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
- {
- return error("淇敼鐢ㄦ埛'" + loginUser.getUsername() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
- }
- if (userService.updateUserProfile(currentUser) > 0)
- {
- // 鏇存柊缂撳瓨鐢ㄦ埛淇℃伅
- tokenService.setLoginUser(loginUser);
- return success();
- }
- return error("淇敼涓汉淇℃伅寮傚父锛岃鑱旂郴绠$悊鍛�");
- }
-
- /**
- * 閲嶇疆瀵嗙爜
- */
- @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE)
- @PutMapping("/updatePwd")
- public AjaxResult updatePwd(@RequestBody Map<String, String> params)
- {
- String oldPassword = params.get("oldPassword");
- String newPassword = params.get("newPassword");
- LoginUser loginUser = getLoginUser();
- String userName = loginUser.getUsername();
- String password = loginUser.getPassword();
- if (!SecurityUtils.matchesPassword(oldPassword, password))
- {
- return error("淇敼瀵嗙爜澶辫触锛屾棫瀵嗙爜閿欒");
- }
- if (SecurityUtils.matchesPassword(newPassword, password))
- {
- return error("鏂板瘑鐮佷笉鑳戒笌鏃у瘑鐮佺浉鍚�");
- }
- newPassword = SecurityUtils.encryptPassword(newPassword);
- if (userService.resetUserPwd(userName, newPassword) > 0)
- {
- // 鏇存柊缂撳瓨鐢ㄦ埛瀵嗙爜
- loginUser.getUser().setPassword(newPassword);
- tokenService.setLoginUser(loginUser);
- return success();
- }
- return error("淇敼瀵嗙爜寮傚父锛岃鑱旂郴绠$悊鍛�");
- }
-
- /**
- * 澶村儚涓婁紶
- */
- @Log(title = "鐢ㄦ埛澶村儚", businessType = BusinessType.UPDATE)
- @PostMapping("/avatar")
- public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
- {
- if (!file.isEmpty())
- {
- LoginUser loginUser = getLoginUser();
- String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
- if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
- {
- AjaxResult ajax = AjaxResult.success();
- ajax.put("imgUrl", avatar);
- // 鏇存柊缂撳瓨鐢ㄦ埛澶村儚
- loginUser.getUser().setAvatar(avatar);
- tokenService.setLoginUser(loginUser);
- return ajax;
- }
- }
- return error("涓婁紶鍥剧墖寮傚父锛岃鑱旂郴绠$悊鍛�");
- }
-}
+package com.ruoyi.project.system.controller;
+
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.common.utils.file.MimeTypeUtils;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.security.service.TokenService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Map;
+
+/**
+ * 涓汉淇℃伅 涓氬姟澶勭悊
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/user/profile")
+@AllArgsConstructor
+public class SysProfileController extends BaseController
+{
+ private ISysUserService userService;
+ private TokenService tokenService;
+
+ /**
+ * 涓汉淇℃伅
+ */
+ @GetMapping
+ public AjaxResult profile()
+ {
+ LoginUser loginUser = getLoginUser();
+ SysUser user = loginUser.getUser();
+ AjaxResult ajax = AjaxResult.success(user);
+ ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
+ ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
+ return ajax;
+ }
+
+ /**
+ * 淇敼鐢ㄦ埛
+ */
+ @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult updateProfile(@RequestBody SysUser user)
+ {
+ LoginUser loginUser = getLoginUser();
+ SysUser currentUser = loginUser.getUser();
+ currentUser.setNickName(user.getNickName());
+ currentUser.setEmail(user.getEmail());
+ currentUser.setPhonenumber(user.getPhonenumber());
+ currentUser.setSex(user.getSex());
+ if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
+ {
+ return error("淇敼鐢ㄦ埛'" + loginUser.getUsername() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
+ }
+ if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
+ {
+ return error("淇敼鐢ㄦ埛'" + loginUser.getUsername() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
+ }
+ if (userService.updateUserProfile(currentUser) > 0)
+ {
+ // 鏇存柊缂撳瓨鐢ㄦ埛淇℃伅
+ tokenService.setLoginUser(loginUser);
+ return success();
+ }
+ return error("淇敼涓汉淇℃伅寮傚父锛岃鑱旂郴绠$悊鍛�");
+ }
+
+ /**
+ * 閲嶇疆瀵嗙爜
+ */
+ @Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE)
+ @PutMapping("/updatePwd")
+ public AjaxResult updatePwd(@RequestBody Map<String, String> params)
+ {
+ String oldPassword = params.get("oldPassword");
+ String newPassword = params.get("newPassword");
+ LoginUser loginUser = getLoginUser();
+ String userName = loginUser.getUsername();
+ String password = loginUser.getPassword();
+ if (!SecurityUtils.matchesPassword(oldPassword, password))
+ {
+ return error("淇敼瀵嗙爜澶辫触锛屾棫瀵嗙爜閿欒");
+ }
+ if (SecurityUtils.matchesPassword(newPassword, password))
+ {
+ return error("鏂板瘑鐮佷笉鑳戒笌鏃у瘑鐮佺浉鍚�");
+ }
+ newPassword = SecurityUtils.encryptPassword(newPassword);
+ if (userService.resetUserPwd(userName, newPassword) > 0)
+ {
+ // 鏇存柊缂撳瓨鐢ㄦ埛瀵嗙爜
+ loginUser.getUser().setPassword(newPassword);
+ tokenService.setLoginUser(loginUser);
+ return success();
+ }
+ return error("淇敼瀵嗙爜寮傚父锛岃鑱旂郴绠$悊鍛�");
+ }
+
+ /**
+ * 澶村儚涓婁紶
+ */
+ @Log(title = "鐢ㄦ埛澶村儚", businessType = BusinessType.UPDATE)
+ @PostMapping("/avatar")
+ public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
+ {
+ if (!file.isEmpty())
+ {
+ LoginUser loginUser = getLoginUser();
+ String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
+ if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
+ {
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("imgUrl", avatar);
+ // 鏇存柊缂撳瓨鐢ㄦ埛澶村儚
+ loginUser.getUser().setAvatar(avatar);
+ tokenService.setLoginUser(loginUser);
+ return ajax;
+ }
+ }
+ return error("涓婁紶鍥剧墖寮傚父锛岃鑱旂郴绠$悊鍛�");
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysRegisterController.java b/src/main/java/com/ruoyi/project/system/controller/SysRegisterController.java
index ca7baf5..aa672cf 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysRegisterController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysRegisterController.java
@@ -1,33 +1,33 @@
-package com.ruoyi.project.system.controller;
-
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.security.RegisterBody;
-import com.ruoyi.framework.security.service.SysRegisterService;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.service.ISysConfigService;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 娉ㄥ唽楠岃瘉
- *
- * @author ruoyi
- */
-@RestController
-@AllArgsConstructor
-public class SysRegisterController extends BaseController {
- private SysRegisterService registerService;
- private ISysConfigService configService;
-
- @PostMapping("/register")
- public AjaxResult register(@RequestBody RegisterBody user) {
- if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
- return error("褰撳墠绯荤粺娌℃湁寮�鍚敞鍐屽姛鑳斤紒");
- }
- String msg = registerService.register(user);
- return StringUtils.isEmpty(msg) ? success() : error(msg);
- }
-}
+package com.ruoyi.project.system.controller;
+
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.security.RegisterBody;
+import com.ruoyi.framework.security.service.SysRegisterService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.system.service.ISysConfigService;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 娉ㄥ唽楠岃瘉
+ *
+ * @author ruoyi
+ */
+@RestController
+@AllArgsConstructor
+public class SysRegisterController extends BaseController {
+ private SysRegisterService registerService;
+ private ISysConfigService configService;
+
+ @PostMapping("/register")
+ public AjaxResult register(@RequestBody RegisterBody user) {
+ if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
+ return error("褰撳墠绯荤粺娌℃湁寮�鍚敞鍐屽姛鑳斤紒");
+ }
+ String msg = registerService.register(user);
+ return StringUtils.isEmpty(msg) ? success() : error(msg);
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysRoleController.java b/src/main/java/com/ruoyi/project/system/controller/SysRoleController.java
index 3b05811..5f65a8d 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysRoleController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysRoleController.java
@@ -1,255 +1,255 @@
-package com.ruoyi.project.system.controller;
-
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.security.service.SysPermissionService;
-import com.ruoyi.framework.security.service.TokenService;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.system.domain.SysDept;
-import com.ruoyi.project.system.domain.SysRole;
-import com.ruoyi.project.system.domain.SysUser;
-import com.ruoyi.project.system.domain.SysUserRole;
-import com.ruoyi.project.system.service.ISysDeptService;
-import com.ruoyi.project.system.service.ISysRoleService;
-import com.ruoyi.project.system.service.ISysUserService;
-
-/**
- * 瑙掕壊淇℃伅
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/role")
-@AllArgsConstructor
-public class SysRoleController extends BaseController
-{
- private ISysRoleService roleService;
- private TokenService tokenService;
- private SysPermissionService permissionService;
- private ISysUserService userService;
- private ISysDeptService deptService;
-
- @PreAuthorize("@ss.hasPermi('system:role:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysRole role)
- {
- startPage();
- List<SysRole> list = roleService.selectRoleList(role);
- return getDataTable(list);
- }
-
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('system:role:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysRole role)
- {
- List<SysRole> list = roleService.selectRoleList(role);
- ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
- util.exportExcel(response, list, "瑙掕壊鏁版嵁");
- }
-
- /**
- * 鏍规嵁瑙掕壊缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('system:role:query')")
- @GetMapping(value = "/{roleId}")
- public AjaxResult getInfo(@PathVariable Long roleId)
- {
- roleService.checkRoleDataScope(roleId);
- return success(roleService.selectRoleById(roleId));
- }
-
- /**
- * 鏂板瑙掕壊
- */
- @PreAuthorize("@ss.hasPermi('system:role:add')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysRole role)
- {
- if (!roleService.checkRoleNameUnique(role))
- {
- return error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪");
- }
- else if (!roleService.checkRoleKeyUnique(role))
- {
- return error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪");
- }
- role.setCreateBy(getUsername());
- return toAjax(roleService.insertRole(role));
-
- }
-
- /**
- * 淇敼淇濆瓨瑙掕壊
- */
- @PreAuthorize("@ss.hasPermi('system:role:edit')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysRole role)
- {
- roleService.checkRoleAllowed(role);
- roleService.checkRoleDataScope(role.getRoleId());
- if (!roleService.checkRoleNameUnique(role))
- {
- return error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪");
- }
- else if (!roleService.checkRoleKeyUnique(role))
- {
- return error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪");
- }
- role.setUpdateBy(getUsername());
-
- if (roleService.updateRole(role) > 0)
- {
- // 鏇存柊缂撳瓨鐢ㄦ埛鏉冮檺
- LoginUser loginUser = getLoginUser();
- if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
- {
- loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
- loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
- tokenService.setLoginUser(loginUser);
- }
- return success();
- }
- return error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑱旂郴绠$悊鍛�");
- }
-
- /**
- * 淇敼淇濆瓨鏁版嵁鏉冮檺
- */
- @PreAuthorize("@ss.hasPermi('system:role:edit')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping("/dataScope")
- public AjaxResult dataScope(@RequestBody SysRole role)
- {
- roleService.checkRoleAllowed(role);
- roleService.checkRoleDataScope(role.getRoleId());
- return toAjax(roleService.authDataScope(role));
- }
-
- /**
- * 鐘舵�佷慨鏀�
- */
- @PreAuthorize("@ss.hasPermi('system:role:edit')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping("/changeStatus")
- public AjaxResult changeStatus(@RequestBody SysRole role)
- {
- roleService.checkRoleAllowed(role);
- roleService.checkRoleDataScope(role.getRoleId());
- role.setUpdateBy(getUsername());
- return toAjax(roleService.updateRoleStatus(role));
- }
-
- /**
- * 鍒犻櫎瑙掕壊
- */
- @PreAuthorize("@ss.hasPermi('system:role:remove')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE)
- @DeleteMapping("/{roleIds}")
- public AjaxResult remove(@PathVariable Long[] roleIds)
- {
- return toAjax(roleService.deleteRoleByIds(roleIds));
- }
-
- /**
- * 鑾峰彇瑙掕壊閫夋嫨妗嗗垪琛�
- */
- @PreAuthorize("@ss.hasPermi('system:role:query')")
- @GetMapping("/optionselect")
- public AjaxResult optionselect()
- {
- return success(roleService.selectRoleAll());
- }
-
- /**
- * 鏌ヨ宸插垎閰嶇敤鎴疯鑹插垪琛�
- */
- @PreAuthorize("@ss.hasPermi('system:role:list')")
- @GetMapping("/authUser/allocatedList")
- public TableDataInfo allocatedList(SysUser user)
- {
- startPage();
- List<SysUser> list = userService.selectAllocatedList(user);
- return getDataTable(list);
- }
-
- /**
- * 鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛�
- */
- @PreAuthorize("@ss.hasPermi('system:role:list')")
- @GetMapping("/authUser/unallocatedList")
- public TableDataInfo unallocatedList(SysUser user)
- {
- startPage();
- List<SysUser> list = userService.selectUnallocatedList(user);
- return getDataTable(list);
- }
-
- /**
- * 鍙栨秷鎺堟潈鐢ㄦ埛
- */
- @PreAuthorize("@ss.hasPermi('system:role:edit')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
- @PutMapping("/authUser/cancel")
- public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
- {
- return toAjax(roleService.deleteAuthUser(userRole));
- }
-
- /**
- * 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛
- */
- @PreAuthorize("@ss.hasPermi('system:role:edit')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
- @PutMapping("/authUser/cancelAll")
- public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
- {
- return toAjax(roleService.deleteAuthUsers(roleId, userIds));
- }
-
- /**
- * 鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈
- */
- @PreAuthorize("@ss.hasPermi('system:role:edit')")
- @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
- @PutMapping("/authUser/selectAll")
- public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
- {
- roleService.checkRoleDataScope(roleId);
- return toAjax(roleService.insertAuthUsers(roleId, userIds));
- }
-
- /**
- * 鑾峰彇瀵瑰簲瑙掕壊閮ㄩ棬鏍戝垪琛�
- */
- @PreAuthorize("@ss.hasPermi('system:role:query')")
- @GetMapping(value = "/deptTree/{roleId}")
- public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
- {
- AjaxResult ajax = AjaxResult.success();
- ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
- ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
- return ajax;
- }
-}
+package com.ruoyi.project.system.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.security.service.SysPermissionService;
+import com.ruoyi.framework.security.service.TokenService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.domain.SysRole;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.domain.SysUserRole;
+import com.ruoyi.project.system.service.ISysDeptService;
+import com.ruoyi.project.system.service.ISysRoleService;
+import com.ruoyi.project.system.service.ISysUserService;
+
+/**
+ * 瑙掕壊淇℃伅
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/role")
+@AllArgsConstructor
+public class SysRoleController extends BaseController
+{
+ private ISysRoleService roleService;
+ private TokenService tokenService;
+ private SysPermissionService permissionService;
+ private ISysUserService userService;
+ private ISysDeptService deptService;
+
+ @PreAuthorize("@ss.hasPermi('system:role:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysRole role)
+ {
+ startPage();
+ List<SysRole> list = roleService.selectRoleList(role);
+ return getDataTable(list);
+ }
+
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:role:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysRole role)
+ {
+ List<SysRole> list = roleService.selectRoleList(role);
+ ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
+ util.exportExcel(response, list, "瑙掕壊鏁版嵁");
+ }
+
+ /**
+ * 鏍规嵁瑙掕壊缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:query')")
+ @GetMapping(value = "/{roleId}")
+ public AjaxResult getInfo(@PathVariable Long roleId)
+ {
+ roleService.checkRoleDataScope(roleId);
+ return success(roleService.selectRoleById(roleId));
+ }
+
+ /**
+ * 鏂板瑙掕壊
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:add')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysRole role)
+ {
+ if (!roleService.checkRoleNameUnique(role))
+ {
+ return error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪");
+ }
+ else if (!roleService.checkRoleKeyUnique(role))
+ {
+ return error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪");
+ }
+ role.setCreateBy(getUsername());
+ return toAjax(roleService.insertRole(role));
+
+ }
+
+ /**
+ * 淇敼淇濆瓨瑙掕壊
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ roleService.checkRoleDataScope(role.getRoleId());
+ if (!roleService.checkRoleNameUnique(role))
+ {
+ return error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪");
+ }
+ else if (!roleService.checkRoleKeyUnique(role))
+ {
+ return error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪");
+ }
+ role.setUpdateBy(getUsername());
+
+ if (roleService.updateRole(role) > 0)
+ {
+ // 鏇存柊缂撳瓨鐢ㄦ埛鏉冮檺
+ LoginUser loginUser = getLoginUser();
+ if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
+ {
+ loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
+ loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
+ tokenService.setLoginUser(loginUser);
+ }
+ return success();
+ }
+ return error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑱旂郴绠$悊鍛�");
+ }
+
+ /**
+ * 淇敼淇濆瓨鏁版嵁鏉冮檺
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping("/dataScope")
+ public AjaxResult dataScope(@RequestBody SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ roleService.checkRoleDataScope(role.getRoleId());
+ return toAjax(roleService.authDataScope(role));
+ }
+
+ /**
+ * 鐘舵�佷慨鏀�
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping("/changeStatus")
+ public AjaxResult changeStatus(@RequestBody SysRole role)
+ {
+ roleService.checkRoleAllowed(role);
+ roleService.checkRoleDataScope(role.getRoleId());
+ role.setUpdateBy(getUsername());
+ return toAjax(roleService.updateRoleStatus(role));
+ }
+
+ /**
+ * 鍒犻櫎瑙掕壊
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:remove')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{roleIds}")
+ public AjaxResult remove(@PathVariable Long[] roleIds)
+ {
+ return toAjax(roleService.deleteRoleByIds(roleIds));
+ }
+
+ /**
+ * 鑾峰彇瑙掕壊閫夋嫨妗嗗垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:query')")
+ @GetMapping("/optionselect")
+ public AjaxResult optionselect()
+ {
+ return success(roleService.selectRoleAll());
+ }
+
+ /**
+ * 鏌ヨ宸插垎閰嶇敤鎴疯鑹插垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:list')")
+ @GetMapping("/authUser/allocatedList")
+ public TableDataInfo allocatedList(SysUser user)
+ {
+ startPage();
+ List<SysUser> list = userService.selectAllocatedList(user);
+ return getDataTable(list);
+ }
+
+ /**
+ * 鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:list')")
+ @GetMapping("/authUser/unallocatedList")
+ public TableDataInfo unallocatedList(SysUser user)
+ {
+ startPage();
+ List<SysUser> list = userService.selectUnallocatedList(user);
+ return getDataTable(list);
+ }
+
+ /**
+ * 鍙栨秷鎺堟潈鐢ㄦ埛
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
+ @PutMapping("/authUser/cancel")
+ public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
+ {
+ return toAjax(roleService.deleteAuthUser(userRole));
+ }
+
+ /**
+ * 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
+ @PutMapping("/authUser/cancelAll")
+ public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
+ {
+ return toAjax(roleService.deleteAuthUsers(roleId, userIds));
+ }
+
+ /**
+ * 鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:edit')")
+ @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
+ @PutMapping("/authUser/selectAll")
+ public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
+ {
+ roleService.checkRoleDataScope(roleId);
+ return toAjax(roleService.insertAuthUsers(roleId, userIds));
+ }
+
+ /**
+ * 鑾峰彇瀵瑰簲瑙掕壊閮ㄩ棬鏍戝垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('system:role:query')")
+ @GetMapping(value = "/deptTree/{roleId}")
+ public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
+ {
+ AjaxResult ajax = AjaxResult.success();
+ ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
+ ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
+ return ajax;
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysUserController.java b/src/main/java/com/ruoyi/project/system/controller/SysUserController.java
index 332d6b5..9e15e50 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysUserController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysUserController.java
@@ -1,292 +1,289 @@
-package com.ruoyi.project.system.controller;
-
-import java.util.List;
-import java.util.stream.Collectors;
-import jakarta.servlet.http.HttpServletResponse;
-
-import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
-import com.ruoyi.project.system.mapper.SysUserMapper;
-import com.ruoyi.project.system.service.*;
-import lombok.AllArgsConstructor;
-import org.apache.commons.lang3.ArrayUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.system.domain.SysDept;
-import com.ruoyi.project.system.domain.SysRole;
-import com.ruoyi.project.system.domain.SysUser;
-
-/**
- * 鐢ㄦ埛淇℃伅
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/user")
-@AllArgsConstructor
-public class SysUserController extends BaseController
-{
- private ISysUserService userService;
- private ISysRoleService roleService;
- private ISysDeptService deptService;
- private ISysPostService postService;
- private ISysUserDeptService userDeptService;
-
- /**
- * 鑾峰彇鐢ㄦ埛鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('system:user:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysUser user)
- {
- startPage();
- List<SysUser> list = userService.selectUserList(user);
- return getDataTable(list);
- }
-
- /**
- * 鑾峰彇鐢ㄦ埛鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('system:user:list')")
- @GetMapping("/listAll")
- public AjaxResult listAll(SysUser user)
- {
- List<SysUser> list = userService.selectUserList(user);
- return AjaxResult.success(list);
- }
-
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('system:user:export')")
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysUser user)
- {
- List<SysUser> list = userService.selectUserList(user);
- ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
- util.exportExcel(response, list, "鐢ㄦ埛鏁版嵁");
- }
-
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
- @PreAuthorize("@ss.hasPermi('system:user:import')")
- @PostMapping("/importData")
- public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
- {
- ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
- List<SysUser> userList = util.importExcel(file.getInputStream());
- String operName = getUsername();
- String message = userService.importUser(userList, updateSupport, operName);
- return success(message);
- }
-
- @PostMapping("/importTemplate")
- public void importTemplate(HttpServletResponse response)
- {
- ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
- util.importTemplateExcel(response, "鐢ㄦ埛鏁版嵁");
- }
-
- /**
- * 鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇璇︾粏淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('system:user:query')")
- @GetMapping(value = { "/", "/{userId}" })
- public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
- {
- AjaxResult ajax = AjaxResult.success();
- if (StringUtils.isNotNull(userId))
- {
- userService.checkUserDataScope(userId);
- SysUser sysUser = userService.selectUserById(userId);
- ajax.put(AjaxResult.DATA_TAG, sysUser);
- ajax.put("postIds", postService.selectPostListByUserId(userId));
- ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
- }
- List<SysRole> roles = roleService.selectRoleAll();
- ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
- ajax.put("posts", postService.selectPostAll());
- SysUserDeptVo sysUserDeptVo = new SysUserDeptVo();
- sysUserDeptVo.setUserId(userId);
- List<SysUserDeptVo> sysUserDeptVos = userDeptService.userLoginFacotryList(sysUserDeptVo);
- ajax.put("deptIds",sysUserDeptVos.stream().map(SysUserDeptVo::getDeptId).collect(Collectors.toList()));
- return ajax;
- }
-
- /**
- * 鏂板鐢ㄦ埛
- */
- @PreAuthorize("@ss.hasPermi('system:user:add')")
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysUser user)
- {
- roleService.checkRoleDataScope(user.getRoleIds());
- if (!userService.checkUserNameUnique(user))
- {
- return error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
- }
- else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
- {
- return error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
- }
- else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
- {
- return error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
- }
- user.setCreateBy(getUsername());
- user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
- user.setTenantId(user.getDeptId());
- return toAjax(userService.insertUser(user));
- }
-
- /**
- * 淇敼鐢ㄦ埛
- */
- @PreAuthorize("@ss.hasPermi('system:user:edit')")
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysUser user)
- {
- userService.checkUserAllowed(user);
- userService.checkUserDataScope(user.getUserId());
- roleService.checkRoleDataScope(user.getRoleIds());
- if (!userService.checkUserNameUnique(user))
- {
- return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
- }
- else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
- {
- return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
- }
- else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
- {
- return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
- }
- user.setUpdateBy(getUsername());
- userService.bindUserDept(user);
- return toAjax(userService.updateUser(user));
- }
-
- /**
- * 鍒犻櫎鐢ㄦ埛
- */
- @PreAuthorize("@ss.hasPermi('system:user:remove')")
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.DELETE)
- @DeleteMapping("/{userIds}")
- public AjaxResult remove(@PathVariable Long[] userIds)
- {
- if (ArrayUtils.contains(userIds, getUserId()))
- {
- return error("褰撳墠鐢ㄦ埛涓嶈兘鍒犻櫎");
- }
- return toAjax(userService.deleteUserByIds(userIds));
- }
-
- /**
- * 閲嶇疆瀵嗙爜
- */
- @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping("/resetPwd")
- public AjaxResult resetPwd(@RequestBody SysUser user)
- {
- userService.checkUserAllowed(user);
- userService.checkUserDataScope(user.getUserId());
- user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
- user.setUpdateBy(getUsername());
- return toAjax(userService.resetPwd(user));
- }
-
- /**
- * 鐘舵�佷慨鏀�
- */
- @PreAuthorize("@ss.hasPermi('system:user:edit')")
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping("/changeStatus")
- public AjaxResult changeStatus(@RequestBody SysUser user)
- {
- userService.checkUserAllowed(user);
- userService.checkUserDataScope(user.getUserId());
- user.setUpdateBy(getUsername());
- return toAjax(userService.updateUserStatus(user));
- }
-
- /**
- * 鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鎺堟潈瑙掕壊
- */
- @PreAuthorize("@ss.hasPermi('system:user:query')")
- @GetMapping("/authRole/{userId}")
- public AjaxResult authRole(@PathVariable("userId") Long userId)
- {
- AjaxResult ajax = AjaxResult.success();
- SysUser user = userService.selectUserById(userId);
- List<SysRole> roles = roleService.selectRolesByUserId(userId);
- ajax.put("user", user);
- ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
- return ajax;
- }
-
- /**
- * 鐢ㄦ埛鎺堟潈瑙掕壊
- */
- @PreAuthorize("@ss.hasPermi('system:user:edit')")
- @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.GRANT)
- @PutMapping("/authRole")
- public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
- {
- userService.checkUserDataScope(userId);
- roleService.checkRoleDataScope(roleIds);
- userService.insertUserAuth(userId, roleIds);
- return success();
- }
-
- /**
- * 鑾峰彇閮ㄩ棬鏍戝垪琛�
- */
- @PreAuthorize("@ss.hasPermi('system:user:list')")
- @GetMapping("/deptTree")
- public AjaxResult deptTree(SysDept dept)
- {
- return success(deptService.selectDeptTreeList(dept));
- }
-
- /**
- * 涓嶅垎椤电敤鎴锋煡璇�
- * @param user
- * @return
- */
- @GetMapping("/userListNoPage")
- public AjaxResult userListNoPage(SysUser user){
- List<SysUser> sysUserList = userService.userListNoPage(user);
- return AjaxResult.success(sysUserList);
- }
-
- /**
- * 鏌ヨ褰撳墠鐢ㄦ埛鍏徃涓嬫墍鏈夌敤鎴�
- * @param user
- * @return
- */
- @GetMapping("/userListNoPageByTenantId")
- public AjaxResult userListNoPageByTenantId(SysUser user){
- //鑾峰彇鐧诲綍鐢ㄦ埛淇℃伅
- SysUser loginUser = SecurityUtils.getLoginUser().getUser();
- user.setTenantId(loginUser.getTenantId());
- List<SysUser> sysUserList = userService.userListNoPage(user);
- return AjaxResult.success(sysUserList);
- }
-}
+package com.ruoyi.project.system.controller;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import jakarta.servlet.http.HttpServletResponse;
+
+import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
+import com.ruoyi.project.system.mapper.SysUserMapper;
+import com.ruoyi.project.system.service.*;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.domain.SysRole;
+import com.ruoyi.project.system.domain.SysUser;
+
+/**
+ * 鐢ㄦ埛淇℃伅
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/user")
+@AllArgsConstructor
+public class SysUserController extends BaseController
+{
+ private ISysUserService userService;
+ private ISysRoleService roleService;
+ private ISysDeptService deptService;
+ private ISysPostService postService;
+ private ISysUserDeptService userDeptService;
+
+ /**
+ * 鑾峰彇鐢ㄦ埛鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysUser user)
+ {
+ startPage();
+ List<SysUser> list = userService.selectUserList(user);
+ return getDataTable(list);
+ }
+
+ /**
+ * 鑾峰彇鐢ㄦ埛鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:list')")
+ @GetMapping("/listAll")
+ public AjaxResult listAll(SysUser user)
+ {
+ List<SysUser> list = userService.selectUserList(user);
+ return AjaxResult.success(list);
+ }
+
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:user:export')")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysUser user)
+ {
+ List<SysUser> list = userService.selectUserList(user);
+ ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
+ util.exportExcel(response, list, "鐢ㄦ埛鏁版嵁");
+ }
+
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
+ @PreAuthorize("@ss.hasPermi('system:user:import')")
+ @PostMapping("/importData")
+ public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+ {
+ ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
+ List<SysUser> userList = util.importExcel(file.getInputStream());
+ String operName = getUsername();
+ String message = userService.importUser(userList, updateSupport, operName);
+ return success(message);
+ }
+
+ @PostMapping("/importTemplate")
+ public void importTemplate(HttpServletResponse response)
+ {
+ ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
+ util.importTemplateExcel(response, "鐢ㄦ埛鏁版嵁");
+ }
+
+ /**
+ * 鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:query')")
+ @GetMapping(value = { "/", "/{userId}" })
+ public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
+ {
+ AjaxResult ajax = AjaxResult.success();
+ if (StringUtils.isNotNull(userId))
+ {
+ userService.checkUserDataScope(userId);
+ SysUser sysUser = userService.selectUserById(userId);
+ ajax.put(AjaxResult.DATA_TAG, sysUser);
+ ajax.put("postIds", postService.selectPostListByUserId(userId));
+ ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
+ }
+ List<SysRole> roles = roleService.selectRoleAll();
+ ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
+ ajax.put("posts", postService.selectPostAll());
+ ajax.put("deptIds", userService.selectDeptIdsByUserId(userId));
+ return ajax;
+ }
+
+ /**
+ * 鏂板鐢ㄦ埛
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:add')")
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysUser user)
+ {
+ roleService.checkRoleDataScope(user.getRoleIds());
+ if (!userService.checkUserNameUnique(user))
+ {
+ return error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
+ }
+ else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
+ {
+ return error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
+ }
+ else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
+ {
+ return error("鏂板鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
+ }
+ user.setCreateBy(getUsername());
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+ user.setTenantId(user.getDeptId());
+ return toAjax(userService.insertUser(user));
+ }
+
+ /**
+ * 淇敼鐢ㄦ埛
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:edit')")
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ userService.checkUserDataScope(user.getUserId());
+ roleService.checkRoleDataScope(user.getRoleIds());
+ if (!userService.checkUserNameUnique(user))
+ {
+ return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
+ }
+ else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
+ {
+ return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
+ }
+ else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
+ {
+ return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
+ }
+ user.setUpdateBy(getUsername());
+ userService.bindUserDept(user);
+ return toAjax(userService.updateUser(user));
+ }
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:remove')")
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{userIds}")
+ public AjaxResult remove(@PathVariable Long[] userIds)
+ {
+ if (ArrayUtils.contains(userIds, getUserId()))
+ {
+ return error("褰撳墠鐢ㄦ埛涓嶈兘鍒犻櫎");
+ }
+ return toAjax(userService.deleteUserByIds(userIds));
+ }
+
+ /**
+ * 閲嶇疆瀵嗙爜
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping("/resetPwd")
+ public AjaxResult resetPwd(@RequestBody SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ userService.checkUserDataScope(user.getUserId());
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+ user.setUpdateBy(getUsername());
+ return toAjax(userService.resetPwd(user));
+ }
+
+ /**
+ * 鐘舵�佷慨鏀�
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:edit')")
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping("/changeStatus")
+ public AjaxResult changeStatus(@RequestBody SysUser user)
+ {
+ userService.checkUserAllowed(user);
+ userService.checkUserDataScope(user.getUserId());
+ user.setUpdateBy(getUsername());
+ return toAjax(userService.updateUserStatus(user));
+ }
+
+ /**
+ * 鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鎺堟潈瑙掕壊
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:query')")
+ @GetMapping("/authRole/{userId}")
+ public AjaxResult authRole(@PathVariable("userId") Long userId)
+ {
+ AjaxResult ajax = AjaxResult.success();
+ SysUser user = userService.selectUserById(userId);
+ List<SysRole> roles = roleService.selectRolesByUserId(userId);
+ ajax.put("user", user);
+ ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
+ return ajax;
+ }
+
+ /**
+ * 鐢ㄦ埛鎺堟潈瑙掕壊
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:edit')")
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.GRANT)
+ @PutMapping("/authRole")
+ public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
+ {
+ userService.checkUserDataScope(userId);
+ roleService.checkRoleDataScope(roleIds);
+ userService.insertUserAuth(userId, roleIds);
+ return success();
+ }
+
+ /**
+ * 鑾峰彇閮ㄩ棬鏍戝垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('system:user:list')")
+ @GetMapping("/deptTree")
+ public AjaxResult deptTree(SysDept dept)
+ {
+ return success(deptService.selectDeptTreeList(dept));
+ }
+
+ /**
+ * 涓嶅垎椤电敤鎴锋煡璇�
+ * @param user
+ * @return
+ */
+ @GetMapping("/userListNoPage")
+ public AjaxResult userListNoPage(SysUser user){
+ List<SysUser> sysUserList = userService.userListNoPage(user);
+ return AjaxResult.success(sysUserList);
+ }
+
+ /**
+ * 鏌ヨ褰撳墠鐢ㄦ埛鍏徃涓嬫墍鏈夌敤鎴�
+ * @param user
+ * @return
+ */
+ @GetMapping("/userListNoPageByTenantId")
+ public AjaxResult userListNoPageByTenantId(SysUser user){
+ //鑾峰彇鐧诲綍鐢ㄦ埛淇℃伅
+ SysUser loginUser = SecurityUtils.getLoginUser().getUser();
+ user.setTenantId(loginUser.getTenantId());
+ List<SysUser> sysUserList = userService.userListNoPage(user);
+ return AjaxResult.success(sysUserList);
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/system/domain/SysUser.java b/src/main/java/com/ruoyi/project/system/domain/SysUser.java
index 515210e..39050e5 100644
--- a/src/main/java/com/ruoyi/project/system/domain/SysUser.java
+++ b/src/main/java/com/ruoyi/project/system/domain/SysUser.java
@@ -1,8 +1,8 @@
package com.ruoyi.project.system.domain;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.ruoyi.common.xss.Xss;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.ruoyi.common.xss.Xss;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
import com.ruoyi.framework.aspectj.lang.annotation.Excel.Type;
@@ -60,13 +60,13 @@
@Excel(name = "璐﹀彿鐘舵��", readConverterExp = "0=姝e父,1=鍋滅敤")
private String status;
- /** 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */
- private String delFlag;
-
- /** 鏄惁寮�閫欰I鍔熻兘锛�0鍚� 1鏄級 */
- @JsonIgnore
- private Integer aiEnabled;
-
+ /** 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */
+ private String delFlag;
+
+ /** 鏄惁寮�閫欰I鍔熻兘锛�0鍚� 1鏄級 */
+ @JsonIgnore
+ private Integer aiEnabled;
+
/** 鏈�鍚庣櫥褰旾P */
@Excel(name = "鏈�鍚庣櫥褰旾P", type = Type.EXPORT)
private String loginIp;
@@ -128,6 +128,12 @@
*/
@TableField(exist = false)
private String deptNames;
+
+ /**
+ * 瑙掕壊鍚嶇О
+ */
+ @TableField(exist = false)
+ private String roleNames;
public Long getCurrentDeptId() {
return currentDeptId;
@@ -255,25 +261,25 @@
this.status = status;
}
- public String getDelFlag()
- {
- return delFlag;
- }
+ public String getDelFlag()
+ {
+ return delFlag;
+ }
- public void setDelFlag(String delFlag)
- {
- this.delFlag = delFlag;
- }
-
- public Integer getAiEnabled()
- {
- return aiEnabled;
- }
-
- public void setAiEnabled(Integer aiEnabled)
- {
- this.aiEnabled = aiEnabled;
- }
+ public void setDelFlag(String delFlag)
+ {
+ this.delFlag = delFlag;
+ }
+
+ public Integer getAiEnabled()
+ {
+ return aiEnabled;
+ }
+
+ public void setAiEnabled(Integer aiEnabled)
+ {
+ this.aiEnabled = aiEnabled;
+ }
public String getLoginIp()
{
@@ -369,6 +375,14 @@
this.deptNames = deptNames;
}
+ public String getRoleNames() {
+ return roleNames;
+ }
+
+ public void setRoleNames(String roleNames) {
+ this.roleNames = roleNames;
+ }
+
public Long getDeptId() {
return deptId;
}
@@ -388,10 +402,10 @@
.append("sex", getSex())
.append("avatar", getAvatar())
.append("password", getPassword())
- .append("status", getStatus())
- .append("delFlag", getDelFlag())
- .append("aiEnabled", getAiEnabled())
- .append("loginIp", getLoginIp())
+ .append("status", getStatus())
+ .append("delFlag", getDelFlag())
+ .append("aiEnabled", getAiEnabled())
+ .append("loginIp", getLoginIp())
.append("loginDate", getLoginDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
diff --git a/src/main/java/com/ruoyi/project/system/mapper/SysUserDeptMapper.java b/src/main/java/com/ruoyi/project/system/mapper/SysUserDeptMapper.java
index 8c0ca53..f5baaec 100644
--- a/src/main/java/com/ruoyi/project/system/mapper/SysUserDeptMapper.java
+++ b/src/main/java/com/ruoyi/project/system/mapper/SysUserDeptMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.project.system.domain.SysUserDept;
import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
+import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -15,4 +16,28 @@
List<SysUserDeptVo> userLoginFacotryList(@Param("userDeptVo") SysUserDeptVo userDeptVo);
List<Map<String, Object>> setSchemeApplicableStaffUserInfo(@Param("ids") List<Long> ids);
+
+ @Select("<script>" +
+ "select count(distinct sud.user_id) " +
+ "from sys_user_dept sud " +
+ "inner join sys_user su on su.user_id = sud.user_id " +
+ "where su.del_flag = '0' " +
+ "and sud.dept_id in " +
+ "<foreach collection='deptIds' item='deptId' open='(' separator=',' close=')'>" +
+ "#{deptId}" +
+ "</foreach>" +
+ "</script>")
+ Long countDistinctUserIdsByDeptIds(@Param("deptIds") List<Long> deptIds);
+
+ @Select("<script>" +
+ "select distinct sud.user_id " +
+ "from sys_user_dept sud " +
+ "inner join sys_user su on su.user_id = sud.user_id " +
+ "where su.del_flag = '0' " +
+ "and sud.dept_id in " +
+ "<foreach collection='deptIds' item='deptId' open='(' separator=',' close=')'>" +
+ "#{deptId}" +
+ "</foreach>" +
+ "</script>")
+ List<Long> selectDistinctUserIdsByDeptIds(@Param("deptIds") List<Long> deptIds);
}
diff --git a/src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java b/src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java
index 5507b3f..ccabf71 100644
--- a/src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java
+++ b/src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java
@@ -155,5 +155,10 @@
List<Long> getUserByRole(@Param("role") String role);
+ /**
+ * 鏌ヨ鎵�鏈夋椿璺冪敤鎴凤紙鍚儴闂ㄥ悕绉板拰瑙掕壊鍚嶇О锛�
+ */
+ List<SysUser> selectUserListWithDetail();
+
List<Long> getUserByPerms(@Param("perms") List<String> perms);
}
diff --git a/src/main/java/com/ruoyi/project/system/service/ISysUserService.java b/src/main/java/com/ruoyi/project/system/service/ISysUserService.java
index 7d5ba4a..e3be5f4 100644
--- a/src/main/java/com/ruoyi/project/system/service/ISysUserService.java
+++ b/src/main/java/com/ruoyi/project/system/service/ISysUserService.java
@@ -217,4 +217,11 @@
* @return
*/
int bindUserDept(SysUser user);
+
+ /**
+ * 鏍规嵁鐢ㄦ埛ID鏌ヨ鎵�鏈夊叧鑱旂殑閮ㄩ棬ID
+ * @param userId
+ * @return
+ */
+ List<Long> selectDeptIdsByUserId(Long userId);
}
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java b/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
index dcbcded..d04239f 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsMapper;
+import com.ruoyi.collaborativeApproval.pojo.EnterpriseNews;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysNotice;
@@ -18,8 +20,12 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.stream.Collectors;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* 鍏憡 鏈嶅姟灞傚疄鐜�
@@ -30,11 +36,14 @@
@RequiredArgsConstructor
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {
+ private static final Pattern ENTERPRISE_NEWS_ID_PATTERN = Pattern.compile("[?&]id=(\\d+)");
+
private final SysNoticeMapper noticeMapper;
private final SysUserMapper userMapper;
private final SysDeptMapper deptMapper;
private final SysUserDeptMapper userDeptMapper;
private final UnipushService unipushService;
+ private final EnterpriseNewsMapper enterpriseNewsMapper;
/**
* 鏌ヨ鍏憡淇℃伅
@@ -78,9 +87,24 @@
* @return 缁撴灉
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public int updateNotice(SysNotice notice)
{
- return noticeMapper.updateNotice(notice);
+ if (notice == null || notice.getNoticeId() == null) {
+ return 0;
+ }
+ SysNotice dbNotice = noticeMapper.selectNoticeById(notice.getNoticeId());
+ if (dbNotice == null) {
+ return 0;
+ }
+ boolean needSyncNewsReadCount = isEnterpriseNewsNotice(dbNotice)
+ && notice.getStatus() != null
+ && !notice.getStatus().equals(dbNotice.getStatus());
+ int rows = noticeMapper.updateNotice(notice);
+ if (rows > 0 && needSyncNewsReadCount) {
+ syncEnterpriseNewsReadCount(dbNotice.getJumpPath());
+ }
+ return rows;
}
/**
@@ -117,10 +141,17 @@
@Override
public int readAll() {
Long userId = SecurityUtils.getUserId();
- return noticeMapper.update(null, Wrappers.<SysNotice>lambdaUpdate()
+ List<SysNotice> unreadNotices = noticeMapper.selectList(Wrappers.<SysNotice>lambdaQuery()
+ .eq(SysNotice::getConsigneeId, userId)
+ .eq(SysNotice::getStatus, "0"));
+ int rows = noticeMapper.update(null, Wrappers.<SysNotice>lambdaUpdate()
.eq(SysNotice::getConsigneeId, userId)
.eq(SysNotice::getStatus, "0")
.set(SysNotice::getStatus, "1"));
+ if (rows > 0) {
+ syncEnterpriseNewsReadCount(unreadNotices);
+ }
+ return rows;
}
@Override
@@ -220,9 +251,63 @@
return false;
}
sysNotice.setStatus("1");
- return noticeMapper.update(null, Wrappers.<SysNotice>lambdaUpdate()
+ boolean updated = noticeMapper.update(null, Wrappers.<SysNotice>lambdaUpdate()
.eq(SysNotice::getNoticeId, noticeId)
.eq(SysNotice::getStatus, "0")
.set(SysNotice::getStatus, "1")) > 0;
+ if (updated) {
+ syncEnterpriseNewsReadCount(sysNotice.getJumpPath());
+ }
+ return updated;
+ }
+
+ private boolean isEnterpriseNewsNotice(SysNotice sysNotice) {
+ return sysNotice != null
+ && sysNotice.getJumpPath() != null
+ && sysNotice.getJumpPath().contains("/enterpriseNews?id=");
+ }
+
+ private void syncEnterpriseNewsReadCount(List<SysNotice> notices) {
+ if (notices == null || notices.isEmpty()) {
+ return;
+ }
+ Set<String> jumpPaths = new HashSet<>();
+ for (SysNotice notice : notices) {
+ if (isEnterpriseNewsNotice(notice)) {
+ jumpPaths.add(notice.getJumpPath());
+ }
+ }
+ for (String jumpPath : jumpPaths) {
+ syncEnterpriseNewsReadCount(jumpPath);
+ }
+ }
+
+ private void syncEnterpriseNewsReadCount(String jumpPath) {
+ Long newsId = parseEnterpriseNewsId(jumpPath);
+ if (newsId == null) {
+ return;
+ }
+ long readCount = noticeMapper.selectCount(Wrappers.<SysNotice>lambdaQuery()
+ .eq(SysNotice::getStatus, "1")
+ .eq(SysNotice::getJumpPath, jumpPath));
+ EnterpriseNews enterpriseNews = new EnterpriseNews();
+ enterpriseNews.setId(newsId);
+ enterpriseNews.setReadCount((int) readCount);
+ enterpriseNewsMapper.updateById(enterpriseNews);
+ }
+
+ private Long parseEnterpriseNewsId(String jumpPath) {
+ if (jumpPath == null || !jumpPath.startsWith("/enterpriseNews")) {
+ return null;
+ }
+ Matcher matcher = ENTERPRISE_NEWS_ID_PATTERN.matcher(jumpPath);
+ if (!matcher.find()) {
+ return null;
+ }
+ try {
+ return Long.parseLong(matcher.group(1));
+ } catch (NumberFormatException e) {
+ return null;
+ }
}
}
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java b/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java
index 39f7234..01addd4 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java
@@ -560,4 +560,11 @@
}
return user.getDeptIds().length;
}
+
+ @Override
+ public List<Long> selectDeptIdsByUserId(Long userId) {
+ LambdaQueryWrapper<SysUserDept> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(SysUserDept::getUserId, userId);
+ return sysUserDeptMapper.selectList(queryWrapper).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+ }
}
diff --git a/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java b/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java
index ec16cea..a94fe62 100644
--- a/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java
+++ b/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java
@@ -1,255 +1,255 @@
-package com.ruoyi.project.tool.gen.controller;
-
-import com.alibaba.druid.DbType;
-import com.alibaba.druid.sql.SQLUtils;
-import com.alibaba.druid.sql.ast.SQLStatement;
-import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
-import com.ruoyi.common.core.text.Convert;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.sql.SqlUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.config.GenConfig;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.tool.gen.domain.GenTable;
-import com.ruoyi.project.tool.gen.domain.GenTableColumn;
-import com.ruoyi.project.tool.gen.service.IGenTableColumnService;
-import com.ruoyi.project.tool.gen.service.IGenTableService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.apache.commons.io.IOUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 浠g爜鐢熸垚 鎿嶄綔澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/tool/gen")
-@AllArgsConstructor
-public class GenController extends BaseController
-{
- private IGenTableService genTableService;
- private IGenTableColumnService genTableColumnService;
-
- /**
- * 鏌ヨ浠g爜鐢熸垚鍒楄〃
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:list')")
- @GetMapping("/list")
- public TableDataInfo genList(GenTable genTable)
- {
- startPage();
- List<GenTable> list = genTableService.selectGenTableList(genTable);
- return getDataTable(list);
- }
-
- /**
- * 鑾峰彇浠g爜鐢熸垚淇℃伅
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:query')")
- @GetMapping(value = "/{talbleId}")
- public AjaxResult getInfo(@PathVariable Long talbleId)
- {
- GenTable table = genTableService.selectGenTableById(talbleId);
- List<GenTable> tables = genTableService.selectGenTableAll();
- List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("info", table);
- map.put("rows", list);
- map.put("tables", tables);
- return success(map);
- }
-
- /**
- * 鏌ヨ鏁版嵁搴撳垪琛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:list')")
- @GetMapping("/db/list")
- public TableDataInfo dataList(GenTable genTable)
- {
- startPage();
- List<GenTable> list = genTableService.selectDbTableList(genTable);
- return getDataTable(list);
- }
-
- /**
- * 鏌ヨ鏁版嵁琛ㄥ瓧娈靛垪琛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:list')")
- @GetMapping(value = "/column/{tableId}")
- public TableDataInfo columnList(Long tableId)
- {
- TableDataInfo dataInfo = new TableDataInfo();
- List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
- dataInfo.setRows(list);
- dataInfo.setTotal(list.size());
- return dataInfo;
- }
-
- /**
- * 瀵煎叆琛ㄧ粨鏋勶紙淇濆瓨锛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:import')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.IMPORT)
- @PostMapping("/importTable")
- public AjaxResult importTableSave(String tables)
- {
- String[] tableNames = Convert.toStrArray(tables);
- // 鏌ヨ琛ㄤ俊鎭�
- List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
- genTableService.importGenTable(tableList, SecurityUtils.getUsername());
- return success();
- }
-
- /**
- * 鍒涘缓琛ㄧ粨鏋勶紙淇濆瓨锛�
- */
- @PreAuthorize("@ss.hasRole('admin')")
- @Log(title = "鍒涘缓琛�", businessType = BusinessType.OTHER)
- @PostMapping("/createTable")
- public AjaxResult createTableSave(String sql)
- {
- try
- {
- SqlUtil.filterKeyword(sql);
- List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
- List<String> tableNames = new ArrayList<>();
- for (SQLStatement sqlStatement : sqlStatements)
- {
- if (sqlStatement instanceof MySqlCreateTableStatement)
- {
- MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
- if (genTableService.createTable(createTableStatement.toString()))
- {
- String tableName = createTableStatement.getTableName().replaceAll("`", "");
- tableNames.add(tableName);
- }
- }
- }
- List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
- String operName = SecurityUtils.getUsername();
- genTableService.importGenTable(tableList, operName);
- return AjaxResult.success();
- }
- catch (Exception e)
- {
- logger.error(e.getMessage(), e);
- return AjaxResult.error("鍒涘缓琛ㄧ粨鏋勫紓甯�");
- }
- }
-
- /**
- * 淇敼淇濆瓨浠g爜鐢熸垚涓氬姟
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
- {
- genTableService.validateEdit(genTable);
- genTableService.updateGenTable(genTable);
- return success();
- }
-
- /**
- * 鍒犻櫎浠g爜鐢熸垚
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:remove')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.DELETE)
- @DeleteMapping("/{tableIds}")
- public AjaxResult remove(@PathVariable Long[] tableIds)
- {
- genTableService.deleteGenTableByIds(tableIds);
- return success();
- }
-
- /**
- * 棰勮浠g爜
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:preview')")
- @GetMapping("/preview/{tableId}")
- public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
- {
- Map<String, String> dataMap = genTableService.previewCode(tableId);
- return success(dataMap);
- }
-
- /**
- * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:code')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
- @GetMapping("/download/{tableName}")
- public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
- {
- byte[] data = genTableService.downloadCode(tableName);
- genCode(response, data);
- }
-
- /**
- * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:code')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
- @GetMapping("/genCode/{tableName}")
- public AjaxResult genCode(@PathVariable("tableName") String tableName)
- {
- if (!GenConfig.isAllowOverwrite())
- {
- return AjaxResult.error("銆愮郴缁熼璁俱�戜笉鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦�");
- }
- genTableService.generatorCode(tableName);
- return success();
- }
-
- /**
- * 鍚屾鏁版嵁搴�
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
- @GetMapping("/synchDb/{tableName}")
- public AjaxResult synchDb(@PathVariable("tableName") String tableName)
- {
- genTableService.synchDb(tableName);
- return success();
- }
-
- /**
- * 鎵归噺鐢熸垚浠g爜
- */
- @PreAuthorize("@ss.hasPermi('tool:gen:code')")
- @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
- @GetMapping("/batchGenCode")
- public void batchGenCode(HttpServletResponse response, String tables) throws IOException
- {
- String[] tableNames = Convert.toStrArray(tables);
- byte[] data = genTableService.downloadCode(tableNames);
- genCode(response, data);
- }
-
- /**
- * 鐢熸垚zip鏂囦欢
- */
- private void genCode(HttpServletResponse response, byte[] data) throws IOException
- {
- response.reset();
- response.addHeader("Access-Control-Allow-Origin", "*");
- response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
- response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
- response.addHeader("Content-Length", "" + data.length);
- response.setContentType("application/octet-stream; charset=UTF-8");
- IOUtils.write(data, response.getOutputStream());
- }
+package com.ruoyi.project.tool.gen.controller;
+
+import com.alibaba.druid.DbType;
+import com.alibaba.druid.sql.SQLUtils;
+import com.alibaba.druid.sql.ast.SQLStatement;
+import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.sql.SqlUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.GenConfig;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.tool.gen.domain.GenTable;
+import com.ruoyi.project.tool.gen.domain.GenTableColumn;
+import com.ruoyi.project.tool.gen.service.IGenTableColumnService;
+import com.ruoyi.project.tool.gen.service.IGenTableService;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.apache.commons.io.IOUtils;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 浠g爜鐢熸垚 鎿嶄綔澶勭悊
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/tool/gen")
+@AllArgsConstructor
+public class GenController extends BaseController
+{
+ private IGenTableService genTableService;
+ private IGenTableColumnService genTableColumnService;
+
+ /**
+ * 鏌ヨ浠g爜鐢熸垚鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:list')")
+ @GetMapping("/list")
+ public TableDataInfo genList(GenTable genTable)
+ {
+ startPage();
+ List<GenTable> list = genTableService.selectGenTableList(genTable);
+ return getDataTable(list);
+ }
+
+ /**
+ * 鑾峰彇浠g爜鐢熸垚淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:query')")
+ @GetMapping(value = "/{talbleId}")
+ public AjaxResult getInfo(@PathVariable Long talbleId)
+ {
+ GenTable table = genTableService.selectGenTableById(talbleId);
+ List<GenTable> tables = genTableService.selectGenTableAll();
+ List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("info", table);
+ map.put("rows", list);
+ map.put("tables", tables);
+ return success(map);
+ }
+
+ /**
+ * 鏌ヨ鏁版嵁搴撳垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:list')")
+ @GetMapping("/db/list")
+ public TableDataInfo dataList(GenTable genTable)
+ {
+ startPage();
+ List<GenTable> list = genTableService.selectDbTableList(genTable);
+ return getDataTable(list);
+ }
+
+ /**
+ * 鏌ヨ鏁版嵁琛ㄥ瓧娈靛垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:list')")
+ @GetMapping(value = "/column/{tableId}")
+ public TableDataInfo columnList(Long tableId)
+ {
+ TableDataInfo dataInfo = new TableDataInfo();
+ List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
+ dataInfo.setRows(list);
+ dataInfo.setTotal(list.size());
+ return dataInfo;
+ }
+
+ /**
+ * 瀵煎叆琛ㄧ粨鏋勶紙淇濆瓨锛�
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:import')")
+ @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.IMPORT)
+ @PostMapping("/importTable")
+ public AjaxResult importTableSave(String tables)
+ {
+ String[] tableNames = Convert.toStrArray(tables);
+ // 鏌ヨ琛ㄤ俊鎭�
+ List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
+ genTableService.importGenTable(tableList, SecurityUtils.getUsername());
+ return success();
+ }
+
+ /**
+ * 鍒涘缓琛ㄧ粨鏋勶紙淇濆瓨锛�
+ */
+ @PreAuthorize("@ss.hasRole('admin')")
+ @Log(title = "鍒涘缓琛�", businessType = BusinessType.OTHER)
+ @PostMapping("/createTable")
+ public AjaxResult createTableSave(String sql)
+ {
+ try
+ {
+ SqlUtil.filterKeyword(sql);
+ List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
+ List<String> tableNames = new ArrayList<>();
+ for (SQLStatement sqlStatement : sqlStatements)
+ {
+ if (sqlStatement instanceof MySqlCreateTableStatement)
+ {
+ MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
+ if (genTableService.createTable(createTableStatement.toString()))
+ {
+ String tableName = createTableStatement.getTableName().replaceAll("`", "");
+ tableNames.add(tableName);
+ }
+ }
+ }
+ List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
+ String operName = SecurityUtils.getUsername();
+ genTableService.importGenTable(tableList, operName);
+ return AjaxResult.success();
+ }
+ catch (Exception e)
+ {
+ logger.error(e.getMessage(), e);
+ return AjaxResult.error("鍒涘缓琛ㄧ粨鏋勫紓甯�");
+ }
+ }
+
+ /**
+ * 淇敼淇濆瓨浠g爜鐢熸垚涓氬姟
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
+ @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
+ {
+ genTableService.validateEdit(genTable);
+ genTableService.updateGenTable(genTable);
+ return success();
+ }
+
+ /**
+ * 鍒犻櫎浠g爜鐢熸垚
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:remove')")
+ @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{tableIds}")
+ public AjaxResult remove(@PathVariable Long[] tableIds)
+ {
+ genTableService.deleteGenTableByIds(tableIds);
+ return success();
+ }
+
+ /**
+ * 棰勮浠g爜
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:preview')")
+ @GetMapping("/preview/{tableId}")
+ public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
+ {
+ Map<String, String> dataMap = genTableService.previewCode(tableId);
+ return success(dataMap);
+ }
+
+ /**
+ * 鐢熸垚浠g爜锛堜笅杞芥柟寮忥級
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:code')")
+ @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
+ @GetMapping("/download/{tableName}")
+ public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
+ {
+ byte[] data = genTableService.downloadCode(tableName);
+ genCode(response, data);
+ }
+
+ /**
+ * 鐢熸垚浠g爜锛堣嚜瀹氫箟璺緞锛�
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:code')")
+ @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
+ @GetMapping("/genCode/{tableName}")
+ public AjaxResult genCode(@PathVariable("tableName") String tableName)
+ {
+ if (!GenConfig.isAllowOverwrite())
+ {
+ return AjaxResult.error("銆愮郴缁熼璁俱�戜笉鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦�");
+ }
+ genTableService.generatorCode(tableName);
+ return success();
+ }
+
+ /**
+ * 鍚屾鏁版嵁搴�
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
+ @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.UPDATE)
+ @GetMapping("/synchDb/{tableName}")
+ public AjaxResult synchDb(@PathVariable("tableName") String tableName)
+ {
+ genTableService.synchDb(tableName);
+ return success();
+ }
+
+ /**
+ * 鎵归噺鐢熸垚浠g爜
+ */
+ @PreAuthorize("@ss.hasPermi('tool:gen:code')")
+ @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.GENCODE)
+ @GetMapping("/batchGenCode")
+ public void batchGenCode(HttpServletResponse response, String tables) throws IOException
+ {
+ String[] tableNames = Convert.toStrArray(tables);
+ byte[] data = genTableService.downloadCode(tableNames);
+ genCode(response, data);
+ }
+
+ /**
+ * 鐢熸垚zip鏂囦欢
+ */
+ private void genCode(HttpServletResponse response, byte[] data) throws IOException
+ {
+ response.reset();
+ response.addHeader("Access-Control-Allow-Origin", "*");
+ response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
+ response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
+ response.addHeader("Content-Length", "" + data.length);
+ response.setContentType("application/octet-stream; charset=UTF-8");
+ IOUtils.write(data, response.getOutputStream());
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/projectManagement/controller/RolesController.java b/src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
index 8adcf8d..709c1aa 100644
--- a/src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
+++ b/src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
@@ -5,6 +5,8 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.framework.web.domain.AjaxResult;
+
+import java.time.LocalDateTime;
import com.ruoyi.projectManagement.dto.RoleDto;
import com.ruoyi.projectManagement.mapper.RolesMapper;
import com.ruoyi.projectManagement.pojo.Roles;
@@ -35,7 +37,7 @@
@Operation(summary = "鏂板")
public AjaxResult add(@RequestBody RoleDto roleDto) {
if (roleDto.getIsDefaultNo()) {
- roleDto.setNo(OrderUtils.countTodayByCreateTime(rolesMapper, "XMJS","no"));
+ roleDto.setNo(OrderUtils.countTodayByCreateTime(rolesMapper, "XMJS","no", roleDto.getCreateTime() != null ? roleDto.getCreateTime() : LocalDateTime.now()));
}
return AjaxResult.success(rolesservice.save(roleDto));
}
diff --git a/src/main/java/com/ruoyi/projectManagement/pojo/Roles.java b/src/main/java/com/ruoyi/projectManagement/pojo/Roles.java
index 1b65ea4..ed111b8 100644
--- a/src/main/java/com/ruoyi/projectManagement/pojo/Roles.java
+++ b/src/main/java/com/ruoyi/projectManagement/pojo/Roles.java
@@ -38,7 +38,6 @@
private Integer status;
@Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@Schema(description = "鍒涘缓鐢ㄦ埛")
diff --git a/src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java b/src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java
index e05ce2e..d999843 100644
--- a/src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.basic.utils.FileUtil;
@@ -53,13 +54,13 @@
@Transactional(rollbackFor = Exception.class)
public void savePlan(SavePlanVo savePlanVo) {
Plan plan = BeanUtil.copyProperties(savePlanVo, Plan.class);
- // 闄勪欢澶勭悊
- fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("", RecordTypeEnum.PLAN, savePlanVo.getId(), savePlanVo.getStorageBlobDTOs());
if (savePlanVo.getId() == null) {
planMapper.insert(plan);
} else {
planMapper.updateById(plan);
}
+ // 闄勪欢澶勭悊
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.PLAN, plan.getId(), savePlanVo.getStorageBlobDTOs());
planService.savePlanNode(plan.getId(), savePlanVo.getSavePlanNodeList());
}
diff --git a/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoStageHandleService.java b/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoStageHandleService.java
index 2025777..76c7617 100644
--- a/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoStageHandleService.java
+++ b/src/main/java/com/ruoyi/projectManagement/service/impl/handle/InfoStageHandleService.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.basic.utils.FileUtil;
@@ -48,18 +49,12 @@
@Transactional
public void save(@NotNull SaveInfoStageVo saveInfoStageVo) {
InfoStage infoStage = BeanUtil.copyProperties(saveInfoStageVo, InfoStage.class);
- // 闄勪欢澶勭悊
- String attachmentIds = StrUtil.join(",", Optional.ofNullable(saveInfoStageVo.getAttachmentIds()).orElse(Collections.emptyList()));
- infoStage.setAttachment(attachmentIds);
-
- fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("", RecordTypeEnum.INFO_STAGE, infoStage.getProjectManagementInfoId(), saveInfoStageVo.getStorageBlobDTOs());
-
if (infoStage.getId() == null) {
infoStageMapper.insert(infoStage);
} else {
infoStageMapper.updateById(infoStage);
}
-
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.INFO_STAGE, infoStage.getId(), saveInfoStageVo.getStorageBlobDTOs());
infoStageHandleService.syncInfoStage(infoStage.getProjectManagementInfoId());
}
diff --git a/src/main/java/com/ruoyi/purchase/controller/AccountingReportController.java b/src/main/java/com/ruoyi/purchase/controller/AccountingReportController.java
index 813fb44..798112b 100644
--- a/src/main/java/com/ruoyi/purchase/controller/AccountingReportController.java
+++ b/src/main/java/com/ruoyi/purchase/controller/AccountingReportController.java
@@ -1,26 +1,23 @@
package com.ruoyi.purchase.controller;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.service.ISupplierService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.purchase.dto.InvoicePurchaseReportDto;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.purchase.dto.VatDto;
-import com.ruoyi.purchase.pojo.InvoicePurchase;
-import com.ruoyi.purchase.service.IInvoicePurchaseService;
-import com.ruoyi.waterrecord.pojo.WaterRecord;
-import io.swagger.v3.oas.annotations.tags.Tag;
+import com.ruoyi.purchase.service.PurchaseReportService;
+import com.ruoyi.purchase.vo.PurchaseReportVo;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@@ -29,40 +26,52 @@
@AllArgsConstructor
public class AccountingReportController {
- private IInvoicePurchaseService invoicePurchaseService;
+ private final ISupplierService supplierService;
+ private final PurchaseReportService purchaseReportService;
+
@GetMapping("/list")
@Log(title = "閲囪喘鎶ヨ〃-椤圭洰鍒╂鼎", businessType = BusinessType.OTHER)
- public AjaxResult list(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto) {
- IPage<InvoicePurchaseReportDto> result =invoicePurchaseService.listPurchaseReport(page, invoicePurchaseReportDto);
- return AjaxResult.success(result);
+ public R list(Page page, String customerName) {
+ return R.ok(purchaseReportService.list(page,customerName));
}
@Log(title = "閲囪喘鎶ヨ〃-椤圭洰鍒╂鼎瀵煎嚭", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@Operation(summary = "閲囪喘鎶ヨ〃-椤圭洰鍒╂鼎瀵煎嚭")
- public void export(HttpServletResponse response) {
- Page page = new Page(-1,-1);
- InvoicePurchaseReportDto waterRecord = new InvoicePurchaseReportDto();
- IPage<InvoicePurchaseReportDto> listPage = invoicePurchaseService.listPurchaseReport(page, waterRecord);
- ExcelUtil<InvoicePurchaseReportDto> util = new ExcelUtil<InvoicePurchaseReportDto>(InvoicePurchaseReportDto.class);
- util.exportExcel(response, listPage.getRecords() , "椤圭洰鍒╂鼎瀵煎嚭");
+ public void export(HttpServletResponse response, String customerName) {
+ List<PurchaseReportVo> list = purchaseReportService.list(new Page(1,-1),customerName).getRecords();
+ ExcelUtil<PurchaseReportVo> util = new ExcelUtil<>(PurchaseReportVo.class);
+ util.exportExcel(response, list , "椤圭洰鍒╂鼎");
+
}
@Log(title = "閲囪喘鎶ヨ〃-澧炲�肩◣姣斿", businessType = BusinessType.OTHER)
@GetMapping("/listVat")
- public AjaxResult listVat(Page page,String month) {
- IPage<VatDto> result = invoicePurchaseService.listVat(page, month);
- return AjaxResult.success(result);
+ public R listVat(Page page,String month) {
+ return R.ok(purchaseReportService.listVat(page,month));
}
@Log(title = "閲囪喘鎶ヨ〃-澧炲�肩◣姣斿", businessType = BusinessType.EXPORT)
@PostMapping("/exportTwo")
@Operation(summary = "閲囪喘鎶ヨ〃-澧炲�肩◣姣斿")
- public void exportTwo(HttpServletResponse response) {
- Page page = new Page(-1,-1);
- IPage<VatDto> result = invoicePurchaseService.listVat(page, null);
- ExcelUtil<VatDto> util = new ExcelUtil<VatDto>(VatDto.class);
- util.exportExcel(response, result.getRecords() , "澧炲�肩◣姣斿");
+ public void exportTwo(HttpServletResponse response,String month) {
+ List<VatDto> list = purchaseReportService.listVat(new Page(1,-1),month).getRecords();
+ ExcelUtil<VatDto> util = new ExcelUtil<>(VatDto.class);
+ util.exportExcel(response, list , "澧炲�肩◣姣斿");
+ }
+
+ @GetMapping("/supplierTransactions")
+ @Log(title = "渚涘簲鍟嗗線鏉�", businessType = BusinessType.OTHER)
+ @Operation(summary = "渚涘簲鍟嗗線鏉�")
+ public R supplierTransactions(Page page, String supplierName) {
+ return R.ok(supplierService.supplierTransactions(page,supplierName));
+ }
+
+ @GetMapping("/supplierTransactionsDetails")
+ @Log(title = "渚涘簲鍟嗗線鏉ユ槑缁�", businessType = BusinessType.OTHER)
+ @Operation(summary = "渚涘簲鍟嗗線鏉ユ槑缁�")
+ public R supplierTransactionsDetails(Page page, Long supplierId) {
+ return R.ok(supplierService.supplierTransactionsDetails(page,supplierId));
}
}
diff --git a/src/main/java/com/ruoyi/purchase/controller/InvoicePurchaseController.java b/src/main/java/com/ruoyi/purchase/controller/InvoicePurchaseController.java
deleted file mode 100644
index afd9213..0000000
--- a/src/main/java/com/ruoyi/purchase/controller/InvoicePurchaseController.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.ruoyi.purchase.controller;
-
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.purchase.dto.InvoicePurchaseDto;
-import com.ruoyi.purchase.pojo.InvoicePurchase;
-import com.ruoyi.purchase.service.IInvoicePurchaseService;
-import com.ruoyi.sales.service.ICommonFileService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * 鍙戠エ淇℃伅Controller
- *
- * @author ruoyi
- * @date 2025-05-14
- */
-@RestController
-@AllArgsConstructor
-@RequestMapping("/purchase/invoice")
-public class InvoicePurchaseController extends BaseController {
-
- private IInvoicePurchaseService invoicePurchaseService;
-
- private ICommonFileService commonFileService;
-
- /**
- * 鏌ヨ鍙戠エ淇℃伅鍒楄〃
- */
- @GetMapping("/list")
- public TableDataInfo list(InvoicePurchaseDto invoicePurchaseDto) {
- startPage();
- List<InvoicePurchaseDto> list = invoicePurchaseService.selectInvoicePurchaseList(invoicePurchaseDto);
- return getDataTable(list);
- }
-
- /**
- * 瀵煎嚭鍙戠エ淇℃伅鍒楄〃
- */
- @Log(title = "鍙戠エ淇℃伅", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, InvoicePurchase invoicePurchase) {
- List<InvoicePurchase> list = invoicePurchaseService.selectInvoicePurchaseLists(invoicePurchase);
- ExcelUtil<InvoicePurchase> util = new ExcelUtil<InvoicePurchase>(InvoicePurchase.class);
- util.exportExcel(response, list, "鍙戠エ淇℃伅鏁版嵁");
- }
-
- /**
- * 鏌ヨ鍙戠エ淇℃伅
- */
- @GetMapping("/getInvoiceById")
- public InvoicePurchaseDto getInvoiceById(InvoicePurchaseDto invoicePurchaseDto) {
- return invoicePurchaseService.getInvoiceById(invoicePurchaseDto);
- }
-
- /**
- * 鏂板淇敼鍙戠エ淇℃伅
- */
- @Log(title = "鍙戠エ淇℃伅", businessType = BusinessType.INSERT)
- @PostMapping("/addOrUpdateInvoice")
- public AjaxResult addOrUpdateInvoice(@RequestBody InvoicePurchaseDto invoicePurchaseDto) throws IOException {
- return toAjax(invoicePurchaseService.addOrUpdateInvoice(invoicePurchaseDto));
- }
-
- /**
- * 鍒犻櫎鍙戠エ淇℃伅
- */
- @Log(title = "鍙戠エ淇℃伅", businessType = BusinessType.DELETE)
- @DeleteMapping("/delInvoice")
- public AjaxResult remove(@RequestBody Long[] ids) {
- return toAjax(invoicePurchaseService.delInvoice(ids));
- }
-
-}
diff --git a/src/main/java/com/ruoyi/purchase/controller/PaymentRegistrationController.java b/src/main/java/com/ruoyi/purchase/controller/PaymentRegistrationController.java
deleted file mode 100644
index 289110c..0000000
--- a/src/main/java/com/ruoyi/purchase/controller/PaymentRegistrationController.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package com.ruoyi.purchase.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.purchase.dto.PaymentHistoryRecordVo;
-import com.ruoyi.purchase.dto.PaymentLedgerDto;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import com.ruoyi.purchase.service.IPaymentRegistrationService;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 浠樻鐧昏Controller
- *
- * @author ruoyi
- * @date 2025-05-15
- */
-@RestController
-@RequestMapping("/purchase/paymentRegistration")
-@AllArgsConstructor
-public class PaymentRegistrationController extends BaseController {
- private IPaymentRegistrationService paymentRegistrationService;
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- */
-// @PreAuthorize("@ss.hasPermi('system:registration:list')")
- @GetMapping("/list")
- public TableDataInfo list(PaymentRegistrationDto paymentRegistrationDto) {
- startPage();
- List<PaymentRegistrationDto> list = paymentRegistrationService.selectPaymentRegistrationList(paymentRegistrationDto);
- return getDataTable(list);
- }
-
- /**
- * 瀵煎嚭浠樻娴佹按鍒楄〃
- */
- @Log(title = "瀵煎嚭浠樻娴佹按鍒楄〃", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, PaymentRegistrationDto paymentRegistrationDto)
- {
- Page page = new Page<>(-1,-1);
- IPage<PaymentRegistrationDto> paymentRegistrationDtoIPage = paymentHistoryListPage(page, paymentRegistrationDto);
- ExcelUtil<PaymentRegistrationDto> util = new ExcelUtil<PaymentRegistrationDto>(PaymentRegistrationDto.class);
- util.exportExcel(response, paymentRegistrationDtoIPage.getRecords(), "瀵煎嚭浠樻娴佹按鍒楄〃");
- }
-
- /**
- * 鑾峰彇浠樻鐧昏璇︾粏淇℃伅
- */
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(paymentRegistrationService.selectPaymentRegistrationById(id));
- }
-
- /**
- * 鏂板浠樻鐧昏
- */
- @Log(title = "浠樻鐧昏", businessType = BusinessType.INSERT)
- @PostMapping
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult add(@RequestBody List<PaymentRegistration> paymentRegistration) {
- return toAjax(paymentRegistrationService.insertPaymentRegistration(paymentRegistration));
- }
-
- /**
- * 淇敼浠樻鐧昏
- */
- @Log(title = "浠樻鐧昏", businessType = BusinessType.UPDATE)
- @PutMapping
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult edit(@RequestBody PaymentRegistration paymentRegistration) {
- return toAjax(paymentRegistrationService.updatePaymentRegistration(paymentRegistration));
- }
-
- /**
- * 鍒犻櫎浠樻鐧昏
- */
- @Log(title = "浠樻鐧昏", businessType = BusinessType.DELETE)
- @DeleteMapping("/del")
- public AjaxResult remove(@RequestBody Long[] ids) {
- return toAjax(paymentRegistrationService.deletePaymentRegistrationByIds(ids));
- }
-
- /**
- * 鍒犻櫎浠樻鐧昏
- */
- @Log(title = "浠樻鐧昏", businessType = BusinessType.DELETE)
- @DeleteMapping("/delete")
- public AjaxResult delete(@RequestBody Long[] ids) {
- return toAjax(paymentRegistrationService.delete(ids));
- }
-
- /**
- * 鑾峰彇浠樻鐧昏璇︾粏淇℃伅
- */
- @GetMapping(value = "/byPurchaseId/{id}")
- public AjaxResult getPurchaseInfo(@PathVariable("id") Long id) {
- return success(paymentRegistrationService.selectPaymentRegistrationByPurchaseId(id));
- }
-
- /**
- * 鑾峰彇浠樻鐧昏璇︾粏淇℃伅
- */
- @GetMapping(value = "/paymentLedgerList")
- public AjaxResult paymentLedgerList(PaymentLedgerDto paymentLedgerDto, Page page,
- Integer detailPageNum,
- Integer detailPageSize) {
- IPage<Map<String, Object>> mapIPage = paymentRegistrationService.selectPaymentLedgerList(paymentLedgerDto, page, detailPageNum, detailPageSize);
- return success(mapIPage);
- }
-
- /**
- * 渚涘簲鍟嗗線鏉ュ垎椤垫帴鍙�
- */
- @GetMapping("/supplierNameListPage")
- public AjaxResult supplierNameListPage(PaymentLedgerDto paymentLedgerDto, Page page){
- return success(paymentRegistrationService.supplierNameListPage(page,paymentLedgerDto));
- }
-
- /**
- * 渚涘簲鍟嗗線鏉ュ垎椤垫帴鍙�
- */
- @GetMapping("/supplierNameListPageDetails")
- public AjaxResult supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto){
- return success(paymentRegistrationService.supplierNameListPageDetails(paymentLedgerDto));
- }
-
- /**
- * 鑾峰彇鏈湀搴斾粯淇℃伅
- */
- @GetMapping(value = "/paymentMonthList")
- public AjaxResult paymentMonthList() {
- return success(paymentRegistrationService.paymentMonthList());
- }
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- @GetMapping("/paymentHistoryList")
- public TableDataInfo paymentHistoryList(PaymentRegistrationDto paymentRegistrationDto) {
- startPage();
- List<PaymentRegistrationDto> list = paymentRegistrationService.paymentHistoryList(paymentRegistrationDto);
- return getDataTable(list);
- }
-
- /**
- * 鏌ヨ渚涘簲鍟嗗線鏉ヨ褰�
- * @param supplierId
- * @return
- */
- @GetMapping("/getPaymentRecordList/{supplierId}")
- public AjaxResult getPaymentRecordList(@PathVariable Long supplierId) {
- List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationService.getPaymentRecordList(supplierId);
- return success(paymentRecordList);
- }
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- @GetMapping("/paymentHistoryListPage")
- public IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, PaymentRegistrationDto paymentRegistrationDto) {
- return paymentRegistrationService.paymentHistoryListPage(page,paymentRegistrationDto);
- }
-}
diff --git a/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
index 3290499..3b20e8f 100644
--- a/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
+++ b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
@@ -1,14 +1,13 @@
package com.ruoyi.purchase.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper;
@@ -17,27 +16,24 @@
import com.ruoyi.purchase.pojo.PurchaseLedgerTemplate;
import com.ruoyi.purchase.pojo.SalesLedgerProductTemplate;
import com.ruoyi.purchase.service.IPurchaseLedgerService;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.service.ISalesLedgerProductService;
import com.ruoyi.sales.service.ISalesLedgerService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import jakarta.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.math.BigDecimal;
import java.net.URLEncoder;
+import java.util.Date;
import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
/**
* 閲囪喘鍙拌处Controller
@@ -122,6 +118,16 @@
}
/**
+ * 鏌ヨ閲囪喘閫�璐у彲閫夐噰璐彴璐�
+ */
+ @GetMapping("/returnableList")
+ public TableDataInfo returnableList(PurchaseLedger purchaseLedger) {
+ startPage();
+ List<PurchaseLedger> list = purchaseLedgerService.selectReturnablePurchaseLedgerList(purchaseLedger);
+ return getDataTable(list);
+ }
+
+ /**
* 瀵煎嚭閲囪喘鍙拌处鍒楄〃
*/
@Log(title = "閲囪喘鍙拌处", businessType = BusinessType.EXPORT)
@@ -132,19 +138,6 @@
util.exportExcel(response, list, "銆愯濉啓鍔熻兘鍚嶇О銆戞暟鎹�");
}
- /**
- * 瀵煎嚭鏉ョエ鐧昏鍒楄〃
- */
- @Log(title = "瀵煎嚭鏉ョエ鐧昏鍒楄〃", businessType = BusinessType.EXPORT)
- @PostMapping("/exportOne")
- public void exportOne(HttpServletResponse response, PurchaseLedger purchaseLedger) {
- Page page = new Page();
- page.setCurrent(-1);
- page.setSize(-1);
- IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerService.selectPurchaseLedgerListPage(page, new PurchaseLedgerDto());
- ExcelUtil<PurchaseLedgerDto> util = new ExcelUtil<PurchaseLedgerDto>(PurchaseLedgerDto.class);
- util.exportExcel(response, purchaseLedgerDtoIPage.getRecords(), "瀵煎嚭鏉ョエ鐧昏鍒楄〃");
- }
/**
* 鏂板淇敼閲囪喘鍙拌处
@@ -153,6 +146,13 @@
@PostMapping("/addOrEditPurchase")
public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception {
return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto));
+ }
+
+ @Operation(summary = "鎵归噺鎺ㄨ繘閲囪喘鍙拌处鍒板叆搴�")
+ @Log(title = "鎵归噺鎺ㄨ繘閲囪喘鍙拌处鍒板叆搴�", businessType = BusinessType.OTHER)
+ @PostMapping("/batchInsertPurchaseSteps")
+ public R batchInsertPurchaseSteps(@RequestBody PurchaseLedgerDto purchaseLedgerDto) {
+ return purchaseLedgerService.batchInsertPurchaseSteps(purchaseLedgerDto == null ? null : purchaseLedgerDto.getIds());
}
/**
@@ -219,7 +219,7 @@
*/
@GetMapping("/getProductBySalesNo")
public AjaxResult getProductBySalesNo(Long id) {
- return AjaxResult.success(purchaseLedgerService.getProductBySalesNo(id));
+ return AjaxResult.success();
}
/**
@@ -265,7 +265,7 @@
@Operation(summary = "鐢熸垚閲囪喘搴忓垪鍙�")
@GetMapping("/createPurchaseNo")
@Log(title = "鐢熸垚閲囪喘搴忓垪鍙�", businessType = BusinessType.OTHER)
- public AjaxResult createPurchaseNo() {
- return AjaxResult.success("鐢熸垚鎴愬姛",purchaseLedgerService.getPurchaseNo());
+ public AjaxResult createPurchaseNo(@RequestParam Date entryDate) {
+ return AjaxResult.success("鐢熸垚鎴愬姛",purchaseLedgerService.getPurchaseNo(entryDate));
}
}
diff --git a/src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java b/src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java
index 16449e8..579d62d 100644
--- a/src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java
+++ b/src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java
@@ -1,16 +1,30 @@
package com.ruoyi.purchase.controller;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.pojo.AccountStatementDetails;
+import com.ruoyi.account.service.AccountStatementDetailsService;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
+import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
+import com.ruoyi.stock.pojo.StockOutRecord;
+
+import java.time.LocalDateTime;
import com.ruoyi.purchase.service.PurchaseReturnOrdersService;
+import com.ruoyi.purchase.vo.PurchaseStockInProductVo;
+import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
/**
* <p>
@@ -27,6 +41,8 @@
public class PurchaseReturnOrdersController {
private PurchaseReturnOrdersService purchaseReturnOrdersService;
private PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
+ private AccountStatementDetailsService accountStatementDetailsService;
+ private StockOutRecordMapper stockOutRecordMapper;
@GetMapping("/listPage")
@@ -39,7 +55,7 @@
@PostMapping("/add")
public AjaxResult add(@RequestBody PurchaseReturnOrderDto purchaseReturnOrderDto) throws Exception {
if (purchaseReturnOrderDto.getIsDefaultNo()) {
- purchaseReturnOrderDto.setNo(OrderUtils.countTodayByCreateTime(purchaseReturnOrdersMapper, "CGTL", "no"));
+ purchaseReturnOrderDto.setNo(OrderUtils.countTodayByCreateTime(purchaseReturnOrdersMapper, "CGTL", "no", purchaseReturnOrderDto.getCreateTime() != null ? purchaseReturnOrderDto.getCreateTime() : LocalDateTime.now()));
}
return AjaxResult.success(purchaseReturnOrdersService.add(purchaseReturnOrderDto));
}
@@ -52,9 +68,30 @@
@PostMapping("/deleteById/{id}")
public AjaxResult deleteById(@PathVariable Long id) {
+ //濡傛灉璇ラ噰璐��璐у凡缁忕敓鎴愬璐﹀崟鍒欐棤娉曞垹闄�
+ PurchaseReturnOrders purchaseReturnOrders = purchaseReturnOrdersService.getById(id);
+ List<AccountStatementDetails> accountStatementDetails = accountStatementDetailsService.list(Wrappers.<AccountStatementDetails>lambdaQuery()
+ .eq(AccountStatementDetails::getReceiptNumber, purchaseReturnOrders.getNo()));
+ if (CollectionUtils.isNotEmpty(accountStatementDetails)){
+ throw new ServiceException("璇ラ噰璐��璐у崟宸茬粡鐢熸垚瀵硅处鍗曪紝鏃犳硶鍒犻櫎");
+ }
+ List<StockOutRecord> approvedStockOutRecords = stockOutRecordMapper.selectList(Wrappers.<StockOutRecord>lambdaQuery()
+ .eq(StockOutRecord::getRecordType, "9")
+ .eq(StockOutRecord::getApprovalStatus, 1)
+ .inSql(StockOutRecord::getRecordId, "select id from purchase_return_order_products where purchase_return_order_id = " + id));
+ if (CollectionUtils.isNotEmpty(approvedStockOutRecords)) {
+ throw new ServiceException("璇ラ噰璐��璐у崟瀵瑰簲鍑哄簱宸插鏍搁�氳繃锛屾棤娉曞垹闄�");
+ }
purchaseReturnOrdersService.deleteById(id);
return AjaxResult.success();
}
+ @GetMapping("/getByPurchaseLedgerId")
+ @Operation(summary = "閲囪喘閫�璐�-鏍规嵁閲囪喘璁㈠崟id鏌ヨ閲囪喘璁㈠崟瀵瑰簲鐨勫叆搴撲骇鍝佷俊鎭�")
+ public AjaxResult getByPurchaseLedgerId(Long purchaseLedgerId) {
+ List<PurchaseStockInProductVo> purchaseStockInProductVos = purchaseReturnOrdersService.getByPurchaseLedgerId(purchaseLedgerId);
+ return AjaxResult.success(purchaseStockInProductVos);
+ }
+
}
diff --git a/src/main/java/com/ruoyi/purchase/controller/TicketRegistrationController.java b/src/main/java/com/ruoyi/purchase/controller/TicketRegistrationController.java
deleted file mode 100644
index db628af..0000000
--- a/src/main/java/com/ruoyi/purchase/controller/TicketRegistrationController.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package com.ruoyi.purchase.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
-import com.ruoyi.purchase.dto.ProductRecordDto;
-import com.ruoyi.purchase.dto.TicketRegistrationDto;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import com.ruoyi.purchase.pojo.ProductRecord;
-import com.ruoyi.purchase.pojo.TicketRegistration;
-import com.ruoyi.purchase.service.IPaymentRegistrationService;
-import com.ruoyi.purchase.service.IProductRecordService;
-import com.ruoyi.purchase.service.ITicketRegistrationService;
-import com.ruoyi.purchase.service.impl.PaymentRegistrationServiceImpl;
-import com.ruoyi.sales.service.ICommonFileService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * 鏉ョエ鐧昏Controller
- *
- * @author ruoyi
- * @date 2025-05-13
- */
-@RestController
-@RequestMapping("/purchase/registration")
-@AllArgsConstructor
-@Tag(name = "鏉ョエ鐧昏")
-public class TicketRegistrationController extends BaseController {
-
- private final PaymentRegistrationServiceImpl paymentRegistrationServiceImpl;
- private ITicketRegistrationService ticketRegistrationService;
-
- private ICommonFileService commonFileService;
-
- private IProductRecordService productRecordService;
-
- private IPaymentRegistrationService paymentRegistrationService;
-
- /**
- * 鏌ヨ鏉ョエ鐧昏鍒楄〃
- */
- @GetMapping("/list")
- public TableDataInfo list(TicketRegistration ticketRegistration) {
- startPage();
- List<TicketRegistration> list = ticketRegistrationService.selectTicketRegistrationList(ticketRegistration);
- return getDataTable(list);
- }
-
- @Operation(summary = "鏍规嵁id鏌ヨ浠樻娴佹按淇℃伅")
- @GetMapping("/getById")
- public List<PaymentRegistrationDto> getById( Long id ) {
- return ticketRegistrationService.getPaymentRegistrationDtoById(id);
- }
-
- @Operation(summary = "鏍规嵁id鏌ヨ浠樻娴佹按")
- @GetMapping("/getPaymentRegistrationById")
- public AjaxResult getPaymentRegistrationById(Long id) {
- PaymentRegistration byId = paymentRegistrationService.getById(id);
- return AjaxResult.success(byId);
- }
-
- @Operation(summary = "淇敼浠樻娴佹按")
- @PutMapping("/updatePaymentRegistration")
- @Log(title = "淇敼浠樻娴佹按", businessType = BusinessType.UPDATE)
- public AjaxResult updatePaymentRegistration(@RequestBody PaymentRegistration paymentRegistratio) {
- return AjaxResult.success(paymentRegistrationService.updatePaymentRegistration(paymentRegistratio));
- }
-
- @Operation(summary = "鍒犻櫎浠樻娴佹按")
- @DeleteMapping("/delPaymentRegistration")
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult delPaymentRegistration(@RequestBody List<Long> id) {
- return toAjax(paymentRegistrationService.delPaymentRegistration(id));
- }
-
- /**
- * 瀵煎嚭鏉ョエ鐧昏鍒楄〃
- */
- @Log(title = "鏉ョエ鐧昏", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, TicketRegistration ticketRegistration) {
- List<TicketRegistration> list = ticketRegistrationService.selectTicketRegistrationList(ticketRegistration);
- ExcelUtil<TicketRegistration> util = new ExcelUtil<TicketRegistration>(TicketRegistration.class);
- util.exportExcel(response, list, "鏉ョエ鐧昏鏁版嵁");
- }
-
- /**
- * 浠樻鐧昏瀵煎嚭
- */
- @Log(title = "浠樻鐧昏瀵煎嚭", businessType = BusinessType.EXPORT)
- @PostMapping("/exportOne")
- public void exportOne(HttpServletResponse response, TicketRegistration ticketRegistration) {
- Page page = new Page<>(-1, -1);
- IPage<TicketRegistration> ticketRegistrationIPage = listPage(page, ticketRegistration);
- ExcelUtil<TicketRegistration> util = new ExcelUtil<TicketRegistration>(TicketRegistration.class);
- util.exportExcel(response, ticketRegistrationIPage.getRecords(), "浠樻鐧昏瀵煎嚭");
- }
-
- /**
- * 鏌ヨ鏉ョエ鐧昏鍜屼骇鍝佺埗瀛愬垪琛�
- */
- @GetMapping("/getRegistrationById")
- public TicketRegistrationDto getRegistrationById(TicketRegistrationDto ticketRegistrationDto) {
- return ticketRegistrationService.getRegistrationById(ticketRegistrationDto);
- }
-
- /**
- * 鏂板淇敼鏉ョエ鐧昏
- */
- @Log(title = "鏉ョエ鐧昏", businessType = BusinessType.INSERT)
- @PostMapping("/addOrUpdateRegistration")
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult addOrUpdateRegistration(@RequestBody List<TicketRegistrationDto> ticketRegistrationDto) throws IOException {
- if(CollectionUtils.isEmpty(ticketRegistrationDto)) return AjaxResult.error("璇烽�夋嫨瑕佷繚瀛樼殑璁板綍");
- for (TicketRegistrationDto ticketRegistrationDto1 : ticketRegistrationDto) {
- ticketRegistrationService.addOrUpdateRegistration(ticketRegistrationDto1);
- }
- return toAjax(1);
- }
-
-
- @PostMapping("/getProductRecordById")
- public AjaxResult getProductRecordById(@RequestBody ProductRecordDto productRecordDto) {
- if (productRecordDto.getId() == null) {
- return AjaxResult.error("鍙傛暟閿欒");
- }
- return AjaxResult.success(productRecordService.getProductRecordById(productRecordDto));
- }
-
- @Schema(description = "淇敼鏉ョエ鐧昏")
- @PostMapping("/updateRegistration")
- public AjaxResult updateRegistration(@RequestBody ProductRecordDto productRecordDto) {
-
- return productRecordService.updateRecord(productRecordDto);
- }
-
- /**
- * 鍒犻櫎鏉ョエ鐧昏(鏉ョエ鍙拌处)
- */
- @Log(title = "鍒犻櫎鏉ョエ鐧昏(鏉ョエ鍙拌处)", businessType = BusinessType.DELETE)
- @DeleteMapping("/delRegistration")
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult delRegistration(@RequestBody Long[] ids) {
- return toAjax(ticketRegistrationService.delRegistration(ids));
- }
-
- /**
- * 鏌ヨ浜у搧淇℃伅寮�绁ㄨ褰曞垪琛�
- */
- @GetMapping("/productRecordList")
- public List<ProductRecord> productRecordList(TicketRegistrationDto ticketRegistrationDto) {
- List<ProductRecord> list = productRecordService.selectProductRecordList(ticketRegistrationDto);
- return list;
- }
-
- /**
- * 鍒嗛〉鏌ヨ浜у搧淇℃伅寮�绁ㄨ褰曞垪琛�
- */
- @GetMapping("/productRecordPage")
- public AjaxResult productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto) {
-
- IPage<ProductRecordDto> list = productRecordService.productRecordPage(page,ticketRegistrationDto);
- return AjaxResult.success(list);
- }
-
- /**
- * 鏌ヨ鍙戠エ鍙�
- */
- @GetMapping("/getTicketNo")
- public AjaxResult getTicketNo(TicketRegistrationDto ticketRegistrationDto) {
- return AjaxResult.success(ticketRegistrationService.getTicketNo(ticketRegistrationDto));
- }
-
- /**
- * 鏌ヨ鏉ョエ鐧昏鍒楄〃
- */
- @GetMapping("/listPage")
- public IPage<TicketRegistration> listPage(Page page, TicketRegistration ticketRegistration) {
- return ticketRegistrationService.selectTicketRegistrationListPage(page,ticketRegistration);
- }
-
- @Schema(description = "鏍规嵁id鏌ヨ鏉ユ紓鐧昏")
- @GetMapping("/getPuargeById")
- public AjaxResult getPuargeById(Long id) {
- return AjaxResult.success(ticketRegistrationService.getPuargeById( id));
- }
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseDto.java b/src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseDto.java
deleted file mode 100644
index c8a8671..0000000
--- a/src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseDto.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.ruoyi.purchase.dto;
-
-import com.ruoyi.sales.pojo.CommonFile;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.util.List;
-
-@Data
-public class InvoicePurchaseDto {
-
- private Long id;
-
- /**
- * 閲囪喘鍙拌处id
- */
- private Long purchaseLedgerId;
-
- /**
- * 閲囪喘鍚堝悓鍙�
- */
- private String purchaseContractNo;
-
- /**
- * 鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�
- */
- private Long salesLedgerId;
-
- /**
- * 閿�鍞悎鍚屽彿
- */
- private String salesContractNo;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- private String supplierName;
-
- /**
- * 鍙戠エ鍙�
- */
- private String invoiceNumber;
-
- /**
- * 鍙戠エ閲戦锛堝厓锛�
- */
- private BigDecimal invoiceAmount;
-
- /**
- * 绋庣巼
- */
- private BigDecimal taxRate;
-
- /**
- * 寮�绁ㄤ汉ID
- */
- private Long issUerId;
-
- /**
- * 寮�绁ㄤ汉
- */
- private String issUer;
-
- /**
- * 寮�绁ㄦ棩鏈�
- */
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate issueDate;
-
- private List<String> tempFileIds;
- private List<CommonFile> CommonFiles;
-
- private String fileName;
-}
diff --git a/src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseReportDto.java b/src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseReportDto.java
deleted file mode 100644
index 45347ad..0000000
--- a/src/main/java/com/ruoyi/purchase/dto/InvoicePurchaseReportDto.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.ruoyi.purchase.dto;
-
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import lombok.Data;
-
-/**
- * 鎶ヨ〃鍒嗘瀽---椤圭洰鍒╂鼎
- */
-@Data
-public class InvoicePurchaseReportDto {
-
- //閿�鍞悎鍚屽彿
- @Excel(name = "閿�鍞悎鍚屽彿")
- private String customerContractNo;
-// 瀹㈡埛鍚嶇О
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-// 椤圭洰鍚嶇О
- @Excel(name = "椤圭洰鍚嶇О")
- private String projectName;
-// 鍚堝悓閲戦
- @Excel(name = "鍚堝悓閲戦")
- private String contractAmount;
-// 閲囪喘閲戦
- @Excel(name = "閲囪喘閲戦")
- private String purchaseAmount;
-
- private String saleTaxExclusiveTotalPrice;
-
- private String taxExclusiveTotalPrice;
-// 鍒╂鼎
- @Excel(name = "鍒╂鼎")
- private String balance;
- // 鍒╂鼎鐜�
- @Excel(name = "鍒╂鼎鐜�")
- private String balanceRatio;
- // 澧炲�肩◣
- @Excel(name = "澧炲�肩◣")
- private String balanceAmount;
-
-}
diff --git a/src/main/java/com/ruoyi/purchase/dto/PaymentRegistrationDto.java b/src/main/java/com/ruoyi/purchase/dto/PaymentRegistrationDto.java
deleted file mode 100644
index 8d56648..0000000
--- a/src/main/java/com/ruoyi/purchase/dto/PaymentRegistrationDto.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.ruoyi.purchase.dto;
-
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-@Data
-public class PaymentRegistrationDto extends PaymentRegistration {
-
- // 鏌ヨ鍒楄〃鏌ヨ鐢ㄤ緵搴斿晢鍙峰拰鍚堝悓鍙�
- private String supplierNameOrContractNo;
-
- // 閿�鍞悎鍚屽彿
- private String salesContractNo;
-
- // 閲囪喘鍚堝悓鍙�
- @Excel(name = "閲囪喘鍚堝悓鍙�")
- private String purchaseContractNumber;
-
- // 渚涘簲鍟嗗悕绉�
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
- // 鍙戠エ鍙�
- private String invoiceNumber;
-
- // 鍙戠エ閲戦
- private BigDecimal invoiceAmount;
-
- // 寰呬粯娆鹃噾棰�
- private BigDecimal unPaymentAmount;
-
- // 浠樻閲戦
- private BigDecimal paymentAmount;
-
- // 搴斾粯閲戦
- private BigDecimal payableAmount;
-
- // 绋庣巼
- private String taxRate;
-
- // 鐧昏浜�
- private String registrant;
-
- private String searchText;
-
- // 宸蹭粯娆炬�婚噾棰�
- private BigDecimal paymentAmountTotal;
-
- private String paymentDateStart;
-
- private String paymentDateEnd;
-}
diff --git a/src/main/java/com/ruoyi/purchase/dto/ProductRecordDto.java b/src/main/java/com/ruoyi/purchase/dto/ProductRecordDto.java
deleted file mode 100644
index 1b3c691..0000000
--- a/src/main/java/com/ruoyi/purchase/dto/ProductRecordDto.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.ruoyi.purchase.dto;
-
-import com.ruoyi.other.pojo.TempFile;
-import com.ruoyi.purchase.pojo.ProductRecord;
-import com.ruoyi.sales.pojo.CommonFile;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-@Data
-public class ProductRecordDto extends ProductRecord {
-
- private Long ticketRegistrationId;
-
- //閿�鍞悎鍚屽彿
- private String salesContractNo;
- //瀹㈡埛鍚堝悓鍙�
- private String customerContarctNo;
-
- //瀹㈡埛鍚嶇О
- private String customerName;
- //浜у搧鍚嶇О
- private String productModel;
- //閲囪喘鍚堝悓鍙�
- private String purchaseContractNumber;
- //渚涘簲鍟嗗悕绉�
- private String supplierName;
- private String projectName;
- private Long issUerId;
- private String issUer;
- /**
- * 鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�
- */
- private BigDecimal contractAmount = BigDecimal.ZERO;
- //澧炲�肩◣
- /**
- * 宸叉潵绁ㄩ噾棰濓紙鍙戠エ閲戦锛�
- */
- private BigDecimal invoiceTotal = BigDecimal.ZERO;
- private BigDecimal invoiceAmount = BigDecimal.ZERO;
- /**
- * 鍙戠エ鍙�
- */
- private String invoiceNumber;
- private BigDecimal unTicketsPrice = BigDecimal.ZERO;
-
- private List<CommonFile> commonFiles;
-
- private List<String> tempFileIds;
-}
diff --git a/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
index 455dc9b..ee089a5 100644
--- a/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
+++ b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerDto.java
@@ -27,8 +27,15 @@
private String entryDateStart;
private String entryDateEnd;
+ @Schema(description = "鍏ュ簱鐘舵��")
+ private String stockInStatus;
private Long id;
+
+ /**
+ * 瀹℃壒瀹炰緥ID
+ */
+ private Long approvalInstanceId;
/**
* 閲囪喘鍚堝悓鍙�
@@ -86,7 +93,7 @@
/**
* 褰曞叆鏃ユ湡
*/
- @JsonFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "褰曞叆鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private Date entryDate;
@@ -131,6 +138,9 @@
private List<SalesLedgerProduct> productData;
+ @Schema(description = "鎵归噺澶勭悊閲囪喘鍙拌处ID鍒楄〃")
+ private List<Long> ids;
+
private List<String> tempFileIds;
private List<CommonFile> SalesLedgerFiles;
@@ -165,26 +175,17 @@
private BigDecimal invoiceAmount;
/**
- * 鏉ョエ鐧昏id
- */
- private Long ticketRegistrationId;
-
- /**
* 鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�
*/
@Excel(name = "鍚堝悓閲戦")
private BigDecimal contractAmount = BigDecimal.ZERO;
+ /**
+ * 瀹為檯鍚堝悓閲戦锛堟墸鍑忛��璐у悗锛�
+ */
+ @Schema(description = "瀹為檯鍚堝悓閲戦")
+ private BigDecimal netContractAmount = BigDecimal.ZERO;
- @TableField(exist = false)
- @Schema(description = "鏉ョエ閲戦")
- @Excel(name = "宸叉潵绁ㄩ噾棰�(鍏�)")
- private BigDecimal receiptPaymentAmount = BigDecimal.ZERO;
-
- @Schema(description = "鏈潵绁ㄩ噾棰�")
- @TableField(exist = false)
- @Excel(name = "鏈潵绁ㄩ噾棰�(鍏�)")
- private BigDecimal unReceiptPaymentAmount =BigDecimal.ZERO;
@Schema(description = "鏂囦欢绫诲瀷 鍙� 4")
@TableField(exist = false)
diff --git a/src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderHasAllInfoDto.java b/src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderHasAllInfoDto.java
new file mode 100644
index 0000000..67c98dd
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderHasAllInfoDto.java
@@ -0,0 +1,30 @@
+package com.ruoyi.purchase.dto;
+
+import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PurchaseReturnOrderHasAllInfoDto extends PurchaseReturnOrders {
+ //渚涘簲鍟嗗悕绉�
+ private String supplierName;
+
+ // 閲囪喘鍚堝悓鍙�
+ private String purchaseContractNumber;
+
+ private String shippingTypeText;
+
+ /**
+ * 瀵瑰簲鍑哄簱鏄惁宸插鏍搁�氳繃
+ */
+ private Boolean stockOutApproved;
+
+ //閫�鏂欎汉濮撳悕
+ private String returnUserName;
+
+ //鍒跺崟浜哄鍚�
+ private String createUserName;
+}
diff --git a/src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderProductsDto.java b/src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderProductsDto.java
index c89c151..928d8bf 100644
--- a/src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderProductsDto.java
+++ b/src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderProductsDto.java
@@ -9,5 +9,7 @@
private String productName;
private String model;
private String unit;
+ //鎵规鍙�
+ private String batchNo;
}
diff --git a/src/main/java/com/ruoyi/purchase/dto/SimpleReturnOrderGroupDto.java b/src/main/java/com/ruoyi/purchase/dto/SimpleReturnOrderGroupDto.java
index dc9220a..e66382e 100644
--- a/src/main/java/com/ruoyi/purchase/dto/SimpleReturnOrderGroupDto.java
+++ b/src/main/java/com/ruoyi/purchase/dto/SimpleReturnOrderGroupDto.java
@@ -16,6 +16,6 @@
@AllArgsConstructor
@NoArgsConstructor
public class SimpleReturnOrderGroupDto implements Serializable {
- private Long salesLedgerProductId;
+ private Long productModelId;
private BigDecimal sumReturnQuantity;
}
diff --git a/src/main/java/com/ruoyi/purchase/dto/TicketRegistrationDto.java b/src/main/java/com/ruoyi/purchase/dto/TicketRegistrationDto.java
deleted file mode 100644
index 59f1da3..0000000
--- a/src/main/java/com/ruoyi/purchase/dto/TicketRegistrationDto.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.ruoyi.purchase.dto;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import com.ruoyi.purchase.pojo.TicketRegistration;
-import com.ruoyi.sales.pojo.CommonFile;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDate;
-import java.util.List;
-
-/**
- * 鏉ョエ鐧昏琛�
- */
-
-@Data
-@TableName("ticket_registration")
-public class TicketRegistrationDto extends TicketRegistration {
-
- /**
- * 涓婚敭ID
- */
- private Long id;
-
- /**
- * 閲囪喘鍙拌处id
- */
- private Long purchaseLedgerId;
-
- /**
- * 閲囪喘鍚堝悓鍙�
- */
- private String purchaseContractNumber;
-
- /**
- * 閿�鍞悎鍚屽彿
- */
- private String salesContractNo;
-
- /**
- * 寮�绁ㄦ棩鏈�
- */
-
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate entryDate;
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- private String customerName;
-
- /**
- * 涓氬姟鍛�
- */
- private String businessPerson;
-
-
-
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @TableField(exist = false)
- private LocalDate enterDate;
-
- /**
- * 涓氬姟鍛榠d
- */
- private Long businessPersonId;
-
- /**
- * 椤圭洰鍚嶇О
- */
- private String projectName;
-
- private List<SalesLedgerProduct> productData;
-
- private Long salesContractNoId;
- private String supplierName;
-
- private List<String> tempFileIds;
- private List<CommonFile> CommonFiles;
-
- private String fileName;
-
- @TableField(exist = false)
- private String createdAtStart;
- @TableField(exist = false)
- private String createdAtEnd;
-}
diff --git a/src/main/java/com/ruoyi/purchase/dto/VatDto.java b/src/main/java/com/ruoyi/purchase/dto/VatDto.java
index c70ebeb..3564183 100644
--- a/src/main/java/com/ruoyi/purchase/dto/VatDto.java
+++ b/src/main/java/com/ruoyi/purchase/dto/VatDto.java
@@ -1,27 +1,30 @@
package com.ruoyi.purchase.dto;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
-import java.time.LocalDate;
-
@Data
+@Schema(name = "VatDto", description = "绠$悊椹鹃┒鑸�--澧炲�肩◣姣斿鍙傛暟")
+@ExcelIgnoreUnannotated
public class VatDto {
- //鏈堜唤
@Excel(name = "鏈堜唤")
+ @Schema(description = "鏈堜唤")
private String month ;
- //杩涢」绋�
- @Excel(name = "杩涢」绋庨")
+ @Excel(name = "閿�椤圭◣棰�")
+ @Schema(description = "閿�椤圭◣棰�")
private BigDecimal jTaxAmount;
- //閿�椤圭◣
- @Excel(name = "閿�椤圭◣棰�")
+ @Excel(name = "杩涢」绋庨")
+ @Schema(description = "杩涢」绋庨")
private BigDecimal xTaxAmount;
@Excel(name = "閿�-杩�")
+ @Schema(description = "閿�-杩�")
private BigDecimal taxAmount;
}
diff --git a/src/main/java/com/ruoyi/purchase/mapper/InvoicePurchaseMapper.java b/src/main/java/com/ruoyi/purchase/mapper/InvoicePurchaseMapper.java
deleted file mode 100644
index b1dc03c..0000000
--- a/src/main/java/com/ruoyi/purchase/mapper/InvoicePurchaseMapper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ruoyi.purchase.mapper;
-
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.purchase.dto.InvoicePurchaseReportDto;
-import com.ruoyi.purchase.dto.VatDto;
-import com.ruoyi.purchase.pojo.InvoicePurchase;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 鍙戠エ淇℃伅Mapper鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-14
- */
-public interface InvoicePurchaseMapper extends BaseMapper<InvoicePurchase> {
-
-
- IPage<InvoicePurchaseReportDto> selectPurchaseReport(IPage page, @Param("c") InvoicePurchaseReportDto invoicePurchaseReportDto);
-
- IPage<VatDto> listVat(Page page,@Param("month") String month);
-
- List<VatDto> listVat1();
-}
diff --git a/src/main/java/com/ruoyi/purchase/mapper/PaymentRegistrationMapper.java b/src/main/java/com/ruoyi/purchase/mapper/PaymentRegistrationMapper.java
deleted file mode 100644
index 196d531..0000000
--- a/src/main/java/com/ruoyi/purchase/mapper/PaymentRegistrationMapper.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.ruoyi.purchase.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.purchase.dto.PaymentHistoryRecordVo;
-import com.ruoyi.purchase.dto.PaymentLedgerDto;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 浠樻鐧昏Mapper鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-15
- */
-public interface PaymentRegistrationMapper extends BaseMapper<PaymentRegistration> {
- /**
- * 鏌ヨ浠樻鐧昏
- *
- * @param id 浠樻鐧昏涓婚敭
- * @return 浠樻鐧昏
- */
- public PaymentRegistrationDto selectPaymentRegistrationById(@Param("id") Long id);
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- public List<PaymentRegistrationDto> selectPaymentRegistrationList(PaymentRegistrationDto paymentRegistrationDto);
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- public List<PaymentRegistrationDto> paymentHistoryList(@Param("params") PaymentRegistrationDto paymentRegistrationDto);
-
- /**
- * 璁$畻姣忓紶鍙戠エ鐨勫凡寮�绁ㄩ噾棰�
- * @param ticketRegistrationIds
- * @return
- */
- public List<PaymentRegistrationDto> countPaymentTotalByTicketRegId(List<Long> ticketRegistrationIds);
-
- /**
- * 鏌ヨ渚涘簲鍟嗗線鏉ヨ褰�
- * @param supplierId
- * @return
- */
- List<PaymentHistoryRecordVo> getPaymentRecordList(Long supplierId);
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, @Param("params") PaymentRegistrationDto paymentRegistrationDto);
-
- IPage<PaymentRegistrationDto> supplierNameListPage(Page page,@Param("req") PaymentLedgerDto paymentLedgerDto);
-
- List<PaymentRegistrationDto> supplierNameListPageDetails(@Param("req") PaymentLedgerDto paymentLedgerDto);
-}
diff --git a/src/main/java/com/ruoyi/purchase/mapper/ProductRecordMapper.java b/src/main/java/com/ruoyi/purchase/mapper/ProductRecordMapper.java
deleted file mode 100644
index b4bdea9..0000000
--- a/src/main/java/com/ruoyi/purchase/mapper/ProductRecordMapper.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.ruoyi.purchase.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.purchase.dto.ProductRecordDto;
-import com.ruoyi.purchase.dto.TicketRegistrationDto;
-import com.ruoyi.purchase.pojo.ProductRecord;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 閲囪喘鍙拌处浜у搧寮�绁ㄨ褰昅apper鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-23
- */
-public interface ProductRecordMapper extends BaseMapper<ProductRecord> {
-
- IPage<ProductRecordDto> productRecordPage(Page page, @Param("c") TicketRegistrationDto ticketRegistrationDto);
-
- List<ProductRecordDto> getProductRecordById(@Param("c") ProductRecordDto productRecordDto);
-}
diff --git a/src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerMapper.java b/src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerMapper.java
index c3201e0..feba849 100644
--- a/src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerMapper.java
+++ b/src/main/java/com/ruoyi/purchase/mapper/PurchaseLedgerMapper.java
@@ -3,7 +3,6 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import org.apache.ibatis.annotations.Param;
@@ -24,7 +23,7 @@
IPage<PurchaseLedgerDto> selectPurchaseLedgerListPage(IPage ipage, @Param("c") PurchaseLedgerDto purchaseLedger);
- List<PaymentRegistrationDto> getPaymentRegistrationDtoById(Long id);
+ List<PurchaseLedger> selectReturnablePurchaseLedgerList(@Param("c") PurchaseLedger purchaseLedger);
List<IncomeExpenseAnalysisDto> selectPurchaseStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat);
diff --git a/src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.java b/src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.java
index a680c12..4eb517f 100644
--- a/src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.java
+++ b/src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.java
@@ -1,13 +1,20 @@
package com.ruoyi.purchase.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.PurchaseReturnDto;
+import com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo;
import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
+import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ruoyi.purchase.vo.PurchaseReturnOrderVo;
+import com.ruoyi.purchase.vo.PurchaseReturnOrderProductsDetailVo;
+import com.ruoyi.purchase.vo.PurchaseStockInProductVo;
+import jakarta.validation.constraints.NotNull;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* <p>
@@ -19,5 +26,14 @@
*/
@Mapper
public interface PurchaseReturnOrdersMapper extends BaseMapper<PurchaseReturnOrders> {
- IPage<PurchaseReturnOrderVo> listPage(Page page, @Param("params") PurchaseReturnOrderDto purchaseReturnOrder);
+ IPage<PurchaseReturnOrderHasAllInfoDto> listPage(Page page, @Param("params") PurchaseReturnOrderDto purchaseReturnOrder);
+
+ PurchaseReturnOrderHasAllInfoDto getPurchaseReturnOrderHasAllInfoById(@Param("id") @NotNull Long id);
+
+ IPage<PurchaseReturnVo> listPageAccountPurchaseReturn(Page page, @Param("req") PurchaseReturnDto purchaseReturnDto);
+
+ //鏍规嵁閲囪喘璁㈠崟id鏌ヨ閲囪喘璁㈠崟瀵瑰簲鐨勫叆搴撲骇鍝佷俊鎭�
+ List<PurchaseStockInProductVo> getByPurchaseLedgerId(@Param("purchaseLedgerId") Long purchaseLedgerId);
+
+ List<PurchaseReturnOrderProductsDetailVo> getPurchaseReturnOrderProductsDetailById(@Param("id") Long id);
}
diff --git a/src/main/java/com/ruoyi/purchase/mapper/TicketRegistrationMapper.java b/src/main/java/com/ruoyi/purchase/mapper/TicketRegistrationMapper.java
deleted file mode 100644
index 39633c1..0000000
--- a/src/main/java/com/ruoyi/purchase/mapper/TicketRegistrationMapper.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ruoyi.purchase.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ruoyi.purchase.pojo.TicketRegistration;
-
-/**
- * 鏉ョエ鐧昏Mapper鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-13
- */
-public interface TicketRegistrationMapper extends BaseMapper<TicketRegistration> {
-}
diff --git a/src/main/java/com/ruoyi/purchase/pojo/InvoicePurchase.java b/src/main/java/com/ruoyi/purchase/pojo/InvoicePurchase.java
deleted file mode 100644
index 0d9eb46..0000000
--- a/src/main/java/com/ruoyi/purchase/pojo/InvoicePurchase.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.ruoyi.purchase.pojo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.util.Date;
-
-/**
- * 鍙戠エ淇℃伅瀵硅薄 invoice_purchase
- *
- * @author ruoyi
- * @date 2025-05-14
- */
-@TableName("invoice_purchase")
-@Data
-public class InvoicePurchase {
- private static final long serialVersionUID = 1L;
-
- /**
- * 涓婚敭ID
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 閲囪喘鍙拌处id
- */
- private Long purchaseLedgerId;
-
- /**
- * 閲囪喘鍚堝悓鍙�
- */
- @Excel(name = "閲囪喘鍚堝悓鍙�")
- private String purchaseContractNo;
-
- /**
- * 鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�
- */
- private Long salesLedgerId;
-
- /**
- * 閿�鍞悎鍚屽彿
- */
- @Excel(name = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
- /**
- * 鍙戠エ鍙�
- */
- @Excel(name = "鍙戠エ鍙�")
- private String invoiceNumber;
-
- /**
- * 鍙戠エ閲戦锛堝厓锛�
- */
- @Excel(name = "鍙戠エ閲戦(鍏�)")
- private BigDecimal invoiceAmount;
-
- /**
- * 绋庣巼
- */
- @Excel(name = "绋庣巼(%)")
- private BigDecimal taxRate;
-
- /**
- * 寮�绁ㄤ汉ID
- */
- private Long issUerId;
-
- /**
- * 寮�绁ㄤ汉
- */
- @Excel(name = "寮�绁ㄤ汉")
- private String issUer;
-
- /**
- * 寮�绁ㄦ棩鏈�
- */
- @JsonFormat(pattern = "yyyy-MM-dd" ,timezone = "GMT+8")
- @Excel(name = "寮�绁ㄦ棩鏈�", width = 30, dateFormat = "yyyy-MM-dd")
- private LocalDate issueDate;
-
- /**
- * 鍙戠エ鏂囦欢锛圥DF鏍煎紡锛�
- */
- private String invoiceFile;
-
- /**
- * 鍒涘缓鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- private Date createdAt;
-
- /**
- * 鏇存柊鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- private Date updatedAt;
-
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
-}
diff --git a/src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java b/src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java
deleted file mode 100644
index a84cf04..0000000
--- a/src/main/java/com/ruoyi/purchase/pojo/PaymentRegistration.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package com.ruoyi.purchase.pojo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * 浠樻鐧昏瀵硅薄 payment_registration
- *
- * @author ruoyi
- * @date 2025-05-15
- */
-
-@Data
-@TableName("payment_registration")
-public class PaymentRegistration {
- private static final long serialVersionUID = 1L;
-
- /**
- * id
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 閿�鍞彴璐d
- */
- private Long saleLedgerId;
-
- /**
- * 閲囪喘鍙拌处id
- */
- private Long purchaseLedgerId;
-
- /**
- * 閲囪喘璁㈠崟浜у搧id
- */
- private Long salesLedgerProductId;
-
- /**
- * 渚涘簲鍟唅d
- */
- private Long supplierId;
-
- /**
- * 鍙戠エid
- */
- private Long ticketRegistrationId;
-
- /**
- * 鏈浠樻閲戦
- */
- @Excel(name = "浠樻閲戦")
- private BigDecimal currentPaymentAmount;
-
- /**
- * 浠樻褰㈠紡
- */
- @Excel(name = "浠樻褰㈠紡")
- private String paymentMethod;
-
- /**
- * 绋庣巼
- */
- private String taxRate;
-
- /**
- * 鐧昏浜�
- */
- private Long registrantId;
-
- // 绉熸埛id
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- /**
- * 浠樻鏃ユ湡
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "浠樻鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
- private Date paymentDate;
-
- /**
- * 鐧昏鏃ユ湡
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鐧昏鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
- private Date registrationtDate;
-
- /**
- * 鍒涘缓鏃ユ湡
- */
- @TableField(fill = FieldFill.INSERT)
- private Date createTime;
-
- /**
- * 淇敼鏃ユ湡
- */
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Date updateTime;
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
-}
diff --git a/src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java b/src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java
deleted file mode 100644
index fdd7503..0000000
--- a/src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.ruoyi.purchase.pojo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * 閲囪喘鍙拌处浜у搧寮�绁ㄨ褰曞璞� product_record
- *
- * @author ruoyi
- * @date 2025-05-23
- */
-@Data
-@TableName("product_record")
-public class ProductRecord {
- private static final long serialVersionUID = 1L;
-
- /**
- * 涓婚敭id
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鏉ョエ鐧昏id
- */
- private Long ticketRegistrationId;
-
- /**
- * 閲囪喘鍙拌处id
- */
- private Long purchaseLedgerId;
-
- /**
- * 浜у搧id
- */
- private Long saleLedgerProjectId;
-
- /**
- * 浜у搧澶х被
- */
- private String productCategory;
-
- /**
- * 瑙勬牸鍨嬪彿
- */
- private String specificationModel;
-
- /**
- * 鍗曚綅
- */
- private String unit;
-
- /**
- * 鏁伴噺
- */
- private BigDecimal quantity;
-
- /**
- * 绋庣巼
- */
- private BigDecimal taxRate;
-
- /**
- * 鍚◣鍗曚环
- */
- private BigDecimal taxInclusiveUnitPrice;
-
- /**
- * 鍚◣鎬讳环
- */
- private BigDecimal taxInclusiveTotalPrice;
-
- /**
- * 涓嶅惈绋庢�讳环
- */
- private BigDecimal taxExclusiveTotalPrice;
-
- /**
- * 鍙戠エ绫诲瀷
- */
- private String invoiceType;
-
- /**
- * 1.閿�鍞彴璐︼紝2.閲囪喘鍙拌处
- */
- private String type;
-
- /**
- * 鏈鏉ョエ鏁�
- */
- private BigDecimal ticketsNum;
-
- /**
- * 鏈鏉ョエ閲戦(鍏�)
- */
- private BigDecimal ticketsAmount;
-
- /**
- * 鏈潵绁ㄦ暟
- */
- private BigDecimal futureTickets = BigDecimal.ZERO;
-
- /**
- * 鏈潵绁ㄩ噾棰�(鍏�)
- */
- private BigDecimal futureTicketsAmount = BigDecimal.ZERO;
-
- /**
- * 浜у搧id
- */
- private Long productId;
-
- /**
- * 鍨嬪彿id
- */
- private Long productModelId;
-
- /**
- * 鍒涘缓鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- private Date createdAt;
-
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
-}
diff --git a/src/main/java/com/ruoyi/purchase/pojo/PurchaseLedger.java b/src/main/java/com/ruoyi/purchase/pojo/PurchaseLedger.java
index d937bad..ec96643 100644
--- a/src/main/java/com/ruoyi/purchase/pojo/PurchaseLedger.java
+++ b/src/main/java/com/ruoyi/purchase/pojo/PurchaseLedger.java
@@ -69,7 +69,7 @@
/**
* 褰曞叆鏃ユ湡
*/
- @JsonFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "褰曞叆鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private Date entryDate;
@@ -119,6 +119,12 @@
* 鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�
*/
private BigDecimal contractAmount;
+
+ /**
+ * 瀹為檯鍚堝悓閲戦锛堟墸鍑忛��璐у悗锛�
+ */
+ @Schema(description = "瀹為檯鍚堝悓閲戦")
+ private BigDecimal netContractAmount;
//
// /**
// * 涓氬姟鍛�
@@ -135,14 +141,6 @@
* 涓氬姟鍛樻墜鏈哄彿
*/
private String phoneNumber;
-
- @TableField(exist = false)
- @Schema(description = "鏉ョエ閲戦")
- private String receiptPaymentAmount;
-
- @Schema(description = "鏈潵绁ㄩ噾棰�")
- @TableField(exist = false)
- private String unReceiptPaymentAmount;
@Schema(description = "鏂囦欢绫诲瀷 鍙� 4")
@TableField(exist = false)
@@ -165,5 +163,4 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
-
}
diff --git a/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrderProducts.java b/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrderProducts.java
index 2a1b172..7738a34 100644
--- a/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrderProducts.java
+++ b/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrderProducts.java
@@ -1,20 +1,17 @@
package com.ruoyi.purchase.pojo;
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
/**
* <p>
- *
+ *
* </p>
*
* @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
@@ -34,7 +31,7 @@
@Schema(description = "閫�璐у崟id")
private Long purchaseReturnOrderId;
- @Schema(description = "閲囪喘浜у搧id")
+ @Schema(description = "閿�鍞彴璐︿骇鍝乮d")
private Long salesLedgerProductId;
@Schema(description = "閫�璐ф暟閲�")
@@ -54,4 +51,7 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+ @Schema(description = "鍏宠仈鍏ュ簱鍗昳d")
+ private Long stockInRecordId;
+
}
diff --git a/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java b/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java
index a89317b..abe0b8a 100644
--- a/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java
+++ b/src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java
@@ -44,6 +44,18 @@
@Schema(description = "渚涘簲鍟唅d")
private Long supplierId;
+ @Schema(description = "鍙戣揣绫诲瀷 1璐ц溅 2蹇��")
+ private Integer shippingType;
+
+ @Schema(description = "鍙戣揣杞︾墝鍙�")
+ private String truckPlateNo;
+
+ @Schema(description = "蹇�掑叕鍙�")
+ private String expressCompany;
+
+ @Schema(description = "蹇�掑崟鍙�")
+ private String expressNo;
+
@Schema(description = "椤圭洰id")
private Long projectId;
@@ -82,7 +94,6 @@
private BigDecimal totalAmount;
@Schema(description = "褰曞叆鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
diff --git a/src/main/java/com/ruoyi/purchase/pojo/SalesLedgerProductTemplate.java b/src/main/java/com/ruoyi/purchase/pojo/SalesLedgerProductTemplate.java
index 3f1690c..793fba6 100644
--- a/src/main/java/com/ruoyi/purchase/pojo/SalesLedgerProductTemplate.java
+++ b/src/main/java/com/ruoyi/purchase/pojo/SalesLedgerProductTemplate.java
@@ -69,10 +69,10 @@
private Integer type;
@Schema(description = "浜у搧id")
- private Integer productId;
+ private Long productId;
@Schema(description = "鍨嬪彿id")
- private Integer productModelId;
+ private Long productModelId;
private String register;
diff --git a/src/main/java/com/ruoyi/purchase/pojo/TicketRegistration.java b/src/main/java/com/ruoyi/purchase/pojo/TicketRegistration.java
deleted file mode 100644
index 0dcf7c6..0000000
--- a/src/main/java/com/ruoyi/purchase/pojo/TicketRegistration.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package com.ruoyi.purchase.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.util.Date;
-
-/**
- * 鏉ョエ鐧昏瀵硅薄 ticket_registration
- *
- * @author ruoyi
- * @date 2025-05-13
- */
-@Data
-@TableName("ticket_registration")
-public class TicketRegistration{
- private static final long serialVersionUID = 1L;
-
- /**
- * 涓婚敭ID
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 鐘舵��
- */
- @Excel(name = "鐘舵��")
- @TableField(exist = false)
- private String statusName;
-
- /**
- * 閲囪喘鍙拌处id
- */
- private Long purchaseLedgerId;
-
- /**
- * 閲囪喘鍚堝悓鍙�
- */
- @Excel(name = "閲囪喘鍚堝悓鍙�")
- private String purchaseContractNumber;
-
- /**
- * 閿�鍞悎鍚屽彿
- */
- @Excel(name = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- /**
- * 渚涘簲鍟嗗悕绉�
- */
- @Excel(name = "渚涘簲鍟嗗悕绉�")
- private String supplierName;
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- private String customerName;
-
-// /**
-// * 涓氬姟鍛�
-// */
-// @Excel(name = "涓氬姟鍛�")
-// private String businessPerson;
-//
-// /**
-// * 涓氬姟鍛榠d
-// */
-// private Long businessPersonId;
-
- /**
- * 鍙戠エ鍙�
- */
- @Excel(name = "鍙戠エ鍙�")
- private String invoiceNumber;
-
- /**
- * 鍙戠エ閲戦锛堝厓锛�
- */
- @Excel(name = "鍙戠エ閲戦(鍏�)")
- private BigDecimal invoiceAmount;
-
- /**
- * 寮�绁ㄤ汉ID
- */
- @Excel(name = "寮�绁ㄤ汉")
- private String issUerId;
-
- /**
- * 寮�绁ㄤ汉
- */
- @Excel(name = "寮�绁ㄤ汉")
- private String issUer;
-
- /**
- * 寮�绁ㄦ棩鏈�
- */
- @JsonFormat(pattern = "yyyy-MM-dd" ,timezone = "GMT+8")
- @Excel(name = "寮�绁ㄦ棩鏈�", width = 30, dateFormat = "yyyy-MM-dd")
- private LocalDate issueDate;
-
- /**
- * 椤圭洰鍚嶇О
- */
- @Excel(name = "椤圭洰鍚嶇О")
- private String projectName;
-
- /**
- * 浜у搧淇℃伅
- */
- private Long productId;
-
- /**
- * 鍒涘缓鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- private Date createdAt;
-
- /**
- * 鏇存柊鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- private Date updatedAt;
-
- /**
- * 鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�
- */
- private Long salesLedgerId;
-
- /**
- * 鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�
- */
- private BigDecimal contractAmount;
-
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @Schema(description = "宸蹭粯娆炬�婚噾棰�")
- @TableField(exist = false)
- @Excel(name = "宸蹭粯娆炬�婚噾棰�")
- private BigDecimal paymentAmountTotal;
-
- @Schema(description = "鏈粯娆炬�婚噾棰�")
- @TableField(exist = false)
- @Excel(name = "鏈粯娆炬�婚噾棰�")
- private BigDecimal unPaymentAmountTotal;
-
- @TableField(exist = false)
- private Boolean status;
-
- @TableField(exist = false)
- private String issueDateStart;
- @TableField(exist = false)
- private String issueDateEnd;
-
- @TableField(exist = false)
- private String supplierNameOrContractNo;
-
- @Schema(description = "褰曞叆鏃堕棿")
- private LocalDate enterDate;
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/IInvoicePurchaseService.java b/src/main/java/com/ruoyi/purchase/service/IInvoicePurchaseService.java
deleted file mode 100644
index cc17fc2..0000000
--- a/src/main/java/com/ruoyi/purchase/service/IInvoicePurchaseService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.ruoyi.purchase.service;
-
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.purchase.dto.InvoicePurchaseDto;
-import com.ruoyi.purchase.dto.InvoicePurchaseReportDto;
-import com.ruoyi.purchase.dto.VatDto;
-import com.ruoyi.purchase.pojo.InvoicePurchase;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * 鍙戠エ淇℃伅Service鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-14
- */
-public interface IInvoicePurchaseService extends IService<InvoicePurchase> {
- List<InvoicePurchaseDto> selectInvoicePurchaseList(InvoicePurchaseDto invoicePurchaseDto);
-
- int delInvoice(Long[] ids);
-
- int addOrUpdateInvoice(InvoicePurchaseDto invoicePurchaseDto) throws IOException;
-
- InvoicePurchaseDto getInvoiceById(InvoicePurchaseDto invoicePurchaseDto);
-
- List<InvoicePurchase> selectInvoicePurchaseLists(InvoicePurchase invoicePurchase);
-
- IPage<InvoicePurchaseReportDto> listPurchaseReport(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto);
-
- IPage<VatDto> listVat(Page page,String month);
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/IPaymentRegistrationService.java b/src/main/java/com/ruoyi/purchase/service/IPaymentRegistrationService.java
deleted file mode 100644
index 88052fa..0000000
--- a/src/main/java/com/ruoyi/purchase/service/IPaymentRegistrationService.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.ruoyi.purchase.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.purchase.dto.PaymentHistoryRecordVo;
-import com.ruoyi.purchase.dto.PaymentLedgerDto;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 浠樻鐧昏Service鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-15
- */
-public interface IPaymentRegistrationService extends IService<PaymentRegistration> {
- /**
- * 鏌ヨ浠樻鐧昏
- *
- * @param id 浠樻鐧昏涓婚敭
- * @return 浠樻鐧昏
- */
- public PaymentRegistration selectPaymentRegistrationById(Long id);
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- public List<PaymentRegistrationDto> selectPaymentRegistrationList(PaymentRegistrationDto paymentRegistrationDto);
-
- /**
- * 鏂板浠樻鐧昏
- *
- * @param paymentRegistration 浠樻鐧昏
- * @return 缁撴灉
- */
- public int insertPaymentRegistration(List<PaymentRegistration> paymentRegistration);
-
- /**
- * 淇敼浠樻鐧昏
- *
- * @param paymentRegistration 浠樻鐧昏
- * @return 缁撴灉
- */
- public int updatePaymentRegistration(PaymentRegistration paymentRegistration);
-
- /**
- * 鎵归噺鍒犻櫎浠樻鐧昏
- *
- * @param ids 闇�瑕佸垹闄ょ殑浠樻鐧昏涓婚敭闆嗗悎
- * @return 缁撴灉
- */
- public int deletePaymentRegistrationByIds(Long[] ids);
-
- /**
- * 閫氳繃閲囪喘鍚堝悓鍙锋煡璇㈤攢鍞悎鍚屽彿锛屼緵搴斿晢鍚嶇О锛屽彂绁ㄥ彿锛屽彂绁ㄩ噾棰濓紝绋庣巼
- *
- * @param purchaseId 閲囪喘鍚堝悓id
- * @return 缁撴灉
- */
- PaymentRegistration selectPaymentRegistrationByPurchaseId(Long purchaseId);
-
- IPage<Map<String, Object>> selectPaymentLedgerList(PaymentLedgerDto paymentLedgerDto, Page page,
- Integer detailPageNum,
- Integer detailPageSize);
-
- Map<String, BigDecimal> paymentMonthList();
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- public List<PaymentRegistrationDto> paymentHistoryList(PaymentRegistrationDto paymentRegistrationDto);
-
- /**
- * 鏌ヨ渚涘簲鍟嗗線鏉ヨ褰�
- * @param supplierId
- * @return
- */
- List<PaymentHistoryRecordVo> getPaymentRecordList(Long supplierId);
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃鍒嗛〉
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, PaymentRegistrationDto paymentRegistrationDto);
-
- Boolean delete(Long[] ids);
-
- int delPaymentRegistration(List<Long> ids);
-
- IPage<PaymentRegistrationDto> supplierNameListPage(Page page, PaymentLedgerDto paymentLedgerDto);
-
- List<PaymentRegistrationDto> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto);
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/IProductRecordService.java b/src/main/java/com/ruoyi/purchase/service/IProductRecordService.java
deleted file mode 100644
index 3ab3d32..0000000
--- a/src/main/java/com/ruoyi/purchase/service/IProductRecordService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ruoyi.purchase.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.purchase.dto.ProductRecordDto;
-import com.ruoyi.purchase.dto.TicketRegistrationDto;
-import com.ruoyi.purchase.pojo.ProductRecord;
-
-import java.util.List;
-
-/**
- * 閲囪喘鍙拌处浜у搧寮�绁ㄨ褰昐ervice鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-23
- */
-public interface IProductRecordService extends IService<ProductRecord> {
-
- List<ProductRecord> selectProductRecordList(TicketRegistrationDto ticketRegistrationDto);
-
- IPage<ProductRecordDto> productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto);
-
- AjaxResult updateRecord(ProductRecordDto productRecordDto);
-
- ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto);
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java b/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
index d09050e..78e86a1 100644
--- a/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
+++ b/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
@@ -4,12 +4,13 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
import com.ruoyi.purchase.pojo.PurchaseLedger;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import org.springframework.web.multipart.MultipartFile;
+import java.util.Date;
import java.util.List;
/**
@@ -22,7 +23,11 @@
List<PurchaseLedger> selectPurchaseLedgerList(PurchaseLedger purchaseLedger);
+ List<PurchaseLedger> selectReturnablePurchaseLedgerList(PurchaseLedger purchaseLedger);
+
int addOrEditPurchase(PurchaseLedgerDto purchaseLedgerDto) throws Exception;
+
+ R batchInsertPurchaseSteps(List<Long> ids);
void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct);
@@ -40,9 +45,7 @@
IPage<PurchaseLedgerDto> selectPurchaseLedgerListPage(IPage ipage, PurchaseLedgerDto purchaseLedger);
- List<InvoiceRegistrationProduct> getProductBySalesNo(Long id);
-
- String getPurchaseNo();
+ String getPurchaseNo(Date entryDate);
AjaxResult importData(MultipartFile file);
diff --git a/src/main/java/com/ruoyi/purchase/service/ITicketRegistrationService.java b/src/main/java/com/ruoyi/purchase/service/ITicketRegistrationService.java
deleted file mode 100644
index 6c1cf5b..0000000
--- a/src/main/java/com/ruoyi/purchase/service/ITicketRegistrationService.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.ruoyi.purchase.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
-import com.ruoyi.purchase.dto.PurchaseLedgerDto;
-import com.ruoyi.purchase.dto.TicketRegistrationDto;
-import com.ruoyi.purchase.pojo.TicketRegistration;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * 鏉ョエ鐧昏Service鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-05-13
- */
-public interface ITicketRegistrationService extends IService<TicketRegistration> {
-
- List<TicketRegistration> selectTicketRegistrationList(TicketRegistration ticketRegistration);
-
- int addOrUpdateRegistration(TicketRegistrationDto ticketRegistrationDto) throws IOException;
-
- int delRegistration(Long[] ids);
-
- TicketRegistrationDto getRegistrationById(TicketRegistrationDto ticketRegistrationDto);
-
- List getTicketNo(TicketRegistrationDto ticketRegistrationDto);
-
- IPage<TicketRegistration> selectTicketRegistrationListPage(Page page, TicketRegistration ticketRegistration);
-
- PurchaseLedgerDto getPuargeById(Long id);
-
- List<PaymentRegistrationDto> getPaymentRegistrationDtoById(Long id);
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/PurchaseReportService.java b/src/main/java/com/ruoyi/purchase/service/PurchaseReportService.java
new file mode 100644
index 0000000..4ec6522
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/service/PurchaseReportService.java
@@ -0,0 +1,14 @@
+package com.ruoyi.purchase.service;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.purchase.dto.VatDto;
+import com.ruoyi.purchase.vo.PurchaseReportVo;
+
+public interface PurchaseReportService {
+
+ IPage<PurchaseReportVo> list(Page page, String customerName);
+
+ IPage<VatDto> listVat(Page page, String month);
+}
diff --git a/src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.java b/src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.java
index dc68108..14e040e 100644
--- a/src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.java
+++ b/src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.java
@@ -6,9 +6,12 @@
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.purchase.vo.PurchaseReturnDetailsVo;
-import com.ruoyi.purchase.vo.PurchaseReturnOrderVo;
+import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto;
+import com.ruoyi.purchase.vo.PurchaseStockInProductVo;
import jakarta.validation.constraints.NotNull;
+
+import java.util.List;
/**
* <p>
@@ -19,7 +22,7 @@
* @since 2026-03-06 11:44:38
*/
public interface PurchaseReturnOrdersService extends IService<PurchaseReturnOrders> {
- IPage<PurchaseReturnOrderVo> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto);
+ IPage<PurchaseReturnOrderHasAllInfoDto> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto);
Boolean add(PurchaseReturnOrderDto purchaseReturnOrderDto);
@@ -27,4 +30,7 @@
PurchaseReturnDetailsVo getPurchaseReturnOrderDtoById(@NotNull Long id);
void deleteById(@NotNull Long id);
+
+ List<PurchaseStockInProductVo> getByPurchaseLedgerId(Long purchaseLedgerId);
+
}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/InvoicePurchaseServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/InvoicePurchaseServiceImpl.java
deleted file mode 100644
index 8b76b1a..0000000
--- a/src/main/java/com/ruoyi/purchase/service/impl/InvoicePurchaseServiceImpl.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.ruoyi.purchase.service.impl;
-
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.enums.FileNameType;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.other.mapper.TempFileMapper;
-import com.ruoyi.project.system.domain.SysUser;
-import com.ruoyi.project.system.mapper.SysUserMapper;
-import com.ruoyi.purchase.dto.InvoicePurchaseDto;
-import com.ruoyi.purchase.dto.InvoicePurchaseReportDto;
-import com.ruoyi.purchase.dto.VatDto;
-import com.ruoyi.purchase.mapper.InvoicePurchaseMapper;
-import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
-import com.ruoyi.purchase.pojo.InvoicePurchase;
-import com.ruoyi.purchase.pojo.PurchaseLedger;
-import com.ruoyi.purchase.service.IInvoicePurchaseService;
-import com.ruoyi.sales.mapper.CommonFileMapper;
-import com.ruoyi.sales.pojo.CommonFile;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.io.IOException;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * 鍙戠エ淇℃伅Service涓氬姟灞傚鐞�
- *
- * @author ruoyi
- * @date 2025-05-14
- */
-@Service
-@RequiredArgsConstructor
-@Slf4j
-public class InvoicePurchaseServiceImpl extends ServiceImpl<InvoicePurchaseMapper, InvoicePurchase> implements IInvoicePurchaseService {
-
- private final InvoicePurchaseMapper invoicePurchaseMapper;
-
- private final PurchaseLedgerMapper purchaseLedgerMapper;
-
- private final SysUserMapper userMapper;
-
- private final CommonFileMapper commonFileMapper;
-
-
-
- @Override
- public List<InvoicePurchaseDto> selectInvoicePurchaseList(InvoicePurchaseDto invoicePurchaseDto) {
- // 鏋勫缓鍙戠エ鏌ヨ鏉′欢
- LambdaQueryWrapper<InvoicePurchase> queryWrapper = new LambdaQueryWrapper<>();
- Optional.ofNullable(invoicePurchaseDto)
- .ifPresent(dto -> {
- if (StringUtils.hasText(dto.getPurchaseContractNo())) {
- queryWrapper.like(InvoicePurchase::getPurchaseContractNo, dto.getPurchaseContractNo());
- }
- if (StringUtils.hasText(dto.getSupplierName())) {
- queryWrapper.like(InvoicePurchase::getSupplierName, dto.getSupplierName());
- }
- // 澶勭悊鏃ユ湡绫诲瀷瀛楁
- if (dto.getIssueDate() != null) {
- queryWrapper.eq(InvoicePurchase::getIssueDate,invoicePurchaseDto.getIssueDate());
- }
- });
-
- // 鏌ヨ鍙戠エ鍒楄〃
- List<InvoicePurchase> invoiceList = invoicePurchaseMapper.selectList(queryWrapper);
-
- // 濡傛灉娌℃湁鏌ヨ鍒板彂绁紝鐩存帴杩斿洖绌哄垪琛�
- if (CollectionUtils.isEmpty(invoiceList)) {
- return Collections.emptyList();
- }
-
- // 鎻愬彇鎵�鏈夊彂绁↖D
- List<Long> invoiceIds = invoiceList.stream()
- .map(InvoicePurchase::getId)
- .collect(Collectors.toList());
-
- // 鎵归噺鏌ヨ杩欎簺鍙戠エ鍏宠仈鐨勬枃浠朵俊鎭�
- LambdaQueryWrapper<CommonFile> fileQueryWrapper = new LambdaQueryWrapper<>();
- fileQueryWrapper.in(CommonFile::getCommonId, invoiceIds)
- .eq(CommonFile::getType, FileNameType.INVOICE.getValue());
- List<CommonFile> fileList = commonFileMapper.selectList(fileQueryWrapper);
-
- // 灏嗘枃浠朵俊鎭槧灏勫埌瀵瑰簲鐨勫彂绁↖D
- Map<Long, String> fileMap = fileList.stream()
- .collect(Collectors.toMap(
- CommonFile::getCommonId,
- CommonFile::getName,
- (existing, replacement) -> existing // 濡傛灉鏈夊涓枃浠讹紝鍙栫涓�涓�
- ));
-
- // 灏嗘枃浠朵俊鎭缃埌鍙戠エDTO涓�
- List<InvoicePurchaseDto> resultList = new ArrayList<>();
- for (InvoicePurchase invoice : invoiceList) {
- InvoicePurchaseDto dto = new InvoicePurchaseDto();
- // 灏咺nvoicePurchase鐨勫睘鎬у鍒跺埌DTO
- BeanUtils.copyProperties(invoice, dto);
- // 璁剧疆鏂囦欢鍚嶏紝濡傛灉瀛樺湪鐨勮瘽
- dto.setFileName(fileMap.getOrDefault(invoice.getId(), null));
- resultList.add(dto);
- }
-
- return resultList;
- }
-
- @Override
- public int delInvoice(Long[] ids) {
- return invoicePurchaseMapper.deleteBatchIds(Arrays.asList(ids));
- }
-
- @Override
- public int addOrUpdateInvoice(InvoicePurchaseDto invoicePurchaseDto) throws IOException {
- int i;
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(invoicePurchaseDto.getPurchaseLedgerId());
- InvoicePurchase invoicePurchase = new InvoicePurchase();
- BeanUtils.copyProperties(invoicePurchaseDto, invoicePurchase);
- invoicePurchase.setPurchaseContractNo(purchaseLedger.getPurchaseContractNumber());
- invoicePurchase.setSalesContractNo(purchaseLedger.getSalesContractNo());
- SysUser sysUser = userMapper.selectUserById(invoicePurchase.getIssUerId());
- invoicePurchase.setIssUer(sysUser.getNickName());
- invoicePurchase.setTenantId(purchaseLedger.getTenantId());
- if (invoicePurchaseDto.getId() == null) {
- i = invoicePurchaseMapper.insert(invoicePurchase);
- } else {
- i = invoicePurchaseMapper.updateById(invoicePurchase);
- }
-
- // 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
-// if (invoicePurchaseDto.getTempFileIds() != null && !invoicePurchaseDto.getTempFileIds().isEmpty()) {
-// migrateTempFilesToFormal(invoicePurchase.getId(), invoicePurchaseDto.getTempFileIds());
-// }
-
- return i;
- }
-
- @Override
- public InvoicePurchaseDto getInvoiceById(InvoicePurchaseDto invoicePurchaseDto) {
- InvoicePurchase invoicePurchase = invoicePurchaseMapper.selectById(invoicePurchaseDto.getId());
- InvoicePurchaseDto resultDto = new InvoicePurchaseDto();
- BeanUtils.copyProperties(invoicePurchase, resultDto);
-
- // 鏌ヨ涓婁紶鏂囦欢
- LambdaQueryWrapper<CommonFile> commonFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
- commonFileLambdaQueryWrapper.eq(CommonFile::getCommonId, invoicePurchaseDto.getId())
- .eq(CommonFile::getType, FileNameType.INVOICE.getValue());
- List<CommonFile> commonFiles = commonFileMapper.selectList(commonFileLambdaQueryWrapper);
- resultDto.setCommonFiles(commonFiles);
- return resultDto;
- }
-
- @Override
- public List<InvoicePurchase> selectInvoicePurchaseLists(InvoicePurchase invoicePurchase) {
- return invoicePurchaseMapper.selectList(new LambdaQueryWrapper<>());
- }
-
- @Override
- public IPage<InvoicePurchaseReportDto> listPurchaseReport(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto) {
- // 澧炲�肩◣ = 閿�鍞殑锛堝惈绋庢�讳环-涓嶅惈绋庢�讳环锛夊噺鍘婚噰璐殑锛堝惈绋庢�讳环-涓嶅惈绋庢�讳环锛�
- return invoicePurchaseMapper.selectPurchaseReport(page, invoicePurchaseReportDto);
- }
-
- @Override
- public IPage<VatDto> listVat(Page page, String month) {
- IPage<VatDto> vatDtos = invoicePurchaseMapper.listVat(page,month);
- vatDtos.getRecords().forEach(vatDto -> {
- vatDto.setTaxAmount(vatDto.getJTaxAmount().subtract(vatDto.getXTaxAmount()));
- });
- return vatDtos;
- }
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
deleted file mode 100644
index d5875e3..0000000
--- a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
+++ /dev/null
@@ -1,564 +0,0 @@
-package com.ruoyi.purchase.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.account.service.AccountExpenseService;
-import com.ruoyi.basic.mapper.SupplierManageMapper;
-import com.ruoyi.basic.pojo.SupplierManage;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.purchase.dto.PaymentHistoryRecordVo;
-import com.ruoyi.purchase.dto.PaymentLedgerDto;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
-import com.ruoyi.purchase.mapper.PaymentRegistrationMapper;
-import com.ruoyi.purchase.mapper.ProductRecordMapper;
-import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
-import com.ruoyi.purchase.mapper.TicketRegistrationMapper;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import com.ruoyi.purchase.pojo.ProductRecord;
-import com.ruoyi.purchase.pojo.PurchaseLedger;
-import com.ruoyi.purchase.pojo.TicketRegistration;
-import com.ruoyi.purchase.service.IPaymentRegistrationService;
-import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
-import org.springframework.util.StringUtils;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.YearMonth;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * 浠樻鐧昏Service涓氬姟灞傚鐞�
- *
- * @author ruoyi
- * @date 2025-05-15
- */
-@Service
-@RequiredArgsConstructor
-public class PaymentRegistrationServiceImpl extends ServiceImpl<PaymentRegistrationMapper, PaymentRegistration> implements IPaymentRegistrationService {
-
- private final PaymentRegistrationMapper paymentRegistrationMapper;
- private final PurchaseLedgerMapper purchaseLedgerMapper;
- private final SupplierManageMapper supplierManageMapper;
- private final SalesLedgerProductMapper salesLedgerProductMapper;
- private final TicketRegistrationMapper ticketRegistrationMapper;
- private final ProductRecordMapper productRecordMapper;
- private final AccountExpenseService accountExpenseService;
-
- /**
- * 鏌ヨ浠樻鐧昏
- *
- * @param id 浠樻鐧昏涓婚敭
- * @return 浠樻鐧昏
- */
- @Override
- public PaymentRegistration selectPaymentRegistrationById(Long id) {
- return paymentRegistrationMapper.selectPaymentRegistrationById(id);
- }
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏
- */
- @Override
- public List<PaymentRegistrationDto> selectPaymentRegistrationList(PaymentRegistrationDto paymentRegistrationDto) {
- List<PaymentRegistrationDto> list = paymentRegistrationMapper.selectPaymentRegistrationList(paymentRegistrationDto);
- for (PaymentRegistrationDto registrationDto : list) {
- List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(new QueryWrapper<PaymentRegistration>()
- .eq("ticket_registration_id", registrationDto.getTicketRegistrationId()));
- BigDecimal total = paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
- BigDecimal invoiceAmount = (null != registrationDto.getInvoiceAmount())? registrationDto.getInvoiceAmount() : BigDecimal.ZERO;
- registrationDto.setUnPaymentAmount(invoiceAmount.subtract(total));
- }
- return list;
- }
-
- /**
- * 鏂板浠樻鐧昏
- *
- * @param paymentRegistrationList 浠樻鐧昏
- * @return 缁撴灉
- */
- @Override
- public int insertPaymentRegistration(List<PaymentRegistration> paymentRegistrationList) {
- LoginUser userId = SecurityUtils.getLoginUser();
- for (PaymentRegistration paymentRegistration : paymentRegistrationList) {
- PaymentRegistration byId = paymentRegistration;
- if (!ObjectUtils.isEmpty(paymentRegistration.getId())){
- paymentRegistration = this.getById(paymentRegistration.getId());
- }
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(paymentRegistration.getPurchaseLedgerId());
- if(null==purchaseLedger) throw new RuntimeException("鏈壘鍒伴噰璐崟");
- // 宸插洖娆鹃噾棰�
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(paymentRegistration.getSalesLedgerProductId());
- if(null==salesLedgerProduct) throw new RuntimeException("鏈壘鍒伴噰璐崟浜у搧");
- if (salesLedgerProduct.getPendingTicketsTotal().compareTo(paymentRegistration.getCurrentPaymentAmount())<0){
- throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�");
- }
- paymentRegistration.setCreateTime(DateUtils.getNowDate());
- paymentRegistration.setUpdateTime(DateUtils.getNowDate());
- paymentRegistration.setRegistrantId(userId.getUserId());
- salesLedgerProduct.setTicketsTotal(salesLedgerProduct.getTicketsTotal().add(paymentRegistration.getCurrentPaymentAmount()));
- salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getTicketsTotal()));
- paymentRegistrationMapper.insert(paymentRegistration);
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- // 2. 澶勭悊璐︽埛鏀嚭
- AccountExpense accountExpense = new AccountExpense();
- accountExpense.setExpenseDate(purchaseLedger.getEntryDate());
- accountExpense.setExpenseType("4");
- accountExpense.setSupplierName(purchaseLedger.getSupplierName());
- accountExpense.setExpenseMoney(paymentRegistration.getCurrentPaymentAmount());
- accountExpense.setExpenseDescribed("浠樻鏀嚭");
-
- accountExpense.setExpenseMethod(paymentRegistration.getPaymentMethod());
- accountExpense.setBusinessId(paymentRegistration.getId());
- accountExpense.setBusinessType(1);
- accountExpense.setInputTime(new Date());
- accountExpense.setInputUser(userId.getNickName());
- accountExpenseService.save(accountExpense);
- }
- return 1;
-
- }
-
- /**
- * 淇敼浠樻鐧昏
- *
- * @param paymentRegistration 浠樻鐧昏
- * @return 缁撴灉
- */
- @Override
- public int updatePaymentRegistration(PaymentRegistration paymentRegistration) {
- PaymentRegistration paymentRegistration1 = paymentRegistrationMapper.selectById(paymentRegistration.getId());
- if(null==paymentRegistration1) throw new RuntimeException("鏈壘鍒颁粯娆剧櫥璁�");
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(paymentRegistration1.getSalesLedgerProductId());
- if(null==salesLedgerProduct) throw new RuntimeException("鏈壘鍒伴噰璐崟浜у搧");
- // 鍒ゆ柇浠樻閲戦涓嶅彲澶т簬寰呬粯娆鹃噾棰�
- BigDecimal subtract = paymentRegistration.getCurrentPaymentAmount().subtract(paymentRegistration1.getCurrentPaymentAmount());
- if (subtract.compareTo(salesLedgerProduct.getPendingTicketsTotal()) > 0) {
- throw new RuntimeException("浠樻閲戦瓒呭嚭寰呬粯娆鹃噾棰�");
- }
- paymentRegistration.setUpdateTime(DateUtils.getNowDate());
- // 鍚屾淇敼璐︽埛鏀嚭
- LambdaQueryWrapper<AccountExpense> accountExpenseLambdaQueryWrapper = new LambdaQueryWrapper<>();
- accountExpenseLambdaQueryWrapper.eq(AccountExpense::getBusinessId, paymentRegistration.getId())
- .eq(AccountExpense::getBusinessType, 1)
- .last("limit 1");
- AccountExpense accountExpense = accountExpenseService.getOne(accountExpenseLambdaQueryWrapper);
- if(null!=accountExpense){
- accountExpense.setExpenseMoney(paymentRegistration.getCurrentPaymentAmount());
- accountExpenseService.updateById(accountExpense);
- }
- // 淇敼閲囪喘浜у搧浠樻閲戦
- salesLedgerProduct.setTicketsTotal(salesLedgerProduct.getTicketsTotal().add(subtract));
- salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getTicketsTotal()));
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- return paymentRegistrationMapper.updateById(paymentRegistration);
- }
-
- /**
- * 鎵归噺鍒犻櫎浠樻鐧昏
- *
- * @param ids 闇�瑕佸垹闄ょ殑浠樻鐧昏涓婚敭
- * @return 缁撴灉
- */
- @Override
- public int deletePaymentRegistrationByIds(Long[] ids) {
- return paymentRegistrationMapper.delete(new QueryWrapper<PaymentRegistration>().in("id", ids));
- }
-
- @Override
- public PaymentRegistration selectPaymentRegistrationByPurchaseId(Long id) {
- PaymentRegistrationDto paymentRegistrationDto = new PaymentRegistrationDto();
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id);
- paymentRegistrationDto.setSalesContractNo(purchaseLedger.getSalesContractNo());
- paymentRegistrationDto.setSupplierName(purchaseLedger.getSupplierName());
- paymentRegistrationDto.setSupplierId(purchaseLedger.getSupplierId());
-
- List<TicketRegistration> ticketRegistrations = ticketRegistrationMapper.selectList(new QueryWrapper<TicketRegistration>()
- .eq("purchase_contract_number", purchaseLedger.getPurchaseContractNumber()));
- if (ticketRegistrations != null && ticketRegistrations.size() > 0) {
- paymentRegistrationDto.setInvoiceNumber(ticketRegistrations.get(0).getInvoiceNumber());
- paymentRegistrationDto.setInvoiceAmount(ticketRegistrations.get(0).getInvoiceAmount());
- }
- return paymentRegistrationDto;
- }
-
- @Override
- public IPage<Map<String, Object>> selectPaymentLedgerList(
- PaymentLedgerDto paymentLedgerDto,
- Page page,
- Integer detailPageNum,
- Integer detailPageSize) {
- LambdaQueryWrapper<SupplierManage> queryWrapper = new LambdaQueryWrapper<>();
- Optional.ofNullable(paymentLedgerDto)
- .ifPresent(dto -> {
- if (StringUtils.hasText(dto.getSupplierName())) {
- queryWrapper.like(SupplierManage::getSupplierName, dto.getSupplierName());
- }
- });
-
- IPage<SupplierManage> supplierPage = supplierManageMapper.selectPage(page, queryWrapper);
- List<SupplierManage> supplierManages = supplierPage.getRecords();
-
- IPage<Map<String, Object>> resultPage = new Page<>(page.getCurrent(), page.getSize(), supplierPage.getTotal());
- List<Map<String, Object>> result = new ArrayList<>();
-
- for (SupplierManage supplierManage : supplierManages) {
- Map<String, Object> res = new HashMap<>();
- res.put("supplierName", supplierManage.getSupplierName());
- res.put("supplierId", supplierManage.getId());
-
- // 搴斾粯閲戦璁$畻
- BigDecimal payableAmount = BigDecimal.ZERO;
- List<PurchaseLedger> purchaseLedgers = purchaseLedgerMapper.selectList(
- new QueryWrapper<PurchaseLedger>().eq("supplier_id", supplierManage.getId())
- );
- List<SalesLedgerProduct> salesLedgerProducts = purchaseLedgers.stream()
- .filter(Objects::nonNull)
- .map(PurchaseLedger::getId)
- .filter(Objects::nonNull)
- .flatMap(id -> salesLedgerProductMapper.selectList(
- new QueryWrapper<SalesLedgerProduct>().eq("sales_ledger_id", id).eq("type",2)
- ).stream())
- .collect(Collectors.toList());
- payableAmount = salesLedgerProducts.stream()
- .map(SalesLedgerProduct::getTaxInclusiveTotalPrice)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- // 鏉ョエ閲戦璁$畻
- List<TicketRegistration> ticketRegistrations = purchaseLedgers.stream()
- .map(PurchaseLedger::getId)
- .filter(Objects::nonNull)
- .map(id -> ticketRegistrationMapper.selectList(
- new LambdaQueryWrapper<TicketRegistration>().eq(TicketRegistration::getPurchaseLedgerId, id)
- ))
- .flatMap(Collection::stream)
- .collect(Collectors.toList());
- BigDecimal invoiceAmount = ticketRegistrations.stream()
- .map(TicketRegistration::getInvoiceAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- // 浠樻璁板綍鍙婅鎯呭垎椤�
- List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(
- new QueryWrapper<PaymentRegistration>().eq("supplier_id", supplierManage.getId())
- );
- BigDecimal paymentAmount = paymentRegistrations.stream()
- .map(PaymentRegistration::getCurrentPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- // 璇︽儏鍒嗛〉澶勭悊
- detailPageNum = detailPageNum != null ? detailPageNum : 1;
- detailPageSize = detailPageSize != null ? detailPageSize : paymentRegistrations.size(); // 榛樿鏄剧ず鍏ㄩ儴
- int totalDetails = paymentRegistrations.size();
- int start = (detailPageNum - 1) * detailPageSize;
- int end = Math.min(start + detailPageSize, totalDetails);
- List<PaymentRegistration> pagedDetails = paymentRegistrations.subList(start, end);
-
- // 鏋勫缓璇︽儏鍒楄〃
- List<Map<String, Object>> details = pagedDetails.stream()
- .filter(Objects::nonNull)
- .map(pr -> {
- Map<String, Object> detail = new HashMap<>();
- detail.put("paymentAmount", pr.getCurrentPaymentAmount());
-
- // 鎵归噺鏌ヨ TicketRegistration锛堥伩鍏� N+1锛�
- TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(pr.getTicketRegistrationId());
- if (ticketRegistration != null) {
- detail.put("payableAmount", ticketRegistration.getInvoiceAmount());
- BigDecimal voteCount = productRecordMapper.selectList(
- new LambdaQueryWrapper<ProductRecord>().eq(ProductRecord::getTicketRegistrationId, ticketRegistration.getId())
- ).stream()
- .map(ProductRecord::getTicketsNum)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- detail.put("voteCount", voteCount);
- }
-
- // 鏃ユ湡鏍煎紡鍖栵紙寤鸿浣跨敤 LocalDateTime锛�
- if (pr.getPaymentDate() != null) {
- detail.put("paymentDate", new SimpleDateFormat("yyyy-MM-dd").format(pr.getPaymentDate()));
- }
- return detail;
- })
- .collect(Collectors.toList());
-
- // 灏佽璇︽儏鍒嗛〉鍏冩暟鎹�
- Map<String, Object> detailPagination = new HashMap<>();
- detailPagination.put("total", totalDetails);
- detailPagination.put("pageNum", detailPageNum);
- detailPagination.put("pageSize", detailPageSize);
- detailPagination.put("pages", (int) Math.ceil((double) totalDetails / detailPageSize));
-
- // 搴斾粯閲戦閫昏緫涓嶉噰鐢ㄥ悎鍚岄噾棰濇敼鎴� 鍙戠エ閲戦鍑忎粯娆鹃噾棰�
- payableAmount = invoiceAmount.subtract(paymentAmount);
- res.put("invoiceAmount", invoiceAmount);
- res.put("payableAmount", payableAmount);
- res.put("paymentAmount", paymentAmount);
- res.put("details", details);
- res.put("detailPagination", detailPagination); // 娣诲姞璇︽儏鍒嗛〉淇℃伅
- result.add(res);
- }
-
- resultPage.setRecords(result);
- return resultPage;
- }
-
- @Override
- public Map<String, BigDecimal> paymentMonthList() {
-
- // 鏌ヨ渚涘簲鍟嗗垪琛�
- List<SupplierManage> suppliers = supplierManageMapper.selectList(null);
- if (CollectionUtils.isEmpty(suppliers)) {
- Map<String, BigDecimal> result = new HashMap<>();
- result.put("payableAmount", BigDecimal.ZERO);
- result.put("paymentAmount", BigDecimal.ZERO);
- return result;
- }
-
- // 鎻愬彇鎵�鏈変緵搴斿晢ID
- List<Long> supplierIds = suppliers.stream()
- .map(SupplierManage::getId) // 鍏堣幏鍙朓nteger绫诲瀷鐨処D
- .filter(Objects::nonNull) // 杩囨护鎺夊彲鑳界殑null鍊�
- .collect(Collectors.toList());
-
- // 鑾峰彇褰撴湀鐨勫紑濮嬪拰缁撴潫鏃ユ湡
- YearMonth currentMonth = YearMonth.now();
- LocalDate startDate = currentMonth.atDay(1);
- LocalDate endDate = currentMonth.atEndOfMonth();
-
- // 鎵归噺鏌ヨ閲囪喘鍙拌处锛堝綋鏈堬級
- Map<Long, List<PurchaseLedger>> purchaseLedgerMap = batchQueryPurchaseLedgers(supplierIds, startDate, endDate);
-
- // 鎵归噺鏌ヨ閿�鍞彴璐︿骇鍝�
- Map<Long, List<SalesLedgerProduct>> salesLedgerProductMap = batchQuerySalesLedgerProducts(purchaseLedgerMap);
-
- // 鎵归噺鏌ヨ浠樻璁板綍锛堝綋鏈堬級
- Map<Long, List<PaymentRegistration>> paymentRegistrationMap = batchQueryPaymentRegistrations(supplierIds, startDate, endDate);
-
- // 璁$畻搴斾粯閲戦鍜屼粯娆鹃噾棰�
- BigDecimal totalPayableAmount = calculateTotalPayableAmount(purchaseLedgerMap, salesLedgerProductMap);
- BigDecimal totalPaymentAmount = calculateTotalPaymentAmount(paymentRegistrationMap);
-
- // 鏋勫缓缁撴灉
- Map<String, BigDecimal> result = new HashMap<>();
- result.put("payableAmount", totalPayableAmount);
- result.put("paymentAmount", totalPaymentAmount);
- return result;
- }
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- @Override
- public List<PaymentRegistrationDto> paymentHistoryList(PaymentRegistrationDto paymentRegistrationDto) {
- return paymentRegistrationMapper.paymentHistoryList(paymentRegistrationDto);
- }
-
- /**
- * 鏌ヨ渚涘簲鍟嗗線鏉ヨ褰�
- * @param supplierId
- * @return
- */
- @Override
- public List<PaymentHistoryRecordVo> getPaymentRecordList(Long supplierId) {
- List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationMapper.getPaymentRecordList(supplierId);
- List<PaymentHistoryRecordVo> result = new ArrayList<>();
- List<PaymentHistoryRecordVo> newResult = new ArrayList<>();
- // 搴斾粯鎬婚噾棰濋噾棰濊绠�
- BigDecimal amountTotal = BigDecimal.ZERO;
- if(CollectionUtils.isNotEmpty(paymentRecordList)) {
- Map<LocalDate, List<PaymentHistoryRecordVo>> dateListMap = paymentRecordList.stream().collect(
- Collectors.groupingBy(
- PaymentHistoryRecordVo::getHappenTime,
- LinkedHashMap::new,
- Collectors.toList()
- )
- );
- for (LocalDate localDate : dateListMap.keySet()) {
- BigDecimal currentPaymentAmount = BigDecimal.ZERO;
- BigDecimal invoiceAmount = BigDecimal.ZERO;
- BigDecimal currentDateTotal = BigDecimal.ZERO;
- List<PaymentHistoryRecordVo> paymentHistoryRecordVos = dateListMap.get(localDate);
- // 璁$畻褰撳ぉ姹囨鏁�
- currentPaymentAmount = paymentHistoryRecordVos.stream()
- .filter(item ->item.getType() == 0)
- .map(PaymentHistoryRecordVo::getCurrentPaymentAmount)
- .reduce(BigDecimal.ZERO,BigDecimal::add);
- // 璁$畻浠婂ぉ鏉ョエ鏁�
- invoiceAmount = paymentHistoryRecordVos.stream()
- .filter(item ->item.getType() == 1)
- .map(PaymentHistoryRecordVo::getInvoiceAmount)
- .reduce(BigDecimal.ZERO,BigDecimal::add);
- // 璁$畻褰撴棩姹囨��
- currentDateTotal = currentDateTotal.add(invoiceAmount).subtract(currentPaymentAmount);
- PaymentHistoryRecordVo paymentHistoryRecordVo = new PaymentHistoryRecordVo();
- paymentHistoryRecordVo.setHappenTime(localDate);
- paymentHistoryRecordVo.setCurrentPaymentAmount(currentPaymentAmount);
- paymentHistoryRecordVo.setInvoiceAmount(invoiceAmount);
- amountTotal = paymentHistoryRecordVo.getInvoiceAmount().subtract(paymentHistoryRecordVo.getCurrentPaymentAmount());
- paymentHistoryRecordVo.setPayableAmount(amountTotal);
- result.add(paymentHistoryRecordVo);
- }
-
-
- for (int i = 0; i < result.size(); i++) {
- PaymentHistoryRecordVo paymentHistoryRecordVo = result.get(i);
- if (i == 0) {
- paymentHistoryRecordVo.setPayableAmount(paymentHistoryRecordVo.getInvoiceAmount().subtract(paymentHistoryRecordVo.getCurrentPaymentAmount()));
- }else {
- PaymentHistoryRecordVo paymentHistoryRecordVo1 = result.get(i-1);
- paymentHistoryRecordVo.setPayableAmount(paymentHistoryRecordVo1.getPayableAmount()
- .add(paymentHistoryRecordVo.getInvoiceAmount()).subtract(paymentHistoryRecordVo.getCurrentPaymentAmount()));
- }
- newResult.add(paymentHistoryRecordVo);
- }
- }
- return newResult;
- }
-
- /**
- * 鏌ヨ浠樻鐧昏鍒楄〃鍒嗛〉
- *
- * @param paymentRegistrationDto 浠樻鐧昏
- * @return 浠樻鐧昏闆嗗悎
- */
- @Override
- public IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, PaymentRegistrationDto paymentRegistrationDto) {
- return paymentRegistrationMapper.paymentHistoryListPage(page, paymentRegistrationDto);
- }
-
- @Override
- public Boolean delete(Long[] ids) {
- for (Long id : ids) {
- List<ProductRecord> productRecords = productRecordMapper.selectList(new QueryWrapper<ProductRecord>().lambda().eq(ProductRecord::getTicketRegistrationId, id));
- for (ProductRecord productRecord : productRecords) {
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId());
- salesLedgerProduct.setTicketsNum(salesLedgerProduct.getTicketsNum().subtract(productRecord.getTicketsNum()));
- salesLedgerProduct.setTicketsAmount(salesLedgerProduct.getTicketsAmount().subtract(productRecord.getTicketsAmount()));
- salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum()));
- salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount()));
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- }
- ticketRegistrationMapper.delete(new QueryWrapper<TicketRegistration>().lambda().eq(TicketRegistration::getId, id));
- productRecordMapper.delete(new QueryWrapper<ProductRecord>().lambda().eq(ProductRecord::getTicketRegistrationId, id));
- }
- return true;
- }
-
- @Override
- public int delPaymentRegistration(List<Long> ids) {
- LambdaQueryWrapper<AccountExpense> accountExpenseLambdaQueryWrapper = new LambdaQueryWrapper<>();
- accountExpenseLambdaQueryWrapper.in(AccountExpense::getBusinessId, ids)
- .eq(AccountExpense::getBusinessType, 1);
- accountExpenseService.remove(accountExpenseLambdaQueryWrapper);
- // 淇敼閲囪喘浜у搧鐨勫凡浠樻閲戦,寰呬粯娆鹃噾棰�
- List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectBatchIds(ids);
- for (PaymentRegistration paymentRegistration : paymentRegistrations) {
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(paymentRegistration.getSalesLedgerProductId());
- salesLedgerProduct.setTicketsTotal(salesLedgerProduct.getTicketsTotal().subtract(paymentRegistration.getCurrentPaymentAmount()));
- salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getPendingTicketsTotal().add(paymentRegistration.getCurrentPaymentAmount()));
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- }
- return paymentRegistrationMapper.deleteBatchIds(ids);
- }
-
- @Override
- public IPage<PaymentRegistrationDto> supplierNameListPage(Page page, PaymentLedgerDto paymentLedgerDto) {
- return paymentRegistrationMapper.supplierNameListPage(page, paymentLedgerDto);
- }
-
- @Override
- public List<PaymentRegistrationDto> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto) {
- return paymentRegistrationMapper.supplierNameListPageDetails(paymentLedgerDto);
- }
-
- // 鎵归噺鏌ヨ閲囪喘鍙拌处锛堝綋鏈堬級
- private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) {
- LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>();
- query.in(PurchaseLedger::getSupplierId, supplierIds)
- .ge(PurchaseLedger::getCreatedAt, startDate)
- .le(PurchaseLedger::getCreatedAt, endDate);
- List<PurchaseLedger> purchaseLedgers = purchaseLedgerMapper.selectList(query);
-
- return purchaseLedgers.stream()
- .filter(pl -> pl.getSupplierId() != null)
- .collect(Collectors.groupingBy(PurchaseLedger::getSupplierId));
- }
-
- // 鎵归噺鏌ヨ閿�鍞彴璐︿骇鍝�
- private Map<Long, List<SalesLedgerProduct>> batchQuerySalesLedgerProducts(Map<Long, List<PurchaseLedger>> purchaseLedgerMap) {
- // 鎻愬彇鎵�鏈夐噰璐彴璐D
- List<Long> purchaseLedgerIds = purchaseLedgerMap.values().stream()
- .flatMap(Collection::stream)
- .map(PurchaseLedger::getId)
- .filter(Objects::nonNull)
- .collect(Collectors.toList());
-
- if (purchaseLedgerIds.isEmpty()) {
- return Collections.emptyMap();
- }
-
- LambdaQueryWrapper<SalesLedgerProduct> query = new LambdaQueryWrapper<>();
- query.in(SalesLedgerProduct::getSalesLedgerId, purchaseLedgerIds);
- List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(query);
-
- return products.stream()
- .filter(slp -> slp.getSalesLedgerId() != null)
- .collect(Collectors.groupingBy(SalesLedgerProduct::getSalesLedgerId));
- }
-
- // 鎵归噺鏌ヨ浠樻璁板綍锛堝綋鏈堬級
- private Map<Long, List<PaymentRegistration>> batchQueryPaymentRegistrations(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) {
- LambdaQueryWrapper<PaymentRegistration> query = new LambdaQueryWrapper<>();
- query.in(PaymentRegistration::getSupplierId, supplierIds)
- .ge(PaymentRegistration::getPaymentDate, startDate)
- .le(PaymentRegistration::getPaymentDate, endDate);
- List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(query);
-
- return paymentRegistrations.stream()
- .filter(pr -> pr.getSupplierId() != null)
- .collect(Collectors.groupingBy(PaymentRegistration::getSupplierId));
- }
-
- // 璁$畻鎬诲簲浠橀噾棰�
- private BigDecimal calculateTotalPayableAmount(Map<Long, List<PurchaseLedger>> purchaseLedgerMap,
- Map<Long, List<SalesLedgerProduct>> salesLedgerProductMap) {
- return purchaseLedgerMap.values().stream()
- .flatMap(Collection::stream)
- .map(pl -> salesLedgerProductMap.getOrDefault(pl.getId(), Collections.emptyList()))
- .flatMap(Collection::stream)
- .map(SalesLedgerProduct::getTaxInclusiveTotalPrice)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- }
-
- // 璁$畻鎬讳粯娆鹃噾棰�
- private BigDecimal calculateTotalPaymentAmount(Map<Long, List<PaymentRegistration>> paymentRegistrationMap) {
- return paymentRegistrationMap.values().stream()
- .flatMap(Collection::stream)
- .map(PaymentRegistration::getCurrentPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- }
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java
deleted file mode 100644
index 961e759..0000000
--- a/src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.ruoyi.purchase.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.enums.FileNameType;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.purchase.dto.ProductRecordDto;
-import com.ruoyi.purchase.dto.TicketRegistrationDto;
-import com.ruoyi.purchase.mapper.ProductRecordMapper;
-import com.ruoyi.purchase.mapper.TicketRegistrationMapper;
-import com.ruoyi.purchase.pojo.ProductRecord;
-import com.ruoyi.purchase.pojo.TicketRegistration;
-import com.ruoyi.purchase.service.IProductRecordService;
-import com.ruoyi.sales.mapper.CommonFileMapper;
-import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.CommonFile;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 閲囪喘鍙拌处浜у搧寮�绁ㄨ褰昐ervice涓氬姟灞傚鐞�
- *
- * @author ruoyi
- * @date 2025-05-23
- */
-@Service
-@RequiredArgsConstructor
-public class ProductRecordServiceImpl extends ServiceImpl<ProductRecordMapper, ProductRecord> implements IProductRecordService {
-
- private final SalesLedgerProductMapper salesLedgerProductMapper;
- private final ProductRecordMapper productRecordMapper;
- private final CommonFileMapper commonFileMapper;
- /**
- * 鏌ヨ閲囪喘鍙拌处浜у搧寮�绁ㄨ褰�
- *
- * @param ticketRegistrationDto 閲囪喘鍙拌处浜у搧寮�绁ㄨ褰曚富閿�
- * @return 閲囪喘鍙拌处浜у搧寮�绁ㄨ褰�
- */
- @Override
- public List<ProductRecord> selectProductRecordList(TicketRegistrationDto ticketRegistrationDto) {
- return productRecordMapper.selectList(new LambdaQueryWrapper<ProductRecord>().eq(ProductRecord::getTicketRegistrationId, ticketRegistrationDto.getId())
- .eq(ProductRecord::getType, "2"));
- }
-
- @Override
- public IPage<ProductRecordDto> productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto) {
- IPage<ProductRecordDto> productRecordDtoIPage1 = productRecordMapper.productRecordPage(page, ticketRegistrationDto);
- page.setSize(productRecordDtoIPage1.getTotal());
- IPage<ProductRecordDto> productRecordDtoIPage = productRecordMapper.productRecordPage(page, ticketRegistrationDto);
- productRecordDtoIPage.getRecords().forEach(productRecordDto -> {
- productRecordDto.setCommonFiles(commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, productRecordDto.getId())
- .eq(CommonFile::getType, FileNameType.PURCHASELEDGER.getValue())));
- });
- return productRecordDtoIPage;
- }
-
- private final TicketRegistrationMapper ticketRegistrationMapper;
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult updateRecord(ProductRecordDto productRecordDto) {
- ProductRecord productRecord = productRecordMapper.selectById(productRecordDto.getId());
- if (productRecord == null) return AjaxResult.error("璁板綍涓嶅瓨鍦�");
-
- // 鏇存柊浜у搧鍙拌处
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId());
- if (salesLedgerProduct != null) {
- // 鏈潵绁ㄩ噾棰� = 鍘熸湭鏉ョエ閲戦 + 鏃ц閲戦 - 鏂拌閲戦
- BigDecimal futureTicketsAmount = salesLedgerProduct.getFutureTicketsAmount()
- .add(productRecord.getTicketsAmount())
- .subtract(productRecordDto.getTicketsAmount());
- salesLedgerProduct.setFutureTicketsAmount(futureTicketsAmount);
-
- // 鏈潵绁ㄦ暟 = 鍘熸湭鏉ョエ鏁� + 鏃ц鏁伴噺 - 鏂拌鏁伴噺
- BigDecimal futureTickets = salesLedgerProduct.getFutureTickets()
- .add(productRecord.getTicketsNum())
- .subtract(productRecordDto.getTicketsNum());
- salesLedgerProduct.setFutureTickets(futureTickets);
-
- // 鏇存柊浜у搧琛ㄦ湰娆℃暟鍊�
- salesLedgerProduct.setTicketsAmount(productRecordDto.getTicketsAmount());
- salesLedgerProduct.setTicketsNum(productRecordDto.getTicketsNum());
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- }
-
- // 鏇存柊鏉ョエ鐧昏
- TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(productRecord.getTicketRegistrationId());
- if (ticketRegistration != null) {
- // 閲戦 = 鏂伴噾棰� - 鏃ч噾棰�
- BigDecimal amountDiff = productRecordDto.getTicketsAmount().subtract(productRecord.getTicketsAmount());
- // 鎬婚噾棰� = 鍘熸�婚噾棰� + 宸��
- ticketRegistration.setInvoiceAmount(ticketRegistration.getInvoiceAmount().add(amountDiff));
- // 鏇存柊鍙戠エ鍙�
- ticketRegistration.setInvoiceNumber(productRecordDto.getInvoiceNumber());
-
- ticketRegistrationMapper.updateById(ticketRegistration);
- }
-
- BeanUtils.copyProperties(productRecordDto, productRecord);
- // 閲嶆柊璁$畻鏈潵绁ㄩ噾棰濓紙鏍规嵁鍓╀綑绁ㄦ暟 * 鍗曚环锛�
- productRecord.setFutureTicketsAmount(productRecord.getFutureTickets().multiply(productRecord.getTaxInclusiveUnitPrice()));
- productRecordMapper.updateById(productRecord);
-
- return AjaxResult.success("淇敼鎴愬姛");
- }
-
- @Override
- public ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto) {
- List<ProductRecordDto> productRecordDtoList = productRecordMapper.getProductRecordById(productRecordDto);
- if (CollectionUtils.isNotEmpty(productRecordDtoList)) {
- ProductRecordDto productRecordDto1 = productRecordDtoList.stream()
- .filter(item -> item.getId().equals(productRecordDto.getId()))
- .findFirst()
- .orElse(null);
- // 杩囨护鍑轰笌浼犲叆鐨� productRecordDto 涓婚敭鐩稿悓鐨勮褰�
- BigDecimal reduce = productRecordDtoList
- .stream()
- .filter(item -> item.getProductModelId().equals(productRecordDto.getProductModelId()))
- .map(ProductRecordDto::getTicketsNum)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- if (productRecordDto1 != null) {
- productRecordDto1.setFutureTickets(productRecordDto1.getQuantity().subtract(reduce));
- productRecordDto1.setFutureTicketsAmount(productRecordDto1.getFutureTickets().multiply(productRecordDto1.getTaxInclusiveUnitPrice()));
- }
- return productRecordDto1;
- }
- return null;
- }
-}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
index 91fb7b9..7c25815 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -6,8 +6,13 @@
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.approve.bean.vo.ApproveProcessVO;
+import com.alibaba.fastjson2.JSON;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
+import com.ruoyi.approve.mapper.ApprovalTemplateMapper;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
import com.ruoyi.approve.pojo.ApproveProcess;
+import com.ruoyi.approve.service.ApprovalInstanceService;
import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.basic.enums.ApplicationTypeEnum;
import com.ruoyi.basic.enums.RecordTypeEnum;
@@ -18,29 +23,29 @@
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.pojo.SupplierManage;
import com.ruoyi.basic.utils.FileUtil;
-import com.ruoyi.common.enums.FileNameType;
+import com.ruoyi.common.enums.ApprovalStatusEnum;
+import com.ruoyi.common.enums.ReviewStatusEnum;
+import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.TypeEnums;
import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
+import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
import com.ruoyi.purchase.dto.PurchaseLedgerImportDto;
import com.ruoyi.purchase.dto.PurchaseLedgerProductImportDto;
-import com.ruoyi.purchase.mapper.PaymentRegistrationMapper;
-import com.ruoyi.purchase.mapper.ProductRecordMapper;
import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
-import com.ruoyi.purchase.mapper.TicketRegistrationMapper;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import com.ruoyi.purchase.pojo.ProductRecord;
import com.ruoyi.purchase.pojo.PurchaseLedger;
-import com.ruoyi.purchase.pojo.TicketRegistration;
import com.ruoyi.purchase.service.IPurchaseLedgerService;
import com.ruoyi.quality.mapper.QualityInspectMapper;
import com.ruoyi.quality.mapper.QualityInspectParamMapper;
@@ -50,15 +55,15 @@
import com.ruoyi.quality.pojo.QualityInspectParam;
import com.ruoyi.quality.pojo.QualityTestStandard;
import com.ruoyi.quality.pojo.QualityTestStandardParam;
+import com.ruoyi.quality.service.IQualityInspectService;
import com.ruoyi.sales.mapper.CommonFileMapper;
-import com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.CommonFile;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
+import com.ruoyi.stock.pojo.StockInRecord;
+import com.ruoyi.stock.service.StockInRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -99,10 +104,6 @@
private final ProductMapper productMapper;
private final ProductModelMapper productModelMapper;
private final SysUserMapper sysUserMapper;
- private final TicketRegistrationMapper ticketRegistrationMapper;
- private final ProductRecordMapper productRecordMapper;
- private final PaymentRegistrationMapper paymentRegistrationMapper;
- private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
private final StringRedisTemplate redisTemplate;
private final QualityInspectMapper qualityInspectMapper;
private final CommonFileServiceImpl commonFileService;
@@ -112,6 +113,11 @@
private final ApproveProcessServiceImpl approveProcessService;
private final ProcurementRecordMapper procurementRecordStorageMapper;
private final FileUtil fileUtil;
+ private final ApprovalInstanceService approvalInstanceService;
+ private final IQualityInspectService qualityInspectService;
+ private final StockInRecordService stockInRecordService;
+ private final StockUtils stockUtils;
+ private final ApprovalTemplateMapper approvalTemplateMapper;
@Override
public List<PurchaseLedger> selectPurchaseLedgerList(PurchaseLedger purchaseLedger) {
@@ -125,7 +131,15 @@
if (purchaseLedger.getApprovalStatus() != null) {
queryWrapper.eq(PurchaseLedger::getApprovalStatus, purchaseLedger.getApprovalStatus());
}
+ // 鍙煡璇㈠叆搴撳凡瀹℃壒閫氳繃鐨勯噰璐彴璐�
+ queryWrapper.inSql(PurchaseLedger::getId,
+ "SELECT DISTINCT record_id FROM stock_in_record WHERE approval_status = 1");
return purchaseLedgerMapper.selectList(queryWrapper);
+ }
+
+ @Override
+ public List<PurchaseLedger> selectReturnablePurchaseLedgerList(PurchaseLedger purchaseLedger) {
+ return purchaseLedgerMapper.selectReturnablePurchaseLedgerList(purchaseLedger);
}
@Override
@@ -158,41 +172,216 @@
purchaseLedger.setRecorderId(purchaseLedgerDto.getRecorderId());
purchaseLedger.setApprovalStatus(1);
+ // 瀹為檯鍚堝悓閲戦濮嬬粓绛変簬鍚堝悓閲戦
+ purchaseLedger.setNetContractAmount(purchaseLedger.getContractAmount());
// 3. 鏂板鎴栨洿鏂颁富琛�
- if (purchaseLedger.getId() == null) {
- purchaseLedgerMapper.insert(purchaseLedger);
- } else {
- // 鍒犻櫎閲囪喘瀹℃牳锛岄噸鏂版彁浜�
- ApproveProcess one = approveProcessService.getOne(new LambdaQueryWrapper<ApproveProcess>()
- .eq(ApproveProcess::getApproveType, 5)
- .eq(ApproveProcess::getApproveReason, purchaseLedger.getPurchaseContractNumber())
- .eq(ApproveProcess::getApproveDelete, 0)
- .last("limit 1"));
- if (one != null) {
- approveProcessService.delByIds(Collections.singletonList(one.getId()));
- }
- purchaseLedgerMapper.updateById(purchaseLedger);
+ if (purchaseLedger.getId() == null && !StringUtils.hasText(purchaseLedger.getPurchaseContractNumber())) {
+ purchaseLedger.setPurchaseContractNumber(generatePurchaseContractNo(purchaseLedger.getEntryDate()));
}
- // 6.閲囪喘瀹℃牳鏂板锛涘鎵圭鐞嗘湭閰嶇疆閲囪喘瀹℃壒浜烘椂锛屽鎵规湇鍔′細鑷姩缃负瀹℃壒閫氳繃銆�
- addApproveByPurchase(loginUser, purchaseLedger);
+ this.saveOrUpdate(purchaseLedger);
// 4. 澶勭悊瀛愯〃鏁版嵁
List<SalesLedgerProduct> productList = purchaseLedgerDto.getProductData();
if (productList != null && !productList.isEmpty()) {
handleSalesLedgerProducts(purchaseLedger.getId(), productList, purchaseLedgerDto.getType());
}
- //鏂板鍘熸潗鏂欐楠� 瀹℃壒涔嬪悗鎵嶇敓鎴愭楠�
-// if (productList != null) {
-// for (SalesLedgerProduct saleProduct : productList) {
-// //鏄惁鎺ㄩ�佽川妫�锛屽鏋渢rue灏辨坊鍔�
-// if (saleProduct.getIsChecked()) {
-// addQualityInspect(purchaseLedger, saleProduct);
-// }
-// }
-// }
+ // 6.閲囪喘瀹℃牳鏂板锛涘鎵圭鐞嗘湭閰嶇疆閲囪喘瀹℃壒浜烘椂锛屽鎵规湇鍔′細鑷姩缃负瀹℃壒閫氳繃銆�
+ //鏌ヨ褰撳墠閲囪喘鍚堝悓鍙锋槸鍚﹀凡娣诲姞瀹℃壒锛屽鏋滄湁涓斾笉鏄┏鍥炵姸鎬侊紝鍒欎笉閲嶅娣诲姞
+ ApprovalInstance oldApprovalInstance = approvalInstanceService.getOne(Wrappers.<ApprovalInstance>lambdaQuery()
+ .eq(ApprovalInstance::getDeleted, 0)
+ .eq(ApprovalInstance::getBusinessType, TypeEnums.PURCHASE_APPROVAL.getCode())
+ .eq(ApprovalInstance::getBusinessId, purchaseLedger.getId())
+ .ne(ApprovalInstance::getStatus,"REJECTED")
+ .last("limit 1")
+ );
+ if(Objects.isNull(oldApprovalInstance)){
+ addApproveByPurchase(loginUser, purchaseLedger, productList);
+ }
// 5. 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.PURCHASE_LEDGER, purchaseLedger.getId(), purchaseLedgerDto.getStorageBlobDTOS());
return 1;
+ }
+
+ @Override
+ public R batchInsertPurchaseSteps(List<Long> ids) {
+ if (CollectionUtils.isEmpty(ids)) {
+ return R.fail("璇烽�夋嫨閲囪喘鍙拌处");
+ }
+
+ List<Long> distinctIds = ids.stream()
+ .filter(Objects::nonNull)
+ .distinct()
+ .collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(distinctIds)) {
+ return R.fail("璇烽�夋嫨閲囪喘鍙拌处");
+ }
+
+ PurchaseLedgerDto queryDto = new PurchaseLedgerDto();
+ queryDto.setIds(distinctIds);
+ IPage<PurchaseLedgerDto> pageResult = this.selectPurchaseLedgerListPage(
+ new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(1, distinctIds.size()),
+ queryDto
+ );
+ List<PurchaseLedgerDto> ledgerDtos = pageResult == null || pageResult.getRecords() == null
+ ? Collections.emptyList()
+ : pageResult.getRecords();
+
+ Map<Long, PurchaseLedgerDto> ledgerDtoMap = ledgerDtos.stream()
+ .filter(item -> item.getId() != null)
+ .collect(Collectors.toMap(PurchaseLedgerDto::getId, item -> item, (left, right) -> left, LinkedHashMap::new));
+
+ List<Map<String, Object>> details = new ArrayList<>();
+ int successCount = 0;
+ int skipCount = 0;
+ int failCount = 0;
+ int autoApprovedCount = 0;
+
+ for (Long id : distinctIds) {
+ Map<String, Object> detail = new LinkedHashMap<>();
+ detail.put("purchaseLedgerId", id);
+ PurchaseLedgerDto purchaseLedgerDto = ledgerDtoMap.get(id);
+ if (purchaseLedgerDto == null) {
+ failCount++;
+ detail.put("status", "FAIL");
+ detail.put("message", "閲囪喘鍙拌处涓嶅瓨鍦ㄦ垨鏈煡璇㈠埌");
+ details.add(detail);
+ continue;
+ }
+
+ detail.put("purchaseContractNumber", purchaseLedgerDto.getPurchaseContractNumber());
+ detail.put("approvalStatus", purchaseLedgerDto.getApprovalStatus());
+ detail.put("stockInStatus", purchaseLedgerDto.getStockInStatus());
+
+ if (ApprovalStatusEnum.REJECTED.getCode().equals(purchaseLedgerDto.getApprovalStatus())) {
+ skipCount++;
+ detail.put("status", "SKIP");
+ detail.put("message", "閲囪喘鍗曞凡椹冲洖");
+ details.add(detail);
+ continue;
+ }
+
+ if ("瀹屽叏鍏ュ簱".equals(purchaseLedgerDto.getStockInStatus())) {
+ skipCount++;
+ detail.put("status", "SKIP");
+ detail.put("message", "閲囪喘鍗曞凡瀹屽叏鍏ュ簱");
+ details.add(detail);
+ continue;
+ }
+
+ try {
+ PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id);
+ if (purchaseLedger == null) {
+ failCount++;
+ detail.put("status", "FAIL");
+ detail.put("message", "閲囪喘鍙拌处涓嶅瓨鍦�");
+ details.add(detail);
+ continue;
+ }
+
+ if (!ApprovalStatusEnum.APPROVED.getCode().equals(purchaseLedger.getApprovalStatus())) {
+ ApprovalInstance approvalInstance = approvalInstanceService.getOne(
+ Wrappers.<ApprovalInstance>lambdaQuery()
+ .eq(ApprovalInstance::getBusinessId, purchaseLedger.getId())
+ .eq(ApprovalInstance::getBusinessType, 5L)
+ .eq(ApprovalInstance::getDeleted, 0)
+ .orderByDesc(ApprovalInstance::getId)
+ .last("limit 1")
+ );
+ if (approvalInstance == null) {
+ failCount++;
+ detail.put("status", "FAIL");
+ detail.put("message", "鏈壘鍒板搴旂殑閲囪喘瀹℃壒瀹炰緥");
+ details.add(detail);
+ continue;
+ }
+
+ if ("APPROVED".equals(approvalInstance.getStatus())
+ && !ApprovalStatusEnum.APPROVED.getCode().equals(purchaseLedger.getApprovalStatus())) {
+ purchaseLedger.setApprovalStatus(ApprovalStatusEnum.APPROVED.getCode());
+ purchaseLedgerMapper.updateById(purchaseLedger);
+ } else if (!"APPROVED".equals(approvalInstance.getStatus())) {
+ R autoApproveResult = approvalInstanceService.autoApprove(approvalInstance.getId());
+ if (autoApproveResult == null || !R.isSuccess(autoApproveResult)) {
+ failCount++;
+ detail.put("status", "FAIL");
+ detail.put("message", autoApproveResult == null ? "閲囪喘瀹℃壒鑷姩閫氳繃澶辫触" : autoApproveResult.getMsg());
+ details.add(detail);
+ continue;
+ }
+ autoApprovedCount++;
+ }
+
+ purchaseLedger = purchaseLedgerMapper.selectById(id);
+ if (purchaseLedger == null || !ApprovalStatusEnum.APPROVED.getCode().equals(purchaseLedger.getApprovalStatus())) {
+ failCount++;
+ detail.put("status", "FAIL");
+ detail.put("message", "閲囪喘鍗曞鎵圭姸鎬佹湭鏇存柊涓哄凡閫氳繃");
+ details.add(detail);
+ continue;
+ }
+ }
+
+ List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(
+ Wrappers.<SalesLedgerProduct>lambdaQuery()
+ .eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId())
+ .eq(SalesLedgerProduct::getType, 2)
+ .orderByAsc(SalesLedgerProduct::getId)
+ );
+ if (CollectionUtils.isEmpty(products)) {
+ skipCount++;
+ detail.put("status", "SKIP");
+ detail.put("message", "閲囪喘鍗曟病鏈変骇鍝佹槑缁�");
+ details.add(detail);
+ continue;
+ }
+
+ int processedProductCount = 0;
+ int skippedProductCount = 0;
+ int failedProductCount = 0;
+ for (SalesLedgerProduct product : products) {
+ try {
+ boolean processed;
+ if (Boolean.TRUE.equals(product.getIsChecked())) {
+ processed = processPurchaseQualityProduct(purchaseLedger, product);
+ } else {
+ processed = processPurchaseDirectProduct(purchaseLedger, product);
+ }
+ if (processed) {
+ processedProductCount++;
+ } else {
+ skippedProductCount++;
+ }
+ } catch (Exception ex) {
+ failedProductCount++;
+ log.error("鎵归噺鎺ㄨ繘閲囪喘鍙拌处澶辫触, purchaseLedgerId={}, productId={}, productModelId={}",
+ purchaseLedger.getId(), product.getId(), product.getProductModelId(), ex);
+ }
+ }
+
+ successCount++;
+ detail.put("status", failedProductCount > 0 ? "PARTIAL" : "SUCCESS");
+ detail.put("processedProductCount", processedProductCount);
+ detail.put("skippedProductCount", skippedProductCount);
+ detail.put("failedProductCount", failedProductCount);
+ detail.put("message", failedProductCount > 0 ? "閮ㄥ垎浜у搧澶勭悊澶辫触" : "澶勭悊瀹屾垚");
+ details.add(detail);
+ } catch (Exception ex) {
+ failCount++;
+ detail.put("status", "FAIL");
+ detail.put("message", ex.getMessage());
+ details.add(detail);
+ log.error("鎵归噺鎺ㄨ繘閲囪喘鍙拌处澶辫触, purchaseLedgerId={}", id, ex);
+ }
+ }
+
+ Map<String, Object> summary = new LinkedHashMap<>();
+ summary.put("totalCount", distinctIds.size());
+ summary.put("successCount", successCount);
+ summary.put("skipCount", skipCount);
+ summary.put("failCount", failCount);
+ summary.put("autoApprovedCount", autoApprovedCount);
+ summary.put("details", details);
+ return R.ok(summary, "鎵归噺鎺ㄨ繘閲囪喘姝ラ瀹屾垚");
}
@@ -220,7 +409,219 @@
param.setId(null);
param.setInspectId(qualityInspect.getId());
qualityInspectParamMapper.insert(param);
- });
+ });
+ }
+ }
+
+ private boolean processPurchaseQualityProduct(PurchaseLedger purchaseLedger, SalesLedgerProduct product) {
+ if (purchaseLedger == null || product == null || product.getProductModelId() == null) {
+ return false;
+ }
+
+ QualityInspect qualityInspect = findLatestPurchaseQualityInspect(purchaseLedger.getId(), product.getProductModelId());
+ if (qualityInspect == null) {
+ addQualityInspect(purchaseLedger, product);
+ qualityInspect = findLatestPurchaseQualityInspect(purchaseLedger.getId(), product.getProductModelId());
+ }
+ if (qualityInspect == null) {
+ return false;
+ }
+
+ LocalDateTime purchaseInspectTime = toStartOfDayPlusDays(purchaseLedger.getEntryDate(), 1);
+ if (purchaseInspectTime != null && (qualityInspect.getCheckTime() == null
+ || !DateUtils.toLocalDate(qualityInspect.getCheckTime()).equals(purchaseInspectTime.toLocalDate()))) {
+ qualityInspect.setCheckTime(DateUtils.toDate(purchaseInspectTime.toLocalDate()));
+ qualityInspectMapper.updateById(qualityInspect);
+ }
+
+ List<StockInRecord> stockRecords = findQualityStockRecords(qualityInspect.getId(), product.getProductModelId());
+ if (hasApprovedStockRecord(stockRecords)) {
+ return true;
+ }
+
+ if (!Integer.valueOf(1).equals(qualityInspect.getInspectState())) {
+ R autoSubmitResult = qualityInspectService.autoSubmit(qualityInspect.getId());
+ if (autoSubmitResult == null || !R.isSuccess(autoSubmitResult)) {
+ return false;
+ }
+ qualityInspect = qualityInspectMapper.selectById(qualityInspect.getId());
+ }
+
+ stockRecords = findQualityStockRecords(qualityInspect.getId(), product.getProductModelId());
+ if (CollectionUtils.isEmpty(stockRecords)
+ && qualityInspect.getQualifiedQuantity() != null
+ && qualityInspect.getQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0) {
+ stockUtils.addStockWithBatchNo(
+ product.getProductModelId(),
+ qualityInspect.getQualifiedQuantity(),
+ StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode(),
+ qualityInspect.getId(),
+ null,
+ purchaseInspectTime == null ? null : purchaseInspectTime.plusDays(1)
+ );
+ stockRecords = findQualityStockRecords(qualityInspect.getId(), product.getProductModelId());
+ }
+
+ StockInRecord targetStockRecord = findLatestUnapprovedStockRecord(stockRecords);
+ if (targetStockRecord == null) {
+ return false;
+ }
+
+ LocalDateTime qualityStockCreateTime = resolveQualityStockCreateTime(qualityInspect);
+ if (qualityStockCreateTime != null && (targetStockRecord.getCreateTime() == null
+ || !qualityStockCreateTime.equals(targetStockRecord.getCreateTime()))) {
+ targetStockRecord.setCreateTime(qualityStockCreateTime);
+ stockInRecordService.updateById(targetStockRecord);
+ }
+
+ approveStockRecords(Collections.singletonList(targetStockRecord));
+ stockRecords = findQualityStockRecords(qualityInspect.getId(), product.getProductModelId());
+ return hasApprovedStockRecord(stockRecords);
+ }
+
+ private boolean processPurchaseDirectProduct(PurchaseLedger purchaseLedger, SalesLedgerProduct product) {
+ if (purchaseLedger == null || product == null || product.getProductModelId() == null) {
+ return false;
+ }
+ if (product.getQuantity() == null) {
+ return false;
+ }
+ if (!StringUtils.hasText(purchaseLedger.getPurchaseContractNumber())) {
+ return false;
+ }
+
+ LocalDateTime stockCreateTime = toStartOfDayPlusDays(purchaseLedger.getEntryDate(), 1);
+
+ List<StockInRecord> stockRecords = findDirectStockRecords(purchaseLedger.getId(), purchaseLedger.getPurchaseContractNumber(), product.getProductModelId(), product.getId());
+ if (hasApprovedStockRecord(stockRecords)) {
+ return true;
+ }
+
+ if (CollectionUtils.isEmpty(stockRecords)) {
+ stockUtils.addStockWithBatchNo(
+ product.getProductModelId(),
+ product.getQuantity(),
+ StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
+ purchaseLedger.getId(),
+ purchaseLedger.getPurchaseContractNumber() + "-" + product.getId(),
+ stockCreateTime
+ );
+ stockRecords = findDirectStockRecords(purchaseLedger.getId(), purchaseLedger.getPurchaseContractNumber(), product.getProductModelId(), product.getId());
+ }
+
+ if (CollectionUtils.isEmpty(stockRecords)) {
+ return false;
+ }
+
+ StockInRecord targetStockRecord = findLatestUnapprovedStockRecord(stockRecords);
+ if (targetStockRecord == null) {
+ return false;
+ }
+
+ if (stockCreateTime != null && (targetStockRecord.getCreateTime() == null
+ || !stockCreateTime.equals(targetStockRecord.getCreateTime()))) {
+ targetStockRecord.setCreateTime(stockCreateTime);
+ stockInRecordService.updateById(targetStockRecord);
+ }
+
+ approveStockRecords(Collections.singletonList(targetStockRecord));
+ stockRecords = findDirectStockRecords(purchaseLedger.getId(), purchaseLedger.getPurchaseContractNumber(), product.getProductModelId(), product.getId());
+ return hasApprovedStockRecord(stockRecords);
+ }
+
+ private LocalDateTime toStartOfDayPlusDays(Date date, int days) {
+ if (date == null) {
+ return null;
+ }
+ return DateUtils.toLocalDate(date).plusDays(days).atStartOfDay();
+ }
+
+ private LocalDateTime resolveQualityStockCreateTime(QualityInspect qualityInspect) {
+ if (qualityInspect == null || qualityInspect.getCheckTime() == null) {
+ return null;
+ }
+ return DateUtils.toLocalDate(qualityInspect.getCheckTime()).plusDays(1).atStartOfDay();
+ }
+
+ private QualityInspect findLatestPurchaseQualityInspect(Long purchaseLedgerId, Long productModelId) {
+ if (purchaseLedgerId == null || productModelId == null) {
+ return null;
+ }
+ return qualityInspectMapper.selectOne(
+ Wrappers.<QualityInspect>lambdaQuery()
+ .eq(QualityInspect::getInspectType, 0)
+ .eq(QualityInspect::getPurchaseLedgerId, purchaseLedgerId)
+ .eq(QualityInspect::getProductModelId, productModelId)
+ .orderByDesc(QualityInspect::getId)
+ .last("limit 1")
+ );
+ }
+
+ private List<StockInRecord> findQualityStockRecords(Long qualityInspectId, Long productModelId) {
+ if (qualityInspectId == null || productModelId == null) {
+ return Collections.emptyList();
+ }
+ return stockInRecordService.list(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordType, StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())
+ .eq(StockInRecord::getRecordId, qualityInspectId)
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .orderByDesc(StockInRecord::getId)
+ );
+ }
+
+ private List<StockInRecord> findDirectStockRecords(Long purchaseLedgerId, String purchaseContractNumber, Long productModelId, Long purchaseProductId) {
+ if (purchaseLedgerId == null || productModelId == null || purchaseProductId == null || !StringUtils.hasText(purchaseContractNumber)) {
+ return Collections.emptyList();
+ }
+ String batchNo = purchaseContractNumber + "-" + purchaseProductId;
+ return stockInRecordService.list(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordType, StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode())
+ .eq(StockInRecord::getRecordId, purchaseLedgerId)
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .eq(StockInRecord::getBatchNo, batchNo)
+ .orderByDesc(StockInRecord::getId)
+ );
+ }
+
+ private boolean hasApprovedStockRecord(List<StockInRecord> stockRecords) {
+ return stockRecords != null && stockRecords.stream()
+ .anyMatch(item -> ReviewStatusEnum.APPROVED.getCode().equals(item.getApprovalStatus()));
+ }
+
+ private StockInRecord findLatestUnapprovedStockRecord(List<StockInRecord> stockRecords) {
+ if (CollectionUtils.isEmpty(stockRecords)) {
+ return null;
+ }
+ return stockRecords.stream()
+ .filter(item -> !ReviewStatusEnum.APPROVED.getCode().equals(item.getApprovalStatus()))
+ .findFirst()
+ .orElse(null);
+ }
+
+ private void approveStockRecords(List<StockInRecord> stockRecords) {
+ if (CollectionUtils.isEmpty(stockRecords)) {
+ return;
+ }
+ List<Long> rejectedIds = stockRecords.stream()
+ .filter(item -> ReviewStatusEnum.REJECTED.getCode().equals(item.getApprovalStatus()))
+ .map(StockInRecord::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ if (!rejectedIds.isEmpty()) {
+ stockInRecordService.batchReAudit(rejectedIds);
+ }
+
+ List<Long> pendingIds = stockRecords.stream()
+ .filter(item -> item.getApprovalStatus() == null
+ || ReviewStatusEnum.PENDING_REVIEW.getCode().equals(item.getApprovalStatus())
+ || ReviewStatusEnum.REJECTED.getCode().equals(item.getApprovalStatus()))
+ .map(StockInRecord::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ if (!pendingIds.isEmpty()) {
+ stockInRecordService.batchApprove(pendingIds, ReviewStatusEnum.APPROVED.getCode());
}
}
@@ -292,9 +693,6 @@
LocalDateTime localDateTime = entryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
salesLedgerProduct.setRegisterDate(localDateTime);
- salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity());
- salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxInclusiveTotalPrice());
- salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice());
salesLedgerProductMapper.insert(salesLedgerProduct);
}
}
@@ -342,18 +740,6 @@
queryWrapper.in(SalesLedgerProduct::getSalesLedgerId, ids)
.eq(SalesLedgerProduct::getType, 2);
salesLedgerProductMapper.delete(queryWrapper);
- // 鎵归噺鍒犻櫎鍏宠仈鐨勯噰璐彴璐︾殑鏉ョエ鐧昏
- LambdaQueryWrapper<TicketRegistration> ticketRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>();
- ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getPurchaseLedgerId,ids);
- ticketRegistrationMapper.delete(ticketRegistrationLambdaQueryWrapper);
- // 鎵归噺鍒犻櫎鍏宠仈鐨勯噰璐彴璐︾殑鏉ョエ鐧昏璁板綍
- LambdaQueryWrapper<ProductRecord> productRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
- productRecordLambdaQueryWrapper.in(ProductRecord::getPurchaseLedgerId,ids);
- productRecordMapper.delete(productRecordLambdaQueryWrapper);
- // 鎵归噺鍒犻櫎浠樻鐧昏
- LambdaQueryWrapper<PaymentRegistration> paymentRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>();
- paymentRegistrationLambdaQueryWrapper.in(PaymentRegistration::getPurchaseLedgerId, ids);
- paymentRegistrationMapper.delete(paymentRegistrationLambdaQueryWrapper);
//鎵归噺鍒犻櫎妫�楠屾爣鍑�
LambdaQueryWrapper<QualityInspect> materialInspectLambdaQueryWrapper = new LambdaQueryWrapper<>();
materialInspectLambdaQueryWrapper.in(QualityInspect::getPurchaseLedgerId, ids);
@@ -377,13 +763,30 @@
for (Long id : ids) {
PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id);
if(purchaseLedger != null){
- ApproveProcess one = approveProcessService.getOne(new LambdaQueryWrapper<ApproveProcess>()
+ List<ApprovalInstance> approvalInstances = approvalInstanceService.list(new LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getBusinessId, purchaseLedger.getId())
+ .eq(ApprovalInstance::getBusinessType, 5L)
+ .eq(ApprovalInstance::getDeleted, 0));
+ if (CollectionUtils.isNotEmpty(approvalInstances)) {
+ approvalInstanceService.delete(
+ approvalInstances.stream()
+ .map(ApprovalInstance::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList())
+ );
+ }
+
+ List<ApproveProcess> approveProcesses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>()
.eq(ApproveProcess::getApproveType, 5)
.eq(ApproveProcess::getApproveDelete, 0)
- .eq(ApproveProcess::getApproveReason, purchaseLedger.getPurchaseContractNumber())
- .last("limit 1"));
- if (one != null) {
- approveProcessService.delByIds(Collections.singletonList(one.getId()));
+ .eq(ApproveProcess::getApproveReason, purchaseLedger.getPurchaseContractNumber()));
+ if (CollectionUtils.isNotEmpty(approveProcesses)) {
+ approveProcessService.delByIds(
+ approveProcesses.stream()
+ .map(ApproveProcess::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList())
+ );
}
}
}
@@ -456,14 +859,6 @@
queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId())
.eq(SalesLedgerProduct::getType, 2);
List<SalesLedgerProduct> productList = salesLedgerProductMapper.selectList(queryWrapper);
- productList.forEach(product -> {
- product.setFutureTickets(product.getFutureTickets() != null ? product.getFutureTickets() : product.getQuantity());
- product.setFutureTicketsAmount(product.getFutureTicketsAmount() != null ? product.getFutureTicketsAmount() : product.getTaxInclusiveTotalPrice());
- product.setTicketsNum(null);
- product.setTicketsAmount(null);
- product.setTempFutureTickets(product.getFutureTickets());
- product.setTempFutureTicketsAmount(product.getFutureTicketsAmount());
- });
resultDto.setProductData(productList);
return resultDto;
}
@@ -490,44 +885,22 @@
PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id);
BeanUtils.copyProperties(purchaseLedger, purchaseLedgerDto);
-// TicketRegistration ticketRegistration = ticketRegistrationMapper.selectOne(new LambdaQueryWrapper<TicketRegistration>().eq(TicketRegistration::getPurchaseLedgerId, id));
-// if (ticketRegistration != null) {
-// purchaseLedgerDto.setInvoiceNumber(ticketRegistration.getInvoiceNumber());
-// purchaseLedgerDto.setInvoiceAmount(ticketRegistration.getInvoiceAmount());
-// purchaseLedgerDto.setTicketRegistrationId(ticketRegistration.getId());
-// }
return purchaseLedgerDto;
}
@Override
public IPage<PurchaseLedgerDto> selectPurchaseLedgerListPage(IPage ipage, PurchaseLedgerDto purchaseLedger) {
- IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerMapper.selectPurchaseLedgerListPage(ipage, purchaseLedger);
- purchaseLedgerDtoIPage.getRecords().forEach(purchaseLedgerDto -> {
- List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, purchaseLedgerDto.getId()).eq(CommonFile::getType, FileNameType.PURCHASE.getValue()));
- purchaseLedgerDto.setSalesLedgerFiles(commonFiles);
- });
- return purchaseLedgerDtoIPage;
+ return purchaseLedgerMapper.selectPurchaseLedgerListPage(ipage, purchaseLedger);
}
@Override
- public List<InvoiceRegistrationProduct> getProductBySalesNo(Long id) {
- List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(new LambdaQueryWrapper<InvoiceRegistrationProduct>()
- .select(InvoiceRegistrationProduct::getId, InvoiceRegistrationProduct::getProductCategory, InvoiceRegistrationProduct::getSpecificationModel,
- InvoiceRegistrationProduct::getUnit, InvoiceRegistrationProduct::getQuantity)
- .eq(InvoiceRegistrationProduct::getSalesLedgerId, id));
- if (invoiceRegistrationProducts.isEmpty()) {
- return new ArrayList<>();
- }
- return invoiceRegistrationProducts;
- }
-
- @Override
- public String getPurchaseNo() {
+ public String getPurchaseNo(Date entryDate) {
+ LocalDate localDate = entryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 鐢熸垚鏃ユ湡鍓嶇紑锛堜緥濡傦細CG20250405锛�
- String purchaseNo = "CG" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+ String purchaseNo = "CG" + localDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
// 鏋勫缓 Redis Key锛堟寜澶╁垎闅旓級
- String redisKey = "purchase_no:" + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
+ String redisKey = "purchase_no:" + localDate.format(DateTimeFormatter.ISO_LOCAL_DATE);
// 鑾峰彇褰撳墠搴忓彿骞堕�掑锛堝師瀛愭搷浣滐級
Long sequence = redisTemplate.opsForValue().increment(redisKey);
@@ -594,6 +967,7 @@
salesLedger.setContractAmount(salesLedgerProductImportDtos.stream()
.map(PurchaseLedgerProductImportDto::getTaxInclusiveTotalPrice)
.reduce(BigDecimal.ZERO,BigDecimal::add));
+ salesLedger.setNetContractAmount(salesLedger.getContractAmount());
// 閫氳繃閿�鍞崟鍙风粦瀹氶攢鍞�
SalesLedger salesLedger1 = salesLedgerMapper.selectOne(new LambdaQueryWrapper<SalesLedger>()
.eq(SalesLedger::getSalesContractNo, salesLedger.getSalesContractNo())
@@ -625,8 +999,6 @@
salesLedgerProduct.setType(2);
// 璁$畻涓嶅惈绋庢�讳环
salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP));
- salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity());
- salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxExclusiveTotalPrice());
list.stream()
.filter(map -> map.get("productName").equals(salesLedgerProduct.getProductCategory()) && map.get("model").equals(salesLedgerProduct.getSpecificationModel()))
.findFirst()
@@ -637,7 +1009,6 @@
salesLedgerProduct.setRegister(loginUser.getNickName());
salesLedgerProduct.setRegisterDate(LocalDateTime.now());
salesLedgerProduct.setApproveStatus(0);
- salesLedgerProduct.setPendingTicketsTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice());
// 鏄惁璐ㄦ鍒ゆ柇
salesLedgerProduct.setIsChecked(salesLedgerProductImportDto.getIsChecked() == 1);
if(salesLedgerProductImportDto.getIsChecked() == 1){
@@ -646,7 +1017,12 @@
salesLedgerProductMapper.insert(salesLedgerProduct);
}
// 閲囪喘瀹℃牳
- addApproveByPurchase(loginUser,salesLedger);
+ List<SalesLedgerProduct> snapshotProducts = salesLedgerProductMapper.selectList(
+ new LambdaQueryWrapper<SalesLedgerProduct>()
+ .eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId())
+ .eq(SalesLedgerProduct::getType, 2)
+ );
+ addApproveByPurchase(loginUser, salesLedger, snapshotProducts);
}
return AjaxResult.success("瀵煎叆鎴愬姛");
@@ -658,21 +1034,91 @@
@Override
public PurchaseLedgerDto getPurchaseByCode(PurchaseLedgerDto purchaseLedgerDto) {
- // 1. 鏌ヨ涓昏〃
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>()
- .eq(PurchaseLedger::getPurchaseContractNumber, purchaseLedgerDto.getPurchaseContractNumber())
- .last("LIMIT 1"));
- if (purchaseLedger == null) {
- throw new BaseException("閲囪喘鍙拌处涓嶅瓨鍦�");
+ PurchaseLedger purchaseLedger = null;
+ ApprovalInstance approvalSnapshotInstance = null;
+
+ // 1. 浼樺厛鎸夊綋鍓嶅鎵瑰疄渚嬫煡璇㈠揩鐓�
+ if (purchaseLedgerDto.getApprovalInstanceId() != null) {
+ approvalSnapshotInstance = approvalInstanceService.getById(purchaseLedgerDto.getApprovalInstanceId());
+ if (approvalSnapshotInstance != null && approvalSnapshotInstance.getBusinessId() != null) {
+ purchaseLedger = purchaseLedgerMapper.selectById(approvalSnapshotInstance.getBusinessId());
+ }
}
- // 2. 鏌ヨ瀛愯〃
+ // 2. 娌′紶瀹℃壒瀹炰緥ID鏃讹紝閫�鍥炲埌鎸夐噰璐悎鍚屽彿鏌ヨ
+ if (purchaseLedger == null) {
+ purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>()
+ .eq(PurchaseLedger::getPurchaseContractNumber, purchaseLedgerDto.getPurchaseContractNumber())
+ .last("LIMIT 1"));
+ if (purchaseLedger == null) {
+ throw new BaseException("閲囪喘鍙拌处涓嶅瓨鍦�");
+ }
+ }
+
+ // 3. 鏌ヨ褰撳墠閲囪喘鍗曞搴旂殑瀹℃壒蹇収
+ if (approvalSnapshotInstance == null) {
+ approvalSnapshotInstance = approvalInstanceService.getOne(new LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getBusinessId, purchaseLedger.getId())
+ .eq(ApprovalInstance::getBusinessType, 5L)
+ .eq(ApprovalInstance::getDeleted, 0)
+ .orderByDesc(ApprovalInstance::getId)
+ .last("LIMIT 1"));
+ }
+
+ if (approvalSnapshotInstance != null && StringUtils.hasText(approvalSnapshotInstance.getFormConfig())) {
+ try {
+ PurchaseLedgerDto snapshot = JSON.parseObject(approvalSnapshotInstance.getFormConfig(), PurchaseLedgerDto.class);
+ if (snapshot != null) {
+ snapshot.setId(purchaseLedger.getId());
+ if (snapshot.getPurchaseContractNumber() == null) {
+ snapshot.setPurchaseContractNumber(purchaseLedger.getPurchaseContractNumber());
+ }
+ if (snapshot.getSupplierId() == null) {
+ snapshot.setSupplierId(purchaseLedger.getSupplierId());
+ }
+ if (snapshot.getSupplierName() == null) {
+ snapshot.setSupplierName(purchaseLedger.getSupplierName());
+ }
+ if (snapshot.getSalesContractNo() == null) {
+ snapshot.setSalesContractNo(purchaseLedger.getSalesContractNo());
+ }
+ if (snapshot.getSalesContractNoId() == null) {
+ snapshot.setSalesContractNoId(purchaseLedger.getSalesLedgerId());
+ }
+ if (snapshot.getProjectName() == null) {
+ snapshot.setProjectName(purchaseLedger.getProjectName());
+ }
+ if (snapshot.getEntryDate() == null) {
+ snapshot.setEntryDate(purchaseLedger.getEntryDate());
+ }
+ if (snapshot.getExecutionDate() == null) {
+ snapshot.setExecutionDate(purchaseLedger.getExecutionDate());
+ }
+ if (snapshot.getRemarks() == null) {
+ snapshot.setRemarks(purchaseLedger.getRemarks());
+ }
+ if (snapshot.getRecorderId() == null) {
+ snapshot.setRecorderId(purchaseLedger.getRecorderId());
+ }
+ if (snapshot.getRecorderName() == null) {
+ snapshot.setRecorderName(purchaseLedger.getRecorderName());
+ }
+ snapshot.setProductData(snapshot.getProductData() == null ? Collections.emptyList() : snapshot.getProductData());
+ snapshot.setHasChildren(CollectionUtils.isNotEmpty(snapshot.getProductData()));
+ return snapshot;
+ }
+ } catch (Exception e) {
+ log.warn("瑙f瀽閲囪喘瀹℃壒蹇収澶辫触: {}", e.getMessage());
+ }
+ }
+
+ // 4. 鏌ヨ瀛愯〃
LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId())
.eq(SalesLedgerProduct::getType, 2);
List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper);
- // 4. 杞崲 DTO
+ // 5. 杞崲 DTO
PurchaseLedgerDto resultDto = new PurchaseLedgerDto();
BeanUtils.copyProperties(purchaseLedger, resultDto);
if (!products.isEmpty()) {
@@ -682,18 +1128,37 @@
return resultDto;
}
- public void addApproveByPurchase(LoginUser loginUser,PurchaseLedger purchaseLedger) throws Exception {
+ public void addApproveByPurchase(LoginUser loginUser, PurchaseLedger purchaseLedger, List<SalesLedgerProduct> productList) {
if (loginUser == null) {
return;
}
- ApproveProcessVO approveProcessVO = new ApproveProcessVO();
- approveProcessVO.setApproveType(5);
- approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
- approveProcessVO.setApproveReason(purchaseLedger.getPurchaseContractNumber());
- approveProcessVO.setApproveUserIds(purchaseLedger.getApproveUserIds());
- approveProcessVO.setApproveUser(loginUser.getUserId());
- approveProcessVO.setApproveTime(LocalDate.now().toString());
- approveProcessService.addApprove(approveProcessVO);
+ ApprovalTemplate approvalTemplate = approvalTemplateMapper.selectOne(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getBusinessType, 5L)
+ .eq(ApprovalTemplate::getDeleted, 0)
+ .orderByDesc(ApprovalTemplate::getId)
+ .last("LIMIT 1")
+ );
+ if (approvalTemplate == null) {
+ throw new BaseException("璇峰厛閰嶇疆閲囪喘瀹℃壒妯℃澘");
+ }
+
+ ApprovalInstanceDto approvalInstance = new ApprovalInstanceDto();
+ approvalInstance.setTemplateId(approvalTemplate.getId());
+ approvalInstance.setTemplateName(approvalTemplate.getTemplateName());
+ approvalInstance.setBusinessId(purchaseLedger.getId());
+ approvalInstance.setBusinessType(5L);
+ approvalInstance.setCurrentLevel(1);
+ approvalInstance.setApplicantId(loginUser.getUserId());
+ approvalInstance.setTitle(purchaseLedger.getPurchaseContractNumber()+"瀹℃壒");
+ approvalInstance.setApplicantName(loginUser.getNickName());
+ approvalInstance.setApplyTime(LocalDateTime.now());
+ PurchaseLedgerDto snapshot = new PurchaseLedgerDto();
+ BeanUtils.copyProperties(purchaseLedger, snapshot);
+ snapshot.setProductData(productList == null ? Collections.emptyList() : new ArrayList<>(productList));
+ approvalInstance.setFormConfig(JSON.toJSONString(snapshot));
+ approvalInstanceService.add(approvalInstance);
+
}
/**
@@ -717,4 +1182,82 @@
}
return sb.toString();
}
+
+ private static final String PURCHASE_LOCK_PREFIX = "purchase_contract_no:";
+ private static final long PURCHASE_LOCK_WAIT_TIMEOUT = 10;
+ private static final long PURCHASE_LOCK_EXPIRE_TIME = 30;
+
+ private String generatePurchaseContractNo(Date entryDate) {
+ LocalDate currentDate = entryDate != null ? DateUtils.toLocalDate(entryDate) : LocalDate.now();
+ String datePart = currentDate.format(DateTimeFormatter.BASIC_ISO_DATE);
+ String lockKey = PURCHASE_LOCK_PREFIX + datePart;
+ String lockValue = Thread.currentThread().getId() + "-" + System.nanoTime();
+
+ try {
+ long startWaitTime = System.currentTimeMillis();
+ while (System.currentTimeMillis() - startWaitTime < PURCHASE_LOCK_WAIT_TIMEOUT * 1000) {
+ Boolean locked = redisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, PURCHASE_LOCK_EXPIRE_TIME, TimeUnit.SECONDS);
+ if (Boolean.TRUE.equals(locked)) {
+ break;
+ }
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new RuntimeException("鑾峰彇閿佹椂琚腑鏂�", e);
+ }
+ }
+
+ if (Boolean.FALSE.equals(redisTemplate.hasKey(lockKey))) {
+ throw new RuntimeException("鑾峰彇閲囪喘鍚堝悓缂栧彿鐢熸垚閿佸け璐ワ細瓒呮椂");
+ }
+
+ String prefix = "CG-" + datePart + "-";
+ List<PurchaseLedger> existingList = purchaseLedgerMapper.selectList(
+ new LambdaQueryWrapper<PurchaseLedger>()
+ .likeRight(PurchaseLedger::getPurchaseContractNumber, prefix)
+ .select(PurchaseLedger::getPurchaseContractNumber));
+ List<Integer> existingSequences = existingList.stream()
+ .map(PurchaseLedger::getPurchaseContractNumber)
+ .filter(Objects::nonNull)
+ .map(no -> {
+ int lastDash = no.lastIndexOf('-');
+ if (lastDash >= 0) {
+ try {
+ return Integer.parseInt(no.substring(lastDash + 1));
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+ return 0;
+ })
+ .collect(Collectors.toList());
+ int nextSequence = findFirstMissingSequence(existingSequences);
+
+ return prefix + String.format("%03d", nextSequence);
+ } finally {
+ String luaScript = "if redis.call('GET', KEYS[1]) == ARGV[1] then return redis.call('DEL', KEYS[1]) else return 0 end";
+ redisTemplate.execute(
+ new org.springframework.data.redis.core.script.DefaultRedisScript<>(luaScript, Long.class),
+ Collections.singletonList(lockKey),
+ lockValue
+ );
+ }
+ }
+
+ private int findFirstMissingSequence(List<Integer> sequences) {
+ if (sequences.isEmpty()) {
+ return 1;
+ }
+ sequences.sort(Integer::compareTo);
+ int next = 1;
+ for (int seq : sequences) {
+ if (seq == next) {
+ next++;
+ } else if (seq > next) {
+ break;
+ }
+ }
+ return next;
+ }
}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseReportServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseReportServiceImpl.java
new file mode 100644
index 0000000..676cf46
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseReportServiceImpl.java
@@ -0,0 +1,32 @@
+package com.ruoyi.purchase.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.mapper.AccountStatementMapper;
+import com.ruoyi.purchase.dto.VatDto;
+import com.ruoyi.purchase.service.PurchaseReportService;
+import com.ruoyi.purchase.vo.PurchaseReportVo;
+import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class PurchaseReportServiceImpl implements PurchaseReportService {
+
+ private final SalesLedgerMapper salesLedgerMapper;
+ private final AccountStatementMapper accountStatementMapper;
+
+ @Override
+ public IPage<PurchaseReportVo> list(Page page, String customerName) {
+ return salesLedgerMapper.selectPurchaseReportVoPage(page, customerName);
+ }
+
+ @Override
+ public IPage<VatDto> listVat(Page page, String month) {
+ return accountStatementMapper.selectVatDtoPage(page, month);
+ }
+}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java
index e75e986..dd8fa0f 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java
@@ -1,36 +1,36 @@
package com.ruoyi.purchase.service.impl;
import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.common.enums.SaleEnum;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
+import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
+import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto;
import com.ruoyi.purchase.dto.PurchaseReturnOrderProductsDto;
+import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper;
import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
+import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.purchase.pojo.PurchaseReturnOrderProducts;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import com.ruoyi.purchase.service.PurchaseReturnOrdersService;
import com.ruoyi.purchase.vo.PurchaseReturnDetailsVo;
-import com.ruoyi.purchase.vo.PurchaseReturnOrderVo;
+import com.ruoyi.purchase.vo.PurchaseReturnOrderProductsDetailVo;
+import com.ruoyi.purchase.vo.PurchaseStockInProductVo;
+import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.service.ISalesLedgerService;
+import com.ruoyi.stock.mapper.StockOutRecordMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
/**
* <p>
@@ -47,10 +47,13 @@
private final PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
private final ISalesLedgerService salesLedgerService;
- private final AccountIncomeService accountIncomeService;
+ private final StockUtils stockUtils;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final PurchaseLedgerMapper purchaseLedgerMapper;
+ private final StockOutRecordMapper stockOutRecordMapper;
@Override
- public IPage<PurchaseReturnOrderVo> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) {
+ public IPage<PurchaseReturnOrderHasAllInfoDto> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) {
return purchaseReturnOrdersMapper.listPage(page, purchaseReturnOrderDto);
}
@@ -64,52 +67,40 @@
purchaseReturnOrderProductsDto.setSalesLedgerProductId(purchaseReturnOrderProductsDto.getSalesLedgerProductId());
purchaseReturnOrderProductsDto.setPurchaseReturnOrderId(purchaseReturnOrderDto.getId());
purchaseReturnOrderProductsDto.setReturnQuantity(purchaseReturnOrderProductsDto.getReturnQuantity());
+ purchaseReturnOrderProductsDto.setStockInRecordId(purchaseReturnOrderProductsDto.getStockInRecordId());
// 杩欓噷涓烘柊澧炲洜姝d涓簄ull
purchaseReturnOrderProductsDto.setId(null);
purchaseReturnOrderProductsMapper.insert(purchaseReturnOrderProductsDto);
+ //搴撳瓨闇�瑕佸嚭搴�(閲囪喘閫�璐�,甯︽壒娆″彿)
+ SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(purchaseReturnOrderProductsDto.getSalesLedgerProductId());
+ stockUtils.substractStock(salesLedgerProduct.getProductModelId(), purchaseReturnOrderProductsDto.getReturnQuantity(), StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode(), purchaseReturnOrderProductsDto.getId(), purchaseReturnOrderProductsDto.getBatchNo());
}
}else {
throw new RuntimeException("璇烽�夋嫨閫�璐у晢鍝�");
}
- // 瀵硅储鍔$鐞嗗彴璐︽坊鍔犱竴绗旇繘璐︽敹鍏�.
- AccountIncome accountIncome = new AccountIncome();
- LoginUser loginUser = SecurityUtils.getLoginUser();
- accountIncome.setInputUser(loginUser.getUsername());
- accountIncome.setIncomeMoney(purchaseReturnOrderDto.getTotalAmount());
- accountIncome.setIncomeDate(DateUtils.toDate(purchaseReturnOrderDto.getPreparedAt()));
- accountIncome.setInputTime(DateUtils.toDate(purchaseReturnOrderDto.getPreparedAt()));
- accountIncome.setBusinessId(purchaseReturnOrderDto.getId());
- accountIncome.setBusinessType(1);
- accountIncome.setIncomeType("4");
- accountIncome.setCustomerName(purchaseReturnOrderDto.getSupplierName());
- accountIncome.setIncomeDescribed(purchaseReturnOrderDto.getRemark());
- accountIncome.setIncomeMethod(String.valueOf(purchaseReturnOrderDto.getIncomeType()));
- accountIncomeService.save(accountIncome);
+ // 鏇存柊閲囪喘鍙拌处鐨勫疄闄呭悎鍚岄噾棰�
+ if (purchaseReturnOrderDto.getPurchaseLedgerId() != null && purchaseReturnOrderDto.getTotalAmount() != null) {
+ PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(purchaseReturnOrderDto.getPurchaseLedgerId());
+ if (purchaseLedger != null) {
+ BigDecimal baseAmount = purchaseLedger.getNetContractAmount() != null
+ ? purchaseLedger.getNetContractAmount()
+ : purchaseLedger.getContractAmount();
+ purchaseLedger.setNetContractAmount(baseAmount.subtract(purchaseReturnOrderDto.getTotalAmount()));
+ purchaseLedgerMapper.updateById(purchaseLedger);
+ }
+ }
return true;
}
@Override
public PurchaseReturnDetailsVo getPurchaseReturnOrderDtoById(Long id) {
- PurchaseReturnOrders purchaseReturnOrders = purchaseReturnOrdersMapper.selectById(id);
+ //鏌ヤ富浣�
+ PurchaseReturnOrderHasAllInfoDto purchaseReturnOrders = purchaseReturnOrdersMapper.getPurchaseReturnOrderHasAllInfoById(id);
PurchaseReturnDetailsVo purchaseReturnOrderDto = BeanUtil.copyProperties(purchaseReturnOrders, PurchaseReturnDetailsVo.class);
- // 鏌ヨ鍑轰粬鍏蜂綋瀵瑰簲鐨勯��璐�
- LambdaQueryWrapper<PurchaseReturnOrderProducts> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, purchaseReturnOrders.getId());
-
- List<PurchaseReturnOrderProducts> purchaseReturnOrderProducts = purchaseReturnOrderProductsMapper.selectList(queryWrapper);
- List<PurchaseReturnDetailsVo.PurchaseReturnOrderProductsDetailVo> purchaseReturnOrderProductsDetailVos = BeanUtil.copyToList(purchaseReturnOrderProducts, PurchaseReturnDetailsVo.PurchaseReturnOrderProductsDetailVo.class);
- // 鏌ヨ鍑哄搴旂殑鍟嗗搧淇℃伅
- List<Long> productIds = purchaseReturnOrderProductsDetailVos.stream().map(PurchaseReturnDetailsVo.PurchaseReturnOrderProductsDetailVo::getSalesLedgerProductId).distinct().filter(Objects::nonNull).collect(Collectors.toList());
- List<SalesLedgerProduct> salesLedgerProducts = salesLedgerService.getSalesLedgerProductListByIds(productIds, SaleEnum.PURCHASE);
- Map<Long, SalesLedgerProduct> productmap = salesLedgerProducts.stream().collect(Collectors.toMap(SalesLedgerProduct::getId, product -> product));
- purchaseReturnOrderProductsDetailVos.forEach(purchaseReturnOrderProductsDetailVo -> {
- purchaseReturnOrderProductsDetailVo.setSalesLedgerProduct(productmap.get(purchaseReturnOrderProductsDetailVo.getSalesLedgerProductId()));
- });
-
+ //鏌ユ槑缁�
+ List<PurchaseReturnOrderProductsDetailVo> purchaseReturnOrderProductsDetailVos = purchaseReturnOrdersMapper.getPurchaseReturnOrderProductsDetailById(id);
purchaseReturnOrderDto.setPurchaseReturnOrderProductsDetailVoList(purchaseReturnOrderProductsDetailVos);
-
-
return purchaseReturnOrderDto;
}
@@ -117,15 +108,18 @@
@Transactional
public void deleteById(Long id) {
purchaseReturnOrdersMapper.deleteById(id);
+ List<PurchaseReturnOrderProducts> purchaseReturnOrderProducts = purchaseReturnOrderProductsMapper.selectList(Wrappers.<PurchaseReturnOrderProducts>lambdaQuery().eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, id));
LambdaUpdateWrapper<PurchaseReturnOrderProducts> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, id);
purchaseReturnOrderProductsMapper.delete(updateWrapper);
+ //(閲囪喘閫�璐х殑鏁版嵁闇�瑕佸垹鎺�)
+ purchaseReturnOrderProducts.stream().forEach(purchaseReturnOrderProducts1 -> {
+ stockUtils.deleteStockOutRecord(purchaseReturnOrderProducts1.getId(),StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode());
+ });
+ }
- // 璐㈠姟
- LambdaUpdateWrapper<AccountIncome> updateWrapperAccountIncome = new LambdaUpdateWrapper<>();
- updateWrapperAccountIncome.eq(AccountIncome::getBusinessId, id);
- updateWrapperAccountIncome.eq(AccountIncome::getBusinessType, 1);
- updateWrapperAccountIncome.eq(AccountIncome::getIncomeType, 4);
- accountIncomeService.remove(updateWrapperAccountIncome);
+ @Override
+ public List<PurchaseStockInProductVo> getByPurchaseLedgerId(Long purchaseLedgerId) {
+ return purchaseReturnOrdersMapper.getByPurchaseLedgerId(purchaseLedgerId);
}
}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/TicketRegistrationServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/TicketRegistrationServiceImpl.java
deleted file mode 100644
index a98d924..0000000
--- a/src/main/java/com/ruoyi/purchase/service/impl/TicketRegistrationServiceImpl.java
+++ /dev/null
@@ -1,464 +0,0 @@
-package com.ruoyi.purchase.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.enums.FileNameType;
-import com.ruoyi.common.enums.SalesLedgerType;
-import com.ruoyi.common.exception.base.BaseException;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.other.mapper.TempFileMapper;
-import com.ruoyi.purchase.dto.PaymentRegistrationDto;
-import com.ruoyi.purchase.dto.PurchaseLedgerDto;
-import com.ruoyi.purchase.dto.TicketRegistrationDto;
-import com.ruoyi.purchase.mapper.PaymentRegistrationMapper;
-import com.ruoyi.purchase.mapper.ProductRecordMapper;
-import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
-import com.ruoyi.purchase.mapper.TicketRegistrationMapper;
-import com.ruoyi.purchase.pojo.PaymentRegistration;
-import com.ruoyi.purchase.pojo.ProductRecord;
-import com.ruoyi.purchase.pojo.PurchaseLedger;
-import com.ruoyi.purchase.pojo.TicketRegistration;
-import com.ruoyi.purchase.service.ITicketRegistrationService;
-import com.ruoyi.sales.mapper.CommonFileMapper;
-import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.CommonFile;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import com.ruoyi.sales.service.ISalesLedgerProductService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * 鏉ョエ鐧昏Service涓氬姟灞傚鐞�
- *
- * @author ruoyi
- * @date 2025-05-13
- */
-@Service
-@RequiredArgsConstructor
-@Slf4j
-public class TicketRegistrationServiceImpl extends ServiceImpl<TicketRegistrationMapper, TicketRegistration> implements ITicketRegistrationService {
-
- private final TicketRegistrationMapper ticketRegistrationMapper;
-
- private final PurchaseLedgerMapper purchaseLedgerMapper;
-
- private final SalesLedgerProductMapper salesLedgerProductMapper;
-
- private final CommonFileMapper commonFileMapper;
-
- private final TempFileMapper tempFileMapper;
-
- private final ProductRecordMapper productRecordMapper;
-
- private final ISalesLedgerProductService salesLedgerProductService;
-
- private final PaymentRegistrationMapper paymentRegistrationMapper;
-
-
- @Override
- public List<TicketRegistration> selectTicketRegistrationList(TicketRegistration ticketRegistration) {
- LambdaQueryWrapper<TicketRegistration> queryWrapper = new LambdaQueryWrapper<>();
- if (StringUtils.isNotBlank(ticketRegistration.getPurchaseContractNumber())) {
- queryWrapper.like(TicketRegistration::getPurchaseContractNumber, ticketRegistration.getPurchaseContractNumber())
- .like(TicketRegistration::getSupplierName, ticketRegistration.getSupplierName())
- .eq(TicketRegistration::getIssueDate, ticketRegistration.getIssueDate());
- }
- List<TicketRegistration> ticketRegistrationList = ticketRegistrationMapper.selectList(queryWrapper);
- // 璁$畻宸蹭粯娆鹃噾棰�
- if (CollectionUtils.isNotEmpty(ticketRegistrationList)) {
- List<Long> ids = ticketRegistrationList.stream().map(TicketRegistration::getId).collect(Collectors.toList());
- List<PaymentRegistrationDto> paymentRegistrationDtoList = paymentRegistrationMapper.countPaymentTotalByTicketRegId(ids);
- for (TicketRegistration registration : ticketRegistrationList) {
- BigDecimal paymentAmountTotal = BigDecimal.ZERO;
- for (PaymentRegistrationDto paymentRegistrationDto : paymentRegistrationDtoList) {
- if (registration.getId().equals(paymentRegistrationDto.getTicketRegistrationId())) {
- paymentAmountTotal = paymentRegistrationDto.getPaymentAmountTotal();
- break;
- }
- }
- BigDecimal invoiceAmount = registration.getInvoiceAmount();
- BigDecimal subtractAmount = invoiceAmount.subtract(paymentAmountTotal);
- registration.setPaymentAmountTotal(paymentAmountTotal);
- registration.setUnPaymentAmountTotal(subtractAmount);
- }
- }
-
- return ticketRegistrationList;
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public int addOrUpdateRegistration(TicketRegistrationDto ticketRegistrationDto) throws IOException {
- // 1. 鏌ヨ閲囪喘鍙拌处璁板綍
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(ticketRegistrationDto.getPurchaseLedgerId());
- if (purchaseLedger == null) {
- // 澶勭悊閲囪喘鍙拌处涓嶅瓨鍦ㄧ殑鎯呭喌锛屼緥濡傛姏鍑哄紓甯告垨杩斿洖閿欒
- throw new IllegalArgumentException("閲囪喘鍙拌处璁板綍涓嶅瓨鍦紝ID: " + ticketRegistrationDto.getPurchaseLedgerId());
- }
-
-
-
- // 3. 鍒涘缓鎴栨洿鏂扮エ鎹櫥璁板疄浣�
- TicketRegistration ticketRegistration = new TicketRegistration();
- BeanUtils.copyProperties(ticketRegistrationDto, ticketRegistration);
- ticketRegistration.setPurchaseContractNumber(purchaseLedger.getPurchaseContractNumber());
- ticketRegistration.setTenantId(purchaseLedger.getTenantId());
- ticketRegistration.setIssueDate(ticketRegistrationDto.getEntryDate());
- ticketRegistration.setContractAmount(purchaseLedger.getContractAmount());
- ticketRegistration.setSalesLedgerId(purchaseLedger.getSalesLedgerId());
- ticketRegistration.setEnterDate(ticketRegistrationDto.getEnterDate());
-
- // 4. 澶勭悊瀛愯〃鏁版嵁
- List<SalesLedgerProduct> productData = ticketRegistrationDto.getProductData();
- if (CollectionUtils.isNotEmpty(productData)) {
- handleSalesLedgerProducts(purchaseLedger.getId(), productData, 2);
- }
-
- // 5. 鎵ц鎻掑叆鎴栨洿鏂版搷浣�
- int rowsAffected = ticketRegistrationMapper.insert(ticketRegistration);
-
- // 6. 澧炲姞閲囪喘鍙拌处浜у搧寮�绁ㄨ褰�
- List<SalesLedgerProduct> salesLedgerProducts = ticketRegistrationDto.getProductData();
- if (CollectionUtils.isNotEmpty(salesLedgerProducts)) {
- int insert = 0 ;
- for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) {
- //鎺掗櫎鎺夊紑绁ㄤ负0鐨勬暟鎹�
- if (salesLedgerProduct.getTicketsNum() != null && salesLedgerProduct.getTicketsNum().compareTo(BigDecimal.ZERO) > 0) {
- ProductRecord productRecord = new ProductRecord();
-
- productRecord.setTicketRegistrationId(ticketRegistration.getId());
- productRecord.setPurchaseLedgerId(ticketRegistrationDto.getPurchaseLedgerId());
- productRecord.setCreatedAt(DateUtils.getNowDate());
- BeanUtils.copyProperties(salesLedgerProduct, productRecord);
- //鍚屾鏇存柊鍏朵粬鍓╀綑鏁伴噺鍜岄噾棰�
- productRecordMapper.update(
- null,
- new LambdaUpdateWrapper<ProductRecord>()
- .eq(ProductRecord::getPurchaseLedgerId, ticketRegistrationDto.getPurchaseLedgerId())
- .set(ProductRecord::getFutureTickets, salesLedgerProduct.getFutureTickets())
- .set(ProductRecord::getFutureTicketsAmount, salesLedgerProduct.getFutureTicketsAmount())
- );
- productRecord.setSaleLedgerProjectId(salesLedgerProduct.getId());
- productRecord.setId(null);
- productRecord.setType("2");
- insert += productRecordMapper.insert(productRecord);
- }
- }
- if (insert <= 0) {
- throw new RuntimeException("浜у搧寮�绁ㄦ暟閮戒负0锛岃妫�鏌�");
- }
- }
- return rowsAffected;
- }
-
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public int delRegistration(Long[] ids) {
-
- // 鏌ヨ瑕佸垹闄ょ殑浜у搧鏉ョエ璁板綍
- LambdaQueryWrapper<ProductRecord> productWrapper = new LambdaQueryWrapper<>();
- productWrapper.in(ProductRecord::getId, Arrays.asList(ids));
- List<ProductRecord> productRecords = productRecordMapper.selectList(productWrapper);
-
- if (CollectionUtils.isEmpty(productRecords)) {
- return 0;
- }
-
- // 鏀堕泦鍏宠仈ID
- Set<Long> ticketRegistrationIds = productRecords.stream()
- .map(ProductRecord::getTicketRegistrationId)
- .collect(Collectors.toSet());
-
- Set<Long> salesLedgerProductIds = productRecords.stream()
- .map(ProductRecord::getSaleLedgerProjectId)
- .collect(Collectors.toSet());
-
- // 鏌ヨ鏉ョエ鐧昏
- List<TicketRegistration> ticketRegistrations =
- ticketRegistrationMapper.selectBatchIds(ticketRegistrationIds);
-
- // 澶勭悊鏉ョエ鐧昏閲戦銆佷粯娆炬祦姘�
- for (TicketRegistration ticket : ticketRegistrations) {
-
- // 璇ユ潵绁ㄧ櫥璁颁笅鎵�鏈変骇鍝佽褰�
- List<ProductRecord> recordsOfTicket = productRecords.stream()
- .filter(r -> r.getTicketRegistrationId().equals(ticket.getId()))
- .collect(Collectors.toList());
-
- // 璁$畻瑕佸洖閫�鐨勯噾棰�
- BigDecimal rollbackAmount = recordsOfTicket.stream()
- .map(ProductRecord::getTicketsAmount)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- BigDecimal remain = ticket.getInvoiceAmount().subtract(rollbackAmount);
-
- if (remain.compareTo(BigDecimal.ZERO) <= 0) {
- // 鍒犻櫎鏉ョエ鐧昏
- ticketRegistrationMapper.deleteById(ticket.getId());
- // 鍒犻櫎浠樻娴佹按
- paymentRegistrationMapper.delete(
- new LambdaQueryWrapper<PaymentRegistration>()
- .eq(PaymentRegistration::getTicketRegistrationId, ticket.getId())
- );
- } else {
- ticket.setInvoiceAmount(remain);
- ticketRegistrationMapper.updateById(ticket);
- }
- }
-
- // 鍥為��閿�鍞彴璐︿骇鍝佺殑鏈潵绁�
- for (ProductRecord record : productRecords) {
-
- LambdaQueryWrapper<SalesLedgerProduct> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(SalesLedgerProduct::getId, record.getSaleLedgerProjectId())
- .eq(SalesLedgerProduct::getType, 2);
-
- SalesLedgerProduct product = salesLedgerProductMapper.selectOne(wrapper);
- if (product != null) {
- product.setFutureTickets(
- product.getFutureTickets().add(record.getTicketsNum())
- );
- product.setFutureTicketsAmount(
- product.getFutureTicketsAmount().add(record.getTicketsAmount())
- );
- salesLedgerProductMapper.updateById(product);
- }
- }
-
- // 鍒犻櫎浜у搧鏉ョエ璁板綍
- productRecordMapper.delete(productWrapper);
-
- // 閲嶆柊璁$畻 currentInvoiceAmount
- for (Long productId : salesLedgerProductIds) {
- refreshCurrentInvoiceAmount(productId);
- }
-
- return 1;
- }
-
- private void refreshCurrentInvoiceAmount(Long salesLedgerProductId) {
-
- // 鏌ヨ璇ヤ骇鍝佹渶鏂颁竴鏉℃潵绁ㄨ褰�
- LambdaQueryWrapper<ProductRecord> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(ProductRecord::getSaleLedgerProjectId, salesLedgerProductId)
- .orderByDesc(ProductRecord::getCreatedAt)
- .last("limit 1");
-
- ProductRecord latestRecord = productRecordMapper.selectOne(wrapper);
-
- SalesLedgerProduct product =
- salesLedgerProductMapper.selectById(salesLedgerProductId);
-
- if (product == null) {
- return;
- }
-
- if (latestRecord == null) {
- // 娌℃湁浠讳綍鏉ョエ璁板綍
- product.setTicketsAmount(BigDecimal.ZERO);
- } else {
- // 姘歌繙鍙栨渶鏂颁竴鏉�
- product.setTicketsAmount(latestRecord.getTicketsAmount());
- }
-
- salesLedgerProductMapper.updateById(product);
- }
-
-
- @Override
- public TicketRegistrationDto getRegistrationById(TicketRegistrationDto ticketRegistrationDto) {
- TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(ticketRegistrationDto.getId());
- LambdaQueryWrapper<PurchaseLedger> purchaseQueryWrapper = new LambdaQueryWrapper<>();
- purchaseQueryWrapper.eq(PurchaseLedger::getId, ticketRegistration.getPurchaseLedgerId());
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(purchaseQueryWrapper);
- if (ticketRegistration == null) {
- throw new BaseException("閲囪喘鍙拌处涓嶅瓨鍦�");
- }
- // 鍒涘缓骞跺~鍏匘TO
- TicketRegistrationDto resultDto = new TicketRegistrationDto();
- BeanUtils.copyProperties(ticketRegistration, resultDto);
-
- // 鏌ヨ骞惰缃叧鑱斾骇鍝�
- LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId())
- .eq(SalesLedgerProduct::getType, 2);
- List<SalesLedgerProduct> productList = salesLedgerProductMapper.selectList(queryWrapper);
- resultDto.setProductData(productList);
- return resultDto;
- }
-
- @Override
- public List getTicketNo(TicketRegistrationDto ticketRegistrationDto) {
- LambdaQueryWrapper<TicketRegistration> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.select(TicketRegistration::getId, TicketRegistration::getInvoiceNumber, TicketRegistration::getInvoiceAmount)
- .eq(TicketRegistration::getPurchaseLedgerId, ticketRegistrationDto.getId());
- List<Map<String, Object>> result = ticketRegistrationMapper.selectMaps(queryWrapper);
- // 灏嗕笅鍒掔嚎鍛藉悕杞崲涓洪┘宄板懡鍚�
- return result.stream().map(map -> map.entrySet().stream()
- .collect(Collectors.toMap(
- entry -> underlineToCamel(entry.getKey()),
- Map.Entry::getValue))
- ).collect(Collectors.toList());
- }
-
- @Override
- public IPage<TicketRegistration> selectTicketRegistrationListPage(Page page, TicketRegistration ticketRegistration) {
- LambdaQueryWrapper<TicketRegistration> queryWrapper = new LambdaQueryWrapper<>();
- if (StringUtils.isNotBlank(ticketRegistration.getSupplierNameOrContractNo())) {
- queryWrapper.and(wrapper -> wrapper
- .like(TicketRegistration::getPurchaseContractNumber, ticketRegistration.getSupplierNameOrContractNo())
- .or()
- .like(TicketRegistration::getSupplierName, ticketRegistration.getSupplierNameOrContractNo())
- .or()
- .like(TicketRegistration::getSalesContractNo, ticketRegistration.getSupplierNameOrContractNo()));
- }
- if (!ObjectUtils.isEmpty(ticketRegistration.getIssueDateStart()) && !ObjectUtils.isEmpty(ticketRegistration.getIssueDateEnd())) {
- queryWrapper.between(TicketRegistration::getIssueDate, LocalDate.parse(ticketRegistration.getIssueDateStart(), DateTimeFormatter.ofPattern("yyyy-MM-dd")), LocalDate.parse(ticketRegistration.getIssueDateEnd(), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
- }
- IPage<TicketRegistration> ticketRegistrationIPage = ticketRegistrationMapper.selectPage(page, queryWrapper);
- // 璁$畻宸蹭粯娆鹃噾棰�
- if (CollectionUtils.isNotEmpty(ticketRegistrationIPage.getRecords())) {
- List<Long> ids = ticketRegistrationIPage.getRecords().stream().map(TicketRegistration::getId).collect(Collectors.toList());
- List<PaymentRegistrationDto> paymentRegistrationDtoList = paymentRegistrationMapper.countPaymentTotalByTicketRegId(ids);
- for (TicketRegistration registration : ticketRegistrationIPage.getRecords()) {
- BigDecimal paymentAmountTotal = BigDecimal.ZERO;
- for (PaymentRegistrationDto paymentRegistrationDto : paymentRegistrationDtoList) {
- if (registration.getId().equals(paymentRegistrationDto.getTicketRegistrationId())) {
- paymentAmountTotal = paymentRegistrationDto.getPaymentAmountTotal();
- break;
- }
- }
- BigDecimal invoiceAmount = registration.getInvoiceAmount();
- BigDecimal subtractAmount = invoiceAmount.subtract(paymentAmountTotal);
- registration.setPaymentAmountTotal(paymentAmountTotal);
- registration.setUnPaymentAmountTotal(subtractAmount);
- }
- }
- if (!ObjectUtils.isEmpty(ticketRegistration.getStatus())) {
-
- if (ticketRegistration.getStatus()) {
- ticketRegistrationIPage.getRecords().removeIf(receiptPaymentDto1 -> new BigDecimal("0.00").equals(receiptPaymentDto1.getUnPaymentAmountTotal()));
- ticketRegistrationIPage.setTotal(ticketRegistrationIPage.getRecords().size());
- }
- }
- ticketRegistrationIPage.getRecords().forEach(item -> {
- // 宸蹭粯娆鹃噾棰� == 寰呬粯娆鹃噾棰�
- item.setStatusName(item.getPaymentAmountTotal().compareTo(item.getInvoiceAmount()) == 0 ? "宸插畬鎴愪粯娆�" : "鏈畬鎴愪粯娆�");
- });
- return ticketRegistrationIPage;
- }
-
- @Override
- public PurchaseLedgerDto getPuargeById(Long id) {
- PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id);
- PurchaseLedgerDto purchaseLedgerDto = new PurchaseLedgerDto();
- BeanUtils.copyProperties(purchaseLedger, purchaseLedgerDto);
- SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct();
- salesLedgerProduct.setSalesLedgerId(id);
- salesLedgerProduct.setType(SalesLedgerType.SALES_LEDGER_TYPE_SALES_LEDGER.getCode());
- List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct);
- purchaseLedgerDto.setProductData(salesLedgerProducts);
- List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>()
- .eq(CommonFile::getType, FileNameType.PURCHASELEDGER.getValue())
- .eq(CommonFile::getCommonId, id));
- purchaseLedgerDto.setSalesLedgerFiles(commonFiles);
- return purchaseLedgerDto;
- }
-
- @Override
- public List<PaymentRegistrationDto> getPaymentRegistrationDtoById(Long id) {
- List<PaymentRegistrationDto> paymentRegistrationDtos =purchaseLedgerMapper.getPaymentRegistrationDtoById(id);
- return paymentRegistrationDtos;
- }
-
- private void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, Integer type) {
- if (products == null || products.isEmpty()) {
- return;
- }
-
- // 杩囨护鍑烘湁 ID 鐨勮褰曪紙鍗抽渶瑕佹洿鏂扮殑璁板綍锛�
- List<SalesLedgerProduct> updateList = products.stream()
- .filter(p -> p.getId() != null)
- .peek(p -> {
- p.setSalesLedgerId(salesLedgerId);
- p.setType(type);
- })
- .collect(Collectors.toList());
-
- // 鎵归噺鏇存柊锛堥渶瑕� MyBatis 鎻愪緵鎵归噺鏇存柊鏂规硶锛�
- if (!updateList.isEmpty()) {
- updateList.forEach(product -> {
- // 闈炵┖鏍¢獙锛屼换涓�瀛楁涓虹┖鍒欐姏鍑哄紓甯�
- if (product.getQuantity() == null) {
- throw new BaseException("鏁伴噺涓嶈兘涓虹┖");
- }
- if (product.getTicketsNum() == null) {
- throw new BaseException("宸插紑绁ㄦ暟閲忎笉鑳戒负绌�");
- }
- if (product.getTaxInclusiveTotalPrice() == null) {
- throw new BaseException("鍚◣鎬讳环涓嶈兘涓虹┖");
- }
- if (product.getTicketsAmount() == null) {
- throw new BaseException("鏈鏉ョエ閲戦(鍏�)涓嶈兘涓虹┖");
- }
-
- // 璁$畻 futureTickets锛堢洿鎺ヤ娇鐢� BigDecimal 璁$畻锛岄伩鍏嶇簿搴︿涪澶憋級
-// product.setFutureTickets(
-// product.getQuantity()
-// .subtract(product.getTicketsNum())
-// );
-
-
- // 璁$畻 futureTicketsAmount
-// product.setFutureTicketsAmount(
-// product.getTaxInclusiveTotalPrice()
-// .subtract(product.getTicketsAmount())
-// );
- product.setType(type);
- salesLedgerProductMapper.updateById(product);
- });
- }
- }
-
- /**
- * 涓嬪垝绾垮懡鍚嶈浆椹煎嘲鍛藉悕
- */
- private String underlineToCamel(String param) {
- if (param == null || "".equals(param.trim())) {
- return "";
- }
- int len = param.length();
- StringBuilder sb = new StringBuilder(len);
- for (int i = 0; i < len; i++) {
- char c = param.charAt(i);
- if (c == '_') {
- if (++i < len) {
- sb.append(Character.toUpperCase(param.charAt(i)));
- }
- } else {
- sb.append(Character.toLowerCase(c));
- }
- }
- return sb.toString();
- }
-}
diff --git a/src/main/java/com/ruoyi/purchase/vo/PurchaseReportVo.java b/src/main/java/com/ruoyi/purchase/vo/PurchaseReportVo.java
new file mode 100644
index 0000000..afe7f98
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/vo/PurchaseReportVo.java
@@ -0,0 +1,44 @@
+package com.ruoyi.purchase.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@Schema(name = "PurchaseReportVo", description = "绠$悊椹鹃┒鑸�--椤圭洰鍒╂鼎鍙傛暟")
+@ExcelIgnoreUnannotated
+public class PurchaseReportVo {
+
+ @Schema(description = "閿�鍞悎鍚屽彿")
+ @Excel(name = "閿�鍞悎鍚屽彿")
+ private String customerContractNo;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ @Excel(name = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "椤圭洰鍚嶇О")
+ @Excel(name = "椤圭洰鍚嶇О")
+ private String projectName;
+
+ @Excel(name = "鍚堝悓閲戦")
+ @Schema(description = "鍚堝悓閲戦")
+ private BigDecimal contractAmount;
+
+ @Excel(name = "閲囪喘閲戦")
+ @Schema(description = "閲囪喘閲戦")
+ private BigDecimal purchaseAmount;
+
+ @Schema(description = "鍒╂鼎")
+ @Excel(name = "鍒╂鼎")
+ private BigDecimal balance;
+
+ @Schema(description = "鍒╂鼎鐜�")
+ @Excel(name = "鍒╂鼎鐜�")
+ private BigDecimal balanceRatio;
+
+
+}
diff --git a/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnDetailsVo.java b/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnDetailsVo.java
index 02317e6..6496b4a 100644
--- a/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnDetailsVo.java
+++ b/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnDetailsVo.java
@@ -1,14 +1,12 @@
package com.ruoyi.purchase.vo;
-import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -20,19 +18,8 @@
@Data
@AllArgsConstructor
@NoArgsConstructor
-public class PurchaseReturnDetailsVo extends PurchaseReturnOrders implements Serializable {
+public class PurchaseReturnDetailsVo extends PurchaseReturnOrderHasAllInfoDto implements Serializable {
private List<PurchaseReturnOrderProductsDetailVo> purchaseReturnOrderProductsDetailVoList;
- @Data
- @AllArgsConstructor
- @NoArgsConstructor
- public static class PurchaseReturnOrderProductsDetailVo implements Serializable {
- private Long id;
- private BigDecimal returnQuantity;
- private Long salesLedgerProductId;
- private Long purchaseReturnOrderId;
-
- private SalesLedgerProduct salesLedgerProduct;
- }
}
diff --git a/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderProductsDetailVo.java b/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderProductsDetailVo.java
new file mode 100644
index 0000000..e50d5d0
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderProductsDetailVo.java
@@ -0,0 +1,65 @@
+package com.ruoyi.purchase.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PurchaseReturnOrderProductsDetailVo {
+
+ @Schema(description = "閫�璐ф槑缁唅d")
+ private Long id;
+
+ @Schema(description = "閿�鍞彴璐︾殑浜у搧id")
+ private Long salesLedgerProductId;
+
+ @Schema(description = "浜у搧瑙勬牸id")
+ private Long productModelId;
+
+ @Schema(description = "浜у搧澶х被")
+ private String productCategory;
+
+ @Schema(description = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ @Schema(description = "鍗曚綅")
+ private String unit;
+
+ @Schema(description = "鍏ュ簱鍗曞彿")
+ private String inboundBatches;
+
+ @Schema(description = "鍏ュ簱鏁伴噺")
+ private BigDecimal stockInNum;
+
+ @Schema(description = "鎵规鍙�")
+ private String batchNo;
+
+ @Schema(description = "鏈��璐ф暟")
+ private BigDecimal unQuantity;
+
+ @Schema(description = "宸查��璐ф暟閲�")
+ private BigDecimal totalReturnNum;
+
+ @Schema(description = "閿�鍞彂璐ф暟閲�")
+ private BigDecimal saleOutQuantity;
+
+ @Schema(description = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ @Schema(description = "閫�璐ф暟閲�")
+ private BigDecimal returnQuantity;
+
+ @Schema(description = "閫�璐у崟id")
+ private Long purchaseReturnOrderId;
+
+ @Schema(description = "鏄惁璐ㄦ")
+ private Boolean isChecked;
+
+}
diff --git a/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderVo.java b/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderVo.java
deleted file mode 100644
index fb02943..0000000
--- a/src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderVo.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.ruoyi.purchase.vo;
-
-import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class PurchaseReturnOrderVo extends PurchaseReturnOrders {
- //渚涘簲鍟嗗悕绉�
- private String supplierName;
-
- // 閲囪喘鍚堝悓鍙�
- private String purchaseContractNumber;
-
- //閫�鏂欎汉濮撳悕
- private String returnUserName;
-
- //鍒跺崟浜哄鍚�
- private String createUserName;
-}
diff --git a/src/main/java/com/ruoyi/purchase/vo/PurchaseStockInProductVo.java b/src/main/java/com/ruoyi/purchase/vo/PurchaseStockInProductVo.java
new file mode 100644
index 0000000..ff7754e
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/vo/PurchaseStockInProductVo.java
@@ -0,0 +1,53 @@
+package com.ruoyi.purchase.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@Schema(name = "PurchaseStockInProductVo", description = "閲囪喘绠$悊--閲囪喘璁㈠崟涓嬪叆搴撲骇鍝佸垪琛�")
+public class PurchaseStockInProductVo {
+
+ @Schema(description = "鍏ュ簱鍗昳d")
+ private Long id;
+
+ @Schema(description = "閿�鍞彴璐︾殑浜у搧id")
+ private Long salesLedgerProductId;
+
+ @Schema(description = "浜у搧瑙勬牸id")
+ private Long productModelId;
+
+ @Schema(description = "浜у搧澶х被")
+ private String productCategory;
+
+ @Schema(description = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ @Schema(description = "鍗曚綅")
+ private String unit;
+
+ @Schema(description = "鍏ュ簱鍗曞彿")
+ private String inboundBatches;
+
+ @Schema(description = "鍏ュ簱鏁伴噺")
+ private BigDecimal stockInNum;
+
+ @Schema(description = "鎵规鍙�")
+ private String batchNo;
+
+ @Schema(description = "鍙��璐ф暟")
+ private BigDecimal unQuantity;
+
+ @Schema(description = "閫�璐ф�绘暟")
+ private BigDecimal totalReturnNum;
+
+ @Schema(description = "閿�鍞彂璐ф暟閲�")
+ private BigDecimal saleOutQuantity;
+
+ @Schema(description = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ @Schema(description = "鏄惁璐ㄦ")
+ private Boolean isChecked;
+}
diff --git a/src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsDetailsVo.java b/src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsDetailsVo.java
new file mode 100644
index 0000000..5cf592d
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsDetailsVo.java
@@ -0,0 +1,36 @@
+package com.ruoyi.purchase.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@Schema(name = "SupplierTransactionsDetailsVo", description = "閲囪喘绠$悊--渚涘簲鍟嗗線鏉ユ槑缁�(杩斿洖)")
+public class SupplierTransactionsDetailsVo {
+
+ @Schema(description = "閲囪喘鍗旾D")
+ private Long purchaseLedgerId;
+
+ @Schema(description = "閲囪喘鍚堝悓鍙�")
+ private String purchaseContractNumber;
+
+ @Schema(description = "閲囪喘鍚堝悓绛捐鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date executionDate;
+
+ @Schema(description = "鍚堝悓閲戦")
+ private BigDecimal contractAmount;
+
+ @Schema(description = "浠樻閲戦")
+ private BigDecimal paymentAmount;
+
+ @Schema(description = "搴斾粯閲戦")
+ private BigDecimal payableAmount;
+
+ @Schema(description = "閫�璐ч噾棰�")
+ private BigDecimal returnAmount;
+
+}
diff --git a/src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsVo.java b/src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsVo.java
new file mode 100644
index 0000000..2434017
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/vo/SupplierTransactionsVo.java
@@ -0,0 +1,33 @@
+package com.ruoyi.purchase.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@Schema(name = "SupplierTransactionsVo", description = "閲囪喘绠$悊--渚涘簲鍟嗗線鏉�(杩斿洖)")
+public class SupplierTransactionsVo {
+
+ @Schema(description = "渚涘簲鍟咺D")
+ private Long supplierId;
+
+ @Schema(description = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+
+ @Schema(description = "鍚堝悓鎬婚噾棰�")
+ //璇ヤ緵搴斿晢閲囪喘鍚堝悓绱閲戦
+ private BigDecimal contractAmounts;
+
+ @Schema(description = "浠樻閲戦")
+ //璇ヤ緵搴斿晢閲囪喘浠樻绱閲戦
+ private BigDecimal paymentAmount;
+
+ @Schema(description = "搴斾粯閲戦")
+ //璇ヤ緵搴斿晢閲囪喘搴斾粯绱閲戦=鍒濆閲戦-浠樻-閫�娆�
+ private BigDecimal payableAmount;
+
+ @Schema(description = "閫�璐ч噾棰�")
+ private BigDecimal returnAmount;
+
+}
diff --git a/src/main/java/com/ruoyi/quality/controller/QualityInspectController.java b/src/main/java/com/ruoyi/quality/controller/QualityInspectController.java
index fcaceb6..cc295d5 100644
--- a/src/main/java/com/ruoyi/quality/controller/QualityInspectController.java
+++ b/src/main/java/com/ruoyi/quality/controller/QualityInspectController.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.dto.QualityInspectDto;
import com.ruoyi.quality.pojo.QualityInspect;
import com.ruoyi.quality.pojo.QualityInspectFile;
@@ -10,6 +12,7 @@
import com.ruoyi.quality.service.IQualityInspectFileService;
import com.ruoyi.quality.service.IQualityInspectParamService;
import com.ruoyi.quality.service.IQualityInspectService;
+import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.util.CollectionUtils;
@@ -37,8 +40,10 @@
* @return
*/
@PostMapping("/add")
- public AjaxResult add(@RequestBody QualityInspectDto qualityInspectDto) {
- return AjaxResult.success(qualityInspectService.add(qualityInspectDto));
+ @Operation(summary = "鏂板妫�楠�")
+ @Log(title = "鏂板妫�楠�", businessType = BusinessType.INSERT)
+ public R<?> add(@RequestBody QualityInspectDto qualityInspectDto) {
+ return R.ok(qualityInspectService.add(qualityInspectDto));
}
/**
@@ -48,9 +53,11 @@
* @return
*/
@DeleteMapping("/del")
- public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) {
+ @Operation(summary = "鍒犻櫎妫�楠�")
+ @Log(title = "鍒犻櫎妫�楠�", businessType = BusinessType.DELETE)
+ public R<?> delQualityInspect(@RequestBody List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
//濡傛灉宸茬粡鎻愪氦灏变笉鍏佽鍒犻櫎
List<QualityInspect> qualityInspects = qualityInspectService.listByIds(ids);
@@ -66,7 +73,7 @@
qualityInspectFileService.remove(Wrappers.<QualityInspectFile>lambdaQuery()
.in(QualityInspectFile::getInspectId, ids));
//鍒犻櫎妫�楠屽崟
- return AjaxResult.success(qualityInspectService.removeBatchByIds(ids));
+ return R.ok(qualityInspectService.removeBatchByIds(ids));
}
/**
@@ -76,8 +83,10 @@
* @return
*/
@GetMapping("/{id}")
- public AjaxResult QualityInspectDetail(@PathVariable("id") Integer id) {
- return AjaxResult.success(qualityInspectService.getDetailById(id));
+ @Operation(summary = "妫�楠岃鎯�")
+ @Log(title = "妫�楠岃鎯�", businessType = BusinessType.OTHER)
+ public R<?> QualityInspectDetail(@PathVariable("id") Integer id) {
+ return R.ok(qualityInspectService.getDetailById(id));
}
/**
@@ -87,8 +96,10 @@
* @return
*/
@PostMapping("/update")
- public AjaxResult update(@RequestBody QualityInspectDto qualityInspectDto) {
- return AjaxResult.success(qualityInspectService.updateQualityInspect(qualityInspectDto));
+ @Operation(summary = "淇敼妫�楠�")
+ @Log(title = "淇敼妫�楠�", businessType = BusinessType.UPDATE)
+ public R<?> update(@RequestBody QualityInspectDto qualityInspectDto) {
+ return R.ok(qualityInspectService.updateQualityInspect(qualityInspectDto));
}
/**
@@ -99,8 +110,10 @@
* @return
*/
@GetMapping("/listPage")
- public AjaxResult qualityInspectListPage(Page page, QualityInspectDto qualityInspect) {
- return AjaxResult.success(qualityInspectService.qualityInspectListPage(page, qualityInspect));
+ @Operation(summary = "鍒嗛〉鏌ヨ妫�楠�")
+ @Log(title = "鍒嗛〉鏌ヨ妫�楠�", businessType = BusinessType.OTHER)
+ public R<?> qualityInspectListPage(Page page, QualityInspectDto qualityInspect) {
+ return R.ok(qualityInspectService.qualityInspectListPage(page, qualityInspect));
}
/**
@@ -110,6 +123,8 @@
* @param qualityInspect
*/
@PostMapping("/export")
+ @Operation(summary = "瀵煎嚭妫�楠�")
+ @Log(title = "瀵煎嚭妫�楠�", businessType = BusinessType.EXPORT)
public void qualityInspectExport(HttpServletResponse response, QualityInspect qualityInspect) {
qualityInspectService.qualityInspectExport(response, qualityInspect);
}
@@ -121,8 +136,10 @@
* @return
*/
@PostMapping("/submit")
- public AjaxResult submit(@RequestBody QualityInspect qualityInspect) {
- return AjaxResult.success(qualityInspectService.submit(qualityInspect));
+ @Operation(summary = "鎻愪氦妫�楠�")
+ @Log(title = "鎻愪氦妫�楠�", businessType = BusinessType.OTHER)
+ public R<?> submit(@RequestBody QualityInspect qualityInspect) {
+ return R.ok(qualityInspectService.submit(qualityInspect));
}
/**
@@ -132,6 +149,8 @@
* @param qualityInspect
*/
@PostMapping("/down")
+ @Operation(summary = "涓嬭浇妫�楠�")
+ @Log(title = "涓嬭浇妫�楠�", businessType = BusinessType.OTHER)
public void down(HttpServletResponse response, @RequestBody QualityInspect qualityInspect) {
qualityInspectService.down(response, qualityInspect);
}
diff --git a/src/main/java/com/ruoyi/quality/controller/QualityInspectParamController.java b/src/main/java/com/ruoyi/quality/controller/QualityInspectParamController.java
index 263b201..48fc093 100644
--- a/src/main/java/com/ruoyi/quality/controller/QualityInspectParamController.java
+++ b/src/main/java/com/ruoyi/quality/controller/QualityInspectParamController.java
@@ -2,13 +2,16 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.pojo.QualityInspect;
import com.ruoyi.quality.pojo.QualityInspectFile;
import com.ruoyi.quality.pojo.QualityInspectParam;
import com.ruoyi.quality.service.IQualityInspectFileService;
import com.ruoyi.quality.service.IQualityInspectParamService;
import com.ruoyi.quality.service.IQualityInspectService;
+import io.swagger.v3.oas.annotations.Operation;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -32,8 +35,10 @@
* @return
*/
@GetMapping("/{inspectId}")
- public AjaxResult QualityInspectParamDetail(@PathVariable("inspectId") Integer inspectId) {
- return AjaxResult.success(qualityInspectParamService.qualityInspectParamDetail(inspectId));
+ @Operation(summary = "妫�楠屽弬鏁伴」璇︽儏")
+ @Log(title = "妫�楠屽弬鏁伴」璇︽儏", businessType = BusinessType.OTHER)
+ public R<?> QualityInspectParamDetail(@PathVariable("inspectId") Integer inspectId) {
+ return R.ok(qualityInspectParamService.qualityInspectParamDetail(inspectId));
}
@@ -43,8 +48,10 @@
* @return
*/
@PostMapping("/update")
- public AjaxResult update(@RequestBody List<QualityInspectParam> qualityInspectParams) {
- return AjaxResult.success(qualityInspectParamService.updateBatchById(qualityInspectParams));
+ @Operation(summary = "淇敼妫�楠屽弬鏁伴」")
+ @Log(title = "淇敼妫�楠屽弬鏁伴」", businessType = BusinessType.UPDATE)
+ public R<?> update(@RequestBody List<QualityInspectParam> qualityInspectParams) {
+ return R.ok(qualityInspectParamService.updateBatchById(qualityInspectParams));
}
/**
@@ -53,11 +60,13 @@
* @return
*/
@DeleteMapping("/del")
- public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) {
+ @Operation(summary = "鍒犻櫎妫�楠屽弬鏁伴」")
+ @Log(title = "鍒犻櫎妫�楠屽弬鏁伴」", businessType = BusinessType.DELETE)
+ public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) {
if(CollectionUtils.isEmpty(ids)){
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
- return AjaxResult.success(qualityInspectParamService.removeBatchByIds(ids));
+ return R.ok(qualityInspectParamService.removeBatchByIds(ids));
}
diff --git a/src/main/java/com/ruoyi/quality/controller/QualityReportController.java b/src/main/java/com/ruoyi/quality/controller/QualityReportController.java
index 4d005b0..370e8f0 100644
--- a/src/main/java/com/ruoyi/quality/controller/QualityReportController.java
+++ b/src/main/java/com/ruoyi/quality/controller/QualityReportController.java
@@ -1,6 +1,8 @@
package com.ruoyi.quality.controller;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.service.QualityReportService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -30,8 +32,9 @@
*/
@Operation(summary = "鑾峰彇妫�楠岀粺璁℃暟鎹�")
@GetMapping("/getInspectStatistics")
- public AjaxResult getInspectStatistics() {
- return AjaxResult.success(qualityReportService.getInspectStatistics());
+ @Log(title = "鑾峰彇妫�楠岀粺璁℃暟鎹�", businessType = BusinessType.OTHER)
+ public R<?> getInspectStatistics() {
+ return R.ok(qualityReportService.getInspectStatistics());
}
/**
@@ -39,8 +42,9 @@
*/
@Operation(summary = "鑾峰彇鍚堟牸鐜囩粺璁℃暟鎹�")
@GetMapping("/getPassRateStatistics")
- public AjaxResult getPassRateStatistics() {
- return AjaxResult.success(qualityReportService.getPassRateStatistics());
+ @Log(title = "鑾峰彇鍚堟牸鐜囩粺璁℃暟鎹�", businessType = BusinessType.OTHER)
+ public R<?> getPassRateStatistics() {
+ return R.ok(qualityReportService.getPassRateStatistics());
}
/**
@@ -48,8 +52,9 @@
*/
@Operation(summary = "鑾峰彇鏈堝害鍚堟牸鐜囩粺璁℃暟鎹�")
@GetMapping("/getMonthlyPassRateStatistics")
- public AjaxResult getMonthlyPassRateStatistics(@RequestParam("year") String year) {
- return AjaxResult.success(qualityReportService.getMonthlyPassRateStatistics(year));
+ @Log(title = "鑾峰彇鏈堝害鍚堟牸鐜囩粺璁℃暟鎹�", businessType = BusinessType.OTHER)
+ public R<?> getMonthlyPassRateStatistics(@RequestParam("year") String year) {
+ return R.ok(qualityReportService.getMonthlyPassRateStatistics(year));
}
/**
@@ -57,8 +62,9 @@
*/
@Operation(summary = "鑾峰彇骞村害鎬诲悎鏍肩巼缁熻鏁版嵁")
@GetMapping("/getYearlyPassRateStatistics")
- public AjaxResult getYearlyPassRateStatistics(@RequestParam("year") String year) {
- return AjaxResult.success(qualityReportService.getYearlyPassRateStatistics(year));
+ @Log(title = "鑾峰彇骞村害鎬诲悎鏍肩巼缁熻鏁版嵁", businessType = BusinessType.OTHER)
+ public R<?> getYearlyPassRateStatistics(@RequestParam("year") String year) {
+ return R.ok(qualityReportService.getYearlyPassRateStatistics(year));
}
/**
@@ -66,8 +72,9 @@
*/
@Operation(summary = "鑾峰彇鏈堝害瀹屾垚鏄庣粏鏁版嵁")
@GetMapping("/getMonthlyCompletionDetails")
- public AjaxResult getMonthlyCompletionDetails(@RequestParam("year") String year) {
- return AjaxResult.success(qualityReportService.getMonthlyCompletionDetails(year));
+ @Log(title = "鑾峰彇鏈堝害瀹屾垚鏄庣粏鏁版嵁", businessType = BusinessType.OTHER)
+ public R<?> getMonthlyCompletionDetails(@RequestParam("year") String year) {
+ return R.ok(qualityReportService.getMonthlyCompletionDetails(year));
}
/**
@@ -75,8 +82,9 @@
*/
@Operation(summary = "鑾峰彇鐑偣妫�娴嬫寚鏍囩粺璁�")
@GetMapping("/getTopParameters")
- public AjaxResult getTopParameters(@RequestParam("modelType") Integer modelType) {
- return AjaxResult.success(qualityReportService.getTopParameters(modelType));
+ @Log(title = "鑾峰彇鐑偣妫�娴嬫寚鏍囩粺璁�", businessType = BusinessType.OTHER)
+ public R<?> getTopParameters(@RequestParam("modelType") Integer modelType) {
+ return R.ok(qualityReportService.getTopParameters(modelType));
}
}
diff --git a/src/main/java/com/ruoyi/quality/controller/QualityTestStandardBindingController.java b/src/main/java/com/ruoyi/quality/controller/QualityTestStandardBindingController.java
index 539f3f7..7f2142e 100644
--- a/src/main/java/com/ruoyi/quality/controller/QualityTestStandardBindingController.java
+++ b/src/main/java/com/ruoyi/quality/controller/QualityTestStandardBindingController.java
@@ -1,8 +1,12 @@
package com.ruoyi.quality.controller;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.pojo.QualityTestStandardBinding;
import com.ruoyi.quality.service.QualityTestStandardBindingService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -20,6 +24,7 @@
@RestController
@RequestMapping("/qualityTestStandardBinding")
@AllArgsConstructor
+@Tag(name = "妫�娴嬫爣鍑嗕富琛ㄤ笌浜у搧鍏宠仈琛�")
public class QualityTestStandardBindingController {
private QualityTestStandardBindingService qualityTestStandardBindingService;
@@ -31,8 +36,10 @@
* @return
*/
@PostMapping("/add")
- public AjaxResult add(@RequestBody List<QualityTestStandardBinding> qualityTestStandardBindings) {
- return AjaxResult.success(qualityTestStandardBindingService.add(qualityTestStandardBindings));
+ @Operation(summary = "鏂板妫�娴嬫爣鍑嗕富琛ㄤ笌浜у搧鍏宠仈琛�")
+ @Log(title = "鏂板妫�娴嬫爣鍑嗕富琛ㄤ笌浜у搧鍏宠仈琛�", businessType = BusinessType.INSERT)
+ public R<?> add(@RequestBody List<QualityTestStandardBinding> qualityTestStandardBindings) {
+ return R.ok(qualityTestStandardBindingService.add(qualityTestStandardBindings));
}
/**
@@ -42,11 +49,13 @@
* @return
*/
@DeleteMapping("/del")
- public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) {
+ @Operation(summary = "鍒犻櫎妫�娴嬫爣鍑嗕富琛ㄤ笌浜у搧鍏宠仈琛�")
+ @Log(title = "鍒犻櫎妫�娴嬫爣鍑嗕富琛ㄤ笌浜у搧鍏宠仈琛�", businessType = BusinessType.DELETE)
+ public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
- return AjaxResult.success(qualityTestStandardBindingService.removeBatchByIds(ids));
+ return R.ok(qualityTestStandardBindingService.removeBatchByIds(ids));
}
/**
@@ -55,8 +64,10 @@
* @return
*/
@GetMapping("/list")
- public AjaxResult listBinding(Long testStandardId) {
- return AjaxResult.success(qualityTestStandardBindingService.listBinding(testStandardId));
+ @Operation(summary = "妫�娴嬫寚鏍囩淮鎶ゆ煡璇�")
+ @Log(title = "妫�娴嬫寚鏍囩淮鎶ゆ煡璇�", businessType = BusinessType.OTHER)
+ public R<?> listBinding(Long testStandardId) {
+ return R.ok(qualityTestStandardBindingService.listBinding(testStandardId));
}
}
diff --git a/src/main/java/com/ruoyi/quality/controller/QualityTestStandardController.java b/src/main/java/com/ruoyi/quality/controller/QualityTestStandardController.java
index a61ffed..ab8fca9 100644
--- a/src/main/java/com/ruoyi/quality/controller/QualityTestStandardController.java
+++ b/src/main/java/com/ruoyi/quality/controller/QualityTestStandardController.java
@@ -2,11 +2,15 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.pojo.QualityTestStandard;
import com.ruoyi.quality.pojo.QualityTestStandardParam;
import com.ruoyi.quality.service.IQualityTestStandardService;
import com.ruoyi.quality.service.QualityTestStandardParamService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -24,6 +28,7 @@
*/
@RestController
@RequestMapping("/qualityTestStandard")
+@Tag(name = "妫�娴嬫爣鍑嗕富琛�")
public class QualityTestStandardController {
@Resource
@@ -39,8 +44,10 @@
* @return
*/
@PostMapping("/add")
- public AjaxResult add(@RequestBody QualityTestStandard qualityTestStandard) {
- return AjaxResult.success(qualityTestStandardService.save(qualityTestStandard));
+ @Operation(summary = "鏂板妫�娴嬫爣鍑嗕富琛�")
+ @Log(title = "鏂板妫�娴嬫爣鍑嗕富琛�", businessType = BusinessType.INSERT)
+ public R<?> add(@RequestBody QualityTestStandard qualityTestStandard) {
+ return R.ok(qualityTestStandardService.save(qualityTestStandard));
}
/**
@@ -49,11 +56,13 @@
* @return
*/
@DeleteMapping("/del")
- public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) {
+ @Operation(summary = "鍒犻櫎妫�娴嬫爣鍑嗕富琛�")
+ @Log(title = "鍒犻櫎妫�娴嬫爣鍑嗕富琛�", businessType = BusinessType.DELETE)
+ public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) {
if(CollectionUtils.isEmpty(ids)){
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
- return AjaxResult.success(qualityTestStandardService.delQualityTestStandard(ids));
+ return R.ok(qualityTestStandardService.delQualityTestStandard(ids));
}
/**
@@ -62,8 +71,10 @@
* @return
*/
@PostMapping("/update")
- public AjaxResult update(@RequestBody QualityTestStandard qualityTestStandard) {
- return AjaxResult.success(qualityTestStandardService.updateById(qualityTestStandard));
+ @Operation(summary = "妫�娴嬫爣鍑嗕富琛ㄤ慨鏀�")
+ @Log(title = "妫�娴嬫爣鍑嗕富琛ㄤ慨鏀�", businessType = BusinessType.UPDATE)
+ public R<?> update(@RequestBody QualityTestStandard qualityTestStandard) {
+ return R.ok(qualityTestStandardService.updateById(qualityTestStandard));
}
/**
@@ -73,8 +84,10 @@
* @return
*/
@GetMapping("/listPage")
- public AjaxResult qualityTestStandardListPage(Page page, QualityTestStandard qualityTestStandard) {
- return AjaxResult.success(qualityTestStandardService.qualityTestStandardListPage(page, qualityTestStandard));
+ @Operation(summary = "妫�娴嬫爣鍑嗕富琛ㄥ垎椤垫煡璇�")
+ @Log(title = "妫�娴嬫爣鍑嗕富琛ㄥ垎椤垫煡璇�", businessType = BusinessType.OTHER)
+ public R<?> qualityTestStandardListPage(Page page, QualityTestStandard qualityTestStandard) {
+ return R.ok(qualityTestStandardService.qualityTestStandardListPage(page, qualityTestStandard));
}
/**
@@ -83,8 +96,10 @@
* @return
*/
@PostMapping("/copyParam")
- public AjaxResult copyParam(@RequestBody QualityTestStandard qualityTestStandard) {
- return AjaxResult.success(qualityTestStandardService.copyParam(qualityTestStandard));
+ @Operation(summary = "妫�娴嬫爣鍑嗗鍒跺弬鏁�")
+ @Log(title = "妫�娴嬫爣鍑嗗鍒跺弬鏁�", businessType = BusinessType.OTHER)
+ public R<?> copyParam(@RequestBody QualityTestStandard qualityTestStandard) {
+ return R.ok(qualityTestStandardService.copyParam(qualityTestStandard));
}
/**
@@ -93,8 +108,10 @@
* @return
*/
@PostMapping("/qualityTestStandardAudit")
- public AjaxResult qualityTestStandardAudit(@RequestBody List<QualityTestStandard> qualityTestStandards) {
- return AjaxResult.success(qualityTestStandardService.updateBatchById(qualityTestStandards));
+ @Operation(summary = "妫�娴嬫爣鍑嗘壒閲忓鏍�")
+ @Log(title = "妫�娴嬫爣鍑嗘壒閲忓鏍�", businessType = BusinessType.OTHER)
+ public R<?> qualityTestStandardAudit(@RequestBody List<QualityTestStandard> qualityTestStandards) {
+ return R.ok(qualityTestStandardService.updateBatchById(qualityTestStandards));
}
/**
@@ -102,8 +119,10 @@
* @return
*/
@GetMapping("/getQualityTestStandardByProductId")
- public AjaxResult getQualityTestStandardByProductId(@Nonnull Long productId, @Nonnull Integer inspectType, String process) {
- return AjaxResult.success(qualityTestStandardService.getQualityTestStandardByProductId(productId,inspectType,process));
+ @Operation(summary = "鏍规嵁浜у搧id鏌ヨ鐩稿叧鐨勬楠屾爣鍑�")
+ @Log(title = "鏍规嵁浜у搧id鏌ヨ鐩稿叧鐨勬楠屾爣鍑�", businessType = BusinessType.OTHER)
+ public R<?> getQualityTestStandardByProductId(@Nonnull Long productId, @Nonnull Integer inspectType, String process) {
+ return R.ok(qualityTestStandardService.getQualityTestStandardByProductId(productId,inspectType,process));
}
/**
@@ -111,8 +130,10 @@
* @return
*/
@GetMapping("/getQualityTestStandardParamByTestStandardId")
- public AjaxResult getQualityTestStandardParamByTestStandardId(Long testStandardId) {
- return AjaxResult.success(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId, testStandardId)));
+ @Operation(summary = "鏍规嵁妫�娴嬫爣鍑唅d鏌ヨ鐩稿叧鐨勬楠屾爣鍑嗗弬鏁�")
+ @Log(title = "鏍规嵁妫�娴嬫爣鍑唅d鏌ヨ鐩稿叧鐨勬楠屾爣鍑嗗弬鏁�", businessType = BusinessType.OTHER)
+ public R<?> getQualityTestStandardParamByTestStandardId(Long testStandardId) {
+ return R.ok(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId, testStandardId)));
}
}
diff --git a/src/main/java/com/ruoyi/quality/controller/QualityTestStandardParamController.java b/src/main/java/com/ruoyi/quality/controller/QualityTestStandardParamController.java
index e5c883c..cc46446 100644
--- a/src/main/java/com/ruoyi/quality/controller/QualityTestStandardParamController.java
+++ b/src/main/java/com/ruoyi/quality/controller/QualityTestStandardParamController.java
@@ -2,10 +2,14 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.pojo.QualityTestStandard;
import com.ruoyi.quality.pojo.QualityTestStandardParam;
import com.ruoyi.quality.service.QualityTestStandardParamService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@@ -24,6 +28,7 @@
@RestController
@RequestMapping("/qualityTestStandardParam")
@AllArgsConstructor
+@Tag(name = "妫�娴嬫爣鍑嗗弬鏁�")
public class QualityTestStandardParamController {
private QualityTestStandardParamService qualityTestStandardParamService;
@@ -34,8 +39,10 @@
* @return
*/
@PostMapping("/add")
- public AjaxResult add(@RequestBody QualityTestStandardParam qualityTestStandardParam) {
- return AjaxResult.success(qualityTestStandardParamService.save(qualityTestStandardParam));
+ @Operation(summary = "鏂板妫�娴嬫爣鍑嗗弬鏁�")
+ @Log(title = "鏂板妫�娴嬫爣鍑嗗弬鏁�", businessType = BusinessType.INSERT)
+ public R<?> add(@RequestBody QualityTestStandardParam qualityTestStandardParam) {
+ return R.ok(qualityTestStandardParamService.save(qualityTestStandardParam));
}
/**
@@ -44,11 +51,13 @@
* @return
*/
@DeleteMapping("/del")
- public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) {
+ @Operation(summary = "鍒犻櫎妫�娴嬫寚鏍囩淮鎶�")
+ @Log(title = "鍒犻櫎妫�娴嬫寚鏍囩淮鎶�", businessType = BusinessType.DELETE)
+ public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) {
if(CollectionUtils.isEmpty(ids)){
- return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
- return AjaxResult.success(qualityTestStandardParamService.removeBatchByIds(ids));
+ return R.ok(qualityTestStandardParamService.removeBatchByIds(ids));
}
/**
@@ -57,8 +66,10 @@
* @return
*/
@PostMapping("/update")
- public AjaxResult update(@RequestBody QualityTestStandardParam qualityTestStandardParam) {
- return AjaxResult.success(qualityTestStandardParamService.updateById(qualityTestStandardParam));
+ @Operation(summary = "妫�娴嬫寚鏍囩淮鎶や慨鏀�")
+ @Log(title = "妫�娴嬫寚鏍囩淮鎶や慨鏀�", businessType = BusinessType.UPDATE)
+ public R<?> update(@RequestBody QualityTestStandardParam qualityTestStandardParam) {
+ return R.ok(qualityTestStandardParamService.updateById(qualityTestStandardParam));
}
/**
@@ -66,8 +77,12 @@
* @return
*/
@GetMapping("/list")
- public AjaxResult list(Long testStandardId) {
- return AjaxResult.success(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId,testStandardId)));
+ @Operation(summary = "妫�娴嬫寚鏍囩淮鎶ゆ煡璇�")
+ @Log(title = "妫�娴嬫寚鏍囩淮鎶ゆ煡璇�", businessType = BusinessType.OTHER)
+ public R<?> list(Long testStandardId) {
+ return R.ok(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery()
+ .eq(QualityTestStandardParam::getTestStandardId, testStandardId)
+ .orderByDesc(QualityTestStandardParam::getCreateTime)));
}
}
diff --git a/src/main/java/com/ruoyi/quality/controller/QualityUnqualifiedController.java b/src/main/java/com/ruoyi/quality/controller/QualityUnqualifiedController.java
index 3b20f82..a2222c3 100644
--- a/src/main/java/com/ruoyi/quality/controller/QualityUnqualifiedController.java
+++ b/src/main/java/com/ruoyi/quality/controller/QualityUnqualifiedController.java
@@ -1,9 +1,13 @@
package com.ruoyi.quality.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.pojo.QualityUnqualified;
import com.ruoyi.quality.service.IQualityUnqualifiedService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -16,6 +20,7 @@
*/
@RestController
@RequestMapping("/quality/qualityUnqualified")
+@Tag(name = "涓嶅悎鏍肩鐞�")
public class QualityUnqualifiedController {
@Resource
@@ -28,9 +33,11 @@
* @return
*/
@PostMapping("/add")
- public AjaxResult add(@RequestBody QualityUnqualified qualityUnqualified) {
+ @Operation(summary = "鏂板涓嶅悎鏍肩鐞�")
+ @Log(title = "鏂板涓嶅悎鏍肩鐞�", businessType = BusinessType.INSERT)
+ public R<?> add(@RequestBody QualityUnqualified qualityUnqualified) {
qualityUnqualified.setInspectState(0);
- return AjaxResult.success(qualityUnqualifiedService.save(qualityUnqualified));
+ return R.ok(qualityUnqualifiedService.save(qualityUnqualified));
}
/**
@@ -39,13 +46,15 @@
* @return
*/
@DeleteMapping("/del")
- public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) {
+ @Operation(summary = "鍒犻櫎涓嶅悎鏍肩鐞�")
+ @Log(title = "鍒犻櫎涓嶅悎鏍肩鐞�", businessType = BusinessType.DELETE)
+ public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) {
qualityUnqualifiedService.listByIds(ids).stream().forEach(qualityUnqualified -> {
if (qualityUnqualified.getInspectState()==1){
throw new RuntimeException("璇ヤ笉鍚堟牸鏁版嵁宸茬粡澶勭悊鏃犳硶鍒犻櫎!");
}
});
- return AjaxResult.success(qualityUnqualifiedService.removeBatchByIds(ids));
+ return R.ok(qualityUnqualifiedService.removeBatchByIds(ids));
}
/**
@@ -54,8 +63,10 @@
* @return
*/
@GetMapping("/{id}")
- public AjaxResult QualityUnqualifiedDetail(@PathVariable("id") Integer id) {
- return AjaxResult.success(qualityUnqualifiedService.getUnqualified(id));
+ @Operation(summary = "涓嶅悎鏍肩鐞嗚鎯�")
+ @Log(title = "涓嶅悎鏍肩鐞嗚鎯�", businessType = BusinessType.OTHER)
+ public R<?> QualityUnqualifiedDetail(@PathVariable("id") Integer id) {
+ return R.ok(qualityUnqualifiedService.getUnqualified(id));
}
/**
@@ -64,8 +75,10 @@
* @return
*/
@PostMapping("/update")
- public AjaxResult update(@RequestBody QualityUnqualified qualityUnqualified) {
- return AjaxResult.success(qualityUnqualifiedService.updateById(qualityUnqualified));
+ @Operation(summary = "涓嶅悎鏍肩鐞嗕慨鏀�")
+ @Log(title = "涓嶅悎鏍肩鐞嗕慨鏀�", businessType = BusinessType.UPDATE)
+ public R<?> update(@RequestBody QualityUnqualified qualityUnqualified) {
+ return R.ok(qualityUnqualifiedService.updateById(qualityUnqualified));
}
/**
@@ -75,8 +88,10 @@
* @return
*/
@GetMapping("/listPage")
- public AjaxResult qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) {
- return AjaxResult.success(qualityUnqualifiedService.qualityUnqualifiedListPage(page, qualityUnqualified));
+ @Operation(summary = "涓嶅悎鏍肩鐞嗗垎椤垫煡璇�")
+ @Log(title = "涓嶅悎鏍肩鐞嗗垎椤垫煡璇�", businessType = BusinessType.OTHER)
+ public R<?> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) {
+ return R.ok(qualityUnqualifiedService.qualityUnqualifiedListPage(page, qualityUnqualified));
}
/**
@@ -85,6 +100,8 @@
* @param qualityUnqualified
*/
@PostMapping("/export")
+ @Operation(summary = "涓嶅悎鏍肩鐞嗗鍑�")
+ @Log(title = "涓嶅悎鏍肩鐞嗗鍑�", businessType = BusinessType.EXPORT)
public void qualityUnqualifiedExport(HttpServletResponse response,QualityUnqualified qualityUnqualified) {
qualityUnqualifiedService.qualityUnqualifiedExport(response, qualityUnqualified);
}
@@ -95,8 +112,10 @@
* @return
*/
@PostMapping("/deal")
- public AjaxResult deal(@RequestBody QualityUnqualified qualityUnqualified) {
- return AjaxResult.success(qualityUnqualifiedService.deal(qualityUnqualified));
+ @Operation(summary = "涓嶅悎鏍肩鐞嗗鐞�")
+ @Log(title = "涓嶅悎鏍肩鐞嗗鐞�", businessType = BusinessType.OTHER)
+ public R<?> deal(@RequestBody QualityUnqualified qualityUnqualified) {
+ return R.ok(qualityUnqualifiedService.deal(qualityUnqualified));
}
diff --git a/src/main/java/com/ruoyi/quality/pojo/QualityInspect.java b/src/main/java/com/ruoyi/quality/pojo/QualityInspect.java
index 9d8a07d..611bde8 100644
--- a/src/main/java/com/ruoyi/quality/pojo/QualityInspect.java
+++ b/src/main/java/com/ruoyi/quality/pojo/QualityInspect.java
@@ -7,7 +7,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import jakarta.validation.constraints.NotBlank;
+import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@@ -20,6 +20,7 @@
@TableName(value = "quality_inspect")
@Data
public class QualityInspect extends DateQueryDto implements Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
/**
@@ -32,13 +33,12 @@
* 绫诲埆(0:鍘熸潗鏂欐楠�;1:杩囩▼妫�楠�;2:鍑哄巶妫�楠�)
*/
@Excel(name = "绫诲埆",readConverterExp = "0=鍘熸潗鏂欐楠�,1=杩囩▼妫�楠�,2=鍑哄巶妫�楠�")
- @NotBlank(message = "绫诲埆涓嶈兘涓虹┖!!")
private Integer inspectType;
/**
* 妫�娴嬫棩鏈�
*/
- @JsonFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "妫�娴嬫棩鏈�", width = 30, dateFormat = "yyyy-MM-dd")
private Date checkTime;
@@ -72,7 +72,6 @@
/**
* 鍏宠仈浜у搧id
*/
- @NotBlank(message = "浜у搧id涓嶈兘涓虹┖")
private Long productId;
/**
@@ -96,9 +95,17 @@
/**
* 鏁伴噺
*/
- @Excel(name = "鏁伴噺")
+ @Excel(name = "鎬绘暟閲�")
private BigDecimal quantity;
+ @Excel(name = "鍚堟牸鏁伴噺")
+ @TableField("qualified_quantity")
+ private BigDecimal qualifiedQuantity;
+
+ @Excel(name = "涓嶅悎鏍兼暟閲�")
+ @TableField("unqualified_quantity")
+ private BigDecimal unqualifiedQuantity;
+
/**
* 妫�娴嬪崟浣�
*/
diff --git a/src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java b/src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java
index 31984af..e20f4be 100644
--- a/src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java
+++ b/src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java
@@ -47,7 +47,7 @@
/**
* 妫�娴嬫棩鏈�
*/
- @JsonFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "妫�娴嬫棩鏈�", width = 30, dateFormat = "yyyy-MM-dd")
private Date checkTime;
@@ -107,7 +107,7 @@
/**
* 澶勭悊鏃ユ湡
*/
- @JsonFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "澶勭悊鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private Date dealTime;
@@ -143,4 +143,7 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+
+ @Schema(description = "鍏宠仈浜у搧鍨嬪彿id")
+ private Long productModelId;
}
diff --git a/src/main/java/com/ruoyi/quality/service/IQualityInspectService.java b/src/main/java/com/ruoyi/quality/service/IQualityInspectService.java
index d78a5ca..8b42207 100644
--- a/src/main/java/com/ruoyi/quality/service/IQualityInspectService.java
+++ b/src/main/java/com/ruoyi/quality/service/IQualityInspectService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.quality.dto.QualityInspectDto;
import com.ruoyi.quality.pojo.QualityInspect;
@@ -23,5 +24,7 @@
int submit(QualityInspect qualityInspect);
+ R autoSubmit(Long id);
+
void down(HttpServletResponse response, QualityInspect qualityInspect);
}
diff --git a/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java b/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
index 8c53500..328c358 100644
--- a/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
+++ b/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.quality.service.impl;
+import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -9,8 +10,11 @@
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.HackLoopTableRenderPolicy;
import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.procurementrecord.service.ProcurementRecordService;
import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.quality.dto.QualityInspectDto;
@@ -20,6 +24,8 @@
import com.ruoyi.quality.pojo.QualityInspect;
import com.ruoyi.quality.pojo.QualityInspectParam;
import com.ruoyi.quality.pojo.QualityUnqualified;
+import com.ruoyi.stock.pojo.StockInRecord;
+import com.ruoyi.stock.service.StockInRecordService;
import com.ruoyi.quality.service.IQualityInspectParamService;
import com.ruoyi.quality.service.IQualityInspectService;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
@@ -33,7 +39,11 @@
import java.io.InputStream;
import java.io.OutputStream;
+import java.math.BigDecimal;
import java.net.URLEncoder;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@@ -45,6 +55,7 @@
private final StockUtils stockUtils;
private final StockInventoryService stockInventoryService;
+ private final StockInRecordService stockInRecordService;
private QualityInspectMapper qualityInspectMapper;
private IQualityInspectParamService qualityInspectParamService;
@@ -84,35 +95,134 @@
@Override
public int submit(QualityInspect inspect) {
QualityInspect qualityInspect = qualityInspectMapper.selectById(inspect.getId());
+
//鎻愪氦鍓嶅繀椤诲垽鏂槸鍚﹀悎鏍�
if (ObjectUtils.isNull(qualityInspect.getCheckResult())) {
- throw new RuntimeException("璇峰厛鍒ゆ柇鏄惁鍚堟牸");
+ throw new ServiceException("璇峰厛鍒ゆ柇鏄惁鍚堟牸");
}
- /*鍒ゆ柇涓嶅悎鏍�*/
- if (qualityInspect.getCheckResult().equals("涓嶅悎鏍�")) {
+
+ if (ObjectUtils.isNull(qualityInspect.getQualifiedQuantity())) {
+ throw new ServiceException("鍚堟牸鏁伴噺涓嶈兘涓虹┖");
+ }
+
+ if (ObjectUtils.isNull(qualityInspect.getUnqualifiedQuantity())) {
+ throw new ServiceException("涓嶅悎鏍兼暟閲忎笉鑳戒负绌�");
+ }
+
+ // 濡傛灉鍚堟牸鏁伴噺涓虹┖锛岃涓�0
+ if (qualityInspect.getQualifiedQuantity() == null) {
+ qualityInspect.setQualifiedQuantity(BigDecimal.ZERO);
+ }
+
+ // 濡傛灉涓嶅悎鏍兼暟閲忎负绌猴紝璁句负0
+ if (qualityInspect.getUnqualifiedQuantity() == null) {
+ qualityInspect.setUnqualifiedQuantity(BigDecimal.ZERO);
+ }
+
+ // 鍚堟牸鐩存帴鍏ュ簱
+ if(qualityInspect.getQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0){
+ //浠呮坊鍔犲叆搴撹褰�
+ StockInventoryDto stockInventoryDto = new StockInventoryDto();
+ //濡傛灉鏄噰璐川妫�鍚堟牸鍏ュ簱閫夌敤CUSTOMIZATION_UNSTOCK_OUT,鍏朵綑鍚堟牸鍏ュ簱閫夌敤QUALITYINSPECT_STOCK_IN
+ stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode()));
+ if (ObjectUtils.isNotEmpty(qualityInspect.getPurchaseLedgerId())){
+ stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
+ }
+ stockInventoryDto.setRecordId(qualityInspect.getId());
+ stockInventoryDto.setProductModelId(qualityInspect.getProductModelId());
+ stockInventoryDto.setQualitity(qualityInspect.getQualifiedQuantity());
+ if (qualityInspect.getCheckTime() != null) {
+ LocalDate stockCreateDate = DateUtils.toLocalDate(qualityInspect.getCheckTime()).plusDays(1);
+ stockInventoryDto.setCreateTime(LocalDateTime.of(stockCreateDate, java.time.LocalTime.MIDNIGHT));
+ }
+ stockInventoryDto.setBatchNo(resolveProductionBatchNo(
+ qualityInspect.getProductMainId(),
+ qualityInspect.getId(),
+ qualityInspect.getProductModelId()));
+ stockInventoryService.addStockInRecordOnly(stockInventoryDto);
+ }
+ // 涓嶅悎鏍煎鐞�
+ if(qualityInspect.getUnqualifiedQuantity().compareTo(BigDecimal.ZERO) > 0){
QualityUnqualified qualityUnqualified = new QualityUnqualified();
BeanUtils.copyProperties(qualityInspect, qualityUnqualified);
qualityUnqualified.setInspectState(0);//寰呭鐞�
+ qualityUnqualified.setQuantity(qualityInspect.getUnqualifiedQuantity());
+ qualityUnqualified.setProductModelId(qualityInspect.getProductModelId());
List<QualityInspectParam> inspectParams = qualityInspectParamService.list(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId, inspect.getId()));
String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(","));
qualityUnqualified.setDefectivePhenomena(text + "杩欎簺鎸囨爣涓瓨鍦ㄤ笉鍚堟牸");//涓嶅悎鏍肩幇璞�
qualityUnqualified.setInspectId(qualityInspect.getId());
qualityUnqualifiedMapper.insert(qualityUnqualified);
- } else {
- //鍚堟牸鐩存帴鍏ュ簱
- // stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), qualityInspect.getId());
- //浠呮坊鍔犲叆搴撹褰�
- StockInventoryDto stockInventoryDto = new StockInventoryDto();
- stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode()));
- stockInventoryDto.setRecordId(qualityInspect.getId());
- stockInventoryDto.setProductModelId(qualityInspect.getProductModelId());
- stockInventoryDto.setQualitity(qualityInspect.getQuantity());
- stockInventoryService.addStockInRecordOnly(stockInventoryDto);
}
+
qualityInspect.setInspectState(1);//宸叉彁浜�
return qualityInspectMapper.updateById(qualityInspect);
}
+ @Override
+ public R autoSubmit(Long id) {
+ if (id == null) {
+ return R.fail("妫�楠屽崟ID涓嶈兘涓虹┖");
+ }
+ QualityInspect qualityInspect = qualityInspectMapper.selectById(id);
+ if (qualityInspect == null) {
+ return R.fail("妫�楠屽崟涓嶅瓨鍦�");
+ }
+ if (Integer.valueOf(1).equals(qualityInspect.getInspectState())) {
+ return R.ok("妫�楠屽崟宸叉彁浜�");
+ }
+
+ if (ObjectUtils.isNull(qualityInspect.getCheckResult())) {
+ qualityInspect.setCheckResult("鍚堟牸");
+ }
+ if (ObjectUtils.isNull(qualityInspect.getQualifiedQuantity())) {
+ qualityInspect.setQualifiedQuantity(qualityInspect.getQuantity() == null ? BigDecimal.ZERO : qualityInspect.getQuantity());
+ }
+ if (ObjectUtils.isNull(qualityInspect.getUnqualifiedQuantity())) {
+ qualityInspect.setUnqualifiedQuantity(BigDecimal.ZERO);
+ }
+ qualityInspectMapper.updateById(qualityInspect);
+ int rows = submit(qualityInspect);
+ return rows > 0 ? R.ok("妫�楠屽崟鎻愪氦鎴愬姛") : R.fail("妫�楠屽崟鎻愪氦澶辫触");
+ }
+
+ private String resolveProductionBatchNo(Long productionProductMainId,
+ Long qualityInspectId,
+ Long productModelId) {
+ if (productModelId == null) {
+ return null;
+ }
+ if (productionProductMainId != null) {
+ StockInRecord productionRecord = stockInRecordService.getOne(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordId, productionProductMainId)
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .in(StockInRecord::getRecordType, Arrays.asList(
+ StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(),
+ StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode()))
+ .isNotNull(StockInRecord::getBatchNo)
+ .orderByDesc(StockInRecord::getId)
+ .last("limit 1"),
+ false);
+ if (productionRecord != null) {
+ return productionRecord.getBatchNo();
+ }
+ }
+ if (qualityInspectId == null) {
+ return null;
+ }
+ StockInRecord inspectRecord = stockInRecordService.getOne(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordId, qualityInspectId)
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .eq(StockInRecord::getRecordType, StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode())
+ .isNotNull(StockInRecord::getBatchNo)
+ .orderByDesc(StockInRecord::getId)
+ .last("limit 1"),
+ false);
+ return inspectRecord == null ? null : inspectRecord.getBatchNo();
+ }
+
/*鐢熸垚妫�楠屾姤鍛�*/
@Override
public void down(HttpServletResponse response, QualityInspect qualityInspect) {
diff --git a/src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java b/src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java
index 0296ef4..b3d93b8 100644
--- a/src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java
+++ b/src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java
@@ -6,7 +6,6 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -24,6 +23,8 @@
import com.ruoyi.quality.mapper.QualityUnqualifiedMapper;
import com.ruoyi.quality.pojo.QualityInspect;
import com.ruoyi.quality.pojo.QualityUnqualified;
+import com.ruoyi.stock.pojo.StockInRecord;
+import com.ruoyi.stock.service.StockInRecordService;
import com.ruoyi.quality.service.IQualityInspectService;
import com.ruoyi.quality.service.IQualityUnqualifiedService;
import com.ruoyi.stock.service.StockUninventoryService;
@@ -34,6 +35,7 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -51,6 +53,7 @@
private final ProductionOrderRoutingOperationMapper productionOrderRoutingOperationMapper;
private final ProductionOperationTaskMapper productionOperationTaskMapper;
private final StockUninventoryService stockUninventoryService;
+ private final StockInRecordService stockInRecordService;
@Override
public IPage<QualityUnqualified> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) {
@@ -68,6 +71,8 @@
public int deal(QualityUnqualified qualityUnqualified) {
QualityUnqualified unqualified = qualityUnqualifiedMapper.selectById(qualityUnqualified.getId());
QualityInspect qualityInspect = qualityInspectService.getById(unqualified.getInspectId());
+ String batchNo = qualityInspect == null ? null
+ : resolveProductionBatchNo(qualityInspect.getProductMainId(), qualityInspect.getId(), qualityInspect.getProductModelId());
if (ObjectUtils.isNotNull(qualityInspect) && qualityInspect.getInspectType() != 0) {
switch (qualityUnqualified.getDealResult()) {
case "杩斾慨":
@@ -81,12 +86,12 @@
}
break;
case "鎶ュ簾":
- stockUtils.addUnStock(qualityInspect.getProductModelId(), unqualified.getQuantity(),
- StockInUnQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId());
+ stockUtils.addUnStockWithBatchNo(qualityInspect.getProductModelId(), unqualified.getQuantity(),
+ StockInQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId(), batchNo);
break;
case "璁╂鏀捐":
- stockUtils.addStock(qualityInspect.getProductModelId(), unqualified.getQuantity(),
- StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId());
+ stockUtils.addStockWithBatchNo(qualityInspect.getProductModelId(), unqualified.getQuantity(),
+ StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId(), batchNo);
break;
default:
break;
@@ -96,7 +101,7 @@
switch (qualityUnqualified.getDealResult()) {
case "鎶ュ簾":
stockUtils.addUnStock(modelId, unqualified.getQuantity(),
- StockInUnQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId());
+ StockInQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId());
break;
case "璁╂鏀捐":
stockUtils.addStock(modelId, unqualified.getQuantity(),
@@ -220,4 +225,41 @@
private BigDecimal defaultDecimal(BigDecimal value) {
return value == null ? BigDecimal.ZERO : value;
}
+
+ private String resolveProductionBatchNo(Long productionProductMainId,
+ Long qualityInspectId,
+ Long productModelId) {
+ if (productModelId == null) {
+ return null;
+ }
+ if (productionProductMainId != null) {
+ StockInRecord productionRecord = stockInRecordService.getOne(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordId, productionProductMainId)
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .in(StockInRecord::getRecordType, Arrays.asList(
+ StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(),
+ StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode()))
+ .isNotNull(StockInRecord::getBatchNo)
+ .orderByDesc(StockInRecord::getId)
+ .last("limit 1"),
+ false);
+ if (productionRecord != null) {
+ return productionRecord.getBatchNo();
+ }
+ }
+ if (qualityInspectId == null) {
+ return null;
+ }
+ StockInRecord inspectRecord = stockInRecordService.getOne(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .eq(StockInRecord::getRecordId, qualityInspectId)
+ .eq(StockInRecord::getProductModelId, productModelId)
+ .eq(StockInRecord::getRecordType, StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode())
+ .isNotNull(StockInRecord::getBatchNo)
+ .orderByDesc(StockInRecord::getId)
+ .last("limit 1"),
+ false);
+ return inspectRecord == null ? null : inspectRecord.getBatchNo();
+ }
}
diff --git a/src/main/java/com/ruoyi/quality/utils/QualityInspectHelper.java b/src/main/java/com/ruoyi/quality/utils/QualityInspectHelper.java
new file mode 100644
index 0000000..766515a
--- /dev/null
+++ b/src/main/java/com/ruoyi/quality/utils/QualityInspectHelper.java
@@ -0,0 +1,73 @@
+package com.ruoyi.quality.utils;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.purchase.pojo.PurchaseLedger;
+import com.ruoyi.quality.mapper.QualityInspectMapper;
+import com.ruoyi.quality.mapper.QualityInspectParamMapper;
+import com.ruoyi.quality.mapper.QualityTestStandardMapper;
+import com.ruoyi.quality.mapper.QualityTestStandardParamMapper;
+import com.ruoyi.quality.pojo.QualityInspect;
+import com.ruoyi.quality.pojo.QualityInspectParam;
+import com.ruoyi.quality.pojo.QualityTestStandard;
+import com.ruoyi.quality.pojo.QualityTestStandardParam;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 璐ㄦ鍗曞垱寤哄伐鍏风被
+ */
+@Component
+@RequiredArgsConstructor
+public class QualityInspectHelper {
+
+ private final QualityInspectMapper qualityInspectMapper;
+ private final QualityTestStandardMapper qualityTestStandardMapper;
+ private final QualityTestStandardParamMapper qualityTestStandardParamMapper;
+ private final QualityInspectParamMapper qualityInspectParamMapper;
+
+ /**
+ * 鍒涘缓璐ㄦ鍗�
+ * @param purchaseLedger 閲囪喘鍙拌处
+ * @param saleProduct 閲囪喘浜у搧
+ */
+ public void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) {
+ QualityInspect qualityInspect = new QualityInspect();
+ qualityInspect.setInspectType(0);
+ qualityInspect.setSupplier(purchaseLedger.getSupplierName());
+ qualityInspect.setPurchaseLedgerId(purchaseLedger.getId());
+ qualityInspect.setProductId(saleProduct.getProductId());
+ qualityInspect.setProductName(saleProduct.getProductCategory());
+ qualityInspect.setModel(saleProduct.getSpecificationModel());
+ qualityInspect.setProductModelId(saleProduct.getProductModelId());
+ qualityInspect.setUnit(saleProduct.getUnit());
+ qualityInspect.setQuantity(saleProduct.getQuantity());
+ qualityInspectMapper.insert(qualityInspect);
+
+ List<QualityTestStandard> qualityTestStandardList = qualityTestStandardMapper
+ .getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null);
+
+ if (qualityTestStandardList.isEmpty()) {
+ return;
+ }
+
+ QualityTestStandard firstStandard = qualityTestStandardList.get(0);
+ qualityInspect.setTestStandardId(firstStandard.getId());
+ qualityInspectMapper.updateById(qualityInspect);
+
+ List<QualityTestStandardParam> standardParams = qualityTestStandardParamMapper.selectList(
+ Wrappers.<QualityTestStandardParam>lambdaQuery()
+ .eq(QualityTestStandardParam::getTestStandardId, firstStandard.getId()));
+
+ for (QualityTestStandardParam standardParam : standardParams) {
+ QualityInspectParam param = new QualityInspectParam();
+ BeanUtils.copyProperties(standardParam, param);
+ param.setId(null);
+ param.setInspectId(qualityInspect.getId());
+ qualityInspectParamMapper.insert(param);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/sales/controller/InvoiceLedgerController.java b/src/main/java/com/ruoyi/sales/controller/InvoiceLedgerController.java
deleted file mode 100644
index 0559ff8..0000000
--- a/src/main/java/com/ruoyi/sales/controller/InvoiceLedgerController.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package com.ruoyi.sales.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.mapper.InvoiceLedgerFileMapper;
-import com.ruoyi.sales.service.InvoiceLedgerService;
-import io.jsonwebtoken.lang.Collections;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-@RestController
-@RequestMapping("/invoiceLedger")
-@AllArgsConstructor
-public class InvoiceLedgerController {
-
- private InvoiceLedgerService invoiceLedgerService;
- private InvoiceLedgerFileMapper invoiceLedgerFileMapper;
-
- /**
- * 寮�绁ㄥ彴璐︽柊澧�
- * @param productDto
- * @return
- */
- @PostMapping("/saveOrUpdate")
- public AjaxResult invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) {
- invoiceLedgerService.invoiceLedgerSaveOrUpdate(productDto);
- return AjaxResult.success();
- }
-
- /**
- * 寮�绁ㄥ彴璐﹀垹闄�
- * @param ids
- * @return
- */
- @DeleteMapping("/del")
- public AjaxResult invoiceLedgerDel(@RequestBody List<Integer> ids) {
- invoiceLedgerService.invoiceLedgerDel(ids);
- return AjaxResult.success();
- }
-
- /**
- * 寮�绁ㄥ彴璐﹀垎椤垫煡璇�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- @GetMapping("/page")
- public AjaxResult invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) {
- return AjaxResult.success(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto));
- }
-
- /**
- * 寮�绁ㄥ彴璐︽枃浠舵煡璇�
- * @param invoiceLedgerId
- * @return
- */
- @GetMapping("/fileList")
- public AjaxResult invoiceLedgerFileList(Integer invoiceLedgerId) {
- return AjaxResult.success(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId));
- }
-
- /**
- * 寮�绁ㄥ彴璐︽枃浠跺垹闄�
- */
- @DeleteMapping("/delFile")
- @Log(title = "寮�绁ㄥ彴璐�", businessType = BusinessType.DELETE)
- public AjaxResult invoiceLedgerDelFile(@RequestBody List<Integer> ids) {
- if(Collections.isEmpty(ids)) return AjaxResult.error("璇烽�夋嫨瑕佸垹闄ょ殑鏂囦欢");
- invoiceLedgerFileMapper.deleteBatchIds(ids);
- return AjaxResult.success();
- }
-
-
-
- /**
- * 寮�绁ㄥ彴璐︽枃浠朵笂浼�
- * @param file
- * @return
- */
- @PostMapping("/uploadFile")
- public AjaxResult invoiceLedgerUploadFile(MultipartFile file) {
- try {
- return AjaxResult.success(invoiceLedgerService.invoiceLedgerUploadFile(file));
- }catch (Exception e) {
- return AjaxResult.error(e.getMessage());
- }
- }
-
- /**
- * 寮�绁ㄥ彴璐﹀鍑�
- * @param response
- * @param invoiceRegistrationProductDto
- * @return
- */
- @PostMapping("/export")
- public void invoiceLedgerExport(HttpServletResponse response, InvoiceRegistrationProductDto invoiceRegistrationProductDto) {
- invoiceLedgerService.invoiceLedgerExport(response, invoiceRegistrationProductDto);
- }
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- @GetMapping("/info")
- public AjaxResult invoiceLedgerInfo(Integer id) {
- return AjaxResult.success(invoiceLedgerService.invoiceLedgerDetail(id));
- }
-
- /**
- * 鏂囦欢鎻愪氦
- * @param invoiceLedgerDto
- * @return
- */
- @PostMapping("/commitFile")
- public AjaxResult invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) {
- try {
- invoiceLedgerService.invoiceLedgerCommitFile(invoiceLedgerDto);
- return AjaxResult.success();
- }catch (Exception e) {
- return AjaxResult.error(e.getMessage());
- }
- }
-
- /**
- * 寮�绁ㄥ彴璐︽煡璇�
- * @param invoiceLedgerDto
- * @return
- */
- @GetMapping("/list")
- public AjaxResult invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) {
- return AjaxResult.success(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto));
- }
-
- /**
- * 瀹㈡埛閿�鍞褰�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- @GetMapping("/salesAccount")
- public AjaxResult invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) {
- return AjaxResult.success(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto));
- }
-
- /**
- * 鏈湀寮�绁ㄩ噾棰�
- */
- @GetMapping("/getInvoiceAmount")
- public AjaxResult getInvoiceAmount() {
- try {
- BigDecimal amount = invoiceLedgerService.getInvoiceAmount();
- return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO);
- } catch (Exception e) {
- return AjaxResult.error("鑾峰彇寮�绁ㄩ噾棰濆け璐ワ細" + e.getMessage());
- }
- }
-
- /**
- * 浜у搧寮�绁ㄨ褰曟煡璇�
- * @param page
- * @param registrationProductDto
- * @return
- */
- @GetMapping("/registrationProductPage")
- public AjaxResult registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) {
-
- return AjaxResult.success(invoiceLedgerService.registrationProductPage(page,registrationProductDto));
- }
-
- /**
- * 浜у搧寮�绁ㄨ鎯�
- * @param id
- * @return
- */
- @GetMapping("/invoiceLedgerProductInfo")
- public AjaxResult invoiceLedgerProductDetail(Integer id) {
- return AjaxResult.success(invoiceLedgerService.invoiceLedgerProductDetail(id));
- }
-
- /**
- * 寮�绁ㄥ彴璐﹀垹闄�
- * @param invoiceRegistrationProductId
- * @return
- */
- @DeleteMapping("delInvoiceLedger/{invoiceRegistrationProductId}")
- public AjaxResult delInvoiceLedger(@PathVariable Integer invoiceRegistrationProductId) {
- try {
- invoiceLedgerService.delInvoiceLedger(invoiceRegistrationProductId);
- return AjaxResult.success();
- }catch (Exception e) {
- return AjaxResult.error(e.getMessage());
- }
- }
-
-}
diff --git a/src/main/java/com/ruoyi/sales/controller/InvoiceRegistrationController.java b/src/main/java/com/ruoyi/sales/controller/InvoiceRegistrationController.java
deleted file mode 100644
index 8ea6c11..0000000
--- a/src/main/java/com/ruoyi/sales/controller/InvoiceRegistrationController.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.ruoyi.sales.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.sales.dto.InvoiceRegistrationDto;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.dto.SalesLedgerDto;
-import com.ruoyi.sales.service.InvoiceRegistrationService;
-import io.jsonwebtoken.lang.Collections;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/invoiceRegistration")
-@AllArgsConstructor
-public class InvoiceRegistrationController {
-
- private InvoiceRegistrationService invoiceRegistrationService;
-
- /**
- * 寮�绁ㄧ櫥璁拌褰曟柊澧�
- * @param salesLedgerDto
- * @return
- */
- @PostMapping("/save")
- @Log(title = "寮�绁ㄧ櫥璁�", businessType = com.ruoyi.framework.aspectj.lang.enums.BusinessType.INSERT)
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult invoiceRegistrationSave(@RequestBody List<SalesLedgerDto> salesLedgerDto) {
- if(Collections.isEmpty(salesLedgerDto)) return AjaxResult.error("璇烽�夋嫨瑕佷繚瀛樼殑璁板綍");
- salesLedgerDto.forEach(item ->{
- invoiceRegistrationService.invoiceRegistrationSave(item);
- });
-
- return AjaxResult.success();
- }
-
- /**
- * 寮�绁ㄧ櫥璁板垹闄�
- * @param ids
- * @return
- */
- @DeleteMapping("/del")
- public AjaxResult invoiceRegistrationDel(@RequestBody List<Integer> ids) {
- invoiceRegistrationService.invoiceRegistrationDel(ids);
- return AjaxResult.success();
- }
-
- /**
- * 寮�绁ㄨ褰曚慨鏀�
- * @param invoiceRegistrationDto
- * @return
- */
- @PostMapping("/update")
- public AjaxResult invoiceRegistrationUpdate(@RequestBody InvoiceRegistrationDto invoiceRegistrationDto) {
- invoiceRegistrationService.invoiceRegistrationUpdate(invoiceRegistrationDto);
- return AjaxResult.success();
- }
-
- /**
- * 寮�绁ㄧ櫥璁板垎椤垫煡璇�
- * @param page
- * @param invoiceRegistrationDto
- * @return
- */
- @GetMapping("/listPage")
- public AjaxResult invoiceRegistrationListPage(Page page, InvoiceRegistrationDto invoiceRegistrationDto) {
- return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationListPage(page, invoiceRegistrationDto));
- }
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佹煡璇�
- * @param invoiceRegistrationProductDto
- * @return
- */
- @GetMapping("/productList")
- public AjaxResult invoiceRegistrationProductList(InvoiceRegistrationProductDto invoiceRegistrationProductDto) {
- return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationProductList(invoiceRegistrationProductDto));
- }
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佽鎯�
- * @param id
- * @return
- */
- @GetMapping("/detail")
- public AjaxResult invoiceRegistrationDetail(Integer id) {
- return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationDetail(id));
- }
-
- /**
- * 寮�绁ㄧ櫥璁板鍑�
- * @param response
- * @param invoiceRegistrationDto
- */
- @PostMapping("/export")
- public void invoiceRegistrationExport(HttpServletResponse response, InvoiceRegistrationDto invoiceRegistrationDto) {
- invoiceRegistrationService.invoiceRegistrationExport(response, invoiceRegistrationDto);
- }
-}
diff --git a/src/main/java/com/ruoyi/sales/controller/MetricStatisticsController.java b/src/main/java/com/ruoyi/sales/controller/MetricStatisticsController.java
index 8ad4f02..577508a 100644
--- a/src/main/java/com/ruoyi/sales/controller/MetricStatisticsController.java
+++ b/src/main/java/com/ruoyi/sales/controller/MetricStatisticsController.java
@@ -1,11 +1,16 @@
package com.ruoyi.sales.controller;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.sales.dto.StatisticsTableDto;
import com.ruoyi.sales.service.impl.MetricStatisticsServiceImpl;
-import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -21,7 +26,8 @@
@AllArgsConstructor
public class MetricStatisticsController extends BaseController {
- private MetricStatisticsServiceImpl metricStatisticsService;
+ private final MetricStatisticsServiceImpl metricStatisticsService;
+ private final ICustomerService customerService;
@Operation(summary = "澶撮儴鎬昏")
@GetMapping("/total")
@@ -35,4 +41,18 @@
return metricStatisticsService.statisticsTable(statisticsTableDto);
}
+ @GetMapping("/customewTransactions")
+ @Log(title = "瀹㈡埛寰�鏉�", businessType = BusinessType.OTHER)
+ @Operation(summary = "瀹㈡埛寰�鏉�")
+ public R customewTransactions(Page page, String customerName) {
+ return R.ok(customerService.customewTransactions(page,customerName));
+ }
+
+ @GetMapping("/customewTransactionsDetails")
+ @Log(title = "瀹㈡埛寰�鏉ユ槑缁�", businessType = BusinessType.OTHER)
+ @Operation(summary = "瀹㈡埛寰�鏉ユ槑缁�")
+ public R customewTransactionsDetails(Page page, Long customerId) {
+ return R.ok(customerService.customewTransactionsDetails(page,customerId));
+ }
+
}
diff --git a/src/main/java/com/ruoyi/sales/controller/PaymentShippingController.java b/src/main/java/com/ruoyi/sales/controller/PaymentShippingController.java
index f88a0e6..f4d8497 100644
--- a/src/main/java/com/ruoyi/sales/controller/PaymentShippingController.java
+++ b/src/main/java/com/ruoyi/sales/controller/PaymentShippingController.java
@@ -15,6 +15,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import java.time.LocalDateTime;
import java.util.List;
/**
@@ -41,7 +42,7 @@
@Operation(summary = "娣诲姞鏀粯涓庡彂璐т俊鎭�")
@Transactional(rollbackFor = Exception.class)
public AjaxResult add(@RequestBody PaymentShipping paymentShipping) {
- String ord = OrderUtils.countTodayByCreateTime(paymentShippingMapper, "ORD","order_no");
+ String ord = OrderUtils.countTodayByCreateTime(paymentShippingMapper, "ORD","order_no", paymentShipping.getCreateTime() != null ? paymentShipping.getCreateTime() : LocalDateTime.now());
paymentShipping.setOrderNo(ord);
boolean save = paymentShippingService.save(paymentShipping);
return save ? success() : error();
diff --git a/src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java b/src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java
deleted file mode 100644
index 5512a8d..0000000
--- a/src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java
+++ /dev/null
@@ -1,191 +0,0 @@
-package com.ruoyi.sales.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.ReceiptPaymentDto;
-import com.ruoyi.sales.dto.ReceiptPaymentRecordDto;
-import com.ruoyi.sales.pojo.ReceiptPayment;
-import com.ruoyi.sales.service.ReceiptPaymentService;
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@RestController
-@RequestMapping("/receiptPayment")
-@AllArgsConstructor
-public class ReceiptPaymentController extends BaseController {
-
- private ReceiptPaymentService receiptPaymentService;
-
- /**
- * 鍥炴鐧昏鏂板
- * @param receiptPayment
- * @return
- */
- @PostMapping("/saveOrUpdate")
- public AjaxResult receiptPaymentSaveOrUpdate (@RequestBody List<ReceiptPayment> receiptPayment) {
- receiptPaymentService.receiptPaymentSaveOrUpdate(receiptPayment);
- return AjaxResult.success();
- }
-
- /**
- * 鍥炴鐧昏淇敼
- * @param receiptPayment
- * @return
- */
- @PostMapping("/update")
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult receiptPaymentUpdate (@RequestBody ReceiptPayment receiptPayment) {
- return AjaxResult.success(receiptPaymentService.receiptPaymentUpdate(receiptPayment));
- }
-
- /**
- * 鍥炴鐧昏鍒犻櫎
- * @param ids
- * @return
- */
- @DeleteMapping("/del")
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult receiptPaymentDel (@RequestBody List<Integer> ids) {
- return AjaxResult.success(receiptPaymentService.receiptPaymentDel(ids));
- }
-
- /**
- * 瀹㈡埛寰�鏉ヨ褰曟煡璇�
- * @param receiptPaymentDto
- * @return
- */
- @GetMapping("/customerInteractions")
- public AjaxResult customerInteractions (InvoiceLedgerDto receiptPaymentDto) {
- return AjaxResult.success(receiptPaymentService.customerInteractions(receiptPaymentDto));
- }
-
- /**
- * 鍥炴鐧昏璇︽儏
- * @param id
- * @return
- */
- @GetMapping("/info")
- public AjaxResult receiptPaymentInfo (Integer id) {
- return AjaxResult.success(receiptPaymentService.receiptPaymentInfo(id));
- }
-
- /**
- * 鏈湀鍥炴閲戦
- */
- @GetMapping("/getReceiptAmount")
- public AjaxResult getReceiptAmount() {
- try {
- BigDecimal receiptAmount = receiptPaymentService.getReceiptAmount();
- return AjaxResult.success(receiptAmount != null ? receiptAmount : BigDecimal.ZERO);
- } catch (Exception e) {
- return AjaxResult.error("鑾峰彇鍥炴閲戦澶辫触锛�" + e.getMessage());
- }
- }
-
- /**
- * 鏌ヨ宸茬粡缁戝畾鍙戠エ鐨勫紑绁ㄥ彴璐�
- * @param page
- * @param receiptPaymentDto
- * @return
- */
- @GetMapping("/bindInvoiceNoRegPage")
- public AjaxResult bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) {
- return AjaxResult.success(receiptPaymentService.bindInvoiceNoRegPage(page,receiptPaymentDto));
- }
-
- @Schema(description = "瀵煎嚭鍥炴鐧昏")
- @PostMapping("/export")
- public void export(HttpServletResponse response, String ids) {
- if (ids == null || ids.isEmpty()) {
- receiptPaymentService.exportPaymentList(response, null);
- } else {
- ArrayList<Long> idList = (ArrayList<Long>) Arrays.stream(ids.split(","))
- .map(s -> s.replaceAll("[\\[\\]]", "").trim())
- .map(Long::valueOf)
- .collect(Collectors.toList());
- receiptPaymentService.exportPaymentList(response, idList);
- }
- }
-
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- @GetMapping("/invoiceInfo")
- public AjaxResult invoiceInfo (Integer id) {
- return AjaxResult.success(receiptPaymentService.invoiceInfo(id));
- }
-
- /**
- * 鏈湀搴旀敹,鍥炴閲戦
- */
- @GetMapping("/getAmountMouth")
- public AjaxResult getAmountMouth() {
- return AjaxResult.success(receiptPaymentService.getAmountMouth());
- }
-
- /**
- * 鏌ヨ鍥炴璁板綍
- */
- @GetMapping("/receiptPaymentHistoryList")
- public TableDataInfo receiptPaymentHistoryList(ReceiptPaymentDto receiptPaymentDto) {
- startPage();
- List<ReceiptPaymentDto> list = receiptPaymentService.receiptPaymentHistoryList(receiptPaymentDto);
- return getDataTable(list);
- }
-
- /**
- * 鏌ヨ鍥炴璁板綍
- */
- @GetMapping("/receiptPaymentHistoryListPage")
- public IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page, ReceiptPaymentDto receiptPaymentDto) {
- return receiptPaymentService.receiptPaymentHistoryListPage(page,receiptPaymentDto);
- }
-
- /**
- * 瀵煎嚭鍥炴娴佹按鍒楄〃
- */
- @Log(title = "瀵煎嚭鍥炴娴佹按鍒楄〃", businessType = BusinessType.EXPORT)
- @PostMapping("/exportOne")
- public void exportOne(HttpServletResponse response, ReceiptPaymentDto salesLedgerDto) {
- Page page = new Page();
- page.setCurrent(-1);
- page.setSize(-1);
- IPage<ReceiptPaymentDto> salesLedgerIPage = receiptPaymentHistoryListPage(page, salesLedgerDto);
- ExcelUtil<ReceiptPaymentRecordDto> util = new ExcelUtil<ReceiptPaymentRecordDto>(ReceiptPaymentRecordDto.class);
- List<ReceiptPaymentRecordDto> receiptPaymentRecordDtos = new ArrayList<>();
- salesLedgerIPage.getRecords().forEach(receiptPaymentRecordDto -> {
- ReceiptPaymentRecordDto receiptPaymentRecordDto1 = new ReceiptPaymentRecordDto();
- BeanUtils.copyProperties(receiptPaymentRecordDto, receiptPaymentRecordDto1);
- receiptPaymentRecordDtos.add(receiptPaymentRecordDto1);
- });
- util.exportExcel(response, receiptPaymentRecordDtos, "瀵煎嚭寮�绁ㄧ櫥璁板垪琛�");
- }
-
- /**
- * 鏌ヨ鍥炴璁板綍涓嶅垎椤�
- */
- @GetMapping("/receiptPaymentHistoryListNoPage")
- public List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage(ReceiptPaymentDto receiptPaymentDto) {
- return receiptPaymentService.receiptPaymentHistoryListNoPage(receiptPaymentDto);
- }
-}
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
index ceb3702..ea18246 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -1,11 +1,11 @@
package com.ruoyi.sales.controller;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.enums.ApplicationTypeEnum;
import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
@@ -13,25 +13,20 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
import com.ruoyi.sales.dto.SalesLedgerDto;
-import com.ruoyi.sales.mapper.InvoiceLedgerMapper;
-import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
-import com.ruoyi.sales.pojo.ReceiptPayment;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.service.ICommonFileService;
import com.ruoyi.sales.service.ISalesLedgerService;
import com.ruoyi.sales.vo.SalesLedgerVo;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.basic.utils.FileUtil;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -57,8 +52,6 @@
private ISalesLedgerService salesLedgerService;
private ICommonFileService commonFileService;
- private InvoiceLedgerMapper invoiceLedgerMapper;
- private ReceiptPaymentMapper receiptPaymentMapper;
private final FileUtil fileUtil;
/**
@@ -122,20 +115,6 @@
if(CollectionUtils.isEmpty(list)){
return getDataTable(list);
}
- List<Long> salesLedgerIds = list.stream().map(SalesLedger::getId).collect(Collectors.toList());
- List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoicedTotal(salesLedgerIds);
- if(CollectionUtils.isEmpty(invoiceLedgerDtoList)){
- return getDataTable(list);
- }
- for (SalesLedger salesLedger : list) {
- for (InvoiceLedgerDto invoiceLedgerDto : invoiceLedgerDtoList) {
- if (salesLedger.getId().intValue() == invoiceLedgerDto.getSalesLedgerId()) {
- BigDecimal noInvoiceAmountTotal = salesLedger.getContractAmount().subtract(invoiceLedgerDto.getInvoiceTotal());
- salesLedger.setNoInvoiceAmountTotal(noInvoiceAmountTotal);
- }
- }
- }
-
return getDataTable(list);
}
@@ -267,77 +246,29 @@
// 鑾峰彇褰撳墠椤垫墍鏈夊彴璐﹁褰曠殑 ID 闆嗗悎
List<Long> salesLedgerIds = iPage.getRecords().stream().map(SalesLedger::getId).collect(Collectors.toList());
- // 鏌ヨ鍙戠エ淇℃伅鐨勫凡寮�绁ㄩ噾棰�
- List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoicedTotal(salesLedgerIds);
- if (CollectionUtils.isEmpty(invoiceLedgerDtoList)) {
- invoiceLedgerDtoList = Collections.emptyList();
- }
- // 杞崲鍙戠エ鏁版嵁, key 涓哄彴璐D, value 涓鸿鍙拌处鐨勬�诲紑绁ㄩ噾棰�
- Map<Long, BigDecimal> invoiceTotals = invoiceLedgerDtoList.stream()
- .filter(dto -> dto.getSalesLedgerId() != null && dto.getInvoiceTotal() != null)
- .collect(Collectors.toMap(
- dto -> dto.getSalesLedgerId().longValue(),
- InvoiceLedgerDto::getInvoiceTotal,
- BigDecimal::add // 瀛樺湪閲嶅ID鎵ц绱姞
- ));
- // 鏌ヨ鍥炴/浠樻璁板綍
- List<ReceiptPayment> receiptPayments = Collections.emptyList();
- if (!CollectionUtils.isEmpty(salesLedgerIds)) {
- receiptPayments = receiptPaymentMapper.selectList(new LambdaQueryWrapper<ReceiptPayment>()
- .in(ReceiptPayment::getSalesLedgerId, salesLedgerIds));
- }
// 杞崲鍥炴鏁版嵁, key 涓哄彴璐D, value 涓鸿鍙拌处鐨勬�诲洖娆鹃噾棰�
Map<Long, BigDecimal> receiptTotals = new HashMap<>();
- if (!CollectionUtils.isEmpty(receiptPayments)) {
- for (ReceiptPayment receiptPayment : receiptPayments) {
- if (receiptPayment.getSalesLedgerId() != null && receiptPayment.getReceiptPaymentAmount() != null) {
- // 濡傛灉 key 瀛樺湪鍒欑浉鍔�,涓嶅瓨鍦ㄥ垯鏀惧叆
- receiptTotals.merge(receiptPayment.getSalesLedgerId(), receiptPayment.getReceiptPaymentAmount(), BigDecimal::add);
- }
- }
- }
+
for (SalesLedgerVo salesLedgerVo : iPage.getRecords()) {
Long ledgerId = salesLedgerVo.getId();
// 鍚堝悓鎬婚噾棰�
BigDecimal contractAmount = salesLedgerVo.getContractAmount() == null ? BigDecimal.ZERO : salesLedgerVo.getContractAmount();
// 寮�绁ㄦ�婚鍜屽洖娆炬�婚
- BigDecimal invoiceTotal = invoiceTotals.getOrDefault(ledgerId, BigDecimal.ZERO);
BigDecimal receiptPaymentAmountTotal = receiptTotals.getOrDefault(ledgerId, BigDecimal.ZERO);
- // 鏈紑绁ㄩ噾棰� = 鍚堝悓閲戦 - 宸插紑绁ㄩ噾棰�
- BigDecimal noInvoiceAmountTotal = contractAmount.subtract(invoiceTotal);
- if (noInvoiceAmountTotal.compareTo(BigDecimal.ZERO) < 0) {
- noInvoiceAmountTotal = BigDecimal.ZERO;
- }
-
- // 寰呭洖娆鹃噾棰� = 宸插紑绁ㄩ噾棰� - 宸插洖娆鹃噾棰�
- BigDecimal noReceiptPaymentAmountTotal = invoiceTotal.subtract(receiptPaymentAmountTotal);
- if (noReceiptPaymentAmountTotal.compareTo(BigDecimal.ZERO) < 0) {
- noReceiptPaymentAmountTotal = BigDecimal.ZERO;
- }
-
- salesLedgerVo.setNoInvoiceAmountTotal(noInvoiceAmountTotal);
- salesLedgerVo.setInvoiceTotal(invoiceTotal);
- salesLedgerVo.setReceiptPaymentAmountTotal(receiptPaymentAmountTotal);
- salesLedgerVo.setNoReceiptAmount(noReceiptPaymentAmountTotal);
-
// 濡傛灉宸茬粡鏈夎繃寮�绁ㄦ垨鍥炴鎿嶄綔,鍒欎笉鍏佽缂栬緫
- boolean hasInvoiceOperation = invoiceTotal.compareTo(BigDecimal.ZERO) > 0;
boolean hasReceiptOperation = receiptPaymentAmountTotal.compareTo(BigDecimal.ZERO) > 0;
- salesLedgerVo.setIsEdit(!(hasInvoiceOperation || hasReceiptOperation));
+ salesLedgerVo.setIsEdit(!hasReceiptOperation);
salesLedgerVo.setStorageBlobVOs(fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, ledgerId));
}
if (ObjectUtils.isNotEmpty(salesLedgerDto.getStatus())) {
if (salesLedgerDto.getStatus()) {
- // 娓呴櫎鎵�鏈夆�滄湭寮�绁ㄩ噾棰濃�濅负 0 鐨勮褰�
- iPage.getRecords().removeIf(salesLedger ->
- Objects.equals(salesLedger.getNoInvoiceAmountTotal(), new BigDecimal("0.00")));
iPage.setTotal(iPage.getRecords().size());
}
}
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
index 411291c..f04417e 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
@@ -1,29 +1,19 @@
package com.ruoyi.sales.controller;
import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.procurementrecord.service.ProcurementRecordService;
-import com.ruoyi.procurementrecord.utils.StockUtils;
-import com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto;
-import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.service.ISalesLedgerProductService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
-import java.math.BigDecimal;
import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
/**
* 浜у搧淇℃伅Controller
@@ -37,29 +27,6 @@
public class SalesLedgerProductController extends BaseController
{
private final ISalesLedgerProductService salesLedgerProductService;
- private final ProcurementRecordService procurementRecordService;
- private final StockUtils stockUtils;
- private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
-
-
- /**
- * 鍥炴鐧昏鍒嗛〉鏌ヨ
- */
- @GetMapping("/listPageSalesLedger")
- public AjaxResult listPage(Page page, SalesLedgerProductDto salesLedgerProduct) {
- IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPage(page,salesLedgerProduct);
- return AjaxResult.success(list);
- }
-
-
- /**
- * 浠樻鐧昏鍒嗛〉鏌ヨ
- */
- @GetMapping("/listPagePurchaseLedger")
- public AjaxResult listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) {
- IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPagePurchaseLedger(page,salesLedgerProduct);
- return AjaxResult.success(list);
- }
/**
@@ -68,40 +35,32 @@
@GetMapping("/list")
public AjaxResult list(SalesLedgerProduct salesLedgerProduct) {
List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct);
- if (CollUtil.isEmpty(list)) {
- return AjaxResult.success(list);
- }
- //
- List<Long> productIds = list.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList());
- List<SimpleReturnOrderGroupDto> groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds);
- Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getSalesLedgerProductId, item -> item.getSumReturnQuantity()));
-
- list.forEach(item -> {
- if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) {
- item.setFutureTickets(BigDecimal.ZERO);
- }
- if (item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) {
- item.setFutureTicketsAmount(BigDecimal.ZERO);
- }
-// ProcurementPageDto procurementDto = new ProcurementPageDto();
-// procurementDto.setSalesLedgerProductId(item.getId());
-// procurementDto.setProductCategory(item.getProductCategory());
-// IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(new Page<>(1,-1), procurementDto);
-// BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity");
-
-// ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0);
- if (item.getApproveStatus() != 2) {
- if (item.getHasSufficientStock() == 0) {
- item.setApproveStatus(0);
- } else {
- item.setApproveStatus(1);
+ if (CollUtil.isNotEmpty(list)) {
+ list.forEach(item -> {
+ if (item.getApproveStatus() != 2) {
+ if (item.getHasSufficientStock() == 0) {
+ item.setApproveStatus(0);
+ } else {
+ item.setApproveStatus(1);
+ }
}
- }
- // 缁熻閫�璐ф暟閲�
- BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getId(), BigDecimal.ZERO);
- item.setReturnQuality(returnQuality);
- item.setAvailableQuality(item.getQuantity().subtract(returnQuality));
- });
+ java.math.BigDecimal returnQuantity = item.getReturnQuantity() == null
+ ? java.math.BigDecimal.ZERO
+ : item.getReturnQuantity();
+ item.setReturnQuantity(returnQuantity);
+ java.math.BigDecimal availableQuality = item.getQuantity() == null
+ ? java.math.BigDecimal.ZERO
+ : item.getQuantity();
+ if (item.getType() != null && item.getType() == 2) {
+ availableQuality = item.getApprovedStockInNum() == null
+ ? java.math.BigDecimal.ZERO
+ : item.getApprovedStockInNum();
+ availableQuality = availableQuality
+ .subtract(item.getShippedQuantity() == null ? java.math.BigDecimal.ZERO : item.getShippedQuantity());
+ }
+ item.setAvailableQuality(availableQuality.subtract(returnQuantity));
+ });
+ }
return AjaxResult.success(list);
}
diff --git a/src/main/java/com/ruoyi/sales/controller/ShipmentApprovalController.java b/src/main/java/com/ruoyi/sales/controller/ShipmentApprovalController.java
deleted file mode 100644
index 8c95270..0000000
--- a/src/main/java/com/ruoyi/sales/controller/ShipmentApprovalController.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package com.ruoyi.sales.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
-import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.procurementrecord.utils.StockUtils;
-import com.ruoyi.sales.mapper.ShipmentApprovalMapper;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import com.ruoyi.sales.pojo.ShipmentApproval;
-import com.ruoyi.sales.service.ISalesLedgerProductService;
-import com.ruoyi.sales.service.ShipmentApprovalService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/shipmentApproval")
-@Tag(name = "鍙戣揣瀹℃壒绠$悊")
-@AllArgsConstructor
-public class ShipmentApprovalController extends BaseController {
-
- private final ShipmentApprovalService shipmentApprovalService;
- private final ShipmentApprovalMapper shipmentApprovalMapper;
- private final ISalesLedgerProductService salesLedgerProductService;
- private final StockUtils stockUtils;
-
- @GetMapping("/listPage")
- @Operation(summary = "鍙戣揣瀹℃壒鍒楄〃")
- public AjaxResult listPage(Page page, ShipmentApproval req) {
- IPage<ShipmentApproval> listPage = shipmentApprovalService.listPage(page,req);
- return AjaxResult.success(listPage);
- }
-
- @PostMapping("/update")
- @Operation(summary = "鍙戣揣瀹℃壒,鏇存柊鍙戣揣瀹℃壒鐘舵��")
- @Transactional(rollbackFor = Exception.class)
- public AjaxResult update(@RequestBody ShipmentApproval req) {
-
- // 鏌ヨ鍙戣揣瀹℃壒
- ShipmentApproval shipmentApproval = shipmentApprovalMapper.selectById(req.getId());
- if (shipmentApproval == null) {
- return AjaxResult.error("鍙戣揣瀹℃壒涓嶅瓨鍦�");
- }
-
- // 鏇存柊鍙戣揣瀹℃壒鐘舵��
- shipmentApproval.setApproveStatus(req.getApproveStatus());
- boolean update = shipmentApprovalService.updateById(shipmentApproval);
- if (!update) {
- // 浜嬪姟鍥炴粴
- throw new ServiceException("鍙戣揣瀹℃壒鏇存柊澶辫触");
- }
- // 鏌ヨ鍏宠仈鐨勯攢鍞彴璐︿骇鍝�
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductService.getById(shipmentApproval.getSalesLedgerProductId());
- if (salesLedgerProduct == null) {
- // 鎶涘紓甯镐簨鍔″洖婊�
- throw new ServiceException("閿�鍞彴璐︿笉瀛樺湪锛屽鎵瑰洖婊�");
- }
-
- // 鍚屾鏇存柊閿�鍞彴璐︿骇鍝佺殑瀹℃壒鐘舵��
- salesLedgerProduct.setApproveStatus(req.getApproveStatus());
- salesLedgerProductService.updateById(salesLedgerProduct);
-
- // 瀹℃壒閫氳繃
- if (req.getApproveStatus() == 3) {
-// // 鏌ヨ閲囪喘鍏ュ簱璁板綍
-// LambdaQueryWrapper<ProcurementRecordStorage> lambdaQueryWrapper = new LambdaQueryWrapper<ProcurementRecordStorage>()
-// .eq(ProcurementRecordStorage::getSalesLedgerProductId, req.getSalesLedgerProductId());
-// ProcurementRecordStorage procurementRecordStorage = procurementRecordStorageService.getOne(lambdaQueryWrapper);
-//
-// if (procurementRecordStorage == null) {
-// // 淇濊瘉鍓嶉潰鐨勪慨鏀瑰叏閮ㄥ洖婊�
-// throw new ServiceException("閲囪喘璁板綍涓嶅瓨鍦紝瀹℃壒鍥炴粴");
-// }
-
-
- //鍑哄簱
- stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId());
- }
-
- return AjaxResult.success();
- }
-
-
-
- /**
- * 瀵煎嚭鍙戣揣淇℃伅绠$悊
- */
- @PostMapping("/export")
- @Operation(summary = "瀵煎嚭鍙戣揣瀹℃壒")
- public void export(HttpServletResponse response) {
- List<ShipmentApproval> list = shipmentApprovalService.list();
- ExcelUtil<ShipmentApproval> util = new ExcelUtil<ShipmentApproval>(ShipmentApproval.class);
- util.exportExcel(response, list, "鍙戣揣瀹℃壒");
- }
-
-}
diff --git a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
index 458be2d..552aaa9 100644
--- a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
+++ b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -2,14 +2,10 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.approve.bean.vo.ApproveProcessVO;
import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
-import com.ruoyi.common.utils.OrderUtils;
-import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
@@ -25,7 +21,6 @@
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
-import java.time.LocalDate;
import java.util.List;
/**
@@ -55,22 +50,7 @@
@Transactional(rollbackFor = Exception.class)
@Log(title = "鍙戣揣淇℃伅绠$悊", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody ShippingInfoDto req) throws Exception {
- LoginUser loginUser = SecurityUtils.getLoginUser();
- String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shipping_no");
- // 鍙戣揣瀹℃壒
- ApproveProcessVO approveProcessVO = new ApproveProcessVO();
- approveProcessVO.setApproveType(7);
- approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
- approveProcessVO.setApproveReason(req.getType() + ":" +sh);
- approveProcessVO.setApproveUserIds(req.getApproveUserIds());
- approveProcessVO.setApproveUser(loginUser.getUserId());
- approveProcessVO.setApproveTime(LocalDate.now().toString());
- approveProcessService.addApprove(approveProcessVO);
- // 娣诲姞鍙戣揣娑堟伅
- req.setShippingNo(sh);
- req.setStatus("寰呭鏍�");
- boolean save = shippingInfoService.add(req);
- return save ? AjaxResult.success() : AjaxResult.error();
+ return AjaxResult.success(shippingInfoService.addReq(req) ? "娣诲姞鎴愬姛" : "娣诲姞澶辫触");
}
@Operation(summary = "鍙戣揣鎵e簱瀛�")
@@ -116,13 +96,20 @@
@GetMapping("/getByCustomerName")
- @Operation(summary = "閫氳繃瀹㈡埛鍚嶇О鏌ヨ")
+ @Operation(summary = "閫氳繃瀹㈡埛鍚嶇О鏌ヨ鍏宠仈鐨勫彂璐у崟鍙�")
public AjaxResult getByCustomerName(String customerName) {
return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName));
}
@GetMapping("/getDateil/{id}")
+ @Operation(summary = "閫氳繃id鏌ヨ璇︽儏")
public R getDateil(@PathVariable("id") Long id) {
return R.ok(shippingInfoService.getDetail(id));
}
+
+ @GetMapping("/getDateilByShippingNo")
+ @Operation(summary = "閫氳繃鍙戣揣鍗曞彿鏌ヨ璇︽儏")
+ public R getDateilByShippingNo(String shippingNo) {
+ return R.ok(shippingInfoService.getDateilByShippingNo(shippingNo));
+ }
}
diff --git a/src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java b/src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java
deleted file mode 100644
index 8f15d3b..0000000
--- a/src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.ruoyi.sales.dto;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.common.vo.FileVo;
-import com.ruoyi.sales.pojo.InvoiceLedger;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.util.Date;
-import java.util.List;
-
-@Data
-public class InvoiceLedgerDto extends InvoiceLedger {
-
- private List<FileVo> fileList;
-
- @Schema(description = "鏌ヨ鏂囨湰")
- private String searchText;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Schema(description = "瀹㈡埛ID")
- private Integer customerId;
-
- @Schema(description = "瀹㈡埛鍚堝悓鍙�")
- private String customerContractNo;
-
- @Schema(description = "涓氬姟鍛�")
- private String salesman;
-
- @Schema(description = "鍙戠エ鏂囦欢鍚�")
- private String invoiceFileName;
-
- @Schema(description = "鍥炴閲戦")
- private BigDecimal receiptPaymentAmount;
-
- @Schema(description = "鍥炴鏃ユ湡")
- @JsonFormat(pattern = "yyyy-MM-dd")
- private Date receiptPaymentDate;
-
- @Schema(description = "鏈洖娆鹃噾棰�")
- private BigDecimal unReceiptPaymentAmount;
-
- @Schema(description = "绋庣巼")
- private BigDecimal taxRate;
-
- @Schema(description = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- @Schema(description = "閿�鍞悎鍚孖D")
- private Integer salesLedgerId;
-
- private String paymentMethod;
-}
diff --git a/src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationDto.java b/src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationDto.java
deleted file mode 100644
index af7dedc..0000000
--- a/src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationDto.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.sales.dto;
-
-import com.ruoyi.sales.pojo.InvoiceRegistration;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-@Data
-public class InvoiceRegistrationDto extends InvoiceRegistration {
-
- @Schema(description = "寮�绁ㄧ櫥璁颁骇鍝侀泦鍚�")
- private List<InvoiceRegistrationProductDto> productDtoList;
-
- @Schema(description = "瀹㈡埛鍚堝悓鍙�")
- private String customerContractNo;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Schema(description = "鍚堝悓閲戦")
- private BigDecimal contractAmount;
-
- @Schema(description = "鏈紑绁ㄩ噾棰�")
- private BigDecimal noInvoiceAmountTotal;
-
-}
diff --git a/src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationProductDto.java b/src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationProductDto.java
deleted file mode 100644
index 4f94afc..0000000
--- a/src/main/java/com/ruoyi/sales/dto/InvoiceRegistrationProductDto.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.ruoyi.sales.dto;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.common.vo.FileVo;
-import com.ruoyi.sales.pojo.CommonFile;
-import com.ruoyi.sales.pojo.InvoiceLedgerFile;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Data
-public class InvoiceRegistrationProductDto extends InvoiceRegistrationProduct {
-
- @Schema(description = "瀹㈡埛鍚堝悓鍙�")
- private String customerContractNo;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Schema(description = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- @Schema(description = "闄勪欢")
- private List<FileVo> fileList;
-
- @Schema(description = "鍙戠エ鍙�")
- private String invoiceNo;
-
- @Schema(description = "鍙戠エ閲戦")
- private BigDecimal invoiceTotal;
-
- @Schema(description = "寮�绁ㄤ汉")
- private String invoicePerson;
-
- @Schema(description = "寮�绁ㄦ椂闂�")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate invoiceDate;
-
- @TableField(exist = false)
- private String invoiceDateStart;
- @TableField(exist = false)
- private String invoiceDateEnd;
-
- @Schema(description = "寮�绁ㄥ彴璐d")
- private Integer invoiceLedgerId;
-
- @Schema(description = "鍙戠エ鏂囦欢鍚�")
- private String invoiceFileName;
-
- private List<InvoiceLedgerFile> commonFiles;
-
- private String searchText;
-
- private Boolean status;
-
- private String projectName;
-
-
- @TableField(exist = false)
- private String createTimeStart;
- @TableField(exist = false)
- private String createTimeEnd;
-
-
-}
diff --git a/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentDto.java b/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentDto.java
deleted file mode 100644
index fb2004a..0000000
--- a/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentDto.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.ruoyi.sales.dto;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import com.ruoyi.sales.pojo.ReceiptPayment;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.util.Date;
-
-@Data
-public class ReceiptPaymentDto extends ReceiptPayment {
-
- @Schema(description = "瀹㈡埛鍚堝悓鍙�")
- @Excel(name = "瀹㈡埛鍚堝悓鍙�")
- private String customerContractNo;
-
- @Schema(description = "鐘舵��")
- @Excel(name = "鐘舵��")
- private String statusName;
-
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "寮�绁ㄦ棩鏈�",width = 30,dateFormat = "yyyy-MM-dd")
- @Schema(description = "寮�绁ㄦ棩鏈�")
- private Date invoiceDate;
-
- @TableField(exist = false)
- private String invoiceDateStart;
- @TableField(exist = false)
- private String invoiceDateEnd;
-
- @Schema(description = "鏌ヨ鏂囨湰")
- private String searchText;
-
- @Schema(description = "閿�鍞彴璐ales_ledger")
- @Excel(isExport = false)
- private Long salesLedgerId;
-
- @Schema(description = "閿�鍞悎鍚屽彿")
- @Excel(name = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- @Schema(description = "瀹㈡埛鍚嶇ОID")
- @Excel(isExport = false)
- private Integer customerId;
-
- @Schema(description = "鍙戠エ鍙�")
- @Excel(name = "鍙戠エ鍙�")
- private String invoiceNo;
-
- @Schema(description = "鍙戠エ閲戦")
- @Excel(name = "鍙戠エ閲戦")
- private BigDecimal invoiceTotal;
-
- @Schema(description = "绋庣巼锛�%锛�")
- @Excel(name = "绋庣巼锛�%锛�")
- private BigDecimal taxRate;
-
- @Schema(description = "浜у搧澶х被")
- @Excel(name = "浜у搧澶х被")
- private String productCategory;
-
- @Schema(description = "鍥炴閲戦")
- @Excel(name = "鍥炴閲戦")
- private BigDecimal receiptPaymentAmountTotal;
-
- @Schema(description = "寰呭洖娆鹃噾棰�")
- @Excel(name = "寰呭洖娆鹃噾棰�")
- private BigDecimal noReceiptAmount;
-
- @TableField(exist = false)
- @Excel(isExport = false)
- private Boolean status;
-
- @TableField(exist = false)
- @Excel(isExport = false)
- private String receiptPaymentDateStart;
- @TableField(exist = false)
- @Excel(isExport = false)
- private String receiptPaymentDateEnd;
-
- @Schema(description = "椤圭洰鍚嶇О")
- @Excel(name = "椤圭洰鍚嶇О")
- private String projectName;
-
-
-}
diff --git a/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentExeclDto.java b/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentExeclDto.java
deleted file mode 100644
index 4212961..0000000
--- a/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentExeclDto.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.ruoyi.sales.dto;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-@Data
-public class ReceiptPaymentExeclDto {
-
- @Schema(description = "閿�鍞悎鍚屽彿")
- @Excel(name = "閿�鍞悎鍚屽彿",sort = 1)
- private String salesContractNo;
-
- @Schema(description = "瀹㈡埛鍚堝悓鍙�")
- @Excel(name = "瀹㈡埛鍚堝悓鍙�",sort = 2)
-
- private String customerContractNo;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- @Excel(name = "瀹㈡埛鍚嶇О",sort = 3)
- private String customerName;
-
- @Schema(description = "浜у搧澶х被")
- @Excel(name = "浜у搧澶х被",sort = 4)
- private String productCategory;
-
- @Schema(description = "椤圭洰鍚嶇О")
- @Excel(name = "椤圭洰鍚嶇О",sort = 5)
- private String projectName;
-
- @Schema(description = "鍙戠エ鍙�")
- @Excel(name = "鍙戠エ鍙�",sort = 6)
- private String invoiceNo;
-
- @Schema(description = "鍙戠エ閲戦")
- @Excel(name = "鍙戠エ閲戦",sort = 7)
- private BigDecimal invoiceTotal;
-
- @Schema(description = "绋庣巼锛�%锛�")
- @Excel(name = "绋庣巼锛�%锛�",sort = 8)
- private BigDecimal taxRate;
-
- @Schema(description = "鍥炴閲戦")
- @Excel(name = "鍥炴閲戦",sort = 9)
- private BigDecimal receiptPaymentAmountTotal;
-
- @Schema(description = "寰呭洖娆鹃噾棰�")
- @Excel(name = "寰呭洖娆鹃噾棰�",sort = 10)
- private BigDecimal noReceiptAmount;
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentRecordDto.java b/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentRecordDto.java
deleted file mode 100644
index c2410e8..0000000
--- a/src/main/java/com/ruoyi/sales/dto/ReceiptPaymentRecordDto.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.ruoyi.sales.dto;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.Date;
-
-/**
- * @author :yys
- * @date : 2025/10/31 10:17
- */
-@Data
-public class ReceiptPaymentRecordDto {
-
- @Schema(description = "瀹㈡埛鍚堝悓鍙�")
- @Excel(name = "瀹㈡埛鍚堝悓鍙�")
- private String customerContractNo;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鐧昏鏃ユ湡",width = 30,dateFormat = "yyyy-MM-dd")
- @Schema(description = "鐧昏鏃ユ湡")
- private LocalDateTime createTime;
-
- @Schema(description = "閿�鍞悎鍚屽彿")
- @Excel(name = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- @Schema(description = "鍥炴閲戦")
- @Excel(name = "鍥炴閲戦")
- private BigDecimal receiptPaymentAmount;
-
- @Schema(description = "椤圭洰鍚嶇О")
- @Excel(name = "椤圭洰鍚嶇О")
- private String projectName;
-
- @Schema(description = "鍥炴褰㈠紡 0鐢垫眹1鎵垮厬")
- @Excel(name = "鍥炴褰㈠紡",readConverterExp = "0=鐢垫眹,1=鎵垮厬")
- private String receiptPaymentType;
-
- @Schema(description = "鐧昏浜�")
- @Excel(name = "鐧昏浜�")
- private String registrant;
-
- @Schema(description = "鏉ユ鏃ユ湡")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鏉ユ鏃ユ湡",width = 30,dateFormat = "yyyy-MM-dd")
- private LocalDate receiptPaymentDate;
-
-}
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java
index c119e94..a4fc57c 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java
@@ -19,7 +19,7 @@
private String salesContractNo;
private String customerContractNo;
private String projectName;
- @JsonFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date entryDate;
private String entryDateStart;
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
index 2430d10..0023e17 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
@@ -43,6 +43,10 @@
@Excel(name = "绛捐鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private Date executionDate;
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "浜や粯鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date deliveryDate;
+
@Schema(description = "浠樻鏂瑰紡")
@Excel(name = "浠樻鏂瑰紡")
private String paymentMethod;
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java
index 2c95909..9f05b60 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java
@@ -73,6 +73,9 @@
@Excel(name = "鏄惁璐ㄦ", readConverterExp = "0=鍚�,1=鏄�")
private Boolean isChecked;
-
-
+ /**
+ * 鏄惁鐢熶骇
+ */
+ @Excel(name = "鏄惁鐢熶骇", readConverterExp = "0=鍚�,1=鏄�")
+ private Integer isProduction;
}
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesQuotationDto.java b/src/main/java/com/ruoyi/sales/dto/SalesQuotationDto.java
index 4841ffd..4b20ff8 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesQuotationDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesQuotationDto.java
@@ -17,4 +17,6 @@
*/
// 瀹℃壒浜�
private String approveUserIds;
+
+ private Long templateId;
}
diff --git a/src/main/java/com/ruoyi/sales/dto/ShippingApproveDto.java b/src/main/java/com/ruoyi/sales/dto/ShippingApproveDto.java
new file mode 100644
index 0000000..693016b
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/dto/ShippingApproveDto.java
@@ -0,0 +1,15 @@
+package com.ruoyi.sales.dto;
+
+import com.ruoyi.sales.pojo.ShippingInfo;
+import lombok.Data;
+
+import java.util.List;
+
+//鍙戣揣瀹℃壒鏌ョ湅璇︽儏
+@Data
+public class ShippingApproveDto {
+
+ private ShippingInfo shippingInfo;
+
+ private List<ShippingProductDetailDto> shippingProductDetailDtoList;
+}
diff --git a/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java b/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
index e12149f..724473a 100644
--- a/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
@@ -8,6 +8,7 @@
import com.ruoyi.sales.pojo.ShippingProductDetail;
import lombok.Data;
+import java.math.BigDecimal;
import java.util.List;
/**
@@ -40,6 +41,15 @@
private List<Long> batchNo;
private List<ShippingProductDetail> batchNoDetailList;
+ //鍏宠仈鐨勫嚭搴撳崟鍙�
+ private String outboundBatches;
+
+ //鍙戣揣鏁伴噺
+ private BigDecimal totalQuantity;
+
+ private Long templateId;
+
+ private String templateName;
}
diff --git a/src/main/java/com/ruoyi/sales/excel/InvoiceLedgerExcelDto.java b/src/main/java/com/ruoyi/sales/excel/InvoiceLedgerExcelDto.java
index b5d09a7..82da2a9 100644
--- a/src/main/java/com/ruoyi/sales/excel/InvoiceLedgerExcelDto.java
+++ b/src/main/java/com/ruoyi/sales/excel/InvoiceLedgerExcelDto.java
@@ -1,19 +1,12 @@
package com.ruoyi.sales.excel;
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.common.vo.FileVo;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import com.ruoyi.sales.pojo.InvoiceLedger;
-import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.List;
@Data
public class InvoiceLedgerExcelDto {
diff --git a/src/main/java/com/ruoyi/sales/excel/InvoiceRegisAndProductExcelDto.java b/src/main/java/com/ruoyi/sales/excel/InvoiceRegisAndProductExcelDto.java
deleted file mode 100644
index 8979504..0000000
--- a/src/main/java/com/ruoyi/sales/excel/InvoiceRegisAndProductExcelDto.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.ruoyi.sales.excel;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
-@Data
-public class InvoiceRegisAndProductExcelDto {
-
- @Excel(name = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- @Excel(name = "瀹㈡埛鍚堝悓鍙�")
- private String customerContractNo;
-
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Excel(name = "涓氬姟鍛�")
- private String salesman;
-
- @Excel(name = "椤圭洰鍚嶇О")
- private String projectName;
-
- @Excel(name = "鍚堝悓閲戦")
- private BigDecimal contractAmount;
-
- @Excel(name = "浜у搧澶х被")
- private String productCategory;
-
- @Excel(name = "瑙勬牸鍨嬪彿")
- private String specificationModel;
-
- @Excel(name = "鍗曚綅")
- private String unit;
-
- @Excel(name = "鏁伴噺")
- private BigDecimal quantity;
-
- @Excel(name = "绋庣巼%")
- private BigDecimal taxRate;
-
- @Excel(name = "鍚◣鍗曚环")
- private BigDecimal taxInclusiveUnitPrice;
-
- @Excel(name = "鍚◣鎬讳环")
- private BigDecimal taxInclusiveTotalPrice;
-
- @Excel(name ="涓嶅惈绋庢�讳环")
- private BigDecimal taxExclusiveTotalPrice;
-
- @Excel(name ="鍙戠エ绫诲瀷")
- private String invoiceType;
-
- @Excel(name ="寮�绁ㄦ暟")
- private Integer invoiceNum;
-
- @Excel(name ="鏈紑绁ㄦ暟")
- private Integer noInvoiceNum;
-
- @Excel(name ="寮�绁ㄩ噾棰�")
- private BigDecimal invoiceAmount;
-
- @Excel(name ="鏈紑绁ㄩ噾棰�")
- private BigDecimal noInvoiceAmount;
-
-
-}
diff --git a/src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerFileMapper.java b/src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerFileMapper.java
deleted file mode 100644
index b8c0b4c..0000000
--- a/src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerFileMapper.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.ruoyi.sales.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ruoyi.sales.pojo.InvoiceLedger;
-import com.ruoyi.sales.pojo.InvoiceLedgerFile;
-
-public interface InvoiceLedgerFileMapper extends BaseMapper<InvoiceLedgerFile> {
-}
diff --git a/src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerMapper.java b/src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerMapper.java
deleted file mode 100644
index a797024..0000000
--- a/src/main/java/com/ruoyi/sales/mapper/InvoiceLedgerMapper.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.ruoyi.sales.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.pojo.InvoiceLedger;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface InvoiceLedgerMapper extends BaseMapper<InvoiceLedger> {
-
- /**
- * 寮�绁ㄥ彴璐﹀垎椤垫煡璇�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- IPage<InvoiceLedgerDto> invoiceLedgerPage(Page page, @Param("invoiceLedgerDto") InvoiceLedgerDto invoiceLedgerDto);
-
- /**
- * 寮�绁ㄥ彴璐︽煡璇�
- * @param invoiceLedgerDto
- * @return
- */
- List<InvoiceLedgerDto> invoiceLedgerList(@Param("invoiceLedgerDto") InvoiceLedgerDto invoiceLedgerDto);
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- InvoiceLedgerDto invoiceLedgerInfo(Integer id);
-
- /**
- * 瀹㈡埛閿�鍞褰�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- IPage<InvoiceLedgerDto> invoiceLedgerSalesAccount(Page page,@Param("invoiceLedgerDto") InvoiceLedgerDto invoiceLedgerDto);
-
- /**
- * 浜у搧寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- InvoiceRegistrationProductDto invoiceLedgerProductInfo(Integer id);
-
- /**
- * 鏍规嵁閿�鍞悎鍚岃绠楀凡寮�绁ㄩ噾棰�
- * @param salesLedgerIds
- * @return
- */
- List<InvoiceLedgerDto> invoicedTotal(List<Long> salesLedgerIds);
-
-}
diff --git a/src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationMapper.java b/src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationMapper.java
deleted file mode 100644
index 54425c4..0000000
--- a/src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationMapper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ruoyi.sales.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.dto.InvoiceRegistrationDto;
-import com.ruoyi.sales.excel.InvoiceRegisAndProductExcelDto;
-import com.ruoyi.sales.pojo.InvoiceRegistration;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface InvoiceRegistrationMapper extends BaseMapper<InvoiceRegistration> {
-
- /**
- * 寮�绁ㄧ櫥璁板垎椤垫煡璇�
- * @param page
- * @param invoiceRegistrationDto
- * @return
- */
- IPage<InvoiceRegistrationDto> invoiceRegistrationListPage(Page page, @Param("invoiceRegistrationDto") InvoiceRegistrationDto invoiceRegistrationDto);
-
- /**
- * 寮�绁ㄧ櫥璁板鍑烘暟鎹煡璇�
- * @return
- */
- List<InvoiceRegisAndProductExcelDto> invoiceRegisAndProductExcelDtoList();
-}
diff --git a/src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationProductMapper.java b/src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationProductMapper.java
deleted file mode 100644
index 1c1ae7a..0000000
--- a/src/main/java/com/ruoyi/sales/mapper/InvoiceRegistrationProductMapper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ruoyi.sales.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface InvoiceRegistrationProductMapper extends BaseMapper<InvoiceRegistrationProduct> {
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佹煡璇�
- * @param invoiceRegistrationProductDto
- * @return
- */
- List<InvoiceRegistrationProductDto> invoiceRegistrationProductList(@Param("invoiceRegistrationProductDto") InvoiceRegistrationProductDto invoiceRegistrationProductDto);
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佸垎椤垫煡璇�
- * @param page
- * @param invoiceRegistrationProductDto
- * @return
- */
- IPage<InvoiceRegistrationProductDto> invoiceRegistrationProductPage(Page page, @Param("invoiceRegistrationProductDto") InvoiceRegistrationProductDto invoiceRegistrationProductDto);
-}
diff --git a/src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java b/src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java
deleted file mode 100644
index 576ebd7..0000000
--- a/src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.ruoyi.sales.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.dto.CustomerInteractionDto;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.ReceiptPaymentDto;
-import com.ruoyi.sales.dto.ReceiptPaymentExeclDto;
-import com.ruoyi.sales.pojo.ReceiptPayment;
-import org.apache.ibatis.annotations.Param;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-public interface ReceiptPaymentMapper extends BaseMapper<ReceiptPayment> {
-
- IPage<ReceiptPaymentDto> receiptPaymentListPage(Page page, @Param("receiptPaymentDto") ReceiptPaymentDto receiptPaymentDto);
-
- ReceiptPaymentDto receiptPaymentInfo(Integer id);
-
- /**
- * 鏌ヨ宸茬粡缁戝畾鍙戠エ鐨勫紑绁ㄥ彴璐�
- * @param page
- * @param receiptPaymentDto
- * @return
- */
- IPage<ReceiptPaymentDto> bindInvoiceNoRegPage(Page page, @Param("req") ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- InvoiceLedgerDto invoiceInfo(Integer id);
-
- /**
- * 璁$畻鍓嶅灏戞潯鏁版嵁鍥炴閲戦缁煎悎
- * @param customerId
- * @param total
- * @return
- */
- BigDecimal getReceiptAmount(@Param("customerId") Integer customerId, @Param("total") long total);
-
- /**
- * 鏌ヨ鍥炴璁板綍
- */
- List<ReceiptPaymentDto> receiptPaymentHistoryList(@Param("params") ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 鏌ヨ鍥炴璁板綍鍒嗛〉
- */
- IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page,@Param("params") ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 瀹㈡埛寰�鏉ヨ褰曟煡璇�
- * @param receiptPaymentDto
- * @return
- */
- List<CustomerInteractionDto> customerInteractions (ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 瀹㈡埛鍥炴璁板綍鏌ヨ
- * @param invoiceLedgerDto
- * @return
- */
- List<InvoiceLedgerDto> invoiceLedgerSalesAccount(@Param("invoiceLedgerDto") InvoiceLedgerDto invoiceLedgerDto);
-
- /**
- * 鏌ヨ鍥炴璁板綍涓嶅垎椤�
- */
- List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage( @Param("params") ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 閫氳繃寮�绁ㄧ櫥璁颁骇鍝乮d鏌ヨ鏄惁宸茬粡鏈夊洖娆捐褰�
- * @param invoiceRegistrationProductId
- * @return
- */
- List<ReceiptPayment> receiptPaymentListByProdRegId(Integer invoiceRegistrationProductId);
-
- List<ReceiptPaymentDto> bindInvoiceNoRegListAll();
-
- List<ReceiptPaymentExeclDto> bindInvoiceNoRegListByIds(List<Long> ids,Long tenantId);
-
-
-}
diff --git a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
index 9f49265..5518290 100644
--- a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
+import com.ruoyi.purchase.vo.PurchaseReportVo;
import com.ruoyi.sales.dto.SalesLedgerDto;
import com.ruoyi.sales.dto.SalesTrendDto;
import com.ruoyi.sales.dto.StatisticsTableDto;
@@ -86,4 +87,7 @@
List<SalesTrendDto> statisticsTable(@Param("statisticsTableDto")StatisticsTableDto statisticsTableDto);
IPage<SalesLedgerDto> listSalesLedgerAndShipped(Page page, @Param("ew") SalesLedgerDto salesLedgerDto);
+
+ IPage<PurchaseReportVo> selectPurchaseReportVoPage(Page page, @Param("customerName") String customerName);
+
}
diff --git a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
index f8e22b9..2615d19 100644
--- a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
@@ -5,7 +5,6 @@
import com.ruoyi.common.config.MyBaseMapper;
import com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto;
import com.ruoyi.sales.dto.LossProductModelDto;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import org.apache.ibatis.annotations.Param;
@@ -26,10 +25,6 @@
List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct);
SalesLedgerProduct selectSalesLedgerProductByMainId(@Param("productMainId") Long productMainId);
-
- IPage<SalesLedgerProductDto> listPage(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct);
-
- IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct);
IPage<ProcurementBusinessSummaryDto> procurementBusinessSummaryListPage(Page page, @Param("req") ProcurementBusinessSummaryDto procurementBusinessSummaryDto);
diff --git a/src/main/java/com/ruoyi/sales/mapper/ShipmentApprovalMapper.java b/src/main/java/com/ruoyi/sales/mapper/ShipmentApprovalMapper.java
deleted file mode 100644
index c3bf397..0000000
--- a/src/main/java/com/ruoyi/sales/mapper/ShipmentApprovalMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.ruoyi.sales.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.pojo.ShipmentApproval;
-import com.ruoyi.sales.pojo.ShippingInfo;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-
-public interface ShipmentApprovalMapper extends BaseMapper<ShipmentApproval> {
- IPage<ShipmentApproval> listPage(Page page,@Param("req") ShipmentApproval req);
-
-}
diff --git a/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java b/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
index 5c7a5bf..07bddbb 100644
--- a/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
@@ -3,10 +3,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
+import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.pojo.ShippingInfo;
-import com.ruoyi.sales.pojo.ShippingProductDetail;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -20,9 +19,7 @@
List<ShippingInfo> listAll();
- List<SalesLedgerProductDto> getReturnManagementDtoById(@Param("shippingId")Long shippingId);
+ List<ShippingProductVo> getReturnManagementDtoById(@Param("shippingId")Long shippingId);
List<ShippingInfo> getShippingInfoByCustomerName(String customerName);
-
- List<ShippingProductDetail> getDateil(Long id);
}
diff --git a/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java b/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java
index f564ba1..a679e0e 100644
--- a/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/ShippingProductDetailMapper.java
@@ -4,6 +4,7 @@
import com.ruoyi.sales.dto.ShippingProductDetailDto;
import com.ruoyi.sales.pojo.ShippingProductDetail;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -19,4 +20,6 @@
public interface ShippingProductDetailMapper extends BaseMapper<ShippingProductDetail> {
List<ShippingProductDetailDto> getDetail(Long id);
+
+ List<ShippingProductDetailDto> getDateilByShippingNo(@Param("shippingNo") String shippingNo);
}
diff --git a/src/main/java/com/ruoyi/sales/pojo/InvoiceLedger.java b/src/main/java/com/ruoyi/sales/pojo/InvoiceLedger.java
deleted file mode 100644
index ef85b3a..0000000
--- a/src/main/java/com/ruoyi/sales/pojo/InvoiceLedger.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.ruoyi.sales.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-
-@Data
-public class InvoiceLedger {
-
- /**
- * 搴忓彿
- */
- @TableId(type = IdType.AUTO)
- private Integer id;
-
- @Schema(description = "invoice_registration_product琛ㄤ富閿�")
- private Integer invoiceRegistrationProductId;
-
- @Schema(description = "鍙戠エ鍙�")
- private String invoiceNo;
-
- @Schema(description = "鍙戠エ閲戦")
- private BigDecimal invoiceTotal;
-
- @Schema(description = "寮�绁ㄤ汉")
- private String invoicePerson;
-
- @Schema(description = "寮�绁ㄦ椂闂�")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate invoiceDate;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/sales/pojo/InvoiceLedgerFile.java b/src/main/java/com/ruoyi/sales/pojo/InvoiceLedgerFile.java
deleted file mode 100644
index 0d4a4f5..0000000
--- a/src/main/java/com/ruoyi/sales/pojo/InvoiceLedgerFile.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.ruoyi.sales.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.TableField;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-@Data
-public class InvoiceLedgerFile {
-
- @Schema(description = "鏂囦欢ID")
- private Long id;
-
- @Schema(description = "鏂囦欢鍚嶇О")
- private String name;
-
- @Schema(description = "鏂囦欢璺緞")
- private String url;
-
- @Schema(description = "鏂囦欢澶у皬")
- private int fileSize;
-
- @Schema(description = "寮�绁ㄥ彴璐D")
- private Integer invoiceLedgerId;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/sales/pojo/InvoiceRegistration.java b/src/main/java/com/ruoyi/sales/pojo/InvoiceRegistration.java
deleted file mode 100644
index e7a926b..0000000
--- a/src/main/java/com/ruoyi/sales/pojo/InvoiceRegistration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.ruoyi.sales.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-@Data
-@TableName("invoice_registration")
-public class InvoiceRegistration {
-
- /**
- * 搴忓彿
- */
- @TableId(type = IdType.AUTO)
- private Integer id;
-
- @Schema(description = "閿�鍞彴璐ales_ledger涓婚敭")
- private Integer salesLedgerId;
-
- @Schema(description = "閿�鍞悎鍚屽彿")
- private String salesContractNo;
-
- @Schema(description = "瀹㈡埛鍚嶇ОID")
- private Integer customerId;
-
- @Schema(description = "涓氬姟鍛�")
- private String salesman;
-
- @Schema(description = "椤圭洰鍚嶇О")
- private String projectName;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/sales/pojo/InvoiceRegistrationProduct.java b/src/main/java/com/ruoyi/sales/pojo/InvoiceRegistrationProduct.java
deleted file mode 100644
index 75ef549..0000000
--- a/src/main/java/com/ruoyi/sales/pojo/InvoiceRegistrationProduct.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.ruoyi.sales.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
-@TableName("invoice_registration_product")
-@Data
-public class InvoiceRegistrationProduct {
-
- /**
- * 搴忓彿
- */
- @TableId(type = IdType.AUTO)
- private Integer id;
-
- @Schema(description = "鍏宠仈閿�鍞彴璐︿富琛ㄤ富閿�")
- private Integer salesLedgerId;
-
- @Schema(description = "sales_ledger_product涓婚敭")
- private Integer salesLedgerProductId;
-
- @Schema(description = "寮�绁ㄧ櫥璁拌〃invoice_registration涓婚敭")
- private Integer invoiceRegistrationId;
-
- @Schema(description = "浜у搧澶х被")
- private String productCategory;
-
- @Schema(description = "瑙勬牸鍨嬪彿")
- private String specificationModel;
-
- @Schema(description = "鍗曚綅")
- private String unit;
-
- @Schema(description = "鏁伴噺")
- private BigDecimal quantity;
-
- @Schema(description = "绋庣巼")
- private BigDecimal taxRate;
-
- @Schema(description = "鍚◣鍗曚环")
- private BigDecimal taxInclusiveUnitPrice;
-
- @Schema(description = "鍚◣鎬讳环")
- private BigDecimal taxInclusiveTotalPrice;
-
- @Schema(description = "涓嶅惈绋庢�讳环")
- private BigDecimal taxExclusiveTotalPrice;
-
- @Schema(description = "鍙戠エ绫诲瀷")
- private String invoiceType;
-
- @Schema(description = "寮�绁ㄦ暟")
- private BigDecimal invoiceNum;
-
- @Schema(description = "鏈紑绁ㄦ暟")
- private BigDecimal noInvoiceNum;
-
- @Schema(description = "寮�绁ㄩ噾棰�")
- private BigDecimal invoiceAmount;
-
- @Schema(description = "鏈紑绁ㄩ噾棰�")
- private BigDecimal noInvoiceAmount;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/sales/pojo/PaymentShipping.java b/src/main/java/com/ruoyi/sales/pojo/PaymentShipping.java
index 51589cd..8c37b72 100644
--- a/src/main/java/com/ruoyi/sales/pojo/PaymentShipping.java
+++ b/src/main/java/com/ruoyi/sales/pojo/PaymentShipping.java
@@ -60,7 +60,6 @@
private String remark;
@Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@Schema(description = "鍒涘缓鐢ㄦ埛")
diff --git a/src/main/java/com/ruoyi/sales/pojo/ReceiptPayment.java b/src/main/java/com/ruoyi/sales/pojo/ReceiptPayment.java
deleted file mode 100644
index 132bfa2..0000000
--- a/src/main/java/com/ruoyi/sales/pojo/ReceiptPayment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.ruoyi.sales.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Data
-public class ReceiptPayment {
-
- /**
- * 搴忓彿
- */
- @TableId(type = IdType.AUTO)
- private Integer id;
-
- @Schema(description = "鍥炴褰㈠紡 0鐢垫眹1鎵垮厬")
- private String receiptPaymentType;
-
- @Schema(description = "鍥炴閲戦")
- private BigDecimal receiptPaymentAmount;
-
- @Schema(description = "鐧昏浜�")
- private String registrant;
-
- @Schema(description = "invoice_ledger寮�绁ㄥ彴璐︿富閿甀D")
- private Integer invoiceLedgerId;
-
- @Schema(description = "sales_ledger閿�鍞彴璐︿富閿甀D")
- private Long salesLedgerId;
-
- @Schema(description = "sales_ledger_product閿�鍞彴璐︿骇鍝佷富閿甀D")
- private Long salesLedgerProductId;
-
- @Schema(description = "鏉ユ鏃ユ湡")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate receiptPaymentDate;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- @JsonFormat(pattern = "yyyy-MM-dd")
- private LocalDateTime createTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
index bc4d02c..c8a0443 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
@@ -1,15 +1,15 @@
package com.ruoyi.sales.pojo;
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.util.Date;
-
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
/**
* 閿�鍞彴璐﹀璞� sales_ledger
@@ -50,7 +50,7 @@
/**
* 褰曞叆鏃ユ湡
*/
- @JsonFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "褰曞叆鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date entryDate;
@@ -103,30 +103,15 @@
@Excel(name = "鍚堝悓閲戦")
private BigDecimal contractAmount;
- @TableField(exist = false)
- @Schema(description = "鏈紑绁ㄩ噾棰�(鍏�)")
- @Excel(name = "鏈紑绁ㄩ噾棰�")
- private BigDecimal noInvoiceAmountTotal = BigDecimal.ZERO;
-
@Schema(description = "绛捐鏃ユ湡")
private LocalDate executionDate;
- @TableField(exist = false)
- @Schema(description = "宸插紑绁ㄩ噾棰�(鍏�)")
- @Excel(name = "宸插紑绁ㄩ噾棰�")
- private BigDecimal invoiceTotal = BigDecimal.ZERO;
-
- @TableField(exist = false)
- @Schema(description = "鍥炴閲戦")
- private BigDecimal receiptPaymentAmountTotal = BigDecimal.ZERO;
-
- @TableField(exist = false)
- @Schema(description = "寰呭洖娆鹃噾棰�")
- private BigDecimal noReceiptAmount = BigDecimal.ZERO;
-
@Schema(description = "浠樻鏂瑰紡")
private String paymentMethod;
+ @Schema(description = "瀹為檯鍚堝悓閲戦")
+ private BigDecimal netContractAmount;
+
@TableField(exist = false)
@Schema(description = "鐢熶骇鐘舵��")
private String productionStatus = "鏈紑濮�";
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java b/src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
index c909871..9bcbd07 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
@@ -62,12 +62,6 @@
private String unit;
/**
- * 鐢熶骇鐐掓満
- */
- @Excel(name = "鐢熶骇鐐掓満")
- private String speculativeTradingName;
-
- /**
* 鏁伴噺
*/
@Excel(name = "鏁伴噺")
@@ -110,46 +104,6 @@
private Integer type;
/**
- * 鏈鏉ョエ鏁�
- */
- private BigDecimal ticketsNum=BigDecimal.ZERO;
-
- /**
- * 鏈鏉ョエ閲戦(鍏�)
- */
- private BigDecimal ticketsAmount=BigDecimal.ZERO;
-
- /**
- * 鏈潵绁ㄦ暟
- */
- private BigDecimal futureTickets=BigDecimal.ZERO;
-
- /**
- * 鏈潵绁ㄩ噾棰�(鍏�)
- */
- private BigDecimal futureTicketsAmount=BigDecimal.ZERO;
-
- @Schema(description = "寮�绁ㄦ暟")
- private BigDecimal invoiceNum = BigDecimal.ZERO;
-
- @Schema(description = "鏈紑绁ㄦ暟")
- private BigDecimal noInvoiceNum = BigDecimal.ZERO;
-
- @Schema(description = "寮�绁ㄩ噾棰�")
- private BigDecimal invoiceAmount = BigDecimal.ZERO;
-
- @Schema(description = "鏈紑绁ㄩ噾棰�")
- private BigDecimal noInvoiceAmount = BigDecimal.ZERO;
-
- @Schema(description = "鏈寮�绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal currentInvoiceNum;
-
- @TableField(exist = false)
- @Schema(description = "鏈寮�绁ㄩ噾棰�")
- private BigDecimal currentInvoiceAmount;
-
- /**
* 浜у搧id
*/
private Long productId;
@@ -158,26 +112,6 @@
* 浜у搧瑙勬牸id
*/
private Long productModelId;
-
- @Schema(description = "鍒濆鏈紑绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal originalNoInvoiceNum;
-
- @Schema(description = "涓存椂鏈紑绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal tempNoInvoiceNum;
-
- @Schema(description = "涓存椂鏈紑绁ㄩ噾棰�")
- @TableField(exist = false)
- private BigDecimal tempnoInvoiceAmount;
-
- @Schema(description = "涓存椂鏈潵绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal tempFutureTickets;
-
- @Schema(description = "涓存椂鏈潵绁ㄩ噾棰�")
- @TableField(exist = false)
- private BigDecimal tempFutureTicketsAmount;
@Schema(description = "鐧昏浜�")
private String register;
@@ -215,21 +149,13 @@
/**
* 浜у搧鐘舵��
*/
+ @TableField(exist = false)
+ @Schema(description = "鍏ュ簱瀹℃牳鐘舵��")
+ private String stockInApprovalStatus;
+
// @TableField(exist = false)
@Schema(description = "浜у搧鐘舵�侊細1-鍏呰冻")
private Integer approveStatus;
-
- @Schema(description = "寰呭洖娆炬�婚噾棰�")
- private BigDecimal pendingInvoiceTotal;
-
- @Schema(description = "鍥炴鎬婚噾棰�")
- private BigDecimal invoiceTotal = BigDecimal.ZERO;
-
- @Schema(description = "寰呬粯娆炬�婚噾棰�")
- private BigDecimal pendingTicketsTotal;
-
- @Schema(description = "浠樻鎬婚噾棰�")
- private BigDecimal ticketsTotal = BigDecimal.ZERO;
@Schema(description = "鏄惁璐ㄦ")
//閽堝閲囪喘鍙拌处锛屾槸鍚﹁川妫�
@@ -238,11 +164,7 @@
@TableField(exist = false)
private Integer hasSufficientStock;
- // 閫�璐ф暟閲�
- @TableField(exist = false)
- private BigDecimal returnQuality;
-
- // 鍙敤鏁伴噺 quantity - returnQuality
+ // 鍙敤鏁伴噺 quantity - returnQuantity
@TableField(exist = false)
private BigDecimal availableQuality;
@Schema(description = "鍒涘缓鐢ㄦ埛")
@@ -257,5 +179,22 @@
private Boolean isProduction;
@TableField(exist = false)
+ @Schema(description = "寰呭彂璐ф暟閲�")
private BigDecimal noQuantity;
+
+ @TableField(exist = false)
+ @Schema(description = "閫�璐ф暟閲�")
+ private BigDecimal returnQuantity;
+
+ @TableField(exist = false)
+ @Schema(description = "閿�鍞彂璐ф暟閲�")
+ private BigDecimal shippedQuantity;
+
+ @TableField(exist = false)
+ @Schema(description = "宸插鏍稿叆搴撴暟閲�")
+ private BigDecimal approvedStockInNum;
+
+ @TableField(exist = false)
+ @Schema(description = "瀹℃壒涓暟閲�")
+ private BigDecimal pendingApprovalQuantity;
}
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
index b72b3af..d8a97a6 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
@@ -52,7 +52,6 @@
@ApiModelProperty(value = "澶囨敞")
private String remark;
@ApiModelProperty(value = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty(value = "淇敼鏃堕棿")
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java b/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java
index 3e64d15..2e55e79 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java
@@ -14,7 +14,12 @@
private Long id;
@Schema(description = "閿�鍞姤浠峰崟id")
private Long salesQuotationId;
-
+ @Schema(description = "浜у搧Id")
+ @TableField(value = "product_id")
+ private Long productId;
+ @Schema(description = "浜у搧瑙勬牸Id")
+ @TableField(value = "product_model_id")
+ private Long productModelId;
@Schema(description = "鍟嗗搧鍚嶇О")
private String product;
@Schema(description = "鍟嗗搧瑙勬牸")
diff --git a/src/main/java/com/ruoyi/sales/pojo/ShipmentApproval.java b/src/main/java/com/ruoyi/sales/pojo/ShipmentApproval.java
deleted file mode 100644
index 6399728..0000000
--- a/src/main/java/com/ruoyi/sales/pojo/ShipmentApproval.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package com.ruoyi.sales.pojo;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.List;
-
-@Data
-@TableName("shipment_approval")
-public class ShipmentApproval {
- @TableId(type = IdType.AUTO)
- private Long id;
- @Schema(description = "鍙戣揣淇℃伅id")
- private Long shippingInfoId;
- @Schema(description = "閿�鍞彴璐d")
- private Long salesLedgerId;
- @Schema(description = "閿�鍞姤浠蜂骇鍝佽〃id")
- private Long salesLedgerProductId;
- @Schema(description = "鐢宠閮ㄩ棬id")
- private Long approveDeptId;
-
- @Schema(description = "鐢宠閮ㄩ棬鍚嶇О")
- @Excel(name = "鐢宠閮ㄩ棬")
- private String approveDeptName;
- @Schema(description = "瀹℃壒鐢ㄦ埛id")
- private Integer approveUserId;
- @Schema(description = "瀹℃壒鐢ㄦ埛鍚嶇О")
- @Excel(name = "瀹℃壒鐢ㄦ埛")
- private String approveUserNames;
-
- /**
- * 瀹℃壒鐘舵��
- */
- @Schema(description = "瀹℃壒鐘舵�侊細0鏈嚭搴�,1宸插嚭搴�,2寰呭鏍�,3瀹℃牳瀹屾垚,4瀹℃牳澶辫触")
- @Excel(name = "瀹℃壒鐘舵��", readConverterExp = "0=鏈嚭搴�,1=宸插嚭搴�,2=寰呭鏍�,3=瀹℃牳瀹屾垚,4=瀹℃牳澶辫触")
- private Integer approveStatus;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "淇敼鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Integer createUser;
-
- @Schema(description = "淇敼鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "鍙戣揣鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
- @TableField(exist = false)
- private Date shippingDate;
-
- @Excel(name = "鍙戣揣杞︾墝鍙�")
- @TableField(exist = false)
- private String shippingCarNumber;
-
- /**
- * 棰勮鏁伴噺
- */
-
- @TableField(exist = false)
- private BigDecimal warnNum;
-
- /**
- * 浜у搧澶х被
- */
- @Excel(name = "浜у搧澶х被")
- @TableField(exist = false)
- private String productCategory;
-
- /**
- * 瑙勬牸鍨嬪彿
- */
- @Excel(name = "瑙勬牸鍨嬪彿")
- @TableField(exist = false)
- private String specificationModel;
-
- /**
- * 鍗曚綅
- */
- @Excel(name = "鍗曚綅")
- @TableField(exist = false)
- private String unit;
-
- /**
- * 鏁伴噺
- */
- @Excel(name = "鏁伴噺")
- @TableField(exist = false)
- private BigDecimal quantity;
- @Excel(name = "鏈�浣庡簱瀛樻暟閲�")
- @TableField(exist = false)
- private BigDecimal minStock;
- /**
- * 绋庣巼
- */
- @Excel(name = "绋庣巼")
- @TableField(exist = false)
- private BigDecimal taxRate;
-
- /**
- * 鍚◣鍗曚环
- */
- @Excel(name = "鍚◣鍗曚环")
- @TableField(exist = false)
- private BigDecimal taxInclusiveUnitPrice;
-
- /**
- * 鍚◣鎬讳环
- */
- @Excel(name = "鍚◣鎬讳环")
- @TableField(exist = false)
- private BigDecimal taxInclusiveTotalPrice;
-
- /**
- * 涓嶅惈绋庢�讳环
- */
- @Excel(name = "涓嶅惈绋庢�讳环")
- @TableField(exist = false)
- private BigDecimal taxExclusiveTotalPrice;
-
- /**
- * 鍙戠エ绫诲瀷
- */
-
- @TableField(exist = false)
- private String invoiceType;
-
- /**
- * 鍙拌处绫诲瀷 1.閿�鍞� 2锛岄噰璐�
- */
- @TableField(exist = false)
- private Integer type;
-
- /**
- * 鏈鏉ョエ鏁�
- */
- @TableField(exist = false)
- private BigDecimal ticketsNum;
-
- /**
- * 鏈鏉ョエ閲戦(鍏�)
- */
- @TableField(exist = false)
- private BigDecimal ticketsAmount;
-
- /**
- * 鏈潵绁ㄦ暟
- */
- @TableField(exist = false)
- private BigDecimal futureTickets;
-
- /**
- * 鏈潵绁ㄩ噾棰�(鍏�)
- */
- @TableField(exist = false)
- private BigDecimal futureTicketsAmount;
-
- @Schema(description = "寮�绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal invoiceNum;
-
- @Schema(description = "鏈紑绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal noInvoiceNum;
-
- @Schema(description = "寮�绁ㄩ噾棰�")
- @TableField(exist = false)
- private BigDecimal invoiceAmount;
-
- @Schema(description = "鏈紑绁ㄩ噾棰�")
- @TableField(exist = false)
- private BigDecimal noInvoiceAmount;
-
- @Schema(description = "鏈寮�绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal currentInvoiceNum;
-
- @TableField(exist = false)
- @Schema(description = "鏈寮�绁ㄩ噾棰�")
- private BigDecimal currentInvoiceAmount;
-
- /**
- * 浜у搧id
- */
- @TableField(exist = false)
- private Long productId;
-
- /**
- * 浜у搧瑙勬牸id
- */
- @TableField(exist = false)
- private Long productModelId;
-
- @Schema(description = "鍒濆鏈紑绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal originalNoInvoiceNum;
-
- @Schema(description = "涓存椂鏈紑绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal tempNoInvoiceNum;
-
- @Schema(description = "涓存椂鏈紑绁ㄩ噾棰�")
- @TableField(exist = false)
- private BigDecimal tempnoInvoiceAmount;
-
- @Schema(description = "涓存椂鏈潵绁ㄦ暟")
- @TableField(exist = false)
- private BigDecimal tempFutureTickets;
-
- @Schema(description = "涓存椂鏈潵绁ㄩ噾棰�")
- @TableField(exist = false)
- private BigDecimal tempFutureTicketsAmount;
-
- @Schema(description = "鐧昏浜�")
- @TableField(exist = false)
- private String register;
-
- @Schema(description = "鐧昏鏃ユ湡")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @Excel(name = "鐧昏鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
- @TableField(exist = false)
- private LocalDateTime registerDate;
- /**
- * 閿�鍞悎鍚屽彿
- */
- @Excel(name = "閿�鍞悎鍚屽彿")
- @TableField(exist = false)
- private String salesContractNo;
-
- /**
- * 瀹㈡埛鍚堝悓鍙�
- */
- @Excel(name = "瀹㈡埛鍚堝悓鍙�")
- @TableField(exist = false)
- private String customerContractNo;
-
-
- /**
- * 椤圭洰鍚嶇О
- */
- @Excel(name = "椤圭洰鍚嶇О")
- @TableField(exist = false)
- private String projectName;
-
- /**
- * 褰曞叆鏃ユ湡
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- @TableField(exist = false)
- private Date entryDate;
-
- /**
- * 涓氬姟鍛�
- */
- @Excel(name = "涓氬姟鍛�")
- @TableField(exist = false)
- private String salesman;
-
- @TableField(exist = false)
- private Long customerId;
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- @Excel(name = "瀹㈡埛鍚嶇О")
- @TableField(exist = false)
- private String customerName;
-
- /**
- * 褰曞叆浜�
- */
- @TableField(exist = false)
- private String entryPerson;
-
- @TableField(exist = false)
- @Schema(description = "褰曞叆浜�")
- @Excel(name = "褰曞叆浜�")
- private String entryPersonName;
-
- /**
- * 澶囨敞
- */
- @Excel(name = "澶囨敞")
- @TableField(exist = false)
- private String remarks;
-
- /**
- * 闄勪欢鏉愭枡锛屽瓨鍌ㄦ枃浠跺悕绛夌浉鍏充俊鎭�
- */
- @TableField(exist = false)
- private String attachmentMaterials;
-
-
- /**
- * 鍚堝悓閲戦锛堜骇鍝佸惈绋庢�讳环锛�
- */
- @Excel(name = "鍚堝悓閲戦")
- @TableField(exist = false)
- private BigDecimal contractAmount;
-
- @TableField(exist = false)
- @Schema(description = "鏈紑绁ㄩ噾棰�(鍏�)")
- @Excel(name = "鏈紑绁ㄩ噾棰�")
- private BigDecimal noInvoiceAmountTotal = BigDecimal.ZERO;
-
- @Schema(description = "绛捐鏃ユ湡")
- @TableField(exist = false)
- private LocalDate executionDate;
-
- @TableField(exist = false)
- @Schema(description = "宸插紑绁ㄩ噾棰�(鍏�)")
- @Excel(name = "宸插紑绁ㄩ噾棰�")
- private BigDecimal invoiceTotal = BigDecimal.ZERO;
-
- @TableField(exist = false)
- @Schema(description = "鍥炴閲戦")
- private BigDecimal receiptPaymentAmountTotal = BigDecimal.ZERO;
-
- @TableField(exist = false)
- @Schema(description = "寰呭洖娆鹃噾棰�")
- private BigDecimal noReceiptAmount = BigDecimal.ZERO;
-
- @Schema(description = "浠樻鏂瑰紡")
- @TableField(exist = false)
- private String paymentMethod;
-
- @TableField(exist = false)
- @Schema(description = "鐢熶骇鐘舵��")
- private String productionStatus = "鏈紑濮�";
-
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-}
diff --git a/src/main/java/com/ruoyi/sales/service/ISalesLedgerProductService.java b/src/main/java/com/ruoyi/sales/service/ISalesLedgerProductService.java
index 47e0616..00fc350 100644
--- a/src/main/java/com/ruoyi/sales/service/ISalesLedgerProductService.java
+++ b/src/main/java/com/ruoyi/sales/service/ISalesLedgerProductService.java
@@ -1,10 +1,7 @@
package com.ruoyi.sales.service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import java.util.List;
@@ -24,10 +21,6 @@
int deleteSalesLedgerProductByIds(Long[] ids);
int addOrUpdateSalesLedgerProduct(SalesLedgerProduct salesLedgerProduct);
-
- IPage<SalesLedgerProductDto> listPage(Page page, SalesLedgerProductDto salesLedgerProduct);
-
- IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct);
R judgmentInventory(SalesLedgerProduct salesLedgerProduct);
diff --git a/src/main/java/com/ruoyi/sales/service/InvoiceLedgerService.java b/src/main/java/com/ruoyi/sales/service/InvoiceLedgerService.java
deleted file mode 100644
index e9335ca..0000000
--- a/src/main/java/com/ruoyi/sales/service/InvoiceLedgerService.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.ruoyi.sales.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.vo.FileVo;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.pojo.InvoiceLedgerFile;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
-import org.springframework.web.multipart.MultipartFile;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.math.BigDecimal;
-import java.util.List;
-
-public interface InvoiceLedgerService {
-
- /**
- * 寮�绁ㄥ彴璐︽柊澧�
- * @param productDto
- * @return
- */
- int invoiceLedgerSaveOrUpdate( InvoiceRegistrationProductDto productDto);
-
- /**
- * 寮�绁ㄥ彴璐﹀垹闄�
- * @param ids
- * @return
- */
- int invoiceLedgerDel(List<Integer> ids);
-
- /**
- * 寮�绁ㄥ彴璐﹀垎椤垫煡璇�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- IPage<InvoiceLedgerDto> invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto);
-
- /**
- * 寮�绁ㄥ彴璐︽枃浠舵煡璇�
- * @param invoiceLedgerId
- * @return
- */
- List<InvoiceLedgerFile> invoiceLedgerFileList(Integer invoiceLedgerId);
-
- /**
- * 寮�绁ㄥ彴璐︽枃浠朵笂浼�
- * @param file
- * @return
- */
- FileVo invoiceLedgerUploadFile(MultipartFile file);
-
- /**
- * 闄勪欢涓嬭浇
- * @param response
- * @param invoiceRegistrationProductDto
- * @return
- */
- void invoiceLedgerExport(HttpServletResponse response ,InvoiceRegistrationProductDto invoiceRegistrationProductDto);
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- InvoiceLedgerDto invoiceLedgerDetail(Integer id);
-
- /**
- * 闄勪欢鎻愪氦
- * @param invoiceLedgerDto
- * @return
- */
- void invoiceLedgerCommitFile(InvoiceLedgerDto invoiceLedgerDto);
-
- /**
- * 寮�绁ㄥ彴璐︽煡璇�
- * @param invoiceLedgerDto
- * @return
- */
- List<InvoiceLedgerDto> invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto);
-
- /**
- * 瀹㈡埛閿�鍞褰�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- IPage<InvoiceLedgerDto> invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto);
-
- BigDecimal getInvoiceAmount();
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佸垎椤垫煡璇�
- * @param page
- * @param registrationProductDto
- * @return
- */
- IPage<InvoiceRegistrationProductDto> registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto);
-
- /**
- * 浜у搧寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- InvoiceRegistrationProductDto invoiceLedgerProductDetail(Integer id);
-
- /**
- * 寮�绁ㄥ彴璐﹀垹闄�
- * @param invoiceRegistrationProductId
- * @return
- */
- void delInvoiceLedger(Integer invoiceRegistrationProductId);
-}
diff --git a/src/main/java/com/ruoyi/sales/service/InvoiceRegistrationService.java b/src/main/java/com/ruoyi/sales/service/InvoiceRegistrationService.java
deleted file mode 100644
index 4044a4e..0000000
--- a/src/main/java/com/ruoyi/sales/service/InvoiceRegistrationService.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.ruoyi.sales.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.dto.InvoiceRegistrationDto;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.dto.SalesLedgerDto;
-import org.springframework.web.bind.annotation.RequestBody;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.util.List;
-
-public interface InvoiceRegistrationService {
-
- /**
- * 寮�绁ㄧ櫥璁拌褰曟柊澧�
- * @param salesLedgerDto
- * @return
- */
- void invoiceRegistrationSave(SalesLedgerDto salesLedgerDto);
-
- /**
- * 寮�绁ㄧ櫥璁板垹闄�
- * @param ids
- * @return
- */
- int invoiceRegistrationDel(List<Integer> ids);
-
-
- /**
- * 寮�绁ㄨ褰曚慨鏀�
- * @param invoiceRegistrationDto
- * @return
- */
- void invoiceRegistrationUpdate(InvoiceRegistrationDto invoiceRegistrationDto);
-
- /**
- * 寮�绁ㄧ櫥璁板垎椤垫煡璇�
- * @param page
- * @param invoiceRegistrationDto
- * @return
- */
- IPage<InvoiceRegistrationDto> invoiceRegistrationListPage(Page page, InvoiceRegistrationDto invoiceRegistrationDto);
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佹煡璇�
- * @param invoiceRegistrationProductDto
- * @return
- */
- List<InvoiceRegistrationProductDto> invoiceRegistrationProductList(InvoiceRegistrationProductDto invoiceRegistrationProductDto);
-
- /**
- * 寮�绁ㄧ櫥璁拌鎯�
- * @param id
- * @return
- */
- InvoiceRegistrationDto invoiceRegistrationDetail(Integer id);
-
- /**
- * 寮�绁ㄧ櫥璁板鍑�
- * @param response
- * @param invoiceRegistrationDto
- */
- void invoiceRegistrationExport(HttpServletResponse response, InvoiceRegistrationDto invoiceRegistrationDto);
-}
diff --git a/src/main/java/com/ruoyi/sales/service/ReceiptPaymentService.java b/src/main/java/com/ruoyi/sales/service/ReceiptPaymentService.java
deleted file mode 100644
index 49378c8..0000000
--- a/src/main/java/com/ruoyi/sales/service/ReceiptPaymentService.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.ruoyi.sales.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.sales.dto.CustomerInteractionDto;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.ReceiptPaymentDto;
-import com.ruoyi.sales.pojo.ReceiptPayment;
-
-import jakarta.servlet.http.HttpServletResponse;
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
-public interface ReceiptPaymentService {
-
- /**
- * 鍥炴鐧昏鏂板
- * @param receiptPayment
- * @return
- */
- int receiptPaymentSaveOrUpdate(List<ReceiptPayment> receiptPayment);
-
- /**
- * 鍥炴鐧昏淇敼
- * @param receiptPayment
- * @return
- */
- int receiptPaymentUpdate(ReceiptPayment receiptPayment);
-
- /**
- * 鍥炴鐧昏鍒犻櫎
- * @param ids
- * @return
- */
- int receiptPaymentDel(List<Integer> ids);
-
- /**
- * 鍥炴鐧昏鍒嗛〉鏌ヨ
- * @param page
- * @param receiptPaymentDto
- * @return
- */
- IPage<ReceiptPaymentDto> receiptPaymentListPage (Page page, ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 鍥炴鐧昏璇︽儏
- * @param id
- * @return
- */
- ReceiptPaymentDto receiptPaymentInfo(Integer id);
-
- BigDecimal getReceiptAmount();
-
- /**
- * 鏌ヨ宸茬粡缁戝畾鍙戠エ鐨勫紑绁ㄥ彴璐�
- * @param page
- * @param receiptPaymentDto
- * @return
- */
- IPage<ReceiptPaymentDto> bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- InvoiceLedgerDto invoiceInfo(Integer id);
-
- Map<String,BigDecimal> getAmountMouth();
-
- /**
- * 鏌ヨ鍥炴璁板綍
- */
- List<ReceiptPaymentDto> receiptPaymentHistoryList(ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 鏌ヨ鍥炴璁板綍鍒嗛〉
- */
- IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page, ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 瀹㈡埛寰�鏉ヨ褰曟煡璇�
- * @param receiptPaymentDto
- * @return
- */
- List<InvoiceLedgerDto> customerInteractions (InvoiceLedgerDto receiptPaymentDto);
-
- /**
- * 鏌ヨ鍥炴璁板綍鍒嗛〉
- */
- List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage(ReceiptPaymentDto receiptPaymentDto);
-
- /**
- * 鍏ㄥ鍑哄洖娆惧垪琛�
- */
- void exportPaymentList(HttpServletResponse response);
-
- /**
- * 閮ㄥ垎瀵煎嚭鍥炴鍒楄〃
- */
- void exportPaymentList(HttpServletResponse response, List<Long> ids);
-}
diff --git a/src/main/java/com/ruoyi/sales/service/ShipmentApprovalService.java b/src/main/java/com/ruoyi/sales/service/ShipmentApprovalService.java
deleted file mode 100644
index 6af2c00..0000000
--- a/src/main/java/com/ruoyi/sales/service/ShipmentApprovalService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ruoyi.sales.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.sales.pojo.ShipmentApproval;
-import com.ruoyi.sales.pojo.ShippingInfo;
-
-
-public interface ShipmentApprovalService extends IService<ShipmentApproval>{
- IPage<ShipmentApproval> listPage(Page page, ShipmentApproval req);
-
-}
diff --git a/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java b/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
index c3e8a0c..12ed935 100644
--- a/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
+++ b/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
@@ -3,7 +3,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
+import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo;
+import com.ruoyi.sales.dto.ShippingApproveDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.dto.ShippingProductDetailDto;
import com.ruoyi.sales.pojo.ShippingInfo;
@@ -21,11 +22,15 @@
boolean delete(List<Long> ids);
- List<SalesLedgerProductDto> getReturnManagementDtoById( Long shippingId);
+ List<ShippingProductVo> getReturnManagementDtoById(Long shippingId);
List<ShippingInfo> getShippingInfoByCustomerName(String customerName);
boolean add(ShippingInfoDto req);
List<ShippingProductDetailDto> getDetail(Long id);
+
+ ShippingApproveDto getDateilByShippingNo(String shippingNo);
+
+ boolean addReq(ShippingInfoDto req);
}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
deleted file mode 100644
index d18a51a..0000000
--- a/src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
+++ /dev/null
@@ -1,509 +0,0 @@
-package com.ruoyi.sales.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.vo.FileVo;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.excel.InvoiceLedgerExcelDto;
-import com.ruoyi.sales.mapper.*;
-import com.ruoyi.sales.pojo.*;
-import com.ruoyi.sales.service.InvoiceLedgerService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.ObjectUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.File;
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.YearMonth;
-import java.util.List;
-import java.util.Objects;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-@Service
-@RequiredArgsConstructor
-public class InvoiceLedgerServiceImpl extends ServiceImpl<InvoiceLedgerMapper, InvoiceLedger> implements InvoiceLedgerService {
-
- @Value("${ruoyi.profile}")
- private String uploadFile;
-
- private final InvoiceLedgerMapper invoiceLedgerMapper;
- private final InvoiceLedgerFileMapper invoiceLedgerFileMapper;
- private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
- private final ReceiptPaymentMapper receiptPaymentMapper;
- private final SalesLedgerProductMapper salesLedgerProductMapper;
-
- /**
- * 寮�绁ㄥ彴璐︽柊澧�
- * @param productDto
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public int invoiceLedgerSaveOrUpdate(InvoiceRegistrationProductDto productDto) {
- // 鍒ゆ柇鏄惁宸茬粡鏂板寮�绁ㄥ彴璐�
- QueryWrapper<InvoiceLedger> ledgerQueryWrapper = new QueryWrapper<>();
- ledgerQueryWrapper.eq("invoice_registration_product_id", productDto.getId());
- InvoiceLedger invoiceLedger = invoiceLedgerMapper.selectOne(ledgerQueryWrapper);
- int result;
- if(ObjectUtils.isEmpty(invoiceLedger)){
- invoiceLedger = new InvoiceLedger();
- invoiceLedger.setInvoiceRegistrationProductId(productDto.getId());
- invoiceLedger.setInvoiceNo(productDto.getInvoiceNo());
- invoiceLedger.setInvoiceTotal(productDto.getInvoiceTotal());
- invoiceLedger.setInvoiceDate(productDto.getInvoiceDate());
- invoiceLedger.setInvoicePerson(productDto.getInvoicePerson());
- result = invoiceLedgerMapper.insert(invoiceLedger);
- }else {
- // 淇敼sale_leger_product
- InvoiceRegistrationProduct invoiceRegistrationProduct = invoiceRegistrationProductMapper.selectById(productDto.getId());
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(invoiceRegistrationProduct.getSalesLedgerProductId());
-
- BigDecimal invoiceNum = productDto.getInvoiceTotal().divide(invoiceRegistrationProduct.getTaxInclusiveUnitPrice(), 2, BigDecimal.ROUND_HALF_UP);
- //璁$畻 鏈紑绁ㄦ暟/鏈紑绁ㄩ噾棰�
- BigDecimal noInvoiceAmount = salesLedgerProduct.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount()).subtract(productDto.getInvoiceTotal());
- BigDecimal noInvoiceNum = salesLedgerProduct.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum()).subtract(invoiceNum);
- salesLedgerProduct.setNoInvoiceAmount(noInvoiceAmount);
- salesLedgerProduct.setNoInvoiceNum(noInvoiceNum);
- salesLedgerProductMapper.updateById(salesLedgerProduct);
-
- // 淇敼褰撳墠浜у搧寮�绁ㄧ櫥璁拌褰曟暟鎹�
- BigDecimal currentNoInvoiceNum = invoiceRegistrationProduct.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum()).subtract(invoiceNum);
- BigDecimal currentNoInvoiceAmount = invoiceRegistrationProduct.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount()).subtract(productDto.getInvoiceTotal());
- invoiceRegistrationProduct.setInvoiceNum(invoiceNum);
- invoiceRegistrationProduct.setInvoiceAmount(productDto.getInvoiceTotal());
- invoiceRegistrationProduct.setNoInvoiceNum(currentNoInvoiceNum);
- invoiceRegistrationProduct.setNoInvoiceAmount(currentNoInvoiceAmount);
- invoiceRegistrationProductMapper.updateById(invoiceRegistrationProduct);
-
- invoiceLedger.setInvoiceNo(productDto.getInvoiceNo());
- invoiceLedger.setInvoiceTotal(productDto.getInvoiceTotal());
- invoiceLedger.setInvoiceDate(productDto.getInvoiceDate());
- invoiceLedger.setInvoicePerson(productDto.getInvoicePerson());
- result = invoiceLedgerMapper.updateById(invoiceLedger);
- //鍒犻櫎鎵�鏈夐檮浠跺叧鑱�
- LambdaQueryWrapper<InvoiceLedgerFile> delWrapper = new LambdaQueryWrapper<>();
- delWrapper.eq(InvoiceLedgerFile::getInvoiceLedgerId, invoiceLedger.getId());
- invoiceLedgerFileMapper.delete(delWrapper);
- }
- List<FileVo> fileList = productDto.getFileList();
- if(CollectionUtils.isNotEmpty(fileList)){
- for (FileVo fileVo : fileList) {
- InvoiceLedgerFile invoiceLedgerFile = new InvoiceLedgerFile();
- BeanUtils.copyProperties(fileVo, invoiceLedgerFile);
- invoiceLedgerFile.setInvoiceLedgerId(invoiceLedger.getId());
- invoiceLedgerFileMapper.insert(invoiceLedgerFile);
- }
- }
- return result;
- }
-
- /**
- * 寮�绁ㄥ彴璐﹀垹闄�
- * @param ids
- * @return
- */
- @Override
- public int invoiceLedgerDel(List<Integer> ids) {
- LambdaQueryWrapper<InvoiceLedger> delWrapper = new LambdaQueryWrapper<>();
- delWrapper.in(InvoiceLedger::getId, ids);
- return invoiceLedgerMapper.delete(delWrapper);
- }
-
- /**
- * 寮�绁ㄥ彴璐﹀垎椤垫煡璇�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- @Override
- public IPage<InvoiceLedgerDto> invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) {
- return invoiceLedgerMapper.invoiceLedgerPage(page, invoiceLedgerDto);
- }
-
- /**
- * 寮�绁ㄥ彴璐︽枃浠舵煡璇�
- * @param invoiceLedgerId
- * @return
- */
- @Override
- public List<InvoiceLedgerFile> invoiceLedgerFileList(Integer invoiceLedgerId) {
- LambdaQueryWrapper<InvoiceLedgerFile> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(InvoiceLedgerFile::getInvoiceLedgerId, invoiceLedgerId);
- return invoiceLedgerFileMapper.selectList(queryWrapper);
- }
-
- /**
- * 寮�绁ㄥ彴璐︽枃浠朵笂浼�
- * @param file
- * @return
- */
- @Override
- public FileVo invoiceLedgerUploadFile(MultipartFile file) {
- FileVo fileVo = new FileVo();
- try {
- String baseDir = uploadFile + File.separatorChar + "invoiceLedger";
- File dirFile = new File(baseDir);
- if(!dirFile.exists()){
- dirFile.mkdirs();
- }
- String filePath = baseDir + File.separatorChar + UUID.randomUUID() + "_" + file.getOriginalFilename();
- file.transferTo(new File(filePath));
- fileVo.setName(file.getOriginalFilename());
- fileVo.setUrl(filePath);
- fileVo.setFileSize((int)file.getSize());
- }catch (Exception e){
- e.printStackTrace();
- throw new RuntimeException("鏂囦欢涓婁紶澶辫触");
- }
- return fileVo;
- }
-
- /**
- * 闄勪欢涓嬭浇
- * @param response
- * @param invoiceRegistrationProductDto
- * @return
- */
- @Override
- public void invoiceLedgerExport(HttpServletResponse response, InvoiceRegistrationProductDto invoiceRegistrationProductDto) {
- List<InvoiceRegistrationProductDto> invoiceRegistrationProductList = invoiceRegistrationProductMapper.invoiceRegistrationProductList(invoiceRegistrationProductDto);
- List<InvoiceLedgerExcelDto> invoiceLedgerExcelDtoList = invoiceRegistrationProductList.stream().map(item -> {
- InvoiceLedgerExcelDto invoiceLedgerExcelDto = new InvoiceLedgerExcelDto();
- BeanUtils.copyProperties(item, invoiceLedgerExcelDto);
- return invoiceLedgerExcelDto;
- }).collect(Collectors.toList());
- ExcelUtil<InvoiceLedgerExcelDto> util = new ExcelUtil<InvoiceLedgerExcelDto>(InvoiceLedgerExcelDto.class);
- util.exportExcel(response, invoiceLedgerExcelDtoList, "渚涘簲鍟嗗鍑�");
- }
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- @Override
- public InvoiceLedgerDto invoiceLedgerDetail(Integer id) {
- InvoiceLedgerDto invoiceLedgerDto = invoiceLedgerMapper.invoiceLedgerInfo(id);
- if(ObjectUtils.isEmpty(invoiceLedgerDto)){
- throw new RuntimeException("寮�绁ㄥ彴璐︽煡鎵惧け璐�");
- }
- // 鏌ヨ闄勪欢
- QueryWrapper<InvoiceLedgerFile> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("invoice_ledger_id", id);
- List<InvoiceLedgerFile> invoiceLedgerFileList = invoiceLedgerFileMapper.selectList(queryWrapper);
- List<FileVo> fileList = invoiceLedgerFileList.stream().map(item -> {
- FileVo fileVo = new FileVo();
- BeanUtils.copyProperties(item, fileVo);
- return fileVo;
- }).collect(Collectors.toList());
- invoiceLedgerDto.setFileList(fileList);
- return invoiceLedgerDto;
- }
-
- /**
- * 闄勪欢鎻愪氦
- * @param invoiceLedgerDto
- * @return
- */
- @Override
- public void invoiceLedgerCommitFile(InvoiceLedgerDto invoiceLedgerDto) {
- if(null == invoiceLedgerDto.getId()){
- throw new RuntimeException("缂哄皯鍙戠エ鍙拌处涓婚敭");
- }
- if(CollectionUtils.isEmpty(invoiceLedgerDto.getFileList())){
- throw new RuntimeException("缂哄皯鏂囦欢淇℃伅");
- }
- QueryWrapper<InvoiceLedger> ledgerQueryWrapper = new QueryWrapper<>();
- ledgerQueryWrapper.eq("invoice_registration_product_id", invoiceLedgerDto.getId());
- InvoiceLedger invoiceLedger = invoiceLedgerMapper.selectOne(ledgerQueryWrapper);
- if(ObjectUtils.isEmpty(invoiceLedger)){
- throw new RuntimeException("寮�绁ㄥ彴璐︽湭鐧昏");
- }
- List<FileVo> fileList = invoiceLedgerDto.getFileList();
- fileList.forEach(fileVo -> {
- InvoiceLedgerFile invoiceLedgerFile = new InvoiceLedgerFile();
- BeanUtils.copyProperties(fileVo, invoiceLedgerFile);
- invoiceLedgerFile.setInvoiceLedgerId(invoiceLedger.getId());
- invoiceLedgerFileMapper.insert(invoiceLedgerFile);
- });
- }
-
- /**
- * 寮�绁ㄥ彴璐︽煡璇�
- * @param invoiceLedgerDto
- * @return
- */
- @Override
- public List<InvoiceLedgerDto> invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) {
- return invoiceLedgerMapper.invoiceLedgerList(invoiceLedgerDto);
- }
-
- /**
- * 瀹㈡埛閿�鍞褰�
- * @param page
- * @param invoiceLedgerDto
- * @return
- */
- @Override
- public IPage<InvoiceLedgerDto> invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) {
- IPage<InvoiceLedgerDto> invoiceLedgerDtoIPage = invoiceLedgerMapper.invoiceLedgerSalesAccount(page, invoiceLedgerDto);
- return invoiceLedgerDtoIPage;
- }
-
- @Override
- public BigDecimal getInvoiceAmount() {
- LocalDate now = LocalDate.now();
- YearMonth currentMonth = YearMonth.from(now);
-
- // 鍒涘缓LambdaQueryWrapper
- LambdaQueryWrapper<InvoiceLedger> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.ge(InvoiceLedger::getInvoiceDate, currentMonth.atDay(1).atStartOfDay()) // 澶т簬绛変簬鏈湀绗竴澶�
- .lt(InvoiceLedger::getInvoiceDate, currentMonth.plusMonths(1).atDay(1).atStartOfDay()); // 灏忎簬涓嬫湀绗竴澶�
-
- // 鎵ц鏌ヨ骞惰绠楁�诲拰
- List<InvoiceLedger> invoiceLedgers = invoiceLedgerMapper.selectList(queryWrapper);
-
- BigDecimal totalContractAmount = invoiceLedgers.stream()
- .map(InvoiceLedger::getInvoiceTotal)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- return totalContractAmount;
- }
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佸垎椤垫煡璇�
- * @param page
- * @param registrationProductDto
- * @return
- */
- @Override
- public IPage<InvoiceRegistrationProductDto> registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) {
- IPage<InvoiceRegistrationProductDto> invoiceRegistrationProductDtoIPage = invoiceRegistrationProductMapper.invoiceRegistrationProductPage(page, registrationProductDto);
- if (registrationProductDto.getStatus()) {
- invoiceRegistrationProductDtoIPage.getRecords().removeIf(invoiceRegistrationProduct -> !StringUtils.isEmpty(invoiceRegistrationProduct.getInvoiceNo()));
- }
- invoiceRegistrationProductDtoIPage.getRecords().forEach(invoiceRegistrationProductDto -> {
- invoiceRegistrationProductDto.setCommonFiles(invoiceLedgerFileMapper.selectList(new QueryWrapper<InvoiceLedgerFile>().lambda()
- .eq(InvoiceLedgerFile::getInvoiceLedgerId, invoiceRegistrationProductDto.getInvoiceLedgerId())));
- });
- return invoiceRegistrationProductDtoIPage;
- }
-
- /**
- * 浜у搧寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- @Override
- public InvoiceRegistrationProductDto invoiceLedgerProductDetail(Integer id) {
- InvoiceRegistrationProductDto invoiceRegistrationProductDto = invoiceLedgerMapper.invoiceLedgerProductInfo(id);
- if(ObjectUtils.isEmpty(invoiceRegistrationProductDto)){
- throw new RuntimeException("浜у搧寮�绁ㄥ彴璐︽煡鎵惧け璐�");
- }
- List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(new LambdaQueryWrapper<InvoiceRegistrationProduct>()
- .eq(InvoiceRegistrationProduct::getSalesLedgerProductId, invoiceRegistrationProductDto.getSalesLedgerProductId()));
- if(CollectionUtils.isNotEmpty(invoiceRegistrationProducts)){
- invoiceRegistrationProductDto.setNoInvoiceNum(invoiceRegistrationProductDto.getQuantity()
- .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceNum).reduce(BigDecimal.ZERO, BigDecimal::add)));
- invoiceRegistrationProductDto.setNoInvoiceAmount(invoiceRegistrationProductDto.getTaxInclusiveTotalPrice()
- .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceAmount).reduce(BigDecimal.ZERO, BigDecimal::add)));
- }
- // 鏌ヨ闄勪欢
- QueryWrapper<InvoiceLedgerFile> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("invoice_ledger_id", invoiceRegistrationProductDto.getInvoiceLedgerId());
- List<InvoiceLedgerFile> invoiceLedgerFileList = invoiceLedgerFileMapper.selectList(queryWrapper);
- List<FileVo> fileList = invoiceLedgerFileList.stream().map(item -> {
- FileVo fileVo = new FileVo();
- BeanUtils.copyProperties(item, fileVo);
- return fileVo;
- }).collect(Collectors.toList());
- invoiceRegistrationProductDto.setFileList(fileList);
- return invoiceRegistrationProductDto;
- }
-
- /**
- * 寮�绁ㄥ彴璐﹀垹闄�
- * @param invoiceRegistrationProductId
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void delInvoiceLedger(Integer invoiceRegistrationProductId) {
- // 鍒ゆ柇鏄惁鏈夊洖娆捐褰�
- List<ReceiptPayment> receiptPaymentList = receiptPaymentMapper.receiptPaymentListByProdRegId(invoiceRegistrationProductId);
- if(!CollectionUtils.isEmpty(receiptPaymentList)){
- throw new RuntimeException("璇峰厛鍒犻櫎鍥炴璁板綍");
- }
- // 鍒ゆ柇鏄惁鏈夊紑绁ㄧ櫥璁拌褰�
- InvoiceRegistrationProduct invoiceRegistrationProduct = invoiceRegistrationProductMapper.selectById(invoiceRegistrationProductId);
- if(ObjectUtils.isEmpty(invoiceRegistrationProduct)){
- throw new RuntimeException("寮�绁ㄧ櫥璁拌褰曟煡鎵惧け璐�");
- }
- // 鍒ゆ柇璇ュ紑绁ㄥ彴璐︽槸鍚︽湭褰撴湀锛屽鏋滀负褰撴湀鐩存帴鍒犻櫎鍚﹀垯鏂板涓�鏉$浉鍙嶈礋鏁版暟鎹�
- QueryWrapper<InvoiceLedger> ledgerQueryWrapper = new QueryWrapper<>();
- ledgerQueryWrapper.eq("invoice_registration_product_id", invoiceRegistrationProductId);
- InvoiceLedger invoiceLedger = invoiceLedgerMapper.selectOne(ledgerQueryWrapper);
- if(ObjectUtils.isEmpty(invoiceLedger)){
- throw new RuntimeException("寮�绁ㄥ彴璐︽煡鎵惧け璐�");
- }
- if( invoiceLedger.getInvoiceDate() == null){
- dealCurrentMonthDel(invoiceRegistrationProductId,invoiceRegistrationProduct);
- return;
- }
- // 鑾峰彇褰撳墠鏃ユ湡
- LocalDate today = LocalDate.now();
- // 浣跨敤YearMonth姣旇緝骞翠唤鍜屾湀浠芥槸鍚︾浉鍚�
- boolean equalsFlag = YearMonth.from(invoiceLedger.getInvoiceDate()).equals(YearMonth.from(today));
- if(equalsFlag){
- dealCurrentMonthDel(invoiceRegistrationProductId,invoiceRegistrationProduct);
- }else {
- dealOtherMonthDel(invoiceRegistrationProduct,invoiceLedger);
- }
- }
-
- /**
- * 澶勭悊褰撴湀寮�绁ㄥ彴璐﹀垹闄�
- *
- * @param invoiceRegistrationProductId
- * @param invoiceRegistrationProduct
- */
-
- private void dealCurrentMonthDel(Integer invoiceRegistrationProductId, InvoiceRegistrationProduct invoiceRegistrationProduct) {
-
- // 鍒犻櫎寮�绁ㄥ彴璐�
- QueryWrapper<InvoiceLedger> delLedgerWrapper = new QueryWrapper<>();
- delLedgerWrapper.eq("invoice_registration_product_id", invoiceRegistrationProductId);
- invoiceLedgerMapper.delete(delLedgerWrapper);
-
- // 鏌ヨ褰撳墠浜у搧涓嬬殑鎵�鏈夊紑绁ㄧ櫥璁�
- QueryWrapper<InvoiceRegistrationProduct> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId());
- queryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId());
- queryWrapper.orderByAsc("create_time");
- List<InvoiceRegistrationProduct> allList = invoiceRegistrationProductMapper.selectList(queryWrapper);
-
- int index = -1;
- for (int i = 0; i < allList.size(); i++) {
- if (invoiceRegistrationProductId.equals(allList.get(i).getId())) {
- index = i;
- break;
- }
- }
- if (index == -1) {
- return;
- }
-
- for (int i = index + 1; i < allList.size(); i++) {
- InvoiceRegistrationProduct current = allList.get(i);
-
- current.setNoInvoiceNum(current.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum()));
- current.setNoInvoiceAmount(current.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount()));
-
- invoiceRegistrationProductMapper.updateById(current);
- }
-
- // 鍒犻櫎褰撳墠寮�绁ㄧ櫥璁�
- invoiceRegistrationProductMapper.deleteById(invoiceRegistrationProductId);
-
- // 鏌ヨ鍒犻櫎鍚庣殑鍓╀綑寮�绁ㄧ櫥璁�
- QueryWrapper<InvoiceRegistrationProduct> newQueryWrapper = new QueryWrapper<>();
- newQueryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId());
- newQueryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId());
- newQueryWrapper.orderByAsc("create_time");
- List<InvoiceRegistrationProduct> remainList = invoiceRegistrationProductMapper.selectList(newQueryWrapper);
-
- // 鏌ヨ閿�鍞彴璐︿骇鍝�
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(invoiceRegistrationProduct.getSalesLedgerProductId());
-
- if (CollectionUtils.isEmpty(remainList)) {
- // 娌℃湁浠讳綍寮�绁ㄨ褰曪紝鎭㈠鍒濆鐘舵��
- salesLedgerProduct.setInvoiceNum(BigDecimal.ZERO);
- salesLedgerProduct.setInvoiceAmount(BigDecimal.ZERO);
- salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity());
- salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice());
- } else {
- salesLedgerProduct.setInvoiceNum(salesLedgerProduct.getInvoiceNum().subtract(invoiceRegistrationProduct.getInvoiceNum()));
- salesLedgerProduct.setInvoiceAmount(salesLedgerProduct.getInvoiceAmount().subtract(invoiceRegistrationProduct.getInvoiceAmount()));
- salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum()));
- salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount()));
- }
-
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- }
-
- /**
- * 澶勭悊鍏朵粬鏈堜唤寮�绁ㄥ彴璐﹀垹闄�
- * @param invoiceRegistrationProduct
- * @param invoiceLedger
- */
- private void dealOtherMonthDel(InvoiceRegistrationProduct invoiceRegistrationProduct, InvoiceLedger invoiceLedger) {
- //鏌ヨ鍘嗗彶寮�绁ㄧ櫥璁�
- QueryWrapper<InvoiceRegistrationProduct> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId());
- queryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId());
- queryWrapper.orderByAsc("create_time");
- List<InvoiceRegistrationProduct> list = invoiceRegistrationProductMapper.selectList(queryWrapper);
-
- if (CollectionUtils.isEmpty(list)) {
- return;
- }
-
- InvoiceRegistrationProduct last = list.get(list.size() - 1);
-
- BigDecimal negateInvoiceNum = invoiceRegistrationProduct.getInvoiceNum().negate();
- BigDecimal negateInvoiceAmount = invoiceRegistrationProduct.getInvoiceAmount().negate();
-
- InvoiceRegistrationProduct copy = new InvoiceRegistrationProduct();
- BeanUtils.copyProperties(invoiceRegistrationProduct, copy);
-
- copy.setId(null);
- copy.setInvoiceNum(negateInvoiceNum);
- copy.setInvoiceAmount(negateInvoiceAmount);
-
- // 鏈紑绁� = 涓婁竴鏉� + 鏈鍐插洖鐨勬暟閲�
- copy.setNoInvoiceNum(last.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum()));
- copy.setNoInvoiceAmount(last.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount()));
-
- invoiceRegistrationProductMapper.insert(copy);
-
- // 澶嶅埗寮�绁ㄥ彴璐�
- InvoiceLedger ledgerCopy = new InvoiceLedger();
- BeanUtils.copyProperties(invoiceLedger, ledgerCopy);
-
- ledgerCopy.setId(null);
- ledgerCopy.setInvoiceRegistrationProductId(copy.getId());
- ledgerCopy.setInvoiceTotal(invoiceLedger.getInvoiceTotal().negate());
- ledgerCopy.setInvoiceDate(LocalDate.now());
-
- invoiceLedgerMapper.insert(ledgerCopy);
-
- // 鍥炴粴 sales_ledger_product
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(invoiceRegistrationProduct.getSalesLedgerProductId());
-
- // 宸插紑绁�
- salesLedgerProduct.setInvoiceNum(salesLedgerProduct.getInvoiceNum().add(negateInvoiceNum));
- salesLedgerProduct.setInvoiceAmount(salesLedgerProduct.getInvoiceAmount().add(negateInvoiceAmount));
-
- // 鏈紑绁�
- salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum()));
- salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount()));
-
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- }
-
-}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/InvoiceRegistrationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/InvoiceRegistrationServiceImpl.java
deleted file mode 100644
index fefe144..0000000
--- a/src/main/java/com/ruoyi/sales/service/impl/InvoiceRegistrationServiceImpl.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package com.ruoyi.sales.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.sales.dto.InvoiceRegistrationDto;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.dto.SalesLedgerDto;
-import com.ruoyi.sales.excel.InvoiceRegisAndProductExcelDto;
-import com.ruoyi.sales.mapper.InvoiceLedgerMapper;
-import com.ruoyi.sales.mapper.InvoiceRegistrationMapper;
-import com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper;
-import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.InvoiceLedger;
-import com.ruoyi.sales.pojo.InvoiceRegistration;
-import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import com.ruoyi.sales.service.InvoiceRegistrationService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.ObjectUtils;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Service
-@RequiredArgsConstructor
-public class InvoiceRegistrationServiceImpl extends ServiceImpl<InvoiceRegistrationMapper, InvoiceRegistration> implements InvoiceRegistrationService {
-
- private final InvoiceRegistrationMapper invoiceRegistrationMapper;
-
- private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
-
- private final SalesLedgerProductMapper salesLedgerProductMapper;
-
- private final InvoiceLedgerMapper invoiceLedgerMapper;
-
- /**
- * 寮�绁ㄧ櫥璁拌褰曟柊澧�
- * @param salesLedgerDto
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void invoiceRegistrationSave(SalesLedgerDto salesLedgerDto) {
- // 鏂板寮�绁ㄧ櫥璁颁富琛�
- InvoiceRegistration invoiceRegistration = new InvoiceRegistration();
- BeanUtils.copyProperties(salesLedgerDto, invoiceRegistration);
- invoiceRegistration.setId(null);
- invoiceRegistration.setCustomerId(salesLedgerDto.getCustomerId().intValue());
- invoiceRegistration.setSalesLedgerId(salesLedgerDto.getId().intValue());
- invoiceRegistrationMapper.insert(invoiceRegistration);
-
- List<SalesLedgerProduct> productData = salesLedgerDto.getProductData();
- if (CollectionUtils.isEmpty(productData)) {
- return;
- }
-
- for (SalesLedgerProduct productDatum : productData) {
- // 鏈寮�绁ㄦ暟 / 閲戦
- BigDecimal currentInvoiceNum = productDatum.getCurrentInvoiceNum();
- BigDecimal currentInvoiceAmount = productDatum.getCurrentInvoiceAmount();
-
- if (currentInvoiceNum == null || BigDecimal.ZERO.compareTo(currentInvoiceNum) == 0) {
- continue;
- }
-
- LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<SalesLedgerProduct>()
- .eq(SalesLedgerProduct::getId, productDatum.getId())
- .eq(SalesLedgerProduct::getSalesLedgerId, productDatum.getSalesLedgerId());
- SalesLedgerProduct dbProduct = salesLedgerProductMapper.selectOne(salesLedgerProductLambdaQueryWrapper);
-
- if (dbProduct == null) {
- throw new RuntimeException("閿�鍞彴璐︿骇鍝佷笉瀛樺湪锛孖D锛�" + productDatum.getId());
- }
-
- // 鏈紑绁�
- BigDecimal noInvoiceAmount = dbProduct.getNoInvoiceAmount();
- BigDecimal noInvoiceNum = dbProduct.getNoInvoiceNum();
-
- // 鍓╀綑鏈紑绁�
- BigDecimal newNoInvoiceNum = noInvoiceNum.subtract(currentInvoiceNum);
- BigDecimal newNoInvoiceAmount = noInvoiceAmount.subtract(currentInvoiceAmount);
-
-
- if (newNoInvoiceAmount.compareTo(BigDecimal.ZERO) < 0) {
- throw new RuntimeException("寮�绁ㄦ暟閲忔垨閲戦瓒呰繃鍚堝悓鎬婚噺");
- }
-
- // 鏇存柊 sales_ledger_product
- salesLedgerProductMapper.update(
- null,
- new LambdaUpdateWrapper<SalesLedgerProduct>()
- .eq(SalesLedgerProduct::getId, dbProduct.getId())
- .set(SalesLedgerProduct::getNoInvoiceNum, newNoInvoiceNum)
- .set(SalesLedgerProduct::getNoInvoiceAmount, newNoInvoiceAmount)
- );
-
- InvoiceRegistrationProduct invoiceRegistrationProduct = new InvoiceRegistrationProduct();
- BeanUtils.copyProperties(dbProduct, invoiceRegistrationProduct);
-
- invoiceRegistrationProduct.setId(null);
- invoiceRegistrationProduct.setSalesLedgerId(salesLedgerDto.getId().intValue());
- invoiceRegistrationProduct.setInvoiceRegistrationId(invoiceRegistration.getId());
- invoiceRegistrationProduct.setSalesLedgerProductId(dbProduct.getId().intValue());
- invoiceRegistrationProduct.setInvoiceNum(currentInvoiceNum);
- invoiceRegistrationProduct.setInvoiceAmount(currentInvoiceAmount);
- invoiceRegistrationProduct.setNoInvoiceAmount(newNoInvoiceAmount);
-
- invoiceRegistrationProductMapper.insert(invoiceRegistrationProduct);
-
- InvoiceLedger invoiceLedger = new InvoiceLedger();
- invoiceLedger.setInvoiceDate(salesLedgerDto.getIssueDate());
- invoiceLedger.setInvoiceRegistrationProductId(invoiceRegistrationProduct.getId());
- invoiceLedger.setInvoiceTotal(currentInvoiceAmount);
- invoiceLedger.setInvoiceNo(salesLedgerDto.getInvoiceNo());
- invoiceLedger.setCreateUser(SecurityUtils.getUserId().intValue());
- invoiceLedger.setInvoicePerson(dbProduct.getRegister());
-
- invoiceLedgerMapper.insert(invoiceLedger);
- }
- }
-
- /**
- * 寮�绁ㄧ櫥璁板垹闄�
- * @param ids
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public int invoiceRegistrationDel(List<Integer> ids) {
- int excuteNum = invoiceRegistrationMapper.deleteBatchIds(ids);
- LambdaQueryWrapper<InvoiceRegistrationProduct> delWrapper = new LambdaQueryWrapper<>();
- delWrapper.in(InvoiceRegistrationProduct::getInvoiceRegistrationId, ids);
- invoiceRegistrationProductMapper.delete(delWrapper);
- return excuteNum;
- }
-
- /**
- * 寮�绁ㄨ褰曚慨鏀�
- * @param invoiceRegistrationDto
- * @return
- */
- @Override
- public void invoiceRegistrationUpdate(InvoiceRegistrationDto invoiceRegistrationDto) {
- InvoiceRegistration invoiceRegistration = new InvoiceRegistration();
- BeanUtils.copyProperties(invoiceRegistrationDto, invoiceRegistration);
- // 寮�绁ㄧ櫥璁颁慨鏀�
- invoiceRegistrationMapper.updateById(invoiceRegistration);
- List<InvoiceRegistrationProductDto> productDtoList = invoiceRegistrationDto.getProductDtoList();
- // 寮�绁ㄤ骇鍝佺櫥璁颁慨鏀�
- if(CollectionUtils.isNotEmpty(productDtoList)){
- for (InvoiceRegistrationProductDto invoiceRegistrationProductDto : productDtoList) {
- InvoiceRegistrationProduct invoiceRegistrationProduct = new InvoiceRegistrationProduct();
- BeanUtils.copyProperties(invoiceRegistrationProductDto, invoiceRegistrationProduct);
- invoiceRegistrationProductMapper.updateById(invoiceRegistrationProduct);
- }
- }
- }
-
- /**
- * 寮�绁ㄧ櫥璁板垎椤垫煡璇�
- * @param page
- * @param invoiceRegistrationDto
- * @return
- */
- @Override
- public IPage<InvoiceRegistrationDto> invoiceRegistrationListPage(Page page, InvoiceRegistrationDto invoiceRegistrationDto) {
- return invoiceRegistrationMapper.invoiceRegistrationListPage(page, invoiceRegistrationDto);
- }
-
- /**
- * 寮�绁ㄧ櫥璁颁骇鍝佹煡璇�
- * @param invoiceRegistrationProductDto
- * @return
- */
- @Override
- public List<InvoiceRegistrationProductDto> invoiceRegistrationProductList(InvoiceRegistrationProductDto invoiceRegistrationProductDto) {
- return invoiceRegistrationProductMapper.invoiceRegistrationProductList(invoiceRegistrationProductDto);
- }
-
- /**
- * 寮�绁ㄧ櫥璁拌鎯�
- * @param id
- * @return
- */
- @Override
- public InvoiceRegistrationDto invoiceRegistrationDetail(Integer id) {
- InvoiceRegistration invoiceRegistration = invoiceRegistrationMapper.selectById(id);
- if(ObjectUtils.isEmpty(invoiceRegistration)){
- throw new RuntimeException("寮�绁ㄧ櫥璁颁俊鎭煡鎵惧け璐�");
- }
- InvoiceRegistrationDto invoiceRegistrationDto = new InvoiceRegistrationDto();
- BeanUtils.copyProperties(invoiceRegistration, invoiceRegistrationDto);
- QueryWrapper<InvoiceRegistrationProduct> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("invoice_registration_id", id);
- List<InvoiceRegistrationProduct> invoiceRegistrationProductList = invoiceRegistrationProductMapper.selectList(queryWrapper);
- List<InvoiceRegistrationProductDto> invoiceRegistrationProductDtoList = invoiceRegistrationProductList.stream().map(item -> {
- InvoiceRegistrationProductDto invoiceRegistrationProductDto = new InvoiceRegistrationProductDto();
- BeanUtils.copyProperties(item, invoiceRegistrationProductDto);
- return invoiceRegistrationProductDto;
- }).collect(Collectors.toList());
- invoiceRegistrationDto.setProductDtoList(invoiceRegistrationProductDtoList);
- return invoiceRegistrationDto;
- }
-
- /**
- * 寮�绁ㄧ櫥璁板鍑�
- * @param response
- * @param invoiceRegistrationDto
- */
- @Override
- public void invoiceRegistrationExport(HttpServletResponse response, InvoiceRegistrationDto invoiceRegistrationDto) {
- List<InvoiceRegisAndProductExcelDto> invoiceRegisAndProductExcelDtoList = invoiceRegistrationMapper.invoiceRegisAndProductExcelDtoList();
- ExcelUtil<InvoiceRegisAndProductExcelDto> util = new ExcelUtil<InvoiceRegisAndProductExcelDto>(InvoiceRegisAndProductExcelDto.class);
- util.exportExcel(response, invoiceRegisAndProductExcelDtoList, "寮�绁ㄧ櫥璁颁俊鎭�");
- }
-}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
deleted file mode 100644
index 677249a..0000000
--- a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
+++ /dev/null
@@ -1,349 +0,0 @@
-package com.ruoyi.sales.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.pojo.AccountIncome;
-import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.sales.dto.InvoiceLedgerDto;
-import com.ruoyi.sales.dto.ReceiptPaymentDto;
-import com.ruoyi.sales.dto.ReceiptPaymentExeclDto;
-import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.ReceiptPayment;
-import com.ruoyi.sales.pojo.SalesLedger;
-import com.ruoyi.sales.pojo.SalesLedgerProduct;
-import com.ruoyi.sales.service.ReceiptPaymentService;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.ObjectUtils;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.YearMonth;
-import java.util.*;
-
-@Service
-@RequiredArgsConstructor
-public class ReceiptPaymentServiceImpl extends ServiceImpl<ReceiptPaymentMapper,ReceiptPayment> implements ReceiptPaymentService {
-
- private final ReceiptPaymentMapper receiptPaymentMapper;
- private final SalesLedgerMapper salesLedgerMapper;
- private final SalesLedgerProductMapper salesLedgerProductMapper;
- private final AccountIncomeService accountIncomeService;
-
- /**
- * 鍥炴鐧昏鏂板
- * @param receiptPaymentList
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public int receiptPaymentSaveOrUpdate(List<ReceiptPayment> receiptPaymentList) {
- for (ReceiptPayment receiptPayment : receiptPaymentList) {
- ReceiptPayment byId = receiptPayment;
- if (!ObjectUtils.isEmpty(receiptPayment.getId())){
- receiptPayment = this.getById(receiptPayment.getId());
- }
- SalesLedger salesLedger = salesLedgerMapper.selectById(receiptPayment.getSalesLedgerId());
- if(null==salesLedger) throw new RuntimeException("鏈壘鍒伴攢鍞崟");
- // 宸插洖娆鹃噾棰�
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(receiptPayment.getSalesLedgerProductId());
- if(null==salesLedgerProduct) throw new RuntimeException("鏈壘鍒伴攢鍞崟浜у搧");
- if (salesLedgerProduct.getPendingInvoiceTotal().add(receiptPayment.getReceiptPaymentAmount()).compareTo(byId.getReceiptPaymentAmount())<0){
- throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�+鍥炴閲戦");
- }
- if(null==receiptPayment.getId()){
- salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(receiptPayment.getReceiptPaymentAmount()));
- salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
- receiptPaymentMapper.insert(receiptPayment);
- // 澧炲姞璐㈠姟鏀跺叆璁板綍
- AccountIncome accountIncome = new AccountIncome();
- accountIncome.setIncomeDate(salesLedger.getEntryDate());
- accountIncome.setIncomeType("3");
- accountIncome.setCustomerName(salesLedger.getCustomerName());
- accountIncome.setIncomeMoney(receiptPayment.getReceiptPaymentAmount());
- accountIncome.setIncomeMethod(receiptPayment.getReceiptPaymentType());
- accountIncome.setInputTime(new Date());
- accountIncome.setInputUser(SecurityUtils.getLoginUser().getNickName());
- accountIncome.setIncomeDescribed("鍥炴鏀跺叆");
- accountIncome.setBusinessId(Long.parseLong(receiptPayment.getId().toString()));
- accountIncome.setBusinessType(1);
- accountIncomeService.save(accountIncome);
- }else {
- BigDecimal subtract = byId.getReceiptPaymentAmount().subtract(receiptPayment.getReceiptPaymentAmount());
- salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(subtract));
- salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
- receiptPayment.setReceiptPaymentAmount(byId.getReceiptPaymentAmount());
- receiptPayment.setReceiptPaymentType(byId.getReceiptPaymentType());
- receiptPaymentMapper.updateById(receiptPayment);
- // 淇敼璐㈠姟鏀跺叆璁板綍
- LambdaQueryWrapper<AccountIncome> accountIncomeLambdaQueryWrapper = new LambdaQueryWrapper<>();
- accountIncomeLambdaQueryWrapper.eq(AccountIncome::getBusinessId, receiptPayment.getId())
- .eq(AccountIncome::getBusinessType, 1);
- AccountIncome accountIncome = accountIncomeService.getOne(accountIncomeLambdaQueryWrapper);
- if(null!=accountIncome){
- accountIncome.setIncomeMoney(receiptPayment.getReceiptPaymentAmount());
- accountIncomeService.updateById(accountIncome);
- }
- }
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- }
- return 1;
- }
-
- /**
- * 鍥炴鐧昏淇敼
- * @param receiptPayment
- * @return
- */
- @Override
- public int receiptPaymentUpdate(ReceiptPayment receiptPayment) {
- ReceiptPayment byId = receiptPayment;
- if (!ObjectUtils.isEmpty(receiptPayment.getId())){
- receiptPayment = this.getById(receiptPayment.getId());
- }
- SalesLedger salesLedger = salesLedgerMapper.selectById(receiptPayment.getSalesLedgerId());
- if(null==salesLedger) throw new RuntimeException("鏈壘鍒伴攢鍞崟");
- // 宸插洖娆鹃噾棰�
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(receiptPayment.getSalesLedgerProductId());
- if(null==salesLedgerProduct) throw new RuntimeException("鏈壘鍒伴攢鍞崟浜у搧");
- if (salesLedgerProduct.getPendingInvoiceTotal().compareTo(receiptPayment.getReceiptPaymentAmount())<0){
- throw new RuntimeException("鏈鍥炴閲戦涓嶈兘澶т簬寰呭洖娆鹃噾棰�");
- }
- BigDecimal subtract = receiptPayment.getReceiptPaymentAmount().subtract(byId.getReceiptPaymentAmount());
- salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().add(subtract));
- salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
- // 淇敼璐㈠姟鏀跺叆璁板綍
- LambdaQueryWrapper<AccountIncome> accountIncomeLambdaQueryWrapper = new LambdaQueryWrapper<>();
- accountIncomeLambdaQueryWrapper.eq(AccountIncome::getBusinessId, receiptPayment.getId())
- .eq(AccountIncome::getBusinessType, 1);
- AccountIncome accountIncome = accountIncomeService.getOne(accountIncomeLambdaQueryWrapper);
- if(null!=accountIncome){
- accountIncome.setIncomeMoney(receiptPayment.getReceiptPaymentAmount());
- accountIncomeService.updateById(accountIncome);
- }
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- receiptPayment.setReceiptPaymentAmount(byId.getReceiptPaymentAmount());
- receiptPayment.setReceiptPaymentType(byId.getReceiptPaymentType());
- return receiptPaymentMapper.updateById(receiptPayment);
- }
-
- /**
- * 鍥炴鐧昏鍒犻櫎
- * @param ids
- * @return
- */
- @Override
- public int receiptPaymentDel(List<Integer> ids) {
- LambdaQueryWrapper<ReceiptPayment> delQuery = new LambdaQueryWrapper<>();
- delQuery.in(ReceiptPayment::getId, ids);
- List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(delQuery);
- if(CollectionUtils.isEmpty(receiptPayments)) throw new RuntimeException("鏈壘鍒板洖娆剧櫥璁�");
- // 閲嶆柊璁$畻閿�鍞骇鍝佸洖娆鹃噾棰�
- for (ReceiptPayment receiptPayment : receiptPayments) {
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(receiptPayment.getSalesLedgerProductId());
- salesLedgerProduct.setInvoiceTotal(salesLedgerProduct.getInvoiceTotal().subtract(receiptPayment.getReceiptPaymentAmount()));
- salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
- salesLedgerProductMapper.updateById(salesLedgerProduct);
- }
- // 鍒犻櫎璐㈠姟鏀跺叆璁板綍
- LambdaQueryWrapper<AccountIncome> accountIncomeLambdaQueryWrapper = new LambdaQueryWrapper<>();
- accountIncomeLambdaQueryWrapper.in(AccountIncome::getBusinessId, ids)
- .eq(AccountIncome::getBusinessType, 1);
- accountIncomeService.remove(accountIncomeLambdaQueryWrapper);
- return receiptPaymentMapper.delete(delQuery);
- }
-
- /**
- * 鍥炴鐧昏鍒嗛〉鏌ヨ
- * @param page
- * @param receiptPaymentDto
- * @return
- */
- @Override
- public IPage<ReceiptPaymentDto> receiptPaymentListPage(Page page, ReceiptPaymentDto receiptPaymentDto) {
- // 璁$畻鍒嗛〉鍓峱age.current-1 * limit鏉℃暟鐨勭患鍚堣绠楀凡缁忔敹鍥炵殑鍥炴閲戦
- // 璁$畻宸茬粡鍒嗛〉鐨勬潯鏁�
- long total = (page.getCurrent() - 1) * page.getSize();
- BigDecimal receiptAmount = receiptPaymentMapper.getReceiptAmount(receiptPaymentDto.getCustomerId(), total);
- if(ObjectUtils.isEmpty(receiptAmount)){
- receiptAmount = BigDecimal.ZERO;
- }
- IPage<ReceiptPaymentDto> iPage = receiptPaymentMapper.receiptPaymentListPage(page, receiptPaymentDto);
- // 寮�绁ㄦ�婚噾棰�
- BigDecimal invoiceTotal = CollectionUtils.isEmpty(iPage.getRecords()) ? BigDecimal.ZERO : iPage.getRecords().get(0).getInvoiceTotal();
- // 褰撳墠搴旀敹閲戦
- BigDecimal currentUnReceiptAmount = invoiceTotal.subtract(receiptAmount);
- for (ReceiptPaymentDto record : iPage.getRecords()) {
- currentUnReceiptAmount = currentUnReceiptAmount.subtract(record.getReceiptPaymentAmount());
- record.setNoReceiptAmount(currentUnReceiptAmount);
- }
- return iPage;
- }
-
- /**
- * 鍥炴鐧昏璇︽儏
- * @param id
- * @return
- */
- @Override
- public ReceiptPaymentDto receiptPaymentInfo(Integer id) {
- return receiptPaymentMapper.receiptPaymentInfo(id);
- }
-
- @Override
- public BigDecimal getReceiptAmount() {
- LocalDate now = LocalDate.now();
- YearMonth currentMonth = YearMonth.from(now);
-
- // 鍒涘缓LambdaQueryWrapper
- LambdaQueryWrapper<ReceiptPayment> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.ge(ReceiptPayment::getReceiptPaymentDate, currentMonth.atDay(1).atStartOfDay()) // 澶т簬绛変簬鏈湀绗竴澶�
- .lt(ReceiptPayment::getReceiptPaymentDate, currentMonth.plusMonths(1).atDay(1).atStartOfDay()); // 灏忎簬涓嬫湀绗竴澶�
-
- // 鎵ц鏌ヨ骞惰绠楁�诲拰
- List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(queryWrapper);
-
- BigDecimal totalContractAmount = receiptPayments.stream()
- .map(ReceiptPayment::getReceiptPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- return totalContractAmount;
- }
-
- /**
- * 鏌ヨ宸茬粡缁戝畾鍙戠エ鐨勫紑绁ㄥ彴璐�
- * @param page
- * @param receiptPaymentDto
- * @return
- */
- @Override
- public IPage<ReceiptPaymentDto> bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) {
- IPage<ReceiptPaymentDto> receiptPaymentDtoIPage = receiptPaymentMapper.bindInvoiceNoRegPage(page, receiptPaymentDto);
-// if (receiptPaymentDto.getStatus()) {
-// long count = receiptPaymentDtoIPage.getRecords()
-// .stream()
-// .filter(receiptPaymentDto1 -> new BigDecimal("0.00").equals(receiptPaymentDto1.getNoReceiptAmount()))
-// .count();
-// receiptPaymentDtoIPage
-// .getRecords()
-// .removeIf(receiptPaymentDto1 -> new BigDecimal("0.00").equals(receiptPaymentDto1.getNoReceiptAmount()));
-// receiptPaymentDtoIPage.setTotal(receiptPaymentDtoIPage.getTotal() - count);
-// }
- receiptPaymentDtoIPage.getRecords().forEach(item -> {
- // 姣旇緝鍥炴閲戦 == 寰呭洖娆鹃噾棰�
- if (item.getInvoiceTotal().compareTo(item.getReceiptPaymentAmountTotal()) == 0) {
- item.setStatusName("宸插畬鎴愬洖娆�");
- }else{
- item.setStatusName("鏈畬鎴愬洖娆�");
- }
-
- });
- return receiptPaymentDtoIPage;
- }
-
- /**
- * 寮�绁ㄥ彴璐﹁鎯�
- * @param id
- * @return
- */
- @Override
- public InvoiceLedgerDto invoiceInfo(Integer id) {
- return receiptPaymentMapper.invoiceInfo(id);
- }
-
- @Override
- public Map<String,BigDecimal> getAmountMouth() {
- List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(null);
- BigDecimal contractAmount = salesLedgers.stream().map(SalesLedger::getContractAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- LocalDate now = LocalDate.now();
- YearMonth currentMonth = YearMonth.from(now);
-
- // 鍒涘缓LambdaQueryWrapper
- LambdaQueryWrapper<ReceiptPayment> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.ge(ReceiptPayment::getReceiptPaymentDate, currentMonth.atDay(1).atStartOfDay()) // 澶т簬绛変簬鏈湀绗竴澶�
- .lt(ReceiptPayment::getReceiptPaymentDate, currentMonth.plusMonths(1).atDay(1).atStartOfDay()); // 灏忎簬涓嬫湀绗竴澶�
-
- // 鎵ц鏌ヨ骞惰绠楁�诲拰
- List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(queryWrapper);
-
- BigDecimal receiveAmount = receiptPayments.stream()
- .map(ReceiptPayment::getReceiptPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- // 鏋勫缓缁撴灉
- Map<String, BigDecimal> result = new HashMap<>();
- result.put("receiveAmount", receiveAmount);
- result.put("contractAmount", contractAmount);
- return result;
- }
-
- /**
- * 鏌ヨ鍥炴璁板綍
- */
- @Override
- public List<ReceiptPaymentDto> receiptPaymentHistoryList(ReceiptPaymentDto receiptPaymentDto) {
- return receiptPaymentMapper.receiptPaymentHistoryList(receiptPaymentDto);
- }
-
- /**
- * 鏌ヨ鍥炴璁板綍鍒嗛〉
- */
- @Override
- public IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page, ReceiptPaymentDto receiptPaymentDto) {
- return receiptPaymentMapper.receiptPaymentHistoryListPage(page, receiptPaymentDto);
- }
-
- /**
- * 瀹㈡埛寰�鏉ヨ褰曟煡璇�
- * @param receiptPaymentDto
- * @return
- */
- @Override
- public List<InvoiceLedgerDto> customerInteractions(InvoiceLedgerDto receiptPaymentDto) {
- return receiptPaymentMapper.invoiceLedgerSalesAccount(receiptPaymentDto);
- }
-
- /**
- * 鏌ヨ鍥炴璁板綍鍒嗛〉
- */
- @Override
- public List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage(ReceiptPaymentDto receiptPaymentDto) {
- return receiptPaymentMapper.receiptPaymentHistoryListNoPage( receiptPaymentDto);
- }
-
- @Override
- public void exportPaymentList(HttpServletResponse response) {
- List<ReceiptPaymentDto> receiptPaymentDtoList = receiptPaymentMapper.bindInvoiceNoRegListAll();
- ExcelUtil<ReceiptPaymentDto> util = new ExcelUtil<ReceiptPaymentDto>(ReceiptPaymentDto.class);
- util.exportExcel(response, receiptPaymentDtoList, "鍥炴鐧昏");
- }
-
- @Override
- public void exportPaymentList(HttpServletResponse response, List<Long> ids) {
- if (ids == null) {
- List<ReceiptPaymentExeclDto> receiptPaymentDtoList = receiptPaymentMapper.bindInvoiceNoRegListByIds(new ArrayList<>(), SecurityUtils.getLoginUser().getTenantId());
- ExcelUtil<ReceiptPaymentExeclDto> util = new ExcelUtil<ReceiptPaymentExeclDto>(ReceiptPaymentExeclDto.class);
- util.exportExcel(response, receiptPaymentDtoList, "鍥炴鐧昏");
- }else {
- List<ReceiptPaymentExeclDto> receiptPaymentDtoList = receiptPaymentMapper.bindInvoiceNoRegListByIds(ids,SecurityUtils.getLoginUser().getTenantId());
- ExcelUtil<ReceiptPaymentExeclDto> util = new ExcelUtil<ReceiptPaymentExeclDto>(ReceiptPaymentExeclDto.class);
- util.exportExcel(response, receiptPaymentDtoList, "鍥炴鐧昏");
- }
-
- }
-}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
index 37e06bb..171f5ae 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -3,8 +3,6 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.procurementrecord.utils.StockUtils;
@@ -14,9 +12,6 @@
import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.quality.mapper.QualityInspectMapper;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
-import com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
@@ -30,6 +25,7 @@
import com.ruoyi.technology.mapper.TechnologyBomStructureMapper;
import com.ruoyi.technology.mapper.TechnologyRoutingMapper;
import com.ruoyi.technology.pojo.TechnologyRouting;
+import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -38,7 +34,6 @@
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
@@ -76,8 +71,6 @@
@Autowired
private TechnologyBomStructureMapper technologyBomStructureMapper;
@Autowired
- private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
- @Autowired
private ProductionProductMainMapper productionProductMainMapper;
@Autowired
private ProductionProductOutputMapper productionProductOutputMapper;
@@ -101,52 +94,34 @@
@Override
public List<SalesLedgerProduct> selectSalesLedgerProductList(SalesLedgerProduct salesLedgerProduct) {
-// LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>();
-// queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedgerProduct.getSalesLedgerId())
-// .eq(SalesLedgerProduct::getType, salesLedgerProduct.getType());
List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct);
if(!CollectionUtils.isEmpty(salesLedgerProducts)){
salesLedgerProducts.forEach(item -> {
- // 鍙戣揣淇℃伅
- ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
+ // 鍙戣揣淇℃伅锛堝彇鏈�鏂颁竴鏉★紝鍙煡璇㈠鏍搁�氳繃鎴栧凡鍙戣揣鐨勮褰曪級
+ ShippingInfo latestShippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
.eq(ShippingInfo::getSalesLedgerProductId, item.getId())
+ .in(ShippingInfo::getStatus, "瀹℃牳閫氳繃", "宸插彂璐�")
.orderByDesc(ShippingInfo::getCreateTime)
.last("limit 1"));
- if(shippingInfo != null){
- item.setShippingDate(shippingInfo.getShippingDate());
- item.setShippingCarNumber(shippingInfo.getShippingCarNumber());
- item.setExpressCompany(shippingInfo.getExpressCompany());
- item.setExpressNumber(shippingInfo.getExpressNumber());
+ if(latestShippingInfo != null){
+ item.setShippingDate(latestShippingInfo.getShippingDate());
+ item.setExpressCompany(latestShippingInfo.getExpressCompany());
+ item.setExpressNumber(latestShippingInfo.getExpressNumber());
+ }
+ // 杞︾墝鍙凤細鍙栨墍鏈夊鏍搁�氳繃鎴栧凡鍙戣揣璁板綍鐨勮溅鐗屽彿锛岄�楀彿鎷兼帴
+ List<ShippingInfo> allShippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>()
+ .eq(ShippingInfo::getSalesLedgerProductId, item.getId())
+ .in(ShippingInfo::getStatus, "瀹℃牳閫氳繃", "宸插彂璐�")
+ .orderByAsc(ShippingInfo::getCreateTime));
+ if(!CollectionUtils.isEmpty(allShippingInfos)){
+ String carNumbers = allShippingInfos.stream()
+ .map(ShippingInfo::getShippingCarNumber)
+ .filter(carNo -> carNo != null && !carNo.trim().isEmpty())
+ .distinct()
+ .collect(Collectors.joining(","));
+ item.setShippingCarNumber(carNumbers);
}
});
- // 寮�绁�
- InvoiceRegistrationProductDto invoiceRegistrationProductDto = new InvoiceRegistrationProductDto();
- invoiceRegistrationProductDto.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId().intValue());
- List<InvoiceRegistrationProductDto> invoiceRegistrationProductDtoList = invoiceRegistrationProductMapper.invoiceRegistrationProductList(invoiceRegistrationProductDto);
- // 缁熻寮�绁ㄧ櫥璁颁骇鍝佺殑宸插紑绁ㄦ暟/宸插紑绁ㄩ噾棰�
- if (!CollectionUtils.isEmpty(invoiceRegistrationProductDtoList)) {
- for (SalesLedgerProduct ledgerProduct : salesLedgerProducts) {
- BigDecimal invoiceNum = BigDecimal.ZERO;
- BigDecimal invoiceAmount = BigDecimal.ZERO;
- BigDecimal noInvoiceNum = BigDecimal.ZERO;
- BigDecimal noInvoiceAmount = BigDecimal.ZERO;
- for (InvoiceRegistrationProductDto registrationProductDto : invoiceRegistrationProductDtoList) {
- if(ledgerProduct.getId().intValue() == registrationProductDto.getSalesLedgerProductId()){
- invoiceNum = invoiceNum.add(registrationProductDto.getInvoiceNum());
- invoiceAmount = invoiceAmount.add(registrationProductDto.getInvoiceAmount());
- }
- }
- noInvoiceNum = ledgerProduct.getQuantity().subtract(invoiceNum);
- noInvoiceAmount = ledgerProduct.getTaxInclusiveTotalPrice().subtract(invoiceAmount);
- ledgerProduct.setInvoiceNum(invoiceNum);
- ledgerProduct.setInvoiceAmount(invoiceAmount);
- ledgerProduct.setNoInvoiceNum(noInvoiceNum);
- ledgerProduct.setNoInvoiceAmount(noInvoiceAmount);
-
-
- }
- }
-
}
return salesLedgerProducts;
}
@@ -202,18 +177,6 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int addOrUpdateSalesLedgerProduct(SalesLedgerProduct salesLedgerProduct) {
- // 寰呭洖娆撅紝浠樻
- if(salesLedgerProduct.getType().equals(1)){
- salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getInvoiceTotal()));
- //鏈紑绁ㄦ暟閲�+閲戦
- salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity());
- salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice());
- }else{
- salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice().subtract(salesLedgerProduct.getTicketsTotal()));
- // 鏈潵绁ㄦ暟閲�+閲戦
- salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity());
- salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxInclusiveTotalPrice());
- }
int result;
Long salesLedgerId = salesLedgerProduct.getSalesLedgerId();
@@ -223,7 +186,6 @@
addProductionData(salesLedgerProduct);
} else {
//鏌ヨ鍘熸湰鐨勪骇鍝佸瀷鍙穒d
- salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity());
result = salesLedgerProductMapper.updateById(salesLedgerProduct);
/*鍒犻櫎瀵瑰簲鐨勭敓浜ф暟鎹苟閲嶆柊鏂板*/
deleteProductionData(Arrays.asList(salesLedgerProduct.getId()));
@@ -266,14 +228,15 @@
*/
public void addProductionData(SalesLedgerProduct salesLedgerProduct) {
//鍏堝垽鏂浜у搧鏄惁闇�瑕佺敓浜�
- if (!salesLedgerProduct.getIsProduction()) {
+ if (!BooleanUtils.isTrue(salesLedgerProduct.getIsProduction())) {
return;
}
SalesLedger salesLedger = salesLedgerMapper.selectById(salesLedgerProduct.getSalesLedgerId());
ProductionPlan productionPlan = new ProductionPlan();
productionPlan.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId());
productionPlan.setSalesLedgerProductId(salesLedgerProduct.getId());
- productionPlan.setMpsNo(generateNextPlanNo(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))));
+ productionPlan.setMpsNo(generateNextPlanNo(com.ruoyi.common.utils.DateUtils.toLocalDate(salesLedger.getEntryDate())
+ .format(DateTimeFormatter.ofPattern("yyyyMMdd"))));
productionPlan.setProductModelId(salesLedgerProduct.getProductModelId());
productionPlan.setQtyRequired(salesLedgerProduct.getQuantity());
productionPlan.setSource("閿�鍞�");
@@ -288,6 +251,9 @@
* 鍒犻櫎鐢熶骇璁″垝
*/
public void deleteProductionData(List<Long> productIds) {
+ if (CollectionUtils.isEmpty(productIds)) {
+ return;
+ }
List<ProductionPlan> productionPlans = productionPlanMapper.selectList(
new LambdaQueryWrapper<ProductionPlan>()
.in(ProductionPlan::getSalesLedgerProductId, productIds.stream().map(Long::intValue).collect(Collectors.toList())));
@@ -300,34 +266,6 @@
}
List<Long> ids = productionPlans.stream().map(ProductionPlan::getId).collect(Collectors.toList());
productionPlanMapper.deleteByIds(ids);
- }
-
- @Override
- public IPage<SalesLedgerProductDto> listPage(Page page, SalesLedgerProductDto salesLedgerProduct) {
- IPage<SalesLedgerProductDto> salesLedgerProductDtoIPage = salesLedgerProductMapper.listPage(page, salesLedgerProduct);
- salesLedgerProductDtoIPage.getRecords().forEach(item -> {
- // 鍒ゆ柇鐘舵��
- if(item.getTaxInclusiveTotalPrice().compareTo(item.getInvoiceTotal()) == 0){
- item.setStatusName("宸插畬鎴愪粯娆�");
- }else{
- item.setStatusName("鏈畬鎴愪粯娆�");
- }
- });
- return salesLedgerProductDtoIPage;
- }
-
- @Override
- public IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) {
- IPage<SalesLedgerProductDto> salesLedgerProductDtoIPage = salesLedgerProductMapper.listPagePurchaseLedger(page, salesLedgerProduct);
- salesLedgerProductDtoIPage.getRecords().forEach(item -> {
- // 鍒ゆ柇鐘舵��
- if(item.getTaxInclusiveTotalPrice().compareTo(item.getTicketsTotal()) == 0){
- item.setStatusName("宸插畬鎴愪粯娆�");
- }else{
- item.setStatusName("鏈畬鎴愪粯娆�");
- }
- });
- return salesLedgerProductDtoIPage;
}
/**
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 9803611..00e913f 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -8,11 +8,17 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.service.AccountIncomeService;
+import com.ruoyi.account.mapper.sales.AccountInvoiceApplicationMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.sales.AccountInvoiceApplication;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.mapper.CustomerMapper;
import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.SaleEnum;
import com.ruoyi.common.exception.base.BaseException;
@@ -24,24 +30,28 @@
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.mapper.TempFileMapper;
-import com.ruoyi.other.pojo.TempFile;
-import com.ruoyi.production.mapper.*;
+import com.ruoyi.production.mapper.ProductionProductInputMapper;
+import com.ruoyi.production.mapper.ProductionProductMainMapper;
+import com.ruoyi.production.mapper.ProductionProductOutputMapper;
import com.ruoyi.production.service.ProductionProductMainService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysDeptMapper;
import com.ruoyi.project.system.mapper.SysUserMapper;
-import com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto;
-import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper;
import com.ruoyi.quality.mapper.QualityInspectMapper;
import com.ruoyi.sales.dto.*;
-import com.ruoyi.sales.mapper.*;
-import com.ruoyi.sales.pojo.*;
+import com.ruoyi.sales.mapper.CommonFileMapper;
+import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
+import com.ruoyi.sales.mapper.ShippingInfoMapper;
+import com.ruoyi.sales.pojo.CommonFile;
+import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.sales.service.ISalesLedgerService;
import com.ruoyi.sales.vo.SalesLedgerVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.io.FilenameUtils;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -51,16 +61,12 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
@@ -83,25 +89,24 @@
private static final String LOCK_PREFIX = "contract_no_lock:";
private static final long LOCK_WAIT_TIMEOUT = 10; // 閿佺瓑寰呰秴鏃舵椂闂达紙绉掞級
private static final long LOCK_EXPIRE_TIME = 30; // 閿佽嚜鍔ㄨ繃鏈熸椂闂达紙绉掞級
- private final AccountIncomeService accountIncomeService;
private final SalesLedgerMapper salesLedgerMapper;
private final CustomerMapper customerMapper;
private final SalesLedgerProductMapper salesLedgerProductMapper;
private final SalesLedgerProductServiceImpl salesLedgerProductServiceImpl;
private final CommonFileMapper commonFileMapper;
private final TempFileMapper tempFileMapper;
- private final ReceiptPaymentMapper receiptPaymentMapper;
private final ShippingInfoServiceImpl shippingInfoServiceImpl;
private final CommonFileServiceImpl commonFileService;
private final ShippingInfoMapper shippingInfoMapper;
- private final InvoiceLedgerMapper invoiceLedgerMapper;
- private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
- private final InvoiceRegistrationMapper invoiceRegistrationMapper;
private final ProductionProductMainMapper productionProductMainMapper;
private final ProductionProductOutputMapper productionProductOutputMapper;
private final ProductionProductInputMapper productionProductInputMapper;
private final QualityInspectMapper qualityInspectMapper;
private final RedisTemplate<String, String> redisTemplate;
+ private final FileUtil fileUtil;
+ private final AccountInvoiceApplicationMapper accountInvoiceApplicationMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+
@Autowired
private SysDeptMapper sysDeptMapper;
@Value("${file.upload-dir}")
@@ -113,9 +118,6 @@
private ProductMapper productMapper;
@Autowired
private ProductionProductMainService productionProductMainService;
- @Autowired
- private PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
- ;
@Autowired
private SysUserMapper sysUserMapper;
@@ -141,17 +143,11 @@
productWrapper.eq(SalesLedgerProduct::getType, type.getCode());
List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(productWrapper);
if (type.equals(SaleEnum.PURCHASE)) {
- // 鏌ヨ閫�璐т俊鎭�
- List<Long> productIds = salesLedgerProducts.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList());
- List<SimpleReturnOrderGroupDto> groupListByProductIds = new ArrayList<>();
- if(CollectionUtils.isNotEmpty(productIds)){
- groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds);
- }
- Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getSalesLedgerProductId, SimpleReturnOrderGroupDto::getSumReturnQuantity));
salesLedgerProducts.forEach(item -> {
- BigDecimal returnQuality = returnOrderGroupDtoMap.getOrDefault(item.getId(), BigDecimal.ZERO);
- item.setReturnQuality(returnQuality);
- item.setAvailableQuality(item.getQuantity().subtract(returnQuality));
+ BigDecimal returnQuantity = item.getReturnQuantity() == null ? BigDecimal.ZERO : item.getReturnQuantity();
+ item.setReturnQuantity(returnQuantity);
+ BigDecimal quantity = item.getQuantity() == null ? BigDecimal.ZERO : item.getQuantity();
+ item.setAvailableQuality(quantity.subtract(returnQuantity));
});
}
return salesLedgerProducts;
@@ -171,10 +167,6 @@
productWrapper.eq(SalesLedgerProduct::getType, 1);
List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper);
for (SalesLedgerProduct product : products) {
- product.setOriginalNoInvoiceNum(product.getNoInvoiceNum());
- // 鎻愪緵涓存椂鏈紑绁ㄦ暟锛屾湭寮�绁ㄩ噾棰濅緵鍓嶆璁$畻
- product.setTempnoInvoiceAmount(product.getNoInvoiceAmount());
- product.setTempNoInvoiceNum(product.getNoInvoiceNum());
product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
product.setRegisterDate(LocalDateTime.now());
// 鍙戣揣淇℃伅
@@ -275,51 +267,37 @@
@Override
public List<MonthlyAmountDto> getAmountHalfYear(Integer type) {
-
LocalDate now = LocalDate.now();
List<MonthlyAmountDto> result = new ArrayList<>();
-
for (int i = 5; i >= 0; i--) {
YearMonth yearMonth = YearMonth.from(now.minusMonths(i));
- LocalDateTime startTime = yearMonth.atDay(1).atStartOfDay();
- LocalDateTime endTime = yearMonth.atEndOfMonth().atTime(23, 59, 59);
-
- // 鍥炴閲戦
- LambdaQueryWrapper<ReceiptPayment> receiptPaymentQuery = new LambdaQueryWrapper<>();
- receiptPaymentQuery
- .ge(ReceiptPayment::getCreateTime, startTime)
- .le(ReceiptPayment::getCreateTime, endTime);
-
- List<ReceiptPayment> receiptPayments =
- receiptPaymentMapper.selectList(receiptPaymentQuery);
-
- BigDecimal receiptAmount = receiptPayments.stream()
- .map(ReceiptPayment::getReceiptPaymentAmount)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
- // 寮�绁ㄩ噾棰�
- LambdaQueryWrapper<InvoiceLedger> invoiceLedgerQuery = new LambdaQueryWrapper<>();
- invoiceLedgerQuery
- .ge(InvoiceLedger::getCreateTime, startTime)
- .le(InvoiceLedger::getCreateTime, endTime);
-
- List<InvoiceLedger> invoiceLedgers =
- invoiceLedgerMapper.selectList(invoiceLedgerQuery);
-
- BigDecimal invoiceAmount = invoiceLedgers.stream()
- .map(InvoiceLedger::getInvoiceTotal)
- .filter(Objects::nonNull)
- .reduce(BigDecimal.ZERO, BigDecimal::add);
-
+ LocalDate startTime = yearMonth.atDay(1);
+ LocalDate endTime = yearMonth.atEndOfMonth();
MonthlyAmountDto dto = new MonthlyAmountDto();
dto.setMonth(yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM")));
- dto.setReceiptAmount(receiptAmount);
- dto.setInvoiceAmount(invoiceAmount);
-
+ //鍥炴閲戦
+ List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList(new LambdaQueryWrapper<AccountSalesCollection>()
+ .between(AccountSalesCollection::getCollectionDate, startTime, endTime));
+ BigDecimal totalIncome = Optional.of(
+ accountSalesCollections.stream()
+ .map(AccountSalesCollection::getCollectionAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ dto.setReceiptAmount(totalIncome);
+ //寮�绁ㄩ噾棰�
+ List<AccountInvoiceApplication> accountInvoiceApplications = accountInvoiceApplicationMapper.selectList(new LambdaQueryWrapper<AccountInvoiceApplication>()
+ .eq(AccountInvoiceApplication::getStatus,1)
+ .between(AccountInvoiceApplication::getApplyDate, startTime, endTime));
+ BigDecimal totalInvoiceAmount = Optional.of(
+ accountInvoiceApplications.stream()
+ .map(AccountInvoiceApplication::getInvoiceAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add)
+ ).orElse(BigDecimal.ZERO);
+ dto.setInvoiceAmount(totalInvoiceAmount);
result.add(dto);
}
-
return result;
}
@@ -342,9 +320,17 @@
if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return AjaxResult.error("閿�鍞彴璐︽暟鎹负绌猴紒");
List<SalesLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("閿�鍞骇鍝佹暟鎹�");
if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return AjaxResult.error("閿�鍞骇鍝佹暟鎹负绌猴紒");
- // 瀹㈡埛鏁版嵁
- List<Customer> customers = customerMapper.selectList(new LambdaQueryWrapper<Customer>().in(Customer::getCustomerName,
- salesLedgerImportDtoList.stream().map(SalesLedgerImportDto::getCustomerName).collect(Collectors.toList())));
+ // 瀹㈡埛鏁版嵁 - 鍙傝�� listPage 鏌ヨ绉佹捣瀹㈡埛锛坱ype = 0锛�
+ // type = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴�
+ Long loginUserId = loginUser.getUser().getUserId();
+ List<Customer> customers = customerMapper.selectList(new QueryWrapper<Customer>()
+ .in("customer_name", salesLedgerImportDtoList.stream()
+ .map(SalesLedgerImportDto::getCustomerName).collect(Collectors.toList()))
+ .and(wrapper -> wrapper.eq("type", 0)
+ .or(wrapper2 -> wrapper2.eq("type", 1).eq("is_assigned", 1)))
+ .and(wrapper -> wrapper.eq("usage_user", loginUserId)
+ .or(wrapper2 -> wrapper2.eq("create_user", loginUserId)
+ .or(wrapper3 -> wrapper3.exists("select 1 from customer_user cu where cu.customer_id = customer.id and cu.user_id = " + loginUserId)))));
// // 瑙勬牸鍨嬪彿鏁版嵁
// List<ProductModel> productModels = productModelMapper.selectList(new LambdaQueryWrapper<ProductModel>().in(ProductModel::getModel,
// salesLedgerProductImportDtoList.stream().map(SalesLedgerImportDto::getSpecificationModel).collect(Collectors.toList())));
@@ -362,20 +348,26 @@
if (salesLedger1 != null) {
continue;
}
+
+ // 鍒ゆ柇涓氬姟鍛樻槸鍚﹀瓨鍦�
+ SysUser salesman = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
+ .eq(SysUser::getNickName, salesLedgerImportDto.getSalesman()));
+ if (salesman == null) {
+ throw new RuntimeException("涓氬姟鍛�:" + salesLedgerImportDto.getSalesman() + "涓嶅瓨鍦紒");
+ }
SalesLedger salesLedger = new SalesLedger();
BeanUtils.copyProperties(salesLedgerImportDto, salesLedger);
salesLedger.setExecutionDate(DateUtils.toLocalDate(salesLedgerImportDto.getExecutionDate()));
+ salesLedger.setDeliveryDate(DateUtils.toLocalDate(salesLedgerImportDto.getDeliveryDate()));
// 閫氳繃瀹㈡埛鍚嶇О鏌ヨ瀹㈡埛ID锛屽鎴峰悎鍚屽彿
- salesLedger.setCustomerId(customers.stream()
+ Optional<Customer> customerOptional = customers.stream()
.filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName()))
- .findFirst()
- .map(Customer::getId)
- .orElse(null));
- salesLedger.setCustomerContractNo(customers.stream()
- .filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName()))
- .findFirst()
- .map(Customer::getTaxpayerIdentificationNumber)
- .orElse(null));
+ .findFirst();
+ if (customerOptional.isEmpty()) {
+ throw new RuntimeException("瀹㈡埛:" + salesLedger.getCustomerName() + "涓嶅瓨鍦紒鎴栬�呴潪绉佹捣鐢ㄦ埛");
+ }
+ salesLedger.setCustomerId(customerOptional.get().getId());
+ salesLedger.setCustomerContractNo(customerOptional.get().getTaxpayerIdentificationNumber());
Long aLong = sysUsers.stream()
.filter(sysUser -> sysUser.getNickName().equals(salesLedger.getEntryPerson()))
.findFirst()
@@ -393,6 +385,7 @@
salesLedger.setContractAmount(salesLedgerProductImportDtos.stream()
.map(SalesLedgerProductImportDto::getTaxInclusiveTotalPrice)
.reduce(BigDecimal.ZERO, BigDecimal::add));
+ salesLedger.setNetContractAmount(salesLedger.getContractAmount());
salesLedgerMapper.insert(salesLedger);
@@ -403,15 +396,16 @@
salesLedgerProduct.setType(1);
// 璁$畻涓嶅惈绋庢�讳环
salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP));
- salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity());
- salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxExclusiveTotalPrice());
- list.stream()
- .filter(map -> map.get("productName").equals(salesLedgerProduct.getProductCategory()) && map.get("model").equals(salesLedgerProduct.getSpecificationModel()))
- .findFirst()
- .ifPresent(map -> {
- salesLedgerProduct.setProductModelId(Long.parseLong(map.get("modelId").toString()));
- salesLedgerProduct.setProductId(Long.parseLong(map.get("id").toString()));
- });
+ // 鏍¢獙浜у搧瑙勬牸鏄惁瀛樺湪
+ Optional<Map<String, Object>> productModelOptional = list.stream()
+ .filter(map -> Objects.equals(map.get("productName"), salesLedgerProduct.getProductCategory()) && Objects.equals(map.get("model"), salesLedgerProduct.getSpecificationModel()))
+ .findFirst();
+ if (productModelOptional.isEmpty()) {
+ throw new RuntimeException("浜у搧澶х被:" + salesLedgerProduct.getProductCategory() + ",瑙勬牸鍨嬪彿:" + salesLedgerProduct.getSpecificationModel() + "涓嶅瓨鍦紒");
+ }
+ Map<String, Object> productModelMap = productModelOptional.get();
+ salesLedgerProduct.setProductModelId(Long.parseLong(productModelMap.get("modelId").toString()));
+ salesLedgerProduct.setProductId(Long.parseLong(productModelMap.get("id").toString()));
// salesLedgerProduct.setProductId(productList.stream()
// .filter(product -> product.getProductName().equals(salesLedgerProduct.getProductCategory()))
// .findFirst()
@@ -425,7 +419,7 @@
salesLedgerProduct.setRegister(loginUser.getNickName());
salesLedgerProduct.setRegisterDate(LocalDateTime.now());
salesLedgerProduct.setApproveStatus(0);
- salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice());
+ salesLedgerProduct.setIsProduction(salesLedgerProductImportDto.getIsProduction() == 1);
salesLedgerProductMapper.insert(salesLedgerProduct);
// 娣诲姞鐢熶骇鏁版嵁
salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
@@ -435,8 +429,8 @@
return AjaxResult.success("瀵煎叆鎴愬姛");
} catch (Exception e) {
e.printStackTrace();
+ return AjaxResult.error("瀵煎叆澶辫触锛�" + e.getMessage());
}
- return AjaxResult.success("瀵煎叆澶辫触");
}
@Override
@@ -458,11 +452,7 @@
productWrapper.eq(SalesLedgerProduct::getType, 1);
List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper);
for (SalesLedgerProduct product : products) {
- product.setOriginalNoInvoiceNum(product.getNoInvoiceNum());
- // 鎻愪緵涓存椂鏈紑绁ㄦ暟锛屾湭寮�绁ㄩ噾棰濅緵鍓嶆璁$畻
- product.setTempnoInvoiceAmount(product.getNoInvoiceAmount());
- product.setTempNoInvoiceNum(product.getNoInvoiceNum());
- product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
+ product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
product.setRegisterDate(LocalDateTime.now());
// 鍙戣揣淇℃伅
ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
@@ -535,29 +525,8 @@
salesLedgerProductMapper.deleteBatchIds(productIds);
}
- LambdaQueryWrapper<InvoiceRegistrationProduct> wrapper = new LambdaQueryWrapper<>();
- wrapper.in(InvoiceRegistrationProduct::getSalesLedgerId, idList);
- List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(wrapper);
List<Integer> invoiceLedgerIds = new ArrayList<>();
- if (CollectionUtils.isNotEmpty(invoiceRegistrationProducts)) {
- LambdaQueryWrapper<InvoiceLedger> wrapperOne = new LambdaQueryWrapper<>();
- wrapperOne.in(InvoiceLedger::getInvoiceRegistrationProductId, invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getId).collect(Collectors.toList()));
- List<InvoiceLedger> invoiceLedgers = invoiceLedgerMapper.selectList(wrapperOne);
- if (CollectionUtils.isNotEmpty(invoiceLedgers)) {
- invoiceLedgerIds = invoiceLedgers.stream().map(InvoiceLedger::getId).collect(Collectors.toList());
- }
- invoiceLedgerMapper.delete(wrapperOne);
- }
- invoiceRegistrationProductMapper.delete(wrapper);
- LambdaQueryWrapper<InvoiceRegistration> wrapperTwo = new LambdaQueryWrapper<>();
- wrapperTwo.in(InvoiceRegistration::getSalesLedgerId, idList);
- invoiceRegistrationMapper.delete(wrapperTwo);
- if (CollectionUtils.isNotEmpty(invoiceLedgerIds)) {
- LambdaQueryWrapper<ReceiptPayment> wrapperTree = new LambdaQueryWrapper<>();
- wrapperTree.in(ReceiptPayment::getInvoiceLedgerId, invoiceLedgerIds);
- receiptPaymentMapper.delete(wrapperTree);
- }
// 鍒犻櫎鍙戣揣鍙拌处璁板綍
List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>()
.in(ShippingInfo::getSalesLedgerId, idList));
@@ -582,125 +551,62 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int addOrUpdateSalesLedger(SalesLedgerDto salesLedgerDto) {
- try {
- // 1. 鏍¢獙瀹㈡埛淇℃伅
- Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId());
- if (customer == null) {
- throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
- }
-
- // 2. DTO杞珽ntity
- SalesLedger salesLedger = convertToEntity(salesLedgerDto);
- salesLedger.setCustomerName(customer.getCustomerName());
- salesLedger.setTenantId(customer.getTenantId());
- // 3. 鏂板鎴栨洿鏂颁富琛�
- if (salesLedger.getId() == null) {
- String contractNo = generateSalesContractNo();
- salesLedger.setSalesContractNo(contractNo);
- salesLedgerMapper.insert(salesLedger);
- } else {
- salesLedgerMapper.updateById(salesLedger);
- }
-
- // 4. 澶勭悊瀛愯〃鏁版嵁
- List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
- if (productList != null && !productList.isEmpty()) {
- handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
- updateMainContractAmount(
- salesLedger.getId(),
- productList,
- SalesLedgerProduct::getTaxInclusiveTotalPrice,
- salesLedgerMapper,
- SalesLedger.class
- );
- }
-
- // 5. 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
- if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) {
- migrateTempFilesToFormal(salesLedger.getId(), salesLedgerDto.getTempFileIds());
- }
- return 1;
- } catch (IOException e) {
- throw new BaseException("鏂囦欢杩佺Щ澶辫触: " + e.getMessage());
+ // 1. 鏍¢獙瀹㈡埛淇℃伅
+ Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId());
+ if (customer == null) {
+ throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
}
+
+ // 2. DTO杞珽ntity
+ SalesLedger salesLedger = convertToEntity(salesLedgerDto);
+ salesLedger.setCustomerName(customer.getCustomerName());
+ salesLedger.setTenantId(customer.getTenantId());
+ // 褰曞叆浜猴細濡傛灉鏈紶鍒欎娇鐢ㄥ綋鍓嶇櫥褰曠敤鎴�
+ if (StringUtils.isEmpty(salesLedger.getEntryPerson())) {
+ salesLedger.setEntryPerson(String.valueOf(SecurityUtils.getUserId()));
+ }
+ // 3. 鏂板鎴栨洿鏂颁富琛�
+ if (salesLedger.getId() == null) {
+ String contractNo = salesLedger.getSalesContractNo();
+ if (StringUtils.isEmpty(contractNo)) {
+ contractNo = generateSalesContractNo(salesLedgerDto.getEntryDate());
+ }
+ salesLedger.setSalesContractNo(contractNo);
+ salesLedgerMapper.insert(salesLedger);
+ } else {
+ salesLedgerMapper.updateById(salesLedger);
+ }
+
+
+ // 4. 澶勭悊瀛愯〃鏁版嵁
+ List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
+ if (productList != null && !productList.isEmpty()) {
+ handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
+ updateMainContractAmount(
+ salesLedger.getId(),
+ productList,
+ SalesLedgerProduct::getTaxInclusiveTotalPrice,
+ salesLedgerMapper,
+ SalesLedger.class
+ );
+ }
+
+ // 5. 鍏滃簳锛氱‘淇濆疄闄呭悎鍚岄噾棰濇湁鍒濆鍊肩瓑浜庡悎鍚岄噾棰�
+ if (salesLedger.getNetContractAmount() == null) {
+ SalesLedger dbLedger = salesLedgerMapper.selectById(salesLedger.getId());
+ if (dbLedger != null && dbLedger.getNetContractAmount() == null && dbLedger.getContractAmount() != null) {
+ SalesLedger updateEntity = new SalesLedger();
+ updateEntity.setId(salesLedger.getId());
+ updateEntity.setNetContractAmount(dbLedger.getContractAmount());
+ salesLedgerMapper.updateById(updateEntity);
+ }
+ }
+
+ // 6. 淇濆瓨閿�鍞彴璐﹂檮浠�
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, salesLedger.getId(), salesLedgerDto.getStorageBlobDTOs());
+
+ return 1;
}
-
- /**
- * 灏嗕复鏃舵枃浠惰縼绉诲埌姝e紡鐩綍
- *
- * @param businessId 涓氬姟ID锛堥攢鍞彴璐D锛�
- * @param tempFileIds 涓存椂鏂囦欢ID鍒楄〃
- * @throws IOException 鏂囦欢鎿嶄綔寮傚父
- */
- private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds) throws IOException {
- if (CollectionUtils.isEmpty(tempFileIds)) {
- return;
- }
-
- // 鏋勫缓姝e紡鐩綍璺緞锛堟寜涓氬姟绫诲瀷鍜屾棩鏈熷垎缁勶級
- String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
-
- Path formalDirPath = Paths.get(formalDir);
-
- // 纭繚姝e紡鐩綍瀛樺湪锛堥�掑綊鍒涘缓锛�
- if (!Files.exists(formalDirPath)) {
- Files.createDirectories(formalDirPath);
- }
-
- for (String tempFileId : tempFileIds) {
- // 鏌ヨ涓存椂鏂囦欢璁板綍
- TempFile tempFile = tempFileMapper.selectById(tempFileId);
- if (tempFile == null) {
- log.warn("涓存椂鏂囦欢涓嶅瓨鍦紝璺宠繃澶勭悊: {}", tempFileId);
- continue;
- }
-
- // 鏋勫缓姝e紡鏂囦欢鍚嶏紙鍖呭惈涓氬姟ID鍜屾椂闂存埑锛岄伩鍏嶅啿绐侊級
- String originalFilename = tempFile.getOriginalName();
- String fileExtension = FilenameUtils.getExtension(originalFilename);
- String formalFilename = businessId + "_" +
- System.currentTimeMillis() + "_" +
- UUID.randomUUID().toString().substring(0, 8) +
- (StringUtils.hasText(fileExtension) ? "." + fileExtension : "");
-
- Path formalFilePath = formalDirPath.resolve(formalFilename);
-
- try {
- // 鎵ц鏂囦欢杩佺Щ锛堜娇鐢ㄥ師瀛愭搷浣滅‘淇濆畨鍏ㄦ�э級
-// Files.move(
-// Paths.get(tempFile.getTempPath()),
-// formalFilePath,
-// StandardCopyOption.REPLACE_EXISTING,
-// StandardCopyOption.ATOMIC_MOVE
-// );
- // 鍘熷瓙绉诲姩澶辫触锛屼娇鐢ㄥ鍒�+鍒犻櫎
- Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING);
- Files.deleteIfExists(Paths.get(tempFile.getTempPath()));
- log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
-
- // 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛�
- CommonFile fileRecord = new CommonFile();
- fileRecord.setCommonId(businessId);
- fileRecord.setName(originalFilename);
- fileRecord.setUrl(formalFilePath.toString());
- fileRecord.setCreateTime(LocalDateTime.now());
- //閿�鍞�
- fileRecord.setType(FileNameType.SALE.getValue());
- commonFileMapper.insert(fileRecord);
-
- // 鍒犻櫎涓存椂鏂囦欢璁板綍
- tempFileMapper.deleteById(tempFile);
-
- log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
- } catch (IOException e) {
- log.error("鏂囦欢杩佺Щ澶辫触: {}", tempFile.getTempPath(), e);
- // 鍙�夋嫨鍥炴粴浜嬪姟鎴栬褰曞け璐ユ枃浠�
- throw new IOException("鏂囦欢杩佺Щ寮傚父", e);
- }
- }
- }
-
- // 鏂囦欢杩佺Щ鏂规硶
@Override
public void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, SaleEnum type) {
@@ -723,9 +629,6 @@
if (!insertList.isEmpty()) {
for (SalesLedgerProduct salesLedgerProduct : insertList) {
salesLedgerProduct.setType(type.getCode());
- salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity());
- salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice());
- salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice());
salesLedgerProductMapper.insert(salesLedgerProduct);
// 娣诲姞鐢熶骇鏁版嵁
salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
@@ -740,8 +643,8 @@
}
@Transactional(readOnly = true)
- public String generateSalesContractNo() {
- LocalDate currentDate = LocalDate.now();
+ public String generateSalesContractNo(Date entryDate) {
+ LocalDate currentDate = entryDate != null ? DateUtils.toLocalDate(entryDate) : LocalDate.now();
String datePart = currentDate.format(DateTimeFormatter.BASIC_ISO_DATE);
String lockKey = LOCK_PREFIX + datePart;
String lockValue = Thread.currentThread().getId() + "-" + System.nanoTime(); // 鍞竴鏍囪瘑閿佹寔鏈夎��
@@ -837,6 +740,15 @@
amountField.setAccessible(true);
amountField.set(entity, totalAmount);
+ // 瀹為檯鍚堝悓閲戦鍒濆鍊肩瓑浜庡悎鍚岄噾棰�
+ try {
+ Field netAmountField = mainEntityClass.getDeclaredField("netContractAmount");
+ netAmountField.setAccessible(true);
+ netAmountField.set(entity, totalAmount);
+ } catch (NoSuchFieldException ignored) {
+ // 瀛愮被鍙兘娌℃湁璇ュ瓧娈碉紝蹇界暐
+ }
+
mainMapper.updateById(entity);
} catch (Exception e) {
throw new RuntimeException("鍔ㄦ�佹洿鏂颁富琛ㄩ噾棰濆け璐�", e);
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
index 1ec6a8d..37d7261 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -7,12 +7,17 @@
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.approve.pojo.ApproveProcess;
-import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo;
-import com.ruoyi.approve.bean.vo.ApproveProcessVO;
+import com.ruoyi.approve.mapper.ApprovalTemplateMapper;
+import com.ruoyi.approve.pojo.ApprovalInstance;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
+import com.ruoyi.approve.pojo.ApproveProcess;
+import com.ruoyi.approve.service.ApprovalInstanceService;
+import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.basic.mapper.CustomerMapper;
import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.common.enums.IsDeleteEnum;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
@@ -28,9 +33,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.time.LocalDate;
-import java.util.Collections;
-import java.util.List;
+import java.time.LocalDateTime;
+import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -43,6 +47,8 @@
private final ApproveProcessServiceImpl approveProcessService;
private final CustomerMapper customerMapper;
+ private final ApprovalTemplateMapper approvalTemplateMapper;
+ private final ApprovalInstanceService approvalInstanceService;
@Override
public IPage<SalesQuotationDto> listPage(Page page, SalesQuotationDto salesQuotationDto) {
@@ -50,10 +56,26 @@
if(CollectionUtils.isEmpty(salesQuotationDtoIPage.getRecords())){
return salesQuotationDtoIPage;
}
- salesQuotationDtoIPage.getRecords().forEach(record -> {
- List<SalesQuotationProduct> products = salesQuotationProductMapper.selectBySalesQuotationId(record.getId());
- record.setProducts(products);
- });
+
+ // 鎵归噺鏌ヨ浜у搧锛岄伩鍏� N+1 闂
+ List<Long> quotationIds = salesQuotationDtoIPage.getRecords().stream()
+ .map(SalesQuotationDto::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+
+ if (!quotationIds.isEmpty()) {
+ List<SalesQuotationProduct> allProducts = salesQuotationProductMapper.selectList(
+ new LambdaQueryWrapper<SalesQuotationProduct>()
+ .in(SalesQuotationProduct::getSalesQuotationId, quotationIds)
+ );
+
+ Map<Long, List<SalesQuotationProduct>> productMap = allProducts.stream()
+ .collect(Collectors.groupingBy(SalesQuotationProduct::getSalesQuotationId));
+
+ salesQuotationDtoIPage.getRecords().forEach(record ->
+ record.setProducts(productMap.getOrDefault(record.getId(), new ArrayList<>()))
+ );
+ }
return salesQuotationDtoIPage;
}
@@ -61,11 +83,13 @@
public boolean add(SalesQuotationDto salesQuotationDto) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SalesQuotation salesQuotation = new SalesQuotation();
+ BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
+ salesQuotation.setId(null);
Customer customer = customerMapper.selectById(Long.valueOf(salesQuotationDto.getCustomerId()));
if (ObjectUtils.isNotEmpty(customer)) {
salesQuotation.setCustomer(customer.getCustomerName());
}
- String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT","quotation_no");
+ String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT","quotation_no", salesQuotationDto.getCreateTime() != null ? salesQuotationDto.getCreateTime() : LocalDateTime.now());
salesQuotation.setQuotationNo(quotationNo);
salesQuotation.setStatus("寰呭鎵�");
salesQuotationMapper.insert(salesQuotation);
@@ -80,19 +104,31 @@
}).collect(Collectors.toList());
salesQuotationProductService.saveBatch(products);
// 鎶ヤ环瀹℃壒
- ApproveProcessVO approveProcessVO = new ApproveProcessVO();
- approveProcessVO.setApproveType(6);
- approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
- approveProcessVO.setApproveReason(quotationNo);
- approveProcessVO.setApproveUserIds(salesQuotationDto.getApproveUserIds());
- approveProcessVO.setApproveUser(loginUser.getUserId());
- approveProcessVO.setApproveTime(LocalDate.now().toString());
- approveProcessVO.setPrice(salesQuotationDto.getTotalAmount());
+ ApprovalTemplate approvalTemplate = approvalTemplateMapper.selectOne(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getBusinessType, 6L)
+ .eq(ApprovalTemplate::getDeleted, 0)
+ .orderByDesc(ApprovalTemplate::getId)
+ .last("LIMIT 1")
+ );
+ if (approvalTemplate == null) {
+ throw new RuntimeException("璇峰厛閰嶇疆鎶ヤ环瀹℃壒妯℃澘");
+ }
+ ApprovalInstanceDto approvalInstance = new ApprovalInstanceDto();
+ approvalInstance.setTemplateId(approvalTemplate.getId());
+ approvalInstance.setTemplateName(approvalTemplate.getTemplateName());
+ approvalInstance.setBusinessId(salesQuotation.getId());
+ approvalInstance.setBusinessType(6L);
+ approvalInstance.setCurrentLevel(1);
+ approvalInstance.setTitle(quotationNo+"瀹℃壒");
+ approvalInstance.setApplicantId(loginUser.getUserId());
+ approvalInstance.setApplicantName(loginUser.getNickName());
+ approvalInstance.setApplyTime(LocalDateTime.now());
try {
- approveProcessService.addApprove(approveProcessVO);
- }catch (Exception e){
- log.error("SalesQuotationServiceImpl error:{}", e);
- throw new RuntimeException("瀹℃壒澶辫触");
+ approvalInstanceService.add(approvalInstance);
+ } catch (Exception e) {
+ log.error("SalesQuotationServiceImpl approve error for quotationNo: {}", e);
+ throw new RuntimeException("瀹℃壒澶辫触: " + e.getMessage(), e);
}
return true;
}
@@ -121,10 +157,35 @@
salesQuotationProductService.saveBatch(products);
// 淇敼鎶ヤ环瀹℃壒
- vo.setApproveUserIds(salesQuotationDto.getApproveUserIds());
- vo.setApproveType(6);
- vo.setApproveReason(salesQuotationDto.getQuotationNo());
- approveProcessService.updateApproveUser(vo);
+ // 鍏堢粨鏉熶箣鍓嶆湭缁撴潫鐨勬姤浠峰鎵�
+ approvalInstanceService.lambdaUpdate().set(ApprovalInstance::getStatus,"REJECTED").eq(ApprovalInstance::getBusinessId,salesQuotation.getId()).eq(ApprovalInstance::getBusinessType,6L).update();
+
+ ApprovalTemplate approvalTemplate = approvalTemplateMapper.selectOne(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getBusinessType, 6L)
+ .eq(ApprovalTemplate::getDeleted, 0)
+ .orderByDesc(ApprovalTemplate::getId)
+ .last("LIMIT 1")
+ );
+ if (approvalTemplate == null) {
+ throw new RuntimeException("璇峰厛閰嶇疆鎶ヤ环瀹℃壒妯℃澘");
+ }
+ ApprovalInstanceDto approvalInstance = new ApprovalInstanceDto();
+ approvalInstance.setTemplateId(approvalTemplate.getId());
+ approvalInstance.setTemplateName(approvalTemplate.getTemplateName());
+ approvalInstance.setBusinessId(salesQuotation.getId());
+ approvalInstance.setBusinessType(6L);
+ approvalInstance.setCurrentLevel(1);
+ approvalInstance.setTitle(salesQuotation.getQuotationNo()+"瀹℃壒");
+ approvalInstance.setApplicantId(SecurityUtils.getUserId());
+ approvalInstance.setApplicantName(SecurityUtils.getLoginUser().getNickName());
+ approvalInstance.setApplyTime(LocalDateTime.now());
+ try {
+ approvalInstanceService.add(approvalInstance);
+ } catch (Exception e) {
+ log.error("SalesQuotationServiceImpl approve error for quotationNo: {}", e);
+ throw new RuntimeException("瀹℃壒澶辫触: " + e.getMessage(), e);
+ }
return true;
}
@Override
@@ -133,12 +194,31 @@
if(salesQuotation==null) return false;
salesQuotationMapper.deleteById(id);
salesQuotationProductMapper.delete(new LambdaQueryWrapper<SalesQuotationProduct>().eq(SalesQuotationProduct::getSalesQuotationId, id));
- // 鍒犻櫎鎶ヤ环瀹℃壒
- ApproveProcess one = approveProcessService.getOne(new LambdaQueryWrapper<ApproveProcess>()
+ // 鍒犻櫎璇ユ姤浠峰搴旂殑鍏ㄩ儴瀹℃壒瀹炰緥锛堝彲鑳藉瓨鍦ㄥ娆℃彁浜�/閲嶅锛�
+ List<ApprovalInstance> approvalInstances = approvalInstanceService.list(new LambdaQueryWrapper<ApprovalInstance>()
+ .eq(ApprovalInstance::getBusinessId, id)
+ .eq(ApprovalInstance::getBusinessType, 6L)
+ .eq(ApprovalInstance::getDeleted, 0));
+ if(!approvalInstances.isEmpty()){
+ approvalInstanceService.delete(
+ approvalInstances.stream()
+ .map(ApprovalInstance::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList())
+ );
+ }
+ // 鍒犻櫎璇ユ姤浠峰搴旂殑鍏ㄩ儴瀹℃壒娴佺▼锛堝悓涓�鎶ヤ环鍙兘鍙嶅鍙戣捣锛�
+ List<ApproveProcess> approveProcesses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>()
.eq(ApproveProcess::getApproveType, 6)
+ .eq(ApproveProcess::getApproveDelete, IsDeleteEnum.NOT_DELETED)
.eq(ApproveProcess::getApproveReason, salesQuotation.getQuotationNo()));
- if(one != null){
- approveProcessService.delByIds(Collections.singletonList(one.getId()));
+ if(!approveProcesses.isEmpty()){
+ approveProcessService.delByIds(
+ approveProcesses.stream()
+ .map(ApproveProcess::getId)
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList())
+ );
}
return true;
}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ShipmentApprovalServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ShipmentApprovalServiceImpl.java
deleted file mode 100644
index 9c358e7..0000000
--- a/src/main/java/com/ruoyi/sales/service/impl/ShipmentApprovalServiceImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.sales.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.sales.mapper.ShipmentApprovalMapper;
-import com.ruoyi.sales.pojo.ShipmentApproval;
-import com.ruoyi.sales.service.ShipmentApprovalService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-/**
- * @author :yys
- * @date : 2025/10/22 9:33
- */
-@Service
-@Slf4j
-@RequiredArgsConstructor
-public class ShipmentApprovalServiceImpl extends ServiceImpl<ShipmentApprovalMapper, ShipmentApproval> implements ShipmentApprovalService {
-
- private final ShipmentApprovalMapper shipmentApprovalMapper;
-
- @Override
- public IPage<ShipmentApproval> listPage(Page page, ShipmentApproval req) {
- IPage<ShipmentApproval> listPage = shipmentApprovalMapper.listPage(page, req);
- return listPage;
- }
-}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
index 545ac7d..be34bc0 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -4,15 +4,23 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.approve.bean.dto.ApprovalInstanceDto;
+import com.ruoyi.approve.mapper.ApprovalTemplateMapper;
+import com.ruoyi.approve.pojo.ApprovalTemplate;
import com.ruoyi.approve.pojo.ApproveProcess;
+import com.ruoyi.approve.service.ApprovalInstanceService;
import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.basic.enums.ApplicationTypeEnum;
import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
+import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.procurementrecord.bean.vo.ShippingProductVo;
import com.ruoyi.procurementrecord.utils.StockUtils;
-import com.ruoyi.sales.dto.SalesLedgerProductDto;
+import com.ruoyi.sales.dto.ShippingApproveDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.dto.ShippingProductDetailDto;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
@@ -25,7 +33,9 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.time.LocalDateTime;
import java.util.List;
/**
@@ -50,11 +60,13 @@
private final ApproveProcessServiceImpl approveProcessService;
private final FileUtil fileUtil;
private final ShippingProductDetailMapper shippingProductDetailMapper;
+ private final ApprovalTemplateMapper approvalTemplateMapper;
+ private final ApprovalInstanceService approvalInstanceService;
@Override
public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) {
IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req);
- listPage.getRecords().forEach(item ->{
+ listPage.getRecords().forEach(item -> {
item.setStorageBlobVOs(fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, item.getId()));
});
return listPage;
@@ -67,8 +79,7 @@
throw new RuntimeException("鍙戣揣淇℃伅涓嶅瓨鍦�");
}
//鎵e噺搴撳瓨
- if(!"宸插彂璐�".equals(byId.getStatus())){
-// SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId());
+ if (!"宸插彂璐�".equals(byId.getStatus())) {
List<ShippingProductDetail> shippingProductDetails = shippingProductDetailMapper.selectList(new LambdaQueryWrapper<ShippingProductDetail>().eq(ShippingProductDetail::getShippingInfoId, req.getId()));
if (CollectionUtils.isEmpty(shippingProductDetails)) {
throw new RuntimeException("鍙戣揣淇℃伅涓嶅瓨鍦�");
@@ -85,31 +96,31 @@
boolean update = this.updateById(byId);
// 淇濆瓨鏂囦欢
fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, req.getId(), req.getStorageBlobDTOs());
- return update ;
+ return update;
}
@Override
+ @Transactional(rollbackFor = Exception.class)
public boolean delete(List<Long> ids) {
List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>()
.in(ShippingInfo::getId, ids));
- if(CollectionUtils.isEmpty(shippingInfos)) return false;
+ if (CollectionUtils.isEmpty(shippingInfos)) return false;
+ // 鍙湁寰呭鏍哥姸鎬佹墠鑳藉垹闄�
+ boolean allPending = shippingInfos.stream().allMatch(s -> "寰呭鏍�".equals(s.getStatus()));
+ if (!allPending) throw new RuntimeException("鍙湁寰呭鏍哥姸鎬佹墠鑳藉垹闄�");
// 鍒犻櫎闄勪欢
commonFileService.deleteByBusinessIds(ids, FileNameType.SHIP.getValue());
- // 鎵e凡鍙戣揣搴撳瓨
- for (ShippingInfo shippingInfo : shippingInfos) {
- if("宸插彂璐�".equals(shippingInfo.getStatus())) {
- stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode());
- }
- }
// 鍒犻櫎鍙戣揣瀹℃壒
- if(CollectionUtils.isNotEmpty(shippingInfos)){
- for (ShippingInfo shippingInfo : shippingInfos){
+ if (CollectionUtils.isNotEmpty(shippingInfos)) {
+ for (ShippingInfo shippingInfo : shippingInfos) {
List<ApproveProcess> one = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>()
.like(ApproveProcess::getApproveReason, shippingInfo.getShippingNo()));
- if(one != null){
+ if (one != null) {
List<Long> list = one.stream().map(ApproveProcess::getId).toList();
approveProcessService.delByIds(list);
}
+ // 鎵e凡鍙戣揣搴撳瓨
+ stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode());
}
}
//鍒犻櫎鍙戣揣鏄庣粏
@@ -119,8 +130,8 @@
}
@Override
- public List<SalesLedgerProductDto> getReturnManagementDtoById(Long shippingId) {
- return shippingInfoMapper.getReturnManagementDtoById(shippingId );
+ public List<ShippingProductVo> getReturnManagementDtoById(Long shippingId) {
+ return shippingInfoMapper.getReturnManagementDtoById(shippingId);
}
@@ -131,9 +142,14 @@
@Override
public boolean add(ShippingInfoDto req) {
- this.save( req);
+ this.save(req);
req.getBatchNoDetailList().forEach(item -> item.setShippingInfoId(req.getId()));
shippingProductDetailMapper.insert(req.getBatchNoDetailList());
+ for (ShippingProductDetail shippingProductDetail : req.getBatchNoDetailList()) {
+ stockUtils.substractStock(shippingProductDetail.getProductModelId(), shippingProductDetail.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(), shippingProductDetail.getBatchNo());
+ }
+ // 淇濆瓨鏂囦欢
+ fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, req.getId(), req.getStorageBlobDTOs());
return true;
}
@@ -141,4 +157,63 @@
public List<ShippingProductDetailDto> getDetail(Long id) {
return shippingProductDetailMapper.getDetail(id);
}
+
+ @Override
+ public ShippingApproveDto getDateilByShippingNo(String shippingNo) {
+ ShippingApproveDto shippingApproveDto = new ShippingApproveDto();
+ ShippingInfo shippingInfo = new ShippingInfo();
+ shippingInfo.setShippingNo(shippingNo);
+ shippingApproveDto.setShippingInfo(shippingInfoMapper.listPage(new Page(1, -1), shippingInfo).getRecords().get(0));
+ List<ShippingProductDetailDto> dateilByShippingNo = shippingProductDetailMapper.getDateilByShippingNo(shippingNo);
+ shippingApproveDto.setShippingProductDetailDtoList(dateilByShippingNo);
+ return shippingApproveDto;
+ }
+
+ @Override
+ public boolean addReq(ShippingInfoDto req) {
+
+ // 鏍¢獙璇ヤ骇鍝佹槸鍚﹀凡鏈夊緟瀹℃牳/瀹℃牳涓殑鍙戣揣璁板綍锛岄槻姝㈤噸澶嶆彁浜�
+ Long salesLedgerProductId = req.getSalesLedgerProductId();
+ if (salesLedgerProductId != null) {
+ long pendingCount = this.count(new LambdaQueryWrapper<ShippingInfo>()
+ .eq(ShippingInfo::getSalesLedgerProductId, salesLedgerProductId)
+ .in(ShippingInfo::getStatus, "寰呭鏍�", "瀹℃牳涓�"));
+ if (pendingCount > 0) {
+ throw new RuntimeException("璇ヤ骇鍝佸凡鏈夊緟瀹℃牳鐨勫彂璐ц褰曪紝璇峰嬁閲嶅鎻愪氦");
+ }
+ }
+
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shipping_no",req.getCreateTime());
+ // 鍏堜繚瀛樺彂璐у崟锛屽啀鍙戣捣瀹℃壒锛涙棤瀹℃牳浜鸿嚜鍔ㄩ�氳繃鏃堕渶瑕佹寜鍙戣揣缂栧彿鍥炲啓鍙戣揣鐘舵�併��
+ req.setShippingNo(sh);
+ req.setStatus("寰呭鏍�");
+ boolean save = this.add(req);
+ // 鍙戣揣瀹℃壒
+ ApprovalTemplate approvalTemplate = approvalTemplateMapper.selectOne(
+ new LambdaQueryWrapper<ApprovalTemplate>()
+ .eq(ApprovalTemplate::getBusinessType, 7L)
+ .eq(ApprovalTemplate::getDeleted, 0)
+ .orderByDesc(ApprovalTemplate::getId)
+ .last("LIMIT 1")
+ );
+ if (approvalTemplate == null) {
+ throw new RuntimeException("璇峰厛閰嶇疆鍙戣揣瀹℃壒妯℃澘");
+ }
+ ApprovalInstanceDto approvalInstance = new ApprovalInstanceDto();
+ approvalInstance.setTemplateId(approvalTemplate.getId());
+ approvalInstance.setTemplateName(approvalTemplate.getTemplateName());
+ approvalInstance.setBusinessId(req.getId());
+ approvalInstance.setBusinessType(7L);
+ approvalInstance.setCurrentLevel(1);
+ approvalInstance.setTitle(sh);
+ approvalInstance.setApplicantId(loginUser.getUserId());
+ approvalInstance.setApplicantName(loginUser.getNickName());
+ approvalInstance.setApplyTime(LocalDateTime.now());
+ approvalInstanceService.add(approvalInstance);
+ // 鍒涘缓瀹℃壒瀹炰緥鍚庯紝鏇存柊鍙戣揣鐘舵�佷负"瀹℃牳涓�"锛屼娇鍓嶇姝g‘鏄剧ず瀹℃壒鐘舵��
+ req.setStatus("瀹℃牳涓�");
+ this.updateById(req);
+ return true;
+ }
}
diff --git a/src/main/java/com/ruoyi/sales/vo/CustomerTransactionsDetailsVo.java b/src/main/java/com/ruoyi/sales/vo/CustomerTransactionsDetailsVo.java
new file mode 100644
index 0000000..cc205b1
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/vo/CustomerTransactionsDetailsVo.java
@@ -0,0 +1,36 @@
+package com.ruoyi.sales.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@Data
+@Schema(name = "CustomerTransactionsDetailsVo", description = "钀ラ攢绠$悊--瀹㈡埛寰�鏉ユ槑缁�(杩斿洖)")
+public class CustomerTransactionsDetailsVo {
+
+ @Schema(description = "閿�鍞崟ID")
+ private Long salesLedgerId;
+
+ @Schema(description = "閿�鍞悎鍚屽彿")
+ private String salesContractNo;
+
+ @Schema(description = "閿�鍞悎鍚岀璁㈡棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate executionDate;
+
+ @Schema(description = "鍚堝悓閲戦")
+ private BigDecimal contractAmount;
+
+ @Schema(description = "鏀舵閲戦")
+ private BigDecimal receiptPaymentAmount;
+
+ @Schema(description = "搴旀敹閲戦")
+ private BigDecimal receiptableAmount;
+
+ @Schema(description = "閫�璐ч噾棰�")
+ private BigDecimal returnAmount;
+
+}
diff --git a/src/main/java/com/ruoyi/sales/vo/CustomerTransactionsVo.java b/src/main/java/com/ruoyi/sales/vo/CustomerTransactionsVo.java
new file mode 100644
index 0000000..a6c7d7f
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/vo/CustomerTransactionsVo.java
@@ -0,0 +1,33 @@
+package com.ruoyi.sales.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@Schema(name = "CustomerTransactionsVo", description = "钀ラ攢绠$悊--瀹㈡埛寰�鏉�(杩斿洖)")
+public class CustomerTransactionsVo {
+
+ @Schema(description = "瀹㈡埛ID")
+ private Long customerId;
+
+ @Schema(description = "瀹㈡埛鍚嶇О")
+ private String customerName;
+
+ @Schema(description = "鍚堝悓鎬婚噾棰�")
+ //璇ュ鎴烽攢鍞悎鍚岀疮璁¢噾棰�
+ private BigDecimal contractAmounts;
+
+ @Schema(description = "鏀舵閲戦")
+ //璇ュ鎴烽攢鍞敹娆剧疮璁¢噾棰�
+ private BigDecimal receiptPaymentAmount;
+
+ @Schema(description = "搴旀敹閲戦")
+ //璇ュ鎴烽攢鍞簲鏀剁疮璁¢噾棰�=鍒濆閲戦-鍥炴-閫�娆�
+ private BigDecimal receiptableAmount;
+
+ @Schema(description = "閫�璐ч噾棰�")
+ private BigDecimal returnAmount;
+
+}
diff --git a/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java b/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
index 7b4ba61..d86ef0b 100644
--- a/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
+++ b/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
@@ -1,5 +1,7 @@
package com.ruoyi.staff.controller;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
@@ -41,8 +43,17 @@
@Operation(summary = "鍒嗛〉鏌ヨ浜哄憳鎵撳崱瑙勫垯閰嶇疆")
@GetMapping("/listPage")
- public R listPage(Page page){
- return R.ok(personalAttendanceLocationConfigService.page(page));
+ public R listPage(Page page, PersonalAttendanceLocationConfig query){
+ page.addOrder(OrderItem.desc("id"));
+ LambdaQueryWrapper<PersonalAttendanceLocationConfig> wrapper = new LambdaQueryWrapper<PersonalAttendanceLocationConfig>()
+ .ne(PersonalAttendanceLocationConfig::getId, 999);
+ if (query.getSysDeptId() != null) {
+ wrapper.eq(PersonalAttendanceLocationConfig::getSysDeptId, query.getSysDeptId());
+ }
+ if (query.getShift() != null && !query.getShift().isEmpty()) {
+ wrapper.eq(PersonalAttendanceLocationConfig::getShift, query.getShift());
+ }
+ return R.ok(personalAttendanceLocationConfigService.page(page, wrapper));
}
diff --git a/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java b/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
index 2f1496b..a86dcb4 100644
--- a/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
+++ b/src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
@@ -60,7 +60,7 @@
}
@Operation(summary = "鐝鐘舵�佷慨鏀�")
- @PostMapping("update")
+ @PostMapping("/update")
public R performanceShiftUpdate(@RequestBody PersonalShift personalShift) {
personalShiftService.performanceShiftUpdate(personalShift);
return R.ok();
diff --git a/src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java b/src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java
index 3378f80..8eb5334 100644
--- a/src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java
+++ b/src/main/java/com/ruoyi/staff/controller/StaffOnJobController.java
@@ -6,19 +6,18 @@
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.staff.dto.StaffOnJobDto;
+import com.ruoyi.staff.dto.StaffOnJobExcelDto;
import com.ruoyi.staff.pojo.StaffContract;
import com.ruoyi.staff.pojo.StaffOnJob;
import com.ruoyi.staff.service.IStaffOnJobService;
-import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.staff.dto.StaffOnJobExcelDto;
-import jakarta.annotation.Resource;
-import jakarta.servlet.http.HttpServletResponse;
-import jakarta.validation.Valid;
import java.util.List;
/**
@@ -40,7 +39,7 @@
* @return
*/
@GetMapping("/listPage")
- public AjaxResult staffOnJobListPage(Page page, StaffOnJob staffOnJob) {
+ public AjaxResult staffOnJobListPage(Page page, StaffOnJobDto staffOnJob) {
return AjaxResult.success(staffOnJobService.staffOnJobListPage(page, staffOnJob));
}
@@ -103,7 +102,7 @@
* @return
*/
@PostMapping("/renewContract/{id}")
- public AjaxResult renewContract(@PathVariable("id") Long id, @RequestBody StaffContract staffContract) {
+ public AjaxResult renewContract(@PathVariable Long id, @RequestBody StaffContract staffContract) {
return AjaxResult.success(staffOnJobService.renewContract(id, staffContract));
}
diff --git a/src/main/java/com/ruoyi/staff/controller/StaffSalaryMainController.java b/src/main/java/com/ruoyi/staff/controller/StaffSalaryMainController.java
index 569ca1c..d30bf3a 100644
--- a/src/main/java/com/ruoyi/staff/controller/StaffSalaryMainController.java
+++ b/src/main/java/com/ruoyi/staff/controller/StaffSalaryMainController.java
@@ -5,10 +5,12 @@
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.staff.dto.CalculateSalaryDto;
+import com.ruoyi.staff.dto.StaffSalaryCalculateDto;
import com.ruoyi.staff.pojo.StaffSalaryMain;
import com.ruoyi.staff.service.StaffSalaryMainService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -43,6 +45,12 @@
return staffSalaryMainService.calculateSalary(calculateSalaryDto);
}
+ @Operation(summary = "鎸夊憳宸ラ噸绠楀伐璧勬槑缁�")
+ @PostMapping("/calculateByEmployeeId")
+ public AjaxResult calculateByEmployeeId(@RequestBody StaffSalaryCalculateDto staffSalaryCalculateDto) {
+ return staffSalaryMainService.calculateSalaryByEmployee(staffSalaryCalculateDto);
+ }
+
@PostMapping("/add")
@Operation(summary = "鏂板缓宸ヨ祫琛�")
@Log(title = "鏂板缓宸ヨ祫琛�", businessType = BusinessType.INSERT)
@@ -67,6 +75,16 @@
return staffSalaryMainService.delete(ids);
}
+ @PostMapping("/export")
+ @Operation(summary = "瀵煎嚭鍛樺伐钖祫鏄庣粏")
+ public void export(HttpServletResponse response, String salaryMonth) {
+ staffSalaryMainService.exportSalaryDetail(response, salaryMonth);
+ }
+ @GetMapping("/availableDepts")
+ @Operation(summary = "鑾峰彇鍙�夐儴闂紙鎺掗櫎宸插彂鏀惧伐璧勮〃鐨勯儴闂級")
+ public AjaxResult getAvailableDepts(String salaryMonth) {
+ return staffSalaryMainService.getAvailableDepts(salaryMonth);
+ }
}
diff --git a/src/main/java/com/ruoyi/staff/dto/StaffLeaveDto.java b/src/main/java/com/ruoyi/staff/dto/StaffLeaveDto.java
index 3685410..0556e57 100644
--- a/src/main/java/com/ruoyi/staff/dto/StaffLeaveDto.java
+++ b/src/main/java/com/ruoyi/staff/dto/StaffLeaveDto.java
@@ -36,7 +36,6 @@
/**
* 瀹跺涵浣忓潃
*/
- @Excel(name = "瀹跺涵浣忓潃", sort = 6)
private String adress;
/**
diff --git a/src/main/java/com/ruoyi/staff/dto/StaffOnJobDto.java b/src/main/java/com/ruoyi/staff/dto/StaffOnJobDto.java
index 0a2c0ae..69fdbe8 100644
--- a/src/main/java/com/ruoyi/staff/dto/StaffOnJobDto.java
+++ b/src/main/java/com/ruoyi/staff/dto/StaffOnJobDto.java
@@ -25,4 +25,6 @@
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date contractEndTime;
+
+ private Long sysDeptId;
}
diff --git a/src/main/java/com/ruoyi/staff/dto/StaffSalaryCalculateDto.java b/src/main/java/com/ruoyi/staff/dto/StaffSalaryCalculateDto.java
new file mode 100644
index 0000000..ef0a50e
--- /dev/null
+++ b/src/main/java/com/ruoyi/staff/dto/StaffSalaryCalculateDto.java
@@ -0,0 +1,16 @@
+package com.ruoyi.staff.dto;
+
+import com.ruoyi.staff.pojo.StaffSalaryDetail;
+import lombok.Data;
+
+/**
+ * 鍗曚釜鍛樺伐宸ヨ祫閲嶇畻鍙傛暟
+ */
+@Data
+public class StaffSalaryCalculateDto extends StaffSalaryDetail {
+
+ /**
+ * 宸ヨ祫鏈堜唤锛屾牸寮� yyyy-MM
+ */
+ private String salaryMonth;
+}
diff --git a/src/main/java/com/ruoyi/staff/excel/StaffSalaryExportData.java b/src/main/java/com/ruoyi/staff/excel/StaffSalaryExportData.java
new file mode 100644
index 0000000..c1f2725
--- /dev/null
+++ b/src/main/java/com/ruoyi/staff/excel/StaffSalaryExportData.java
@@ -0,0 +1,64 @@
+package com.ruoyi.staff.excel;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 鍛樺伐钖祫瀵煎嚭鏁版嵁
+ */
+@Data
+public class StaffSalaryExportData {
+
+ @Excel(name = "宸ヨ祫鏈堜唤")
+ private String salaryMonth;
+
+ @Excel(name = "宸ヨ祫涓婚")
+ private String salaryTitle;
+
+ @Excel(name = "鍛樺伐濮撳悕")
+ private String staffName;
+
+ @Excel(name = "閮ㄩ棬鍚嶇О")
+ private String deptName;
+
+ @Excel(name = "鍩烘湰宸ヨ祫")
+ private BigDecimal basicSalary;
+
+ @Excel(name = "璁′欢宸ヨ祫")
+ private BigDecimal pieceSalary;
+
+ @Excel(name = "璁℃椂宸ヨ祫")
+ private BigDecimal hourlySalary;
+
+ @Excel(name = "鍏朵粬鏀跺叆")
+ private BigDecimal otherIncome;
+
+ @Excel(name = "绀句繚涓汉")
+ private BigDecimal socialPersonal;
+
+ @Excel(name = "鍏Н閲戜釜浜�")
+ private BigDecimal fundPersonal;
+
+ @Excel(name = "鍏朵粬鏀嚭")
+ private BigDecimal otherDeduct;
+
+ @Excel(name = "绀句繚琛ョ即")
+ private BigDecimal socialSupplementAmount;
+
+ @Excel(name = "宸ヨ祫涓◣")
+ private BigDecimal salaryTax;
+
+ @Excel(name = "搴斿彂宸ヨ祫")
+ private BigDecimal grossSalary;
+
+ @Excel(name = "搴旀墸宸ヨ祫")
+ private BigDecimal deductSalary;
+
+ @Excel(name = "瀹炲彂宸ヨ祫")
+ private BigDecimal netSalary;
+
+ @Excel(name = "澶囨敞")
+ private String remark;
+}
diff --git a/src/main/java/com/ruoyi/staff/init/DataInitializer.java b/src/main/java/com/ruoyi/staff/init/DataInitializer.java
new file mode 100644
index 0000000..1432d2e
--- /dev/null
+++ b/src/main/java/com/ruoyi/staff/init/DataInitializer.java
@@ -0,0 +1,33 @@
+package com.ruoyi.staff.init;
+
+import com.ruoyi.staff.mapper.PersonalAttendanceLocationConfigMapper;
+import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class DataInitializer implements ApplicationRunner {
+
+ private final PersonalAttendanceLocationConfigMapper configMapper;
+
+ @Override
+ public void run(ApplicationArguments args) {
+ initLeaveConfig();
+ }
+
+ private void initLeaveConfig() {
+ PersonalAttendanceLocationConfig config = configMapper.selectById(999);
+ if (config == null) {
+ config = new PersonalAttendanceLocationConfig();
+ config.setId(999);
+ config.setShift("璇峰亣");
+ configMapper.insert(config);
+ log.info("宸插垵濮嬪寲璇峰亣鐝閰嶇疆(id=999)");
+ }
+ }
+}
diff --git a/src/main/java/com/ruoyi/staff/mapper/SchemeApplicableStaffMapper.java b/src/main/java/com/ruoyi/staff/mapper/SchemeApplicableStaffMapper.java
index f58b76a..41cd653 100644
--- a/src/main/java/com/ruoyi/staff/mapper/SchemeApplicableStaffMapper.java
+++ b/src/main/java/com/ruoyi/staff/mapper/SchemeApplicableStaffMapper.java
@@ -26,6 +26,13 @@
List<SchemeApplicableStaff> selectSchemeByStaffId(@Param("staffId") Long staffId);
/**
+ * 鏍规嵁閮ㄩ棬ID鏌ヨ鏈�鏂扮ぞ淇濇柟妗�
+ * @param deptId 閮ㄩ棬ID
+ * @return 鏈�鏂扮ぞ淇濇柟妗�
+ */
+ SchemeApplicableStaff selectLatestSchemeByDeptId(@Param("deptId") Long deptId);
+
+ /**
* 鏍规嵁绀句繚鏂规ID鏌ヨ瀵瑰簲鐨勬槑缁嗗垪琛�
* @param schemeId 绀句繚鏂规ID
* @return 鏂规鏄庣粏鍒楄〃
diff --git a/src/main/java/com/ruoyi/staff/mapper/StaffOnJobMapper.java b/src/main/java/com/ruoyi/staff/mapper/StaffOnJobMapper.java
index de8a3c0..7cad87f 100644
--- a/src/main/java/com/ruoyi/staff/mapper/StaffOnJobMapper.java
+++ b/src/main/java/com/ruoyi/staff/mapper/StaffOnJobMapper.java
@@ -14,7 +14,7 @@
@Mapper
public interface StaffOnJobMapper extends BaseMapper<StaffOnJob> {
- IPage<StaffOnJobDto> staffOnJobListPage(Page page, @Param("staffOnJob") StaffOnJob staffOnJob);
+ IPage<StaffOnJobDto> staffOnJobListPage(Page page, @Param("staffOnJob") StaffOnJobDto staffOnJob);
List<StaffOnJobDto> staffOnJobList(@Param("staffOnJob") StaffOnJob staffOnJob);
@@ -42,4 +42,4 @@
* @return 鍛樺伐鏁版嵁
*/
StaffOnJob selectStaffByNickName(String staffName);
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/ruoyi/staff/mapper/StaffSalaryMainMapper.java b/src/main/java/com/ruoyi/staff/mapper/StaffSalaryMainMapper.java
index eca5dbe..7e29494 100644
--- a/src/main/java/com/ruoyi/staff/mapper/StaffSalaryMainMapper.java
+++ b/src/main/java/com/ruoyi/staff/mapper/StaffSalaryMainMapper.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* <p>
* 鍛樺伐宸ヨ祫涓昏〃 Mapper 鎺ュ彛
@@ -15,4 +17,6 @@
@Mapper
public interface StaffSalaryMainMapper extends BaseMapper<StaffSalaryMain> {
+ List<String> selectIssuedDeptIds(String salaryMonth);
+
}
diff --git a/src/main/java/com/ruoyi/staff/pojo/StaffOnJob.java b/src/main/java/com/ruoyi/staff/pojo/StaffOnJob.java
index bff864a..ccf8a57 100644
--- a/src/main/java/com/ruoyi/staff/pojo/StaffOnJob.java
+++ b/src/main/java/com/ruoyi/staff/pojo/StaffOnJob.java
@@ -77,7 +77,6 @@
/**
* 瀹跺涵浣忓潃
*/
- @Excel(name = "瀹跺涵浣忓潃", sort = 6)
private String adress;
/**
diff --git a/src/main/java/com/ruoyi/staff/pojo/StaffSalaryDetail.java b/src/main/java/com/ruoyi/staff/pojo/StaffSalaryDetail.java
index 6cbe396..e616c2b 100644
--- a/src/main/java/com/ruoyi/staff/pojo/StaffSalaryDetail.java
+++ b/src/main/java/com/ruoyi/staff/pojo/StaffSalaryDetail.java
@@ -68,6 +68,9 @@
@Schema(description = "鍏朵粬鏀嚭")
private BigDecimal otherDeduct;
+ @Schema(description = "绀句繚琛ョ即")
+ private BigDecimal socialSupplementAmount;
+
@Schema(description = "宸ヨ祫涓◣")
private BigDecimal salaryTax;
diff --git a/src/main/java/com/ruoyi/staff/service/IStaffOnJobService.java b/src/main/java/com/ruoyi/staff/service/IStaffOnJobService.java
index a859d14..46588d1 100644
--- a/src/main/java/com/ruoyi/staff/service/IStaffOnJobService.java
+++ b/src/main/java/com/ruoyi/staff/service/IStaffOnJobService.java
@@ -14,7 +14,7 @@
public interface IStaffOnJobService extends IService<StaffOnJob> {
- IPage<StaffOnJobDto> staffOnJobListPage(Page page, StaffOnJob staffOnJob);
+ IPage<StaffOnJobDto> staffOnJobListPage(Page page, StaffOnJobDto staffOnJob);
StaffOnJobDto staffOnJobDetail(Long id);
diff --git a/src/main/java/com/ruoyi/staff/service/StaffSalaryMainService.java b/src/main/java/com/ruoyi/staff/service/StaffSalaryMainService.java
index 1794e43..0317a3b 100644
--- a/src/main/java/com/ruoyi/staff/service/StaffSalaryMainService.java
+++ b/src/main/java/com/ruoyi/staff/service/StaffSalaryMainService.java
@@ -3,7 +3,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.staff.dto.CalculateSalaryDto;
+import com.ruoyi.staff.dto.StaffSalaryCalculateDto;
import com.ruoyi.staff.pojo.StaffSalaryMain;
+import jakarta.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@@ -27,4 +29,10 @@
AjaxResult delete(List<Long> ids);
AjaxResult calculateSalary(CalculateSalaryDto calculateSalaryDto);
+
+ AjaxResult calculateSalaryByEmployee(StaffSalaryCalculateDto staffSalaryCalculateDto);
+
+ void exportSalaryDetail(HttpServletResponse response, String salaryMonth);
+
+ AjaxResult getAvailableDepts(String salaryMonth);
}
diff --git a/src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java b/src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java
index 48c6745..14d522c 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java
@@ -72,7 +72,8 @@
List<PersonalShift> personalShifts = personalShiftMapper.selectList(Wrappers.<PersonalShift>lambdaQuery()
.eq(PersonalShift::getStaffOnJobId, staffOnJob.getId())
.eq(PersonalShift::getWorkTime, currentDate.atStartOfDay())
- .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId));
+ .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId)
+ .ne(PersonalShift::getPersonalAttendanceLocationConfigId, 999));
if (CollectionUtil.isEmpty(personalShifts)){
throw new BaseException("褰撳墠鐢ㄦ埛褰撳ぉ娌℃湁鎺掔彮鏁版嵁");
}
@@ -230,12 +231,15 @@
List<PersonalShift> personalShifts = personalShiftMapper.selectList(Wrappers.<PersonalShift>lambdaQuery()
.eq(PersonalShift::getStaffOnJobId, staffOnJob.getId())
.eq(PersonalShift::getWorkTime, currentDate.atStartOfDay())
- .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId));
+ .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId)
+ .ne(PersonalShift::getPersonalAttendanceLocationConfigId, 999));
if (CollectionUtil.isNotEmpty(personalShifts)){
PersonalAttendanceLocationConfig personalAttendanceLocationConfig = personalAttendanceLocationConfigMapper.selectById(personalShifts.get(0).getPersonalAttendanceLocationConfigId());
- resultDto.setStartAt(personalAttendanceLocationConfig.getStartAt());
- resultDto.setEndAt(personalAttendanceLocationConfig.getEndAt());
- resultDto.setShift(personalAttendanceLocationConfig.getShift());
+ if (personalAttendanceLocationConfig != null) {
+ resultDto.setStartAt(personalAttendanceLocationConfig.getStartAt());
+ resultDto.setEndAt(personalAttendanceLocationConfig.getEndAt());
+ resultDto.setShift(personalAttendanceLocationConfig.getShift());
+ }
}
return resultDto;
}
diff --git a/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java b/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
index bd61ca3..60607ba 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
@@ -25,6 +25,7 @@
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -59,6 +60,7 @@
schemeApplicableStaffLambdaQueryWrapper.like(SchemeApplicableStaff::getTitle, schemeApplicableStaff.getTitle());
}
}
+ schemeApplicableStaffLambdaQueryWrapper.orderByDesc(SchemeApplicableStaff::getId);
Page<SchemeApplicableStaff> page1 = schemeApplicableStaffMapper.selectPage(page, schemeApplicableStaffLambdaQueryWrapper);
List<Long> collect = page1.getRecords().stream().map(SchemeApplicableStaff::getId).collect(Collectors.toList());
if(CollectionUtils.isEmpty(collect)){
@@ -152,100 +154,85 @@
* @param id
*/
public void calculateByEmployeeId(Integer id,Map<String, Object> map,String date) {
- // 1. 鍏ュ弬鏍¢獙
- if (id == null) {
- return; // 鎴栬繑鍥炵┖鍒楄〃锛屾牴鎹笟鍔¢渶姹傝皟鏁�
+ if (id == null || map == null) {
+ return;
}
Long staffId = id.longValue();
- // 绀句繚閲戦
- BigDecimal socialPersonal = new BigDecimal("0.00");
- // 鍏Н閲戦噾棰�
- BigDecimal fundPersonal = new BigDecimal("0.00");
- // 鍩烘湰宸ヨ祫
- BigDecimal basicSalary = new BigDecimal("0.00");
- map.put("fundPersonal", fundPersonal); // 鍏Н閲�
- map.put("socialPersonal", socialPersonal); // 绀句繚閲戦
- map.put("basicSalary", basicSalary); // 鍩烘湰宸ヨ祫
- // 涓◣閲戦
- BigDecimal salaryTax = new BigDecimal("0.00");
- map.put("salaryTax", salaryTax);
- // 璁′欢宸ヨ祫
- BigDecimal pieceSalary = new BigDecimal("0.00");
- map.put("pieceSalary", pieceSalary);
- // 璁℃椂宸ヨ祫
- BigDecimal hourlySalary = new BigDecimal("0.00");
- map.put("hourlySalary", hourlySalary);
- // 鍏朵粬鏀跺叆
- BigDecimal otherIncome = new BigDecimal("0.00");
- map.put("otherIncome", otherIncome);
- // 鍏朵粬鏀嚭
- BigDecimal otherDeduct = new BigDecimal("0.00");
- map.put("otherDeduct", otherDeduct);
- // 搴斿彂宸ヨ祫
- BigDecimal grossSalary = new BigDecimal("0.00");
- map.put("grossSalary", grossSalary);
- // 搴旀墸宸ヨ祫
- BigDecimal deductSalary = new BigDecimal("0.00");
- map.put("deductSalary", deductSalary);
- // 瀹炲彂宸ヨ祫
- BigDecimal netSalary = new BigDecimal("0.00");
- map.put("netSalary", netSalary);
- // 璋冪敤鍩烘湰宸ヨ祫
StaffOnJob staffOnJobDto = staffOnJobMapper.selectById(staffId);
if(staffOnJobDto == null){
return;
}
- basicSalary = staffOnJobDto.getBasicSalary();
- map.put("basicSalary", basicSalary);
- // 搴斿彂宸ヨ祫
- map.put("grossSalary", basicSalary);
- // 涓◣閲戦锛堟棤绀句繚鐗堬級
- BigDecimal bigDecimal = TaxCalculator.calculateMonthlyTax(basicSalary, socialPersonal, fundPersonal);
- map.put("salaryTax", bigDecimal);
- // 璁℃椂宸ヨ祫 璁′欢宸ヨ祫
+ BigDecimal basicSalary = hasValue(map, "basicSalary")
+ ? normalizeMoney(getBigDecimal(map, "basicSalary"))
+ : normalizeMoney(staffOnJobDto.getBasicSalary());
+ BigDecimal otherIncome = normalizeMoney(getBigDecimal(map, "otherIncome"));
+ BigDecimal otherDeduct = normalizeMoney(getBigDecimal(map, "otherDeduct"));
+ BigDecimal socialSupplementAmount = hasValue(map, "socialSupplementAmount")
+ ? normalizeMoney(getBigDecimal(map, "socialSupplementAmount"))
+ : calculateLatestDeptSocialSupplementAmount(staffOnJobDto);
+ BigDecimal pieceSalary = normalizeMoney(getBigDecimal(map, "pieceSalary"));
+ BigDecimal hourlySalary = normalizeMoney(getBigDecimal(map, "hourlySalary"));
+ BigDecimal socialPersonal = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ BigDecimal fundPersonal = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+
UserProductionAccountingDto userProductionAccountingDto = new UserProductionAccountingDto();
userProductionAccountingDto.setUserId(getUidByStaffId(staffId));
userProductionAccountingDto.setDate(date);
UserAccountDto byUserId = salesLedgerProductionAccountingService.getByUserId(userProductionAccountingDto);
if(byUserId != null){
- map.put("pieceSalary", byUserId.getAccountBalance());
- map.put("hourlySalary", byUserId.getAccount());
- // 搴斿彂 瀹炲彂澧炲姞
- grossSalary = grossSalary.add(byUserId.getAccountBalance()).add(byUserId.getAccount());
- map.put("grossSalary", grossSalary);
- netSalary = netSalary.add(byUserId.getAccountBalance()).add(byUserId.getAccount());
- map.put("netSalary", netSalary);
+ pieceSalary = normalizeMoney(byUserId.getAccountBalance());
+ hourlySalary = normalizeMoney(byUserId.getAccount());
}
- // 2. 鏌ヨ璇ヤ汉鍛樺搴旂殑绀句繚鏂规
+
+ // 鏌ヨ璇ヤ汉鍛樺搴旂殑绀句繚鏂规
List<SchemeApplicableStaff> schemeList = schemeApplicableStaffMapper.selectSchemeByStaffId(staffId);
- if (CollectionUtils.isEmpty(schemeList)) {
- return; // 鏃犲尮閰嶆柟妗堬紝杩斿洖绌哄垪琛�
- }
- // 3. 涓烘瘡涓柟妗堝叧鑱旀槑缁嗗垪琛�
- for (SchemeApplicableStaff scheme : schemeList) {
- List<SchemeInsuranceDetail> detailList = schemeApplicableStaffMapper.selectDetailBySchemeId(scheme.getId());
- // 鏍规嵁鏄庣粏鍒楄〃璁$畻绀句繚缂磋垂閲戦
- if(CollectionUtils.isEmpty(detailList)){
- continue;
- }
- for (SchemeInsuranceDetail detail : detailList) {
- if("鍏Н閲�".equals(detail.getInsuranceType())){
- fundPersonal = fundPersonal.add(calculateByEmployeeIdType(detail.getInsuranceType(),fundPersonal, staffOnJobDto, detail));
- }else{
- socialPersonal = socialPersonal.add(calculateByEmployeeIdType(detail.getInsuranceType(),socialPersonal, staffOnJobDto, detail));
+ if (!CollectionUtils.isEmpty(schemeList)) {
+ for (SchemeApplicableStaff scheme : schemeList) {
+ List<SchemeInsuranceDetail> detailList = schemeApplicableStaffMapper.selectDetailBySchemeId(scheme.getId());
+ if(CollectionUtils.isEmpty(detailList)){
+ continue;
+ }
+ for (SchemeInsuranceDetail detail : detailList) {
+ if("鍏Н閲�".equals(detail.getInsuranceType())){
+ fundPersonal = calculateByEmployeeIdType(detail.getInsuranceType(), fundPersonal, basicSalary, staffOnJobDto, detail);
+ }else{
+ socialPersonal = calculateByEmployeeIdType(detail.getInsuranceType(), socialPersonal, basicSalary, staffOnJobDto, detail);
+ }
}
}
}
+
+ BigDecimal grossSalary = basicSalary.add(pieceSalary).add(hourlySalary).add(otherIncome);
+ BigDecimal salaryTax = TaxCalculator.calculateMonthlyTax(
+ grossSalary,
+ socialPersonal.add(socialSupplementAmount),
+ fundPersonal
+ );
+ BigDecimal deductSalary = salaryTax
+ .add(fundPersonal)
+ .add(socialPersonal)
+ .add(socialSupplementAmount)
+ .add(otherDeduct);
+ BigDecimal netSalary = grossSalary.subtract(deductSalary);
+
+ if (!hasText(map, "staffName")) {
+ map.put("staffName", staffOnJobDto.getStaffName());
+ }
+ if (!hasText(map, "nation")) {
+ map.put("nation", staffOnJobDto.getNation());
+ }
+ map.put("basicSalary", basicSalary);
+ map.put("pieceSalary", pieceSalary);
+ map.put("hourlySalary", hourlySalary);
+ map.put("otherIncome", otherIncome);
map.put("socialPersonal", socialPersonal);
map.put("fundPersonal", fundPersonal);
- // 涓◣閲戦锛堢ぞ淇濈増锛�
- bigDecimal = TaxCalculator.calculateMonthlyTax(basicSalary, socialPersonal, fundPersonal);
- map.put("salaryTax", bigDecimal);
- // 搴旀墸宸ヨ祫
- map.put("deductSalary", bigDecimal.add(fundPersonal).add(socialPersonal));
- // 瀹炲彂宸ヨ祫
- map.put("netSalary", basicSalary.subtract(bigDecimal).subtract(fundPersonal).subtract(socialPersonal));
-
+ map.put("otherDeduct", otherDeduct);
+ map.put("socialSupplementAmount", socialSupplementAmount);
+ map.put("grossSalary", grossSalary);
+ map.put("salaryTax", salaryTax);
+ map.put("deductSalary", deductSalary);
+ map.put("netSalary", netSalary);
}
/**
@@ -276,17 +263,81 @@
* @param detail
* @return
*/
- public BigDecimal calculateByEmployeeIdType(String type,BigDecimal bigDecimal, StaffOnJob staffOnJobDto,SchemeInsuranceDetail detail) {
+ public BigDecimal calculateByEmployeeIdType(String type,BigDecimal bigDecimal, BigDecimal basicSalary, StaffOnJob staffOnJobDto,SchemeInsuranceDetail detail) {
// 鍒ゆ柇鏄惁璋冪敤鍩烘湰宸ヨ祫
if (detail.getUseBasicSalary() == 1) {
BigDecimal divide = detail.getPaymentBase().multiply(detail.getPersonalRatio()).divide(new BigDecimal("100"), 2);
bigDecimal = bigDecimal.add(divide);
}else{
- // 璋冪敤鍩烘湰宸ヨ祫
- BigDecimal multiply = staffOnJobDto.getBasicSalary().multiply(detail.getPersonalRatio().divide(new BigDecimal("100"), 2));
+ // 璋冪敤褰撳墠宸ヨ祫琛ㄤ腑鐨勫熀鏈伐璧�
+ BigDecimal multiply = basicSalary.multiply(detail.getPersonalRatio().divide(new BigDecimal("100"), 2));
bigDecimal = bigDecimal.add(multiply);
}
bigDecimal = bigDecimal.add(detail.getPersonalFixed());
return bigDecimal;
}
+
+ private BigDecimal calculateLatestDeptSocialSupplementAmount(StaffOnJob staffOnJobDto) {
+ if (staffOnJobDto == null || staffOnJobDto.getSysDeptId() == null) {
+ return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ }
+ SchemeApplicableStaff latestScheme = schemeApplicableStaffMapper.selectLatestSchemeByDeptId(staffOnJobDto.getSysDeptId());
+ if (latestScheme == null) {
+ return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ }
+ List<SchemeInsuranceDetail> detailList = schemeApplicableStaffMapper.selectDetailBySchemeId(latestScheme.getId());
+ if (CollectionUtils.isEmpty(detailList)) {
+ return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ }
+ BigDecimal socialSupplementAmount = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ for (SchemeInsuranceDetail detail : detailList) {
+ if (!"鍏Н閲�".equals(detail.getInsuranceType())) {
+ socialSupplementAmount = calculateByEmployeeIdType(
+ detail.getInsuranceType(),
+ socialSupplementAmount,
+ normalizeMoney(staffOnJobDto.getBasicSalary()),
+ staffOnJobDto,
+ detail
+ );
+ }
+ }
+ return socialSupplementAmount.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private boolean hasValue(Map<String, Object> map, String key) {
+ return map != null && map.get(key) != null;
+ }
+
+ private boolean hasText(Map<String, Object> map, String key) {
+ if (map == null) {
+ return false;
+ }
+ Object value = map.get(key);
+ return value != null && !String.valueOf(value).trim().isEmpty();
+ }
+
+ private BigDecimal getBigDecimal(Map<String, Object> map, String key) {
+ if (map == null) {
+ return null;
+ }
+ Object value = map.get(key);
+ if (value == null) {
+ return null;
+ }
+ if (value instanceof BigDecimal) {
+ return (BigDecimal) value;
+ }
+ if (value instanceof Number) {
+ return new BigDecimal(String.valueOf(value));
+ }
+ String text = String.valueOf(value).trim();
+ if (text.isEmpty()) {
+ return null;
+ }
+ return new BigDecimal(text);
+ }
+
+ private BigDecimal normalizeMoney(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : value.setScale(2, RoundingMode.HALF_UP);
+ }
}
diff --git a/src/main/java/com/ruoyi/staff/service/impl/StaffLeaveServiceImpl.java b/src/main/java/com/ruoyi/staff/service/impl/StaffLeaveServiceImpl.java
index 548323d..4978d0f 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/StaffLeaveServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/StaffLeaveServiceImpl.java
@@ -59,6 +59,7 @@
StaffLeave staffLeave = new StaffLeave();
staffLeave.setStaffOnJobId(staffLeaveDto.getStaffOnJobId());
staffLeave.setReason(staffLeaveDto.getReason());
+ staffLeave.setLeaveDate(staffLeaveDto.getLeaveDate());
String reason = staffLeaveDto.getReason();
if (StaffLeaveReasonOther.getCode().equals(reason)){
staffLeave.setRemark(staffLeaveDto.getRemark());
diff --git a/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java b/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
index 7c11041..1f20da2 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.dto.WordDateDto;
import com.ruoyi.project.system.domain.SysDept;
@@ -67,8 +68,9 @@
//鍦ㄨ亴鍛樺伐鍙拌处鍒嗛〉鏌ヨ
@Override
- public IPage<StaffOnJobDto> staffOnJobListPage(Page page, StaffOnJob staffOnJob) {
- return staffOnJobMapper.staffOnJobListPage(page,staffOnJob);
+ public IPage<StaffOnJobDto> staffOnJobListPage(Page page, StaffOnJobDto staffOnJob) {
+ IPage<StaffOnJobDto> staffOnJobDtoIPage = staffOnJobMapper.staffOnJobListPage(page, staffOnJob);
+ return staffOnJobDtoIPage;
}
//鏂板鍏ヨ亴
@@ -83,6 +85,7 @@
}
// 鍒涘缓鍏ヨ亴鏁版嵁
+ syncStudyInfoFromEducation(staffOnJobPrams);
staffOnJobPrams.setContractExpireTime(staffOnJobPrams.getContractEndTime());
staffOnJobPrams.setStaffState(1);
staffOnJobMapper.insert(staffOnJobPrams);
@@ -141,6 +144,7 @@
// 缁戝畾瀛愯〃鏁版嵁
bingingStaffOnJobExtra(id,staffOnJobParams);
// 鏇存柊鍛樺伐鏁版嵁
+ syncStudyInfoFromEducation(staffOnJobParams);
staffOnJobParams.setContractExpireTime(staffOnJobParams.getContractEndTime());
return staffOnJobMapper.updateById(staffOnJobParams);
}
@@ -158,6 +162,7 @@
.forEach(staff -> staff.setStaffOnJobId(id)); // 璧嬪��
staffEducationService.saveBatch(staffOnJobPrams.getStaffEducationList());
}
+
// 鏂板宸ヤ綔缁忓巻
if(CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffWorkExperienceList())){
staffOnJobPrams.getStaffWorkExperienceList().stream()
@@ -174,6 +179,28 @@
}
}
+ private void syncStudyInfoFromEducation(StaffOnJob staffOnJobPrams) {
+ if (staffOnJobPrams == null || CollectionUtils.isEmpty(staffOnJobPrams.getStaffEducationList())) {
+ if (staffOnJobPrams != null) {
+ staffOnJobPrams.setFirstStudy("/");
+ staffOnJobPrams.setProfession("/");
+ }
+ return;
+ }
+ Optional<StaffEducation> matchedEducation = staffOnJobPrams.getStaffEducationList().stream()
+ .filter(Objects::nonNull)
+ .filter(education -> StringUtils.isNotEmpty(education.getMajor()))
+ .findFirst();
+ if (matchedEducation.isPresent()) {
+ StaffEducation education = matchedEducation.get();
+ staffOnJobPrams.setFirstStudy(education.getEducation());
+ staffOnJobPrams.setProfession(education.getMajor());
+ return;
+ }
+ staffOnJobPrams.setFirstStudy("/");
+ staffOnJobPrams.setProfession("/");
+ }
+
/**
* 閫氳繃鍛樺伐id鍒犻櫎鏁欒偛缁忓巻锛屽伐浣滅粡鍘嗭紝绱ф�ヨ仈绯讳汉
diff --git a/src/main/java/com/ruoyi/staff/service/impl/StaffSalaryMainServiceImpl.java b/src/main/java/com/ruoyi/staff/service/impl/StaffSalaryMainServiceImpl.java
index a6d4500..41f8af3 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/StaffSalaryMainServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/StaffSalaryMainServiceImpl.java
@@ -3,13 +3,16 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.mapper.AccountExpenseMapper;
-import com.ruoyi.account.pojo.AccountExpense;
-import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.mapper.SysDeptMapper;
import com.ruoyi.project.system.mapper.SysUserDeptMapper;
+import com.ruoyi.staff.excel.StaffSalaryExportData;
+import jakarta.servlet.http.HttpServletResponse;
import com.ruoyi.staff.dto.CalculateSalaryDto;
+import com.ruoyi.staff.dto.StaffSalaryCalculateDto;
import com.ruoyi.staff.mapper.StaffLeaveMapper;
import com.ruoyi.staff.mapper.StaffSalaryDetailMapper;
import com.ruoyi.staff.mapper.StaffSalaryMainMapper;
@@ -23,9 +26,12 @@
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
-import java.util.Date;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* <p>
@@ -45,7 +51,7 @@
private final SchemeApplicableStaffServiceImpl schemeApplicableStaffService;
private final SysUserDeptMapper sysUserDeptMapper;
private final StaffLeaveMapper staffLeaveMapper;
- private final AccountExpenseMapper accountExpenseMapper;
+ private final SysDeptMapper sysDeptMapper;
@Override
public AjaxResult listPage(Page page, StaffSalaryMain staffSalaryMain) {
@@ -61,6 +67,7 @@
staffSalaryMainLambdaQueryWrapper.eq(StaffSalaryMain::getStatus, staffSalaryMain.getStatus());
}
}
+ staffSalaryMainLambdaQueryWrapper.orderByDesc(StaffSalaryMain::getId);
Page<StaffSalaryMain> page1 = staffSalaryMainMapper.selectPage(page, staffSalaryMainLambdaQueryWrapper);
page1.getRecords().forEach(main -> {
List<StaffSalaryDetail> staffSalaryDetailList = staffSalaryDetailMapper.selectList(new LambdaQueryWrapper<StaffSalaryDetail>().eq(StaffSalaryDetail::getMainId, main.getId()));
@@ -71,6 +78,26 @@
@Override
public AjaxResult add(StaffSalaryMain staffSalaryMain) {
+ if (staffSalaryMain == null || StringUtils.isEmpty(staffSalaryMain.getSalaryMonth())) {
+ return AjaxResult.error("鍙傛暟閿欒");
+ }
+
+ Integer status = staffSalaryMain.getStatus();
+ if (status != null && status == 5) {
+ String salaryMonth = staffSalaryMain.getSalaryMonth();
+ String deptIds = staffSalaryMain.getDeptIds();
+
+ List<StaffSalaryMain> issuedList = staffSalaryMainMapper.selectList(new LambdaQueryWrapper<StaffSalaryMain>()
+ .eq(StaffSalaryMain::getSalaryMonth, salaryMonth)
+ .eq(StaffSalaryMain::getStatus, 5));
+
+ for (StaffSalaryMain issued : issuedList) {
+ if (hasOverlappingDept(deptIds, issued.getDeptIds())) {
+ return AjaxResult.error("鍚屼竴鏈堜唤鍚屼竴閮ㄩ棬宸ヨ祫涓嶅彲浠ュ彂鏀惧娆�");
+ }
+ }
+ }
+
staffSalaryMainMapper.insert(staffSalaryMain);
staffSalaryMain.getStaffSalaryDetailList().forEach(detail -> {
detail.setMainId(staffSalaryMain.getId());
@@ -88,6 +115,30 @@
if(staffSalaryMain1 == null){
return AjaxResult.error("鍙傛暟閿欒");
}
+
+ Integer newStatus = staffSalaryMain.getStatus();
+ if (newStatus != null && newStatus == 5) {
+ String salaryMonth = staffSalaryMain.getSalaryMonth();
+ if (StringUtils.isEmpty(salaryMonth)) {
+ salaryMonth = staffSalaryMain1.getSalaryMonth();
+ }
+ String deptIds = staffSalaryMain.getDeptIds();
+ if (StringUtils.isEmpty(deptIds)) {
+ deptIds = staffSalaryMain1.getDeptIds();
+ }
+
+ List<StaffSalaryMain> issuedList = staffSalaryMainMapper.selectList(new LambdaQueryWrapper<StaffSalaryMain>()
+ .eq(StaffSalaryMain::getSalaryMonth, salaryMonth)
+ .eq(StaffSalaryMain::getStatus, 5)
+ .ne(StaffSalaryMain::getId, staffSalaryMain.getId()));
+
+ for (StaffSalaryMain issued : issuedList) {
+ if (hasOverlappingDept(deptIds, issued.getDeptIds())) {
+ return AjaxResult.error("鍚屼竴鏈堜唤鍚屼竴閮ㄩ棬宸ヨ祫涓嶅彲浠ュ彂鏀惧娆�");
+ }
+ }
+ }
+
// 寰呭鏍镐笉鍙紪杈�
// if(staffSalaryMain1.getStatus() > 3){
// return AjaxResult.error("寰呭鏍镐笉鍙紪杈�");
@@ -99,21 +150,6 @@
detail.setMainId(staffSalaryMain.getId());
});
staffSalaryDetailService.saveBatch(staffSalaryMain.getStaffSalaryDetailList());
- }
- // 鍜岃储鍔¤仈鍔紝鏂板鏀嚭
- if(staffSalaryMain.getStatus().equals(5)){
- AccountExpense accountExpense = new AccountExpense();
- accountExpense.setBusinessType(3);
- accountExpense.setExpenseMoney(staffSalaryMain.getTotalSalary());
- accountExpense.setBusinessId(staffSalaryMain.getId());
- accountExpense.setExpenseDate(new Date());
- accountExpense.setExpenseMethod("2");
- accountExpense.setExpenseType("1");
- accountExpense.setExpenseDescribed(staffSalaryMain.getSalaryTitle());
- accountExpense.setNote(staffSalaryMain.getRemark());
- accountExpense.setInputUser(SecurityUtils.getLoginUser().getNickName());
- accountExpense.setInputTime(new Date());
- accountExpenseMapper.insert(accountExpense);
}
return AjaxResult.success("淇敼鎴愬姛");
}
@@ -154,6 +190,84 @@
return AjaxResult.success(mapList);
}
+ @Override
+ public AjaxResult calculateSalaryByEmployee(StaffSalaryCalculateDto staffSalaryCalculateDto) {
+ if (staffSalaryCalculateDto == null
+ || staffSalaryCalculateDto.getStaffOnJobId() == null
+ || StringUtils.isEmpty(staffSalaryCalculateDto.getSalaryMonth())) {
+ return AjaxResult.error("鍙傛暟閿欒");
+ }
+ Map<String, Object> map = new HashMap<>();
+ map.put("id", staffSalaryCalculateDto.getStaffOnJobId());
+ map.put("staffOnJobId", staffSalaryCalculateDto.getStaffOnJobId());
+ map.put("salaryMonth", staffSalaryCalculateDto.getSalaryMonth());
+ map.put("staffName", staffSalaryCalculateDto.getStaffName());
+ map.put("postName", staffSalaryCalculateDto.getPostName());
+ map.put("deptName", staffSalaryCalculateDto.getDeptName());
+ if (staffSalaryCalculateDto.getBasicSalary() != null) {
+ map.put("basicSalary", staffSalaryCalculateDto.getBasicSalary());
+ }
+ map.put("pieceSalary", staffSalaryCalculateDto.getPieceSalary());
+ map.put("hourlySalary", staffSalaryCalculateDto.getHourlySalary());
+ map.put("otherIncome", staffSalaryCalculateDto.getOtherIncome());
+ map.put("socialPersonal", staffSalaryCalculateDto.getSocialPersonal());
+ map.put("fundPersonal", staffSalaryCalculateDto.getFundPersonal());
+ map.put("otherDeduct", staffSalaryCalculateDto.getOtherDeduct());
+ map.put("socialSupplementAmount", staffSalaryCalculateDto.getSocialSupplementAmount());
+ map.put("salaryTax", staffSalaryCalculateDto.getSalaryTax());
+ map.put("grossSalary", staffSalaryCalculateDto.getGrossSalary());
+ map.put("deductSalary", staffSalaryCalculateDto.getDeductSalary());
+ map.put("netSalary", staffSalaryCalculateDto.getNetSalary());
+ map.put("remark", staffSalaryCalculateDto.getRemark());
+ schemeApplicableStaffService.calculateByEmployeeId(
+ staffSalaryCalculateDto.getStaffOnJobId().intValue(),
+ map,
+ staffSalaryCalculateDto.getSalaryMonth()
+ );
+ return AjaxResult.success(map);
+ }
+
+ @Override
+ public void exportSalaryDetail(HttpServletResponse response, String salaryMonth) {
+ LambdaQueryWrapper<StaffSalaryMain> mainWrapper = new LambdaQueryWrapper<>();
+ if (StringUtils.isNotEmpty(salaryMonth)) {
+ mainWrapper.eq(StaffSalaryMain::getSalaryMonth, salaryMonth);
+ }
+ List<StaffSalaryMain> mainList = staffSalaryMainMapper.selectList(mainWrapper);
+
+ List<StaffSalaryExportData> exportDataList = new ArrayList<>();
+ for (StaffSalaryMain main : mainList) {
+ List<StaffSalaryDetail> detailList = staffSalaryDetailMapper.selectList(
+ new LambdaQueryWrapper<StaffSalaryDetail>().eq(StaffSalaryDetail::getMainId, main.getId())
+ );
+
+ for (StaffSalaryDetail detail : detailList) {
+ StaffSalaryExportData exportData = new StaffSalaryExportData();
+ exportData.setSalaryMonth(main.getSalaryMonth());
+ exportData.setSalaryTitle(main.getSalaryTitle());
+ exportData.setStaffName(detail.getStaffName());
+ exportData.setDeptName(detail.getDeptName());
+ exportData.setBasicSalary(detail.getBasicSalary());
+ exportData.setPieceSalary(detail.getPieceSalary());
+ exportData.setHourlySalary(detail.getHourlySalary());
+ exportData.setOtherIncome(detail.getOtherIncome());
+ exportData.setSocialPersonal(detail.getSocialPersonal());
+ exportData.setFundPersonal(detail.getFundPersonal());
+ exportData.setOtherDeduct(detail.getOtherDeduct());
+ exportData.setSocialSupplementAmount(detail.getSocialSupplementAmount());
+ exportData.setSalaryTax(detail.getSalaryTax());
+ exportData.setGrossSalary(detail.getGrossSalary());
+ exportData.setDeductSalary(detail.getDeductSalary());
+ exportData.setNetSalary(detail.getNetSalary());
+ exportData.setRemark(detail.getRemark());
+ exportDataList.add(exportData);
+ }
+ }
+
+ ExcelUtil<StaffSalaryExportData> util = new ExcelUtil<>(StaffSalaryExportData.class);
+ util.exportExcel(response, exportDataList, "鍛樺伐钖祫鏄庣粏");
+ }
+
public List<Map<String, Object>> setSchemeApplicableStaffUserInfo(List<Long> ids) {
if(CollectionUtils.isEmpty(ids)){
return new ArrayList<>();
@@ -162,4 +276,52 @@
return sysUserDeptMapper.setSchemeApplicableStaffUserInfo(ids);
}
+ @Override
+ public AjaxResult getAvailableDepts(String salaryMonth) {
+ if (StringUtils.isEmpty(salaryMonth)) {
+ return AjaxResult.error("宸ヨ祫鏈堜唤涓嶈兘涓虹┖");
+ }
+
+ List<String> issuedDeptIdStrings = staffSalaryMainMapper.selectIssuedDeptIds(salaryMonth);
+
+ Set<Long> issuedDeptIds = new HashSet<>();
+ for (String deptIds : issuedDeptIdStrings) {
+ if (StringUtils.isNotEmpty(deptIds)) {
+ String[] ids = deptIds.split(",");
+ for (String id : ids) {
+ issuedDeptIds.add(Long.parseLong(id.trim()));
+ }
+ }
+ }
+
+ List<SysDept> allDepts = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
+ .eq(SysDept::getStatus, "0")
+ .eq(SysDept::getDelFlag, "0"));
+
+ List<SysDept> availableDepts = new ArrayList<>();
+ for (SysDept dept : allDepts) {
+ if (!issuedDeptIds.contains(dept.getDeptId())) {
+ availableDepts.add(dept);
+ }
+ }
+
+ return AjaxResult.success(availableDepts);
+ }
+
+ private boolean hasOverlappingDept(String deptIds1, String deptIds2) {
+ if (StringUtils.isEmpty(deptIds1) || StringUtils.isEmpty(deptIds2)) {
+ return false;
+ }
+
+ Set<String> deptSet1 = new HashSet<>(Arrays.asList(deptIds1.split(",")));
+ String[] deptArray2 = deptIds2.split(",");
+
+ for (String deptId : deptArray2) {
+ if (deptSet1.contains(deptId.trim())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
diff --git a/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java b/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
index 1887b27..f4ca0cc 100644
--- a/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
+++ b/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
@@ -70,4 +70,15 @@
return AjaxResult.success();
}
+ @PostMapping("/reAudit")
+ @Log(title = "鍏ュ簱绠$悊-鍙嶅鍏ュ簱", businessType = BusinessType.UPDATE)
+ @Operation(summary = "鎵归噺鍙嶅鍏ュ簱璁板綍")
+ public AjaxResult reAudit(@RequestBody StockInRecordDto approveDto) {
+ if(CollectionUtils.isEmpty(approveDto.getIds())){
+ return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+ stockInRecordService.batchReAudit(approveDto.getIds());
+ return AjaxResult.success();
+ }
+
}
diff --git a/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java b/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
index 44fe885..a0a9fa5 100644
--- a/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
+++ b/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
@@ -51,6 +51,19 @@
return R.ok(stockInventoryDtoIPage);
}
+ /**
+ * 鏌ヨ瀵瑰簲鎵瑰彿鍜屾暟閲�
+ * @param page
+ * @param stockInventoryDto
+ * @return
+ */
+ @GetMapping("/getBatchNoQty")
+ @Operation(summary = "鏌ヨ瀵瑰簲鎵瑰彿鍜屾暟閲�")
+ public R getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) {
+ IPage<StockInventoryDto> stockInventoryDtoIPage = stockInventoryService.getBatchNoQty(page, stockInventoryDto);
+ return R.ok(stockInventoryDtoIPage);
+ }
+
@PostMapping("/addstockInventory")
@Operation(summary = "鏂板搴撳瓨")
public R addstockInventory(@RequestBody StockInventoryDto stockInventoryDto) {
@@ -85,7 +98,7 @@
}
- @PostMapping("importStockInventory")
+ @PostMapping("/importStockInventory")
@Operation(summary = "瀵煎叆搴撳瓨")
public R importStockInventory(MultipartFile file) {
return stockInventoryService.importStockInventory(file);
@@ -105,13 +118,13 @@
stockInventoryService.exportStockInventory(response, stockInventoryDto);
}
- @GetMapping("stockInventoryPage")
+ @GetMapping("/stockInventoryPage")
@Operation(summary = "搴撳瓨鎶ヨ〃鏌ヨ")
public R stockInventoryPage(Page page, StockInventoryDto stockInventoryDto) {
return R.ok(stockInventoryService.stockInventoryPage(stockInventoryDto,page));
}
- @GetMapping("stockInAndOutRecord")
+ @GetMapping("/stockInAndOutRecord")
@Operation(summary = "缁熻鍚勪釜浜у搧鐨勫叆搴撳拰鍑哄簱璁板綍")
public R stockInAndOutRecord(StockInventoryDto stockInventoryDto,Page page) {
return R.ok(stockInventoryService.stockInAndOutRecord(stockInventoryDto,page));
@@ -128,7 +141,6 @@
public R thawStock(@RequestBody StockInventoryDto stockInventoryDto) {
return R.ok(stockInventoryService.thawStock(stockInventoryDto));
}
-
@GetMapping("/getByModelId")
@Operation(summary = "鏍规嵁浜у搧瑙勬牸ID鑾峰彇鍏ュ簱璁板綍")
diff --git a/src/main/java/com/ruoyi/stock/controller/StockOutRecordController.java b/src/main/java/com/ruoyi/stock/controller/StockOutRecordController.java
index 7351890..660cf31 100644
--- a/src/main/java/com/ruoyi/stock/controller/StockOutRecordController.java
+++ b/src/main/java/com/ruoyi/stock/controller/StockOutRecordController.java
@@ -87,4 +87,15 @@
return AjaxResult.success();
}
+ @PostMapping("/reAudit")
+ @Log(title = "鍑哄簱绠$悊-鍙嶅鍑哄簱", businessType = BusinessType.UPDATE)
+ @Operation(summary = "鎵归噺鍙嶅鍑哄簱璁板綍")
+ public AjaxResult reAudit(@RequestBody StockOutRecordDto approveDto) {
+ if(CollectionUtils.isEmpty(approveDto.getIds())){
+ return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+ stockOutRecordService.batchReAudit(approveDto.getIds());
+ return AjaxResult.success();
+ }
+
}
diff --git a/src/main/java/com/ruoyi/stock/controller/StockUninventoryController.java b/src/main/java/com/ruoyi/stock/controller/StockUninventoryController.java
index 477a68d..3a002e0 100644
--- a/src/main/java/com/ruoyi/stock/controller/StockUninventoryController.java
+++ b/src/main/java/com/ruoyi/stock/controller/StockUninventoryController.java
@@ -2,8 +2,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockOutUnQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
@@ -37,7 +37,7 @@
@PostMapping("/addstockUninventory")
@Operation(summary = "鏂板搴撳瓨")
public R addstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) {
- stockUninventoryDto.setRecordType(String.valueOf(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()));
+ stockUninventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()));
stockUninventoryDto.setRecordId(0L);
return R.ok(stockUninventoryService.addStockUninventory(stockUninventoryDto));
}
@@ -46,7 +46,7 @@
@PostMapping("/subtractstockUninventory")
@Operation(summary = "鎵e噺搴撳瓨")
public R subtractstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) {
- stockUninventoryDto.setRecordType(String.valueOf(StockOutUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
+ stockUninventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
stockUninventoryDto.setRecordId(0L);
return R.ok(stockUninventoryService.subtractStockUninventory(stockUninventoryDto));
}
@@ -54,7 +54,7 @@
@PostMapping("/addStockInRecordOnly")
@Operation(summary = "鏂板鍏ュ簱璁板綍锛堜粎鍒涘缓璁板綍锛屼笉璋冩暣搴撳瓨锛�")
public R addStockInRecordOnly(@RequestBody StockUninventoryDto stockUninventoryDto) {
- stockUninventoryDto.setRecordType(String.valueOf(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()));
+ stockUninventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()));
stockUninventoryDto.setRecordId(0L);
return R.ok(stockUninventoryService.addStockInRecordOnly(stockUninventoryDto));
}
@@ -62,7 +62,7 @@
@PostMapping("/addStockOutRecordOnly")
@Operation(summary = "鏂板鍑哄簱璁板綍锛堜粎鍒涘缓璁板綍锛屼笉璋冩暣搴撳瓨锛�")
public R addStockOutRecordOnly(@RequestBody StockUninventoryDto stockUninventoryDto) {
- stockUninventoryDto.setRecordType(String.valueOf(StockOutUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
+ stockUninventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
stockUninventoryDto.setRecordId(0L);
return R.ok(stockUninventoryService.addStockOutRecordOnly(stockUninventoryDto));
}
diff --git a/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java b/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
index 56ad762..f4f03ba 100644
--- a/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
+++ b/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
@@ -18,6 +18,11 @@
*/
private String model;
/**
+ * 鎵规鍙�
+ */
+ private String batchNo;
+
+ /**
* 浜у搧鍗曚綅
*/
private String unit;
@@ -35,4 +40,7 @@
@Schema(description = "璁板綍ID鍒楄〃")
private List<Long> ids;
+ @Schema(description = "婧愬崟鍙�")
+ private String sourceOrderNo;
+
}
diff --git a/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java b/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
index 2be6512..33b7599 100644
--- a/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
+++ b/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
@@ -15,6 +15,7 @@
private String productName;
private String model;
private String unit;
+ private String batchNo;
//鍏ュ簱绫诲瀷
@@ -76,4 +77,7 @@
@Schema(description = "涓嶅悎鏍煎簱瀛業D")
private Long unQualifiedId;
+
+ @Schema(description = "浜у搧id")
+ private Long productId;
}
diff --git a/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java b/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java
index 022be78..0419f2f 100644
--- a/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java
+++ b/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java
@@ -21,6 +21,10 @@
*/
private String model;
/**
+ * 鎵规鍙�
+ */
+ private String batchNo;
+ /**
* 浜у搧鍗曚綅
*/
private String unit;
diff --git a/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java b/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java
index d705110..a5a9642 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java
@@ -18,11 +18,13 @@
private String model;
@Excel(name = "鍗曚綅")
private String unit;
+ @Excel(name = "鎵瑰彿")
+ private String batchNo;
@Excel(name = "鍏ュ簱鏉ユ簮")
private String recordType;
@Excel(name = "鍏ュ簱鏁伴噺")
private String stockInNum;
- @Excel(name = "鍏ュ簱鏃堕棿")
+ @Excel(name = "鍏ュ簱鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
diff --git a/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java b/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
index a5cec35..a608401 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
@@ -19,6 +19,10 @@
@Excel(name = "鍗曚綅")
private String unit;
+ @Excel(name = "鎵瑰彿")
+ private String batchNo;
+
+
@Excel(name = "鍚堟牸搴撳瓨鏁伴噺")
private BigDecimal qualifiedQuantity;
diff --git a/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java b/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java
index f120817..c0f6b25 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java
@@ -17,11 +17,13 @@
private String model;
@Excel(name = "鍗曚綅")
private String unit;
+ @Excel(name = "鎵瑰彿")
+ private String batchNo;
@Excel(name = "鍑哄簱鏉ユ簮")
private String recordType;
@Excel(name = "鍑哄簱鏁伴噺")
- private String stockInNum;
- @Excel(name = "鍑哄簱鏃堕棿")
+ private String stockOutNum;
+ @Excel(name = "鍑哄簱鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
diff --git a/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java b/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java
index 7fd6e36..6f90ec4 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java
@@ -19,6 +19,8 @@
@Excel(name = "鍗曚綅")
private String unit;
+ @Excel(name = "鎵瑰彿")
+ private String batchNo;
@Excel(name = "搴撳瓨鏁伴噺")
private BigDecimal qualitity;
diff --git a/src/main/java/com/ruoyi/stock/mapper/StockInRecordMapper.java b/src/main/java/com/ruoyi/stock/mapper/StockInRecordMapper.java
index afc30ae..7d746ac 100644
--- a/src/main/java/com/ruoyi/stock/mapper/StockInRecordMapper.java
+++ b/src/main/java/com/ruoyi/stock/mapper/StockInRecordMapper.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.purchase.PurchaseInboundDto;
+import com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo;
import com.ruoyi.stock.dto.StockInRecordDto;
import com.ruoyi.stock.execl.StockInRecordExportData;
import com.ruoyi.stock.pojo.StockInRecord;
@@ -14,4 +16,6 @@
IPage<StockInRecordDto> listPage(Page page, @Param("params") StockInRecordDto stockInRecordDto);
List<StockInRecordExportData> listStockInRecordExportData(@Param("params") StockInRecordDto stockInRecordDto);
+
+ IPage<PurchaseInboundVo> listPageAccountPurchase(Page page, @Param("req") PurchaseInboundDto purchaseInboundDto);
}
diff --git a/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java b/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
index a31cf5b..dbc271b 100644
--- a/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
+++ b/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
@@ -56,4 +56,6 @@
List<StockInventory> listSelectableBatchNoByProductModelIds(@Param("productModelIds") List<Long> productModelIds);
List<StockInventory> getByModelId(@Param("productModelId") Long productModelId);
+
+ IPage<StockInventoryDto> getBatchNoQty(Page page, @Param("ew") StockInventoryDto stockInventoryDto);
}
diff --git a/src/main/java/com/ruoyi/stock/mapper/StockOutRecordMapper.java b/src/main/java/com/ruoyi/stock/mapper/StockOutRecordMapper.java
index d180ef9..c391587 100644
--- a/src/main/java/com/ruoyi/stock/mapper/StockOutRecordMapper.java
+++ b/src/main/java/com/ruoyi/stock/mapper/StockOutRecordMapper.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.sales.SalesOutboundDto;
+import com.ruoyi.account.bean.vo.sales.SalesOutboundVo;
import com.ruoyi.stock.dto.StockOutRecordDto;
import com.ruoyi.stock.execl.StockOutRecordExportData;
import com.ruoyi.stock.pojo.StockOutRecord;
@@ -25,4 +27,5 @@
List<StockOutRecordExportData> listStockOutRecordExportData(@Param("params") StockOutRecordDto stockOutRecordDto);
+ IPage<SalesOutboundVo> listPageAccountSales(Page page, @Param("req") SalesOutboundDto salesOutboundDto);
}
diff --git a/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java b/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
index 6b8a807..d020761 100644
--- a/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
+++ b/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
@@ -43,11 +43,13 @@
@Schema(description = "澶囨敞")
private String remark;
+ @Schema(description = "棰勮鏁伴噺")
+ private BigDecimal warnNum;
+
@Schema(description = "绫诲瀷 0鍚堟牸鍏ュ簱 1涓嶅悎鏍煎叆搴�")
private String type;
@Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
diff --git a/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java b/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
index 20ea4a2..5a35020 100644
--- a/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
+++ b/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
@@ -53,7 +53,6 @@
private String remark;
@Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@@ -75,7 +74,7 @@
@Schema(description = "绫诲瀷 0鍚堟牸鍏ュ簱 1涓嶅悎鏍煎叆搴�")
private String type;
- @Schema(description = "瀹℃壒鐘舵�� 0-寰呭鎵� 1-閫氳繃 2-椹冲洖", implementation = ReviewStatusEnum.class)
+ @Schema(description = "瀹℃壒鐘舵�� 0-寰呭鎵� 1-閫氳繃 2-椹冲洖 3-閿�鍞嚭搴撳緟纭", implementation = ReviewStatusEnum.class)
private Integer approvalStatus;
@TableField(fill = FieldFill.INSERT)
diff --git a/src/main/java/com/ruoyi/stock/service/StockInRecordService.java b/src/main/java/com/ruoyi/stock/service/StockInRecordService.java
index 249f261..117b70f 100644
--- a/src/main/java/com/ruoyi/stock/service/StockInRecordService.java
+++ b/src/main/java/com/ruoyi/stock/service/StockInRecordService.java
@@ -23,4 +23,6 @@
void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto);
int batchApprove(List<Long> ids, Integer approvalStatus);
+
+ int batchReAudit(List<Long> ids);
}
diff --git a/src/main/java/com/ruoyi/stock/service/StockInventoryService.java b/src/main/java/com/ruoyi/stock/service/StockInventoryService.java
index d47cc4b..5d534d5 100644
--- a/src/main/java/com/ruoyi/stock/service/StockInventoryService.java
+++ b/src/main/java/com/ruoyi/stock/service/StockInventoryService.java
@@ -47,4 +47,6 @@
Boolean thawStock(StockInventoryDto stockInventoryDto);
List<StockInventory> getByModelId(Long modelId);
+
+ IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto);
}
diff --git a/src/main/java/com/ruoyi/stock/service/StockOutRecordService.java b/src/main/java/com/ruoyi/stock/service/StockOutRecordService.java
index bbad1f6..ca498b3 100644
--- a/src/main/java/com/ruoyi/stock/service/StockOutRecordService.java
+++ b/src/main/java/com/ruoyi/stock/service/StockOutRecordService.java
@@ -31,4 +31,6 @@
void exportStockOutRecord(HttpServletResponse response, StockOutRecordDto stockOutRecordDto);
int batchApprove(List<Long> ids, Integer approvalStatus);
+
+ int batchReAudit(List<Long> ids);
}
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
index f84a9d8..00161b5 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -5,18 +5,30 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.enums.ReviewStatusEnum;
+import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.EnumUtil;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
+
+import java.time.LocalDateTime;
import com.ruoyi.stock.dto.StockInRecordDto;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
import com.ruoyi.stock.execl.StockInRecordExportData;
+import com.ruoyi.production.mapper.ProductionOrderPickMapper;
+import com.ruoyi.production.pojo.ProductionOrderPick;
+import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
+import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper;
+import com.ruoyi.procurementrecord.pojo.ReturnManagement;
+import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
+import com.ruoyi.sales.mapper.SalesLedgerMapper;
+import com.ruoyi.sales.mapper.ShippingInfoMapper;
+import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.stock.mapper.StockInRecordMapper;
import com.ruoyi.stock.mapper.StockInventoryMapper;
import com.ruoyi.stock.mapper.StockUninventoryMapper;
@@ -24,12 +36,13 @@
import com.ruoyi.stock.pojo.StockInventory;
import com.ruoyi.stock.pojo.StockUninventory;
import com.ruoyi.stock.service.StockInRecordService;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
-import jakarta.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
import java.util.List;
@Service
@@ -39,6 +52,11 @@
private StockInRecordMapper stockInRecordMapper;
private StockInventoryMapper stockInventoryMapper;
private StockUninventoryMapper stockUninventoryMapper;
+ private ProductionOrderPickMapper productionOrderPickMapper;
+ private ReturnSaleProductMapper returnSaleProductMapper;
+ private ReturnManagementMapper returnManagementMapper;
+ private ShippingInfoMapper shippingInfoMapper;
+ private SalesLedgerMapper salesLedgerMapper;
@Override
public IPage<StockInRecordDto> listPage(Page page, StockInRecordDto stockInRecordDto) {
@@ -49,8 +67,13 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int add(StockInRecordDto stockInRecordDto) {
- String no = OrderUtils.countTodayByCreateTime(stockInRecordMapper, "RK","inbound_batches");
+ LocalDateTime createTime = stockInRecordDto.getCreateTime();
+ if (createTime == null) {
+ createTime = LocalDateTime.now();
+ }
+ String no = OrderUtils.countTodayByCreateTime(stockInRecordMapper, "RK","inbound_batches", createTime);
stockInRecordDto.setInboundBatches(no);
+ stockInRecordDto.setCreateTime(createTime);
StockInRecord stockInRecord = new StockInRecord();
BeanUtils.copyProperties(stockInRecordDto, stockInRecord);
return stockInRecordMapper.insert(stockInRecord);
@@ -120,10 +143,10 @@
public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) {
List<StockInRecordExportData> list = stockInRecordMapper.listStockInRecordExportData(stockInRecordDto);
for (StockInRecordExportData stockInRecordExportData : list) {
- if (stockInRecordExportData.getType().equals("0")) {
+ if (!stockInRecordExportData.getType().equals("0")) {
stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
}else {
- stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
+ stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
}
}
ExcelUtil<StockInRecordExportData> util = new ExcelUtil<>(StockInRecordExportData.class);
@@ -152,6 +175,32 @@
return stockUninventoryMapper.selectOne(eq);
}
+ /**
+ * 鍥炴粴鐢熶骇閫�鏂欏叆搴撶殑棰嗘枡璁板綍閫�鏂欐暟閲�
+ * @param stockInRecord 鍏ュ簱璁板綍
+ */
+ private void rollbackFeedReturnQty(StockInRecord stockInRecord) {
+ ProductionOrderPick productionOrderPick = productionOrderPickMapper.selectById(stockInRecord.getRecordId());
+ if (productionOrderPick != null) {
+ BigDecimal returnQty = productionOrderPick.getReturnQty();
+ if (returnQty == null) {
+ returnQty = BigDecimal.ZERO;
+ }
+ BigDecimal newReturnQty = returnQty.subtract(stockInRecord.getStockInNum());
+ if (newReturnQty.compareTo(BigDecimal.ZERO) < 0) {
+ newReturnQty = BigDecimal.ZERO;
+ }
+ productionOrderPick.setReturnQty(newReturnQty);
+ // 閲嶆柊璁$畻瀹為檯鐢ㄩ噺
+ BigDecimal actualQty = productionOrderPick.getQuantity().add(
+ productionOrderPick.getFeedingQty() != null ? productionOrderPick.getFeedingQty() : BigDecimal.ZERO)
+ .subtract(newReturnQty);
+ productionOrderPick.setActualQty(actualQty);
+ productionOrderPick.setReturned(newReturnQty.compareTo(BigDecimal.ZERO) > 0);
+ productionOrderPickMapper.updateById(productionOrderPick);
+ }
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public int batchDeletePending(List<Long> ids) {
@@ -162,6 +211,11 @@
}
if (stockInRecord.getApprovalStatus() != null && !ReviewStatusEnum.PENDING_REVIEW.getCode().equals(stockInRecord.getApprovalStatus())) {
throw new BaseException("鍙湁寰呭鎵圭姸鎬佺殑璁板綍鎵嶈兘鍒犻櫎,鍏ュ簱鎵规:" + stockInRecord.getInboundBatches());
+ }
+
+ // 濡傛灉鏄敓浜ч��鏂欏叆搴擄紝鍒犻櫎鏃堕渶瑕佸洖婊氶鏂欒褰曠殑閫�鏂欐暟閲�
+ if (StockInQualifiedRecordTypeEnum.FEED_RETURN_IN.getCode().equals(stockInRecord.getRecordType())) {
+ rollbackFeedReturnQty(stockInRecord);
}
}
return stockInRecordMapper.deleteBatchIds(ids);
@@ -186,6 +240,13 @@
}
stockInRecord.setApprovalStatus(approvalStatus);
stockInRecordMapper.updateById(stockInRecord);
+
+ // 瀹℃壒椹冲洖鏃讹紝濡傛灉鏄敓浜ч��鏂欏叆搴擄紝闇�瑕佸洖婊氶鏂欒褰曠殑閫�鏂欐暟閲�
+ if (ReviewStatusEnum.REJECTED.getCode().equals(approvalStatus) &&
+ StockInQualifiedRecordTypeEnum.FEED_RETURN_IN.getCode().equals(stockInRecord.getRecordType())) {
+ rollbackFeedReturnQty(stockInRecord);
+ }
+
// 瀹℃壒閫氳繃鏃讹紝搴撳瓨澧炲姞
if (ReviewStatusEnum.APPROVED.getCode().equals(approvalStatus)) {
if ("0".equals(stockInRecord.getType())) {
@@ -197,13 +258,18 @@
stockInventoryDto.setQualitity(stockInRecord.getStockInNum());
stockInventoryDto.setRemark(stockInRecord.getRemark());
if (stockInventory == null) {
- stockInventoryMapper.insert(new StockInventory() {{
- setProductModelId(stockInRecord.getProductModelId());
- setQualitity(stockInRecord.getStockInNum());
- setBatchNo(stockInRecord.getBatchNo());
- setRemark(stockInRecord.getRemark());
- setVersion(1);
- }});
+ try {
+ stockInventoryMapper.insert(new StockInventory() {{
+ setProductModelId(stockInRecord.getProductModelId());
+ setQualitity(stockInRecord.getStockInNum());
+ setBatchNo(stockInRecord.getBatchNo());
+ setRemark(stockInRecord.getRemark());
+ setWarnNum(stockInRecord.getWarnNum());
+ setVersion(1);
+ }});
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
+ }
} else {
stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
}
@@ -216,19 +282,114 @@
stockUninventoryDto.setQualitity(stockInRecord.getStockInNum());
stockUninventoryDto.setRemark(stockInRecord.getRemark());
if (stockUninventory == null) {
- stockUninventoryMapper.insert(new StockUninventory() {{
- setProductModelId(stockInRecord.getProductModelId());
- setQualitity(stockInRecord.getStockInNum());
- setBatchNo(stockInRecord.getBatchNo());
- setRemark(stockInRecord.getRemark());
- setVersion(1);
- }});
+ try {
+ stockUninventoryMapper.insert(new StockUninventory() {{
+ setProductModelId(stockInRecord.getProductModelId());
+ setQualitity(stockInRecord.getStockInNum());
+ setBatchNo(stockInRecord.getBatchNo());
+ setRemark(stockInRecord.getRemark());
+ setVersion(1);
+ }});
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ stockUninventoryMapper.updateAddStockUnInventory(stockUninventoryDto);
+ }
} else {
stockUninventoryMapper.updateAddStockUnInventory(stockUninventoryDto);
}
}
+ // 閿�鍞��璐у叆搴�:鎵e噺閿�鍞彴璐﹀疄闄呭悎鍚岄噾棰�(閫�璐х敓鏁�)
+ handleSalesReturnRefund(stockInRecord);
}
}
return ids.size();
}
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int batchReAudit(List<Long> ids) {
+ if (CollectionUtils.isEmpty(ids)) {
+ throw new BaseException("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+
+ for (Long id : ids) {
+ StockInRecord stockInRecord = stockInRecordMapper.selectById(id);
+ if (stockInRecord == null) {
+ throw new BaseException("鍏ュ簱璁板綍涓嶅瓨鍦�,鏃犳硶閲嶆柊瀹℃牳!!!");
+ }
+ // 鍙湁椹冲洖鐘舵�佹墠鑳介噸鏂板鏍�
+ if (!ReviewStatusEnum.REJECTED.getCode().equals(stockInRecord.getApprovalStatus())) {
+ throw new BaseException("鍙湁椹冲洖鐘舵�佺殑璁板綍鎵嶈兘閲嶆柊瀹℃牳,鍏ュ簱鎵规:" + stockInRecord.getInboundBatches());
+ }
+
+ // 濡傛灉鏄敓浜ч��鏂欏叆搴擄紝鎭㈠閫�鏂欐暟閲忥紙鍥犱负椹冲洖鏃跺凡鎵e噺锛�
+ if (StockInQualifiedRecordTypeEnum.FEED_RETURN_IN.getCode().equals(stockInRecord.getRecordType())) {
+ ProductionOrderPick productionOrderPick = productionOrderPickMapper.selectById(stockInRecord.getRecordId());
+ if (productionOrderPick != null) {
+ BigDecimal returnQty = productionOrderPick.getReturnQty();
+ if (returnQty == null) {
+ returnQty = BigDecimal.ZERO;
+ }
+ // 閲嶆柊瀹℃牳鏃舵仮澶嶉��鏂欐暟閲�
+ BigDecimal newReturnQty = returnQty.add(stockInRecord.getStockInNum());
+ productionOrderPick.setReturnQty(newReturnQty);
+ // 閲嶆柊璁$畻瀹為檯鐢ㄩ噺
+ BigDecimal actualQty = productionOrderPick.getQuantity().add(
+ productionOrderPick.getFeedingQty() != null ? productionOrderPick.getFeedingQty() : BigDecimal.ZERO)
+ .subtract(newReturnQty);
+ productionOrderPick.setActualQty(actualQty);
+ productionOrderPick.setReturned(newReturnQty.compareTo(BigDecimal.ZERO) > 0);
+ productionOrderPickMapper.updateById(productionOrderPick);
+ }
+ }
+
+ // 灏嗙姸鎬佹敼涓哄緟瀹℃牳
+ stockInRecord.setApprovalStatus(ReviewStatusEnum.PENDING_REVIEW.getCode());
+ stockInRecordMapper.updateById(stockInRecord);
+ }
+
+ return ids.size();
+ }
+
+ /**
+ * 閿�鍞��璐у叆搴撳鎵归�氳繃鏃�,鎵e噺瀵瑰簲閿�鍞彴璐︾殑瀹為檯鍚堝悓閲戦銆�
+ * 鍏宠仈閾�:stock_in_record.record_id = return_sale_product.id
+ * 鈫� return_management.shipping_id = shipping_info.id
+ * 鈫� shipping_info.sales_ledger_id = sales_ledger.id
+ * 鍙鐞� record_type 涓� 14(鍚堟牸)鎴� 15(涓嶅悎鏍�)鐨勯攢鍞��璐у叆搴撱��
+ */
+ private void handleSalesReturnRefund(StockInRecord stockInRecord) {
+ String recordType = stockInRecord.getRecordType();
+ if (!StockInQualifiedRecordTypeEnum.RETURN_HE_IN.getCode().equals(recordType)
+ && !StockInQualifiedRecordTypeEnum.RETURN_UNSTOCK_IN.getCode().equals(recordType)) {
+ return;
+ }
+ if (stockInRecord.getRecordId() == null) {
+ return;
+ }
+ ReturnSaleProduct rsp = returnSaleProductMapper.selectById(stockInRecord.getRecordId());
+ if (rsp == null || rsp.getReturnManagementId() == null) {
+ return;
+ }
+ ReturnManagement rm = returnManagementMapper.selectById(rsp.getReturnManagementId());
+ if (rm == null || rm.getShippingId() == null) {
+ return;
+ }
+ ShippingInfo shippingInfo = shippingInfoMapper.selectById(rm.getShippingId());
+ if (shippingInfo == null || shippingInfo.getSalesLedgerId() == null) {
+ return;
+ }
+ SalesLedger salesLedger = salesLedgerMapper.selectById(shippingInfo.getSalesLedgerId());
+ if (salesLedger == null || salesLedger.getContractAmount() == null) {
+ return;
+ }
+ BigDecimal refund = rsp.getAmount() != null ? rsp.getAmount() : BigDecimal.ZERO;
+ if (refund.compareTo(BigDecimal.ZERO) == 0) {
+ return;
+ }
+ BigDecimal baseAmount = salesLedger.getNetContractAmount() != null
+ ? salesLedger.getNetContractAmount()
+ : salesLedger.getContractAmount();
+ salesLedger.setNetContractAmount(baseAmount.subtract(refund));
+ salesLedgerMapper.updateById(salesLedger);
+ }
}
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
index d712518..07d70a5 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -10,7 +10,6 @@
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -30,7 +29,7 @@
import com.ruoyi.stock.service.StockOutRecordService;
import com.ruoyi.stock.service.StockUninventoryService;
import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -52,15 +51,16 @@
* @since 2026-01-21 04:16:36
*/
@Service
-@AllArgsConstructor
+@RequiredArgsConstructor
public class StockInventoryServiceImpl extends ServiceImpl<StockInventoryMapper, StockInventory> implements StockInventoryService {
- private StockInventoryMapper stockInventoryMapper;
- private StockInRecordService stockInRecordService;
- private StockOutRecordService stockOutRecordService;
- private StockUninventoryService stockUninventoryService;
- private SalesLedgerProductMapper salesLedgerProductMapper;
- private ProductModelMapper productModelMapper;
+ private final StockInventoryMapper stockInventoryMapper;
+ private final StockInRecordService stockInRecordService;
+ private final StockOutRecordService stockOutRecordService;
+ private final StockUninventoryService stockUninventoryService;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final ProductModelMapper productModelMapper;
+
@Override
public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) {
return stockInventoryMapper.pagestockInventory(page, stockInventoryDto);
@@ -105,9 +105,13 @@
newStockInventory.setBatchNo(stockInventoryDto.getBatchNo());
newStockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
newStockInventory.setWarnNum(stockInventoryDto.getWarnNum());
- stockInventoryMapper.insert(newStockInventory);
- }else {
- stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
+ try {
+ stockInventoryMapper.insert(newStockInventory);
+ } catch (org.springframework.dao.DuplicateKeyException e) {
+ stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
+ }
+ } else {
+ stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
}
return true;
}
@@ -117,7 +121,7 @@
@Transactional(rollbackFor = Exception.class)
public Boolean subtractStockInventory(StockInventoryDto stockInventoryDto) {
LambdaQueryWrapper<StockInventory> eq = new QueryWrapper<StockInventory>().lambda()
- .eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId());
+ .eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId());
if (StringUtils.isEmpty(stockInventoryDto.getBatchNo())) {
eq.isNull(StockInventory::getBatchNo);
stockInventoryDto.setBatchNo(null);
@@ -168,6 +172,7 @@
stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
stockInRecordDto.setType("0");
stockInRecordDto.setRemark(stockInventoryDto.getRemark());
+ stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum());
stockInRecordService.add(stockInRecordDto);
return true;
}
@@ -337,7 +342,7 @@
}
stockInventoryDto.setProductModelId(matchedProduct.getProductModelId());
- this.addstockInventory(stockInventoryDto);
+ this.addStockInRecordOnly(stockInventoryDto);
successCount++;
}
@@ -345,7 +350,7 @@
if (dto.getUnQualifiedQuantity() != null && dto.getUnQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0) {
StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
stockUninventoryDto.setRecordId(0L);
- stockUninventoryDto.setRecordType(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode());
+ stockUninventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode());
stockUninventoryDto.setQualitity(dto.getUnQualifiedQuantity());
stockUninventoryDto.setRemark(dto.getRemark());
@@ -393,28 +398,28 @@
List<StockInventoryExportData> list = stockInventoryMapper.listStockInventoryExportData(stockInventoryDto);
ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class);
- util.exportExcel(response,list, "搴撳瓨淇℃伅");
+ util.exportExcel(response, list, "搴撳瓨淇℃伅");
}
@Override
public IPage<StockInRecordDto> stockInventoryPage(StockInventoryDto stockInventoryDto, Page page) {
- return stockInventoryMapper.stockInventoryPage(stockInventoryDto,page);
+ return stockInventoryMapper.stockInventoryPage(stockInventoryDto, page);
}
@Override
public IPage<StockInventoryDto> stockInAndOutRecord(StockInventoryDto stockInventoryDto, Page page) {
- return stockInventoryMapper.stockInAndOutRecord(stockInventoryDto,page);
+ return stockInventoryMapper.stockInAndOutRecord(stockInventoryDto, page);
}
@Override
public Boolean frozenStock(StockInventoryDto stockInventoryDto) {
StockInventory stockInventory = stockInventoryMapper.selectById(stockInventoryDto.getId());
- if (stockInventory.getQualitity().compareTo(stockInventoryDto.getLockedQuantity())<0) {
+ if (stockInventory.getQualitity().compareTo(stockInventoryDto.getLockedQuantity()) < 0) {
throw new RuntimeException("鍐荤粨鏁伴噺涓嶈兘瓒呰繃搴撳瓨鏁伴噺");
}
if (ObjectUtils.isEmpty(stockInventory.getLockedQuantity())) {
stockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
- }else {
+ } else {
stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().add(stockInventoryDto.getLockedQuantity()));
}
return this.updateById(stockInventory);
@@ -423,7 +428,7 @@
@Override
public Boolean thawStock(StockInventoryDto stockInventoryDto) {
StockInventory stockInventory = stockInventoryMapper.selectById(stockInventoryDto.getId());
- if (stockInventory.getLockedQuantity().compareTo(stockInventoryDto.getLockedQuantity())<0) {
+ if (stockInventory.getLockedQuantity().compareTo(stockInventoryDto.getLockedQuantity()) < 0) {
throw new RuntimeException("瑙e喕鏁伴噺涓嶈兘瓒呰繃鍐荤粨鏁伴噺");
}
stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity()));
@@ -434,4 +439,9 @@
public List<StockInventory> getByModelId(Long modelId) {
return stockInventoryMapper.getByModelId(modelId);
}
+
+ @Override
+ public IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) {
+ return stockInventoryMapper.getBatchNoQty(page, stockInventoryDto);
+ }
}
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
index cead7fc..7138641 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
@@ -4,15 +4,19 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.account.mapper.sales.AccountInvoiceApplicationMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
import com.ruoyi.common.enums.ReviewStatusEnum;
+import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.EnumUtil;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
+
+import java.time.LocalDateTime;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.dto.StockOutRecordDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
@@ -20,19 +24,16 @@
import com.ruoyi.stock.mapper.StockInventoryMapper;
import com.ruoyi.stock.mapper.StockOutRecordMapper;
import com.ruoyi.stock.mapper.StockUninventoryMapper;
-import com.ruoyi.stock.pojo.StockInRecord;
import com.ruoyi.stock.pojo.StockInventory;
import com.ruoyi.stock.pojo.StockOutRecord;
import com.ruoyi.stock.pojo.StockUninventory;
import com.ruoyi.stock.service.StockOutRecordService;
-import lombok.AllArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
-import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -49,6 +50,8 @@
private final StockOutRecordMapper stockOutRecordMapper;
private final StockInventoryMapper stockInventoryMapper;
private final StockUninventoryMapper stockUninventoryMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+ private final AccountInvoiceApplicationMapper accountInvoiceApplicationMapper;
@Override
public IPage<StockOutRecordDto> listPage(Page page, StockOutRecordDto stockOutRecordDto) {
@@ -57,10 +60,16 @@
@Override
public int add(StockOutRecordDto stockOutRecordDto) {
- String no = OrderUtils.countTodayByCreateTime(stockOutRecordMapper, "CK","outbound_batches");
+ LocalDateTime createTime = stockOutRecordDto.getCreateTime();
+ if (createTime == null) {
+ createTime = LocalDateTime.now();
+ }
+ String no = OrderUtils.countTodayByCreateTime(stockOutRecordMapper, "CK","outbound_batches", createTime);
stockOutRecordDto.setOutboundBatches(no);
- StockInRecord stockInRecord = new StockInRecord();
- BeanUtils.copyProperties(stockOutRecordDto, stockInRecord);
+ stockOutRecordDto.setCreateTime(createTime);
+ if (StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode().equals(stockOutRecordDto.getRecordType())){
+ stockOutRecordDto.setApprovalStatus(3);
+ }
return stockOutRecordMapper.insert(stockOutRecordDto);
}
@@ -79,6 +88,11 @@
@Override
public int batchDelete(List<Long> ids) {
+ //todo 濡傛灉鍑哄簱涓庡紑绁ㄦ敹娆炬湁鍏宠仈鍒欐棤娉曞垹闄�
+ if (accountSalesCollectionMapper.existsByStockOutRecordId(ids) ||
+ accountInvoiceApplicationMapper.existsByStockOutRecordId(ids)) {
+ throw new BaseException("鍑哄簱璁板綍瀛樺湪寮�绁ㄦ敹娆惧叧鑱旀暟鎹�,鏃犳硶鍒犻櫎!!!");
+ }
for (Long id : ids) {
StockOutRecord stockOutRecord = stockOutRecordMapper.selectById(id);
if (stockOutRecord.getType().equals("0")) {
@@ -99,7 +113,8 @@
stockInRecordDto.setBatchNo(stockInventory.getBatchNo());
stockInventoryMapper.updateAddStockInventory(stockInRecordDto);
}
- }else if (stockOutRecord.getType().equals("1")) {
+ }
+ else if (stockOutRecord.getType().equals("1")) {
LambdaQueryWrapper<StockUninventory> wrapper = new LambdaQueryWrapper<StockUninventory>()
.eq(StockUninventory::getProductModelId, stockOutRecord.getProductModelId());
if (StringUtils.isEmpty(stockOutRecord.getBatchNo())) {
@@ -129,7 +144,7 @@
if (stockInRecordExportData.getType().equals("0")) {
stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
}else {
- stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
+ stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
}
}
ExcelUtil<StockOutRecordExportData> util = new ExcelUtil<>(StockOutRecordExportData.class);
@@ -200,6 +215,26 @@
return ids.size();
}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int batchReAudit(List<Long> ids) {
+ if (CollectionUtils.isEmpty(ids)) {
+ throw new BaseException("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+ for (Long id : ids) {
+ StockOutRecord stockOutRecord = stockOutRecordMapper.selectById(id);
+ if (stockOutRecord == null) {
+ throw new BaseException("鍑哄簱璁板綍涓嶅瓨鍦�,鏃犳硶閲嶆柊瀹℃牳!!!");
+ }
+ if (!ReviewStatusEnum.REJECTED.getCode().equals(stockOutRecord.getApprovalStatus())) {
+ throw new BaseException("鍙湁椹冲洖鐘舵�佺殑璁板綍鎵嶈兘閲嶆柊瀹℃牳,鍑哄簱鎵规:" + stockOutRecord.getOutboundBatches());
+ }
+ stockOutRecord.setApprovalStatus(ReviewStatusEnum.PENDING_REVIEW.getCode());
+ stockOutRecordMapper.updateById(stockOutRecord);
+ }
+ return ids.size();
+ }
+
private StockInventory getStockInventory(Long productModelId, String batchNo) {
LambdaQueryWrapper<StockInventory> eq = new LambdaQueryWrapper<>();
eq.eq(StockInventory::getProductModelId, productModelId);
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
index 4835b09..47f7d34 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
@@ -4,8 +4,12 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.ProductModelMapper;
+import com.ruoyi.basic.pojo.ProductModel;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -14,21 +18,22 @@
import com.ruoyi.stock.dto.StockOutRecordDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
import com.ruoyi.stock.execl.StockUnInventoryExportData;
+import com.ruoyi.stock.mapper.StockInventoryMapper;
import com.ruoyi.stock.mapper.StockUninventoryMapper;
+import com.ruoyi.stock.pojo.StockInRecord;
import com.ruoyi.stock.pojo.StockInventory;
import com.ruoyi.stock.pojo.StockUninventory;
import com.ruoyi.stock.service.StockInRecordService;
import com.ruoyi.stock.service.StockOutRecordService;
import com.ruoyi.stock.service.StockUninventoryService;
-import lombok.AllArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import jakarta.servlet.http.HttpServletResponse;
-
import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
import java.util.List;
/**
@@ -47,6 +52,8 @@
private final StockUninventoryMapper stockUninventoryMapper;
private final StockOutRecordService stockOutRecordService;
private final StockInRecordService stockInRecordService;
+ private final ProductModelMapper productModelMapper;
+ private final StockInventoryMapper stockInventoryMapper;
@Override
public IPage<StockUninventoryDto> pageStockUninventory(Page page, StockUninventoryDto stockUninventoryDto) {
@@ -73,21 +80,7 @@
stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId());
stockInRecordDto.setType("1");
stockInRecordService.add(stockInRecordDto);
- //鍐嶈繘琛屾柊澧炲簱瀛樻暟閲忓簱瀛�
- //鍏堟煡璇㈠簱瀛樿〃涓殑浜у搧鏄惁瀛樺湪锛屼笉瀛樺湪鏂板锛屽瓨鍦ㄦ洿鏂�
- StockUninventory oldStockUnInventory = stockUninventoryMapper.selectOne(wrapper);
- if (ObjectUtils.isEmpty(oldStockUnInventory)) {
- StockUninventory newStockUnInventory = new StockUninventory();
- newStockUnInventory.setProductModelId(stockUninventoryDto.getProductModelId());
- newStockUnInventory.setQualitity(stockUninventoryDto.getQualitity());
- newStockUnInventory.setLockedQuantity(stockUninventoryDto.getLockedQuantity());
- newStockUnInventory.setBatchNo(stockUninventoryDto.getBatchNo());
- newStockUnInventory.setVersion(1);
- newStockUnInventory.setRemark(stockUninventoryDto.getRemark());
- stockUninventoryMapper.insert(newStockUnInventory);
- }else {
- stockUninventoryMapper.updateAddStockUnInventory(stockUninventoryDto);
- }
+ //瀹℃壒鍐嶆坊鍔�
return 1;
}
@@ -120,7 +113,11 @@
stockInRecordDto.setRecordId(stockUninventoryDto.getRecordId());
stockInRecordDto.setRecordType(stockUninventoryDto.getRecordType());
stockInRecordDto.setStockInNum(stockUninventoryDto.getQualitity());
- stockInRecordDto.setBatchNo(stockUninventoryDto.getBatchNo());
+ String batchNo = StringUtils.trim(stockUninventoryDto.getBatchNo());
+ if (StringUtils.isEmpty(batchNo)) {
+ batchNo = generateAutoBatchNo(stockUninventoryDto.getProductModelId());
+ }
+ stockInRecordDto.setBatchNo(batchNo);
stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId());
stockInRecordDto.setType("1");
stockInRecordDto.setRemark(stockUninventoryDto.getRemark());
@@ -200,4 +197,80 @@
stockUninventory.setLockedQuantity(stockUninventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity()));
return this.updateById(stockUninventory);
}
+
+ //瑙勫垯鐢熸垚锛�20260424-浜у搧缂栧彿-001
+ private String generateAutoBatchNo(Long productModelId) {
+ if (productModelId == null) {
+ throw new ServiceException("浜у搧瑙勬牸ID涓嶈兘涓虹┖");
+ }
+ ProductModel productModel = productModelMapper.selectById(productModelId);
+ if (productModel == null) {
+ throw new ServiceException("浜у搧瑙勬牸涓嶅瓨鍦紝ID=" + productModelId);
+ }
+ String productCode = StringUtils.trim(productModel.getProductCode());
+ if (StringUtils.isEmpty(productCode)) {
+ throw new ServiceException("浜у搧瑙勬牸鏈淮鎶や骇鍝佺紪鐮侊紝ID=" + productModelId);
+ }
+
+ String dateText = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
+ String prefix = dateText + "-" + productCode + "-";
+ int maxSequence = resolveMaxSequence(prefix);
+ int sequence = maxSequence + 1;
+ while (sequence < 1_000_000) {
+ String batchNo = prefix + String.format("%03d", sequence);
+ if (!isBatchNoExists(batchNo)) {
+ return batchNo;
+ }
+ sequence++;
+ }
+ throw new ServiceException("鎵瑰彿搴忓彿瓒呭嚭鑼冨洿锛岃妫�鏌ユ壒鍙锋暟鎹�");
+ }
+
+ private int resolveMaxSequence(String prefix) {
+ int maxSequence = 0;
+ List<StockInventory> stockInventoryList = stockInventoryMapper.selectList(
+ Wrappers.<StockInventory>lambdaQuery()
+ .select(StockInventory::getBatchNo)
+ .likeRight(StockInventory::getBatchNo, prefix));
+ for (StockInventory stockInventory : stockInventoryList) {
+ maxSequence = Math.max(maxSequence, parseSequence(stockInventory.getBatchNo(), prefix));
+ }
+
+ List<StockInRecord> stockInRecordList = stockInRecordService.list(
+ Wrappers.<StockInRecord>lambdaQuery()
+ .select(StockInRecord::getBatchNo)
+ .likeRight(StockInRecord::getBatchNo, prefix));
+ for (StockInRecord stockInRecord : stockInRecordList) {
+ maxSequence = Math.max(maxSequence, parseSequence(stockInRecord.getBatchNo(), prefix));
+ }
+ return maxSequence;
+ }
+
+ private int parseSequence(String batchNo, String prefix) {
+ if (StringUtils.isEmpty(batchNo) || StringUtils.isEmpty(prefix) || !batchNo.startsWith(prefix)) {
+ return 0;
+ }
+ String sequenceText = batchNo.substring(prefix.length());
+ if (StringUtils.isEmpty(sequenceText) || !sequenceText.matches("\\d+")) {
+ return 0;
+ }
+ try {
+ return Integer.parseInt(sequenceText);
+ } catch (NumberFormatException ignored) {
+ return 0;
+ }
+ }
+
+ private boolean isBatchNoExists(String batchNo) {
+ if (StringUtils.isEmpty(batchNo)) {
+ return false;
+ }
+ Long inventoryCount = stockInventoryMapper.selectCount(
+ Wrappers.<StockInventory>lambdaQuery().eq(StockInventory::getBatchNo, batchNo));
+ if (inventoryCount != null && inventoryCount > 0) {
+ return true;
+ }
+ return stockInRecordService.count(
+ Wrappers.<StockInRecord>lambdaQuery().eq(StockInRecord::getBatchNo, batchNo)) > 0;
+ }
}
diff --git a/src/main/java/com/ruoyi/technology/bean/vo/TechnologyBomStructureVo.java b/src/main/java/com/ruoyi/technology/bean/vo/TechnologyBomStructureVo.java
index e41540d..d3719d6 100644
--- a/src/main/java/com/ruoyi/technology/bean/vo/TechnologyBomStructureVo.java
+++ b/src/main/java/com/ruoyi/technology/bean/vo/TechnologyBomStructureVo.java
@@ -23,5 +23,8 @@
@Schema(description = "瑙勬牸鍨嬪彿")
private String model;
+ @Schema(description = "浜у搧缂栫爜")
+ private String productCode;
+
private List<TechnologyBomStructureVo> children;
}
diff --git a/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java b/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
index 226973f..9e35143 100644
--- a/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
+++ b/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
@@ -76,7 +76,7 @@
@PreAuthorize("@ss.hasPermi('product:bom:export')")
@Operation(summary = "瀵煎嚭BOM鏂囦欢")
@Log(title = "瀵煎嚭BOM鏂囦欢", businessType = BusinessType.EXPORT)
- public void exportBom(HttpServletResponse response, @RequestParam Integer bomId) {
+ public void exportBom(HttpServletResponse response, @RequestParam Long bomId) {
technologyBomService.exportBom(response, bomId);
}
diff --git a/src/main/java/com/ruoyi/technology/controller/TechnologyOperationController.java b/src/main/java/com/ruoyi/technology/controller/TechnologyOperationController.java
index c24c93f..4279311 100644
--- a/src/main/java/com/ruoyi/technology/controller/TechnologyOperationController.java
+++ b/src/main/java/com/ruoyi/technology/controller/TechnologyOperationController.java
@@ -24,28 +24,28 @@
private final TechnologyOperationService technologyOperationService;
@GetMapping("/listPage")
- @Log(title = "Technology operation page", businessType = BusinessType.OTHER)
+ @Log(title = "宸ュ簭鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
@Operation(summary = "宸ュ簭鍒嗛〉鏌ヨ")
public R<IPage<TechnologyOperationVo>> listPage(Page<TechnologyOperationDto> page, TechnologyOperationDto technologyOperationDto) {
return R.ok(technologyOperationService.listPage(page, technologyOperationDto));
}
@PostMapping("/add")
- @Log(title = "Add technology operation", businessType = BusinessType.INSERT)
+ @Log(title = "宸ュ簭鏂板", businessType = BusinessType.INSERT)
@Operation(summary = "鏂板宸ュ簭")
public R add(@RequestBody TechnologyOperationDto technologyOperationDto) {
return technologyOperationService.add(technologyOperationDto);
}
@PutMapping("/update")
- @Log(title = "Update technology operation", businessType = BusinessType.UPDATE)
+ @Log(title = "宸ュ簭鏇存柊", businessType = BusinessType.UPDATE)
@Operation(summary = "淇敼宸ュ簭")
public R update(@RequestBody com.ruoyi.technology.pojo.TechnologyOperation technologyOperation) {
- return R.ok(technologyOperationService.updateById(technologyOperation));
+ return technologyOperationService.update(technologyOperation);
}
@DeleteMapping("/batchDelete")
- @Log(title = "Delete technology operation", businessType = BusinessType.DELETE)
+ @Log(title = "鍒犻櫎宸ュ簭", businessType = BusinessType.DELETE)
@Operation(summary = "鎵归噺鍒犻櫎宸ュ簭")
public R batchDelete(@RequestBody List<Long> ids) {
return R.ok(technologyOperationService.batchDelete(ids));
diff --git a/src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.java b/src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.java
index 061a50c..92bb773 100644
--- a/src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.java
+++ b/src/main/java/com/ruoyi/technology/controller/TechnologyOperationParamController.java
@@ -36,7 +36,7 @@
}
@DeleteMapping("/batchDelete/{id}")
- @Log(title = "Delete technology operation param", businessType = BusinessType.DELETE)
+ @Log(title = "鍒犻櫎宸ュ簭鍙傛暟", businessType = BusinessType.DELETE)
@Operation(summary = "鍒犻櫎宸ュ簭鍙傛暟")
public AjaxResult batchDelete(@PathVariable("id") Long id) {
return AjaxResult.success(technologyOperationParamService.batchDelete(id));
diff --git a/src/main/java/com/ruoyi/technology/pojo/TechnologyOperation.java b/src/main/java/com/ruoyi/technology/pojo/TechnologyOperation.java
index 061169b..1915946 100644
--- a/src/main/java/com/ruoyi/technology/pojo/TechnologyOperation.java
+++ b/src/main/java/com/ruoyi/technology/pojo/TechnologyOperation.java
@@ -49,7 +49,7 @@
@Schema(description = "鏄惁璐ㄦ")
private Boolean isQuality;
- @Schema(description = "绫诲瀷 鍖哄垎璁℃椂鍜岃浠�")
+ @Schema(description = "绫诲瀷 鍖哄垎璁℃椂鍜岃浠讹紝0璁℃椂锛�1璁′欢")
private Integer type;
@Schema(description = "璁惧id")
diff --git a/src/main/java/com/ruoyi/technology/pojo/TechnologyParam.java b/src/main/java/com/ruoyi/technology/pojo/TechnologyParam.java
index 75d56cf..8f2672d 100644
--- a/src/main/java/com/ruoyi/technology/pojo/TechnologyParam.java
+++ b/src/main/java/com/ruoyi/technology/pojo/TechnologyParam.java
@@ -1,8 +1,10 @@
package com.ruoyi.technology.pojo;
import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -53,6 +55,8 @@
@Schema(description = "鍒涘缓鏃堕棿")
@TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@Schema(description = "淇敼浜�")
@@ -61,6 +65,8 @@
@Schema(description = "淇敼鏃堕棿")
@TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
@Schema(description = "閮ㄩ棬ID")
diff --git a/src/main/java/com/ruoyi/technology/pojo/TechnologyRouting.java b/src/main/java/com/ruoyi/technology/pojo/TechnologyRouting.java
index 1427de6..880662b 100644
--- a/src/main/java/com/ruoyi/technology/pojo/TechnologyRouting.java
+++ b/src/main/java/com/ruoyi/technology/pojo/TechnologyRouting.java
@@ -32,7 +32,6 @@
private String description;
@Schema(description = "褰曞叆鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@Schema(description = "鏇存柊鏃堕棿")
diff --git a/src/main/java/com/ruoyi/technology/pojo/TechnologyRoutingOperation.java b/src/main/java/com/ruoyi/technology/pojo/TechnologyRoutingOperation.java
index f91f1e1..93ae801 100644
--- a/src/main/java/com/ruoyi/technology/pojo/TechnologyRoutingOperation.java
+++ b/src/main/java/com/ruoyi/technology/pojo/TechnologyRoutingOperation.java
@@ -58,4 +58,7 @@
@Schema(description = "閮ㄩ棬ID")
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+
+ @Schema(description = "绫诲瀷 鍖哄垎璁℃椂鍜岃浠讹紝0璁℃椂锛�1璁′欢")
+ private Integer type;
}
diff --git a/src/main/java/com/ruoyi/technology/service/TechnologyBomService.java b/src/main/java/com/ruoyi/technology/service/TechnologyBomService.java
index 31fd335..d4aa3d3 100644
--- a/src/main/java/com/ruoyi/technology/service/TechnologyBomService.java
+++ b/src/main/java/com/ruoyi/technology/service/TechnologyBomService.java
@@ -26,7 +26,7 @@
R uploadBom(MultipartFile file);
- void exportBom(HttpServletResponse response, Integer bomId);
+ void exportBom(HttpServletResponse response, Long bomId);
R copy(TechnologyBom technologyBom);
}
diff --git a/src/main/java/com/ruoyi/technology/service/TechnologyOperationService.java b/src/main/java/com/ruoyi/technology/service/TechnologyOperationService.java
index 42ba667..ec301d6 100644
--- a/src/main/java/com/ruoyi/technology/service/TechnologyOperationService.java
+++ b/src/main/java/com/ruoyi/technology/service/TechnologyOperationService.java
@@ -16,6 +16,8 @@
R add(TechnologyOperationDto technologyOperationDto);
+ R update(TechnologyOperation technologyOperation);
+
String batchDelete(List<Long> ids);
List<TechnologyOperationVo> listVo();
diff --git a/src/main/java/com/ruoyi/technology/service/impl/TechnologyBomServiceImpl.java b/src/main/java/com/ruoyi/technology/service/impl/TechnologyBomServiceImpl.java
index 2a4cd1d..8894288 100644
--- a/src/main/java/com/ruoyi/technology/service/impl/TechnologyBomServiceImpl.java
+++ b/src/main/java/com/ruoyi/technology/service/impl/TechnologyBomServiceImpl.java
@@ -15,8 +15,7 @@
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.production.bean.dto.BomImportDto;
-import com.ruoyi.production.bean.dto.ProductStructureDto;
+import com.ruoyi.technology.bean.dto.BomImportDto;
import com.ruoyi.technology.bean.dto.TechnologyBomDto;
import com.ruoyi.technology.bean.dto.TechnologyBomStructureDto;
import com.ruoyi.technology.bean.vo.TechnologyBomStructureVo;
@@ -108,12 +107,12 @@
@Transactional(rollbackFor = Exception.class)
public R update(TechnologyBom technologyBom) {
if (technologyBom.getId() == null) {
- throw new ServiceException("BOM id is required");
+ throw new ServiceException("BOM ID涓嶈兘涓虹┖");
}
validateProductModel(technologyBom.getProductModelId());
TechnologyBom oldBom = technologyBomMapper.selectById(technologyBom.getId());
if (oldBom == null) {
- throw new ServiceException("BOM not found");
+ throw new ServiceException("BOM涓嶅瓨鍦�");
}
if (oldBom.getProductModelId() != null && !oldBom.getProductModelId().equals(technologyBom.getProductModelId())) {
technologyRoutingMapper.updateProductModelByBomId(technologyBom.getProductModelId(), technologyBom.getId().longValue());
@@ -135,12 +134,12 @@
@Transactional(rollbackFor = Exception.class)
public boolean batchDelete(List<Long> ids) {
if (ids == null || ids.isEmpty()) {
- throw new ServiceException("Select at least one BOM");
+ throw new ServiceException("璇疯嚦灏戦�夋嫨涓�涓狟OM");
}
List<TechnologyRouting> list = technologyRoutingMapper.selectList(Wrappers.<TechnologyRouting>lambdaQuery()
.in(TechnologyRouting::getBomId, ids));
if (!list.isEmpty()) {
- throw new ServiceException("BOM is referenced by routing");
+ throw new ServiceException("BOM宸茶宸ヨ壓璺嚎寮曠敤锛屼笉鑳藉垹闄�");
}
technologyBomStructureService.remove(Wrappers.<TechnologyBomStructure>lambdaQuery()
.in(TechnologyBomStructure::getBomId, ids));
@@ -152,11 +151,11 @@
*/
private void validateProductModel(Long productModelId) {
if (productModelId == null) {
- throw new ServiceException("Product model is required");
+ throw new ServiceException("浜у搧瑙勬牸ID涓嶈兘涓虹┖");
}
ProductModel productModel = productModelService.getById(productModelId);
if (productModel == null) {
- throw new ServiceException("Product model not found");
+ throw new ServiceException("浜у搧瑙勬牸涓嶅瓨鍦�");
}
}
@@ -263,70 +262,72 @@
@Override
- public void exportBom(HttpServletResponse response, Integer bomId) {
+ public void exportBom(HttpServletResponse response, Long bomId) {
if (bomId == null) {
+ throw new ServiceException("BOM ID涓嶈兘涓虹┖");
+ }
+
+ List<TechnologyBomStructureVo> treeData = technologyBomStructureService.listByBomId(bomId);
+ if (treeData == null || treeData.isEmpty()) {
return;
}
-// List<ProductStructureDto> treeData = productStructureService.listBybomId(bomId);
-// if (treeData == null || treeData.isEmpty()) {
-// return;
-// }
-//
-// // 灏嗘爲褰㈢粨鏋勬墎骞冲寲 浣跨敤 BFS绠楁硶 瀵煎嚭,鎸夊眰绾ч『搴�
-// List<BomImportDto> exportList = new ArrayList<>();
-//
-// // Map<ID, Node> idMap 鐢ㄤ簬鏌ユ壘鐖惰妭鐐�
-// Map<Long, ProductStructureDto> idMap = new HashMap<>();
-// populateMap(treeData, idMap);
-//
-// // treeData 鐨勭涓�涓槸鏍硅妭鐐�
-// for (ProductStructureDto root : treeData) {
-// // 娣诲姞鏍硅妭鐐�
-// BomImportDto rootRow = new BomImportDto();
-// rootRow.setParentName(root.getProductName());
-// rootRow.setParentSpec(root.getModel());
-// rootRow.setUnitQty(root.getUnitQuantity());
-// rootRow.setRemark("");
-// exportList.add(rootRow);
-//
-// // BFS 閬嶅巻-闃熷垪
-// Queue<ProductStructureDto> queue = new LinkedList<>();
-// if (root.getChildren() != null) {
-// queue.addAll(root.getChildren());
-// }
-//
-// while (!queue.isEmpty()) {
-// ProductStructureDto child = queue.poll();
-//
-// // 鏌ユ壘鐖惰妭鐐�
-// ProductStructureDto parent = idMap.get(child.getParentId());
-// if (parent == null) {
-// // 闄や簡鏈�澶栧眰鑺傜偣,鍏朵粬鑺傜偣鐨勭埗绫昏偗瀹氭槸涓嶄細涓虹┖鐨�
-// continue;
-// }
-//
-// BomImportDto row = new BomImportDto();
-// // 鐖剁被淇℃伅
-// row.setParentName(parent.getProductName());
-// row.setParentSpec(parent.getModel());
-// // 瀛愮被淇℃伅
-// row.setChildName(child.getProductName());
-// row.setChildSpec(child.getModel());
-// row.setUnitQty(child.getUnitQuantity());
-// row.setProcess(child.getProcessName());
-//
-// exportList.add(row);
-//
-// // 灏嗗瓙鑺傜偣鐨勫瓙鑺傜偣鍔犲叆闃熷垪-涓嬩竴灞�
-// if (child.getChildren() != null && !child.getChildren().isEmpty()) {
-// queue.addAll(child.getChildren());
-// }
-// }
-// }
+ // 灏嗘爲褰㈢粨鏋勬墎骞冲寲 浣跨敤 BFS绠楁硶 瀵煎嚭,鎸夊眰绾ч『搴�
+ List<BomImportDto> exportList = new ArrayList<>();
+
+ // Map<ID, Node> idMap 鐢ㄤ簬鏌ユ壘鐖惰妭鐐�
+ Map<Long, TechnologyBomStructureVo> idMap = new HashMap<>();
+ populateMap(treeData, idMap);
+
+ // treeData 鐨勭涓�涓槸鏍硅妭鐐�
+ for (TechnologyBomStructureVo root : treeData) {
+ // 娣诲姞鏍硅妭鐐�
+ BomImportDto rootRow = new BomImportDto();
+ rootRow.setParentName(root.getProductName());
+ rootRow.setParentSpec(root.getModel());
+ rootRow.setUnitQty(root.getUnitQuantity());
+ rootRow.setParentCode(root.getProductCode());
+ rootRow.setRemark("");
+ exportList.add(rootRow);
+
+ // BFS 閬嶅巻-闃熷垪
+ Queue<TechnologyBomStructureVo> queue = new LinkedList<>();
+ if (root.getChildren() != null) {
+ queue.addAll(root.getChildren());
+ }
+
+ while (!queue.isEmpty()) {
+ TechnologyBomStructureVo child = queue.poll();
+
+ // 鏌ユ壘鐖惰妭鐐�
+ TechnologyBomStructureVo parent = idMap.get(child.getParentId());
+ if (parent == null) {
+ // 闄や簡鏈�澶栧眰鑺傜偣,鍏朵粬鑺傜偣鐨勭埗绫昏偗瀹氭槸涓嶄細涓虹┖鐨�
+ continue;
+ }
+
+ BomImportDto row = new BomImportDto();
+ // 鐖剁被淇℃伅
+ row.setParentName(parent.getProductName());
+ row.setParentSpec(parent.getModel());
+ // 瀛愮被淇℃伅
+ row.setChildName(child.getProductName());
+ row.setChildSpec(child.getModel());
+ row.setUnitQty(child.getUnitQuantity());
+ row.setProcess(child.getOperationName());
+ row.setChildCode(child.getProductCode());
+
+ exportList.add(row);
+
+ // 灏嗗瓙鑺傜偣鐨勫瓙鑺傜偣鍔犲叆闃熷垪-涓嬩竴灞�
+ if (child.getChildren() != null && !child.getChildren().isEmpty()) {
+ queue.addAll(child.getChildren());
+ }
+ }
+ }
ExcelUtil<BomImportDto> util = new ExcelUtil<>(BomImportDto.class);
-// util.exportExcel(response, exportList, "BOM缁撴瀯瀵煎嚭");
+ util.exportExcel(response, exportList, "BOM缁撴瀯瀵煎嚭");
}
@Override
@@ -408,11 +409,11 @@
return s.replaceAll("[\\u00A0\\u3000]", "").trim();
}
- private void populateMap(List<ProductStructureDto> nodes, Map<Long, ProductStructureDto> map) {
+ private void populateMap(List<TechnologyBomStructureVo> nodes, Map<Long, TechnologyBomStructureVo> map) {
if (nodes == null || nodes.isEmpty()) {
return;
}
- for (ProductStructureDto node : nodes) {
+ for (TechnologyBomStructureVo node : nodes) {
map.put(node.getId(), node);
populateMap(node.getChildren(), map);
}
diff --git a/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationParamServiceImpl.java b/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationParamServiceImpl.java
index 107fa22..e8cd6c1 100644
--- a/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationParamServiceImpl.java
+++ b/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationParamServiceImpl.java
@@ -41,21 +41,21 @@
public boolean saveTechnologyOperationParam(TechnologyOperationParam technologyOperationParam) {
if (technologyOperationParam.getTechnologyOperationId() == null
|| technologyOperationMapper.selectById(technologyOperationParam.getTechnologyOperationId()) == null) {
- throw new ServiceException("Operation not found");
+ throw new ServiceException("宸ュ簭涓嶅瓨鍦�");
}
if (technologyOperationParam.getTechnologyParamId() == null) {
- throw new ServiceException("Param is required");
+ throw new ServiceException("鍙傛暟ID涓嶈兘涓虹┖");
}
TechnologyParam technologyParam = technologyParamMapper.selectById(technologyOperationParam.getTechnologyParamId());
if (technologyParam == null) {
- throw new ServiceException("Param not found");
+ throw new ServiceException("鍙傛暟涓嶅瓨鍦�");
}
boolean duplicate = technologyOperationParamMapper.selectCount(Wrappers.<TechnologyOperationParam>lambdaQuery()
.eq(TechnologyOperationParam::getTechnologyOperationId, technologyOperationParam.getTechnologyOperationId())
.eq(TechnologyOperationParam::getTechnologyParamId, technologyOperationParam.getTechnologyParamId())
.ne(technologyOperationParam.getId() != null, TechnologyOperationParam::getId, technologyOperationParam.getId())) > 0;
if (duplicate) {
- throw new ServiceException("Duplicate param in operation");
+ throw new ServiceException("宸ュ簭鍙傛暟閲嶅");
}
return this.saveOrUpdate(technologyOperationParam);
}
diff --git a/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java b/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java
index da9ed8b..a407cd6 100644
--- a/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java
+++ b/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java
@@ -57,6 +57,27 @@
return R.ok();
}
+ @Override
+ public R update(TechnologyOperation technologyOperation) {
+ if (technologyOperation.getId() == null) {
+ return R.fail("宸ュ簭ID涓嶈兘涓虹┖");
+ }
+ boolean updated = technologyOperationMapper.update(
+ null,
+ Wrappers.<TechnologyOperation>lambdaUpdate()
+ .eq(TechnologyOperation::getId, technologyOperation.getId())
+ .set(TechnologyOperation::getName, technologyOperation.getName())
+ .set(TechnologyOperation::getNo, technologyOperation.getNo())
+ .set(TechnologyOperation::getRemark, technologyOperation.getRemark())
+ .set(TechnologyOperation::getSalaryQuota, technologyOperation.getSalaryQuota())
+ .set(TechnologyOperation::getIsQuality, technologyOperation.getIsQuality())
+ .set(TechnologyOperation::getIsProduction, technologyOperation.getIsProduction())
+ .set(TechnologyOperation::getType, technologyOperation.getType())
+ .set(TechnologyOperation::getDeviceLedgerId, technologyOperation.getDeviceLedgerId())
+ ) > 0;
+ return updated ? R.ok() : R.fail("淇敼澶辫触");
+ }
+
/**
* 鍒犻櫎宸ュ簭鍓嶆牎楠屾槸鍚﹀凡琚獴OM缁撴瀯鎴栧伐鑹鸿矾绾垮紩鐢ㄣ��
*/
diff --git a/src/main/java/com/ruoyi/technology/service/impl/TechnologyParamServiceImpl.java b/src/main/java/com/ruoyi/technology/service/impl/TechnologyParamServiceImpl.java
index a3e8f5e..c30cb06 100644
--- a/src/main/java/com/ruoyi/technology/service/impl/TechnologyParamServiceImpl.java
+++ b/src/main/java/com/ruoyi/technology/service/impl/TechnologyParamServiceImpl.java
@@ -2,18 +2,22 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.technology.bean.dto.TechnologyParamDto;
import com.ruoyi.technology.bean.vo.TechnologyParamVo;
+import com.ruoyi.technology.mapper.TechnologyOperationParamMapper;
import com.ruoyi.technology.mapper.TechnologyParamMapper;
+import com.ruoyi.technology.pojo.TechnologyOperationParam;
import com.ruoyi.technology.pojo.TechnologyParam;
import com.ruoyi.technology.service.TechnologyParamService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -28,6 +32,7 @@
private static final List<Integer> VALID_PARAM_TYPES = Arrays.asList(1, 2, 3, 4);
private static final String PARAM_CODE_PREFIX = "PARAM_";
private static final Byte DATE_PARAM_TYPE = (byte) 4;
+ private final TechnologyOperationParamMapper technologyOperationParamMapper;
/**
* 鍒嗛〉鏌ヨ鍩虹鍙傛暟骞舵牸寮忓寲鏃ユ湡绫诲瀷灞曠ず銆�
@@ -161,10 +166,13 @@
* 鎵归噺鍒犻櫎鍩虹鍙傛暟銆�
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public int deleteBaseParamByIds(Long[] ids) {
if (ids == null || ids.length == 0) {
throw new RuntimeException("鍒犻櫎ID涓嶈兘涓虹┖");
}
- return baseMapper.deleteBatchIds(Arrays.asList(ids));
+ technologyOperationParamMapper.delete(Wrappers.<TechnologyOperationParam>lambdaQuery()
+ .in(TechnologyOperationParam::getTechnologyParamId, Arrays.asList(ids)));
+ return baseMapper.deleteByIds(Arrays.asList(ids));
}
}
diff --git a/src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingServiceImpl.java b/src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingServiceImpl.java
index 4079f84..f41f659 100644
--- a/src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingServiceImpl.java
+++ b/src/main/java/com/ruoyi/technology/service/impl/TechnologyRoutingServiceImpl.java
@@ -7,8 +7,12 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.OrderUtils;
+
+import java.time.LocalDateTime;
import com.ruoyi.technology.bean.dto.TechnologyRoutingDto;
import com.ruoyi.technology.bean.vo.TechnologyRoutingVo;
+import com.ruoyi.production.mapper.ProductionOrderRoutingMapper;
+import com.ruoyi.production.pojo.ProductionOrderRouting;
import com.ruoyi.technology.mapper.*;
import com.ruoyi.technology.pojo.*;
import com.ruoyi.technology.service.TechnologyRoutingService;
@@ -40,6 +44,8 @@
private final TechnologyParamMapper technologyParamMapper;
private final TechnologyRoutingOperationParamMapper technologyRoutingOperationParamMapper;
+ private final ProductionOrderRoutingMapper productionOrderRoutingMapper;
+
@Override
public IPage<TechnologyRoutingVo> pageTechnologyRouting(Page<TechnologyRoutingDto> page, TechnologyRoutingDto technologyRoutingDto) {
return technologyRoutingMapper.pageTechnologyRouting(page, technologyRoutingDto);
@@ -56,7 +62,7 @@
@Override
public Long saveTechnologyRouting(TechnologyRouting technologyRouting) {
- String code = OrderUtils.countTodayByCreateTime(technologyRoutingMapper, "GYLX", "process_route_code");
+ String code = OrderUtils.countTodayByCreateTime(technologyRoutingMapper, "GYLX", "process_route_code", technologyRouting.getCreateTime() != null ? technologyRouting.getCreateTime() : LocalDateTime.now());
technologyRouting.setProcessRouteCode(code);
technologyRoutingMapper.insert(technologyRouting);
// 甯﹀叆bom浜у搧缁撴瀯
@@ -78,6 +84,13 @@
public boolean removeTechnologyRouting(List<Long> ids) {
if (ids == null || ids.isEmpty()) {
return false;
+ }
+ // 鍒ゆ柇鏄惁鏈夌敓浜ц鍗曠粦瀹氳宸ヨ壓璺嚎
+ Long count = productionOrderRoutingMapper.selectCount(
+ Wrappers.<ProductionOrderRouting>lambdaQuery()
+ .in(ProductionOrderRouting::getTechnologyRoutingId, ids));
+ if (count > 0) {
+ throw new ServiceException("璇ュ伐鑹鸿矾绾垮凡缁戝畾鐢熶骇璁㈠崟锛屾棤娉曞垹闄わ紒");
}
List<TechnologyRoutingOperation> routingOperationList = technologyRoutingOperationMapper.selectList(
Wrappers.<TechnologyRoutingOperation>lambdaQuery()
@@ -143,7 +156,10 @@
routingOperation.setProductModelId(resolveOutputProductModelId(bomStructure, structureById, technologyRouting.getProductModelId()));
routingOperation.setTechnologyOperationId(bomStructure.getOperationId());
routingOperation.setDragSort(dragSort++);
- routingOperation.setIsQuality(getOperationQuality(bomStructure.getOperationId()));
+ TechnologyOperation technologyOperation = getOperation(bomStructure.getOperationId());
+ routingOperation.setIsQuality(technologyOperation != null ? technologyOperation.getIsQuality() : null);
+ routingOperation.setIsProduction(technologyOperation != null ? technologyOperation.getIsProduction() : null);
+ routingOperation.setType(technologyOperation != null ? technologyOperation.getType() : null);
technologyRoutingOperationMapper.insert(routingOperation);
syncRoutingOperationParams(routingOperation.getId(), bomStructure.getOperationId());
}
@@ -204,12 +220,11 @@
}
}
- /**
- * 璐ㄦ鏍囪瘑浠ュ伐搴忓熀纭�琛ㄥ畾涔変负鍑嗐��
- */
- private Boolean getOperationQuality(Long operationId) {
- TechnologyOperation technologyOperation = technologyOperationMapper.selectById(operationId);
- return technologyOperation != null ? technologyOperation.getIsQuality() : null;
+ private TechnologyOperation getOperation(Long operationId) {
+ if (operationId == null) {
+ return null;
+ }
+ return technologyOperationMapper.selectById(operationId);
}
private String buildProcessRouteCode(Long id) {
diff --git a/src/main/java/com/ruoyi/warehouse/controller/DocumentationFileController.java b/src/main/java/com/ruoyi/warehouse/controller/DocumentationFileController.java
index 9c8517e..f272150 100644
--- a/src/main/java/com/ruoyi/warehouse/controller/DocumentationFileController.java
+++ b/src/main/java/com/ruoyi/warehouse/controller/DocumentationFileController.java
@@ -1,8 +1,5 @@
package com.ruoyi.warehouse.controller;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.pojo.AccountFile;
-import com.ruoyi.account.service.AccountFileService;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.warehouse.pojo.DocumentationFile;
import com.ruoyi.warehouse.service.DocumentationFileService;
diff --git a/src/main/java/com/ruoyi/warehouse/mapper/DocumentationFileMapper.java b/src/main/java/com/ruoyi/warehouse/mapper/DocumentationFileMapper.java
index 0617258..94d7eac 100644
--- a/src/main/java/com/ruoyi/warehouse/mapper/DocumentationFileMapper.java
+++ b/src/main/java/com/ruoyi/warehouse/mapper/DocumentationFileMapper.java
@@ -1,9 +1,6 @@
package com.ruoyi.warehouse.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.pojo.AccountFile;
import com.ruoyi.warehouse.pojo.DocumentationFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
diff --git a/src/main/java/com/ruoyi/warehouse/mapper/DocumentationMapper.java b/src/main/java/com/ruoyi/warehouse/mapper/DocumentationMapper.java
index 33278bf..85cceec 100644
--- a/src/main/java/com/ruoyi/warehouse/mapper/DocumentationMapper.java
+++ b/src/main/java/com/ruoyi/warehouse/mapper/DocumentationMapper.java
@@ -2,7 +2,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto;
import com.ruoyi.warehouse.dto.DocumentationDto;
import com.ruoyi.warehouse.pojo.Documentation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
diff --git a/src/main/java/com/ruoyi/warehouse/service/DocumentationFileService.java b/src/main/java/com/ruoyi/warehouse/service/DocumentationFileService.java
index 575ecd4..a5a8836 100644
--- a/src/main/java/com/ruoyi/warehouse/service/DocumentationFileService.java
+++ b/src/main/java/com/ruoyi/warehouse/service/DocumentationFileService.java
@@ -1,9 +1,6 @@
package com.ruoyi.warehouse.service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.account.pojo.AccountFile;
import com.ruoyi.warehouse.pojo.DocumentationFile;
import java.util.List;
diff --git a/src/main/resources/application-btw.yml b/src/main/resources/application-btw.yml
new file mode 100644
index 0000000..c532961
--- /dev/null
+++ b/src/main/resources/application-btw.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-btw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_btw
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9101 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-ckgm.yml b/src/main/resources/application-ckgm.yml
new file mode 100644
index 0000000..c775901
--- /dev/null
+++ b/src/main/resources/application-ckgm.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-ckgm?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_ckgm
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9071 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index ef003c9..e5e2f9a 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -74,7 +74,7 @@
druid:
# 涓诲簱鏁版嵁婧�
master:
- url: jdbc:mysql://localhost:3306/product-inventory-management-new-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ url: jdbc:mysql://localhost:3306/product-inventory-management-bdpro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
# 浠庡簱鏁版嵁婧�
@@ -254,8 +254,17 @@
# 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
allowOverwrite: false
+# 鏂囦欢涓婁紶閰嶇疆
file:
- temp-dir: D:/ruoyi/temp/uploads # 涓存椂鐩綍
- upload-dir: D:/ruoyi/prod/uploads # 姝e紡鐩綍
+ temp-dir: D:/ruoyi/temp/uploads # 涓存椂鐩綍 鍚庢湡鍒犻櫎
+ upload-dir: D:/ruoyi/prod/uploads # 姝e紡鐩綍 鍚庢湡鍒犻櫎
+ path: D:/ruoyi/prod/uploads # 涓婁紶鐩綍
+ urlPrefix: /common # 閾炬帴鍓嶇紑
+ domain: http://127.0.0.1:7006 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
knowledge:
one: D:\鏂扮枂澶х綏绱犱紒涓氫骇鍝佷綋绯昏鏄庢枃妗�.md
diff --git a/src/main/resources/application-hqjc.yml b/src/main/resources/application-hqjc.yml
new file mode 100644
index 0000000..6157353
--- /dev/null
+++ b/src/main/resources/application-hqjc.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:9002/product-inventory-management-hqjc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: hqjc@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_hqjc
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://36.134.77.64:9001 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-hthb.yml b/src/main/resources/application-hthb.yml
new file mode 100644
index 0000000..543b8dd
--- /dev/null
+++ b/src/main/resources/application-hthb.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-hthb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_hthb
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9089 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-jfhy.yml b/src/main/resources/application-jfhy.yml
new file mode 100644
index 0000000..ffee8bc
--- /dev/null
+++ b/src/main/resources/application-jfhy.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-jfhy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_jfhy
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9099 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-khyy.yml b/src/main/resources/application-khyy.yml
new file mode 100644
index 0000000..acb4712
--- /dev/null
+++ b/src/main/resources/application-khyy.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-khyy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_khyy
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9093 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-lsy.yml b/src/main/resources/application-lsy.yml
new file mode 100644
index 0000000..821119e
--- /dev/null
+++ b/src/main/resources/application-lsy.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-lsy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_lsy
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9083 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-myhb-pro.yml b/src/main/resources/application-myhb-pro.yml
new file mode 100644
index 0000000..a94aa06
--- /dev/null
+++ b/src/main/resources/application-myhb-pro.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9110
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-myhb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_qlmc
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+ # host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9095 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-nhxcl.yml b/src/main/resources/application-nhxcl.yml
new file mode 100644
index 0000000..5734844
--- /dev/null
+++ b/src/main/resources/application-nhxcl.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-nhxcl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: nhxcl@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_nhxcl
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+ # host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://127.0.0.1:9001 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-qfsw.yml b/src/main/resources/application-qfsw.yml
new file mode 100644
index 0000000..4ae73ec
--- /dev/null
+++ b/src/main/resources/application-qfsw.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-qfsw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_qfsw
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9079 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-qlmc-pro.yml b/src/main/resources/application-qlmc-pro.yml
new file mode 100644
index 0000000..1370c5d
--- /dev/null
+++ b/src/main/resources/application-qlmc-pro.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9096
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-qlmc-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_qlmc
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+ # host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9095 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-rfsy.yml b/src/main/resources/application-rfsy.yml
new file mode 100644
index 0000000..ceb2cdb
--- /dev/null
+++ b/src/main/resources/application-rfsy.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-rfsy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_rfsy
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9075 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-xhks.yml b/src/main/resources/application-xhks.yml
new file mode 100644
index 0000000..5c95e75
--- /dev/null
+++ b/src/main/resources/application-xhks.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-xhks?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_xhks
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9077 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-xlgs.yml b/src/main/resources/application-xlgs.yml
new file mode 100644
index 0000000..0cdbd39
--- /dev/null
+++ b/src/main/resources/application-xlgs.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-xlgs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_xlgs
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9091 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-yss.yml b/src/main/resources/application-yss.yml
new file mode 100644
index 0000000..76f7ead
--- /dev/null
+++ b/src/main/resources/application-yss.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-yss?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_yss
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9085 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application-zdjc.yml b/src/main/resources/application-zdjc.yml
new file mode 100644
index 0000000..ca0d5ee
--- /dev/null
+++ b/src/main/resources/application-zdjc.yml
@@ -0,0 +1,268 @@
+# 椤圭洰鐩稿叧閰嶇疆
+ruoyi:
+ # 鍚嶇О
+ name: RuoYi
+ # 鐗堟湰
+ version: 3.8.9
+ # 鐗堟潈骞翠唤
+ copyrightYear: 2025
+ # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛�
+ profile: /javaWork/product-inventory-management/file
+
+ # 鑾峰彇ip鍦板潃寮�鍏�
+ addressEnabled: false
+ # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉
+ captchaType: math
+ # 鍗忓悓瀹℃壒缂栧彿鍓嶇紑(閰嶇疆鏂囦欢鍚庣紑鍛藉悕)
+ approvalNumberPrefix: NEW
+
+ # 涓帹 Unipush 閰嶇疆
+ getui:
+ appId: PfjyAAE0FK64FaO1w2CMb1
+ appKey: zTMb831OEL6J4GK1uE3Ob4
+ masterSecret: K1GFtsv42v61tXGnF7SGE5
+ domain: https://restapi.getui.cn/v2/
+ # 绂荤嚎鎺ㄩ�佷娇鐢ㄧ殑鍖呭悕/缁勪欢鍚�
+ intentComponent: uni.app.UNI099A590/io.dcloud.PandoraEntry
+
+# 寮�鍙戠幆澧冮厤缃�
+server:
+ # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
+ port: 9003
+ servlet:
+ # 搴旂敤鐨勮闂矾寰�
+ context-path: /
+ tomcat:
+ # tomcat鐨刄RI缂栫爜
+ uri-encoding: UTF-8
+ # 杩炴帴鏁版弧鍚庣殑鎺掗槦鏁帮紝榛樿涓�100
+ accept-count: 1000
+ threads:
+ # tomcat鏈�澶х嚎绋嬫暟锛岄粯璁や负200
+ max: 800
+ # Tomcat鍚姩鍒濆鍖栫殑绾跨▼鏁帮紝榛樿鍊�10
+ min-spare: 100
+
+# 鏃ュ織閰嶇疆
+logging:
+ level:
+ com.ruoyi: warn
+ org.springframework: warn
+
+minio:
+ endpoint: http://114.132.189.42/
+ port: 7019
+ secure: false
+ accessKey: admin
+ secretKey: 12345678
+ preview-expiry: 24 # 棰勮鍦板潃榛樿24灏忔椂
+ default-bucket: jxc
+# 鐢ㄦ埛閰嶇疆
+user:
+ password:
+ # 瀵嗙爜鏈�澶ч敊璇鏁�
+ maxRetryCount: 5
+ # 瀵嗙爜閿佸畾鏃堕棿锛堥粯璁�10鍒嗛挓锛�
+ lockTime: 10
+
+# Spring閰嶇疆
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 涓诲簱鏁版嵁婧�
+ master:
+ url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-zdjc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: xd@123456..
+ # 浠庡簱鏁版嵁婧�
+ slave:
+ # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
+ enabled: false
+ url:
+ username:
+ password:
+ # 鍒濆杩炴帴鏁�
+ initialSize: 5
+ # 鏈�灏忚繛鎺ユ睜鏁伴噺
+ minIdle: 10
+ # 鏈�澶ц繛鎺ユ睜鏁伴噺
+ maxActive: 20
+ # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+ maxWait: 60000
+ # 閰嶇疆杩炴帴瓒呮椂鏃堕棿
+ connectTimeout: 30000
+ # 閰嶇疆缃戠粶瓒呮椂鏃堕棿
+ socketTimeout: 60000
+ # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+ timeBetweenEvictionRunsMillis: 60000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ minEvictableIdleTimeMillis: 300000
+ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+ maxEvictableIdleTimeMillis: 900000
+ # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+ allow:
+ url-pattern: /druid/*
+ # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 鎱QL璁板綍
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+ # 璧勬簮淇℃伅
+ messages:
+ # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
+ basename: i18n/messages
+ # 鏂囦欢涓婁紶
+ servlet:
+ multipart:
+ # 鍗曚釜鏂囦欢澶у皬
+ max-file-size: 1GB
+ # 璁剧疆鎬讳笂浼犵殑鏂囦欢澶у皬
+ max-request-size: 2GB
+ # 鏈嶅姟妯″潡
+ devtools:
+ restart:
+ # 鐑儴缃插紑鍏�
+ enabled: false
+ # redis 閰嶇疆
+ data:
+ mongodb:
+ uri: mongodb://114.132.189.42:9028/chat_memory_db_zdjc
+ # redis 閰嶇疆
+ redis:
+ # 鍦板潃
+# host: 127.0.0.1
+ host: 172.17.0.1
+ # 绔彛锛岄粯璁や负6379
+ port: 6379
+ # 鏁版嵁搴撶储寮�
+ database: 0
+ # 瀵嗙爜
+ # password: root2022!
+ password:
+
+ # 杩炴帴瓒呮椂鏃堕棿
+ timeout: 10s
+ lettuce:
+ pool:
+ # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+ min-idle: 0
+ # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+ max-idle: 8
+ # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+ max-active: 8
+ # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+ max-wait: -1ms
+
+ # Quartz瀹氭椂浠诲姟閰嶇疆锛堟柊澧為儴鍒嗭級
+ quartz:
+ job-store-type: jdbc # 浣跨敤鏁版嵁搴撳瓨鍌�
+ jdbc:
+ initialize-schema: never # 棣栨杩愯鏃惰嚜鍔ㄥ垱寤鸿〃缁撴瀯锛屾垚鍔熷悗鏀逛负never
+ schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQL琛ㄧ粨鏋勮剼鏈�
+ properties:
+ org:
+ quartz:
+ scheduler:
+ instanceName: RuoYiScheduler
+ instanceId: AUTO
+ jobStore:
+ class: org.quartz.impl.jdbcjobstore.JobStoreTX
+ driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQL閫傞厤
+ tablePrefix: qrtz_ # 琛ㄥ悕鍓嶇紑锛屼笌鑴氭湰涓�鑷�
+ isClustered: false # 鍗曡妭鐐规ā寮忥紙闆嗙兢闇�鏀逛负true锛�
+ clusterCheckinInterval: 10000
+ txIsolationLevelSerializable: true
+ threadPool:
+ class: org.quartz.simpl.SimpleThreadPool
+ threadCount: 10 # 绾跨▼姹犲ぇ灏�
+ threadPriority: 5
+ makeThreadsDaemons: true
+ updateCheck: false # 鍏抽棴鐗堟湰妫�鏌�
+# token閰嶇疆
+token:
+ # 浠ょ墝鑷畾涔夋爣璇�
+ header: Authorization
+ # 浠ょ墝瀵嗛挜
+ secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ
+ # 浠ょ墝鏈夋晥鏈燂紙榛樿30鍒嗛挓锛�
+ expireTime: 450
+
+# MyBatis Plus閰嶇疆
+mybatis-plus:
+ # 鎼滅储鎸囧畾鍖呭埆鍚� 鏍规嵁鑷繁鐨勯」鐩潵
+ typeAliasesPackage: com.ruoyi.**.pojo
+ # 閰嶇疆mapper鐨勬壂鎻忥紝鎵惧埌鎵�鏈夌殑mapper.xml鏄犲皠鏂囦欢
+ mapperLocations: classpath*:mapper/**/*Mapper.xml
+ # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
+ configLocation: classpath:mybatis/mybatis-config.xml
+ global-config:
+ enable-sql-runner: true
+ db-config:
+ id-type: auto
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+ helperDialect: mysql
+ supportMethodsArguments: true
+ params: count=countSql
+
+# Swagger閰嶇疆
+swagger:
+ # 鏄惁寮�鍚痵wagger
+ enabled: true
+ # 璇锋眰鍓嶇紑
+ pathMapping: /dev-api
+
+# 闃叉XSS鏀诲嚮
+xss:
+ # 杩囨护寮�鍏�
+ enabled: true
+ # 鎺掗櫎閾炬帴锛堝涓敤閫楀彿鍒嗛殧锛�
+ excludes: /system/notice
+ # 鍖归厤閾炬帴
+ urlPatterns: /system/*,/monitor/*,/tool/*
+
+# 浠g爜鐢熸垚
+gen:
+ # 浣滆��
+ author: ruoyi
+ # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool
+ packageName: com.ruoyi.project.system
+ # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸true
+ autoRemovePre: false
+ # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛�
+ tablePrefix: sys_
+ # 鏄惁鍏佽鐢熸垚鏂囦欢瑕嗙洊鍒版湰鍦帮紙鑷畾涔夎矾寰勶級锛岄粯璁や笉鍏佽
+ allowOverwrite: false
+
+# 鏂囦欢涓婁紶閰嶇疆
+file:
+ temp-dir: /javaWork/product-inventory-management/file/temp/uploads # 涓存椂鐩綍
+ upload-dir: /javaWork/product-inventory-management/file/prod/uploads # 姝e紡鐩綍
+ path: /javaWork/product-inventory-management/file # 涓婁紶鐩綍
+ urlPrefix: /prod-api/common # 閾炬帴鍓嶇紑
+ domain: http://1.15.17.182:9081 # 鍩熷悕鍓嶇紑
+ expired: 120 # 杩囨湡鏃堕棿(鍗曚綅:鍒嗛挓)
+ useLimit: 10 # 浣跨敤娆℃暟
+ compress: true # 鏄惁鍘嬬缉
+ needCompressSize: 10MB # 鍘嬬缉闃堝��
+ compressQuality: 0.5 # 鍘嬬缉璐ㄩ噺(0.0-1.0)
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 70324c6..ad3d4bc 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,9 +1,19 @@
# Spring閰嶇疆
spring:
+ jackson:
+ date-format: yyyy-MM-dd HH:mm:ss
+ time-zone: GMT+8
main:
allow-circular-references: true
profiles:
active: dev
+
+# Pinecone 鍚戦噺鏁版嵁搴撻厤缃�
+pinecone:
+ api-key: pcsk_4SJLnh_tNB3wSLJU8tc4E5P28PcXX8eCLdURqZpVhg1FMV8CRYxjneWdzqRdB5Ftqooi9
+ index: xiaozhi-index
+ namespace: knowledge-base
+
langchain4j:
mcp:
# MCP 鏈嶅姟绔湴鍧�锛堟牴鎹疄闄呴儴缃茬殑 MCP 鏈嶅姟璋冩暣锛�
diff --git a/src/main/resources/approve-todo-agent-prompt.txt b/src/main/resources/approve-todo-agent-prompt.txt
index c309da8..f026fee 100644
--- a/src/main/resources/approve-todo-agent-prompt.txt
+++ b/src/main/resources/approve-todo-agent-prompt.txt
@@ -1,4 +1,5 @@
浣犳槸涓�涓鎵瑰緟鍔炲姪鎵嬶紝璐熻矗鍗忓悓鍔炲叕瀹℃壒寰呭姙鐨勬煡璇€�佸鏍搞�佸彇娑堝鏍搞�佷慨鏀广�佸垹闄ゅ拰缁熻鍒嗘瀽銆�
+褰撳墠鏃ユ湡锛歿{currentDate}}锛堜腑鍥芥椂鍖猴級銆�
宸ヤ綔瑕佹眰锛�
1. 鐢ㄦ埛闂緟鍔炲垪琛ㄣ�佸鎵硅繘搴︺�佸鎵硅鎯呫�佺粺璁℃暟鎹椂锛屼紭鍏堣皟鐢ㄥ伐鍏凤紝涓嶈鑷嗛�犳暟鎹��
@@ -16,3 +17,4 @@
13. 鍙湁鈥滄煡璇㈠鎵瑰緟鍔炶鎯呪�濊繖涓伐鍏峰厑璁歌緭鍑鸿嚜鐒惰瑷�鏂囨湰銆�
14. 濡傛灉宸ュ叿杩斿洖鐨勬槸缁熻 JSON锛屼篃鍚屾牱鐩存帴杈撳嚭鍘熷 JSON锛涘叾涓� `description`銆乣summary`銆乣charts` 宸茬粡渚涘墠绔娇鐢ㄣ��
15. 鍥炵瓟浣跨敤涓枃锛涗絾鍦� JSON 鍦烘櫙涓嬶紝鏈�缁堣緭鍑哄繀椤绘槸鍚堟硶 JSON 鏈綋銆�
+16. 鐢ㄦ埛鎻愬埌鈥滀粖骞�/鏈湀/浠婂ぉ/鏈�杩�/涓婃湀/鍘诲勾鈥濈瓑鐩稿鏃堕棿鏃讹紝蹇呴』涓ユ牸鍩轰簬鈥滃綋鍓嶆棩鏈熲�濇崲绠楋紝绂佹鑷鍋囪骞翠唤銆�
diff --git a/src/main/resources/financial-agent-prompt.txt b/src/main/resources/financial-agent-prompt.txt
new file mode 100644
index 0000000..5b5fb02
--- /dev/null
+++ b/src/main/resources/financial-agent-prompt.txt
@@ -0,0 +1,11 @@
+浣犳槸鏁板瓧鍖栧伐鍘傜殑璐㈠姟鏅鸿兘浣擄紝瑕嗙洊涓氳储铻嶅悎銆佹垚鏈牳绠椼�佸埄娑﹀垎鏋愩�佸簱瀛樿祫閲戙�佸簲鏀跺簲浠樸�佺幇閲戞祦棰勬祴銆佺粡钀ラ璀︿笌缁忚惀椹鹃┒鑸便��
+褰撳墠鏃ユ湡锛歿{currentDate}}锛堜腑鍥芥椂鍖猴級銆�
+
+宸ヤ綔瑙勫垯锛�
+1. 鐢ㄦ埛鎻愬嚭鈥滄煡銆侀棶銆佺粺璁°�佸垎鏋愩�侀璀︺�佸缓璁�佹姤鍛娾�濈被闇�姹傛椂锛屼紭鍏堣皟鐢ㄥ伐鍏疯繑鍥炵粨鏋勫寲 JSON锛屼笉缂栭�犱笟鍔℃暟鎹��
+2. 鍛戒腑鎴愭湰銆佸埄娑︺�佸簱瀛樿祫閲戙�佺幇閲戞祦銆侀璀︺�侀┚椹惰埍銆佹棩鎶ャ�佸懆鎶ョ瓑鍦烘櫙鏃讹紝浼樺厛璋冪敤瀵瑰簲宸ュ叿銆�
+3. 宸ュ叿杩斿洖 JSON 鏃讹紝鐩存帴杈撳嚭鍘熷 JSON 瀛楃涓诧紝涓嶈棰濆鍖呰9 Markdown锛屼篃涓嶈鍦ㄥ墠鍚庤拷鍔犺В閲婃枃鏈��
+4. 鐢ㄦ埛娌℃湁鏄庣‘缁欏嚭鏃堕棿銆佸鎴枫�佷緵搴斿晢銆佷骇鍝併�佽鍗曘�佹暟閲忕瓑绛涢�夋潯浠舵椂锛屼笉瑕佽嚜琛岃ˉ鍏呮潯浠讹紱宸ュ叿鍙傛暟淇濇寔涓虹┖锛岀敱宸ュ叿鎸夊綋鍓嶄笟鍔″彛寰勬煡璇€��
+5. 鐢ㄦ埛鎻愬埌鈥滄湰鍛ㄣ�佹湰鏈堛�佷粖骞淬�佷粖澶┿�佹渶杩戙�佽繎30澶┿�佷笂鏈堛�佸幓骞粹�濈瓑鐩稿鏃堕棿鏃讹紝蹇呴』涓ユ牸鍩轰簬鈥滃綋鍓嶆棩鏈熲�濇崲绠楋紝绂佹鑷鍋囪骞翠唤銆�
+6. 鐢ㄦ埛闂�滀负浠�涔堝埄娑︿笅闄嶁�濃�滃摢涓鍗曚簭鎹熲�濃�滃摢涓鎴锋渶璧氶挶鈥濃�滃摢涓鎴峰埄娑﹁础鐚渶楂樷�濃�滃摢涓伐搴忔垚鏈渶楂樷�濈瓑闂鏃讹紝浼樺厛鍩轰簬璁㈠崟鍒╂鼎涓庡伐搴忔垚鏈垎鏋愬伐鍏蜂綔绛斻��
+7. 鍥炵瓟蹇呴』浣跨敤涓枃锛涜嫢鏁版嵁涓嶈冻浠ュ緱鍑虹粨璁猴紝鏄庣‘鎸囧嚭缂哄皯鍝簺鍏抽敭瀛楁鎴栫瓫閫夋潯浠躲��
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index d69a572..9bffe41 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 鏃ュ織瀛樻斁璺緞 -->
- <property name="log.path" value="/home/ruoyi/logs" />
+ <property name="log.path" value="./logs" />
<!-- 鏃ュ織杈撳嚭鏍煎紡 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
@@ -11,7 +11,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
-
+
<!-- 绯荤粺鏃ュ織杈撳嚭 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
@@ -34,7 +34,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
-
+
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� -->
@@ -56,7 +56,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
-
+
<!-- 鐢ㄦ埛璁块棶鏃ュ織杈撳嚭 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
@@ -70,7 +70,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
-
+
<!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring鏃ュ織绾у埆鎺у埗 -->
@@ -79,15 +79,15 @@
<root level="info">
<appender-ref ref="console" />
</root>
-
+
<!--绯荤粺鎿嶄綔鏃ュ織-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
-
+
<!--绯荤粺鐢ㄦ埛鎿嶄綔鏃ュ織-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/src/main/resources/manufacturing-agent-prompt.txt b/src/main/resources/manufacturing-agent-prompt.txt
new file mode 100644
index 0000000..1653bb9
--- /dev/null
+++ b/src/main/resources/manufacturing-agent-prompt.txt
@@ -0,0 +1,10 @@
+浣犳槸浼佷笟鍒堕�犳櫤鑳藉姪鎵嬶紝瑕嗙洊鐢熶骇鐜板満銆佽鍒掋�佸伐鍗曘�佽澶囥�佽川閲忋�佺墿鏂欍�佸紓甯稿鐞嗕竷涓煙銆�
+褰撳墠鏃ユ湡锛歿{currentDate}}锛堜腑鍥芥椂鍖猴級銆�
+
+宸ヤ綔瑙勫垯锛�
+1. 鐢ㄦ埛鎻愬嚭鈥滄煡銆侀棶銆侀璀︺�佸垎鏋愨�濋渶姹傛椂锛屼紭鍏堣皟鐢ㄥ伐鍏锋嬁缁撴瀯鍖栫粨鏋滐紝涓嶈鑷嗛�犱笟鍔℃暟鎹��
+2. 鐢ㄦ埛鎻愬嚭鈥滃姙鈥濋渶姹傛椂锛屼紭鍏堣緭鍑哄姙鐞嗗缓璁姩浣滃崱锛堟帴鍙c�佸繀濉瓧娈点�佺ず渚嬶級锛屾槑纭渶瑕佸墠绔簩娆$‘璁ゃ��
+3. 宸ュ叿杩斿洖 JSON 鏃讹紝鐩存帴杈撳嚭鍘熷 JSON 瀛楃涓诧紝涓嶈棰濆鍖呰9 Markdown锛屼笉瑕佸湪鍓嶅悗鍔犺В閲婃枃瀛椼��
+4. 鍥炵瓟蹇呴』浣跨敤涓枃锛涜嫢鐢ㄦ埛闂缂哄皯鏃堕棿鑼冨洿銆佸叧閿瓧绛夋潯浠讹紝鍙厛缁欓粯璁ゅ彛寰勫苟鎻愮ず鍙ˉ鍏呮潯浠躲��
+5. 鑻ユ棤娉曚粠宸ュ叿缁撴灉寰楀埌缁撹锛屾槑纭鏄庣己灏戠殑绛涢�夋潯浠舵垨涓氬姟瀛楁銆�
+6. 鐢ㄦ埛鎻愬埌鈥滀粖骞�/鏈湀/浠婂ぉ/鏈�杩�/涓婃湀/鍘诲勾鈥濈瓑鐩稿鏃堕棿鏃讹紝蹇呴』涓ユ牸鍩轰簬鈥滃綋鍓嶆棩鏈熲�濇崲绠楋紝绂佹鑷鍋囪骞翠唤銆�
diff --git a/src/main/resources/mapper/account/AccountExpenseMapper.xml b/src/main/resources/mapper/account/AccountExpenseMapper.xml
deleted file mode 100644
index f4039c8..0000000
--- a/src/main/resources/mapper/account/AccountExpenseMapper.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.ruoyi.account.mapper.AccountExpenseMapper">
- <select id="accountExpenseListPage" resultType="com.ruoyi.account.pojo.AccountExpense">
- SELECT
- *
- FROM account_expense
- where
- 1=1
- <if test="accountExpense.entryDateStart != null and accountExpense.entryDateStart != '' ">
- AND expense_date >= DATE_FORMAT(#{accountExpense.entryDateStart},'%Y-%m-%d')
- </if>
- <if test=" accountExpense.supplierName != null and accountExpense.supplierName != ''">
- AND supplier_name like CONCAT('%',#{accountExpense.supplierName},'%')
- </if>
- <if test=" accountExpense.invoiceNumber != null and accountExpense.invoiceNumber != ''">
- AND invoice_number like CONCAT('%',#{accountExpense.invoiceNumber},'%')
- </if>
- <if test="accountExpense.entryDateEnd != null and accountExpense.entryDateEnd != '' ">
- AND expense_date <= DATE_FORMAT(#{accountExpense.entryDateEnd},'%Y-%m-%d')
- </if>
- <if test="accountExpense.expenseType != null and accountExpense.expenseType != '' ">
- AND expense_type = #{accountExpense.expenseType}
- </if>
- <if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
- AND expense_method = #{accountExpense.expenseMethod}
- </if>
- </select>
- <select id="accountExpenseExport" resultType="com.ruoyi.account.pojo.AccountExpense">
- SELECT
- *
- FROM account_expense
- where
- 1=1
- <if test="accountExpense.entryDateStart != null and accountExpense.entryDateStart != '' ">
- AND expense_date >= DATE_FORMAT(#{accountExpense.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="accountExpense.entryDateEnd != null and accountExpense.entryDateEnd != '' ">
- AND expense_date <= DATE_FORMAT(#{accountExpense.entryDateEnd},'%Y-%m-%d')
- </if>
- <if test="accountExpense.expenseType != null and accountExpense.expenseType != '' ">
- AND expense_type = #{accountExpense.expenseType}
- </if>
- <if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
- AND expense_method = #{accountExpense.expenseMethod}
- </if>
- </select>
- <select id="report" resultType="com.ruoyi.account.dto.AccountDto2">
- SELECT
- sdd.dict_label typeName,
- sum(expense_money) account
- FROM account_expense ae
- left join sys_dict_data sdd on ae.expense_type = sdd.dict_value and sdd.dict_type='expense_types'
- where
- 1=1
- <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
- AND expense_date >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
- AND expense_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
- </if>
- group by sdd.dict_label, ae.expense_type
- </select>
-
- <select id="report1" resultType="java.math.BigDecimal">
- SELECT
- ifnull(sum(expense_money),0) account
- FROM account_expense ai
- where
- expense_type=#{dictValue}
- <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
- AND expense_date >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
- AND expense_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
- </if>
- </select>
-
- <select id="selectAccountExpenseStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
- SELECT DATE_FORMAT(expense_date, #{dateFormat}) as dateStr, IFNULL(SUM(expense_money), 0) as amount
- FROM account_expense
- WHERE expense_date BETWEEN #{startDate} AND #{endDate}
- GROUP BY dateStr
- </select>
-
- <select id="selectExpenseComposition" resultType="com.ruoyi.dto.MapDto">
- SELECT sdd.dict_label as name, CAST(IFNULL(SUM(ae.expense_money), 0) AS CHAR) as value
- FROM account_expense ae
- LEFT JOIN sys_dict_data sdd ON ae.expense_type = sdd.dict_value AND sdd.dict_type = 'expense_types'
- <where>
- <if test="startDate != null and startDate != ''">
- AND ae.expense_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- AND ae.expense_date <= #{endDate}
- </if>
- </where>
- GROUP BY ae.expense_type, sdd.dict_label
- </select>
-
-</mapper>
diff --git a/src/main/resources/mapper/account/AccountFileMapper.xml b/src/main/resources/mapper/account/AccountFileMapper.xml
deleted file mode 100644
index 86266d5..0000000
--- a/src/main/resources/mapper/account/AccountFileMapper.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.ruoyi.account.mapper.AccountFileMapper">
- <select id="accountFileListPage" resultType="com.ruoyi.account.pojo.AccountFile">
- SELECT
- *
- FROM account_file
- where
- 1=1
- <if test="accountFile.accountId != null and accountFile.accountId != ''">
- AND account_id = #{accountFile.accountId}
- </if>
- <if test="accountFile.name != null and accountFile.name != '' ">
- AND name = #{accountFile.name}
- </if>
- <if test="accountFile.accountType != null and accountFile.accountType != '' ">
- AND account_type = #{accountFile.accountType}
- </if>
- </select>
-</mapper>
diff --git a/src/main/resources/mapper/account/AccountIncomeMapper.xml b/src/main/resources/mapper/account/AccountIncomeMapper.xml
deleted file mode 100644
index 9becd41..0000000
--- a/src/main/resources/mapper/account/AccountIncomeMapper.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.ruoyi.account.mapper.AccountIncomeMapper">
-
- <select id="accountIncomeListPage" resultType="com.ruoyi.account.pojo.AccountIncome">
- SELECT
- *
- FROM account_income
- where
- 1=1
- <if test="accountIncome.entryDateStart != null and accountIncome.entryDateStart != '' ">
- AND income_date >= DATE_FORMAT(#{accountIncome.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="accountIncome.customerName != null and accountIncome.customerName != '' ">
- AND customer_name like CONCAT('%',#{accountIncome.customerName},'%')
- </if>
-
- <if test="accountIncome.invoiceNumber != null and accountIncome.invoiceNumber != '' ">
- AND invoice_number like CONCAT('%',#{accountIncome.invoiceNumber},'%')
- </if>
- <if test="accountIncome.entryDateEnd != null and accountIncome.entryDateEnd != '' ">
- AND income_date <= DATE_FORMAT(#{accountIncome.entryDateEnd},'%Y-%m-%d')
- </if>
- <if test="accountIncome.incomeType != null and accountIncome.incomeType != '' ">
- AND income_type = #{accountIncome.incomeType}
- </if>
- <if test="accountIncome.incomeMethodLabel != null and accountIncome.incomeMethodLabel != ''">
- AND (
- (
- business_type = 1
- AND income_method in
- <foreach collection="accountIncome.receiptPaymentMethodList" item="method" open="(" separator="," close=")">
- #{method}
- </foreach>
- )
- OR
- (
- business_type is null
- AND income_method in
- <foreach collection="accountIncome.paymentMethodList" item="method" open="(" separator="," close=")">
- #{method}
- </foreach>
- )
- )
- </if>
- <if test="(accountIncome.incomeMethodLabel == null or accountIncome.incomeMethodLabel == '') and accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
- AND income_method = #{accountIncome.incomeMethod}
- </if>
- </select>
- <select id="accountIncomeExport" resultType="com.ruoyi.account.pojo.AccountIncome">
- SELECT
- *
- FROM account_income
- where
- 1=1
- <if test="accountIncome.entryDateStart != null and accountIncome.entryDateStart != '' ">
- AND income_date >= DATE_FORMAT(#{accountIncome.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="accountIncome.entryDateEnd != null and accountIncome.entryDateEnd != '' ">
- AND income_date <= DATE_FORMAT(#{accountIncome.entryDateEnd},'%Y-%m-%d')
- </if>
- <if test="accountIncome.incomeType != null and accountIncome.incomeType != '' ">
- AND income_type = #{accountIncome.incomeType}
- </if>
- <if test="accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
- AND income_method = #{accountIncome.incomeMethod}
- </if>
- </select>
- <select id="report" resultType="com.ruoyi.account.dto.AccountDto2">
- SELECT
- sdd.dict_label typeName,
- ifnull(sum(income_money),0) account
- FROM account_income ai
- left join sys_dict_data sdd on ai.income_type = sdd.dict_value and sdd.dict_type='income_types'
- where
- 1=1
- <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
- AND income_date >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
- AND income_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
- </if>
- GROUP BY sdd.dict_label, ai.income_type
- </select>
- <select id="report1" resultType="java.math.BigDecimal">
- SELECT
- ifnull(sum(income_money),0) account
- FROM account_income ai
- where
- income_type=#{dictValue}
- <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
- AND income_date >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
- AND income_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
- </if>
- </select>
-
- <select id="selectIncomeStats"
- resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
- SELECT DATE_FORMAT(income_date, #{dateFormat}) AS dateStr,
- IFNULL(SUM(income_money), 0) AS amount
- FROM account_income
- WHERE income_date BETWEEN #{startDate} AND #{endDate}
-# AND business_type = 1
- GROUP BY dateStr
- ORDER BY dateStr
-
- </select>
-
-</mapper>
diff --git a/src/main/resources/mapper/account/AccountStatementMapper.xml b/src/main/resources/mapper/account/AccountStatementMapper.xml
new file mode 100644
index 0000000..32b1621
--- /dev/null
+++ b/src/main/resources/mapper/account/AccountStatementMapper.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.AccountStatementMapper">
+
+ <select id="listPageAccountStatement" resultType="com.ruoyi.account.bean.vo.StatementAccountVo">
+ SELECT lj.*,
+ <choose>
+ <when test="req.accountType == 1">
+ c.customer_name as customerName
+ </when>
+ <when test="req.accountType == 2">
+ s.supplier_name as customerName
+ </when>
+ <otherwise>
+ '' as customerName
+ </otherwise>
+ </choose>
+ FROM account_statement AS lj
+ <!-- 鍔ㄦ�� LEFT JOIN -->
+ <choose>
+ <when test="req.accountType == 1">
+ LEFT JOIN customer AS c
+ ON lj.customer_id = c.id
+ </when>
+ <when test="req.accountType == 2">
+ LEFT JOIN supplier_manage AS s
+ ON lj.customer_id = s.id
+ </when>
+ </choose>
+ WHERE 1=1
+ <if test="req.accountType != null">
+ AND lj.account_type = #{req.accountType}
+ </if>
+ <if test="req.customerId != null">
+ AND lj.customer_id = #{req.customerId}
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND DATE_FORMAT(CONCAT(lj.statement_month, '-01'), '%Y-%m-%d')
+ BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ ORDER BY lj.statement_month DESC
+ </select>
+ <select id="selectVatDtoPage" resultType="com.ruoyi.purchase.dto.VatDto">
+ SELECT
+ month,
+ jTaxAmount,
+ xTaxAmount,
+ (jTaxAmount - xTaxAmount) AS taxAmount
+ FROM (
+ SELECT
+ month,
+ SUM(IF(type = 'purchase', tax_price, 0)) AS xTaxAmount,
+ SUM(IF(type = 'sales', tax_price, 0)) AS jTaxAmount
+ FROM (
+ SELECT
+ DATE_FORMAT(issue_date, '%Y-%m') AS month,
+ tax_price,
+ 'sales' AS type
+ FROM account_sales_invoice
+ WHERE status != 1
+ UNION ALL
+ SELECT
+ DATE_FORMAT(issue_date, '%Y-%m') AS month,
+ tax_price,
+ 'purchase' AS type
+ FROM account_purchase_invoice
+ WHERE status != 1
+ ) AS all_data
+ GROUP BY month
+ ) AS TT
+ <where>
+ <if test="month != null">
+ and TT.month = #{month}
+ </if>
+ </where>
+ ORDER BY TT.month
+ </select>
+</mapper>
diff --git a/src/main/resources/mapper/account/BorrowInfoMapper.xml b/src/main/resources/mapper/account/BorrowInfoMapper.xml
deleted file mode 100644
index f21c8d7..0000000
--- a/src/main/resources/mapper/account/BorrowInfoMapper.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.account.mapper.BorrowInfoMapper">
-
- <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
- <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.BorrowInfo">
- <id column="id" property="id" />
- <result column="borrower_name" property="borrowerName" />
- <result column="borrow_amount" property="borrowAmount" />
- <result column="interest_rate" property="interestRate" />
- <result column="borrow_date" property="borrowDate" />
- <result column="repay_date" property="repayDate" />
- <result column="status" property="status" />
- <result column="remark" property="remark" />
- <result column="create_time" property="createTime" />
- <result column="create_user" property="createUser" />
- <result column="update_time" property="updateTime" />
- <result column="update_user" property="updateUser" />
- <result column="tenant_id" property="tenantId" />
- </resultMap>
-
-</mapper>
diff --git a/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml b/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml
index 355151a..a41c8c1 100644
--- a/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml
+++ b/src/main/resources/mapper/account/SalesRefundAmountOrderMapper.xml
@@ -15,12 +15,12 @@
<result column="create_user_id" property="createUserId" />
<result column="update_user_id" property="updateUserId" />
</resultMap>
- <select id="pageSalesRefundAmountOrderDto" resultType="com.ruoyi.account.dto.SalesRefundAmountOrderDto">
+ <select id="pageSalesRefundAmountOrderDto" resultType="com.ruoyi.account.bean.dto.SalesRefundAmountOrderDto">
select sl.sales_contract_no,
sl.customer_contract_no,
- slp.specification_model,
- slp.product_category as product_name,
- slp.unit,
+ pm.model as specification_model,
+ p.product_name ,
+ pm.unit,
sl.customer_name,
rm.return_no as return_management_no,
srao.*
@@ -28,6 +28,8 @@
left join return_management rm on srao.return_management_id = rm.id
left join return_sale_product rs on rm.id = rs.return_management_id
left join sales_ledger_product slp on rs.return_sales_ledger_product_id = slp.id
+ left join product_model pm on slp.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
left join sales_ledger sl on slp.sales_ledger_id = sl.id
<where>
<if test="ew.salesContractNo != null and ew.salesContractNo !=''">
diff --git a/src/main/resources/mapper/account/financial/AccountSubjectMapper.xml b/src/main/resources/mapper/account/financial/AccountSubjectMapper.xml
new file mode 100644
index 0000000..469691f
--- /dev/null
+++ b/src/main/resources/mapper/account/financial/AccountSubjectMapper.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.financial.AccountSubjectMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.financial.AccountSubject">
+ <id column="id" property="id" />
+ <result column="parent_id" property="parentId" />
+ <result column="subject_code" property="subjectCode" />
+ <result column="subject_name" property="subjectName" />
+ <result column="subject_type" property="subjectType" />
+ <result column="balance_direction" property="balanceDirection" />
+ <result column="status" property="status" />
+ <result column="remark" property="remark" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ </resultMap>
+
+ <select id="countReferencedBySubjectCodes" resultType="java.lang.Long">
+ SELECT COUNT(1)
+ FROM fin_voucher_entry
+ WHERE subject_code IN
+ <foreach collection="subjectCodes" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/account/financial/FinVoucherEntryMapper.xml b/src/main/resources/mapper/account/financial/FinVoucherEntryMapper.xml
new file mode 100644
index 0000000..56633ba
--- /dev/null
+++ b/src/main/resources/mapper/account/financial/FinVoucherEntryMapper.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.financial.FinVoucherEntryMapper">
+
+ <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.financial.FinVoucherEntry">
+ <id column="id" property="id"/>
+ <result column="voucher_id" property="voucherId"/>
+ <result column="row_no" property="rowNo"/>
+ <result column="subject_code" property="subjectCode"/>
+ <result column="subject_name" property="subjectName"/>
+ <result column="summary" property="summary"/>
+ <result column="debit" property="debit"/>
+ <result column="credit" property="credit"/>
+ <result column="auxiliary_type" property="auxiliaryType"/>
+ <result column="auxiliary_id" property="auxiliaryId"/>
+ <result column="auxiliary_name" property="auxiliaryName"/>
+ <result column="create_user" property="createUser"/>
+ <result column="create_time" property="createTime"/>
+ <result column="update_user" property="updateUser"/>
+ <result column="update_time" property="updateTime"/>
+ <result column="dept_id" property="deptId"/>
+ </resultMap>
+
+ <select id="listPostedEntries" resultType="com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo">
+ SELECT
+ v.voucher_date AS voucherDate,
+ v.voucher_no AS voucherNo,
+ CASE
+ WHEN e.summary IS NOT NULL AND e.summary != '' THEN e.summary
+ ELSE v.summary
+ END AS summary,
+ e.debit AS debit,
+ e.credit AS credit,
+ e.row_no AS rowNo
+ FROM fin_voucher_entry e
+ INNER JOIN fin_voucher v ON e.voucher_id = v.id
+ WHERE v.status = 'posted'
+ AND (e.subject_code = #{subjectCode} OR e.subject_code LIKE CONCAT(#{subjectCode}, '%'))
+ AND v.voucher_date <![CDATA[>=]]> #{startDate}
+ AND v.voucher_date <![CDATA[<=]]> #{endDate}
+ <if test="auxiliaryType != null and auxiliaryType != ''">
+ AND e.auxiliary_type = #{auxiliaryType}
+ </if>
+ <if test="auxiliaryId != null and auxiliaryId != ''">
+ AND e.auxiliary_id = #{auxiliaryId}
+ </if>
+ ORDER BY v.voucher_date ASC, v.id ASC, e.row_no ASC, e.id ASC
+ </select>
+
+ <select id="listPostedEntriesBefore" resultType="com.ruoyi.account.bean.vo.financial.FinLedgerEntryRecordVo">
+ SELECT
+ v.voucher_date AS voucherDate,
+ v.voucher_no AS voucherNo,
+ CASE
+ WHEN e.summary IS NOT NULL AND e.summary != '' THEN e.summary
+ ELSE v.summary
+ END AS summary,
+ e.debit AS debit,
+ e.credit AS credit,
+ e.row_no AS rowNo
+ FROM fin_voucher_entry e
+ INNER JOIN fin_voucher v ON e.voucher_id = v.id
+ WHERE v.status = 'posted'
+ AND (e.subject_code = #{subjectCode} OR e.subject_code LIKE CONCAT(#{subjectCode}, '%'))
+ AND v.voucher_date <![CDATA[<]]> #{beforeDate}
+ <if test="auxiliaryType != null and auxiliaryType != ''">
+ AND e.auxiliary_type = #{auxiliaryType}
+ </if>
+ <if test="auxiliaryId != null and auxiliaryId != ''">
+ AND e.auxiliary_id = #{auxiliaryId}
+ </if>
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
new file mode 100644
index 0000000..f4d6284
--- /dev/null
+++ b/src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.purchase.AccountPaymentApplicationMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.purchase.AccountPaymentApplication">
+ <id column="id" property="id" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ <result column="supplier_id" property="supplierId" />
+ <result column="stock_in_record_ids" property="stockInRecordIds" />
+ <result column="invoice_application_no" property="invoiceApplicationNo" />
+ <result column="payment_method" property="paymentMethod" />
+ <result column="payment_content" property="paymentContent" />
+ <result column="apply_date" property="applyDate" />
+ <result column="remark" property="remark" />
+ <result column="status" property="status" />
+ <result column="payment_amount" property="paymentAmount" />
+ </resultMap>
+ <select
+ id="listPageAccountPaymentApplication"
+ resultType="com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo">
+ select * from (select apa.*,
+ sm.supplier_name,
+ GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches
+ from account_payment_application apa
+ left join supplier_manage sm on apa.supplier_id = sm.id
+ left join stock_in_record sir on FIND_IN_SET(sir.id, apa.stock_in_record_ids) > 0
+ GROUP BY apa.id)A
+ <where>
+ <if test="req.supplierId != null">
+ AND A.supplier_id = #{req.supplierId}
+ </if>
+ <if test="req.invoiceApplicationNo != null and req.invoiceApplicationNo != ''">
+ AND A.invoice_application_no LIKE CONCAT('%',#{req.invoiceApplicationNo},'%')
+ </if>
+ <if test="req.status != null">
+ AND A.status = #{req.status}
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND A.apply_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ </where>
+ order by A.id desc
+ </select>
+
+ <select id="getInboundBatchesBySupplier"
+ resultType="com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo">
+ SELECT
+ sir.id,
+ sir.inbound_batches,
+ pl.supplier_name,
+ DATE(sir.create_time) AS inboundDate,
+ p.product_name,
+ pm.model as specification_model,
+ sir.stock_in_num * slp.tax_inclusive_unit_price AS InboundAmount,
+ pl.purchase_contract_number
+ FROM stock_in_record sir
+ -- 10 绫诲瀷鎵嶅叧鑱旇川妫�琛�
+ LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id
+ -- 鍔ㄦ�佸叧鑱旈噰璐紙鑷姩閫傞厤 7 鍜� 10锛�
+ LEFT JOIN purchase_ledger pl
+ ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id)
+ -- 浜у搧鍏宠仈涓嶅姩
+ LEFT JOIN sales_ledger_product slp ON pl.id = slp.sales_ledger_id
+ LEFT JOIN product_model pm ON sir.product_model_id = pm.id
+ LEFT JOIN product p ON pm.product_id = p.id
+ -- 鏉′欢
+ WHERE sir.approval_status = 1 AND slp.type = 2
+ AND sir.record_type IN ('7','10')
+ and pl.supplier_id=#{supplierId}
+
+ and sir.id NOT IN (
+ SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(a.stock_in_record_ids, ',', n.n), ',', -1)
+ FROM account_payment_application a
+ CROSS JOIN (
+ SELECT 1 n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL
+ SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
+ ) n
+ WHERE n.n <= CHAR_LENGTH(a.stock_in_record_ids) - CHAR_LENGTH(REPLACE(a.stock_in_record_ids, ',', '')) + 1
+ and a.status!=2
+ )
+
+ order by sir.id DESC
+ </select>
+
+ <select id="existsByStockInRecordId" resultType="java.lang.Boolean">
+ SELECT COUNT(*) > 0
+ FROM account_payment_application
+ WHERE status != 2
+ AND (
+ <foreach collection="stockInRecordIds" item="id" separator=" OR ">
+ FIND_IN_SET(#{id}, stock_in_record_ids) > 0
+ </foreach>
+ )
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml b/src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml
new file mode 100644
index 0000000..a164b5c
--- /dev/null
+++ b/src/main/resources/mapper/account/purchase/AccountPurchaseInvoiceMapper.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.purchase.AccountPurchaseInvoiceMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.purchase.AccountPurchaseInvoice">
+ <id column="id" property="id" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ <result column="invoice_number" property="invoiceNumber" />
+ <result column="tax_rate" property="taxRate" />
+ <result column="invoice_type" property="invoiceType" />
+ <result column="issue_date" property="issueDate" />
+ <result column="tax_exclusivel_price" property="taxExclusivelPrice" />
+ <result column="tax_price" property="taxPrice" />
+ <result column="tax_inclusive_price" property="taxInclusivePrice" />
+ <result column="remark" property="remark" />
+ <result column="invoice_content" property="invoiceContent" />
+ <result column="supplier_id" property="supplierId" />
+ <result column="storage_attachment_id" property="storageAttachmentId" />
+ <result column="stock_in_record_ids" property="stockInRecordIds" />
+ </resultMap>
+ <select id="listPageAccountPurchaseInvoice"
+ resultType="com.ruoyi.account.bean.vo.purchase.AccountPurchaseInvoiceVo">
+ select api.* , sm.supplier_name
+ from account_purchase_invoice api
+ left join supplier_manage sm on api.supplier_id = sm.id
+ <where>
+ <if test="req.supplierId != null">
+ AND api.supplier_id = #{req.supplierId}
+ </if>
+ <if test="req.status != null">
+ AND api.status = #{req.status}
+ </if>
+ <if test="req.invoiceNumber != null and req.invoiceNumber != ''">
+ AND api.invoice_number LIKE CONCAT('%',#{req.invoiceNumber},'%')
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND api.issue_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ </where>
+ order by api.id desc
+ </select>
+ <select id="getInboundBatchesBySupplier"
+ resultType="com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo">
+ SELECT
+ sir.id,
+ sir.inbound_batches,
+ pl.supplier_name,
+ DATE(sir.create_time) AS inboundDate,
+ p.product_name,
+ pm.model as specification_model,
+ sir.stock_in_num * slp.tax_inclusive_unit_price AS InboundAmount,
+ pl.purchase_contract_number
+ FROM stock_in_record sir
+ -- 10 绫诲瀷鎵嶅叧鑱旇川妫�琛�
+ LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id
+ -- 鍔ㄦ�佸叧鑱旈噰璐紙鑷姩閫傞厤 7 鍜� 10锛�
+ LEFT JOIN purchase_ledger pl
+ ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id)
+ -- 浜у搧鍏宠仈涓嶅姩
+ LEFT JOIN sales_ledger_product slp ON pl.id = slp.sales_ledger_id
+ LEFT JOIN product_model pm ON sir.product_model_id = pm.id
+ LEFT JOIN product p ON pm.product_id = p.id
+ -- 鏉′欢
+ WHERE sir.approval_status = 1 AND slp.type = 2
+ AND sir.record_type IN ('7','10')
+ and pl.supplier_id=#{supplierId}
+
+ and sir.id NOT IN (
+ SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(a.stock_in_record_ids, ',', n.n), ',', -1)
+ FROM account_purchase_invoice a
+ CROSS JOIN (
+ SELECT 1 n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL
+ SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
+ ) n
+ WHERE n.n <= CHAR_LENGTH(a.stock_in_record_ids) - CHAR_LENGTH(REPLACE(a.stock_in_record_ids, ',', '')) + 1
+ and a.status=0
+ )
+
+ order by sir.id DESC
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml b/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
new file mode 100644
index 0000000..ed247e5
--- /dev/null
+++ b/src/main/resources/mapper/account/purchase/AccountPurchasePaymentMapper.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.purchase.AccountPurchasePayment">
+ <id column="id" property="id" />
+ <result column="account_payment_application_id" property="accountPaymentApplicationId" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ <result column="supplier_id" property="supplierId" />
+ <result column="payment_date" property="paymentDate" />
+ <result column="payment_method" property="paymentMethod" />
+ <result column="payment_amount" property="paymentAmount" />
+ <result column="payment_number" property="paymentNumber" />
+ <result column="remark" property="remark" />
+ </resultMap>
+ <select id="listPageAccountPurchasePayment"
+ resultType="com.ruoyi.account.bean.vo.purchase.AccountPurchasePaymentVo">
+ select app.*,
+ sm.supplier_name,
+ sm.bank_account_num,
+ sm.bank_account_name,
+ apa.invoice_application_no AS invoiceApplicationNo,
+ if(asd.receipt_number is not null, true, false) as isAccountStatemen
+ from account_purchase_payment app
+ left join supplier_manage sm on app.supplier_id = sm.id
+ left join account_payment_application apa on app.account_payment_application_id=apa.id
+ left join account_statement_details asd on app.payment_number = asd.receipt_number
+ <where>
+ <if test="req.supplierId != null">
+ AND app.supplier_id = #{req.supplierId}
+ </if>
+ <if test="req.paymentMethod != null and req.paymentMethod != ''">
+ AND app.payment_method LIKE CONCAT('%',#{req.paymentMethod},'%')
+ </if>
+ <if test="req.paymentNumber != null and req.paymentNumber != ''">
+ AND app.payment_number LIKE CONCAT('%',#{req.paymentNumber},'%')
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND app.payment_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ </where>
+ order by app.id desc
+ </select>
+ <select id="selectPayment" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
+ SELECT DATE_FORMAT(payment_date, #{dateFormat}) AS dateStr,
+ IFNULL(SUM(payment_amount), 0) AS amount
+ FROM account_purchase_payment
+ WHERE payment_date BETWEEN #{startStr} AND #{endStr}
+ GROUP BY dateStr
+ ORDER BY dateStr
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml b/src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml
new file mode 100644
index 0000000..4121614
--- /dev/null
+++ b/src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.sales.AccountInvoiceApplicationMapper">
+
+ <select id="listPageAccountInvoiceApplication"
+ resultType="com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo">
+ select * from (select aia.*,
+ c.customer_name,
+ GROUP_CONCAT(sour.outbound_batches SEPARATOR ',') AS outboundBatches
+ from account_invoice_application aia
+ left join customer c on aia.customer_id = c.id
+ left join stock_out_record sour on FIND_IN_SET(sour.id, aia.stock_out_record_ids) > 0
+ GROUP BY aia.id)A
+ <where>
+ <if test="req.customerId != null">
+ AND A.customer_id = #{req.customerId}
+ </if>
+ <if test="req.invoiceApplicationNo != null and req.invoiceApplicationNo != ''">
+ AND A.invoice_application_no LIKE CONCAT('%',#{req.invoiceApplicationNo},'%')
+ </if>
+ <if test="req.status != null">
+ AND A.status = #{req.status}
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND A.apply_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ </where>
+ order by A.id desc
+ </select>
+ <select id="getOutboundBatchesByCustomer"
+ resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo">
+ SELECT
+ sor.id,
+ sor.outbound_batches,
+ sl.customer_name,
+ sor.create_time as shippingDate,
+ p.product_name,
+ pm.model as specification_model,
+ slp.tax_rate,
+ sor.stock_out_num * slp.tax_inclusive_unit_price as outboundAmount,
+ s.shipping_no,
+ sl.sales_contract_no
+ FROM stock_out_record sor
+ left join shipping_info s on sor.record_id = s.id
+ LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
+ LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1
+ left join product_model pm on slp.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ WHERE sor.record_type='13' and sor.approval_status=1
+ and sl.customer_id=#{customerId}
+
+ and sor.id NOT IN (
+ SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(a.stock_out_record_ids, ',', n.n), ',', -1)
+ FROM account_invoice_application a
+ CROSS JOIN (
+ SELECT 1 n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL
+ SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6
+ ) n
+ WHERE n.n <= CHAR_LENGTH(a.stock_out_record_ids) - CHAR_LENGTH(REPLACE(a.stock_out_record_ids, ',', '')) + 1
+ and a.status!=2
+ )
+
+ order by sor.id DESC
+ </select>
+ <select id="existsByStockOutRecordId" resultType="java.lang.Boolean">
+ SELECT COUNT(*) > 0
+ FROM account_invoice_application
+ WHERE status != 2
+ AND (
+ <foreach collection="stockOutRecordIds" item="id" separator=" OR ">
+ FIND_IN_SET(#{id}, stock_out_record_ids) > 0
+ </foreach>
+ )
+ </select>
+ <select id="selectAccountInvoiceApplicationList"
+ resultType="com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo">
+ select
+ *
+ from (
+ select aia.*,
+ asi.id AS sales_invoice_id,
+ asi.status AS sales_invoice_status,
+ c.customer_name,
+ GROUP_CONCAT(sour.outbound_batches SEPARATOR ',') AS outboundBatches
+ from account_invoice_application aia
+ left join customer c on aia.customer_id = c.id
+ left join stock_out_record sour on FIND_IN_SET(sour.id, aia.stock_out_record_ids) > 0
+ left join account_sales_invoice asi on aia.id = asi.account_invoice_application_id
+ GROUP BY aia.id
+ )A
+ WHERE A.customer_id = #{customerId}
+ AND (COALESCE(A.sales_invoice_id,'') = '' OR A.sales_invoice_status = 1)
+ AND A.status = 1
+ order by A.id desc
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml b/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
new file mode 100644
index 0000000..6a35890
--- /dev/null
+++ b/src/main/resources/mapper/account/sales/AccountSalesCollectionMapper.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.sales.AccountSalesCollection">
+ <id column="id" property="id" />
+ <result column="stock_out_record_ids" property="stockOutRecordIds" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ <result column="customer_id" property="customerId" />
+ <result column="collection_date" property="collectionDate" />
+ <result column="collection_amount" property="collectionAmount" />
+ <result column="collection_method" property="collectionMethod" />
+ <result column="collection_number" property="collectionNumber" />
+ <result column="remark" property="remark" />
+ </resultMap>
+ <select id="listPageAccountSalesCollection"
+ resultType="com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo">
+ select
+ A.* ,
+ if(asd.receipt_number is not null, true, false) as isAccountStatemen
+ from (select ascc.*,
+ c.customer_name,
+ GROUP_CONCAT(sour.outbound_batches SEPARATOR ',') AS outboundBatches
+ from account_sales_collection ascc
+ left join customer c on ascc.customer_id = c.id
+ left join stock_out_record sour on FIND_IN_SET(sour.id, ascc.stock_out_record_ids) > 0
+ GROUP BY ascc.id)A
+ left join account_statement_details asd on A.collection_number = asd.receipt_number
+ <where>
+ <if test="req.customerId != null">
+ AND A.customer_id = #{req.customerId}
+ </if>
+ <if test="req.collectionNumber != null and req.collectionNumber != ''">
+ AND A.collection_number LIKE CONCAT('%',#{req.collectionNumber},'%')
+ </if>
+ <if test="req.collectionMethod != null and req.collectionMethod != ''">
+ AND A.collection_method LIKE CONCAT('%',#{req.collectionMethod},'%')
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND A.collection_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ </where>
+ order by A.id desc
+ </select>
+ <select id="existsByStockOutRecordId" resultType="java.lang.Boolean">
+ SELECT COUNT(*) > 0
+ FROM account_sales_collection
+ WHERE
+ <foreach collection="stockOutRecordIds" item="id" open="(" separator=" OR " close=")">
+ FIND_IN_SET(#{id}, stock_out_record_ids)
+ </foreach>
+ </select>
+ <select id="getOutboundBatchesByCustomer"
+ resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo">
+ SELECT
+ id,
+ outbound_batches,
+ customer_name,
+ shipping_date,
+ product_name,
+ specification_model,
+ tax_rate,
+ outbound_amount,
+ shipping_no,
+ sales_contract_no,
+ amount_received
+ FROM
+ (
+ SELECT
+ sor.id,
+ sor.outbound_batches,
+ sl.customer_name,
+ sor.create_time AS shipping_date,
+ p.product_name,
+ pm.model AS specification_model,
+ slp.tax_rate,
+ sor.stock_out_num * slp.tax_inclusive_unit_price AS outbound_amount,
+ s.shipping_no,
+ sl.sales_contract_no,
+ COALESCE ( SUM( acsc.collection_amount ), 0 ) AS amount_received
+ FROM
+ stock_out_record sor
+ LEFT JOIN shipping_info s ON sor.record_id = s.id
+ LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
+ LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id
+ AND slp.type = 1
+ LEFT JOIN product_model pm ON slp.product_model_id = pm.id
+ LEFT JOIN product p ON pm.product_id = p.id
+ LEFT JOIN account_sales_collection acsc ON acsc.stock_out_record_ids = sor.id
+ WHERE
+ sor.record_type = '13'
+ AND sor.approval_status = 1
+ AND sl.customer_id = #{customerId}
+ GROUP BY
+ sor.outbound_batches
+ ORDER BY
+ sor.id
+ ) tempA
+ WHERE
+ amount_received < outbound_amount
+ </select>
+ <select id="selectIncomeStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
+ SELECT DATE_FORMAT(collection_date, #{dateFormat}) AS dateStr,
+ IFNULL(SUM(collection_amount), 0) AS amount
+ FROM account_sales_collection
+ WHERE collection_date BETWEEN #{startStr} AND #{endStr}
+ GROUP BY dateStr
+ ORDER BY dateStr
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml b/src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml
new file mode 100644
index 0000000..e69d79d
--- /dev/null
+++ b/src/main/resources/mapper/account/sales/AccountSalesInvoiceMapper.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.account.mapper.sales.AccountSalesInvoiceMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.sales.AccountSalesInvoice">
+ <id column="id" property="id" />
+ <result column="account_invoice_application_id" property="accountInvoiceApplicationId" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ <result column="invoice_number" property="invoiceNumber" />
+ <result column="tax_rate" property="taxRate" />
+ <result column="invoice_type" property="invoiceType" />
+ <result column="issue_date" property="issueDate" />
+ <result column="tax_exclusivel_price" property="taxExclusivelPrice" />
+ <result column="tax_price" property="taxPrice" />
+ <result column="tax_inclusive_price" property="taxInclusivePrice" />
+ <result column="remark" property="remark" />
+ <result column="invoice_content" property="invoiceContent" />
+ <result column="customer_id" property="customerId" />
+ <result column="storage_attachment_id" property="storageAttachmentId" />
+ </resultMap>
+ <select id="listPageAccountSalesInvoice"
+ resultType="com.ruoyi.account.bean.vo.sales.AccountSalesInvoiceVo">
+ select asi.* , c.customer_name
+ from account_sales_invoice asi
+ left join customer c on asi.customer_id = c.id
+ <where>
+ <if test="req.customerId != null">
+ AND asi.customer_id = #{req.customerId}
+ </if>
+ <if test="req.status != null">
+ AND asi.status = #{req.status}
+ </if>
+ <if test="req.invoiceNumber != null and req.invoiceNumber != ''">
+ AND asi.invoice_number LIKE CONCAT('%',#{req.invoiceNumber},'%')
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND asi.issue_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ </where>
+ order by asi.id desc
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/aftersalesservice/AfterSalesNearExpiryMapper.xml b/src/main/resources/mapper/aftersalesservice/AfterSalesNearExpiryMapper.xml
index e4b3c77..d1cde99 100644
--- a/src/main/resources/mapper/aftersalesservice/AfterSalesNearExpiryMapper.xml
+++ b/src/main/resources/mapper/aftersalesservice/AfterSalesNearExpiryMapper.xml
@@ -25,17 +25,18 @@
<select id="listPage" resultType="com.ruoyi.aftersalesservice.pojo.AfterSalesNearExpiry">
select * from after_sales_near_expiry
- where 1 = 1
- <if test="req.expireDate != null">
- AND expire_date = #{req.expireDate}
- </if>
- <if test="req.disDate != null">
- AND dis_date = #{req.disDate}
- </if>
- <if test="req.status != null">
- AND status = #{req.status}
- </if>
+ <where>
+ <if test="req.expireDate != null">
+ AND expire_date = #{req.expireDate}
+ </if>
+ <if test="req.disDate != null">
+ AND dis_date = #{req.disDate}
+ </if>
+ <if test="req.status != null">
+ AND status = #{req.status}
+ </if>
+ </where>
order by create_time desc
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml b/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml
index 2130c09..1d36599 100644
--- a/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml
+++ b/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml
@@ -32,7 +32,7 @@
<if test="req.serviceType != null">
and service_type = #{req.serviceType}
</if>
- order by update_time desc
+ order by create_time desc
</select>
<select id="countAfterSalesService" resultType="com.ruoyi.aftersalesservice.dto.CountDto">
select
@@ -42,4 +42,4 @@
group by status
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApprovalInstanceMapper.xml b/src/main/resources/mapper/approve/ApprovalInstanceMapper.xml
new file mode 100644
index 0000000..f3720c2
--- /dev/null
+++ b/src/main/resources/mapper/approve/ApprovalInstanceMapper.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.ApprovalInstanceMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.ApprovalInstance">
+ <id column="id" property="id" />
+ <result column="instance_no" property="instanceNo" />
+ <result column="template_id" property="templateId" />
+ <result column="template_name" property="templateName" />
+ <result column="business_id" property="businessId" />
+ <result column="business_type" property="businessType" />
+ <result column="title" property="title" />
+ <result column="status" property="status" />
+ <result column="current_level" property="currentLevel" />
+ <result column="applicant_id" property="applicantId" />
+ <result column="applicant_name" property="applicantName" />
+ <result column="apply_time" property="applyTime" />
+ <result column="finish_time" property="finishTime" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="deleted" property="deleted" />
+ </resultMap>
+ <select id="listPage" resultType="com.ruoyi.approve.bean.vo.ApprovalInstanceVo">
+ select ai.*,su.nick_name as create_user_name from
+ approval_instance ai
+ left join sys_user su on ai.create_user = su.user_id
+ <where>
+ deleted = 0
+ <if test="ew.id != null">
+ and ai.id = #{ew.id}
+ </if>
+ <if test="ew.instanceNo != null">
+ and ai.instance_no like concat('%',#{ew.instanceNo},'%')
+ </if>
+ <if test="ew.templateName != null">
+ and ai.template_name like concat('%',#{ew.templateName},'%')
+ </if>
+ <if test="ew.templateId != null ">
+ and ai. template_id = #{ew.templateId}
+ </if>
+ <if test="ew.businessType != null ">
+ and ai.business_type = #{ew.businessType}
+ </if>
+ <if test="ew.createTimeStart != null and ew.createTimeEnd != null">
+ and ai.apply_time >= #{ew.createTimeStart}
+ and ai.apply_time <= #{ew.createTimeEnd}
+ </if>
+ <if test="ew.status != null">
+ and ai.status = #{ew.status}
+ </if>
+ <if test="ew.applicantName != null and ew.applicantName !=''">
+ and ai.applicant_name = #{ew.applicantName}
+ </if>
+ </where>
+ order by ai.create_time desc
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApprovalInstanceNodeMapper.xml b/src/main/resources/mapper/approve/ApprovalInstanceNodeMapper.xml
new file mode 100644
index 0000000..560271b
--- /dev/null
+++ b/src/main/resources/mapper/approve/ApprovalInstanceNodeMapper.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.ApprovalInstanceNodeMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.ApprovalInstanceNode">
+ <id column="id" property="id" />
+ <result column="instance_id" property="instanceId" />
+ <result column="level_no" property="levelNo" />
+ <result column="approve_type" property="approveType" />
+ <result column="status" property="status" />
+ <result column="start_time" property="startTime" />
+ <result column="finish_time" property="finishTime" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="deleted" property="deleted" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApprovalRecordMapper.xml b/src/main/resources/mapper/approve/ApprovalRecordMapper.xml
new file mode 100644
index 0000000..db40692
--- /dev/null
+++ b/src/main/resources/mapper/approve/ApprovalRecordMapper.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.ApprovalRecordMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.ApprovalRecord">
+ <id column="id" property="id" />
+ <result column="instance_id" property="instanceId" />
+ <result column="node_id" property="nodeId" />
+ <result column="task_id" property="taskId" />
+ <result column="operator_id" property="operatorId" />
+ <result column="operator_name" property="operatorName" />
+ <result column="action" property="action" />
+ <result column="comment" property="comment" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="deleted" property="deleted" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApprovalTaskMapper.xml b/src/main/resources/mapper/approve/ApprovalTaskMapper.xml
new file mode 100644
index 0000000..c079440
--- /dev/null
+++ b/src/main/resources/mapper/approve/ApprovalTaskMapper.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.ApprovalTaskMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.ApprovalTask">
+ <id column="id" property="id" />
+ <result column="instance_id" property="instanceId" />
+ <result column="node_id" property="nodeId" />
+ <result column="level_no" property="levelNo" />
+ <result column="approver_id" property="approverId" />
+ <result column="approver_name" property="approverName" />
+ <result column="task_status" property="taskStatus" />
+ <result column="approve_time" property="approveTime" />
+ <result column="comment" property="comment" />
+ <result column="is_read" property="isRead" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="deleted" property="deleted" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApprovalTemplateMapper.xml b/src/main/resources/mapper/approve/ApprovalTemplateMapper.xml
new file mode 100644
index 0000000..a48432b
--- /dev/null
+++ b/src/main/resources/mapper/approve/ApprovalTemplateMapper.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.ApprovalTemplateMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.ApprovalTemplate">
+ <id column="id" property="id" />
+ <result column="template_name" property="templateName" />
+ <result column="enabled" property="enabled" />
+ <result column="description" property="description" />
+ <result column="deleted" property="deleted" />
+ <result column="dept_id" property="deptId" />
+ </resultMap>
+ <select id="listPage" resultType="com.ruoyi.approve.bean.vo.ApprovalTemplateVo">
+ select at.*,su.nick_name as create_user_name from
+ approval_template at
+ left join sys_user su on at.create_user = su.user_id
+ <where>
+ deleted = 0
+ <if test="ew.templateName != null">
+ and template_name like concat('%',#{ew.templateName},'%')
+ </if>
+ <if test="ew.templateType != null">
+ and template_type = #{ew.templateType}
+ </if>
+ <if test="ew.enabled != null">
+ and enabled = #{ew.enabled}
+ </if>
+ </where>
+ order by at.id desc
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApprovalTemplateNodeApproverMapper.xml b/src/main/resources/mapper/approve/ApprovalTemplateNodeApproverMapper.xml
new file mode 100644
index 0000000..dac42cc
--- /dev/null
+++ b/src/main/resources/mapper/approve/ApprovalTemplateNodeApproverMapper.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.ApprovalTemplateNodeApproverMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.ApprovalTemplateNodeApprover">
+ <id column="id" property="id" />
+ <result column="node_id" property="nodeId" />
+ <result column="template_id" property="templateId" />
+ <result column="approver_id" property="approverId" />
+ <result column="approver_name" property="approverName" />
+ <result column="sort_no" property="sortNo" />
+ <result column="created_time" property="createdTime" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApprovalTemplateNodeMapper.xml b/src/main/resources/mapper/approve/ApprovalTemplateNodeMapper.xml
new file mode 100644
index 0000000..7956787
--- /dev/null
+++ b/src/main/resources/mapper/approve/ApprovalTemplateNodeMapper.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.ApprovalTemplateNodeMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.ApprovalTemplateNode">
+ <id column="id" property="id" />
+ <result column="template_id" property="templateId" />
+ <result column="level_no" property="levelNo" />
+ <result column="approve_type" property="approveType" />
+ <result column="created_time" property="createdTime" />
+ <result column="updated_time" property="updatedTime" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/ApproveProcessMapper.xml b/src/main/resources/mapper/approve/ApproveProcessMapper.xml
index fef06f7..f3e628f 100644
--- a/src/main/resources/mapper/approve/ApproveProcessMapper.xml
+++ b/src/main/resources/mapper/approve/ApproveProcessMapper.xml
@@ -20,12 +20,14 @@
<result property="tenantId" column="tenant_id" />
<result property="approveType" column="approve_type" />
<result property="approveRemark" column="approve_remark" />
+ <result property="startDateTime" column="start_date_time" />
+ <result property="endDateTime" column="end_date_time" />
</resultMap>
<sql id="Base_Column_List">
id,approve_id,approve_user,approve_dept_id,approve_dept_name,approve_user_ids,
approve_user_names,approve_reason,approve_time,approve_over_time,approve_status,
- approve_delete,tenant_id,approve_type,approve_remark
+ approve_delete,tenant_id,approve_type,approve_remark,start_date_time,end_date_time
</sql>
<select id="listPage" resultType="com.ruoyi.approve.vo.ApproveProcessVo">
select * from approve_process where approve_delete = 0
@@ -38,5 +40,6 @@
<if test="req.approveType != null ">
and approve_type = #{req.approveType}
</if>
+ order by id desc
</select>
</mapper>
diff --git a/src/main/resources/mapper/approve/FinReimbursementDetailMapper.xml b/src/main/resources/mapper/approve/FinReimbursementDetailMapper.xml
new file mode 100644
index 0000000..f8a67bb
--- /dev/null
+++ b/src/main/resources/mapper/approve/FinReimbursementDetailMapper.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.FinReimbursementDetailMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.FinReimbursementDetail">
+ <id column="id" property="id" />
+ <result column="reimbursement_id" property="reimbursementId" />
+ <result column="row_no" property="rowNo" />
+ <result column="invoice_date" property="invoiceDate" />
+ <result column="expense_category" property="expenseCategory" />
+ <result column="amount" property="amount" />
+ <result column="description" property="description" />
+ <result column="invoice_no" property="invoiceNo" />
+ <result column="invoice_type" property="invoiceType" />
+ <result column="invoice_amount" property="invoiceAmount" />
+ <result column="tax_rate" property="taxRate" />
+ <result column="tax_amount" property="taxAmount" />
+ <result column="remark" property="remark" />
+ <result column="tenant_id" property="tenantId" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ <result column="deleted" property="deleted" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/FinReimbursementMapper.xml b/src/main/resources/mapper/approve/FinReimbursementMapper.xml
new file mode 100644
index 0000000..6b4931c
--- /dev/null
+++ b/src/main/resources/mapper/approve/FinReimbursementMapper.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.FinReimbursementMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.FinReimbursement">
+ <id column="id" property="id" />
+ <result column="bill_no" property="billNo" />
+ <result column="reimbursement_type" property="reimbursementType" />
+ <result column="expense_type" property="expenseType" />
+ <result column="applicant_id" property="applicantId" />
+ <result column="applicant_code" property="applicantCode" />
+ <result column="applicant_name" property="applicantName" />
+ <result column="applicant_dept_id" property="applicantDeptId" />
+ <result column="applicant_dept_name" property="applicantDeptName" />
+ <result column="reason" property="reason" />
+ <result column="apply_amount" property="applyAmount" />
+ <result column="detail_total_amount" property="detailTotalAmount" />
+ <result column="payee_name" property="payeeName" />
+ <result column="payee_account" property="payeeAccount" />
+ <result column="payee_bank" property="payeeBank" />
+ <result column="approval_instance_id" property="approvalInstanceId" />
+ <result column="approve_process_id" property="approveProcessId" />
+ <result column="bill_status" property="billStatus" />
+ <result column="approved_time" property="approvedTime" />
+ <result column="paid_time" property="paidTime" />
+ <result column="account_expense_id" property="accountExpenseId" />
+ <result column="remark" property="remark" />
+ <result column="tenant_id" property="tenantId" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ <result column="deleted" property="deleted" />
+ </resultMap>
+ <select id="listPage" resultType="com.ruoyi.approve.bean.vo.FinReimbursementVo">
+ select fin_reimbursement.*,
+ fin_reimbursement_travel.start_time ,
+ fin_reimbursement_travel.end_time
+ from
+ fin_reimbursement
+ left join fin_reimbursement_travel on fin_reimbursement.id = fin_reimbursement_travel.reimbursement_id
+ <where>
+ <if test="ew.billNo != null and ew.billNo != ''">
+ bill_no like concat('%',#{ew.billNo},'%')
+ </if>
+ <if test="ew.applicantName != null and ew.applicantName != ''">
+ and applicant_name like concat('%',#{ew.applicantName},'%')
+ </if>
+ <if test="ew.applicantCode != null and ew.applicantCode != ''">
+ and applicant_code like concat('%',#{ew.applicantCode},'%')
+ </if>
+ <if test="ew.createTimeStart != null and ew.createTimeStart !='' and ew.createTimeEnd != null and ew.createTimeEnd != ''">
+ and create_time >= #{ew.createTimeStart}
+ and create_time <= #{ew.createTimeEnd}
+ </if>
+ </where>
+ order by create_time desc
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/FinReimbursementTravelMapper.xml b/src/main/resources/mapper/approve/FinReimbursementTravelMapper.xml
new file mode 100644
index 0000000..dc42863
--- /dev/null
+++ b/src/main/resources/mapper/approve/FinReimbursementTravelMapper.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.approve.mapper.FinReimbursementTravelMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.approve.pojo.FinReimbursementTravel">
+ <id column="id" property="id" />
+ <result column="reimbursement_id" property="reimbursementId" />
+ <result column="start_time" property="startTime" />
+ <result column="end_time" property="endTime" />
+ <result column="travel_days" property="travelDays" />
+ <result column="departure_city" property="departureCity" />
+ <result column="destination_city" property="destinationCity" />
+ <result column="hotel_standard" property="hotelStandard" />
+ <result column="lodging_days" property="lodgingDays" />
+ <result column="meal_allowance" property="mealAllowance" />
+ <result column="transport_allowance" property="transportAllowance" />
+ <result column="lodging_limit" property="lodgingLimit" />
+ <result column="standard_tag" property="standardTag" />
+ <result column="within_standard" property="withinStandard" />
+ <result column="tenant_id" property="tenantId" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml b/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml
index e4819c2..8d41ef1 100644
--- a/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml
+++ b/src/main/resources/mapper/approve/KnowledgeBaseMapper.xml
@@ -16,6 +16,6 @@
and type = #{knowledgeBase.type}
</if>
</where>
-
+ order by id desc
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/basic/CustomerMapper.xml b/src/main/resources/mapper/basic/CustomerMapper.xml
index 57dea6c..ffaff4e 100644
--- a/src/main/resources/mapper/basic/CustomerMapper.xml
+++ b/src/main/resources/mapper/basic/CustomerMapper.xml
@@ -22,7 +22,14 @@
from customer_user cu
where cu.customer_id = c.id
and cu.user_id != c.usage_user
- ) as user_ids_str
+ ) as user_ids_str,
+ CASE
+ WHEN EXISTS (SELECT 1 FROM sales_ledger sl WHERE sl.customer_id = c.id)
+ OR EXISTS (SELECT 1 FROM sales_quotation sq WHERE sq.customer_id = c.id)
+ OR EXISTS (SELECT 1 FROM return_management rm WHERE rm.customer_id = c.id)
+ THEN 1
+ ELSE 0
+ END AS sales_reference_flag
from customer c
left join sys_user u on c.usage_user = u.user_id
<where>
@@ -52,6 +59,7 @@
)
</if>
</where>
+ order by c.id desc
</select>
<select id="list" resultType="com.ruoyi.basic.vo.CustomerVo">
@@ -70,7 +78,14 @@
from customer_user cu
where cu.customer_id = c.id
and cu.user_id != c.usage_user
- ) as user_ids_str
+ ) as user_ids_str,
+ CASE
+ WHEN EXISTS (SELECT 1 FROM sales_ledger sl WHERE sl.customer_id = c.id)
+ OR EXISTS (SELECT 1 FROM sales_quotation sq WHERE sq.customer_id = c.id)
+ OR EXISTS (SELECT 1 FROM return_management rm WHERE rm.customer_id = c.id)
+ THEN 1
+ ELSE 0
+ END AS sales_reference_flag
from customer c
left join sys_user u on c.usage_user = u.user_id
<where>
@@ -106,5 +121,67 @@
)
</if>
</where>
+ order by c.id desc
</select>
-</mapper>
\ No newline at end of file
+ <select id="customewTransactions" resultType="com.ruoyi.sales.vo.CustomerTransactionsVo">
+ select T1.customer_id,
+ c.customer_name,
+ T1.contractAmounts AS contractAmounts,
+ IFNULL(T2.receiptPaymentAmount, 0) AS receiptPaymentAmount,
+ T1.contractAmounts - IFNULL(T2.receiptPaymentAmount, 0) - IFNULL(T4.returnAmount, 0) AS receiptableAmount,
+ IFNULL(T4.returnAmount, 0) AS returnAmount
+ from (select customer_id, sum(contract_amount) as contractAmounts from sales_ledger group by customer_id) T1
+ left join (select customer_id, sum(collection_amount) as receiptPaymentAmount from account_sales_collection group by customer_id) T2 on T1.customer_id = T2.customer_id
+ left join (
+ select
+ sl.customer_id,
+ sum(rm.refund_amount) as returnAmount
+ from return_management rm
+ left join shipping_info si on rm.shipping_id = si.id
+ left join sales_ledger sl on si.sales_ledger_id = sl.id
+ where rm.status=1
+ group by sl.customer_id
+ ) T4 on T4.customer_id=T1.customer_id
+ left join customer c on T1.customer_id = c.id
+ <where>
+ <if test="customerName!=null and customerName!=''">
+ AND c.customer_name LIKE CONCAT('%', #{customerName}, '%')
+ </if>
+ </where>
+ order by T1.customer_id desc
+ </select>
+ <select id="customewTransactionsDetails"
+ resultType="com.ruoyi.sales.vo.CustomerTransactionsDetailsVo">
+ select sl.id salesLedgerId,
+ sl.sales_contract_no,
+ sl.execution_date,
+ sl.contract_amount AS contract_amount,
+ IFNULL(T1.receiptPaymentAmount, 0) AS receiptPaymentAmount,
+ sl.contract_amount - IFNULL(T1.receiptPaymentAmount, 0) - IFNULL(T3.returnAmount, 0) AS receiptableAmount,
+ IFNULL(T3.returnAmount, 0) AS returnAmount
+ from sales_ledger sl
+ left join (
+ select
+ sl.id,
+ sum(ascc.collection_amount) as receiptPaymentAmount
+ from account_sales_collection ascc
+ left join stock_out_record sor on FIND_IN_SET(sor.id, ascc.stock_out_record_ids) > 0
+ left join shipping_info s on sor.record_id = s.id
+ LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
+ WHERE sor.record_type='13'
+ and sor.approval_status=1
+ group by sl.id
+ )T1 on T1.id = sl.id
+ left join (
+ select sl.id,
+ sum(rm.refund_amount) as returnAmount
+ from return_management rm
+ left join shipping_info si on rm.shipping_id = si.id
+ left join sales_ledger sl on si.sales_ledger_id = sl.id
+ where rm.status=1
+ group by sl.id
+ )T3 on T3.id = sl.id
+ where sl.customer_id = #{customerId}
+ order by sl.id desc
+ </select>
+</mapper>
diff --git a/src/main/resources/mapper/basic/ProductModelMapper.xml b/src/main/resources/mapper/basic/ProductModelMapper.xml
index 0a540bf..6270b1d 100644
--- a/src/main/resources/mapper/basic/ProductModelMapper.xml
+++ b/src/main/resources/mapper/basic/ProductModelMapper.xml
@@ -9,7 +9,6 @@
<result column="product_id" property="productId" />
<result column="model" property="model" />
<result column="unit" property="unit" />
- <result column="speculative_trading_name" property="speculativeTradingName" />
<result column="tenant_id" property="tenantId" />
<result column="product_name" property="productName" />
<result column="product_id" property="productId" />
diff --git a/src/main/resources/mapper/basic/SupplierManageMapper.xml b/src/main/resources/mapper/basic/SupplierManageMapper.xml
index 87688e1..63bdf7e 100644
--- a/src/main/resources/mapper/basic/SupplierManageMapper.xml
+++ b/src/main/resources/mapper/basic/SupplierManageMapper.xml
@@ -35,6 +35,7 @@
AND T1.is_white = #{supplierManageDto.isWhite}
</if>
</where>
+ order by T1.id desc
</select>
<select id="supplierExportList" resultType="com.ruoyi.basic.excel.SupplierManageExcelDto">
@@ -68,5 +69,65 @@
</if>
</where>
</select>
+ <select id="supplierTransactions" resultType="com.ruoyi.purchase.vo.SupplierTransactionsVo">
+ select T1.supplier_id,
+ sm.supplier_name,
+ T1.contractAmounts,
+ IFNULL(T2.paymentAmount, 0) AS paymentAmount,
+ T1.contractAmounts - IFNULL(T2.paymentAmount, 0) - IFNULL(T4.returnAmount, 0) AS payableAmount,
+ IFNULL(T4.returnAmount, 0) AS returnAmount
+ from (select supplier_id, sum(contract_amount) as contractAmounts from purchase_ledger group by supplier_id) T1
+ left join (select supplier_id, sum(payment_amount) as paymentAmount from account_purchase_payment group by supplier_id) T2 on T1.supplier_id = T2.supplier_id
+ left join (
+ select
+ supplier_id,
+ sum(total_amount) as returnAmount
+ from purchase_return_orders pro
+ group by supplier_id
+ ) T4 on T4.supplier_id=T1.supplier_id
+ left join supplier_manage sm on T1.supplier_id = sm.id
+ <where>
+ <if test="supplierName!=null and supplierName!=''">
+ AND sm.supplier_name LIKE CONCAT('%',#{supplierName},'%')
+ </if>
+ </where>
+ order by T1.supplier_id desc
+ </select>
+ <select id="supplierTransactionsDetails"
+ resultType="com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo">
+ select pl.id purchaseLedgerId,
+ pl.purchase_contract_number,
+ pl.execution_date,
+ pl.contract_amount AS contract_amount,
+ IFNULL(T1.paymentAmount, 0) AS paymentAmount,
+ pl.contract_amount - IFNULL(T1.paymentAmount, 0) - IFNULL(T3.returnAmount, 0) AS payableAmount,
+ IFNULL(T3.returnAmount, 0) AS returnAmount
+ from purchase_ledger pl
+ left join (
+ select
+ pl.id,
+ sum(app.payment_amount) as paymentAmount
+ from account_purchase_payment app
+ left join account_payment_application apa on app.account_payment_application_id = apa.id
+ left join stock_in_record sir on FIND_IN_SET(sir.id, apa.stock_in_record_ids) > 0
+ -- 10 绫诲瀷鎵嶅叧鑱旇川妫�琛�
+ LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id
+ -- 鍔ㄦ�佸叧鑱旈噰璐紙鑷姩閫傞厤 7 鍜� 10锛�
+ LEFT JOIN purchase_ledger pl
+ ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id)
+ WHERE sir.approval_status = 1
+ AND sir.record_type IN ('7','10')
+ group by pl.id
+ )T1 on T1.id = pl.id
+ left join (
+ select pl.id,
+ sum(pro.total_amount) as returnAmount
+ from purchase_return_orders pro
+ left join purchase_ledger pl on pro.purchase_ledger_id = pl.id
+ group by pl.id
+ )T3 on T3.id = pl.id
+ where pl.supplier_id = #{supplierId}
+ order by pl.id desc
+ </select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsMapper.xml b/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsMapper.xml
new file mode 100644
index 0000000..830a858
--- /dev/null
+++ b/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsMapper.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.collaborativeApproval.pojo.EnterpriseNews">
+ <id column="id" property="id" />
+ <result column="title" property="title" />
+ <result column="summary" property="summary" />
+ <result column="content" property="content" />
+ <result column="category" property="category" />
+ <result column="read_scope" property="readScope" />
+ <result column="is_required" property="isRequired" />
+ <result column="status" property="status" />
+ <result column="required_read_count" property="requiredReadCount" />
+ <result column="read_count" property="readCount" />
+ <result column="create_user" property="createUser" />
+ <result column="create_time" property="createTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="dept_id" property="deptId" />
+ </resultMap>
+ <select id="listPage" resultType="com.ruoyi.collaborativeApproval.vo.EnterpriseNewsVo">
+ select en.*, u.nick_name as create_user_name from
+ enterprise_news en
+ left join sys_user u on en.create_user = u.user_id
+ <where>
+ <if test="enterpriseNewsDto.title != null and enterpriseNewsDto.title != ''">
+ and en.title like concat('%',#{enterpriseNewsDto.title},'%')
+ </if>
+ <if test="enterpriseNewsDto.category != null and enterpriseNewsDto.category != ''">
+ and en.category = #{enterpriseNewsDto.category}
+ </if>
+ <if test="enterpriseNewsDto.status != null ">
+ and en.status = #{enterpriseNewsDto.status}
+ </if>
+ <if test="enterpriseNewsDto.createUser != null and enterpriseNewsDto.createUser != ''">
+ and en.create_user = #{enterpriseNewsDto.createUser}
+ </if>
+ <if test="enterpriseNewsDto.createTimeStart != null and enterpriseNewsDto.createTimeEnd != null">
+ and en.create_time between #{enterpriseNewsDto.createTimeStart} and #{enterpriseNewsDto.createTimeEnd}
+ </if>
+ </where>
+ order by en.create_time desc
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeDeptMapper.xml b/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeDeptMapper.xml
new file mode 100644
index 0000000..0b13f67
--- /dev/null
+++ b/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeDeptMapper.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeDeptMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeDept">
+ <id column="id" property="id" />
+ <result column="news_id" property="newsId" />
+ <result column="dept_id" property="deptId" />
+ <result column="create_time" property="createTime" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeUserMapper.xml b/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeUserMapper.xml
new file mode 100644
index 0000000..7f4ac4b
--- /dev/null
+++ b/src/main/resources/mapper/collaborativeApproval/EnterpriseNewsScopeUserMapper.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.collaborativeApproval.mapper.EnterpriseNewsScopeUserMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.collaborativeApproval.pojo.EnterpriseNewsScopeUser">
+ <id column="id" property="id" />
+ <result column="news_id" property="newsId" />
+ <result column="user_id" property="userId" />
+ <result column="create_time" property="createTime" />
+ </resultMap>
+
+</mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml b/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml
index 08cf865..06acc33 100644
--- a/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/NoticeMapper.xml
@@ -17,5 +17,6 @@
and n.status = #{ew.status}
</if>
</where>
+ order by n.create_time desc
</select>
</mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml b/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml
index 03dc024..9ae4b8d 100644
--- a/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/RulesRegulationsManagementMapper.xml
@@ -27,5 +27,6 @@
and rrm.category = #{ew.category}
</if>
</where>
+ order by rrm.id desc
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml b/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
index 5da6dff..53b2f3c 100644
--- a/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
@@ -4,13 +4,27 @@
<select id="listPage" resultType="com.ruoyi.collaborativeApproval.dto.SealApplicationManagementDTO">
- select sam.*, su.user_name as create_user_name, d.dept_name as department,
- su1.nick_name as approveUserName
- from seal_application_management sam
- left join sys_user su on sam.create_user = su.user_id
- left join sys_user su1 on sam.approve_user_id = su1.user_id
- left join sys_user_dept sud on su.user_id = sud.user_id
- left join sys_dept d on sud.dept_id = d.dept_id
+ SELECT
+ sam.*,
+ su.user_name AS create_user_name,
+
+ GROUP_CONCAT(DISTINCT d.dept_name ORDER BY d.dept_id SEPARATOR ',') AS department,
+
+ su1.nick_name AS approveUserName
+
+ FROM seal_application_management sam
+
+ LEFT JOIN sys_user su
+ ON sam.create_user = su.user_id
+
+ LEFT JOIN sys_user su1
+ ON sam.approve_user_id = su1.user_id
+
+ LEFT JOIN sys_user_dept sud
+ ON su.user_id = sud.user_id
+
+ LEFT JOIN sys_dept d
+ ON sud.dept_id = d.dept_id
<where>
<if test="ew.applicationNum != null and ew.applicationNum != ''">
and sam.application_num like concat('%',#{ew.applicationNum},'%')
@@ -22,5 +36,7 @@
and sam.status = #{ew.status}
</if>
</where>
+ GROUP BY sam.id
+ order by sam.id desc
</select>
</mapper>
diff --git a/src/main/resources/mapper/device/DeviceLedgerMapper.xml b/src/main/resources/mapper/device/DeviceLedgerMapper.xml
index c980120..f3b674e 100644
--- a/src/main/resources/mapper/device/DeviceLedgerMapper.xml
+++ b/src/main/resources/mapper/device/DeviceLedgerMapper.xml
@@ -88,7 +88,7 @@
where id = #{id}
</select>
<select id="getDeviceTypeDistributionByYear"
- resultType="com.ruoyi.account.dto.DeviceTypeDetail"
+ resultType="com.ruoyi.account.bean.dto.DeviceTypeDetail"
parameterType="java.lang.Integer">
SELECT
`type`,
diff --git a/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml b/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
index e21669f..cb05e72 100644
--- a/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
+++ b/src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
@@ -26,7 +26,6 @@
left join device_ledger dl on dm.device_ledger_id = dl.id
left join sys_user su on dm.create_user = su.user_id
<where>
- 1 = 1
<if test="deviceMaintenanceDto.deviceName != null">
and dl.device_name like concat('%',#{deviceMaintenanceDto.deviceName},'%')
</if>
@@ -50,6 +49,7 @@
and dm.maintenance_actually_time < date_add(str_to_date(#{deviceMaintenanceDto.maintenanceActuallyTime}, '%Y-%m-%d'), interval 1 day)
</if>
</where>
+ order by dm.create_time desc
</select>
<select id="detailById" resultType="com.ruoyi.device.vo.DeviceMaintenanceVo">
select dm.id,
diff --git a/src/main/resources/mapper/device/DeviceRepairMapper.xml b/src/main/resources/mapper/device/DeviceRepairMapper.xml
index 2eb1d29..10a0abf 100644
--- a/src/main/resources/mapper/device/DeviceRepairMapper.xml
+++ b/src/main/resources/mapper/device/DeviceRepairMapper.xml
@@ -11,10 +11,13 @@
dr.repair_time,
dr.repair_name,
dr.remark,
- dr.maintenance_name,
- dr.maintenance_time,
- dr.maintenance_result,
- dr.status,
+ dr.maintenance_name,
+ dr.maintenance_time,
+ dr.maintenance_result,
+ dr.acceptance_name,
+ dr.acceptance_time,
+ dr.acceptance_remark,
+ dr.status,
dr.create_time,
dr.update_time,
dr.create_user,
@@ -26,7 +29,6 @@
from device_repair dr
left join device_ledger dl on dr.device_ledger_id = dl.id
<where>
- 1 = 1
<if test="deviceRepairDto.deviceName != null">
and dl.device_name like concat('%',#{deviceRepairDto.deviceName},'%')
</if>
@@ -50,6 +52,7 @@
and dr.maintenance_time like concat('%',#{deviceRepairDto.maintenanceTimeStr},'%')
</if>
</where>
+ order by dr.create_time desc
</select>
<select id="detailById" resultType="com.ruoyi.device.vo.DeviceRepairVo">
select dr.id,
@@ -60,6 +63,9 @@
dr.maintenance_name,
dr.maintenance_time,
dr.maintenance_result,
+ dr.acceptance_name,
+ dr.acceptance_time,
+ dr.acceptance_remark,
dr.status,
dr.create_time,
dr.update_time,
diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
index e4200af..7de15bd 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
@@ -15,7 +15,9 @@
next_date,
record_date,
CASE
- WHEN most_date >= DATE_FORMAT(now(),'%Y-%m-%d') THEN 1
+ WHEN most_date IS NOT NULL
+ AND valid IS NOT NULL
+ AND DATE_ADD(most_date, INTERVAL valid DAY) >= CURDATE() THEN 1
ELSE 2
END AS status,
create_user,
@@ -40,10 +42,16 @@
<if test="req.status != null">
<choose>
<when test="req.status == 1">
- AND most_date >= DATE_FORMAT(now(),'%Y-%m-%d')
+ AND most_date IS NOT NULL
+ AND valid IS NOT NULL
+ AND DATE_ADD(most_date, INTERVAL valid DAY) >= CURDATE()
</when>
<when test="req.status == 2">
- AND most_date < DATE_FORMAT(now(),'%Y-%m-%d')
+ AND (
+ most_date IS NULL
+ OR valid IS NULL
+ OR DATE_ADD(most_date, INTERVAL valid DAY) < CURDATE()
+ )
</when>
</choose>
</if>
@@ -54,6 +62,6 @@
AND record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
</if>
</where>
- ORDER BY update_time DESC
+ ORDER BY create_time DESC
</select>
</mapper>
diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerRecordMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerRecordMapper.xml
index 69446e0..e01ef1e 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerRecordMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerRecordMapper.xml
@@ -32,7 +32,7 @@
AND t1.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
</if>
</where>
- ORDER BY t1.update_time DESC
+ ORDER BY t1.create_time DESC
</select>
<select id="list" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord">
SELECT
@@ -65,4 +65,4 @@
</where>
ORDER BY t1.update_time DESC
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml
index 611d51e..301ff6f 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/SparePartsMapper.xml
@@ -10,5 +10,6 @@
and sp.name like concat('%',#{spareParts.name},'%')
</if>
</where>
+ order by sp.create_time desc
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/measuringinstrumentledger/SparePartsRequisitionRecordMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/SparePartsRequisitionRecordMapper.xml
index 9851e59..0f18391 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/SparePartsRequisitionRecordMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/SparePartsRequisitionRecordMapper.xml
@@ -32,5 +32,6 @@
and sprr.source_type = #{params.sourceType}
</if>
</where>
+ order by sprr.create_time desc
</select>
</mapper>
diff --git a/src/main/resources/mapper/oA/OaProjectMapper.xml b/src/main/resources/mapper/oA/OaProjectMapper.xml
deleted file mode 100644
index c245a39..0000000
--- a/src/main/resources/mapper/oA/OaProjectMapper.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.oA.mapper.OaProjectMapper">
-
-
- <select id="listPage" resultType="com.ruoyi.oA.dto.OaProjectDto">
- select op.*,su.nick_name as managerName from oa_project op
- LEFT JOIN sys_user su ON op.manager_id=su.user_id
- <where>
- 1=1
- <if test="req.projectName != null and req.projectName != ''">
- and op.project_name like concat('%',#{req.projectName},'%')
- </if>
- <if test="req.managerName != null and req.managerName != ''">
- and su.nick_name like concat('%',#{req.managerName},'%')
- </if>
- <if test="req.status != null and req.status != ''">
- and op.status = #{req.status}
- </if>
- </where>
- </select>
- <select id="selectByIds" resultType="com.ruoyi.oA.dto.OaProjectDto">
- select op.*,su.nick_name as managerName from oa_project op
- LEFT JOIN sys_user su ON op.manager_id=su.user_id
- where op.project_id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
-</mapper>
diff --git a/src/main/resources/mapper/oA/OaProjectPhaseMapper.xml b/src/main/resources/mapper/oA/OaProjectPhaseMapper.xml
deleted file mode 100644
index 2f52fe9..0000000
--- a/src/main/resources/mapper/oA/OaProjectPhaseMapper.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.oA.mapper.OaProjectPhaseMapper">
-
- <resultMap id="BaseResultMap" type="com.ruoyi.oA.pojo.OaProjectPhase">
- <id property="phaseId" column="phase_id" jdbcType="INTEGER"/>
- <result property="phaseName" column="phase_name" jdbcType="VARCHAR"/>
- <result property="oaProjectId" column="oa_project_id" jdbcType="INTEGER"/>
- <result property="startDate" column="start_date" jdbcType="TIMESTAMP"/>
- <result property="endDate" column="end_date" jdbcType="TIMESTAMP"/>
- <result property="status" column="status" jdbcType="VARCHAR"/>
- <result property="createUser" column="create_user" jdbcType="BIGINT"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateUser" column="update_user" jdbcType="BIGINT"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="tenantId" column="tenant_id" jdbcType="BIGINT"/>
- </resultMap>
-
- <sql id="Base_Column_List">
- phase_id,phase_name,oa_project_id,
- start_date,end_date,status,
- create_user,create_time,update_user,
- update_time,tenant_id
- </sql>
-</mapper>
diff --git a/src/main/resources/mapper/oA/OaProjectPhaseTaskMapper.xml b/src/main/resources/mapper/oA/OaProjectPhaseTaskMapper.xml
deleted file mode 100644
index cc029d9..0000000
--- a/src/main/resources/mapper/oA/OaProjectPhaseTaskMapper.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.oA.mapper.OaProjectPhaseTaskMapper">
-
- <resultMap id="BaseResultMap" type="com.ruoyi.oA.pojo.OaProjectPhaseTask">
- <id property="taskId" column="task_id" jdbcType="INTEGER"/>
- <result property="taskName" column="task_name" jdbcType="VARCHAR"/>
- <result property="phaseId" column="phase_id" jdbcType="INTEGER"/>
- <result property="startDate" column="start_date" jdbcType="TIMESTAMP"/>
- <result property="endDate" column="end_date" jdbcType="TIMESTAMP"/>
- <result property="targetDate" column="target_date" jdbcType="TIMESTAMP"/>
- <result property="targetValue" column="target_value" jdbcType="INTEGER"/>
- <result property="currentValue" column="current_value" jdbcType="INTEGER"/>
- <result property="unit" column="unit" jdbcType="VARCHAR"/>
- <result property="status" column="status" jdbcType="VARCHAR"/>
- <result property="completionRate" column="completion_rate" jdbcType="INTEGER"/>
- <result property="createUser" column="create_user" jdbcType="BIGINT"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateUser" column="update_user" jdbcType="BIGINT"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="tenantId" column="tenant_id" jdbcType="BIGINT"/>
- </resultMap>
-
- <sql id="Base_Column_List">
- task_id,task_name,phase_id,
- start_date,end_date,target_date,
- target_value,current_value,unit,
- status,completion_rate,create_user,
- create_time,update_user,update_time,
- tenant_id
- </sql>
-</mapper>
diff --git a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
index b0166ca..f1a87ca 100644
--- a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
@@ -2,7 +2,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper">
- <select id="listProcurementBySalesLedgerId" resultType="com.ruoyi.procurementrecord.dto.ProcurementDto">
+ <select id="listProcurementBySalesLedgerId" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementDto">
select
t1.supplier_name,
t2.product_category,
@@ -28,7 +28,7 @@
</if>
group by t2.id
</select>
- <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
+ <select id="listPage" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto">
select
t3.supplier_name,
t3.purchase_contract_number,
@@ -68,7 +68,7 @@
</where>
order by t1.create_time desc
</select>
- <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
+ <select id="list" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto">
select
t3.supplier_name,
t3.purchase_contract_number,
@@ -92,7 +92,7 @@
left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
where t1.type = 1
</select>
- <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
+ <select id="listOne" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto">
select
t3.customer_contract_no,
t3.sales_contract_no,
@@ -117,7 +117,7 @@
left join sales_ledger t3 on t3.id = t2.sales_ledger_id
where t1.type = 2
</select>
- <select id="listPageCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
+ <select id="listPageCopy" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy">
select
t3.supplier_name,
t3.purchase_contract_number,
@@ -175,7 +175,7 @@
group by t3.supplier_name,t2.product_category,t2.specification_model,t1.unit_price
order by t1.create_time desc
</select>
- <select id="listCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
+ <select id="listCopy" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy">
select
t3.supplier_name,
t3.purchase_contract_number,
@@ -203,7 +203,7 @@
where t1.type = 1
group by t3.supplier_name,t2.product_category,t2.specification_model
</select>
- <select id="listCopyOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
+ <select id="listCopyOne" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy">
select
t3.customer_contract_no,
t3.sales_contract_no,
@@ -232,7 +232,7 @@
where t1.type = 2
group by t3.customer_name,t2.product_category,t2.specification_model
</select>
- <select id="listPageByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
+ <select id="listPageByProduction" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto">
select
t3.customer_contract_no,
t3.sales_contract_no,
@@ -274,7 +274,7 @@
</where>
order by t1.create_time desc
</select>
- <select id="listPageCopyByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
+ <select id="listPageCopyByProduction" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy">
select
t3.customer_contract_no,
t3.sales_contract_no,
@@ -336,7 +336,7 @@
group by t2.product_category,t2.specification_model,t1.unit_price
order by t1.create_time desc
</select>
- <select id="listPagePRS" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
+ <select id="listPagePRS" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDtoCopy">
select *
from procurement_record_storage t1
left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
@@ -358,7 +358,7 @@
from procurement_record_storage
where product_model_id = #{productModelId}
</select>
- <select id="listPageByProductProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
+ <select id="listPageByProductProduction" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementPageDto">
select
t1.*,
t1.inbound_num as inboundNum0,
@@ -380,4 +380,4 @@
</where>
order by t1.create_time desc
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml b/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml
index adc64dd..46925aa 100644
--- a/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml
@@ -2,7 +2,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper">
- <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+ <select id="listPage" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto">
select
t3.supplier_name,
t2.product_category,
@@ -38,7 +38,7 @@
</where>
order by t1.create_time desc
</select>
- <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+ <select id="list" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto">
select t3.supplier_name,
t2.product_category,
t1.id,
@@ -58,7 +58,7 @@
where t1.type = 1
</select>
- <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+ <select id="listOne" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto">
select t3.customer_contract_no,
t3.sales_contract_no,
t3.customer_name,
@@ -80,7 +80,7 @@
where t1.type = 2
</select>
- <select id="listTwo" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+ <select id="listTwo" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto">
select t1.supplier_name,
t1.product_category,
t1.id,
@@ -97,7 +97,7 @@
from procurement_record_out t1
where t1.type = 3
</select>
- <select id="listPageByProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+ <select id="listPageByProduct" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto">
select
t3.customer_contract_no,
t3.sales_contract_no,
@@ -134,7 +134,7 @@
</where>
order by t1.create_time desc
</select>
- <select id="listPageByCustom" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+ <select id="listPageByCustom" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto">
select
t2.supplier_name,
t2.product_category,
@@ -180,7 +180,7 @@
order by id desc
limit 1
</select>
- <select id="listPageBySemiProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+ <select id="listPageBySemiProduct" resultType="com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto">
select
t1.id,
t1.code,
@@ -206,4 +206,4 @@
order by t1.create_time desc
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml b/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
index 1b84282..6231005 100644
--- a/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
@@ -2,17 +2,34 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.procurementrecord.mapper.ReturnManagementMapper">
- <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto">
+ <select id="listPage" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto">
select rm.*,
c.customer_name,
si.shipping_no,
+ rm.shipping_type,
+ rm.truck_plate_no,
+ rm.express_company,
+ rm.express_no,
sl.project_name,
sl.sales_contract_no,
- sl.salesman
+ sl.salesman,
+ CASE
+ WHEN tempA.total_approval = 0 OR tempA.total_approval IS NULL THEN 0
+ WHEN tempA.approval_sum = tempA.total_approval THEN 1
+ ELSE 2
+ END AS stock_in_approval_status
from return_management rm
left join shipping_info si on rm.shipping_id = si.id
left join customer c on rm.customer_id = c.id
left join sales_ledger sl on si.sales_ledger_id = sl.id
+ LEFT JOIN (
+ SELECT
+ rsp.return_management_id,
+ COUNT(sir.id) AS total_approval,
+ SUM(CASE WHEN sir.approval_status = 1 THEN 1 ELSE 0 END) AS approval_sum
+ FROM return_sale_product rsp LEFT JOIN stock_in_record sir ON rsp.id = sir.record_id
+ GROUP BY rsp.return_management_id
+ ) tempA ON tempA.return_management_id = rm.id
<where>
<if test="req.returnNo != null and req.returnNo != ''">
and rm.return_no like concat('%',#{req.returnNo},'%')
@@ -39,11 +56,16 @@
and sl.sales_contract_no like concat('%',#{req.salesContractNo},'%')
</if>
</where>
+ order by rm.id desc
</select>
- <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto">
+ <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto">
select rm.*,
c.customer_name,
si.shipping_no,
+ rm.shipping_type,
+ rm.truck_plate_no,
+ rm.express_company,
+ rm.express_no,
sl.project_name,
sl.sales_contract_no,
sl.salesman
@@ -53,4 +75,37 @@
left join sales_ledger sl on si.sales_ledger_id = sl.id
where rm.id = #{id}
</select>
-</mapper>
\ No newline at end of file
+ <select id="listPageAccountSalesReturn" resultType="com.ruoyi.account.bean.vo.sales.SalesReturnVo">
+ select rm.id,
+ rm.return_no,
+ c.customer_name,
+ si.shipping_no,
+ rm.shipping_type,
+ rm.truck_plate_no,
+ rm.express_company,
+ rm.express_no,
+ rm.make_time,
+ rm.refund_amount,
+ rm.return_reason,
+ rm.make_time,
+ sl.sales_contract_no
+ from return_management rm
+ left join shipping_info si on rm.shipping_id = si.id
+ left join customer c on rm.customer_id = c.id
+ left join sales_ledger sl on si.sales_ledger_id = sl.id
+ where rm.status=1
+ <if test="req.returnNo != null and req.returnNo != ''">
+ and rm.return_no like concat('%',#{req.returnNo},'%')
+ </if>
+ <if test="req.customerName != null and req.customerName != ''">
+ and c.customer_name like concat('%',#{req.customerName},'%')
+ </if>
+ <if test="req.customerId != null ">
+ and rm.customer_id = #{req.customerId}
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND DATE_FORMAT(rm.make_time, '%Y-%m-%d') BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ order by rm.id DESC
+ </select>
+</mapper>
diff --git a/src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml b/src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml
index 55cba43..d104b21 100644
--- a/src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml
@@ -6,33 +6,48 @@
<resultMap id="BaseResultMap" type="com.ruoyi.procurementrecord.pojo.ReturnSaleProduct">
<id column="id" property="id" />
<result column="return_management_id" property="returnManagementId" />
- <result column="return_sales_ledger_product_id" property="returnsalesLedgerProductId" />
+ <result column="stock_out_record_id" property="stockOutRecordId" />
<result column="num" property="num" />
<result column="status" property="status" />
</resultMap>
- <select id="listReturnSaleProductDto" resultType="com.ruoyi.procurementrecord.dto.ReturnSaleProductDto">
- SELECT slp.product_category as product_name,
- slp.specification_model as model,
- slp.unit as unit,
+ <select id="listReturnSaleProductDto" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto">
+ SELECT distinct
+ p.product_name as product_name,
+ pm.model as model,
+ pm.unit as unit,
rsp.*,
- GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity,
- COALESCE(rs.total_return_num, 0) AS total_return_num
+ sor.outbound_batches,
+ sor.stock_out_num,
+ sor.batch_no,
+ GREATEST( sor.stock_out_num - COALESCE ( rs.total_return_num, 0 ), 0 ) AS un_quantity,
+ COALESCE ( rs.pending_return_num, 0 ) AS pending_return_num ,
+ COALESCE ( rs.return_num, 0 ) AS total_return_num
FROM return_sale_product rsp
LEFT JOIN return_management rm ON rm.id = rsp.return_management_id
LEFT JOIN shipping_info si ON si.id = rm.shipping_id
+ LEFT JOIN shipping_product_detail spd ON spd.shipping_info_id = si.id
+ LEFT JOIN stock_out_record sor ON rsp.stock_out_record_id = sor.id and sor.record_type = '13'
LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1
- LEFT JOIN (SELECT return_sales_ledger_product_id,
-
- SUM(num) AS total_return_num
+ left join product_model pm on slp.product_model_id = pm.id
+ LEFT JOIN product p on pm.product_id = p.id
+ LEFT JOIN (SELECT stock_out_record_id,
+ SUM(num) AS total_return_num,
+ SUM( CASE WHEN return_management_id =#{returnManagementId} AND STATUS = 0 THEN num ELSE 0 END ) AS pending_return_num ,
+ SUM( CASE WHEN STATUS = 1 THEN num ELSE 0 END ) AS return_num
FROM return_sale_product
- WHERE 1 = 1 and return_management_id != #{returnManagementId}
- GROUP BY return_sales_ledger_product_id) rs ON rs.return_sales_ledger_product_id = slp.id
+ GROUP BY stock_out_record_id) rs ON rs.stock_out_record_id = sor.id
where rm.id =#{returnManagementId}
</select>
- <select id="listReturnSaleProduct" resultType="com.ruoyi.procurementrecord.dto.ReturnSaleProductDto">
- select rsp.*,slp.tax_inclusive_unit_price ,slp.tax_inclusive_total_price*rsp.num as price
+ <select id="listReturnSaleProduct" resultType="com.ruoyi.procurementrecord.bean.dto.ReturnSaleProductDto">
+ select rsp.*,
+ sor.batch_no,
+ slp.tax_inclusive_unit_price ,
+ slp.tax_inclusive_total_price*rsp.num as price
from return_sale_product rsp
- left join sales_ledger_product slp on slp.id = rsp.return_sales_ledger_product_id
+ LEFT JOIN return_management rm ON rm.id = rsp.return_management_id
+ LEFT JOIN shipping_info si ON si.id = rm.shipping_id
+ LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1
+ LEFT JOIN stock_out_record sor ON rsp.stock_out_record_id = sor.id
where rsp.return_management_id = #{returnManagementId}
</select>
diff --git a/src/main/resources/mapper/production/ProductionAccountMapper.xml b/src/main/resources/mapper/production/ProductionAccountMapper.xml
index 2841854..4be1c23 100644
--- a/src/main/resources/mapper/production/ProductionAccountMapper.xml
+++ b/src/main/resources/mapper/production/ProductionAccountMapper.xml
@@ -29,15 +29,19 @@
pa.scheduling_user_id as schedulingUserId,
pa.scheduling_user_name as schedulingUserName,
cast(sum(
- ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) *
case
- when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$'
- then cast(substring_index(pm.model, '*', -1) as decimal(18,4))
- else 1
+ when poro.type = 0 then ifnull(pa.work_hours, 0) * ifnull(ppm.work_hour, 0)
+ else ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) *
+ case
+ when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$'
+ then cast(substring_index(pm.model, '*', -1) as decimal(18,4))
+ else 1
+ end
end
) as decimal(18,4)) as wages,
cast(sum(ifnull(pa.finished_num, 0)) as decimal(18,4)) as finishedNum,
cast(sum(ifnull(pa.work_hours, 0)) as decimal(18,4)) as workHours,
+ cast(sum(ifnull(ppm.work_hour, 0)) as decimal(18,4)) as workHour,
case
when sum(ifnull(ppo.quantity, 0) + ifnull(ppo.scrapQty, 0)) = 0 then '0%'
else concat(
diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 577bcfd..5847f5f 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -29,6 +29,7 @@
pm.model as model,
pm.unit as unit,
poro.operation_name as operationName,
+ poro.type as type,
IFNULL(scrapStat.scrapQty, 0) AS scrapQty,
ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus,
CASE
@@ -63,11 +64,14 @@
<if test="c != null and c.status != null">
and pot.status = #{c.status}
</if>
+ <if test="c != null and c.isProduction != null">
+ and poro.is_production = #{c.isProduction}
+ </if>
<if test="c != null and c.workOrderNo != null and c.workOrderNo != ''">
and pot.work_order_no like concat('%', #{c.workOrderNo}, '%')
</if>
</where>
- order by pot.id desc
+ order by pot.production_order_id desc, poro.drag_sort
</select>
<select id="selectTaskStatisticsByDate" resultType="com.ruoyi.home.dto.ProductionTaskStatisticsDto">
@@ -106,7 +110,7 @@
select poro.operation_name as processName,
sum(ifnull(ppi.input_quantity, 0)) as totalInput,
sum(ifnull(ppo.scrap_qty, 0)) as totalScrap,
- sum(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0)) as totalOutput
+ sum(greatest(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0), 0)) as totalOutput
from production_product_output ppo
inner join production_product_main ppm on ppo.production_product_main_id = ppm.id
inner join production_operation_task pot on ppm.production_operation_task_id = pot.id
@@ -158,6 +162,7 @@
<select id="getOperation" resultType="com.ruoyi.production.bean.vo.ProductionOperationTaskVo">
select poro.operation_name as operationName,
+ max(poro.type) as type,
count(pot.id) as productionTaskCount,
sum(ifnull(pot.plan_quantity, 0)) as planQuantity,
sum(ifnull(pot.complete_quantity, 0)) as completeQuantity,
diff --git a/src/main/resources/mapper/production/ProductionOrderMapper.xml b/src/main/resources/mapper/production/ProductionOrderMapper.xml
index 1a304ef..67cc55b 100644
--- a/src/main/resources/mapper/production/ProductionOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOrderMapper.xml
@@ -212,4 +212,87 @@
and ifnull(complete_quantity, 0) < quantity
</select>
+ <select id="selectHomeOrderProgressPage" resultType="java.util.Map">
+ select po.nps_no as orderNo,
+ p.product_name as productName,
+ ifnull(po.quantity, 0) as plannedQuantity,
+ ifnull(po.complete_quantity, 0) as completedQuantity,
+ round(ifnull(po.complete_quantity, 0) / nullif(po.quantity, 0) * 100, 2) as completionRate,
+ po.plan_complete_time as dueDate,
+ po.status as status
+ from production_order po
+ left join product_model pm on po.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ <where>
+ <if test="status != null">
+ and po.status = #{status}
+ </if>
+ <if test="startTime != null and endTime != null">
+ and po.create_time >= #{startTime}
+ and po.create_time < #{endTime}
+ </if>
+ </where>
+ order by po.id desc
+ <if test="size != null and size >= 0">
+ limit #{offset}, #{size}
+ </if>
+ </select>
+
+ <select id="countHomeOrderProgress" resultType="java.lang.Long">
+ select count(1)
+ from production_order po
+ <where>
+ <if test="status != null">
+ and po.status = #{status}
+ </if>
+ <if test="startTime != null and endTime != null">
+ and po.create_time >= #{startTime}
+ and po.create_time < #{endTime}
+ </if>
+ </where>
+ </select>
+
+ <select id="countHomeOrderProgressByStatus" resultType="java.util.Map">
+ select po.status as status, count(1) as cnt
+ from production_order po
+ where po.status in (1, 2, 3, 4)
+ <if test="startTime != null and endTime != null">
+ and po.create_time >= #{startTime}
+ and po.create_time < #{endTime}
+ </if>
+ group by po.status
+ </select>
+
+ <select id="selectHomeTodayProductionPlan" resultType="java.util.Map">
+ select po.nps_no as orderNo,
+ p.product_name as productName,
+ ifnull(po.quantity, 0) as plannedQuantity,
+ po.plan_complete_time as dueDate,
+ po.status as status
+ from production_order po
+ left join product_model pm on po.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ <where>
+ po.status in (1, 2)
+ <if test="planStart != null and planEnd != null">
+ and po.plan_complete_time >= #{planStart}
+ and po.plan_complete_time < #{planEnd}
+ </if>
+ </where>
+ order by case when po.status = 2 then 0 else 1 end, po.id desc
+ limit #{size}
+ </select>
+
+ <select id="countHomeTodayProductionPlan" resultType="java.lang.Long">
+ select count(1)
+ from production_order po
+ <where>
+ po.status in (1, 2)
+ <if test="planStart != null and planEnd != null">
+ and po.plan_complete_time >= #{planStart}
+ and po.plan_complete_time < #{planEnd}
+ </if>
+ </where>
+ </select>
+
</mapper>
diff --git a/src/main/resources/mapper/production/ProductionOrderRoutingOperationMapper.xml b/src/main/resources/mapper/production/ProductionOrderRoutingOperationMapper.xml
index 55739db..4d63797 100644
--- a/src/main/resources/mapper/production/ProductionOrderRoutingOperationMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOrderRoutingOperationMapper.xml
@@ -13,6 +13,7 @@
<result column="update_time" property="updateTime" />
<result column="drag_sort" property="dragSort" />
<result column="is_quality" property="isQuality" />
+ <result column="type" property="type" />
<result column="create_user" property="createUser" />
<result column="dept_id" property="deptId" />
</resultMap>
diff --git a/src/main/resources/mapper/production/ProductionPlanMapper.xml b/src/main/resources/mapper/production/ProductionPlanMapper.xml
index a389d32..69ccd36 100644
--- a/src/main/resources/mapper/production/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/production/ProductionPlanMapper.xml
@@ -53,6 +53,9 @@
<if test="c.requiredDateStart != null and c.requiredDateEnd != null">
and pp.required_date between #{c.requiredDateStart} and #{c.requiredDateEnd}
</if>
+ <if test="c.salesContractNo != null and c.salesContractNo != ''">
+ and sl.sales_contract_no like concat('%', #{c.salesContractNo}, '%')
+ </if>
</if>
</where>
ORDER BY COALESCE(pp.id) DESC
diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index 5a78a5b..df585f9 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -100,13 +100,17 @@
ifnull(ppo.scrap_qty, 0) as scrapQty,
date(pa.scheduling_date) as schedulingDate,
pa.scheduling_user_name as schedulingUserName,
+ cast(ifnull(ppm.work_hour, 0) as decimal(18,4)) as workHour,
cast(ifnull(pa.work_hours, 0) as decimal(18,4)) as workHours,
cast(
- ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) *
case
- when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$'
- then cast(substring_index(pm.model, '*', -1) as decimal(18,4))
- else 1
+ when poro.type = 0 then ifnull(pa.work_hours, 0) * ifnull(ppm.work_hour, 0)
+ else ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) *
+ case
+ when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$'
+ then cast(substring_index(pm.model, '*', -1) as decimal(18,4))
+ else 1
+ end
end
as decimal(18,4)
) as wages
diff --git a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml b/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
deleted file mode 100644
index c5a99f9..0000000
--- a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.purchase.mapper.InvoicePurchaseMapper">
-
-
- <select id="selectPurchaseReport" resultType="com.ruoyi.purchase.dto.InvoicePurchaseReportDto">
- SELECT
- sl.sales_contract_no AS customerContractNo,
- sl.customer_name,
- sl.contract_amount AS contract_amount,
- SUM( pl.contract_amount ) AS purchase_amount,
- (
- sl.contract_amount - SUM( pl.contract_amount )) AS balance,
- CONCAT( ROUND( ( sl.contract_amount - SUM( pl.contract_amount )) / sl.contract_amount * 100, 1 ), '%' ) AS balance_ratio
- FROM
- sales_ledger sl
- INNER JOIN purchase_ledger pl ON sl.sales_contract_no = pl.sales_contract_no
- <where>
- <if test="c.customerName != null and c.customerName != ''">
- AND sl.customer_name LIKE CONCAT('%', #{c.customerName}, '%')
- </if>
- </where>
- GROUP BY
- sl.sales_contract_no,
- sl.customer_name,
- sl.contract_amount
- ORDER BY
- sl.sales_contract_no
- </select>
- <select id="listVat" resultType="com.ruoyi.purchase.dto.VatDto">
- select *
- from (SELECT
- COALESCE(a1.month, a2.month) AS month,
- IFNULL(a1.tax_amount, 0) AS j_tax_amount,
- IFNULL(a2.x_tax_amount, 0) AS x_tax_amount
- FROM (
- -- 绗竴涓煡璇細鏉ヨ嚜 invoice_ledger 鐨勭◣棰�
- SELECT
- DATE_FORMAT(il.invoice_date, '%Y-%m') AS month,
- ROUND(SUM(pr.invoice_amount - pr.invoice_amount / (1 + pr.tax_rate / 100)), 2) AS tax_amount
- FROM invoice_ledger il
- LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id
- WHERE il.invoice_no IS NOT NULL
- AND invoice_type = '澧炰笓绁�'
- AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL -- 鏂板锛氳繃婊onth涓篘ULL鐨勬儏
- GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m')
- ) a1
- LEFT JOIN (
- -- 绗簩涓煡璇細鏉ヨ嚜 ticket_registration 鐨勭◣棰�
- SELECT
- DATE_FORMAT(a.issue_date, '%Y-%m') AS month,
- SUM(a.invoice_amount) AS x_tax_amount
- FROM (
- SELECT DISTINCT pr.id,
- tr.issue_date,
- ROUND(pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS un_tickets_price,
- ROUND(pr.tickets_amount - pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS invoice_amount
- FROM product_record pr
- LEFT JOIN purchase_ledger pl ON pl.id = pr.purchase_ledger_id
- LEFT JOIN sales_ledger sl ON sl.id = pl.sales_ledger_id
- LEFT JOIN ticket_registration tr ON tr.purchase_ledger_id = pl.id
- LEFT JOIN product_model pm ON pm.id = pr.product_model_id
- WHERE type = 2
- AND tr.invoice_number IS NOT NULL
- ) a
- GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m')
- ) a2 ON a1.month = a2.month
-
- UNION ALL
-
- SELECT
- COALESCE(a1.month, a2.month) AS month,
- IFNULL(a1.tax_amount, 0) AS tax_amount,
- IFNULL(a2.x_tax_amount, 0) AS x_tax_amount
- FROM (
- -- 绗簩涓煡璇細鏉ヨ嚜 ticket_registration 鐨勭◣棰濓紙鍙嶈繃鏉ヨˉ鍏ㄦ病鏈夊尮閰嶅埌鐨勶級
- SELECT
- DATE_FORMAT(a.issue_date, '%Y-%m') AS month,
- SUM(a.invoice_amount) AS x_tax_amount
- FROM (
- SELECT DISTINCT pr.id,
- tr.issue_date,
- ROUND(pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS un_tickets_price,
- ROUND(pr.tickets_amount - pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS invoice_amount
- FROM product_record pr
- LEFT JOIN purchase_ledger pl ON pl.id = pr.purchase_ledger_id
- LEFT JOIN sales_ledger sl ON sl.id = pl.sales_ledger_id
- LEFT JOIN ticket_registration tr ON tr.purchase_ledger_id = pl.id
- LEFT JOIN product_model pm ON pm.id = pr.product_model_id
- WHERE type = 2
- AND tr.invoice_number IS NOT NULL
- ) a
- GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m')
- ) a2
- LEFT JOIN (
- -- 绗竴涓煡璇細鏉ヨ嚜 invoice_ledger 鐨勭◣棰�
- SELECT
- DATE_FORMAT(il.invoice_date, '%Y-%m') AS month,
- ROUND(SUM(pr.invoice_amount - pr.invoice_amount / (1 + pr.tax_rate / 100)), 2) AS tax_amount
- FROM invoice_ledger il
- LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id
- WHERE il.invoice_no IS NOT NULL
- AND invoice_type = '澧炰笓绁�'
- AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL -- 鏂板锛氳繃婊onth涓篘ULL鐨勬儏
- GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m')
- ) a1 ON a1.month = a2.month
- WHERE a1.month IS NULL
- ORDER BY month
- )as a
- <where>
- a.month is not null
- <if test="month != null">
- and a.month = #{month}
- </if>
- </where>
-
- </select>
- <select id="listVat1" resultType="com.ruoyi.purchase.dto.VatDto">
- # SELECT
-# DATE_FORMAT(il.invoice_date, '%Y-%m') AS month,
-# ROUND(SUM(pr.invoice_amount - pr.invoice_amount / (1 + pr.tax_rate / 100)), 2) AS tax_amount
-# FROM invoice_ledger il
-# LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id
-# WHERE il.invoice_no IS NOT NULL
-# AND invoice_type = '澧炰笓绁�'
-# GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m')
-# ORDER BY month;
-# select DATE_FORMAT(a.issue_date, '%Y-%m'), sum(a.invoice_amount) as xTaxAmount
-# from (SELECT distinct pr.id,
-# tr.issue_date,
-# ROUND(pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS un_tickets_price,
-# ROUND(pr.tickets_amount - pr.tickets_amount / (1 + pr.tax_rate / 100),
-# 2) AS invoice_amount
-# FROM product_record pr
-# LEFT JOIN purchase_ledger pl ON pl.id = pr.purchase_ledger_id
-# LEFT JOIN sales_ledger sl ON sl.id = pl.sales_ledger_id
-# LEFT JOIN ticket_registration tr ON tr.purchase_ledger_id = pl.id
-# LEFT JOIN product_model pm ON pm.id = pr.product_model_id
-# WHERE type = 2
-# and tr.invoice_number is not null) a
-# GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m')
- </select>
-
-</mapper>
diff --git a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml b/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
deleted file mode 100644
index 8e01079..0000000
--- a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.purchase.mapper.PaymentRegistrationMapper">
-
- <resultMap type="PaymentRegistration" id="PaymentRegistrationResult">
- <result property="id" column="id"/>
- <result property="saleLedgerId" column="sale_ledger_id"/>
- <result property="purchaseLedgerId" column="purchase_ledger_id"/>
- <result property="supplierId" column="supplier_id"/>
- <result property="ticketRegistrationId" column="ticket_registration_id"/>
- <result property="currentPaymentAmount" column="current_payment_amount"/>
- <result property="paymentMethod" column="payment_method"/>
- <result property="registrantId" column="registrant_id"/>
- <result property="paymentDate" column="payment_date"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="tenantId" column="tenant_id"/>
- <result property="registrationtDate" column="registrationt_date"/>
- </resultMap>
-
- <resultMap type="com.ruoyi.purchase.dto.PaymentRegistrationDto" id="PaymentRegistrationDtoResult">
- <result property="id" column="id"/>
- <result property="saleLedgerId" column="sale_ledger_id"/>
- <result property="purchaseLedgerId" column="purchase_ledger_id"/>
- <result property="supplierId" column="supplier_id"/>
- <result property="ticketRegistrationId" column="ticket_registration_id"/>
- <result property="currentPaymentAmount" column="current_payment_amount"/>
- <result property="paymentMethod" column="payment_method"/>
- <result property="registrantId" column="registrant_id"/>
- <result property="paymentDate" column="payment_date"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="salesContractNo" column="sales_contract_no"/>
- <result property="purchaseContractNumber" column="purchase_contract_number"/>
- <result property="supplierName" column="supplier_name"/>
- <result property="invoiceNumber" column="invoice_number"/>
- <result property="taxRate" column="tax_rate"/>
- <result property="invoiceAmount" column="invoice_amount"/>
- <result property="tenantId" column="tenant_id"/>
- <result property="registrationtDate" column="registrationt_date"/>
- </resultMap>
-
- <sql id="selectPaymentRegistrationVo">
- select pr.id,
- pr.sale_ledger_id,
- pr.purchase_ledger_id,
- pr.supplier_id,
- pr.ticket_registration_id,
- pr.current_payment_amount,
- pr.payment_method,
- pr.registrant_id,
- pr.payment_date,
- pr.create_time,
- pr.update_time,
- pr.tenant_id,
- sl.sales_contract_no as sales_contract_no,
- pl.purchase_contract_number as purchase_contract_number,
- sm.supplier_name as supplier_name,
- ip.invoice_number as invoice_number,
- ip.invoice_amount as invoice_amount,
- pr.tax_rate,
- pr.registrationt_date,
- su.nick_name as registrant
- from payment_registration pr
- left join sales_ledger sl on pr.sale_ledger_id = sl.id
- left join purchase_ledger pl on pr.purchase_ledger_id = pl.id
- left join supplier_manage sm on pr.supplier_id = sm.id
- left join ticket_registration ip on pr.ticket_registration_id = ip.id
- left join sys_user su on pr.registrant_id = su.user_id
- </sql>
-
- <select id="selectPaymentRegistrationList" parameterType="com.ruoyi.purchase.dto.PaymentRegistrationDto"
- resultMap="PaymentRegistrationDtoResult">
- <include refid="selectPaymentRegistrationVo"/>
- <where>
- <if test="supplierNameOrContractNo != null and supplierNameOrContractNo != ''">
- and sm.supplier_name LIKE CONCAT('%', #{supplierNameOrContractNo}, '%') or sl.sales_contract_no LIKE
- CONCAT('%', #{supplierNameOrContractNo}, '%')
- or pl.purchase_contract_number LIKE CONCAT('%', #{supplierNameOrContractNo}, '%')
- </if>
- </where>
- </select>
-
- <select id="selectPaymentRegistrationById" parameterType="Long" resultMap="PaymentRegistrationDtoResult">
- <include refid="selectPaymentRegistrationVo"/>
- where pr.id = #{id}
- </select>
-
- <select id="paymentHistoryList" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
- SELECT
- T1.payment_date,
- T2.supplier_name,
- T1.current_payment_amount,
- T1.payment_method,
- T3.nick_name AS registrant,
- T1.registrationt_date
- FROM
- payment_registration T1
- LEFT JOIN
- supplier_manage T2 ON T1.supplier_id = T2.id
- LEFT JOIN
- sys_user T3 ON T3.user_id = T1.registrant_id
- <where>
- <if test="params.searchText != null and params.searchText != '' ">
- AND T2.supplier_name LIKE CONCAT('%',#{params.searchText},'%')
- </if>
- </where>
- ORDER BY T1.payment_date,T1.create_time DESC
- </select>
-
- <select id="countPaymentTotalByTicketRegId" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
- SELECT
- IFNULL(SUM(current_payment_amount),0) AS paymentAmountTotal,
- ticket_registration_id
- FROM
- payment_registration
- <where>
- ticket_registration_id IN
- <foreach collection="ticketRegistrationIds" separator="," open="(" close=")" item="item">
- #{item}
- </foreach>
- </where>
- GROUP BY ticket_registration_id
- </select>
-
- <select id="getPaymentRecordList" resultType="com.ruoyi.purchase.dto.PaymentHistoryRecordVo">
- SELECT * FROM(
- SELECT
- T1.issue_date AS happenTime,
- IFNULL(T1.invoice_amount,0) AS invoiceAmount,
- '1' AS type,
- 0 AS currentPaymentAmount
- FROM
- ticket_registration T1
- LEFT JOIN purchase_ledger T2 ON T1.purchase_ledger_id = T2.id
- WHERE T2.supplier_id = #{supplierId}
- UNION
- SELECT
- payment_date AS happenTime,
- 0 AS invoiceAmount,
- '0' AS type,
- current_payment_amount AS currentPaymentAmount
- FROM payment_registration
- WHERE supplier_id = #{supplierId}
- ) T1
- ORDER BY T1.happenTime ASC
-
- </select>
-
- <select id="paymentHistoryListPage" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
- SELECT
- T1.id,
- T1.payment_date,
- T2.supplier_name,
- T1.current_payment_amount,
- T1.payment_method,
- T3.nick_name AS registrant,
- T1.registrationt_date,
- t4.purchase_contract_number,
- t5.invoice_amount,
- t5.invoice_number
- FROM
- payment_registration T1
- LEFT JOIN purchase_ledger t4 ON t4.id = T1.purchase_ledger_id
- LEFT JOIN supplier_manage T2 ON T1.supplier_id = T2.id
- LEFT JOIN sys_user T3 ON T3.user_id = T1.registrant_id
- left join ticket_registration t5 on t5.id = T1.ticket_registration_id
- <where>
- <if test="params.searchText != null and params.searchText != '' ">
- AND T2.supplier_name LIKE CONCAT('%',#{params.searchText},'%')
- </if>
- <if test="params.paymentDateStart != null and params.paymentDateStart !='' ">
- AND T1.payment_date >= date_format(#{params.paymentDateStart},'%Y-%m-%d')
- </if>
- <if test="params.paymentDateEnd != null and params.paymentDateEnd !='' ">
- AND T1.payment_date <= date_format(#{params.paymentDateEnd},'%Y-%m-%d')
- </if>
- <if test="params.purchaseContractNumber != null and params.purchaseContractNumber !='' ">
- AND t4.purchase_contract_number LIKE CONCAT('%',#{params.purchaseContractNumber},'%')
- </if>
- </where>
- ORDER BY T1.payment_date,T1.create_time DESC
- </select>
- <select id="supplierNameListPage" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
- SELECT
- T1.supplier_id,
- T1.supplier_name,
- SUM(contract_amount) AS invoiceAmount,
- IFNULL( SUM(T2.current_payment_amount) , 0 ) AS paymentAmount,
- IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount
- FROM purchase_ledger T1
- LEFT JOIN payment_registration T2 ON T1.id = T2.purchase_ledger_id
- <where>
- <if test="req.supplierName != null and req.supplierName != '' ">
- T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
- </if>
- </where>
- GROUP BY T1.supplier_id, T1.supplier_name
- </select>
-
- <select id="supplierNameListPageDetails" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
- SELECT
- T1.supplier_id,
- T1.supplier_name,
- T1.purchase_contract_number,
- T2.payment_date,
- SUM(T1.contract_amount) AS invoiceAmount,
- IFNULL(SUM(T2.current_payment_amount), 0) AS paymentAmount,
- IFNULL((IFNULL(SUM(T1.contract_amount), 0) - IFNULL(SUM(T2.current_payment_amount), 0)), 0) AS payableAmount
- FROM purchase_ledger T1
- INNER JOIN payment_registration T2 ON T1.id = T2.purchase_ledger_id
- <where>
- T1.supplier_id = #{req.supplierId}
- <if test="req.supplierName != null and req.supplierName != '' ">
- AND T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
- </if>
- </where>
- GROUP BY T1.supplier_id, T1.supplier_name, T1.purchase_contract_number, T2.payment_date
- </select>
-
-</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/purchase/ProductRecordMapper.xml b/src/main/resources/mapper/purchase/ProductRecordMapper.xml
deleted file mode 100644
index aa850cb..0000000
--- a/src/main/resources/mapper/purchase/ProductRecordMapper.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.purchase.mapper.ProductRecordMapper">
-
-
- <select id="productRecordPage" resultType="com.ruoyi.purchase.dto.ProductRecordDto">
- SELECT
- sl.sales_contract_no,
- sl.customer_contract_no,
- sl.customer_name,
- pm.model AS product_model,
- pl.purchase_contract_number,
- pl.supplier_name,
- pl.project_name,
- pr.*,
- tr.invoice_number,
- tr.iss_uer_id,
- tr.iss_uer,
- tr.id as ticketRegistrationId,
- ROUND(pr.tickets_amount/(1+pr.tax_rate/100),2 ) as un_tickets_price,
- ROUND(pr.tickets_amount-pr.tickets_amount/(1+pr.tax_rate/100),2 )as invoice_amount
- FROM product_record pr
- left join purchase_ledger pl on pl.id = pr.purchase_ledger_id
- left join sales_ledger sl on sl.id = pl.sales_ledger_id
- left join ticket_registration tr on tr.id = pr.ticket_registration_id
- left join product_model pm on pm.id = pr.product_model_id
- WHERE type = 2
- <if test="c.salesContractNo != null and c.salesContractNo != ''">
- and sl.sales_contract_no like concat('%',#{c.salesContractNo},'%')
- </if>
- <if test="c.supplierName != null and c.supplierName != ''">
- and pl.supplier_name like concat('%',#{c.supplierName},'%')
- </if>
- <if test="c.createdAtStart != null and c.createdAtStart != ''">
- and pr.created_at >= str_to_date(#{c.createdAtStart}, '%Y-%m-%d')
- </if>
- <if test="c.createdAtEnd != null and c.createdAtEnd != ''">
- and pr.created_at < date_add(str_to_date(#{c.createdAtEnd}, '%Y-%m-%d'), interval 1 day)
- </if>
- <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''">
- and tr.purchase_contract_number like concat('%',#{c.purchaseContractNumber},'%')
- </if>
- </select>
- <select id="getProductRecordById" resultType="com.ruoyi.purchase.dto.ProductRecordDto">
- SELECT
- sl.sales_contract_no,
- sl.customer_contract_no,
- sl.customer_name,
- pm.model AS product_model,
- pl.purchase_contract_number,
- pl.supplier_name,
- pr.*,
- tr.invoice_number,
- ROUND(pr.tickets_amount/(1+pr.tax_rate/100),2 ) as un_tickets_price,
- ROUND(pr.tickets_amount-pr.tickets_amount/(1+pr.tax_rate/100),2 )as invoice_amount
- FROM product_record pr
- left join purchase_ledger pl on pl.id = pr.purchase_ledger_id
- left join sales_ledger sl on sl.id = pl.sales_ledger_id
- left join ticket_registration tr on tr.id = pr.ticket_registration_id
- left join product_model pm on pm.id = pr.product_model_id
- WHERE type = 2
- <if test="c.purchaseLedgerId != null and c.purchaseLedgerId != ''">
- and pr.purchase_ledger_id = #{c.purchaseLedgerId}
- </if>
- <if test="c.productModelId != null and c.productModelId != ''">
- and pm.id = #{c.productModelId}
- </if>
- </select>
-</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml b/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
index 1aed9b4..8b94eb7 100644
--- a/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
+++ b/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
@@ -6,97 +6,177 @@
<update id="updateContractAmountById">
UPDATE purchase_ledger
- SET contract_amount = #{totalTaxInclusiveAmount}
+ SET contract_amount = #{totalTaxInclusiveAmount},
+ net_contract_amount = #{totalTaxInclusiveAmount}
WHERE id = #{id}
</update>
-
- <select id="selectPurchaseLedgerListPage" resultType="com.ruoyi.purchase.dto.PurchaseLedgerDto">
- SELECT
- pl.id,
- pl.purchase_contract_number,
- pl.sales_contract_no,
- pl.supplier_id,
- pl.supplier_name,
- pl.project_name,
- pl.contract_amount,
- IFNULL(tr_sum.total_invoice_amount, 0) AS receipt_payment_amount,
- pl.contract_amount - IFNULL(tr_sum.total_invoice_amount, 0) AS unReceipt_payment_amount,
- pl.entry_date,
- pl.execution_date,
- pl.recorder_id,
- pl.recorder_name,
- pl.template_name,
- pl.approve_user_ids,
- sm.is_white,
- pl.approval_status,
- pl.payment_method,
- pl.remarks
- FROM purchase_ledger pl
- LEFT JOIN (
- SELECT
- purchase_ledger_id,
- SUM(invoice_amount) AS total_invoice_amount
- FROM ticket_registration
- GROUP BY purchase_ledger_id
- ) tr_sum ON pl.id = tr_sum.purchase_ledger_id
- LEFT JOIN supplier_manage sm ON pl.supplier_id = sm.id
- <where>
- <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''">
- AND pl.purchase_contract_number LIKE CONCAT('%', #{c.purchaseContractNumber}, '%')
- </if>
- <if test="c.approvalStatus != null and c.approvalStatus != ''">
- AND pl.approval_status = #{c.approvalStatus}
- </if>
- <if test="c.supplierName != null and c.supplierName != ''">
- AND pl.supplier_name LIKE CONCAT('%', #{c.supplierName}, '%')
- </if>
- <if test="c.salesContractNo != null and c.salesContractNo != ''">
- AND pl.sales_contract_no LIKE CONCAT('%', #{c.salesContractNo}, '%')
- </if>
- <if test="c.projectName != null and c.projectName != ''">
- AND pl.project_name LIKE CONCAT('%', #{c.projectName}, '%')
- </if>
- <if test="c.entryDateStart != null and c.entryDateStart != ''">
- AND pl.entry_date >= #{c.entryDateStart}
- </if>
- <if test="c.entryDateEnd != null and c.entryDateEnd != ''">
- AND pl.entry_date <= #{c.entryDateEnd}
- </if>
- <if test="c.supplierId != null">
- AND pl.supplier_id = #{c.supplierId}
- </if>
- <if test="c.approvalStatus != null">
- AND pl.approval_status = #{c.approvalStatus}
- </if>
- </where>
- ORDER BY pl.entry_date DESC
- </select>
-
- <select id="getPaymentRegistrationDtoById" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
- SELECT
- T1.id,
- T1.payment_date,
- T2.supplier_name,
- T1.current_payment_amount,
- T1.payment_method,
- T3.nick_name AS registrant,
- T1.registrationt_date
- FROM
- payment_registration T1
- LEFT JOIN
- supplier_manage T2 ON T1.supplier_id = T2.id
- LEFT JOIN
- sys_user T3 ON T3.user_id = T1.registrant_id
- WHERE
- T1.sales_ledger_product_id = #{id}
- </select>
-
-
<select id="selectPurchaseStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
SELECT DATE_FORMAT(entry_date, #{dateFormat}) as dateStr, IFNULL(SUM(contract_amount), 0) as amount
FROM purchase_ledger
WHERE entry_date BETWEEN #{startDate} AND #{endDate}
GROUP BY dateStr
+ </select>
+
+ <select id="selectPurchaseLedgerListPage" resultType="com.ruoyi.purchase.dto.PurchaseLedgerDto">
+ SELECT result.*
+ FROM (
+ SELECT
+ pl.id,
+ pl.purchase_contract_number,
+ pl.sales_contract_no,
+ pl.supplier_id,
+ pl.supplier_name,
+ pl.project_name,
+ pl.contract_amount,
+ pl.net_contract_amount,
+ pl.entry_date,
+ pl.execution_date,
+ pl.recorder_id,
+ pl.recorder_name,
+ pl.template_name,
+ pl.approve_user_ids,
+ sm.is_white,
+ pl.approval_status,
+ pl.payment_method,
+ pl.remarks,
+ CASE
+ WHEN IFNULL(ls.total_product_count, 0) = 0 THEN '寰呭叆搴�'
+ WHEN IFNULL(ls.full_product_count, 0) >= IFNULL(ls.total_product_count, 0) THEN '瀹屽叏鍏ュ簱'
+ WHEN IFNULL(ls.approved_product_count, 0) > 0 THEN '鍏ュ簱涓�'
+ ELSE '寰呭叆搴�'
+ END AS stock_in_status
+ FROM purchase_ledger pl
+ LEFT JOIN supplier_manage sm ON pl.supplier_id = sm.id
+ LEFT JOIN (
+ SELECT
+ product_status.sales_ledger_id,
+ COUNT(1) AS total_product_count,
+ SUM(CASE WHEN product_status.approved_stock_in_num > 0 THEN 1 ELSE 0 END) AS approved_product_count,
+ SUM(CASE WHEN product_status.approved_stock_in_num >= product_status.product_quantity THEN 1 ELSE 0 END) AS full_product_count
+ FROM (
+ SELECT
+ slp.id AS sales_ledger_product_id,
+ slp.sales_ledger_id,
+ IFNULL(slp.quantity, 0) AS product_quantity,
+ IFNULL(approved_qty.approved_stock_in_num, 0) AS approved_stock_in_num
+ FROM sales_ledger_product slp
+ LEFT JOIN (
+ SELECT rel.sales_ledger_product_id,
+ IFNULL(SUM(rel.stock_in_num), 0) AS approved_stock_in_num
+ FROM (
+ SELECT slp.id AS sales_ledger_product_id,
+ sir.stock_in_num
+ FROM stock_in_record sir
+ INNER JOIN sales_ledger_product slp
+ ON slp.type = 2
+ AND TRIM(sir.record_type) = '7'
+ AND sir.record_id = slp.sales_ledger_id
+ AND (
+ (sir.batch_no IS NOT NULL AND sir.batch_no LIKE CONCAT('%-', slp.id))
+ OR (sir.batch_no IS NULL AND sir.product_model_id = slp.product_model_id)
+ )
+ WHERE sir.approval_status = 1
+
+ UNION ALL
+
+ SELECT slp.id AS sales_ledger_product_id,
+ sir.stock_in_num
+ FROM stock_in_record sir
+ INNER JOIN quality_inspect qi
+ ON TRIM(sir.record_type) = '10'
+ AND sir.record_id = qi.id
+ INNER JOIN sales_ledger_product slp
+ ON slp.type = 2
+ AND slp.sales_ledger_id = qi.purchase_ledger_id
+ AND slp.product_model_id = qi.product_model_id
+ WHERE sir.approval_status = 1
+ ) rel
+ GROUP BY rel.sales_ledger_product_id
+ ) approved_qty ON approved_qty.sales_ledger_product_id = slp.id
+ WHERE slp.type = 2
+ ) product_status
+ GROUP BY product_status.sales_ledger_id
+ ) ls ON ls.sales_ledger_id = pl.id
+ <where>
+ <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''">
+ AND pl.purchase_contract_number LIKE CONCAT('%', #{c.purchaseContractNumber}, '%')
+ </if>
+ <if test="c.approvalStatus != null and c.approvalStatus != ''">
+ AND pl.approval_status = #{c.approvalStatus}
+ </if>
+ <if test="c.supplierName != null and c.supplierName != ''">
+ AND pl.supplier_name LIKE CONCAT('%', #{c.supplierName}, '%')
+ </if>
+ <if test="c.salesContractNo != null and c.salesContractNo != ''">
+ AND pl.sales_contract_no LIKE CONCAT('%', #{c.salesContractNo}, '%')
+ </if>
+ <if test="c.projectName != null and c.projectName != ''">
+ AND pl.project_name LIKE CONCAT('%', #{c.projectName}, '%')
+ </if>
+ <if test="c.entryDateStart != null and c.entryDateStart != ''">
+ AND pl.entry_date >= #{c.entryDateStart}
+ </if>
+ <if test="c.entryDateEnd != null and c.entryDateEnd != ''">
+ AND pl.entry_date <= #{c.entryDateEnd}
+ </if>
+ <if test="c.supplierId != null">
+ AND pl.supplier_id = #{c.supplierId}
+ </if>
+ <if test="c.ids != null and c.ids.size() > 0">
+ AND pl.id IN
+ <foreach collection="c.ids" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </if>
+ <if test="c.approvalStatus != null">
+ AND pl.approval_status = #{c.approvalStatus}
+ </if>
+ </where>
+ ) result
+ <if test="c.stockInStatus != null and c.stockInStatus != ''">
+ WHERE result.stock_in_status = #{c.stockInStatus}
+ </if>
+ ORDER BY result.entry_date DESC
+ </select>
+
+ <select id="selectReturnablePurchaseLedgerList" resultType="com.ruoyi.purchase.pojo.PurchaseLedger">
+ SELECT DISTINCT pl.*
+ FROM purchase_ledger pl
+ WHERE 1 = 1
+ <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''">
+ AND pl.purchase_contract_number LIKE CONCAT('%', #{c.purchaseContractNumber}, '%')
+ </if>
+ <if test="c.supplierId != null">
+ AND pl.supplier_id = #{c.supplierId}
+ </if>
+ <if test="c.approvalStatus != null">
+ AND pl.approval_status = #{c.approvalStatus}
+ </if>
+ AND EXISTS (
+ SELECT 1
+ FROM stock_in_record sir
+ LEFT JOIN quality_inspect qi
+ ON sir.record_type = '10'
+ AND sir.record_id = qi.id
+ LEFT JOIN sales_ledger_product slp
+ ON slp.sales_ledger_id = pl.id
+ AND slp.product_model_id = sir.product_model_id
+ AND slp.type = 2
+ LEFT JOIN (
+ SELECT stock_in_record_id, SUM(return_quantity) AS total_return_num
+ FROM purchase_return_order_products
+ GROUP BY stock_in_record_id
+ ) rs ON rs.stock_in_record_id = sir.id
+ WHERE sir.approval_status = 1
+ AND sir.record_type IN ('7','10')
+ AND (
+ (sir.record_type = '7' AND sir.record_id = pl.id)
+ OR (sir.record_type = '10' AND qi.purchase_ledger_id = pl.id)
+ )
+ AND slp.id IS NOT NULL
+ AND GREATEST(sir.stock_in_num - COALESCE(rs.total_return_num, 0), 0) > 0
+ )
+ ORDER BY pl.entry_date DESC
</select>
<select id="selectTotalPurchaseAmount" resultType="java.math.BigDecimal">
@@ -111,4 +191,4 @@
</if>
</where>
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/purchase/PurchaseReturnOrderProductsMapper.xml b/src/main/resources/mapper/purchase/PurchaseReturnOrderProductsMapper.xml
index cd13f3c..ec1efe1 100644
--- a/src/main/resources/mapper/purchase/PurchaseReturnOrderProductsMapper.xml
+++ b/src/main/resources/mapper/purchase/PurchaseReturnOrderProductsMapper.xml
@@ -13,7 +13,9 @@
</resultMap>
<select id="getReturnOrderGroupListByProductIds" resultType="com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto"
parameterType="java.util.List">
- select t1.sales_ledger_product_id,sum(t1.return_quantity) as sum_return_quantity from purchase_return_order_products as t1
+ select t1.sales_ledger_product_id,
+ sum(t1.return_quantity) as sum_return_quantity
+ from purchase_return_order_products as t1
inner join purchase_return_orders as t2 on t1.purchase_return_order_id = t2.id
WHERE t1.sales_ledger_product_id IN
<foreach item="id" collection="productIds" separator="," open="(" close=")">
diff --git a/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml b/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
index 0232873..8ca4903 100644
--- a/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
+++ b/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
@@ -8,6 +8,10 @@
<result column="no" property="no" />
<result column="return_type" property="returnType" />
<result column="supplier_id" property="supplierId" />
+ <result column="shipping_type" property="shippingType" />
+ <result column="truck_plate_no" property="truckPlateNo" />
+ <result column="express_company" property="expressCompany" />
+ <result column="express_no" property="expressNo" />
<result column="project_id" property="projectId" />
<result column="project_phase" property="projectPhase" />
<result column="prepared_at" property="preparedAt" />
@@ -18,16 +22,29 @@
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
-
- <select id="listPage" resultType="com.ruoyi.purchase.vo.PurchaseReturnOrderVo">
+ <sql id="getPurchaseReturnOrderHasAllInfoFormAndColumn">
SELECT
- pro.*,
- sm.supplier_name as supplierName,
- pl.purchase_contract_number as purchaseContractNumber
+ pro.*,
+ sm.supplier_name as supplier_name,
+ pl.purchase_contract_number as purchase_contract_number,
+ CASE
+ WHEN EXISTS (
+ SELECT 1
+ FROM purchase_return_order_products prop
+ INNER JOIN stock_out_record sor ON sor.record_id = prop.id
+ AND sor.record_type = '9'
+ AND sor.approval_status = 1
+ WHERE prop.purchase_return_order_id = pro.id
+ ) THEN 1
+ ELSE 0
+ END AS stock_out_approved
FROM purchase_return_orders pro
- LEFT JOIN supplier_manage sm ON pro.supplier_id = sm.id
- LEFT JOIN purchase_ledger pl ON pl.id = pro.purchase_ledger_id
- where 1=1
+ LEFT JOIN supplier_manage sm ON pro.supplier_id = sm.id
+ LEFT JOIN purchase_ledger pl ON pl.id = pro.purchase_ledger_id
+ </sql>
+ <select id="listPage" resultType="com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto">
+ <include refid="getPurchaseReturnOrderHasAllInfoFormAndColumn"/>
+ <where>
<if test="params.no != null and params.no != '' ">
AND pro.no LIKE CONCAT('%',#{params.no},'%')
</if>
@@ -43,6 +60,160 @@
<if test="params.createUser != null">
AND pro.create_user = #{params.createUser}
</if>
+ </where>
ORDER BY pro.create_time DESC
</select>
+ <select id="getPurchaseReturnOrderHasAllInfoById"
+ resultType="com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto">
+ <include refid="getPurchaseReturnOrderHasAllInfoFormAndColumn"/>
+ where pro.id = #{id}
+ </select>
+ <select id="listPageAccountPurchaseReturn"
+ resultType="com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo">
+ select pro.id,
+ pro.no returnNo,
+ t.inboundBatches,
+ sm.supplier_name,
+ pro.shipping_type,
+ pro.truck_plate_no,
+ pro.express_company,
+ pro.express_no,
+ pro.prepared_at,
+ pro.total_amount,
+ CASE pro.return_type WHEN 0 THEN '閫�璐ч��娆�' WHEN 1 THEN '鎷掓敹' END AS returnType,
+ pl.purchase_contract_number
+ from purchase_return_orders pro
+ left join
+ (select prop.purchase_return_order_id,
+ GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches
+ from purchase_return_order_products prop
+ left join stock_in_record sir on prop.stock_in_record_id = sir.id
+ GROUP BY prop.purchase_return_order_id) t on t.purchase_return_order_id = pro.id
+ left join supplier_manage sm on pro.supplier_id = sm.id
+ left join purchase_ledger pl on pro.purchase_ledger_id = pl.id
+ where 1=1
+ <if test="req.returnNo != null and req.returnNo != ''">
+ and pro.no like concat('%',#{req.returnNo},'%')
+ </if>
+ <if test="req.supplierId != null">
+ and pro.supplier_id = #{req.supplierId}
+ </if>
+ <if test="req.supplierName != null and req.supplierName != ''">
+ and sm.supplier_name like concat('%',#{req.supplierName},'%')
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND DATE_FORMAT(pro.prepared_at, '%Y-%m-%d') BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ order by pro.id DESC
+ </select>
+ <select id="getByPurchaseLedgerId" resultType="com.ruoyi.purchase.vo.PurchaseStockInProductVo">
+ SELECT
+ sir.id,
+ sir.product_model_id,
+ slp.id salesLedgerProductId,
+ slp.product_category,
+ slp.specification_model,
+ slp.unit,
+ slp.is_checked,
+ sir.inbound_batches,
+ sir.stock_in_num,
+ sir.batch_no,
+ slp.tax_inclusive_unit_price,
+ GREATEST(
+ sir.stock_in_num
+ - COALESCE(rs.total_return_num, 0)
+ - COALESCE(so.total_sale_out_num, 0),
+ 0
+ ) AS un_quantity,
+ COALESCE(rs.total_return_num, 0) AS total_return_num,
+ COALESCE(so.total_sale_out_num, 0) AS saleOutQuantity
+ FROM stock_in_record sir
+ LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id
+ LEFT JOIN purchase_ledger pl
+ ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id)
+ LEFT JOIN sales_ledger_product slp
+ ON pl.id = slp.sales_ledger_id
+ AND slp.product_model_id = sir.product_model_id
+ AND slp.type = 2
+ LEFT JOIN (
+ SELECT
+ stock_in_record_id,
+ SUM(return_quantity) AS total_return_num
+ FROM purchase_return_order_products prop
+ left join purchase_return_orders pro on pro.id = prop.purchase_return_order_id
+ WHERE 1=1
+ GROUP BY stock_in_record_id
+ ) rs ON rs.stock_in_record_id = sir.id
+ LEFT JOIN (
+ SELECT
+ inv.batch_no,
+ inv.product_model_id,
+ SUM(spd.quantity) AS total_sale_out_num
+ FROM shipping_product_detail spd
+ INNER JOIN shipping_info si
+ ON si.id = spd.shipping_info_id
+ INNER JOIN stock_out_record sor
+ ON sor.record_id = si.id
+ AND sor.record_type = '13'
+ AND sor.approval_status IN (0, 1, 3)
+ INNER JOIN stock_inventory inv
+ ON inv.id = spd.stock_inventory_id
+ GROUP BY inv.batch_no, inv.product_model_id
+ ) so ON so.product_model_id = sir.product_model_id
+ AND (so.batch_no = sir.batch_no OR (so.batch_no IS NULL AND sir.batch_no IS NULL))
+ WHERE sir.approval_status = 1
+ AND sir.record_type IN ('7','10')
+ and pl.id = #{purchaseLedgerId}
+ </select>
+ <select id="getPurchaseReturnOrderProductsDetailById"
+ resultType="com.ruoyi.purchase.vo.PurchaseReturnOrderProductsDetailVo">
+ select prop.id,
+ prop.sales_ledger_product_id,
+ slp.product_model_id,
+ slp.product_category,
+ slp.specification_model,
+ slp.is_checked,
+ slp.unit,
+ sir.inbound_batches,
+ sir.stock_in_num,
+ sir.batch_no,
+ slp.tax_inclusive_unit_price,
+ prop.return_quantity,
+ prop.purchase_return_order_id,
+ GREATEST(
+ sir.stock_in_num
+ - COALESCE(rs.total_return_num, 0)
+ - COALESCE(so.total_sale_out_num, 0),
+ 0
+ ) AS un_quantity,
+ COALESCE(rs.total_return_num, 0) AS total_return_num,
+ COALESCE(so.total_sale_out_num, 0) AS saleOutQuantity
+ from purchase_return_order_products prop
+ left join purchase_return_orders pro on prop.purchase_return_order_id = pro.id
+ LEFT JOIN stock_in_record sir ON prop.stock_in_record_id = sir.id and sir.record_type in ('7','10')
+ LEFT JOIN sales_ledger_product slp ON prop.sales_ledger_product_id = slp.id and slp.type = 2
+ LEFT JOIN (SELECT stock_in_record_id,
+ SUM(return_quantity) AS total_return_num
+ FROM purchase_return_order_products
+ WHERE 1 = 1
+ GROUP BY stock_in_record_id) rs ON rs.stock_in_record_id = sir.id
+ LEFT JOIN (
+ SELECT
+ inv.batch_no,
+ inv.product_model_id,
+ SUM(spd.quantity) AS total_sale_out_num
+ FROM shipping_product_detail spd
+ INNER JOIN shipping_info si
+ ON si.id = spd.shipping_info_id
+ INNER JOIN stock_out_record sor
+ ON sor.record_id = si.id
+ AND sor.record_type = '13'
+ AND sor.approval_status IN (0, 1, 3)
+ INNER JOIN stock_inventory inv
+ ON inv.id = spd.stock_inventory_id
+ GROUP BY inv.batch_no, inv.product_model_id
+ ) so ON so.product_model_id = sir.product_model_id
+ AND (so.batch_no = sir.batch_no OR (so.batch_no IS NULL AND sir.batch_no IS NULL))
+ where pro.id = #{id}
+ </select>
</mapper>
diff --git a/src/main/resources/mapper/quality/QualityInspectMapper.xml b/src/main/resources/mapper/quality/QualityInspectMapper.xml
index f252881..ed01cad 100644
--- a/src/main/resources/mapper/quality/QualityInspectMapper.xml
+++ b/src/main/resources/mapper/quality/QualityInspectMapper.xml
@@ -54,6 +54,15 @@
<if test="qualityInspect.entryDateEnd != null and qualityInspect.entryDateEnd != '' ">
AND qi.check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-%d')
</if>
+ <if test="qualityInspect.purchaseContractNo != null and qualityInspect.purchaseContractNo != '' ">
+ AND pl.purchase_contract_number like concat('%',#{qualityInspect.purchaseContractNo},'%')
+ </if>
+ <if test="qualityInspect.workOrderNo != null and qualityInspect.workOrderNo != '' ">
+ AND pot.work_order_no like concat('%',#{qualityInspect.workOrderNo},'%')
+ </if>
+ <if test="qualityInspect.salesContractNo != null and qualityInspect.salesContractNo != '' ">
+ AND po_sales.sales_contract_no like concat('%',#{qualityInspect.salesContractNo},'%')
+ </if>
ORDER BY qi.check_time DESC
</select>
@@ -128,8 +137,7 @@
COALESCE(SUM(
CASE
WHEN qi.inspect_state = 1
- AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ THEN qi.qualified_quantity
ELSE 0
END
), 0) AS qualifiedCount,
@@ -137,8 +145,7 @@
COALESCE(SUM(
CASE
WHEN qi.inspect_state = 1
- AND qi.check_result = '涓嶅悎鏍�'
- THEN qi.quantity
+ THEN qi.unqualified_quantity
ELSE 0
END
), 0) AS unqualifiedCount,
@@ -166,8 +173,7 @@
COALESCE(SUM(
CASE
WHEN qi.inspect_state = 1
- AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ THEN qi.qualified_quantity
ELSE 0
END
), 0)
@@ -248,8 +254,8 @@
/* 鍚堟牸 */
COALESCE(SUM(
CASE
- WHEN qi.inspect_state = 1 AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ WHEN qi.inspect_state = 1
+ THEN qi.qualified_quantity
ELSE 0
END
), 0) AS qualifiedCount,
@@ -257,8 +263,8 @@
/* 涓嶅悎鏍� */
COALESCE(SUM(
CASE
- WHEN qi.inspect_state = 1 AND qi.check_result = '涓嶅悎鏍�'
- THEN qi.quantity
+ WHEN qi.inspect_state = 1
+ THEN qi.unqualified_quantity
ELSE 0
END
), 0) AS unqualifiedCount,
@@ -279,8 +285,8 @@
ROUND(
COALESCE(SUM(
CASE
- WHEN qi.inspect_state = 1 AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ WHEN qi.inspect_state = 1
+ THEN qi.qualified_quantity
ELSE 0
END
), 0)
@@ -312,7 +318,6 @@
<select id="getYearlyPassRateStatistics" resultType="com.ruoyi.quality.dto.QualityPassRateDto">
SELECT t.modelType,
-
COALESCE(SUM(
CASE
WHEN pp.product_name = '鍘熸潗鏂�' AND t.modelType = 0 THEN qi.quantity
@@ -320,8 +325,23 @@
WHEN pp.product_name = '鎴愬搧' AND t.modelType = 2 THEN qi.quantity
ELSE 0
END
- ), 0) AS totalCount
-
+ ), 0) AS totalCount,
+ COALESCE(SUM(
+ CASE
+ WHEN pp.product_name = '鍘熸潗鏂�' AND t.modelType = 0 THEN qi.qualified_quantity
+ WHEN pp.product_name = '鍗婃垚鍝�' AND t.modelType = 1 THEN qi.qualified_quantity
+ WHEN pp.product_name = '鎴愬搧' AND t.modelType = 2 THEN qi.qualified_quantity
+ ELSE 0
+ END
+ ), 0) AS qualifiedCount,
+ COALESCE(SUM(
+ CASE
+ WHEN pp.product_name = '鍘熸潗鏂�' AND t.modelType = 0 THEN qi.unqualified_quantity
+ WHEN pp.product_name = '鍗婃垚鍝�' AND t.modelType = 1 THEN qi.unqualified_quantity
+ WHEN pp.product_name = '鎴愬搧' AND t.modelType = 2 THEN qi.unqualified_quantity
+ ELSE 0
+ END
+ ), 0) AS unqualifiedCount
FROM (SELECT 0 AS modelType
UNION ALL
SELECT 1
@@ -334,8 +354,6 @@
ON qi.product_model_id = pm.id
AND YEAR(qi.check_time) = #{year}
AND qi.inspect_state = 1
- AND qi.check_result = '鍚堟牸'
-
GROUP BY t.modelType
ORDER BY t.modelType;
</select>
diff --git a/src/main/resources/mapper/quality/QualityTestStandardMapper.xml b/src/main/resources/mapper/quality/QualityTestStandardMapper.xml
index f326a66..53eef84 100644
--- a/src/main/resources/mapper/quality/QualityTestStandardMapper.xml
+++ b/src/main/resources/mapper/quality/QualityTestStandardMapper.xml
@@ -19,6 +19,7 @@
<if test="c.inspectType != null ">
AND inspect_type =#{c.inspectType}
</if>
+ order by create_time desc
</select>
<select id="getQualityTestStandardByProductId" resultType="com.ruoyi.quality.pojo.QualityTestStandard">
SELECT qts.*
diff --git a/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml b/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
index 5bda4f6..d995258 100644
--- a/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
+++ b/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
@@ -26,23 +26,24 @@
END AS method
FROM quality_unqualified qu
LEFT JOIN product_model pm ON qu.model = pm.id
- where
- 1=1
- <if test="qualityUnqualified.inspectType != null ">
- AND inspect_type = #{qualityUnqualified.inspectType}
- </if>
- <if test="qualityUnqualified.inspectState != null ">
- AND inspect_state = #{qualityUnqualified.inspectState}
- </if>
- <if test="qualityUnqualified.productName != null and qualityUnqualified.productName != '' ">
- AND product_name = #{qualityUnqualified.productName}
- </if>
- <if test="qualityUnqualified.entryDateStart != null and qualityUnqualified.entryDateStart != '' ">
- AND check_time >= DATE_FORMAT(#{qualityUnqualified.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="qualityUnqualified.entryDateEnd != null and qualityUnqualified.entryDateEnd != '' ">
- AND check_time <= DATE_FORMAT(#{qualityUnqualified.entryDateEnd},'%Y-%m-%d')
- </if>
+ <where>
+ <if test="qualityUnqualified.inspectType != null ">
+ AND inspect_type = #{qualityUnqualified.inspectType}
+ </if>
+ <if test="qualityUnqualified.inspectState != null ">
+ AND inspect_state = #{qualityUnqualified.inspectState}
+ </if>
+ <if test="qualityUnqualified.productName != null and qualityUnqualified.productName != '' ">
+ AND product_name = #{qualityUnqualified.productName}
+ </if>
+ <if test="qualityUnqualified.entryDateStart != null and qualityUnqualified.entryDateStart != '' ">
+ AND check_time >= DATE_FORMAT(#{qualityUnqualified.entryDateStart},'%Y-%m-%d')
+ </if>
+ <if test="qualityUnqualified.entryDateEnd != null and qualityUnqualified.entryDateEnd != '' ">
+ AND check_time <= DATE_FORMAT(#{qualityUnqualified.entryDateEnd},'%Y-%m-%d')
+ </if>
+ </where>
+ order by qu.create_time desc
</select>
<select id="qualityUnqualifiedExport" resultType="com.ruoyi.quality.pojo.QualityUnqualified">
SELECT
@@ -84,7 +85,7 @@
ELSE false
END AS method
FROM quality_unqualified qu
- LEFT JOIN product_model pm ON qu.model = pm.id
+ LEFT JOIN product_model pm ON qu.product_model_id = pm.id
where
1=1
and qu.id = #{id}
diff --git a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
deleted file mode 100644
index 5454640..0000000
--- a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
+++ /dev/null
@@ -1,185 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.sales.mapper.InvoiceLedgerMapper">
- <select id="invoiceLedgerPage" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_contract_no ,
- T1.customer_id ,
- T1.invoice_no ,
- T1.invoice_amount ,
- T1.tax_rate ,
- T1.invoice_person ,
- T1.invoice_date ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id ,
- T2.customer_name,
- T3.customer_contract_no,
- T3.salesman,
- T4.invoiceFileName
- FROM invoice_ledger T1
- LEFT JOIN customer T2 ON T1.customer_id = T2.id
- LEFT JOIN sales_ledger T3 ON T1.sales_ledger_id = T3.id
- LEFT JOIN (
- SELECT
- invoice_ledger_id,
- GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
- FROM invoice_ledger_file GROUP BY invoice_ledger_id
- ) T4 ON T4.invoice_ledger_id = T1.id
- <where>
- <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != ''">
- AND (
- T2.customer_name LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%')
- OR T1.sales_contract_no LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%')
- )
- </if>
- <if test="invoiceLedgerDto.invoiceDate != null">
- AND DATE_FORMAT(T1.invoice_date,'%Y-%m-%d') = DATE_FORMAT(#{invoiceLedgerDto.invoiceDate},'%Y-%m-%d')
- </if>
- </where>
- </select>
-
- <select id="invoiceLedgerList" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_contract_no ,
- T1.customer_id ,
- T1.invoice_no ,
- T1.invoice_amount ,
- T1.tax_rate ,
- T1.invoice_person ,
- T1.invoice_date ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id ,
- T2.customer_name,
- T3.salesman,
- T3.customer_contract_no,
- T4.invoiceFileName
- FROM invoice_ledger T1
- LEFT JOIN customer T2 ON T1.customer_id = T2.id
- LEFT JOIN sales_ledger T3 ON T1.sales_ledger_id = T3.id
- LEFT JOIN (
- SELECT
- invoice_ledger_id,
- GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
- FROM invoice_ledger_file GROUP BY invoice_ledger_id
- ) T4 ON T4.invoice_ledger_id = T1.id
- <where>
- <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != ''">
- AND (
- T2.customer_name LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%')
- OR T1.sales_contract_no LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%')
- )
- </if>
- <if test="invoiceLedgerDto.invoiceDate != null">
- AND DATE_FORMAT(T1.invoice_date,'%Y-%m-%d') = DATE_FORMAT(#{invoiceLedgerDto.invoiceDate},'%Y-%m-%d')
- </if>
- </where>
- </select>
-
- <select id="invoiceLedgerInfo" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_contract_no ,
- T1.customer_id ,
- T1.invoice_no ,
- T1.invoice_amount ,
- T1.tax_rate ,
- T1.invoice_person ,
- T1.invoice_date ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id ,
- T2.customer_name
- FROM invoice_ledger T1
- LEFT JOIN customer T2 ON T1.customer_id = T2.id
- WHERE T1.id = #{id}
- </select>
-
- <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
- SELECT
- T1.customer_id as id,
- T1.customer_name,
- SUM(contract_amount) AS invoice_total,
- IFNULL( SUM(T2.receipt_payment_amount) , 0 ) AS receipt_payment_amount,
- IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.receipt_payment_amount),0)),0) AS unReceipt_payment_amount
- FROM sales_ledger T1
- LEFT JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id
- <where>
- <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' ">
- T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
- </if>
- </where>
- GROUP BY T1.customer_name,t1.customer_id
- </select>
-
- <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_ledger_product_id ,
- T1.invoice_registration_id ,
- T1.product_category ,
- T1.specification_model ,
- T1.unit ,
- T1.quantity ,
- T1.tax_rate ,
- T1.tax_inclusive_unit_price ,
- T1.tax_inclusive_total_price ,
- T1.tax_exclusive_total_price ,
- T1.invoice_type ,
- T1.invoice_num ,
- T1.invoice_amount ,
- T1.no_invoice_num ,
- T1.no_invoice_amount ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id,
- T2.sales_contract_no,
- T2.customer_contract_no,
- T2.customer_name,
- T3.invoice_no,
- T3.invoice_total,
- T3.invoice_person,
- T3.invoice_date,
- T3.id AS invoice_ledger_id
- FROM invoice_registration_product T1
- LEFT JOIN sales_ledger T2 ON T1.sales_ledger_id = T2.id
- LEFT JOIN invoice_ledger T3 ON T1.id = T3.invoice_registration_product_id
- WHERE T1.id = #{id}
- </select>
-
- <select id="invoicedTotal" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
- SELECT
- IFNULL(SUM(T1.invoice_total),0) AS invoice_total,
- T2.sales_ledger_id
- FROM
- invoice_ledger T1
- LEFT JOIN invoice_registration_product T2 ON T1.invoice_registration_product_id = T2.id
- <where>
- AND T2.sales_ledger_id IN
- <foreach collection="salesLedgerIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </where>
- GROUP BY
- T2.sales_ledger_id
- </select>
-
-
-</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml b/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml
deleted file mode 100644
index 9edbea4..0000000
--- a/src/main/resources/mapper/sales/InvoiceRegistrationMapper.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.sales.mapper.InvoiceRegistrationMapper">
- <select id="invoiceRegistrationListPage" resultType="com.ruoyi.sales.dto.InvoiceRegistrationDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_contract_no ,
- T1.customer_id ,
- T1.salesman ,
- T1.project_name ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id,
- T2.customer_contract_no,
- T3.customer_name,
- T2.contract_amount,
- CASE WHEN T4.noInvoiceAmountTotal IS NULL THEN 0 ELSE T4.noInvoiceAmountTotal END AS noInvoiceAmountTotal
- FROM invoice_registration T1
- LEFT JOIN sales_ledger T2 ON T1.sales_ledger_id = T2.id
- LEFT JOIN customer T3 ON T1.customer_id = T3.id
- LEFT JOIN (
- SELECT
- SUM( no_invoice_amount ) AS noInvoiceAmountTotal ,
- invoice_registration_id
- FROM
- invoice_registration_product
- GROUP BY
- invoice_registration_id
- ) T4 ON T1.id = T4.invoice_registration_id
- </select>
-
- <select id="invoiceRegisAndProductExcelDtoList" resultType="com.ruoyi.sales.excel.InvoiceRegisAndProductExcelDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_contract_no ,
- T1.customer_id ,
- T1.salesman ,
- T1.project_name ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id,
- T2.customer_contract_no,
- T3.customer_name,
- T2.contract_amount,
- T4.product_category,
- T4.specification_model,
- T4.unit,
- T4.quantity,
- T4.tax_rate,
- T4.tax_inclusive_unit_price,
- T4.tax_inclusive_total_price,
- T4.tax_exclusive_total_price,
- T4.invoice_type,
- T4.invoice_num,
- T4.invoice_amount,
- T4.no_invoice_num,
- T4.no_invoice_amount
- FROM invoice_registration T1
- JOIN sales_ledger T2 ON T1.sales_ledger_id = T2.id
- JOIN customer T3 ON T1.customer_id = T3.id
- JOIN invoice_registration_product T4 ON T1.id = T4.invoice_registration_id
- ORDER BY T1.id ASC
- </select>
-</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/InvoiceRegistrationProductMapper.xml b/src/main/resources/mapper/sales/InvoiceRegistrationProductMapper.xml
deleted file mode 100644
index fcaba49..0000000
--- a/src/main/resources/mapper/sales/InvoiceRegistrationProductMapper.xml
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper">
-
- <select id="invoiceRegistrationProductList" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_ledger_product_id ,
- T1.invoice_registration_id ,
- T1.product_category ,
- T1.specification_model ,
- T1.unit ,
- T1.quantity ,
- T1.tax_rate ,
- T1.tax_inclusive_unit_price ,
- T1.tax_inclusive_total_price ,
- T1.tax_exclusive_total_price ,
- T1.invoice_type ,
- T1.invoice_num ,
- T1.invoice_amount ,
- T1.no_invoice_num ,
- T1.no_invoice_amount ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id,
- T2.sales_contract_no,
- T2.customer_contract_no,
- T2.customer_name,
- T3.invoice_no,
- T3.invoice_total,
- T3.invoice_person,
- T3.invoice_date,
- T4.invoiceFileName
- FROM invoice_registration_product T1
- LEFT JOIN sales_ledger T2 ON T1.sales_ledger_id = T2.id
- LEFT JOIN invoice_ledger T3 ON T1.id = T3.invoice_registration_product_id
- LEFT JOIN (
- SELECT
- invoice_ledger_id,
- GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
- FROM invoice_ledger_file GROUP BY invoice_ledger_id
- ) T4 ON T4.invoice_ledger_id = T3.id
- <where>
- <if test="invoiceRegistrationProductDto.searchText != null and invoiceRegistrationProductDto.searchText != '' ">
- AND (T2.sales_contract_no LIKE CONCAT('%',#{invoiceRegistrationProductDto.searchText},'%')
- OR
- T2.customer_name LIKE CONCAT('%',#{invoiceRegistrationProductDto.searchText},'%')
- )
- </if>
- <if test="invoiceRegistrationProductDto.invoiceDate != null">
- AND T3.invoice_date = #{invoiceRegistrationProductDto.invoiceDate}
- </if>
- </where>
- ORDER BY T1.create_time DESC
- </select>
-
- <select id="invoiceRegistrationProductPage" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_ledger_product_id ,
- T1.invoice_registration_id ,
- T1.product_category ,
- T1.specification_model ,
- T1.unit ,
- T1.quantity ,
- T1.tax_rate ,
- T1.tax_inclusive_unit_price ,
- T1.tax_inclusive_total_price ,
- T1.tax_exclusive_total_price ,
- T1.invoice_type ,
- T1.invoice_num ,
- T1.invoice_amount ,
- T1.no_invoice_num ,
- T1.no_invoice_amount ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id,
- T2.sales_contract_no,
- T2.customer_contract_no,
- T2.customer_name,
- T3.invoice_no,
- T3.id as invoice_ledger_id,
- IFNULL(T3.invoice_total,0) AS invoice_total,
- T3.invoice_person,
- T3.invoice_date,
- T4.invoiceFileName,
- T2.project_name,
- u.nick_name as invoicePerson
- FROM invoice_registration_product T1
- LEFT JOIN sales_ledger T2 ON T1.sales_ledger_id = T2.id
- LEFT JOIN sys_user u ON u.user_id = T1.create_user
- RIGHT JOIN invoice_ledger T3 ON T1.id = T3.invoice_registration_product_id
- LEFT JOIN (
- SELECT
- invoice_ledger_id,
- GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
- FROM invoice_ledger_file GROUP BY invoice_ledger_id
- ) T4 ON T4.invoice_ledger_id = T3.id
- <where>
- <if test="invoiceRegistrationProductDto.searchText != null and invoiceRegistrationProductDto.searchText != '' ">
- AND (T2.sales_contract_no LIKE CONCAT('%',#{invoiceRegistrationProductDto.searchText},'%')
- OR
- T2.customer_name LIKE CONCAT('%',#{invoiceRegistrationProductDto.searchText},'%')
- )
- </if>
- <if test="invoiceRegistrationProductDto.invoiceDateStart != null and invoiceRegistrationProductDto.invoiceDateStart != ''">
- AND T3.invoice_date >= str_to_date(#{invoiceRegistrationProductDto.invoiceDateStart}, '%Y-%m-%d')
- </if>
- <if test="invoiceRegistrationProductDto.invoiceDateEnd != null and invoiceRegistrationProductDto.invoiceDateEnd != ''">
- AND T3.invoice_date < date_add(str_to_date(#{invoiceRegistrationProductDto.invoiceDateEnd},
- '%Y-%m-%d'), interval 1 day)
- </if>
- <if test="invoiceRegistrationProductDto.createTimeStart != null ">
- AND T1.create_time >= date_format(#{invoiceRegistrationProductDto.createTimeStart}, '%Y-%m-%d
- %H:%i:%s')
- </if>
- <if test="invoiceRegistrationProductDto.createTimeEnd != null ">
- AND T1.create_time <= date_format(#{invoiceRegistrationProductDto.createTimeStart}, '%Y-%m-%d
- %H:%i:%s')+interval 1 day
- </if>
- </where>
- ORDER BY T1.create_time DESC
- </select>
-</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
deleted file mode 100644
index 975d120..0000000
--- a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
+++ /dev/null
@@ -1,454 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.sales.mapper.ReceiptPaymentMapper">
- <select id="receiptPaymentListPage" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
- SELECT
- T4.customer_id,
- IFNULL(T5.invoice_total,0) AS invoice_total,
- T1.receipt_payment_amount,
- T1.receipt_payment_date
- FROM
- receipt_payment T1
- LEFT JOIN invoice_ledger T2 ON T1.invoice_ledger_id = T2.id
- LEFT JOIN invoice_registration_product T3 ON T2.invoice_registration_product_id = T3.id
- LEFT JOIN sales_ledger T4 ON T4.id = T3.sales_ledger_id
- LEFT JOIN (
- SELECT
- T3.customer_id,
- SUM( invoice_total ) AS invoice_total
- FROM
- invoice_ledger T1
- LEFT JOIN invoice_registration_product T2 ON T1.invoice_registration_product_id = T2.id
- LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id
- GROUP BY T3.customer_id
- ) T5 ON T5.customer_id = T4.customer_id
- <where>
- <if test="receiptPaymentDto.customerId != null">
- AND T4.customer_id = #{receiptPaymentDto.customerId}
- </if>
- </where>
- ORDER BY T1.create_time ASC
- </select>
-
- <select id="receiptPaymentInfo" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
- SELECT
- T1.id ,
- T1.sales_ledger_id ,
- T1.sales_contract_no ,
- T1.customer_id ,
- T1.invoice_no ,
- T1.invoice_amount ,
- T1.tax_rate ,
- T1.receipt_payment_type ,
- T1.receipt_payment_amount ,
- T1.registrant ,
- T1.receipt_payment_date ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id,
- T1.invoice_ledger_id,
- T3.customer_contract_no,
- T2.customer_name
- FROM receipt_payment T1
- LEFT JOIN customer T2 ON T1.customer_id = T2.id
- LEFT JOIN sales_ledger T3 ON T1.sales_ledger_id = T3.id
- WHERE T1.id = #{id}
- </select>
-
- <select id="bindInvoiceNoRegPage" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
- SELECT
- T1.id,
- T1.invoice_no,
- T1.invoice_total,
- T3.project_name,
- T1.invoice_person,
- T1.invoice_date,
- T1.create_time,
- T1.create_user,
- T1.update_time,
- T1.update_user,
- T1.tenant_id,
- T2.tax_rate,
- T3.sales_contract_no,
- T3.customer_contract_no,
- T3.customer_name,
- T4.invoiceFileName,
- T5.product_category,
- IFNULL(T6.receipt_payment_amount_total, 0) AS receipt_payment_amount_total,
- (T1.invoice_total - IFNULL(T6.receipt_payment_amount_total, 0)) AS noReceiptAmount
- FROM invoice_ledger T1
- LEFT JOIN invoice_registration_product T2 ON T2.id = T1.invoice_registration_product_id
- LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id
- LEFT JOIN (
- SELECT
- invoice_ledger_id,
- GROUP_CONCAT(name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
- FROM invoice_ledger_file
- GROUP BY invoice_ledger_id
- ) T4 ON T4.invoice_ledger_id = T1.id
- LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
- LEFT JOIN (
- SELECT
- SUM(receipt_payment_amount) AS receipt_payment_amount_total,
- invoice_ledger_id
- FROM receipt_payment
- GROUP BY invoice_ledger_id
- ) T6 ON T1.id = T6.invoice_ledger_id
- <where>
- <if test="req.customerName != null and req.customerName !=''">
- AND T3.customer_name LIKE CONCAT('%',#{req.customerName},'%')
- </if>
- <if test="req.invoiceLedgerId != null">
- AND T1.id = #{req.invoiceLedgerId}
- </if>
- <if test="req.customerContractNo != null and req.customerContractNo !=''">
- AND T3.customer_contract_no LIKE CONCAT('%',#{req.customerContractNo},'%')
- </if>
- <if test="req.projectName != null and req.projectName !=''">
- AND T3.project_name LIKE CONCAT('%',#{req.projectName},'%')
- </if>
- <if test="req.invoiceDateStart != null and req.invoiceDateStart != '' ">
- AND T1.invoice_date >= DATE_FORMAT(#{req.invoiceDateStart},'%Y-%m-%d')
- </if>
- <if test="req.invoiceDateEnd != null and req.invoiceDateEnd != '' ">
- AND T1.invoice_date <= DATE_FORMAT(#{req.invoiceDateEnd},'%Y-%m-%d')
- </if>
- <if test="req.status != null and req.status">
- and (T1.invoice_total - IFNULL(T6.receipt_payment_amount_total, 0)) > 0
- </if>
- </where>
-
- ORDER BY IFNULL(T2.create_time, T1.create_time) DESC
-
- </select>
-
- <select id="invoiceInfo" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
- SELECT
- T1.id,
- T1.invoice_no,
- T1.invoice_total ,
- T2.tax_rate,
- T3.customer_name,
- T3.sales_contract_no
- FROM
- invoice_ledger T1
- LEFT JOIN
- invoice_registration_product T2 ON T1.invoice_registration_product_id = T2.id
- LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id
- WHERE T1.id = #{id}
- </select>
-
- <select id="getReceiptAmount" resultType="java.math.BigDecimal">
- SELECT
- SUM( receipt_payment_amount ) AS total_amount
- FROM
- (
- SELECT
- T1.receipt_payment_amount
- FROM
- receipt_payment T1
- LEFT JOIN invoice_ledger T2 ON T1.invoice_ledger_id = T2.id
- LEFT JOIN invoice_registration_product T3 ON T2.invoice_registration_product_id = T3.id
- LEFT JOIN sales_ledger T4 ON T4.id = T3.sales_ledger_id
- LEFT JOIN (
- SELECT
- T3.customer_id,
- SUM( invoice_total ) AS invoice_total
- FROM
- invoice_ledger T1
- LEFT JOIN invoice_registration_product T2 ON T1.invoice_registration_product_id = T2.id
- LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id
- GROUP BY
- T3.customer_id
- ) T5 ON T5.customer_id = T4.customer_id
- WHERE
- T4.customer_id = #{customerId}
-
- ORDER BY
- T1.create_time ASC
- LIMIT #{total} ) AS limited_rows
- </select>
-
- <select id="receiptPaymentHistoryList" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
- SELECT
- T1.receipt_payment_date,
- T5.customer_name,
- T1.receipt_payment_amount,
- T1.receipt_payment_type,
- T1.registrant,
- T1.create_time
- FROM
- receipt_payment T1
- LEFT JOIN
- invoice_ledger T2 ON T1.invoice_ledger_id = T2.id
- LEFT JOIN invoice_registration_product T3 ON T2.invoice_registration_product_id = T3.id
- LEFT JOIN sales_ledger T4 ON T3.sales_ledger_id = T4.id
- LEFT JOIN customer T5 ON T5.id = T4.customer_id
- <where>
- <if test="params.searchText != null and params.searchText != '' ">
- T5.customer_name LIKE CONCAT('%',#{params.searchText},'%')
- </if>
- </where>
- ORDER BY T1.receipt_payment_date DESC
- </select>
-
- <select id="receiptPaymentHistoryListPage" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
- SELECT
- T1.id,
- T1.receipt_payment_date,
- T5.customer_name,
- T1.receipt_payment_amount,
- T1.receipt_payment_type,
- T1.registrant,
- T1.create_time,
- T4.project_name,
- T4.sales_contract_no,
- T4.customer_contract_no
- FROM
- receipt_payment T1
- LEFT JOIN sales_ledger T4 ON T1.sales_ledger_id = T4.id
- LEFT JOIN customer T5 ON T5.id = T4.customer_id
- <where>
- <if test="params.searchText != null and params.searchText != '' ">
- T5.customer_name LIKE CONCAT('%',#{params.searchText},'%')
- </if>
- <if test="params.receiptPaymentDateStart != null and params.receiptPaymentDateStart != '' ">
- AND T1.receipt_payment_date >= date_format(#{params.receiptPaymentDateStart},'%Y-%m-%d')
- </if>
- <if test="params.receiptPaymentDateEnd != null and params.receiptPaymentDateEnd != '' ">
- AND T1.receipt_payment_date <= date_format(#{params.receiptPaymentDateEnd}, '%Y-%m-%d')
- </if>
- <if test="params.projectName != null and params.projectName != '' ">
- AND T4.project_name LIKE CONCAT('%',#{params.projectName},'%')
- </if>
- <if test="params.customerContractNo != null and params.customerContractNo != '' ">
- AND T4.customer_contract_no LIKE CONCAT('%',#{params.customerContractNo},'%')
- </if>
- <if test="params.salesContractNo != null and params.salesContractNo != '' ">
- AND T4.sales_contract_no LIKE CONCAT('%',#{params.salesContractNo},'%')
- </if>
- </where>
- ORDER BY T1.receipt_payment_date DESC
- </select>
-
-
-
-
-<!-- SELECT-->
-<!-- *-->
-<!-- FROM-->
-<!-- (-->
-<!-- SELECT-->
-<!-- receipt_payment_amount AS receiptAmount,-->
-<!-- receipt_payment_date AS happenTime,-->
-<!-- 0 AS type,-->
-<!-- 0 AS invoiceAmount-->
-<!-- FROM-->
-<!-- receipt_payment-->
-<!-- WHERE-->
-<!-- invoice_ledger_id IN (-->
-<!-- SELECT-->
-<!-- id-->
-<!-- FROM-->
-<!-- invoice_ledger-->
-<!-- WHERE-->
-<!-- invoice_registration_product_id IN (-->
-<!-- SELECT-->
-<!-- id-->
-<!-- FROM-->
-<!-- invoice_registration_product-->
-<!-- WHERE-->
-<!-- sales_ledger_id IN ( SELECT id FROM sales_ledger WHERE customer_id = #{customerId} ))) UNION-->
-<!-- SELECT-->
-<!-- 0 AS receiptAmount,-->
-<!-- invoice_date AS happenTime,-->
-<!-- 1 AS type,-->
-<!-- invoice_total AS invoiceAmount-->
-<!-- FROM-->
-<!-- invoice_ledger-->
-<!-- WHERE-->
-<!-- invoice_registration_product_id IN (-->
-<!-- SELECT-->
-<!-- id-->
-<!-- FROM-->
-<!-- invoice_registration_product-->
-<!-- WHERE-->
-<!-- sales_ledger_id IN ( SELECT id FROM sales_ledger WHERE customer_id = #{customerId} ))-->
-<!-- AND invoice_date IS NOT NULL-->
-<!-- ) T1-->
-<!-- ORDER BY-->
-<!-- T1.happenTime ASC-->
-
-
- <select id="customerInteractions" resultType="com.ruoyi.sales.dto.CustomerInteractionDto">
- SELECT
- rp.receipt_payment_amount AS receiptAmount,
- rp.receipt_payment_date AS happenTime,
- 0 AS type,
- 0 AS invoiceAmount
- FROM
- receipt_payment rp
- WHERE EXISTS (
- SELECT 1
- FROM invoice_ledger il
- JOIN invoice_registration_product irp ON il.invoice_registration_product_id = irp.id
- JOIN sales_ledger sl ON irp.sales_ledger_id = sl.id
- WHERE sl.customer_id = #{customerId}
- AND rp.invoice_ledger_id = il.id
- )
-
- UNION ALL
-
- SELECT
- 0 AS receiptAmount,
- il.invoice_date AS happenTime,
- 1 AS type,
- il.invoice_total AS invoiceAmount
- FROM
- invoice_ledger il
- JOIN invoice_registration_product irp ON il.invoice_registration_product_id = irp.id
- JOIN sales_ledger sl ON irp.sales_ledger_id = sl.id
- WHERE
- sl.customer_id = #{customerId}
- AND il.invoice_date IS NOT NULL
-
- ORDER BY happenTime ASC;
- </select>
-
- <select id="receiptPaymentHistoryListNoPage" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
- SELECT
- T1.id,
- T1.receipt_payment_date,
- T5.customer_name,
- T1.receipt_payment_amount,
- T1.receipt_payment_type,
- T1.registrant,
- T1.create_time
- FROM
- receipt_payment T1
- LEFT JOIN
- invoice_ledger T2 ON T1.invoice_ledger_id = T2.id
- LEFT JOIN invoice_registration_product T3 ON T2.invoice_registration_product_id = T3.id
- LEFT JOIN sales_ledger T4 ON T3.sales_ledger_id = T4.id
- LEFT JOIN customer T5 ON T5.id = T4.customer_id
- WHERE T1.invoice_ledger_id = #{params.invoiceLedgerId}
- ORDER BY T1.receipt_payment_date DESC
- </select>
-
- <select id="receiptPaymentListByProdRegId" resultType="com.ruoyi.sales.pojo.ReceiptPayment">
- SELECT
- T1.*
- FROM
- receipt_payment T1
- LEFT JOIN invoice_ledger T2 ON T1.invoice_ledger_id = T2.id
- WHERE
- T2.invoice_registration_product_id = #{invoiceRegistrationProductId}
- </select>
- <select id="bindInvoiceNoRegListAll" resultType="com.ruoyi.sales.dto.ReceiptPaymentDto">
- SELECT
- T1.id ,
- T1.invoice_no ,
- T1.invoice_total ,
- T3.project_name,
- T1.invoice_person ,
- T1.invoice_date ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id ,
- T2.tax_rate,
- T3.sales_contract_no,
- T3.customer_contract_no,
- T3.customer_name,
- T4.invoiceFileName,
- T5.product_category,
- IFNULL(T6.receipt_payment_amount_total ,0) AS receipt_payment_amount_total,
- (T1.invoice_total - IFNULL(T6.receipt_payment_amount_total ,0)) AS no_receipt_amount
- FROM invoice_ledger T1
- LEFT JOIN invoice_registration_product T2 ON T2.id = T1.invoice_registration_product_id
- LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id
- LEFT JOIN (
- SELECT
- invoice_ledger_id,
- GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
- FROM invoice_ledger_file GROUP BY invoice_ledger_id
- ) T4 ON T4.invoice_ledger_id = T1.id
- LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
- LEFT JOIN (
- SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP
- BY invoice_ledger_id
- ) T6 ON T1.id = T6.invoice_ledger_id
- </select>
- <select id="bindInvoiceNoRegListByIds" resultType="com.ruoyi.sales.dto.ReceiptPaymentExeclDto">
- SELECT
- T1.id ,
- T1.invoice_no ,
- T1.invoice_total ,
- T3.project_name,
- T1.invoice_person ,
- T1.invoice_date ,
- T1.create_time ,
- T1.create_user ,
- T1.update_time ,
- T1.update_user ,
- T1.tenant_id ,
- T2.tax_rate,
- T3.sales_contract_no,
- T3.customer_contract_no,
- T3.customer_name,
- T4.invoiceFileName,
- T5.product_category,
- IFNULL(T6.receipt_payment_amount_total ,0) AS receipt_payment_amount_total,
- (T1.invoice_total - IFNULL(T6.receipt_payment_amount_total ,0)) AS no_receipt_amount
- FROM invoice_ledger T1
- LEFT JOIN invoice_registration_product T2 ON T2.id = T1.invoice_registration_product_id
- LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id
- LEFT JOIN (
- SELECT
- invoice_ledger_id,
- GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
- FROM invoice_ledger_file GROUP BY invoice_ledger_id
- ) T4 ON T4.invoice_ledger_id = T1.id
- LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
- LEFT JOIN (
- SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP
- BY invoice_ledger_id
- ) T6 ON T1.id = T6.invoice_ledger_id
- <where>
- <if test="ids.size() > 0">
- T1.id IN
- <foreach item="item" collection="ids" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="tenantId != null " >
- AND T1.tenant_id = #{tenantId}
- </if>
- </where>
-
- </select>
-
- <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
- SELECT
- T1.sales_contract_no,
- T1.contract_amount AS invoice_total,
- IFNULL(SUM(T2.receipt_payment_amount), 0) AS receipt_payment_amount,
- IFNULL((T1.contract_amount - IFNULL(SUM(T2.receipt_payment_amount), 0)), 0) AS unReceipt_payment_amount,
- T2.receipt_payment_date
- FROM sales_ledger T1
- INNER JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id
- <where>
- T1.customer_id = #{invoiceLedgerDto.customerId}
- <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' ">
- AND T1.customer_name LIKE CONCAT ('%', #{invoiceLedgerDto.searchText}, '%')
- </if>
- </where>
- GROUP BY T1.id, T1.sales_contract_no, T1.contract_amount, T2.receipt_payment_date
- </select>
-
-</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/SalesLedgerMapper.xml b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
index e08632a..2d6b7f8 100644
--- a/src/main/resources/mapper/sales/SalesLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
@@ -56,6 +56,7 @@
T1.attachment_materials,
T1.tenant_id,
T1.contract_amount,
+ T1.net_contract_amount,
T1.contract_amount AS noInvoiceAmountTotal,
T1.execution_date,
T2.nick_name AS entry_person_name,
@@ -121,5 +122,23 @@
</if>
order by sl.execution_date desc
</select>
+ <select id="selectPurchaseReportVoPage" resultType="com.ruoyi.purchase.vo.PurchaseReportVo">
+ select sl.sales_contract_no customerContractNo,
+ c.customer_name,
+ sl.project_name,
+ sl.contract_amount contractAmount,
+ pl.contract_amount purchaseAmount,
+ sl.contract_amount-pl.contract_amount balance,
+ (sl.contract_amount-pl.contract_amount)/sl.contract_amount balanceRatio
+ from sales_ledger sl
+ left join purchase_ledger pl on sl.id = pl.sales_ledger_id
+ left join customer c on sl.customer_id = c.id
+ <where>
+ <if test="customerName != null and customerName != '' ">
+ and c.customer_name like concat('%',#{customerName},'%')
+ </if>
+ </where>
+ order by sl.entry_date desc
+ </select>
</mapper>
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 49689a1..9e6839f 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -6,16 +6,50 @@
<select id="selectSalesLedgerProductList" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct">
SELECT
- T1.*,
+ T1.id,
+ T1.sales_ledger_id,
+ T1.warn_num,
+ T1.quantity,
+ T1.min_stock,
+ T1.tax_rate,
+ T1.tax_inclusive_unit_price,
+ T1.tax_inclusive_total_price,
+ T1.tax_exclusive_total_price,
+ T1.invoice_type,
+ T1.type,
+ T1.product_id,
+ T1.product_model_id,
+ T1.register,
+ T1.register_date,
+ T1.approve_status,
+ T1.is_checked,
+ T1.is_production,
+ T1.create_user,
+ T1.dept_id,
+ p.product_name as product_category,
+ pm.model as specification_model,
+ pm.unit as unit,
CASE
WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >0 THEN 1
ELSE 0
END as has_sufficient_stock,
- (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0)) as no_quantity,
+ (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0) - IFNULL(t5.pending_approval_quantity, 0)) as no_quantity,
+ IFNULL(t3.shipped_quantity, 0) as shipped_quantity,
+ IFNULL(t6.return_quantity, 0) as return_quantity,
+ IFNULL(t4.approved_stock_in_num, 0) as approved_stock_in_num,
+ IFNULL(t5.pending_approval_quantity, 0) as pending_approval_quantity,
CASE
- WHEN (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN '寰呭彂璐�'
+ WHEN IFNULL(t3.shipped_quantity, 0) = 0 AND IFNULL(t5.pending_approval_quantity, 0) = 0 THEN '寰呭彂璐�'
+ WHEN IFNULL(t3.shipped_quantity, 0) = 0 AND IFNULL(t5.pending_approval_quantity, 0) > 0 THEN '瀹℃壒涓�'
+ WHEN (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN '閮ㄥ垎鍙戣揣'
ELSE '宸插彂璐�'
- END as shippingStatus
+ END as shippingStatus,
+ CASE
+ WHEN T1.type != 2 THEN NULL
+ WHEN IFNULL(t4.approved_stock_in_num, 0) <= 0 THEN '寰呭叆搴�'
+ WHEN IFNULL(t4.approved_stock_in_num, 0) >= IFNULL(T1.quantity, 0) THEN '瀹屽叏鍏ュ簱'
+ ELSE '鍏ュ簱涓�'
+ END AS stock_in_approval_status
FROM
sales_ledger_product T1
LEFT JOIN (
@@ -24,11 +58,132 @@
GROUP BY product_model_id
) t2 ON T1.product_model_id = t2.product_model_id
LEFT JOIN (
- SELECT sales_ledger_product_id, IFNULL(SUM(spd.quantity), 0) as shipped_quantity
+ SELECT
+ slp.id AS sales_ledger_product_id,
+ IFNULL(SUM(so.total_sale_out_num), 0) AS shipped_quantity
+ FROM sales_ledger_product slp
+ LEFT JOIN (
+ SELECT
+ pl.id AS purchase_ledger_id,
+ sir.product_model_id,
+ SUM(spd.quantity) AS total_sale_out_num
+ FROM shipping_product_detail spd
+ INNER JOIN shipping_info si
+ ON si.id = spd.shipping_info_id
+ INNER JOIN stock_out_record sor
+ ON sor.record_id = si.id
+ AND TRIM(sor.record_type) = '13'
+ AND sor.approval_status IN (0, 1, 3)
+ INNER JOIN stock_inventory inv
+ ON inv.id = spd.stock_inventory_id
+ INNER JOIN stock_in_record sir
+ ON sir.product_model_id = inv.product_model_id
+ AND (
+ (sir.batch_no IS NOT NULL AND sir.batch_no = inv.batch_no)
+ OR (sir.batch_no IS NULL AND inv.batch_no IS NULL)
+ )
+ AND sir.approval_status = 1
+ AND sir.record_type IN ('7', '10')
+ LEFT JOIN quality_inspect qi
+ ON sir.record_type = '10'
+ AND sir.record_id = qi.id
+ LEFT JOIN purchase_ledger pl
+ ON pl.id = IF(sir.record_type = '7', sir.record_id, qi.purchase_ledger_id)
+ WHERE si.status IN ('瀹℃牳閫氳繃', '宸插彂璐�')
+ AND pl.id IS NOT NULL
+ GROUP BY pl.id, sir.product_model_id
+ ) so ON so.purchase_ledger_id = slp.sales_ledger_id
+ AND so.product_model_id = slp.product_model_id
+ WHERE slp.type = 2
+ GROUP BY slp.id
+
+ UNION ALL
+
+ -- 閿�鍞彴璐�(type=1): shipping_info 鐩存帴鎸� sales_ledger_product_id,鍙粺璁″嚭搴撳鏍搁�氳繃(approval_status=1)鐨勫彂璐ч噺,涓� t5 鐨� pending 閫昏緫浜掕ˉ
+ SELECT
+ si.sales_ledger_product_id AS sales_ledger_product_id,
+ IFNULL(SUM(spd.quantity), 0) AS shipped_quantity
+ FROM shipping_info si
+ INNER JOIN shipping_product_detail spd ON si.id = spd.shipping_info_id
+ INNER JOIN stock_out_record sor
+ ON sor.record_id = si.id
+ AND TRIM(sor.record_type) = '13'
+ AND sor.approval_status = 1
+ WHERE si.status IN ('瀹℃牳閫氳繃', '宸插彂璐�')
+ AND si.sales_ledger_product_id IS NOT NULL
+ GROUP BY si.sales_ledger_product_id
+ ) t3 ON t3.sales_ledger_product_id = T1.id
+ LEFT JOIN (
+ SELECT rel.sales_ledger_product_id,
+ IFNULL(SUM(rel.stock_in_num), 0) AS approved_stock_in_num
+ FROM (
+ SELECT slp.id AS sales_ledger_product_id,
+ sir.stock_in_num
+ FROM stock_in_record sir
+ INNER JOIN sales_ledger_product slp
+ ON slp.type = 2
+ AND TRIM(sir.record_type) = '7'
+ AND sir.record_id = slp.sales_ledger_id
+ AND (
+ (sir.batch_no IS NOT NULL AND sir.batch_no LIKE CONCAT('%-', slp.id))
+ OR (sir.batch_no IS NULL AND sir.product_model_id = slp.product_model_id)
+ )
+ WHERE sir.approval_status = 1
+
+ UNION ALL
+
+ SELECT slp.id AS sales_ledger_product_id,
+ sir.stock_in_num
+ FROM stock_in_record sir
+ INNER JOIN quality_inspect qi
+ ON TRIM(sir.record_type) = '10'
+ AND sir.record_id = qi.id
+ INNER JOIN sales_ledger_product slp
+ ON slp.type = 2
+ AND slp.sales_ledger_id = qi.purchase_ledger_id
+ AND slp.product_model_id = qi.product_model_id
+ WHERE sir.approval_status = 1
+ ) rel
+ GROUP BY rel.sales_ledger_product_id
+ ) t4 ON t4.sales_ledger_product_id = T1.id
+ LEFT JOIN (
+ SELECT si.sales_ledger_product_id, IFNULL(SUM(spd.quantity), 0) as pending_approval_quantity
FROM shipping_info si
LEFT JOIN shipping_product_detail spd ON si.id = spd.shipping_info_id
- GROUP BY sales_ledger_product_id
- ) t3 ON t3.sales_ledger_product_id = T1.id
+ WHERE si.status IN ('寰呭鏍�', '瀹℃牳涓�')
+ OR (si.status = '瀹℃牳閫氳繃' AND NOT EXISTS (
+ SELECT 1 FROM stock_out_record sor
+ WHERE sor.record_id = si.id
+ AND TRIM(sor.record_type) = '13'
+ AND sor.approval_status = 1
+ ))
+ GROUP BY si.sales_ledger_product_id
+ ) t5 ON t5.sales_ledger_product_id = T1.id
+ LEFT JOIN (
+ SELECT
+ prop.sales_ledger_product_id,
+ IFNULL(SUM(prop.return_quantity), 0) AS return_quantity
+ FROM purchase_return_order_products prop
+ LEFT JOIN purchase_return_orders pro
+ ON pro.id = prop.purchase_return_order_id
+ GROUP BY prop.sales_ledger_product_id
+
+ UNION ALL
+
+ SELECT
+ si.sales_ledger_product_id,
+ IFNULL(SUM(rsp.num), 0) AS return_quantity
+ FROM return_sale_product rsp
+ INNER JOIN return_management rm ON rm.id = rsp.return_management_id
+ INNER JOIN shipping_info si ON si.id = rm.shipping_id
+ INNER JOIN stock_in_record sir ON sir.record_id = rsp.id
+ AND TRIM(sir.record_type) IN ('14','15')
+ AND sir.approval_status = 1
+ WHERE si.sales_ledger_product_id IS NOT NULL
+ GROUP BY si.sales_ledger_product_id
+ ) t6 ON t6.sales_ledger_product_id = T1.id
+ left join product_model pm ON T1.product_model_id = pm.id
+ left join product p ON pm.product_id = p.id
<where>
<if test="salesLedgerProduct.salesLedgerId != null">
AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
@@ -55,74 +210,6 @@
and slp.id is not null
order by slp.id desc
limit 1
-
-
- </select>
- <select id="listPage" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto">
- select slp.*,
- sl.project_name,
- sl.customer_name,
- sl.sales_contract_no,
- sl.customer_contract_no
- from sales_ledger_product slp
- left join sales_ledger sl on slp.sales_ledger_id = sl.id
- <where>
- slp.type = 1
- <if test="req.salesContractNo != null and req.salesContractNo != '' ">
- AND sl.sales_contract_no like concat('%',#{req.salesContractNo},'%')
- </if>
- <if test="req.customerContractNo != null and req.customerContractNo != '' ">
- AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%')
- </if>
- <if test="req.projectName != null and req.projectName != '' ">
- AND sl.project_name like concat('%',#{req.projectName},'%')
- </if>
- <if test="req.customerName != null and req.customerName != '' ">
- AND sl.customer_name like concat('%',#{req.customerName},'%')
- </if>
- <if test="req.productCategory != null and req.productCategory != '' ">
- AND slp.product_category like concat('%',#{req.productCategory},'%')
- </if>
- <if test="req.status != null and req.status ">
- AND slp.pending_invoice_total > 0
- </if>
- </where>
- order by slp.register_date desc
- </select>
- <select id="listPagePurchaseLedger" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto">
- select slp.*,
- sl.project_name,
- sl.supplier_name,
- sl.supplier_id,
- sl.sales_contract_no,
- sl.purchase_contract_number
- from sales_ledger_product slp
- left join purchase_ledger sl on slp.sales_ledger_id = sl.id
- <where>
- slp.type = 2
- <if test="req.purchaseContractNumber != null and req.purchaseContractNumber != '' ">
- AND sl.purchase_contract_number like concat('%',#{req.purchaseContractNumber},'%')
- </if>
- <if test="req.approvalStatus != null and req.approvalStatus != ''">
- and sl.approval_status = #{req.approvalStatus}
- </if>
- <if test="req.customerContractNo != null and req.customerContractNo != '' ">
- AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%')
- </if>
- <if test="req.projectName != null and req.projectName != '' ">
- AND sl.project_name like concat('%',#{req.projectName},'%')
- </if>
- <if test="req.customerName != null and req.customerName != '' ">
- AND sl.customer_name like concat('%',#{req.customerName},'%')
- </if>
- <if test="req.productCategory != null and req.productCategory != '' ">
- AND slp.product_category like concat('%',#{req.productCategory},'%')
- </if>
- <if test="req.status != null and req.status ">
- AND slp.pending_tickets_total > 0
- </if>
- </where>
- order by slp.register_date desc
</select>
<select id="procurementBusinessSummaryListPage"
resultType="com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto">
diff --git a/src/main/resources/mapper/sales/SalesQuotationMapper.xml b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
index cf15b63..746e331 100644
--- a/src/main/resources/mapper/sales/SalesQuotationMapper.xml
+++ b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
@@ -4,20 +4,19 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sales.mapper.SalesQuotationMapper">
<select id="listPage" resultType="com.ruoyi.sales.dto.SalesQuotationDto">
- SELECT t1.*,
- t2.approve_user_ids
+ SELECT t1.*
FROM sales_quotation t1
- LEFT JOIN approve_process t2 ON t1.quotation_no = t2.approve_reason and t2.approve_type = 6
- WHERE 1=1
- and t2.approve_deleted = 0
- <if test="salesQuotationDto.quotationNo != null and salesQuotationDto.quotationNo != '' ">
- AND t1.quotation_no LIKE CONCAT('%',#{salesQuotationDto.quotationNo},'%')
- </if>
- <if test="salesQuotationDto.customer != null and salesQuotationDto.customer != '' ">
- AND t1.customer = #{salesQuotationDto.customer}
- </if>
- <if test="salesQuotationDto.status != null and salesQuotationDto.status != '' ">
- AND t1.status = #{salesQuotationDto.status}
- </if>
+ <where>
+ <if test="salesQuotationDto.quotationNo != null and salesQuotationDto.quotationNo != '' ">
+ AND t1.quotation_no LIKE CONCAT('%',#{salesQuotationDto.quotationNo},'%')
+ </if>
+ <if test="salesQuotationDto.customer != null and salesQuotationDto.customer != '' ">
+ AND t1.customer = #{salesQuotationDto.customer}
+ </if>
+ <if test="salesQuotationDto.status != null and salesQuotationDto.status != '' ">
+ AND t1.status = #{salesQuotationDto.status}
+ </if>
+ </where>
+ order by t1.id desc
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/sales/ShipmentApprovalMapper.xml b/src/main/resources/mapper/sales/ShipmentApprovalMapper.xml
deleted file mode 100644
index 68cd664..0000000
--- a/src/main/resources/mapper/sales/ShipmentApprovalMapper.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.sales.mapper.ShipmentApprovalMapper">
-
- <select id="listPage" resultType="com.ruoyi.sales.pojo.ShipmentApproval">
- SELECT *,
- si.shipping_car_number,
- T2.nick_name AS entry_person_name
- FROM shipment_approval sa
- LEFT JOIN shipping_info si ON sa.shipping_info_id = si.id
- LEFT JOIN sales_ledger sl ON sa.sales_ledger_id = sl.id
- LEFT JOIN sales_ledger_product slp ON sa.sales_ledger_product_id = slp.id and slp.type = 1
- LEFT JOIN sys_user T2 ON sl.entry_person = T2.user_id
- <where>
- 1=1
- <if test="req.approveStatus != null and req.approveStatus != '' ">
- AND sa.approve_status = #{req.approveStatus}
- </if>
- <if test="req.salesContractNo != null and req.salesContractNo != '' ">
- AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%')
- </if>
- </where>
- </select>
-</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/ShippingInfoMapper.xml b/src/main/resources/mapper/sales/ShippingInfoMapper.xml
index 048bb23..8775933 100644
--- a/src/main/resources/mapper/sales/ShippingInfoMapper.xml
+++ b/src/main/resources/mapper/sales/ShippingInfoMapper.xml
@@ -19,14 +19,22 @@
s.update_user,
s.tenant_id,
sl.sales_contract_no,
- slp.specification_model,
+ pm.model as specification_model,
+ pm.unit,
p.product_name,
- sl.customer_name
+ sl.customer_name,
+ spd.totalQuantity,
+ sor.outboundBatches
FROM shipping_info s
+ LEFT JOIN (select shipping_info_id,sum(quantity) totalQuantity from shipping_product_detail GROUP BY shipping_info_id) spd ON spd.shipping_info_id = s.id
LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1
left join product_model pm on slp.product_model_id = pm.id
left join product p on pm.product_id = p.id
+ left join (select record_id,GROUP_CONCAT(outbound_batches SEPARATOR ',') AS outboundBatches
+ from stock_out_record
+ where record_type='13'and approval_status=1
+ group by record_id)sor on sor.record_id= s.id
WHERE 1=1
<if test="req.salesContractNo != null and req.salesContractNo != ''">
AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%')
@@ -58,33 +66,47 @@
FROM shipping_info s
LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
</select>
- <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto">
- SELECT
- slp.*,
- si.shipping_no,
- GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity,
- COALESCE(rs.total_return_num, 0) AS total_return_num
+ <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.bean.vo.ShippingProductVo">
+ SELECT distinct
+ sor.id,
+ slp.product_category,
+ slp.specification_model,
+ slp.unit,
+ slp.product_model_id,
+ sor.outbound_batches,
+ sor.stock_out_num,
+ sor.batch_no,
+ slp.tax_inclusive_unit_price,
+ GREATEST(sor.stock_out_num - COALESCE(rs.total_return_num, 0), 0) AS un_quantity,
+ COALESCE(rs.return_num, 0) AS total_return_num,
+ COALESCE(rs.pending_return_num, 0) AS pending_return_num
FROM shipping_info si
+ LEFT JOIN shipping_product_detail spd ON spd.shipping_info_id = si.id
+ LEFT JOIN stock_out_record sor ON sor.record_id = si.id and sor.record_type = '13'
LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1
LEFT JOIN (
SELECT
- return_sales_ledger_product_id,
- SUM(num) AS total_return_num
+ stock_out_record_id,
+ SUM(num) AS total_return_num,
+ SUM( CASE WHEN rsp.STATUS = 0 THEN rsp.num ELSE 0 END ) AS pending_return_num ,
+ SUM( CASE WHEN rsp.STATUS = 1 THEN rsp.num ELSE 0 END ) AS return_num
FROM return_sale_product rsp
left join return_management rm on rm.id = rsp.return_management_id
left join shipping_info si on si.id = rm.shipping_id
WHERE 1=1
- GROUP BY return_sales_ledger_product_id
- ) rs ON rs.return_sales_ledger_product_id = slp.id
+ GROUP BY stock_out_record_id
+ ) rs ON rs.stock_out_record_id = sor.id
<where>
<if test="shippingId != null">
si.id = #{shippingId}
</if>
</where>
+ order by sor.id
</select>
<select id="getShippingInfoByCustomerName" resultType="com.ruoyi.sales.pojo.ShippingInfo">
- select * from shipping_info si
+ select distinct si.* from shipping_info si
left join sales_ledger sl on si.sales_ledger_id = sl.id
- where si.status = '宸插彂璐�' and sl.customer_name = #{customerName}
+ inner join stock_out_record sor on sor.record_id = si.id and sor.record_type = '13' and sor.approval_status = 1
+ where sl.customer_name = #{customerName} and si.status = '瀹℃牳閫氳繃'
</select>
</mapper>
diff --git a/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml b/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml
index 464af10..15a6168 100644
--- a/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml
+++ b/src/main/resources/mapper/sales/ShippingProductDetailMapper.xml
@@ -18,5 +18,14 @@
left join product p on p.id = pm.product_id
where spd.shipping_info_id = #{id}
</select>
+ <select id="getDateilByShippingNo" resultType="com.ruoyi.sales.dto.ShippingProductDetailDto">
+ select si.batch_no, pm.model as specification_model, p.product_name, spd.quantity as delivery_quantity
+ from shipping_product_detail spd
+ left join shipping_info sp on sp.id = spd.shipping_info_id
+ left join stock_inventory si on si.id = spd.stock_inventory_id
+ left join product_model pm on pm.id = si.product_model_id
+ left join product p on p.id = pm.product_id
+ where sp.shipping_no = #{shippingNo}
+ </select>
</mapper>
diff --git a/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml b/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
index 7dbb388..4a15bbf 100644
--- a/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
+++ b/src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
@@ -39,9 +39,10 @@
and personal_attendance_records.date >= #{params.date}
and personal_attendance_records.date < DATE_ADD(DATE(#{params.date}), INTERVAL 1 DAY)
</if>
+ order by personal_attendance_records.id desc
</select>
- <!-- 鏌ヨ鎸囧畾鏃ユ湡娌℃湁鑰冨嫟璁板綍鐨勫湪鑱屽憳宸ワ紙鍦ㄦ寚瀹氭椂闂翠箣鍓嶅叆鑱岀殑锛� -->
+ <!-- 鏌ヨ鎸囧畾鏃ユ湡鏈夋帓鐝紙闈炶鍋囷級浣嗘病鏈夎�冨嫟璁板綍鐨勫湪鑱屽憳宸ワ紝娌℃帓鐝涓轰紤鎭笉鏍囪缂哄嫟 -->
<select id="selectStaffWithoutAttendanceRecordBeforeTime" resultType="com.ruoyi.staff.pojo.StaffOnJob">
SELECT soj.*
FROM staff_on_job soj
@@ -49,8 +50,11 @@
AND soj.create_time < #{entryDeadline}
AND EXISTS (
SELECT 1
- FROM personal_attendance_location_config palc
- WHERE palc.sys_dept_id = soj.sys_dept_id
+ FROM personal_shift ps
+ WHERE ps.staff_on_job_id = soj.id
+ AND DATE(ps.work_time) = #{date}
+ AND ps.personal_attendance_location_config_id IS NOT NULL
+ AND ps.personal_attendance_location_config_id != 999
)
AND NOT EXISTS (
SELECT 1
diff --git a/src/main/resources/mapper/staff/PersonalShiftMapper.xml b/src/main/resources/mapper/staff/PersonalShiftMapper.xml
index 69bcae3..e872e01 100644
--- a/src/main/resources/mapper/staff/PersonalShiftMapper.xml
+++ b/src/main/resources/mapper/staff/PersonalShiftMapper.xml
@@ -18,22 +18,25 @@
u.id user_id
FROM personal_shift s
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
+ LEFT JOIN staff_leave sl ON sl.staff_on_job_id = u.id
LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
<where>
+ u.id IS NOT NULL
<if test="sysDeptId != null and sysDeptId != ''">
and u.sys_dept_id = #{sysDeptId}
</if>
<if test="time != null and time != ''">
and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m')
+ AND (u.staff_state = 1 OR (u.staff_state = 0 AND sl.leave_date IS NOT NULL AND sl.leave_date >= DATE_FORMAT(#{time}, '%Y-%m-01')))
</if>
<if test="userName != null and userName != ''">
and u.staff_name like concat('%', #{userName}, '%')
</if>
</where>
GROUP BY u.id, u.staff_name
- ORDER BY MAX(s.create_time)
+ ORDER BY MAX(s.create_time) desc
</select>
-
+
<select id="performanceShiftYear" resultType="java.util.Map">
SELECT
u.staff_name name,
@@ -43,10 +46,12 @@
GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), '锛�', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str
FROM personal_shift s
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
- LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
+ LEFT JOIN staff_leave sl ON sl.staff_on_job_id = u.id
+ LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
<where>
<if test="time != null and time != ''">
and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
+ AND (u.staff_state = 1 OR (u.staff_state = 0 AND sl.leave_date IS NOT NULL AND sl.leave_date >= DATE_FORMAT(#{time}, '%Y-01-01')))
</if>
<if test="userName != null and userName != ''">
and u.staff_name like concat('%', #{userName}, '%')
@@ -66,10 +71,12 @@
GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), '锛�', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str
FROM personal_shift s
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
+ LEFT JOIN staff_leave sl ON sl.staff_on_job_id = u.id
LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
<where>
<if test="time != null and time != ''">
and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
+ AND (u.staff_state = 1 OR (u.staff_state = 0 AND sl.leave_date IS NOT NULL AND sl.leave_date >= DATE_FORMAT(#{time}, '%Y-01-01')))
</if>
<if test="userName != null and userName != ''">
and u.staff_name like concat('%', #{userName}, '%')
@@ -87,10 +94,12 @@
GROUP_CONCAT(s.work_time, '锛�', IFNULL(palc.shift, ''), '锛�', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id
FROM personal_shift s
LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
+ LEFT JOIN staff_leave sl ON sl.staff_on_job_id = u.id
LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
<where>
<if test="time != null and time != ''">
and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' )
+ AND (u.staff_state = 1 OR (u.staff_state = 0 AND sl.leave_date IS NOT NULL AND sl.leave_date >= DATE_FORMAT(#{time}, '%Y-%m-01')))
</if>
<if test="userName != null and userName != ''">
and u.staff_name like concat('%', #{userName}, '%')
diff --git a/src/main/resources/mapper/staff/SchemeApplicableStaffMapper.xml b/src/main/resources/mapper/staff/SchemeApplicableStaffMapper.xml
index 1652dd6..78a2a98 100644
--- a/src/main/resources/mapper/staff/SchemeApplicableStaffMapper.xml
+++ b/src/main/resources/mapper/staff/SchemeApplicableStaffMapper.xml
@@ -25,6 +25,20 @@
create_time DESC
</select>
+ <!-- 鏍规嵁閮ㄩ棬ID鏌ヨ鏈�鏂扮ぞ淇濇柟妗� -->
+ <select id="selectLatestSchemeByDeptId" resultType="com.ruoyi.staff.pojo.SchemeApplicableStaff">
+ SELECT
+ <include refid="schemeColumns"/>
+ FROM
+ scheme_applicable_staff
+ WHERE
+ 1 = 1
+ AND FIND_IN_SET(#{deptId}, dept_ids)
+ ORDER BY
+ create_time DESC
+ LIMIT 1
+ </select>
+
<!-- 鏌ヨ鏂规瀵瑰簲鐨勬槑缁� -->
<select id="selectDetailBySchemeId" resultType="com.ruoyi.staff.pojo.SchemeInsuranceDetail">
SELECT
diff --git a/src/main/resources/mapper/staff/StaffLeaveMapper.xml b/src/main/resources/mapper/staff/StaffLeaveMapper.xml
index 4637ff0..fef5c81 100644
--- a/src/main/resources/mapper/staff/StaffLeaveMapper.xml
+++ b/src/main/resources/mapper/staff/StaffLeaveMapper.xml
@@ -18,18 +18,24 @@
soj.emergency_contact as emergencyContact,
soj.emergency_contact_phone as emergencyContactPhone,
sp.post_name as postName,
- sd.dept_name as deptName
+ sd.dept_name as deptName,
+ se.education as first_study,
+ se.major as profession
FROM staff_leave
- LEFT JOIN
- staff_on_job soj ON soj.id = staff_leave.staff_on_job_id
- LEFT JOIN
- sys_post sp ON sp.post_id = soj.sys_post_id
- LEFT JOIN
- sys_dept sd ON sd.dept_id = soj.sys_dept_id
- where 1=1
+ LEFT JOIN staff_on_job soj ON soj.id = staff_leave.staff_on_job_id
+ LEFT JOIN sys_post sp ON sp.post_id = soj.sys_post_id
+ LEFT JOIN sys_dept sd ON sd.dept_id = soj.sys_dept_id
+ LEFT JOIN staff_education se ON se.staff_on_job_id = staff_leave.staff_on_job_id
+ AND se.id = (
+ SELECT MAX(se2.id)
+ FROM staff_education se2
+ WHERE se2.staff_on_job_id = staff_leave.staff_on_job_id
+ )
+ WHERE 1=1
<if test="c.staffName != null and c.staffName != '' ">
AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%')
</if>
+ order by staff_leave.create_time desc
</select>
<select id="staffLeaveList" resultType="com.ruoyi.staff.dto.StaffLeaveDto">
SELECT
@@ -56,10 +62,12 @@
sys_post sp ON sp.post_id = soj.sys_post_id
LEFT JOIN
sys_dept sd ON sd.dept_id = soj.sys_dept_id
- where 1=1
- <if test="c.staffName != null and c.staffName != '' ">
- AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%')
- </if>
+ <where>
+ <if test="c.staffName != null and c.staffName != '' ">
+ AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%')
+ </if>
+ </where>
+ order by staff_leave.create_time desc
</select>
<select id="staffLeaveReasonAnalytics" resultType="com.ruoyi.staff.dto.StaffLeaveDto">
diff --git a/src/main/resources/mapper/staff/StaffOnJobMapper.xml b/src/main/resources/mapper/staff/StaffOnJobMapper.xml
index b0c85bc..90825e3 100644
--- a/src/main/resources/mapper/staff/StaffOnJobMapper.xml
+++ b/src/main/resources/mapper/staff/StaffOnJobMapper.xml
@@ -3,29 +3,83 @@
<mapper namespace="com.ruoyi.staff.mapper.StaffOnJobMapper">
<select id="staffOnJobListPage" resultType="com.ruoyi.staff.dto.StaffOnJobDto">
SELECT
- staff_on_job.*,
- sp.post_name as postName,
- sd.dept_name as deptName,
- t1.contract_start_time
+ staff_on_job.id,
+ staff_on_job.staff_state,
+ staff_on_job.staff_no,
+ staff_on_job.staff_name,
+ staff_on_job.sex,
+ staff_on_job.native_place,
+ staff_on_job.sys_post_id,
+ staff_on_job.sys_dept_id,
+ staff_on_job.role_id,
+ staff_on_job.adress,
+ staff_on_job.first_study,
+ staff_on_job.profession,
+ staff_on_job.identity_card,
+ staff_on_job.age,
+ staff_on_job.phone,
+ staff_on_job.contract_term,
+ staff_on_job.contract_expire_time,
+ staff_on_job.trial_end_date,
+ staff_on_job.trial_start_date,
+ staff_on_job.sign_date,
+ staff_on_job.salary_select,
+ staff_on_job.pro_salary,
+ staff_on_job.date_select,
+ staff_on_job.remark,
+ staff_on_job.create_time,
+ staff_on_job.create_user,
+ staff_on_job.update_time,
+ staff_on_job.update_user,
+ staff_on_job.tenant_id,
+ staff_on_job.alias,
+ staff_on_job.birth_date,
+ staff_on_job.nation,
+ staff_on_job.marital_status,
+ staff_on_job.pro_term,
+ staff_on_job.positive_date,
+ staff_on_job.basic_salary,
+ staff_on_job.dept_id,
+ sp.post_name AS post_name,
+ sd.dept_name AS dept_name,
+ MIN(t1.contract_start_time) AS contract_start_time,
+ MAX(t1.contract_end_time) AS contract_end_time,
+ (
+ SELECT GROUP_CONCAT(sec.contact_name SEPARATOR ',')
+ FROM staff_emergency_contact sec
+ WHERE sec.staff_on_job_id = staff_on_job.id
+ ) AS emergency_contact,
+ (
+ SELECT GROUP_CONCAT(sec.contact_phone SEPARATOR ',')
+ FROM staff_emergency_contact sec
+ WHERE sec.staff_on_job_id = staff_on_job.id
+ ) AS emergency_contact_phone
FROM staff_on_job
- LEFT JOIN
- sys_post sp ON sp.post_id = staff_on_job.sys_post_id
- LEFT JOIN
- sys_dept sd ON sd.dept_id = staff_on_job.sys_dept_id
- LEFT JOIN staff_contract as t1 ON t1.staff_on_job_id = staff_on_job.id
- where 1=1
- <if test="staffOnJob.staffState != null">
- AND staff_state = #{staffOnJob.staffState}
+ LEFT JOIN sys_post sp ON sp.post_id = staff_on_job.sys_post_id
+ LEFT JOIN sys_dept sd ON sd.dept_id = staff_on_job.sys_dept_id
+ LEFT JOIN staff_contract AS t1 ON t1.staff_on_job_id = staff_on_job.id
+ <where>
+ <if test="staffOnJob.staffState != null">
+ AND staff_on_job.staff_state = #{staffOnJob.staffState}
+ </if>
+ <if test="staffOnJob.staffName != null and staffOnJob.staffName != '' ">
+ AND staff_on_job.staff_name LIKE CONCAT('%',#{staffOnJob.staffName},'%')
+ </if>
+ <if test="staffOnJob.entryDateStart != null and staffOnJob.entryDateStart != '' ">
+ AND staff_on_job.contract_expire_time >= DATE_FORMAT(#{staffOnJob.entryDateStart},'%Y-%m-%d')
+ </if>
+ <if test="staffOnJob.entryDateEnd != null and staffOnJob.entryDateEnd != '' ">
+ AND staff_on_job.contract_expire_time <= DATE_FORMAT(#{staffOnJob.entryDateEnd},'%Y-%m-%d')
+ </if>
+ <if test="staffOnJob.sysDeptId != null">
+ AND staff_on_job.sys_dept_id = #{staffOnJob.sysDeptId}
+ </if>
+ </where>
+ GROUP BY staff_on_job.id
+ <if test="staffOnJob.contractStartTime != null">
+ HAVING MIN(t1.contract_start_time) = #{staffOnJob.contractStartTime}
</if>
- <if test="staffOnJob.staffName != null and staffOnJob.staffName != '' ">
- AND staff_name LIKE CONCAT('%',#{staffOnJob.staffName},'%')
- </if>
- <if test="staffOnJob.entryDateStart != null and staffOnJob.entryDateStart != '' ">
- AND contract_expire_time >= DATE_FORMAT(#{staffOnJob.entryDateStart},'%Y-%m-%d')
- </if>
- <if test="staffOnJob.entryDateEnd != null and staffOnJob.entryDateEnd != '' ">
- AND contract_expire_time <= DATE_FORMAT(#{staffOnJob.entryDateEnd},'%Y-%m-%d')
- </if>
+ order by staff_on_job.create_time desc
</select>
<select id="staffOnJobList" resultType="com.ruoyi.staff.dto.StaffOnJobDto">
SELECT
@@ -37,13 +91,15 @@
sys_post sp ON sp.post_id = staff_on_job.sys_post_id
LEFT JOIN
sys_dept sd ON sd.dept_id = staff_on_job.sys_dept_id
- where 1=1
- <if test="staffOnJob.staffState != null">
- AND staff_state = #{staffOnJob.staffState}
- </if>
- <if test="staffOnJob.staffName != null and staffOnJob.staffName != '' ">
- AND staff_name LIKE CONCAT('%',#{staffOnJob.staffName},'%')
- </if>
+ <where>
+ <if test="staffOnJob.staffState != null">
+ AND staff_state = #{staffOnJob.staffState}
+ </if>
+ <if test="staffOnJob.staffName != null and staffOnJob.staffName != '' ">
+ AND staff_name LIKE CONCAT('%',#{staffOnJob.staffName},'%')
+ </if>
+ </where>
+ order by staff_on_job.create_time desc
</select>
<!-- 缁熻鎸囧畾鏃ユ湡鐨勫湪鑱屽憳宸ユ暟 -->
<select id="countOnJobStaffByDate" resultType="java.lang.Integer">
diff --git a/src/main/resources/mapper/staff/StaffSalaryMainMapper.xml b/src/main/resources/mapper/staff/StaffSalaryMainMapper.xml
index c3f0c62..bec4e6d 100644
--- a/src/main/resources/mapper/staff/StaffSalaryMainMapper.xml
+++ b/src/main/resources/mapper/staff/StaffSalaryMainMapper.xml
@@ -16,4 +16,11 @@
<result column="update_user" property="updateUser" />
</resultMap>
+ <select id="selectIssuedDeptIds" resultType="java.lang.String">
+ SELECT DISTINCT dept_ids
+ FROM staff_salary_main
+ WHERE salary_month = #{salaryMonth}
+ AND status = 5
+ </select>
+
</mapper>
diff --git a/src/main/resources/mapper/stock/StockInRecordMapper.xml b/src/main/resources/mapper/stock/StockInRecordMapper.xml
index 62f1d19..3e10e2b 100644
--- a/src/main/resources/mapper/stock/StockInRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -19,17 +19,108 @@
p.product_name as product_name,
pm.model,
pm.unit,
- u.nick_name as createBy
+ u.nick_name as createBy,
+ CASE
+ WHEN TRIM(sir.record_type) = '7' THEN
+ COALESCE(pl_by_product.purchase_contract_number, pl_direct.purchase_contract_number)
+ WHEN TRIM(sir.record_type) = '10' THEN
+ pl_by_quality.purchase_contract_number
+ WHEN #{params.topParentProductId} = 276 THEN
+ CASE
+ WHEN TRIM(sir.record_type) IN ('14', '15') THEN
+ sl_return.sales_contract_no
+ WHEN TRIM(sir.record_type) IN ('2', '5') THEN
+ COALESCE(po_sales_main.sales_contract_no, po_main.nps_no)
+ WHEN TRIM(sir.record_type) = '6' THEN
+ COALESCE(po_sales_qi.sales_contract_no, po_qi.nps_no)
+ WHEN TRIM(sir.record_type) IN ('4', '11') THEN
+ COALESCE(po_sales_uq.sales_contract_no, po_uq.nps_no)
+ WHEN TRIM(sir.record_type) IN ('20', '22') THEN
+ COALESCE(po_sales_pick.sales_contract_no, po_pick.nps_no)
+ ELSE NULL
+ END
+ ELSE NULL
+ END AS sourceOrderNo
FROM stock_in_record as sir
LEFT JOIN product_model as pm on sir.product_model_id = pm.id
LEFT JOIN product as p on pm.product_id = p.id
LEFT JOIN sys_user as u on sir.create_user = u.user_id
+ LEFT JOIN quality_inspect as qi_purchase on TRIM(sir.record_type) = '10' and sir.record_id = qi_purchase.id
+ LEFT JOIN sales_ledger_product as slp on TRIM(sir.record_type) = '7' and slp.id = sir.record_id and slp.type = 2
+ LEFT JOIN purchase_ledger as pl_by_product on TRIM(sir.record_type) = '7' and pl_by_product.id = slp.sales_ledger_id
+ LEFT JOIN purchase_ledger as pl_direct on TRIM(sir.record_type) = '7' and pl_direct.id = sir.record_id
+ LEFT JOIN purchase_ledger as pl_by_quality on TRIM(sir.record_type) = '10' and pl_by_quality.id = qi_purchase.purchase_ledger_id
+
+ LEFT JOIN production_product_main as ppm_main on TRIM(sir.record_type) IN ('2', '5') and sir.record_id = ppm_main.id
+ LEFT JOIN production_operation_task as pot_main on ppm_main.production_operation_task_id = pot_main.id
+ LEFT JOIN production_order as po_main on pot_main.production_order_id = po_main.id
+ LEFT JOIN (
+ select po2.id as production_order_id,
+ group_concat(distinct sl2.sales_contract_no order by sl2.sales_contract_no separator ',') as sales_contract_no
+ from production_order po2
+ left join production_plan pp2
+ on find_in_set(pp2.id, replace(replace(replace(po2.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0
+ left join sales_ledger sl2 on sl2.id = pp2.sales_ledger_id
+ group by po2.id
+ ) as po_sales_main on po_sales_main.production_order_id = po_main.id
+
+ LEFT JOIN quality_inspect as qi_prod on TRIM(sir.record_type) = '6' and sir.record_id = qi_prod.id
+ LEFT JOIN production_product_main as ppm_qi on qi_prod.product_main_id = ppm_qi.id
+ LEFT JOIN production_operation_task as pot_qi on ppm_qi.production_operation_task_id = pot_qi.id
+ LEFT JOIN production_order as po_qi on pot_qi.production_order_id = po_qi.id
+ LEFT JOIN (
+ select po2.id as production_order_id,
+ group_concat(distinct sl2.sales_contract_no order by sl2.sales_contract_no separator ',') as sales_contract_no
+ from production_order po2
+ left join production_plan pp2
+ on find_in_set(pp2.id, replace(replace(replace(po2.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0
+ left join sales_ledger sl2 on sl2.id = pp2.sales_ledger_id
+ group by po2.id
+ ) as po_sales_qi on po_sales_qi.production_order_id = po_qi.id
+
+ LEFT JOIN quality_unqualified as qu on TRIM(sir.record_type) IN ('4', '11') and sir.record_id = qu.id
+ LEFT JOIN quality_inspect as qi_uq on qu.inspect_id = qi_uq.id
+ LEFT JOIN production_product_main as ppm_uq on qi_uq.product_main_id = ppm_uq.id
+ LEFT JOIN production_operation_task as pot_uq on ppm_uq.production_operation_task_id = pot_uq.id
+ LEFT JOIN production_order as po_uq on pot_uq.production_order_id = po_uq.id
+ LEFT JOIN (
+ select po2.id as production_order_id,
+ group_concat(distinct sl2.sales_contract_no order by sl2.sales_contract_no separator ',') as sales_contract_no
+ from production_order po2
+ left join production_plan pp2
+ on find_in_set(pp2.id, replace(replace(replace(po2.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0
+ left join sales_ledger sl2 on sl2.id = pp2.sales_ledger_id
+ group by po2.id
+ ) as po_sales_uq on po_sales_uq.production_order_id = po_uq.id
+
+ LEFT JOIN production_order_pick as pop on TRIM(sir.record_type) IN ('20', '22') and sir.record_id = pop.id
+ LEFT JOIN production_order as po_pick on pop.production_order_id = po_pick.id
+ LEFT JOIN (
+ select po2.id as production_order_id,
+ group_concat(distinct sl2.sales_contract_no order by sl2.sales_contract_no separator ',') as sales_contract_no
+ from production_order po2
+ left join production_plan pp2
+ on find_in_set(pp2.id, replace(replace(replace(po2.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0
+ left join sales_ledger sl2 on sl2.id = pp2.sales_ledger_id
+ group by po2.id
+ ) as po_sales_pick on po_sales_pick.production_order_id = po_pick.id
+
+ LEFT JOIN return_sale_product as rsp on TRIM(sir.record_type) IN ('14', '15') and sir.record_id = rsp.id
+ LEFT JOIN return_management as rm on rsp.return_management_id = rm.id
+ LEFT JOIN shipping_info as si_return on rm.shipping_id = si_return.id
+ LEFT JOIN sales_ledger as sl_return on si_return.sales_ledger_id = sl_return.id
<where>
<if test="params.timeStr != null and params.timeStr != ''">
and sir.create_time like concat('%',#{params.timeStr},'%')
</if>
<if test="params.productName != null and params.productName != ''">
and p.product_name like concat('%',#{params.productName},'%')
+ </if>
+ <if test="params.model != null and params.model != ''">
+ and pm.model like concat('%',#{params.model},'%')
+ </if>
+ <if test="params.batchNo != null and params.batchNo != ''">
+ and sir.batch_no like concat('%',#{params.batchNo},'%')
</if>
<if test="params.type != null and params.type != ''">
and sir.type = #{params.type}
@@ -70,4 +161,41 @@
</where>
order by sir.id desc
</select>
+ <select id="listPageAccountPurchase" resultType="com.ruoyi.account.bean.vo.purchase.PurchaseInboundVo">
+ SELECT
+ sir.id,
+ sir.inbound_batches,
+ pl.supplier_name,
+ DATE(sir.create_time) AS inboundDate,
+ p.product_name,
+ pm.model as specification_model,
+ sir.stock_in_num * slp.tax_inclusive_unit_price AS InboundAmount,
+ pl.purchase_contract_number
+ FROM stock_in_record sir
+ -- 10 绫诲瀷鎵嶅叧鑱旇川妫�琛�
+ LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id
+ -- 鍔ㄦ�佸叧鑱旈噰璐紙鑷姩閫傞厤 7 鍜� 10锛�
+ LEFT JOIN purchase_ledger pl
+ ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id)
+ -- 浜у搧鍏宠仈涓嶅姩
+ LEFT JOIN sales_ledger_product slp ON pl.id = slp.sales_ledger_id
+ LEFT JOIN product_model pm ON sir.product_model_id = pm.id
+ LEFT JOIN product p ON pm.product_id = p.id
+ -- 鏉′欢
+ WHERE sir.approval_status = 1 AND slp.type = 2
+ AND sir.record_type IN ('7','10')
+ <if test="req.inboundBatches != null and req.inboundBatches != ''">
+ AND sir.inbound_batches LIKE CONCAT('%',#{req.inboundBatches},'%')
+ </if>
+ <if test="req.supplierId != null">
+ AND pl.supplier_id = #{req.supplierId}
+ </if>
+ <if test="req.supplierName != null and req.supplierName != ''">
+ AND pl.supplier_name LIKE CONCAT('%',#{req.supplierName},'%')
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND DATE(sir.create_time) BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ order by sir.id DESC
+ </select>
</mapper>
diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index 60fc90e..ac9c49b 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -99,6 +99,145 @@
INNER JOIN product_tree pt ON p.parent_id = pt.id
)
select
+ GROUP_CONCAT(DISTINCT batch_no ORDER BY batch_no SEPARATOR ',') as batch_no,
+ MAX(qualifiedId) as qualifiedId,
+ MAX(unQualifiedId) as unQualifiedId,
+ SUM(qualifiedQuantity) as qualifiedQuantity,
+ SUM(unQualifiedQuantity) as unQualifiedQuantity,
+ SUM(qualifiedLockedQuantity) as qualifiedLockedQuantity,
+ SUM(unQualifiedLockedQuantity) as unQualifiedLockedQuantity,
+ SUM(qualifiedQuantity - qualifiedLockedQuantity - IFNULL(qualifiedPendingOut, 0)) as qualifiedUnLockedQuantity,
+ SUM(unQualifiedQuantity - unQualifiedLockedQuantity - IFNULL(unQualifiedPendingOut, 0)) as unQualifiedUnLockedQuantity,
+ SUM(IFNULL(qualifiedPendingOut, 0)) as qualifiedPendingOutQuantity,
+ SUM(IFNULL(unQualifiedPendingOut, 0)) as unQualifiedPendingOutQuantity,
+ product_model_id,
+ MAX(create_time) as create_time,
+ MAX(update_time) as update_time,
+ MAX(warn_num) as warn_num,
+ MAX(version) as version,
+ model,
+ MAX(remark) as remark,
+ unit,
+ product_name,
+ product_id,
+ 'combined' as stockType
+ from (
+ select
+ si.batch_no,
+ si.id as qualifiedId,
+ null as unQualifiedId,
+ si.qualitity as qualifiedQuantity,
+ 0 as unQualifiedQuantity,
+ COALESCE(si.locked_quantity, 0) as locked_quantity,
+ COALESCE(si.locked_quantity, 0) as qualifiedLockedQuantity,
+ 0 as unQualifiedLockedQuantity,
+ si.product_model_id,
+ si.create_time,
+ si.update_time,
+ COALESCE(si.warn_num, 0) as warn_num,
+ si.version,
+ (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity,
+ pm.model,
+ si.remark,
+ pm.unit,
+ p.product_name,
+ p.id as product_id,
+ (
+ select IFNULL(SUM(sor.stock_out_num), 0)
+ from stock_out_record sor
+ where sor.product_model_id = si.product_model_id
+ and (
+ (si.batch_no is null and sor.batch_no is null)
+ or si.batch_no = sor.batch_no
+ )
+ and sor.type = '0'
+ and sor.approval_status = 0
+ ) as qualifiedPendingOut,
+ 0 as unQualifiedPendingOut
+ from stock_inventory si
+ left join product_model pm on si.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+
+ union all
+
+ select
+ su.batch_no,
+ null as qualifiedId,
+ su.id as unQualifiedId,
+ 0 as qualifiedQuantity,
+ su.qualitity as unQualifiedQuantity,
+ COALESCE(su.locked_quantity, 0) as locked_quantity,
+ 0 as qualifiedLockedQuantity,
+ COALESCE(su.locked_quantity, 0) as unQualifiedLockedQuantity,
+ su.product_model_id,
+ su.create_time,
+ su.update_time,
+ 0 as warn_num,
+ su.version,
+ (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity,
+ pm.model,
+ su.remark,
+ pm.unit,
+ p.product_name,
+ p.id as product_id,
+ 0 as qualifiedPendingOut,
+ (
+ select IFNULL(SUM(sor.stock_out_num), 0)
+ from stock_out_record sor
+ where sor.product_model_id = su.product_model_id
+ and (
+ (su.batch_no is null and sor.batch_no is null)
+ or su.batch_no = sor.batch_no
+ )
+ and sor.type = '1'
+ and sor.approval_status = 0
+ ) as unQualifiedPendingOut
+ from stock_uninventory su
+ left join product_model pm on su.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ ) as combined
+ <where>
+ <if test="ew.productName != null and ew.productName !=''">
+ and combined.product_name in (
+ select distinct p.product_name
+ from product p
+ left join product_model pm on p.id = pm.product_id
+ where p.product_name like concat('%',#{ew.productName},'%')
+ or pm.model like concat('%',#{ew.productName},'%')
+ )
+ </if>
+ <if test="ew.topParentProductId != null and ew.topParentProductId > 0">
+ and combined.product_id in (select id from product_tree)
+ </if>
+ <if test="ew.model != null and ew.model !=''">
+ and combined.model like concat('%',#{ew.model},'%')
+ </if>
+ <if test="ew.batchNo != null and ew.batchNo !=''">
+ and combined.batch_no like concat('%',#{ew.batchNo},'%')
+ </if>
+ </where>
+ group by
+ product_model_id,
+ model,
+ unit,
+ product_name,
+ product_id
+ order by combined.create_time desc
+ </select>
+
+ <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
+ WITH RECURSIVE product_tree AS (
+ SELECT id
+ FROM product
+ WHERE id = #{ew.topParentProductId}
+
+ UNION ALL
+
+ SELECT p.id
+ FROM product p
+ INNER JOIN product_tree pt ON p.parent_id = pt.id
+ )
+ select
batch_no,
MAX(qualifiedId) as qualifiedId,
MAX(unQualifiedId) as unQualifiedId,
@@ -205,84 +344,6 @@
</where>
group by batch_no, product_model_id, model, unit, product_name, product_id
</select>
-
- <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
- WITH RECURSIVE product_tree AS (
- SELECT id
- FROM product
- WHERE id = #{ew.topParentProductId}
-
- UNION ALL
-
- SELECT p.id
- FROM product p
- INNER JOIN product_tree pt ON p.parent_id = pt.id
- )
- select
- SUM(qualifiedQuantity) as qualifiedQuantity,
- SUM(unQualifiedQuantity) as unQualifiedQuantity,
- SUM(qualifiedLockedQuantity) as qualifiedLockedQuantity,
- SUM(unQualifiedLockedQuantity) as unQualifiedLockedQuantity,
- model,
- unit,
- product_name,
- MAX(warn_num) as warn_num,
- MAX(remark) as remark,
- MAX(update_time) as update_time
- from (
- select
- si.qualitity as qualifiedQuantity,
- 0 as unQualifiedQuantity,
- COALESCE(si.locked_quantity, 0) as qualifiedLockedQuantity,
- 0 as unQualifiedLockedQuantity,
- si.product_model_id,
- si.create_time,
- si.update_time,
- COALESCE(si.warn_num, 0) as warn_num,
- si.remark,
- pm.model,
- pm.unit,
- p.product_name,
- p.id as product_id
- from stock_inventory si
- left join product_model pm on si.product_model_id = pm.id
- left join product p on pm.product_id = p.id
-
- union all
-
- select
- 0 as qualifiedQuantity,
- su.qualitity as unQualifiedQuantity,
- 0 as qualifiedLockedQuantity,
- COALESCE(su.locked_quantity, 0) as unQualifiedLockedQuantity,
- su.product_model_id,
- su.create_time,
- su.update_time,
- 0 as warn_num,
- su.remark,
- pm.model,
- pm.unit,
- p.product_name,
- p.id as product_id
- from stock_uninventory su
- left join product_model pm on su.product_model_id = pm.id
- left join product p on pm.product_id = p.id
- ) as combined
- <where>
- <if test="ew.productName != null and ew.productName !=''">
- and combined.product_name in (
- select distinct p.product_name
- from product p
- left join product_model pm on p.id = pm.product_id
- where p.product_name like concat('%',#{ew.productName},'%') or pm.model like concat('%',#{ew.productName},'%')
- )
- </if>
- <if test="ew.topParentProductId != null and ew.topParentProductId > 0">
- and combined.product_id in (select id from product_tree)
- </if>
- </where>
- group by product_model_id, model, unit, product_name
- </select>
<select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto">
select sir.*,si.qualitity as current_stock,
pm.model,
@@ -291,7 +352,11 @@
su.nick_name as create_by
from
stock_in_record sir
- left join stock_inventory si on sir.product_model_id = si.product_model_id
+ left join (
+ select product_model_id, sum(qualitity) as qualitity
+ from stock_inventory
+ group by product_model_id
+ ) si on sir.product_model_id = si.product_model_id
left join product_model pm on sir.product_model_id = pm.id
left join product p on pm.product_id = p.id
left join sys_user su on sir.create_user = su.user_id
@@ -307,6 +372,7 @@
and sir.create_time <= #{ew.endMonth}
</if>
</where>
+ order by sir.id desc
</select>
<select id="stockInAndOutRecord" resultType="com.ruoyi.stock.dto.StockInventoryDto">
@@ -436,7 +502,7 @@
WHERE sor.product_model_id = #{productModelId}
AND (sor.batch_no = #{batchNo} OR (#{batchNo} IS NULL AND sor.batch_no IS NULL))
AND sor.type = #{type}
- AND sor.approval_status = 0
+ AND sor.approval_status IN (0, 3)
</select>
<select id="listSelectableBatchNoByProductModelIds" resultType="com.ruoyi.stock.pojo.StockInventory">
@@ -452,13 +518,163 @@
and (si.qualitity - ifnull(si.locked_quantity, 0)) > 0
order by si.product_model_id, si.batch_no
</select>
- <select id="getByModelId" resultType="com.ruoyi.stock.pojo.StockInventory">
- select spd.id, spd.batch_no, spd.locked_quantity, (spd.qualitity - IFNULL(sd.qualitity, 0)) as qualitity
- from stock_inventory spd
- left join (select stock_inventory_id, sum(quantity) as qualitity
- from shipping_product_detail
- group by stock_inventory_id) as sd on sd.stock_inventory_id = spd.id
- where product_model_id = #{productModelId}
+ <select id="getByModelId" resultType="com.ruoyi.stock.dto.StockInventoryDto">
+ select si.id, si.batch_no, si.locked_quantity, (si.qualitity - IFNULL(sd.qualitity, 0)) as qualitity,
+ p.product_name, pm.model, pm.unit
+ from stock_inventory si
+ left join (
+ select spd.stock_inventory_id, sum(spd.quantity) as qualitity
+ from shipping_product_detail spd
+ where exists (
+ select 1
+ from stock_out_record sor
+ where sor.record_id = spd.shipping_info_id
+ and sor.record_type = '13'
+ and sor.type = '0'
+ and sor.approval_status in (0, 3)
+ and sor.product_model_id = spd.product_model_id
+ and (sor.batch_no = spd.batch_no or (sor.batch_no is null and spd.batch_no is null))
+ )
+ group by spd.stock_inventory_id
+ ) as sd on sd.stock_inventory_id = si.id
+ left join product_model pm on si.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ where si.product_model_id = #{productModelId}
+ and si.qualitity > IFNULL(sd.qualitity, 0)
+ </select>
+
+ <select id="getBatchNoQty" resultType="com.ruoyi.stock.dto.StockInventoryDto">
+ select
+ batch_no,
+ MAX(qualifiedId) as qualifiedId,
+ MAX(unQualifiedId) as unQualifiedId,
+
+ SUM(qualifiedQuantity) as qualifiedQuantity,
+ SUM(unQualifiedQuantity) as unQualifiedQuantity,
+
+ SUM(qualifiedLockedQuantity) as qualifiedLockedQuantity,
+ SUM(unQualifiedLockedQuantity) as unQualifiedLockedQuantity,
+
+ SUM(IFNULL(qualifiedPendingOut, 0)) as qualifiedPendingOutQuantity,
+ SUM(IFNULL(unQualifiedPendingOut, 0)) as unQualifiedPendingOutQuantity,
+
+ SUM(qualifiedQuantity - qualifiedLockedQuantity - IFNULL(qualifiedPendingOut, 0)) as qualifiedUnLockedQuantity,
+ SUM(unQualifiedQuantity - unQualifiedLockedQuantity - IFNULL(unQualifiedPendingOut, 0)) as unQualifiedUnLockedQuantity,
+
+ product_model_id,
+ model,
+ unit,
+ product_name,
+ product_id,
+
+ MAX(create_time) as create_time,
+ MAX(update_time) as update_time,
+ MAX(warn_num) as warn_num,
+ MAX(version) as version,
+ MAX(remark) as remark,
+
+ 'combined' as stockType
+ from (
+ select
+ si.batch_no,
+ si.id as qualifiedId,
+ null as unQualifiedId,
+
+ si.qualitity as qualifiedQuantity,
+ 0 as unQualifiedQuantity,
+
+ COALESCE(si.locked_quantity, 0) as qualifiedLockedQuantity,
+ 0 as unQualifiedLockedQuantity,
+
+ si.product_model_id,
+ pm.model,
+ pm.unit,
+ p.product_name,
+ p.id as product_id,
+
+ si.create_time,
+ si.update_time,
+ COALESCE(si.warn_num, 0) as warn_num,
+ si.version,
+ si.remark,
+
+ (
+ select IFNULL(SUM(sor.stock_out_num), 0)
+ from stock_out_record sor
+ where sor.product_model_id = si.product_model_id
+ and (
+ (si.batch_no is null and sor.batch_no is null)
+ or si.batch_no = sor.batch_no
+ )
+ and sor.type = '0'
+ and sor.approval_status = 0
+ ) as qualifiedPendingOut,
+
+ 0 as unQualifiedPendingOut
+ from stock_inventory si
+ left join product_model pm on si.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+
+ union all
+
+ select
+ su.batch_no,
+ null as qualifiedId,
+ su.id as unQualifiedId,
+
+ 0 as qualifiedQuantity,
+ su.qualitity as unQualifiedQuantity,
+
+ 0 as qualifiedLockedQuantity,
+ COALESCE(su.locked_quantity, 0) as unQualifiedLockedQuantity,
+
+ su.product_model_id,
+ pm.model,
+ pm.unit,
+ p.product_name,
+ p.id as product_id,
+
+ su.create_time,
+ su.update_time,
+ 0 as warn_num,
+ su.version,
+ su.remark,
+
+ 0 as qualifiedPendingOut,
+
+ (
+ select IFNULL(SUM(sor.stock_out_num), 0)
+ from stock_out_record sor
+ where sor.product_model_id = su.product_model_id
+ and (
+ (su.batch_no is null and sor.batch_no is null)
+ or su.batch_no = sor.batch_no
+ )
+ and sor.type = '1'
+ and sor.approval_status = 0
+ ) as unQualifiedPendingOut
+ from stock_uninventory su
+ left join product_model pm on su.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ ) as combined
+ <where>
+ <if test="ew.productModelId != null and ew.productModelId > 0">
+ and combined.product_model_id = #{ew.productModelId}
+ </if>
+
+ <if test="ew.productId != null and ew.productId > 0">
+ and combined.product_id = #{ew.productId}
+ </if>
+ </where>
+ group by
+ batch_no,
+ product_model_id,
+ model,
+ unit,
+ product_name,
+ product_id
+ order by
+ batch_no
</select>
</mapper>
diff --git a/src/main/resources/mapper/stock/StockOutRecordMapper.xml b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
index 8615294..ad5976f 100644
--- a/src/main/resources/mapper/stock/StockOutRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -46,6 +46,12 @@
<if test="params.productName != null and params.productName != ''">
and p.product_name like concat('%',#{params.productName},'%')
</if>
+ <if test="params.model != null and params.model != ''">
+ and pm.model like concat('%',#{params.model},'%')
+ </if>
+ <if test="params.batchNo != null and params.batchNo != ''">
+ and sor.batch_no like concat('%',#{params.batchNo},'%')
+ </if>
<if test="params.type != null and params.type != ''">
and sor.type = #{params.type}
</if>
@@ -86,4 +92,37 @@
order by sor.id desc
</select>
+ <select id="listPageAccountSales" resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo">
+ SELECT
+ sor.id,
+ sor.outbound_batches,
+ sl.customer_name,
+ sor.create_time as shippingDate,
+ p.product_name,
+ pm.model as specification_model,
+ slp.tax_rate,
+ sor.stock_out_num * slp.tax_inclusive_unit_price as outboundAmount,
+ s.shipping_no,
+ sl.sales_contract_no
+ FROM stock_out_record sor
+ left join shipping_info s on sor.record_id = s.id
+ LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
+ LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1
+ left join product_model pm on slp.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ WHERE sor.record_type='13' and sor.approval_status=1
+ <if test="req.outboundBatches != null and req.outboundBatches != ''">
+ AND sor.outbound_batches LIKE CONCAT('%',#{req.outboundBatches},'%')
+ </if>
+ <if test="req.customerName != null and req.customerName != ''">
+ AND sl.customer_name LIKE CONCAT('%',#{req.customerName},'%')
+ </if>
+ <if test="req.customerId != null ">
+ AND sl.customer_id = #{req.customerId}
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND s.shipping_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ order by sor.id DESC
+ </select>
</mapper>
diff --git a/src/main/resources/mapper/system/SysDeptMapper.xml b/src/main/resources/mapper/system/SysDeptMapper.xml
index ee5256f..de46729 100644
--- a/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -22,9 +22,9 @@
<result property="updateTime" column="update_time" />
<result property="staffCount" column="staff_count" />
</resultMap>
-
+
<sql id="selectDeptVo">
- select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
+ select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
@@ -49,9 +49,9 @@
<!-- 鏁版嵁鑼冨洿杩囨护 -->
${params.dataScope}
group by d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
- order by d.parent_id, d.order_num
+ order by d.parent_id asc, d.order_num asc, d.create_time desc
</select>
-
+
<select id="selectDeptListByRoleId" resultType="java.lang.Long">
select d.dept_id
from sys_dept d
@@ -60,39 +60,40 @@
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
- order by d.parent_id, d.order_num
+ order by d.parent_id asc, d.order_num asc, d.create_time desc
</select>
-
+
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name,
d.dept_nick
from sys_dept d
where d.dept_id = #{deptId}
+ order by d.create_time desc
</select>
-
+
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user_dept where dept_id = #{deptId}
</select>
-
+
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
-
+
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
-
+
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
-
+
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
- where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
+ where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' order by d.create_time desc limit 1
</select>
-
+
<insert id="insertDept" parameterType="com.ruoyi.project.system.domain.SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
@@ -122,7 +123,7 @@
sysdate()
)
</insert>
-
+
<update id="updateDept" parameterType="com.ruoyi.project.system.domain.SysDept">
update sys_dept
<set>
@@ -140,7 +141,7 @@
</set>
where dept_id = #{deptId}
</update>
-
+
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
@@ -153,14 +154,14 @@
#{item.deptId}
</foreach>
</update>
-
+
<update id="updateDeptStatusNormal" parameterType="Long">
- update sys_dept set status = '0' where dept_id in
+ update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
-
+
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
@@ -184,4 +185,4 @@
WHERE parent_id = 100;
</select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/system/SysDictTypeMapper.xml b/src/main/resources/mapper/system/SysDictTypeMapper.xml
index 1cf1349..dd2342e 100644
--- a/src/main/resources/mapper/system/SysDictTypeMapper.xml
+++ b/src/main/resources/mapper/system/SysDictTypeMapper.xml
@@ -14,9 +14,9 @@
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
-
+
<sql id="selectDictTypeVo">
- select dict_id, dict_name, dict_type, status, create_by, create_time, remark
+ select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from sys_dict_type
</sql>
@@ -39,36 +39,37 @@
and date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
+ order by create_time desc
</select>
-
+
<select id="selectDictTypeAll" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
</select>
-
+
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_id = #{dictId}
</select>
-
+
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
</select>
-
+
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
</select>
-
+
<delete id="deleteDictTypeById" parameterType="Long">
delete from sys_dict_type where dict_id = #{dictId}
</delete>
-
+
<delete id="deleteDictTypeByIds" parameterType="Long">
delete from sys_dict_type where dict_id in
<foreach collection="array" item="dictId" open="(" separator="," close=")">
#{dictId}
- </foreach>
+ </foreach>
</delete>
<update id="updateDictType" parameterType="com.ruoyi.project.system.domain.SysDictType">
@@ -83,7 +84,7 @@
</set>
where dict_id = #{dictId}
</update>
-
+
<insert id="insertDictType" parameterType="com.ruoyi.project.system.domain.SysDictType">
insert into sys_dict_type(
<if test="dictName != null and dictName != ''">dict_name,</if>
@@ -101,5 +102,5 @@
sysdate()
)
</insert>
-
-</mapper>
\ No newline at end of file
+
+</mapper>
diff --git a/src/main/resources/mapper/system/SysNoticeMapper.xml b/src/main/resources/mapper/system/SysNoticeMapper.xml
index 3dd5735..14372d8 100644
--- a/src/main/resources/mapper/system/SysNoticeMapper.xml
+++ b/src/main/resources/mapper/system/SysNoticeMapper.xml
@@ -10,11 +10,16 @@
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
+ <result property="senderId" column="sender_id" />
+ <result property="consigneeId" column="consignee_id" />
+ <result property="jumpPath" column="jump_path" />
+ <result property="appJumpPath" column="app_jump_path" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
+ <result property="tenantId" column="tenant_id" />
</resultMap>
<sql id="selectNoticeVo">
diff --git a/src/main/resources/mapper/system/SysPostMapper.xml b/src/main/resources/mapper/system/SysPostMapper.xml
index 177f74d..d62d78b 100644
--- a/src/main/resources/mapper/system/SysPostMapper.xml
+++ b/src/main/resources/mapper/system/SysPostMapper.xml
@@ -16,12 +16,12 @@
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
-
+
<sql id="selectPostVo">
- select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
+ select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post
</sql>
-
+
<select id="selectPostList" parameterType="com.ruoyi.project.system.domain.SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
@@ -35,17 +35,18 @@
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
+ order by create_time desc
</select>
-
+
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
-
+
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
-
+
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id
from sys_post p
@@ -53,7 +54,7 @@
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
-
+
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
@@ -61,17 +62,17 @@
left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
-
+
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
-
+
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
-
+
<update id="updatePost" parameterType="com.ruoyi.project.system.domain.SysPost">
update sys_post
<set>
@@ -85,7 +86,7 @@
</set>
where post_id = #{postId}
</update>
-
+
<insert id="insertPost" parameterType="com.ruoyi.project.system.domain.SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
@@ -107,16 +108,16 @@
sysdate()
)
</insert>
-
+
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
-
+
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
- </foreach>
+ </foreach>
</delete>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/system/SysRoleMapper.xml b/src/main/resources/mapper/system/SysRoleMapper.xml
index 9e16cf7..45617f3 100644
--- a/src/main/resources/mapper/system/SysRoleMapper.xml
+++ b/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -20,10 +20,10 @@
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
-
+
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
- r.status, r.del_flag, r.create_time, r.remark
+ r.status, r.del_flag, r.create_time, r.remark
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
@@ -54,17 +54,17 @@
${params.dataScope}
order by r.role_sort
</select>
-
+
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select>
-
+
<select id="selectRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0'
</select>
-
+
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
select r.role_id
from sys_role r
@@ -72,27 +72,27 @@
left join sys_user u on u.user_id = ur.user_id
where u.user_id = #{userId}
</select>
-
+
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_id = #{roleId}
</select>
-
+
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>
-
+
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select>
-
+
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
-
+
<insert id="insertRole" parameterType="com.ruoyi.project.system.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
@@ -120,7 +120,7 @@
sysdate()
)
</insert>
-
+
<update id="updateRole" parameterType="com.ruoyi.project.system.domain.SysRole">
update sys_role
<set>
@@ -137,16 +137,16 @@
</set>
where role_id = #{roleId}
</update>
-
+
<delete id="deleteRoleById" parameterType="Long">
update sys_role set del_flag = '2' where role_id = #{roleId}
</delete>
-
+
<delete id="deleteRoleByIds" parameterType="Long">
update sys_role set del_flag = '2' where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
- </foreach>
+ </foreach>
</delete>
-
-</mapper>
\ No newline at end of file
+
+</mapper>
diff --git a/src/main/resources/mapper/system/SysUserMapper.xml b/src/main/resources/mapper/system/SysUserMapper.xml
index 72da1a1..b12ee0f 100644
--- a/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/src/main/resources/mapper/system/SysUserMapper.xml
@@ -25,6 +25,7 @@
<result property="remark" column="remark" />
<result property="deptNames" column="dept_names" />
<result property="tenantId" column="tenant_id" />
+ <result property="roleNames" column="role_names" />
<association property="dept" javaType="com.ruoyi.project.system.domain.SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
@@ -97,6 +98,7 @@
</if>
<!-- 鏁版嵁鑼冨洿杩囨护 -->
${params.dataScope}
+ ORDER BY u.create_time DESC
</select>
<select id="selectAllocatedList" parameterType="com.ruoyi.project.system.domain.SysUser" resultMap="SysUserResult">
@@ -130,17 +132,20 @@
</if>
<!-- 鏁版嵁鑼冨洿杩囨护 -->
${params.dataScope}
+ ORDER BY u.create_time DESC
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
+ ORDER BY u.create_time DESC
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
and u.del_flag = '0'
+ ORDER BY u.create_time DESC
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
@@ -165,6 +170,7 @@
</if>
and u.del_flag = '0'
</where>
+ ORDER BY u.create_time DESC
</select>
<select id="selectRegistrantIds" resultType="com.ruoyi.project.system.domain.SysUser">
SELECT user_id, nick_name FROM sys_user
@@ -179,6 +185,7 @@
1=0 <!-- 绌哄垪琛ㄦ椂杩斿洖绌虹粨鏋� -->
</if>
</where>
+ ORDER BY sys_user.create_time DESC
</select>
<select id="selectUsersByIds" resultType="com.ruoyi.project.system.domain.SysUser">
SELECT user_id, nick_name
@@ -188,6 +195,7 @@
#{id}
</foreach>
and del_flag = '0'
+ ORDER BY sys_user.create_time DESC
</select>
<select id="selectUserByNickName" resultType="com.ruoyi.project.system.domain.SysUser"
parameterType="java.lang.String">
@@ -281,7 +289,31 @@
and sr.status = '0'
and su.status = '0'
and su.del_flag = '0'
+ ORDER BY su.create_time DESC
</select>
+
+ <select id="selectUserListWithDetail" resultMap="SysUserResult">
+ select u.user_id, u.nick_name, u.user_name, u.status, u.del_flag,
+ dept_agg.dept_names,
+ role_agg.role_names
+ from sys_user u
+ left join (
+ SELECT ud.user_id, GROUP_CONCAT(d.dept_name SEPARATOR ', ') AS dept_names
+ FROM sys_user_dept ud
+ LEFT JOIN sys_dept d ON ud.dept_id = d.dept_id
+ WHERE d.del_flag = '0' AND d.status = '0'
+ GROUP BY ud.user_id
+ ) dept_agg on dept_agg.user_id = u.user_id
+ left join (
+ SELECT ur.user_id, GROUP_CONCAT(r.role_name SEPARATOR ', ') AS role_names
+ FROM sys_user_role ur
+ LEFT JOIN sys_role r ON ur.role_id = r.role_id
+ WHERE r.del_flag = '0' AND r.status = '0'
+ GROUP BY ur.user_id
+ ) role_agg on role_agg.user_id = u.user_id
+ where u.del_flag = '0' AND u.status = '0'
+ </select>
+
<select id="getUserByPerms" resultType="java.lang.Long">
select distinct t5.user_id
from sys_role_menu t1
diff --git a/src/main/resources/mapper/technology/TechnologyBomStructureMapper.xml b/src/main/resources/mapper/technology/TechnologyBomStructureMapper.xml
index 2030715..536cdba 100644
--- a/src/main/resources/mapper/technology/TechnologyBomStructureMapper.xml
+++ b/src/main/resources/mapper/technology/TechnologyBomStructureMapper.xml
@@ -21,7 +21,8 @@
p.product_name as productName,
pm.product_id as productId,
pm.model,
- top1.name as operationName
+ top1.name as operationName,
+ pm.product_code as productCode
from technology_bom_structure tbs
left join product_model pm on tbs.product_model_id = pm.id
left join product p on pm.product_id = p.id
diff --git a/src/main/resources/mapper/technology/TechnologyOperationMapper.xml b/src/main/resources/mapper/technology/TechnologyOperationMapper.xml
index f6adc74..b09fdc2 100644
--- a/src/main/resources/mapper/technology/TechnologyOperationMapper.xml
+++ b/src/main/resources/mapper/technology/TechnologyOperationMapper.xml
@@ -32,6 +32,6 @@
and t.type = #{c.type}
</if>
</where>
- order by t.id asc
+ order by t.id desc
</select>
</mapper>
diff --git a/src/main/resources/mapper/technology/TechnologyOperationParamMapper.xml b/src/main/resources/mapper/technology/TechnologyOperationParamMapper.xml
index e1ccb2a..063f5aa 100644
--- a/src/main/resources/mapper/technology/TechnologyOperationParamMapper.xml
+++ b/src/main/resources/mapper/technology/TechnologyOperationParamMapper.xml
@@ -28,6 +28,6 @@
and top1.technology_param_id = #{paramId}
</if>
</where>
- order by top1.id asc
+ order by top1.id desc
</select>
</mapper>
diff --git a/src/main/resources/mapper/technology/TechnologyRoutingOperationMapper.xml b/src/main/resources/mapper/technology/TechnologyRoutingOperationMapper.xml
index 1bbb25c..26053b8 100644
--- a/src/main/resources/mapper/technology/TechnologyRoutingOperationMapper.xml
+++ b/src/main/resources/mapper/technology/TechnologyRoutingOperationMapper.xml
@@ -12,6 +12,7 @@
<result column="update_time" property="updateTime" />
<result column="drag_sort" property="dragSort" />
<result column="is_quality" property="isQuality" />
+ <result column="type" property="type" />
<result column="create_user" property="createUser" />
<result column="dept_id" property="deptId" />
</resultMap>
diff --git a/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml b/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
index 18b2082..2c58276 100644
--- a/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
+++ b/src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
@@ -51,6 +51,7 @@
<if test="documentationBorrowManagement.entryDateEnd != null and documentationBorrowManagement.entryDateEnd != ''">
and borrow_date <= DATE_FORMAT(#{documentationBorrowManagement.entryDateEnd},'%Y-%m-%d')
</if>
+ order by dbm.create_time desc
</select>
<select id="export" resultType="com.ruoyi.warehouse.dto.DocumentationBorrowManagementDto">
select dbm.*,doc.doc_name
diff --git a/src/main/resources/mapper/warehouse/DocumentationMapper.xml b/src/main/resources/mapper/warehouse/DocumentationMapper.xml
index 91f17a9..503f175 100644
--- a/src/main/resources/mapper/warehouse/DocumentationMapper.xml
+++ b/src/main/resources/mapper/warehouse/DocumentationMapper.xml
@@ -32,6 +32,7 @@
<if test="documentation.id != null">
and doc.id = #{documentation.id}
</if>
+ order by doc.create_time desc
</select>
<select id="listByDocumentClassificationId" resultType="com.ruoyi.warehouse.dto.DocumentationDto">
SELECT
diff --git a/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml b/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml
index 06202f8..7545c55 100644
--- a/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml
+++ b/src/main/resources/mapper/warehouse/DocumentationReturnManagementMapper.xml
@@ -28,6 +28,7 @@
<if test="documentationReturnManagement.entryDateEnd != null and documentationReturnManagement.entryDateEnd != ''">
and return_date <= DATE_FORMAT(#{documentationReturnManagement.entryDateEnd},'%Y-%m-%d')
</if>
+ order by dbm.create_time desc
</select>
<select id="exportrevent" resultType="com.ruoyi.warehouse.dto.ReturnExportDto">
diff --git a/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesRowcolMapper.xml b/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesRowcolMapper.xml
index 87dfa32..2b083a4 100644
--- a/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesRowcolMapper.xml
+++ b/src/main/resources/mapper/warehouse/WarehouseGoodsShelvesRowcolMapper.xml
@@ -36,6 +36,7 @@
and wgsr.id = #{warehouseGoodsShelvesRowcol.id}
</if>
</where>
+ order by wgsr.create_time desc
</select>
</mapper>
diff --git a/src/main/resources/purchase-agent-prompt.txt b/src/main/resources/purchase-agent-prompt.txt
index 97f7eb2..2fd5021 100644
--- a/src/main/resources/purchase-agent-prompt.txt
+++ b/src/main/resources/purchase-agent-prompt.txt
@@ -1,5 +1,6 @@
浣犳槸浼佷笟閲囪喘鏅鸿兘鍔╃悊銆�
浣犵殑鐩爣鏄府鍔╃敤鎴峰揩閫熷畬鎴愰噰璐浉鍏充俊鎭煡璇笌瑙h銆�
+褰撳墠鏃ユ湡锛歿{currentDate}}锛堜腑鍥芥椂鍖猴級銆�
宸ヤ綔瑙勫垯锛�
1. 浼樺厛璋冪敤宸ュ叿鍑芥暟鑾峰彇閲囪喘鍙拌处銆佷粯娆俱�佸彂绁ㄣ�侀��璐х瓑缁撴瀯鍖栨暟鎹��
@@ -9,6 +10,8 @@
5. 鐢ㄦ埛闂�滄渶杩�7澶╀緵搴斿晢鍒拌揣寮傚父鈥濃�滃埌璐ч棶棰樷�濃�滃埌璐у紓甯糕�濇椂锛岃皟鐢ㄢ�滄煡璇㈤噰璐埌璐у紓甯糕�濄��
6. 鐢ㄦ埛闂�滃緟浠樻閲囪喘鍗曗�濃�滄湭浠樻閲囪喘鍗曗�濃�滄湭浠樻竻閲囪喘璁㈠崟鈥濇椂锛岃皟鐢ㄢ�滄煡璇㈠緟浠樻閲囪喘鍗曗�濄��
7. 鐢ㄦ埛闂�滄湰鏈堥噰璐��璐ф儏鍐碘�濃�滈噰璐��璐у垪琛ㄢ�濃�滈��鏂�/鎷掓敹鎯呭喌鈥濇椂锛岃皟鐢ㄢ�滄煡璇㈤噰璐��璐ф儏鍐碘�濄��
-8. 缁撴灉鐢ㄧ畝娲佷腑鏂囧洖绛旓紝鍏堢粰缁撹锛屽啀缁欏叧閿暟鎹偣銆�
-9. 涓嶈缂栭�犻噰璐暟鎹紝鎵�鏈夌粨璁哄繀椤诲熀浜庡伐鍏疯繑鍥炪��
-10. 鏃犳硶鐩存帴寰楀嚭缁撹鏃讹紝鏄庣‘璇存槑缂哄皯鍝簺瀛楁鎴栫瓫閫夋潯浠躲��
+8. 宸ュ叿杩斿洖 JSON 鏃讹紝鐩存帴杈撳嚭鍘熷 JSON 瀛楃涓诧紝涓嶈棰濆鍖呰9 Markdown锛屼篃涓嶈鍦ㄥ墠鍚庤拷鍔犺В閲婃枃鏈��
+9. 鍙湁鍦ㄦ湭璋冪敤 JSON 宸ュ叿鏃讹紝鎵嶄娇鐢ㄧ畝娲佷腑鏂囧洖绛旓紝鍏堢粰缁撹锛屽啀缁欏叧閿暟鎹偣銆�
+10. 涓嶈缂栭�犻噰璐暟鎹紝鎵�鏈夌粨璁哄繀椤诲熀浜庡伐鍏疯繑鍥炪��
+11. 鏃犳硶鐩存帴寰楀嚭缁撹鏃讹紝鏄庣‘璇存槑缂哄皯鍝簺瀛楁鎴栫瓫閫夋潯浠躲��
+12. 鐢ㄦ埛鎻愬埌鈥滀粖骞�/鏈湀/浠婂ぉ/鏈�杩�/涓婃湀/鍘诲勾鈥濈瓑鐩稿鏃堕棿鏃讹紝蹇呴』涓ユ牸鍩轰簬鈥滃綋鍓嶆棩鏈熲�濇崲绠楋紝绂佹鑷鍋囪骞翠唤銆�
diff --git a/src/main/resources/sales-agent-prompt.txt b/src/main/resources/sales-agent-prompt.txt
new file mode 100644
index 0000000..3a43502
--- /dev/null
+++ b/src/main/resources/sales-agent-prompt.txt
@@ -0,0 +1,9 @@
+浣犳槸浼佷笟閿�鍞姪鎵嬶紝瑕嗙洊瀹㈡埛妗f銆侀攢鍞姤浠枫�侀攢鍞彴璐︺�侀攢鍞��璐с�佸鎴峰線鏉ャ�佸彂璐у彴璐︺�佹寚鏍囩粺璁°�佸鎴锋祦澶遍闄╁垎鏋愩�佸洖娆句笌鎶ヤ环绛栫暐寤鸿绛夊満鏅��
+褰撳墠鏃ユ湡锛歿{currentDate}}锛堜腑鍥芥椂鍖猴級銆�
+宸ヤ綔瑙勫垯锛�
+1. 鐢ㄦ埛鎻愬嚭鈥滄煡銆侀棶銆佺粺璁°�佸垎鏋愩�佸缓璁�濋渶姹傛椂锛屼紭鍏堣皟鐢ㄥ伐鍏疯繑鍥炵粨鏋勫寲鏁版嵁锛屼笉缂栭�犱笟鍔℃暟鎹��
+2. 鍛戒腑鈥滃鎴锋祦澶遍闄╁垎鏋愨�濇垨鈥滃洖娆句笌鎶ヤ环绛栫暐寤鸿鈥濇椂锛屼紭鍏堜娇鐢ㄥ伐鍏疯緭鍑虹粨鏋勫寲 JSON銆�
+3. 宸ュ叿杩斿洖 JSON 鏃讹紝鐩存帴杈撳嚭鍘熷 JSON 瀛楃涓诧紝涓嶈棰濆鍖呰9 Markdown锛屼篃涓嶈鍦ㄥ墠鍚庤拷鍔犺В閲婃枃鏈��
+4. 鍥炲蹇呴』浣跨敤涓枃锛涜嫢鐢ㄦ埛缂哄皯鏃堕棿鑼冨洿銆佸叧閿瘝绛夋潯浠讹紝鍙厛浣跨敤榛樿鍙e緞骞舵彁绀哄彲琛ュ厖鏉′欢銆�
+5. 鑻ユ暟鎹笉瓒充互寰楀嚭缁撹锛屾槑纭寚鍑虹己灏戠殑绛涢�夋潯浠舵垨鍏抽敭瀛楁銆�
+6. 鐢ㄦ埛鎻愬埌鈥滀粖骞�/鏈湀/浠婂ぉ/鏈�杩�/涓婃湀/鍘诲勾鈥濈瓑鐩稿鏃堕棿鏃讹紝蹇呴』涓ユ牸鍩轰簬鈥滃綋鍓嶆棩鏈熲�濇崲绠楋紝绂佹鑷鍋囪骞翠唤銆�
diff --git "a/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" "b/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
index 9558711..0dad163 100644
--- "a/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
+++ "b/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
Binary files differ
--
Gitblit v1.9.3