From 7dbbaa4f41556cbb36b73fec6e2503b7cb4ccc19 Mon Sep 17 00:00:00 2001 From: lywsvip Date: Wed, 5 Aug 2026 01:03:21 +0800 Subject: [PATCH] init git --- .gitignore | 39 + pom.xml | 159 ++++ xingyun-basedata/pom.xml | 27 + .../app/AddressForDeleteCustomerListener.java | 30 + .../app/AddressForDeleteMemberListener.java | 30 + .../app/AddressForDeleteShopListener.java | 30 + .../AddressForDeleteStoreCenterListener.java | 30 + .../app/AddressForDeleteSupplierListener.java | 30 + ...pertyForDeleteProductPropertyListener.java | 31 + .../ProductForDeleteProductBrandListener.java | 30 + ...oductForDeleteProductCategoryListener.java | 30 + ...yItemForDeleteProductPropertyListener.java | 30 + ...nForDeleteProductPropertyItemListener.java | 32 + ...ationForDeleteProductPropertyListener.java | 31 + .../app/ShopForDeleteSysDeptListener.java | 29 + .../bo/address/AddressSelectorBo.java | 120 +++ .../basedata/bo/address/GetAddressBo.java | 156 ++++ .../basedata/bo/address/QueryAddressBo.java | 170 ++++ .../bo/customer/CustomerSelectorBo.java | 37 + .../basedata/bo/customer/GetCustomerBo.java | 164 ++++ .../basedata/bo/customer/QueryCustomerBo.java | 77 ++ .../company/GetLogisticsCompanyBo.java | 94 ++ .../company/LogisticsCompanySelectorBo.java | 37 + .../company/QueryLogisticsCompanyBo.java | 77 ++ .../basedata/bo/member/GetMemberBo.java | 133 +++ .../basedata/bo/member/MemberSelectorBo.java | 33 + .../basedata/bo/member/QueryMemberBo.java | 77 ++ .../basedata/bo/paytype/GetPayTypeBo.java | 49 + .../bo/paytype/PayTypeSelectorBo.java | 43 + .../basedata/bo/paytype/QueryPayTypeBo.java | 77 ++ .../basedata/bo/print/GetPrintTemplateBo.java | 31 + .../print/GetPrintTemplateCompSettingBo.java | 44 + .../bo/print/GetPrintTemplateSettingBo.java | 72 ++ .../bo/print/QueryPrintTemplateBo.java | 61 ++ .../bo/product/brand/GetProductBrandBo.java | 61 ++ .../product/brand/ProductBrandSelectorBo.java | 37 + .../brand/ProductCategorySelectorBo.java | 43 + .../bo/product/brand/QueryProductBrandBo.java | 43 + .../category/GetProductCategoryBo.java | 72 ++ .../category/ProductCategoryTreeBo.java | 49 + .../bo/product/info/GetProductBo.java | 292 ++++++ .../bo/product/info/ProductBundleBo.java | 55 ++ .../bo/product/info/ProductSelectorBo.java | 113 +++ .../bo/product/info/QueryProductBo.java | 107 +++ .../property/GetProductPropertyBo.java | 100 ++ .../property/ProductPropertyModelorBo.java | 121 +++ .../property/QueryProductPropertyBo.java | 68 ++ .../item/GetProductPropertyItemBo.java | 43 + .../item/QueryProductPropertyItemBo.java | 43 + .../xingyun/basedata/bo/shop/GetShopBo.java | 91 ++ .../xingyun/basedata/bo/shop/QueryShopBo.java | 88 ++ .../basedata/bo/shop/ShopSelectorBo.java | 44 + .../bo/storecenter/GetStoreCenterBo.java | 100 ++ .../bo/storecenter/QueryStoreCenterBo.java | 77 ++ .../bo/storecenter/StoreCenterSelectorBo.java | 37 + .../basedata/bo/supplier/GetSupplierBo.java | 180 ++++ .../basedata/bo/supplier/QuerySupplierBo.java | 77 ++ .../bo/supplier/SupplierSelectorBo.java | 37 + .../controller/AddressController.java | 150 +++ .../BaseDataSelectorController.java | 578 ++++++++++++ .../controller/CustomerController.java | 155 ++++ .../LogisticsCompanyController.java | 132 +++ .../basedata/controller/MemberController.java | 195 ++++ .../controller/PayTypeController.java | 128 +++ .../controller/PrintTemplateController.java | 180 ++++ .../controller/ProductBrandController.java | 157 ++++ .../controller/ProductCategoryController.java | 153 ++++ .../controller/ProductController.java | 167 ++++ .../controller/ProductPropertyController.java | 175 ++++ .../ProductPropertyItemController.java | 132 +++ .../basedata/controller/ShopController.java | 151 +++ .../controller/StoreCenterController.java | 155 ++++ .../controller/SupplierController.java | 155 ++++ .../product/ProductPropertyRelationDto.java | 50 + .../property/ProductPropertyModelorDto.java | 72 ++ .../xingyun/basedata/entity/Address.java | 120 +++ .../xingyun/basedata/entity/Customer.java | 159 ++++ .../basedata/entity/LogisticsCompany.java | 107 +++ .../xingyun/basedata/entity/Member.java | 125 +++ .../xingyun/basedata/entity/PayType.java | 92 ++ .../basedata/entity/PrintTemplate.java | 81 ++ .../basedata/entity/PrintTemplateComp.java | 37 + .../xingyun/basedata/entity/Product.java | 145 +++ .../xingyun/basedata/entity/ProductBrand.java | 101 +++ .../basedata/entity/ProductBundle.java | 101 +++ .../basedata/entity/ProductCategory.java | 91 ++ .../entity/ProductCategoryProperty.java | 36 + .../basedata/entity/ProductProperty.java | 109 +++ .../basedata/entity/ProductPropertyItem.java | 93 ++ .../entity/ProductPropertyRelation.java | 48 + .../basedata/entity/ProductPurchase.java | 33 + .../basedata/entity/ProductRetail.java | 33 + .../xingyun/basedata/entity/ProductSale.java | 33 + .../xingyun/basedata/entity/Shop.java | 102 +++ .../xingyun/basedata/entity/StoreCenter.java | 111 +++ .../xingyun/basedata/entity/Supplier.java | 168 ++++ .../basedata/enums/AddressEntityType.java | 31 + .../xingyun/basedata/enums/AddressType.java | 31 + .../basedata/enums/BaseDataOpLogType.java | 12 + .../basedata/enums/ColumnDataType.java | 32 + .../xingyun/basedata/enums/ColumnType.java | 31 + .../xingyun/basedata/enums/InvoiceType.java | 32 + .../xingyun/basedata/enums/ManageType.java | 31 + .../enums/ProductCategoryNodeType.java | 24 + .../xingyun/basedata/enums/ProductType.java | 31 + .../xingyun/basedata/enums/PropertyType.java | 31 + .../xingyun/basedata/enums/SettleType.java | 31 + .../xingyun/basedata/enums/TaxRate.java | 32 + .../basedata/events/DeleteCustomerEvent.java | 17 + .../events/DeleteLogisticsCompanyEvent.java | 17 + .../basedata/events/DeleteMemberEvent.java | 17 + .../basedata/events/DeletePayTypeEvent.java | 17 + .../events/DeleteProductBrandEvent.java | 17 + .../events/DeleteProductCategoryEvent.java | 17 + .../basedata/events/DeleteProductEvent.java | 17 + .../events/DeleteProductPropertyEvent.java | 17 + .../DeleteProductPropertyItemEvent.java | 17 + .../basedata/events/DeleteShopEvent.java | 17 + .../events/DeleteStoreCenterEvent.java | 17 + .../basedata/events/DeleteSupplierEvent.java | 17 + .../excel/address/AddressExportModel.java | 129 +++ .../address/AddressExportTaskWorker.java | 35 + .../excel/address/AddressImportListener.java | 194 ++++ .../excel/address/AddressImportModel.java | 93 ++ .../customer/CustomerImportListener.java | 162 ++++ .../excel/customer/CustomerImportModel.java | 136 +++ .../excel/member/MemberImportListener.java | 158 ++++ .../excel/member/MemberImportModel.java | 101 +++ .../excel/product/ProductImportListener.java | 267 ++++++ .../excel/product/ProductImportModel.java | 121 +++ .../brand/ProductBrandImportListener.java | 97 ++ .../brand/ProductBrandImportModel.java | 49 + .../ProductCategoryImportListener.java | 139 +++ .../category/ProductCategoryImportModel.java | 50 + .../excel/shop/ShopImportListener.java | 98 ++ .../basedata/excel/shop/ShopImportModel.java | 49 + .../StoreCenterImportListener.java | 131 +++ .../storecenter/StoreCenterImportModel.java | 73 ++ .../supplier/SupplierImportListener.java | 186 ++++ .../excel/supplier/SupplierImportModel.java | 156 ++++ .../impl/address/AddressServiceImpl.java | 169 ++++ .../impl/customer/CustomerServiceImpl.java | 236 +++++ .../LogisticsCompanyServiceImpl.java | 198 ++++ .../impl/member/MemberServiceImpl.java | 205 +++++ .../impl/paytype/PayTypeServiceImpl.java | 177 ++++ .../print/PrintTemplateCompServiceImpl.java | 28 + .../impl/print/PrintTemplateServiceImpl.java | 129 +++ .../impl/product/ProductBrandServiceImpl.java | 184 ++++ .../product/ProductBundleServiceImpl.java | 33 + .../ProductCategoryPropertyServiceImpl.java | 49 + .../product/ProductCategoryServiceImpl.java | 246 +++++ .../ProductPropertyItemServiceImpl.java | 185 ++++ .../ProductPropertyRelationServiceImpl.java | 195 ++++ .../product/ProductPropertyServiceImpl.java | 356 ++++++++ .../product/ProductPurchaseServiceImpl.java | 61 ++ .../product/ProductRetailServiceImpl.java | 60 ++ .../impl/product/ProductSaleServiceImpl.java | 60 ++ .../impl/product/ProductServiceImpl.java | 566 ++++++++++++ .../basedata/impl/shop/ShopServiceImpl.java | 157 ++++ .../storecenter/StoreCenterServiceImpl.java | 208 +++++ .../impl/supplier/SupplierServiceImpl.java | 243 +++++ .../basedata/mappers/AddressMapper.java | 40 + .../basedata/mappers/CustomerMapper.java | 44 + .../mappers/LogisticsCompanyMapper.java | 44 + .../basedata/mappers/MemberMapper.java | 44 + .../basedata/mappers/PayTypeMapper.java | 42 + .../mappers/PrintTemplateCompMapper.java | 16 + .../basedata/mappers/PrintTemplateMapper.java | 32 + .../basedata/mappers/ProductBrandMapper.java | 42 + .../basedata/mappers/ProductBundleMapper.java | 16 + .../mappers/ProductCategoryMapper.java | 33 + .../ProductCategoryPropertyMapper.java | 25 + .../basedata/mappers/ProductMapper.java | 107 +++ .../mappers/ProductPropertyItemMapper.java | 35 + .../mappers/ProductPropertyMapper.java | 43 + .../ProductPropertyRelationMapper.java | 44 + .../mappers/ProductPurchaseMapper.java | 16 + .../basedata/mappers/ProductRetailMapper.java | 16 + .../basedata/mappers/ProductSaleMapper.java | 16 + .../xingyun/basedata/mappers/ShopMapper.java | 32 + .../basedata/mappers/StoreCenterMapper.java | 44 + .../basedata/mappers/SupplierMapper.java | 44 + .../service/address/AddressService.java | 77 ++ .../service/customer/CustomerService.java | 66 ++ .../logistics/LogisticsCompanyService.java | 68 ++ .../service/member/MemberService.java | 67 ++ .../service/paytype/PayTypeService.java | 68 ++ .../print/PrintTemplateCompService.java | 11 + .../service/print/PrintTemplateService.java | 63 ++ .../service/product/ProductBrandService.java | 68 ++ .../service/product/ProductBundleService.java | 16 + .../ProductCategoryPropertyService.java | 33 + .../product/ProductCategoryService.java | 64 ++ .../product/ProductPropertyItemService.java | 70 ++ .../ProductPropertyRelationService.java | 62 ++ .../product/ProductPropertyService.java | 67 ++ .../product/ProductPurchaseService.java | 24 + .../service/product/ProductRetailService.java | 24 + .../service/product/ProductSaleService.java | 24 + .../service/product/ProductService.java | 107 +++ .../basedata/service/shop/ShopService.java | 58 ++ .../storecenter/StoreCenterService.java | 56 ++ .../service/supplier/SupplierService.java | 66 ++ .../vo/address/AddressSelectorVo.java | 61 ++ .../basedata/vo/address/CreateAddressVo.java | 76 ++ .../basedata/vo/address/QueryAddressVo.java | 55 ++ .../basedata/vo/address/UpdateAddressVo.java | 83 ++ .../vo/customer/CreateCustomerVo.java | 128 +++ .../vo/customer/QueryCustomerSelectorVo.java | 26 + .../basedata/vo/customer/QueryCustomerVo.java | 26 + .../vo/customer/UpdateCustomerVo.java | 124 +++ .../company/CreateLogisticsCompanyVo.java | 60 ++ .../QueryLogisticsCompanySelectorVo.java | 26 + .../company/QueryLogisticsCompanyVo.java | 26 + .../company/UpdateLogisticsCompanyVo.java | 67 ++ .../basedata/vo/member/CreateMemberVo.java | 88 ++ .../vo/member/QueryMemberSelectorVo.java | 26 + .../basedata/vo/member/QueryMemberVo.java | 27 + .../basedata/vo/member/UpdateMemberVo.java | 94 ++ .../basedata/vo/paytype/CreatePayTypeVo.java | 44 + .../vo/paytype/PayTypeSelectorVo.java | 26 + .../basedata/vo/paytype/QueryPayTypeVo.java | 26 + .../basedata/vo/paytype/UpdatePayTypeVo.java | 51 ++ .../vo/print/CreatePrintTemplateVo.java | 21 + .../vo/print/QueryPrintTemplateVo.java | 20 + .../print/UpdatePrintTemplateDemoDataVo.java | 29 + .../print/UpdatePrintTemplateSettingVo.java | 29 + .../vo/print/UpdatePrintTemplateVo.java | 29 + .../product/brand/CreateProductBrandVo.java | 56 ++ .../brand/QueryProductBrandSelectorVo.java | 26 + .../vo/product/brand/QueryProductBrandVo.java | 26 + .../product/brand/UpdateProductBrandVo.java | 63 ++ .../category/CreateProductCategoryVo.java | 42 + .../QueryProductCategorySelectorVo.java | 12 + .../category/UpdateProductCategoryVo.java | 43 + .../vo/product/info/CreateProductVo.java | 151 +++ .../vo/product/info/ProductBundleVo.java | 57 ++ .../info/ProductPropertyRelationVo.java | 24 + .../product/info/QueryProductSelectorVo.java | 72 ++ .../vo/product/info/QueryProductVo.java | 72 ++ .../vo/product/info/UpdateProductVo.java | 156 ++++ .../CreateProductSalePropItemRelationVo.java | 30 + .../vo/product/poly/CreateProductPolyVo.java | 217 +++++ .../vo/product/poly/QueryProductPolyVo.java | 39 + .../vo/product/poly/UpdateProductPolyVo.java | 105 +++ .../property/CreateProductPolyPropertyVo.java | 40 + .../CreateProductPolySalePropGroupVo.java | 23 + .../property/CreateProductPropertyVo.java | 78 ++ .../property/QueryProductPropertyVo.java | 26 + .../property/UpdateProductPropertyVo.java | 85 ++ .../item/CreateProductPropertyItemVo.java | 43 + .../item/QueryProductPropertyItemVo.java | 34 + .../item/UpdateProductPropertyItemVo.java | 43 + .../CreateProductPropertyRelationVo.java | 40 + .../purchase/CreateProductPurchaseVo.java | 32 + .../purchase/UpdateProductPurchaseVo.java | 34 + .../product/retail/CreateProductRetailVo.java | 32 + .../product/retail/UpdateProductRetailVo.java | 34 + .../vo/product/sale/CreateProductSaleVo.java | 32 + .../vo/product/sale/UpdateProductSaleVo.java | 34 + .../CreateProductSalePropGroupVo.java | 36 + .../QueryProductSalePropGroupSelectorVo.java | 38 + .../saleprop/QueryProductSalePropGroupVo.java | 32 + .../UpdateProductSalePropGroupVo.java | 51 ++ .../item/CreateProductSalePropItemVo.java | 43 + .../QueryProductSalePropItemSelectorVo.java | 38 + .../item/QueryProductSalePropItemVo.java | 40 + .../item/UpdateProductSalePropItemVo.java | 51 ++ .../basedata/vo/shop/CreateShopVo.java | 59 ++ .../xingyun/basedata/vo/shop/QueryShopVo.java | 49 + .../basedata/vo/shop/ShopSelectorVo.java | 27 + .../basedata/vo/shop/UpdateShopVo.java | 66 ++ .../vo/storecenter/CreateStoreCenterVo.java | 66 ++ .../QueryStoreCenterSelectorVo.java | 26 + .../vo/storecenter/QueryStoreCenterVo.java | 26 + .../vo/storecenter/UpdateStoreCenterVo.java | 73 ++ .../vo/supplier/CreateSupplierVo.java | 145 +++ .../vo/supplier/QuerySupplierSelectorVo.java | 36 + .../basedata/vo/supplier/QuerySupplierVo.java | 27 + .../vo/supplier/UpdateSupplierVo.java | 132 +++ xingyun-basedata/src/main/java/lombok.config | 2 + .../mappers/address/AddressMapper.xml | 65 ++ .../mappers/customer/CustomerMapper.xml | 90 ++ .../logistics/LogisticsCompanyMapper.xml | 42 + .../resources/mappers/member/MemberMapper.xml | 72 ++ .../mappers/paytype/PayTypeMapper.xml | 40 + .../mappers/print/PrintTemplateMapper.xml | 21 + .../mappers/product/ProductBrandMapper.xml | 67 ++ .../mappers/product/ProductCategoryMapper.xml | 38 + .../product/ProductCategoryPropertyMapper.xml | 27 + .../mappers/product/ProductMapper.xml | 163 ++++ .../product/ProductPropertyItemMapper.xml | 55 ++ .../mappers/product/ProductPropertyMapper.xml | 81 ++ .../product/ProductPropertyRelationMapper.xml | 41 + .../mappers/product/ProductPurchaseMapper.xml | 5 + .../mappers/product/ProductRetailMapper.xml | 5 + .../mappers/product/ProductSaleMapper.xml | 5 + .../resources/mappers/shop/ShopMapper.xml | 61 ++ .../mappers/storecenter/StoreCenterMapper.xml | 72 ++ .../mappers/supplier/SupplierMapper.xml | 45 + xingyun-chart/pom.xml | 32 + .../chart/bo/OrderChartSameMonthBo.java | 39 + .../chart/bo/OrderChartSameMonthSumBo.java | 40 + .../xingyun/chart/bo/OrderChartTodayBo.java | 39 + .../chart/bo/OrderChartTodaySumBo.java | 40 + .../chart/controller/ChartController.java | 115 +++ .../chart/dto/OrderChartSameMonthDto.java | 28 + .../xingyun/chart/dto/OrderChartSumDto.java | 25 + .../xingyun/chart/dto/OrderChartTodayDto.java | 28 + .../xingyun/chart/entity/OrderChart.java | 58 ++ .../chart/enums/OrderChartBizType.java | 32 + .../chart/impl/OrderChartServiceImpl.java | 150 +++ .../mq/OrderDataToChartListener.java | 68 ++ .../chart/mappers/OrderChartMapper.java | 56 ++ .../chart/service/OrderChartService.java | 55 ++ .../xingyun/chart/vo/CreateOrderChartVo.java | 39 + .../xingyun/chart/vo/GetOrderChartVo.java | 22 + .../xingyun/chart/vo/QueryOrderChartVo.java | 22 + xingyun-chart/src/main/java/lombok.config | 2 + .../resources/mappers/OrderChartMapper.xml | 83 ++ xingyun-comp/pom.xml | 31 + .../comp/bo/components/MapLocationBo.java | 23 + .../comp/bo/components/OrderTimeLineBo.java | 68 ++ .../xingyun/comp/bo/dic/CitySelectorBo.java | 37 + .../comp/bo/sw/excel/GetOnlineExcelBo.java | 67 ++ .../comp/bo/sw/excel/QueryOnlineExcelBo.java | 67 ++ .../comp/bo/sw/filebox/GetFileBoxBo.java | 83 ++ .../comp/bo/sw/filebox/QueryFileBoxBo.java | 56 ++ .../SecurityDownloadController.java | 80 ++ .../comp/controller/SelectorController.java | 50 + .../components/ComponentController.java | 172 ++++ .../comp/controller/sw/FileBoxController.java | 120 +++ .../controller/sw/OnlineExcelController.java | 149 +++ .../xingyun/comp/entity/FileBox.java | 105 +++ .../xingyun/comp/entity/OnlineExcel.java | 84 ++ .../xingyun/comp/enums/FileBoxFileType.java | 30 + .../xingyun/comp/enums/FileBoxNodeType.java | 24 + .../xingyun/comp/enums/SwOpLogType.java | 12 + .../xingyun/comp/impl/FileBoxServiceImpl.java | 210 +++++ .../comp/impl/OnlineExcelServiceImpl.java | 201 ++++ .../xingyun/comp/mappers/FileBoxMapper.java | 24 + .../comp/mappers/OnlineExcelMapper.java | 24 + .../xingyun/comp/service/FileBoxService.java | 67 ++ .../comp/service/OnlineExcelService.java | 74 ++ .../vo/sw/excel/BatchSendOnlineExcelVo.java | 40 + .../comp/vo/sw/excel/CreateOnlineExcelVo.java | 35 + .../comp/vo/sw/excel/QueryOnlineExcelVo.java | 44 + .../comp/vo/sw/excel/SendOnlineExcelVo.java | 38 + .../sw/excel/UpdateOnlineExcelContentVo.java | 28 + .../comp/vo/sw/excel/UpdateOnlineExcelVo.java | 45 + .../vo/sw/filebox/CreateFileBoxDirVo.java | 24 + .../comp/vo/sw/filebox/QueryFileBoxVo.java | 23 + .../comp/vo/sw/filebox/UpdateFileBoxVo.java | 35 + .../comp/vo/sw/filebox/UploadFileBoxVo.java | 27 + xingyun-comp/src/main/java/lombok.config | 2 + .../main/resources/mappers/FileBoxMapper.xml | 24 + .../resources/mappers/OnlineExcelMapper.xml | 52 ++ xingyun-core/pom.xml | 68 ++ .../timeline/ReceiveOrderTimeLineBizType.java | 13 + .../xingyun/core/queue/MqConstants.java | 25 + .../xingyun/core/queue/MqStringPool.java | 13 + .../xingyun/core/utils/SplitNumberUtil.java | 62 ++ xingyun-core/src/main/java/lombok.config | 2 + xingyun-sc/pom.xml | 29 + .../sc/bo/logistics/GetLogisticsSheetBo.java | 377 ++++++++ .../GetLogisticsSheetDeliveryBo.java | 45 + .../QueryLogisticsSheetBizOrderBo.java | 103 +++ .../bo/logistics/QueryLogisticsSheetBo.java | 125 +++ .../xingyun/sc/bo/paytype/OrderPayTypeBo.java | 62 ++ .../sc/bo/purchase/GetPurchaseOrderBo.java | 372 ++++++++ .../sc/bo/purchase/PrintPurchaseOrderBo.java | 235 +++++ .../bo/purchase/PurchaseOrderSelectorBo.java | 105 +++ .../purchase/PurchaseOrderWithReceiveBo.java | 298 ++++++ .../sc/bo/purchase/PurchaseProductBo.java | 126 +++ .../sc/bo/purchase/QueryPurchaseOrderBo.java | 176 ++++ .../QueryPurchaseOrderWithReceiveBo.java | 87 ++ .../purchase/config/GetPurchaseConfigBo.java | 61 ++ .../bo/purchase/receive/GetPaymentDateBo.java | 36 + .../purchase/receive/GetReceiveSheetBo.java | 435 +++++++++ .../purchase/receive/PrintReceiveSheetBo.java | 260 ++++++ .../purchase/receive/QueryReceiveSheetBo.java | 198 ++++ .../QueryReceiveSheetWithReturnBo.java | 97 ++ .../receive/ReceiveSheetSelectorBo.java | 105 +++ .../receive/ReceiveSheetWithReturnBo.java | 301 ++++++ .../returned/GetPurchaseReturnBo.java | 419 +++++++++ .../returned/PrintPurchaseReturnBo.java | 259 ++++++ .../returned/QueryPurchaseReturnBo.java | 190 ++++ .../xingyun/sc/bo/retail/RetailProductBo.java | 121 +++ .../bo/retail/config/GetRetailConfigBo.java | 49 + .../sc/bo/retail/out/GetRetailOutSheetBo.java | 412 +++++++++ .../bo/retail/out/PrintRetailOutSheetBo.java | 237 +++++ .../bo/retail/out/QueryRetailOutSheetBo.java | 172 ++++ .../out/QueryRetailOutSheetWithReturnBo.java | 100 ++ .../out/RetailOutSheetWithReturnBo.java | 300 ++++++ .../bo/retail/returned/GetRetailReturnBo.java | 413 +++++++++ .../retail/returned/PrintRetailReturnBo.java | 249 +++++ .../retail/returned/QueryRetailReturnBo.java | 192 ++++ .../xingyun/sc/bo/sale/GetSaleOrderBo.java | 381 ++++++++ .../xingyun/sc/bo/sale/PrintSaleOrderBo.java | 222 +++++ .../xingyun/sc/bo/sale/QuerySaleOrderBo.java | 162 ++++ .../sc/bo/sale/QuerySaleOrderWithOutBo.java | 87 ++ .../sc/bo/sale/SaleOrderWithOutBo.java | 319 +++++++ .../xingyun/sc/bo/sale/SaleProductBo.java | 121 +++ .../sc/bo/sale/config/GetSaleConfigBo.java | 49 + .../sc/bo/sale/out/GetSaleOutSheetBo.java | 446 +++++++++ .../sc/bo/sale/out/PrintSaleOutSheetBo.java | 248 +++++ .../sc/bo/sale/out/QuerySaleOutSheetBo.java | 189 ++++ .../out/QuerySaleOutSheetWithReturnBo.java | 97 ++ .../bo/sale/out/SaleOutSheetWithReturnBo.java | 297 ++++++ .../sc/bo/sale/returned/GetSaleReturnBo.java | 410 +++++++++ .../bo/sale/returned/PrintSaleReturnBo.java | 246 +++++ .../bo/sale/returned/QuerySaleReturnBo.java | 189 ++++ .../adjust/stock/QueryStockAdjustSheetBo.java | 140 +++ .../adjust/stock/StockAdjustProductBo.java | 107 +++ .../adjust/stock/StockAdjustSheetFullBo.java | 315 +++++++ .../stock/reason/GetStockAdjustReasonBo.java | 43 + .../reason/QueryStockAdjustReasonBo.java | 77 ++ .../reason/StockAdjustReasonSelectorBo.java | 37 + .../bo/stock/product/QueryProductStockBo.java | 129 +++ .../product/log/QueryProductStockLogBo.java | 189 ++++ .../take/config/GetTakeStockConfigBo.java | 63 ++ .../stock/take/plan/GetTakeStockPlanBo.java | 127 +++ .../stock/take/plan/QueryTakeStockPlanBo.java | 163 ++++ .../plan/QueryTakeStockPlanProductBo.java | 119 +++ .../stock/take/plan/TakeStockPlanFullBo.java | 285 ++++++ .../take/plan/TakeStockPlanSelectorBo.java | 90 ++ .../take/pre/GetPreTakeStockSheetBo.java | 231 +++++ .../stock/take/pre/PreTakeStockProductBo.java | 81 ++ .../take/pre/PreTakeStockSheetSelectorBo.java | 76 ++ .../take/pre/QueryPreTakeStockSheetBo.java | 99 ++ .../pre/QueryPreTakeStockSheetProductBo.java | 148 +++ .../take/sheet/QueryTakeStockSheetBo.java | 148 +++ .../take/sheet/TakeStockSheetFullBo.java | 355 ++++++++ .../take/sheet/TakeStockSheetProductBo.java | 130 +++ .../transfer/QueryScTransferOrderBo.java | 148 +++ .../QueryScTransferOrderDetailReceiveBo.java | 44 + .../stock/transfer/ScTransferOrderFullBo.java | 322 +++++++ .../stock/transfer/ScTransferProductBo.java | 107 +++ .../warning/GetProductStockWarningBo.java | 123 +++ .../GetProductStockWarningNotifyBo.java | 46 + .../warning/QueryProductStockWarningBo.java | 123 +++ .../components/code/GenerateCodeTypePool.java | 74 ++ .../sc/controller/ScSelectorController.java | 273 ++++++ .../logistics/LogisticsSheetController.java | 324 +++++++ .../purchase/PurchaseConfigController.java | 60 ++ .../purchase/PurchaseOrderController.java | 379 ++++++++ .../purchase/PurchaseReturnController.java | 198 ++++ .../purchase/ReceiveSheetController.java | 324 +++++++ .../retail/RetailConfigController.java | 60 ++ .../retail/RetailOutSheetController.java | 337 +++++++ .../retail/RetailReturnController.java | 201 ++++ .../controller/sale/SaleConfigController.java | 60 ++ .../controller/sale/SaleOrderController.java | 311 +++++++ .../sale/SaleOutSheetController.java | 276 ++++++ .../controller/sale/SaleReturnController.java | 201 ++++ .../stock/ProductStockController.java | 74 ++ .../stock/ProductStockLogController.java | 74 ++ .../adjust/StockAdjustReasonController.java | 131 +++ .../adjust/StockAdjustSheetController.java | 241 +++++ .../take/PreTakeStockSheetController.java | 232 +++++ .../stock/take/TakeStockConfigController.java | 68 ++ .../stock/take/TakeStockPlanController.java | 257 ++++++ .../stock/take/TakeStockSheetController.java | 271 ++++++ .../transfer/ScTransferOrderController.java | 290 ++++++ .../ProductStockWarningController.java | 217 +++++ .../logistics/LogisticsSheetBizOrderDto.java | 49 + .../dto/logistics/LogisticsSheetFullDto.java | 183 ++++ .../sc/dto/purchase/PurchaseOrderFullDto.java | 168 ++++ .../purchase/PurchaseOrderWithReceiveDto.java | 93 ++ .../sc/dto/purchase/PurchaseProductDto.java | 83 ++ .../purchase/receive/GetPaymentDateDto.java | 23 + .../purchase/receive/ReceiveSheetFullDto.java | 184 ++++ .../receive/ReceiveSheetWithReturnDto.java | 98 ++ .../returned/PurchaseReturnFullDto.java | 179 ++++ .../sc/dto/retail/RetailProductDto.java | 83 ++ .../out/RetailOutSheetDetailLotDto.java | 49 + .../dto/retail/out/RetailOutSheetFullDto.java | 194 ++++ .../out/RetailOutSheetWithReturnDto.java | 100 ++ .../retail/returned/RetailReturnFullDto.java | 194 ++++ .../xingyun/sc/dto/sale/SaleOrderFullDto.java | 172 ++++ .../sc/dto/sale/SaleOrderWithOutDto.java | 108 +++ .../xingyun/sc/dto/sale/SaleProductDto.java | 83 ++ .../sale/out/SaleOutSheetDetailLotDto.java | 49 + .../sc/dto/sale/out/SaleOutSheetFullDto.java | 199 ++++ .../sale/out/SaleOutSheetWithReturnDto.java | 100 ++ .../dto/sale/returned/SaleReturnFullDto.java | 194 ++++ .../sc/dto/stock/ProductStockChangeDto.java | 49 + .../adjust/stock/StockAdjustProductDto.java | 72 ++ .../adjust/stock/StockAdjustSheetFullDto.java | 116 +++ .../GetTakeStockPlanDetailProductDto.java | 31 + .../plan/QueryTakeStockPlanProductDto.java | 33 + .../stock/take/plan/TakeStockPlanFullDto.java | 124 +++ .../take/pre/PreTakeStockProductDto.java | 67 ++ .../take/pre/PreTakeStockSheetFullDto.java | 94 ++ .../pre/QueryPreTakeStockSheetProductDto.java | 39 + .../take/sheet/TakeStockSheetFullDto.java | 125 +++ .../take/sheet/TakeStockSheetProductDto.java | 67 ++ .../transfer/ScTransferOrderFullDto.java | 125 +++ .../stock/transfer/ScTransferProductDto.java | 72 ++ .../xingyun/sc/entity/LogisticsSheet.java | 179 ++++ .../sc/entity/LogisticsSheetDetail.java | 44 + .../xingyun/sc/entity/OrderPayType.java | 49 + .../xingyun/sc/entity/PreTakeStockSheet.java | 87 ++ .../sc/entity/PreTakeStockSheetDetail.java | 58 ++ .../xingyun/sc/entity/ProductStock.java | 53 ++ .../xingyun/sc/entity/ProductStockLog.java | 112 +++ .../sc/entity/ProductStockWarning.java | 91 ++ .../sc/entity/ProductStockWarningNotify.java | 30 + .../xingyun/sc/entity/PurchaseConfig.java | 61 ++ .../xingyun/sc/entity/PurchaseOrder.java | 139 +++ .../sc/entity/PurchaseOrderDetail.java | 78 ++ .../sc/entity/PurchaseOrderDetailBundle.java | 76 ++ .../entity/PurchaseOrderDetailBundleForm.java | 12 + .../sc/entity/PurchaseOrderDetailForm.java | 21 + .../xingyun/sc/entity/PurchaseOrderForm.java | 20 + .../xingyun/sc/entity/PurchaseReturn.java | 147 +++ .../sc/entity/PurchaseReturnDetail.java | 80 ++ .../xingyun/sc/entity/ReceiveSheet.java | 150 +++ .../xingyun/sc/entity/ReceiveSheetDetail.java | 84 ++ .../sc/entity/ReceiveSheetDetailBundle.java | 84 ++ .../xingyun/sc/entity/RetailConfig.java | 51 ++ .../xingyun/sc/entity/RetailOutSheet.java | 140 +++ .../sc/entity/RetailOutSheetDetail.java | 99 ++ .../sc/entity/RetailOutSheetDetailBundle.java | 84 ++ .../sc/entity/RetailOutSheetDetailLot.java | 61 ++ .../xingyun/sc/entity/RetailReturn.java | 147 +++ .../xingyun/sc/entity/RetailReturnDetail.java | 94 ++ .../xingyun/sc/entity/SaleConfig.java | 51 ++ .../xingyun/sc/entity/SaleOrder.java | 130 +++ .../xingyun/sc/entity/SaleOrderDetail.java | 93 ++ .../sc/entity/SaleOrderDetailBundle.java | 84 ++ .../xingyun/sc/entity/SaleOutSheet.java | 145 +++ .../xingyun/sc/entity/SaleOutSheetDetail.java | 104 +++ .../sc/entity/SaleOutSheetDetailBundle.java | 84 ++ .../sc/entity/SaleOutSheetDetailLot.java | 61 ++ .../xingyun/sc/entity/SaleReturn.java | 147 +++ .../xingyun/sc/entity/SaleReturnDetail.java | 94 ++ .../xingyun/sc/entity/ScTransferOrder.java | 119 +++ .../sc/entity/ScTransferOrderDetail.java | 74 ++ .../entity/ScTransferOrderDetailReceive.java | 69 ++ .../xingyun/sc/entity/StockAdjustReason.java | 88 ++ .../xingyun/sc/entity/StockAdjustSheet.java | 114 +++ .../sc/entity/StockAdjustSheetDetail.java | 54 ++ .../xingyun/sc/entity/TakeStockConfig.java | 51 ++ .../xingyun/sc/entity/TakeStockPlan.java | 98 ++ .../sc/entity/TakeStockPlanDetail.java | 73 ++ .../xingyun/sc/entity/TakeStockSheet.java | 112 +++ .../sc/entity/TakeStockSheetDetail.java | 53 ++ .../xingyun/sc/enums/LogisticsOpLogType.java | 13 + .../sc/enums/LogisticsSheetDetailBizType.java | 31 + .../sc/enums/LogisticsSheetStatus.java | 31 + .../sc/enums/OrderAddressOrderType.java | 33 + .../sc/enums/PreTakeStockSheetStatus.java | 32 + .../xingyun/sc/enums/ProductStockBizType.java | 34 + .../xingyun/sc/enums/PurchaseOpLogType.java | 13 + .../xingyun/sc/enums/PurchaseOrderStatus.java | 31 + .../sc/enums/PurchaseReturnStatus.java | 31 + .../xingyun/sc/enums/ReceiveSheetStatus.java | 31 + .../xingyun/sc/enums/RetailOpLogType.java | 13 + .../sc/enums/RetailOutSheetStatus.java | 31 + .../xingyun/sc/enums/RetailReturnStatus.java | 31 + .../xingyun/sc/enums/SaleOpLogType.java | 13 + .../xingyun/sc/enums/SaleOrderStatus.java | 31 + .../xingyun/sc/enums/SaleOutSheetStatus.java | 31 + .../xingyun/sc/enums/SaleReturnStatus.java | 31 + .../xingyun/sc/enums/ScTransferOpLogType.java | 13 + .../sc/enums/ScTransferOrderStatus.java | 31 + .../xingyun/sc/enums/SettleStatus.java | 31 + .../sc/enums/StockAdjustOpLogType.java | 13 + .../sc/enums/StockAdjustSheetBizType.java | 31 + .../sc/enums/StockAdjustSheetStatus.java | 31 + .../sc/enums/StockWarningOpLogType.java | 13 + .../xingyun/sc/enums/TakeStockOpLogType.java | 13 + .../xingyun/sc/enums/TakeStockPlanStatus.java | 31 + .../xingyun/sc/enums/TakeStockPlanType.java | 31 + .../sc/enums/TakeStockSheetStatus.java | 31 + .../events/order/ApprovePassOrderEvent.java | 26 + .../impl/ApprovePassPurchaseOrderEvent.java | 14 + .../impl/ApprovePassPurchaseReturnEvent.java | 14 + .../impl/ApprovePassRetailOutSheetEvent.java | 14 + .../impl/ApprovePassRetailReturnEvent.java | 14 + .../order/impl/ApprovePassSaleOrderEvent.java | 14 + .../impl/ApprovePassSaleReturnEvent.java | 14 + .../sc/events/stock/AddStockEvent.java | 26 + .../sc/events/stock/SubStockEvent.java | 26 + .../stock/take/DeleteTakeStockPlanEvent.java | 26 + .../LogisticsSheetDeliveryImportListener.java | 84 ++ .../LogisticsSheetDeliveryImportModel.java | 38 + .../logistics/LogisticsSheetExportModel.java | 212 +++++ .../LogisticsSheetExportTaskWorker.java | 38 + .../LogisticsSheetImportListener.java | 337 +++++++ .../logistics/LogisticsSheetImportModel.java | 201 ++++ .../purchase/PurchaseOrderExportModel.java | 199 ++++ .../PurchaseOrderExportTaskWorker.java | 38 + .../purchase/PurchaseOrderImportListener.java | 178 ++++ .../purchase/PurchaseOrderImportModel.java | 104 +++ .../PurchaseOrderPayTypeImportListener.java | 144 +++ .../PurchaseOrderPayTypeImportModel.java | 58 ++ .../receive/ReceiveSheetExportModel.java | 200 ++++ .../receive/ReceiveSheetExportTaskWorker.java | 38 + .../receive/ReceiveSheetImportListener.java | 184 ++++ .../receive/ReceiveSheetImportModel.java | 112 +++ .../ReceiveSheetPayTypeImportListener.java | 134 +++ .../ReceiveSheetPayTypeImportModel.java | 58 ++ .../returned/PurchaseReturnExportModel.java | 191 ++++ .../PurchaseReturnExportTaskWorker.java | 38 + .../retail/out/RetailOutSheetExportModel.java | 203 +++++ .../out/RetailOutSheetExportTaskWorker.java | 38 + .../returned/RetailReturnExportModel.java | 218 +++++ .../RetailReturnExportTaskWorker.java | 38 + .../sc/excel/sale/SaleOrderExportModel.java | 197 ++++ .../excel/sale/SaleOrderExportTaskWorker.java | 38 + .../sale/out/SaleOutSheetExportModel.java | 191 ++++ .../out/SaleOutSheetExportTaskWorker.java | 38 + .../sale/returned/SaleReturnExportModel.java | 191 ++++ .../returned/SaleReturnExportTaskWorker.java | 36 + .../excel/stock/ProductStockExportModel.java | 119 +++ .../stock/ProductStockExportTaskWorker.java | 37 + .../stock/ProductStockLogExportModel.java | 168 ++++ .../ProductStockLogExportTaskWorker.java | 38 + .../adjust/StockAdjustSheetExportModel.java | 131 +++ .../StockAdjustSheetExportTaskWorker.java | 38 + .../take/plan/TakeStockPlanExportModel.java | 147 +++ .../plan/TakeStockPlanExportTaskWorker.java | 38 + .../pre/PreTakeStockSheetExportModel.java | 87 ++ .../PreTakeStockSheetExportTaskWorker.java | 38 + .../take/sheet/TakeStockSheetExportModel.java | 138 +++ .../sheet/TakeStockSheetExportTaskWorker.java | 38 + .../transfer/ScTransferOrderExportModel.java | 139 +++ .../ScTransferOrderExportTaskWorker.java | 38 + .../warning/StockWarningImportListener.java | 112 +++ .../warning/StockWarningImportModel.java | 53 ++ .../LogisticsSheetDetailServiceImpl.java | 23 + .../logistics/LogisticsSheetServiceImpl.java | 270 ++++++ .../impl/paytype/OrderPayTypeServiceImpl.java | 60 ++ .../purchase/PurchaseConfigServiceImpl.java | 75 ++ ...chaseOrderDetailBundleFormServiceImpl.java | 14 + .../PurchaseOrderDetailBundleServiceImpl.java | 14 + .../PurchaseOrderDetailFormServiceImpl.java | 14 + .../PurchaseOrderDetailServiceImpl.java | 84 ++ .../PurchaseOrderFormServiceImpl.java | 14 + .../purchase/PurchaseOrderServiceImpl.java | 858 ++++++++++++++++++ .../PurchaseReturnDetailServiceImpl.java | 14 + .../purchase/PurchaseReturnServiceImpl.java | 603 ++++++++++++ .../ReceiveSheetDetailBundleServiceImpl.java | 14 + .../ReceiveSheetDetailServiceImpl.java | 84 ++ .../purchase/ReceiveSheetServiceImpl.java | 766 ++++++++++++++++ .../impl/retail/RetailConfigServiceImpl.java | 54 ++ ...RetailOutSheetDetailBundleServiceImpl.java | 14 + .../RetailOutSheetDetailLotServiceImpl.java | 101 +++ .../RetailOutSheetDetailServiceImpl.java | 170 ++++ .../retail/RetailOutSheetServiceImpl.java | 740 +++++++++++++++ .../retail/RetailReturnDetailServiceImpl.java | 14 + .../impl/retail/RetailReturnServiceImpl.java | 578 ++++++++++++ .../sc/impl/sale/SaleConfigServiceImpl.java | 54 ++ .../SaleOrderDetailBundleServiceImpl.java | 14 + .../impl/sale/SaleOrderDetailServiceImpl.java | 84 ++ .../sc/impl/sale/SaleOrderServiceImpl.java | 629 +++++++++++++ .../SaleOutSheetDetailBundleServiceImpl.java | 14 + .../SaleOutSheetDetailLotServiceImpl.java | 101 +++ .../sale/SaleOutSheetDetailServiceImpl.java | 172 ++++ .../sc/impl/sale/SaleOutSheetServiceImpl.java | 847 +++++++++++++++++ .../sale/SaleReturnDetailServiceImpl.java | 14 + .../sc/impl/sale/SaleReturnServiceImpl.java | 593 ++++++++++++ .../stock/ProductStockLogServiceImpl.java | 121 +++ .../impl/stock/ProductStockServiceImpl.java | 315 +++++++ .../adjust/StockAdjustReasonServiceImpl.java | 158 ++++ .../StockAdjustSheetDetailServiceImpl.java | 14 + .../adjust/StockAdjustSheetServiceImpl.java | 390 ++++++++ .../PreTakeStockSheetDetailServiceImpl.java | 14 + .../take/PreTakeStockSheetServiceImpl.java | 229 +++++ .../take/TakeStockConfigServiceImpl.java | 64 ++ .../take/TakeStockPlanDetailServiceImpl.java | 90 ++ .../stock/take/TakeStockPlanServiceImpl.java | 443 +++++++++ .../take/TakeStockSheetDetailServiceImpl.java | 14 + .../stock/take/TakeStockSheetServiceImpl.java | 469 ++++++++++ ...TransferOrderDetailReceiveServiceImpl.java | 14 + .../ScTransferOrderDetailServiceImpl.java | 27 + .../transfer/ScTransferOrderServiceImpl.java | 477 ++++++++++ .../ProductStockWarningNotifyServiceImpl.java | 66 ++ .../ProductStockWarningServiceImpl.java | 132 +++ .../ProductStockWarningSysNotifyRule.java | 55 ++ .../sc/listeners/app/OrderDataListener.java | 20 + .../app/StockChangeToMqListener.java | 26 + ...arningForDeleteSysNotifyGroupListener.java | 31 + ...roductStockWarningStockChangeListener.java | 156 ++++ .../mq/TakeStockPlanStockChangeListener.java | 47 + .../mappers/LogisticsSheetDetailMapper.java | 15 + .../sc/mappers/LogisticsSheetMapper.java | 74 ++ .../sc/mappers/OrderPayTypeMapper.java | 15 + .../PreTakeStockSheetDetailMapper.java | 15 + .../sc/mappers/PreTakeStockSheetMapper.java | 99 ++ .../sc/mappers/ProductStockLogMapper.java | 50 + .../sc/mappers/ProductStockMapper.java | 97 ++ .../sc/mappers/ProductStockWarningMapper.java | 43 + .../ProductStockWarningNotifyMapper.java | 15 + .../sc/mappers/PurchaseConfigMapper.java | 8 + .../PurchaseOrderDetailBundleFormMapper.java | 9 + .../PurchaseOrderDetailBundleMapper.java | 8 + .../PurchaseOrderDetailFormMapper.java | 16 + .../sc/mappers/PurchaseOrderDetailMapper.java | 44 + .../sc/mappers/PurchaseOrderFormMapper.java | 16 + .../sc/mappers/PurchaseOrderMapper.java | 122 +++ .../mappers/PurchaseReturnDetailMapper.java | 16 + .../sc/mappers/PurchaseReturnMapper.java | 63 ++ .../ReceiveSheetDetailBundleMapper.java | 8 + .../sc/mappers/ReceiveSheetDetailMapper.java | 45 + .../sc/mappers/ReceiveSheetMapper.java | 98 ++ .../sc/mappers/RetailConfigMapper.java | 8 + .../RetailOutSheetDetailBundleMapper.java | 8 + .../RetailOutSheetDetailLotMapper.java | 45 + .../mappers/RetailOutSheetDetailMapper.java | 45 + .../sc/mappers/RetailOutSheetMapper.java | 122 +++ .../sc/mappers/RetailReturnDetailMapper.java | 16 + .../sc/mappers/RetailReturnMapper.java | 49 + .../xingyun/sc/mappers/SaleConfigMapper.java | 8 + .../mappers/SaleOrderDetailBundleMapper.java | 8 + .../sc/mappers/SaleOrderDetailMapper.java | 45 + .../xingyun/sc/mappers/SaleOrderMapper.java | 120 +++ .../SaleOutSheetDetailBundleMapper.java | 8 + .../mappers/SaleOutSheetDetailLotMapper.java | 45 + .../sc/mappers/SaleOutSheetDetailMapper.java | 45 + .../sc/mappers/SaleOutSheetMapper.java | 98 ++ .../sc/mappers/SaleReturnDetailMapper.java | 16 + .../xingyun/sc/mappers/SaleReturnMapper.java | 63 ++ .../mappers/ScTransferOrderDetailMapper.java | 35 + .../ScTransferOrderDetailReceiveMapper.java | 16 + .../sc/mappers/ScTransferOrderMapper.java | 80 ++ .../sc/mappers/StockAdjustReasonMapper.java | 44 + .../mappers/StockAdjustSheetDetailMapper.java | 15 + .../sc/mappers/StockAdjustSheetMapper.java | 80 ++ .../sc/mappers/TakeStockConfigMapper.java | 15 + .../sc/mappers/TakeStockPlanDetailMapper.java | 73 ++ .../sc/mappers/TakeStockPlanMapper.java | 69 ++ .../mappers/TakeStockSheetDetailMapper.java | 15 + .../sc/mappers/TakeStockSheetMapper.java | 94 ++ .../LogisticsSheetDetailService.java | 17 + .../logistics/LogisticsSheetService.java | 97 ++ .../service/paytype/OrderPayTypeService.java | 33 + .../purchase/PurchaseConfigService.java | 22 + .../PurchaseOrderDetailBundleFormService.java | 9 + .../PurchaseOrderDetailBundleService.java | 8 + .../PurchaseOrderDetailFormService.java | 9 + .../purchase/PurchaseOrderDetailService.java | 34 + .../purchase/PurchaseOrderFormService.java | 9 + .../purchase/PurchaseOrderService.java | 149 +++ .../purchase/PurchaseReturnDetailService.java | 8 + .../purchase/PurchaseReturnService.java | 119 +++ .../ReceiveSheetDetailBundleService.java | 8 + .../purchase/ReceiveSheetDetailService.java | 34 + .../service/purchase/ReceiveSheetService.java | 157 ++++ .../service/retail/RetailConfigService.java | 22 + .../RetailOutSheetDetailBundleService.java | 9 + .../RetailOutSheetDetailLotService.java | 34 + .../retail/RetailOutSheetDetailService.java | 48 + .../service/retail/RetailOutSheetService.java | 151 +++ .../retail/RetailReturnDetailService.java | 8 + .../service/retail/RetailReturnService.java | 81 ++ .../sc/service/sale/SaleConfigService.java | 22 + .../sale/SaleOrderDetailBundleService.java | 8 + .../service/sale/SaleOrderDetailService.java | 34 + .../sc/service/sale/SaleOrderService.java | 140 +++ .../sale/SaleOutSheetDetailBundleService.java | 8 + .../sale/SaleOutSheetDetailLotService.java | 34 + .../sale/SaleOutSheetDetailService.java | 48 + .../sc/service/sale/SaleOutSheetService.java | 157 ++++ .../service/sale/SaleReturnDetailService.java | 8 + .../sc/service/sale/SaleReturnService.java | 119 +++ .../service/stock/ProductStockLogService.java | 41 + .../sc/service/stock/ProductStockService.java | 65 ++ .../adjust/StockAdjustReasonService.java | 68 ++ .../adjust/StockAdjustSheetDetailService.java | 9 + .../stock/adjust/StockAdjustSheetService.java | 109 +++ .../take/PreTakeStockSheetDetailService.java | 8 + .../stock/take/PreTakeStockSheetService.java | 106 +++ .../stock/take/TakeStockConfigService.java | 29 + .../take/TakeStockPlanDetailService.java | 51 ++ .../stock/take/TakeStockPlanService.java | 104 +++ .../take/TakeStockSheetDetailService.java | 8 + .../stock/take/TakeStockSheetService.java | 129 +++ .../ScTransferOrderDetailReceiveService.java | 9 + .../ScTransferOrderDetailService.java | 26 + .../transfer/ScTransferOrderService.java | 110 +++ .../ProductStockWarningNotifyService.java | 36 + .../warning/ProductStockWarningService.java | 69 ++ .../sc/vo/address/CreateOrderAddressVo.java | 82 ++ .../vo/logistics/CreateLogisticsSheetVo.java | 150 +++ .../logistics/DeliveryLogisticsSheetVo.java | 35 + .../logistics/LogisticsSheetBizOrderVo.java | 31 + .../LogisticsSheetCalcWeightOrVolumeVo.java | 46 + .../logistics/LogisticsSheetSelectorVo.java | 76 ++ .../QueryLogisticsSheetBizOrderVo.java | 37 + .../vo/logistics/QueryLogisticsSheetVo.java | 76 ++ .../vo/logistics/UpdateLogisticsSheetVo.java | 20 + .../xingyun/sc/vo/paytype/OrderPayTypeVo.java | 35 + .../purchase/ApprovePassPurchaseOrderVo.java | 21 + .../ApproveRefusePurchaseOrderVo.java | 28 + .../sc/vo/purchase/CreatePurchaseOrderVo.java | 121 +++ .../vo/purchase/PurchaseOrderSelectorVo.java | 58 ++ .../sc/vo/purchase/PurchaseProductVo.java | 38 + .../sc/vo/purchase/QueryPurchaseOrderVo.java | 82 ++ .../QueryPurchaseOrderWithReceiveVo.java | 49 + .../vo/purchase/QueryPurchaseProductVo.java | 43 + .../sc/vo/purchase/UpdatePurchaseOrderVo.java | 23 + .../config/UpdatePurchaseConfigVo.java | 55 ++ .../receive/ApprovePassReceiveSheetVo.java | 27 + .../receive/ApproveRefuseReceiveSheetVo.java | 28 + .../receive/CreateReceiveSheetVo.java | 173 ++++ .../purchase/receive/QueryReceiveSheetVo.java | 96 ++ .../QueryReceiveSheetWithReturnVo.java | 49 + .../vo/purchase/receive/ReceiveProductVo.java | 44 + .../receive/ReceiveSheetSelectorVo.java | 58 ++ .../receive/UpdateReceiveSheetVo.java | 31 + .../returned/ApprovePassPurchaseReturnVo.java | 27 + .../ApproveRefusePurchaseReturnVo.java | 28 + .../returned/CreatePurchaseReturnVo.java | 167 ++++ .../returned/QueryPurchaseReturnVo.java | 96 ++ .../vo/purchase/returned/ReturnProductVo.java | 44 + .../returned/UpdatePurchaseReturnVo.java | 32 + .../retail/config/UpdateRetailConfigVo.java | 49 + .../out/ApprovePassRetailOutSheetVo.java | 27 + .../out/ApproveRefuseRetailOutSheetVo.java | 28 + .../vo/retail/out/CreateRetailOutSheetVo.java | 160 ++++ .../vo/retail/out/QueryRetailOutSheetVo.java | 90 ++ .../out/QueryRetailOutSheetWithReturnVo.java | 49 + .../vo/retail/out/QueryRetailProductVo.java | 43 + .../sc/vo/retail/out/RetailOutProductVo.java | 50 + .../retail/out/RetailOutSheetSelectorVo.java | 58 ++ .../vo/retail/out/UpdateRetailOutSheetVo.java | 21 + .../returned/ApprovePassRetailReturnVo.java | 27 + .../returned/ApproveRefuseRetailReturnVo.java | 28 + .../retail/returned/CreateRetailReturnVo.java | 210 +++++ .../retail/returned/QueryRetailReturnVo.java | 96 ++ .../returned/RetailReturnProductVo.java | 56 ++ .../retail/returned/UpdateRetailReturnVo.java | 31 + .../sc/vo/sale/ApprovePassSaleOrderVo.java | 27 + .../sc/vo/sale/ApproveRefuseSaleOrderVo.java | 28 + .../xingyun/sc/vo/sale/CreateSaleOrderVo.java | 126 +++ .../xingyun/sc/vo/sale/QuerySaleOrderVo.java | 82 ++ .../sc/vo/sale/QuerySaleOrderWithOutVo.java | 49 + .../sc/vo/sale/QuerySaleProductVo.java | 43 + .../sc/vo/sale/SaleOrderSelectorVo.java | 58 ++ .../xingyun/sc/vo/sale/SaleProductVo.java | 50 + .../xingyun/sc/vo/sale/UpdateSaleOrderVo.java | 20 + .../sc/vo/sale/config/UpdateSaleConfigVo.java | 49 + .../sale/out/ApprovePassSaleOutSheetVo.java | 27 + .../sale/out/ApproveRefuseSaleOutSheetVo.java | 28 + .../sc/vo/sale/out/CreateSaleOutSheetVo.java | 179 ++++ .../sc/vo/sale/out/QuerySaleOutSheetVo.java | 96 ++ .../out/QuerySaleOutSheetWithReturnVo.java | 49 + .../sc/vo/sale/out/SaleOutProductVo.java | 56 ++ .../vo/sale/out/SaleOutSheetSelectorVo.java | 58 ++ .../sc/vo/sale/out/UpdateSaleOutSheetVo.java | 34 + .../returned/ApprovePassSaleReturnVo.java | 27 + .../returned/ApproveRefuseSaleReturnVo.java | 28 + .../vo/sale/returned/CreateSaleReturnVo.java | 178 ++++ .../vo/sale/returned/QuerySaleReturnVo.java | 96 ++ .../vo/sale/returned/SaleReturnProductVo.java | 56 ++ .../vo/sale/returned/UpdateSaleReturnVo.java | 31 + .../sc/vo/stock/AddProductStockVo.java | 87 ++ .../sc/vo/stock/QueryProductStockVo.java | 39 + .../sc/vo/stock/SubProductStockVo.java | 80 ++ .../stock/ApprovePassStockAdjustSheetVo.java | 27 + .../ApproveRefuseStockAdjustSheetVo.java | 28 + .../stock/CreateStockAdjustSheetVo.java | 72 ++ .../stock/QueryStockAdjustProductVo.java | 37 + .../adjust/stock/QueryStockAdjustSheetVo.java | 91 ++ .../adjust/stock/StockAdjustProductVo.java | 38 + .../stock/UpdateStockAdjustSheetVo.java | 18 + .../reason/CreateStockAdjustReasonVo.java | 36 + .../reason/QueryStockAdjustReasonVo.java | 26 + .../reason/StockAdjustReasonSelectorVo.java | 26 + .../reason/UpdateStockAdjustReasonVo.java | 43 + .../sc/vo/stock/log/AddLogWithAddStockVo.java | 122 +++ .../sc/vo/stock/log/AddLogWithSubStockVo.java | 122 +++ .../vo/stock/log/QueryProductStockLogVo.java | 64 ++ .../sc/vo/stock/lot/AddProductLotStockVo.java | 31 + .../sc/vo/stock/lot/CreateProductLotVo.java | 74 ++ .../sc/vo/stock/lot/QueryProductLotVo.java | 59 ++ .../take/config/UpdateTakeStockConfigVo.java | 66 ++ .../take/plan/CancelTakeStockPlanVo.java | 21 + .../take/plan/CreateTakeStockPlanVo.java | 65 ++ .../take/plan/HandleTakeStockPlanVo.java | 106 +++ .../stock/take/plan/QueryTakeStockPlanVo.java | 79 ++ .../take/plan/TakeStockPlanSelectorVo.java | 83 ++ .../take/plan/UpdateTakeStockPlanVo.java | 36 + .../take/pre/CreatePreTakeStockSheetVo.java | 111 +++ .../stock/take/pre/PreTakeStockProductVo.java | 40 + .../take/pre/PreTakeStockSheetSelectorVo.java | 53 ++ .../take/pre/QueryPreTakeStockProductVo.java | 29 + .../take/pre/QueryPreTakeStockSheetVo.java | 59 ++ .../take/pre/UpdatePreTakeStockSheetVo.java | 18 + .../sheet/ApprovePassTakeStockSheetVo.java | 27 + .../sheet/ApproveRefuseTakeStockSheetVo.java | 28 + .../take/sheet/CreateTakeStockSheetVo.java | 65 ++ .../sheet/QueryTakeStockSheetProductVo.java | 37 + .../take/sheet/QueryTakeStockSheetVo.java | 100 ++ .../take/sheet/TakeStockSheetProductVo.java | 38 + .../take/sheet/UpdateTakeStockSheetVo.java | 59 ++ .../ApprovePassScTransferOrderVo.java | 27 + .../ApproveRefuseScTransferOrderVo.java | 28 + .../transfer/CreateScTransferOrderVo.java | 62 ++ .../QueryScTransferOrderDetailReceiveVo.java | 23 + .../transfer/QueryScTransferOrderVo.java | 85 ++ .../transfer/QueryScTransferProductVo.java | 37 + .../transfer/ReceiveScTransferOrderVo.java | 56 ++ .../stock/transfer/ScTransferProductVo.java | 38 + .../transfer/UpdateScTransferOrderVo.java | 18 + .../warning/CreateProductStockWarningVo.java | 50 + .../warning/QueryProductStockWarningVo.java | 50 + .../warning/UpdateProductStockWarningVo.java | 26 + xingyun-sc/src/main/java/lombok.config | 2 + .../logistics/LogisticsSheetMapper.xml | 219 +++++ .../purchase/PurchaseOrderDetailMapper.xml | 49 + .../mappers/purchase/PurchaseOrderMapper.xml | 346 +++++++ .../mappers/purchase/PurchaseReturnMapper.xml | 192 ++++ .../purchase/ReceiveSheetDetailMapper.xml | 49 + .../mappers/purchase/ReceiveSheetMapper.xml | 313 +++++++ .../retail/RetailOutSheetDetailLotMapper.xml | 41 + .../retail/RetailOutSheetDetailMapper.xml | 52 ++ .../mappers/retail/RetailOutSheetMapper.xml | 364 ++++++++ .../mappers/retail/RetailReturnMapper.xml | 154 ++++ .../mappers/sale/SaleOrderDetailMapper.xml | 53 ++ .../mappers/sale/SaleOrderMapper.xml | 352 +++++++ .../sale/SaleOutSheetDetailLotMapper.xml | 41 + .../mappers/sale/SaleOutSheetDetailMapper.xml | 52 ++ .../mappers/sale/SaleOutSheetMapper.xml | 303 +++++++ .../mappers/sale/SaleReturnMapper.xml | 170 ++++ .../mappers/stock/ProductStockLogMapper.xml | 82 ++ .../mappers/stock/ProductStockMapper.xml | 84 ++ .../stock/ProductStockWarningMapper.xml | 40 + .../stock/adjust/StockAdjustReasonMapper.xml | 40 + .../stock/adjust/StockAdjustSheetMapper.xml | 175 ++++ .../stock/take/PreTaskStockSheetMapper.xml | 223 +++++ .../stock/take/TakeStockConfigMapper.xml | 5 + .../stock/take/TakeStockPlanDetailMapper.xml | 69 ++ .../stock/take/TakeStockPlanMapper.xml | 184 ++++ .../stock/take/TakeStockSheetMapper.xml | 227 +++++ .../transfer/ScTransferOrderDetailMapper.xml | 16 + .../stock/transfer/ScTransferOrderMapper.xml | 177 ++++ .../main/resources/print/purchase-order.ftl | 117 +++ .../main/resources/print/purchase-return.ftl | 123 +++ .../main/resources/print/receive-sheet.ftl | 127 +++ .../main/resources/print/retail-out-sheet.ftl | 120 +++ .../main/resources/print/retail-return.ftl | 127 +++ .../src/main/resources/print/sale-order.ftl | 109 +++ .../main/resources/print/sale-out-sheet.ftl | 126 +++ .../src/main/resources/print/sale-return.ftl | 127 +++ xingyun-server/pom.xml | 158 ++++ .../xingyun/server/XingYunApplication.java | 88 ++ xingyun-server/src/main/java/lombok.config | 2 + .../src/main/resources/application-dev.yml | 110 +++ .../src/main/resources/application-prod.yml | 114 +++ .../src/main/resources/application-test.yml | 115 +++ .../src/main/resources/application.yml | 229 +++++ .../src/main/resources/magic-editor-config.js | 21 + xingyun-settle/pom.xml | 26 + .../bo/check/GetSettleCheckSheetBo.java | 280 ++++++ .../bo/check/QuerySettleCheckSheetBo.java | 180 ++++ .../settle/bo/check/SettleCheckBizItemBo.java | 74 ++ .../CustomerSettleCheckBizItemBo.java | 75 ++ .../GetCustomerSettleCheckSheetBo.java | 283 ++++++ .../QueryCustomerSettleCheckSheetBo.java | 180 ++++ .../settle/bo/fee/GetSettleFeeSheetBo.java | 210 +++++ .../settle/bo/fee/QuerySettleFeeSheetBo.java | 141 +++ .../customer/GetCustomerSettleFeeSheetBo.java | 213 +++++ .../QueryCustomerSettleFeeSheetBo.java | 142 +++ .../settle/bo/item/in/GetSettleInItemBo.java | 43 + .../bo/item/in/QuerySettleInItemBo.java | 77 ++ .../bo/item/in/SettleInItemSelectorBo.java | 37 + .../bo/item/out/GetSettleOutItemBo.java | 43 + .../bo/item/out/QuerySettleOutItemBo.java | 77 ++ .../bo/item/out/SettleOutItemSelectorBo.java | 37 + .../settle/bo/pre/GetSettlePreSheetBo.java | 190 ++++ .../settle/bo/pre/QuerySettlePreSheetBo.java | 134 +++ .../customer/GetCustomerSettlePreSheetBo.java | 192 ++++ .../QueryCustomerSettlePreSheetBo.java | 134 +++ .../settle/bo/sheet/GetSettleSheetBo.java | 268 ++++++ .../settle/bo/sheet/QuerySettleSheetBo.java | 150 +++ .../settle/bo/sheet/SettleBizItemBo.java | 78 ++ .../customer/CustomerSettleBizItemBo.java | 78 ++ .../customer/GetCustomerSettleSheetBo.java | 271 ++++++ .../customer/QueryCustomerSettleSheetBo.java | 150 +++ .../components/code/GenerateCodeTypePool.java | 44 + .../CustomerSettleCheckSheetController.java | 205 +++++ .../CustomerSettleFeeSheetController.java | 183 ++++ .../CustomerSettlePreSheetController.java | 183 ++++ .../CustomerSettleSheetController.java | 201 ++++ .../SettleCheckSheetController.java | 199 ++++ .../controller/SettleFeeSheetController.java | 179 ++++ .../controller/SettleInItemController.java | 143 +++ .../controller/SettleOutItemController.java | 144 +++ .../controller/SettlePreSheetController.java | 178 ++++ .../controller/SettleSelectorController.java | 129 +++ .../controller/SettleSheetController.java | 198 ++++ .../dto/check/SettleCheckBizItemDto.java | 46 + .../dto/check/SettleCheckSheetFullDto.java | 156 ++++ .../CustomerSettleCheckBizItemDto.java | 46 + .../CustomerSettleCheckSheetFullDto.java | 156 ++++ .../settle/dto/fee/SettleFeeSheetFullDto.java | 119 +++ .../CustomerSettleFeeSheetFullDto.java | 119 +++ .../settle/dto/pre/SettlePreSheetFullDto.java | 113 +++ .../CustomerSettlePreSheetFullDto.java | 113 +++ .../settle/dto/sheet/SettleBizItemDto.java | 49 + .../settle/dto/sheet/SettleSheetFullDto.java | 133 +++ .../customer/CustomerSettleBizItemDto.java | 49 + .../customer/CustomerSettleSheetFullDto.java | 133 +++ .../entity/CustomerSettleCheckSheet.java | 139 +++ .../CustomerSettleCheckSheetDetail.java | 67 ++ .../settle/entity/CustomerSettleFeeSheet.java | 120 +++ .../entity/CustomerSettleFeeSheetDetail.java | 50 + .../settle/entity/CustomerSettlePreSheet.java | 113 +++ .../entity/CustomerSettlePreSheetDetail.java | 50 + .../settle/entity/CustomerSettleSheet.java | 124 +++ .../entity/CustomerSettleSheetDetail.java | 60 ++ .../settle/entity/SettleCheckSheet.java | 139 +++ .../settle/entity/SettleCheckSheetDetail.java | 67 ++ .../xingyun/settle/entity/SettleFeeSheet.java | 120 +++ .../settle/entity/SettleFeeSheetDetail.java | 50 + .../xingyun/settle/entity/SettleInItem.java | 88 ++ .../xingyun/settle/entity/SettleOutItem.java | 88 ++ .../xingyun/settle/entity/SettlePreSheet.java | 113 +++ .../settle/entity/SettlePreSheetDetail.java | 50 + .../xingyun/settle/entity/SettleSheet.java | 124 +++ .../settle/entity/SettleSheetDetail.java | 60 ++ .../CustomerSettleCheckSheetBizType.java | 32 + .../CustomerSettleCheckSheetCalcType.java | 31 + .../enums/CustomerSettleCheckSheetStatus.java | 31 + .../enums/CustomerSettleFeeSheetStatus.java | 31 + .../enums/CustomerSettleFeeSheetType.java | 31 + .../enums/CustomerSettlePreSheetStatus.java | 31 + .../enums/CustomerSettleSheetStatus.java | 31 + .../settle/enums/SettleCheckSheetBizType.java | 32 + .../enums/SettleCheckSheetCalcType.java | 31 + .../settle/enums/SettleCheckSheetStatus.java | 31 + .../settle/enums/SettleFeeSheetStatus.java | 31 + .../settle/enums/SettleFeeSheetType.java | 31 + .../xingyun/settle/enums/SettleOpLogType.java | 12 + .../settle/enums/SettlePreSheetStatus.java | 31 + .../settle/enums/SettleSheetStatus.java | 31 + .../check/SettleCheckSheetExportModel.java | 169 ++++ .../SettleCheckSheetExportTaskWorker.java | 38 + .../CustomerSettleCheckSheetExportModel.java | 171 ++++ ...tomerSettleCheckSheetExportTaskWorker.java | 38 + .../excel/fee/SettleFeeSheetExportModel.java | 138 +++ .../fee/SettleFeeSheetExportTaskWorker.java | 38 + .../CustomerSettleFeeSheetExportModel.java | 140 +++ ...ustomerSettleFeeSheetExportTaskWorker.java | 38 + .../item/in/SettleInItemExportModel.java | 43 + .../item/in/SettleInItemExportTaskWorker.java | 37 + .../item/out/SettleOutItemExportModel.java | 43 + .../out/SettleOutItemExportTaskWorker.java | 37 + .../excel/pre/SettlePreSheetExportModel.java | 138 +++ .../pre/SettlePreSheetExportTaskWorker.java | 38 + .../CustomerSettlePreSheetExportModel.java | 140 +++ ...ustomerSettlePreSheetExportTaskWorker.java | 38 + .../excel/sheet/SettleSheetExportModel.java | 137 +++ .../sheet/SettleSheetExportTaskWorker.java | 38 + .../CustomerSettleSheetExportModel.java | 139 +++ .../CustomerSettleSheetExportTaskWorker.java | 38 + ...omerSettleCheckSheetDetailServiceImpl.java | 15 + .../CustomerSettleCheckSheetServiceImpl.java | 781 ++++++++++++++++ ...stomerSettleFeeSheetDetailServiceImpl.java | 14 + .../CustomerSettleFeeSheetServiceImpl.java | 391 ++++++++ ...stomerSettlePreSheetDetailServiceImpl.java | 14 + .../CustomerSettlePreSheetServiceImpl.java | 380 ++++++++ .../CustomerSettleSheetDetailServiceImpl.java | 14 + .../impl/CustomerSettleSheetServiceImpl.java | 492 ++++++++++ .../SettleCheckSheetDetailServiceImpl.java | 14 + .../impl/SettleCheckSheetServiceImpl.java | 770 ++++++++++++++++ .../impl/SettleFeeSheetDetailServiceImpl.java | 13 + .../impl/SettleFeeSheetServiceImpl.java | 384 ++++++++ .../settle/impl/SettleInItemServiceImpl.java | 153 ++++ .../settle/impl/SettleOutItemServiceImpl.java | 153 ++++ .../impl/SettlePreSheetDetailServiceImpl.java | 13 + .../impl/SettlePreSheetServiceImpl.java | 372 ++++++++ .../impl/SettleSheetDetailServiceImpl.java | 13 + .../settle/impl/SettleSheetServiceImpl.java | 483 ++++++++++ .../CustomerSettleCheckSheetDetailMapper.java | 17 + .../CustomerSettleCheckSheetMapper.java | 61 ++ .../CustomerSettleFeeSheetDetailMapper.java | 17 + .../mappers/CustomerSettleFeeSheetMapper.java | 63 ++ .../CustomerSettlePreSheetDetailMapper.java | 17 + .../mappers/CustomerSettlePreSheetMapper.java | 63 ++ .../CustomerSettleSheetDetailMapper.java | 16 + .../mappers/CustomerSettleSheetMapper.java | 49 + .../mappers/SettleCheckSheetDetailMapper.java | 16 + .../mappers/SettleCheckSheetMapper.java | 61 ++ .../mappers/SettleFeeSheetDetailMapper.java | 16 + .../settle/mappers/SettleFeeSheetMapper.java | 63 ++ .../settle/mappers/SettleInItemMapper.java | 36 + .../settle/mappers/SettleOutItemMapper.java | 36 + .../mappers/SettlePreSheetDetailMapper.java | 16 + .../settle/mappers/SettlePreSheetMapper.java | 63 ++ .../mappers/SettleSheetDetailMapper.java | 16 + .../settle/mappers/SettleSheetMapper.java | 49 + ...CustomerSettleCheckSheetDetailService.java | 9 + .../CustomerSettleCheckSheetService.java | 171 ++++ .../CustomerSettleFeeSheetDetailService.java | 9 + .../CustomerSettleFeeSheetService.java | 120 +++ .../CustomerSettlePreSheetDetailService.java | 9 + .../CustomerSettlePreSheetService.java | 120 +++ .../CustomerSettleSheetDetailService.java | 9 + .../service/CustomerSettleSheetService.java | 120 +++ .../SettleCheckSheetDetailService.java | 8 + .../service/SettleCheckSheetService.java | 169 ++++ .../service/SettleFeeSheetDetailService.java | 8 + .../settle/service/SettleFeeSheetService.java | 118 +++ .../settle/service/SettleInItemService.java | 66 ++ .../settle/service/SettleOutItemService.java | 69 ++ .../service/SettlePreSheetDetailService.java | 8 + .../settle/service/SettlePreSheetService.java | 118 +++ .../service/SettleSheetDetailService.java | 8 + .../settle/service/SettleSheetService.java | 119 +++ .../check/ApprovePassSettleCheckSheetVo.java | 27 + .../ApproveRefuseSettleCheckSheetVo.java | 28 + .../vo/check/CreateSettleCheckSheetVo.java | 73 ++ .../vo/check/QuerySettleCheckSheetVo.java | 78 ++ .../vo/check/QueryUnCheckBizItemVo.java | 34 + .../vo/check/SettleCheckSheetItemVo.java | 41 + .../vo/check/UpdateSettleCheckSheetVo.java | 18 + ...ApprovePassCustomerSettleCheckSheetVo.java | 27 + ...proveRefuseCustomerSettleCheckSheetVo.java | 28 + .../CreateCustomerSettleCheckSheetVo.java | 73 ++ .../CustomerSettleCheckSheetItemVo.java | 41 + .../QueryCustomerSettleCheckSheetVo.java | 78 ++ .../QueryCustomerUnCheckBizItemVo.java | 34 + .../UpdateCustomerSettleCheckSheetVo.java | 18 + .../vo/fee/ApprovePassSettleFeeSheetVo.java | 27 + .../vo/fee/ApproveRefuseSettleFeeSheetVo.java | 28 + .../settle/vo/fee/CreateSettleFeeSheetVo.java | 77 ++ .../settle/vo/fee/QuerySettleFeeSheetVo.java | 78 ++ .../settle/vo/fee/SettleFeeSheetItemVo.java | 26 + .../settle/vo/fee/UpdateSettleFeeSheetVo.java | 18 + .../ApprovePassCustomerSettleFeeSheetVo.java | 27 + ...ApproveRefuseCustomerSettleFeeSheetVo.java | 28 + .../CreateCustomerSettleFeeSheetVo.java | 77 ++ .../CustomerSettleFeeSheetItemVo.java | 26 + .../QueryCustomerSettleFeeSheetVo.java | 78 ++ .../UpdateCustomerSettleFeeSheetVo.java | 18 + .../vo/item/in/CreateSettleInItemVo.java | 36 + .../vo/item/in/QuerySettleInItemVo.java | 26 + .../vo/item/in/SettleInItemSelectorVo.java | 26 + .../vo/item/in/UpdateSettleInItemVo.java | 43 + .../vo/item/out/CreateSettleOutItemVo.java | 36 + .../vo/item/out/QuerySettleOutItemVo.java | 26 + .../vo/item/out/SettleOutItemSelectorVo.java | 26 + .../vo/item/out/UpdateSettleOutItemVo.java | 43 + .../vo/pre/ApprovePassSettlePreSheetVo.java | 27 + .../vo/pre/ApproveRefuseSettlePreSheetVo.java | 28 + .../settle/vo/pre/CreateSettlePreSheetVo.java | 67 ++ .../settle/vo/pre/QuerySettlePreSheetVo.java | 78 ++ .../settle/vo/pre/SettlePreSheetItemVo.java | 26 + .../settle/vo/pre/UpdateSettlePreSheetVo.java | 18 + .../ApprovePassCustomerSettlePreSheetVo.java | 27 + ...ApproveRefuseCustomerSettlePreSheetVo.java | 28 + .../CreateCustomerSettlePreSheetVo.java | 67 ++ .../CustomerSettlePreSheetItemVo.java | 26 + .../QueryCustomerSettlePreSheetVo.java | 78 ++ .../UpdateCustomerSettlePreSheetVo.java | 18 + .../vo/sheet/ApprovePassSettleSheetVo.java | 27 + .../vo/sheet/ApproveRefuseSettleSheetVo.java | 28 + .../settle/vo/sheet/CreateSettleSheetVo.java | 73 ++ .../settle/vo/sheet/QuerySettleSheetVo.java | 70 ++ .../vo/sheet/QueryUnSettleBizItemVo.java | 34 + .../settle/vo/sheet/SettleSheetItemVo.java | 38 + .../settle/vo/sheet/UpdateSettleSheetVo.java | 18 + .../ApprovePassCustomerSettleSheetVo.java | 27 + .../ApproveRefuseCustomerSettleSheetVo.java | 28 + .../customer/CreateCustomerSettleSheetVo.java | 73 ++ .../customer/CustomerSettleSheetItemVo.java | 38 + .../customer/QueryCustomerSettleSheetVo.java | 70 ++ .../QueryCustomerUnSettleBizItemVo.java | 34 + .../customer/UpdateCustomerSettleSheetVo.java | 18 + xingyun-settle/src/main/java/lombok.config | 2 + .../CustomerSettleCheckSheetMapper.xml | 181 ++++ .../mappers/CustomerSettleFeeSheetMapper.xml | 155 ++++ .../mappers/CustomerSettlePreSheetMapper.xml | 151 +++ .../mappers/CustomerSettleSheetMapper.xml | 145 +++ .../mappers/SettleCheckSheetMapper.xml | 180 ++++ .../mappers/SettleFeeSheetMapper.xml | 154 ++++ .../resources/mappers/SettleInItemMapper.xml | 59 ++ .../resources/mappers/SettleOutItemMapper.xml | 59 ++ .../mappers/SettlePreSheetMapper.xml | 150 +++ .../resources/mappers/SettleSheetMapper.xml | 144 +++ 1185 files changed, 108514 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 xingyun-basedata/pom.xml create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteCustomerListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteMemberListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteShopListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteStoreCenterListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteSupplierListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductCategoryPropertyForDeleteProductPropertyListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductBrandListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductCategoryListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyItemForDeleteProductPropertyListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyItemListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ShopForDeleteSysDeptListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/AddressSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/GetAddressBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/QueryAddressBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/CustomerSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/GetCustomerBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/QueryCustomerBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/GetLogisticsCompanyBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/LogisticsCompanySelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/QueryLogisticsCompanyBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/GetMemberBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/MemberSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/QueryMemberBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/GetPayTypeBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/PayTypeSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/QueryPayTypeBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateCompSettingBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateSettingBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/QueryPrintTemplateBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/GetProductBrandBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductBrandSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductCategorySelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/QueryProductBrandBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/GetProductCategoryBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/ProductCategoryTreeBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductBundleBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/GetProductPropertyBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/ProductPropertyModelorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/QueryProductPropertyBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/GetProductPropertyItemBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/QueryProductPropertyItemBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/GetShopBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/QueryShopBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/ShopSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/GetStoreCenterBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/QueryStoreCenterBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/StoreCenterSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/GetSupplierBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/QuerySupplierBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/SupplierSelectorBo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AddressController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/BaseDataSelectorController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/CustomerController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/LogisticsCompanyController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/MemberController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PayTypeController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PrintTemplateController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductBrandController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductCategoryController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyItemController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ShopController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/StoreCenterController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/SupplierController.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/ProductPropertyRelationDto.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/property/ProductPropertyModelorDto.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Address.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Customer.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/LogisticsCompany.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Member.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PayType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplate.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplateComp.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Product.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBrand.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBundle.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategory.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategoryProperty.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductProperty.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyItem.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyRelation.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPurchase.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductRetail.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductSale.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Shop.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/StoreCenter.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Supplier.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressEntityType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/BaseDataOpLogType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnDataType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/InvoiceType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ManageType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductCategoryNodeType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/PropertyType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/SettleType.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/TaxRate.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteCustomerEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteLogisticsCompanyEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteMemberEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeletePayTypeEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductBrandEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductCategoryEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyItemEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteShopEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteStoreCenterEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteSupplierEvent.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportTaskWorker.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportListener.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportModel.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/address/AddressServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/customer/CustomerServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/logistics/LogisticsCompanyServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/member/MemberServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/paytype/PayTypeServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateCompServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBrandServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBundleServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryPropertyServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyItemServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyRelationServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPurchaseServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductRetailServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductSaleServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/shop/ShopServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/storecenter/StoreCenterServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/supplier/SupplierServiceImpl.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AddressMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CustomerMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/LogisticsCompanyMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/MemberMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PayTypeMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateCompMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBrandMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBundleMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryPropertyMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyItemMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyRelationMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPurchaseMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductRetailMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductSaleMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ShopMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/StoreCenterMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/SupplierMapper.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/address/AddressService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/customer/CustomerService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/logistics/LogisticsCompanyService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/member/MemberService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/paytype/PayTypeService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateCompService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBrandService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBundleService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryPropertyService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyItemService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyRelationService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPurchaseService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductRetailService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductSaleService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/shop/ShopService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/storecenter/StoreCenterService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/supplier/SupplierService.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/AddressSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/CreateAddressVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/QueryAddressVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/UpdateAddressVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/CreateCustomerVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/UpdateCustomerVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/CreateLogisticsCompanyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanySelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/UpdateLogisticsCompanyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/CreateMemberVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/UpdateMemberVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/CreatePayTypeVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/PayTypeSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/QueryPayTypeVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/UpdatePayTypeVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/CreatePrintTemplateVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/QueryPrintTemplateVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateDemoDataVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateSettingVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/CreateProductBrandVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/UpdateProductBrandVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/CreateProductCategoryVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/QueryProductCategorySelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/UpdateProductCategoryVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/CreateProductVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductBundleVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductPropertyRelationVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/UpdateProductVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/saleprop/CreateProductSalePropItemRelationVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/CreateProductPolyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/QueryProductPolyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/UpdateProductPolyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/property/CreateProductPolyPropertyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/saleprop/CreateProductPolySalePropGroupVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/CreateProductPropertyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/QueryProductPropertyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/UpdateProductPropertyVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/CreateProductPropertyItemVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/QueryProductPropertyItemVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/UpdateProductPropertyItemVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/realtion/CreateProductPropertyRelationVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/CreateProductPurchaseVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/UpdateProductPurchaseVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/CreateProductRetailVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/UpdateProductRetailVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/CreateProductSaleVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/UpdateProductSaleVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/CreateProductSalePropGroupVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/UpdateProductSalePropGroupVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/CreateProductSalePropItemVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/UpdateProductSalePropItemVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/CreateShopVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/QueryShopVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/ShopSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/UpdateShopVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/CreateStoreCenterVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/UpdateStoreCenterVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/CreateSupplierVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierSelectorVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierVo.java create mode 100644 xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/UpdateSupplierVo.java create mode 100644 xingyun-basedata/src/main/java/lombok.config create mode 100644 xingyun-basedata/src/main/resources/mappers/address/AddressMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/customer/CustomerMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/logistics/LogisticsCompanyMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/member/MemberMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/paytype/PayTypeMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/print/PrintTemplateMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductBrandMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductCategoryMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductCategoryPropertyMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductPropertyItemMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductPropertyMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductPropertyRelationMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductPurchaseMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductRetailMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/product/ProductSaleMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/shop/ShopMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/storecenter/StoreCenterMapper.xml create mode 100644 xingyun-basedata/src/main/resources/mappers/supplier/SupplierMapper.xml create mode 100644 xingyun-chart/pom.xml create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthBo.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthSumBo.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodayBo.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodaySumBo.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/controller/ChartController.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSameMonthDto.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSumDto.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartTodayDto.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/entity/OrderChart.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/enums/OrderChartBizType.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/impl/OrderChartServiceImpl.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/listeners/mq/OrderDataToChartListener.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/mappers/OrderChartMapper.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/service/OrderChartService.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/CreateOrderChartVo.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/GetOrderChartVo.java create mode 100644 xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/QueryOrderChartVo.java create mode 100644 xingyun-chart/src/main/java/lombok.config create mode 100644 xingyun-chart/src/main/resources/mappers/OrderChartMapper.xml create mode 100644 xingyun-comp/pom.xml create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/MapLocationBo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/OrderTimeLineBo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/dic/CitySelectorBo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/GetOnlineExcelBo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/QueryOnlineExcelBo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/GetFileBoxBo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/QueryFileBoxBo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SecurityDownloadController.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SelectorController.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/components/ComponentController.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/FileBoxController.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/OnlineExcelController.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/FileBox.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/OnlineExcel.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxFileType.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxNodeType.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/SwOpLogType.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/FileBoxServiceImpl.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/OnlineExcelServiceImpl.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/FileBoxMapper.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/OnlineExcelMapper.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/FileBoxService.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/OnlineExcelService.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/BatchSendOnlineExcelVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/CreateOnlineExcelVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/QueryOnlineExcelVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/SendOnlineExcelVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelContentVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/CreateFileBoxDirVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/QueryFileBoxVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UpdateFileBoxVo.java create mode 100644 xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UploadFileBoxVo.java create mode 100644 xingyun-comp/src/main/java/lombok.config create mode 100644 xingyun-comp/src/main/resources/mappers/FileBoxMapper.xml create mode 100644 xingyun-comp/src/main/resources/mappers/OnlineExcelMapper.xml create mode 100644 xingyun-core/pom.xml create mode 100644 xingyun-core/src/main/java/com/lframework/xingyun/core/components/timeline/ReceiveOrderTimeLineBizType.java create mode 100644 xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqConstants.java create mode 100644 xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqStringPool.java create mode 100644 xingyun-core/src/main/java/com/lframework/xingyun/core/utils/SplitNumberUtil.java create mode 100644 xingyun-core/src/main/java/lombok.config create mode 100644 xingyun-sc/pom.xml create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetDeliveryBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBizOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/paytype/OrderPayTypeBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/GetPurchaseOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PrintPurchaseOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderSelectorBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderWithReceiveBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderWithReceiveBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/config/GetPurchaseConfigBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetPaymentDateBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetReceiveSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/PrintReceiveSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetWithReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetSelectorBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetWithReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/GetPurchaseReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/PrintPurchaseReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/QueryPurchaseReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/RetailProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/config/GetRetailConfigBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/GetRetailOutSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/PrintRetailOutSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetWithReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/RetailOutSheetWithReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/GetRetailReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/PrintRetailReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/QueryRetailReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/GetSaleOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/PrintSaleOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderWithOutBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleOrderWithOutBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/config/GetSaleConfigBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/GetSaleOutSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/PrintSaleOutSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetWithReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/SaleOutSheetWithReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/GetSaleReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/PrintSaleReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/QuerySaleReturnBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/QueryStockAdjustSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/GetStockAdjustReasonBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/QueryStockAdjustReasonBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/StockAdjustReasonSelectorBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/QueryProductStockBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/log/QueryProductStockLogBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/config/GetTakeStockConfigBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/GetTakeStockPlanBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanFullBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanSelectorBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/GetPreTakeStockSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockSheetSelectorBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/QueryTakeStockSheetBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetFullBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderDetailReceiveBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferOrderFullBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferProductBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningNotifyBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/QueryProductStockWarningBo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/components/code/GenerateCodeTypePool.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ScSelectorController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/logistics/LogisticsSheetController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseConfigController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseOrderController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseReturnController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/ReceiveSheetController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailConfigController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailOutSheetController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailReturnController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleConfigController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOutSheetController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleReturnController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockLogController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustReasonController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustSheetController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/PreTakeStockSheetController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockConfigController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockPlanController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockSheetController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/transfer/ScTransferOrderController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/warning/ProductStockWarningController.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetBizOrderDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderWithReceiveDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/GetPaymentDateDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetWithReturnDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/returned/PurchaseReturnFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/RetailProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetDetailLotDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetWithReturnDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/returned/RetailReturnFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderWithOutDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetDetailLotDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetWithReturnDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/returned/SaleReturnFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/ProductStockChangeDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustSheetFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/GetTakeStockPlanDetailProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/QueryTakeStockPlanProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/TakeStockPlanFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockSheetFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/QueryPreTakeStockSheetProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferOrderFullDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferProductDto.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheet.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheetDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/OrderPayType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheet.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheetDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStock.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockLog.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarning.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarningNotify.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseConfig.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrder.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundle.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundleForm.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailForm.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderForm.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturn.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturnDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheet.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetailBundle.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailConfig.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheet.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailBundle.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailLot.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturn.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturnDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleConfig.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrder.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetailBundle.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheet.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailBundle.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailLot.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturn.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturnDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrder.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetailReceive.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustReason.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheet.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheetDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockConfig.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlan.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlanDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheet.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheetDetail.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetDetailBizType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/OrderAddressOrderType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PreTakeStockSheetStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ProductStockBizType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOrderStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseReturnStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ReceiveSheetStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOutSheetStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailReturnStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOrderStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOutSheetStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleReturnStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOrderStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SettleStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetBizType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockWarningOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockOpLogType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanType.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockSheetStatus.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/ApprovePassOrderEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseOrderEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseReturnEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailOutSheetEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailReturnEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleOrderEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleReturnEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/AddStockEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/SubStockEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/take/DeleteTakeStockPlanEvent.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportTaskWorker.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportModel.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/paytype/OrderPayTypeServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseConfigServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleFormServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailFormServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderFormServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailBundleServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailConfigServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailBundleServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailLotServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleConfigServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailBundleServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailBundleServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailLotServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockLogServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustReasonServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockConfigServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailReceiveServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningNotifyServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningServiceImpl.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningSysNotifyRule.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/OrderDataListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockChangeToMqListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockWarningForDeleteSysNotifyGroupListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/ProductStockWarningStockChangeListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/TakeStockPlanStockChangeListener.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderPayTypeMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockLogMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningNotifyMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseConfigMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleFormMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailFormMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderFormMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailBundleMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailConfigMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailBundleMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailLotMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleConfigMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailBundleMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailBundleMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailLotMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailReceiveMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustReasonMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockConfigMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetDetailMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetMapper.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/paytype/OrderPayTypeService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseConfigService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleFormService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailFormService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderFormService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailBundleService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailConfigService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailBundleService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailLotService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleConfigService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailBundleService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailBundleService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailLotService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockLogService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustReasonService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockConfigService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailReceiveService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningNotifyService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningService.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/address/CreateOrderAddressVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/CreateLogisticsSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/DeliveryLogisticsSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetBizOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetCalcWeightOrVolumeVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetBizOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/UpdateLogisticsSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/paytype/OrderPayTypeVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApprovePassPurchaseOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApproveRefusePurchaseOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/CreatePurchaseOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseOrderSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderWithReceiveVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/UpdatePurchaseOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/config/UpdatePurchaseConfigVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApprovePassReceiveSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApproveRefuseReceiveSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/CreateReceiveSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetWithReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveSheetSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/UpdateReceiveSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApprovePassPurchaseReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApproveRefusePurchaseReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/CreatePurchaseReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/QueryPurchaseReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ReturnProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/UpdatePurchaseReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/config/UpdateRetailConfigVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApprovePassRetailOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApproveRefuseRetailOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/CreateRetailOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetWithReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutSheetSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/UpdateRetailOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApprovePassRetailReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApproveRefuseRetailReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/CreateRetailReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/QueryRetailReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/RetailReturnProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/UpdateRetailReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApprovePassSaleOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApproveRefuseSaleOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderWithOutVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleOrderSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/UpdateSaleOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/config/UpdateSaleConfigVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApprovePassSaleOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApproveRefuseSaleOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/CreateSaleOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetWithReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutSheetSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/UpdateSaleOutSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApprovePassSaleReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApproveRefuseSaleReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/CreateSaleReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/QuerySaleReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/SaleReturnProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/UpdateSaleReturnVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/AddProductStockVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/QueryProductStockVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/SubProductStockVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApprovePassStockAdjustSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApproveRefuseStockAdjustSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/CreateStockAdjustSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/StockAdjustProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/UpdateStockAdjustSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/CreateStockAdjustReasonVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/QueryStockAdjustReasonVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/StockAdjustReasonSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/UpdateStockAdjustReasonVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithAddStockVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithSubStockVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/QueryProductStockLogVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/AddProductLotStockVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/CreateProductLotVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/QueryProductLotVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/config/UpdateTakeStockConfigVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CancelTakeStockPlanVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CreateTakeStockPlanVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/HandleTakeStockPlanVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/QueryTakeStockPlanVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/TakeStockPlanSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/UpdateTakeStockPlanVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/CreatePreTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockSheetSelectorVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/UpdatePreTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApprovePassTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApproveRefuseTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/CreateTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/TakeStockSheetProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/UpdateTakeStockSheetVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApprovePassScTransferOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApproveRefuseScTransferOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/CreateScTransferOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderDetailReceiveVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ReceiveScTransferOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ScTransferProductVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/UpdateScTransferOrderVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/CreateProductStockWarningVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/QueryProductStockWarningVo.java create mode 100644 xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/UpdateProductStockWarningVo.java create mode 100644 xingyun-sc/src/main/java/lombok.config create mode 100644 xingyun-sc/src/main/resources/mappers/logistics/LogisticsSheetMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderDetailMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/purchase/PurchaseReturnMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetDetailMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailLotMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/retail/RetailReturnMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/sale/SaleOrderDetailMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/sale/SaleOrderMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailLotMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/sale/SaleReturnMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/ProductStockLogMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/ProductStockMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/ProductStockWarningMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustReasonMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/take/PreTaskStockSheetMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/take/TakeStockConfigMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanDetailMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/take/TakeStockSheetMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderDetailMapper.xml create mode 100644 xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderMapper.xml create mode 100644 xingyun-sc/src/main/resources/print/purchase-order.ftl create mode 100644 xingyun-sc/src/main/resources/print/purchase-return.ftl create mode 100644 xingyun-sc/src/main/resources/print/receive-sheet.ftl create mode 100644 xingyun-sc/src/main/resources/print/retail-out-sheet.ftl create mode 100644 xingyun-sc/src/main/resources/print/retail-return.ftl create mode 100644 xingyun-sc/src/main/resources/print/sale-order.ftl create mode 100644 xingyun-sc/src/main/resources/print/sale-out-sheet.ftl create mode 100644 xingyun-sc/src/main/resources/print/sale-return.ftl create mode 100644 xingyun-server/pom.xml create mode 100644 xingyun-server/src/main/java/com/lframework/xingyun/server/XingYunApplication.java create mode 100644 xingyun-server/src/main/java/lombok.config create mode 100644 xingyun-server/src/main/resources/application-dev.yml create mode 100644 xingyun-server/src/main/resources/application-prod.yml create mode 100644 xingyun-server/src/main/resources/application-test.yml create mode 100644 xingyun-server/src/main/resources/application.yml create mode 100644 xingyun-server/src/main/resources/magic-editor-config.js create mode 100644 xingyun-settle/pom.xml create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/GetSettleCheckSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/QuerySettleCheckSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/SettleCheckBizItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/CustomerSettleCheckBizItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/GetCustomerSettleCheckSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/QueryCustomerSettleCheckSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/GetSettleFeeSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/QuerySettleFeeSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/GetCustomerSettleFeeSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/QueryCustomerSettleFeeSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/GetSettleInItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/QuerySettleInItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/SettleInItemSelectorBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/GetSettleOutItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/QuerySettleOutItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/SettleOutItemSelectorBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/GetSettlePreSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/QuerySettlePreSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/GetCustomerSettlePreSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/QueryCustomerSettlePreSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/GetSettleSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/QuerySettleSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/SettleBizItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/CustomerSettleBizItemBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/GetCustomerSettleSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/QueryCustomerSettleSheetBo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/components/code/GenerateCodeTypePool.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleCheckSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleFeeSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettlePreSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleCheckSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleFeeSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleInItemController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleOutItemController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettlePreSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSelectorController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSheetController.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckBizItemDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckBizItemDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/SettleFeeSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/customer/CustomerSettleFeeSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/SettlePreSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/customer/CustomerSettlePreSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleBizItemDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleBizItemDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleSheetFullDto.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleInItem.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleOutItem.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheet.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheetDetail.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetBizType.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetCalcType.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetType.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettlePreSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetBizType.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetCalcType.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetType.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleOpLogType.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettlePreSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleSheetStatus.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportModel.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportTaskWorker.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleInItemServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleOutItemServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetDetailServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetServiceImpl.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleInItemMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleOutItemMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetDetailMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetMapper.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleInItemService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleOutItemService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetDetailService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetService.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApprovePassSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApproveRefuseSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/CreateSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QuerySettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QueryUnCheckBizItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/SettleCheckSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/UpdateSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApprovePassCustomerSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApproveRefuseCustomerSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CreateCustomerSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CustomerSettleCheckSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerUnCheckBizItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/UpdateCustomerSettleCheckSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApprovePassSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApproveRefuseSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/CreateSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/QuerySettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/SettleFeeSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/UpdateSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApprovePassCustomerSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApproveRefuseCustomerSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CreateCustomerSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CustomerSettleFeeSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/QueryCustomerSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/UpdateCustomerSettleFeeSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/CreateSettleInItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/QuerySettleInItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/SettleInItemSelectorVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/UpdateSettleInItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/CreateSettleOutItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/QuerySettleOutItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/SettleOutItemSelectorVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/UpdateSettleOutItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApprovePassSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApproveRefuseSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/CreateSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/QuerySettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/SettlePreSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/UpdateSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApprovePassCustomerSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApproveRefuseCustomerSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CreateCustomerSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CustomerSettlePreSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/QueryCustomerSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/UpdateCustomerSettlePreSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApprovePassSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApproveRefuseSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/CreateSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QuerySettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QueryUnSettleBizItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/SettleSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/UpdateSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApprovePassCustomerSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApproveRefuseCustomerSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CreateCustomerSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CustomerSettleSheetItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerUnSettleBizItemVo.java create mode 100644 xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/UpdateCustomerSettleSheetVo.java create mode 100644 xingyun-settle/src/main/java/lombok.config create mode 100644 xingyun-settle/src/main/resources/mappers/CustomerSettleCheckSheetMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/CustomerSettleFeeSheetMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/CustomerSettlePreSheetMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/CustomerSettleSheetMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/SettleCheckSheetMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/SettleFeeSheetMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/SettleInItemMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/SettleOutItemMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/SettlePreSheetMapper.xml create mode 100644 xingyun-settle/src/main/resources/mappers/SettleSheetMapper.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..480bdf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ +.kotlin + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5740291 --- /dev/null +++ b/pom.xml @@ -0,0 +1,159 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.2.12 + + + + com.lframework + xingyun + 1.0.0 + pom + + xingyun-core + xingyun-server + xingyun-basedata + xingyun-sc + xingyun-chart + xingyun-settle + xingyun-comp + + + + 17 + ${java.version} + ${java.version} + 3.11.0 + 1.18.32 + 1.0.0 + 1.0.0 + + + + + + com.lframework + framework + ${framework.version} + pom + import + + + com.lframework + mq-starter + ${framework.version} + pom + import + + + com.lframework + xingyun-basedata + ${xingyun.version} + + + + com.lframework + xingyun-comp + ${xingyun.version} + + + com.lframework + xingyun-sc + ${xingyun.version} + + + + com.lframework + xingyun-chart + ${xingyun.version} + + + + com.lframework + xingyun-settle + ${xingyun.version} + + + + com.lframework + xingyun-core + ${xingyun.version} + + + + com.baomidou + mybatis-plus + 3.5.7 + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.3.0 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + UTF-8 + + + org.projectlombok + lombok + ${lombok.version} + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + dev + + true + + + dev + 127.0.0.1:10000 + + + + test + + test + 127.0.0.1:10000 + + + + prod + + prod + 127.0.0.1:10000 + + + + + \ No newline at end of file diff --git a/xingyun-basedata/pom.xml b/xingyun-basedata/pom.xml new file mode 100644 index 0000000..5dac090 --- /dev/null +++ b/xingyun-basedata/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + com.lframework + xingyun + 1.0.0 + + + xingyun-basedata + + + + com.lframework + xingyun-core + + + io.swagger.core.v3 + swagger-annotations-jakarta + 2.2.36 + compile + + + + \ No newline at end of file diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteCustomerListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteCustomerListener.java new file mode 100644 index 0000000..9bd9460 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteCustomerListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.events.DeleteCustomerEvent; +import com.lframework.xingyun.basedata.service.address.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class AddressForDeleteCustomerListener implements + ApplicationListener { + + @Autowired + private AddressService addressService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteCustomerEvent event) { + + Wrapper
deleteWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, event.getEntity().getId()) + .eq(Address::getEntityType, AddressEntityType.CUSTOMER); + addressService.remove(deleteWrapper); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteMemberListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteMemberListener.java new file mode 100644 index 0000000..df27db8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteMemberListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.events.DeleteMemberEvent; +import com.lframework.xingyun.basedata.service.address.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class AddressForDeleteMemberListener implements + ApplicationListener { + + @Autowired + private AddressService addressService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteMemberEvent event) { + + Wrapper
deleteWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, event.getEntity().getId()) + .eq(Address::getEntityType, AddressEntityType.MEMBER); + addressService.remove(deleteWrapper); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteShopListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteShopListener.java new file mode 100644 index 0000000..d548bbb --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteShopListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.events.DeleteShopEvent; +import com.lframework.xingyun.basedata.service.address.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class AddressForDeleteShopListener implements + ApplicationListener { + + @Autowired + private AddressService addressService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteShopEvent event) { + + Wrapper
deleteWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, event.getEntity().getId()) + .eq(Address::getEntityType, AddressEntityType.SHOP); + addressService.remove(deleteWrapper); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteStoreCenterListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteStoreCenterListener.java new file mode 100644 index 0000000..91baf99 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteStoreCenterListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.events.DeleteStoreCenterEvent; +import com.lframework.xingyun.basedata.service.address.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class AddressForDeleteStoreCenterListener implements + ApplicationListener { + + @Autowired + private AddressService addressService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteStoreCenterEvent event) { + + Wrapper
deleteWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, event.getEntity().getId()) + .eq(Address::getEntityType, AddressEntityType.SC); + addressService.remove(deleteWrapper); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteSupplierListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteSupplierListener.java new file mode 100644 index 0000000..08fd45d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/AddressForDeleteSupplierListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.events.DeleteSupplierEvent; +import com.lframework.xingyun.basedata.service.address.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class AddressForDeleteSupplierListener implements + ApplicationListener { + + @Autowired + private AddressService addressService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteSupplierEvent event) { + + Wrapper
deleteWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, event.getEntity().getId()) + .eq(Address::getEntityType, AddressEntityType.SUPPLIER); + addressService.remove(deleteWrapper); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductCategoryPropertyForDeleteProductPropertyListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductCategoryPropertyForDeleteProductPropertyListener.java new file mode 100644 index 0000000..238e692 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductCategoryPropertyForDeleteProductPropertyListener.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.events.DeleteProductPropertyEvent; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class ProductCategoryPropertyForDeleteProductPropertyListener implements + ApplicationListener { + + @Autowired + private ProductCategoryPropertyService productCategoryPropertyService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteProductPropertyEvent event) { + + Wrapper queryWrapper = Wrappers.lambdaQuery( + ProductCategoryProperty.class) + .eq(ProductCategoryProperty::getPropertyId, event.getEntity().getId()); + if (productCategoryPropertyService.count(queryWrapper) > 0) { + productCategoryPropertyService.remove(queryWrapper); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductBrandListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductBrandListener.java new file mode 100644 index 0000000..477f86b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductBrandListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.events.DeleteProductBrandEvent; +import com.lframework.xingyun.basedata.service.product.ProductService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class ProductForDeleteProductBrandListener implements + ApplicationListener { + + @Autowired + private ProductService productService; + + @Override + public void onApplicationEvent(DeleteProductBrandEvent event) { + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getBrandId, event.getEntity().getId()) + .eq(Product::getAvailable, Boolean.TRUE); + if (productService.count(queryWrapper) > 0) { + throw new DefaultClientException( + "商品品牌:" + event.getEntity().getName() + "下存在商品信息,无法删除!"); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductCategoryListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductCategoryListener.java new file mode 100644 index 0000000..f6328e3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductForDeleteProductCategoryListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.events.DeleteProductCategoryEvent; +import com.lframework.xingyun.basedata.service.product.ProductService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class ProductForDeleteProductCategoryListener implements + ApplicationListener { + + @Autowired + private ProductService productService; + + @Override + public void onApplicationEvent(DeleteProductCategoryEvent event) { + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCategoryId, event.getEntity().getId()) + .eq(Product::getAvailable, Boolean.TRUE); + if (productService.count(queryWrapper) > 0) { + throw new DefaultClientException( + "商品分类:" + event.getEntity().getName() + "下存在商品信息,无法删除!"); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyItemForDeleteProductPropertyListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyItemForDeleteProductPropertyListener.java new file mode 100644 index 0000000..2efa5fe --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyItemForDeleteProductPropertyListener.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.app; + +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.events.DeleteProductPropertyEvent; +import com.lframework.xingyun.basedata.service.product.ProductPropertyItemService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Component +public class ProductPropertyItemForDeleteProductPropertyListener implements + ApplicationListener { + + @Autowired + private ProductPropertyItemService productPropertyItemService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteProductPropertyEvent event) { + + List productPropertyItemList = productPropertyItemService.getByPropertyId( + event.getEntity().getId()); + for (ProductPropertyItem propertyItem : productPropertyItemList) { + productPropertyItemService.deleteById(propertyItem.getId()); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyItemListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyItemListener.java new file mode 100644 index 0000000..aea9e03 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyItemListener.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.events.DeleteProductPropertyItemEvent; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class ProductPropertyRelationForDeleteProductPropertyItemListener implements + ApplicationListener { + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteProductPropertyItemEvent event) { + + Wrapper queryWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class) + .eq(ProductPropertyRelation::getPropertyId, event.getEntity().getPropertyId()) + .eq(ProductPropertyRelation::getPropertyItemId, event.getEntity().getId()); + if (productPropertyRelationService.count(queryWrapper) > 0) { + productPropertyRelationService.remove(queryWrapper); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyListener.java new file mode 100644 index 0000000..e12fc09 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ProductPropertyRelationForDeleteProductPropertyListener.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.events.DeleteProductPropertyEvent; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +public class ProductPropertyRelationForDeleteProductPropertyListener implements + ApplicationListener { + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteProductPropertyEvent event) { + + Wrapper queryWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class) + .eq(ProductPropertyRelation::getPropertyId, event.getEntity().getId()); + if (productPropertyRelationService.count(queryWrapper) > 0) { + productPropertyRelationService.remove(queryWrapper); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ShopForDeleteSysDeptListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ShopForDeleteSysDeptListener.java new file mode 100644 index 0000000..640762e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/app/ShopForDeleteSysDeptListener.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.basedata.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.web.inner.events.system.DeleteSysDeptEvent; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class ShopForDeleteSysDeptListener implements + ApplicationListener { + + @Autowired + private ShopService shopService; + + @Override + public void onApplicationEvent(DeleteSysDeptEvent event) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getDeptId, event.getEntity().getId()).eq(Shop::getAvailable, true); + if (shopService.count(queryWrapper) > 0) { + throw new DefaultClientException("部门:" + event.getEntity().getName() + "下存在门店,不允许删除!"); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/AddressSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/AddressSelectorBo.java new file mode 100644 index 0000000..7575872 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/AddressSelectorBo.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.basedata.bo.address; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Address; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class AddressSelectorBo extends BaseBo
{ + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 地址类型 + */ + @Schema(description = "地址类型") + @EnumConvert + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String telephone; + + /** + * 省ID + */ + @Schema(description = "省ID") + private String provinceId; + + /** + * 省名称 + */ + @Schema(description = "省名称") + private String provinceName; + + /** + * 市ID + */ + @Schema(description = "市ID") + private String cityId; + + /** + * 市名称 + */ + @Schema(description = "市名称") + private String cityName; + + /** + * 区ID + */ + @Schema(description = "区ID") + private String districtId; + + /** + * 区名称 + */ + @Schema(description = "区名称") + private String districtName; + + /** + * 地区全称 + */ + @Schema(description = "地区全称") + private String areaFullName; + + /** + * 详细地址 + */ + @Schema(description = "详细地址") + private String address; + + /** + * 是否默认地址 + */ + @Schema(description = "是否默认地址") + private Boolean isDefault; + + public AddressSelectorBo() { + + } + + public AddressSelectorBo(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + this.areaFullName = + this.provinceName + StringPool.CITY_SPLIT + this.cityName + StringPool.CITY_SPLIT + + this.districtName; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/GetAddressBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/GetAddressBo.java new file mode 100644 index 0000000..90a6481 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/GetAddressBo.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.basedata.bo.address; + +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.*; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetAddressBo extends BaseBo
{ + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 实体ID + */ + @Schema(description = "实体ID") + private String entityId; + + /** + * 实体名称 + */ + @Schema(description = "实体名称") + private String entityName; + + /** + * 实体类型 + */ + @Schema(description = "实体类型") + @EnumConvert + private Integer entityType; + + /** + * 地址类型 + */ + @Schema(description = "地址类型") + @EnumConvert + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String telephone; + + /** + * 省ID + */ + @Schema(description = "省ID") + private String provinceId; + + /** + * 省名称 + */ + @Schema(description = "省名称") + private String provinceName; + + /** + * 市ID + */ + @Schema(description = "市ID") + private String cityId; + + /** + * 市名称 + */ + @Schema(description = "市名称") + private String cityName; + + /** + * 区ID + */ + @Schema(description = "区ID") + private String districtId; + + /** + * 区名称 + */ + @Schema(description = "区名称") + private String districtName; + + /** + * 详细地址 + */ + @Schema(description = "详细地址") + private String address; + + /** + * 是否默认地址 + */ + @Schema(description = "是否默认地址") + private Boolean isDefault; + + public GetAddressBo() { + + } + + public GetAddressBo(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + if (dto.getEntityType() == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getEntityId()); + this.entityName = sc.getName(); + } else if (dto.getEntityType() == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getEntityId()); + this.entityName = customer.getName(); + } else if (dto.getEntityType() == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getEntityId()); + this.entityName = supplier.getName(); + } else if (dto.getEntityType() == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getEntityId()); + this.entityName = member.getName(); + } else if (dto.getEntityType() == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getEntityId()); + this.entityName = shop.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/QueryAddressBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/QueryAddressBo.java new file mode 100644 index 0000000..c67b29e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/QueryAddressBo.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.basedata.bo.address; + +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.*; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryAddressBo extends BaseBo
{ + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 实体ID + */ + @Schema(description = "实体ID") + private String entityId; + + /** + * 实体名称 + */ + @Schema(description = "实体名称") + private String entityName; + + /** + * 实体类型 + */ + @Schema(description = "实体类型") + @EnumConvert + private Integer entityType; + + /** + * 地址类型 + */ + @Schema(description = "地址类型") + @EnumConvert + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String telephone; + + /** + * 省ID + */ + @Schema(description = "省ID") + private String provinceId; + + /** + * 省名称 + */ + @Schema(description = "省名称") + private String provinceName; + + /** + * 市ID + */ + @Schema(description = "市ID") + private String cityId; + + /** + * 市名称 + */ + @Schema(description = "市名称") + private String cityName; + + /** + * 区ID + */ + @Schema(description = "区ID") + private String districtId; + + /** + * 区名称 + */ + @Schema(description = "区名称") + private String districtName; + + /** + * 详细地址 + */ + @Schema(description = "详细地址") + private String address; + + /** + * 是否默认地址 + */ + @Schema(description = "是否默认地址") + private Boolean isDefault; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + public QueryAddressBo() { + + } + + public QueryAddressBo(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + if (dto.getEntityType() == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getEntityId()); + this.entityName = sc.getName(); + } else if (dto.getEntityType() == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getEntityId()); + this.entityName = customer.getName(); + } else if (dto.getEntityType() == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getEntityId()); + this.entityName = supplier.getName(); + } else if (dto.getEntityType() == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getEntityId()); + this.entityName = member.getName(); + } else if (dto.getEntityType() == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getEntityId()); + this.entityName = shop.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/CustomerSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/CustomerSelectorBo.java new file mode 100644 index 0000000..32ffb5a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/CustomerSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.bo.customer; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Customer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class CustomerSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public CustomerSelectorBo() { + + } + + public CustomerSelectorBo(Customer dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/GetCustomerBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/GetCustomerBo.java new file mode 100644 index 0000000..26a1371 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/GetCustomerBo.java @@ -0,0 +1,164 @@ +package com.lframework.xingyun.basedata.bo.customer; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Customer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetCustomerBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 简码 + */ + @Schema(description = "简码") + private String mnemonicCode; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + private String email; + + /** + * 邮编 + */ + @Schema(description = "邮编") + private String zipCode; + + /** + * 传真 + */ + @Schema(description = "传真") + private String fax; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private List city; + + /** + * 地区名称 + */ + @Schema(description = "地区名称") + private String cityName; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 结算方式 + */ + @Schema(description = "结算方式") + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @Schema(description = "统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @Schema(description = "纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @Schema(description = "开户银行") + private String bankName; + + /** + * 户名 + */ + @Schema(description = "户名") + private String accountName; + + /** + * 银行账号 + */ + @Schema(description = "银行账号") + private String accountNo; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetCustomerBo() { + + } + + public GetCustomerBo(Customer dto) { + + super(dto); + } + + @Override + public BaseBo convert(Customer dto) { + + return super.convert(dto, GetCustomerBo::getSettleType); + } + + @Override + protected void afterInit(Customer dto) { + + if (dto.getSettleType() != null) { + this.settleType = dto.getSettleType().getCode(); + } + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/QueryCustomerBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/QueryCustomerBo.java new file mode 100644 index 0000000..7ed6a10 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/QueryCustomerBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.bo.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Customer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryCustomerBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryCustomerBo() { + + } + + public QueryCustomerBo(Customer dto) { + + super(dto); + } + + @Override + protected void afterInit(Customer dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/GetLogisticsCompanyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/GetLogisticsCompanyBo.java new file mode 100644 index 0000000..10db128 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/GetLogisticsCompanyBo.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.basedata.bo.logistics.company; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetLogisticsCompanyBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private List city; + + /** + * 地区名称 + */ + @Schema(description = "地区名称") + private String cityName; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetLogisticsCompanyBo() { + + } + + public GetLogisticsCompanyBo(LogisticsCompany dto) { + + super(dto); + } + + @Override + protected void afterInit(LogisticsCompany dto) { + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/LogisticsCompanySelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/LogisticsCompanySelectorBo.java new file mode 100644 index 0000000..6823979 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/LogisticsCompanySelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.bo.logistics.company; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class LogisticsCompanySelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public LogisticsCompanySelectorBo() { + + } + + public LogisticsCompanySelectorBo(LogisticsCompany dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/QueryLogisticsCompanyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/QueryLogisticsCompanyBo.java new file mode 100644 index 0000000..bce4ca2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/QueryLogisticsCompanyBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.bo.logistics.company; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryLogisticsCompanyBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryLogisticsCompanyBo() { + + } + + public QueryLogisticsCompanyBo(LogisticsCompany dto) { + + super(dto); + } + + @Override + protected void afterInit(LogisticsCompany dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/GetMemberBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/GetMemberBo.java new file mode 100644 index 0000000..f106360 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/GetMemberBo.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.basedata.bo.member; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDate; + +@Data +public class GetMemberBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 性别 + */ + @Schema(description = "性别") + private Integer gender; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + private String email; + + /** + * 出生日期 + */ + @Schema(description = "出生日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate birthday; + + /** + * 入会日期 + */ + @Schema(description = "入会日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate joinDay; + + /** + * 所属门店ID + */ + @Schema(description = "所属门店ID") + private String shopId; + + /** + * 所属门店名称 + */ + @Schema(description = "所属门店名称") + private String shopName; + + /** + * 所属导购ID + */ + @Schema(description = "所属导购ID") + private String guiderId; + + /** + * 所属导购名称 + */ + @Schema(description = "所属导购名称") + private String guiderName; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetMemberBo() { + + } + + public GetMemberBo(Member dto) { + + super(dto); + } + + @Override + public BaseBo convert(Member dto) { + + return super.convert(dto, GetMemberBo::getGender); + } + + @Override + protected void afterInit(Member dto) { + + this.gender = dto.getGender().getCode(); + + if (!StringUtil.isBlank(dto.getShopId())) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getShopId()); + this.shopName = shop.getName(); + } + + if (!StringUtil.isBlank(dto.getGuiderId())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser guider = userService.findById(dto.getGuiderId()); + this.guiderName = guider.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/MemberSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/MemberSelectorBo.java new file mode 100644 index 0000000..8baf5b3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/MemberSelectorBo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.bo.member; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Member; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class MemberSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public MemberSelectorBo(Member dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/QueryMemberBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/QueryMemberBo.java new file mode 100644 index 0000000..b4e9384 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/QueryMemberBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.bo.member; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Member; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryMemberBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryMemberBo() { + + } + + public QueryMemberBo(Member dto) { + + super(dto); + } + + @Override + protected void afterInit(Member dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/GetPayTypeBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/GetPayTypeBo.java new file mode 100644 index 0000000..3e31721 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/GetPayTypeBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.bo.paytype; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PayType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetPayTypeBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 是否记录内容 + */ + @Schema(description = "是否记录内容") + private Boolean recText; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetPayTypeBo() { + + } + + public GetPayTypeBo(PayType dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/PayTypeSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/PayTypeSelectorBo.java new file mode 100644 index 0000000..5a75148 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/PayTypeSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.paytype; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PayType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class PayTypeSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 是否记录内容 + */ + @Schema(description = "是否记录内容") + private Boolean recText; + + public PayTypeSelectorBo() { + + } + + public PayTypeSelectorBo(PayType dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/QueryPayTypeBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/QueryPayTypeBo.java new file mode 100644 index 0000000..20367ef --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/QueryPayTypeBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.bo.paytype; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PayType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryPayTypeBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryPayTypeBo() { + + } + + public QueryPayTypeBo(PayType dto) { + + super(dto); + } + + @Override + protected void afterInit(PayType dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateBo.java new file mode 100644 index 0000000..5ef3e63 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateBo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.bo.print; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PrintTemplate; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetPrintTemplateBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private Integer id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public GetPrintTemplateBo() { + + } + + public GetPrintTemplateBo(PrintTemplate dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateCompSettingBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateCompSettingBo.java new file mode 100644 index 0000000..68d2655 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateCompSettingBo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.bo.print; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.basedata.entity.PrintTemplateComp; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Map; + +@Data +public class GetPrintTemplateCompSettingBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 组件配置 + */ + @Schema(description = "组件配置") + private Map compJson; + + public GetPrintTemplateCompSettingBo() { + + } + + public GetPrintTemplateCompSettingBo(PrintTemplateComp dto) { + + super(dto); + } + + @Override + public BaseBo convert(PrintTemplateComp dto) { + return super.convert(dto, GetPrintTemplateCompSettingBo::getCompJson); + } + + @Override + protected void afterInit(PrintTemplateComp dto) { + this.compJson = JsonUtil.parseMap(dto.getCompJson(), String.class, Object.class); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateSettingBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateSettingBo.java new file mode 100644 index 0000000..0f3879d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/GetPrintTemplateSettingBo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.basedata.bo.print; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.basedata.entity.PrintTemplate; +import com.lframework.xingyun.basedata.service.print.PrintTemplateCompService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Data +public class GetPrintTemplateSettingBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private Integer id; + + /** + * JSON配置 + */ + @Schema(description = "JSON配置") + private Map templateJson; + + /** + * 示例数据 + */ + @Schema(description = "示例数据") + private Map demoData; + + /** + * 附加组件配置 + */ + @Schema(description = "附加组件配置") + private List> compJsonList; + + public GetPrintTemplateSettingBo() { + + } + + public GetPrintTemplateSettingBo(PrintTemplate dto) { + + super(dto); + } + + @Override + public BaseBo convert(PrintTemplate dto) { + return super.convert(dto, GetPrintTemplateSettingBo::getTemplateJson, + GetPrintTemplateSettingBo::getDemoData); + } + + @Override + protected void afterInit(PrintTemplate dto) { + this.templateJson = JsonUtil.parseMap(dto.getTemplateJson(), String.class, Object.class); + + if (!StringUtil.isBlank(dto.getDemoData())) { + this.demoData = JsonUtil.parseMap(dto.getDemoData(), String.class, Object.class); + } + + PrintTemplateCompService printTemplateCompService = ApplicationUtil.getBean( + PrintTemplateCompService.class); + List compJsonList = printTemplateCompService.getCompJsonByTemplateId(dto.getId()); + this.compJsonList = compJsonList.stream() + .map(t -> JsonUtil.parseMap(t, String.class, Object.class)).collect(Collectors.toList()); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/QueryPrintTemplateBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/QueryPrintTemplateBo.java new file mode 100644 index 0000000..1d35475 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/print/QueryPrintTemplateBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.basedata.bo.print; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PrintTemplate; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryPrintTemplateBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private Integer id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryPrintTemplateBo() { + + } + + public QueryPrintTemplateBo(PrintTemplate dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/GetProductBrandBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/GetProductBrandBo.java new file mode 100644 index 0000000..8e99936 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/GetProductBrandBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetProductBrandBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * logo + */ + @Schema(description = "logo") + private String logo; + + /** + * 简介 + */ + @Schema(description = "简介") + private String introduction; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetProductBrandBo() { + + } + + public GetProductBrandBo(ProductBrand dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductBrandSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductBrandSelectorBo.java new file mode 100644 index 0000000..dbf8162 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductBrandSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class ProductBrandSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public ProductBrandSelectorBo() { + + } + + public ProductBrandSelectorBo(ProductBrand dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductCategorySelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductCategorySelectorBo.java new file mode 100644 index 0000000..b9483e9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductCategorySelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class ProductCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 父级ID + */ + @Schema(description = "父级ID") + private String parentId; + + public ProductCategorySelectorBo() { + + } + + public ProductCategorySelectorBo(ProductCategory dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/QueryProductBrandBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/QueryProductBrandBo.java new file mode 100644 index 0000000..bd74007 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/QueryProductBrandBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class QueryProductBrandBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public QueryProductBrandBo() { + + } + + public QueryProductBrandBo(ProductBrand dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/GetProductCategoryBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/GetProductCategoryBo.java new file mode 100644 index 0000000..bca3095 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/GetProductCategoryBo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.basedata.bo.product.category; + +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetProductCategoryBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 父级ID + */ + @Schema(description = "父级ID") + private String parentId; + + /** + * 父级名称 + */ + @Schema(description = "父级名称") + private String parentName; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetProductCategoryBo() { + + } + + public GetProductCategoryBo(ProductCategory dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductCategory dto) { + + if (!StringUtil.isBlank(this.getParentId())) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory parentCategory = productCategoryService.findById(this.getParentId()); + if (!ObjectUtil.isNull(parentCategory)) { + this.setParentName(parentCategory.getName()); + } + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/ProductCategoryTreeBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/ProductCategoryTreeBo.java new file mode 100644 index 0000000..02ce499 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/ProductCategoryTreeBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.bo.product.category; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class ProductCategoryTreeBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 父级ID + */ + @Schema(description = "父级ID") + private String parentId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public ProductCategoryTreeBo() { + + } + + public ProductCategoryTreeBo(ProductCategory dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java new file mode 100644 index 0000000..c384022 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java @@ -0,0 +1,292 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.*; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 重量(kg) + */ + @Schema(description = "重量(kg)") + private BigDecimal weight; + + /** + * 体积(cm3) + */ + @Schema(description = "体积(cm3)") + private BigDecimal volume; + + /** + * 进项税率(%) + */ + @Schema(description = "进项税率(%)") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @Schema(description = "销项税率(%)") + private BigDecimal saleTaxRate; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 商品类型 + */ + @Schema(description = "商品类型") + @EnumConvert + private Integer productType; + + /** + * 单品 + */ + @Schema(description = "单品") + private List productBundles; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @Schema(description = "销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @Schema(description = "零售价") + private BigDecimal retailPrice; + + /** + * 属性 + */ + @Schema(description = "属性") + private List properties; + + public GetProductBo() { + + } + + public GetProductBo(Product dto) { + + super(dto); + } + + @Override + public BaseBo convert(Product dto) { + + return super.convert(dto, GetProductBo::getProperties); + } + + @Override + protected void afterInit(Product dto) { + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(dto.getCategoryId()); + this.categoryName = productCategory.getName(); + + if (StringUtil.isNotBlank(dto.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(dto.getBrandId()); + this.brandName = productBrand.getName(); + } + + if (dto.getProductType() == ProductType.BUNDLE) { + ProductBundleService productBundleService = ApplicationUtil.getBean( + ProductBundleService.class); + List bundles = productBundleService.getByMainProductId(dto.getId()); + this.productBundles = bundles.stream().map(ProductBundleBo::new).collect(Collectors.toList()); + } + + ProductPurchaseService productPurchaseService = ApplicationUtil.getBean( + ProductPurchaseService.class); + ProductPurchase productPurchase = productPurchaseService.getById(dto.getId()); + this.purchasePrice = productPurchase.getPrice(); + + ProductSaleService productSaleService = ApplicationUtil.getBean(ProductSaleService.class); + ProductSale productSale = productSaleService.getById(dto.getId()); + this.salePrice = productSale.getPrice(); + + ProductRetailService productRetailService = ApplicationUtil.getBean( + ProductRetailService.class); + ProductRetail productRetail = productRetailService.getById(dto.getId()); + this.retailPrice = productRetail.getPrice(); + + ProductPropertyRelationService productPropertyRelationService = ApplicationUtil.getBean( + ProductPropertyRelationService.class); + List propertyRelationDtos = productPropertyRelationService.getByProductId( + dto.getId()); + if (!CollectionUtil.isEmpty(propertyRelationDtos)) { + this.properties = new ArrayList<>(); + for (ProductPropertyRelationDto property : propertyRelationDtos) { + if (property.getPropertyColumnType() == ColumnType.MULTIPLE) { + PropertyBo propertyBo = this.properties.stream() + .filter(t -> t.getId().equals(property.getPropertyId())).findFirst().orElse(null); + if (propertyBo == null) { + this.properties.add(new PropertyBo(property)); + } else { + propertyBo.setText(propertyBo.getText().concat(StringPool.STR_SPLIT) + .concat(property.getPropertyItemId())); + propertyBo.setTextStr(propertyBo.getTextStr().concat(StringPool.STR_SPLIT_CN) + .concat(property.getPropertyText())); + } + } else { + this.properties.add(new PropertyBo(property)); + } + } + } + } + + @Data + public static class PropertyBo extends BaseBo { + + /** + * 属性ID + */ + @Schema(description = "属性ID") + private String id; + + /** + * 属性名 + */ + @Schema(description = "属性名") + private String name; + + /** + * 字段类型 + */ + @Schema(description = "字段类型") + private Integer columnType; + + /** + * 属性值 + */ + @Schema(description = "属性值") + private String text; + + /** + * 属性文本 + */ + @Schema(description = "属性文本") + private String textStr; + + public PropertyBo() { + + } + + public PropertyBo(ProductPropertyRelationDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductPropertyRelationDto dto) { + + return super.convert(dto, PropertyBo::getColumnType); + } + + @Override + protected void afterInit(ProductPropertyRelationDto dto) { + + this.id = dto.getPropertyId(); + this.name = dto.getPropertyName(); + this.text = dto.getPropertyColumnType() == ColumnType.CUSTOM ? dto.getPropertyText() + : dto.getPropertyItemId(); + this.textStr = dto.getPropertyText(); + this.columnType = dto.getPropertyColumnType().getCode(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductBundleBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductBundleBo.java new file mode 100644 index 0000000..6905cc5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductBundleBo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ProductBundleBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单品ID + */ + @Schema(description = "单品ID") + private String productId; + + /** + * 包含数量 + */ + @Schema(description = "包含数量") + private Integer bundleNum; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @Schema(description = "销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @Schema(description = "零售价") + private BigDecimal retailPrice; + + public ProductBundleBo() { + } + + public ProductBundleBo(ProductBundle dto) { + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductSelectorBo.java new file mode 100644 index 0000000..47ff7ee --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductSelectorBo.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class ProductSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 商品类型 + */ + @Schema(description = "商品类型") + @EnumConvert + private Integer productType; + + public ProductSelectorBo() { + + } + + public ProductSelectorBo(Product dto) { + + super(dto); + } + + @Override + protected void afterInit(Product dto) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(dto.getCategoryId()); + this.categoryName = productCategory.getName(); + + if (StringUtil.isNotBlank(dto.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand brand = productBrandService.findById(dto.getBrandId()); + this.brandName = brand.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java new file mode 100644 index 0000000..b09d854 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 名称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 商品类型 + */ + @Schema(description = "商品类型") + @EnumConvert + private Integer productType; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryProductBo() { + + } + + public QueryProductBo(Product dto) { + + super(dto); + } + + @Override + protected void afterInit(Product dto) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(dto.getCategoryId()); + this.categoryName = productCategory.getName(); + + if (StringUtil.isNotBlank(dto.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand brand = productBrandService.findById(dto.getBrandId()); + this.brandName = brand.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/GetProductPropertyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/GetProductPropertyBo.java new file mode 100644 index 0000000..8ff0be0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/GetProductPropertyBo.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.basedata.bo.product.property; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.enums.PropertyType; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetProductPropertyBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 是否必填 + */ + @Schema(description = "是否必填") + private Boolean isRequired; + + /** + * 录入类型 + */ + @Schema(description = "录入类型") + private Integer columnType; + + /** + * 数据类型 + */ + @Schema(description = "数据类型") + private Integer columnDataType; + + /** + * 属性类别 + */ + @Schema(description = "属性类别") + private Integer propertyType; + + /** + * 分类 + */ + @Schema(description = "分类") + private List categories; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetProductPropertyBo() { + + } + + public GetProductPropertyBo(ProductProperty dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductProperty dto) { + + this.columnType = dto.getColumnType().getCode(); + this.propertyType = dto.getPropertyType().getCode(); + if (dto.getColumnDataType() != null) { + this.columnDataType = dto.getColumnDataType().getCode(); + } + + if (dto.getPropertyType() == PropertyType.APPOINT) { + ProductCategoryPropertyService productCategoryPropertyService = ApplicationUtil.getBean( + ProductCategoryPropertyService.class); + List categoryPropertyList = productCategoryPropertyService.getByPropertyId( + dto.getId()); + + this.categories = categoryPropertyList.stream().map(ProductCategoryProperty::getCategoryId) + .collect(Collectors.toList()); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/ProductPropertyModelorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/ProductPropertyModelorBo.java new file mode 100644 index 0000000..300585e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/ProductPropertyModelorBo.java @@ -0,0 +1,121 @@ +package com.lframework.xingyun.basedata.bo.product.property; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class ProductPropertyModelorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 是否必填 + */ + @Schema(description = "是否必填") + private Boolean isRequired; + + /** + * 可选项,当columnType != CUSTOM时 不为空 + */ + @Schema(description = "可选项,当columnType != CUSTOM时 不为空") + private List items; + + /** + * 显示值 当columnType != CUSTOM时,此值为items项ID 当columnType == CUSTOM时,此值为录入值 + */ + @Schema(description = "显示值 当columnType != CUSTOM时,此值为items项ID 当columnType == CUSTOM时,此值为录入值") + private String text; + + /** + * 录入类型 + */ + @Schema(description = "录入类型") + private Integer columnType; + + /** + * 数据类型 + */ + @Schema(description = "数据类型") + private Integer columnDataType; + + /** + * 属性类别 + */ + @Schema(description = "属性类别") + private Integer propertyType; + + public ProductPropertyModelorBo() { + + } + + public ProductPropertyModelorBo(ProductPropertyModelorDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductPropertyModelorDto dto) { + + return super.convert(dto, ProductPropertyModelorBo::getItems, ProductPropertyModelorBo::getColumnType, + ProductPropertyModelorBo::getColumnDataType, ProductPropertyModelorBo::getPropertyType); + } + + @Override + protected void afterInit(ProductPropertyModelorDto dto) { + + if (!CollectionUtil.isEmpty(dto.getItems())) { + this.items = dto.getItems().stream().map(ProductPropertyItemModelorBo::new).collect(Collectors.toList()); + } + + this.columnType = dto.getColumnType().getCode(); + if (dto.getColumnDataType() != null) { + this.columnDataType = dto.getColumnDataType().getCode(); + } + + this.propertyType = dto.getPropertyType().getCode(); + } + + @Data + public static class ProductPropertyItemModelorBo + extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public ProductPropertyItemModelorBo() { + + } + + public ProductPropertyItemModelorBo(ProductPropertyModelorDto.ProductPropertyItemModelorDto dto) { + + super(dto); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/QueryProductPropertyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/QueryProductPropertyBo.java new file mode 100644 index 0000000..9159221 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/QueryProductPropertyBo.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.basedata.bo.product.property; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class QueryProductPropertyBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 是否必填 + */ + @Schema(description = "是否必填") + private Boolean isRequired; + + /** + * 录入类型 + */ + @Schema(description = "录入类型") + private Integer columnType; + + /** + * 属性类别 + */ + @Schema(description = "属性类别") + private Integer propertyType; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public QueryProductPropertyBo() { + + } + + public QueryProductPropertyBo(ProductProperty dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductProperty dto) { + + this.columnType = dto.getColumnType().getCode(); + this.propertyType = dto.getPropertyType().getCode(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/GetProductPropertyItemBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/GetProductPropertyItemBo.java new file mode 100644 index 0000000..fe51fb9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/GetProductPropertyItemBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.product.property.item; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetProductPropertyItemBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetProductPropertyItemBo() { + + } + + public GetProductPropertyItemBo(ProductPropertyItem dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/QueryProductPropertyItemBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/QueryProductPropertyItemBo.java new file mode 100644 index 0000000..5988553 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/QueryProductPropertyItemBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.product.property.item; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class QueryProductPropertyItemBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public QueryProductPropertyItemBo() { + + } + + public QueryProductPropertyItemBo(ProductPropertyItem dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/GetShopBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/GetShopBo.java new file mode 100644 index 0000000..fb9411a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/GetShopBo.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.basedata.bo.shop; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysDept; +import com.lframework.starter.web.inner.service.system.SysDeptService; +import com.lframework.xingyun.basedata.entity.Shop; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * 门店 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetShopBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 所属部门ID + */ + @Schema(description = "所属部门ID") + private String deptId; + + /** + * 所属部门名称 + */ + @Schema(description = "所属部门名称") + private String deptName; + + /** + * 经度 + */ + @Schema(description = "经度") + private BigDecimal lng; + + /** + * 纬度 + */ + @Schema(description = "纬度") + private BigDecimal lat; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetShopBo() { + + } + + public GetShopBo(Shop dto) { + + super(dto); + } + + @Override + protected void afterInit(Shop dto) { + if (!StringUtil.isBlank(dto.getDeptId())) { + SysDeptService sysDeptService = ApplicationUtil.getBean(SysDeptService.class); + + SysDept dept = sysDeptService.findById(dto.getDeptId()); + + this.deptName = dept.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/QueryShopBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/QueryShopBo.java new file mode 100644 index 0000000..d752331 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/QueryShopBo.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.basedata.bo.shop; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysDept; +import com.lframework.starter.web.inner.service.system.SysDeptService; +import com.lframework.xingyun.basedata.entity.Shop; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 门店 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryShopBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 所属部门名称 + */ + @Schema(description = "所属部门名称") + private String deptName; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryShopBo() { + + } + + public QueryShopBo(Shop dto) { + + super(dto); + } + + @Override + protected void afterInit(Shop dto) { + if (!StringUtil.isBlank(dto.getDeptId())) { + SysDeptService sysDeptService = ApplicationUtil.getBean(SysDeptService.class); + + SysDept dept = sysDeptService.findById(dto.getDeptId()); + + this.deptName = dept.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/ShopSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/ShopSelectorBo.java new file mode 100644 index 0000000..0939765 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/ShopSelectorBo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.bo.shop; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Shop; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + *

+ * 门店选择器 Bo + *

+ * + * @author zmj + */ +@Data +public class ShopSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public ShopSelectorBo() { + + } + + public ShopSelectorBo(Shop dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/GetStoreCenterBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/GetStoreCenterBo.java new file mode 100644 index 0000000..975a04c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/GetStoreCenterBo.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.basedata.bo.storecenter; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetStoreCenterBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @Schema(description = "联系人手机号码") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private List city; + + /** + * 地区名称 + */ + @Schema(description = "地区名称") + private String cityName; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 仓库人数 + */ + @Schema(description = "仓库人数") + private Integer peopleNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetStoreCenterBo() { + + } + + public GetStoreCenterBo(StoreCenter dto) { + + super(dto); + } + + @Override + protected void afterInit(StoreCenter dto) { + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/QueryStoreCenterBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/QueryStoreCenterBo.java new file mode 100644 index 0000000..7a3f66a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/QueryStoreCenterBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.bo.storecenter; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryStoreCenterBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryStoreCenterBo() { + + } + + public QueryStoreCenterBo(StoreCenter dto) { + + super(dto); + } + + @Override + protected void afterInit(StoreCenter dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/StoreCenterSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/StoreCenterSelectorBo.java new file mode 100644 index 0000000..5fd4e87 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/StoreCenterSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.bo.storecenter; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class StoreCenterSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public StoreCenterSelectorBo() { + + } + + public StoreCenterSelectorBo(StoreCenter dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/GetSupplierBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/GetSupplierBo.java new file mode 100644 index 0000000..b8f5d50 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/GetSupplierBo.java @@ -0,0 +1,180 @@ +package com.lframework.xingyun.basedata.bo.supplier; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Supplier; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSupplierBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 简码 + */ + @Schema(description = "简码") + private String mnemonicCode; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + private String email; + + /** + * 邮编 + */ + @Schema(description = "邮编") + private String zipCode; + + /** + * 传真 + */ + @Schema(description = "传真") + private String fax; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private List city; + + /** + * 地区名称 + */ + @Schema(description = "地区名称") + private String cityName; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 送货周期(天) + */ + @Schema(description = "送货周期(天)") + private Integer deliveryCycle; + + /** + * 经营方式 + */ + @Schema(description = "经营方式") + private Integer manageType; + + /** + * 结算方式 + */ + @Schema(description = "结算方式") + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @Schema(description = "统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @Schema(description = "纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @Schema(description = "开户银行") + private String bankName; + + /** + * 户名 + */ + @Schema(description = "户名") + private String accountName; + + /** + * 银行账号 + */ + @Schema(description = "银行账号") + private String accountNo; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetSupplierBo() { + + } + + public GetSupplierBo(Supplier dto) { + + super(dto); + } + + @Override + public BaseBo convert(Supplier dto) { + + return super.convert(dto, GetSupplierBo::getSettleType, GetSupplierBo::getManageType); + } + + @Override + protected void afterInit(Supplier dto) { + + if (dto.getManageType() != null) { + this.manageType = dto.getManageType().getCode(); + } + + if (dto.getSettleType() != null) { + this.settleType = dto.getSettleType().getCode(); + } + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/QuerySupplierBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/QuerySupplierBo.java new file mode 100644 index 0000000..4618326 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/QuerySupplierBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.bo.supplier; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Supplier; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySupplierBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySupplierBo() { + + } + + public QuerySupplierBo(Supplier dto) { + + super(dto); + } + + @Override + protected void afterInit(Supplier dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/SupplierSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/SupplierSelectorBo.java new file mode 100644 index 0000000..bf75084 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/SupplierSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.bo.supplier; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Supplier; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class SupplierSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public SupplierSelectorBo() { + + } + + public SupplierSelectorBo(Supplier dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AddressController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AddressController.java new file mode 100644 index 0000000..46a4dc1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AddressController.java @@ -0,0 +1,150 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.address.GetAddressBo; +import com.lframework.xingyun.basedata.bo.address.QueryAddressBo; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.excel.address.AddressExportTaskWorker; +import com.lframework.xingyun.basedata.excel.address.AddressImportListener; +import com.lframework.xingyun.basedata.excel.address.AddressImportModel; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import com.lframework.xingyun.basedata.vo.address.UpdateAddressVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 地址库 + * + * @author zmj + */ +@Tag(name = "地址库") +@Validated +@RestController +@RequestMapping("/basedata/address") +public class AddressController extends DefaultBaseController { + + @Autowired + private AddressService addressService; + + /** + * 地址列表 + */ + @Operation(summary = "地址列表") + @HasPermission({"base-data:address:query", "base-data:address:add", "base-data:address:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryAddressVo vo) { + + PageResult
pageResult = addressService.query(getPageIndex(vo), getPageSize(vo), vo); + + List
datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryAddressBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询地址 + */ + @Operation(summary = "查询地址") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:address:query", "base-data:address:add", "base-data:address:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Address data = addressService.findById(id); + if (data == null) { + throw new DefaultClientException("地址不存在!"); + } + + GetAddressBo result = new GetAddressBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增地址 + */ + @Operation(summary = "新增地址") + @HasPermission({"base-data:address:add"}) + @PostMapping + public InvokeResult create(@Valid CreateAddressVo vo) { + + addressService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改地址 + */ + @Operation(summary = "修改地址") + @HasPermission({"base-data:address:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateAddressVo vo) { + + addressService.update(vo); + + addressService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"base-data:address:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryAddressVo vo) { + + ExportTaskUtil.exportTask("地址信息", AddressExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:address:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("地址导入模板", "地址导入模板", AddressImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:address:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + AddressImportListener listener = new AddressImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, AddressImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/BaseDataSelectorController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/BaseDataSelectorController.java new file mode 100644 index 0000000..73ce42b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/BaseDataSelectorController.java @@ -0,0 +1,578 @@ +package com.lframework.xingyun.basedata.controller; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.address.AddressSelectorBo; +import com.lframework.xingyun.basedata.bo.customer.CustomerSelectorBo; +import com.lframework.xingyun.basedata.bo.logistics.company.LogisticsCompanySelectorBo; +import com.lframework.xingyun.basedata.bo.member.MemberSelectorBo; +import com.lframework.xingyun.basedata.bo.paytype.PayTypeSelectorBo; +import com.lframework.xingyun.basedata.bo.product.brand.ProductBrandSelectorBo; +import com.lframework.xingyun.basedata.bo.product.brand.ProductCategorySelectorBo; +import com.lframework.xingyun.basedata.bo.product.info.ProductSelectorBo; +import com.lframework.xingyun.basedata.bo.shop.ShopSelectorBo; +import com.lframework.xingyun.basedata.bo.storecenter.StoreCenterSelectorBo; +import com.lframework.xingyun.basedata.bo.supplier.SupplierSelectorBo; +import com.lframework.xingyun.basedata.entity.*; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; +import com.lframework.xingyun.basedata.vo.shop.ShopSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 基础数据数据选择器 + * + * @author zmj + */ +@Tag(name = "基础数据数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class BaseDataSelectorController extends DefaultBaseController { + + @Autowired + private ProductBrandService productBrandService; + + @Autowired + private ProductCategoryService productCategoryService; + + @Autowired + private MemberService memberService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private CustomerService customerService; + + @Autowired + private ShopService shopService; + + @Autowired + private AddressService addressService; + + @Autowired + private PayTypeService payTypeService; + + @Autowired + private ProductService productService; + + @Autowired + private LogisticsCompanyService logisticsCompanyService; + + /** + * 商品 + */ + @Operation(summary = "商品") + @GetMapping("/product") + public InvokeResult> product( + @Valid QueryProductSelectorVo vo) { + + PageResult pageResult = productService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载商品 + */ + @Operation(summary = "加载商品") + @PostMapping("/product/load") + public InvokeResult> loadProduct( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> productService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(ProductSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 品牌 + */ + @Operation(summary = "品牌") + @GetMapping("/brand") + public InvokeResult> brand( + @Valid QueryProductBrandSelectorVo vo) { + + PageResult pageResult = productBrandService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductBrandSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载品牌 + */ + @Operation(summary = "加载品牌") + @PostMapping("/brand/load") + public InvokeResult> loadBrand( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> productBrandService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(ProductBrandSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 分类 + */ + @Operation(summary = "分类") + @GetMapping("/category") + public InvokeResult> category( + @Valid QueryProductCategorySelectorVo vo) { + + List datas = productCategoryService.selector(vo); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductCategorySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 加载分类 + */ + @Operation(summary = "加载分类") + @PostMapping("/category/load") + public InvokeResult> loadCustomList( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> productCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(ProductCategorySelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 会员 + */ + @Operation(summary = "会员") + @GetMapping("/member") + public InvokeResult> selector(@Valid QueryMemberSelectorVo vo) { + + PageResult pageResult = memberService.selector(getPageIndex(vo), getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(MemberSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载会员 + */ + @Operation(summary = "加载会员") + @PostMapping("/member/load") + public InvokeResult> loadMember( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> memberService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(MemberSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 仓库 + */ + @Operation(summary = "仓库") + @GetMapping("/sc") + public InvokeResult> selector( + @Valid QueryStoreCenterSelectorVo vo) { + + PageResult pageResult = storeCenterService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(StoreCenterSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载仓库 + */ + @Operation(summary = "加载仓库") + @PostMapping("/sc/load") + public InvokeResult> loadSc( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> storeCenterService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(StoreCenterSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 供应商 + */ + @Operation(summary = "供应商") + @GetMapping("/supplier") + public InvokeResult> selector(@Valid QuerySupplierSelectorVo vo) { + + PageResult pageResult = supplierService.selector(getPageIndex(vo), getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SupplierSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载供应商 + */ + @Operation(summary = "加载供应商") + @PostMapping("/supplier/load") + public InvokeResult> loadSupplier( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> supplierService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(SupplierSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 客户 + */ + @Operation(summary = "客户") + @GetMapping("/customer") + public InvokeResult> selector(@Valid QueryCustomerSelectorVo vo) { + + PageResult pageResult = customerService.selector(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(CustomerSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载客户 + */ + @Operation(summary = "加载客户") + @PostMapping("/customer/load") + public InvokeResult> loadCustomer( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> customerService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(CustomerSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 门店 + */ + @Operation(summary = "门店") + @GetMapping("/shop") + public InvokeResult> selector(@Valid ShopSelectorVo vo) { + + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(Shop.class) + .orderByAsc(Shop::getCode); + if (!StringUtil.isEmpty(vo.getCode())) { + queryWrapper.eq(Shop::getCode, vo.getCode()); + } + if (!StringUtil.isEmpty(vo.getName())) { + queryWrapper.like(Shop::getName, vo.getName()); + } + + Page page = new Page<>(getPageIndex(vo), getPageSize(vo)); + page = shopService.page(page, queryWrapper); + + PageResult pageResult = PageResultUtil.convert(page); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ShopSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载门店 + */ + @Operation(summary = "加载门店") + @PostMapping("/shop/load") + public InvokeResult> loadShop( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> shopService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(ShopSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 地址 + */ + @Operation(summary = "地址") + @GetMapping("/address") + public InvokeResult> selector(@Valid AddressSelectorVo vo) { + + PageResult
pageResult = addressService.selector(getPageIndex(vo), getPageSize(vo), + vo); + + List
datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(AddressSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载地址 + */ + @Operation(summary = "加载地址") + @PostMapping("/address/load") + public InvokeResult> loadAddress( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List
datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> addressService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(AddressSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 默认地址 + */ + @Operation(summary = "默认地址") + @GetMapping("/address/default") + public InvokeResult selector( + @NotBlank(message = "实体ID不能为空!") String entityId, + @NotNull(message = "实体类型不能为空!") @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) Integer entityType, + @NotNull(message = "地址类型不能为空!") @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) Integer addressType) { + + Wrapper
queryWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, entityId).eq(Address::getEntityType, entityType) + .eq(Address::getAddressType, addressType) + .eq(Address::getIsDefault, Boolean.TRUE); + Address address = addressService.getOne(queryWrapper); + + return InvokeResultBuilder.success(address == null ? null : new AddressSelectorBo(address)); + } + + /** + * 支付方式 + */ + @Operation(summary = "支付方式") + @GetMapping("/paytype") + public InvokeResult> selector(@Valid PayTypeSelectorVo vo) { + + PageResult pageResult = payTypeService.selector(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PayTypeSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载支付方式 + */ + @Operation(summary = "加载支付方式") + @PostMapping("/paytype/load") + public InvokeResult> loadPayType( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> payTypeService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(PayTypeSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 物流公司 + */ + @Operation(summary = "物流公司") + @GetMapping("/logistics/company") + public InvokeResult> selector( + @Valid QueryLogisticsCompanySelectorVo vo) { + + PageResult pageResult = logisticsCompanyService.selector(getPageIndex(vo), + getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(LogisticsCompanySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载物流公司 + */ + @Operation(summary = "加载物流公司") + @PostMapping("/logistics/company/load") + public InvokeResult> loadLogisticsCompany( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> logisticsCompanyService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(LogisticsCompanySelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/CustomerController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/CustomerController.java new file mode 100644 index 0000000..cb743e1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/CustomerController.java @@ -0,0 +1,155 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.customer.GetCustomerBo; +import com.lframework.xingyun.basedata.bo.customer.QueryCustomerBo; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.excel.customer.CustomerImportListener; +import com.lframework.xingyun.basedata.excel.customer.CustomerImportModel; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 客户管理 + * + * @author zmj + */ +@Tag(name = "客户管理") +@Validated +@RestController +@RequestMapping("/basedata/customer") +public class CustomerController extends DefaultBaseController { + + @Autowired + private CustomerService customerService; + + /** + * 客户列表 + */ + @Operation(summary = "客户列表") + @HasPermission({"base-data:customer:query", "base-data:customer:add", + "base-data:customer:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryCustomerVo vo) { + + PageResult pageResult = customerService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询客户 + */ + @Operation(summary = "查询客户") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:customer:query", "base-data:customer:add", + "base-data:customer:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Customer data = customerService.findById(id); + if (data == null) { + throw new DefaultClientException("客户不存在!"); + } + + GetCustomerBo result = new GetCustomerBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 删除客户 + */ + @Operation(summary = "删除客户") + @HasPermission({"base-data:customer:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "客户ID不能为空!") String id) { + + customerService.deleteById(id); + + customerService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增客户 + */ + @Operation(summary = "新增客户") + @HasPermission({"base-data:customer:add"}) + @PostMapping + public InvokeResult create(@Valid CreateCustomerVo vo) { + + customerService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改客户 + */ + @Operation(summary = "修改客户") + @HasPermission({"base-data:customer:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateCustomerVo vo) { + + customerService.update(vo); + + customerService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:customer:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + System.out.println("当前版本:2026-04-18-v2"); + ExcelUtil.exportXlsx("客户导入模板", "客户导入模板", CustomerImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:customer:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + CustomerImportListener listener = new CustomerImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, CustomerImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/LogisticsCompanyController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/LogisticsCompanyController.java new file mode 100644 index 0000000..67454b3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/LogisticsCompanyController.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.logistics.company.GetLogisticsCompanyBo; +import com.lframework.xingyun.basedata.bo.logistics.company.QueryLogisticsCompanyBo; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.basedata.vo.logistics.company.CreateLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.UpdateLogisticsCompanyVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 物流公司管理 + * + * @author zmj + */ +@Tag(name = "物流公司管理") +@Validated +@RestController +@RequestMapping("/basedata/logistics/company") +public class LogisticsCompanyController extends DefaultBaseController { + + @Autowired + private LogisticsCompanyService logisticsCompanyService; + + /** + * 物流公司列表 + */ + @Operation(summary = "物流公司列表") + @HasPermission({"base-data:logistics-company:query", "base-data:logistics-company:add", + "base-data:logistics-company:modify"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryLogisticsCompanyVo vo) { + + PageResult pageResult = logisticsCompanyService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryLogisticsCompanyBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询物流公司 + */ + @Operation(summary = "查询物流公司") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:logistics-company:query", "base-data:logistics-company:add", + "base-data:logistics-company:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + LogisticsCompany data = logisticsCompanyService.findById(id); + if (data == null) { + throw new DefaultClientException("物流公司不存在!"); + } + + GetLogisticsCompanyBo result = new GetLogisticsCompanyBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"base-data:logistics-company:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "物流公司ID不能为空!") String id) { + + logisticsCompanyService.deleteById(id); + + logisticsCompanyService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增物流公司 + */ + @Operation(summary = "新增物流公司") + @HasPermission({"base-data:logistics-company:add"}) + @PostMapping + public InvokeResult create(@Valid CreateLogisticsCompanyVo vo) { + + logisticsCompanyService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改物流公司 + */ + @Operation(summary = "修改物流公司") + @HasPermission({"base-data:logistics-company:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateLogisticsCompanyVo vo) { + + logisticsCompanyService.update(vo); + + logisticsCompanyService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/MemberController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/MemberController.java new file mode 100644 index 0000000..c2a38b0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/MemberController.java @@ -0,0 +1,195 @@ +package com.lframework.xingyun.basedata.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.support.ExcelTypeEnum; +import com.alibaba.excel.write.builder.ExcelWriterBuilder; +import com.alibaba.excel.write.handler.WriteHandler; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.member.GetMemberBo; +import com.lframework.xingyun.basedata.bo.member.QueryMemberBo; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.excel.member.MemberImportListener; +import com.lframework.xingyun.basedata.excel.member.MemberImportModel; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.vo.member.CreateMemberVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import com.lframework.xingyun.basedata.vo.member.UpdateMemberVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.OutputStream; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 会员管理 + * + * @author zmj + */ +@Tag(name = "会员管理") +@Validated +@RestController +@RequestMapping("/basedata/member") +public class MemberController extends DefaultBaseController { + + @Autowired + private MemberService memberService; + + /** + * 会员列表 + */ + @Operation(summary = "会员列表") + @HasPermission({"base-data:member:query", "base-data:member:add", "base-data:member:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryMemberVo vo) { + + PageResult pageResult = memberService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = CollectionUtil.isEmpty(datas) + ? CollectionUtil.emptyList() + : datas.stream().map(QueryMemberBo::new).collect(Collectors.toList()); + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询会员 + */ + @Operation(summary = "查询会员") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:member:query", "base-data:member:add", "base-data:member:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Member data = memberService.findById(id); + if (data == null) { + throw new DefaultClientException("会员不存在!"); + } + + GetMemberBo result = new GetMemberBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 删除会员 + */ + @Operation(summary = "删除会员") + @HasPermission({"base-data:member:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "会员ID不能为空!") String id) { + + memberService.deleteById(id); + + memberService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增会员 + */ + @Operation(summary = "新增会员") + @HasPermission({"base-data:member:add"}) + @PostMapping + public InvokeResult create(@Valid CreateMemberVo vo) { + + String id = memberService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改会员 + */ + @Operation(summary = "修改会员") + @HasPermission({"base-data:member:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateMemberVo vo) { + + memberService.update(vo); + + memberService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:member:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("会员导入模板", "会员导入模板", MemberImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:member:import"}) + @PostMapping("/import") + public InvokeResult importExcel( + @RequestParam("id") @NotBlank(message = "ID不能为空") String id, + @RequestParam("file") @NotNull(message = "请上传文件") MultipartFile file) { + + // 1. 基础校验 + if (file.isEmpty()) { + throw new DefaultClientException("上传文件不能为空"); + } + + String fileName = file.getOriginalFilename(); + if (fileName == null || + !(fileName.endsWith(".xls") || fileName.endsWith(".xlsx"))) { + throw new DefaultClientException("只支持 Excel 文件(xls/xlsx)"); + } + + try { + // 2. 创建监听器 + MemberImportListener listener = new MemberImportListener(); + listener.setTaskId(id); + + // 3. 执行读取(EasyExcel 3.x 标准写法) + ExcelUtil.read(file, MemberImportModel.class, listener) + .autoCloseStream(true) + .sheet() + .doRead(); + + } catch (Exception e) { + throw new DefaultClientException("导入失败:" + e.getMessage()); + } + + return InvokeResultBuilder.success(); + } + + private static void write(OutputStream os, + String sheetName, + Class clazz, + List data, + List handlers, + ExcelTypeEnum type) { + + ExcelWriterBuilder builder = EasyExcel.write(os, clazz) + .excelType(type); + + if (handlers != null) { + handlers.forEach(builder::registerWriteHandler); + } + + builder.sheet(sheetName).doWrite(data); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PayTypeController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PayTypeController.java new file mode 100644 index 0000000..90dd532 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PayTypeController.java @@ -0,0 +1,128 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.paytype.GetPayTypeBo; +import com.lframework.xingyun.basedata.bo.paytype.QueryPayTypeBo; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.vo.paytype.CreatePayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.UpdatePayTypeVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 支付方式管理 + * + * @author zmj + */ +@Tag(name = "支付方式管理") +@Validated +@RestController +@RequestMapping("/basedata/paytype") +public class PayTypeController extends DefaultBaseController { + + @Autowired + private PayTypeService payTypeService; + + /** + * 支付方式列表 + */ + @Operation(summary = "支付方式列表") + @HasPermission({"base-data:pay-type:query", "base-data:pay-type:add", + "base-data:pay-type:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryPayTypeVo vo) { + + PageResult pageResult = payTypeService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryPayTypeBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询支付方式 + */ + @Operation(summary = "查询支付方式") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:pay-type:query", "base-data:pay-type:add", + "base-data:pay-type:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + PayType data = payTypeService.findById(id); + if (data == null) { + throw new DefaultClientException("支付方式不存在!"); + } + + GetPayTypeBo result = new GetPayTypeBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增支付方式 + */ + @Operation(summary = "新增支付方式") + @HasPermission({"base-data:pay-type:add"}) + @PostMapping + public InvokeResult create(@Valid CreatePayTypeVo vo) { + + payTypeService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改支付方式 + */ + @Operation(summary = "修改支付方式") + @HasPermission({"base-data:pay-type:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdatePayTypeVo vo) { + + payTypeService.update(vo); + + payTypeService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 删除支付方式 + */ + @Operation(summary = "删除支付方式") + @HasPermission({"base-data:pay-type:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotBlank(message = "支付方式ID不能为空!") String id) { + + payTypeService.deleteById(id); + + payTypeService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PrintTemplateController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PrintTemplateController.java new file mode 100644 index 0000000..bb5fa08 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PrintTemplateController.java @@ -0,0 +1,180 @@ +package com.lframework.xingyun.basedata.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.print.GetPrintTemplateBo; +import com.lframework.xingyun.basedata.bo.print.GetPrintTemplateCompSettingBo; +import com.lframework.xingyun.basedata.bo.print.GetPrintTemplateSettingBo; +import com.lframework.xingyun.basedata.bo.print.QueryPrintTemplateBo; +import com.lframework.xingyun.basedata.entity.PrintTemplate; +import com.lframework.xingyun.basedata.entity.PrintTemplateComp; +import com.lframework.xingyun.basedata.service.print.PrintTemplateCompService; +import com.lframework.xingyun.basedata.service.print.PrintTemplateService; +import com.lframework.xingyun.basedata.vo.print.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 打印模板 + * + * @author zmj + */ +@Tag(name = "打印模板") +@Validated +@RestController +@RequestMapping("/basedata/print/template") +public class PrintTemplateController extends DefaultBaseController { + + @Autowired + private PrintTemplateService printTemplateService; + + @Autowired + private PrintTemplateCompService printTemplateCompService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"base-data:print-template:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryPrintTemplateVo vo) { + + PageResult pageResult = printTemplateService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryPrintTemplateBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:print-template:query"}) + @GetMapping + public InvokeResult get(@NotNull(message = "ID不能为空!") Integer id) { + + PrintTemplate data = printTemplateService.findById(id); + if (data == null) { + throw new DefaultClientException("打印模板不存在!"); + } + + GetPrintTemplateBo result = new GetPrintTemplateBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"base-data:print-template:add"}) + @PostMapping + public InvokeResult create(@Valid CreatePrintTemplateVo vo) { + + printTemplateService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"base-data:print-template:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdatePrintTemplateVo vo) { + + printTemplateService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 查询设置 + */ + @Operation(summary = "查询设置") + @Parameter(description = "ID", name = "id", required = true) + @GetMapping("/setting") + public InvokeResult getSetting( + @NotNull(message = "ID不能为空!") Integer id) { + + PrintTemplate data = printTemplateService.findById(id); + if (data == null) { + throw new DefaultClientException("打印模板不存在!"); + } + + GetPrintTemplateSettingBo result = new GetPrintTemplateSettingBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 保存设置 + */ + @Operation(summary = "保存设置") + @HasPermission({"base-data:print-template:modify"}) + @PutMapping("/setting") + public InvokeResult updateSetting(@Valid UpdatePrintTemplateSettingVo vo) { + + printTemplateService.updateSetting(vo); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "设置示例数据") + @HasPermission({"base-data:print-template:modify"}) + @PutMapping("/setting/demo") + public InvokeResult updateDemoData(@Valid UpdatePrintTemplateDemoDataVo vo) { + + printTemplateService.updateDemoData(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 查询组件设置 + */ + @Operation(summary = "查询组件设置") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:print-template:modify"}) + @GetMapping("/setting/comp") + public InvokeResult> getCompSetting( + @NotNull(message = "ID不能为空!") Integer id) { + List datas = new ArrayList<>(); + datas.addAll(printTemplateCompService.list(Wrappers.lambdaQuery(PrintTemplateComp.class) + .eq(PrintTemplateComp::getTemplateId, 0))); + datas.addAll(printTemplateCompService.list(Wrappers.lambdaQuery(PrintTemplateComp.class) + .eq(PrintTemplateComp::getTemplateId, id))); + + List results = datas.stream() + .map(GetPrintTemplateCompSettingBo::new).collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductBrandController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductBrandController.java new file mode 100644 index 0000000..0146afa --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductBrandController.java @@ -0,0 +1,157 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.product.brand.GetProductBrandBo; +import com.lframework.xingyun.basedata.bo.product.brand.QueryProductBrandBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.excel.product.brand.ProductBrandImportListener; +import com.lframework.xingyun.basedata.excel.product.brand.ProductBrandImportModel; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.vo.product.brand.CreateProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.UpdateProductBrandVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 品牌管理 + * + * @author zmj + */ +@Tag(name = "品牌管理") +@Validated +@RestController +@RequestMapping("/basedata/product/brand") +public class ProductBrandController extends DefaultBaseController { + + @Autowired + private ProductBrandService productBrandService; + + /** + * 品牌列表 + */ + @Operation(summary = "品牌列表") + @HasPermission({"base-data:product:brand:query", "base-data:product:brand:add", + "base-data:product:brand:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductBrandVo vo) { + + PageResult pageResult = productBrandService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryProductBrandBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + + /** + * 查询品牌 + */ + @Operation(summary = "查询品牌") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:product:brand:query", "base-data:product:brand:add", + "base-data:product:brand:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductBrand data = productBrandService.findById(id); + if (data == null) { + throw new DefaultClientException("品牌不存在!"); + } + + GetProductBrandBo result = new GetProductBrandBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"base-data:product:brand:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "品牌ID不能为空!") String id) { + + productBrandService.deleteById(id); + + productBrandService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增品牌 + */ + @Operation(summary = "新增品牌") + @HasPermission({"base-data:product:brand:add"}) + @PostMapping + public InvokeResult create(@Valid CreateProductBrandVo vo) { + + productBrandService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改品牌 + */ + @Operation(summary = "修改品牌") + @HasPermission({"base-data:product:brand:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateProductBrandVo vo) { + + productBrandService.update(vo); + + productBrandService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:product:brand:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("品牌导入模板", "品牌导入模板", ProductBrandImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:product:brand:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ProductBrandImportListener listener = new ProductBrandImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ProductBrandImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductCategoryController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductCategoryController.java new file mode 100644 index 0000000..76536ef --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductCategoryController.java @@ -0,0 +1,153 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.inner.service.RecursionMappingService; +import com.lframework.xingyun.basedata.bo.product.category.GetProductCategoryBo; +import com.lframework.xingyun.basedata.bo.product.category.ProductCategoryTreeBo; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryImportListener; +import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryImportModel; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.vo.product.category.CreateProductCategoryVo; +import com.lframework.xingyun.basedata.vo.product.category.UpdateProductCategoryVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 分类管理 + * + * @author zmj + */ +@Tag(name = "分类管理") +@Validated +@RestController +@RequestMapping("/basedata/product/category") +public class ProductCategoryController extends DefaultBaseController { + + @Autowired + private ProductCategoryService productCategoryService; + + @Autowired + private RecursionMappingService recursionMappingService; + + /** + * 分类列表 + */ + @Operation(summary = "分类列表") + @HasPermission({"base-data:product:category:query", "base-data:product:category:add", + "base-data:product:category:modify"}) + @GetMapping("/query") + public InvokeResult> query() { + + List datas = productCategoryService.getAllProductCategories(); + if (CollectionUtil.isEmpty(datas)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List results = datas.stream().map(ProductCategoryTreeBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 查询分类 + */ + @Operation(summary = "查询分类") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:product:category:query", "base-data:product:category:add", + "base-data:product:category:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductCategory data = productCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("分类不存在!"); + } + + GetProductCategoryBo result = new GetProductCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"base-data:product:category:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "分类ID不能为空!") String id) { + + productCategoryService.deleteById(id); + productCategoryService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增分类 + */ + @Operation(summary = "新增分类") + @HasPermission({"base-data:product:category:add"}) + @PostMapping + public InvokeResult create(@Valid CreateProductCategoryVo vo) { + + productCategoryService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改分类 + */ + @Operation(summary = "修改分类") + @HasPermission({"base-data:product:category:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateProductCategoryVo vo) { + + productCategoryService.update(vo); + + productCategoryService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:product:category:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("分类导入模板", "分类导入模板", ProductCategoryImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:product:category:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ProductCategoryImportListener listener = new ProductCategoryImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ProductCategoryImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductController.java new file mode 100644 index 0000000..c7a5de1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductController.java @@ -0,0 +1,167 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.product.info.GetProductBo; +import com.lframework.xingyun.basedata.bo.product.info.QueryProductBo; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.excel.product.ProductImportListener; +import com.lframework.xingyun.basedata.excel.product.ProductImportModel; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.info.CreateProductVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 商品管理 + * + * @author zmj + */ +@Tag(name = "商品管理") +@Validated +@RestController +@RequestMapping("/basedata/product") +public class ProductController extends DefaultBaseController { + + @Autowired + private ProductService productService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + /** + * 商品列表 + */ + @Operation(summary = "商品列表") + @HasPermission({"base-data:product:info:query", "base-data:product:info:add", + "base-data:product:info:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductVo vo) { + + PageResult pageResult = productService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 商品详情 + */ + @Operation(summary = "商品详情") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:product:info:query", "base-data:product:info:add", + "base-data:product:info:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Product data = productService.findById(id); + + GetProductBo result = new GetProductBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增商品 + */ + @Operation(summary = "新增商品") + @HasPermission({"base-data:product:info:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateProductVo vo) { + + productService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改商品 + */ + @Operation(summary = "修改商品") + @HasPermission({"base-data:product:info:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateProductVo vo) { + + productService.update(vo); + + productService.cleanCacheByKey(vo.getId()); + + productPropertyRelationService.cleanCacheByKey(vo.getId()); + + productBundleService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"base-data:product:info:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "ID不能为空!") String id) { + + productService.deleteById(id); + + productService.cleanCacheByKey(id); + + productPropertyRelationService.cleanCacheByKey(id); + + productBundleService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:product:info:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("商品导入模板", "商品导入模板", ProductImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:product:info:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ProductImportListener listener = new ProductImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ProductImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyController.java new file mode 100644 index 0000000..a89a23a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyController.java @@ -0,0 +1,175 @@ +package com.lframework.xingyun.basedata.controller; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.threads.DefaultRunnable; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.product.property.GetProductPropertyBo; +import com.lframework.xingyun.basedata.bo.product.property.ProductPropertyModelorBo; +import com.lframework.xingyun.basedata.bo.product.property.QueryProductPropertyBo; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.vo.product.property.CreateProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.UpdateProductPropertyVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 属性管理 + * + * @author zmj + */ +@Tag(name = "属性管理") +@Validated +@RestController +@RequestMapping("/basedata/product/property") +public class ProductPropertyController extends DefaultBaseController { + + @Autowired + private ProductPropertyService productPropertyService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + /** + * 属性列表 + */ + @Operation(summary = "属性列表") + @HasPermission({"base-data:product:property:query", "base-data:product:property:add", + "base-data:product:property:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductPropertyVo vo) { + + PageResult pageResult = productPropertyService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryProductPropertyBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询属性 + */ + @Operation(summary = "查询属性") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:product:property:query", "base-data:product:property:add", + "base-data:product:property:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductProperty data = productPropertyService.findById(id); + if (data == null) { + throw new DefaultClientException("属性不存在!"); + } + + GetProductPropertyBo result = new GetProductPropertyBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"base-data:product:property:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "属性ID不能为空!") String id) { + + productPropertyService.deleteById(id); + + productPropertyService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增属性 + */ + @Operation(summary = "新增属性") + @HasPermission({"base-data:product:property:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateProductPropertyVo vo) { + + productPropertyService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改属性 + */ + @Operation(summary = "修改属性") + @HasPermission({"base-data:product:property:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateProductPropertyVo vo) { + + productPropertyService.update(vo); + + productPropertyService.cleanCacheByKey(vo.getId()); + + ThreadUtil.execAsync(new DefaultRunnable((() -> { + Wrapper relationWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class).select(ProductPropertyRelation::getProductId) + .eq(ProductPropertyRelation::getPropertyId, vo.getId()) + .groupBy(ProductPropertyRelation::getProductId); + List relations = productPropertyRelationService.list( + relationWrapper); + + productPropertyRelationService.cleanCacheByKeys( + relations.stream().map(ProductPropertyRelation::getProductId).collect( + Collectors.toList())); + }))); + + return InvokeResultBuilder.success(); + } + + /** + * 属性模型 + */ + @Operation(summary = "属性模型") + @Parameter(description = "分类ID", name = "categoryId", required = true) + @GetMapping("/modelor/category") + public InvokeResult> getModelorByCategory( + @NotBlank(message = "分类ID不能为空!") String categoryId) { + + List datas = productPropertyService.getModelorByCategoryId( + categoryId); + + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductPropertyModelorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyItemController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyItemController.java new file mode 100644 index 0000000..354f877 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyItemController.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.product.property.item.GetProductPropertyItemBo; +import com.lframework.xingyun.basedata.bo.product.property.item.QueryProductPropertyItemBo; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.service.product.ProductPropertyItemService; +import com.lframework.xingyun.basedata.vo.product.property.item.CreateProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.UpdateProductPropertyItemVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 属性值管理 + * + * @author zmj + */ +@Tag(name = "属性值管理") +@Validated +@RestController +@RequestMapping("/basedata/product/property/item") +public class ProductPropertyItemController extends DefaultBaseController { + + @Autowired + private ProductPropertyItemService productPropertyItemService; + + /** + * 属性值列表 + */ + @Operation(summary = "属性值列表") + @HasPermission({"base-data:product:property-item:query", "base-data:product:property-item:add", + "base-data:product:property-item:modify"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryProductPropertyItemVo vo) { + + PageResult pageResult = productPropertyItemService.query(getPageIndex(vo), + getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryProductPropertyItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询属性值 + */ + @Operation(summary = "查询属性值") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:product:property-item:query", "base-data:product:property-item:add", + "base-data:product:property-item:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductPropertyItem data = productPropertyItemService.findById(id); + if (data == null) { + throw new DefaultClientException("属性值不存在!"); + } + + GetProductPropertyItemBo result = new GetProductPropertyItemBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增属性值 + */ + @Operation(summary = "新增属性值") + @HasPermission({"base-data:product:property-item:add"}) + @PostMapping + public InvokeResult create(@Valid CreateProductPropertyItemVo vo) { + + productPropertyItemService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改属性值 + */ + @Operation(summary = "修改属性值") + @HasPermission({"base-data:product:property-item:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateProductPropertyItemVo vo) { + + productPropertyItemService.update(vo); + + productPropertyItemService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"base-data:product:property-item:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "ID不能为空!") String id) { + + productPropertyItemService.deleteById(id); + + productPropertyItemService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ShopController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ShopController.java new file mode 100644 index 0000000..63d78fa --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ShopController.java @@ -0,0 +1,151 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.shop.GetShopBo; +import com.lframework.xingyun.basedata.bo.shop.QueryShopBo; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.excel.shop.ShopImportListener; +import com.lframework.xingyun.basedata.excel.shop.ShopImportModel; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.vo.shop.CreateShopVo; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import com.lframework.xingyun.basedata.vo.shop.UpdateShopVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 门店 Controller + * + * @author zmj + */ +@Tag(name = "门店") +@Validated +@RestController +@RequestMapping("/basedata/shop") +public class ShopController extends DefaultBaseController { + + @Autowired + private ShopService shopService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"base-data:shop:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryShopVo vo) { + + PageResult pageResult = shopService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryShopBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "id", name = "id", required = true) + @HasPermission({"base-data:shop:query"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + Shop data = shopService.findById(id); + if (data == null) { + throw new DefaultClientException("门店不存在!"); + } + + GetShopBo result = new GetShopBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"base-data:shop:add"}) + @PostMapping + public InvokeResult create(@Valid CreateShopVo vo) { + + shopService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @HasPermission({"base-data:shop:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotBlank(message = "门店ID不能为空!") String id) { + + shopService.deleteById(id); + + shopService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"base-data:shop:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateShopVo vo) { + + shopService.update(vo); + + shopService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:shop:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("门店导入模板", "门店导入模板", ShopImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:shop:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ShopImportListener listener = new ShopImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ShopImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/StoreCenterController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/StoreCenterController.java new file mode 100644 index 0000000..342505a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/StoreCenterController.java @@ -0,0 +1,155 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.storecenter.GetStoreCenterBo; +import com.lframework.xingyun.basedata.bo.storecenter.QueryStoreCenterBo; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.excel.storecenter.StoreCenterImportListener; +import com.lframework.xingyun.basedata.excel.storecenter.StoreCenterImportModel; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.vo.storecenter.CreateStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.UpdateStoreCenterVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 仓库管理 + * + * @author zmj + */ +@Tag(name = "仓库管理") +@Validated +@RestController +@RequestMapping("/basedata/storecenter") +public class StoreCenterController extends DefaultBaseController { + + @Autowired + private StoreCenterService storeCenterService; + + /** + * 仓库列表 + */ + @Operation(summary = "仓库列表") + @HasPermission({"base-data:store-center:query", "base-data:store-center:add", + "base-data:store-center:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryStoreCenterVo vo) { + + PageResult pageResult = storeCenterService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryStoreCenterBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询仓库 + */ + @Operation(summary = "查询仓库") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:store-center:query", "base-data:store-center:add", + "base-data:store-center:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + StoreCenter data = storeCenterService.findById(id); + if (data == null) { + throw new DefaultClientException("仓库不存在!"); + } + + GetStoreCenterBo result = new GetStoreCenterBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 删除仓库 + */ + @Operation(summary = "删除仓库") + @HasPermission({"base-data:store-center:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "仓库ID不能为空!") String id) { + + storeCenterService.deleteById(id); + + storeCenterService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增仓库 + */ + @Operation(summary = "新增仓库") + @HasPermission({"base-data:store-center:add"}) + @PostMapping + public InvokeResult create(@Valid CreateStoreCenterVo vo) { + + storeCenterService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改仓库 + */ + @Operation(summary = "修改仓库") + @HasPermission({"base-data:store-center:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateStoreCenterVo vo) { + + storeCenterService.update(vo); + + storeCenterService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:store-center:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("仓库导入模板", "仓库导入模板", StoreCenterImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:store-center:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + StoreCenterImportListener listener = new StoreCenterImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, StoreCenterImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/SupplierController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/SupplierController.java new file mode 100644 index 0000000..5d88ad3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/SupplierController.java @@ -0,0 +1,155 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.bo.supplier.GetSupplierBo; +import com.lframework.xingyun.basedata.bo.supplier.QuerySupplierBo; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.excel.supplier.SupplierImportListener; +import com.lframework.xingyun.basedata.excel.supplier.SupplierImportModel; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.supplier.CreateSupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.UpdateSupplierVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 供应商管理 + * + * @author zmj + */ +@Tag(name = "供应商管理") +@Validated +@RestController +@RequestMapping("/basedata/supplier") +public class SupplierController extends DefaultBaseController { + + @Autowired + private SupplierService supplierService; + + /** + * 供应商列表 + */ + @Operation(summary = "供应商列表") + @HasPermission({"base-data:supplier:query", "base-data:supplier:add", + "base-data:supplier:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySupplierVo vo) { + + PageResult pageResult = supplierService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QuerySupplierBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询供应商 + */ + @Operation(summary = "查询供应商") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"base-data:supplier:query", "base-data:supplier:add", + "base-data:supplier:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Supplier data = supplierService.findById(id); + if (data == null) { + throw new DefaultClientException("供应商不存在!"); + } + + GetSupplierBo result = new GetSupplierBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 删除供应商 + */ + @Operation(summary = "删除供应商") + @HasPermission({"base-data:supplier:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "供应商ID不能为空!") String id) { + + supplierService.deleteById(id); + + supplierService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增供应商 + */ + @Operation(summary = "新增供应商") + @HasPermission({"base-data:supplier:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSupplierVo vo) { + + supplierService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改供应商 + */ + @Operation(summary = "修改供应商") + @HasPermission({"base-data:supplier:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSupplierVo vo) { + + supplierService.update(vo); + + supplierService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"base-data:supplier:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("供应商导入模板", "供应商导入模板", SupplierImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"base-data:supplier:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + SupplierImportListener listener = new SupplierImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, SupplierImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/ProductPropertyRelationDto.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/ProductPropertyRelationDto.java new file mode 100644 index 0000000..5ecd9d1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/ProductPropertyRelationDto.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.dto.product; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.ColumnType; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProductPropertyRelationDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "ProductPropertyRelationDto"; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 属性ID + */ + private String propertyId; + + /** + * 属性值ID + */ + private String propertyItemId; + + /** + * 字段类型 + */ + private ColumnType propertyColumnType; + + /** + * 属性名称 + */ + private String propertyName; + + /** + * 属性值 + */ + private String propertyText; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/property/ProductPropertyModelorDto.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/property/ProductPropertyModelorDto.java new file mode 100644 index 0000000..c6c265e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/property/ProductPropertyModelorDto.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.basedata.dto.product.property; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class ProductPropertyModelorDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 是否必填 + */ + private Boolean isRequired; + + /** + * 可选项,当columnType != CUSTOM时 不为空 + */ + private List items; + + /** + * 显示值 当columnType != CUSTOM时,此值为items项ID 当columnType == CUSTOM时,此值为录入值 + */ + private String text; + + /** + * 录入类型 + */ + private ColumnType columnType; + + /** + * 数据类型 + */ + private ColumnDataType columnDataType; + + /** + * 属性类别 + */ + private PropertyType propertyType; + + @Data + public static class ProductPropertyItemModelorDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Address.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Address.java new file mode 100644 index 0000000..da010cb --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Address.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-03-26 + */ +@Data +@TableName("base_data_address") +public class Address extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Address"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 实体ID + */ + private String entityId; + + /** + * 实体类型 + */ + private AddressEntityType entityType; + + /** + * 地址类型 + */ + private AddressType addressType; + + /** + * 姓名 + */ + private String name; + + /** + * 手机号 + */ + private String telephone; + + /** + * 省 + */ + private String provinceId; + + /** + * 市 + */ + private String cityId; + + /** + * 区 + */ + private String districtId; + + /** + * 详细地址 + */ + private String address; + + /** + * 是否默认地址 + */ + private Boolean isDefault; + + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Customer.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Customer.java new file mode 100644 index 0000000..1c60ead --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Customer.java @@ -0,0 +1,159 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.basedata.enums.SettleType; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-10 + */ +@Data +@TableName("base_data_customer") +public class Customer extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "CustomerDto"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 简码 + */ + private String mnemonicCode; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 邮编 + */ + private String zipCode; + + /** + * 传真 + */ + private String fax; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 结算方式 + */ + private SettleType settleType; + + /** + * 统一社会信用代码 + */ + private String creditCode; + + /** + * 纳税人识别号 + */ + private String taxIdentifyNo; + + /** + * 开户银行 + */ + private String bankName; + + /** + * 户名 + */ + private String accountName; + + /** + * 银行账号 + */ + private String accountNo; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/LogisticsCompany.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/LogisticsCompany.java new file mode 100644 index 0000000..fdcdd53 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/LogisticsCompany.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-03-26 + */ +@Data +@TableName("base_data_logistics_company") +public class LogisticsCompany extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "LogisticsCompany"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Member.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Member.java new file mode 100644 index 0000000..bfc0180 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Member.java @@ -0,0 +1,125 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.starter.web.inner.enums.system.Gender; +import lombok.Data; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_member") +public class Member extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Member"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 性别 + */ + private Gender gender; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 出生日期 + */ + private LocalDate birthday; + + /** + * 入会日期 + */ + private LocalDate joinDay; + + /** + * 所属门店 + */ + private String shopId; + + /** + * 所属导购 + */ + private String guiderId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PayType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PayType.java new file mode 100644 index 0000000..8569984 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PayType.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-30 + */ +@Data +@TableName("base_data_pay_type") +public class PayType extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PayType"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 是否记录内容 + */ + private Boolean recText; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplate.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplate.java new file mode 100644 index 0000000..4ba9e49 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplate.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2025-01-28 + */ +@Data +@TableName("tbl_print_template") +public class PrintTemplate extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PrintTemplate"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 名称 + */ + private String name; + + /** + * JSON配置 + */ + private String templateJson; + + /** + * 示例数据 + */ + private String demoData; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplateComp.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplateComp.java new file mode 100644 index 0000000..aaf958f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PrintTemplateComp.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2025-01-28 + */ +@Data +@TableName("tbl_print_template_comp") +public class PrintTemplateComp extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PrintTemplateComp"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 模板ID + */ + private Integer templateId; + + /** + * 组件配置 + */ + private String compJson; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Product.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Product.java new file mode 100644 index 0000000..4248c7c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Product.java @@ -0,0 +1,145 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.basedata.enums.ProductType; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 商品 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product") +public class Product extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "Product"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 简称 + */ + private String shortName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 商品类型 + */ + private ProductType productType; + + /** + * 进项税率(%) + */ + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + private BigDecimal saleTaxRate; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 重量(kg) + */ + private BigDecimal weight; + + /** + * 体积(cm3) + */ + private BigDecimal volume; + + /** + * 状态 + */ + private Boolean available; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBrand.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBrand.java new file mode 100644 index 0000000..8c0ade7 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBrand.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-06 + */ +@Data +@TableName("base_data_product_brand") +public class ProductBrand extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductBrand"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 简称 + */ + private String shortName; + + /** + * logo + */ + private String logo; + + /** + * 简介 + */ + private String introduction; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBundle.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBundle.java new file mode 100644 index 0000000..e5601b4 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBundle.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 组合商品 + *

+ * + * @author zmj + * @since 2023-05-25 + */ +@Data +@TableName("base_data_product_bundle") +public class ProductBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductBundle"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 主商品ID + */ + private String mainProductId; + + /** + * 单品ID + */ + private String productId; + + /** + * 包含数量 + */ + private Integer bundleNum; + + /** + * 采购价 + */ + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + private BigDecimal salePrice; + + /** + * 零售价 + */ + private BigDecimal retailPrice; + + + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategory.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategory.java new file mode 100644 index 0000000..b26f0de --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategory.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-05 + */ +@Data +@TableName("base_data_product_category") +public class ProductCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductCategory"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 父级ID + */ + private String parentId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategoryProperty.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategoryProperty.java new file mode 100644 index 0000000..ab76315 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategoryProperty.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-05 + */ +@Data +@TableName("base_data_product_category_property") +public class ProductCategoryProperty extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductCategoryPropertyDto"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 商品属性ID + */ + private String propertyId; + + /** + * 商品分类ID + */ + private String categoryId; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductProperty.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductProperty.java new file mode 100644 index 0000000..4832b72 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductProperty.java @@ -0,0 +1,109 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-30 + */ +@Data +@TableName("base_data_product_property") +public class ProductProperty extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductProperty"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 是否必填 + */ + private Boolean isRequired; + + /** + * 录入类型 + */ + private ColumnType columnType; + + /** + * 数据类型 + */ + private ColumnDataType columnDataType; + + /** + * 属性类别 + */ + private PropertyType propertyType; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyItem.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyItem.java new file mode 100644 index 0000000..854343e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyItem.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-08-08 + */ +@Data +@TableName("base_data_product_property_item") +public class ProductPropertyItem extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductPropertyItem"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 属性ID + */ + private String propertyId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyRelation.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyRelation.java new file mode 100644 index 0000000..2ae3a84 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyRelation.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-08-05 + */ +@Data +@TableName("base_data_product_property_relation") +public class ProductPropertyRelation extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 商品属性ID + */ + private String propertyId; + + /** + * 属性值ID + */ + private String propertyItemId; + + /** + * 商品属性值 + */ + private String propertyText; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPurchase.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPurchase.java new file mode 100644 index 0000000..da231e2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPurchase.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product_purchase") +public class ProductPurchase extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 采购价 + */ + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductRetail.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductRetail.java new file mode 100644 index 0000000..08c9627 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductRetail.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product_retail") +public class ProductRetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 零售价 + */ + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductSale.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductSale.java new file mode 100644 index 0000000..3dba349 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductSale.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product_sale") +public class ProductSale extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 销售价 + */ + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Shop.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Shop.java new file mode 100644 index 0000000..b4bba79 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Shop.java @@ -0,0 +1,102 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 门店 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_shop") +public class Shop extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Shop"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 所属部门ID + */ + private String deptId; + + /** + * 经度 + */ + private BigDecimal lng; + + /** + * 纬度 + */ + private BigDecimal lat; + + /** + * 备注 + */ + private String description; + + /** + * 状态 + */ + private Boolean available; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/StoreCenter.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/StoreCenter.java new file mode 100644 index 0000000..15db10d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/StoreCenter.java @@ -0,0 +1,111 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-07 + */ +@Data +@TableName("base_data_store_center") +public class StoreCenter extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "StoreCenter"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系人手机号码 + */ + private String telephone; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 仓库人数 + */ + private Integer peopleNum; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Supplier.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Supplier.java new file mode 100644 index 0000000..8bf9e09 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Supplier.java @@ -0,0 +1,168 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_supplier") +public class Supplier extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Supplier"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 简码 + */ + private String mnemonicCode; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 邮编 + */ + private String zipCode; + + /** + * 传真 + */ + private String fax; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 送货周期(天) + */ + private Integer deliveryCycle; + + /** + * 经营方式 + */ + private ManageType manageType; + + /** + * 结算方式 + */ + private SettleType settleType; + + /** + * 统一社会信用代码 + */ + private String creditCode; + + /** + * 纳税人识别号 + */ + private String taxIdentifyNo; + + /** + * 开户银行 + */ + private String bankName; + + /** + * 户名 + */ + private String accountName; + + /** + * 银行账号 + */ + private String accountNo; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressEntityType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressEntityType.java new file mode 100644 index 0000000..cf41c95 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressEntityType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum AddressEntityType implements BaseEnum { + SC(1, "仓库"), CUSTOMER(2, "客户"), SUPPLIER(3, "供应商"), MEMBER(4, "会员"), SHOP(5, "门店"); + + @EnumValue + private final Integer code; + + private final String desc; + + AddressEntityType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressType.java new file mode 100644 index 0000000..5c86cd2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum AddressType implements BaseEnum { + DELIVERY(1, "发货地址"), RECEIVE(2, "收货地址"); + + @EnumValue + private final Integer code; + + private final String desc; + + AddressType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/BaseDataOpLogType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/BaseDataOpLogType.java new file mode 100644 index 0000000..f25407e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/BaseDataOpLogType.java @@ -0,0 +1,12 @@ +package com.lframework.xingyun.basedata.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class BaseDataOpLogType implements OpLogType { + @Override + public Integer getCode() { + return 1000; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnDataType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnDataType.java new file mode 100644 index 0000000..45af9d0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnDataType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum ColumnDataType implements BaseEnum { + INT(1, "整数型"), FLOAT(2, "浮点型"), STRING(3, "字符型"), DATE(4, "日期型"), TIME(5, "时间型"), DATE_TIME(6, + "日期时间型"); + + @EnumValue + private final Integer code; + + private final String desc; + + ColumnDataType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnType.java new file mode 100644 index 0000000..29ae502 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum ColumnType implements BaseEnum { + MULTIPLE(1, "多选"), SINGLE(2, "单选"), CUSTOM(3, "手动录入"); + + @EnumValue + private final Integer code; + + private final String desc; + + ColumnType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/InvoiceType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/InvoiceType.java new file mode 100644 index 0000000..4b1a73e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/InvoiceType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum InvoiceType implements BaseEnum { + NORMAL(1, "增值税普通发票"), SPECIAL(2, "增值税专用发票"), NORMAL_OR_SPECIAL(3, "增值税专用发票或增值税普通发票"), + ; + + @EnumValue + private final Integer code; + + private final String desc; + + InvoiceType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ManageType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ManageType.java new file mode 100644 index 0000000..b998927 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ManageType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum ManageType implements BaseEnum { + DISTRIBUTION(1, "经销"); + + @EnumValue + private final Integer code; + + private final String desc; + + ManageType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductCategoryNodeType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductCategoryNodeType.java new file mode 100644 index 0000000..830e3bd --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductCategoryNodeType.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.enums; + +import com.lframework.starter.web.inner.enums.system.NodeType; +import org.springframework.stereotype.Component; + +import java.io.Serializable; + +@Component +public final class ProductCategoryNodeType implements NodeType, Serializable { + + private static final long serialVersionUID = 1L; + + @Override + public Integer getCode() { + + return 2; + } + + @Override + public String getDesc() { + + return "商品分类"; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductType.java new file mode 100644 index 0000000..6961a87 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum ProductType implements BaseEnum { + NORMAL(1, "普通商品"), BUNDLE(2, "组合商品"); + + @EnumValue + private final Integer code; + + private final String desc; + + ProductType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/PropertyType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/PropertyType.java new file mode 100644 index 0000000..41b6fd3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/PropertyType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum PropertyType implements BaseEnum { + COMMON(1, "通用属性"), APPOINT(2, "指定分类属性"), NONE(3, "无"); + + @EnumValue + private final Integer code; + + private final String desc; + + PropertyType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/SettleType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/SettleType.java new file mode 100644 index 0000000..a7d4294 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/SettleType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleType implements BaseEnum { + ARBITRARILY(1, "任意指定"), CASH_ON_DELIVERY(2, "货到付款"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/TaxRate.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/TaxRate.java new file mode 100644 index 0000000..2d83033 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/TaxRate.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum TaxRate implements BaseEnum { + RATE17(17, "17%"), RATE11(11, "11%"), RATE6(6, "6%"), RATE3(3, "3%"), RATE0(0, "0%"), FREE(-1, + "免税"); + + @EnumValue + private final Integer code; + + private final String desc; + + TaxRate(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteCustomerEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteCustomerEvent.java new file mode 100644 index 0000000..11a1890 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteCustomerEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.Customer; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteCustomerEvent extends DataChangeEvent { + + public DeleteCustomerEvent(Object source, Customer entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteLogisticsCompanyEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteLogisticsCompanyEvent.java new file mode 100644 index 0000000..feb80c4 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteLogisticsCompanyEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteLogisticsCompanyEvent extends DataChangeEvent { + + public DeleteLogisticsCompanyEvent(Object source, LogisticsCompany entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteMemberEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteMemberEvent.java new file mode 100644 index 0000000..d2f15e7 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteMemberEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.Member; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteMemberEvent extends DataChangeEvent { + + public DeleteMemberEvent(Object source, Member entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeletePayTypeEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeletePayTypeEvent.java new file mode 100644 index 0000000..2bdebeb --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeletePayTypeEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.PayType; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeletePayTypeEvent extends DataChangeEvent { + + public DeletePayTypeEvent(Object source, PayType entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductBrandEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductBrandEvent.java new file mode 100644 index 0000000..73790c5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductBrandEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteProductBrandEvent extends DataChangeEvent { + + public DeleteProductBrandEvent(Object source, ProductBrand entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductCategoryEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductCategoryEvent.java new file mode 100644 index 0000000..259b4a0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductCategoryEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteProductCategoryEvent extends DataChangeEvent { + + public DeleteProductCategoryEvent(Object source, ProductCategory entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductEvent.java new file mode 100644 index 0000000..5e60314 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.Product; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteProductEvent extends DataChangeEvent { + + public DeleteProductEvent(Object source, Product entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyEvent.java new file mode 100644 index 0000000..b7ae073 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteProductPropertyEvent extends DataChangeEvent { + + public DeleteProductPropertyEvent(Object source, ProductProperty entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyItemEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyItemEvent.java new file mode 100644 index 0000000..0239639 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteProductPropertyItemEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteProductPropertyItemEvent extends DataChangeEvent { + + public DeleteProductPropertyItemEvent(Object source, ProductPropertyItem entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteShopEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteShopEvent.java new file mode 100644 index 0000000..8bc76ba --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteShopEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.Shop; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteShopEvent extends DataChangeEvent { + + public DeleteShopEvent(Object source, Shop entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteStoreCenterEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteStoreCenterEvent.java new file mode 100644 index 0000000..2109b7e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteStoreCenterEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteStoreCenterEvent extends DataChangeEvent { + + public DeleteStoreCenterEvent(Object source, StoreCenter entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteSupplierEvent.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteSupplierEvent.java new file mode 100644 index 0000000..c6cc40d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/events/DeleteSupplierEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.basedata.events; + +import com.lframework.starter.web.core.event.DataChangeEvent; +import com.lframework.starter.web.core.event.DataChangeType; +import com.lframework.xingyun.basedata.entity.Supplier; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DeleteSupplierEvent extends DataChangeEvent { + + public DeleteSupplierEvent(Object source, Supplier entity, + DataChangeType type) { + super(source, entity, type); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportModel.java new file mode 100644 index 0000000..2aa7d72 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportModel.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.basedata.excel.address; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.*; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import lombok.Data; + +@Data +public class AddressExportModel extends BaseBo
implements ExcelModel { + + /** + * 实体名称 + */ + @ExcelProperty("实体名称") + private String entityName; + + /** + * 实体类型 + */ + @ExcelProperty("实体类型") + private String entityType; + + /** + * 地址类型 + */ + @ExcelProperty("地址类型") + private String addressType; + + /** + * 姓名 + */ + @ExcelProperty("姓名") + private String name; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 省 + */ + @ExcelProperty("省") + private String provinceName; + + /** + * 市 + */ + @ExcelProperty("市") + private String cityName; + + /** + * 区 + */ + @ExcelProperty("区") + private String districtName; + + /** + * 详细地址 + */ + @ExcelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ExcelProperty("是否默认地址") + private String isDefault; + + public AddressExportModel() { + + } + + public AddressExportModel(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + if (dto.getEntityType() == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getEntityId()); + this.entityName = sc.getName(); + } else if (dto.getEntityType() == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getEntityId()); + this.entityName = customer.getName(); + } else if (dto.getEntityType() == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getEntityId()); + this.entityName = supplier.getName(); + } else if (dto.getEntityType() == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getEntityId()); + this.entityName = member.getName(); + } else if (dto.getEntityType() == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getEntityId()); + this.entityName = shop.getName(); + } + + this.entityType = dto.getEntityType().getDesc(); + this.addressType = dto.getAddressType().getDesc(); + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + this.isDefault = dto.getIsDefault() ? "是" : "否"; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportTaskWorker.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportTaskWorker.java new file mode 100644 index 0000000..c661f62 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportTaskWorker.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.basedata.excel.address; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; + +public class AddressExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryAddressVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryAddressVo.class); + } + + @Override + public PageResult
getDataList(int pageIndex, int pageSize, QueryAddressVo params) { + AddressService addressService = ApplicationUtil.getBean(AddressService.class); + + return addressService.query(pageIndex, pageSize, params); + } + + @Override + public AddressExportModel exportData(Address data) { + return new AddressExportModel(data); + } + + @Override + public Class getModelClass() { + return AddressExportModel.class; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportListener.java new file mode 100644 index 0000000..b1aa5fa --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportListener.java @@ -0,0 +1,194 @@ +package com.lframework.xingyun.basedata.excel.address; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.*; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +@Slf4j +public class AddressImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(AddressImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getEntityCode())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“实体编号”不能为空"); + } + AddressEntityType entityType = EnumUtil.getByDesc(AddressEntityType.class, + data.getEntityType()); + if (entityType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体类型”只能填写“" + CollectionUtil.join( + EnumUtil.getDescs(AddressEntityType.class), "、") + "”"); + } + data.setEntityTypeEnum(entityType); + if (entityType == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getEntityCode()) + .eq(StoreCenter::getAvailable, Boolean.TRUE); + StoreCenter sc = storeCenterService.getOne(queryWrapper); + if (sc == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(sc.getId()); + } else if (entityType == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Customer.class) + .eq(Customer::getCode, data.getEntityCode()) + .eq(Customer::getAvailable, Boolean.TRUE); + Customer customer = customerService.getOne(queryWrapper); + if (customer == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(customer.getId()); + } else if (entityType == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getEntityCode()) + .eq(Supplier::getAvailable, Boolean.TRUE); + Supplier supplier = supplierService.getOne(queryWrapper); + if (supplier == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(supplier.getId()); + } else if (entityType == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, data.getEntityCode()) + .eq(Member::getAvailable, Boolean.TRUE); + Member member = memberService.getOne(queryWrapper); + if (member == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(member.getId()); + } else if (entityType == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, data.getEntityCode()) + .eq(Shop::getAvailable, Boolean.TRUE); + Shop shop = shopService.getOne(queryWrapper); + if (shop == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(shop.getId()); + } + AddressType addressType = EnumUtil.getByDesc(AddressType.class, + data.getAddressType()); + if (addressType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地址类型”只能填写“" + CollectionUtil.join( + EnumUtil.getDescs(AddressType.class), "、") + "”"); + } + data.setAddressTypeEnum(addressType); + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“姓名”不能为空"); + } + if (StringUtil.isBlank(data.getTelephone())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“联系电话”不能为空"); + } + if (StringUtil.isBlank(data.getCity())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”不能为空"); + } + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + if (StringUtil.isBlank(data.getAddress())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“详细地址”不能为空"); + } + if (StringUtil.isBlank(data.getIsDefault())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否默认地址”不能为空"); + } + + if (!"是".equals(data.getIsDefault()) && !"否".equals(data.getIsDefault())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否默认地址”只能填写“是、否”"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + AddressService addressService = ApplicationUtil.getBean(AddressService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + AddressImportModel data = datas.get(i); + CreateAddressVo createAddressVo = new CreateAddressVo(); + createAddressVo.setEntityId(data.getEntityId()); + createAddressVo.setEntityType(data.getEntityTypeEnum().getCode()); + createAddressVo.setAddressType(data.getAddressTypeEnum().getCode()); + createAddressVo.setName(data.getName()); + createAddressVo.setTelephone(data.getTelephone()); + createAddressVo.setCityId(data.getAreaId()); + createAddressVo.setAddress(data.getAddress()); + createAddressVo.setIsDefault("是".equals(data.getIsDefault())); + + try { + addressService.create(createAddressVo); + } catch (Exception e) { + throw new DefaultClientException( + "第" + (i + 1) + "行新增失败,失败原因:" + e.getMessage()); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportModel.java new file mode 100644 index 0000000..67bf199 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportModel.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.basedata.excel.address; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import lombok.Data; + +@Data +public class AddressImportModel implements ExcelModel { + + /** + * 实体编号 + */ + @ExcelRequired + @ExcelProperty("实体编号") + private String entityCode; + + /** + * 实体ID + */ + @ExcelIgnore + private String entityId; + + /** + * 实体类型 + */ + @ExcelRequired + @ExcelProperty("实体类型") + private String entityType; + + /** + * 实体类型枚举 + */ + @ExcelIgnore + private AddressEntityType entityTypeEnum; + + /** + * 地址类型 + */ + @ExcelRequired + @ExcelProperty("地址类型") + private String addressType; + + /** + * 地址类型枚举 + */ + @ExcelIgnore + private AddressType addressTypeEnum; + + /** + * 姓名 + */ + @ExcelRequired + @ExcelProperty("姓名") + private String name; + + /** + * 联系电话 + */ + @ExcelRequired + @ExcelProperty("联系电话") + private String telephone; + + /** + * 地区 + */ + @ExcelRequired + @ExcelProperty("地区") + private String city; + + /** + * 地区ID + */ + @ExcelIgnore + private String areaId; + + /** + * 详细地址 + */ + @ExcelRequired + @ExcelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ExcelRequired + @ExcelProperty("是否默认地址") + private String isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportListener.java new file mode 100644 index 0000000..db271a2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportListener.java @@ -0,0 +1,162 @@ +package com.lframework.xingyun.basedata.excel.customer; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class CustomerImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(CustomerImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Customer.class) + .eq(Customer::getCode, data.getCode()) + .eq(Customer::getAvailable, Boolean.TRUE); + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + if (customerService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (StringUtil.isBlank(data.getMnemonicCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“简码”不能为空"); + } + if (StringUtil.isBlank(data.getSettleType())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结算方式”不能为空"); + } + SettleType settleType = EnumUtil.getByDesc(SettleType.class, data.getSettleType()); + if (settleType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结算方式”只能填写“" + + CollectionUtil.join( + EnumUtil.getDescs(SettleType.class), "、") + "”"); + } + data.setSettleTypeEnum(settleType); + + if (!StringUtil.isBlank(data.getCity())) { + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + } + + if (!StringUtil.isEmpty(data.getEmail())) { + if (!RegUtil.isMatch(PatternPool.EMAIL, data.getEmail())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“电子邮箱”格式有误"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + CustomerImportModel data = datas.get(i); + + Customer record = new Customer(); + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setMnemonicCode(data.getMnemonicCode()); + record.setContact(data.getContact()); + record.setTelephone(data.getTelephone()); + record.setEmail(data.getEmail()); + record.setZipCode(data.getZipCode()); + record.setFax(data.getFax()); + record.setCityId(data.getAreaId()); + record.setAddress(data.getAddress()); + record.setSettleType(data.getSettleTypeEnum()); + record.setCreditCode(data.getCreditCode()); + record.setTaxIdentifyNo(data.getTaxIdentifyNo()); + record.setBankName(data.getBankName()); + record.setAccountName(data.getAccountName()); + record.setAccountNo(data.getAccountNo()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + customerService.save(record); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportModel.java new file mode 100644 index 0000000..af9ab87 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportModel.java @@ -0,0 +1,136 @@ +package com.lframework.xingyun.basedata.excel.customer; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.enums.SettleType; +import lombok.Data; + +@Data +public class CustomerImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 简码 + */ + @ExcelRequired + @ExcelProperty("简码") + private String mnemonicCode; + + /** + * 联系人 + */ + @ExcelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ExcelProperty("电子邮箱") + private String email; + + /** + * 邮编 + */ + @ExcelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ExcelProperty("传真") + private String fax; + + /** + * 地区 + */ + @ExcelProperty("地区") + private String city; + + /** + * 地区ID + */ + @ExcelIgnore + private String areaId; + + /** + * 地址 + */ + @ExcelProperty("地址") + private String address; + + /** + * 结算方式 + */ + @ExcelRequired + @ExcelProperty("结算方式") + private String settleType; + + /** + * 结算方式枚举 + */ + @ExcelIgnore + private SettleType settleTypeEnum; + + /** + * 统一社会信用代码 + */ + @ExcelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ExcelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ExcelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ExcelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ExcelProperty("银行账号") + private String accountNo; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportListener.java new file mode 100644 index 0000000..4f94674 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportListener.java @@ -0,0 +1,158 @@ +package com.lframework.xingyun.basedata.excel.member; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.enums.system.Gender; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Slf4j +public class MemberImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(MemberImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + ( + checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, data.getCode()) + .eq(Member::getAvailable, Boolean.TRUE); + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + if (memberService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (StringUtil.isBlank(data.getGender())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“性别”不能为空"); + } + + Gender gender = EnumUtil.getByDesc(Gender.class, data.getGender()); + if (gender == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“性别”只能填写“" + CollectionUtil.join( + EnumUtil.getDescs(Gender.class), "、") + "”"); + } + data.setGenderEnum(gender); + + if (!StringUtil.isEmpty(data.getEmail())) { + if (!RegUtil.isMatch(PatternPool.EMAIL, data.getEmail())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“电子邮箱”格式有误"); + } + } + + if (!StringUtil.isEmpty(data.getShopCode())) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, data.getShopCode()); + Shop shop = shopService.getOne(queryWrapper); + if (shop == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“所属门店编号”不存在"); + } + data.setShopId(shop.getId()); + } + + if (!StringUtil.isEmpty(data.getGuiderCode())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser guider = userService.findByCode(data.getGuiderCode()); + if (guider == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“所属导购编号”不存在"); + } + data.setGuiderId(guider.getId()); + } + + if (data.getJoinDay() == null) { + data.setJoinDay(new Date()); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + MemberImportModel data = datas.get(i); + + Member record = new Member(); + record.setId(IdUtil.getId()); + + if (!StringUtil.isBlank(data.getTelephone())) { + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getTelephone, data.getTelephone()) + .eq(Member::getAvailable, Boolean.TRUE) + .ne(Member::getId, record.getId()); + if (memberService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + (i + 1) + "行“联系电话”重复,请重新输入"); + } + } + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setGender(data.getGenderEnum()); + record.setTelephone(data.getTelephone()); + record.setEmail(data.getEmail()); + record.setBirthday(DateUtil.toLocalDate(data.getBirthday())); + record.setJoinDay(DateUtil.toLocalDate(data.getJoinDay())); + record.setShopId(data.getShopId()); + record.setGuiderId(data.getGuiderId()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + record.setAvailable(Boolean.TRUE); + + data.setId(record.getId()); + + memberService.save(record); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportModel.java new file mode 100644 index 0000000..013c80d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportModel.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.basedata.excel.member; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.inner.enums.system.Gender; +import lombok.Data; + +import java.util.Date; + +@Data +public class MemberImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 性别 + */ + @ExcelRequired + @ExcelProperty("性别") + private String gender; + + /** + * 性别 + */ + @ExcelIgnore + private Gender genderEnum; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ExcelProperty("电子邮箱") + private String email; + + /** + * 出生日期 + */ + @ExcelProperty("出生日期") + private Date birthday; + + /** + * 入会日期 + */ + @ExcelProperty("入会日期") + private Date joinDay; + + /** + * 所属门店ID + */ + @ExcelIgnore + private String shopId; + + /** + * 所属门店编号 + */ + @ExcelProperty("所属门店编号") + private String shopCode; + + /** + * 所属导购ID + */ + @ExcelIgnore + private String guiderId; + + /** + * 所属导购编号 + */ + @ExcelProperty("所属导购编号") + private String guiderCode; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportListener.java new file mode 100644 index 0000000..61aac0f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportListener.java @@ -0,0 +1,267 @@ +package com.lframework.xingyun.basedata.excel.product; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.*; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ProductImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ProductImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + ( + checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getCode()).eq(Product::getAvailable, Boolean.TRUE); + ProductService productService = ApplicationUtil.getBean(ProductService.class); + if (productService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getCode()); + Product product = productService.getOne(queryWrapper); + + if (!StringUtil.isBlank(data.getSkuCode())) { + LambdaQueryWrapper checkSkuCodeWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getSkuCode, data.getSkuCode()).eq(Product::getAvailable, Boolean.TRUE); + if (productService.count(checkSkuCodeWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“SKU编号”重复,请检查"); + } + } + + if (StringUtil.isBlank(data.getCategoryCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“分类编号”不能为空"); + } + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + Wrapper queryProductCategoryWrapper = Wrappers.lambdaQuery( + ProductCategory.class).eq(ProductCategory::getCode, data.getCategoryCode()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + ProductCategory productCategory = productCategoryService.getOne(queryProductCategoryWrapper); + if (productCategory == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“分类编号”不存在,请检查"); + } + + data.setCategoryId(productCategory.getId()); + + if (!StringUtil.isBlank(data.getBrandCode())) { + ProductBrandService productBrandService = ApplicationUtil.getBean( + ProductBrandService.class); + Wrapper queryProductBrandWrapper = Wrappers.lambdaQuery( + ProductBrand.class).eq(ProductBrand::getCode, data.getBrandCode()) + .eq(ProductBrand::getAvailable, Boolean.TRUE); + ProductBrand productBrand = productBrandService.getOne(queryProductBrandWrapper); + if (productBrand == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“品牌编号”不存在,请检查"); + } + data.setBrandId(productBrand.getId()); + } + + if (data.getTaxRate() != null) { + if (NumberUtil.lt(data.getTaxRate(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“进项税率(%)”不允许小于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getTaxRate(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“进项税率(%)”最多允许2位小数"); + } + } + + if (data.getSaleTaxRate() != null) { + if (NumberUtil.lt(data.getSaleTaxRate(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销项税率(%)”不允许小于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getSaleTaxRate(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销项税率(%)”最多允许2位小数"); + } + } + + if (data.getPurchasePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价(元)”不能为空"); + } + + if (!NumberUtil.isNumberPrecision(data.getPurchasePrice(), 6)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价(元)”最多允许6位小数"); + } + if (NumberUtil.lt(data.getPurchasePrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价(元)”不允许小于0"); + } + + if (data.getSalePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售价(元)”不能为空"); + } + + if (!NumberUtil.isNumberPrecision(data.getSalePrice(), 6)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售价(元)”最多允许6位小数"); + } + if (NumberUtil.lt(data.getSalePrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售价(元)”不允许小于0"); + } + + if (data.getRetailPrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售价(元)”不能为空"); + } + + if (!NumberUtil.isNumberPrecision(data.getRetailPrice(), 6)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售价(元)”最多允许6位小数"); + } + if (NumberUtil.lt(data.getRetailPrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售价(元)”不允许小于0"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ProductImportModel data = datas.get(i); + + if (StringUtil.isNotBlank(data.getSkuCode())) { + Wrapper checkSkuCodeWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getSkuCode, data.getSkuCode()).eq(Product::getAvailable, Boolean.TRUE); + if (productService.count(checkSkuCodeWrapper) > 0) { + throw new DefaultClientException("第" + (i + 1) + "行“商品SKU编号”重复,请重新输入"); + } + } + + Product record = new Product(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + if (StringUtil.isNotBlank(data.getShortName())) { + record.setShortName(data.getShortName()); + } + if (StringUtil.isNotBlank(data.getSkuCode())) { + record.setSkuCode(data.getSkuCode()); + } + record.setExternalCode(data.getExternalCode()); + record.setCategoryId(data.getCategoryId()); + + // 判断分类是否是末级分类 + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(data.getCategoryId()); + Wrapper checkCategoryWrapper = Wrappers.lambdaQuery( + ProductCategory.class).eq(ProductCategory::getParentId, productCategory.getId()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + if (productCategoryService.count(checkCategoryWrapper) > 0) { + throw new DefaultClientException( + "第" + (i + 1) + "行“商品分类”不是末级分类,请使用末级分类"); + } + record.setBrandId(data.getBrandId()); + record.setTaxRate(data.getTaxRate() == null ? BigDecimal.ZERO : data.getTaxRate()); + record.setSaleTaxRate( + data.getSaleTaxRate() == null ? BigDecimal.ZERO : data.getSaleTaxRate()); + record.setSpec(data.getSpec()); + record.setUnit(data.getUnit()); + record.setProductType(ProductType.NORMAL); + + record.setAvailable(Boolean.TRUE); + + productService.save(record); + data.setId(record.getId()); + + if (data.getPurchasePrice() != null) { + ProductPurchaseService productPurchaseService = ApplicationUtil.getBean( + ProductPurchaseService.class); + CreateProductPurchaseVo createProductPurchaseVo = new CreateProductPurchaseVo(); + createProductPurchaseVo.setId(data.getId()); + createProductPurchaseVo.setPrice(data.getPurchasePrice()); + + productPurchaseService.create(createProductPurchaseVo); + } + + if (data.getSalePrice() != null) { + ProductSaleService productSaleService = ApplicationUtil.getBean(ProductSaleService.class); + CreateProductSaleVo createProductSaleVo = new CreateProductSaleVo(); + createProductSaleVo.setId(data.getId()); + createProductSaleVo.setPrice(data.getSalePrice()); + + productSaleService.create(createProductSaleVo); + } + + if (data.getRetailPrice() != null) { + ProductRetailService productRetailService = ApplicationUtil.getBean( + ProductRetailService.class); + CreateProductRetailVo createProductRetailVo = new CreateProductRetailVo(); + createProductRetailVo.setId(data.getId()); + createProductRetailVo.setPrice(data.getRetailPrice()); + + productRetailService.create(createProductRetailVo); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportModel.java new file mode 100644 index 0000000..97fee3a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportModel.java @@ -0,0 +1,121 @@ +package com.lframework.xingyun.basedata.excel.product; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ProductImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 简称 + */ + @ExcelProperty("简称") + private String shortName; + + /** + * SKU编号 + */ + @ExcelProperty("SKU编号") + private String skuCode; + + /** + * 简码 + */ + @ExcelProperty("简码") + private String externalCode; + + /** + * 分类ID + */ + @ExcelIgnore + private String categoryId; + + /** + * 分类编号 + */ + @ExcelRequired + @ExcelProperty("分类编号") + private String categoryCode; + + /** + * 品牌ID + */ + @ExcelIgnore + private String brandId; + + /** + * 品牌编号 + */ + @ExcelProperty("品牌编号") + private String brandCode; + + /** + * 进项税率(%) + */ + @ExcelProperty("进项税率(%)") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @ExcelProperty("销项税率(%)") + private BigDecimal saleTaxRate; + + /** + * 规格 + */ + @ExcelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ExcelProperty("单位") + private String unit; + + /** + * 采购价 + */ + @ExcelRequired + @ExcelProperty("采购价(元)") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @ExcelRequired + @ExcelProperty("销售价(元)") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @ExcelRequired + @ExcelProperty("零售价(元)") + private BigDecimal retailPrice; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportListener.java new file mode 100644 index 0000000..c6eb8a2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportListener.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.basedata.excel.product.brand; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ProductBrandImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ProductBrandImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + ( + checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getCode, data.getCode()).eq(ProductBrand::getAvailable, Boolean.TRUE); + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + if (productBrandService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ProductBrandImportModel data = datas.get(i); + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getName, data.getName()).eq(ProductBrand::getAvailable, Boolean.TRUE) + .ne(ProductBrand::getCode, data.getCode()); + if (productBrandService.count(checkNameWrapper) > 0) { + throw new DefaultClientException( + "第" + (i + 1) + "行“名称”重复,请重新输入"); + } + + ProductBrand record = new ProductBrand(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setShortName(data.getShortName()); + record.setIntroduction(StringUtil.isBlank(data.getIntroduction()) ? StringPool.EMPTY_STR + : data.getIntroduction()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + productBrandService.save(record); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportModel.java new file mode 100644 index 0000000..3f0496f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportModel.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.excel.product.brand; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class ProductBrandImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 简称 + */ + @ExcelProperty("简称") + private String shortName; + + /** + * 简介 + */ + @ExcelProperty("简介") + private String introduction; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportListener.java new file mode 100644 index 0000000..c68c199 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportListener.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.basedata.excel.product.category; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ProductCategoryImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ProductCategoryImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + ( + checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getCode()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + if (productCategoryService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (!StringUtil.isBlank(data.getParentCode())) { + Wrapper queryParentWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getParentCode()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + ProductCategory parent = productCategoryService.getOne(queryParentWrapper); + if (parent == null) { + // 检查是不是新导入的 + if (this.datas.stream().noneMatch(t -> t.getCode().equals(data.getParentCode()))) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“上级分类编号”不存在"); + } + } + + // 不允许改变上级分类 + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getCode()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + ProductCategory productCategory = productCategoryService.getOne(queryWrapper); + if (productCategory != null) { + ProductCategory parentCategory = StringUtil.isBlank(productCategory.getParentId()) ? null + : productCategoryService.getById(productCategory.getParentId()); + if (parentCategory == null || !parentCategory.getCode().equals(data.getParentCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“上级分类编号”有误,不允许修改分类的归属关系"); + } + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ProductCategoryImportModel data = datas.get(i); + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getName, data.getName()) + .ne(ProductCategory::getCode, data.getCode()); + if (productCategoryService.count(checkNameWrapper) > 0) { + throw new DefaultClientException( + "第" + (i + 1) + "行“名称”重复,请重新输入"); + } + + ProductCategory record = new ProductCategory(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + if (!StringUtil.isBlank(data.getParentCode())) { + Wrapper queryParentWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getParentCode()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + ProductCategory parent = productCategoryService.getOne(queryParentWrapper); + if (parent == null) { + throw new DefaultClientException("第" + (i + 1) + "行“上级分类编号”不存在"); + } + if (record.getId().equals(parent.getId())) { + throw new DefaultClientException( + "第" + (i + 1) + "行“上级分类编号”与“编号”相同,请重新输入"); + } + record.setParentId(parent.getId()); + } + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + productCategoryService.save(record); + productCategoryService.saveRecursion(true, record.getId(), record.getParentId()); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportModel.java new file mode 100644 index 0000000..6fd09ee --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportModel.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.excel.product.category; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class ProductCategoryImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 上级分类编号 + */ + @ExcelProperty("上级分类编号") + private String parentCode; + + /** + * 上级分类ID + */ + @ExcelIgnore + private String parentId; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportListener.java new file mode 100644 index 0000000..6188dde --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportListener.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.basedata.excel.shop; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.inner.entity.SysDept; +import com.lframework.starter.web.inner.service.system.SysDeptService; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ShopImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ShopImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, data.getCode()).eq(Shop::getAvailable, Boolean.TRUE); + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + if (shopService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (!StringUtil.isBlank(data.getDeptCode())) { + SysDeptService deptService = ApplicationUtil.getBean(SysDeptService.class); + SysDept dept = deptService.findByCode(data.getDeptCode()); + if (dept == null || !dept.getAvailable()) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“所属部门编号”不存在"); + } + data.setDeptId(dept.getId()); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ShopImportModel data = datas.get(i); + + Shop record = new Shop(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setDeptId(data.getDeptId()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + shopService.save(record); + + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportModel.java new file mode 100644 index 0000000..9171b42 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportModel.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.excel.shop; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class ShopImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 所属部门编号 + */ + @ExcelProperty("所属部门编号") + private String deptCode; + + /** + * 所属部门ID + */ + @ExcelIgnore + private String deptId; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportListener.java new file mode 100644 index 0000000..fa061f8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportListener.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.basedata.excel.storecenter; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class StoreCenterImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(StoreCenterImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getCode()) + .eq(StoreCenter::getAvailable, Boolean.TRUE); + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + if (storeCenterService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (!StringUtil.isBlank(data.getCity())) { + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + } + + if (data.getPeopleNum() != null) { + if (data.getPeopleNum() < 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库人数”不允许小于0"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + StoreCenterImportModel data = datas.get(i); + + StoreCenter record = new StoreCenter(); + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setContact(data.getContact()); + record.setTelephone(data.getTelephone()); + record.setCityId(data.getAreaId()); + record.setAddress(data.getAddress()); + record.setPeopleNum(data.getPeopleNum()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + record.setAvailable(Boolean.TRUE); + + storeCenterService.save(record); + data.setId(record.getId()); + + this.setSuccessProcessByIndex(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportModel.java new file mode 100644 index 0000000..346beaf --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportModel.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.basedata.excel.storecenter; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class StoreCenterImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 联系人 + */ + @ExcelProperty("联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @ExcelProperty("联系人手机号码") + private String telephone; + + /** + * 地区 + */ + @ExcelProperty("地区") + private String city; + + /** + * 仓库地址 + */ + @ExcelProperty("仓库地址") + private String address; + + /** + * 仓库人数 + */ + @ExcelProperty("仓库人数") + private Integer peopleNum; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 地区的ID + */ + @ExcelIgnore + private String areaId; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportListener.java new file mode 100644 index 0000000..3cd4316 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportListener.java @@ -0,0 +1,186 @@ +package com.lframework.xingyun.basedata.excel.supplier; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class SupplierImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(SupplierImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getCode()) + .eq(Supplier::getAvailable, Boolean.TRUE); + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + if (supplierService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (StringUtil.isBlank(data.getMnemonicCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“简码”不能为空"); + } + if (StringUtil.isBlank(data.getSettleType())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结算方式”不能为空"); + } + SettleType settleType = EnumUtil.getByDesc(SettleType.class, data.getSettleType()); + if (settleType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结算方式”只能填写“" + + CollectionUtil.join( + EnumUtil.getDescs(SettleType.class), "、") + "”"); + } + data.setSettleTypeEnum(settleType); + + if (StringUtil.isBlank(data.getManageType())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“经营方式”不能为空"); + } + ManageType manageType = EnumUtil.getByDesc(ManageType.class, data.getManageType()); + if (manageType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“经营方式”只能填写“" + + CollectionUtil.join( + EnumUtil.getDescs(ManageType.class), "、") + "”"); + } + data.setManageTypeEnum(manageType); + + if (!StringUtil.isBlank(data.getCity())) { + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + } + + if (!StringUtil.isEmpty(data.getEmail())) { + if (!RegUtil.isMatch(PatternPool.EMAIL, data.getEmail())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“电子邮箱”格式有误"); + } + } + + if (data.getDeliveryCycle() != null) { + if (data.getDeliveryCycle() <= 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“送货周期(天)”必须大于0"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + SupplierImportModel data = datas.get(i); + + Supplier record = new Supplier(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setMnemonicCode(data.getMnemonicCode()); + record.setContact(data.getContact()); + record.setTelephone(data.getTelephone()); + record.setEmail(data.getEmail()); + record.setZipCode(data.getZipCode()); + record.setFax(data.getFax()); + record.setCityId(data.getAreaId()); + record.setAddress(data.getAddress()); + record.setDeliveryCycle(data.getDeliveryCycle()); + record.setManageType(data.getManageTypeEnum()); + record.setSettleType(data.getSettleTypeEnum()); + record.setCreditCode(data.getCreditCode()); + record.setTaxIdentifyNo(data.getTaxIdentifyNo()); + record.setBankName(data.getBankName()); + record.setAccountName(data.getAccountName()); + record.setAccountNo(data.getAccountNo()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + supplierService.save(record); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportModel.java new file mode 100644 index 0000000..863c863 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportModel.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.basedata.excel.supplier; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import lombok.Data; + +@Data +public class SupplierImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 简码 + */ + @ExcelRequired + @ExcelProperty("简码") + private String mnemonicCode; + + /** + * 联系人 + */ + @ExcelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ExcelProperty("电子邮箱") + private String email; + + /** + * 邮编 + */ + @ExcelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ExcelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ExcelProperty("地区") + private String city; + + /** + * 地区ID + */ + @ExcelIgnore + private String areaId; + + /** + * 地址 + */ + @ExcelProperty("地址") + private String address; + + /** + * 送货周期(天) + */ + @ExcelProperty("送货周期(天)") + private Integer deliveryCycle; + + /** + * 经营方式 + */ + @ExcelRequired + @ExcelProperty("经营方式") + private String manageType; + + /** + * 经营方式枚举 + */ + @ExcelIgnore + private ManageType manageTypeEnum; + + /** + * 结算方式 + */ + @ExcelRequired + @ExcelProperty(value = "结算方式") + private String settleType; + + /** + * 结算方式枚举 + */ + @ExcelIgnore + private SettleType settleTypeEnum; + + /** + * 统一社会信用代码 + */ + @ExcelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ExcelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ExcelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ExcelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ExcelProperty("银行账号") + private String accountNo; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/address/AddressServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/address/AddressServiceImpl.java new file mode 100644 index 0000000..71d31bf --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/address/AddressServiceImpl.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.basedata.impl.address; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.mappers.AddressMapper; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import com.lframework.xingyun.basedata.vo.address.UpdateAddressVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class AddressServiceImpl extends BaseMpServiceImpl + implements AddressService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult
query(Integer pageIndex, Integer pageSize, QueryAddressVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List
datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List
query(QueryAddressVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult
selector(Integer pageIndex, Integer pageSize, AddressSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List
datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = Address.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Address findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增地址,ID:{}, 编号:{}", params = {"#_result", + "#vo.code"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateAddressVo vo) { + + if (vo.getIsDefault()) { + Wrapper
checkWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, vo.getEntityId()) + .eq(Address::getAddressType, vo.getAddressType()) + .eq(Address::getIsDefault, Boolean.TRUE); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("实体已存在默认地址,不允许再新增默认地址!"); + } + } + + Address data = new Address(); + data.setId(IdUtil.getId()); + data.setEntityId(vo.getEntityId()); + data.setEntityType(EnumUtil.getByCode(AddressEntityType.class, vo.getEntityType())); + data.setAddressType(EnumUtil.getByCode(AddressType.class, vo.getAddressType())); + data.setName(vo.getName()); + data.setTelephone(vo.getTelephone()); + DicCityDto district = dicCityService.findById(vo.getCityId()); + data.setDistrictId(district.getId()); + DicCityDto city = dicCityService.findById(district.getParentId()); + data.setCityId(city.getId()); + DicCityDto province = dicCityService.findById(city.getParentId()); + data.setProvinceId(province.getId()); + data.setAddress(vo.getAddress()); + data.setIsDefault(vo.getIsDefault());; + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改地址,ID:{}, 编号:{}", params = {"#vo.id", + "#vo.code"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateAddressVo vo) { + + Address data = getBaseMapper().selectById(vo.getId()); + if (data == null) { + throw new DefaultClientException("地址不存在!"); + } + if (vo.getIsDefault()) { + Wrapper
checkWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, vo.getEntityId()) + .eq(Address::getAddressType, vo.getAddressType()) + .eq(Address::getIsDefault, Boolean.TRUE) + .ne(Address::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("实体已存在默认地址,不允许再新增默认地址!"); + } + } + data.setEntityId(vo.getEntityId()); + data.setEntityType(EnumUtil.getByCode(AddressEntityType.class, vo.getEntityType())); + data.setAddressType(EnumUtil.getByCode(AddressType.class, vo.getAddressType())); + data.setName(vo.getName()); + data.setTelephone(vo.getTelephone()); + DicCityDto district = dicCityService.findById(vo.getCityId()); + data.setDistrictId(district.getId()); + DicCityDto city = dicCityService.findById(district.getParentId()); + data.setCityId(city.getId()); + DicCityDto province = dicCityService.findById(city.getParentId()); + data.setProvinceId(province.getId()); + data.setAddress(vo.getAddress()); + data.setIsDefault(vo.getIsDefault()); + + getBaseMapper().updateById(data); + } + + @Override + public Address getDefaultAddress(String entityId, Integer entityType, Integer addressType) { + Wrapper
queryWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, entityId) + .eq(Address::getEntityType, entityType) + .eq(Address::getAddressType, addressType) + .eq(Address::getIsDefault, Boolean.TRUE); + return this.getOne(queryWrapper); + } + + @CacheEvict(value = Address.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/customer/CustomerServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/customer/CustomerServiceImpl.java new file mode 100644 index 0000000..2d7db79 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/customer/CustomerServiceImpl.java @@ -0,0 +1,236 @@ +package com.lframework.xingyun.basedata.impl.customer; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.events.DeleteCustomerEvent; +import com.lframework.xingyun.basedata.mappers.CustomerMapper; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class CustomerServiceImpl extends BaseMpServiceImpl implements + CustomerService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryCustomerVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Customer.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Customer findById(String id) { + + return getBaseMapper().selectById(id); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryCustomerSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除客户,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Customer.class) + .set(Customer::getAvailable, Boolean.FALSE) + .eq(Customer::getId, id); + getBaseMapper().update(updateWrapper); + + Customer record = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteCustomerEvent.class, record); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增客户,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Customer.class) + .eq(Customer::getCode, vo.getCode()) + .eq(Customer::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Customer data = new Customer(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getMnemonicCode())) { + data.setMnemonicCode(vo.getMnemonicCode()); + } + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getEmail())) { + data.setEmail(vo.getEmail()); + } + if (!StringUtil.isBlank(vo.getZipCode())) { + data.setZipCode(vo.getZipCode()); + } + if (!StringUtil.isBlank(vo.getFax())) { + data.setFax(vo.getFax()); + } + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + data.setSettleType(EnumUtil.getByCode(SettleType.class, vo.getSettleType())); + if (!StringUtil.isBlank(vo.getCreditCode())) { + data.setCreditCode(vo.getCreditCode()); + } + if (!StringUtil.isBlank(vo.getTaxIdentifyNo())) { + data.setTaxIdentifyNo(vo.getTaxIdentifyNo()); + } + if (!StringUtil.isBlank(vo.getBankName())) { + data.setBankName(vo.getBankName()); + } + if (!StringUtil.isBlank(vo.getAccountName())) { + data.setAccountName(vo.getAccountName()); + } + if (!StringUtil.isBlank(vo.getAccountNo())) { + data.setAccountNo(vo.getAccountNo()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改客户,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerVo vo) { + + Customer data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("客户不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Customer.class) + .eq(Customer::getCode, vo.getCode()) + .eq(Customer::getAvailable, Boolean.TRUE) + .ne(Customer::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Customer.class) + .set(Customer::getCode, vo.getCode()).set(Customer::getName, vo.getName()) + .set(Customer::getMnemonicCode, + !StringUtil.isBlank(vo.getMnemonicCode()) ? vo.getMnemonicCode() : null) + .set(Customer::getContact, !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(Customer::getTelephone, + !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(Customer::getEmail, !StringUtil.isBlank(vo.getEmail()) ? vo.getEmail() : null) + .set(Customer::getZipCode, !StringUtil.isBlank(vo.getZipCode()) ? vo.getZipCode() : null) + .set(Customer::getFax, !StringUtil.isBlank(vo.getFax()) ? vo.getFax() : null) + .set(Customer::getAddress, !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(Customer::getCreditCode, + !StringUtil.isBlank(vo.getCreditCode()) ? vo.getCreditCode() : null) + .set(Customer::getTaxIdentifyNo, + !StringUtil.isBlank(vo.getTaxIdentifyNo()) ? vo.getTaxIdentifyNo() : null) + .set(Customer::getBankName, !StringUtil.isBlank(vo.getBankName()) ? vo.getBankName() : null) + .set(Customer::getAccountName, + !StringUtil.isBlank(vo.getAccountName()) ? vo.getAccountName() : null) + .set(Customer::getAccountNo, + !StringUtil.isBlank(vo.getAccountNo()) ? vo.getAccountNo() : null) + .set(Customer::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(Customer::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(Customer::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(Customer::getCityId, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = Customer.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/logistics/LogisticsCompanyServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/logistics/LogisticsCompanyServiceImpl.java new file mode 100644 index 0000000..0b546f5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/logistics/LogisticsCompanyServiceImpl.java @@ -0,0 +1,198 @@ +package com.lframework.xingyun.basedata.impl.logistics; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.events.DeleteLogisticsCompanyEvent; +import com.lframework.xingyun.basedata.mappers.LogisticsCompanyMapper; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.basedata.vo.logistics.company.CreateLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.UpdateLogisticsCompanyVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class LogisticsCompanyServiceImpl extends + BaseMpServiceImpl implements + LogisticsCompanyService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanyVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryLogisticsCompanyVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = LogisticsCompany.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public LogisticsCompany findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除物流公司,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(LogisticsCompany.class) + .set(LogisticsCompany::getAvailable, Boolean.FALSE).eq(LogisticsCompany::getId, id); + getBaseMapper().update(updateWrapper); + + LogisticsCompany record = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteLogisticsCompanyEvent.class, record); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增物流公司,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateLogisticsCompanyVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(LogisticsCompany.class) + .eq(LogisticsCompany::getCode, vo.getCode()).eq(LogisticsCompany::getAvailable, true); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LogisticsCompany data = new LogisticsCompany(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改物流公司,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateLogisticsCompanyVo vo) { + + LogisticsCompany data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("物流公司不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(LogisticsCompany.class) + .eq(LogisticsCompany::getCode, vo.getCode()) + .eq(LogisticsCompany::getAvailable, true) + .ne(LogisticsCompany::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + LogisticsCompany.class) + .set(LogisticsCompany::getCode, vo.getCode()).set(LogisticsCompany::getName, vo.getName()) + .set(LogisticsCompany::getContact, + !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(LogisticsCompany::getTelephone, + !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(LogisticsCompany::getAddress, + !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(LogisticsCompany::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(LogisticsCompany::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(LogisticsCompany::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(LogisticsCompany::getCityId, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanySelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = LogisticsCompany.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/member/MemberServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/member/MemberServiceImpl.java new file mode 100644 index 0000000..8df6880 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/member/MemberServiceImpl.java @@ -0,0 +1,205 @@ +package com.lframework.xingyun.basedata.impl.member; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.enums.system.Gender; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.events.DeleteMemberEvent; +import com.lframework.xingyun.basedata.mappers.MemberMapper; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.vo.member.CreateMemberVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import com.lframework.xingyun.basedata.vo.member.UpdateMemberVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class MemberServiceImpl extends BaseMpServiceImpl implements + MemberService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryMemberVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryMemberVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Member.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Member findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除会员,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Member.class) + .set(Member::getAvailable, Boolean.FALSE) + .eq(Member::getId, id); + getBaseMapper().update(updateWrapper); + + Member record = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteMemberEvent.class, record); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增会员,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateMemberVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, vo.getCode()) + .eq(Member::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getTelephone, vo.getTelephone()) + .eq(Member::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("手机号重复,请重新输入!"); + } + } + + Member data = new Member(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setGender(EnumUtil.getByCode(Gender.class, vo.getGender())); + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getEmail())) { + data.setEmail(vo.getEmail()); + } + if (vo.getBirthday() != null) { + data.setBirthday(vo.getBirthday()); + } + if (vo.getJoinDay() != null) { + data.setJoinDay(vo.getJoinDay()); + } + if (!StringUtil.isBlank(vo.getShopId())) { + data.setShopId(vo.getShopId()); + } + if (!StringUtil.isBlank(vo.getGuiderId())) { + data.setGuiderId(vo.getGuiderId()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改会员,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateMemberVo vo) { + + Member data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("会员不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, vo.getCode()) + .eq(Member::getAvailable, Boolean.TRUE) + .ne(Member::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getTelephone, vo.getTelephone()) + .eq(Member::getAvailable, Boolean.TRUE) + .ne(Member::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("手机号重复,请重新输入!"); + } + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Member.class) + .set(Member::getCode, vo.getCode()).set(Member::getName, vo.getName()) + .set(Member::getGender, EnumUtil.getByCode(Gender.class, vo.getGender())) + .set(Member::getTelephone, + !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(Member::getEmail, !StringUtil.isBlank(vo.getEmail()) ? vo.getEmail() : null) + .set(Member::getBirthday, vo.getBirthday() != null ? vo.getBirthday() : null) + .set(Member::getJoinDay, vo.getJoinDay() != null ? vo.getJoinDay() : null) + .set(Member::getShopId, !StringUtil.isBlank(vo.getShopId()) ? vo.getShopId() : null) + .set(Member::getGuiderId, + !StringUtil.isBlank(vo.getGuiderId()) ? vo.getGuiderId() : null) + .set(Member::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(Member::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryMemberSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = Member.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/paytype/PayTypeServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/paytype/PayTypeServiceImpl.java new file mode 100644 index 0000000..844048b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/paytype/PayTypeServiceImpl.java @@ -0,0 +1,177 @@ +package com.lframework.xingyun.basedata.impl.paytype; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.events.DeletePayTypeEvent; +import com.lframework.xingyun.basedata.mappers.PayTypeMapper; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.vo.paytype.CreatePayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.UpdatePayTypeVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class PayTypeServiceImpl extends BaseMpServiceImpl + implements PayTypeService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryPayTypeVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPayTypeVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, PayTypeSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = PayType.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public PayType findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除支付方式,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PayType.class) + .set(PayType::getAvailable, Boolean.FALSE) + .eq(PayType::getId, id); + getBaseMapper().update(updateWrapper); + + PayType record = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeletePayTypeEvent.class, record); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增支付方式,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePayTypeVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, vo.getCode()) + .eq(PayType::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getName, vo.getName()) + .eq(PayType::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + PayType data = new PayType(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + data.setRecText(vo.getRecText()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改支付方式,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePayTypeVo vo) { + + PayType data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("支付方式不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, vo.getCode()) + .eq(PayType::getAvailable, Boolean.TRUE) + .ne(PayType::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getName, vo.getName()) + .eq(PayType::getAvailable, Boolean.TRUE) + .ne(PayType::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(PayType.class) + .set(PayType::getCode, vo.getCode()).set(PayType::getName, vo.getName()) + .set(PayType::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(PayType::getRecText, vo.getRecText()) + .eq(PayType::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = PayType.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateCompServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateCompServiceImpl.java new file mode 100644 index 0000000..4db8d1f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateCompServiceImpl.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.basedata.impl.print; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.PrintTemplateComp; +import com.lframework.xingyun.basedata.mappers.PrintTemplateCompMapper; +import com.lframework.xingyun.basedata.service.print.PrintTemplateCompService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class PrintTemplateCompServiceImpl extends + BaseMpServiceImpl implements + PrintTemplateCompService { + + @Override + public List getCompJsonByTemplateId(Integer templateId) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(PrintTemplateComp.class) + .eq(PrintTemplateComp::getTemplateId, templateId); + List datas = getBaseMpMapper().selectList(queryWrapper); + + return datas.stream().map(PrintTemplateComp::getCompJson).collect(Collectors.toList()); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateServiceImpl.java new file mode 100644 index 0000000..364117f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/print/PrintTemplateServiceImpl.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.basedata.impl.print; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.PrintTemplate; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.mappers.PrintTemplateMapper; +import com.lframework.xingyun.basedata.service.print.PrintTemplateService; +import com.lframework.xingyun.basedata.vo.print.*; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class PrintTemplateServiceImpl extends + BaseMpServiceImpl implements + PrintTemplateService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryPrintTemplateVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPrintTemplateVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PrintTemplate findById(Integer id) { + return getById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增打印模板,名称:{}", params = {"#vo.name"}) + @Transactional(rollbackFor = Exception.class) + @Override + public Integer create(CreatePrintTemplateVo vo) { + Wrapper checkNameWrapper = Wrappers.lambdaQuery(PrintTemplate.class) + .eq(PrintTemplate::getName, vo.getName()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + PrintTemplate data = new PrintTemplate(); + data.setName(vo.getName()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改打印模板,ID:{},名称:{}", params = { + "#vo.id", "#vo.name"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePrintTemplateVo vo) { + Wrapper checkNameWrapper = Wrappers.lambdaQuery(PrintTemplate.class) + .eq(PrintTemplate::getName, vo.getName()).ne(PrintTemplate::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + PrintTemplate data = getById(vo.getId()); + if (data == null) { + throw new DefaultClientException("打印模板不存在!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PrintTemplate.class) + .eq(PrintTemplate::getId, vo.getId()).set(PrintTemplate::getName, vo.getName()); + + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改打印模板设置,ID:{}", params = { + "#vo.id"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void updateSetting(UpdatePrintTemplateSettingVo vo) { + PrintTemplate data = getById(vo.getId()); + if (data == null) { + throw new DefaultClientException("打印模板不存在!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PrintTemplate.class) + .eq(PrintTemplate::getId, vo.getId()) + .set(PrintTemplate::getTemplateJson, vo.getTemplateJson()); + + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改打印模板示例数据,ID:{}", params = { + "#vo.id"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void updateDemoData(UpdatePrintTemplateDemoDataVo vo) { + PrintTemplate data = getById(vo.getId()); + if (data == null) { + throw new DefaultClientException("打印模板不存在!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PrintTemplate.class) + .eq(PrintTemplate::getId, vo.getId()) + .set(PrintTemplate::getDemoData, vo.getDemoData()); + + getBaseMapper().update(updateWrapper); + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBrandServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBrandServiceImpl.java new file mode 100644 index 0000000..0cd6e1b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBrandServiceImpl.java @@ -0,0 +1,184 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.events.DeleteProductBrandEvent; +import com.lframework.xingyun.basedata.mappers.ProductBrandMapper; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.vo.product.brand.CreateProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.UpdateProductBrandVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class ProductBrandServiceImpl extends BaseMpServiceImpl + implements ProductBrandService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductBrandVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductBrandVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryProductBrandSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = ProductBrand.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductBrand findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除商品品牌,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductBrand.class) + .set(ProductBrand::getAvailable, Boolean.FALSE).eq(ProductBrand::getId, id); + getBaseMapper().update(updateWrapper); + + ProductBrand brand = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteProductBrandEvent.class, brand); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增商品品牌,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductBrandVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getCode, vo.getCode()).eq(ProductBrand::getAvailable, true); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getName, vo.getName()).eq(ProductBrand::getAvailable, true); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + ProductBrand data = new ProductBrand(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setShortName( + StringUtil.isBlank(vo.getShortName()) ? StringPool.EMPTY_STR : vo.getShortName()); + data.setIntroduction( + StringUtil.isBlank(vo.getIntroduction()) ? StringPool.EMPTY_STR : vo.getIntroduction()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (!StringUtil.isBlank(vo.getLogo())) { + data.setLogo(vo.getLogo()); + } + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改商品品牌,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductBrandVo vo) { + + ProductBrand data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("品牌不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getCode, vo.getCode()).eq(ProductBrand::getAvailable, true) + .ne(ProductBrand::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getName, vo.getName()).eq(ProductBrand::getAvailable, true) + .ne(ProductBrand::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(ProductBrand.class) + .set(ProductBrand::getCode, vo.getCode()).set(ProductBrand::getName, vo.getName()) + .set(ProductBrand::getShortName, + StringUtil.isBlank(vo.getShortName()) ? StringPool.EMPTY_STR : vo.getShortName()) + .set(ProductBrand::getLogo, StringUtil.isBlank(vo.getLogo()) ? null : vo.getLogo()) + .set(ProductBrand::getIntroduction, + StringUtil.isBlank(vo.getIntroduction()) ? StringPool.EMPTY_STR : vo.getIntroduction()) + .set(ProductBrand::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(ProductBrand::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = ProductBrand.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBundleServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBundleServiceImpl.java new file mode 100644 index 0000000..ff56fb0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBundleServiceImpl.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.mappers.ProductBundleMapper; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import java.io.Serializable; +import java.util.List; + +@Service +public class ProductBundleServiceImpl extends BaseMpServiceImpl + implements ProductBundleService { + + @Cacheable(value = ProductBundle.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null or #result.isEmpty()") + @Override + public List getByMainProductId(String id) { + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductBundle.class) + .eq(ProductBundle::getMainProductId, id); + return this.list(queryWrapper); + } + + @CacheEvict(value = ProductBundle.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryPropertyServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryPropertyServiceImpl.java new file mode 100644 index 0000000..80f97d4 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryPropertyServiceImpl.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.mappers.ProductCategoryPropertyMapper; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class ProductCategoryPropertyServiceImpl + extends BaseMpServiceImpl + implements ProductCategoryPropertyService { + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(String categoryId, String propertyId) { + + ProductCategoryProperty record = new ProductCategoryProperty(); + record.setId(IdUtil.getId()); + record.setPropertyId(propertyId); + record.setCategoryId(categoryId); + + getBaseMapper().insert(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByPropertyId(String propertyId) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery( + ProductCategoryProperty.class) + .eq(ProductCategoryProperty::getPropertyId, propertyId); + getBaseMapper().delete(deleteWrapper); + } + + @Override + public List getByPropertyId(String propertyId) { + + return getBaseMapper().getByPropertyId(propertyId); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryServiceImpl.java new file mode 100644 index 0000000..9c0c41d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryServiceImpl.java @@ -0,0 +1,246 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.inner.service.RecursionMappingService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.enums.ProductCategoryNodeType; +import com.lframework.xingyun.basedata.events.DeleteProductCategoryEvent; +import com.lframework.xingyun.basedata.mappers.ProductCategoryMapper; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.category.CreateProductCategoryVo; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import com.lframework.xingyun.basedata.vo.product.category.UpdateProductCategoryVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class ProductCategoryServiceImpl extends + BaseMpServiceImpl + implements ProductCategoryService { + + @Autowired + private RecursionMappingService recursionMappingService; + + @Autowired + private ProductService productService; + + @Override + public List getAllProductCategories() { + + return getBaseMapper().getAllProductCategories(); + } + + @Cacheable(value = ProductCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductCategory findById(String id) { + + return getBaseMapper().selectById(id); + } + + @Override + public List selector(QueryProductCategorySelectorVo vo) { + + return getBaseMapper().selector(vo); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除商品分类,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + List batchIds = new ArrayList<>(); + batchIds.add(id); + List nodeChildIds = recursionMappingService.getNodeChildIds(id, + ProductCategoryNodeType.class); + if (CollectionUtil.isNotEmpty(nodeChildIds)) { + batchIds.addAll(nodeChildIds); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductCategory.class) + .set(ProductCategory::getAvailable, Boolean.FALSE).in(ProductCategory::getId, batchIds); + getBaseMapper().update(updateWrapper); + + for (String categoryId : batchIds) { + ProductCategory category = this.findById(categoryId); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteProductCategoryEvent.class, category); + } + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增商品分类,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductCategoryVo vo) { + + //查询Code是否重复 + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, vo.getCode()).eq(ProductCategory::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + //查询Name是否重复 + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getName, vo.getName()).eq(ProductCategory::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + //如果parentId不为空,查询上级分类是否存在 + if (!StringUtil.isBlank(vo.getParentId())) { + Wrapper checkParentWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getId, vo.getParentId()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkParentWrapper) == 0) { + throw new DefaultClientException("上级分类不存在,请检查!"); + } + + // 然后判断上级分类下是否有商品,如果有商品不允许新增子分类 + Wrapper checkProductWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCategoryId, vo.getParentId()) + .eq(Product::getAvailable, Boolean.TRUE); + if (productService.count(checkProductWrapper) > 0) { + throw new DefaultClientException("上级分类已关联商品,不允许新增子分类!"); + } + } + + ProductCategory data = new ProductCategory(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getParentId())) { + data.setParentId(vo.getParentId()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription(vo.getDescription()); + + getBaseMapper().insert(data); + + this.saveRecursion(true, data.getId(), data.getParentId()); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改商品分类,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductCategoryVo vo) { + + ProductCategory data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("分类不存在!"); + } + + //查询Code是否重复 + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, vo.getCode()).eq(ProductCategory::getAvailable, Boolean.TRUE) + .ne(ProductCategory::getId, data.getId()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + //查询Name是否重复 + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getName, vo.getName()).eq(ProductCategory::getAvailable, Boolean.TRUE) + .ne(ProductCategory::getId, data.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductCategory.class) + .set(ProductCategory::getCode, vo.getCode()).set(ProductCategory::getName, vo.getName()) + .set(ProductCategory::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(ProductCategory::getId, data.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + /** + * 保存递归信息 + * + * @param categoryId + * @param parentId + */ + @Override + public void saveRecursion(Boolean isCreate, String categoryId, String parentId) { + + if (!isCreate) { + recursionMappingService.deleteNode(categoryId, ProductCategoryNodeType.class); + } + + if (!StringUtil.isBlank(parentId)) { + List parentIds = recursionMappingService.getNodeParentIds(parentId, + ProductCategoryNodeType.class); + if (CollectionUtil.isEmpty(parentIds)) { + parentIds = new ArrayList<>(); + } + parentIds.add(parentId); + + recursionMappingService.saveNode(categoryId, ProductCategoryNodeType.class, + parentIds); + } else { + recursionMappingService.saveNode(categoryId, ProductCategoryNodeType.class); + } + + // 还要更新这个节点的子节点 + List childIds = recursionMappingService.getNodeChildIds(categoryId, + ProductCategoryNodeType.class); + + for (String childId : childIds) { + List parentDeptList = new ArrayList<>(); + ProductCategory productCategory = this.findById(childId); + + while (StringUtil.isNotBlank(productCategory.getParentId())) { + productCategory = this.findById(productCategory.getParentId()); + if (productCategory == null) { + break; + } + parentDeptList.add(productCategory); + } + + parentDeptList = CollectionUtil.reverse(parentDeptList); + recursionMappingService.deleteNode(childId, ProductCategoryNodeType.class); + recursionMappingService.saveNode(childId, ProductCategoryNodeType.class, + parentDeptList.stream().map(ProductCategory::getId).collect(Collectors.toList())); + } + } + + @CacheEvict(value = ProductCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyItemServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyItemServiceImpl.java new file mode 100644 index 0000000..a3ac749 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyItemServiceImpl.java @@ -0,0 +1,185 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.events.DeleteProductPropertyItemEvent; +import com.lframework.xingyun.basedata.mappers.ProductPropertyItemMapper; +import com.lframework.xingyun.basedata.service.product.ProductPropertyItemService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.vo.product.property.item.CreateProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.UpdateProductPropertyItemVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class ProductPropertyItemServiceImpl extends + BaseMpServiceImpl + implements ProductPropertyItemService { + + @Autowired + private ProductPropertyService productPropertyService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductPropertyItemVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductPropertyItemVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public List getByPropertyId(String propertyId) { + + return getBaseMapper().getByPropertyId(propertyId); + } + + @Cacheable(value = ProductPropertyItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductPropertyItem findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增商品属性值,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPropertyItemVo vo) { + + ProductProperty property = productPropertyService.findById(vo.getPropertyId()); + if (ObjectUtil.isNull(property)) { + throw new DefaultClientException("属性不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, vo.getPropertyId()) + .eq(ProductPropertyItem::getCode, vo.getCode()) + .eq(ProductPropertyItem::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, vo.getPropertyId()) + .eq(ProductPropertyItem::getName, vo.getName()) + .eq(ProductPropertyItem::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + ProductPropertyItem data = new ProductPropertyItem(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setPropertyId(vo.getPropertyId()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改商品属性值,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductPropertyItemVo vo) { + + ProductPropertyItem data = this.findById(vo.getId()); + if (data == null) { + throw new DefaultClientException("属性值不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, data.getPropertyId()) + .eq(ProductPropertyItem::getCode, vo.getCode()) + .eq(ProductPropertyItem::getAvailable, Boolean.TRUE) + .ne(ProductPropertyItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, data.getPropertyId()) + .eq(ProductPropertyItem::getName, vo.getName()) + .eq(ProductPropertyItem::getAvailable, Boolean.TRUE) + .ne(ProductPropertyItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductPropertyItem.class) + .set(ProductPropertyItem::getCode, vo.getCode()) + .set(ProductPropertyItem::getName, vo.getName()) + .eq(ProductPropertyItem::getId, vo.getId()) + .set(ProductPropertyItem::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Transactional(rollbackFor = Exception.class) + @OpLog(type = BaseDataOpLogType.class, name = "删除商品属性值,ID:{}", params = "#id") + @Override + public void deleteById(String id) { + + Wrapper deleteWrapper = Wrappers.lambdaUpdate(ProductPropertyItem.class) + .eq(ProductPropertyItem::getId, id).set(ProductPropertyItem::getAvailable, Boolean.FALSE); + this.update(deleteWrapper); + + ProductPropertyItem propertyItem = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteProductPropertyItemEvent.class, + propertyItem); + } + + @CacheEvict(value = ProductPropertyItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyRelationServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyRelationServiceImpl.java new file mode 100644 index 0000000..8224437 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyRelationServiceImpl.java @@ -0,0 +1,195 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.mappers.ProductPropertyRelationMapper; +import com.lframework.xingyun.basedata.service.product.*; +import com.lframework.xingyun.basedata.vo.product.property.realtion.CreateProductPropertyRelationVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Service +public class ProductPropertyRelationServiceImpl extends + BaseMpServiceImpl + implements ProductPropertyRelationService { + + @Autowired + private ProductPropertyService productPropertyService; + + @Autowired + private ProductPropertyItemService productPropertyItemService; + + @Autowired + private ProductService productService; + + @Autowired + private ProductCategoryPropertyService productCategoryPropertyService; + + @Cacheable(value = ProductPropertyRelationDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #productId", unless = "#result == null or #result.size() == 0") + @Override + public List getByProductId(String productId) { + + return getBaseMapper().getByProductId(productId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setMultipleToSimple(String propertyId) { + + List datas = getBaseMapper().getByPropertyId(propertyId); + if (!CollectionUtil.isEmpty(datas)) { + + Set checkSet = new HashSet<>(); + for (ProductPropertyRelationDto data : datas) { + if (checkSet.stream() + .anyMatch(t -> t.getProductId().equals(data.getProductId()) && t.getPropertyId() + .equals(data.getPropertyId()))) { + getBaseMapper().deleteById(data.getId()); + } else { + checkSet.add(data); + } + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setCommonToAppoint(String propertyId) { + + List categoryList = productCategoryPropertyService.getByPropertyId( + propertyId); + for (ProductCategoryProperty productCategoryPropertyDto : categoryList) { + getBaseMapper().setCommonToAppoint(propertyId, productCategoryPropertyDto.getCategoryId()); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setAppointToCommon(String propertyId) { + + List propertyItems = productPropertyItemService.getByPropertyId( + propertyId); + if (!CollectionUtil.isEmpty(propertyItems)) { + ProductPropertyItem propertyItem = propertyItems.get(0); + + List productIds = productService.getIdNotInProductProperty(propertyId); + if (!CollectionUtil.isEmpty(productIds)) { + for (String productId : productIds) { + ProductPropertyRelation data = new ProductPropertyRelation(); + data.setId(IdUtil.getId()); + data.setProductId(productId); + data.setPropertyId(propertyItem.getPropertyId()); + data.setPropertyItemId(propertyItem.getId()); + + getBaseMapper().insert(data); + } + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateAppointCategoryId(String propertyId) { + + List propertyItems = productPropertyItemService.getByPropertyId( + propertyId); + if (!CollectionUtil.isEmpty(propertyItems)) { + ProductPropertyItem propertyItem = propertyItems.get(0); + + Wrapper deleteWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class) + .eq(ProductPropertyRelation::getPropertyId, propertyId); + getBaseMapper().delete(deleteWrapper); + + List categoryList = productCategoryPropertyService.getByPropertyId( + propertyId); + for (ProductCategoryProperty productCategoryPropertyDto : categoryList) { + List productIds = productService.getIdByCategoryId( + productCategoryPropertyDto.getCategoryId()); + if (!CollectionUtil.isEmpty(productIds)) { + for (String productId : productIds) { + ProductPropertyRelation data = new ProductPropertyRelation(); + data.setId(IdUtil.getId()); + data.setProductId(productId); + data.setPropertyId(propertyItem.getPropertyId()); + data.setPropertyItemId(propertyItem.getId()); + + getBaseMapper().insert(data); + } + } + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPropertyRelationVo vo) { + + ProductProperty productProperty = productPropertyService.findById(vo.getPropertyId()); + if (productProperty == null) { + throw new DefaultClientException("商品属性不存在!"); + } + + ProductPropertyRelation data = new ProductPropertyRelation(); + data.setId(IdUtil.getId()); + data.setProductId(vo.getProductId()); + data.setPropertyId(productProperty.getId()); + + if (productProperty.getColumnType() != ColumnType.CUSTOM) { + ProductPropertyItem propertyItem = productPropertyItemService.findById( + vo.getPropertyItemId()); + + if (propertyItem == null) { + throw new DefaultClientException("属性值不存在!"); + } + Assert.isTrue(propertyItem.getPropertyId().equals(productProperty.getId())); + + data.setPropertyItemId(propertyItem.getId()); + + } else { + if (StringUtil.isBlank(vo.getPropertyText())) { + throw new DefaultClientException("属性值文本不存在!"); + } + + data.setPropertyText(vo.getPropertyText()); + } + + getBaseMapper().insert(data); + + return data.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByProductId(String productId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class).eq(ProductPropertyRelation::getProductId, productId); + getBaseMapper().delete(deleteWrapper); + } + + @CacheEvict(value = ProductPropertyRelationDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyServiceImpl.java new file mode 100644 index 0000000..4c8d08a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyServiceImpl.java @@ -0,0 +1,356 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.service.RecursionMappingService; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.enums.*; +import com.lframework.xingyun.basedata.events.DeleteProductPropertyEvent; +import com.lframework.xingyun.basedata.mappers.ProductPropertyMapper; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.vo.product.property.CreateProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.UpdateProductPropertyVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +@Service +public class ProductPropertyServiceImpl extends + BaseMpServiceImpl + implements ProductPropertyService { + + @Autowired + private ProductCategoryService productCategoryService; + + @Autowired + private RecursionMappingService recursionMappingService; + + @Autowired + private ProductCategoryPropertyService productCategoryPropertyService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductPropertyVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductPropertyVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = ProductProperty.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductProperty findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除商品属性,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductProperty.class) + .set(ProductProperty::getAvailable, Boolean.FALSE).eq(ProductProperty::getId, id); + getBaseMapper().update(updateWrapper); + + ProductProperty productProperty = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteProductPropertyEvent.class, + productProperty); + } + + private List calcCategoryIds(List categoryIds) { + + if (CollectionUtil.isEmpty(categoryIds)) { + return CollectionUtil.emptyList(); + } + + //先整理categoryId,因为可能父级分类和子级分类全传过来了 + Set childCategoryIds = new HashSet<>(); + + for (String categoryId : categoryIds) { + + List children = recursionMappingService.getNodeChildIds(categoryId, + ProductCategoryNodeType.class); + if (!CollectionUtil.isEmpty(children)) { + childCategoryIds.addAll(children); + } + } + + //如果传过来的categoryId在childCategoryIds中,则表示categoryId和他的父级节点一起传过来了,需要去除 + List results = categoryIds.stream().filter(t -> !childCategoryIds.contains(t)) + .collect(Collectors.toList()); + + return results; + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增商品属性,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPropertyVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getCode, vo.getCode()).eq(ProductProperty::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getName, vo.getName()).eq(ProductProperty::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + if (vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + //如果是指定分类 + if (CollectionUtil.isEmpty(vo.getCategoryIds())) { + throw new InputErrorException("请选择商品分类!"); + } + + for (String categoryId : vo.getCategoryIds()) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + if (productCategory == null) { + throw new InputErrorException("商品分类数据有误,请检查!"); + } + } + + vo.setCategoryIds(this.calcCategoryIds(vo.getCategoryIds())); + } + + ProductProperty data = new ProductProperty(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setIsRequired(vo.getIsRequired()); + data.setColumnType(EnumUtil.getByCode(ColumnType.class, vo.getColumnType())); + if (data.getColumnType() == ColumnType.CUSTOM) { + if (vo.getColumnDataType() == null) { + throw new InputErrorException("数据类型不能为空!"); + } + + data.setColumnDataType(EnumUtil.getByCode(ColumnDataType.class, vo.getColumnDataType())); + } + data.setPropertyType(EnumUtil.getByCode(PropertyType.class, vo.getPropertyType())); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + if (data.getPropertyType() == PropertyType.APPOINT) { + for (String categoryId : vo.getCategoryIds()) { + productCategoryPropertyService.create(categoryId, data.getId()); + } + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改商品属性,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductPropertyVo vo) { + + ProductProperty data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("属性不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getCode, vo.getCode()).eq(ProductProperty::getAvailable, Boolean.TRUE) + .ne(ProductProperty::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getName, vo.getName()).eq(ProductProperty::getAvailable, Boolean.TRUE) + .ne(ProductProperty::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + //如果字段类型是手动录入,那么不允许修改字段类型 + if (data.getColumnType() == ColumnType.CUSTOM) { + if (vo.getColumnType() != ColumnType.CUSTOM.getCode().intValue()) { + throw new InputErrorException( + "该属性的字段类型为“" + ColumnType.CUSTOM.getDesc() + "”,不允许修改!"); + } + + if (vo.getColumnDataType() == null) { + throw new InputErrorException("请选择数据类型!"); + } + + if (data.getColumnDataType().getCode().intValue() != vo.getColumnDataType()) { + throw new InputErrorException("数据类型不允许修改!"); + } + + if (vo.getPropertyType() != data.getPropertyType().getCode().intValue()) { + throw new InputErrorException("该属性不允许修改属性类别!"); + } + } + + if (data.getColumnType() != ColumnType.CUSTOM + && vo.getColumnType() == ColumnType.CUSTOM.getCode().intValue()) { + //从其他类型更改为手动录入 + throw new InputErrorException( + "该属性不允许将字段类型修改为“" + ColumnType.CUSTOM.getDesc() + "”!"); + } + + if (data.getPropertyType() != PropertyType.NONE + && vo.getPropertyType() == PropertyType.NONE.getCode() + .intValue()) { + throw new InputErrorException( + "该属性的属性类别为“" + data.getPropertyType().getDesc() + "”,不允许修改为“" + + PropertyType.NONE.getDesc() + "”"); + } + + List oldProductCategoryPropertyList = new ArrayList<>(); + + if (vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + //如果是指定分类 + if (CollectionUtil.isEmpty(vo.getCategoryIds())) { + throw new InputErrorException("请选择商品分类!"); + } + + for (String categoryId : vo.getCategoryIds()) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + if (productCategory == null) { + throw new InputErrorException("商品分类数据有误,请检查!"); + } + } + + vo.setCategoryIds(this.calcCategoryIds(vo.getCategoryIds())); + } + + if (data.getPropertyType() == PropertyType.APPOINT) { + //删除关系 + oldProductCategoryPropertyList = productCategoryPropertyService.getByPropertyId(data.getId()); + productCategoryPropertyService.deleteByPropertyId(data.getId()); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + ProductProperty.class) + .set(ProductProperty::getCode, vo.getCode()).set(ProductProperty::getName, vo.getName()) + .set(ProductProperty::getIsRequired, vo.getIsRequired()) + .set(ProductProperty::getColumnType, vo.getColumnType()) + .set(ProductProperty::getPropertyType, vo.getPropertyType()) + .set(ProductProperty::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(ProductProperty::getId, vo.getId()); + if (vo.getColumnType() != ColumnType.CUSTOM.getCode().intValue()) { + updateWrapper.set(ProductProperty::getColumnDataType, null); + } else { + updateWrapper.set(ProductProperty::getColumnDataType, vo.getColumnDataType()); + } + + if (vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + for (String categoryId : vo.getCategoryIds()) { + productCategoryPropertyService.create(categoryId, data.getId()); + } + } + + getBaseMapper().update(updateWrapper); + + if (vo.getPropertyType() != PropertyType.NONE.getCode().intValue()) { + if (data.getColumnType() == ColumnType.MULTIPLE + && vo.getColumnType() == ColumnType.SINGLE.getCode() + .intValue()) { + //从多选更改为单选 + productPropertyRelationService.setMultipleToSimple(data.getId()); + } + + if (data.getPropertyType() == PropertyType.COMMON + && vo.getPropertyType() == PropertyType.APPOINT.getCode() + .intValue()) { + //从通用改成指定分类 + productPropertyRelationService.setCommonToAppoint(data.getId()); + + } else if (data.getPropertyType() == PropertyType.APPOINT + && vo.getPropertyType() == PropertyType.COMMON.getCode().intValue()) { + //从指定分类改成通用 + productPropertyRelationService.setAppointToCommon(data.getId()); + } else if (data.getPropertyType() == PropertyType.APPOINT + && vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + List oldCategoryIds = oldProductCategoryPropertyList.stream() + .map(ProductCategoryProperty::getCategoryId).collect(Collectors.toList()); + + boolean isUpdateCategory = CollectionUtil.isEqualList(oldCategoryIds, vo.getCategoryIds()); + if (isUpdateCategory) { + //更改了分类ID + productPropertyRelationService.updateAppointCategoryId(data.getId()); + } + } + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public List getModelorByCategoryId(String categoryId) { + + List parentCategoryIds = recursionMappingService.getNodeParentIds(categoryId, + ProductCategoryNodeType.class); + List categoryIds = new ArrayList<>(parentCategoryIds); + categoryIds.add(categoryId); + List datas = getBaseMapper().getModelorByCategoryId(categoryIds); + return datas; + } + + @CacheEvict(value = ProductProperty.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPurchaseServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPurchaseServiceImpl.java new file mode 100644 index 0000000..a6f3883 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPurchaseServiceImpl.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.mappers.ProductPurchaseMapper; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.purchase.UpdateProductPurchaseVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductPurchaseServiceImpl extends + BaseMpServiceImpl + implements ProductPurchaseService { + + @OpLog(type = BaseDataOpLogType.class, name = "设置商品采购价,ID:{}, 采购价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPurchaseVo vo) { + + ProductPurchase data = new ProductPurchase(); + data.setId(IdUtil.getId()); + if (!StringUtil.isBlank(vo.getId())) { + data.setId(vo.getId()); + } + + data.setPrice(vo.getPrice()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "设置商品采购价,ID:{}, 采购价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductPurchaseVo vo) { + + if (vo.getPrice() == null) { + throw new InputErrorException("采购价不能为空!"); + } + + if (vo.getPrice().doubleValue() < 0D) { + throw new InputErrorException("采购价必须大于0!"); + } + + getBaseMapper().deleteById(vo.getId()); + + CreateProductPurchaseVo createVo = new CreateProductPurchaseVo(); + createVo.setId(vo.getId()); + createVo.setPrice(vo.getPrice()); + + this.create(createVo); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductRetailServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductRetailServiceImpl.java new file mode 100644 index 0000000..de582ae --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductRetailServiceImpl.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductRetail; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.mappers.ProductRetailMapper; +import com.lframework.xingyun.basedata.service.product.ProductRetailService; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.retail.UpdateProductRetailVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductRetailServiceImpl extends BaseMpServiceImpl + implements ProductRetailService { + + @OpLog(type = BaseDataOpLogType.class, name = "设置商品零售价,ID:{}, 零售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductRetailVo vo) { + + ProductRetail data = new ProductRetail(); + data.setId(IdUtil.getId()); + if (!StringUtil.isBlank(vo.getId())) { + data.setId(vo.getId()); + } + + data.setPrice(vo.getPrice()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "设置商品零售价,ID:{}, 零售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductRetailVo vo) { + + if (vo.getPrice() == null) { + throw new InputErrorException("零售价不能为空!"); + } + + if (vo.getPrice().doubleValue() < 0D) { + throw new InputErrorException("零售价必须大于0!"); + } + + getBaseMapper().deleteById(vo.getId()); + + CreateProductRetailVo createVo = new CreateProductRetailVo(); + createVo.setId(vo.getId()); + createVo.setPrice(vo.getPrice()); + + this.create(createVo); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductSaleServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductSaleServiceImpl.java new file mode 100644 index 0000000..78b1bf8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductSaleServiceImpl.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductSale; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.mappers.ProductSaleMapper; +import com.lframework.xingyun.basedata.service.product.ProductSaleService; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import com.lframework.xingyun.basedata.vo.product.sale.UpdateProductSaleVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductSaleServiceImpl extends BaseMpServiceImpl + implements ProductSaleService { + + @OpLog(type = BaseDataOpLogType.class, name = "设置商品销售价,ID:{}, 销售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductSaleVo vo) { + + ProductSale data = new ProductSale(); + data.setId(IdUtil.getId()); + if (!StringUtil.isBlank(vo.getId())) { + data.setId(vo.getId()); + } + + data.setPrice(vo.getPrice()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "设置商品销售价,ID:{}, 销售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductSaleVo vo) { + + if (vo.getPrice() == null) { + throw new InputErrorException("销售价不能为空!"); + } + + if (vo.getPrice().doubleValue() < 0D) { + throw new InputErrorException("销售价必须大于0!"); + } + + getBaseMapper().deleteById(vo.getId()); + + CreateProductSaleVo createVo = new CreateProductSaleVo(); + createVo.setId(vo.getId()); + createVo.setPrice(vo.getPrice()); + + this.create(createVo); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java new file mode 100644 index 0000000..0b5b527 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java @@ -0,0 +1,566 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.*; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.service.RecursionMappingService; +import com.lframework.xingyun.basedata.entity.*; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.ProductCategoryNodeType; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.events.DeleteProductEvent; +import com.lframework.xingyun.basedata.mappers.ProductMapper; +import com.lframework.xingyun.basedata.service.product.*; +import com.lframework.xingyun.basedata.vo.product.info.*; +import com.lframework.xingyun.basedata.vo.product.property.realtion.CreateProductPropertyRelationVo; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.purchase.UpdateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.retail.UpdateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import com.lframework.xingyun.basedata.vo.product.sale.UpdateProductSaleVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class ProductServiceImpl extends BaseMpServiceImpl implements + ProductService { + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Autowired + private ProductSaleService productSaleService; + + @Autowired + private ProductRetailService productRetailService; + + @Autowired + private RecursionMappingService recursionMappingService; + + @Autowired + private ProductPropertyService productPropertyService; + + @Autowired + private ProductPropertyItemService productPropertyItemService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private ProductCategoryService productCategoryService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryProductSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public Integer queryCount(QueryProductVo vo) { + + return getBaseMapper().queryCount(vo); + } + + @Cacheable(value = Product.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Product findById(String id) { + + return getBaseMapper().selectById(id); + } + + @Override + public List getIdNotInProductProperty(String propertyId) { + + return getBaseMapper().getIdNotInProductProperty(propertyId); + } + + @Override + public List getIdByCategoryId(String categoryId) { + + return getBaseMapper().getIdByCategoryId(categoryId); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除商品,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Product.class) + .set(Product::getAvailable, Boolean.FALSE).eq(Product::getId, id); + getBaseMapper().update(updateWrapper); + + Product product = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteProductEvent.class, product); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增商品,ID:{}, 编号:{}", params = {"#_result", + "#vo.code"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, vo.getCode()).eq(Product::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + if (StringUtil.isNotBlank(vo.getSkuCode())) { + checkWrapper = Wrappers.lambdaQuery(Product.class).eq(Product::getSkuCode, vo.getSkuCode()) + .eq(Product::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("商品SKU编号重复,请重新输入!"); + } + } + + Product data = new Product(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (StringUtil.isNotBlank(vo.getShortName())) { + data.setShortName(vo.getShortName()); + } + if (StringUtil.isNotBlank(vo.getSkuCode())) { + data.setSkuCode(vo.getSkuCode()); + } + if (StringUtil.isNotBlank(vo.getExternalCode())) { + data.setExternalCode(vo.getExternalCode()); + } + + if (StringUtil.isNotBlank(vo.getBrandId())) { + data.setBrandId(vo.getBrandId()); + } + data.setCategoryId(vo.getCategoryId()); + + ProductCategory productCategory = productCategoryService.findById(data.getCategoryId()); + Wrapper checkCategoryWrapper = Wrappers.lambdaQuery( + ProductCategory.class).eq(ProductCategory::getParentId, productCategory.getId()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + if (productCategoryService.count(checkCategoryWrapper) > 0) { + throw new DefaultClientException( + "“商品分类”不是末级分类,请选择末级分类"); + } + + if (StringUtil.isNotBlank(vo.getSpec())) { + data.setSpec(vo.getSpec()); + } + + if (StringUtil.isNotBlank(vo.getUnit())) { + data.setUnit(vo.getUnit()); + } + + data.setProductType(EnumUtil.getByCode(ProductType.class, vo.getProductType())); + data.setTaxRate(vo.getTaxRate() == null ? BigDecimal.ZERO : vo.getTaxRate()); + data.setSaleTaxRate(vo.getSaleTaxRate() == null ? BigDecimal.ZERO : vo.getSaleTaxRate()); + data.setWeight(vo.getWeight()); + data.setVolume(vo.getVolume()); + + data.setAvailable(Boolean.TRUE); + + getBaseMapper().insert(data); + + // 组合商品 + if (data.getProductType() == ProductType.BUNDLE) { + if (CollectionUtil.isEmpty(vo.getProductBundles())) { + throw new DefaultClientException("单品数据不能为空!"); + } + + BigDecimal purchasePrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getPurchasePrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getPurchasePrice(), purchasePrice)) { + throw new DefaultClientException("单品的采购价设置错误!"); + } + + BigDecimal salePrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getSalePrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getSalePrice(), salePrice)) { + throw new DefaultClientException("单品的销售价设置错误!"); + } + + BigDecimal retailPrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getRetailPrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getRetailPrice(), retailPrice)) { + throw new DefaultClientException("单品的零售价设置错误!"); + } + + List productBundles = vo.getProductBundles().stream().map(productBundleVo -> { + ProductBundle productBundle = new ProductBundle(); + productBundle.setId(IdUtil.getId()); + productBundle.setMainProductId(data.getId()); + productBundle.setProductId(productBundleVo.getProductId()); + productBundle.setBundleNum(productBundleVo.getBundleNum()); + productBundle.setPurchasePrice(productBundleVo.getPurchasePrice()); + productBundle.setSalePrice(productBundleVo.getSalePrice()); + productBundle.setRetailPrice(productBundleVo.getRetailPrice()); + + return productBundle; + }).collect(Collectors.toList()); + + productBundleService.saveBatch(productBundles); + } + + if (vo.getPurchasePrice() == null) { + throw new DefaultClientException("采购价不能为空!"); + } + + if (NumberUtil.lt(vo.getPurchasePrice(), 0)) { + throw new DefaultClientException("采购价不允许小于0!"); + } + + CreateProductPurchaseVo createProductPurchaseVo = new CreateProductPurchaseVo(); + createProductPurchaseVo.setId(data.getId()); + createProductPurchaseVo.setPrice(vo.getPurchasePrice()); + + productPurchaseService.create(createProductPurchaseVo); + + if (vo.getSalePrice() == null) { + throw new DefaultClientException("销售价不能为空!"); + } + + if (NumberUtil.lt(vo.getSalePrice(), 0)) { + throw new DefaultClientException("销售价不允许小于0!"); + } + + CreateProductSaleVo createProductSaleVo = new CreateProductSaleVo(); + createProductSaleVo.setId(data.getId()); + createProductSaleVo.setPrice(vo.getSalePrice()); + + productSaleService.create(createProductSaleVo); + + if (vo.getRetailPrice() == null) { + throw new DefaultClientException("零售价不能为空!"); + } + + if (NumberUtil.lt(vo.getRetailPrice(), 0D)) { + throw new DefaultClientException("零售价不允许小于0!"); + } + + CreateProductRetailVo createProductRetailVo = new CreateProductRetailVo(); + createProductRetailVo.setId(data.getId()); + createProductRetailVo.setPrice(vo.getRetailPrice()); + + productRetailService.create(createProductRetailVo); + + if (!CollectionUtil.isEmpty(vo.getProperties())) { + // 商品和商品属性的关系 + for (ProductPropertyRelationVo property : vo.getProperties()) { + ProductProperty productProperty = productPropertyService.findById(property.getId()); + if (productProperty == null) { + throw new DefaultClientException("商品属性不存在!"); + } + if (productProperty.getColumnType() == ColumnType.SINGLE) { + ProductPropertyItem propertyItem = productPropertyItemService.findById( + property.getText()); + if (propertyItem == null) { + throw new DefaultClientException("商品属性值不存在!"); + } + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItem.getId()); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } else if (productProperty.getColumnType() == ColumnType.MULTIPLE) { + + List propertyItemIds = JsonUtil.parseList(property.getText(), String.class); + for (String propertyItemId : propertyItemIds) { + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItemId); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } + + } else if (productProperty.getColumnType() == ColumnType.CUSTOM) { + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyText(property.getText()); + productPropertyRelationService.create(createProductPropertyRelationVo); + } else { + throw new DefaultClientException("商品属性字段类型不存在!"); + } + } + } + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改商品,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductVo vo) { + + Product data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("商品不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, vo.getCode()).eq(Product::getAvailable, Boolean.TRUE) + .ne(Product::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + if (StringUtil.isNotBlank(vo.getSkuCode())) { + checkWrapper = Wrappers.lambdaQuery(Product.class).eq(Product::getAvailable, Boolean.TRUE) + .eq(Product::getSkuCode, vo.getSkuCode()) + .ne(Product::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("商品SKU编号重复,请重新输入!"); + } + } + + ProductCategory productCategory = productCategoryService.findById(vo.getCategoryId()); + Wrapper checkCategoryWrapper = Wrappers.lambdaQuery( + ProductCategory.class).eq(ProductCategory::getParentId, productCategory.getId()) + .eq(ProductCategory::getAvailable, Boolean.TRUE); + if (productCategoryService.count(checkCategoryWrapper) > 0) { + throw new DefaultClientException( + "“商品分类”不是末级分类,请选择末级分类"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Product.class) + .set(Product::getCode, vo.getCode()).set(Product::getName, vo.getName()) + .set(Product::getSkuCode, vo.getSkuCode()) + .set(Product::getExternalCode, + StringUtil.isBlank(vo.getExternalCode()) ? null : vo.getExternalCode()) + .set(Product::getSpec, StringUtil.isBlank(vo.getSpec()) ? null : vo.getSpec()) + .set(Product::getUnit, StringUtil.isBlank(vo.getUnit()) ? null : vo.getUnit()) + .set(Product::getShortName, + StringUtil.isBlank(vo.getShortName()) ? null : vo.getShortName()) + .set(Product::getCategoryId, + StringUtil.isBlank(vo.getCategoryId()) ? null : vo.getCategoryId()) + .set(Product::getBrandId, StringUtil.isBlank(vo.getBrandId()) ? null : vo.getBrandId()) + .set(Product::getTaxRate, vo.getTaxRate() == null ? BigDecimal.ZERO : vo.getTaxRate()) + .set(Product::getSaleTaxRate, + vo.getSaleTaxRate() == null ? BigDecimal.ZERO : vo.getSaleTaxRate()) + .set(Product::getWeight, vo.getWeight()) + .set(Product::getVolume, vo.getVolume()) + .eq(Product::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + // 组合商品 + if (data.getProductType() == ProductType.BUNDLE) { + if (CollectionUtil.isEmpty(vo.getProductBundles())) { + throw new DefaultClientException("单品数据不能为空!"); + } + + BigDecimal purchasePrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getPurchasePrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getPurchasePrice(), purchasePrice)) { + throw new DefaultClientException("单品的采购价设置错误!"); + } + + BigDecimal salePrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getSalePrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getSalePrice(), salePrice)) { + throw new DefaultClientException("单品的销售价设置错误!"); + } + + BigDecimal retailPrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getRetailPrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getRetailPrice(), retailPrice)) { + throw new DefaultClientException("单品的零售价设置错误!"); + } + + Wrapper deleteBundleWrapper = Wrappers.lambdaQuery(ProductBundle.class) + .eq(ProductBundle::getMainProductId, data.getId()); + productBundleService.remove(deleteBundleWrapper); + + List productBundles = vo.getProductBundles().stream().map(productBundleVo -> { + ProductBundle productBundle = new ProductBundle(); + productBundle.setId(IdUtil.getId()); + productBundle.setMainProductId(data.getId()); + productBundle.setProductId(productBundleVo.getProductId()); + productBundle.setBundleNum(productBundleVo.getBundleNum()); + productBundle.setPurchasePrice(productBundleVo.getPurchasePrice()); + productBundle.setSalePrice(productBundleVo.getSalePrice()); + productBundle.setRetailPrice(productBundleVo.getRetailPrice()); + + return productBundle; + }).collect(Collectors.toList()); + + productBundleService.saveBatch(productBundles); + } + + productPropertyRelationService.deleteByProductId(data.getId()); + if (!CollectionUtil.isEmpty(vo.getProperties())) { + // 商品和商品属性的关系 + for (ProductPropertyRelationVo property : vo.getProperties()) { + ProductProperty productProperty = productPropertyService.findById(property.getId()); + if (productProperty == null) { + throw new DefaultClientException("商品属性不存在!"); + } + if (productProperty.getColumnType() == ColumnType.SINGLE) { + ProductPropertyItem propertyItem = productPropertyItemService.findById( + property.getText()); + if (propertyItem == null) { + throw new DefaultClientException("商品属性值不存在!"); + } + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItem.getId()); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } else if (productProperty.getColumnType() == ColumnType.MULTIPLE) { + + List propertyItemIds = JsonUtil.parseList(property.getText(), String.class); + for (String propertyItemId : propertyItemIds) { + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItemId); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } + + } else if (productProperty.getColumnType() == ColumnType.CUSTOM) { + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyText(property.getText()); + productPropertyRelationService.create(createProductPropertyRelationVo); + } else { + throw new DefaultClientException("商品属性字段类型不存在!"); + } + } + } + + productPurchaseService.removeById(data.getId()); + + if (vo.getPurchasePrice() != null) { + + UpdateProductPurchaseVo updateProductPurchaseVo = new UpdateProductPurchaseVo(); + updateProductPurchaseVo.setId(data.getId()); + updateProductPurchaseVo.setPrice(vo.getPurchasePrice()); + + productPurchaseService.update(updateProductPurchaseVo); + } + + productSaleService.removeById(data.getId()); + + if (vo.getSalePrice() != null) { + UpdateProductSaleVo updateProductSaleVo = new UpdateProductSaleVo(); + updateProductSaleVo.setId(data.getId()); + updateProductSaleVo.setPrice(vo.getSalePrice()); + + productSaleService.update(updateProductSaleVo); + } + + productRetailService.removeById(data.getId()); + if (vo.getRetailPrice() != null) { + UpdateProductRetailVo updateProductRetailVo = new UpdateProductRetailVo(); + updateProductRetailVo.setId(data.getId()); + updateProductRetailVo.setPrice(vo.getRetailPrice()); + + productRetailService.update(updateProductRetailVo); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public List getByCategoryIds(List categoryIds, Integer productType) { + + if (CollectionUtil.isEmpty(categoryIds)) { + return CollectionUtil.emptyList(); + } + + // 根据categoryIds查询所有叶子节点 + List children = new ArrayList<>(); + for (String categoryId : categoryIds) { + children.addAll(recursionMappingService.getNodeChildIds(categoryId, + ProductCategoryNodeType.class)); + } + + children.addAll(categoryIds); + + children = children.stream().distinct().collect(Collectors.toList()); + + List datas = getBaseMapper().getByCategoryIds(children, productType); + + return datas; + } + + @Override + public List getByBrandIds(List brandIds, Integer productType) { + + if (CollectionUtil.isEmpty(brandIds)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByBrandIds(brandIds, productType); + } + + @CacheEvict(value = Product.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/shop/ShopServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/shop/ShopServiceImpl.java new file mode 100644 index 0000000..d548a5b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/shop/ShopServiceImpl.java @@ -0,0 +1,157 @@ +package com.lframework.xingyun.basedata.impl.shop; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.events.DeleteShopEvent; +import com.lframework.xingyun.basedata.mappers.ShopMapper; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.vo.shop.CreateShopVo; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import com.lframework.xingyun.basedata.vo.shop.UpdateShopVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class ShopServiceImpl extends BaseMpServiceImpl implements ShopService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryShopVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryShopVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Shop.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Shop findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除门店,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Shop.class) + .set(Shop::getAvailable, Boolean.FALSE) + .eq(Shop::getId, id); + getBaseMapper().update(updateWrapper); + + Shop record = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteShopEvent.class, record); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增门店,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateShopVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, vo.getCode()) + .eq(Shop::getAvailable, Boolean.TRUE); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Shop data = new Shop(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getDeptId())) { + data.setDeptId(vo.getDeptId()); + } + if (vo.getLng() != null) { + data.setLng(vo.getLng()); + } + if (vo.getLat() != null) { + data.setLat(vo.getLat()); + } + if (!StringUtil.isBlank(vo.getDescription())) { + data.setDescription(vo.getDescription()); + } + + data.setAvailable(Boolean.TRUE); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改门店,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateShopVo vo) { + + Shop data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("门店不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, vo.getCode()) + .eq(Shop::getAvailable, Boolean.TRUE) + .ne(Shop::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Shop.class) + .set(Shop::getCode, vo.getCode()) + .set(Shop::getName, vo.getName()) + .set(Shop::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId()) + .set(Shop::getLng, vo.getLng() == null ? null : vo.getLng()) + .set(Shop::getLat, vo.getLat() == null ? null : vo.getLat()) + .set(Shop::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(Shop::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = Shop.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/storecenter/StoreCenterServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/storecenter/StoreCenterServiceImpl.java new file mode 100644 index 0000000..cb591da --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/storecenter/StoreCenterServiceImpl.java @@ -0,0 +1,208 @@ +package com.lframework.xingyun.basedata.impl.storecenter; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.events.DeleteStoreCenterEvent; +import com.lframework.xingyun.basedata.mappers.StoreCenterMapper; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.vo.storecenter.CreateStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.UpdateStoreCenterVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class StoreCenterServiceImpl extends BaseMpServiceImpl + implements StoreCenterService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryStoreCenterVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = StoreCenter.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public StoreCenter findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除仓库,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StoreCenter.class) + .set(StoreCenter::getAvailable, Boolean.FALSE) + .eq(StoreCenter::getId, id); + getBaseMapper().update(updateWrapper); + + StoreCenter record = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteStoreCenterEvent.class, record); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增仓库,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateStoreCenterVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, vo.getCode()) + .eq(StoreCenter::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + StoreCenter data = new StoreCenter(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + data.setAvailable(Boolean.TRUE); + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + + if (vo.getPeopleNum() != null) { + if (vo.getPeopleNum() < 0) { + throw new InputErrorException("仓库人数不允许小于0!"); + } + data.setPeopleNum(vo.getPeopleNum()); + } + + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改仓库,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateStoreCenterVo vo) { + + StoreCenter data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, vo.getCode()) + .eq(StoreCenter::getAvailable, Boolean.TRUE) + .ne(StoreCenter::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(StoreCenter.class) + .set(StoreCenter::getCode, vo.getCode()).set(StoreCenter::getName, vo.getName()) + .set(StoreCenter::getContact, !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(StoreCenter::getTelephone, + !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(StoreCenter::getAddress, !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(StoreCenter::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(StoreCenter::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(StoreCenter::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(StoreCenter::getCityId, null); + } + + if (vo.getPeopleNum() != null) { + if (vo.getPeopleNum() < 0) { + throw new InputErrorException("仓库人数不允许小于0!"); + } + updateWrapper.set(StoreCenter::getPeopleNum, vo.getPeopleNum()); + } else { + updateWrapper.set(StoreCenter::getPeopleNum, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryStoreCenterSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = StoreCenter.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/supplier/SupplierServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/supplier/SupplierServiceImpl.java new file mode 100644 index 0000000..ee62cbe --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/supplier/SupplierServiceImpl.java @@ -0,0 +1,243 @@ +package com.lframework.xingyun.basedata.impl.supplier; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.event.DataChangeEventBuilder; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.events.DeleteSupplierEvent; +import com.lframework.xingyun.basedata.mappers.SupplierMapper; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.supplier.CreateSupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.UpdateSupplierVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class SupplierServiceImpl extends BaseMpServiceImpl implements + SupplierService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySupplierVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySupplierVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Supplier.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Supplier findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.class, name = "删除供应商,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Supplier.class) + .set(Supplier::getAvailable, Boolean.FALSE) + .eq(Supplier::getId, id); + getBaseMapper().update(updateWrapper); + + Supplier record = this.findById(id); + + DataChangeEventBuilder.publishLogicDelete(this, DeleteSupplierEvent.class, record); + } + + @OpLog(type = BaseDataOpLogType.class, name = "新增供应商,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSupplierVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, vo.getCode()) + .eq(Supplier::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Supplier data = new Supplier(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getMnemonicCode())) { + data.setMnemonicCode(vo.getMnemonicCode()); + } + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getEmail())) { + data.setEmail(vo.getEmail()); + } + if (!StringUtil.isBlank(vo.getZipCode())) { + data.setZipCode(vo.getZipCode()); + } + if (!StringUtil.isBlank(vo.getFax())) { + data.setFax(vo.getFax()); + } + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + if (vo.getDeliveryCycle() != null) { + data.setDeliveryCycle(vo.getDeliveryCycle()); + } + data.setManageType(EnumUtil.getByCode(ManageType.class, vo.getManageType())); + + data.setSettleType(EnumUtil.getByCode(SettleType.class, vo.getSettleType())); + + if (!StringUtil.isBlank(vo.getCreditCode())) { + data.setCreditCode(vo.getCreditCode()); + } + if (!StringUtil.isBlank(vo.getTaxIdentifyNo())) { + data.setTaxIdentifyNo(vo.getTaxIdentifyNo()); + } + if (!StringUtil.isBlank(vo.getBankName())) { + data.setBankName(vo.getBankName()); + } + if (!StringUtil.isBlank(vo.getAccountName())) { + data.setAccountName(vo.getAccountName()); + } + if (!StringUtil.isBlank(vo.getAccountNo())) { + data.setAccountNo(vo.getAccountNo()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.class, name = "修改供应商,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSupplierVo vo) { + + Supplier data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("供应商不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, vo.getCode()) + .eq(Supplier::getAvailable, Boolean.TRUE) + .ne(Supplier::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Supplier.class) + .set(Supplier::getCode, vo.getCode()).set(Supplier::getName, vo.getName()) + .set(Supplier::getMnemonicCode, + !StringUtil.isBlank(vo.getMnemonicCode()) ? vo.getMnemonicCode() : null) + .set(Supplier::getContact, !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(Supplier::getTelephone, + !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(Supplier::getEmail, !StringUtil.isBlank(vo.getEmail()) ? vo.getEmail() : null) + .set(Supplier::getZipCode, !StringUtil.isBlank(vo.getZipCode()) ? vo.getZipCode() : null) + .set(Supplier::getFax, !StringUtil.isBlank(vo.getFax()) ? vo.getFax() : null) + .set(Supplier::getAddress, !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(Supplier::getDeliveryCycle, vo.getDeliveryCycle()) + .set(Supplier::getCreditCode, + !StringUtil.isBlank(vo.getCreditCode()) ? vo.getCreditCode() : null) + .set(Supplier::getTaxIdentifyNo, + !StringUtil.isBlank(vo.getTaxIdentifyNo()) ? vo.getTaxIdentifyNo() : null) + .set(Supplier::getBankName, !StringUtil.isBlank(vo.getBankName()) ? vo.getBankName() : null) + .set(Supplier::getAccountName, + !StringUtil.isBlank(vo.getAccountName()) ? vo.getAccountName() : null) + .set(Supplier::getAccountNo, + !StringUtil.isBlank(vo.getAccountNo()) ? vo.getAccountNo() : null) + .set(Supplier::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(Supplier::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(Supplier::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(Supplier::getCityId, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QuerySupplierSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = Supplier.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AddressMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AddressMapper.java new file mode 100644 index 0000000..df6c41f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AddressMapper.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2023-03-26 + */ +public interface AddressMapper extends BaseMapper
{ + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "createTime", alias = "tb", autoParse = true) + }) + List
query(@Param("vo") QueryAddressVo vo); + + /** + * 选择器 + * + * @return + */ + List
selector(@Param("vo") AddressSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CustomerMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CustomerMapper.java new file mode 100644 index 0000000..da0f44b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CustomerMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-10 + */ +public interface CustomerMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryCustomerVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryCustomerSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/LogisticsCompanyMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/LogisticsCompanyMapper.java new file mode 100644 index 0000000..18bd613 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/LogisticsCompanyMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 物流公司 Mapper 接口 + *

+ * + * @author zmj + * @since 2023-06-02 + */ +public interface LogisticsCompanyMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryLogisticsCompanyVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryLogisticsCompanySelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/MemberMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/MemberMapper.java new file mode 100644 index 0000000..ca75c68 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/MemberMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface MemberMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryMemberVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryMemberSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PayTypeMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PayTypeMapper.java new file mode 100644 index 0000000..f7fdf03 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PayTypeMapper.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface PayTypeMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryPayTypeVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") PayTypeSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateCompMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateCompMapper.java new file mode 100644 index 0000000..a97cdd8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateCompMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.PrintTemplateComp; + +/** + *

+ * 打印模板组件 Mapper 接口 + *

+ * + * @author zmj + * @since 2025-01-28 + */ +public interface PrintTemplateCompMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateMapper.java new file mode 100644 index 0000000..9726d17 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PrintTemplateMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.PrintTemplate; +import com.lframework.xingyun.basedata.vo.print.QueryPrintTemplateVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 打印模板 Mapper 接口 + *

+ * + * @author zmj + * @since 2025-01-28 + */ +public interface PrintTemplateMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "name", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryPrintTemplateVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBrandMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBrandMapper.java new file mode 100644 index 0000000..201f5db --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBrandMapper.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-06 + */ +public interface ProductBrandMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + }) + List query(@Param("vo") QueryProductBrandVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryProductBrandSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBundleMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBundleMapper.java new file mode 100644 index 0000000..ceaf540 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBundleMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductBundle; + +/** + *

+ * 组合商品 Mapper 接口 + *

+ * + * @author zmj + * @since 2023-05-26 + */ +public interface ProductBundleMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryMapper.java new file mode 100644 index 0000000..5edb342 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryMapper.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-05 + */ +public interface ProductCategoryMapper extends BaseMapper { + + /** + * 查询全部分类信息 + * + * @return + */ + List getAllProductCategories(); + + /** + * 选择器 + * + * @return + */ + List selector(@Param("vo") QueryProductCategorySelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryPropertyMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryPropertyMapper.java new file mode 100644 index 0000000..0e567e6 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryPropertyMapper.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-05 + */ +public interface ProductCategoryPropertyMapper extends BaseMapper { + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductMapper.java new file mode 100644 index 0000000..ebf4ac4 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductMapper.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + @Sorts({ + @Sort(value = "code", alias = "g", autoParse = true), + @Sort(value = "name", alias = "g", autoParse = true), + @Sort(value = "createTime", alias = "g", autoParse = true), + @Sort(value = "updateTime", alias = "g", autoParse = true), + }) + List query(@Param("vo") QueryProductVo vo); + + /** + * 查询商品品种数 + * + * @param vo + * @return + */ + Integer queryCount(@Param("vo") QueryProductVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List selector(@Param("vo") QueryProductSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Product findById(String id); + + /** + * 查询没有属性的ID + * + * @param propertyId + * @return + */ + List getIdNotInProductProperty(String propertyId); + + /** + * 根据分类ID查询 + * + * @param categoryId + * @return + */ + List getIdByCategoryId(String categoryId); + + /** + * 根据分类ID查询 + * + * @param categoryIds + * @return + */ + List getByCategoryIds(@Param("categoryIds") List categoryIds, + @Param("productType") Integer productType); + + /** + * 根据品牌ID查询 + * + * @param brandIds + * @return + */ + List getByBrandIds(@Param("brandIds") List brandIds, + @Param("productType") Integer productType); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyItemMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyItemMapper.java new file mode 100644 index 0000000..32fe021 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyItemMapper.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-08-08 + */ +public interface ProductPropertyItemMapper extends BaseMapper { + + /** + * 查询里诶包 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryProductPropertyItemVo vo); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyMapper.java new file mode 100644 index 0000000..1ccefe4 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductPropertyMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "p", autoParse = true), + @Sort(value = "name", alias = "p", autoParse = true), + }) + List query(@Param("vo") QueryProductPropertyVo vo); + + /** + * 根据商品分类查询 + * + * @param categoryIds + * @return + */ + List getModelorByCategoryId(@Param("categoryIds") Collection categoryIds); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyRelationMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyRelationMapper.java new file mode 100644 index 0000000..5874503 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyRelationMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-08-05 + */ +public interface ProductPropertyRelationMapper extends BaseMapper { + + /** + * 根据商品ID查询 + * + * @param productId + * @return + */ + List getByProductId(String productId); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); + + /** + * 将通用更改为指定分类 + * + * @param propertyId + * @param categoryId + */ + void setCommonToAppoint(@Param("propertyId") String propertyId, @Param("categoryId") String categoryId); + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPurchaseMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPurchaseMapper.java new file mode 100644 index 0000000..facedc3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPurchaseMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductPurchase; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductPurchaseMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductRetailMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductRetailMapper.java new file mode 100644 index 0000000..7aec026 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductRetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductRetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductRetailMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductSaleMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductSaleMapper.java new file mode 100644 index 0000000..212cc99 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductSaleMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductSale; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductSaleMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ShopMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ShopMapper.java new file mode 100644 index 0000000..bdb07fe --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ShopMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 门店 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ShopMapper extends BaseMapper { + + /** + * 查询列表 + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryShopVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/StoreCenterMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/StoreCenterMapper.java new file mode 100644 index 0000000..ee8dfab --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/StoreCenterMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-07 + */ +public interface StoreCenterMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryStoreCenterVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryStoreCenterSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/SupplierMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/SupplierMapper.java new file mode 100644 index 0000000..f587a03 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/SupplierMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface SupplierMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QuerySupplierVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QuerySupplierSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/address/AddressService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/address/AddressService.java new file mode 100644 index 0000000..5da764e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/address/AddressService.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.service.address; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import com.lframework.xingyun.basedata.vo.address.UpdateAddressVo; + +import java.util.List; + +/** + * 地址库 Service + * + * @author zmj + */ +public interface AddressService extends BaseMpService
{ + + /** + * 查询列表 + * + * @return + */ + PageResult
query(Integer pageIndex, Integer pageSize, QueryAddressVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List
query(QueryAddressVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult
selector(Integer pageIndex, Integer pageSize, + AddressSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Address findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateAddressVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateAddressVo vo); + + /** + * 查询默认地址 + * + * @param entityId + * @param entityType + * @param addressType + * @return + */ + Address getDefaultAddress(String entityId, Integer entityType, Integer addressType); + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/customer/CustomerService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/customer/CustomerService.java new file mode 100644 index 0000000..40c9064 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/customer/CustomerService.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.basedata.service.customer; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVo; + +import java.util.List; + +public interface CustomerService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryCustomerVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Customer findById(String id); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryCustomerSelectorVo vo); + + /** + * 根据ID删除(逻辑删除) + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/logistics/LogisticsCompanyService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/logistics/LogisticsCompanyService.java new file mode 100644 index 0000000..f816e96 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/logistics/LogisticsCompanyService.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.basedata.service.logistics; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.vo.logistics.company.CreateLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.UpdateLogisticsCompanyVo; + +import java.util.List; + +public interface LogisticsCompanyService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanyVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryLogisticsCompanyVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + LogisticsCompany findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateLogisticsCompanyVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateLogisticsCompanyVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanySelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/member/MemberService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/member/MemberService.java new file mode 100644 index 0000000..97b8e76 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/member/MemberService.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.basedata.service.member; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.vo.member.CreateMemberVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import com.lframework.xingyun.basedata.vo.member.UpdateMemberVo; + +import java.util.List; + +public interface MemberService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryMemberVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryMemberVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Member findById(String id); + + /** + * 根据ID删除(逻辑删除) + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateMemberVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateMemberVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryMemberSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/paytype/PayTypeService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/paytype/PayTypeService.java new file mode 100644 index 0000000..561b469 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/paytype/PayTypeService.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.basedata.service.paytype; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.vo.paytype.CreatePayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.UpdatePayTypeVo; + +import java.util.List; + +public interface PayTypeService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryPayTypeVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPayTypeVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + PayTypeSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PayType findById(String id); + + /** + * 根据ID删除(逻辑删除) + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreatePayTypeVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePayTypeVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateCompService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateCompService.java new file mode 100644 index 0000000..67acd69 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateCompService.java @@ -0,0 +1,11 @@ +package com.lframework.xingyun.basedata.service.print; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.PrintTemplateComp; + +import java.util.List; + +public interface PrintTemplateCompService extends BaseMpService { + + List getCompJsonByTemplateId(Integer templateId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateService.java new file mode 100644 index 0000000..54240e5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/print/PrintTemplateService.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.basedata.service.print; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.PrintTemplate; +import com.lframework.xingyun.basedata.vo.print.*; + +import java.util.List; + +public interface PrintTemplateService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryPrintTemplateVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPrintTemplateVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PrintTemplate findById(Integer id); + + /** + * 创建 + * + * @param vo + * @return + */ + Integer create(CreatePrintTemplateVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePrintTemplateVo vo); + + /** + * 保存设置 + * + * @param vo + */ + void updateSetting(UpdatePrintTemplateSettingVo vo); + + /** + * 保存示例数据 + * + * @param vo + */ + void updateDemoData(UpdatePrintTemplateDemoDataVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBrandService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBrandService.java new file mode 100644 index 0000000..071953e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBrandService.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.vo.product.brand.CreateProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.UpdateProductBrandVo; + +import java.util.List; + +public interface ProductBrandService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductBrandVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductBrandVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + QueryProductBrandSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductBrand findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductBrandVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductBrandVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBundleService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBundleService.java new file mode 100644 index 0000000..1264f27 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBundleService.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductBundle; + +import java.util.List; + +public interface ProductBundleService extends BaseMpService { + + /** + * 根据组合商品ID查询 + * @param id + * @return + */ + List getByMainProductId(String id); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryPropertyService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryPropertyService.java new file mode 100644 index 0000000..c091163 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryPropertyService.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; + +import java.util.List; + +public interface ProductCategoryPropertyService extends BaseMpService { + + /** + * 创建 + * + * @param categoryId + * @param propertyId + * @return + */ + String create(String categoryId, String propertyId); + + /** + * 根据属性ID删除 + * + * @param propertyId + */ + void deleteByPropertyId(String propertyId); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryService.java new file mode 100644 index 0000000..fc99d43 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryService.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.vo.product.category.CreateProductCategoryVo; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import com.lframework.xingyun.basedata.vo.product.category.UpdateProductCategoryVo; + +import java.util.List; + +public interface ProductCategoryService extends BaseMpService { + + /** + * 查询全部分类信息 + * + * @return + */ + List getAllProductCategories(); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductCategory findById(String id); + + /** + * 选择器 + * + * @return + */ + List selector(QueryProductCategorySelectorVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductCategoryVo vo); + + /** + * 保存关系 + * + * @param categoryId + * @param parentId + */ + void saveRecursion(Boolean isCreate, String categoryId, String parentId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyItemService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyItemService.java new file mode 100644 index 0000000..4868821 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyItemService.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.vo.product.property.item.CreateProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.UpdateProductPropertyItemVo; + +import java.util.List; + +public interface ProductPropertyItemService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryProductPropertyItemVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductPropertyItemVo vo); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductPropertyItem findById(String id); + + /** + * 新增 + * + * @param vo + * @return + */ + String create(CreateProductPropertyItemVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductPropertyItemVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyRelationService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyRelationService.java new file mode 100644 index 0000000..14f0b46 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyRelationService.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.vo.product.property.realtion.CreateProductPropertyRelationVo; + +import java.util.List; + +public interface ProductPropertyRelationService extends BaseMpService { + + /** + * 根据商品Id查询 + * + * @param productId + * @return + */ + List getByProductId(String productId); + + /** + * 将多选属性更改为单选属性 + * + * @param propertyId + */ + void setMultipleToSimple(String propertyId); + + /** + * 从通用改为指定分类 + * + * @param propertyId + */ + void setCommonToAppoint(String propertyId); + + /** + * 从指定分类改为通用 + * + * @param propertyId + */ + void setAppointToCommon(String propertyId); + + /** + * 修改指定分类的分类ID + * + * @param propertyId + */ + void updateAppointCategoryId(String propertyId); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductPropertyRelationVo vo); + + /** + * 根据商品Id删除 + * + * @param productId + */ + void deleteByProductId(String productId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyService.java new file mode 100644 index 0000000..928fdaa --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyService.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.vo.product.property.CreateProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.UpdateProductPropertyVo; + +import java.util.List; + +public interface ProductPropertyService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductPropertyVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductPropertyVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductProperty findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductPropertyVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductPropertyVo vo); + + /** + * 根据分类ID查询 + * + * @param categoryId + * @return + */ + List getModelorByCategoryId(String categoryId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPurchaseService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPurchaseService.java new file mode 100644 index 0000000..7fcb957 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPurchaseService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.purchase.UpdateProductPurchaseVo; + +public interface ProductPurchaseService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductPurchaseVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductPurchaseVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductRetailService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductRetailService.java new file mode 100644 index 0000000..7af45ac --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductRetailService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductRetail; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.retail.UpdateProductRetailVo; + +public interface ProductRetailService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductRetailVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductRetailVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductSaleService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductSaleService.java new file mode 100644 index 0000000..24524bc --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductSaleService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductSale; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import com.lframework.xingyun.basedata.vo.product.sale.UpdateProductSaleVo; + +public interface ProductSaleService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductSaleVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductSaleVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java new file mode 100644 index 0000000..e1e02ed --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.vo.product.info.CreateProductVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo; + +import java.util.List; + +public interface ProductService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryProductSelectorVo vo); + + /** + * 查询商品品种数 + * + * @param vo + * @return + */ + Integer queryCount(QueryProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Product findById(String id); + + /** + * 查询没有属性的ID + * + * @param propertyId + * @return + */ + List getIdNotInProductProperty(String propertyId); + + /** + * 根据分类ID查询 + * + * @param categoryId + * @return + */ + List getIdByCategoryId(String categoryId); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductVo vo); + + /** + * 根据分类ID查询 + * + * @param categoryIds + * @return + */ + List getByCategoryIds(List categoryIds, Integer productType); + + /** + * 根据品牌ID查询 + * + * @param brandIds + * @return + */ + List getByBrandIds(List brandIds, Integer productType); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/shop/ShopService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/shop/ShopService.java new file mode 100644 index 0000000..5ef8903 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/shop/ShopService.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.basedata.service.shop; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.vo.shop.CreateShopVo; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import com.lframework.xingyun.basedata.vo.shop.UpdateShopVo; + +import java.util.List; + +/** + * 门店 Service + * + * @author zmj + */ +public interface ShopService extends BaseMpService { + + /** + * 查询列表 + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryShopVo vo); + + /** + * 查询列表 + * @param vo + * @return + */ + List query(QueryShopVo vo); + + /** + * 根据ID查询 + * @param id + * @return + */ + Shop findById(String id); + + /** + * 根据ID删除(逻辑删除) + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * @param vo + * @return + */ + String create(CreateShopVo vo); + + /** + * 修改 + * @param vo + */ + void update(UpdateShopVo vo); + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/storecenter/StoreCenterService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/storecenter/StoreCenterService.java new file mode 100644 index 0000000..b438bf5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/storecenter/StoreCenterService.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.basedata.service.storecenter; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.vo.storecenter.CreateStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.UpdateStoreCenterVo; + +public interface StoreCenterService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryStoreCenterVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StoreCenter findById(String id); + + /** + * 根据ID删除(逻辑删除) + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateStoreCenterVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateStoreCenterVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryStoreCenterSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/supplier/SupplierService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/supplier/SupplierService.java new file mode 100644 index 0000000..55ee890 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/supplier/SupplierService.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.basedata.service.supplier; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.vo.supplier.CreateSupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.UpdateSupplierVo; + +import java.util.List; + +public interface SupplierService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySupplierVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySupplierVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Supplier findById(String id); + + /** + * 根据ID删除(逻辑删除) + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSupplierVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSupplierVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QuerySupplierSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/AddressSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/AddressSelectorVo.java new file mode 100644 index 0000000..d9fe566 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/AddressSelectorVo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class AddressSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 实体ID + */ + @Schema(description = "实体ID") + private String entityId; + + /** + * 实体类型 + */ + @Schema(description = "实体类型") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @Schema(description = "地址类型") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String telephone; + + /** + * 详细地址 + */ + @Schema(description = "详细地址") + private String address; + + /** + * 是否默认地址 + */ + @Schema(description = "是否默认地址") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/CreateAddressVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/CreateAddressVo.java new file mode 100644 index 0000000..d03c9b9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/CreateAddressVo.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateAddressVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 实体ID + */ + @Schema(description = "实体ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "实体ID不能为空!") + private String entityId; + + /** + * 实体类型 + */ + @Schema(description = "实体类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "实体类型不能为空!") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @Schema(description = "地址类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "地址类型不能为空!") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "姓名不能为空!") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "地区ID不能为空!") + private String cityId; + + /** + * 详细地址 + */ + @Schema(description = "详细地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "详细地址不能为空!") + private String address; + + /** + * 是否默认地址 + */ + @Schema(description = "是否默认地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否默认地址不能为空!") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/QueryAddressVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/QueryAddressVo.java new file mode 100644 index 0000000..0e72f0d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/QueryAddressVo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryAddressVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 实体类型 + */ + @Schema(description = "实体类型") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @Schema(description = "地址类型") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String telephone; + + /** + * 详细地址 + */ + @Schema(description = "详细地址") + private String address; + + /** + * 是否默认地址 + */ + @Schema(description = "是否默认地址") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/UpdateAddressVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/UpdateAddressVo.java new file mode 100644 index 0000000..080d379 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/UpdateAddressVo.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateAddressVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 实体ID + */ + @Schema(description = "实体ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "实体ID不能为空!") + private String entityId; + + /** + * 实体类型 + */ + @Schema(description = "实体类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "实体类型不能为空!") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @Schema(description = "地址类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "地址类型不能为空!") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "姓名不能为空!") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "地区ID不能为空!") + private String cityId; + + /** + * 详细地址 + */ + @Schema(description = "详细地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "详细地址不能为空!") + private String address; + + /** + * 是否默认地址 + */ + @Schema(description = "是否默认地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否默认地址不能为空!") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/CreateCustomerVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/CreateCustomerVo.java new file mode 100644 index 0000000..afa299b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/CreateCustomerVo.java @@ -0,0 +1,128 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.SettleType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateCustomerVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简码 + */ + @Schema(description = "简码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入简码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @Schema(description = "邮编") + private String zipCode; + + /** + * 传真 + */ + @Schema(description = "传真") + private String fax; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 结算方式 + */ + @Schema(description = "结算方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择结算方式!") + @IsEnum(message = "请选择结算方式!", enumClass = SettleType.class) + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @Schema(description = "统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @Schema(description = "纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @Schema(description = "开户银行") + private String bankName; + + /** + * 户名 + */ + @Schema(description = "户名") + private String accountName; + + /** + * 银行账号 + */ + @Schema(description = "银行账号") + private String accountNo; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerSelectorVo.java new file mode 100644 index 0000000..21a19cc --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryCustomerSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerVo.java new file mode 100644 index 0000000..c626f4d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryCustomerVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/UpdateCustomerVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/UpdateCustomerVo.java new file mode 100644 index 0000000..70c63d1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/UpdateCustomerVo.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateCustomerVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简码 + */ + @Schema(description = "简码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入简码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @Schema(description = "邮编") + private String zipCode; + + /** + * 传真 + */ + @Schema(description = "传真") + private String fax; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 统一社会信用代码 + */ + @Schema(description = "统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @Schema(description = "纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @Schema(description = "开户银行") + private String bankName; + + /** + * 户名 + */ + @Schema(description = "户名") + private String accountName; + + /** + * 银行账号 + */ + @Schema(description = "银行账号") + private String accountNo; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/CreateLogisticsCompanyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/CreateLogisticsCompanyVo.java new file mode 100644 index 0000000..a0ed4d2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/CreateLogisticsCompanyVo.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateLogisticsCompanyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanySelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanySelectorVo.java new file mode 100644 index 0000000..29a5b60 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanySelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryLogisticsCompanySelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanyVo.java new file mode 100644 index 0000000..b6272a3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanyVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryLogisticsCompanyVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/UpdateLogisticsCompanyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/UpdateLogisticsCompanyVo.java new file mode 100644 index 0000000..4edb602 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/UpdateLogisticsCompanyVo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateLogisticsCompanyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/CreateMemberVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/CreateMemberVo.java new file mode 100644 index 0000000..e80472a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/CreateMemberVo.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.inner.enums.system.Gender; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; + +@Data +public class CreateMemberVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 性别 + */ + @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择性别!") + @IsEnum(message = "请选择性别!", enumClass = Gender.class) + private Integer gender; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 出生日期 + */ + @Schema(description = "出生日期") + private LocalDate birthday; + + + /** + * 入会日期 + */ + @Schema(description = "入会日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "入会日期不能为空!") + private LocalDate joinDay; + + /** + * 所属门店ID + */ + @Schema(description = "所属门店ID") + private String shopId; + + /** + * 所属导购ID + */ + @Schema(description = "所属导购ID") + private String guiderId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberSelectorVo.java new file mode 100644 index 0000000..b1f094d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryMemberSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberVo.java new file mode 100644 index 0000000..fa012e8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryMemberVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/UpdateMemberVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/UpdateMemberVo.java new file mode 100644 index 0000000..a0ac323 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/UpdateMemberVo.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.inner.enums.system.Gender; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; + +@Data +public class UpdateMemberVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 性别 + */ + @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择性别!") + @IsEnum(message = "请选择性别!", enumClass = Gender.class) + private Integer gender; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 出生日期 + */ + @Schema(description = "出生日期") + private LocalDate birthday; + + /** + * 入会日期 + */ + @Schema(description = "入会日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "入会日期不能为空!") + private LocalDate joinDay; + + /** + * 所属门店ID + */ + @Schema(description = "所属门店ID") + private String shopId; + + /** + * 所属导购ID + */ + @Schema(description = "所属导购ID") + private String guiderId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/CreatePayTypeVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/CreatePayTypeVo.java new file mode 100644 index 0000000..9d94fb6 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/CreatePayTypeVo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreatePayTypeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否记录内容 + */ + @Schema(description = "是否记录内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否记录内容不能为空!") + private Boolean recText; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/PayTypeSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/PayTypeSelectorVo.java new file mode 100644 index 0000000..d4d5ec8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/PayTypeSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PayTypeSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/QueryPayTypeVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/QueryPayTypeVo.java new file mode 100644 index 0000000..4940c6b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/QueryPayTypeVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryPayTypeVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/UpdatePayTypeVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/UpdatePayTypeVo.java new file mode 100644 index 0000000..e75f2a8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/UpdatePayTypeVo.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdatePayTypeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否记录内容 + */ + @Schema(description = "是否记录内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否记录内容不能为空!") + private Boolean recText; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/CreatePrintTemplateVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/CreatePrintTemplateVo.java new file mode 100644 index 0000000..04dcdd8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/CreatePrintTemplateVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.basedata.vo.print; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreatePrintTemplateVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/QueryPrintTemplateVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/QueryPrintTemplateVo.java new file mode 100644 index 0000000..60fde08 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/QueryPrintTemplateVo.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.basedata.vo.print; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryPrintTemplateVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateDemoDataVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateDemoDataVo.java new file mode 100644 index 0000000..9bed1e2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateDemoDataVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.basedata.vo.print; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdatePrintTemplateDemoDataVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private Integer id; + + /** + * 示例数据 + */ + @Schema(description = "示例数据", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "示例数据不能为空!") + private String demoData; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateSettingVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateSettingVo.java new file mode 100644 index 0000000..da37a34 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateSettingVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.basedata.vo.print; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdatePrintTemplateSettingVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private Integer id; + + /** + * 模板配置 + */ + @Schema(description = "模板配置", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "模板配置不能为空!") + private String templateJson; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateVo.java new file mode 100644 index 0000000..51fdb38 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/print/UpdatePrintTemplateVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.basedata.vo.print; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdatePrintTemplateVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private Integer id; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/CreateProductBrandVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/CreateProductBrandVo.java new file mode 100644 index 0000000..6937b1b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/CreateProductBrandVo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.UploadUrl; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateProductBrandVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * logo + */ + @Schema(description = "logo") + @UploadUrl(message = "logo文件格式有误!") + private String logo; + + /** + * 简介 + */ + @Schema(description = "简介") + private String introduction; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandSelectorVo.java new file mode 100644 index 0000000..270a3fa --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductBrandSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandVo.java new file mode 100644 index 0000000..02ebe03 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductBrandVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/UpdateProductBrandVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/UpdateProductBrandVo.java new file mode 100644 index 0000000..de48e11 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/UpdateProductBrandVo.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.UploadUrl; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateProductBrandVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * logo + */ + @Schema(description = "logo") + @UploadUrl(message = "logo文件格式有误!") + private String logo; + + /** + * 简介 + */ + @Schema(description = "简介") + private String introduction; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/CreateProductCategoryVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/CreateProductCategoryVo.java new file mode 100644 index 0000000..b9808e6 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/CreateProductCategoryVo.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.basedata.vo.product.category; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateProductCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "编号不能为空!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 父级ID + */ + @Schema(description = "父级ID") + private String parentId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/QueryProductCategorySelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/QueryProductCategorySelectorVo.java new file mode 100644 index 0000000..772e35b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/QueryProductCategorySelectorVo.java @@ -0,0 +1,12 @@ +package com.lframework.xingyun.basedata.vo.product.category; + +import com.lframework.starter.web.core.vo.BaseVo; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductCategorySelectorVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/UpdateProductCategoryVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/UpdateProductCategoryVo.java new file mode 100644 index 0000000..fcc89af --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/UpdateProductCategoryVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.vo.product.category; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateProductCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "编号不能为空!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/CreateProductVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/CreateProductVo.java new file mode 100644 index 0000000..44af306 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/CreateProductVo.java @@ -0,0 +1,151 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class CreateProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * 商品SKU编号 + */ + @Schema(description = "商品SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + @NotBlank(message = "分类ID不能为空!") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 进项税率(%) + */ + @Schema(description = "进项税率(%)") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @Schema(description = "销项税率(%)") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + private BigDecimal saleTaxRate; + + /** + * 商品类型 + */ + @Schema(description = "商品类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "商品类型不能为空!") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; + + /** + * 重量(kg) + */ + @Schema(description = "重量(kg)") + @Digits(integer = 10, fraction = 2, message = "重量最多允许2位小数!") + private BigDecimal weight; + + /** + * 体积(cm3) + */ + @Schema(description = "体积(cm3)") + @Digits(integer = 10, fraction = 2, message = "体积最多允许2位小数!") + private BigDecimal volume; + + /** + * 单品 + */ + @Schema(description = "单品") + @Valid + private List productBundles; + + /** + * 商品属性 + */ + @Schema(description = "商品属性") + @Valid + private List properties; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @Schema(description = "销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @Schema(description = "零售价") + private BigDecimal retailPrice; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductBundleVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductBundleVo.java new file mode 100644 index 0000000..e77463a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductBundleVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.*; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ProductBundleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 包含数量 + */ + @Schema(description = "包含数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "包含数量不能为空!") + @Min(value = 1, message = "包含数量必须大于0!") + private Integer bundleNum; + + /** + * 采购价 + */ + @Schema(description = "采购价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购价不能为空!") + @Digits(integer = 10, fraction = 6, message = "采购价最多允许6位小数!") + @Positive(message = "采购价必须大于0!") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @Schema(description = "销售价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销售价不能为空!") + @Digits(integer = 10, fraction = 6, message = "销售价最多允许6位小数!") + @Positive(message = "销售价必须大于0!") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @Schema(description = "零售价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "零售价不能为空!") + @Digits(integer = 10, fraction = 6, message = "零售价最多允许6位小数!") + @Positive(message = "零售价必须大于0!") + private BigDecimal retailPrice; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductPropertyRelationVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductPropertyRelationVo.java new file mode 100644 index 0000000..7bd412f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductPropertyRelationVo.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.core.vo.BaseVo; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProductPropertyRelationVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 属性ID + */ + @NotBlank(message = "属性值ID不能为空!") + private String id; + + /** + * 属性值内容 + */ + private String text; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductSelectorVo.java new file mode 100644 index 0000000..3a80e66 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductSelectorVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryProductSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime startTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime endTime; + + /** + * 商品类型 + */ + @Schema(description = "商品类型") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductVo.java new file mode 100644 index 0000000..b9fdabe --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryProductVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 商品类型 + */ + @Schema(description = "商品类型") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime startTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime endTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/UpdateProductVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/UpdateProductVo.java new file mode 100644 index 0000000..c4590c1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/UpdateProductVo.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class UpdateProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @Schema(description = "简称") + private String shortName; + + /** + * 商品SKU编号 + */ + @Schema(description = "商品SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + @NotBlank(message = "分类ID不能为空!") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 重量(kg) + */ + @Schema(description = "重量(kg)") + @Digits(integer = 10, fraction = 2, message = "重量最多允许2位小数!") + private BigDecimal weight; + + /** + * 体积(cm3) + */ + @Schema(description = "体积(cm3)") + @Digits(integer = 10, fraction = 2, message = "体积最多允许2位小数!") + private BigDecimal volume; + + /** + * 进项税率(%) + */ + @Schema(description = "进项税率(%)") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @Schema(description = "销项税率(%)") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + private BigDecimal saleTaxRate; + + /** + * 商品类型 + */ + @Schema(description = "商品类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "商品类型不能为空!") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; + + /** + * 单品 + */ + @Schema(description = "单品") + @Valid + private List productBundles; + + /** + * 商品属性 + */ + @Schema(description = "商品属性") + @Valid + private List properties; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @Schema(description = "销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @Schema(description = "零售价") + private BigDecimal retailPrice; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/saleprop/CreateProductSalePropItemRelationVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/saleprop/CreateProductSalePropItemRelationVo.java new file mode 100644 index 0000000..a058203 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/saleprop/CreateProductSalePropItemRelationVo.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.basedata.vo.product.info.saleprop; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateProductSalePropItemRelationVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 销售属性值ID + */ + @Schema(description = "销售属性值ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "销售属性值ID不能为空!") + private List salePropItemIds; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/CreateProductPolyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/CreateProductPolyVo.java new file mode 100644 index 0000000..0761b68 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/CreateProductPolyVo.java @@ -0,0 +1,217 @@ +package com.lframework.xingyun.basedata.vo.product.poly; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class CreateProductPolyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品货号 + */ + @Schema(description = "商品货号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "商品货号不能为空!") + private String code; + + /** + * 商品名称 + */ + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品名称不能为空!") + private String name; + + /** + * 商品简称 + */ + @Schema(description = "商品简称") + private String shortName; + + /** + * 分类ID + */ + @Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请选择商品分类!") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请选择商品品牌!") + private String brandId; + + /** + * 是否多销售属性 + */ + @Schema(description = "是否多销售属性", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择是否多销售属性!") + private Boolean multipleSaleProp; + + /** + * 进项税率(%) + */ + @Schema(description = "进项税率(%)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "进项税率(%)不能为空!") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "进项税率(%)必须为整数!") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @Schema(description = "销项税率(%)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销项税率(%)不能为空!") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "销项税率(%)必须为整数!") + private BigDecimal saleTaxRate; + + /** + * 商品属性 + */ + @Schema(description = "商品属性", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + private List properties; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty + private List products; + + public void validate() { + + int orderNo = 1; + for (ProductVo product : this.getProducts()) { + if (this.getMultipleSaleProp()) { + if (StringUtil.isBlank(product.getSalePropItemId1())) { + throw new InputErrorException("销售属性1不能为空!"); + } + } + + if (StringUtil.isBlank(product.getCode())) { + throw new InputErrorException("第" + (orderNo) + "行商品编号不能为空!"); + } + + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, product.getCode())) { + throw new InputErrorException("第" + (orderNo) + "行商品编号必须由字母或数字组成,长度不能超过20位!"); + } + + if (StringUtil.isBlank(product.getName())) { + throw new InputErrorException("第" + (orderNo) + "行商品名称不能为空!"); + } + + if (StringUtil.isBlank(product.getSkuCode())) { + throw new InputErrorException("第" + (orderNo) + "行商品SKU编号不能为空!"); + } + + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + (orderNo) + "行商品采购价不能为空!"); + } + + if (product.getSalePrice() == null) { + throw new InputErrorException("第" + (orderNo) + "行商品销售价不能为空!"); + } + + if (product.getRetailPrice() == null) { + throw new InputErrorException("第" + (orderNo) + "行商品零售价不能为空!"); + } + + orderNo++; + } + } + + @Data + public static class PropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 属性ID + */ + @NotBlank(message = "属性值ID不能为空!") + private String id; + + /** + * 属性值内容 + */ + private String text; + } + + @Data + public static class ProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 销售属性1ID multipleSaleProp == true时生效 + */ + private String salePropItemId1; + + /** + * 销售属性2ID multipleSaleProp == true时生效 + */ + private String salePropItemId2; + + /** + * 商品编号 + */ + private String code; + + /** + * 商品名称 + */ + private String name; + + /** + * 商品SKU编号 + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 采购价 + */ + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + private BigDecimal salePrice; + + /** + * 零售价 + */ + private BigDecimal retailPrice; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/QueryProductPolyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/QueryProductPolyVo.java new file mode 100644 index 0000000..0204881 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/QueryProductPolyVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.basedata.vo.product.poly; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductPolyVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/UpdateProductPolyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/UpdateProductPolyVo.java new file mode 100644 index 0000000..5c63139 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/UpdateProductPolyVo.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.basedata.vo.product.poly; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class UpdateProductPolyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 商品货号 + */ + @Schema(description = "商品货号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "商品货号不能为空!") + private String code; + + /** + * 商品名称 + */ + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品名称不能为空!") + private String name; + + /** + * 商品简称 + */ + @Schema(description = "商品简称") + private String shortName; + + /** + * 分类ID + */ + @Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请选择商品分类!") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请选择商品品牌!") + private String brandId; + + /** + * 进项税率(%) + */ + @Schema(description = "进项税率(%)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "进项税率(%)不能为空!") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "进项税率(%)必须为整数!") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @Schema(description = "销项税率(%)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销项税率(%)不能为空!") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "销项税率(%)必须为整数!") + private BigDecimal saleTaxRate; + + /** + * 商品属性 + */ + @Schema(description = "商品属性", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + private List properties; + + @Data + public static class PropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 属性ID + */ + @NotBlank(message = "属性值ID不能为空!") + private String id; + + /** + * 属性值内容 + */ + private String text; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/property/CreateProductPolyPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/property/CreateProductPolyPropertyVo.java new file mode 100644 index 0000000..8ae69a3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/property/CreateProductPolyPropertyVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.basedata.vo.product.poly.property; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateProductPolyPropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * polyID + */ + @Schema(description = "polyID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "polyId不能为空!") + private String polyId; + + /** + * 属性ID + */ + @Schema(description = "属性ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; + + /** + * 属性值ID + */ + @Schema(description = "属性值ID") + private String propertyItemId; + + /** + * 属性值文本 + */ + @Schema(description = "属性值文本") + private String propertyText; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/saleprop/CreateProductPolySalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/saleprop/CreateProductPolySalePropGroupVo.java new file mode 100644 index 0000000..0ac27ee --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/saleprop/CreateProductPolySalePropGroupVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.basedata.vo.product.poly.saleprop; + +import com.lframework.starter.web.core.vo.BaseVo; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateProductPolySalePropGroupVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品聚合ID + */ + private String polyId; + + /** + * 销售属性组ID + */ + private List salePropGroupIds; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/CreateProductPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/CreateProductPropertyVo.java new file mode 100644 index 0000000..ac96e24 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/CreateProductPropertyVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.basedata.vo.product.property; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateProductPropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否必填 + */ + @Schema(description = "是否必填", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择是否必填!") + private Boolean isRequired; + + /** + * 录入类型 + */ + @Schema(description = "录入类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择录入类型!") + @IsEnum(enumClass = ColumnType.class, message = "请选择录入类型!") + private Integer columnType; + + /** + * 数据类型 + */ + @Schema(description = "数据类型") + @IsEnum(enumClass = ColumnDataType.class, message = "请选择数据类型!") + private Integer columnDataType; + + /** + * 属性类别 + */ + @Schema(description = "属性类别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择属性类别!") + @IsEnum(enumClass = PropertyType.class, message = "请选择属性类别!") + private Integer propertyType; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private List categoryIds; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/QueryProductPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/QueryProductPropertyVo.java new file mode 100644 index 0000000..607c6ca --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/QueryProductPropertyVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.product.property; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductPropertyVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/UpdateProductPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/UpdateProductPropertyVo.java new file mode 100644 index 0000000..98c4a9e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/UpdateProductPropertyVo.java @@ -0,0 +1,85 @@ +package com.lframework.xingyun.basedata.vo.product.property; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class UpdateProductPropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID") + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否必填 + */ + @Schema(description = "是否必填", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择是否必填!") + private Boolean isRequired; + + /** + * 录入类型 + */ + @Schema(description = "录入类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择录入类型!") + @IsEnum(enumClass = ColumnType.class, message = "请选择录入类型!") + private Integer columnType; + + /** + * 数据类型 + */ + @Schema(description = "数据类型") + @IsEnum(enumClass = ColumnDataType.class, message = "请选择数据类型!") + private Integer columnDataType; + + /** + * 属性类别 + */ + @Schema(description = "属性类别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择属性类别!") + @IsEnum(enumClass = PropertyType.class, message = "请选择属性类别!") + private Integer propertyType; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private List categoryIds; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/CreateProductPropertyItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/CreateProductPropertyItemVo.java new file mode 100644 index 0000000..dea9aec --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/CreateProductPropertyItemVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.vo.product.property.item; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateProductPropertyItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 属性ID + */ + @Schema(description = "属性ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/QueryProductPropertyItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/QueryProductPropertyItemVo.java new file mode 100644 index 0000000..cbb13fa --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/QueryProductPropertyItemVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.basedata.vo.product.property.item; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductPropertyItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 属性ID + */ + @Schema(description = "属性ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/UpdateProductPropertyItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/UpdateProductPropertyItemVo.java new file mode 100644 index 0000000..222bede --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/UpdateProductPropertyItemVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.vo.product.property.item; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateProductPropertyItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/realtion/CreateProductPropertyRelationVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/realtion/CreateProductPropertyRelationVo.java new file mode 100644 index 0000000..96b3219 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/realtion/CreateProductPropertyRelationVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.basedata.vo.product.property.realtion; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateProductPropertyRelationVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 属性ID + */ + @Schema(description = "属性ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; + + /** + * 属性值ID + */ + @Schema(description = "属性值ID") + private String propertyItemId; + + /** + * 属性值文本 + */ + @Schema(description = "属性值文本") + private String propertyText; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/CreateProductPurchaseVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/CreateProductPurchaseVo.java new file mode 100644 index 0000000..89b8483 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/CreateProductPurchaseVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.vo.product.purchase; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CreateProductPurchaseVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String id; + + /** + * 采购价 + */ + @Schema(description = "采购价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请输入采购价!") + @Positive(message = "采购价必须大于0!") + @Digits(integer = 20, fraction = 6, message = "采购价最多允许6位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/UpdateProductPurchaseVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/UpdateProductPurchaseVo.java new file mode 100644 index 0000000..c5f3c3c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/UpdateProductPurchaseVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.basedata.vo.product.purchase; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class UpdateProductPurchaseVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String id; + + /** + * 采购价 + */ + @Schema(description = "采购价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请输入采购价!") + @Positive(message = "采购价必须大于0!") + @Digits(integer = 20, fraction = 6, message = "采购价最多允许6位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/CreateProductRetailVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/CreateProductRetailVo.java new file mode 100644 index 0000000..d7bed9d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/CreateProductRetailVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.vo.product.retail; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CreateProductRetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String id; + + /** + * 零售价 + */ + @Schema(description = "零售价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请输入零售价!") + @Positive(message = "零售价必须大于0!") + @Digits(integer = 20, fraction = 6, message = "零售价最多允许6位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/UpdateProductRetailVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/UpdateProductRetailVo.java new file mode 100644 index 0000000..ef3b4b9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/UpdateProductRetailVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.basedata.vo.product.retail; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class UpdateProductRetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String id; + + /** + * 零售价 + */ + @Schema(description = "零售价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请输入零售价!") + @Positive(message = "零售价必须大于0!") + @Digits(integer = 20, fraction = 6, message = "零售价最多允许6位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/CreateProductSaleVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/CreateProductSaleVo.java new file mode 100644 index 0000000..fd60a2e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/CreateProductSaleVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.vo.product.sale; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CreateProductSaleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String id; + + /** + * 销售价 + */ + @Schema(description = "销售价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请输入销售价!") + @Positive(message = "销售价必须大于0!") + @Digits(integer = 20, fraction = 6, message = "销售价最多允许6位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/UpdateProductSaleVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/UpdateProductSaleVo.java new file mode 100644 index 0000000..c0693f8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/UpdateProductSaleVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.basedata.vo.product.sale; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class UpdateProductSaleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String id; + + /** + * 销售价 + */ + @Schema(description = "销售价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请输入销售价!") + @Positive(message = "销售价必须大于0!") + @Digits(integer = 20, fraction = 6, message = "销售价最多允许6位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/CreateProductSalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/CreateProductSalePropGroupVo.java new file mode 100644 index 0000000..4f7431c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/CreateProductSalePropGroupVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateProductSalePropGroupVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupSelectorVo.java new file mode 100644 index 0000000..4e94f8f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupSelectorVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductSalePropGroupSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 是否过滤空的销售属性组 + */ + @Schema(description = "是否过滤空的销售属性组") + private Boolean filterEmpty; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupVo.java new file mode 100644 index 0000000..628fe7e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductSalePropGroupVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/UpdateProductSalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/UpdateProductSalePropGroupVo.java new file mode 100644 index 0000000..a5775de --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/UpdateProductSalePropGroupVo.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateProductSalePropGroupVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/CreateProductSalePropItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/CreateProductSalePropItemVo.java new file mode 100644 index 0000000..826b8ce --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/CreateProductSalePropItemVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateProductSalePropItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 销售属性组ID + */ + @Schema(description = "销售属性组ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "GroupID不能为空!") + private String groupId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemSelectorVo.java new file mode 100644 index 0000000..8bdea59 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemSelectorVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductSalePropItemSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 销售属性组ID + */ + @Schema(description = "销售属性组ID") + private String salePropGroupId; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemVo.java new file mode 100644 index 0000000..9a3ecec --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryProductSalePropItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 销售属性组ID + */ + @Schema(description = "销售属性组ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "GroupID不能为空!") + private String groupId; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/UpdateProductSalePropItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/UpdateProductSalePropItemVo.java new file mode 100644 index 0000000..f678f6f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/UpdateProductSalePropItemVo.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateProductSalePropItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/CreateShopVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/CreateShopVo.java new file mode 100644 index 0000000..e628622 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/CreateShopVo.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CreateShopVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 所属部门ID + */ + @Schema(description = "所属部门ID") + private String deptId; + + /** + * 经度 + */ + @Schema(description = "经度") + @TypeMismatch(message = "经度格式有误!") + private BigDecimal lng; + + /** + * 纬度 + */ + @Schema(description = "纬度") + @TypeMismatch(message = "纬度格式有误!") + private BigDecimal lat; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/QueryShopVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/QueryShopVo.java new file mode 100644 index 0000000..f6e4ef7 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/QueryShopVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryShopVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 所属部门ID + */ + @Schema(description = "所属部门ID") + private String deptId; + + /** + * 创建时间 起始时间 + */ + @Schema(description = "创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @Schema(description = "创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/ShopSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/ShopSelectorVo.java new file mode 100644 index 0000000..7959b34 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/ShopSelectorVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ShopSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/UpdateShopVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/UpdateShopVo.java new file mode 100644 index 0000000..6d15f93 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/UpdateShopVo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class UpdateShopVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 所属部门ID + */ + @Schema(description = "所属部门ID") + private String deptId; + + /** + * 经度 + */ + @Schema(description = "经度") + @TypeMismatch(message = "经度格式有误!") + private BigDecimal lng; + + /** + * 纬度 + */ + @Schema(description = "纬度") + @TypeMismatch(message = "纬度格式有误!") + private BigDecimal lat; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/CreateStoreCenterVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/CreateStoreCenterVo.java new file mode 100644 index 0000000..77f17bb --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/CreateStoreCenterVo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateStoreCenterVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @Schema(description = "联系人手机号码") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 仓库人数 + */ + @Schema(description = "仓库人数") + private Integer peopleNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterSelectorVo.java new file mode 100644 index 0000000..ae9eb7c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryStoreCenterSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterVo.java new file mode 100644 index 0000000..1018c7d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryStoreCenterVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/UpdateStoreCenterVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/UpdateStoreCenterVo.java new file mode 100644 index 0000000..d682a3c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/UpdateStoreCenterVo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateStoreCenterVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @Schema(description = "联系人手机号码") + private String telephone; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 仓库人数 + */ + @Schema(description = "仓库人数") + private Integer peopleNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/CreateSupplierVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/CreateSupplierVo.java new file mode 100644 index 0000000..8b0f141 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/CreateSupplierVo.java @@ -0,0 +1,145 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateSupplierVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简码 + */ + @Schema(description = "简码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入简码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @Schema(description = "邮编") + private String zipCode; + + /** + * 传真 + */ + @Schema(description = "传真") + private String fax; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 送货周期(天) + */ + @Schema(description = "送货周期(天)") + @Min(message = "送货周期(天)必须大于0!", value = 1) + private Integer deliveryCycle; + + /** + * 经营方式 + */ + @Schema(description = "经营方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择经营方式!") + @IsEnum(message = "请选择经营方式!", enumClass = ManageType.class) + private Integer manageType; + + /** + * 结算方式 + */ + @Schema(description = "结算方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择结算方式!") + @IsEnum(message = "请选择结算方式!", enumClass = SettleType.class) + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @Schema(description = "统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @Schema(description = "纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @Schema(description = "开户银行") + private String bankName; + + /** + * 户名 + */ + @Schema(description = "户名") + private String accountName; + + /** + * 银行账号 + */ + @Schema(description = "银行账号") + private String accountNo; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierSelectorVo.java new file mode 100644 index 0000000..18d98e7 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierSelectorVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.basedata.enums.ManageType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QuerySupplierSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 经营方式 + */ + @Schema(description = "经营方式") + @IsEnum(message = "经营方式格式不正确!", enumClass = ManageType.class) + private Integer manageType; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierVo.java new file mode 100644 index 0000000..1863a8b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QuerySupplierVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/UpdateSupplierVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/UpdateSupplierVo.java new file mode 100644 index 0000000..6021682 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/UpdateSupplierVo.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateSupplierVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简码 + */ + @Schema(description = "简码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入简码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contact; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @Schema(description = "电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @Schema(description = "邮编") + private String zipCode; + + /** + * 传真 + */ + @Schema(description = "传真") + private String fax; + + /** + * 地区ID + */ + @Schema(description = "地区ID") + private String cityId; + + /** + * 地址 + */ + @Schema(description = "地址") + private String address; + + /** + * 送货周期(天) + */ + @Schema(description = "送货周期(天)") + @Min(message = "送货周期(天)必须大于0!", value = 1) + private Integer deliveryCycle; + + /** + * 统一社会信用代码 + */ + @Schema(description = "统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @Schema(description = "纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @Schema(description = "开户银行") + private String bankName; + + /** + * 户名 + */ + @Schema(description = "户名") + private String accountName; + + /** + * 银行账号 + */ + @Schema(description = "银行账号") + private String accountNo; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/lombok.config b/xingyun-basedata/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-basedata/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-basedata/src/main/resources/mappers/address/AddressMapper.xml b/xingyun-basedata/src/main/resources/mappers/address/AddressMapper.xml new file mode 100644 index 0000000..362e913 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/address/AddressMapper.xml @@ -0,0 +1,65 @@ + + + + + + SELECT + tb.* + FROM base_data_address AS tb + + + + \ No newline at end of file diff --git a/xingyun-basedata/src/main/resources/mappers/customer/CustomerMapper.xml b/xingyun-basedata/src/main/resources/mappers/customer/CustomerMapper.xml new file mode 100644 index 0000000..843b0f0 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/customer/CustomerMapper.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + mnemonic_code, + contact, + telephone, + email, + zip_code, + fax, + city_id, + address, + settle_type, + credit_code, + tax_identify_no, + bank_name, + account_name, + account_no, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_customer + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/logistics/LogisticsCompanyMapper.xml b/xingyun-basedata/src/main/resources/mappers/logistics/LogisticsCompanyMapper.xml new file mode 100644 index 0000000..e9e71ee --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/logistics/LogisticsCompanyMapper.xml @@ -0,0 +1,42 @@ + + + + + + SELECT + * + FROM base_data_logistics_company + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/member/MemberMapper.xml b/xingyun-basedata/src/main/resources/mappers/member/MemberMapper.xml new file mode 100644 index 0000000..f96956b --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/member/MemberMapper.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + gender, + telephone, + email, + birthday, + join_day, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_member + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/paytype/PayTypeMapper.xml b/xingyun-basedata/src/main/resources/mappers/paytype/PayTypeMapper.xml new file mode 100644 index 0000000..c7ebd2e --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/paytype/PayTypeMapper.xml @@ -0,0 +1,40 @@ + + + + + + SELECT + tb.* + FROM base_data_pay_type AS tb + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/print/PrintTemplateMapper.xml b/xingyun-basedata/src/main/resources/mappers/print/PrintTemplateMapper.xml new file mode 100644 index 0000000..5837fc4 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/print/PrintTemplateMapper.xml @@ -0,0 +1,21 @@ + + + + + + SELECT + tb.* + FROM tbl_print_template AS tb + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductBrandMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductBrandMapper.xml new file mode 100644 index 0000000..c92e5f8 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductBrandMapper.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + short_name, + logo, + introduction, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_product_brand + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryMapper.xml new file mode 100644 index 0000000..b3b1248 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + SELECT + id, + code, + name, + parent_id, + available, + description + FROM base_data_product_category + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryPropertyMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryPropertyMapper.xml new file mode 100644 index 0000000..8aba70f --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryPropertyMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + SELECT + cp.id, + cp.property_id, + cp.category_id + FROM base_data_product_category_property AS cp + LEFT JOIN base_data_product_property AS p ON p.id = cp.property_id + LEFT JOIN base_data_product_category AS c ON c.id = cp.category_id + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml new file mode 100644 index 0000000..1fae0fa --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml @@ -0,0 +1,163 @@ + + + + + + SELECT + g.* + FROM base_data_product AS g + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = g.category_id and rm.node_type = 2 + + + + + + + + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyItemMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyItemMapper.xml new file mode 100644 index 0000000..be3b5e4 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyItemMapper.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + property_id, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_product_property_item + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyMapper.xml new file mode 100644 index 0000000..ec06103 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + p.id, + p.code, + p.name, + p.is_required, + p.column_type, + p.column_data_type, + p.property_type, + p.available, + p.description, + p.create_by, + p.create_time, + p.update_by, + p.update_time + FROM base_data_product_property AS p + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyRelationMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyRelationMapper.xml new file mode 100644 index 0000000..e1a8e0b --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyRelationMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + SELECT + pp.id, + pp.product_id, + p.id AS property_id, + t.id AS property_item_id, + p.column_type AS property_column_type, + p.name AS property_name, + IF(p.column_type = 3, pp.property_text, t.name) AS property_text + FROM base_data_product_property_relation AS pp + INNER JOIN base_data_product_property AS p ON p.id = pp.property_id + LEFT JOIN base_data_product_property_item AS t ON t.id = pp.property_item_id + + + DELETE FROM base_data_product_property_relation WHERE property_id = #{propertyId} AND product_id NOT IN (SELECT id from base_data_product WHERE category_id = #{categoryId}) + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPurchaseMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPurchaseMapper.xml new file mode 100644 index 0000000..6255097 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPurchaseMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductRetailMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductRetailMapper.xml new file mode 100644 index 0000000..fb42450 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductRetailMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductSaleMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductSaleMapper.xml new file mode 100644 index 0000000..cea9f93 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductSaleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/shop/ShopMapper.xml b/xingyun-basedata/src/main/resources/mappers/shop/ShopMapper.xml new file mode 100644 index 0000000..61e5dd8 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/shop/ShopMapper.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.dept_id, + tb.lng, + tb.lat, + tb.description, + tb.available, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM tbl_shop AS tb + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/storecenter/StoreCenterMapper.xml b/xingyun-basedata/src/main/resources/mappers/storecenter/StoreCenterMapper.xml new file mode 100644 index 0000000..c6e3fc7 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/storecenter/StoreCenterMapper.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + contact, + telephone, + people_num, + city_id, + address, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_store_center + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/supplier/SupplierMapper.xml b/xingyun-basedata/src/main/resources/mappers/supplier/SupplierMapper.xml new file mode 100644 index 0000000..fa6f88b --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/supplier/SupplierMapper.xml @@ -0,0 +1,45 @@ + + + + + + SELECT + * + FROM base_data_supplier + + + + + + diff --git a/xingyun-chart/pom.xml b/xingyun-chart/pom.xml new file mode 100644 index 0000000..ce380b7 --- /dev/null +++ b/xingyun-chart/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + com.lframework + xingyun + 1.0.0 + + + xingyun-chart + + + + com.lframework + xingyun-core + + + io.swagger.core.v3 + swagger-annotations-jakarta + 2.2.36 + compile + + + org.jetbrains + annotations + 24.0.1 + compile + + + \ No newline at end of file diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthBo.java new file mode 100644 index 0000000..f094eb6 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthBo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class OrderChartSameMonthBo extends BaseBo { + + /** + * 单据总金额 + */ + @Schema(description = "单据总金额") + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + @Schema(description = "单据总数量") + private Integer totalNum; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createDate; + + public OrderChartSameMonthBo() { + + } + + public OrderChartSameMonthBo(OrderChartSameMonthDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthSumBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthSumBo.java new file mode 100644 index 0000000..14b8e79 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthSumBo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +@Data +public class OrderChartSameMonthSumBo extends BaseBo { + + /** + * 单据总金额 + */ + @Schema(description = "单据总金额") + private BigDecimal totalAmount; + + /** + * 单据数量 + */ + @Schema(description = "单据数量") + private Long totalNum; + + /** + * 图表数据 + */ + @Schema(description = "图表数据") + private List charts; + + public OrderChartSameMonthSumBo() { + + } + + public OrderChartSameMonthSumBo(OrderChartSumDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodayBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodayBo.java new file mode 100644 index 0000000..6bea8f9 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodayBo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class OrderChartTodayBo extends BaseBo { + + /** + * 单据总金额 + */ + @Schema(description = "单据总金额") + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + @Schema(description = "单据总数量") + private Integer totalNum; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createHour; + + public OrderChartTodayBo() { + + } + + public OrderChartTodayBo(OrderChartTodayDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodaySumBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodaySumBo.java new file mode 100644 index 0000000..f57b2b1 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodaySumBo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +@Data +public class OrderChartTodaySumBo extends BaseBo { + + /** + * 单据总金额 + */ + @Schema(description = "单据总金额") + private BigDecimal totalAmount; + + /** + * 单据数量 + */ + @Schema(description = "单据数量") + private Long totalNum; + + /** + * 图表数据 + */ + @Schema(description = "图表数据") + private List charts; + + public OrderChartTodaySumBo() { + + } + + public OrderChartTodaySumBo(OrderChartSumDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/controller/ChartController.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/controller/ChartController.java new file mode 100644 index 0000000..b410f90 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/controller/ChartController.java @@ -0,0 +1,115 @@ +package com.lframework.xingyun.chart.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.xingyun.chart.bo.OrderChartSameMonthBo; +import com.lframework.xingyun.chart.bo.OrderChartSameMonthSumBo; +import com.lframework.xingyun.chart.bo.OrderChartTodayBo; +import com.lframework.xingyun.chart.bo.OrderChartTodaySumBo; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import com.lframework.xingyun.chart.service.OrderChartService; +import com.lframework.xingyun.chart.vo.GetOrderChartVo; +import com.lframework.xingyun.chart.vo.QueryOrderChartVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 报表 + * + * @author zmj + */ +@Tag(name = "报表") +@Validated +@RestController +@RequestMapping("/chart") +public class ChartController extends DefaultBaseController { + + @Autowired + private OrderChartService orderChartService; + + /** + * 订单报表 + */ + @Operation(summary = "订单报表") + @GetMapping("/order") + public InvokeResult>> orderChart() { + + //当日数据 + Map todayMap = new HashMap<>(2, 1); + //当月数据 + Map sameMonthMap = new HashMap<>(2, 1); + + List orderBizTypes = CollectionUtil.toList(OrderChartBizType.PURCHASE_ORDER.getCode(), + OrderChartBizType.SALE_ORDER.getCode(), OrderChartBizType.RETAIL_OUT_SHEET.getCode()); + todayMap.put("order", getTodayChart(orderBizTypes)); + sameMonthMap.put("order", getSameMonthChart(orderBizTypes)); + + List returnBizTypes = CollectionUtil.toList( + OrderChartBizType.PURCHASE_RETURN.getCode(), + OrderChartBizType.SALE_RETURN.getCode(), OrderChartBizType.RETAIL_RETURN.getCode()); + todayMap.put("returned", getTodayChart(returnBizTypes)); + sameMonthMap.put("returned", getSameMonthChart(returnBizTypes)); + + Map> result = new HashMap<>(2, 1); + result.put("today", todayMap); + result.put("sameMonth", sameMonthMap); + + return InvokeResultBuilder.success(result); + } + + private OrderChartTodaySumBo getTodayChart(List bizTypes) { + + GetOrderChartVo orderSumVo = new GetOrderChartVo(); + orderSumVo.setBizTypes(bizTypes); + // 今日订单汇总数据 + OrderChartTodaySumBo orderSumBo = new OrderChartTodaySumBo( + orderChartService.getTodayChartSum(orderSumVo)); + // 今日订单图表数据 + QueryOrderChartVo chartVo = new QueryOrderChartVo(); + chartVo.setBizTypes(bizTypes); + List charts = orderChartService.queryTodayChart(chartVo); + List chartResults = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(charts)) { + chartResults = charts.stream().map(OrderChartTodayBo::new).collect(Collectors.toList()); + } + orderSumBo.setCharts(chartResults); + + return orderSumBo; + } + + private OrderChartSameMonthSumBo getSameMonthChart(List bizTypes) { + + GetOrderChartVo orderSumVo = new GetOrderChartVo(); + orderSumVo.setBizTypes(bizTypes); + // 当月订单汇总数据 + OrderChartSameMonthSumBo sameMonthOrderSumBo = new OrderChartSameMonthSumBo( + orderChartService.getSameMonthChartSum(orderSumVo)); + // 当月订单图表数据 + QueryOrderChartVo chartVo = new QueryOrderChartVo(); + chartVo.setBizTypes(bizTypes); + List sameMonthCharts = orderChartService.querySameMonthChart(chartVo); + List sameMonthChartResults = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(sameMonthCharts)) { + sameMonthChartResults = sameMonthCharts.stream().map(OrderChartSameMonthBo::new) + .collect(Collectors.toList()); + } + sameMonthOrderSumBo.setCharts(sameMonthChartResults); + + return sameMonthOrderSumBo; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSameMonthDto.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSameMonthDto.java new file mode 100644 index 0000000..4995bfe --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSameMonthDto.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.chart.dto; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class OrderChartSameMonthDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + private Integer totalNum; + + /** + * 创建时间 + */ + private String createDate; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSumDto.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSumDto.java new file mode 100644 index 0000000..bf53365 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSumDto.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.chart.dto; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class OrderChartSumDto implements BaseDto, Serializable { + + public static final String CACHE_NAME = "OrderChartSumDto"; + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 单据数量 + */ + private Long totalNum; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartTodayDto.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartTodayDto.java new file mode 100644 index 0000000..a394ef5 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartTodayDto.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.chart.dto; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class OrderChartTodayDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + private Integer totalNum; + + /** + * 创建时间 + */ + private String createHour; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/entity/OrderChart.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/entity/OrderChart.java new file mode 100644 index 0000000..61cbd94 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/entity/OrderChart.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.chart.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-19 + */ +@Data +@TableName("tbl_order_chart") +public class OrderChart extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 创建日期 + */ + private String createDate; + + /** + * 创建时间(小时) + */ + private String createHour; + + /** + * 业务类型 + */ + private OrderChartBizType bizType; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/enums/OrderChartBizType.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/enums/OrderChartBizType.java new file mode 100644 index 0000000..838e360 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/enums/OrderChartBizType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.chart.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum OrderChartBizType implements BaseEnum { + PURCHASE_ORDER(0, "采购订单"), PURCHASE_RETURN(1, "采购退单"), SALE_ORDER(2, "销售订单"), SALE_RETURN(3, + "销售退单"), RETAIL_OUT_SHEET(4, "零售出库单"), RETAIL_RETURN(5, "零售退单"); + + @EnumValue + private final Integer code; + + private final String desc; + + OrderChartBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/impl/OrderChartServiceImpl.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/impl/OrderChartServiceImpl.java new file mode 100644 index 0000000..0e74fb9 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/impl/OrderChartServiceImpl.java @@ -0,0 +1,150 @@ +package com.lframework.xingyun.chart.impl; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.entity.OrderChart; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import com.lframework.xingyun.chart.mappers.OrderChartMapper; +import com.lframework.xingyun.chart.service.OrderChartService; +import com.lframework.xingyun.chart.vo.CreateOrderChartVo; +import com.lframework.xingyun.chart.vo.GetOrderChartVo; +import com.lframework.xingyun.chart.vo.QueryOrderChartVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class OrderChartServiceImpl extends BaseMpServiceImpl + implements OrderChartService { + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateOrderChartVo vo) { + + if (vo.getCreateTime() == null) { + vo.setCreateTime(LocalDateTime.now()); + } + + OrderChart record = new OrderChart(); + record.setId(IdUtil.getId()); + record.setTotalAmount(vo.getTotalAmount()); + record.setCreateTime(vo.getCreateTime()); + record.setBizType(EnumUtil.getByCode(OrderChartBizType.class, vo.getBizType())); + record.setCreateDate(DateUtil.formatDate(vo.getCreateTime().toLocalDate())); + record.setCreateHour(DateUtil.format(vo.getCreateTime(), StringPool.DATE_TIME_HOUR_PATTER)); + + getBaseMapper().insert(record); + + return record.getId(); + } + + @Override + public OrderChartSumDto getTodayChartSum(GetOrderChartVo vo) { + + LocalDate now = LocalDate.now(); + + OrderChartSumDto data = getBaseMapper().getChartSum(vo.getBizTypes(), + DateUtil.toLocalDateTime(now), + DateUtil.toLocalDateTimeMax(now)); + if (data == null) { + data = new OrderChartSumDto(); + data.setTotalAmount(BigDecimal.ZERO); + data.setTotalNum(0L); + } + + return data; + } + + @Override + public OrderChartSumDto getSameMonthChartSum(GetOrderChartVo vo) { + + LocalDate startDate = LocalDate.now().withDayOfMonth(1); + LocalDate endDate = startDate.plusMonths(1).minusDays(1); + + OrderChartSumDto data = getBaseMapper().getChartSum(vo.getBizTypes(), + DateUtil.toLocalDateTime(startDate), + DateUtil.toLocalDateTimeMax(endDate)); + if (data == null) { + data = new OrderChartSumDto(); + data.setTotalAmount(BigDecimal.ZERO); + data.setTotalNum(0L); + } + + return data; + } + + @Override + public List queryTodayChart(QueryOrderChartVo vo) { + + LocalDate now = LocalDate.now(); + + List results = getBaseMapper().queryToday(vo.getBizTypes(), + DateUtil.toLocalDateTime(now), + DateUtil.toLocalDateTimeMax(now)); + + int offset = 24; + List newResults = new ArrayList<>(offset); + + for (int i = 0; i < offset; i++) { + LocalTime localTime = LocalTime.of(i, 0, 0); + String filterDateStr = DateUtil.formatDateTime(LocalDateTime.of(now, localTime), + StringPool.DATE_TIME_HOUR_PATTER); + OrderChartTodayDto result = results.stream() + .filter(t -> t.getCreateHour().equals(filterDateStr)) + .findFirst().orElse(null); + if (result == null) { + result = new OrderChartTodayDto(); + result.setCreateHour(filterDateStr); + result.setTotalAmount(BigDecimal.ZERO); + result.setTotalNum(0); + } + + newResults.add(result); + } + + return newResults; + } + + @Override + public List querySameMonthChart(QueryOrderChartVo vo) { + + LocalDate startDate = LocalDate.now().withDayOfMonth(1); + LocalDate endDate = startDate.plusMonths(1).minusDays(1); + + List results = getBaseMapper().querySameMonth(vo.getBizTypes(), + DateUtil.toLocalDateTime(startDate), DateUtil.toLocalDateTimeMax(endDate)); + + LocalDate lastDate = startDate.plusMonths(1).minusDays(1); + int offset = lastDate.getDayOfMonth() - startDate.getDayOfMonth() + 1; + List newResults = new ArrayList<>(offset); + + for (int i = 0; i < offset; i++) { + String filterDateStr = DateUtil.formatDate(startDate.plusDays(i)); + OrderChartSameMonthDto result = results.stream() + .filter(t -> t.getCreateDate().equals(filterDateStr)) + .findFirst().orElse(null); + if (result == null) { + result = new OrderChartSameMonthDto(); + result.setCreateDate(filterDateStr); + result.setTotalAmount(BigDecimal.ZERO); + result.setTotalNum(0); + } + + newResults.add(result); + } + + return newResults; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/listeners/mq/OrderDataToChartListener.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/listeners/mq/OrderDataToChartListener.java new file mode 100644 index 0000000..5d44b43 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/listeners/mq/OrderDataToChartListener.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.chart.listeners.mq; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import com.lframework.xingyun.chart.service.OrderChartService; +import com.lframework.xingyun.chart.vo.CreateOrderChartVo; +import com.lframework.xingyun.core.queue.MqStringPool; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.ExchangeTypes; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Slf4j +@Component +public class OrderDataToChartListener { + + @Autowired + private OrderChartService orderChartService; + + @Transactional(rollbackFor = Exception.class) + @RabbitListener(bindings = { + @QueueBinding(value = @Queue(value = "chart.approve_pass_order"), exchange = @Exchange(value = MqStringPool.APPROVE_PASS_ORDER_EXCHANGE, type = ExchangeTypes.FANOUT))}) + public void execute(Message message) { + ApprovePassOrderDto event = message.getPayload(); + OrderChartBizType bizType = this.convertBizType(event.getOrderType()); + if (event.getOrderType() == null) { + log.error("orderType={},无法匹配业务类型", event.getOrderType()); + return; + } + + CreateOrderChartVo vo = new CreateOrderChartVo(); + vo.setTotalAmount(event.getTotalAmount()); + vo.setCreateTime(event.getApproveTime()); + vo.setBizType(bizType.getCode()); + + orderChartService.create(vo); + } + + private OrderChartBizType convertBizType(ApprovePassOrderDto.OrderType orderType) { + + if (orderType == ApprovePassOrderDto.OrderType.PURCHASE_ORDER) { + return OrderChartBizType.PURCHASE_ORDER; + } + if (orderType == ApprovePassOrderDto.OrderType.PURCHASE_RETURN) { + return OrderChartBizType.PURCHASE_RETURN; + } + if (orderType == ApprovePassOrderDto.OrderType.SALE_ORDER) { + return OrderChartBizType.SALE_ORDER; + } + if (orderType == ApprovePassOrderDto.OrderType.SALE_RETURN) { + return OrderChartBizType.SALE_RETURN; + } + if (orderType == ApprovePassOrderDto.OrderType.RETAIL_OUT_SHEET) { + return OrderChartBizType.RETAIL_OUT_SHEET; + } + if (orderType == ApprovePassOrderDto.OrderType.RETAIL_RETURN) { + return OrderChartBizType.RETAIL_RETURN; + } + + return null; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/mappers/OrderChartMapper.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/mappers/OrderChartMapper.java new file mode 100644 index 0000000..5b71cde --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/mappers/OrderChartMapper.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.chart.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.entity.OrderChart; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-19 + */ +public interface OrderChartMapper extends BaseMapper { + + /** + * 汇总数据 + * + * @param bizTypes + * @param startTime + * @param endTime + * @return + */ + OrderChartSumDto getChartSum(@Param("bizTypes") List bizTypes, + @Param("startTime") LocalDateTime startTime, + @Param("endTime") LocalDateTime endTime); + + /** + * 查询列表 + * + * @param bizTypes + * @param startTime + * @param endTime + * @return + */ + List querySameMonth(@Param("bizTypes") List bizTypes, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); + + /** + * 查询当日数据列表 + * + * @param bizTypes + * @param startTime + * @param endTime + * @return + */ + List queryToday(@Param("bizTypes") List bizTypes, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/service/OrderChartService.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/service/OrderChartService.java new file mode 100644 index 0000000..a9a7dc5 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/service/OrderChartService.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.chart.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.entity.OrderChart; +import com.lframework.xingyun.chart.vo.CreateOrderChartVo; +import com.lframework.xingyun.chart.vo.GetOrderChartVo; +import com.lframework.xingyun.chart.vo.QueryOrderChartVo; + +import java.util.List; + +public interface OrderChartService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateOrderChartVo vo); + + /** + * 查询当日汇总数据 + * + * @param vo + * @return + */ + OrderChartSumDto getTodayChartSum(GetOrderChartVo vo); + + /** + * 查询当月汇总数据 + * + * @param vo + * @return + */ + OrderChartSumDto getSameMonthChartSum(GetOrderChartVo vo); + + /** + * 查询当日数据 + * + * @param vo + * @return + */ + List queryTodayChart(QueryOrderChartVo vo); + + /** + * 查询当月数据 + * + * @param vo + * @return + */ + List querySameMonthChart(QueryOrderChartVo vo); +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/CreateOrderChartVo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/CreateOrderChartVo.java new file mode 100644 index 0000000..b5cc365 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/CreateOrderChartVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.chart.vo; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class CreateOrderChartVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + @Schema(description = "单据总金额", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "单据总金额不能为空!") + private BigDecimal totalAmount; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不存在!", enumClass = OrderChartBizType.class) + private Integer bizType; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/GetOrderChartVo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/GetOrderChartVo.java new file mode 100644 index 0000000..794b142 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/GetOrderChartVo.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.chart.vo; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class GetOrderChartVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "业务类型不能为空!") + private List bizTypes; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/QueryOrderChartVo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/QueryOrderChartVo.java new file mode 100644 index 0000000..6d0b0af --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/QueryOrderChartVo.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.chart.vo; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class QueryOrderChartVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "业务类型不能为空!") + private List bizTypes; +} diff --git a/xingyun-chart/src/main/java/lombok.config b/xingyun-chart/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-chart/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-chart/src/main/resources/mappers/OrderChartMapper.xml b/xingyun-chart/src/main/resources/mappers/OrderChartMapper.xml new file mode 100644 index 0000000..03a6246 --- /dev/null +++ b/xingyun-chart/src/main/resources/mappers/OrderChartMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xingyun-comp/pom.xml b/xingyun-comp/pom.xml new file mode 100644 index 0000000..7589d58 --- /dev/null +++ b/xingyun-comp/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + com.lframework + xingyun + 1.0.0 + + + xingyun-comp + + + + com.lframework + xingyun-core + + + + com.lframework + web-starter + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + + + + \ No newline at end of file diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/MapLocationBo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/MapLocationBo.java new file mode 100644 index 0000000..5ee279f --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/MapLocationBo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.comp.bo.components; + +import com.lframework.starter.web.core.bo.BaseBo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class MapLocationBo extends BaseBo { + + /** + * 经度 + */ + @Schema(description = "经度") + private BigDecimal lng; + + /** + * 纬度 + */ + @Schema(description = "纬度") + private BigDecimal lat; +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/OrderTimeLineBo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/OrderTimeLineBo.java new file mode 100644 index 0000000..50137fb --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/components/OrderTimeLineBo.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.comp.bo.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.inner.entity.OrderTimeLine; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author zmj + * @since 2022/8/10 + */ +@Data +public class OrderTimeLineBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 订单ID + */ + @Schema(description = "订单ID") + private String orderId; + + /** + * 描述内容 + */ + @Schema(description = "描述内容") + private String content; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + private Integer bizType; + + public OrderTimeLineBo() { + } + + public OrderTimeLineBo(OrderTimeLine dto) { + super(dto); + } + + @Override + protected void afterInit(OrderTimeLine dto) { + + this.bizType = dto.getBizType(); + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/dic/CitySelectorBo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/dic/CitySelectorBo.java new file mode 100644 index 0000000..e7ee893 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/dic/CitySelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.comp.bo.dic; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class CitySelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 父级ID + */ + @Schema(description = "父级ID") + private String parentId; + + public CitySelectorBo() { + + } + + public CitySelectorBo(DicCityDto dto) { + + super(dto); + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/GetOnlineExcelBo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/GetOnlineExcelBo.java new file mode 100644 index 0000000..c344afd --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/GetOnlineExcelBo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.comp.bo.sw.excel; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.comp.entity.OnlineExcel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 在线Excel GetBo + *

+ */ +@Data +public class GetOnlineExcelBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public GetOnlineExcelBo() { + + } + + public GetOnlineExcelBo(OnlineExcel dto) { + + super(dto); + } + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/QueryOnlineExcelBo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/QueryOnlineExcelBo.java new file mode 100644 index 0000000..17d7c02 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/excel/QueryOnlineExcelBo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.comp.bo.sw.excel; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.comp.entity.OnlineExcel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 在线Excel QueryBo + *

+ */ +@Data +public class QueryOnlineExcelBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryOnlineExcelBo() { + + } + + public QueryOnlineExcelBo(OnlineExcel dto) { + + super(dto); + } + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/GetFileBoxBo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/GetFileBoxBo.java new file mode 100644 index 0000000..b97c94a --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/GetFileBoxBo.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.comp.bo.sw.filebox; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.comp.entity.FileBox; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 文件收纳箱 GetBo + *

+ */ +@Data +public class GetFileBoxBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 上传记录ID + */ + @Schema(description = "上传记录ID") + private String recordId; + + /** + * 上传类型 + */ + @Schema(description = "上传类型") + private String contentType; + + @Schema(description = "文件类型") + @EnumConvert + private Integer fileType; + + /** + * 文件大小 + */ + @Schema(description = "文件大小") + private String fileSize; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + public GetFileBoxBo() { + + } + + public GetFileBoxBo(FileBox dto) { + + super(dto); + } + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/QueryFileBoxBo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/QueryFileBoxBo.java new file mode 100644 index 0000000..65ce23d --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/bo/sw/filebox/QueryFileBoxBo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.comp.bo.sw.filebox; + +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.comp.entity.FileBox; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 文件收纳箱 QueryBo + *

+ */ +@Data +public class QueryFileBoxBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + @Schema(description = "文件大小") + private String fileSize; + + @Schema(description = "文件类型") + @EnumConvert + private Integer fileType; + + @Schema(description = "文件路径") + private String filePath; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + public QueryFileBoxBo() { + + } + + public QueryFileBoxBo(FileBox dto) { + + super(dto); + } + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SecurityDownloadController.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SecurityDownloadController.java new file mode 100644 index 0000000..a52ea4d --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SecurityDownloadController.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.comp.controller; + +import com.lframework.starter.common.exceptions.impl.AccessDeniedException; +import com.lframework.starter.common.utils.FileUtil; +import com.lframework.starter.web.core.components.redis.RedisHandler; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ResponseUtil; +import com.lframework.starter.web.core.utils.UploadUtil; +import com.lframework.starter.web.inner.entity.SecurityUploadRecord; +import com.lframework.starter.web.inner.service.SecurityUploadRecordService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.constraints.NotBlank; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.File; + +/** + * 安全下载 + * + * @author zmj + */ +@Tag(name = "安全下载") +@Slf4j +@Validated +@RestController +@ConditionalOnBean(SecurityUploadRecordService.class) +@RequestMapping(" /download/security") +public class SecurityDownloadController extends DefaultBaseController { + + @Autowired + private SecurityUploadRecordService securityUploadRecordService; + + @Autowired + private RedisHandler redisHandler; + + @Operation(summary = "下载文件(获取签名URL)") + @Parameter(description = "ID", name = "id", required = true) + @GetMapping("/url") + public InvokeResult getSecurityDownloadUrl(@NotBlank(message = "ID不能为空!") String id) { + SecurityUploadRecord record = securityUploadRecordService.getById(id); + if (record == null) { + throw new AccessDeniedException(); + } + + if (!record.getCreateById().equals(getCurrentUser().getId())) { + throw new AccessDeniedException(); + } + + return InvokeResultBuilder.success( + UploadUtil.generatePresignedUrl(record.getUploadType().getCode(), record.getFilePath())); + } + + @Operation(summary = "下载文件") + @Parameter(description = "签名", name = "sign", required = true) + @GetMapping + public void download(@NotBlank(message = "签名不能为空!") String sign) { + Object val = redisHandler.hget("security-upload", sign); + if (val == null) { + throw new AccessDeniedException(); + } + + File file = new File(val.toString()); + if (!FileUtil.exist(file) || !FileUtil.isFile(file)) { + log.info("下载的文件不存在,sign {} val {}", sign, val); + throw new AccessDeniedException(); + } + + ResponseUtil.download(file); + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SelectorController.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SelectorController.java new file mode 100644 index 0000000..29a5a6c --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/SelectorController.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.comp.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.comp.bo.dic.CitySelectorBo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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; +import java.util.stream.Collectors; + +/** + * 数据选择器 + * + * @author zmj + */ +@Tag(name = "数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class SelectorController extends DefaultBaseController { + + @Autowired + private DicCityService dicCityService; + + /** + * 城市数据 + */ + @Operation(summary = "城市数据") + @GetMapping("/city") + public InvokeResult> dicCity() { + + List datas = dicCityService.getAll(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(CitySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/components/ComponentController.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/components/ComponentController.java new file mode 100644 index 0000000..a2f1f91 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/components/ComponentController.java @@ -0,0 +1,172 @@ +package com.lframework.xingyun.comp.controller.components; + +import cn.hutool.crypto.SecureUtil; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.FileUtil; +import com.lframework.starter.web.core.bo.ExcelImportBo; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelImportUtil; +import com.lframework.starter.web.core.utils.HttpUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.starter.web.core.utils.UploadUtil; +import com.lframework.starter.web.inner.entity.OrderTimeLine; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.OrderTimeLineService; +import com.lframework.starter.web.inner.service.SysConfService; +import com.lframework.xingyun.comp.bo.components.MapLocationBo; +import com.lframework.xingyun.comp.bo.components.OrderTimeLineBo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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 org.springframework.web.multipart.MultipartFile; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 公共组件 Controller + */ +@Slf4j +@Tag(name = "公共组件") +@Validated +@RestController +@RequestMapping("/component") +public class ComponentController extends DefaultBaseController { + + @Autowired + private SysConfService sysConfService; + + @Autowired + private OrderTimeLineService orderTimeLineService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Operation(summary = "查询导入Excel任务") + @GetMapping("/import/task") + public InvokeResult getExcelImportTask( + @NotBlank(message = "ID不能为空!") String id) { + + return InvokeResultBuilder.success(ExcelImportUtil.getTask(id)); + } + + @Operation(summary = "获取地图Key") + @GetMapping("/map/key") + public InvokeResult getMapKey() { + String key = sysConfService.findRequiredByKey("tx-map.key"); + + return InvokeResultBuilder.success(key); + } + + @Operation(summary = "根据地址查询经纬度") + @GetMapping("/map/location") + public InvokeResult getMapLocation( + @NotEmpty(message = "地址不能为空!") String address) { + + String key = sysConfService.findRequiredByKey("tx-map.key"); + String secret = sysConfService.findRequiredByKey("tx-map.secret"); + + // 请求腾讯地图WebService Api + // Api文档地址:https://lbs.qq.com/service/webService/webServiceGuide/webServiceGeocoder + String baseUrl = "https://apis.map.qq.com/"; + String uri = "/ws/geocoder/v1/"; + String reqParams = "?address=" + address + "&key=" + key; + + // Api使用签名方式 + // 签名文档:https://lbs.qq.com/faq/serverFaq/webServiceKey + String sign = SecureUtil.md5(uri + reqParams + secret); + Map reqMap = new HashMap<>(); + reqMap.put("address", address); + reqMap.put("key", key); + reqMap.put("sig", sign); + + try { + String resp = HttpUtil.doGet(baseUrl + uri, reqMap); + Map respMap = JsonUtil.parseObject(resp, Map.class); + if (!"0".equals(String.valueOf(respMap.get("status")))) { + throw new DefaultClientException(String.valueOf(respMap.get("message"))); + } + + Map result = (Map) respMap.get("result"); + Map location = (Map) result.get("location"); + MapLocationBo bo = new MapLocationBo(); + bo.setLng(new BigDecimal(String.valueOf(location.get("lng")))); + bo.setLat(new BigDecimal(String.valueOf(location.get("lat")))); + + return InvokeResultBuilder.success(bo); + } catch (ClientException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultClientException("解析地址失败,请稍后再试!"); + } + } + + @Operation(summary = "单据时间轴") + @Parameter(description = "单据ID", name = "orderId", required = true) + @GetMapping("/timeline/order") + public InvokeResult> getOrderTimeLine( + @NotBlank(message = "单据ID不能为空!") String orderId) { + + List datas = orderTimeLineService.getByOrder(orderId); + List results = datas.stream().map(OrderTimeLineBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @Operation(summary = "通用上传图片") + @PostMapping("/upload/image") + public InvokeResult uploadImage(MultipartFile file) { + if (!FileUtil.IMG_SUFFIX.contains( + FileUtil.getSuffix(file.getOriginalFilename()).toLowerCase())) { + throw new DefaultClientException( + "上传图片仅支持【" + CollectionUtil.join(FileUtil.IMG_SUFFIX, StringPool.STR_SPLIT_CN) + + "】格式!"); + } + + String url = UploadUtil.upload(file).getUrl(); + + return InvokeResultBuilder.success(url); + } + + @Operation(summary = "通用上传视频") + @PostMapping("/upload/video") + public InvokeResult uploadVideo(MultipartFile file) { + if (!FileUtil.VIDEO_SUFFIX.contains( + FileUtil.getSuffix(file.getOriginalFilename()).toLowerCase())) { + throw new DefaultClientException( + "上传视频仅支持【" + CollectionUtil.join(FileUtil.VIDEO_SUFFIX, StringPool.STR_SPLIT_CN) + + "】格式!"); + } + + String url = UploadUtil.upload(file).getUrl(); + + return InvokeResultBuilder.success(url); + } + + @Operation(summary = "获取编号") + @Parameter(description = "编号类型", name = "type", required = true) + @GetMapping("/generate/code") + public InvokeResult generateCode(@NotNull(message = "编号类型不能为空!") Integer type) { + return InvokeResultBuilder.success(generateCodeService.generate(type)); + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/FileBoxController.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/FileBoxController.java new file mode 100644 index 0000000..008bf09 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/FileBoxController.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.comp.controller.sw; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.comp.bo.sw.filebox.GetFileBoxBo; +import com.lframework.xingyun.comp.bo.sw.filebox.QueryFileBoxBo; +import com.lframework.xingyun.comp.entity.FileBox; +import com.lframework.xingyun.comp.service.FileBoxService; +import com.lframework.xingyun.comp.vo.sw.filebox.CreateFileBoxDirVo; +import com.lframework.xingyun.comp.vo.sw.filebox.QueryFileBoxVo; +import com.lframework.xingyun.comp.vo.sw.filebox.UpdateFileBoxVo; +import com.lframework.xingyun.comp.vo.sw.filebox.UploadFileBoxVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 文件收纳箱 Controller + */ +@Tag(name = "文件收纳箱") +@Validated +@RestController +@RequestMapping("/sw/filebox") +public class FileBoxController extends DefaultBaseController { + + @Autowired + private FileBoxService fileBoxService; + + @Operation(summary = "创建文件夹") + @PostMapping("/dir") + public InvokeResult createDir(@Valid CreateFileBoxDirVo vo) { + + fileBoxService.createDir(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 上传文件 + */ + @Operation(summary = "上传文件") + @PostMapping("/upload") + public InvokeResult upload(@Valid UploadFileBoxVo vo) { + + fileBoxService.upload(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryFileBoxVo vo) { + + PageResult pageResult = fileBoxService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryFileBoxBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "id", name = "id", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + FileBox data = fileBoxService.findById(id); + if (data == null) { + throw new DefaultClientException("文件收纳箱不存在!"); + } + + GetFileBoxBo result = new GetFileBoxBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @PutMapping + public InvokeResult update(@Valid UpdateFileBoxVo vo) { + + fileBoxService.update(vo); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "删除") + @DeleteMapping + public InvokeResult deleteById(@NotEmpty(message = "ID不能为空!") String id) { + fileBoxService.deleteById(id); + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/OnlineExcelController.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/OnlineExcelController.java new file mode 100644 index 0000000..9769577 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/controller/sw/OnlineExcelController.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.comp.controller.sw; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.comp.bo.sw.excel.GetOnlineExcelBo; +import com.lframework.xingyun.comp.bo.sw.excel.QueryOnlineExcelBo; +import com.lframework.xingyun.comp.entity.OnlineExcel; +import com.lframework.xingyun.comp.service.OnlineExcelService; +import com.lframework.xingyun.comp.vo.sw.excel.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 在线Excel Controller + */ +@Tag(name = "在线Excel") +@Validated +@RestController +@RequestMapping("/sw/excel") +public class OnlineExcelController extends DefaultBaseController { + + @Autowired + private OnlineExcelService onlineExcelService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryOnlineExcelVo vo) { + + PageResult pageResult = onlineExcelService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryOnlineExcelBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "id", name = "id", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + OnlineExcel data = onlineExcelService.findById(id); + if (data == null) { + throw new DefaultClientException("在线Excel不存在!"); + } + + GetOnlineExcelBo result = new GetOnlineExcelBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @PostMapping + public InvokeResult create(@Valid CreateOnlineExcelVo vo) { + + onlineExcelService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @PutMapping + public InvokeResult update(@Valid UpdateOnlineExcelVo vo) { + + onlineExcelService.update(vo); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "查询内容") + @Parameter(description = "id", name = "id", required = true) + @GetMapping("/content") + public InvokeResult getContent(@NotBlank(message = "id不能为空!") String id) { + + OnlineExcel data = onlineExcelService.findById(id); + if (data == null) { + throw new DefaultClientException("文件不存在!"); + } + + return InvokeResultBuilder.success(data.getContent()); + } + + @Operation(summary = "修改内容") + @PutMapping("/content") + public InvokeResult updateContent(@Valid UpdateOnlineExcelContentVo vo) { + + onlineExcelService.updateContent(vo); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "发送文件给他人") + @PostMapping("/send") + public InvokeResult send(@Valid SendOnlineExcelVo vo) { + + if (vo.getUserId().equals(SecurityUtil.getCurrentUser().getId())) { + throw new DefaultClientException("文件不能发送给自己!"); + } + + onlineExcelService.send(vo); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "批量发送文件给他人") + @PostMapping("/send/batch") + public InvokeResult batchSend(@Valid @RequestBody BatchSendOnlineExcelVo vo) { + + if (vo.getUserId().equals(SecurityUtil.getCurrentUser().getId())) { + throw new DefaultClientException("文件不能发送给自己!"); + } + + onlineExcelService.batchSend(vo); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/FileBox.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/FileBox.java new file mode 100644 index 0000000..d667032 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/FileBox.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.comp.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.comp.enums.FileBoxFileType; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 文件收纳箱 + *

+ */ +@Data +@TableName("sw_file_box") +public class FileBox extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "FileBox"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 上传记录ID + */ + private String recordId; + + /** + * ContentType + */ + private String contentType; + + /** + * 文件类型 + */ + private FileBoxFileType fileType; + + /** + * 文件大小 + */ + private String fileSize; + + /** + * 文件路径 + */ + private String filePath; + + /** + * 文件后缀 + */ + private String fileSuffix; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/OnlineExcel.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/OnlineExcel.java new file mode 100644 index 0000000..e10dae4 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/entity/OnlineExcel.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.comp.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 在线Excel + *

+ */ +@Data +@TableName("sw_online_excel") +public class OnlineExcel extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "OnlineExcel"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 内容 + */ + private String content; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxFileType.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxFileType.java new file mode 100644 index 0000000..cf9998f --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxFileType.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.comp.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum FileBoxFileType implements BaseEnum { + DIR(0, "目录"), + FILE(1, "文件"), + ; + + @EnumValue + private final Integer code; + + private final String desc; + + FileBoxFileType(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getDesc() { + return this.desc; + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxNodeType.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxNodeType.java new file mode 100644 index 0000000..61d0771 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/FileBoxNodeType.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.comp.enums; + +import com.lframework.starter.web.inner.enums.system.NodeType; +import org.springframework.stereotype.Component; + +import java.io.Serializable; + +@Component +public final class FileBoxNodeType implements NodeType, Serializable { + + private static final long serialVersionUID = 1L; + + @Override + public Integer getCode() { + + return 3; + } + + @Override + public String getDesc() { + + return "文件收纳箱"; + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/SwOpLogType.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/SwOpLogType.java new file mode 100644 index 0000000..9dc2751 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/enums/SwOpLogType.java @@ -0,0 +1,12 @@ +package com.lframework.xingyun.comp.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class SwOpLogType implements OpLogType { + @Override + public Integer getCode() { + return 4000; + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/FileBoxServiceImpl.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/FileBoxServiceImpl.java new file mode 100644 index 0000000..bfd8978 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/FileBoxServiceImpl.java @@ -0,0 +1,210 @@ +package com.lframework.xingyun.comp.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.*; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.components.upload.client.dto.UploadDto; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.service.RecursionMappingService; +import com.lframework.xingyun.comp.entity.FileBox; +import com.lframework.xingyun.comp.enums.FileBoxFileType; +import com.lframework.xingyun.comp.enums.FileBoxNodeType; +import com.lframework.xingyun.comp.enums.SwOpLogType; +import com.lframework.xingyun.comp.mappers.FileBoxMapper; +import com.lframework.xingyun.comp.service.FileBoxService; +import com.lframework.xingyun.comp.vo.sw.filebox.CreateFileBoxDirVo; +import com.lframework.xingyun.comp.vo.sw.filebox.QueryFileBoxVo; +import com.lframework.xingyun.comp.vo.sw.filebox.UpdateFileBoxVo; +import com.lframework.xingyun.comp.vo.sw.filebox.UploadFileBoxVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@Service +public class FileBoxServiceImpl extends + BaseMpServiceImpl implements FileBoxService { + + @Autowired + private RecursionMappingService recursionMappingService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryFileBoxVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryFileBoxVo vo) { + + return getBaseMapper().query(vo, SecurityUtil.getCurrentUser().getId()); + } + + @Override + public FileBox findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SwOpLogType.class, name = "修改文件,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateFileBoxVo vo) { + + FileBox data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("文件或文件夹不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(FileBox.class) + .set(data.getFileType() != FileBoxFileType.DIR, FileBox::getName, vo.getName()) + .set(FileBox::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR + : vo.getDescription()) + .eq(FileBox::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.class, name = "删除文件,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + List delIds = new ArrayList<>(); + delIds.add(id); + + List childIds = recursionMappingService.getNodeChildIds(id, + FileBoxNodeType.class); + delIds.addAll(childIds); + + recursionMappingService.deleteNodeAndChildren(id, + FileBoxNodeType.class); + + Wrapper deleteWrapper = Wrappers.lambdaQuery(FileBox.class) + .in(FileBox::getId, delIds) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + this.remove(deleteWrapper); + } + + @OpLog(type = SwOpLogType.class, name = "创建文件夹,父级目录:{},文件夹名称:{}", params = { + "#vo.parentPath", "#vo.name"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void createDir(CreateFileBoxDirVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(FileBox.class) + .eq(FileBox::getName, vo.getName()).eq(FileBox::getFilePath, vo.getParentPath()) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("文件夹名称重复,请重新输入!"); + } + FileBox dir = new FileBox(); + dir.setId(IdUtil.getId()); + dir.setName(vo.getName()); + dir.setFileType(FileBoxFileType.DIR); + dir.setFilePath(vo.getParentPath()); + dir.setDescription(StringPool.EMPTY_STR); + + this.save(dir); + + if ("/".equals(vo.getParentPath())) { + recursionMappingService.saveNode(dir.getId(), + FileBoxNodeType.class); + } else { + String path = vo.getParentPath().substring(0, + vo.getParentPath().lastIndexOf("/") == 0 ? 1 : vo.getParentPath().lastIndexOf("/")); + String name = vo.getParentPath().substring(vo.getParentPath().lastIndexOf("/") + 1); + + Wrapper queryWrapper = Wrappers.lambdaQuery(FileBox.class) + .eq(FileBox::getName, name).eq(FileBox::getFilePath, path) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + FileBox fileBox = this.getOne(queryWrapper); + if (fileBox == null) { + throw new DefaultClientException("父级目录不存在!"); + } + + List parentIds = recursionMappingService.getNodeParentIds(fileBox.getId(), + FileBoxNodeType.class); + parentIds.add(fileBox.getId()); + + recursionMappingService.saveNode(dir.getId(), + FileBoxNodeType.class, parentIds); + } + } + + @OpLog(type = SwOpLogType.class, name = "上传文件,父级目录:{},文件名称:{}", params = { + "#vo.path", "#vo.name"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void upload(UploadFileBoxVo vo) { + MultipartFile file = vo.getFile(); + UploadDto uploadDto = UploadUtil.upload(file, + CollectionUtil.toList("filebox", SecurityUtil.getCurrentUser().getId()), true); + + String recordId = uploadDto.getSecurityUploadRecordId(); + + FileBox record = new FileBox(); + record.setId(IdUtil.getId()); + record.setName(file.getOriginalFilename()); + record.setRecordId(recordId); + record.setContentType(file.getContentType()); + record.setFileType(FileBoxFileType.FILE); + record.setFileSize(FileUtil.readableFileSize(file.getSize())); + record.setFilePath(vo.getPath()); + record.setFileSuffix(FileUtil.getSuffix(file.getOriginalFilename())); + record.setDescription(StringPool.EMPTY_STR); + + this.save(record); + + if ("/".equals(vo.getPath())) { + recursionMappingService.saveNode(record.getId(), + FileBoxNodeType.class); + } else { + String path = vo.getPath() + .substring(0, vo.getPath().lastIndexOf("/") == 0 ? 1 : vo.getPath().lastIndexOf("/")); + String name = vo.getPath().substring(vo.getPath().lastIndexOf("/") + 1); + + Wrapper queryWrapper = Wrappers.lambdaQuery(FileBox.class) + .eq(FileBox::getName, name).eq(FileBox::getFilePath, path) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + FileBox fileBox = this.getOne(queryWrapper); + if (fileBox == null) { + throw new DefaultClientException("父级目录不存在!"); + } + + List parentIds = recursionMappingService.getNodeParentIds(fileBox.getId(), + FileBoxNodeType.class); + parentIds.add(fileBox.getId()); + + recursionMappingService.saveNode(record.getId(), + FileBoxNodeType.class, parentIds); + } + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/OnlineExcelServiceImpl.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/OnlineExcelServiceImpl.java new file mode 100644 index 0000000..a37f71e --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/impl/OnlineExcelServiceImpl.java @@ -0,0 +1,201 @@ +package com.lframework.xingyun.comp.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.comp.entity.OnlineExcel; +import com.lframework.xingyun.comp.enums.SwOpLogType; +import com.lframework.xingyun.comp.mappers.OnlineExcelMapper; +import com.lframework.xingyun.comp.service.OnlineExcelService; +import com.lframework.xingyun.comp.vo.sw.excel.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Service +public class OnlineExcelServiceImpl extends + BaseMpServiceImpl implements OnlineExcelService { + + @Autowired + private SysUserService userService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryOnlineExcelVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryOnlineExcelVo vo) { + + return getBaseMapper().query(vo, SecurityUtil.getCurrentUser().getId()); + } + + @Override + public OnlineExcel findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SwOpLogType.class, name = "新增在线Excel,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateOnlineExcelVo vo) { + + OnlineExcel data = new OnlineExcel(); + data.setId(IdUtil.getId()); + data.setName(vo.getName()); + data.setContent(vo.getContent()); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = SwOpLogType.class, name = "修改在线Excel,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateOnlineExcelVo vo) { + + OnlineExcel data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("在线Excel不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(OnlineExcel.class) + .set(OnlineExcel::getName, vo.getName()).set(OnlineExcel::getAvailable, vo.getAvailable()) + .set(OnlineExcel::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(OnlineExcel::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.class, name = "修改在线Excel内容,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void updateContent(UpdateOnlineExcelContentVo vo) { + OnlineExcel data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("在线Excel不存在!"); + } + + Map content = JsonUtil.parseObject(data.getContent(), Map.class); + List sheets = JsonUtil.parseList(vo.getContent(), Map.class); + content.put("sheets", sheets); + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(OnlineExcel.class) + .set(OnlineExcel::getContent, JsonUtil.toJsonString(content)) + .eq(OnlineExcel::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.class, name = "发送Excel文件,发送方{}, 接收方{}", params = {"#sender", + "#receiver"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void send(SendOnlineExcelVo vo) { + + OnlineExcel record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("Excel文件不存在!"); + } + + SysUser receiver = userService.findById(vo.getUserId()); + if (receiver == null) { + throw new DefaultClientException("接收方不存在!"); + } + + if (vo.getSelfSave()) { + record.setId(IdUtil.getId()); + record.setAvailable(Boolean.TRUE); + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + this.save(record); + } else { + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + record.setAvailable(Boolean.TRUE); + this.updateById(record); + } + + OpLogUtil.setVariable("sender", SecurityUtil.getCurrentUser().getId()); + OpLogUtil.setVariable("receiver", vo.getUserId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.class, name = "批量发送Excel文件,发送方{}, 接收方{}", params = {"#sender", + "#receiver"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchSend(BatchSendOnlineExcelVo vo) { + + SysUser receiver = userService.findById(vo.getUserId()); + if (receiver == null) { + throw new DefaultClientException("接收方不存在!"); + } + + for (String id : vo.getIds()) { + OnlineExcel record = this.getById(id); + if (record == null) { + throw new DefaultClientException("Excel文件不存在!"); + } + + if (vo.getSelfSave()) { + record.setId(IdUtil.getId()); + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + record.setAvailable(Boolean.TRUE); + this.save(record); + } else { + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + record.setAvailable(Boolean.TRUE); + this.updateById(record); + } + } + + OpLogUtil.setVariable("sender", SecurityUtil.getCurrentUser().getId()); + OpLogUtil.setVariable("receiver", vo.getUserId()); + OpLogUtil.setExtra(vo); + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/FileBoxMapper.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/FileBoxMapper.java new file mode 100644 index 0000000..0db2cd0 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/FileBoxMapper.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.comp.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.comp.entity.FileBox; +import com.lframework.xingyun.comp.vo.sw.filebox.QueryFileBoxVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 收件收纳箱 Mapper 接口 + *

+ */ +public interface FileBoxMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryFileBoxVo vo, @Param("createById") String createById); +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/OnlineExcelMapper.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/OnlineExcelMapper.java new file mode 100644 index 0000000..c55b621 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/mappers/OnlineExcelMapper.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.comp.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.comp.entity.OnlineExcel; +import com.lframework.xingyun.comp.vo.sw.excel.QueryOnlineExcelVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 在线Excel Mapper 接口 + *

+ */ +public interface OnlineExcelMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryOnlineExcelVo vo, @Param("createById") String createById); +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/FileBoxService.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/FileBoxService.java new file mode 100644 index 0000000..56e5c3c --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/FileBoxService.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.comp.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.comp.entity.FileBox; +import com.lframework.xingyun.comp.vo.sw.filebox.CreateFileBoxDirVo; +import com.lframework.xingyun.comp.vo.sw.filebox.QueryFileBoxVo; +import com.lframework.xingyun.comp.vo.sw.filebox.UpdateFileBoxVo; +import com.lframework.xingyun.comp.vo.sw.filebox.UploadFileBoxVo; + +import java.util.List; + +/** + * 文件收纳箱 Service + */ +public interface FileBoxService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryFileBoxVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryFileBoxVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + FileBox findById(String id); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateFileBoxVo vo); + + + /** + * 根据ID删除 + * @param id + */ + void deleteById(String id); + + /** + * 创建文件夹 + * @param vo + */ + void createDir(CreateFileBoxDirVo vo); + + /** + * 上传文件 + * @param vo + */ + void upload(UploadFileBoxVo vo); + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/OnlineExcelService.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/OnlineExcelService.java new file mode 100644 index 0000000..844502d --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/service/OnlineExcelService.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.comp.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.comp.entity.OnlineExcel; +import com.lframework.xingyun.comp.vo.sw.excel.*; + +import java.util.List; + +/** + * 在线Excel Service + */ +public interface OnlineExcelService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryOnlineExcelVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryOnlineExcelVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + OnlineExcel findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateOnlineExcelVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateOnlineExcelVo vo); + + /** + * 修改内容 + * + * @param vo + */ + void updateContent(UpdateOnlineExcelContentVo vo); + + /** + * 发送 + * + * @param vo + */ + void send(SendOnlineExcelVo vo); + + /** + * 批量发送 + * + * @param vo + */ + void batchSend(BatchSendOnlineExcelVo vo); + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/BatchSendOnlineExcelVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/BatchSendOnlineExcelVo.java new file mode 100644 index 0000000..0942e5d --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/BatchSendOnlineExcelVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.comp.vo.sw.excel; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class BatchSendOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "ID不能为空!") + private List ids; + + /** + * 用户ID + */ + @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "用户ID不能为空!") + private String userId; + + /** + * 是否留存副本 + */ + @Schema(description = "是否留存副本", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否留存副本不能为空!") + @TypeMismatch(message = "是否留存副本格式错误!") + private Boolean selfSave; +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/CreateOnlineExcelVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/CreateOnlineExcelVo.java new file mode 100644 index 0000000..3c61ba3 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/CreateOnlineExcelVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.comp.vo.sw.excel; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 内容 + */ + @Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入内容!") + private String content; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/QueryOnlineExcelVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/QueryOnlineExcelVo.java new file mode 100644 index 0000000..1949c06 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/QueryOnlineExcelVo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.comp.vo.sw.excel; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryOnlineExcelVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 状态 + */ + @Schema(description = "状态") + @TypeMismatch(message = "状态格式有误!") + private Boolean available; + + /** + * 创建时间 起始时间 + */ + @Schema(description = "创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @Schema(description = "创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/SendOnlineExcelVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/SendOnlineExcelVo.java new file mode 100644 index 0000000..88960ee --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/SendOnlineExcelVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.comp.vo.sw.excel; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SendOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 用户ID + */ + @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "用户ID不能为空!") + private String userId; + + /** + * 是否留存副本 + */ + @Schema(description = "是否留存副本", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否留存副本不能为空!") + @TypeMismatch(message = "是否留存副本格式错误!") + private Boolean selfSave; +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelContentVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelContentVo.java new file mode 100644 index 0000000..66e1569 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelContentVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.comp.vo.sw.excel; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateOnlineExcelContentVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 内容 + */ + @Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "内容不能为空!") + private String content; +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelVo.java new file mode 100644 index 0000000..e9682c2 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/excel/UpdateOnlineExcelVo.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.comp.vo.sw.excel; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED) + @TypeMismatch(message = "状态格式有误!") + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/CreateFileBoxDirVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/CreateFileBoxDirVo.java new file mode 100644 index 0000000..9efcf3c --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/CreateFileBoxDirVo.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.comp.vo.sw.filebox; + +import com.lframework.starter.web.core.components.validation.Pattern; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateFileBoxDirVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "父级目录", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "父级目录不能为空!") + private String parentPath; + + @Schema(description = "文件夹名称", requiredMode = Schema.RequiredMode.REQUIRED) + @Pattern(regexp = "^(?!^\\.)[^\\/:*?\"<>|\\s].*$", message = "文件夹名称不合法!") + @NotBlank(message = "文件夹名称不能为空!") + private String name; +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/QueryFileBoxVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/QueryFileBoxVo.java new file mode 100644 index 0000000..6dc163b --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/QueryFileBoxVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.comp.vo.sw.filebox; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryFileBoxVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + @Schema(description = "路径") + private String path; +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UpdateFileBoxVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UpdateFileBoxVo.java new file mode 100644 index 0000000..344c0e4 --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UpdateFileBoxVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.comp.vo.sw.filebox; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateFileBoxVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + +} diff --git a/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UploadFileBoxVo.java b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UploadFileBoxVo.java new file mode 100644 index 0000000..a06464a --- /dev/null +++ b/xingyun-comp/src/main/java/com/lframework/xingyun/comp/vo/sw/filebox/UploadFileBoxVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.comp.vo.sw.filebox; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import java.io.Serializable; + +@Data +public class UploadFileBoxVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 文件 + */ + @Schema(description = "文件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "文件不能为空!") + private MultipartFile file; + + @Schema(description = "路径", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "路径不能为空!") + private String path; +} diff --git a/xingyun-comp/src/main/java/lombok.config b/xingyun-comp/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-comp/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-comp/src/main/resources/mappers/FileBoxMapper.xml b/xingyun-comp/src/main/resources/mappers/FileBoxMapper.xml new file mode 100644 index 0000000..bed0c3d --- /dev/null +++ b/xingyun-comp/src/main/resources/mappers/FileBoxMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + SELECT tb.* + FROM sw_file_box AS tb + + diff --git a/xingyun-comp/src/main/resources/mappers/OnlineExcelMapper.xml b/xingyun-comp/src/main/resources/mappers/OnlineExcelMapper.xml new file mode 100644 index 0000000..11ae7be --- /dev/null +++ b/xingyun-comp/src/main/resources/mappers/OnlineExcelMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + SELECT tb.id, + tb.name, + tb.content, + tb.available, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM sw_online_excel AS tb + + diff --git a/xingyun-core/pom.xml b/xingyun-core/pom.xml new file mode 100644 index 0000000..bdd2285 --- /dev/null +++ b/xingyun-core/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + com.lframework + xingyun + 1.0.0 + + + xingyun-core + + + + + com.lframework + common + + + + com.lframework + rabbitmq-starter + + + org.ssssssss + magic-api-spring-boot-starter + + + org.ssssssss + magic-api-plugin-cluster + + + org.ssssssss + magic-api-servlet-javaee + + + org.ssssssss + magic-api-servlet-jakarta + + + + + + com.lframework + bpm-starter + + + org.ssssssss + magic-api-spring-boot-starter + + + org.ssssssss + magic-api-plugin-cluster + + + org.ssssssss + magic-api-servlet-javaee + + + org.ssssssss + magic-api-servlet-jakarta + + + + + + \ No newline at end of file diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/components/timeline/ReceiveOrderTimeLineBizType.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/components/timeline/ReceiveOrderTimeLineBizType.java new file mode 100644 index 0000000..f9fa899 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/components/timeline/ReceiveOrderTimeLineBizType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.core.components.timeline; + +import com.lframework.starter.web.core.components.timeline.OrderTimeLineBizType; +import org.springframework.stereotype.Component; + +@Component +public class ReceiveOrderTimeLineBizType implements OrderTimeLineBizType { + + @Override + public Integer getCode() { + return 7; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqConstants.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqConstants.java new file mode 100644 index 0000000..84bbec9 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqConstants.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.core.queue; + +import com.lframework.starter.mq.core.queue.QueueDefinition; +import com.lframework.starter.mq.rabbitmq.queue.RabbitMQQueueDefinition; + +public class MqConstants { + + /** + * 增加库存 + */ + public static final QueueDefinition ADD_STOCK = new RabbitMQQueueDefinition( + MqStringPool.ADD_STOCK_EXCHANGE); + + /** + * 扣减库存 + */ + public static final QueueDefinition SUB_STOCK = new RabbitMQQueueDefinition( + MqStringPool.SUB_STOCK_EXCHANGE); + + /** + * 审核通过订单 + */ + public static final QueueDefinition APPROVE_PASS_ORDER = new RabbitMQQueueDefinition( + MqStringPool.APPROVE_PASS_ORDER_EXCHANGE); +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqStringPool.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqStringPool.java new file mode 100644 index 0000000..ba6b198 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/queue/MqStringPool.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.core.queue; + +public interface MqStringPool { + + // 增加库存 + String ADD_STOCK_EXCHANGE = "add_stock.fanout"; + + // 扣减库存 + String SUB_STOCK_EXCHANGE = "sub_stock.fanout"; + + // 审核通过订单 + String APPROVE_PASS_ORDER_EXCHANGE = "approve_pass_order.fanout"; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/utils/SplitNumberUtil.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/utils/SplitNumberUtil.java new file mode 100644 index 0000000..293926d --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/utils/SplitNumberUtil.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.core.utils; + +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +public class SplitNumberUtil { + + /** + * 将 totalNum 按照权重指标分摊 + * + * @param totalNum + * @param datas key:唯一标识 value:权重指标 + * @param precision 精度 + * @return + */ + public static Map split(Number totalNum, Map datas, + int precision) { + if (CollectionUtil.isEmpty(datas)) { + return null; + } + + if (precision < 0) { + throw new DefaultSysException("precision不允许小于0!"); + } + if (!NumberUtil.isNumberPrecision(totalNum, precision)) { + throw new DefaultSysException("totalNum的小数位数不允许大于 " + precision + "!"); + } + + Number totalWeight = datas.values().stream().reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + Map results = new HashMap<>(datas.size()); + Number remainNum = totalNum; + + int index = 0; + int dataSize = datas.size(); + for (Entry entry : datas.entrySet()) { + Object key = entry.getKey(); + Number val = entry.getValue(); + if (index == dataSize - 1) { + // 最后一行 + results.put(key, remainNum); + } else { + Number curNum = NumberUtil.getNumber(NumberUtil.mul(totalNum, + NumberUtil.equal(totalWeight, BigDecimal.ZERO) ? dataSize + : NumberUtil.div(val, totalWeight)), precision); + remainNum = NumberUtil.sub(remainNum, curNum); + if (NumberUtil.lt(remainNum, BigDecimal.ZERO)) { + curNum = NumberUtil.add(remainNum, curNum); + remainNum = BigDecimal.ZERO; + } + results.put(key, curNum); + } + } + + return results; + } +} diff --git a/xingyun-core/src/main/java/lombok.config b/xingyun-core/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-core/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-sc/pom.xml b/xingyun-sc/pom.xml new file mode 100644 index 0000000..d72516e --- /dev/null +++ b/xingyun-sc/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + com.lframework + xingyun + 1.0.0 + + + xingyun-sc + + + + com.lframework + xingyun-core + + + + com.lframework + xingyun-basedata + + + jakarta.validation + jakarta.validation-api + + + \ No newline at end of file diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetBo.java new file mode 100644 index 0000000..9469794 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetBo.java @@ -0,0 +1,377 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto.DetailDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetLogisticsSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 物流单号 + */ + @Schema(description = "物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @Schema(description = "物流公司ID") + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + @Schema(description = "寄件人姓名") + private String senderName; + + /** + * 寄件人联系电话 + */ + @Schema(description = "寄件人联系电话") + private String senderTelephone; + + /** + * 寄件人省 + */ + @Schema(description = "寄件人省") + private String senderProvinceId; + + /** + * 寄件人市 + */ + @Schema(description = "寄件人市") + private String senderCityId; + + /** + * 寄件人区 + */ + @Schema(description = "寄件人区") + private String senderDistrictId; + + /** + * 寄件人地区 + */ + @Schema(description = "寄件人地区") + private String senderCity; + + /** + * 寄件人地址 + */ + @Schema(description = "寄件人地址") + private String senderAddress; + + /** + * 收件人姓名 + */ + @Schema(description = "收件人姓名") + private String receiverName; + + /** + * 收件人联系电话 + */ + @Schema(description = "收件人联系电话") + private String receiverTelephone; + + /** + * 收件人省 + */ + @Schema(description = "收件人省") + private String receiverProvinceId; + + /** + * 收件人市 + */ + @Schema(description = "收件人市") + private String receiverCityId; + + /** + * 收件人区 + */ + @Schema(description = "收件人区") + private String receiverDistrictId; + + /** + * 收件人地区 + */ + @Schema(description = "收件人地区") + private String receiverCity; + + /** + * 收件人地址 + */ + @Schema(description = "收件人地址") + private String receiverAddress; + + /** + * 状态 + */ + @Schema(description = "状态") + @EnumConvert + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 总重量 + */ + @Schema(description = "总重量") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @Schema(description = "总体积") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @Schema(description = "物流费") + private BigDecimal totalAmount; + + /** + * 发货人 + */ + @Schema(description = "发货人") + private String deliveryBy; + + /** + * 发货时间 + */ + @Schema(description = "发货时间") + private LocalDateTime deliveryTime; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private LocalDateTime updateTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetLogisticsSheetBo() { + + } + + public GetLogisticsSheetBo(LogisticsSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(LogisticsSheetFullDto dto) { + + return super.convert(dto, GetLogisticsSheetBo::getDetails); + } + + @Override + protected void afterInit(LogisticsSheetFullDto dto) { + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new) + .collect(Collectors.toList()); + } + + if (StringUtil.isNotBlank(dto.getDeliveryBy())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser deliveryBy = userService.findById(dto.getDeliveryBy()); + this.deliveryBy = deliveryBy.getName(); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List senderCitys = dicCityService.getChainById(senderDistrictId); + this.senderCity = senderCitys.stream().map(DicCityDto::getName).collect(Collectors.joining(StringPool.CITY_SPLIT)); + + List receiverCitys = dicCityService.getChainById(receiverDistrictId); + this.receiverCity = receiverCitys.stream().map(DicCityDto::getName).collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 物流单ID + */ + @Schema(description = "物流单ID") + private String sheetId; + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + @EnumConvert + private Integer bizType; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 收货人ID + */ + @Schema(description = "收货人ID") + private String receiverId; + + /** + * 收货人姓名 + */ + @Schema(description = "收货人姓名") + private String receiverName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + public OrderDetailBo(DetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(DetailDto dto) { + if (dto.getBizType() == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean( + SaleOutSheetService.class); + SaleOutSheet saleOutSheet = saleOutSheetService.getById(dto.getBizId()); + this.bizCode = saleOutSheet.getCode(); + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(saleOutSheet.getScId()); + this.scId = sc.getId(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(saleOutSheet.getCustomerId()); + this.receiverId = customer.getId(); + this.receiverName = customer.getName(); + + this.createBy = saleOutSheet.getCreateBy(); + this.createTime = saleOutSheet.getCreateTime(); + } else if (dto.getBizType() == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailOutSheet retailOutSheet = retailOutSheetService.getById(dto.getBizId()); + this.bizCode = retailOutSheet.getCode(); + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(retailOutSheet.getScId()); + this.scId = sc.getId(); + this.scName = sc.getName(); + + if (StringUtil.isNotBlank(retailOutSheet.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(retailOutSheet.getMemberId()); + this.receiverId = member.getId(); + this.receiverName = member.getName(); + } + + this.createBy = retailOutSheet.getCreateBy(); + this.createTime = retailOutSheet.getCreateTime(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetDeliveryBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetDeliveryBo.java new file mode 100644 index 0000000..3fa127a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetDeliveryBo.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class GetLogisticsSheetDeliveryBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 物流单号 + */ + @Schema(description = "物流单号") + private String logisticsNo; + + /** + * 物流费 + */ + @Schema(description = "物流费") + private BigDecimal totalAmount; + + public GetLogisticsSheetDeliveryBo() { + + } + + public GetLogisticsSheetDeliveryBo(LogisticsSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(LogisticsSheet dto) { + + return super.convert(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBizOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBizOrderBo.java new file mode 100644 index 0000000..3eaefda --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBizOrderBo.java @@ -0,0 +1,103 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryLogisticsSheetBizOrderBo extends BaseBo { + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + @EnumConvert + private Integer bizType; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 收货人ID + */ + @Schema(description = "收货人ID") + private String receiverId; + + /** + * 收货人姓名 + */ + @Schema(description = "收货人姓名") + private String receiverName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + public QueryLogisticsSheetBizOrderBo() { + } + + public QueryLogisticsSheetBizOrderBo(LogisticsSheetBizOrderDto dto) { + super(dto); + } + + @Override + protected void afterInit(LogisticsSheetBizOrderDto dto) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + if (dto.getBizType() == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getReceiverId()); + this.receiverName = customer.getName(); + } else if (dto.getBizType() == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + if (StringUtil.isNotBlank(dto.getReceiverId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getReceiverId()); + this.receiverName = member.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBo.java new file mode 100644 index 0000000..dbcc192 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBo.java @@ -0,0 +1,125 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryLogisticsSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 物流单号 + */ + @Schema(description = "物流单号") + private String logisticsNo; + + /** + * 物流公司名称 + */ + @Schema(description = "物流公司名称") + private String logisticsCompanyName; + + /** + * 总重量 + */ + @Schema(description = "总重量") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @Schema(description = "总体积") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @Schema(description = "物流费") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @Schema(description = "状态") + @EnumConvert + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 发货人 + */ + @Schema(description = "发货人") + private String deliveryBy; + + /** + * 发货时间 + */ + @Schema(description = "发货时间") + private LocalDateTime deliveryTime; + + public QueryLogisticsSheetBo(LogisticsSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(LogisticsSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(LogisticsSheet dto) { + LogisticsCompanyService logisticsCompanyService = ApplicationUtil.getBean( + LogisticsCompanyService.class); + LogisticsCompany logisticsCompany = logisticsCompanyService.findById( + dto.getLogisticsCompanyId()); + this.logisticsCompanyName = logisticsCompany.getName(); + + if (StringUtil.isNotBlank(dto.getDeliveryBy())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser deliveryBy = userService.findById(dto.getDeliveryBy()); + this.deliveryBy = deliveryBy.getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/paytype/OrderPayTypeBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/paytype/OrderPayTypeBo.java new file mode 100644 index 0000000..969a33e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/paytype/OrderPayTypeBo.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.sc.bo.paytype; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class OrderPayTypeBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 订单ID + */ + @Schema(description = "订单ID") + private String orderId; + + /** + * 支付方式ID + */ + @Schema(description = "支付方式ID") + private String payTypeId; + + /** + * 支付金额 + */ + @Schema(description = "支付金额") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @Schema(description = "支付内容") + private String text; + + @Schema(description = "是否记录内容") + private Boolean recText; + + public OrderPayTypeBo() { + } + + public OrderPayTypeBo(OrderPayType dto) { + super(dto); + } + + @Override + protected void afterInit(OrderPayType dto) { + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + PayType payType = payTypeService.findById(dto.getPayTypeId()); + this.recText = payType.getRecText(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/GetPurchaseOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/GetPurchaseOrderBo.java new file mode 100644 index 0000000..8db6ba8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/GetPurchaseOrderBo.java @@ -0,0 +1,372 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetPurchaseOrderBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 预计到货日期 + */ + @Schema(description = "预计到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate expectArriveDate; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 采购金额 + */ + @Schema(description = "采购金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 关联的审批流程ID + */ + @Schema(description = "关联的审批流程ID") + private String flowInstanceId; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetPurchaseOrderBo() { + + } + + public GetPurchaseOrderBo(PurchaseOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrderFullDto dto) { + + return super.convert(dto, GetPurchaseOrderBo::getStatus, GetPurchaseOrderBo::getDetails); + } + + @Override + protected void afterInit(PurchaseOrderFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + this.supplierName = supplierService.findById(dto.getSupplierId()).getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal purchaseNum; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @Schema(description = "含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, PurchaseOrderFullDto.OrderDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + PurchaseOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseOrderFullDto.OrderDetailDto dto) { + + this.purchaseNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 6); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PrintPurchaseOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PrintPurchaseOrderBo.java new file mode 100644 index 0000000..2456cb1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PrintPurchaseOrderBo.java @@ -0,0 +1,235 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintPurchaseOrderBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 预计到货日期 + */ + @Schema(description = "预计到货日期") + private String expectArriveDate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintPurchaseOrderBo() { + + } + + public PrintPurchaseOrderBo(PurchaseOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrderFullDto dto) { + + return super.convert(dto, PrintPurchaseOrderBo::getDetails); + } + + @Override + protected void afterInit(PurchaseOrderFullDto dto) { + + this.purchaserName = StringPool.EMPTY_STR; + this.expectArriveDate = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (dto.getExpectArriveDate() != null) { + this.expectArriveDate = DateUtil.formatDate(dto.getExpectArriveDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal purchaseNum; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 采购金额 + */ + @Schema(description = "采购金额") + private BigDecimal purchaseAmount; + + public OrderDetailBo(PurchaseOrderFullDto.OrderDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + PurchaseOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseOrderFullDto.OrderDetailDto dto) { + + this.purchaseNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.purchaseAmount = dto.getTaxAmount(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderSelectorBo.java new file mode 100644 index 0000000..4495c74 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderSelectorBo.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class PurchaseOrderSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + public PurchaseOrderSelectorBo() { + + } + + public PurchaseOrderSelectorBo(PurchaseOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrder dto) { + + return super.convert(dto, PurchaseOrderSelectorBo::getStatus); + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderWithReceiveBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderWithReceiveBo.java new file mode 100644 index 0000000..ed1d75f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderWithReceiveBo.java @@ -0,0 +1,298 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PurchaseOrderWithReceiveBo extends BaseBo { + + /** + * 订单ID + */ + @Schema(description = "订单ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PurchaseOrderWithReceiveBo() { + + } + + public PurchaseOrderWithReceiveBo(PurchaseOrderWithReceiveDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrderWithReceiveDto dto) { + + return super.convert(dto, PurchaseOrderWithReceiveBo::getPurchaserId, + PurchaseOrderWithReceiveBo::getDetails); + } + + @Override + protected void afterInit(PurchaseOrderWithReceiveDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierName = supplier.getName(); + + if (!StringUtil.isBlank(dto.getPurchaserId())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser purchaser = userService.findById(dto.getPurchaserId()); + + this.purchaserId = purchaser.getId(); + this.purchaserName = purchaser.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.scId, t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal orderNum; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 剩余收货数量 + */ + @Schema(description = "剩余收货数量") + private BigDecimal remainNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 含税成本价 + */ + @Schema(description = "含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo() { + + } + + public DetailBo(String scId, PurchaseOrderWithReceiveDto.DetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + PurchaseOrderWithReceiveDto.DetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + PurchaseOrderWithReceiveDto.DetailDto dto, + SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(PurchaseOrderWithReceiveDto.DetailDto dto) { + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.orderNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReceiveNum()); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseProductBo.java new file mode 100644 index 0000000..7302c34 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseProductBo.java @@ -0,0 +1,126 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class PurchaseProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @Schema(description = "含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public PurchaseProductBo(String scId, PurchaseProductDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(PurchaseProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 6); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderBo.java new file mode 100644 index 0000000..f0437be --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderBo.java @@ -0,0 +1,176 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Data +public class QueryPurchaseOrderBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 预计到货日期 + */ + @Schema(description = "预计到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate expectArriveDate; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 采购金额 + */ + @Schema(description = "采购金额") + private BigDecimal totalAmount; + + /** + * 关联的审批流程ID + */ + @Schema(description = "关联的审批流程ID") + private String flowInstanceId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + public QueryPurchaseOrderBo(PurchaseOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrder dto) { + + return super.convert(dto, QueryPurchaseOrderBo::getStatus); + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderWithReceiveBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderWithReceiveBo.java new file mode 100644 index 0000000..66cff22 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderWithReceiveBo.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryPurchaseOrderWithReceiveBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryPurchaseOrderWithReceiveBo(PurchaseOrder dto) { + + super(dto); + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/config/GetPurchaseConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/config/GetPurchaseConfigBo.java new file mode 100644 index 0000000..df8e343 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/config/GetPurchaseConfigBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.sc.bo.purchase.config; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetPurchaseConfigBo extends BaseBo { + + /** + * 采购收货单是否关联采购订单 + */ + @Schema(description = "采购收货单是否关联采购订单") + private Boolean receiveRequirePurchase; + + /** + * 采购收货单是否多次关联采购订单 + */ + @Schema(description = "采购收货单是否多次关联采购订单") + private Boolean receiveMultipleRelatePurchase; + + /** + * 采购退货单是否关联采购收货单 + */ + @Schema(description = "采购退货单是否关联采购收货单") + private Boolean purchaseReturnRequireReceive; + + /** + * 采购退货单是否多次关联采购收货单 + */ + @Schema(description = "采购退货单是否多次关联采购收货单") + private Boolean purchaseReturnMultipleRelateReceive; + + /** + * 采购订单是否开启审批流程 + */ + @Schema(description = "采购订单是否开启审批流程") + private Boolean purchaseRequireBpm; + + /** + * 采购订单关联的审批流程ID + */ + @Schema(description = "采购订单关联的审批流程ID") + private String purchaseBpmProcessId; + + /** + * 采购订单关联的审批流程编号 + */ + @Schema(description = "采购订单关联的审批流程编号") + private String purchaseBpmProcessCode; + + public GetPurchaseConfigBo() { + + } + + public GetPurchaseConfigBo(PurchaseConfig dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetPaymentDateBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetPaymentDateBo.java new file mode 100644 index 0000000..801d8a2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetPaymentDateBo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDate; + +@Data +public class GetPaymentDateBo extends BaseBo { + + /** + * 是否允许修改付款日期 + */ + @Schema(description = "是否允许修改付款日期") + private Boolean allowModify; + + /** + * 默认付款日期 + */ + @Schema(description = "默认付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + public GetPaymentDateBo() { + + } + + public GetPaymentDateBo(GetPaymentDateDto dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetReceiveSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetReceiveSheetBo.java new file mode 100644 index 0000000..9d52577 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetReceiveSheetBo.java @@ -0,0 +1,435 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetReceiveSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 到货日期 + */ + @Schema(description = "到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate receiveDate; + + /** + * 采购订单ID + */ + @Schema(description = "采购订单ID") + private String purchaseOrderId; + + /** + * 采购订单号 + */ + @Schema(description = "采购订单号") + private String purchaseOrderCode; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 采购金额 + */ + @Schema(description = "采购金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetReceiveSheetBo() { + + } + + public GetReceiveSheetBo(ReceiveSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheetFullDto dto) { + + return super.convert(dto, GetReceiveSheetBo::getStatus, GetReceiveSheetBo::getSettleStatus, + GetReceiveSheetBo::getDetails); + } + + @Override + protected void afterInit(ReceiveSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + this.supplierName = supplierService.findById(dto.getSupplierId()).getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean(PurchaseOrderService.class); + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.purchaseOrderCode = purchaseOrder.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal orderNum; + + /** + * 剩余收货数量 + */ + @Schema(description = "剩余收货数量") + private BigDecimal remainNum; + + /** + * 收货数量 + */ + @Schema(description = "收货数量") + private BigDecimal receiveNum; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 采购总金额 + */ + @Schema(description = "采购总金额") + private BigDecimal taxAmount; + + /** + * 含税成本价 + */ + @Schema(description = "含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 采购订单明细ID + */ + @Schema(description = "采购订单明细ID") + private String purchaseOrderDetailId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, ReceiveSheetFullDto.OrderDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + ReceiveSheetFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ReceiveSheetFullDto.OrderDetailDto dto) { + + this.receiveNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getPurchaseOrderDetailId())) { + PurchaseOrderDetailService purchaseOrderDetailService = ApplicationUtil.getBean( + PurchaseOrderDetailService.class); + PurchaseOrderDetail purchaseOrderDetail = purchaseOrderDetailService.getById( + dto.getPurchaseOrderDetailId()); + this.orderNum = purchaseOrderDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(purchaseOrderDetail.getOrderNum(), + purchaseOrderDetail.getReceiveNum()); + } + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 6); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/PrintReceiveSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/PrintReceiveSheetBo.java new file mode 100644 index 0000000..50003f6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/PrintReceiveSheetBo.java @@ -0,0 +1,260 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintReceiveSheetBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private String paymentDate; + + /** + * 到货日期 + */ + @Schema(description = "到货日期") + private String receiveDate; + + /** + * 采购订单号 + */ + @Schema(description = "采购订单号") + private String purchaseOrderCode; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintReceiveSheetBo() { + + } + + public PrintReceiveSheetBo(ReceiveSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheetFullDto dto) { + + return super.convert(dto, PrintReceiveSheetBo::getDetails); + } + + @Override + protected void afterInit(ReceiveSheetFullDto dto) { + + this.purchaserName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.receiveDate = StringPool.EMPTY_STR; + this.purchaseOrderCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean(PurchaseOrderService.class); + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.purchaseOrderCode = purchaseOrder.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + if (dto.getReceiveDate() != null) { + this.receiveDate = DateUtil.formatDate(dto.getReceiveDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 收货数量 + */ + @Schema(description = "收货数量") + private BigDecimal receiveNum; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 收货金额 + */ + @Schema(description = "收货金额") + private BigDecimal receiveAmount; + + public OrderDetailBo(ReceiveSheetFullDto.OrderDetailDto dto) { + + this.init(dto); + } + + @Override + public BaseBo convert( + ReceiveSheetFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ReceiveSheetFullDto.OrderDetailDto dto) { + + this.receiveNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.receiveAmount = dto.getTaxAmount(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetBo.java new file mode 100644 index 0000000..7a3b50a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetBo.java @@ -0,0 +1,198 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Data +public class QueryReceiveSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 到货日期 + */ + @Schema(description = "到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate receiveDate; + + /** + * 采购订单ID + */ + @Schema(description = "采购订单ID") + private String purchaseOrderId; + + /** + * 采购订单号 + */ + @Schema(description = "采购订单号") + private String purchaseOrderCode; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 采购金额 + */ + @Schema(description = "采购金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QueryReceiveSheetBo(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return super.convert(dto, QueryReceiveSheetBo::getStatus, QueryReceiveSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.purchaseOrderCode = purchaseOrder.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetWithReturnBo.java new file mode 100644 index 0000000..a06617d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetWithReturnBo.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryReceiveSheetWithReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryReceiveSheetWithReturnBo() { + + } + + public QueryReceiveSheetWithReturnBo(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetSelectorBo.java new file mode 100644 index 0000000..e7b1dc3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetSelectorBo.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class ReceiveSheetSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + public ReceiveSheetSelectorBo() { + + } + + public ReceiveSheetSelectorBo(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return super.convert(dto, ReceiveSheetSelectorBo::getStatus); + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetWithReturnBo.java new file mode 100644 index 0000000..fe6d8e3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetWithReturnBo.java @@ -0,0 +1,301 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class ReceiveSheetWithReturnBo extends BaseBo { + + /** + * 订单ID + */ + @Schema(description = "订单ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public ReceiveSheetWithReturnBo() { + + } + + public ReceiveSheetWithReturnBo(ReceiveSheetWithReturnDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheetWithReturnDto dto) { + + return super.convert(dto, ReceiveSheetWithReturnBo::getPurchaserId, + ReceiveSheetWithReturnBo::getDetails); + } + + @Override + protected void afterInit(ReceiveSheetWithReturnDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierName = supplier.getName(); + + if (!StringUtil.isBlank(dto.getPurchaserId())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser purchaser = userService.findById(dto.getPurchaserId()); + + this.purchaserId = purchaser.getId(); + this.purchaserName = purchaser.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 收货数量 + */ + @Schema(description = "收货数量") + private BigDecimal receiveNum; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 采购总金额 + */ + @Schema(description = "采购总金额") + private BigDecimal taxAmount; + + /** + * 含税成本价 + */ + @Schema(description = "含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 剩余退货数量 + */ + @Schema(description = "剩余退货数量") + private BigDecimal remainNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo(String scId, ReceiveSheetWithReturnDto.DetailDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + public BaseBo convert( + ReceiveSheetWithReturnDto.DetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + ReceiveSheetWithReturnDto.DetailDto dto, + SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(ReceiveSheetWithReturnDto.DetailDto dto) { + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.receiveNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReturnNum()); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/GetPurchaseReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/GetPurchaseReturnBo.java new file mode 100644 index 0000000..63709e7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/GetPurchaseReturnBo.java @@ -0,0 +1,419 @@ +package com.lframework.xingyun.sc.bo.purchase.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetPurchaseReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 采购收货单ID + */ + @Schema(description = "采购收货单ID") + private String receiveSheetId; + + /** + * 采购收货单号 + */ + @Schema(description = "采购收货单号") + private String receiveSheetCode; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 采购金额 + */ + @Schema(description = "采购金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetPurchaseReturnBo(PurchaseReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturnFullDto dto) { + + return super.convert(dto, GetPurchaseReturnBo::getStatus, GetPurchaseReturnBo::getSettleStatus, + GetPurchaseReturnBo::getDetails); + } + + @Override + protected void afterInit(PurchaseReturnFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + this.supplierName = supplierService.findById(dto.getSupplierId()).getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.receiveSheetCode = receiveSheet.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new ReturnDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 收货数量 + */ + @Schema(description = "收货数量") + private BigDecimal receiveNum; + + /** + * 剩余退货数量 + */ + @Schema(description = "剩余退货数量") + private BigDecimal remainNum; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 退货价 + */ + @Schema(description = "退货价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @Schema(description = "含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 采购收货单明细ID + */ + @Schema(description = "采购收货单明细ID") + private String receiveSheetDetailId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public ReturnDetailBo(String scId, PurchaseReturnFullDto.ReturnDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + PurchaseReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.purchasePrice = dto.getTaxPrice(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getReceiveSheetDetailId())) { + ReceiveSheetDetailService receiveSheetDetailService = ApplicationUtil.getBean( + ReceiveSheetDetailService.class); + ReceiveSheetDetail receiveSheetDetailDto = receiveSheetDetailService.getById( + dto.getReceiveSheetDetailId()); + this.receiveNum = receiveSheetDetailDto.getOrderNum(); + this.remainNum = NumberUtil.sub(receiveSheetDetailDto.getOrderNum(), + receiveSheetDetailDto.getReturnNum()); + } + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 6); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/PrintPurchaseReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/PrintPurchaseReturnBo.java new file mode 100644 index 0000000..219390f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/PrintPurchaseReturnBo.java @@ -0,0 +1,259 @@ +package com.lframework.xingyun.sc.bo.purchase.returned; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintPurchaseReturnBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private String paymentDate; + + /** + * 采购收货单号 + */ + @Schema(description = "采购收货单号") + private String receiveSheetCode; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintPurchaseReturnBo(PurchaseReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturnFullDto dto) { + + return super.convert(dto, PrintPurchaseReturnBo::getDetails); + } + + @Override + protected void afterInit(PurchaseReturnFullDto dto) { + + this.purchaserName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.receiveSheetCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.receiveSheetCode = receiveSheet.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(ReturnDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 退货价 + */ + @Schema(description = "退货价") + private BigDecimal purchasePrice; + + /** + * 退货金额 + */ + @Schema(description = "退货金额") + private BigDecimal returnAmount; + + public ReturnDetailBo(PurchaseReturnFullDto.ReturnDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + PurchaseReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.purchasePrice = dto.getTaxPrice(); + this.returnAmount = dto.getTaxAmount(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/QueryPurchaseReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/QueryPurchaseReturnBo.java new file mode 100644 index 0000000..0a501b6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/QueryPurchaseReturnBo.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.sc.bo.purchase.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryPurchaseReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @Schema(description = "采购员姓名") + private String purchaserName; + + /** + * 采购收货单ID + */ + @Schema(description = "采购收货单ID") + private String receiveSheetId; + + /** + * 采购收货单号 + */ + @Schema(description = "采购收货单号") + private String receiveSheetCode; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 采购金额 + */ + @Schema(description = "采购金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QueryPurchaseReturnBo(PurchaseReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturn dto) { + + return super.convert(dto, QueryPurchaseReturnBo::getStatus, + QueryPurchaseReturnBo::getSettleStatus); + } + + @Override + protected void afterInit(PurchaseReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.receiveSheetCode = receiveSheet.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/RetailProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/RetailProductBo.java new file mode 100644 index 0000000..5e0b842 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/RetailProductBo.java @@ -0,0 +1,121 @@ +package com.lframework.xingyun.sc.bo.retail; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class RetailProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 是否多销售属性 + */ + @Schema(description = "是否多销售属性") + private Boolean multiSaleProp; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 零售价 + */ + @Schema(description = "零售价") + private BigDecimal retailPrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public RetailProductBo(String scId, RetailProductDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(RetailProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/config/GetRetailConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/config/GetRetailConfigBo.java new file mode 100644 index 0000000..3230a8f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/config/GetRetailConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.bo.retail.config; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.RetailConfig; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetRetailConfigBo extends BaseBo { + + /** + * 零售出库单上的会员是否必填 + */ + @Schema(description = "零售出库单上的会员是否必填") + private Boolean retailOutSheetRequireMember; + + /** + * 零售退货单上的会员是否必填 + */ + @Schema(description = "零售退货单上的会员是否必填") + private Boolean retailReturnRequireMember; + + /** + * 零售退货单是否关联零售出库单 + */ + @Schema(description = "零售退货单是否关联零售出库单") + private Boolean retailReturnRequireOutStock; + + /** + * 零售退货单是否多次关联零售出库单 + */ + @Schema(description = "零售退货单是否多次关联零售出库单") + private Boolean retailReturnMultipleRelateOutStock; + + /** + * 零售出库单是否需要发货 + */ + @Schema(description = "零售出库单是否需要发货") + private Boolean retailOutSheetRequireLogistics; + + public GetRetailConfigBo() { + + } + + public GetRetailConfigBo(RetailConfig dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/GetRetailOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/GetRetailOutSheetBo.java new file mode 100644 index 0000000..40cbca3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/GetRetailOutSheetBo.java @@ -0,0 +1,412 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetRetailOutSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 会员名称 + */ + @Schema(description = "会员名称") + private String memberName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 销售金额 + */ + @Schema(description = "销售金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetRetailOutSheetBo() { + + } + + public GetRetailOutSheetBo(RetailOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheetFullDto dto) { + + return super.convert(dto, GetRetailOutSheetBo::getStatus, GetRetailOutSheetBo::getSettleStatus, + GetRetailOutSheetBo::getDetails); + } + + @Override + protected void afterInit(RetailOutSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + this.memberName = memberService.findById(dto.getMemberId()).getName(); + } + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 组合商品ID + */ + @Schema(description = "组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @Schema(description = "组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal orderNum; + + /** + * 剩余出库数量 + */ + @Schema(description = "剩余出库数量") + private BigDecimal remainNum; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal retailPrice; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, RetailOutSheetFullDto.SheetDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + RetailOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.retailPrice = dto.getOriPrice(); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/PrintRetailOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/PrintRetailOutSheetBo.java new file mode 100644 index 0000000..310dd94 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/PrintRetailOutSheetBo.java @@ -0,0 +1,237 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintRetailOutSheetBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 会员编号 + */ + @Schema(description = "会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @Schema(description = "会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private String paymentDate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintRetailOutSheetBo() { + + } + + public PrintRetailOutSheetBo(RetailOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheetFullDto dto) { + + return super.convert(dto, PrintRetailOutSheetBo::getDetails); + } + + @Override + protected void afterInit(RetailOutSheetFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 出库金额 + */ + @Schema(description = "出库金额") + private BigDecimal outAmount; + + public OrderDetailBo(RetailOutSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + RetailOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.outAmount = dto.getTaxAmount(); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetBo.java new file mode 100644 index 0000000..3ab88d3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetBo.java @@ -0,0 +1,172 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryRetailOutSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 会员编号 + */ + @Schema(description = "会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @Schema(description = "会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 销售金额 + */ + @Schema(description = "销售金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QueryRetailOutSheetBo(RetailOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheet dto) { + + return super.convert(dto, QueryRetailOutSheetBo::getStatus, + QueryRetailOutSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(RetailOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetWithReturnBo.java new file mode 100644 index 0000000..fbef467 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetWithReturnBo.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryRetailOutSheetWithReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 会员编号 + */ + @Schema(description = "会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @Schema(description = "会员名称") + private String memberName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryRetailOutSheetWithReturnBo() { + + } + + public QueryRetailOutSheetWithReturnBo(RetailOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/RetailOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/RetailOutSheetWithReturnBo.java new file mode 100644 index 0000000..7a1c56b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/RetailOutSheetWithReturnBo.java @@ -0,0 +1,300 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class RetailOutSheetWithReturnBo extends BaseBo { + + /** + * 订单ID + */ + @Schema(description = "订单ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 会员名称 + */ + @Schema(description = "会员名称") + private String memberName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public RetailOutSheetWithReturnBo() { + + } + + public RetailOutSheetWithReturnBo(RetailOutSheetWithReturnDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheetWithReturnDto dto) { + + return super.convert(dto, RetailOutSheetWithReturnBo::getSalerId, + RetailOutSheetWithReturnBo::getDetails); + } + + @Override + protected void afterInit(RetailOutSheetWithReturnDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberName = member.getName(); + } + + if (!StringUtil.isBlank(dto.getSalerId())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = userService.findById(dto.getSalerId()); + + this.salerId = saler.getId(); + this.salerName = saler.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal retailPrice; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 剩余退货数量 + */ + @Schema(description = "剩余退货数量") + private BigDecimal remainNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo(String scId, RetailOutSheetWithReturnDto.SheetDetailDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + public BaseBo convert( + RetailOutSheetWithReturnDto.SheetDetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + RetailOutSheetWithReturnDto.SheetDetailDto dto, SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(RetailOutSheetWithReturnDto.SheetDetailDto dto) { + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.outNum = dto.getOrderNum(); + this.retailPrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReturnNum()); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/GetRetailReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/GetRetailReturnBo.java new file mode 100644 index 0000000..0e6be2f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/GetRetailReturnBo.java @@ -0,0 +1,413 @@ +package com.lframework.xingyun.sc.bo.retail.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetRetailReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String memberId; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String memberName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售出库单ID + */ + @Schema(description = "销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @Schema(description = "销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 退货金额 + */ + @Schema(description = "退货金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetRetailReturnBo(RetailReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturnFullDto dto) { + + return super.convert(dto, GetRetailReturnBo::getStatus, GetRetailReturnBo::getSettleStatus, + GetRetailReturnBo::getDetails); + } + + @Override + protected void afterInit(RetailReturnFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + this.memberName = memberService.findById(dto.getMemberId()).getName(); + } + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheet outSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new ReturnDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 剩余退货数量 + */ + @Schema(description = "剩余退货数量") + private BigDecimal remainNum; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal retailPrice; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 销售出库单明细ID + */ + @Schema(description = "销售出库单明细ID") + private String outSheetDetailId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public ReturnDetailBo(String scId, RetailReturnFullDto.ReturnDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + RetailReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.retailPrice = dto.getTaxPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getOutSheetDetailId())) { + RetailOutSheetDetailLotService receiveSheetDetailService = ApplicationUtil.getBean( + RetailOutSheetDetailLotService.class); + RetailOutSheetDetailLotDto outSheetDetail = receiveSheetDetailService.findById( + dto.getOutSheetDetailId()); + this.outNum = outSheetDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(outSheetDetail.getOrderNum(), + outSheetDetail.getReturnNum()); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/PrintRetailReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/PrintRetailReturnBo.java new file mode 100644 index 0000000..7b85e63 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/PrintRetailReturnBo.java @@ -0,0 +1,249 @@ +package com.lframework.xingyun.sc.bo.retail.returned; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintRetailReturnBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String memberCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String memberName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private String paymentDate; + + /** + * 销售出库单号 + */ + @Schema(description = "销售出库单号") + private String outSheetCode; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintRetailReturnBo(RetailReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturnFullDto dto) { + + return super.convert(dto, PrintRetailReturnBo::getDetails); + } + + @Override + protected void afterInit(RetailReturnFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.outSheetCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheet outSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == RetailReturnStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(ReturnDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 退货金额 + */ + @Schema(description = "退货金额") + private BigDecimal returnAmount; + + public ReturnDetailBo(RetailReturnFullDto.ReturnDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + RetailReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.taxPrice = dto.getTaxPrice(); + this.returnAmount = dto.getTaxAmount(); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/QueryRetailReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/QueryRetailReturnBo.java new file mode 100644 index 0000000..aa45f87 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/QueryRetailReturnBo.java @@ -0,0 +1,192 @@ +package com.lframework.xingyun.sc.bo.retail.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryRetailReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 会员编号 + */ + @Schema(description = "会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @Schema(description = "会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 销售出库单ID + */ + @Schema(description = "销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @Schema(description = "销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 退货金额 + */ + @Schema(description = "退货金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QueryRetailReturnBo(RetailReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturn dto) { + + return super.convert(dto, QueryRetailReturnBo::getStatus, QueryRetailReturnBo::getSettleStatus); + } + + @Override + protected void afterInit(RetailReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailOutSheet outSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/GetSaleOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/GetSaleOrderBo.java new file mode 100644 index 0000000..c89db42 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/GetSaleOrderBo.java @@ -0,0 +1,381 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSaleOrderBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 销售金额 + */ + @Schema(description = "销售金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetSaleOrderBo() { + + } + + public GetSaleOrderBo(SaleOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto dto) { + + return super.convert(dto, GetSaleOrderBo::getStatus, GetSaleOrderBo::getDetails); + } + + @Override + protected void afterInit(SaleOrderFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + this.customerName = customerService.findById(dto.getCustomerId()).getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 组合商品ID + */ + @Schema(description = "组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @Schema(description = "组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal orderNum; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @Schema(description = "现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @Schema(description = "折扣(%)") + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + public OrderDetailBo(String scId, SaleOrderFullDto.OrderDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOrderFullDto.OrderDetailDto dto) { + + this.orderNum = dto.getOrderNum(); + this.oriPrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/PrintSaleOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/PrintSaleOrderBo.java new file mode 100644 index 0000000..486f257 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/PrintSaleOrderBo.java @@ -0,0 +1,222 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintSaleOrderBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintSaleOrderBo() { + + } + + public PrintSaleOrderBo(SaleOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto dto) { + + return super.convert(dto, PrintSaleOrderBo::getDetails); + } + + @Override + protected void afterInit(SaleOrderFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == SaleOrderStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal orderNum; + + /** + * 现价 + */ + @Schema(description = "现价") + private BigDecimal taxPrice; + + /** + * 销售金额 + */ + @Schema(description = "销售金额") + private BigDecimal orderAmount; + + public OrderDetailBo(SaleOrderFullDto.OrderDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOrderFullDto.OrderDetailDto dto) { + + this.orderNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.orderAmount = dto.getTaxAmount(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderBo.java new file mode 100644 index 0000000..1f37f6b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderBo.java @@ -0,0 +1,162 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QuerySaleOrderBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 销售金额 + */ + @Schema(description = "销售金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + public QuerySaleOrderBo(SaleOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrder dto) { + + return super.convert(dto, QuerySaleOrderBo::getStatus); + } + + @Override + protected void afterInit(SaleOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderWithOutBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderWithOutBo.java new file mode 100644 index 0000000..8118f72 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderWithOutBo.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySaleOrderWithOutBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QuerySaleOrderWithOutBo(SaleOrder dto) { + + super(dto); + } + + @Override + protected void afterInit(SaleOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleOrderWithOutBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleOrderWithOutBo.java new file mode 100644 index 0000000..9982112 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleOrderWithOutBo.java @@ -0,0 +1,319 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class SaleOrderWithOutBo extends BaseBo { + + /** + * 订单ID + */ + @Schema(description = "订单ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public SaleOrderWithOutBo() { + + } + + public SaleOrderWithOutBo(SaleOrderWithOutDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderWithOutDto dto) { + + return super.convert(dto, SaleOrderWithOutBo::getDetails); + } + + @Override + protected void afterInit(SaleOrderWithOutDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerName = customer.getName(); + + if (!StringUtil.isBlank(dto.getSalerId())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = userService.findById(dto.getSalerId()); + + this.salerId = saler.getId(); + this.salerName = saler.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 组合商品ID + */ + @Schema(description = "组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @Schema(description = "组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal orderNum; + + /** + * 销售价 + */ + @Schema(description = "销售价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal discountRate; + + /** + * 剩余出库数量 + */ + @Schema(description = "剩余出库数量") + private BigDecimal remainNum; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo() { + + } + + public DetailBo(String scId, SaleOrderWithOutDto.DetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert(SaleOrderWithOutDto.DetailDto dto) { + + return this; + } + + @Override + public BaseBo convert(SaleOrderWithOutDto.DetailDto dto, + SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(SaleOrderWithOutDto.DetailDto dto) { + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.orderNum = dto.getOrderNum(); + this.salePrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getOutNum()); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleProductBo.java new file mode 100644 index 0000000..a0a2316 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleProductBo.java @@ -0,0 +1,121 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class SaleProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 是否多销售属性 + */ + @Schema(description = "是否多销售属性") + private Boolean multiSaleProp; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 销售价 + */ + @Schema(description = "销售价") + private BigDecimal salePrice; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public SaleProductBo(String scId, SaleProductDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + protected void afterInit(SaleProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/config/GetSaleConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/config/GetSaleConfigBo.java new file mode 100644 index 0000000..5db9fa9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/config/GetSaleConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.bo.sale.config; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.SaleConfig; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetSaleConfigBo extends BaseBo { + + /** + * 销售出库单是否关联销售订单 + */ + @Schema(description = "销售出库单是否关联销售订单") + private Boolean outStockRequireSale; + + /** + * 销售出库单是否多次关联销售订单 + */ + @Schema(description = "销售出库单是否多次关联销售订单") + private Boolean outStockMultipleRelateSale; + + /** + * 销售退货单是否关联销售出库单 + */ + @Schema(description = "销售退货单是否关联销售出库单") + private Boolean saleReturnRequireOutStock; + + /** + * 销售退货单是否多次关联销售出库单 + */ + @Schema(description = "销售退货单是否多次关联销售出库单") + private Boolean saleReturnMultipleRelateOutStock; + + /** + * 销售出库单是否关联物流单 + */ + @Schema(description = "销售出库单是否关联物流单") + private Boolean outStockRequireLogistics; + + public GetSaleConfigBo() { + + } + + public GetSaleConfigBo(SaleConfig dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/GetSaleOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/GetSaleOutSheetBo.java new file mode 100644 index 0000000..47096ef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/GetSaleOutSheetBo.java @@ -0,0 +1,446 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSaleOutSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售订单ID + */ + @Schema(description = "销售订单ID") + private String saleOrderId; + + /** + * 销售订单号 + */ + @Schema(description = "销售订单号") + private String saleOrderCode; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 销售金额 + */ + @Schema(description = "销售金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetSaleOutSheetBo() { + + } + + public GetSaleOutSheetBo(SaleOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheetFullDto dto) { + + return super.convert(dto, GetSaleOutSheetBo::getStatus, GetSaleOutSheetBo::getSettleStatus, + GetSaleOutSheetBo::getDetails); + } + + @Override + protected void afterInit(SaleOutSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + this.customerName = customerService.findById(dto.getCustomerId()).getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.saleOrderCode = saleOrder.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 组合商品ID + */ + @Schema(description = "组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @Schema(description = "组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal orderNum; + + /** + * 剩余出库数量 + */ + @Schema(description = "剩余出库数量") + private BigDecimal remainNum; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 销售订单明细ID + */ + @Schema(description = "销售订单明细ID") + private String saleOrderDetailId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, SaleOutSheetFullDto.SheetDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + SaleOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.salePrice = dto.getOriPrice(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getSaleOrderDetailId())) { + SaleOrderDetailService saleOrderDetailService = ApplicationUtil.getBean( + SaleOrderDetailService.class); + SaleOrderDetail saleOrderDetail = saleOrderDetailService.getById( + dto.getSaleOrderDetailId()); + this.orderNum = saleOrderDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(saleOrderDetail.getOrderNum(), saleOrderDetail.getOutNum()); + } + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/PrintSaleOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/PrintSaleOutSheetBo.java new file mode 100644 index 0000000..dc9d0d9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/PrintSaleOutSheetBo.java @@ -0,0 +1,248 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintSaleOutSheetBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private String paymentDate; + + /** + * 销售订单号 + */ + @Schema(description = "销售订单号") + private String saleOrderCode; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintSaleOutSheetBo() { + + } + + public PrintSaleOutSheetBo(SaleOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheetFullDto dto) { + + return super.convert(dto, PrintSaleOutSheetBo::getDetails); + } + + @Override + protected void afterInit(SaleOutSheetFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.saleOrderCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.saleOrderCode = saleOrder.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal outAmount; + + public OrderDetailBo(SaleOutSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + SaleOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.outAmount = dto.getTaxAmount(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetBo.java new file mode 100644 index 0000000..8106db9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetBo.java @@ -0,0 +1,189 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QuerySaleOutSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 销售订单ID + */ + @Schema(description = "销售订单ID") + private String saleOrderId; + + /** + * 销售订单号 + */ + @Schema(description = "销售订单号") + private String saleOrderCode; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 销售金额 + */ + @Schema(description = "销售金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QuerySaleOutSheetBo(SaleOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheet dto) { + + return super.convert(dto, QuerySaleOutSheetBo::getStatus, QuerySaleOutSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SaleOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.saleOrderCode = saleOrder.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetWithReturnBo.java new file mode 100644 index 0000000..806f6b2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetWithReturnBo.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySaleOutSheetWithReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QuerySaleOutSheetWithReturnBo() { + + } + + public QuerySaleOutSheetWithReturnBo(SaleOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/SaleOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/SaleOutSheetWithReturnBo.java new file mode 100644 index 0000000..33ce3c5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/SaleOutSheetWithReturnBo.java @@ -0,0 +1,297 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class SaleOutSheetWithReturnBo extends BaseBo { + + /** + * 订单ID + */ + @Schema(description = "订单ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public SaleOutSheetWithReturnBo() { + + } + + public SaleOutSheetWithReturnBo(SaleOutSheetWithReturnDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheetWithReturnDto dto) { + + return super.convert(dto, SaleOutSheetWithReturnBo::getSalerId, + SaleOutSheetWithReturnBo::getDetails); + } + + @Override + protected void afterInit(SaleOutSheetWithReturnDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerName = customer.getName(); + + if (!StringUtil.isBlank(dto.getSalerId())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = userService.findById(dto.getSalerId()); + + this.salerId = saler.getId(); + this.salerName = saler.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 剩余退货数量 + */ + @Schema(description = "剩余退货数量") + private BigDecimal remainNum; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo(String scId, SaleOutSheetWithReturnDto.SheetDetailDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + public BaseBo convert( + SaleOutSheetWithReturnDto.SheetDetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + SaleOutSheetWithReturnDto.SheetDetailDto dto, SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(SaleOutSheetWithReturnDto.SheetDetailDto dto) { + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.outNum = dto.getOrderNum(); + this.salePrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReturnNum()); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/GetSaleReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/GetSaleReturnBo.java new file mode 100644 index 0000000..39faa44 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/GetSaleReturnBo.java @@ -0,0 +1,410 @@ +package com.lframework.xingyun.sc.bo.sale.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSaleReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售出库单ID + */ + @Schema(description = "销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @Schema(description = "销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal giftNum; + + /** + * 退货金额 + */ + @Schema(description = "退货金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public GetSaleReturnBo(SaleReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturnFullDto dto) { + + return super.convert(dto, GetSaleReturnBo::getStatus, GetSaleReturnBo::getSettleStatus, + GetSaleReturnBo::getDetails); + } + + @Override + protected void afterInit(SaleReturnFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + this.customerName = customerService.findById(dto.getCustomerId()).getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheet outSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new ReturnDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal outNum; + + /** + * 剩余退货数量 + */ + @Schema(description = "剩余退货数量") + private BigDecimal remainNum; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @Schema(description = "折扣") + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + @Schema(description = "是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @Schema(description = "税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 销售出库单明细ID + */ + @Schema(description = "销售出库单明细ID") + private String outSheetDetailId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public ReturnDetailBo(String scId, SaleReturnFullDto.ReturnDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + SaleReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.salePrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getOutSheetDetailId())) { + SaleOutSheetDetailLotService receiveSheetDetailService = ApplicationUtil.getBean( + SaleOutSheetDetailLotService.class); + SaleOutSheetDetailLotDto outSheetDetail = receiveSheetDetailService.findById( + dto.getOutSheetDetailId()); + this.outNum = outSheetDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(outSheetDetail.getOrderNum(), + outSheetDetail.getReturnNum()); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/PrintSaleReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/PrintSaleReturnBo.java new file mode 100644 index 0000000..943a7d5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/PrintSaleReturnBo.java @@ -0,0 +1,246 @@ +package com.lframework.xingyun.sc.bo.sale.returned; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PrintSaleReturnBo extends BaseBo { + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private String paymentDate; + + /** + * 销售出库单号 + */ + @Schema(description = "销售出库单号") + private String outSheetCode; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private String createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @Schema(description = "订单明细") + private List details; + + public PrintSaleReturnBo(SaleReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturnFullDto dto) { + + return super.convert(dto, PrintSaleReturnBo::getDetails); + } + + @Override + protected void afterInit(SaleReturnFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.outSheetCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheet outSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == SaleReturnStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(ReturnDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * SKU编号 + */ + @Schema(description = "SKU编号") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 价格 + */ + @Schema(description = "价格") + private BigDecimal taxPrice; + + /** + * 退货金额 + */ + @Schema(description = "退货金额") + private BigDecimal returnAmount; + + public ReturnDetailBo(SaleReturnFullDto.ReturnDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + SaleReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.taxPrice = dto.getTaxPrice(); + this.returnAmount = dto.getTaxAmount(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/QuerySaleReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/QuerySaleReturnBo.java new file mode 100644 index 0000000..df41f31 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/QuerySaleReturnBo.java @@ -0,0 +1,189 @@ +package com.lframework.xingyun.sc.bo.sale.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QuerySaleReturnBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @Schema(description = "销售员姓名") + private String salerName; + + /** + * 销售出库单ID + */ + @Schema(description = "销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @Schema(description = "销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @Schema(description = "赠品数量") + private BigDecimal totalGiftNum; + + /** + * 退货金额 + */ + @Schema(description = "退货金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QuerySaleReturnBo(SaleReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturn dto) { + + return super.convert(dto, QuerySaleReturnBo::getStatus, QuerySaleReturnBo::getSettleStatus); + } + + @Override + protected void afterInit(SaleReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + SaleOutSheet outSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/QueryStockAdjustSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/QueryStockAdjustSheetBo.java new file mode 100644 index 0000000..3508a2e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/QueryStockAdjustSheetBo.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 库存调整单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryStockAdjustSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + @EnumConvert + private Integer bizType; + + /** + * 调整原因 + */ + @Schema(description = "调整原因") + private String reasonName; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public QueryStockAdjustSheetBo() { + + } + + public QueryStockAdjustSheetBo(StockAdjustSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(StockAdjustSheet dto) { + + return super.convert(dto, QueryStockAdjustSheetBo::getStatus); + } + + @Override + protected void afterInit(StockAdjustSheet dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + StockAdjustReasonService stockAdjustReasonService = ApplicationUtil.getBean( + StockAdjustReasonService.class); + StockAdjustReason reason = stockAdjustReasonService.findById(dto.getReasonId()); + this.reasonName = reason.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustProductBo.java new file mode 100644 index 0000000..63baadc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustProductBo.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class StockAdjustProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 当前库存数量 + */ + @Schema(description = "当前库存数量") + private BigDecimal curStockNum; + + /** + * 仓库ID + */ + @JsonIgnore + @Schema(hidden = true) + private String scId; + + public StockAdjustProductBo() { + + } + + public StockAdjustProductBo(String scId, StockAdjustProductDto dto) { + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(StockAdjustProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getId(), + this.scId); + this.curStockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java new file mode 100644 index 0000000..8e09f4d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java @@ -0,0 +1,315 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.convert.EnumConvert; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 库存调整单 GetBo + *

+ * + * @author zmj + */ +@Data +public class StockAdjustSheetFullBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + @EnumConvert + private Integer bizType; + + /** + * 调整原因ID + */ + @Schema(description = "调整原因ID") + private String reasonId; + + /** + * 调整原因 + */ + @Schema(description = "调整原因") + private String reasonName; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 明细 + */ + @Schema(description = "明细") + private List details; + + public StockAdjustSheetFullBo(StockAdjustSheetFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(StockAdjustSheetFullDto dto) { + + return super.convert(dto, StockAdjustSheetFullBo::getStatus); + } + + @Override + protected void afterInit(StockAdjustSheetFullDto dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + StockAdjustReasonService stockAdjustReasonService = ApplicationUtil.getBean(StockAdjustReasonService.class); + StockAdjustReason reason = stockAdjustReasonService.findById(dto.getReasonId()); + this.reasonName = reason.getName(); + + this.details = dto.getDetails().stream().map(t -> new DetailBo(t, this.scId, this.status)) + .collect(Collectors.toList()); + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 调整库存数量 + */ + @Schema(description = "调整库存数量") + private BigDecimal stockNum; + + /** + * 当前库存数量 + */ + @Schema(description = "当前库存数量") + private BigDecimal curStockNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @JsonIgnore + @Schema(hidden = true) + private String scId; + + /** + * 状态 + */ + @JsonIgnore + @Schema(hidden = true) + private Integer status; + + public DetailBo(StockAdjustSheetFullDto.DetailDto dto, String scId, Integer status) { + + this.scId = scId; + this.status = status; + + this.init(dto); + } + + @Override + public BaseBo convert( + StockAdjustSheetFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(StockAdjustSheetFullDto.DetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (EnumUtil.getByCode(StockAdjustSheetStatus.class, this.status) + != StockAdjustSheetStatus.APPROVE_PASS) { + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getProductId(), + this.scId); + this.curStockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/GetStockAdjustReasonBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/GetStockAdjustReasonBo.java new file mode 100644 index 0000000..51928a6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/GetStockAdjustReasonBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock.reason; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetStockAdjustReasonBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetStockAdjustReasonBo() { + + } + + public GetStockAdjustReasonBo(StockAdjustReason dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/QueryStockAdjustReasonBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/QueryStockAdjustReasonBo.java new file mode 100644 index 0000000..b522761 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/QueryStockAdjustReasonBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock.reason; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryStockAdjustReasonBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryStockAdjustReasonBo() { + + } + + public QueryStockAdjustReasonBo(StockAdjustReason dto) { + + super(dto); + } + + @Override + protected void afterInit(StockAdjustReason dto) { + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/StockAdjustReasonSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/StockAdjustReasonSelectorBo.java new file mode 100644 index 0000000..3531a70 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/StockAdjustReasonSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock.reason; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class StockAdjustReasonSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public StockAdjustReasonSelectorBo() { + + } + + public StockAdjustReasonSelectorBo(StockAdjustReason dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/QueryProductStockBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/QueryProductStockBo.java new file mode 100644 index 0000000..2175707 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/QueryProductStockBo.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.sc.bo.stock.product; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStock; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class QueryProductStockBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 商品分类 + */ + @Schema(description = "商品分类") + private String categoryName; + + /** + * 商品品牌 + */ + @Schema(description = "商品品牌") + private String brandName; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 含税价格 + */ + @Schema(description = "含税价格") + private BigDecimal taxPrice; + + /** + * 含税金额 + */ + @Schema(description = "含税金额") + private BigDecimal taxAmount; + + public QueryProductStockBo() { + + } + + public QueryProductStockBo(ProductStock dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductStock dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/log/QueryProductStockLogBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/log/QueryProductStockLogBo.java new file mode 100644 index 0000000..621708f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/log/QueryProductStockLogBo.java @@ -0,0 +1,189 @@ +package com.lframework.xingyun.sc.bo.stock.product.log; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryProductStockLogBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 商品分类 + */ + @Schema(description = "商品分类") + private String categoryName; + + /** + * 商品品牌 + */ + @Schema(description = "商品品牌") + private String brandName; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 原库存数量 + */ + @Schema(description = "原库存数量") + private BigDecimal oriStockNum; + + /** + * 现库存数量 + */ + @Schema(description = "现库存数量") + private BigDecimal curStockNum; + + /** + * 原含税成本价 + */ + @Schema(description = "原含税成本价") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @Schema(description = "现含税成本价") + private BigDecimal curTaxPrice; + + /** + * 含税金额 + */ + @Schema(description = "含税金额") + private BigDecimal taxAmount; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + private Integer bizType; + + public QueryProductStockLogBo() { + + } + + public QueryProductStockLogBo(ProductStockLog dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductStockLog dto) { + + return super.convert(dto, QueryProductStockLogBo::getBizType); + } + + @Override + protected void afterInit(ProductStockLog dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + + this.bizType = dto.getBizType().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/config/GetTakeStockConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/config/GetTakeStockConfigBo.java new file mode 100644 index 0000000..5f9cebb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/config/GetTakeStockConfigBo.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.sc.bo.stock.take.config; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + *

+ * 盘点参数 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetTakeStockConfigBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据 + */ + @Schema(description = "库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据") + private Boolean showProduct; + + /** + * 库存盘点单是否显示盘点任务创建时商品的系统库存数量 + */ + @Schema(description = "库存盘点单是否显示盘点任务创建时商品的系统库存数量") + private Boolean showStock; + + /** + * 盘点差异生成时是否自动调整盘点任务中商品的系统库存数量 + */ + @Schema(description = "盘点差异生成时是否自动调整盘点任务中商品的系统库存数量") + private Boolean autoChangeStock; + + /** + * 盘点差异单中的盘点数量是否允许手动修改 + */ + @Schema(description = "盘点差异单中的盘点数量是否允许手动修改") + private Boolean allowChangeNum; + + /** + * 盘点任务创建后多少小时内未完成,则自动作废 + */ + @Schema(description = "盘点任务创建后多少小时内未完成,则自动作废") + private Integer cancelHours; + + public GetTakeStockConfigBo() { + + } + + public GetTakeStockConfigBo(TakeStockConfig dto) { + + super(dto); + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/GetTakeStockPlanBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/GetTakeStockPlanBo.java new file mode 100644 index 0000000..64365b2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/GetTakeStockPlanBo.java @@ -0,0 +1,127 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + *

+ * 盘点任务 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetTakeStockPlanBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @Schema(description = "盘点类别") + private Integer takeType; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + private Integer takeStatus; + + /** + * 业务名称 + */ + @Schema(description = "业务名称") + private String bizName; + + public GetTakeStockPlanBo() { + + } + + public GetTakeStockPlanBo(TakeStockPlan dto) { + + super(dto); + } + + @Override + public
BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, GetTakeStockPlanBo::getTakeType, GetTakeStockPlanBo::getTakeStatus); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scName = sc.getName(); + + String bizId = dto.getBizId(); + if (dto.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (dto.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanBo.java new file mode 100644 index 0000000..8a8ef49 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanBo.java @@ -0,0 +1,163 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 盘点任务 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryTakeStockPlanBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @Schema(description = "盘点类别") + private Integer takeType; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + private Integer takeStatus; + + /** + * 盘点内容 + */ + @Schema(description = "盘点内容") + private String bizName; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryTakeStockPlanBo() { + + } + + public QueryTakeStockPlanBo(TakeStockPlan dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, QueryTakeStockPlanBo::getTakeType, QueryTakeStockPlanBo::getTakeStatus); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + String bizId = dto.getBizId(); + if (dto.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (dto.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanProductBo.java new file mode 100644 index 0000000..9adbb3a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanProductBo.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class QueryTakeStockPlanProductBo extends BaseBo { + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 初始库存 + */ + @Schema(description = "初始库存") + private BigDecimal stockNum; + + public QueryTakeStockPlanProductBo(QueryTakeStockPlanProductDto dto) { + + super(dto); + } + + @Override + protected void afterInit(QueryTakeStockPlanProductDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (!config.getShowStock()) { + this.stockNum = null; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanFullBo.java new file mode 100644 index 0000000..f3c5298 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanFullBo.java @@ -0,0 +1,285 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class TakeStockPlanFullBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @Schema(description = "盘点类别") + private Integer takeType; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + private Integer takeStatus; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 明细 + */ + @Schema(description = "明细") + private List details; + + public TakeStockPlanFullBo(TakeStockPlanFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(TakeStockPlanFullDto dto) { + + return super.convert(dto, TakeStockPlanFullBo::getTakeType, TakeStockPlanFullBo::getTakeStatus, + TakeStockPlanFullBo::getDetails); + } + + @Override + protected void afterInit(TakeStockPlanFullDto dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + this.details = CollectionUtil.isEmpty(dto.getDetails()) ? + CollectionUtil.emptyList() : + dto.getDetails().stream().map(t -> new DetailBo(t, this.id)).collect(Collectors.toList()); + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 原盘点数量(通过盘点单统计) + */ + @Schema(description = "原盘点数量(通过盘点单统计)") + private BigDecimal oriTakeNum; + + /** + * 修改后的盘点数量 + */ + @Schema(description = "修改后的盘点数量") + private BigDecimal takeNum; + + /** + * 出项数量 + */ + @Schema(description = "出项数量") + private BigDecimal totalOutNum; + + /** + * 进项数量 + */ + @Schema(description = "进项数量") + private BigDecimal totalInNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 差异数量 + */ + @Schema(description = "差异数量") + private BigDecimal diffNum; + + /** + * 盘点任务ID + */ + @Schema(description = "盘点任务ID", hidden = true) + @JsonIgnore + private String planId; + + public DetailBo(TakeStockPlanFullDto.DetailDto dto, String planId) { + + this.planId = planId; + + this.init(dto); + } + + @Override + public BaseBo convert(TakeStockPlanFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(TakeStockPlanFullDto.DetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (this.oriTakeNum != null || this.takeNum != null) { + + if (this.takeNum != null) { + this.diffNum = NumberUtil.sub(this.takeNum, this.stockNum); + } else { + this.diffNum = NumberUtil.sub(this.oriTakeNum, this.stockNum); + } + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanSelectorBo.java new file mode 100644 index 0000000..0b5aa23 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanSelectorBo.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class TakeStockPlanSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @Schema(description = "盘点类别") + private Integer takeType; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + private Integer takeStatus; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public TakeStockPlanSelectorBo(TakeStockPlan dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, TakeStockPlanSelectorBo::getTakeType, TakeStockPlanSelectorBo::getTakeStatus); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/GetPreTakeStockSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/GetPreTakeStockSheetBo.java new file mode 100644 index 0000000..0627185 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/GetPreTakeStockSheetBo.java @@ -0,0 +1,231 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 预先盘点单 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetPreTakeStockSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + private Integer takeStatus; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 操作人 + */ + @Schema(description = "操作人") + private String updateBy; + + /** + * 操作时间 + */ + @Schema(description = "操作时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 明细 + */ + @Schema(description = "明细") + private List details; + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 初盘数量 + */ + @Schema(description = "初盘数量") + private BigDecimal firstNum; + + /** + * 复盘数量 + */ + @Schema(description = "复盘数量") + private BigDecimal secondNum; + + /** + * 抽盘数量 + */ + @Schema(description = "抽盘数量") + private BigDecimal randNum; + + public SheetDetailBo(PreTakeStockSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + protected void afterInit(PreTakeStockSheetFullDto.SheetDetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + } + } + + public GetPreTakeStockSheetBo() { + + } + + public GetPreTakeStockSheetBo(PreTakeStockSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PreTakeStockSheetFullDto dto) { + + return super.convert(dto, GetPreTakeStockSheetBo::getTakeStatus); + } + + @Override + protected void afterInit(PreTakeStockSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scId = sc.getId(); + this.scName = sc.getName(); + + this.takeStatus = dto.getTakeStatus().getCode(); + + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockProductBo.java new file mode 100644 index 0000000..e116246 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockProductBo.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class PreTakeStockProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + public PreTakeStockProductBo() { + + } + + public PreTakeStockProductBo(PreTakeStockProductDto dto) { + + super(dto); + } + + @Override + protected void afterInit(PreTakeStockProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockSheetSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockSheetSelectorBo.java new file mode 100644 index 0000000..97ef708 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockSheetSelectorBo.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class PreTakeStockSheetSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + private Integer takeStatus; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public PreTakeStockSheetSelectorBo(PreTakeStockSheet dto) { + + super(dto); + } + + @Override + public
BaseBo convert(PreTakeStockSheet dto) { + + return super.convert(dto, PreTakeStockSheetSelectorBo::getTakeStatus); + } + + @Override + protected void afterInit(PreTakeStockSheet dto) { + + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetBo.java new file mode 100644 index 0000000..e866bdd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetBo.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 预先盘点单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryPreTakeStockSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + private Integer takeStatus; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public QueryPreTakeStockSheetBo() { + + } + + public QueryPreTakeStockSheetBo(PreTakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(PreTakeStockSheet dto) { + + return super.convert(dto, QueryPreTakeStockSheetBo::getTakeStatus); + } + + @Override + protected void afterInit(PreTakeStockSheet dto) { + + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetProductBo.java new file mode 100644 index 0000000..2cc1884 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetProductBo.java @@ -0,0 +1,148 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class QueryPreTakeStockSheetProductBo extends BaseBo { + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 盘点数量 + */ + @Schema(description = "盘点数量") + private BigDecimal takeNum; + + public QueryPreTakeStockSheetProductBo(QueryPreTakeStockSheetProductDto dto, String scId) { + + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(QueryPreTakeStockSheetProductDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (dto.getTakeStatus() == PreTakeStockSheetStatus.FIRST_TAKE) { + this.takeNum = dto.getFirstNum(); + } else if (dto.getTakeStatus() == PreTakeStockSheetStatus.SECOND_TAKE) { + this.takeNum = dto.getSecondNum(); + } else if (dto.getTakeStatus() == PreTakeStockSheetStatus.RAND_TAKE) { + this.takeNum = dto.getRandNum(); + } + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (config.getShowStock()) { + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.productId, this.scId); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/QueryTakeStockSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/QueryTakeStockSheetBo.java new file mode 100644 index 0000000..29939ed --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/QueryTakeStockSheetBo.java @@ -0,0 +1,148 @@ +package com.lframework.xingyun.sc.bo.stock.take.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 盘点单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryTakeStockSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 盘点任务号 + */ + @Schema(description = "盘点任务号") + private String planCode; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点任务-盘点类别 + */ + @Schema(description = "盘点任务-盘点类别") + private Integer takeType; + + /** + * 盘点任务-盘点状态 + */ + @Schema(description = "盘点任务-盘点状态") + private Integer takeStatus; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public QueryTakeStockSheetBo() { + + } + + public QueryTakeStockSheetBo(TakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockSheet dto) { + + return super.convert(dto, QueryTakeStockSheetBo::getTakeStatus, QueryTakeStockSheetBo::getStatus); + } + + @Override + protected void afterInit(TakeStockSheet dto) { + + this.status = dto.getStatus().getCode(); + + TakeStockPlanService takeStockPlanService = ApplicationUtil.getBean(TakeStockPlanService.class); + TakeStockPlan takeStockPlan = takeStockPlanService.getById(dto.getPlanId()); + + this.planCode = takeStockPlan.getCode(); + this.takeStatus = takeStockPlan.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.takeType = takeStockPlan.getTakeType().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetFullBo.java new file mode 100644 index 0000000..a2c2ca3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetFullBo.java @@ -0,0 +1,355 @@ +package com.lframework.xingyun.sc.bo.stock.take.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 盘点单详情 Bo + *

+ * + * @author zmj + */ +@Data +public class TakeStockSheetFullBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 盘点任务ID + */ + @Schema(description = "盘点任务ID") + private String planId; + + /** + * 盘点任务号 + */ + @Schema(description = "盘点任务号") + private String planCode; + + /** + * 预先盘点单ID + */ + @Schema(description = "预先盘点单ID") + private String preSheetId; + + /** + * 预先盘点单号 + */ + @Schema(description = "预先盘点单号") + private String preSheetCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 盘点任务-盘点类别 + */ + @Schema(description = "盘点任务-盘点类别") + private Integer takeType; + + /** + * 业务名称 + */ + @Schema(description = "业务名称") + private String bizName; + + /** + * 盘点任务-盘点状态 + */ + @Schema(description = "盘点任务-盘点状态") + private Integer takeStatus; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由") + private String refuseReason; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 明细 + */ + @Schema(description = "明细") + private List details; + + public TakeStockSheetFullBo(TakeStockSheetFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(TakeStockSheetFullDto dto) { + + return super.convert(dto, TakeStockSheetFullBo::getTakeStatus, TakeStockSheetFullBo::getStatus); + } + + @Override + protected void afterInit(TakeStockSheetFullDto dto) { + + this.status = dto.getStatus().getCode(); + + TakeStockPlanService takeStockPlanService = ApplicationUtil.getBean(TakeStockPlanService.class); + TakeStockPlan plan = takeStockPlanService.getById(dto.getPlanId()); + this.planCode = plan.getCode(); + this.takeType = plan.getTakeType().getCode(); + this.takeStatus = plan.getTakeStatus().getCode(); + + String bizId = plan.getBizId(); + if (plan.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (plan.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + + if (!StringUtil.isBlank(dto.getPreSheetId())) { + PreTakeStockSheetService preTakeStockSheetService = ApplicationUtil.getBean( + PreTakeStockSheetService.class); + PreTakeStockSheet preSheet = preTakeStockSheetService.getById(dto.getPreSheetId()); + this.preSheetCode = preSheet.getCode(); + } + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(this.approveBy)) { + this.approveBy = userService.findById(this.approveBy).getName(); + } + + this.details = dto.getDetails().stream().map(t -> new SheetDetailBo(t, this.planId)) + .collect(Collectors.toList()); + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 盘点数量 + */ + @Schema(description = "盘点数量") + private BigDecimal takeNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 盘点任务ID + */ + @Schema(description = "盘点任务ID") + private String planId; + + public SheetDetailBo(TakeStockSheetFullDto.SheetDetailDto dto, String planId) { + + this.planId = planId; + + this.init(dto); + } + + @Override + protected void afterInit(TakeStockSheetFullDto.SheetDetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (config.getShowStock()) { + TakeStockPlanDetailService takeStockPlanDetailService = ApplicationUtil.getBean( + TakeStockPlanDetailService.class); + GetTakeStockPlanDetailProductDto planDetail = takeStockPlanDetailService.getByPlanIdAndProductId( + this.planId, this.productId); + this.stockNum = planDetail.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetProductBo.java new file mode 100644 index 0000000..84af0f2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetProductBo.java @@ -0,0 +1,130 @@ +package com.lframework.xingyun.sc.bo.stock.take.sheet; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class TakeStockSheetProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 库存数量 + */ + @Schema(description = "库存数量") + private BigDecimal stockNum; + + /** + * 盘点任务ID + */ + @Schema(description = "盘点任务ID", hidden = true) + @JsonIgnore + private String planId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public TakeStockSheetProductBo(TakeStockSheetProductDto dto, String planId, String scId) { + + this.planId = planId; + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(TakeStockSheetProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (config.getShowStock()) { + if (!StringUtil.isBlank(this.planId)) { + TakeStockPlanDetailService takeStockPlanDetailService = ApplicationUtil.getBean( + TakeStockPlanDetailService.class); + GetTakeStockPlanDetailProductDto product = takeStockPlanDetailService.getByPlanIdAndProductId( + this.planId, this.productId); + this.stockNum = product.getStockNum(); + } else { + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.productId, + this.scId); + this.stockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderBo.java new file mode 100644 index 0000000..0c8c72a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderBo.java @@ -0,0 +1,148 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 仓库调拨单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryScTransferOrderBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 转出仓库编号 + */ + @Schema(description = "转出仓库编号") + private String sourceScCode; + + /** + * 转出仓库名称 + */ + @Schema(description = "转出仓库名称") + private String sourceScName; + + /** + * 转入仓库编号 + */ + @Schema(description = "转入仓库编号") + private String targetScCode; + + /** + * 转入仓库名称 + */ + @Schema(description = "转入仓库名称") + private String targetScName; + + /** + * 调拨数量 + */ + @Schema(description = "调拨数量") + private BigDecimal totalNum; + + /** + * 调拨成本金额 + */ + @Schema(description = "调拨成本金额") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public QueryScTransferOrderBo() { + + } + + public QueryScTransferOrderBo(ScTransferOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(ScTransferOrder dto) { + + return super.convert(dto, QueryScTransferOrderBo::getStatus); + } + + @Override + protected void afterInit(ScTransferOrder dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sourceSc = storeCenterService.findById(dto.getSourceScId()); + this.sourceScCode = sourceSc.getCode(); + this.sourceScName = sourceSc.getName(); + + StoreCenter targetSc = storeCenterService.findById(dto.getTargetScId()); + this.targetScCode = targetSc.getCode(); + this.targetScName = targetSc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderDetailReceiveBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderDetailReceiveBo.java new file mode 100644 index 0000000..8d5abba --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderDetailReceiveBo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryScTransferOrderDetailReceiveBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 收货数量 + */ + @Schema(description = "收货数量") + private BigDecimal receiveNum; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + public QueryScTransferOrderDetailReceiveBo() { + } + + public QueryScTransferOrderDetailReceiveBo(ScTransferOrderDetailReceive dto) { + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferOrderFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferOrderFullBo.java new file mode 100644 index 0000000..907d47d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferOrderFullBo.java @@ -0,0 +1,322 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 仓库调拨单 GetBo + *

+ * + * @author zmj + */ +@Data +public class ScTransferOrderFullBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 转出仓库ID + */ + @Schema(description = "转出仓库ID") + private String sourceScId; + + /** + * 转出仓库名称 + */ + @Schema(description = "转出仓库名称") + private String sourceScName; + + /** + * 转入仓库ID + */ + @Schema(description = "转入仓库ID") + private String targetScId; + + /** + * 转入仓库名称 + */ + @Schema(description = "转入仓库名称") + private String targetScName; + + /** + * 调拨数量 + */ + @Schema(description = "调拨数量") + private BigDecimal totalNum; + + /** + * 调拨成本金额 + */ + @Schema(description = "调拨成本金额") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + /** + * 明细 + */ + @Schema(description = "明细") + private List details; + + public ScTransferOrderFullBo(ScTransferOrderFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(ScTransferOrderFullDto dto) { + + return super.convert(dto, ScTransferOrderFullBo::getStatus); + } + + @Override + protected void afterInit(ScTransferOrderFullDto dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sourceSc = storeCenterService.findById(dto.getSourceScId()); + this.sourceScName = sourceSc.getName(); + + StoreCenter targetSc = storeCenterService.findById(dto.getTargetScId()); + this.targetScName = targetSc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.details = dto.getDetails().stream().map(t -> new DetailBo(t, this.sourceScId, this.status)) + .collect(Collectors.toList()); + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 调拨数量 + */ + @Schema(description = "调拨数量") + private BigDecimal transferNum; + + /** + * 当前库存数量 + */ + @Schema(description = "当前库存数量") + private BigDecimal curStockNum; + + /** + * 已收货数量 + */ + @Schema(description = "已收货数量") + private BigDecimal receiveNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 仓库ID + */ + @JsonIgnore + @Schema(hidden = true) + private String scId; + + /** + * 状态 + */ + @JsonIgnore + @Schema(hidden = true) + private Integer status; + + public DetailBo(ScTransferOrderFullDto.DetailDto dto, String scId, Integer status) { + + this.scId = scId; + this.status = status; + + this.init(dto); + } + + @Override + public BaseBo convert( + ScTransferOrderFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ScTransferOrderFullDto.DetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (EnumUtil.getByCode(ScTransferOrderStatus.class, this.status) + != ScTransferOrderStatus.APPROVE_PASS) { + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getProductId(), + this.scId); + this.curStockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferProductBo.java new file mode 100644 index 0000000..3945b9e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferProductBo.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ScTransferProductBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String productId; + + /** + * 编号 + */ + @Schema(description = "编号") + private String productCode; + + /** + * 名称 + */ + @Schema(description = "名称") + private String productName; + + /** + * 分类名称 + */ + @Schema(description = "分类名称") + private String categoryName; + + /** + * 品牌名称 + */ + @Schema(description = "品牌名称") + private String brandName; + + /** + * SKU + */ + @Schema(description = "SKU") + private String skuCode; + + /** + * 简码 + */ + @Schema(description = "简码") + private String externalCode; + + /** + * 规格 + */ + @Schema(description = "规格") + private String spec; + + /** + * 单位 + */ + @Schema(description = "单位") + private String unit; + + /** + * 当前库存数量 + */ + @Schema(description = "当前库存数量") + private BigDecimal curStockNum; + + /** + * 仓库ID + */ + @JsonIgnore + @Schema(hidden = true) + private String scId; + + public ScTransferProductBo() { + + } + + public ScTransferProductBo(String scId, ScTransferProductDto dto) { + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(ScTransferProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getId(), + this.scId); + this.curStockNum = productStock == null ? BigDecimal.ZERO : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningBo.java new file mode 100644 index 0000000..9a0129b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningBo.java @@ -0,0 +1,123 @@ +package com.lframework.xingyun.sc.bo.stock.warning; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 库存预警 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetProductStockWarningBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 预警上限 + */ + @Schema(description = "预警上限") + private BigDecimal maxLimit; + + /** + * 预警下限 + */ + @Schema(description = "预警下限") + private BigDecimal minLimit; + + /** + * 操作人 + */ + @Schema(description = "操作人") + private String updateBy; + + /** + * 操作时间 + */ + @Schema(description = "操作时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; + + public GetProductStockWarningBo() { + + } + + public GetProductStockWarningBo(ProductStockWarning dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductStockWarning dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + this.productCode = product.getCode(); + this.productName = product.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningNotifyBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningNotifyBo.java new file mode 100644 index 0000000..09a55ff --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/GetProductStockWarningNotifyBo.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.sc.bo.stock.warning; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysNotifyGroup; +import com.lframework.starter.web.inner.service.system.SysNotifyGroupService; +import com.lframework.xingyun.sc.entity.ProductStockWarningNotify; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetProductStockWarningNotifyBo extends BaseBo { + + /** + * 消息通知组ID + */ + @Schema(description = "消息通知组ID") + private String id; + + /** + * 消息通知组名称 + */ + @Schema(description = "消息通知组名称") + private String name; + + /** + * 消息通知组状态 + */ + @Schema(description = "消息通知组状态") + private Boolean available; + + public GetProductStockWarningNotifyBo(ProductStockWarningNotify dto) { + super(dto); + } + + @Override + protected void afterInit(ProductStockWarningNotify dto) { + SysNotifyGroupService sysNotifyGroupService = ApplicationUtil.getBean( + SysNotifyGroupService.class); + + SysNotifyGroup sysNotifyGroup = sysNotifyGroupService.findById(dto.getNotifyGroupId()); + this.id = sysNotifyGroup.getId(); + this.name = sysNotifyGroup.getName(); + this.available = sysNotifyGroup.getAvailable(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/QueryProductStockWarningBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/QueryProductStockWarningBo.java new file mode 100644 index 0000000..96414e3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/warning/QueryProductStockWarningBo.java @@ -0,0 +1,123 @@ +package com.lframework.xingyun.sc.bo.stock.warning; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 库存预警 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryProductStockWarningBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 仓库编号 + */ + @Schema(description = "仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @Schema(description = "仓库名称") + private String scName; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 预警上限 + */ + @Schema(description = "预警上限") + private BigDecimal maxLimit; + + /** + * 预警下限 + */ + @Schema(description = "预警下限") + private BigDecimal minLimit; + + /** + * 操作人 + */ + @Schema(description = "操作人") + private String updateBy; + + /** + * 操作时间 + */ + @Schema(description = "操作时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Boolean available; + + public QueryProductStockWarningBo() { + + } + + public QueryProductStockWarningBo(ProductStockWarning dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductStockWarning dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + this.productCode = product.getCode(); + this.productName = product.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/components/code/GenerateCodeTypePool.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/components/code/GenerateCodeTypePool.java new file mode 100644 index 0000000..e6c81c8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/components/code/GenerateCodeTypePool.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.components.code; + +public interface GenerateCodeTypePool { + + /** + * 采购订单 + */ + Integer PURCHASE_ORDER = 200; + + /** + * 采购收货单 + */ + Integer RECEIVE_SHEET = 201; + + /** + * 采购退单 + */ + Integer PURCHASE_RETURN = 202; + + /** + * 销售订单 + */ + Integer SALE_ORDER = 203; + + /** + * 销售出库单 + */ + Integer SALE_OUT_SHEET = 204; + + /** + * 销售退货单 + */ + Integer SALE_RETURN = 205; + + /** + * 零售出库单 + */ + Integer RETAIL_OUT_SHEET = 206; + + /** + * 零售退货单 + */ + Integer RETAIL_RETURN = 207; + + /** + * 预先盘点单 + */ + Integer PRE_TAKE_STOCK_SHEET = 208; + + /** + * 盘点任务 + */ + Integer TAKE_STOCK_PLAN = 209; + + /** + * 盘点单 + */ + Integer TAKE_STOCK_SHEET = 210; + + /** + * 库存调整单 + */ + Integer STOCK_ADJUST_SHEET = 212; + + /** + * 仓库调拨单 + */ + Integer SC_TRANSFER_ORDER = 213; + + /** + * 物流单 + */ + Integer LOGISTICS_SHEET = 214; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ScSelectorController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ScSelectorController.java new file mode 100644 index 0000000..f464956 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ScSelectorController.java @@ -0,0 +1,273 @@ +package com.lframework.xingyun.sc.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.bo.purchase.PurchaseOrderSelectorBo; +import com.lframework.xingyun.sc.bo.purchase.receive.ReceiveSheetSelectorBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.reason.StockAdjustReasonSelectorBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.TakeStockPlanSelectorBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.PreTakeStockSheetSelectorBo; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.vo.purchase.PurchaseOrderSelectorVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveSheetSelectorVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 数据选择器 + * + * @author zmj + */ +@Tag(name = "数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class ScSelectorController extends DefaultBaseController { + + @Autowired + private PurchaseOrderService purchaseOrderService; + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Autowired + private PreTakeStockSheetService preTakeStockSheetService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Autowired + private StockAdjustReasonService stockAdjustReasonService; + + /** + * 采购订单 + */ + @Operation(summary = "采购订单") + @GetMapping("/purchaseorder") + public InvokeResult> selector( + @Valid PurchaseOrderSelectorVo vo) { + + PageResult pageResult = purchaseOrderService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PurchaseOrderSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载采购订单 + */ + @Operation(summary = "加载采购订单") + @PostMapping("/purchaseorder/load") + public InvokeResult> loadPurchaseOrder( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = purchaseOrderService.listByIds(ids); + List results = datas.stream().map(PurchaseOrderSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 采购收货单 + */ + @Operation(summary = "采购收货单") + @GetMapping("/receivesheet") + public InvokeResult> selector( + @Valid ReceiveSheetSelectorVo vo) { + + PageResult pageResult = receiveSheetService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ReceiveSheetSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载采购收货单 + */ + @Operation(summary = "加载采购收货单") + @PostMapping("/receivesheet/load") + public InvokeResult> loadReceiveSheet( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = receiveSheetService.listByIds(ids); + List results = datas.stream().map(ReceiveSheetSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 盘点任务 + */ + @Operation(summary = "盘点任务") + @GetMapping("/takestock/plan") + public InvokeResult> selector( + @Valid TakeStockPlanSelectorVo vo) { + + PageResult pageResult = takeStockPlanService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(TakeStockPlanSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载盘点任务 + */ + @Operation(summary = "加载盘点任务") + @PostMapping("/takestock/plan/load") + public InvokeResult> loadTakeStockPlan( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = takeStockPlanService.listByIds(ids); + List results = datas.stream().map(TakeStockPlanSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 预先盘点单 + */ + @Operation(summary = "预先盘点单") + @GetMapping("/takestock/pre") + public InvokeResult> selector( + @Valid PreTakeStockSheetSelectorVo vo) { + + PageResult pageResult = preTakeStockSheetService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PreTakeStockSheetSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载预先盘点单 + */ + @Operation(summary = "加载预先盘点单") + @PostMapping("/takestock/pre/load") + public InvokeResult> loadPreTakeStock( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = preTakeStockSheetService.listByIds(ids); + List results = datas.stream().map(PreTakeStockSheetSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @Operation(summary = "订单支付方式") + @GetMapping("/paytype/order") + public InvokeResult> getOrderPayType( + @NotBlank(message = "订单ID不能为空!") String orderId) { + List datas = orderPayTypeService.findByOrderId(orderId); + List results = datas.stream().map(OrderPayTypeBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 库存调整原因 + */ + @Operation(summary = "库存调整原因") + @GetMapping("/stock/adjust/reason") + public InvokeResult> selector( + @Valid StockAdjustReasonSelectorVo vo) { + + PageResult pageResult = stockAdjustReasonService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(StockAdjustReasonSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载库存调整原因 + */ + @Operation(summary = "加载库存调整原因") + @PostMapping("/stock/adjust/reason/load") + public InvokeResult> loadStockAdjustReason( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().map(t -> stockAdjustReasonService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(StockAdjustReasonSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/logistics/LogisticsSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/logistics/LogisticsSheetController.java new file mode 100644 index 0000000..42481cb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/logistics/LogisticsSheetController.java @@ -0,0 +1,324 @@ +package com.lframework.xingyun.sc.controller.logistics; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.logistics.GetLogisticsSheetBo; +import com.lframework.xingyun.sc.bo.logistics.GetLogisticsSheetDeliveryBo; +import com.lframework.xingyun.sc.bo.logistics.QueryLogisticsSheetBizOrderBo; +import com.lframework.xingyun.sc.bo.logistics.QueryLogisticsSheetBo; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.excel.logistics.*; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import com.lframework.xingyun.sc.vo.logistics.*; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetCalcWeightOrVolumeVo.BizOrderVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 物流单管理 + * + * @author zmj + */ +@Tag(name = "物流单管理") +@Validated +@RestController +@RequestMapping("/logistics/sheet") +public class LogisticsSheetController extends DefaultBaseController { + + @Autowired + private LogisticsSheetService logisticsSheetService; + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + /** + * 物流单列表 + */ + @Operation(summary = "物流单列表") + @HasPermission({"logistics:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryLogisticsSheetVo vo) { + + PageResult pageResult = logisticsSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryLogisticsSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"logistics:sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "物流单ID不能为空!") String id) { + + LogisticsSheetFullDto data = logisticsSheetService.getDetail(id); + + GetLogisticsSheetBo result = new GetLogisticsSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询业务单据 + */ + @Operation(summary = "查询业务单据") + @HasPermission({"logistics:sheet:add", "logistics:sheet:modify"}) + @GetMapping("/biz") + public InvokeResult> queryBizOrder( + @Valid QueryLogisticsSheetBizOrderVo vo) { + + PageResult pageResult = logisticsSheetService.queryBizOrder( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryLogisticsSheetBizOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 计算重量 + */ + @Operation(summary = "计算重量") + @HasPermission({"logistics:sheet:add", "logistics:sheet:modify"}) + @PostMapping("/calc/weight") + public InvokeResult calcWeight( + @Valid @RequestBody LogisticsSheetCalcWeightOrVolumeVo vo) { + + BigDecimal totalWeight = BigDecimal.ZERO; + + List saleOutSheetIds = new ArrayList<>(); + List retailOutSheetIds = new ArrayList<>(); + + for (BizOrderVo bizOrder : vo.getBizOrders()) { + LogisticsSheetDetailBizType bizType = EnumUtil.getByCode(LogisticsSheetDetailBizType.class, + bizOrder.getBizType()); + + if (bizType == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + saleOutSheetIds.add(bizOrder.getBizId()); + } else if (bizType == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + retailOutSheetIds.add(bizOrder.getBizId()); + } + } + + if (CollectionUtil.isNotEmpty(saleOutSheetIds)) { + totalWeight = NumberUtil.add(totalWeight, + saleOutSheetDetailService.getTotalWeightBySheetIds(saleOutSheetIds)); + } + + if (CollectionUtil.isNotEmpty(retailOutSheetIds)) { + totalWeight = NumberUtil.add(totalWeight, + retailOutSheetDetailService.getTotalWeightBySheetIds(retailOutSheetIds)); + } + + return InvokeResultBuilder.success(totalWeight); + } + + /** + * 计算体积 + */ + @Operation(summary = "计算体积") + @HasPermission({"logistics:sheet:add", "logistics:sheet:modify"}) + @PostMapping("/calc/volume") + public InvokeResult calcVolume( + @Valid @RequestBody LogisticsSheetCalcWeightOrVolumeVo vo) { + + BigDecimal totalVolume = BigDecimal.ZERO; + + List saleOutSheetIds = new ArrayList<>(); + List retailOutSheetIds = new ArrayList<>(); + + for (BizOrderVo bizOrder : vo.getBizOrders()) { + LogisticsSheetDetailBizType bizType = EnumUtil.getByCode(LogisticsSheetDetailBizType.class, + bizOrder.getBizType()); + + if (bizType == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + saleOutSheetIds.add(bizOrder.getBizId()); + } else if (bizType == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + retailOutSheetIds.add(bizOrder.getBizId()); + } + } + + if (CollectionUtil.isNotEmpty(saleOutSheetIds)) { + totalVolume = NumberUtil.add(totalVolume, + saleOutSheetDetailService.getTotalVolumeBySheetIds(saleOutSheetIds)); + } + + if (CollectionUtil.isNotEmpty(retailOutSheetIds)) { + totalVolume = NumberUtil.add(totalVolume, + retailOutSheetDetailService.getTotalVolumeBySheetIds(retailOutSheetIds)); + } + + return InvokeResultBuilder.success(totalVolume); + } + + /** + * 创建物流单 + */ + @Operation(summary = "创建物流单") + @HasPermission({"logistics:sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateLogisticsSheetVo vo) { + + String id = logisticsSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改物流单 + */ + @Operation(summary = "修改物流单") + @HasPermission({"logistics:sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateLogisticsSheetVo vo) { + + logisticsSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除物流单 + */ + @Operation(summary = "删除物流单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"logistics:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "物流单ID不能为空!") String id) { + + logisticsSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 查询物流单发货信息 + */ + @Operation(summary = "查询物流单发货信息") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"logistics:sheet:delivery"}) + @GetMapping("/delivery") + public InvokeResult queryDelivery( + @NotBlank(message = "ID不能为空!") String id) { + + LogisticsSheet sheet = logisticsSheetService.getById(id); + if (sheet == null) { + throw new DefaultClientException("物流单不存在!"); + } + + return InvokeResultBuilder.success(new GetLogisticsSheetDeliveryBo(sheet)); + } + + /** + * 物流单发货 + */ + @Operation(summary = "物流单发货") + @HasPermission({"logistics:sheet:delivery"}) + @PutMapping("/delivery") + public InvokeResult delivery(@Valid DeliveryLogisticsSheetVo vo) { + + logisticsSheetService.delivery(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"logistics:sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryLogisticsSheetVo vo) { + + ExportTaskUtil.exportTask("物流单信息", LogisticsSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"logistics:sheet:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("物流单导入模板","物流单导入模板", LogisticsSheetImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"logistics:sheet:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + LogisticsSheetImportListener listener = new LogisticsSheetImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, LogisticsSheetImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载批量发货模板") + @HasPermission({"logistics:sheet:delivery"}) + @GetMapping("/import/template/delivery") + public void downloadDeliveryImportTemplate() { + ExcelUtil.exportXlsx("物流单批量发货模板", "物流单批量发货模板", LogisticsSheetDeliveryImportModel.class); + } + + @Operation(summary = "批量发货") + @HasPermission({"logistics:sheet:delivery"}) + @PostMapping("/import/delivery") + public InvokeResult deliveryImportExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + LogisticsSheetDeliveryImportListener listener = new LogisticsSheetDeliveryImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, LogisticsSheetDeliveryImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseConfigController.java new file mode 100644 index 0000000..36314c4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseConfigController.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.xingyun.sc.bo.purchase.config.GetPurchaseConfigBo; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.vo.purchase.config.UpdatePurchaseConfigVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 采购参数设置 + * + * @author zmj + */ +@Tag(name = "采购参数设置") +@Validated +@RestController +@RequestMapping("/purchase/config") +public class PurchaseConfigController extends DefaultBaseController { + + @Autowired + private PurchaseConfigService purchaseConfigService; + + /** + * 查询详情 + */ + @Operation(summary = "查询详情") + @GetMapping + public InvokeResult get() { + + PurchaseConfig config = purchaseConfigService.get(); + GetPurchaseConfigBo result = new GetPurchaseConfigBo(config); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @PutMapping + public InvokeResult update(@Valid UpdatePurchaseConfigVo vo) { + + purchaseConfigService.update(vo); + + purchaseConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseOrderController.java new file mode 100644 index 0000000..0870230 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseOrderController.java @@ -0,0 +1,379 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.purchase.*; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.excel.purchase.*; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.purchase.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 采购订单管理 + * + * @author zmj + */ +@Tag(name = "采购订单管理") +@Validated +@RestController +@RequestMapping("/purchase/order") +public class PurchaseOrderController extends DefaultBaseController { + + @Autowired + private PurchaseOrderService purchaseOrderService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:order:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "订单ID不能为空!") String id) { + + PurchaseOrderFullDto data = purchaseOrderService.getDetail(id, false); + if (data == null) { + throw new DefaultClientException("订单不存在!"); + } + + PrintPurchaseOrderBo result = new PrintPurchaseOrderBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 订单列表 + */ + @Operation(summary = "订单列表") + @HasPermission({"purchase:order:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryPurchaseOrderVo vo) { + + PageResult pageResult = purchaseOrderService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryPurchaseOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"purchase:order:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryPurchaseOrderVo vo) { + + ExportTaskUtil.exportTask("采购单信息", PurchaseOrderExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameters({ + @Parameter(description = "ID", name = "id", required = true), + @Parameter(description = "isForm", name = "是否为表单数据", example = "false") + }) + @HasPermission({"purchase:order:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id, Boolean isForm) { + + PurchaseOrderFullDto data = purchaseOrderService.getDetail(id, isForm); + + GetPurchaseOrderBo result = new GetPurchaseOrderBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(收货业务) + */ + @Operation(summary = "根据ID查询(收货业务)") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @GetMapping("/receive") + public InvokeResult getWithReceive( + @NotBlank(message = "订单ID不能为空!") String id) { + + PurchaseOrderWithReceiveDto data = purchaseOrderService.getWithReceive(id); + PurchaseOrderWithReceiveBo result = new PurchaseOrderWithReceiveBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(收货业务) + */ + @Operation(summary = "查询列表(收货业务)") + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @GetMapping("/query/receive") + public InvokeResult> queryWithReceive( + @Valid QueryPurchaseOrderWithReceiveVo vo) { + + PageResult pageResult = purchaseOrderService.queryWithReceive(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryPurchaseOrderWithReceiveBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(收货业务) + */ + @Operation(summary = "加载列表(收货业务)") + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @PostMapping("/query/receive/load") + public InvokeResult> loadWithReceive( + @RequestBody(required = false) List ids) { + + List datas = purchaseOrderService.listByIds(ids); + + List results = datas.stream() + .map(QueryPurchaseOrderWithReceiveBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建订单 + */ + @Operation(summary = "创建订单") + @HasPermission({"purchase:order:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreatePurchaseOrderVo vo) { + + vo.validate(); + + String id = purchaseOrderService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改订单 + */ + @Operation(summary = "修改订单") + @HasPermission({"purchase:order:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdatePurchaseOrderVo vo) { + + vo.validate(); + + purchaseOrderService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过订单 + */ + @Operation(summary = "审核通过订单") + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassPurchaseOrderVo vo) { + + purchaseOrderService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过订单 + */ + @Operation(summary = "直接审核通过订单") + @HasPermission({"purchase:order:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreatePurchaseOrderVo vo) { + + vo.validate(); + + purchaseOrderService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝订单 + */ + @Operation(summary = "审核拒绝订单") + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefusePurchaseOrderVo vo) { + + purchaseOrderService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除订单 + */ + @Operation(summary = "删除订单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:order:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "订单ID不能为空!") String id) { + + purchaseOrderService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 取消审核订单 + */ + @Operation(summary = "取消审核订单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/cancel") + public InvokeResult cancelApprovePass(@NotBlank(message = "订单ID不能为空!") String id) { + + purchaseOrderService.cancelApprovePass(id); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"purchase:order:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("采购订单导入模板", "采购订单导入模板", PurchaseOrderImportModel.class); + } + + @Operation(summary = "下载导入约定支付模板") + @HasPermission({"purchase:order:import"}) + @GetMapping("/import/template/paytype") + public void downloadImportPayTypeTemplate() { + ExcelUtil.exportXlsx("采购订单导入约定支付模板", "采购订单导入约定支付模板", PurchaseOrderPayTypeImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"purchase:order:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + PurchaseOrderImportListener listener = new PurchaseOrderImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, PurchaseOrderImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "导入约定支付") + @HasPermission({"purchase:order:import"}) + @PostMapping("/import/paytype") + public InvokeResult importPayTypeExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + PurchaseOrderPayTypeImportListener listener = new PurchaseOrderPayTypeImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, PurchaseOrderPayTypeImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品 + */ + @Operation(summary = "根据关键字查询可采购商品") + @Parameters({ + @Parameter(description = "仓库ID", name = "scId", required = true), + @Parameter(description = "关键字", name = "condition", required = true)}) + @HasPermission({"purchase:order:add", "purchase:order:modify", "purchase:receive:add", + "purchase:receive:modify", "purchase:return:add", "purchase:return:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchPurchaseProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, String condition, Boolean isReturn) { + + if (isReturn == null) { + isReturn = false; + } + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + PageResult pageResult = purchaseOrderService.queryPurchaseByCondition( + getPageIndex(), getPageSize(), condition, isReturn); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new PurchaseProductBo(scId, t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @Operation(summary = "查询可采购商品列表") + @HasPermission({"purchase:order:add", "purchase:order:modify", "purchase:receive:add", + "purchase:receive:modify", "purchase:return:add", "purchase:return:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryPurchaseProductList( + @Valid QueryPurchaseProductVo vo) { + + PageResult pageResult = purchaseOrderService.queryPurchaseList( + getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new PurchaseProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseReturnController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseReturnController.java new file mode 100644 index 0000000..e17a2d7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseReturnController.java @@ -0,0 +1,198 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.purchase.returned.GetPurchaseReturnBo; +import com.lframework.xingyun.sc.bo.purchase.returned.PrintPurchaseReturnBo; +import com.lframework.xingyun.sc.bo.purchase.returned.QueryPurchaseReturnBo; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.excel.purchase.returned.PurchaseReturnExportTaskWorker; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import com.lframework.xingyun.sc.vo.purchase.returned.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 采购退单管理 + * + * @author zmj + */ +@Tag(name = "采购退单管理") +@Validated +@RestController +@RequestMapping("/purchase/return") +public class PurchaseReturnController extends DefaultBaseController { + + @Autowired + private PurchaseReturnService purchaseReturnService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:return:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "退单ID不能为空!") String id) { + + PurchaseReturnFullDto data = purchaseReturnService.getDetail(id); + + PrintPurchaseReturnBo result = new PrintPurchaseReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 退单列表 + */ + @Operation(summary = "退单列表") + @HasPermission({"purchase:return:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryPurchaseReturnVo vo) { + + PageResult pageResult = purchaseReturnService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryPurchaseReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"purchase:return:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryPurchaseReturnVo vo) { + + ExportTaskUtil.exportTask("采购退货单信息", PurchaseReturnExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:return:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "退单ID不能为空!") String id) { + + PurchaseReturnFullDto data = purchaseReturnService.getDetail(id); + + GetPurchaseReturnBo result = new GetPurchaseReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建 + */ + @Operation(summary = "创建") + @HasPermission({"purchase:return:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreatePurchaseReturnVo vo) { + + vo.validate(); + + String id = purchaseReturnService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"purchase:return:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdatePurchaseReturnVo vo) { + + vo.validate(); + + purchaseReturnService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"purchase:return:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassPurchaseReturnVo vo) { + + purchaseReturnService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"purchase:return:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreatePurchaseReturnVo vo) { + + vo.validate(); + + purchaseReturnService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"purchase:return:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefusePurchaseReturnVo vo) { + + purchaseReturnService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:return:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "采购退货单ID不能为空!") String id) { + + purchaseReturnService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/ReceiveSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/ReceiveSheetController.java new file mode 100644 index 0000000..d64785e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/ReceiveSheetController.java @@ -0,0 +1,324 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.purchase.receive.*; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.excel.purchase.receive.*; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.purchase.receive.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 采购收货单管理 + * + * @author zmj + */ +@Tag(name = "采购收货单管理") +@Validated +@RestController +@RequestMapping("/purchase/receive/sheet") +public class ReceiveSheetController extends DefaultBaseController { + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:receive:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "订单ID不能为空!") String id) { + + ReceiveSheetFullDto data = receiveSheetService.getDetail(id); + + PrintReceiveSheetBo result = new PrintReceiveSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 订单列表 + */ + @Operation(summary = "订单列表") + @HasPermission({"purchase:receive:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryReceiveSheetVo vo) { + + PageResult pageResult = receiveSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryReceiveSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"purchase:receive:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryReceiveSheetVo vo) { + + ExportTaskUtil.exportTask("采购收货单信息", ReceiveSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:receive:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id) { + + ReceiveSheetFullDto data = receiveSheetService.getDetail(id); + + GetReceiveSheetBo result = new GetReceiveSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据供应商ID查询默认付款日期 + */ + @Operation(summary = "根据供应商ID查询默认付款日期") + @Parameter(description = "供应商ID", name = "supplierId", required = true) + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @GetMapping("/paymentdate") + public InvokeResult getPaymentDate( + @NotBlank(message = "供应商ID不能为空!") String supplierId) { + + GetPaymentDateDto data = receiveSheetService.getPaymentDate(supplierId); + + GetPaymentDateBo result = new GetPaymentDateBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(采购退货业务) + */ + @Operation(summary = "根据ID查询(采购退货业务)") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:return:add", "purchase:return:modify"}) + @GetMapping("/return") + public InvokeResult getWithReturn( + @NotBlank(message = "收货单ID不能为空!") String id) { + + ReceiveSheetWithReturnDto data = receiveSheetService.getWithReturn(id); + ReceiveSheetWithReturnBo result = new ReceiveSheetWithReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(采购退货业务) + */ + @Operation(summary = "查询列表(采购退货业务)") + @HasPermission({"purchase:return:add", "purchase:return:modify"}) + @GetMapping("/query/return") + public InvokeResult> queryWithReturn( + @Valid QueryReceiveSheetWithReturnVo vo) { + + PageResult pageResult = receiveSheetService.queryWithReturn(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryReceiveSheetWithReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(采购退货业务) + */ + @Operation(summary = "加载列表(采购退货业务)") + @HasPermission({"purchase:return:add", "purchase:return:modify"}) + @PostMapping("/query/return/load") + public InvokeResult> loadWithReturn( + @RequestBody(required = false) List ids) { + + List datas = receiveSheetService.listByIds(ids); + + List results = datas.stream() + .map(QueryReceiveSheetWithReturnBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建 + */ + @Operation(summary = "创建") + @HasPermission({"purchase:receive:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateReceiveSheetVo vo) { + + vo.validate(); + + String id = receiveSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"purchase:receive:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateReceiveSheetVo vo) { + + vo.validate(); + + receiveSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"purchase:receive:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassReceiveSheetVo vo) { + + receiveSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"purchase:receive:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateReceiveSheetVo vo) { + + vo.validate(); + + receiveSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"purchase:receive:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseReceiveSheetVo vo) { + + receiveSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"purchase:receive:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "采购收货单ID不能为空!") String id) { + + receiveSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"purchase:receive:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("采购收货单导入模板", "采购收货单导入模板", ReceiveSheetImportModel.class); + } + + @Operation(summary = "下载导入支付方式模板") + @HasPermission({"purchase:receive:import"}) + @GetMapping("/import/template/paytype") + public void downloadImportPayTypeTemplate() { + ExcelUtil.exportXlsx("采购收货单导入支付方式模板", "采购收货单导入支付方式模板", ReceiveSheetPayTypeImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"purchase:receive:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + PurchaseConfig config = purchaseConfigService.get(); + if (config.getReceiveRequirePurchase()) { + throw new DefaultClientException("“采购收货单是否关联采购订单”必须设置为“否”才可以导入!"); + } + + ReceiveSheetImportListener listener = new ReceiveSheetImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ReceiveSheetImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "导入支付方式") + @HasPermission({"purchase:receive:import"}) + @PostMapping("/import/paytype") + public InvokeResult importPayTypeExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ReceiveSheetPayTypeImportListener listener = new ReceiveSheetPayTypeImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ReceiveSheetPayTypeImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailConfigController.java new file mode 100644 index 0000000..9d20d92 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailConfigController.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.controller.retail; + +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.xingyun.sc.bo.retail.config.GetRetailConfigBo; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.vo.retail.config.UpdateRetailConfigVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 零售参数设置 + * + * @author zmj + */ +@Tag(name = "零售参数设置") +@Validated +@RestController +@RequestMapping("/retail/config") +public class RetailConfigController extends DefaultBaseController { + + @Autowired + private RetailConfigService retailConfigService; + + /** + * 查询详情 + */ + @Operation(summary = "查询详情") + @GetMapping + public InvokeResult get() { + + RetailConfig config = retailConfigService.get(); + GetRetailConfigBo result = new GetRetailConfigBo(config); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @PutMapping + public InvokeResult update(@Valid UpdateRetailConfigVo vo) { + + retailConfigService.update(vo); + + retailConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailOutSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailOutSheetController.java new file mode 100644 index 0000000..14d3108 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailOutSheetController.java @@ -0,0 +1,337 @@ +package com.lframework.xingyun.sc.controller.retail; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.purchase.receive.GetPaymentDateBo; +import com.lframework.xingyun.sc.bo.retail.RetailProductBo; +import com.lframework.xingyun.sc.bo.retail.out.*; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.excel.retail.out.RetailOutSheetExportTaskWorker; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.retail.out.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 零售出库单管理 + * + * @author zmj + */ +@Tag(name = "零售出库单管理") +@Validated +@RestController +@RequestMapping("/retail/out/sheet") +public class RetailOutSheetController extends DefaultBaseController { + + @Autowired + private RetailOutSheetService retailOutSheetService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"retail:out:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "订单ID不能为空!") String id) { + + RetailOutSheetFullDto data = retailOutSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("零售出库单不存在!"); + } + + PrintRetailOutSheetBo result = new PrintRetailOutSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 订单列表 + */ + @Operation(summary = "订单列表") + @HasPermission({"retail:out:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryRetailOutSheetVo vo) { + + PageResult pageResult = retailOutSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryRetailOutSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"retail:out:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryRetailOutSheetVo vo) { + + ExportTaskUtil.exportTask("零售出库单信息", RetailOutSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"retail:out:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id) { + + RetailOutSheetFullDto data = retailOutSheetService.getDetail(id); + + GetRetailOutSheetBo result = new GetRetailOutSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据会员ID查询默认付款日期 + */ + @Operation(summary = "根据会员ID查询默认付款日期") + @Parameter(description = "会员ID", name = "memberId") + @HasPermission({"retail:out:add", "retail:out:modify"}) + @GetMapping("/paymentdate") + public InvokeResult getPaymentDate(String memberId) { + + GetPaymentDateDto data = retailOutSheetService.getPaymentDate(memberId); + + GetPaymentDateBo result = new GetPaymentDateBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(零售退货业务) + */ + @Operation(summary = "根据ID查询(零售退货业务)") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"retail:return:add", "retail:return:modify"}) + @GetMapping("/return") + public InvokeResult getWithReturn( + @NotBlank(message = "出库单ID不能为空!") String id) { + + RetailOutSheetWithReturnDto data = retailOutSheetService.getWithReturn(id); + RetailOutSheetWithReturnBo result = new RetailOutSheetWithReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(零售退货业务) + */ + @Operation(summary = "查询列表(零售退货业务)") + @HasPermission({"retail:return:add", "retail:return:modify"}) + @GetMapping("/query/return") + public InvokeResult> queryWithReturn( + @Valid QueryRetailOutSheetWithReturnVo vo) { + + PageResult pageResult = retailOutSheetService.queryWithReturn(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryRetailOutSheetWithReturnBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(零售退货业务) + */ + @Operation(summary = "加载列表(零售退货业务)") + @HasPermission({"retail:return:add", "retail:return:modify"}) + @PostMapping("/query/return/load") + public InvokeResult> loadWithReturn( + @RequestBody(required = false) List ids) { + + List datas = retailOutSheetService.listByIds(ids); + + List results = datas.stream() + .map(QueryRetailOutSheetWithReturnBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建 + */ + @Operation(summary = "创建") + @HasPermission({"retail:out:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateRetailOutSheetVo vo) { + + vo.validate(); + + String id = retailOutSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"retail:out:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateRetailOutSheetVo vo) { + + vo.validate(); + + retailOutSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"retail:out:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassRetailOutSheetVo vo) { + + retailOutSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"retail:out:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateRetailOutSheetVo vo) { + + vo.validate(); + + retailOutSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"retail:out:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseRetailOutSheetVo vo) { + + retailOutSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"retail:out:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "零售出库单ID不能为空!") String id) { + + retailOutSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品 + */ + @Operation(summary = "根据关键字查询可零售商品") + @Parameters({ + @Parameter(description = "仓库ID", name = "scId", required = true), + @Parameter(description = "关键字", name = "condition", required = true)}) + @HasPermission({"retail:out:add", "retail:out:modify", "retail:return:add", + "retail:return:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchRetailProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, String condition, Boolean isReturn) { + + if (isReturn == null) { + isReturn = false; + } + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + PageResult pageResult = retailOutSheetService.queryRetailByCondition( + getPageIndex(), + getPageSize(), condition, isReturn); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new RetailProductBo(scId, t)).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @Operation(summary = "查询可零售商品列表") + @HasPermission({"retail:out:add", "retail:out:modify", "retail:return:add", + "retail:return:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryRetailProductList( + @Valid QueryRetailProductVo vo) { + + PageResult pageResult = retailOutSheetService.queryRetailList( + getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new RetailProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailReturnController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailReturnController.java new file mode 100644 index 0000000..51c8a90 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailReturnController.java @@ -0,0 +1,201 @@ +package com.lframework.xingyun.sc.controller.retail; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.retail.returned.GetRetailReturnBo; +import com.lframework.xingyun.sc.bo.retail.returned.PrintRetailReturnBo; +import com.lframework.xingyun.sc.bo.retail.returned.QueryRetailReturnBo; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.excel.retail.returned.RetailReturnExportTaskWorker; +import com.lframework.xingyun.sc.service.retail.RetailReturnService; +import com.lframework.xingyun.sc.vo.retail.returned.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 零售退单管理 + * + * @author zmj + */ +@Tag(name = "零售退单管理") +@Validated +@RestController +@RequestMapping("/retail/return") +public class RetailReturnController extends DefaultBaseController { + + @Autowired + private RetailReturnService retailReturnService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"retail:return:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "退单ID不能为空!") String id) { + + RetailReturnFullDto data = retailReturnService.getDetail(id); + if (data == null) { + throw new DefaultClientException("零售退货单不存在!"); + } + + PrintRetailReturnBo result = new PrintRetailReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 退单列表 + */ + @Operation(summary = "退单列表") + @HasPermission({"retail:return:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryRetailReturnVo vo) { + + PageResult pageResult = retailReturnService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryRetailReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"retail:return:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryRetailReturnVo vo) { + ExportTaskUtil.exportTask("零售退货单信息", RetailReturnExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"retail:return:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "退单ID不能为空!") String id) { + + RetailReturnFullDto data = retailReturnService.getDetail(id); + + GetRetailReturnBo result = new GetRetailReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建 + */ + @Operation(summary = "创建") + @HasPermission({"retail:return:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateRetailReturnVo vo) { + + vo.validate(); + + String id = retailReturnService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"retail:return:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateRetailReturnVo vo) { + + vo.validate(); + + retailReturnService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"retail:return:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassRetailReturnVo vo) { + + retailReturnService.approvePass(vo); + + RetailReturn r = retailReturnService.getById(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"retail:return:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateRetailReturnVo vo) { + + vo.validate(); + + retailReturnService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"retail:return:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseRetailReturnVo vo) { + + retailReturnService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"retail:return:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "零售退货单ID不能为空!") String id) { + + retailReturnService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleConfigController.java new file mode 100644 index 0000000..53031be --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleConfigController.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.xingyun.sc.bo.sale.config.GetSaleConfigBo; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.vo.sale.config.UpdateSaleConfigVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 销售参数设置 + * + * @author zmj + */ +@Tag(name = "销售参数设置") +@Validated +@RestController +@RequestMapping("/sale/config") +public class SaleConfigController extends DefaultBaseController { + + @Autowired + private SaleConfigService saleConfigService; + + /** + * 查询详情 + */ + @Operation(summary = "查询详情") + @GetMapping + public InvokeResult get() { + + SaleConfig config = saleConfigService.get(); + GetSaleConfigBo result = new GetSaleConfigBo(config); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @PutMapping + public InvokeResult update(@Valid UpdateSaleConfigVo vo) { + + saleConfigService.update(vo); + + saleConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java new file mode 100644 index 0000000..aa1be9a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java @@ -0,0 +1,311 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.sale.*; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.excel.sale.SaleOrderExportTaskWorker; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.vo.sale.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 销售订单管理 + * + * @author zmj + */ +@Tag(name = "销售订单管理") +@Validated +@RestController +@RequestMapping("/sale/order") +public class SaleOrderController extends DefaultBaseController { + + @Autowired + private SaleOrderService saleOrderService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:order:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOrderFullDto data = saleOrderService.getDetail(id); + if (data == null) { + throw new DefaultClientException("订单不存在!"); + } + + PrintSaleOrderBo result = new PrintSaleOrderBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 订单列表 + */ + @Operation(summary = "订单列表") + @HasPermission({"sale:order:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySaleOrderVo vo) { + + PageResult pageResult = saleOrderService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"sale:order:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySaleOrderVo vo) { + + ExportTaskUtil.exportTask("销售单信息", SaleOrderExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:order:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "订单ID不能为空!") String id) { + + SaleOrderFullDto data = saleOrderService.getDetail(id); + + GetSaleOrderBo result = new GetSaleOrderBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(出库业务) + */ + @Operation(summary = "根据ID查询(出库业务)") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:out:add", "sale:out:modify"}) + @GetMapping("/out") + public InvokeResult getWithOut( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOrderWithOutDto data = saleOrderService.getWithOut(id); + SaleOrderWithOutBo result = new SaleOrderWithOutBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(出库业务) + */ + @Operation(summary = "查询列表(出库业务)") + @HasPermission({"sale:out:add", "sale:out:modify"}) + @GetMapping("/query/out") + public InvokeResult> queryWithOut( + @Valid QuerySaleOrderWithOutVo vo) { + + PageResult pageResult = saleOrderService.queryWithOut(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOrderWithOutBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(出库业务) + */ + @Operation(summary = "加载列表(出库业务)") + @HasPermission({"sale:out:add", "sale:out:modify"}) + @PostMapping("/query/out/load") + public InvokeResult> getWithOut( + @RequestBody(required = false) List ids) { + + List datas = saleOrderService.listByIds(ids); + + List results = datas.stream() + .map(QuerySaleOrderWithOutBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建订单 + */ + @Operation(summary = "创建订单") + @HasPermission({"sale:order:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSaleOrderVo vo) { + + vo.validate(); + + String id = saleOrderService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改订单 + */ + @Operation(summary = "修改订单") + @HasPermission({"sale:order:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSaleOrderVo vo) { + + vo.validate(); + + saleOrderService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过订单 + */ + @Operation(summary = "审核通过订单") + @HasPermission({"sale:order:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSaleOrderVo vo) { + + saleOrderService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过订单 + */ + @Operation(summary = "直接审核通过订单") + @HasPermission({"sale:order:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSaleOrderVo vo) { + + vo.validate(); + + saleOrderService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝订单 + */ + @Operation(summary = "审核拒绝订单") + @HasPermission({"sale:order:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSaleOrderVo vo) { + + saleOrderService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除订单 + */ + @Operation(summary = "删除订单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:order:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "订单ID不能为空!") String id) { + + saleOrderService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品 + */ + @Operation(summary = "根据关键字查询可销售商品") + @Parameters({ + @Parameter(description = "仓库ID", name = "scId", required = true), + @Parameter(description = "关键字", name = "condition", required = true)}) + @HasPermission({"sale:order:add", "sale:order:modify", "sale:out:add", "sale:out:modify", + "sale:return:add", "sale:return:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchSaleProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, String condition, Boolean isReturn) { + + if (isReturn == null) { + isReturn = false; + } + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + PageResult pageResult = saleOrderService.querySaleByCondition(getPageIndex(), + getPageSize(), condition, isReturn); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new SaleProductBo(scId, t)).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @Operation(summary = "查询可销售商品列表") + @HasPermission({"sale:order:add", "sale:order:modify", "sale:out:add", "sale:out:modify", + "sale:return:add", "sale:return:modify"}) + @GetMapping("/product/list") + public InvokeResult> querySaleProductList( + @Valid QuerySaleProductVo vo) { + + PageResult pageResult = saleOrderService.querySaleList(getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new SaleProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOutSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOutSheetController.java new file mode 100644 index 0000000..5c412aa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOutSheetController.java @@ -0,0 +1,276 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.purchase.receive.GetPaymentDateBo; +import com.lframework.xingyun.sc.bo.sale.out.*; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.excel.sale.out.SaleOutSheetExportTaskWorker; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.vo.sale.out.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 销售出库单管理 + * + * @author zmj + */ +@Tag(name = "销售出库单管理") +@Validated +@RestController +@RequestMapping("/sale/out/sheet") +public class SaleOutSheetController extends DefaultBaseController { + + @Autowired + private SaleOutSheetService saleOutSheetService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:out:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOutSheetFullDto data = saleOutSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("销售出库单不存在!"); + } + + PrintSaleOutSheetBo result = new PrintSaleOutSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 订单列表 + */ + @Operation(summary = "订单列表") + @HasPermission({"sale:out:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySaleOutSheetVo vo) { + + PageResult pageResult = saleOutSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOutSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"sale:out:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySaleOutSheetVo vo) { + + ExportTaskUtil.exportTask("销售出库单信息", SaleOutSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:out:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOutSheetFullDto data = saleOutSheetService.getDetail(id); + + GetSaleOutSheetBo result = new GetSaleOutSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据客户ID查询默认付款日期 + */ + @Operation(summary = "根据客户ID查询默认付款日期") + @Parameter(description = "客户ID", name = "customerId", required = true) + @HasPermission({"sale:out:add", "sale:out:modify"}) + @GetMapping("/paymentdate") + public InvokeResult getPaymentDate( + @NotBlank(message = "客户ID不能为空!") String customerId) { + + GetPaymentDateDto data = saleOutSheetService.getPaymentDate(customerId); + + GetPaymentDateBo result = new GetPaymentDateBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(销售退货业务) + */ + @Operation(summary = "根据ID查询(销售退货业务)") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:return:add", "sale:return:modify"}) + @GetMapping("/return") + public InvokeResult getWithReturn( + @NotBlank(message = "出库单ID不能为空!") String id) { + + SaleOutSheetWithReturnDto data = saleOutSheetService.getWithReturn(id); + SaleOutSheetWithReturnBo result = new SaleOutSheetWithReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(销售退货业务) + */ + @Operation(summary = "查询列表(销售退货业务)") + @HasPermission({"sale:return:add", "sale:return:modify"}) + @GetMapping("/query/return") + public InvokeResult> queryWithReturn( + @Valid QuerySaleOutSheetWithReturnVo vo) { + + PageResult pageResult = saleOutSheetService.queryWithReturn(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOutSheetWithReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(销售退货业务) + */ + @Operation(summary = "加载列表(销售退货业务)") + @HasPermission({"sale:return:add", "sale:return:modify"}) + @PostMapping("/query/return/load") + public InvokeResult> loadWithReturn( + @RequestBody(required = false) List ids) { + + List datas = saleOutSheetService.listByIds(ids); + + List results = datas.stream() + .map(QuerySaleOutSheetWithReturnBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建 + */ + @Operation(summary = "创建") + @HasPermission({"sale:out:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSaleOutSheetVo vo) { + + vo.validate(); + + String id = saleOutSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"sale:out:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSaleOutSheetVo vo) { + + vo.validate(); + + saleOutSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"sale:out:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSaleOutSheetVo vo) { + + saleOutSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"sale:out:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSaleOutSheetVo vo) { + + vo.validate(); + + saleOutSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"sale:out:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSaleOutSheetVo vo) { + + saleOutSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:out:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "销售出库单ID不能为空!") String id) { + + saleOutSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleReturnController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleReturnController.java new file mode 100644 index 0000000..f262d5c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleReturnController.java @@ -0,0 +1,201 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.sale.returned.GetSaleReturnBo; +import com.lframework.xingyun.sc.bo.sale.returned.PrintSaleReturnBo; +import com.lframework.xingyun.sc.bo.sale.returned.QuerySaleReturnBo; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.excel.sale.returned.SaleReturnExportTaskWorker; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import com.lframework.xingyun.sc.vo.sale.returned.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 销售退单管理 + * + * @author zmj + */ +@Tag(name = "销售退单管理") +@Validated +@RestController +@RequestMapping("/sale/return") +public class SaleReturnController extends DefaultBaseController { + + @Autowired + private SaleReturnService saleReturnService; + + /** + * 打印 + */ + @Operation(summary = "打印") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:return:query"}) + @GetMapping("/print") + public InvokeResult print( + @NotBlank(message = "退单ID不能为空!") String id) { + + SaleReturnFullDto data = saleReturnService.getDetail(id); + + if (data == null) { + throw new DefaultClientException("销售退单不存在!"); + } + + PrintSaleReturnBo result = new PrintSaleReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 退单列表 + */ + @Operation(summary = "退单列表") + @HasPermission({"sale:return:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySaleReturnVo vo) { + + PageResult pageResult = saleReturnService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"sale:return:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySaleReturnVo vo) { + + ExportTaskUtil.exportTask("销售退货单信息", SaleReturnExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:return:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "退单ID不能为空!") String id) { + + SaleReturnFullDto data = saleReturnService.getDetail(id); + + GetSaleReturnBo result = new GetSaleReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建 + */ + @Operation(summary = "创建") + @HasPermission({"sale:return:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSaleReturnVo vo) { + + vo.validate(); + + String id = saleReturnService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"sale:return:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSaleReturnVo vo) { + + vo.validate(); + + saleReturnService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"sale:return:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSaleReturnVo vo) { + + saleReturnService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"sale:return:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSaleReturnVo vo) { + + vo.validate(); + + saleReturnService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"sale:return:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSaleReturnVo vo) { + + saleReturnService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"sale:return:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "销售退货单ID不能为空!") String id) { + + saleReturnService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockController.java new file mode 100644 index 0000000..ce5d0cb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockController.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.controller.stock; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.product.QueryProductStockBo; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.excel.stock.ProductStockExportTaskWorker; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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; +import java.util.stream.Collectors; + +/** + * 商品库存 + * + * @author zmj + */ +@Tag(name = "商品库存") +@Validated +@RestController +@RequestMapping("/stock/product") +public class ProductStockController extends DefaultBaseController { + + @Autowired + private ProductStockService productStockService; + + /** + * 查询商品库存 + */ + @Operation(summary = "查询商品库存") + @HasPermission({"stock:product:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductStockVo vo) { + + PageResult pageResult = productStockService.query(getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryProductStockBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出商品库存 + */ + @Operation(summary = "导出商品库存") + @HasPermission({"stock:product:export"}) + @GetMapping("/export") + public InvokeResult export(@Valid QueryProductStockVo vo) { + + ExportTaskUtil.exportTask("商品库存信息", ProductStockExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockLogController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockLogController.java new file mode 100644 index 0000000..54f261d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockLogController.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.controller.stock; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.product.log.QueryProductStockLogBo; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.excel.stock.ProductStockLogExportTaskWorker; +import com.lframework.xingyun.sc.service.stock.ProductStockLogService; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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; +import java.util.stream.Collectors; + +/** + * 商品库存变动记录 + * + * @author zmj + */ +@Tag(name = "商品库存变动记录") +@Validated +@RestController +@RequestMapping("/stock/product/log") +public class ProductStockLogController extends DefaultBaseController { + + @Autowired + private ProductStockLogService productStockLogService; + + /** + * 查询商品库存变动记录 + */ + @Operation(summary = "查询商品库存变动记录") + @HasPermission({"stock:product-log:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductStockLogVo vo) { + + PageResult pageResult = productStockLogService.query(getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryProductStockLogBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出商品库存变动记录 + */ + @Operation(summary = "导出商品库存变动记录") + @HasPermission({"stock:product-log:export"}) + @GetMapping("/export") + public InvokeResult export(@Valid QueryProductStockLogVo vo) { + + ExportTaskUtil.exportTask("商品库存变动记录信息", ProductStockLogExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustReasonController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustReasonController.java new file mode 100644 index 0000000..0cd397d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustReasonController.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.sc.controller.stock.adjust; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.reason.GetStockAdjustReasonBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.reason.QueryStockAdjustReasonBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.CreateStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.UpdateStockAdjustReasonVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 库存调整原因 + * + * @author zmj + */ +@Tag(name = "库存调整原因") +@Validated +@RestController +@RequestMapping("/stock/adjust/reason") +public class StockAdjustReasonController extends DefaultBaseController { + + @Autowired + private StockAdjustReasonService stockAdjustReasonService; + + /** + * 库存调整原因列表 + */ + @Operation(summary = "库存调整原因列表") + @HasPermission({"stock:adjust:reason:query", "stock:adjust:reason:add", + "stock:adjust:reason:modify"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryStockAdjustReasonVo vo) { + + PageResult pageResult = stockAdjustReasonService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryStockAdjustReasonBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询库存调整原因 + */ + @Operation(summary = "查询库存调整原因") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:adjust:reason:query", "stock:adjust:reason:add", + "stock:adjust:reason:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + StockAdjustReason data = stockAdjustReasonService.findById(id); + if (data == null) { + throw new DefaultClientException("库存调整原因不存在!"); + } + + GetStockAdjustReasonBo result = new GetStockAdjustReasonBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"stock:adjust:reason:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "库存调整原因ID不能为空!") String id) { + + stockAdjustReasonService.deleteById(id); + + stockAdjustReasonService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增库存调整原因 + */ + @Operation(summary = "新增库存调整原因") + @HasPermission({"stock:adjust:reason:add"}) + @PostMapping + public InvokeResult create(@Valid CreateStockAdjustReasonVo vo) { + + stockAdjustReasonService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改库存调整原因 + */ + @Operation(summary = "修改库存调整原因") + @HasPermission({"stock:adjust:reason:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateStockAdjustReasonVo vo) { + + stockAdjustReasonService.update(vo); + + stockAdjustReasonService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustSheetController.java new file mode 100644 index 0000000..94b3828 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustSheetController.java @@ -0,0 +1,241 @@ +package com.lframework.xingyun.sc.controller.stock.adjust; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.QueryStockAdjustSheetBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.StockAdjustProductBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.StockAdjustSheetFullBo; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.excel.stock.adjust.StockAdjustSheetExportTaskWorker; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetService; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 库存调整单 Controller + * + * @author zmj + */ +@Tag(name = "库存调整单") +@Validated +@RestController +@RequestMapping("/stock/adjust") +public class StockAdjustSheetController extends DefaultBaseController { + + @Autowired + private StockAdjustSheetService stockAdjustSheetService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"stock:adjust:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryStockAdjustSheetVo vo) { + + PageResult pageResult = stockAdjustSheetService.query( + getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryStockAdjustSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:adjust:query"}) + @GetMapping("/detail") + public InvokeResult getDetail( + @NotBlank(message = "id不能为空!") String id) { + + StockAdjustSheetFullDto data = stockAdjustSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("库存调整单不存在!"); + } + + StockAdjustSheetFullBo result = new StockAdjustSheetFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"stock:adjust:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryStockAdjustSheetVo vo) { + + ExportTaskUtil.exportTask("库存调整单信息", StockAdjustSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品列表 + */ + @Operation(summary = "根据关键字查询商品列表") + @Parameters({ + @Parameter(description = "仓库ID", name = "scId", required = true), + @Parameter(description = "关键字", name = "condition", required = true)}) + @HasPermission({"stock:adjust:add", "stock:adjust:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, + String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + PageResult pageResult = stockAdjustSheetService.queryStockAdjustByCondition( + getPageIndex(), getPageSize(), scId, condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new StockAdjustProductBo(scId, t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @Operation(summary = "查询商品列表") + @HasPermission({"stock:adjust:add", "stock:adjust:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryStockAdjustProductVo vo) { + + PageResult pageResult = stockAdjustSheetService.queryStockAdjustList( + getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new StockAdjustProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"stock:adjust:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateStockAdjustSheetVo vo) { + + vo.validate(); + + stockAdjustSheetService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"stock:adjust:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateStockAdjustSheetVo vo) { + + vo.validate(); + + stockAdjustSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:adjust:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "id不能为空!") String id) { + + stockAdjustSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"stock:adjust:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassStockAdjustSheetVo vo) { + + stockAdjustSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"stock:adjust:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateStockAdjustSheetVo vo) { + + vo.validate(); + + stockAdjustSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"stock:adjust:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseStockAdjustSheetVo vo) { + + stockAdjustSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/PreTakeStockSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/PreTakeStockSheetController.java new file mode 100644 index 0000000..64e15aa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/PreTakeStockSheetController.java @@ -0,0 +1,232 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.take.pre.GetPreTakeStockSheetBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.PreTakeStockProductBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.QueryPreTakeStockSheetBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.QueryPreTakeStockSheetProductBo; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.excel.stock.take.pre.PreTakeStockSheetExportTaskWorker; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.vo.stock.take.pre.CreatePreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockProductVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.UpdatePreTakeStockSheetVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 预先盘点单 Controller + * + * @author zmj + */ +@Tag(name = "预先盘点单") +@Validated +@RestController +@RequestMapping("/stock/take/pre") +public class PreTakeStockSheetController extends DefaultBaseController { + + @Autowired + private PreTakeStockSheetService preTakeStockSheetService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"stock:take:pre:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryPreTakeStockSheetVo vo) { + + PageResult pageResult = preTakeStockSheetService.query(getPageIndex(vo), + getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryPreTakeStockSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出列表 + */ + @Operation(summary = "导出列表") + @HasPermission({"stock:take:pre:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryPreTakeStockSheetVo vo) { + + ExportTaskUtil.exportTask("预先盘点单信息", PreTakeStockSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:pre:query"}) + @GetMapping + public InvokeResult getDetail( + @NotBlank(message = "id不能为空!") String id) { + + PreTakeStockSheetFullDto data = preTakeStockSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("预先盘点单不存在!"); + } + + GetPreTakeStockSheetBo result = new GetPreTakeStockSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据预先盘点单、盘点任务查询商品信息 + */ + @Operation(summary = "根据预先盘点单、盘点任务查询商品信息") + @Parameters({ + @Parameter(description = "ID", name = "id", required = true), + @Parameter(description = "盘点任务ID", name = "planId", required = true)}) + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/products") + public InvokeResult> getProducts( + @NotBlank(message = "ID不能为空!") String id, + @NotBlank(message = "盘点任务ID不能为空!") String planId) { + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(planId); + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + planId = null; + } + + List datas = preTakeStockSheetService.getProducts(id, planId); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream() + .map(t -> new QueryPreTakeStockSheetProductBo(t, takeStockPlan.getScId())) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"stock:take:pre:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreatePreTakeStockSheetVo vo) { + + vo.validate(); + + preTakeStockSheetService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"stock:take:pre:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdatePreTakeStockSheetVo vo) { + + vo.validate(); + + preTakeStockSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:pre:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "ID不能为空!") String id) { + + preTakeStockSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品列表 + */ + @Operation(summary = "根据关键字查询预先盘点单商品列表") + @Parameter(description = "关键字", name = "condition", required = true) + @HasPermission({"stock:take:pre:add", "stock:take:pre:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts(String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + PageResult pageResult = preTakeStockSheetService.queryPreTakeStockByCondition( + getPageIndex(), getPageSize(), condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PreTakeStockProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @Operation(summary = "查询预先盘点单商品列表") + @HasPermission({"stock:take:pre:add", "stock:take:pre:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryPreTakeStockProductVo vo) { + + PageResult pageResult = preTakeStockSheetService.queryPreTakeStockList( + getPageIndex(vo), getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PreTakeStockProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockConfigController.java new file mode 100644 index 0000000..7c4df7e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockConfigController.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.xingyun.sc.bo.stock.take.config.GetTakeStockConfigBo; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.vo.stock.take.config.UpdateTakeStockConfigVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 盘点参数 Controller + * + * @author zmj + */ +@Tag(name = "盘点参数") +@Validated +@RestController +@RequestMapping("/stock/take/config") +public class TakeStockConfigController extends DefaultBaseController { + + @Autowired + private TakeStockConfigService takeStockConfigService; + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @HasPermission({"stock:take:config:modify", "stock:take:plan:handle:diff"}) + @GetMapping + public InvokeResult get() { + + TakeStockConfig data = takeStockConfigService.get(); + if (data == null) { + throw new DefaultClientException("盘点参数不存在!"); + } + + GetTakeStockConfigBo result = new GetTakeStockConfigBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"stock:take:config:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateTakeStockConfigVo vo) { + + takeStockConfigService.update(vo); + + takeStockConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockPlanController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockPlanController.java new file mode 100644 index 0000000..56d7497 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockPlanController.java @@ -0,0 +1,257 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.qrtz.QrtzHandler; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.tenant.TenantContextHolder; +import com.lframework.starter.web.core.components.threads.DefaultRunnable; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.CronUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.take.plan.GetTakeStockPlanBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.QueryTakeStockPlanBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.QueryTakeStockPlanProductBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.TakeStockPlanFullBo; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.excel.stock.take.plan.TakeStockPlanExportTaskWorker; +import com.lframework.xingyun.sc.impl.stock.take.TakeStockPlanServiceImpl; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.vo.stock.take.plan.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 盘点任务 Controller + * + * @author zmj + */ +@Tag(name = "盘点任务") +@Validated +@RestController +@RequestMapping("/stock/take/plan") +public class TakeStockPlanController extends DefaultBaseController { + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Autowired + private TakeStockConfigService takeStockConfigService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"stock:take:plan:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryTakeStockPlanVo vo) { + + PageResult pageResult = takeStockPlanService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryTakeStockPlanBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出列表 + */ + @Operation(summary = "导出列表") + @HasPermission({"stock:take:plan:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryTakeStockPlanVo vo) { + + ExportTaskUtil.exportTask("盘点任务信息", TakeStockPlanExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:plan:query", "stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + TakeStockPlan data = takeStockPlanService.getById(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + GetTakeStockPlanBo result = new GetTakeStockPlanBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询详情") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:plan:query", "stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/detail") + public InvokeResult getDetail(@NotBlank(message = "id不能为空!") String id) { + + TakeStockPlanFullDto data = takeStockPlanService.getDetail(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + TakeStockPlanFullBo result = new TakeStockPlanFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据盘点任务ID查询商品信息 + */ + @Operation(summary = "根据盘点任务ID查询商品信息") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/products") + public InvokeResult> getProducts( + @NotBlank(message = "id不能为空!") String id) { + + TakeStockConfig config = takeStockConfigService.get(); + if (!config.getShowProduct()) { + // 如果不显示商品的话,则显示emptyList + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = takeStockPlanService.getProducts(id); + if (CollectionUtil.isEmpty(datas)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List results = datas.stream().map(QueryTakeStockPlanProductBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"stock:take:plan:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateTakeStockPlanVo vo) { + + vo.validate(); + + String id = takeStockPlanService.create(vo); + + TakeStockConfig config = takeStockConfigService.get(); + + Map params = new HashMap<>(); + params.put("id", id); + params.put(StringPool.TENANT_ID_QRTZ, TenantContextHolder.getTenantId()); + + ThreadUtil.execAsync(new DefaultRunnable(() -> { + // 自动作废 + QrtzHandler.addJob(TakeStockPlanServiceImpl.AutoCancelJob.class, + CronUtil.getDateTimeCron(LocalDateTime.now().plusHours(config.getCancelHours())), params); + })); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"stock:take:plan:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateTakeStockPlanVo vo) { + + takeStockPlanService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 差异生成 + */ + @Operation(summary = "差异生成") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:plan:create-diff"}) + @PatchMapping("/diff") + public InvokeResult createDiff(@NotBlank(message = "ID不能为空!") String id) { + + takeStockPlanService.createDiff(id); + + return InvokeResultBuilder.success(); + } + + /** + * 差异处理 + */ + @Operation(summary = "差异处理") + @HasPermission({"stock:take:plan:handle-diff"}) + @PatchMapping("/handle") + public InvokeResult handleDiff(@Valid @RequestBody HandleTakeStockPlanVo vo) { + + vo.validate(); + + takeStockPlanService.handleDiff(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 作废 + */ + @Operation(summary = "作废") + @HasPermission({"stock:take:plan:cancel"}) + @PatchMapping("/cancel") + public InvokeResult cancel(@Valid CancelTakeStockPlanVo vo) { + + takeStockPlanService.cancel(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:plan:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "ID不能为空!") String id) { + + takeStockPlanService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockSheetController.java new file mode 100644 index 0000000..cf91d92 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockSheetController.java @@ -0,0 +1,271 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.take.sheet.QueryTakeStockSheetBo; +import com.lframework.xingyun.sc.bo.stock.take.sheet.TakeStockSheetFullBo; +import com.lframework.xingyun.sc.bo.stock.take.sheet.TakeStockSheetProductBo; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.excel.stock.take.sheet.TakeStockSheetExportTaskWorker; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.sheet.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 盘点单 Controller + * + * @author zmj + */ +@Tag(name = "盘点单") +@Validated +@RestController +@RequestMapping("/stock/take/sheet") +public class TakeStockSheetController extends DefaultBaseController { + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"stock:take:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryTakeStockSheetVo vo) { + + PageResult pageResult = takeStockSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryTakeStockSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出列表 + */ + @Operation(summary = "导出列表") + @HasPermission({"stock:take:sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryTakeStockSheetVo vo) { + + ExportTaskUtil.exportTask("库存盘点单信息", TakeStockSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:sheet:query"}) + @GetMapping("/detail") + public InvokeResult getDetail(@NotBlank(message = "id不能为空!") String id) { + + TakeStockSheetFullDto data = takeStockSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockSheetFullBo result = new TakeStockSheetFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据关键字查询商品列表 + */ + @Operation(summary = "根据关键字查询商品列表") + @Parameters({ + @Parameter(description = "盘点任务ID", name = "planId", required = true), + @Parameter(description = "关键字", name = "condition", required = true)}) + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts( + @NotBlank(message = "盘点任务ID不能为空!") String planId, + String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(planId); + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + planId = null; + } + PageResult pageResult = takeStockSheetService.queryTakeStockByCondition( + getPageIndex(), + getPageSize(), planId, condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + String finalPlanId = planId; + results = datas.stream() + .map(t -> new TakeStockSheetProductBo(t, finalPlanId, takeStockPlan.getScId())) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @Operation(summary = "查询商品列表") + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryTakeStockSheetProductVo vo) { + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(vo.getPlanId()); + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + vo.setPlanId(null); + } + + PageResult pageResult = takeStockSheetService.queryTakeStockList( + getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream() + .map(t -> new TakeStockSheetProductBo(t, vo.getPlanId(), takeStockPlan.getScId())) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"stock:take:sheet:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateTakeStockSheetVo vo) { + + vo.validate(); + + takeStockSheetService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"stock:take:sheet:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateTakeStockSheetVo vo) { + + vo.validate(); + + takeStockSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"stock:take:sheet:approve"}) + @PostMapping("/approve/direct") + public InvokeResult directApprovePass(@Valid @RequestBody CreateTakeStockSheetVo vo) { + + vo.validate(); + + takeStockSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"stock:take:sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@Valid ApprovePassTakeStockSheetVo vo) { + + takeStockSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"stock:take:sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@Valid ApproveRefuseTakeStockSheetVo vo) { + + takeStockSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 取消审核 + */ + @Operation(summary = "取消审核") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:sheet:cancel-approve"}) + @PatchMapping("/approve/cancel") + public InvokeResult cancelApprovePass(@NotBlank(message = "ID不能为空!") String id) { + + takeStockSheetService.cancelApprovePass(id); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @Operation(summary = "删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:take:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "ID不能为空!") String id) { + + takeStockSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/transfer/ScTransferOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/transfer/ScTransferOrderController.java new file mode 100644 index 0000000..f0ab31c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/transfer/ScTransferOrderController.java @@ -0,0 +1,290 @@ +package com.lframework.xingyun.sc.controller.stock.transfer; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.transfer.QueryScTransferOrderBo; +import com.lframework.xingyun.sc.bo.stock.transfer.QueryScTransferOrderDetailReceiveBo; +import com.lframework.xingyun.sc.bo.stock.transfer.ScTransferOrderFullBo; +import com.lframework.xingyun.sc.bo.stock.transfer.ScTransferProductBo; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import com.lframework.xingyun.sc.excel.stock.transfer.ScTransferOrderExportTaskWorker; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailReceiveService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderService; +import com.lframework.xingyun.sc.vo.stock.transfer.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 仓库调拨单 Controller + * + * @author zmj + */ +@Tag(name = "仓库调拨单") +@Validated +@RestController +@RequestMapping("/stock/transfer/sc") +public class ScTransferOrderController extends DefaultBaseController { + + @Autowired + private ScTransferOrderService scTransferOrderService; + + @Autowired + private ScTransferOrderDetailReceiveService scTransferOrderDetailReceiveService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"stock:sc-transfer:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryScTransferOrderVo vo) { + + PageResult pageResult = scTransferOrderService.query( + getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryScTransferOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:sc-transfer:query"}) + @GetMapping("/detail") + public InvokeResult getDetail( + @NotBlank(message = "id不能为空!") String id) { + + ScTransferOrderFullDto data = scTransferOrderService.getDetail(id); + if (data == null) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + ScTransferOrderFullBo result = new ScTransferOrderFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"stock:sc-transfer:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryScTransferOrderVo vo) { + + ExportTaskUtil.exportTask("仓库调拨单信息", ScTransferOrderExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品列表 + */ + @Operation(summary = "根据关键字查询商品列表") + @Parameters({ + @Parameter(description = "仓库ID", name = "scId", required = true), + @Parameter(description = "关键字", name = "condition", required = true)}) + @HasPermission({"stock:sc-transfer:add", "stock:sc-transfer:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, + String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + PageResult pageResult = scTransferOrderService.queryScTransferByCondition( + getPageIndex(), getPageSize(), scId, condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new ScTransferProductBo(scId, t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @Operation(summary = "查询商品列表") + @HasPermission({"stock:sc-transfer:add", "stock:sc-transfer:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryScTransferProductVo vo) { + + PageResult pageResult = scTransferOrderService.queryScTransferList( + getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new ScTransferProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"stock:sc-transfer:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateScTransferOrderVo vo) { + + vo.validate(); + + scTransferOrderService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"stock:sc-transfer:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateScTransferOrderVo vo) { + + vo.validate(); + + scTransferOrderService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:sc-transfer:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "id不能为空!") String id) { + + scTransferOrderService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @Operation(summary = "审核通过") + @HasPermission({"stock:sc-transfer:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassScTransferOrderVo vo) { + + scTransferOrderService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @Operation(summary = "直接审核通过") + @HasPermission({"stock:sc-transfer:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateScTransferOrderVo vo) { + + vo.validate(); + + scTransferOrderService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @Operation(summary = "审核拒绝") + @HasPermission({"stock:sc-transfer:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseScTransferOrderVo vo) { + + scTransferOrderService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 收货 + */ + @Operation(summary = "收货") + @HasPermission({"stock:sc-transfer:receive"}) + @PatchMapping("/receive") + public InvokeResult receive(@RequestBody @Valid ReceiveScTransferOrderVo vo) { + + scTransferOrderService.receive(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 收货记录 + */ + @Operation(summary = "收货记录") + @HasPermission({"stock:sc-transfer:query"}) + @GetMapping("/receive/detail") + public InvokeResult> receiveDetail( + @Valid QueryScTransferOrderDetailReceiveVo vo) { + + Wrapper queryWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetailReceive.class) + .eq(ScTransferOrderDetailReceive::getOrderId, vo.getOrderId()) + .eq(ScTransferOrderDetailReceive::getDetailId, vo.getDetailId()) + .orderByAsc(ScTransferOrderDetailReceive::getCreateTime); + + Page page = new Page<>(getPageIndex(vo), getPageSize(vo)); + Page pageInfo = scTransferOrderDetailReceiveService.page(page, + queryWrapper); + PageResult pageResult = PageResultUtil.convert(pageInfo); + List datas = pageResult.getDatas(); + List results = datas.stream() + .map(QueryScTransferOrderDetailReceiveBo::new).collect( + Collectors.toList()); + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/warning/ProductStockWarningController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/warning/ProductStockWarningController.java new file mode 100644 index 0000000..c78b3da --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/warning/ProductStockWarningController.java @@ -0,0 +1,217 @@ +package com.lframework.xingyun.sc.controller.stock.warning; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.ExcelUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.warning.GetProductStockWarningBo; +import com.lframework.xingyun.sc.bo.stock.warning.GetProductStockWarningNotifyBo; +import com.lframework.xingyun.sc.bo.stock.warning.QueryProductStockWarningBo; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import com.lframework.xingyun.sc.entity.ProductStockWarningNotify; +import com.lframework.xingyun.sc.excel.stock.warning.StockWarningImportListener; +import com.lframework.xingyun.sc.excel.stock.warning.StockWarningImportModel; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningNotifyService; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningService; +import com.lframework.xingyun.sc.vo.stock.warning.CreateProductStockWarningVo; +import com.lframework.xingyun.sc.vo.stock.warning.QueryProductStockWarningVo; +import com.lframework.xingyun.sc.vo.stock.warning.UpdateProductStockWarningVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 库存预警 Controller + * + * @author zmj + */ +@Tag(name = "库存预警") +@Validated +@RestController +@RequestMapping("/stock/warning") +public class ProductStockWarningController extends DefaultBaseController { + + @Autowired + private ProductStockWarningService productStockWarningService; + + @Autowired + private ProductStockWarningNotifyService productStockWarningNotifyService; + + /** + * 查询列表 + */ + @Operation(summary = "查询列表") + @HasPermission({"stock:warning:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryProductStockWarningVo vo) { + + PageResult pageResult = productStockWarningService.query( + getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryProductStockWarningBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:warning:query"}) + @GetMapping("/detail") + public InvokeResult getDetail( + @NotBlank(message = "id不能为空!") String id) { + + ProductStockWarning data = productStockWarningService.findById(id); + if (data == null) { + throw new DefaultClientException("库存预警不存在!"); + } + + GetProductStockWarningBo result = new GetProductStockWarningBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @Operation(summary = "新增") + @HasPermission({"stock:warning:add"}) + @PostMapping + public InvokeResult create(@Valid CreateProductStockWarningVo vo) { + + productStockWarningService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @Operation(summary = "修改") + @HasPermission({"stock:warning:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateProductStockWarningVo vo) { + + productStockWarningService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"stock:warning:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "id不能为空!") String id) { + + productStockWarningService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @Operation(summary = "批量删除") + @HasPermission({"stock:warning:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @Parameter(description = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的库存预警!") List ids) { + + productStockWarningService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 查询设置的消息通知组 + */ + @Operation(summary = "查询设置的消息通知组") + @HasPermission({"stock:warning:notify"}) + @GetMapping("/setting") + public InvokeResult> getSetting() { + List datas = productStockWarningNotifyService.list( + Wrappers.lambdaQuery( + ProductStockWarningNotify.class).orderByDesc(ProductStockWarningNotify::getId)); + + return InvokeResultBuilder.success( + datas.stream().map(GetProductStockWarningNotifyBo::new).collect( + Collectors.toList())); + } + + /** + * 新增设置的消息通知组 + */ + @Operation(summary = "保存设置的消息通知组") + @HasPermission({"stock:warning:notify"}) + @PostMapping("/setting") + public InvokeResult createSetting( + @Parameter(description = "消息通知组ID", required = true) @NotBlank(message = "消息通知组ID不能为空!") String id) { + + productStockWarningNotifyService.createSetting(id); + + return InvokeResultBuilder.success(); + } + + /** + * 删除设置的消息通知组 + */ + @Operation(summary = "删除设置的消息通知组") + @HasPermission({"stock:warning:notify"}) + @DeleteMapping("/setting") + public InvokeResult deleteSetting( + @Parameter(description = "消息通知组ID", required = true) @NotBlank(message = "消息通知组ID不能为空!") String id) { + + productStockWarningNotifyService.deleteSetting(id); + + return InvokeResultBuilder.success(); + } + + @Operation(summary = "下载导入模板") + @HasPermission({"stock:warning:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXlsx("库存预警导入模板", "库存预警导入模板", StockWarningImportModel.class); + } + + @Operation(summary = "导入") + @HasPermission({"stock:warning:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + StockWarningImportListener listener = new StockWarningImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, StockWarningImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetBizOrderDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetBizOrderDto.java new file mode 100644 index 0000000..f090c03 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetBizOrderDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.dto.logistics; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class LogisticsSheetBizOrderDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务单据号 + */ + private String bizCode; + + /** + * 仓库ID + */ + private String scId; + + /** + * 收货人ID + */ + private String receiverId; + + /** + * 业务类型 + */ + private LogisticsSheetDetailBizType bizType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetFullDto.java new file mode 100644 index 0000000..b047018 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetFullDto.java @@ -0,0 +1,183 @@ +package com.lframework.xingyun.sc.dto.logistics; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class LogisticsSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 物流单号 + */ + private String logisticsNo; + + /** + * 物流公司ID + */ + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + private String senderName; + + /** + * 寄件人联系电话 + */ + private String senderTelephone; + + /** + * 寄件人省 + */ + private String senderProvinceId; + + /** + * 寄件人市 + */ + private String senderCityId; + + /** + * 寄件人区 + */ + private String senderDistrictId; + + /** + * 寄件人地址 + */ + private String senderAddress; + + /** + * 收件人姓名 + */ + private String receiverName; + + /** + * 收件人联系电话 + */ + private String receiverTelephone; + + /** + * 收件人省 + */ + private String receiverProvinceId; + + /** + * 收件人市 + */ + private String receiverCityId; + + /** + * 收件人区 + */ + private String receiverDistrictId; + + /** + * 收件人地址 + */ + private String receiverAddress; + + /** + * 状态 + */ + private LogisticsSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 总重量 + */ + private BigDecimal totalWeight; + + /** + * 总体积 + */ + private BigDecimal totalVolume; + + /** + * 物流费 + */ + private BigDecimal totalAmount; + + /** + * 发货人 + */ + private String deliveryBy; + + /** + * 发货时间 + */ + private LocalDateTime deliveryTime; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 物流单ID + */ + private String sheetId; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private LogisticsSheetDetailBizType bizType; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderFullDto.java new file mode 100644 index 0000000..8c859c3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderFullDto.java @@ -0,0 +1,168 @@ +package com.lframework.xingyun.sc.dto.purchase; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class PurchaseOrderFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 预计到货日期 + */ + private LocalDate expectArriveDate; + + /** + * 采购数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 采购金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private PurchaseOrderStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 关联的审批流程ID + */ + private Long flowInstanceId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class OrderDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private BigDecimal orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率 + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 含税总金额 + */ + private BigDecimal taxAmount; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderWithReceiveDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderWithReceiveDto.java new file mode 100644 index 0000000..6c15359 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderWithReceiveDto.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.sc.dto.purchase; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 采购订单在收货业务的Dto + */ +@Data +public class PurchaseOrderWithReceiveDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private BigDecimal orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已收货数量 + */ + private BigDecimal receiveNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseProductDto.java new file mode 100644 index 0000000..67493ab --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseProductDto.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.sc.dto.purchase; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class PurchaseProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 采购价 + */ + private BigDecimal purchasePrice; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 状态 + */ + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/GetPaymentDateDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/GetPaymentDateDto.java new file mode 100644 index 0000000..ba33352 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/GetPaymentDateDto.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.sc.dto.purchase.receive; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; + +@Data +public class GetPaymentDateDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 是否允许修改付款日期 + */ + private Boolean allowModify; + + /** + * 默认付款日期 + */ + private LocalDate paymentDate; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetFullDto.java new file mode 100644 index 0000000..b91a1d7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetFullDto.java @@ -0,0 +1,184 @@ +package com.lframework.xingyun.sc.dto.purchase.receive; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class ReceiveSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 采购订单ID + */ + private String purchaseOrderId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 到货日期 + */ + private LocalDate receiveDate; + + /** + * 采购数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 采购金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private ReceiveSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class OrderDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 收货数量 + */ + private BigDecimal orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 采购总金额 + */ + private BigDecimal taxAmount; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率 + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 采购订单明细ID + */ + private String purchaseOrderDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetWithReturnDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetWithReturnDto.java new file mode 100644 index 0000000..08e3dba --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetWithReturnDto.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.sc.dto.purchase.receive; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 采购收货单在采购退货业务的Dto + */ +@Data +public class ReceiveSheetWithReturnDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 收货数量 + */ + private BigDecimal orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 采购总金额 + */ + private BigDecimal taxAmount; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/returned/PurchaseReturnFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/returned/PurchaseReturnFullDto.java new file mode 100644 index 0000000..82e635e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/returned/PurchaseReturnFullDto.java @@ -0,0 +1,179 @@ +package com.lframework.xingyun.sc.dto.purchase.returned; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class PurchaseReturnFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 收货单ID + */ + private String receiveSheetId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private PurchaseReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 退单明细 + */ + private List details; + + @Data + public static class ReturnDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private BigDecimal returnNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率 + */ + private BigDecimal taxRate; + + /** + * 退货总金额 + */ + private BigDecimal taxAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 收货单明细ID + */ + private String receiveSheetDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/RetailProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/RetailProductDto.java new file mode 100644 index 0000000..5869b99 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/RetailProductDto.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.sc.dto.retail; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class RetailProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 零售价 + */ + private BigDecimal retailPrice; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 状态 + */ + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetDetailLotDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetDetailLotDto.java new file mode 100644 index 0000000..06fea44 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetDetailLotDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.dto.retail.out; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class RetailOutSheetDetailLotDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetFullDto.java new file mode 100644 index 0000000..443d0d5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetFullDto.java @@ -0,0 +1,194 @@ +package com.lframework.xingyun.sc.dto.retail.out; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class RetailOutSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 出库总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售订单明细ID + */ + private String saleOrderDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetWithReturnDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetWithReturnDto.java new file mode 100644 index 0000000..7fec3df --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetWithReturnDto.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.sc.dto.retail.out; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class RetailOutSheetWithReturnDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/returned/RetailReturnFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/returned/RetailReturnFullDto.java new file mode 100644 index 0000000..4fcf508 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/returned/RetailReturnFullDto.java @@ -0,0 +1,194 @@ +package com.lframework.xingyun.sc.dto.retail.returned; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class RetailReturnFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 退货总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 零售出库单ID + */ + private String outSheetId; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class ReturnDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private BigDecimal returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 零售出库单明细ID + */ + private String outSheetDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderFullDto.java new file mode 100644 index 0000000..b65ee64 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderFullDto.java @@ -0,0 +1,172 @@ +package com.lframework.xingyun.sc.dto.sale; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class SaleOrderFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 销售总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOrderStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class OrderDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 总金额 + */ + private BigDecimal taxAmount; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderWithOutDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderWithOutDto.java new file mode 100644 index 0000000..238b861 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderWithOutDto.java @@ -0,0 +1,108 @@ +package com.lframework.xingyun.sc.dto.sale; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 销售订单在出库业务的Dto + */ +@Data +public class SaleOrderWithOutDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 销售数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已出库数量 + */ + private BigDecimal outNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleProductDto.java new file mode 100644 index 0000000..d069ab0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleProductDto.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.sc.dto.sale; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SaleProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 销售价 + */ + private BigDecimal salePrice; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 状态 + */ + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetDetailLotDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetDetailLotDto.java new file mode 100644 index 0000000..ee5066d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetDetailLotDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.dto.sale.out; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SaleOutSheetDetailLotDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetFullDto.java new file mode 100644 index 0000000..de612f2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetFullDto.java @@ -0,0 +1,199 @@ +package com.lframework.xingyun.sc.dto.sale.out; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class SaleOutSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 出库总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 销售订单ID + */ + private String saleOrderId; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售订单明细ID + */ + private String saleOrderDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetWithReturnDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetWithReturnDto.java new file mode 100644 index 0000000..e136196 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetWithReturnDto.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.sc.dto.sale.out; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class SaleOutSheetWithReturnDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/returned/SaleReturnFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/returned/SaleReturnFullDto.java new file mode 100644 index 0000000..71796b9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/returned/SaleReturnFullDto.java @@ -0,0 +1,194 @@ +package com.lframework.xingyun.sc.dto.sale.returned; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class SaleReturnFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 退货总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 销售出库单ID + */ + private String outSheetId; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class ReturnDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private BigDecimal returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售出库单明细ID + */ + private String outSheetDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/ProductStockChangeDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/ProductStockChangeDto.java new file mode 100644 index 0000000..a1b5e99 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/ProductStockChangeDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.dto.stock; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class ProductStockChangeDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + private String scId; + + /** + * 商品ID + */ + private String productId; + + /** + * 变动数量 + */ + private BigDecimal num; + + /** + * 含税变动金额 + */ + private BigDecimal taxAmount; + + /** + * 当前含税均价 + */ + private BigDecimal curTaxPrice; + + /** + * 当前库存数量 + */ + private BigDecimal curStockNum; + + /** + * 生成时间 + */ + private LocalDateTime createTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java new file mode 100644 index 0000000..1afb7cc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.sc.dto.stock.adjust.stock; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StockAdjustProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 当前库存数量 + */ + private Integer curStockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustSheetFullDto.java new file mode 100644 index 0000000..39eb093 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustSheetFullDto.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.sc.dto.stock.adjust.stock; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.StockAdjustSheetBizType; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 库存调整单详情 Dto + *

+ * + * @author zmj + */ +@Data +public class StockAdjustSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 业务类型 + */ + private StockAdjustSheetBizType bizType; + + /** + * 调整原因ID + */ + private String reasonId; + + /** + * 状态 + */ + private StockAdjustSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 调整库存数量 + */ + private BigDecimal stockNum; + + /** + * 备注 + */ + private String description; + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/GetTakeStockPlanDetailProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/GetTakeStockPlanDetailProductDto.java new file mode 100644 index 0000000..fe58bc6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/GetTakeStockPlanDetailProductDto.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.dto.stock.take.plan; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 查询盘点任务详情中的商品信息 Dto + */ +@Data +public class GetTakeStockPlanDetailProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 详情ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 库存数量 + */ + private BigDecimal stockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/QueryTakeStockPlanProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/QueryTakeStockPlanProductDto.java new file mode 100644 index 0000000..3eab61a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/QueryTakeStockPlanProductDto.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.sc.dto.stock.take.plan; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class QueryTakeStockPlanProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + private String productId; + + /** + * 初始库存 + */ + private BigDecimal stockNum; + + /** + * 出项数量 + */ + private BigDecimal totalOutNum; + + /** + * 入项数量 + */ + private BigDecimal totalInNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/TakeStockPlanFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/TakeStockPlanFullDto.java new file mode 100644 index 0000000..605812f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/TakeStockPlanFullDto.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.sc.dto.stock.take.plan; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class TakeStockPlanFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点类别 + */ + private TakeStockPlanType takeType; + + /** + * 备注 + */ + private String description; + + /** + * 盘点状态 + */ + private TakeStockPlanStatus takeStatus; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 库存数量 + */ + private BigDecimal stockNum; + + /** + * 盘点数量 + */ + private BigDecimal oriTakeNum; + + /** + * 修改后的盘点数量 + */ + private BigDecimal takeNum; + + /** + * 出项数量 + */ + private BigDecimal totalOutNum; + + /** + * 进项数量 + */ + private BigDecimal totalInNum; + + /** + * 成本价 + */ + private BigDecimal taxPrice; + + /** + * 备注 + */ + private String description; + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockProductDto.java new file mode 100644 index 0000000..0a1a4ac --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockProductDto.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.sc.dto.stock.take.pre; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PreTakeStockProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockSheetFullDto.java new file mode 100644 index 0000000..c5b0e0f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockSheetFullDto.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.sc.dto.stock.take.pre; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 预先盘点单 Dto + *

+ * + * @author zmj + */ +@Data +public class PreTakeStockSheetFullDto implements BaseDto, Serializable { + + public static final String CACHE_NAME = "PreTakeStockSheetFullDto"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点状态 + */ + private PreTakeStockSheetStatus takeStatus; + + /** + * 备注 + */ + private String description; + + /** + * 操作人ID + */ + private String updateBy; + + /** + * 操作时间 + */ + private LocalDateTime updateTime; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 初盘数量 + */ + private BigDecimal firstNum; + + /** + * 复盘数量 + */ + private BigDecimal secondNum; + + /** + * 抽盘数量 + */ + private BigDecimal randNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/QueryPreTakeStockSheetProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/QueryPreTakeStockSheetProductDto.java new file mode 100644 index 0000000..3000d56 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/QueryPreTakeStockSheetProductDto.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.sc.dto.stock.take.pre; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class QueryPreTakeStockSheetProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + private String productId; + + /** + * 初盘数量 + */ + private BigDecimal firstNum; + + /** + * 复盘数量 + */ + private BigDecimal secondNum; + + /** + * 抽盘数量 + */ + private BigDecimal randNum; + + /** + * 预先盘点单状态 + */ + private PreTakeStockSheetStatus takeStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetFullDto.java new file mode 100644 index 0000000..5537644 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetFullDto.java @@ -0,0 +1,125 @@ +package com.lframework.xingyun.sc.dto.stock.take.sheet; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 盘点单详情 Dto + *

+ * + * @author zmj + */ +@Data +public class TakeStockSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 盘点任务ID + */ + private String planId; + + /** + * 预先盘点单ID + */ + private String preSheetId; + + /** + * 仓库ID + */ + private String scId; + + /** + * 状态 + */ + private TakeStockSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 拒绝理由 + */ + private String refuseReason; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 明细 + */ + private List details; + + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 盘点数量 + */ + private BigDecimal takeNum; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetProductDto.java new file mode 100644 index 0000000..5bdd3c8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetProductDto.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.sc.dto.stock.take.sheet; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TakeStockSheetProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferOrderFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferOrderFullDto.java new file mode 100644 index 0000000..e95ac09 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferOrderFullDto.java @@ -0,0 +1,125 @@ +package com.lframework.xingyun.sc.dto.stock.transfer; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 仓库调拨单详情 Dto + *

+ * + * @author zmj + */ +@Data +public class ScTransferOrderFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 转出仓库ID + */ + private String sourceScId; + + /** + * 转入仓库ID + */ + private String targetScId; + + /** + * 调拨数量 + */ + private BigDecimal totalNum; + + /** + * 调拨成本金额 + */ + private BigDecimal totalAmount; + + /** + * 状态 + */ + private ScTransferOrderStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 调拨数量 + */ + private BigDecimal transferNum; + + /** + * 已收货数量 + */ + private BigDecimal receiveNum; + + /** + * 备注 + */ + private String description; + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferProductDto.java new file mode 100644 index 0000000..f4f2d90 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferProductDto.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.sc.dto.stock.transfer; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ScTransferProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 简码 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 当前库存数量 + */ + private Integer curStockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheet.java new file mode 100644 index 0000000..e2a1ec7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheet.java @@ -0,0 +1,179 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 物流单 + *

+ * + * @author zmj + * @since 2023-06-13 + */ +@Data +@TableName("tbl_logistics_sheet") +public class LogisticsSheet extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "LogisticsSheet"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 物流单号 + */ + private String logisticsNo; + + /** + * 物流公司ID + */ + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + private String senderName; + + /** + * 寄件人联系电话 + */ + private String senderTelephone; + + /** + * 寄件人省 + */ + private String senderProvinceId; + + /** + * 寄件人市 + */ + private String senderCityId; + + /** + * 寄件人区 + */ + private String senderDistrictId; + + /** + * 寄件人地址 + */ + private String senderAddress; + + /** + * 收件人姓名 + */ + private String receiverName; + + /** + * 收件人联系电话 + */ + private String receiverTelephone; + + /** + * 收件人省 + */ + private String receiverProvinceId; + + /** + * 收件人市 + */ + private String receiverCityId; + + /** + * 收件人区 + */ + private String receiverDistrictId; + + /** + * 收件人地址 + */ + private String receiverAddress; + + /** + * 总重量 + */ + private BigDecimal totalWeight; + + /** + * 总体积 + */ + private BigDecimal totalVolume; + + /** + * 物流费 + */ + private BigDecimal totalAmount; + + /** + * 状态 + */ + private LogisticsSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 发货人 + */ + private String deliveryBy; + + /** + * 发货时间 + */ + private LocalDateTime deliveryTime; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheetDetail.java new file mode 100644 index 0000000..e042296 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheetDetail.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import lombok.Data; + +/** + *

+ * 物流单 + *

+ * + * @author zmj + * @since 2023-06-13 + */ +@Data +@TableName("tbl_logistics_sheet_detail") +public class LogisticsSheetDetail extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "LogisticsSheetDetail"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 物流单ID + */ + private String sheetId; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private LogisticsSheetDetailBizType bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/OrderPayType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/OrderPayType.java new file mode 100644 index 0000000..9e21c44 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/OrderPayType.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-03-28 + */ +@Data +@TableName("tbl_order_pay_type") +public class OrderPayType extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "OrderPayType"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 订单ID + */ + private String orderId; + + /** + * 支付方式ID + */ + private String payTypeId; + + /** + * 支付金额 + */ + private BigDecimal payAmount; + + /** + * 支付内容 + */ + private String text; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheet.java new file mode 100644 index 0000000..ee50e26 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheet.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 预先盘点单 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_pre_take_stock_sheet") +public class PreTakeStockSheet extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PreTakeStockSheet"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点状态 + */ + private PreTakeStockSheetStatus takeStatus; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheetDetail.java new file mode 100644 index 0000000..9cec41e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheetDetail.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * 预先盘点单详情 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_pre_take_stock_sheet_detail") +public class PreTakeStockSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 预先盘点单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 初盘数量 + */ + private BigDecimal firstNum; + + /** + * 复盘数量 + */ + private BigDecimal secondNum; + + /** + * 抽盘数量 + */ + private BigDecimal randNum; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStock.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStock.java new file mode 100644 index 0000000..cb48b80 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStock.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_product_stock") +public class ProductStock extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 商品ID + */ + private String productId; + + /** + * 库存数量 + */ + private BigDecimal stockNum; + + /** + * 含税价格 + */ + private BigDecimal taxPrice; + + /** + * 含税金额 + */ + private BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockLog.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockLog.java new file mode 100644 index 0000000..a601808 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockLog.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-14 + */ +@Data +@TableName("tbl_product_stock_log") +public class ProductStockLog extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 商品ID + */ + private String productId; + + /** + * 原库存数量 + */ + private BigDecimal oriStockNum; + + /** + * 现库存数量 + */ + private BigDecimal curStockNum; + + /** + * 原含税成本价 + */ + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + private BigDecimal curTaxPrice; + + /** + * 变动库存数量 + */ + private BigDecimal stockNum; + + /** + * 变动含税金额 + */ + private BigDecimal taxAmount; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务单据号 + */ + private String bizCode; + + /** + * 业务单据明细ID + */ + private String bizDetailId; + + /** + * 业务类型 + */ + private ProductStockBizType bizType; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarning.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarning.java new file mode 100644 index 0000000..1c7a06a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarning.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 库存预警 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_product_stock_warning") +public class ProductStockWarning extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 商品ID + */ + private String productId; + + /** + * 预警上限 + */ + private BigDecimal maxLimit; + + /** + * 预警下限 + */ + private BigDecimal minLimit; + + /** + * 状态 + */ + private Boolean available; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarningNotify.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarningNotify.java new file mode 100644 index 0000000..97c6017 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockWarningNotify.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * 库存预警通知组 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_product_stock_warning_notify") +public class ProductStockWarningNotify extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 通知组ID + */ + private String notifyGroupId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseConfig.java new file mode 100644 index 0000000..58277c6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseConfig.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_config") +public class PurchaseConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PurchaseConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 采购收货单是否关联采购订单 + */ + private Boolean receiveRequirePurchase; + + /** + * 采购收货单是否多次关联采购订单 + */ + private Boolean receiveMultipleRelatePurchase; + + /** + * 采购退货单是否关联采购收货单 + */ + private Boolean purchaseReturnRequireReceive; + + /** + * 采购退货单是否多次关联采购收货单 + */ + private Boolean purchaseReturnMultipleRelateReceive; + + /** + * 采购订单是否开启审批流程 + */ + private Boolean purchaseRequireBpm; + + /** + * 采购订单关联的审批流程ID + */ + private Long purchaseBpmProcessId; + + /** + * 采购订单关联的审批流程编号 + */ + private String purchaseBpmProcessCode; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrder.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrder.java new file mode 100644 index 0000000..78f26ed --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrder.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_order") +public class PurchaseOrder extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + protected String id; + + /** + * 单号 + */ + protected String code; + + /** + * 仓库ID + */ + protected String scId; + + /** + * 供应商ID + */ + protected String supplierId; + + /** + * 采购员ID + */ + protected String purchaserId; + + /** + * 预计到货日期 + */ + protected LocalDate expectArriveDate; + + /** + * 采购数量 + */ + protected BigDecimal totalNum; + + /** + * 赠品数量 + */ + protected BigDecimal totalGiftNum; + + /** + * 采购金额 + */ + protected BigDecimal totalAmount; + + /** + * 备注 + */ + protected String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + protected String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + protected String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + protected LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + protected String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + protected String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + protected LocalDateTime updateTime; + + /** + * 审核人 + */ + protected String approveBy; + + /** + * 审核时间 + */ + protected LocalDateTime approveTime; + + /** + * 状态 + */ + protected PurchaseOrderStatus status; + + /** + * 拒绝原因 + */ + protected String refuseReason; + + /** + * 关联的审批流程ID + */ + private Long flowInstanceId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetail.java new file mode 100644 index 0000000..0f0a754 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetail.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_order_detail") +public class PurchaseOrderDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + protected String id; + + /** + * 订单ID + */ + protected String orderId; + + /** + * 商品ID + */ + protected String productId; + + /** + * 采购数量 + */ + protected BigDecimal orderNum; + + /** + * 采购价 + */ + protected BigDecimal taxPrice; + + /** + * 是否赠品 + */ + protected Boolean isGift; + + /** + * 税率(%) + */ + protected BigDecimal taxRate; + + /** + * 备注 + */ + protected String description; + + /** + * 排序编号 + */ + protected Integer orderNo; + + /** + * 已收货数量 + */ + protected BigDecimal receiveNum; + + /** + * 含税总金额 + */ + protected BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundle.java new file mode 100644 index 0000000..95570db --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundle.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@TableName("tbl_purchase_order_detail_bundle") +public class PurchaseOrderDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PurchaseOrderDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 采购单ID + */ + private String orderId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private BigDecimal orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private BigDecimal productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品含税金额 + */ + private BigDecimal productTaxAmount; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundleForm.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundleForm.java new file mode 100644 index 0000000..e8e2b06 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailBundleForm.java @@ -0,0 +1,12 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +@Data +@TableName("tbl_purchase_order_detail_bundle_form") +public class PurchaseOrderDetailBundleForm extends PurchaseOrderDetailBundle implements BaseDto { + + private static final long serialVersionUID = 1L; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailForm.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailForm.java new file mode 100644 index 0000000..0ebcd36 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetailForm.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_order_detail_form") +public class PurchaseOrderDetailForm extends PurchaseOrderDetail implements BaseDto { + + private static final long serialVersionUID = 1L; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderForm.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderForm.java new file mode 100644 index 0000000..f2593c5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderForm.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_order_form") +public class PurchaseOrderForm extends PurchaseOrder implements BaseDto { + + private static final long serialVersionUID = 1L; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturn.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturn.java new file mode 100644 index 0000000..0187da8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturn.java @@ -0,0 +1,147 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-16 + */ +@Data +@TableName("tbl_purchase_return") +public class PurchaseReturn extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 收货单ID + */ + private String receiveSheetId; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private PurchaseReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturnDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturnDetail.java new file mode 100644 index 0000000..9da68d6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturnDetail.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-16 + */ +@Data +@TableName("tbl_purchase_return_detail") +public class PurchaseReturnDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 收货单ID + */ + private String returnId; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private BigDecimal returnNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 收货单明细ID + */ + private String receiveSheetDetailId; + + /** + * 退货总金额 + */ + private BigDecimal taxAmount; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheet.java new file mode 100644 index 0000000..2f027cf --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheet.java @@ -0,0 +1,150 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-09 + */ +@Data +@TableName("tbl_receive_sheet") +public class ReceiveSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 到货日期 + */ + private LocalDate receiveDate; + + /** + * 采购单ID + */ + private String purchaseOrderId; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 收货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private ReceiveSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetail.java new file mode 100644 index 0000000..4b64fb0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetail.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-09 + */ +@Data +@TableName("tbl_receive_sheet_detail") +public class ReceiveSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 收货单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private BigDecimal orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 采购订单明细ID + */ + private String purchaseOrderDetailId; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + + /** + * 采购总金额 + */ + private BigDecimal taxAmount; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetailBundle.java new file mode 100644 index 0000000..ed33aeb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetailBundle.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2025-10-05 + */ +@Data +@TableName("tbl_receive_sheet_detail_bundle") +public class ReceiveSheetDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ReceiveSheetDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 收货单ID + */ + private String sheetId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private BigDecimal orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private BigDecimal productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; + + /** + * 总金额 + */ + private BigDecimal productTaxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailConfig.java new file mode 100644 index 0000000..b5447f2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailConfig.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_retail_config") +public class RetailConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "RetailConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 零售出库单上的会员是否必填 + */ + private Boolean retailOutSheetRequireMember; + + /** + * 零售退货单是否关联零售出库单 + */ + private Boolean retailReturnRequireOutStock; + + /** + * 零售退货单是否多次关联零售出库单 + */ + private Boolean retailReturnMultipleRelateOutStock; + + /** + * 零售退货单上的会员是否必填 + */ + private Boolean retailReturnRequireMember; + + /** + * 零售出库单是否需要发货 + */ + private Boolean retailOutSheetRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheet.java new file mode 100644 index 0000000..d888865 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheet.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_retail_out_sheet") +public class RetailOutSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 出库金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetail.java new file mode 100644 index 0000000..ff8329d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetail.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_retail_out_sheet_detail") +public class RetailOutSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + + /** + * 组合商品原始明细ID + */ + private String oriBundleDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailBundle.java new file mode 100644 index 0000000..1417213 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailBundle.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-05-26 + */ +@Data +@TableName("tbl_retail_out_sheet_detail_bundle") +public class RetailOutSheetDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "RetailOutSheetDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private BigDecimal orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private BigDecimal productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; + + /** + * 总金额 + */ + private BigDecimal productTaxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailLot.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailLot.java new file mode 100644 index 0000000..fca3beb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailLot.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-03 + */ +@Data +@TableName("tbl_retail_out_sheet_detail_lot") +public class RetailOutSheetDetailLot extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturn.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturn.java new file mode 100644 index 0000000..df2351e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturn.java @@ -0,0 +1,147 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_retail_return") +public class RetailReturn extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 出库单ID + */ + private String outSheetId; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturnDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturnDetail.java new file mode 100644 index 0000000..bd87a65 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturnDetail.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_retail_return_detail") +public class RetailReturnDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 退货单ID + */ + private String returnId; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private BigDecimal returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 出库单明细ID + */ + private String outSheetDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleConfig.java new file mode 100644 index 0000000..3a4bed8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleConfig.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_sale_config") +public class SaleConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SaleConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 销售出库单是否关联销售订单 + */ + private Boolean outStockRequireSale; + + /** + * 销售出库单是否多次关联销售订单 + */ + private Boolean outStockMultipleRelateSale; + + /** + * 销售退货单是否关联销售出库单 + */ + private Boolean saleReturnRequireOutStock; + + /** + * 销售退货单是否多次关联销售出库单 + */ + private Boolean saleReturnMultipleRelateOutStock; + + /** + * 销售出库单是否需要物流单 + */ + private Boolean outStockRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrder.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrder.java new file mode 100644 index 0000000..01db26b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrder.java @@ -0,0 +1,130 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-21 + */ +@Data +@TableName("tbl_sale_order") +public class SaleOrder extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 销售数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 销售金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOrderStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetail.java new file mode 100644 index 0000000..aa9bca0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetail.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-21 + */ +@Data +@TableName("tbl_sale_order_detail") +public class SaleOrderDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 订单ID + */ + private String orderId; + + /** + * 商品ID + */ + private String productId; + + /** + * 销售数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已出库数量 + */ + private BigDecimal outNum; + + /** + * 组合商品原始明细ID + */ + private String oriBundleDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetailBundle.java new file mode 100644 index 0000000..1355b8e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetailBundle.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-05-26 + */ +@Data +@TableName("tbl_sale_order_detail_bundle") +public class SaleOrderDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SaleOrderDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 销售单ID + */ + private String orderId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private BigDecimal orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private BigDecimal productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; + + /** + * 单品含税金额 + */ + private BigDecimal productTaxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheet.java new file mode 100644 index 0000000..b0a4e40 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheet.java @@ -0,0 +1,145 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_sale_out_sheet") +public class SaleOutSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 销售单ID + */ + private String saleOrderId; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 出库金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetail.java new file mode 100644 index 0000000..6de23f0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetail.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_sale_out_sheet_detail") +public class SaleOutSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售订单明细ID + */ + private String saleOrderDetailId; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + + /** + * 组合商品原始明细ID + */ + private String oriBundleDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailBundle.java new file mode 100644 index 0000000..e24eace --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailBundle.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-05-26 + */ +@Data +@TableName("tbl_sale_out_sheet_detail_bundle") +public class SaleOutSheetDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SaleOutSheetDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private BigDecimal orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private BigDecimal productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; + + /** + * 单品含税金额 + */ + private BigDecimal productTaxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailLot.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailLot.java new file mode 100644 index 0000000..761a2ac --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailLot.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-03 + */ +@Data +@TableName("tbl_sale_out_sheet_detail_lot") +public class SaleOutSheetDetailLot extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private BigDecimal orderNum; + + /** + * 已退货数量 + */ + private BigDecimal returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturn.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturn.java new file mode 100644 index 0000000..7f2f1bd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturn.java @@ -0,0 +1,147 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_sale_return") +public class SaleReturn extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 出库单ID + */ + private String outSheetId; + + /** + * 商品数量 + */ + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + private BigDecimal totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturnDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturnDetail.java new file mode 100644 index 0000000..7d6ab79 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturnDetail.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_sale_return_detail") +public class SaleReturnDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 退货单ID + */ + private String returnId; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private BigDecimal returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 出库单明细ID + */ + private String outSheetDetailId; + + /** + * 总金额 + */ + private BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrder.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrder.java new file mode 100644 index 0000000..d1aba89 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrder.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 仓库调拨单 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_sc_transfer_order") +public class ScTransferOrder extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 转出仓库ID + */ + private String sourceScId; + + /** + * 转入仓库ID + */ + private String targetScId; + + /** + * 调拨数量 + */ + private BigDecimal totalNum; + + /** + * 调拨成本金额 + */ + private BigDecimal totalAmount; + + /** + * 状态 + */ + private ScTransferOrderStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetail.java new file mode 100644 index 0000000..23ca467 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetail.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * 仓库调拨单明细 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_sc_transfer_order_detail") +public class ScTransferOrderDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 调拨单ID + */ + private String orderId; + + /** + * 商品ID + */ + private String productId; + + /** + * 调拨数量 + */ + private BigDecimal transferNum; + + /** + * 调拨总金额 + */ + private BigDecimal transferAmount; + + /** + * 成本价 + */ + private BigDecimal taxPrice; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + + /** + * 已收货数量 + */ + private BigDecimal receiveNum; + + /** + * 已收货金额 + */ + private BigDecimal receiveAmount; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetailReceive.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetailReceive.java new file mode 100644 index 0000000..3c6e954 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetailReceive.java @@ -0,0 +1,69 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 仓库调拨单收货明细 + *

+ * + * @author zmj + * @since 2023-05-24 + */ +@Data +@TableName("tbl_sc_transfer_order_detail_receive") +public class ScTransferOrderDetailReceive extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 调拨单ID + */ + private String orderId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 收货数量 + */ + private BigDecimal receiveNum; + + /** + * 收货金额 + */ + private BigDecimal receiveAmount; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustReason.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustReason.java new file mode 100644 index 0000000..df96158 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustReason.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 库存调整原因 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_stock_adjust_reason") +public class StockAdjustReason extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "StockAdjustReason"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheet.java new file mode 100644 index 0000000..cd6aedc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheet.java @@ -0,0 +1,114 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.StockAdjustSheetBizType; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 库存调整单 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_stock_adjust_sheet") +public class StockAdjustSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 业务类型 + */ + private StockAdjustSheetBizType bizType; + + /** + * 调整原因ID + */ + private String reasonId; + + /** + * 状态 + */ + private StockAdjustSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheetDetail.java new file mode 100644 index 0000000..34c5dc5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheetDetail.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * 库存调整单明细 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_stock_adjust_sheet_detail") +public class StockAdjustSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单据ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 调整库存数量 + */ + private BigDecimal stockNum; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockConfig.java new file mode 100644 index 0000000..ad23cbf --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockConfig.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * 盘点参数 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_config") +public class TakeStockConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "TakeStockConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据 + */ + private Boolean showProduct; + + /** + * 库存盘点单是否显示盘点任务创建时商品的系统库存数量 + */ + private Boolean showStock; + + /** + * 盘点差异生成时是否自动调整盘点任务中商品的系统库存数量 + */ + private Boolean autoChangeStock; + + /** + * 盘点差异单中的盘点数量是否允许手动修改 + */ + private Boolean allowChangeNum; + + /** + * 盘点任务创建后多少小时内未完成,则自动作废 + */ + private Integer cancelHours; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlan.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlan.java new file mode 100644 index 0000000..d8672e4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlan.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 盘点任务 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_plan") +public class TakeStockPlan extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "TakeStockPlan"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点类别 + */ + private TakeStockPlanType takeType; + + /** + * 业务ID + */ + private String bizId; + + /** + * 盘点状态 + */ + private TakeStockPlanStatus takeStatus; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlanDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlanDetail.java new file mode 100644 index 0000000..de9d0c7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlanDetail.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * 盘点任务详情 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_plan_detail") +public class TakeStockPlanDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 盘点任务ID + */ + private String planId; + + /** + * 商品ID + */ + private String productId; + + /** + * 初始库存数量 + */ + private BigDecimal stockNum; + + /** + * 盘点数量 + */ + private BigDecimal oriTakeNum; + + /** + * 修改后的盘点数量 + */ + private BigDecimal takeNum; + + /** + * 出项数量 + */ + private BigDecimal totalOutNum; + + /** + * 入项数量 + */ + private BigDecimal totalInNum; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheet.java new file mode 100644 index 0000000..ff9d8fa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheet.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * 盘点单 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_sheet") +public class TakeStockSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 盘点任务ID + */ + private String planId; + + /** + * 预先盘点单ID + */ + private String preSheetId; + + /** + * 仓库ID + */ + private String scId; + + /** + * 状态 + */ + private TakeStockSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝理由 + */ + private String refuseReason; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheetDetail.java new file mode 100644 index 0000000..0e87e3d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheetDetail.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * 盘点单详情 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_sheet_detail") +public class TakeStockSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 盘点单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 盘点数量 + */ + private BigDecimal takeNum; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsOpLogType.java new file mode 100644 index 0000000..f732e90 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class LogisticsOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2000; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetDetailBizType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetDetailBizType.java new file mode 100644 index 0000000..9490d00 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetDetailBizType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum LogisticsSheetDetailBizType implements BaseEnum { + SALE_OUT_SHEET(1, "销售出库单"), RETAIL_OUT_SHEET(2, "零售出库单"); + + @EnumValue + private final Integer code; + + private final String desc; + + LogisticsSheetDetailBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetStatus.java new file mode 100644 index 0000000..d44e578 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum LogisticsSheetStatus implements BaseEnum { + CREATED(0, "待发货"), DELIVERY(3, "已发货"); + + @EnumValue + private final Integer code; + + private final String desc; + + LogisticsSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/OrderAddressOrderType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/OrderAddressOrderType.java new file mode 100644 index 0000000..4f401ae --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/OrderAddressOrderType.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum OrderAddressOrderType implements BaseEnum { + PURCHASE_ORDER(0, "采购订单"), RECEIVE_SHEET(1, "采购收货单"), PURCHASE_RETURN(2, "采购退单"), + SALE_ORDER(3, "采购订单"), OUT_SHEET(4, "销售出库单"), SALE_RETURN(5, "销售退单"), + RETAIL_OUT_SHEET(6, "零售出库单"), RETAIL_RETURN(7, "销售退单"); + + @EnumValue + private final Integer code; + + private final String desc; + + OrderAddressOrderType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PreTakeStockSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PreTakeStockSheetStatus.java new file mode 100644 index 0000000..72af33a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PreTakeStockSheetStatus.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum PreTakeStockSheetStatus implements BaseEnum { + FIRST_TAKE(0, "初盘"), SECOND_TAKE(1, "复盘"), RAND_TAKE(2, "抽盘"), + ; + + @EnumValue + private final Integer code; + + private final String desc; + + PreTakeStockSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ProductStockBizType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ProductStockBizType.java new file mode 100644 index 0000000..12259d0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ProductStockBizType.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum ProductStockBizType implements BaseEnum { + PURCHASE(1, "采购入库"), PURCHASE_RETURN(2, "采购退货出库"), SALE(3, "销售出库"), SALE_RETURN(4, + "销售退货入库"), RETAIL(5, + "零售出库"), RETAIL_RETURN(6, "零售退货入库"), TAKE_STOCK_IN(7, "盘点入库"), TAKE_STOCK_OUT(8, + "盘点出库"), STOCK_ADJUST(10, "库存调整"), SC_TRANSFER(11, "仓库调拨"); + + @EnumValue + private final Integer code; + + private final String desc; + + ProductStockBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOpLogType.java new file mode 100644 index 0000000..1a7c33b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class PurchaseOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2001; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOrderStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOrderStatus.java new file mode 100644 index 0000000..10071de --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOrderStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum PurchaseOrderStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + PurchaseOrderStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseReturnStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseReturnStatus.java new file mode 100644 index 0000000..5df4f5a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseReturnStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum PurchaseReturnStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + PurchaseReturnStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ReceiveSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ReceiveSheetStatus.java new file mode 100644 index 0000000..67dfa9e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ReceiveSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum ReceiveSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + ReceiveSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOpLogType.java new file mode 100644 index 0000000..65a1745 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class RetailOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2002; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOutSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOutSheetStatus.java new file mode 100644 index 0000000..fc5f085 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOutSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum RetailOutSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + RetailOutSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailReturnStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailReturnStatus.java new file mode 100644 index 0000000..1f27fef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailReturnStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum RetailReturnStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + RetailReturnStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOpLogType.java new file mode 100644 index 0000000..1628c5f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class SaleOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2003; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOrderStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOrderStatus.java new file mode 100644 index 0000000..e26f2a5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOrderStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SaleOrderStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + SaleOrderStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOutSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOutSheetStatus.java new file mode 100644 index 0000000..0ad804e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOutSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SaleOutSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + SaleOutSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleReturnStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleReturnStatus.java new file mode 100644 index 0000000..93b5b81 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleReturnStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SaleReturnStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + SaleReturnStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOpLogType.java new file mode 100644 index 0000000..8e6d394 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class ScTransferOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2005; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOrderStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOrderStatus.java new file mode 100644 index 0000000..c2f7da9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOrderStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum ScTransferOrderStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"), PART_RECEIVED(9, "部分收货"), RECEIVED(12, "已收货"); + + @EnumValue + private Integer code; + + private String desc; + + ScTransferOrderStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SettleStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SettleStatus.java new file mode 100644 index 0000000..8f33f08 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SettleStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleStatus implements BaseEnum { + UN_SETTLE(0, "未结算"), PART_SETTLE(1, "结算中"), SETTLED(3, "已结算"), UN_REQUIRE(6, "无需结算"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustOpLogType.java new file mode 100644 index 0000000..a606f71 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class StockAdjustOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2004; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetBizType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetBizType.java new file mode 100644 index 0000000..aec35e0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetBizType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum StockAdjustSheetBizType implements BaseEnum { + IN(0, "入库"), OUT(2, "出库"); + + @EnumValue + private Integer code; + + private String desc; + + StockAdjustSheetBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetStatus.java new file mode 100644 index 0000000..8234e3d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum StockAdjustSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + StockAdjustSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockWarningOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockWarningOpLogType.java new file mode 100644 index 0000000..4dcb721 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockWarningOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class StockWarningOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2007; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockOpLogType.java new file mode 100644 index 0000000..9261e16 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockOpLogType.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.sc.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class TakeStockOpLogType implements OpLogType { + + @Override + public Integer getCode() { + return 2006; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanStatus.java new file mode 100644 index 0000000..54eba6d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum TakeStockPlanStatus implements BaseEnum { + CREATED(0, "盘点任务生成"), DIFF_CREATED(6, "盘点差异生成"), FINISHED(9, "盘点完成"), CANCELED(12, "盘点已作废"); + + @EnumValue + private final Integer code; + + private final String desc; + + TakeStockPlanStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanType.java new file mode 100644 index 0000000..9d4f887 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum TakeStockPlanType implements BaseEnum { + ALL(0, "全场盘点"), SIMPLE(1, "单品盘点"), CATEGORY(2, "分类盘点"), BRAND(3, "品牌盘点"); + + @EnumValue + private final Integer code; + + private final String desc; + + TakeStockPlanType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockSheetStatus.java new file mode 100644 index 0000000..49064bd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum TakeStockSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + TakeStockSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/ApprovePassOrderEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/ApprovePassOrderEvent.java new file mode 100644 index 0000000..31315c9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/ApprovePassOrderEvent.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.events.order; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import lombok.Getter; +import org.springframework.context.ApplicationEvent; + +/** + * 业务单据审核通过Event + */ +public abstract class ApprovePassOrderEvent extends ApplicationEvent { + + @Getter + private ApprovePassOrderDto order; + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassOrderEvent(Object source, ApprovePassOrderDto order) { + + super(source); + this.order = order; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseOrderEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseOrderEvent.java new file mode 100644 index 0000000..7f875e4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseOrderEvent.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.events.order.impl; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto.OrderType; +import com.lframework.xingyun.sc.events.order.ApprovePassOrderEvent; + +public class ApprovePassPurchaseOrderEvent extends ApprovePassOrderEvent { + + public ApprovePassPurchaseOrderEvent(Object source, + ApprovePassOrderDto order) { + super(source, order); + order.setOrderType(OrderType.PURCHASE_ORDER); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseReturnEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseReturnEvent.java new file mode 100644 index 0000000..8023797 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassPurchaseReturnEvent.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.events.order.impl; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto.OrderType; +import com.lframework.xingyun.sc.events.order.ApprovePassOrderEvent; + +public class ApprovePassPurchaseReturnEvent extends ApprovePassOrderEvent { + + public ApprovePassPurchaseReturnEvent(Object source, + ApprovePassOrderDto order) { + super(source, order); + order.setOrderType(OrderType.PURCHASE_RETURN); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailOutSheetEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailOutSheetEvent.java new file mode 100644 index 0000000..88440a1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailOutSheetEvent.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.events.order.impl; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto.OrderType; +import com.lframework.xingyun.sc.events.order.ApprovePassOrderEvent; + +public class ApprovePassRetailOutSheetEvent extends ApprovePassOrderEvent { + + public ApprovePassRetailOutSheetEvent(Object source, + ApprovePassOrderDto order) { + super(source, order); + order.setOrderType(OrderType.RETAIL_OUT_SHEET); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailReturnEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailReturnEvent.java new file mode 100644 index 0000000..895a7a1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassRetailReturnEvent.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.events.order.impl; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto.OrderType; +import com.lframework.xingyun.sc.events.order.ApprovePassOrderEvent; + +public class ApprovePassRetailReturnEvent extends ApprovePassOrderEvent { + + public ApprovePassRetailReturnEvent(Object source, + ApprovePassOrderDto order) { + super(source, order); + order.setOrderType(OrderType.RETAIL_RETURN); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleOrderEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleOrderEvent.java new file mode 100644 index 0000000..9f22c9f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleOrderEvent.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.events.order.impl; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto.OrderType; +import com.lframework.xingyun.sc.events.order.ApprovePassOrderEvent; + +public class ApprovePassSaleOrderEvent extends ApprovePassOrderEvent { + + public ApprovePassSaleOrderEvent(Object source, + ApprovePassOrderDto order) { + super(source, order); + order.setOrderType(OrderType.SALE_ORDER); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleReturnEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleReturnEvent.java new file mode 100644 index 0000000..fd6c36a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/order/impl/ApprovePassSaleReturnEvent.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.events.order.impl; + +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto.OrderType; +import com.lframework.xingyun.sc.events.order.ApprovePassOrderEvent; + +public class ApprovePassSaleReturnEvent extends ApprovePassOrderEvent { + + public ApprovePassSaleReturnEvent(Object source, + ApprovePassOrderDto order) { + super(source, order); + order.setOrderType(OrderType.SALE_RETURN); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/AddStockEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/AddStockEvent.java new file mode 100644 index 0000000..fac398d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/AddStockEvent.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.events.stock; + +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import org.springframework.context.ApplicationEvent; + +/** + * 入库事件 + */ +public class AddStockEvent extends ApplicationEvent { + + /** + * 变动记录 + */ + private ProductStockChangeDto change; + + public AddStockEvent(Object source, ProductStockChangeDto change) { + + super(source); + this.change = change; + } + + public ProductStockChangeDto getChange() { + + return change; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/SubStockEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/SubStockEvent.java new file mode 100644 index 0000000..2dc06d4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/SubStockEvent.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.events.stock; + +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import org.springframework.context.ApplicationEvent; + +/** + * 出库事件 + */ +public class SubStockEvent extends ApplicationEvent { + + /** + * 变动记录 + */ + private ProductStockChangeDto change; + + public SubStockEvent(Object source, ProductStockChangeDto change) { + + super(source); + this.change = change; + } + + public ProductStockChangeDto getChange() { + + return change; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/take/DeleteTakeStockPlanEvent.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/take/DeleteTakeStockPlanEvent.java new file mode 100644 index 0000000..34bbf80 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/events/stock/take/DeleteTakeStockPlanEvent.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.events.stock.take; + +import org.springframework.context.ApplicationEvent; + +/** + * 删除盘点任务事件 + */ +public class DeleteTakeStockPlanEvent extends ApplicationEvent { + + /** + * 盘点任务ID + */ + private String id; + + public DeleteTakeStockPlanEvent(Object source, String id) { + + super(source); + + this.id = id; + } + + public String getId() { + + return id; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportListener.java new file mode 100644 index 0000000..9fc6947 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportListener.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.vo.logistics.DeliveryLogisticsSheetVo; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.util.List; + +@Slf4j +public class LogisticsSheetDeliveryImportListener extends + ExcelImportListener { + + @Override + protected void doInvoke(LogisticsSheetDeliveryImportModel data, AnalysisContext context) { + + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不能为空"); + } + + LogisticsSheetService logisticsSheetService = ApplicationUtil.getBean( + LogisticsSheetService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(LogisticsSheet.class) + .eq(LogisticsSheet::getCode, data.getCode()); + LogisticsSheet sheet = logisticsSheetService.getOne(queryWrapper); + if (sheet == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不存在"); + } + data.setId(sheet.getId()); + + if (data.getTotalAmount() != null) { + if (NumberUtil.lt(data.getTotalAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”最多允许2位小数"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + LogisticsSheetService logisticsSheetService = ApplicationUtil.getBean( + LogisticsSheetService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + LogisticsSheetDeliveryImportModel data = datas.get(i); + + DeliveryLogisticsSheetVo deliveryLogisticsSheetVo = new DeliveryLogisticsSheetVo(); + deliveryLogisticsSheetVo.setId(data.getId()); + deliveryLogisticsSheetVo.setLogisticsNo(data.getLogisticsNo()); + deliveryLogisticsSheetVo.setTotalAmount(data.getTotalAmount()); + + try { + logisticsSheetService.delivery(deliveryLogisticsSheetVo); + } catch (Exception e) { + throw new DefaultClientException( + "第" + (i + 1) + "行发货失败,失败原因:" + e.getMessage()); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportModel.java new file mode 100644 index 0000000..1e1d41b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportModel.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class LogisticsSheetDeliveryImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 单据号 + */ + @ExcelRequired + @ExcelProperty("单据号") + private String code; + + /** + * 物流单号 + */ + @ExcelProperty("物流单号") + private String logisticsNo; + + /** + * 物流费 + */ + @ExcelProperty("物流费(元)") + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportModel.java new file mode 100644 index 0000000..f8b1ab1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportModel.java @@ -0,0 +1,212 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class LogisticsSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("单号") + private String code; + + /** + * 物流单号 + */ + @ExcelProperty("物流单号") + private String logisticsNo; + + /** + * 物流公司 + */ + @ExcelProperty("物流公司") + private String logisticsCompanyName; + + /** + * 寄件人姓名 + */ + @ExcelProperty("寄件人姓名") + private String senderName; + + /** + * 寄件人联系电话 + */ + @ExcelProperty("寄件人联系电话") + private String senderTelephone; + + /** + * 寄件人省 + */ + @ExcelProperty("寄件人省") + private String senderProvinceName; + + /** + * 寄件人市 + */ + @ExcelProperty("寄件人市") + private String senderCityName; + + /** + * 寄件人区 + */ + @ExcelProperty("寄件人区") + private String senderDistrictName; + + /** + * 寄件人地址 + */ + @ExcelProperty("寄件人地址") + private String senderAddress; + + /** + * 收件人姓名 + */ + @ExcelProperty("收件人姓名") + private String receiverName; + + /** + * 收件人联系电话 + */ + @ExcelProperty("收件人联系电话") + private String receiverTelephone; + + /** + * 收件人省 + */ + @ExcelProperty("收件人省") + private String receiverProvinceName; + + /** + * 收件人市 + */ + @ExcelProperty("收件人市") + private String receiverCityName; + + /** + * 收件人区 + */ + @ExcelProperty("收件人区") + private String receiverDistrictName; + + /** + * 收件人地址 + */ + @ExcelProperty("收件人地址") + private String receiverAddress; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 总重量 + */ + @ExcelProperty("总重量(kg)") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @ExcelProperty("总体积(cm³)") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @ExcelProperty("物流费(元)") + private BigDecimal totalAmount; + + /** + * 创建人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 创建时间 + */ + @ExcelProperty("操作时间") + private Date createTime; + + /** + * 发货人 + */ + @ExcelProperty("发货人") + private String deliveryBy; + + /** + * 发货时间 + */ + @ExcelProperty("发货时间") + private Date deliveryTime; + + public LogisticsSheetExportModel() { + + } + + public LogisticsSheetExportModel(LogisticsSheet dto) { + + super(dto); + } + + @Override + protected void afterInit(LogisticsSheet dto) { + + LogisticsCompanyService logisticsCompanyService = ApplicationUtil.getBean( + LogisticsCompanyService.class); + LogisticsCompany logisticsCompany = logisticsCompanyService.findById( + dto.getLogisticsCompanyId()); + this.logisticsCompanyName = logisticsCompany.getName(); + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto senderProvince = dicCityService.findById(dto.getSenderProvinceId()); + this.senderProvinceName = senderProvince.getName(); + + DicCityDto senderCity = dicCityService.findById(dto.getSenderCityId()); + this.senderCityName = senderCity.getName(); + + DicCityDto senderDistrict = dicCityService.findById(dto.getSenderDistrictId()); + this.senderDistrictName = senderDistrict.getName(); + + DicCityDto receiverProvince = dicCityService.findById(dto.getReceiverProvinceId()); + this.receiverProvinceName = receiverProvince.getName(); + + DicCityDto receiverCity = dicCityService.findById(dto.getReceiverCityId()); + this.receiverCityName = receiverCity.getName(); + + DicCityDto receiverDistrict = dicCityService.findById(dto.getReceiverDistrictId()); + this.receiverDistrictName = receiverDistrict.getName(); + + this.status = dto.getStatus().getDesc(); + + if (StringUtil.isNotBlank(dto.getDeliveryBy())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser deliveryBy = userService.findById(dto.getDeliveryBy()); + this.deliveryBy = deliveryBy.getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportTaskWorker.java new file mode 100644 index 0000000..ee783f5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetVo; + +public class LogisticsSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryLogisticsSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryLogisticsSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryLogisticsSheetVo params) { + + LogisticsSheetService logisticsSheetService = ApplicationUtil.getBean( + LogisticsSheetService.class); + + return logisticsSheetService.query(pageIndex, pageSize, params); + } + + @Override + public LogisticsSheetExportModel exportData(LogisticsSheet data) { + return new LogisticsSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return LogisticsSheetExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportListener.java new file mode 100644 index 0000000..6e21611 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportListener.java @@ -0,0 +1,337 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.dto.dic.city.DicCityDto; +import com.lframework.starter.web.inner.service.DicCityService; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.vo.logistics.CreateLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetBizOrderVo; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +@Slf4j +public class LogisticsSheetImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(LogisticsSheetImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getSaleOutSheetCodes()) && StringUtil.isBlank( + data.getRetailOutSheetCodes())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + + "行“销售出库单号、零售出库单号”不能同时为空"); + } + + if (StringUtil.isNotBlank(data.getSaleOutSheetCodes())) { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + List arr = CollectionUtil.toList( + data.getSaleOutSheetCodes().split(StringPool.STR_SPLIT)); + Wrapper querySaleOutSheetWrapper = Wrappers.lambdaQuery(SaleOutSheet.class) + .in(SaleOutSheet::getCode, arr); + List saleOutSheets = saleOutSheetService.list(querySaleOutSheetWrapper); + if (saleOutSheets.size() != arr.size()) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售出库单号(" + arr.stream() + .filter(t -> !saleOutSheets.contains(t)) + .collect(Collectors.joining(StringPool.STR_SPLIT_CN)) + ")”不存在"); + } + + data.setSaleOutSheetIds(new HashMap<>()); + for (SaleOutSheet saleOutSheet : saleOutSheets) { + data.getSaleOutSheetIds().put(saleOutSheet.getId(), saleOutSheet.getCode()); + } + } + + if (StringUtil.isNotBlank(data.getRetailOutSheetCodes())) { + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + List arr = CollectionUtil.toList( + data.getRetailOutSheetCodes().split(StringPool.STR_SPLIT)); + Wrapper queryRetailOutSheetWrapper = Wrappers.lambdaQuery( + RetailOutSheet.class).in(RetailOutSheet::getCode, arr); + List retailOutSheets = retailOutSheetService.list(queryRetailOutSheetWrapper); + if (retailOutSheets.size() != arr.size()) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售出库单号(" + arr.stream() + .filter(t -> !retailOutSheets.contains(t)) + .collect(Collectors.joining(StringPool.STR_SPLIT_CN)) + ")”不存在"); + } + + data.setRetailOutSheetIds(new HashMap<>()); + for (RetailOutSheet retailOutSheet : retailOutSheets) { + data.getRetailOutSheetIds().put(retailOutSheet.getId(), retailOutSheet.getCode()); + } + } + + if (StringUtil.isBlank(data.getLogisticsCompanyCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流公司编号”不能为空"); + } + LogisticsCompanyService logisticsCompanyService = ApplicationUtil.getBean( + LogisticsCompanyService.class); + Wrapper queryLogisticsCompanyWrapper = Wrappers.lambdaQuery( + LogisticsCompany.class).eq(LogisticsCompany::getCode, data.getLogisticsCompanyCode()); + LogisticsCompany logisticsCompany = logisticsCompanyService.getOne( + queryLogisticsCompanyWrapper); + if (logisticsCompany == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流公司编号”不存在"); + } + data.setLogisticsCompanyId(logisticsCompany.getId()); + + if (StringUtil.isBlank(data.getSenderName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人姓名”不能为空"); + } + if (StringUtil.isBlank(data.getSenderTelephone())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人联系电话”不能为空"); + } + if (StringUtil.isBlank(data.getSenderProvinceName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人省”不能为空"); + } + if (StringUtil.isBlank(data.getSenderCityName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人市”不能为空"); + } + if (StringUtil.isBlank(data.getSenderDistrictName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人区”不能为空"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto senderProvince = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName() + .equals(data.getSenderProvinceName())) + .findFirst().orElse(null); + if (senderProvince == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人省”不存在"); + } + data.setSenderProvinceId(senderProvince.getId()); + + DicCityDto senderCity = allCitys.stream() + .filter(t -> senderProvince.getId().equals(t.getParentId()) && t.getName() + .equals(data.getSenderCityName())) + .findFirst().orElse(null); + if (senderCity == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人市”不存在"); + } + data.setSenderCityId(senderCity.getId()); + + DicCityDto senderDistrict = allCitys.stream() + .filter(t -> senderCity.getId().equals(t.getParentId()) && t.getName() + .equals(data.getSenderDistrictName())) + .findFirst().orElse(null); + if (senderDistrict == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人区”错误不存在"); + } + data.setSenderDistrictId(senderDistrict.getId()); + + if (StringUtil.isBlank(data.getSenderAddress())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人地址”不能为空"); + } + + if (StringUtil.isBlank(data.getReceiverName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人姓名”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverTelephone())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人联系电话”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverProvinceName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人省”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverCityName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人市”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverDistrictName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人区”不能为空"); + } + + DicCityDto receiverProvince = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName() + .equals(data.getReceiverProvinceName())) + .findFirst().orElse(null); + if (receiverProvince == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人省”不存在"); + } + data.setReceiverProvinceId(receiverProvince.getId()); + + DicCityDto receiverCity = allCitys.stream() + .filter(t -> receiverProvince.getId().equals(t.getParentId()) && t.getName() + .equals(data.getReceiverCityName())) + .findFirst().orElse(null); + if (receiverCity == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人市”不存在"); + } + data.setReceiverCityId(receiverCity.getId()); + + DicCityDto receiverDistrict = allCitys.stream() + .filter(t -> receiverCity.getId().equals(t.getParentId()) && t.getName() + .equals(data.getReceiverDistrictName())) + .findFirst().orElse(null); + if (receiverDistrict == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人区”错误不存在"); + } + data.setReceiverDistrictId(receiverDistrict.getId()); + + if (StringUtil.isBlank(data.getReceiverAddress())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人地址”不能为空"); + } + if (data.getTotalWeight() != null) { + if (NumberUtil.lt(data.getTotalWeight(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总重量”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalWeight(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总重量”最多允许2位小数"); + } + } + + if (data.getTotalVolume() != null) { + if (NumberUtil.lt(data.getTotalVolume(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总体积”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalVolume(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总体积”最多允许2位小数"); + } + } + + if (data.getTotalAmount() != null) { + if (NumberUtil.lt(data.getTotalAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”最多允许2位小数"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + LogisticsSheetService logisticsSheetService = ApplicationUtil.getBean( + LogisticsSheetService.class); + + LogisticsSheetDetailService logisticsSheetDetailService = ApplicationUtil.getBean( + LogisticsSheetDetailService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + LogisticsSheetImportModel data = datas.get(i); + if (CollectionUtil.isNotEmpty(data.getSaleOutSheetIds())) { + for (Entry entry : data.getSaleOutSheetIds().entrySet()) { + if (logisticsSheetDetailService.getByBizId(entry.getKey(), + LogisticsSheetDetailBizType.SALE_OUT_SHEET) != null) { + throw new DefaultClientException( + "销售出库单【" + entry.getValue() + "】已关联物流单,不允许再次关联物流单"); + } + } + } + + if (CollectionUtil.isNotEmpty(data.getRetailOutSheetIds())) { + for (Entry entry : data.getRetailOutSheetIds().entrySet()) { + if (logisticsSheetDetailService.getByBizId(entry.getKey(), + LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) != null) { + throw new DefaultClientException( + "零售出库单【" + entry.getValue() + "】已关联物流单,不允许再次关联物流单"); + } + } + } + + CreateLogisticsSheetVo createLogisticsSheetVo = new CreateLogisticsSheetVo(); + createLogisticsSheetVo.setLogisticsNo(data.getLogisticsNo()); + createLogisticsSheetVo.setLogisticsCompanyId(data.getLogisticsCompanyId()); + createLogisticsSheetVo.setSenderName(data.getSenderName()); + createLogisticsSheetVo.setSenderTelephone(data.getSenderTelephone()); + createLogisticsSheetVo.setSenderProvinceId(data.getSenderProvinceId()); + createLogisticsSheetVo.setSenderCityId(data.getSenderCityId()); + createLogisticsSheetVo.setSenderDistrictId(data.getSenderDistrictId()); + createLogisticsSheetVo.setSenderAddress(data.getSenderAddress()); + createLogisticsSheetVo.setReceiverName(data.getReceiverName()); + createLogisticsSheetVo.setReceiverTelephone(data.getReceiverTelephone()); + createLogisticsSheetVo.setReceiverProvinceId(data.getReceiverProvinceId()); + createLogisticsSheetVo.setReceiverCityId(data.getReceiverCityId()); + createLogisticsSheetVo.setReceiverDistrictId(data.getReceiverDistrictId()); + createLogisticsSheetVo.setReceiverAddress(data.getReceiverAddress()); + createLogisticsSheetVo.setTotalWeight(data.getTotalWeight()); + createLogisticsSheetVo.setTotalVolume(data.getTotalVolume()); + createLogisticsSheetVo.setTotalAmount(data.getTotalAmount()); + createLogisticsSheetVo.setDescription(data.getDescription()); + createLogisticsSheetVo.setBizOrders(new ArrayList<>()); + if (CollectionUtil.isNotEmpty(data.getSaleOutSheetIds())) { + for (Entry entry : data.getSaleOutSheetIds().entrySet()) { + LogisticsSheetBizOrderVo bizOrderVo = new LogisticsSheetBizOrderVo(); + bizOrderVo.setBizId(entry.getKey()); + bizOrderVo.setBizType(LogisticsSheetDetailBizType.SALE_OUT_SHEET.getCode()); + createLogisticsSheetVo.getBizOrders().add(bizOrderVo); + } + } + + if (CollectionUtil.isNotEmpty(data.getRetailOutSheetIds())) { + for (Entry entry : data.getRetailOutSheetIds().entrySet()) { + LogisticsSheetBizOrderVo bizOrderVo = new LogisticsSheetBizOrderVo(); + bizOrderVo.setBizId(entry.getKey()); + bizOrderVo.setBizType(LogisticsSheetDetailBizType.RETAIL_OUT_SHEET.getCode()); + createLogisticsSheetVo.getBizOrders().add(bizOrderVo); + } + } + + try { + logisticsSheetService.create(createLogisticsSheetVo); + } catch (Exception e) { + throw new DefaultClientException( + "第" + (i + 1) + "行新增失败,失败原因:" + e.getMessage()); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportModel.java new file mode 100644 index 0000000..3490e52 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportModel.java @@ -0,0 +1,201 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Map; + +@Data +public class LogisticsSheetImportModel implements ExcelModel { + + /** + * 物流单号 + */ + @ExcelProperty("物流单号") + private String logisticsNo; + + /** + * 销售出库单ID + */ + @ExcelIgnore + private Map saleOutSheetIds; + + /** + * 销售出库单号 + */ + @ExcelProperty("销售出库单号,多个用,分隔") + private String saleOutSheetCodes; + + /** + * 零售出库单ID + */ + @ExcelIgnore + private Map retailOutSheetIds; + + /** + * 零售出库单号 + */ + @ExcelProperty("零售出库单号,多个用,分隔") + private String retailOutSheetCodes; + + /** + * 物流公司ID + */ + @ExcelIgnore + private String logisticsCompanyId; + + /** + * 物流公司编号 + */ + @ExcelRequired + @ExcelProperty("物流公司编号") + private String logisticsCompanyCode; + + /** + * 寄件人姓名 + */ + @ExcelRequired + @ExcelProperty("寄件人姓名") + private String senderName; + + /** + * 寄件人联系电话 + */ + @ExcelRequired + @ExcelProperty("寄件人联系电话") + private String senderTelephone; + + /** + * 寄件人省ID + */ + @ExcelIgnore + private String senderProvinceId; + + /** + * 寄件人省 + */ + @ExcelRequired + @ExcelProperty("寄件人省") + private String senderProvinceName; + + /** + * 寄件人市ID + */ + @ExcelIgnore + private String senderCityId; + + /** + * 寄件人市 + */ + @ExcelRequired + @ExcelProperty("寄件人市") + private String senderCityName; + + /** + * 寄件人区ID + */ + @ExcelIgnore + private String senderDistrictId; + + /** + * 寄件人区 + */ + @ExcelRequired + @ExcelProperty("寄件人区") + private String senderDistrictName; + + /** + * 寄件人地址 + */ + @ExcelRequired + @ExcelProperty("寄件人地址") + private String senderAddress; + + /** + * 收件人姓名 + */ + @ExcelRequired + @ExcelProperty("收件人姓名") + private String receiverName; + + /** + * 收件人联系电话 + */ + @ExcelRequired + @ExcelProperty("收件人联系电话") + private String receiverTelephone; + + /** + * 收件人省ID + */ + @ExcelIgnore + private String receiverProvinceId; + + /** + * 收件人省 + */ + @ExcelRequired + @ExcelProperty("收件人省") + private String receiverProvinceName; + + /** + * 收件人市ID + */ + @ExcelIgnore + private String receiverCityId; + + /** + * 收件人市 + */ + @ExcelRequired + @ExcelProperty("收件人市") + private String receiverCityName; + + /** + * 收件人区ID + */ + @ExcelIgnore + private String receiverDistrictId; + + /** + * 收件人区 + */ + @ExcelRequired + @ExcelProperty("收件人区") + private String receiverDistrictName; + + /** + * 收件人地址 + */ + @ExcelRequired + @ExcelProperty("收件人地址") + private String receiverAddress; + + /** + * 总重量 + */ + @ExcelProperty("总重量(kg)") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @ExcelProperty("总体积(cm³)") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @ExcelProperty("物流费(元)") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportModel.java new file mode 100644 index 0000000..4bee806 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportModel.java @@ -0,0 +1,199 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class PurchaseOrderExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ExcelProperty("采购员") + private String purchaserName; + + /** + * 预计到货日期 + */ + @ExcelProperty("预计到货日期") + @DateTimeFormat(StringPool.DATE_PATTERN) + private Date expectArriveDate; + + /** + * 采购数量 + */ + @ExcelProperty("采购数量") + private BigDecimal purchaseNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 采购金额 + */ + @ExcelProperty("采购金额") + private BigDecimal purchaseAmount; + + /** + * 约定支付 + */ + @ExcelProperty("约定支付") + private String payTypeStr; + + /** + * 备注 + */ + @ExcelProperty("订单备注") + private String description; + + /** + * 创建人 + */ + @ExcelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ExcelProperty("创建时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 拒绝原因 + */ + @ExcelProperty("拒绝原因") + private String refuseReason; + + public PurchaseOrderExportModel() { + + } + + public PurchaseOrderExportModel(PurchaseOrder dto) { + + super(dto); + } + + @Override + public
BaseBo convert(PurchaseOrder dto) { + + return this; + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScName(sc.getName()); + this.setSupplierName(supplier.getName()); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + SysUser purchaser = userService.findById(dto.getPurchaserId()); + this.setPurchaserName(purchaser.getName()); + } + this.setExpectArriveDate(DateUtil.toDate(dto.getExpectArriveDate())); + this.setPurchaseNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setPurchaseAmount(dto.getTotalAmount()); + this.setDescription(dto.getDescription()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + + this.setStatus(dto.getStatus().getDesc()); + this.setRefuseReason(dto.getRefuseReason()); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportTaskWorker.java new file mode 100644 index 0000000..b749dc8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseOrderVo; + +public class PurchaseOrderExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryPurchaseOrderVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryPurchaseOrderVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryPurchaseOrderVo params) { + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + + return purchaseOrderService.query(pageIndex, pageSize, params); + } + + @Override + public PurchaseOrderExportModel exportData(PurchaseOrder data) { + return new PurchaseOrderExportModel(data); + } + + @Override + public Class getModelClass() { + return PurchaseOrderExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportListener.java new file mode 100644 index 0000000..d33e3ba --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportListener.java @@ -0,0 +1,178 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.purchase.CreatePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.PurchaseProductVo; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Slf4j +public class PurchaseOrderImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(PurchaseOrderImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getScCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不能为空"); + } else { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getScCode()); + StoreCenter sc = storeCenterService.getOne(queryWrapper); + if (sc == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不存在"); + } + + data.setScId(sc.getId()); + } + if (StringUtil.isBlank(data.getSupplierCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不能为空"); + } else { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getSupplierCode()); + Supplier supplier = supplierService.getOne(queryWrapper); + if (supplier == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“供应商编号”不存在"); + } + + data.setSupplierId(supplier.getId()); + } + if (!StringUtil.isBlank(data.getPurchaserCode())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser purchaser = userService.findByCode(data.getPurchaserCode()); + if (purchaser == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购员编号”不存在"); + } + data.setPurchaserId(purchaser.getId()); + } + if (data.getExpectArriveDate() == null) { + data.setExpectArriveDate(new Date()); + } + if (StringUtil.isBlank(data.getProductCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不能为空"); + } else { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getProductCode()); + Product product = productService.getOne(queryWrapper); + if (product == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不存在"); + } + data.setProductId(product.getId()); + } + + if (!"是".equals(data.getGift()) && !"否".equals(data.getGift())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否赠品”只能填“是”或“否”"); + } + + boolean isGift = "是".equals(data.getGift()); + if (!isGift) { + // 非赠品 + if (data.getPurchasePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”不能为空"); + } + if (NumberUtil.le(data.getPurchasePrice(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”必须大于0"); + } + if (!NumberUtil.isNumberPrecision(data.getPurchasePrice(), 6)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”最多允许6位小数"); + } + } else { + // 赠品 + data.setPurchasePrice(BigDecimal.ZERO); + } + if (data.getPurchaseNum() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购数量”不能为空"); + } + if (NumberUtil.le(data.getPurchaseNum(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购数量”必须大于0"); + } + if (!NumberUtil.isNumberPrecision(data.getPurchaseNum(), 8)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购数量”最多允许8位小数"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据仓库、供应商、采购员、预计到货日期 分组 + Map> groupByMap = this.getDatas().stream().collect( + Collectors.groupingBy( + t -> t.getScCode() + "_" + t.getSupplierCode() + "_" + t.getPurchaserCode() + "_" + + DateUtil.toLocalDate(t.getExpectArriveDate()))); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + + int index = 0; + for (List value : groupByMap.values()) { + PurchaseOrderImportModel valueObj = value.get(0); + CreatePurchaseOrderVo createPurchaseOrderVo = new CreatePurchaseOrderVo(); + createPurchaseOrderVo.setScId(valueObj.getScId()); + createPurchaseOrderVo.setSupplierId(valueObj.getSupplierId()); + createPurchaseOrderVo.setPurchaserId(valueObj.getPurchaserId()); + createPurchaseOrderVo.setExpectArriveDate( + DateUtil.toLocalDate(valueObj.getExpectArriveDate())); + createPurchaseOrderVo.setDescription(valueObj.getDescription()); + + List products = new ArrayList<>(); + for (PurchaseOrderImportModel data : value) { + PurchaseProductVo purchaseProductVo = new PurchaseProductVo(); + purchaseProductVo.setProductId(data.getProductId()); + purchaseProductVo.setPurchasePrice(data.getPurchasePrice()); + purchaseProductVo.setPurchaseNum(data.getPurchaseNum()); + purchaseProductVo.setDescription(data.getDetailDescription()); + + products.add(purchaseProductVo); + + index++; + this.setSuccessProcessByIndex(index); + } + createPurchaseOrderVo.setProducts(products); + + purchaseOrderService.create(createPurchaseOrderVo); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportModel.java new file mode 100644 index 0000000..be65fa5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportModel.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class PurchaseOrderImportModel implements ExcelModel { + + /** + * 仓库ID + */ + @ExcelIgnore + private String scId; + + /** + * 仓库编号 + */ + @ExcelRequired + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 供应商ID + */ + @ExcelIgnore + private String supplierId; + + /** + * 供应商编号 + */ + @ExcelRequired + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 采购员ID + */ + @ExcelIgnore + private String purchaserId; + + /** + * 采购员编号 + */ + @ExcelProperty("采购员编号") + private String purchaserCode; + + /** + * 预计到货日期 + */ + @ExcelProperty("预计到货日期") + private Date expectArriveDate; + + /** + * 商品ID + */ + @ExcelIgnore + private String productId; + + /** + * 商品编号 + */ + @ExcelRequired + @ExcelProperty("商品编号") + private String productCode; + + /** + * 采购价 + */ + @ExcelRequired + @ExcelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 采购数量 + */ + @ExcelRequired + @ExcelProperty("采购数量") + private BigDecimal purchaseNum; + + /** + * 是否赠品 + */ + @ExcelRequired + @ExcelProperty("是否赠品") + private String gift; + + /** + * 单据明细备注 + */ + @ExcelProperty("单据明细备注") + private String detailDescription; + + /** + * 单据备注 + */ + @ExcelProperty("单据备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportListener.java new file mode 100644 index 0000000..a81e7e4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportListener.java @@ -0,0 +1,144 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +@Slf4j +public class PurchaseOrderPayTypeImportListener extends + ExcelImportListener { + + @Override + protected void doInvoke(PurchaseOrderPayTypeImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不能为空"); + } + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean(PurchaseOrderService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(PurchaseOrder.class) + .eq(PurchaseOrder::getCode, data.getCode()); + PurchaseOrder order = purchaseOrderService.getOne(queryWrapper); + if (order == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不存在"); + } + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“单据号”的状态为“" + + PurchaseOrderStatus.APPROVE_PASS.getDesc() + "”,不允许导入支付方式"); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean( + OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”已关联支付方式,不允许重复导入"); + } + data.setId(order.getId()); + data.setTotalAmount(order.getTotalAmount()); + + if (StringUtil.isBlank(data.getPayTypeCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不能为空"); + } + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + Wrapper queryPayTypeWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, data.getPayTypeCode()); + PayType payType = payTypeService.getOne(queryPayTypeWrapper); + if (payType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不存在"); + } + + data.setPayTypeId(payType.getId()); + + if (data.getPayAmount() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”不能为空"); + } + + if (NumberUtil.le(data.getPayAmount(), BigDecimal.ZERO)) { + // 如果 <= 0 + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”必须大于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getPayAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”最多允许2位小数"); + } + + if (payType.getRecText()) { + if (StringUtil.isBlank(data.getText())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付内容”不能为空"); + } + } else { + data.setText(null); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据ID 分组 + Map> groupByMap = this.getDatas().stream() + .collect( + Collectors.groupingBy(PurchaseOrderPayTypeImportModel::getId)); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean( + OrderPayTypeService.class); + + int index = 0; + for (Entry> entry : groupByMap.entrySet()) { + List value = entry.getValue(); + String id = entry.getKey(); + + BigDecimal totalAmount = value.stream().map(PurchaseOrderPayTypeImportModel::getPayAmount) + .reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, value.get(0).getTotalAmount())) { + throw new DefaultClientException( + "单据号:" + value.get(0).getCode() + "所有支付方式的支付金额不等于含税总金额,请检查"); + } + + orderPayTypeService.create(id, value.stream().map(t -> { + OrderPayTypeVo orderPayTypeVo = new OrderPayTypeVo(); + orderPayTypeVo.setId(t.getPayTypeId()); + orderPayTypeVo.setPayAmount(t.getPayAmount()); + orderPayTypeVo.setText(t.getText()); + + return orderPayTypeVo; + }).collect(Collectors.toList())); + + index++; + this.setSuccessProcessByIndex(index); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportModel.java new file mode 100644 index 0000000..9532809 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportModel.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class PurchaseOrderPayTypeImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 单据号 + */ + @ExcelRequired + @ExcelProperty("单据号") + private String code; + + /** + * 支付方式ID + */ + @ExcelIgnore + private String payTypeId; + + /** + * 支付方式编号 + */ + @ExcelRequired + @ExcelProperty("支付方式编号") + private String payTypeCode; + + /** + * 支付金额 + */ + @ExcelRequired + @ExcelProperty("支付金额") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @ExcelProperty("支付内容") + private String text; + + /** + * 单据总金额 + */ + @ExcelIgnore + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportModel.java new file mode 100644 index 0000000..bd31ffa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportModel.java @@ -0,0 +1,200 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class ReceiveSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ExcelProperty("采购员") + private String purchaserName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private BigDecimal receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 实际到货日期 + */ + @ExcelProperty("实际到货日期") + @DateTimeFormat(StringPool.DATE_PATTERN) + private Date receiveDate; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 采购订单号 + */ + @ExcelProperty("采购订单号") + private String purchaseOrderCode; + + public ReceiveSheetExportModel() { + + } + + public ReceiveSheetExportModel(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return this; + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser purchaser = null; + if (!StringUtil.isBlank(dto.getPurchaserId())) { + purchaser = userService.findById(dto.getPurchaserId()); + } + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setPurchaserName(purchaser == null ? null : purchaser.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setReceiveDate(DateUtil.toDate(dto.getReceiveDate())); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.setPurchaseOrderCode(purchaseOrder.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportTaskWorker.java new file mode 100644 index 0000000..dc076aa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetVo; + +public class ReceiveSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryReceiveSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryReceiveSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryReceiveSheetVo params) { + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean( + ReceiveSheetService.class); + + return receiveSheetService.query(pageIndex, pageSize, params); + } + + @Override + public ReceiveSheetExportModel exportData(ReceiveSheet data) { + return new ReceiveSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return ReceiveSheetExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportListener.java new file mode 100644 index 0000000..b81828c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportListener.java @@ -0,0 +1,184 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.purchase.receive.CreateReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveProductVo; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Slf4j +public class ReceiveSheetImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(ReceiveSheetImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getScCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不能为空"); + } else { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getScCode()); + StoreCenter sc = storeCenterService.getOne(queryWrapper); + if (sc == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不存在"); + } + + data.setScId(sc.getId()); + } + if (StringUtil.isBlank(data.getSupplierCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“供应商编号”不能为空"); + } else { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getSupplierCode()); + Supplier supplier = supplierService.getOne(queryWrapper); + if (supplier == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“供应商编号”不存在"); + } + + data.setSupplierId(supplier.getId()); + } + if (!StringUtil.isBlank(data.getPurchaserCode())) { + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser purchaser = userService.findByCode(data.getPurchaserCode()); + if (purchaser == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购员编号”不存在"); + } + data.setPurchaserId(purchaser.getId()); + } + if (data.getPaymentDate() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“付款日期”不存在"); + } + if (data.getReceiveDate() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实际到货日期”不存在"); + } + if (StringUtil.isBlank(data.getProductCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不能为空"); + } else { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getProductCode()); + Product product = productService.getOne(queryWrapper); + if (product == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不存在"); + } + data.setProductId(product.getId()); + } + + if (!"是".equals(data.getGift()) && !"否".equals(data.getGift())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否赠品”只能填“是”或“否”"); + } + + boolean isGift = "是".equals(data.getGift()); + if (!isGift) { + // 非赠品 + if (data.getPurchasePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”不能为空"); + } + if (NumberUtil.le(data.getPurchasePrice(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”必须大于0"); + } + if (!NumberUtil.isNumberPrecision(data.getPurchasePrice(), 6)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”最多允许6位小数"); + } + } else { + // 赠品 + data.setPurchasePrice(BigDecimal.ZERO); + } + if (data.getReceiveNum() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收货数量”不能为空"); + } + if (NumberUtil.le(data.getReceiveNum(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收货数量”必须大于0"); + } + if (!NumberUtil.isNumberPrecision(data.getReceiveNum(), 8)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收货数量”最多允许8位小数"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据仓库、供应商、采购员、预计到货日期 分组 + Map> groupByMap = this.getDatas().stream().collect( + Collectors.groupingBy( + t -> t.getScCode() + "_" + t.getSupplierCode() + "_" + t.getPurchaserCode() + "_" + + DateUtil.toLocalDate(t.getPaymentDate()) + "_" + DateUtil.toLocalDate( + t.getReceiveDate()))); + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + + int index = 0; + for (List value : groupByMap.values()) { + ReceiveSheetImportModel valueObj = value.get(0); + CreateReceiveSheetVo createReceiveSheetVo = new CreateReceiveSheetVo(); + createReceiveSheetVo.setScId(valueObj.getScId()); + createReceiveSheetVo.setSupplierId(valueObj.getSupplierId()); + createReceiveSheetVo.setPurchaserId(valueObj.getPurchaserId()); + createReceiveSheetVo.setPaymentDate(DateUtil.toLocalDate(valueObj.getPaymentDate())); + createReceiveSheetVo.setAllowModifyPaymentDate(Boolean.TRUE); + createReceiveSheetVo.setReceiveDate(DateUtil.toLocalDate(valueObj.getReceiveDate())); + createReceiveSheetVo.setDescription(valueObj.getDescription()); + createReceiveSheetVo.setRequired(Boolean.FALSE); + + List products = new ArrayList<>(); + for (ReceiveSheetImportModel data : value) { + ReceiveProductVo purchaseProductVo = new ReceiveProductVo(); + purchaseProductVo.setProductId(data.getProductId()); + purchaseProductVo.setPurchasePrice(data.getPurchasePrice()); + purchaseProductVo.setReceiveNum(data.getReceiveNum()); + purchaseProductVo.setDescription(data.getDetailDescription()); + + products.add(purchaseProductVo); + + index++; + this.setSuccessProcessByIndex(index); + } + createReceiveSheetVo.setProducts(products); + + receiveSheetService.create(createReceiveSheetVo); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportModel.java new file mode 100644 index 0000000..3a2dd99 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportModel.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class ReceiveSheetImportModel implements ExcelModel { + + /** + * 仓库ID + */ + @ExcelIgnore + private String scId; + + /** + * 仓库编号 + */ + @ExcelRequired + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 供应商ID + */ + @ExcelIgnore + private String supplierId; + + /** + * 供应商编号 + */ + @ExcelRequired + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 采购员ID + */ + @ExcelIgnore + private String purchaserId; + + /** + * 采购员编号 + */ + @ExcelProperty("采购员编号") + private String purchaserCode; + + /** + * 付款日期 + */ + @ExcelRequired + @ExcelProperty("付款日期") + private Date paymentDate; + + /** + * 实际到货日期 + */ + @ExcelRequired + @ExcelProperty("实际到货日期") + private Date receiveDate; + + /** + * 商品ID + */ + @ExcelIgnore + private String productId; + + /** + * 商品编号 + */ + @ExcelRequired + @ExcelProperty("商品编号") + private String productCode; + + /** + * 采购价 + */ + @ExcelRequired + @ExcelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 收货数量 + */ + @ExcelRequired + @ExcelProperty("收货数量") + private BigDecimal receiveNum; + + /** + * 是否赠品 + */ + @ExcelRequired + @ExcelProperty("是否赠品") + private String gift; + + /** + * 单据明细备注 + */ + @ExcelProperty("单据明细备注") + private String detailDescription; + + /** + * 单据备注 + */ + @ExcelProperty("单据备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportListener.java new file mode 100644 index 0000000..883f056 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportListener.java @@ -0,0 +1,134 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +@Slf4j +public class ReceiveSheetPayTypeImportListener extends + ExcelImportListener { + + @Override + protected void doInvoke(ReceiveSheetPayTypeImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不能为空"); + } + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(ReceiveSheet.class) + .eq(ReceiveSheet::getCode, data.getCode()); + ReceiveSheet order = receiveSheetService.getOne(queryWrapper); + if (order == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不存在"); + } + if (order.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“单据号”的状态为“" + + ReceiveSheetStatus.APPROVE_PASS.getDesc() + "”,不允许导入支付方式"); + } + data.setId(order.getId()); + data.setTotalAmount(order.getTotalAmount()); + + if (StringUtil.isBlank(data.getPayTypeCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不能为空"); + } + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + Wrapper queryPayTypeWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, data.getPayTypeCode()); + PayType payType = payTypeService.getOne(queryPayTypeWrapper); + if (payType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不存在"); + } + + data.setPayTypeId(payType.getId()); + + if (data.getPayAmount() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”不能为空"); + } + + if (NumberUtil.le(data.getPayAmount(), BigDecimal.ZERO)) { + // 如果 <= 0 + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”必须大于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getPayAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”最多允许2位小数"); + } + + if (payType.getRecText()) { + if (StringUtil.isBlank(data.getText())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付内容”不能为空"); + } + } else { + data.setText(null); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据ID 分组 + Map> groupByMap = this.getDatas().stream() + .collect( + Collectors.groupingBy(ReceiveSheetPayTypeImportModel::getId)); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean( + OrderPayTypeService.class); + + int index = 0; + for (Entry> entry : groupByMap.entrySet()) { + List value = entry.getValue(); + String id = entry.getKey(); + + BigDecimal totalAmount = value.stream().map(ReceiveSheetPayTypeImportModel::getPayAmount) + .reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, value.get(0).getTotalAmount())) { + throw new DefaultClientException( + "单据号:" + value.get(0).getCode() + "所有支付方式的支付金额不等于含税总金额,请检查"); + } + + orderPayTypeService.create(id, value.stream().map(t -> { + OrderPayTypeVo orderPayTypeVo = new OrderPayTypeVo(); + orderPayTypeVo.setId(t.getPayTypeId()); + orderPayTypeVo.setPayAmount(t.getPayAmount()); + orderPayTypeVo.setText(t.getText()); + + return orderPayTypeVo; + }).collect(Collectors.toList())); + + index++; + this.setSuccessProcessByIndex(index); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportModel.java new file mode 100644 index 0000000..2f72e2f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportModel.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ReceiveSheetPayTypeImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 单据号 + */ + @ExcelRequired + @ExcelProperty("单据号") + private String code; + + /** + * 支付方式ID + */ + @ExcelIgnore + private String payTypeId; + + /** + * 支付方式编号 + */ + @ExcelRequired + @ExcelProperty("支付方式编号") + private String payTypeCode; + + /** + * 支付金额 + */ + @ExcelRequired + @ExcelProperty("支付金额") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @ExcelProperty("支付内容") + private String text; + + /** + * 单据总金额 + */ + @ExcelIgnore + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportModel.java new file mode 100644 index 0000000..413ea70 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportModel.java @@ -0,0 +1,191 @@ +package com.lframework.xingyun.sc.excel.purchase.returned; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class PurchaseReturnExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ExcelProperty("采购员") + private String purchaserName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private BigDecimal receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 采购收货单号 + */ + @ExcelProperty("采购收货单号") + private String receiveSheetCode; + + public PurchaseReturnExportModel() { + + } + + public PurchaseReturnExportModel(PurchaseReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturn dto) { + + return this; + } + + @Override + protected void afterInit(PurchaseReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser purchaser = null; + if (!StringUtil.isBlank(dto.getPurchaserId())) { + purchaser = userService.findById(dto.getPurchaserId()); + } + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setPurchaserName(purchaser == null ? null : purchaser.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.setReceiveSheetCode(receiveSheet.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportTaskWorker.java new file mode 100644 index 0000000..fd76882 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.purchase.returned; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import com.lframework.xingyun.sc.vo.purchase.returned.QueryPurchaseReturnVo; + +public class PurchaseReturnExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryPurchaseReturnVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryPurchaseReturnVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryPurchaseReturnVo params) { + + PurchaseReturnService purchaseReturnService = ApplicationUtil.getBean( + PurchaseReturnService.class); + + return purchaseReturnService.query(pageIndex, pageSize, params); + } + + @Override + public PurchaseReturnExportModel exportData(PurchaseReturn data) { + return new PurchaseReturnExportModel(data); + } + + @Override + public Class getModelClass() { + return PurchaseReturnExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportModel.java new file mode 100644 index 0000000..a7601d8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportModel.java @@ -0,0 +1,203 @@ +package com.lframework.xingyun.sc.excel.retail.out; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class RetailOutSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("会员编号") + private String memberCode; + + /** + * 客户名称 + */ + @ExcelProperty("会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ExcelProperty("支付方式") + private String payTypeStr; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private BigDecimal receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public RetailOutSheetExportModel() { + + } + + public RetailOutSheetExportModel(RetailOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheet dto) { + + return this; + } + + @Override + protected void afterInit(RetailOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = !StringUtil.isBlank(dto.getMemberId()) ? memberService.findById(dto.getMemberId()) : null; + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setMemberCode(member == null ? null : member.getCode()); + this.setMemberName(member == null ? null : member.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportTaskWorker.java new file mode 100644 index 0000000..39438c0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.retail.out; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetVo; + +public class RetailOutSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryRetailOutSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryRetailOutSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryRetailOutSheetVo params) { + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + + return retailOutSheetService.query(pageIndex, pageSize, params); + } + + @Override + public RetailOutSheetExportModel exportData(RetailOutSheet data) { + return new RetailOutSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return RetailOutSheetExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportModel.java new file mode 100644 index 0000000..6cbf616 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportModel.java @@ -0,0 +1,218 @@ +package com.lframework.xingyun.sc.excel.retail.returned; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class RetailReturnExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 会员编号 + */ + @ExcelProperty("会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @ExcelProperty("会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ExcelProperty("支付方式") + private String payTypeStr; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 零售出库单号 + */ + @ExcelProperty("零售出库单号") + private String outSheetCode; + + public RetailReturnExportModel() { + + } + + public RetailReturnExportModel(RetailReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturn dto) { + + return this; + } + + @Override + protected void afterInit(RetailReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = !StringUtil.isBlank(dto.getMemberId()) ? memberService.findById(dto.getMemberId()) : null; + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setMemberCode(member == null ? null : member.getCode()); + this.setMemberName(member == null ? null : member.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailOutSheet retailOutSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.setOutSheetCode(retailOutSheet.getCode()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportTaskWorker.java new file mode 100644 index 0000000..e406d64 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.retail.returned; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.service.retail.RetailReturnService; +import com.lframework.xingyun.sc.vo.retail.returned.QueryRetailReturnVo; + +public class RetailReturnExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryRetailReturnVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryRetailReturnVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryRetailReturnVo params) { + + RetailReturnService retailReturnService = ApplicationUtil.getBean( + RetailReturnService.class); + + return retailReturnService.query(pageIndex, pageSize, params); + } + + @Override + public RetailReturnExportModel exportData(RetailReturn data) { + return new RetailReturnExportModel(data); + } + + @Override + public Class getModelClass() { + return RetailReturnExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java new file mode 100644 index 0000000..26f12e2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java @@ -0,0 +1,197 @@ +package com.lframework.xingyun.sc.excel.sale; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class SaleOrderExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scOde; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ExcelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 约定支付 + */ + @ExcelProperty("约定支付") + private String payTypeStr; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SaleOrderExportModel() { + + } + + public SaleOrderExportModel(SaleOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrder dto) { + + return this; + } + + @Override + protected void afterInit(SaleOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = userService.findById(dto.getSalerId()); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScOde(sc.getCode()); + this.setScName(sc.getName()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + if (saler != null) { + this.setSalerName(saler.getName()); + } + this.setTotalNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setTotalAmount(dto.getTotalAmount()); + this.setDescription(dto.getDescription()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + + this.setStatus(dto.getStatus().getDesc()); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportTaskWorker.java new file mode 100644 index 0000000..96704bb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.sale; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderVo; + +public class SaleOrderExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySaleOrderVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySaleOrderVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QuerySaleOrderVo params) { + + SaleOrderService saleOrderService = ApplicationUtil.getBean( + SaleOrderService.class); + + return saleOrderService.query(pageIndex, pageSize, params); + } + + @Override + public SaleOrderExportModel exportData(SaleOrder data) { + return new SaleOrderExportModel(data); + } + + @Override + public Class getModelClass() { + return SaleOrderExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportModel.java new file mode 100644 index 0000000..03744b3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportModel.java @@ -0,0 +1,191 @@ +package com.lframework.xingyun.sc.excel.sale.out; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class SaleOutSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ExcelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private BigDecimal receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 采购订单号 + */ + @ExcelProperty("销售订单号") + private String purchaseOrderCode; + + public SaleOutSheetExportModel() { + + } + + public SaleOutSheetExportModel(SaleOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheet dto) { + + return this; + } + + @Override + protected void afterInit(SaleOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.setPurchaseOrderCode(saleOrder.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportTaskWorker.java new file mode 100644 index 0000000..de4b35f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.sale.out; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetVo; + +public class SaleOutSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySaleOutSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySaleOutSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QuerySaleOutSheetVo params) { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean( + SaleOutSheetService.class); + + return saleOutSheetService.query(pageIndex, pageSize, params); + } + + @Override + public SaleOutSheetExportModel exportData(SaleOutSheet data) { + return new SaleOutSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return SaleOutSheetExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportModel.java new file mode 100644 index 0000000..64a5271 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportModel.java @@ -0,0 +1,191 @@ +package com.lframework.xingyun.sc.excel.sale.returned; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class SaleReturnExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ExcelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private BigDecimal totalNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private BigDecimal giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 销售出库单号 + */ + @ExcelProperty("销售出库单号") + private String outSheetCode; + + public SaleReturnExportModel() { + + } + + public SaleReturnExportModel(SaleReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturn dto) { + + return this; + } + + @Override + protected void afterInit(SaleReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + SaleOutSheet saleOutSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.setOutSheetCode(saleOutSheet.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportTaskWorker.java new file mode 100644 index 0000000..231f880 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportTaskWorker.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.excel.sale.returned; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import com.lframework.xingyun.sc.vo.sale.returned.QuerySaleReturnVo; + +public class SaleReturnExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySaleReturnVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySaleReturnVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, QuerySaleReturnVo params) { + + SaleReturnService saleReturnService = ApplicationUtil.getBean(SaleReturnService.class); + + return saleReturnService.query(pageIndex, pageSize, params); + } + + @Override + public SaleReturnExportModel exportData(SaleReturn data) { + return new SaleReturnExportModel(data); + } + + @Override + public Class getModelClass() { + return SaleReturnExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportModel.java new file mode 100644 index 0000000..ba7baad --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportModel.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.sc.excel.stock; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStock; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ProductStockExportModel extends BaseBo implements ExcelModel { + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 商品编号 + */ + @ExcelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ExcelProperty("商品名称") + private String productName; + + /** + * 商品分类 + */ + @ExcelProperty("商品分类") + private String categoryName; + + /** + * 商品品牌 + */ + @ExcelProperty("商品品牌") + private String brandName; + + /** + * 库存数量 + */ + @ExcelProperty("库存数量") + private BigDecimal stockNum; + + /** + * 含税价格 + */ + @ExcelProperty("含税价格") + private BigDecimal taxPrice; + + /** + * 含税金额 + */ + @ExcelProperty("含税金额") + private BigDecimal taxAmount; + + public ProductStockExportModel() { + + } + + public ProductStockExportModel(ProductStock dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductStock dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ProductStock dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportTaskWorker.java new file mode 100644 index 0000000..efe6306 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportTaskWorker.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.excel.stock; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; + +public class ProductStockExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryProductStockVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryProductStockVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryProductStockVo params) { + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + + return productStockService.query(pageIndex, pageSize, params); + } + + @Override + public ProductStockExportModel exportData(ProductStock data) { + return new ProductStockExportModel(data); + } + + @Override + public Class getModelClass() { + return ProductStockExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportModel.java new file mode 100644 index 0000000..53c26df --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportModel.java @@ -0,0 +1,168 @@ +package com.lframework.xingyun.sc.excel.stock; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class ProductStockLogExportModel extends BaseBo implements ExcelModel { + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 商品编号 + */ + @ExcelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ExcelProperty("商品名称") + private String productName; + + /** + * 商品分类 + */ + @ExcelProperty("商品分类") + private String categoryName; + + /** + * 商品品牌 + */ + @ExcelProperty("商品品牌") + private String brandName; + + /** + * 原库存数量 + */ + @ExcelProperty("变动前库存数量") + private BigDecimal oriStockNum; + + /** + * 现库存数量 + */ + @ExcelProperty("变动后库存数量") + private BigDecimal curStockNum; + + /** + * 库存数量 + */ + @ExcelProperty("变动库存数量") + private BigDecimal stockNum; + + /** + * 原含税成本价 + */ + @ExcelProperty("变动前含税成本价") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @ExcelProperty("变动后含税成本价") + private BigDecimal curTaxPrice; + + /** + * 含税金额 + */ + @ExcelProperty("变动含税金额") + private BigDecimal taxAmount; + + /** + * 创建时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 创建人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ExcelProperty("业务类型") + private String bizType; + + public ProductStockLogExportModel() { + + } + + public ProductStockLogExportModel(ProductStockLog dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductStockLog dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ProductStockLog dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + if(StringUtil.isNotBlank(product.getBrandId())) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + this.brandName = productBrand.getName(); + } + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setBizCode(dto.getBizCode()); + this.setBizType(dto.getBizType().getDesc()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportTaskWorker.java new file mode 100644 index 0000000..80b707f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.stock; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.service.stock.ProductStockLogService; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; + +public class ProductStockLogExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryProductStockLogVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryProductStockLogVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryProductStockLogVo params) { + + ProductStockLogService productStockLogService = ApplicationUtil.getBean( + ProductStockLogService.class); + + return productStockLogService.query(pageIndex, pageSize, params); + } + + @Override + public ProductStockLogExportModel exportData(ProductStockLog data) { + return new ProductStockLogExportModel(data); + } + + @Override + public Class getModelClass() { + return ProductStockLogExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportModel.java new file mode 100644 index 0000000..d83e993 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportModel.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.sc.excel.stock.adjust; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetDetailService; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class StockAdjustSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 调整品种数 + */ + @ExcelProperty("调整品种数") + private Integer productNum; + + /** + * 库存调整数量 + */ + @ExcelProperty("库存调整数量") + private BigDecimal diffStockNum; + + /** + * 修改时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("操作时间") + private Date updateTime; + + /** + * 修改人 + */ + @ExcelProperty("操作人") + private String updateBy; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 审核时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("审核时间") + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public StockAdjustSheetExportModel(StockAdjustSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(StockAdjustSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(StockAdjustSheet dto) { + + this.status = dto.getStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + StockAdjustSheetDetailService stockAdjustSheetDetailService = ApplicationUtil.getBean( + StockAdjustSheetDetailService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class).eq(StockAdjustSheetDetail::getSheetId, dto.getId()) + .orderByAsc(StockAdjustSheetDetail::getOrderNo); + List details = stockAdjustSheetDetailService.list(queryWrapper); + this.productNum = details.size(); + this.diffStockNum = details.stream().map(StockAdjustSheetDetail::getStockNum).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportTaskWorker.java new file mode 100644 index 0000000..fc1fe9e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.stock.adjust; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetService; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustSheetVo; + +public class StockAdjustSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryStockAdjustSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryStockAdjustSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryStockAdjustSheetVo params) { + + StockAdjustSheetService stockAdjustSheetService = ApplicationUtil.getBean( + StockAdjustSheetService.class); + + return stockAdjustSheetService.query(pageIndex, pageSize, params); + } + + @Override + public StockAdjustSheetExportModel exportData(StockAdjustSheet data) { + return new StockAdjustSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return StockAdjustSheetExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportModel.java new file mode 100644 index 0000000..207b857 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportModel.java @@ -0,0 +1,147 @@ +package com.lframework.xingyun.sc.excel.stock.take.plan; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import lombok.Data; + +import java.util.Date; + +@Data +public class TakeStockPlanExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @ExcelProperty("盘点类别") + private String takeType; + + /** + * 业务名称 + */ + @ExcelProperty("业务名称") + private String bizName; + + /** + * 盘点状态 + */ + @ExcelProperty("盘点状态") + private String takeStatus; + + /** + * 创建时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("创建时间") + private Date createTime; + + /** + * 创建人 + */ + @ExcelProperty("创建人") + private String createBy; + + /** + * 操作时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("操作时间") + private Date updateTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String updateBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public TakeStockPlanExportModel(TakeStockPlan dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, TakeStockPlanExportModel::getTakeStatus, TakeStockPlanExportModel::getTakeType); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getDesc(); + this.takeStatus = dto.getTakeStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + String bizId = dto.getBizId(); + if (dto.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (dto.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportTaskWorker.java new file mode 100644 index 0000000..14acd2a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.stock.take.plan; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.vo.stock.take.plan.QueryTakeStockPlanVo; + +public class TakeStockPlanExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryTakeStockPlanVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryTakeStockPlanVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryTakeStockPlanVo params) { + + TakeStockPlanService takeStockPlanService = ApplicationUtil.getBean( + TakeStockPlanService.class); + + return takeStockPlanService.query(pageIndex, pageSize, params); + } + + @Override + public TakeStockPlanExportModel exportData(TakeStockPlan data) { + return new TakeStockPlanExportModel(data); + } + + @Override + public Class getModelClass() { + return TakeStockPlanExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportModel.java new file mode 100644 index 0000000..39014f1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportModel.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.excel.stock.take.pre; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import lombok.Data; + +import java.util.Date; + +@Data +public class PreTakeStockSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @ExcelProperty("盘点状态") + private String takeStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 操作时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("操作时间") + private Date updateTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String updateBy; + + public PreTakeStockSheetExportModel(PreTakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(PreTakeStockSheet dto) { + + return super.convert(dto, PreTakeStockSheetExportModel::getTakeStatus, + PreTakeStockSheetExportModel::getUpdateTime); + } + + @Override + protected void afterInit(PreTakeStockSheet dto) { + + this.takeStatus = dto.getTakeStatus().getDesc(); + + this.updateTime = DateUtil.toDate(dto.getUpdateTime()); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportTaskWorker.java new file mode 100644 index 0000000..33483aa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.stock.take.pre; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockSheetVo; + +public class PreTakeStockSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryPreTakeStockSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryPreTakeStockSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryPreTakeStockSheetVo params) { + + PreTakeStockSheetService preTakeStockSheetService = ApplicationUtil.getBean( + PreTakeStockSheetService.class); + + return preTakeStockSheetService.query(pageIndex, pageSize, params); + } + + @Override + public PreTakeStockSheetExportModel exportData(PreTakeStockSheet data) { + return new PreTakeStockSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return PreTakeStockSheetExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportModel.java new file mode 100644 index 0000000..09bfdec --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportModel.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.sc.excel.stock.take.sheet; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import lombok.Data; + +import java.util.Date; + +@Data +public class TakeStockSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 盘点任务号 + */ + @ExcelProperty("关联盘点任务") + private String planCode; + + /** + * 盘点任务-盘点状态 + */ + @ExcelProperty("盘点状态") + private String takeStatus; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 盘点任务-盘点类别 + */ + @ExcelProperty("盘点类别") + private String takeType; + + /** + * 状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 修改时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date updateTime; + + /** + * 修改人 + */ + @ExcelProperty("操作人") + private String updateBy; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public TakeStockSheetExportModel(TakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockSheet dto) { + + return super.convert(dto, TakeStockSheetExportModel::getTakeStatus, + TakeStockSheetExportModel::getStatus, + TakeStockSheetExportModel::getUpdateTime, TakeStockSheetExportModel::getApproveTime); + } + + @Override + protected void afterInit(TakeStockSheet dto) { + + this.status = dto.getStatus().getDesc(); + + TakeStockPlanService takeStockPlanService = ApplicationUtil.getBean(TakeStockPlanService.class); + TakeStockPlan takeStockPlan = takeStockPlanService.getById(dto.getPlanId()); + + this.planCode = takeStockPlan.getCode(); + this.takeStatus = takeStockPlan.getTakeStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.takeType = takeStockPlan.getTakeType().getDesc(); + + this.updateTime = DateUtil.toDate(dto.getUpdateTime()); + this.approveTime = DateUtil.toDate(dto.getApproveTime()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportTaskWorker.java new file mode 100644 index 0000000..f5530cf --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.stock.take.sheet; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetVo; + +public class TakeStockSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryTakeStockSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryTakeStockSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryTakeStockSheetVo params) { + + TakeStockSheetService takeStockSheetService = ApplicationUtil.getBean( + TakeStockSheetService.class); + + return takeStockSheetService.query(pageIndex, pageSize, params); + } + + @Override + public TakeStockSheetExportModel exportData(TakeStockSheet data) { + return new TakeStockSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return TakeStockSheetExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportModel.java new file mode 100644 index 0000000..bf9db56 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportModel.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.sc.excel.stock.transfer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class ScTransferOrderExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 转出仓库编号 + */ + @ExcelProperty("转出仓库编号") + private String sourceScCode; + + /** + * 转出仓库名称 + */ + @ExcelProperty("转出仓库名称") + private String sourceScName; + + /** + * 转入仓库编号 + */ + @ExcelProperty("转入仓库编号") + private String targetScCode; + + /** + * 转入仓库名称 + */ + @ExcelProperty("转入仓库名称") + private String targetScName; + + /** + * 调拨数量 + */ + @ExcelProperty("调拨数量") + private BigDecimal totalNum; + + /** + * 调拨成本金额 + */ + @ExcelProperty("调拨成本金额") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ExcelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ExcelProperty("修改时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date updateTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + public ScTransferOrderExportModel(ScTransferOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(ScTransferOrder dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ScTransferOrder dto) { + + this.status = dto.getStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sourceSc = storeCenterService.findById(dto.getSourceScId()); + this.sourceScCode = sourceSc.getCode(); + this.sourceScName = sourceSc.getName(); + + StoreCenter targetSc = storeCenterService.findById(dto.getTargetScId()); + this.targetScCode = targetSc.getCode(); + this.targetScName = targetSc.getName(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (dto.getStatus() != ScTransferOrderStatus.APPROVE_PASS + && dto.getStatus() != ScTransferOrderStatus.PART_RECEIVED + && dto.getStatus() != ScTransferOrderStatus.RECEIVED) { + this.totalAmount = null; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportTaskWorker.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportTaskWorker.java new file mode 100644 index 0000000..f235671 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.excel.stock.transfer; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderService; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferOrderVo; + +public class ScTransferOrderExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryScTransferOrderVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryScTransferOrderVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryScTransferOrderVo params) { + + ScTransferOrderService scTransferOrderService = ApplicationUtil.getBean( + ScTransferOrderService.class); + + return scTransferOrderService.query(pageIndex, pageSize, params); + } + + @Override + public ScTransferOrderExportModel exportData(ScTransferOrder data) { + return new ScTransferOrderExportModel(data); + } + + @Override + public Class getModelClass() { + return ScTransferOrderExportModel.class; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportListener.java new file mode 100644 index 0000000..fe0fc60 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportListener.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.sc.excel.stock.warning; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.components.excel.ExcelImportListener; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningService; +import com.lframework.xingyun.sc.vo.stock.warning.CreateProductStockWarningVo; +import com.lframework.xingyun.sc.vo.stock.warning.UpdateProductStockWarningVo; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class StockWarningImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(StockWarningImportModel data, AnalysisContext context) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + Wrapper queryScWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getScCode()); + StoreCenter sc = storeCenterService.getOne(queryScWrapper); + if (sc == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不存在"); + } + + data.setScId(sc.getId()); + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Wrapper queryProductWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getProductCode()); + Product product = productService.getOne(queryProductWrapper); + if (product == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不存在"); + } + data.setProductId(product.getId()); + + if (NumberUtil.le(data.getMinLimit(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“预警下限”不能小于0"); + } + + if (NumberUtil.le(data.getMaxLimit(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“预警上限”不能小于0"); + } + + if (NumberUtil.lt(data.getMaxLimit(), data.getMinLimit())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“预警上限”不能小于“预警下限”"); + } + + if (!NumberUtil.isNumberPrecision(data.getMinLimit(), 8)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“预警下限”最多允许8位小数"); + } + + if (!NumberUtil.isNumberPrecision(data.getMaxLimit(), 8)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“预警上限”最多允许8位小数"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ProductStockWarningService productStockWarningService = ApplicationUtil.getBean( + ProductStockWarningService.class); + + int index = 0; + for (StockWarningImportModel data : this.getDatas()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductStockWarning.class) + .eq(ProductStockWarning::getScId, data.getScId()) + .eq(ProductStockWarning::getProductId, data.getProductId()); + ProductStockWarning record = productStockWarningService.getOne(checkWrapper); + if (record == null) { + CreateProductStockWarningVo vo = new CreateProductStockWarningVo(); + vo.setScId(data.getScId()); + vo.setProductId(data.getProductId()); + vo.setMinLimit(data.getMinLimit()); + vo.setMaxLimit(data.getMaxLimit()); + + productStockWarningService.create(vo); + } else { + UpdateProductStockWarningVo vo = new UpdateProductStockWarningVo(); + vo.setId(record.getId()); + vo.setAvailable(record.getAvailable()); + vo.setScId(data.getScId()); + vo.setProductId(data.getProductId()); + vo.setMinLimit(data.getMinLimit()); + vo.setMaxLimit(data.getMaxLimit()); + + productStockWarningService.update(vo); + } + + index++; + this.setSuccessProcessByIndex(index); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportModel.java new file mode 100644 index 0000000..136c7a8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/warning/StockWarningImportModel.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.sc.excel.stock.warning; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.annotations.excel.ExcelRequired; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class StockWarningImportModel implements ExcelModel { + + /** + * 仓库ID + */ + @ExcelIgnore + private String scId; + + /** + * 仓库编号 + */ + @ExcelRequired + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 商品ID + */ + @ExcelIgnore + private String productId; + + /** + * 商品编号 + */ + @ExcelRequired + @ExcelProperty("商品编号") + private String productCode; + + /** + * 预警上限 + */ + @ExcelRequired + @ExcelProperty("预警上限") + private BigDecimal maxLimit; + + /** + * 预警下限 + */ + @ExcelRequired + @ExcelProperty("预警下限") + private BigDecimal minLimit; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetDetailServiceImpl.java new file mode 100644 index 0000000..03d5ae8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetDetailServiceImpl.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.sc.impl.logistics; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.mappers.LogisticsSheetDetailMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class LogisticsSheetDetailServiceImpl extends + BaseMpServiceImpl implements + LogisticsSheetDetailService { + + @Override + public LogisticsSheetDetail getByBizId(String bizId, LogisticsSheetDetailBizType bizType) { + Wrapper queryWrapper = Wrappers.lambdaQuery(LogisticsSheetDetail.class) + .eq(LogisticsSheetDetail::getBizId, bizId).eq(LogisticsSheetDetail::getBizType, bizType); + return this.getOne(queryWrapper); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetServiceImpl.java new file mode 100644 index 0000000..7da830a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetServiceImpl.java @@ -0,0 +1,270 @@ +package com.lframework.xingyun.sc.impl.logistics; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; +import com.lframework.xingyun.sc.enums.LogisticsOpLogType; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import com.lframework.xingyun.sc.mappers.LogisticsSheetMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.vo.logistics.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class LogisticsSheetServiceImpl extends + BaseMpServiceImpl implements LogisticsSheetService { + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private LogisticsSheetDetailService logisticsSheetDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryLogisticsSheetVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryLogisticsSheetVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + LogisticsSheetSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public LogisticsSheetFullDto getDetail(String id) { + LogisticsSheetFullDto sheet = getBaseMapper().getDetail(id); + if (sheet == null) { + throw new InputErrorException("物流单不存在!"); + } + + return sheet; + } + + @Override + public PageResult queryBizOrder(Integer pageIndex, Integer pageSize, + QueryLogisticsSheetBizOrderVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryBizOrder(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = LogisticsOpLogType.class, name = "创建物流单,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateLogisticsSheetVo vo) { + LogisticsSheet sheet = new LogisticsSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.LOGISTICS_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(LogisticsSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = LogisticsOpLogType.class, name = "修改物流单,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateLogisticsSheetVo vo) { + LogisticsSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("物流单不存在!"); + } + + if (sheet.getStatus() != LogisticsSheetStatus.CREATED) { + throw new DefaultClientException("物流单已发货,无法修改!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + LogisticsSheetDetail.class).eq(LogisticsSheetDetail::getSheetId, sheet.getId()); + logisticsSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(LogisticsSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(LogisticsSheetStatus.CREATED); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(LogisticsSheet.class) + .eq(LogisticsSheet::getId, sheet.getId()).in(LogisticsSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("物流单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = LogisticsOpLogType.class, name = "物流单发货,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public void delivery(DeliveryLogisticsSheetVo vo) { + + LogisticsSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("物流单不存在!"); + } + + if (sheet.getStatus() != LogisticsSheetStatus.CREATED) { + throw new DefaultClientException("物流单已发货,无法重复发货!"); + } + + List statusList = new ArrayList<>(); + statusList.add(LogisticsSheetStatus.CREATED); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(LogisticsSheet.class) + .set(LogisticsSheet::getDeliveryBy, SecurityUtil.getCurrentUser().getId()) + .set(LogisticsSheet::getDeliveryTime, LocalDateTime.now()) + .set(StringUtil.isNotBlank(vo.getLogisticsNo()), LogisticsSheet::getLogisticsNo, + vo.getLogisticsNo()) + .set(vo.getTotalAmount() != null, LogisticsSheet::getTotalAmount, vo.getTotalAmount()) + .set(LogisticsSheet::getStatus, LogisticsSheetStatus.DELIVERY) + .eq(LogisticsSheet::getId, sheet.getId()).in(LogisticsSheet::getStatus, statusList); + if (getBaseMapper().update(updateOrderWrapper) != 1) { + throw new DefaultClientException("物流单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = LogisticsOpLogType.class, name = "删除物流单,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + LogisticsSheet order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("物流单不存在!"); + } + + if (order.getStatus() != LogisticsSheetStatus.CREATED) { + throw new DefaultClientException("已发货的物流单不允许执行删除操作!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + LogisticsSheetDetail.class).eq(LogisticsSheetDetail::getSheetId, order.getId()); + logisticsSheetDetailService.remove(deleteDetailWrapper); + + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", order.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + LogisticsSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个物流单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + private void create(LogisticsSheet sheet, CreateLogisticsSheetVo vo) { + sheet.setLogisticsNo(vo.getLogisticsNo()); + sheet.setLogisticsCompanyId(vo.getLogisticsCompanyId()); + sheet.setSenderName(vo.getSenderName()); + sheet.setSenderTelephone(vo.getSenderTelephone()); + sheet.setSenderProvinceId(vo.getSenderProvinceId()); + sheet.setSenderCityId(vo.getSenderCityId()); + sheet.setSenderDistrictId(vo.getSenderDistrictId()); + sheet.setSenderAddress(vo.getSenderAddress()); + sheet.setReceiverName(vo.getReceiverName()); + sheet.setReceiverTelephone(vo.getReceiverTelephone()); + sheet.setReceiverProvinceId(vo.getReceiverProvinceId()); + sheet.setReceiverCityId(vo.getReceiverCityId()); + sheet.setReceiverDistrictId(vo.getReceiverDistrictId()); + sheet.setReceiverAddress(vo.getReceiverAddress()); + sheet.setTotalWeight(vo.getTotalWeight()); + sheet.setTotalVolume(vo.getTotalVolume()); + sheet.setTotalAmount(vo.getTotalAmount()); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + List details = vo.getBizOrders().stream().map(t -> { + LogisticsSheetDetail detail = new LogisticsSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(t.getBizId()); + detail.setBizType(EnumUtil.getByCode(LogisticsSheetDetailBizType.class, t.getBizType())); + + return detail; + }).collect(Collectors.toList()); + + logisticsSheetDetailService.saveBatch(details); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/paytype/OrderPayTypeServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/paytype/OrderPayTypeServiceImpl.java new file mode 100644 index 0000000..4bebfcb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/paytype/OrderPayTypeServiceImpl.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.impl.paytype; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.mappers.OrderPayTypeMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class OrderPayTypeServiceImpl extends + BaseMpServiceImpl implements OrderPayTypeService { + + @Transactional(rollbackFor = Exception.class) + @Override + public void create(String orderId, List data) { + Wrapper deleteOrderPayTypeWrapper = Wrappers.lambdaQuery(OrderPayType.class) + .eq(OrderPayType::getOrderId, orderId); + this.remove(deleteOrderPayTypeWrapper); + if (CollectionUtil.isNotEmpty(data)) { + List records = data.stream().map(payTypeVo -> { + OrderPayType orderPayType = new OrderPayType(); + orderPayType.setId(IdUtil.getId()); + orderPayType.setOrderId(orderId); + orderPayType.setPayTypeId(payTypeVo.getId()); + orderPayType.setPayAmount(payTypeVo.getPayAmount()); + if (StringUtil.isNotBlank(payTypeVo.getText())) { + orderPayType.setText(payTypeVo.getText()); + } + + return orderPayType; + }).collect(Collectors.toList()); + this.saveBatch(records); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByOrderId(String orderId) { + Wrapper deleteOrderPayTypeWrapper = Wrappers.lambdaQuery(OrderPayType.class) + .eq(OrderPayType::getOrderId, orderId); + this.remove(deleteOrderPayTypeWrapper); + } + + @Override + public List findByOrderId(String orderId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(OrderPayType.class) + .eq(OrderPayType::getOrderId, orderId); + return this.list(queryWrapper); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseConfigServiceImpl.java new file mode 100644 index 0000000..9f68392 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseConfigServiceImpl.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.bpm.entity.FlowDefinitionWrapper; +import com.lframework.starter.bpm.service.FlowDefinitionWrapperService; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.enums.PurchaseOpLogType; +import com.lframework.xingyun.sc.mappers.PurchaseConfigMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.vo.purchase.config.UpdatePurchaseConfigVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; + +@Service +public class PurchaseConfigServiceImpl extends + BaseMpServiceImpl + implements PurchaseConfigService { + + @Autowired + private FlowDefinitionWrapperService flowDefinitionWrapperService; + + @Cacheable(value = PurchaseConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public PurchaseConfig get() { + + PurchaseConfig config = getBaseMapper().selectOne(Wrappers.query()); + + return config; + } + + @OpLog(type = PurchaseOpLogType.class, name = "修改采购参数设置") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePurchaseConfigVo vo) { + + PurchaseConfig config = getBaseMapper().selectOne(Wrappers.query()); + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseConfig.class) + .eq(PurchaseConfig::getId, config.getId()) + .set(PurchaseConfig::getReceiveRequirePurchase, vo.getReceiveRequirePurchase()) + .set(PurchaseConfig::getReceiveMultipleRelatePurchase, + vo.getReceiveMultipleRelatePurchase()) + .set(PurchaseConfig::getPurchaseReturnRequireReceive, vo.getPurchaseReturnRequireReceive()) + .set(PurchaseConfig::getPurchaseReturnMultipleRelateReceive, + vo.getPurchaseReturnMultipleRelateReceive()) + .set(PurchaseConfig::getPurchaseRequireBpm, vo.getPurchaseRequireBpm()); + + if (vo.getPurchaseRequireBpm()) { + FlowDefinitionWrapper flowDefinition = flowDefinitionWrapperService.getById(vo.getPurchaseBpmProcessId()); + updateWrapper.set(PurchaseConfig::getPurchaseBpmProcessId, flowDefinition.getId()) + .set(PurchaseConfig::getPurchaseBpmProcessCode, flowDefinition.getFlowCode()); + } else { + updateWrapper.set(PurchaseConfig::getPurchaseBpmProcessId, null) + .set(PurchaseConfig::getPurchaseBpmProcessCode, null); + } + + this.update(updateWrapper); + + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = PurchaseConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleFormServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleFormServiceImpl.java new file mode 100644 index 0000000..9c04972 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleFormServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailBundleForm; +import com.lframework.xingyun.sc.mappers.PurchaseOrderDetailBundleFormMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailBundleFormService; +import org.springframework.stereotype.Service; + +@Service +public class PurchaseOrderDetailBundleFormServiceImpl extends + BaseMpServiceImpl + implements PurchaseOrderDetailBundleFormService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleServiceImpl.java new file mode 100644 index 0000000..4189a0c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailBundle; +import com.lframework.xingyun.sc.mappers.PurchaseOrderDetailBundleMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class PurchaseOrderDetailBundleServiceImpl extends + BaseMpServiceImpl + implements PurchaseOrderDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailFormServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailFormServiceImpl.java new file mode 100644 index 0000000..05e1514 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailFormServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailForm; +import com.lframework.xingyun.sc.mappers.PurchaseOrderDetailFormMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailFormService; +import org.springframework.stereotype.Service; + +@Service +public class PurchaseOrderDetailFormServiceImpl extends + BaseMpServiceImpl + implements PurchaseOrderDetailFormService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailServiceImpl.java new file mode 100644 index 0000000..ad6918e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailServiceImpl.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.mappers.PurchaseOrderDetailMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; + +@Service +public class PurchaseOrderDetailServiceImpl extends + BaseMpServiceImpl + implements PurchaseOrderDetailService { + + @Autowired + private ProductService productService; + + @Override + public List getByOrderId(String orderId) { + + return getBaseMapper().getByOrderId(orderId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReceiveNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + PurchaseOrderDetail orderDetail = getBaseMapper().selectById(id); + + BigDecimal remainNum = NumberUtil.sub(orderDetail.getOrderNum(), orderDetail.getReceiveNum()); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余收货数量为" + remainNum + + ",本次收货数量不允许大于" + + remainNum + "!"); + } + + if (getBaseMapper().addReceiveNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余收货数量不足,不允许继续收货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReceiveNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + PurchaseOrderDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReceiveNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已收货数量为" + orderDetail.getReceiveNum() + + ",本次取消收货数量不允许大于" + orderDetail.getReceiveNum() + "!"); + } + + if (getBaseMapper().subReceiveNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已收货数量不足,不允许取消收货!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderFormServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderFormServiceImpl.java new file mode 100644 index 0000000..5b9c72b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderFormServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PurchaseOrderForm; +import com.lframework.xingyun.sc.mappers.PurchaseOrderFormMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderFormService; +import org.springframework.stereotype.Service; + +@Service +public class PurchaseOrderFormServiceImpl extends + BaseMpServiceImpl implements + PurchaseOrderFormService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderServiceImpl.java new file mode 100644 index 0000000..1c67e50 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderServiceImpl.java @@ -0,0 +1,858 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.bpm.dto.FlowInstanceExtDto; +import com.lframework.starter.bpm.enums.FlowDefinitionExtBizType; +import com.lframework.starter.bpm.listeners.BpmBizListener; +import com.lframework.starter.bpm.service.FlowInstanceWrapperService; +import com.lframework.starter.bpm.transfers.FlowCuInstanceTransfer; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.*; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.*; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.bo.purchase.GetPurchaseOrderBo; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.PurchaseOpLogType; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import com.lframework.xingyun.sc.events.order.impl.ApprovePassPurchaseOrderEvent; +import com.lframework.xingyun.sc.mappers.PurchaseOrderMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.*; +import com.lframework.xingyun.sc.vo.purchase.*; +import lombok.extern.slf4j.Slf4j; +import org.dromara.warm.flow.core.dto.FlowParams; +import org.dromara.warm.flow.core.entity.Instance; +import org.dromara.warm.flow.core.listener.ListenerVariable; +import org.dromara.warm.flow.core.service.InsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class PurchaseOrderServiceImpl extends + BaseMpServiceImpl implements PurchaseOrderService { + + private static final String BPM_FLAG = "PurchaseOrder"; + + @Autowired + private PurchaseOrderDetailService purchaseOrderDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private SysUserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Autowired + private InsService insService; + + @Autowired + private PurchaseOrderFormService purchaseOrderFormService; + + @Autowired + private PurchaseOrderDetailFormService purchaseOrderDetailFormService; + + @Autowired + private FlowInstanceWrapperService flowInstanceWrapperService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private PurchaseOrderDetailBundleService purchaseOrderDetailBundleService; + + @Autowired + private PurchaseOrderDetailBundleFormService purchaseOrderDetailBundleFormService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryPurchaseOrderVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPurchaseOrderVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + PurchaseOrderSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public PurchaseOrderFullDto getDetail(String id, Boolean isForm) { + if (isForm == null) { + isForm = false; + } + + PurchaseOrderFullDto order = getBaseMapper().getDetail(id, isForm); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + return order; + } + + @Override + public PurchaseOrderWithReceiveDto getWithReceive(String id) { + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + PurchaseOrderWithReceiveDto order = getBaseMapper().getWithReceive(id, + purchaseConfig.getReceiveRequirePurchase()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + return order; + } + + @Override + public PageResult queryWithReceive(Integer pageIndex, Integer pageSize, + QueryPurchaseOrderWithReceiveVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReceive(vo, + purchaseConfig.getReceiveMultipleRelatePurchase()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = PurchaseOpLogType.class, name = "创建订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建订单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePurchaseOrderVo vo) { + + PurchaseConfig config = purchaseConfigService.get(); + + PurchaseOrder order = newOrder(config.getPurchaseRequireBpm()); + order.setId(IdUtil.getId()); + order.setCode(generateCodeService.generate(GenerateCodeTypePool.PURCHASE_ORDER)); + + this.create(order, vo, config.getPurchaseRequireBpm()); + + order.setStatus(PurchaseOrderStatus.CREATED); + + if (config.getPurchaseRequireBpm()) { + purchaseOrderFormService.save((PurchaseOrderForm) order); + Instance instance = this.startBpmInstance(config.getPurchaseBpmProcessCode(), order.getId()); + order.setFlowInstanceId(instance.getId()); + } else { + getBaseMapper().insert(order); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + return order.getId(); + } + + @OpLog(type = PurchaseOpLogType.class, name = "修改订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改订单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePurchaseOrderVo vo) { + + PurchaseOrder order = vo.getIsForm() ? purchaseOrderFormService.getById(vo.getId()) + : getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED + && order.getStatus() != PurchaseOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,无法修改!"); + } + + throw new DefaultClientException("订单无法修改!"); + } + + // 删除订单明细 + if (vo.getIsForm()) { + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetailForm.class).eq(PurchaseOrderDetailForm::getOrderId, order.getId()); + purchaseOrderDetailFormService.remove(deleteDetailWrapper); + } else { + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetail.class).eq(PurchaseOrderDetail::getOrderId, order.getId()); + purchaseOrderDetailService.remove(deleteDetailWrapper); + } + + this.create(order, vo, vo.getIsForm()); + + order.setStatus(PurchaseOrderStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseOrderStatus.CREATED); + statusList.add(PurchaseOrderStatus.APPROVE_REFUSE); + + if (vo.getIsForm()) { + PurchaseConfig config = purchaseConfigService.get(); + if (!config.getPurchaseRequireBpm()) { + throw new DefaultClientException("已关闭审批流程,无法重新发起该订单!"); + } + if (!flowInstanceWrapperService.canRestart(order.getId())) { + throw new DefaultClientException("订单不允许重新发起!"); + } + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrderForm.class).set(PurchaseOrderForm::getApproveBy, null) + .set(PurchaseOrderForm::getApproveTime, null) + .set(PurchaseOrderForm::getRefuseReason, StringPool.EMPTY_STR) + .eq(PurchaseOrderForm::getId, order.getId()).in(PurchaseOrderForm::getStatus, statusList); + + if (purchaseOrderFormService.updateAllColumn((PurchaseOrderForm) order, updateOrderWrapper)) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + Instance instance = this.startBpmInstance(config.getPurchaseBpmProcessCode(), order.getId()); + updateOrderWrapper = Wrappers.lambdaUpdate(PurchaseOrderForm.class) + .set(PurchaseOrderForm::getFlowInstanceId, instance.getId()) + .eq(PurchaseOrderForm::getId, order.getId()); + purchaseOrderFormService.update(updateOrderWrapper); + } else { + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrder.class).set(PurchaseOrder::getApproveBy, null) + .set(PurchaseOrder::getApproveTime, null) + .set(PurchaseOrder::getRefuseReason, StringPool.EMPTY_STR) + .eq(PurchaseOrder::getId, order.getId()).in(PurchaseOrder::getStatus, statusList); + + if (getBaseMapper().update(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = PurchaseOpLogType.class, name = "审核通过订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassPurchaseOrderVo vo) { + + PurchaseOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED + && order.getStatus() != PurchaseOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核通过!"); + } + + order.setStatus(PurchaseOrderStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseOrderStatus.CREATED); + statusList.add(PurchaseOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrder.class).set(PurchaseOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseOrder::getApproveTime, LocalDateTime.now()) + .eq(PurchaseOrder::getId, order.getId()).in(PurchaseOrder::getStatus, statusList); + + if (getBaseMapper().update(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(order.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有约定支付,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetail.class).eq(PurchaseOrderDetail::getOrderId, order.getId()) + .orderByAsc(PurchaseOrderDetail::getOrderNo); + List details = purchaseOrderDetailService.list(queryDetailWrapper); + + BigDecimal totalNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + + for (PurchaseOrderDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum()), 2)); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + if (isGift) { + giftNum = NumberUtil.add(giftNum, detail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, detail.getOrderNum()); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetailBundle.class) + .eq(PurchaseOrderDetailBundle::getOrderId, order.getId()) + .eq(PurchaseOrderDetailBundle::getDetailId, detail.getId()); + List purchaseOrderDetailBundles = purchaseOrderDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(purchaseOrderDetailBundles); + + for (PurchaseOrderDetailBundle purchaseOrderDetailBundle : purchaseOrderDetailBundles) { + PurchaseOrderDetail newDetail = new PurchaseOrderDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setOrderId(order.getId()); + newDetail.setProductId(purchaseOrderDetailBundle.getProductId()); + newDetail.setOrderNum(purchaseOrderDetailBundle.getProductOrderNum()); + newDetail.setTaxPrice(purchaseOrderDetailBundle.getProductTaxPrice()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(purchaseOrderDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(detail.getOrderNo()); + newDetail.setTaxAmount(purchaseOrderDetailBundle.getProductTaxAmount()); + + purchaseOrderDetailService.save(newDetail); + purchaseOrderDetailService.removeById(detail.getId()); + + purchaseOrderDetailBundle.setProductDetailId(newDetail.getId()); + purchaseOrderDetailBundleService.updateById(purchaseOrderDetailBundle); + + if (isGift) { + giftNum = NumberUtil.add(giftNum, newDetail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, newDetail.getOrderNum()); + } + } + } + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseOrder.class) + .set(PurchaseOrder::getTotalNum, totalNum).set(PurchaseOrder::getTotalGiftNum, giftNum) + .set(PurchaseOrder::getTotalAmount, totalAmount).eq(PurchaseOrder::getId, order.getId()); + this.update(updateWrapper); + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + this.sendApprovePassEvent(order); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Override + public String directApprovePass(CreatePurchaseOrderVo vo) { + + PurchaseOrderService thisService = getThis(this.getClass()); + + String orderId = thisService.create(vo); + + ApprovePassPurchaseOrderVo approvePassPurchaseOrderVo = new ApprovePassPurchaseOrderVo(); + approvePassPurchaseOrderVo.setId(orderId); + + thisService.approvePass(approvePassPurchaseOrderVo); + + return orderId; + } + + @OpLog(type = PurchaseOpLogType.class, name = "审核拒绝订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefusePurchaseOrderVo vo) { + + PurchaseOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_REFUSE) { + throw new DefaultClientException("订单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核拒绝!"); + } + + order.setStatus(PurchaseOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrder.class).set(PurchaseOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseOrder::getApproveTime, LocalDateTime.now()) + .set(PurchaseOrder::getRefuseReason, vo.getRefuseReason()) + .eq(PurchaseOrder::getId, order.getId()) + .eq(PurchaseOrder::getStatus, PurchaseOrderStatus.CREATED); + if (getBaseMapper().update(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = PurchaseOpLogType.class, name = "删除订单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + PurchaseOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED + && order.getStatus() != PurchaseOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的采购单据不允许执行删除操作!"); + } + + throw new DefaultClientException("订单无法删除!"); + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetail.class).eq(PurchaseOrderDetail::getOrderId, order.getId()); + purchaseOrderDetailService.remove(deleteDetailWrapper); + + // 删除组合商品明细 + Wrapper deleteBundleWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetailBundle.class).eq(PurchaseOrderDetailBundle::getOrderId, order.getId()); + purchaseOrderDetailBundleService.remove(deleteBundleWrapper); + + // 删除订单 + Wrapper deleteWrapper = Wrappers.lambdaQuery(PurchaseOrder.class) + .eq(PurchaseOrder::getId, order.getId()) + .in(PurchaseOrder::getStatus, PurchaseOrderStatus.CREATED, + PurchaseOrderStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", order.getCode()); + } + + @OpLog(type = PurchaseOpLogType.class, name = "取消审核订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CancelApproveOrderTimeLineBizType.class, orderId = "#id", name = "取消审核") + @Transactional(rollbackFor = Exception.class) + @Override + public void cancelApprovePass(String id) { + + Assert.notBlank(id); + + PurchaseOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.APPROVE_PASS) { + + throw new DefaultClientException("订单尚未审核通过,无需取消审核!"); + } + + order.setStatus(PurchaseOrderStatus.CREATED); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(PurchaseOrder.class) + .set(PurchaseOrder::getApproveBy, null).set(PurchaseOrder::getApproveTime, null) + .set(PurchaseOrder::getRefuseReason, StringPool.EMPTY_STR) + .eq(PurchaseOrder::getId, order.getId()) + .eq(PurchaseOrder::getStatus, PurchaseOrderStatus.APPROVE_PASS); + if (getBaseMapper().update(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + } + + private void create(PurchaseOrder order, CreatePurchaseOrderVo vo, boolean isForm) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + order.setScId(vo.getScId()); + + Supplier supplier = supplierService.findById(vo.getSupplierId()); + if (supplier == null) { + throw new InputErrorException("供应商不存在!"); + } + order.setSupplierId(vo.getSupplierId()); + + if (!StringUtil.isBlank(vo.getPurchaserId())) { + SysUser purchaser = userService.findById(vo.getPurchaserId()); + if (purchaser == null) { + throw new InputErrorException("采购员不存在!"); + } + + order.setPurchaserId(vo.getPurchaserId()); + } + + order.setExpectArriveDate(vo.getExpectArriveDate()); + + BigDecimal purchaseNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (PurchaseProductVo productVo : vo.getProducts()) { + + boolean isGift = productVo.getPurchasePrice().doubleValue() == 0D; + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getPurchaseNum()); + } else { + purchaseNum = NumberUtil.add(purchaseNum, productVo.getPurchaseNum()); + } + + // 计算含税总金额:采购数量 × 采购价(采购价本身就是含税价) + BigDecimal taxAmount = NumberUtil.getNumber( + NumberUtil.mul(productVo.getPurchasePrice(), productVo.getPurchaseNum()), 2); + totalAmount = NumberUtil.add(totalAmount, taxAmount); + + PurchaseOrderDetail orderDetail = newOrderDetail(isForm); + orderDetail.setId(IdUtil.getId()); + orderDetail.setOrderId(order.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + orderDetail.setProductId(productVo.getProductId()); + orderDetail.setOrderNum(productVo.getPurchaseNum()); + orderDetail.setTaxPrice(productVo.getPurchasePrice()); + orderDetail.setIsGift(isGift); + orderDetail.setTaxRate(product.getTaxRate()); + orderDetail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + orderDetail.setOrderNo(orderNo); + orderDetail.setTaxAmount(taxAmount); + + if (isForm) { + purchaseOrderDetailFormService.save((PurchaseOrderDetailForm) orderDetail); + } else { + purchaseOrderDetailService.save(orderDetail); + } + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + if (!NumberUtil.isInteger(productVo.getPurchaseNum())) { + throw new InputErrorException("第" + orderNo + "行商品采购数量必须是整数!"); + } + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getPurchasePrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(orderDetail.getTaxAmount(), + bundleWeight, 2); + List purchaseOrderDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + PurchaseOrderDetailBundle purchaseOrderDetailBundle = newOrderDetailBundle(isForm); + purchaseOrderDetailBundle.setId(IdUtil.getId()); + purchaseOrderDetailBundle.setOrderId(order.getId()); + purchaseOrderDetailBundle.setDetailId(orderDetail.getId()); + purchaseOrderDetailBundle.setMainProductId(product.getId()); + purchaseOrderDetailBundle.setOrderNum(orderDetail.getOrderNum()); + purchaseOrderDetailBundle.setProductId(productBundle.getProductId()); + purchaseOrderDetailBundle.setProductOrderNum( + NumberUtil.mul(orderDetail.getOrderNum(), productBundle.getBundleNum())); + purchaseOrderDetailBundle.setProductOriPrice(productBundle.getPurchasePrice()); + purchaseOrderDetailBundle.setProductTaxAmount(BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue())); + // 这里会有尾差 + purchaseOrderDetailBundle.setProductTaxPrice(NumberUtil.getNumber( + NumberUtil.div(purchaseOrderDetailBundle.getProductTaxAmount(), + purchaseOrderDetailBundle.getProductOrderNum()), 6)); + purchaseOrderDetailBundle.setProductTaxRate(bundle.getTaxRate()); + + return purchaseOrderDetailBundle; + }).collect(Collectors.toList()); + + if (isForm) { + purchaseOrderDetailBundleFormService.saveBatch((List) purchaseOrderDetailBundles); + } else { + purchaseOrderDetailBundleService.saveBatch(purchaseOrderDetailBundles); + } + } + orderNo++; + } + order.setTotalNum(purchaseNum); + order.setTotalGiftNum(giftNum); + order.setTotalAmount(totalAmount); + order.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + orderPayTypeService.create(order.getId(), vo.getPayTypes()); + } + + @Override + public PageResult queryPurchaseByCondition(Integer pageIndex, + Integer pageSize, String condition, Boolean isReturn) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPurchaseByCondition(condition, isReturn); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryPurchaseList(Integer pageIndex, Integer pageSize, + QueryPurchaseProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPurchaseList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PurchaseProductDto getPurchaseById(String id) { + + PurchaseProductDto data = getBaseMapper().getPurchaseById(id); + + return data; + } + + private void sendApprovePassEvent(PurchaseOrder order) { + + ApprovePassOrderDto dto = new ApprovePassOrderDto(); + dto.setId(order.getId()); + dto.setTotalAmount(order.getTotalAmount()); + dto.setApproveTime(order.getApproveTime()); + + ApprovePassPurchaseOrderEvent event = new ApprovePassPurchaseOrderEvent(this, dto); + + ApplicationUtil.publishEvent(event); + } + + /** + * 发起流程实例 + * + * @param processCode + * @param businessId + * @return + */ + private Instance startBpmInstance(String processCode, String businessId) { + if (this.getById(businessId) != null) { + throw new DefaultClientException("订单已办理完成,无法重新发起!"); + } + FlowParams flowParams = new FlowParams(); + flowParams.flowCode(processCode); + + String title = this.getBpmTitle(businessId); + FlowCuInstanceTransfer.setTitle(title); + + FlowInstanceExtDto ext = new FlowInstanceExtDto(); + ext.setBizType(FlowDefinitionExtBizType.SYSTEM.getCode()); + ext.setBizFlag(BPM_FLAG); + + flowParams.ext(JsonUtil.toJsonString(ext)); + + // 需要传入表单变量 + GetPurchaseOrderBo detail = new GetPurchaseOrderBo(this.getDetail(businessId, true)); + flowParams.variable( + JsonUtil.parseMap(JsonUtil.toJsonString(detail), String.class, Object.class)); + + Instance instance = insService.start(businessId, flowParams); + + return instance; + } + + @Slf4j + @Component + public static class PurchaseOrderBpmListener implements BpmBizListener { + + @Autowired + private PurchaseOrderService purchaseOrderService; + @Autowired + private PurchaseOrderFormService purchaseOrderFormService; + @Autowired + private PurchaseOrderDetailFormService purchaseOrderDetailFormService; + @Autowired + private PurchaseOrderDetailBundleFormService purchaseOrderDetailBundleFormService; + @Autowired + private PurchaseOrderDetailBundleService purchaseOrderDetailBundleService; + @Autowired + private PurchaseOrderDetailService purchaseOrderDetailService; + + @Override + public boolean isMatch(FlowInstanceExtDto ext) { + return BPM_FLAG.equals(ext.getBizFlag()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void businessComplete(ListenerVariable listenerVariable, String businessId, + String startById) { + log.info("接收到业务完成事件"); + PurchaseOrderForm orderForm = purchaseOrderFormService.getById(businessId); + Wrapper queryWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetailForm.class).eq(PurchaseOrderDetailForm::getOrderId, orderForm.getId()); + List detailFormList = purchaseOrderDetailFormService.list( + queryWrapper); + + PurchaseOrder order = new PurchaseOrder(); + BeanUtil.copyProperties(orderForm, order); + + List detailList = detailFormList.stream().map(detailForm -> { + PurchaseOrderDetail detail = new PurchaseOrderDetail(); + BeanUtil.copyProperties(detailForm, detail); + return detail; + }).collect(Collectors.toList()); + + purchaseOrderService.save(order); + + purchaseOrderDetailService.saveBatch(detailList); + + Wrapper queryDetailBundleWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetailBundleForm.class) + .eq(PurchaseOrderDetailBundleForm::getOrderId, order.getId()); + List detailBundleFormList = purchaseOrderDetailBundleFormService.list( + queryDetailBundleWrapper); + if (!CollectionUtil.isEmpty(detailBundleFormList)) { + List detailBundleList = detailBundleFormList.stream() + .map(detailBundleForm -> { + PurchaseOrderDetailBundle detailBundle = new PurchaseOrderDetailBundle(); + BeanUtil.copyProperties(detailBundleForm, detailBundle); + return detailBundle; + }).collect(Collectors.toList()); + purchaseOrderDetailBundleService.saveBatch(detailBundleList); + } + // 目前订单是已保存状态 + ApprovePassPurchaseOrderVo approveVo = new ApprovePassPurchaseOrderVo(); + approveVo.setId(order.getId()); + + purchaseOrderService.approvePass(approveVo); + } + } + + // 扩展点,可以自定义标题 + private String getBpmTitle(String orderId) { + return ""; + } + + private PurchaseOrder newOrder(boolean isForm) { + if (isForm) { + return new PurchaseOrderForm(); + } else { + return new PurchaseOrder(); + } + } + + private PurchaseOrderDetail newOrderDetail(boolean isForm) { + if (isForm) { + return new PurchaseOrderDetailForm(); + } else { + return new PurchaseOrderDetail(); + } + } + + private PurchaseOrderDetailBundle newOrderDetailBundle(boolean isForm) { + if (isForm) { + return new PurchaseOrderDetailBundleForm(); + } else { + return new PurchaseOrderDetailBundle(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnDetailServiceImpl.java new file mode 100644 index 0000000..d9521d8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PurchaseReturnDetail; +import com.lframework.xingyun.sc.mappers.PurchaseReturnDetailMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnDetailService; +import org.springframework.stereotype.Service; + +@Service +public class PurchaseReturnDetailServiceImpl extends + BaseMpServiceImpl + implements PurchaseReturnDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnServiceImpl.java new file mode 100644 index 0000000..c627903 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnServiceImpl.java @@ -0,0 +1,603 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.PurchaseOpLogType; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.events.order.impl.ApprovePassPurchaseReturnEvent; +import com.lframework.xingyun.sc.mappers.PurchaseReturnMapper; +import com.lframework.xingyun.sc.service.purchase.*; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.purchase.returned.*; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class PurchaseReturnServiceImpl extends + BaseMpServiceImpl + implements PurchaseReturnService { + + @Autowired + private PurchaseReturnDetailService purchaseReturnDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private SysUserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + @Autowired + private ReceiveSheetDetailService receiveSheetDetailService; + + @Autowired + private ProductStockService productStockService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryPurchaseReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPurchaseReturnVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PurchaseReturnFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = PurchaseOpLogType.class, name = "创建采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建退单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = new PurchaseReturn(); + purchaseReturn.setId(IdUtil.getId()); + purchaseReturn.setCode(generateCodeService.generate(GenerateCodeTypePool.PURCHASE_RETURN)); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + this.create(purchaseReturn, vo, purchaseConfig.getPurchaseReturnRequireReceive()); + + purchaseReturn.setStatus(PurchaseReturnStatus.CREATED); + + getBaseMapper().insert(purchaseReturn); + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + + return purchaseReturn.getId(); + } + + @OpLog(type = PurchaseOpLogType.class, name = "修改采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改退单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = getBaseMapper().selectById(vo.getId()); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED + && purchaseReturn.getStatus() != PurchaseReturnStatus.APPROVE_REFUSE) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("采购退货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("采购退货单无法修改!"); + } + + boolean requireReceive = !StringUtil.isBlank(purchaseReturn.getReceiveSheetId()); + + if (requireReceive) { + //查询采购退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + List details = purchaseReturnDetailService.list(queryDetailWrapper); + for (PurchaseReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getReceiveSheetDetailId())) { + //先恢复已退货数量 + receiveSheetDetailService.subReturnNum(detail.getReceiveSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除采购退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + purchaseReturnDetailService.remove(deleteDetailWrapper); + + this.create(purchaseReturn, vo, requireReceive); + + purchaseReturn.setStatus(PurchaseReturnStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseReturnStatus.CREATED); + statusList.add(PurchaseReturnStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getApproveBy, null).set(PurchaseReturn::getApproveTime, null) + .set(PurchaseReturn::getRefuseReason, StringPool.EMPTY_STR) + .eq(PurchaseReturn::getId, purchaseReturn.getId()) + .in(PurchaseReturn::getStatus, statusList); + if (getBaseMapper().update(purchaseReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = PurchaseOpLogType.class, name = "审核通过采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassPurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = getBaseMapper().selectById(vo.getId()); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED + && purchaseReturn.getStatus() != PurchaseReturnStatus.APPROVE_REFUSE) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("采购退货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购退货单无法审核通过!"); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getPurchaseReturnMultipleRelateReceive()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(PurchaseReturn.class) + .eq(PurchaseReturn::getReceiveSheetId, purchaseReturn.getReceiveSheetId()) + .ne(PurchaseReturn::getId, purchaseReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + ReceiveSheet receiveSheet = receiveSheetService.getById(purchaseReturn.getReceiveSheetId()); + throw new DefaultClientException( + "采购收货单号:" + receiveSheet.getCode() + + ",已关联其他采购退货单,不允许关联多个采购退货单!"); + } + } + + purchaseReturn.setStatus(PurchaseReturnStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseReturnStatus.CREATED); + statusList.add(PurchaseReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseReturn.class) + .set(PurchaseReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseReturn::getApproveTime, LocalDateTime.now()) + .eq(PurchaseReturn::getId, purchaseReturn.getId()) + .in(PurchaseReturn::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(PurchaseReturn::getDescription, vo.getDescription()); + } + if (getBaseMapper().update(purchaseReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购退货单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()) + .orderByAsc(PurchaseReturnDetail::getOrderNo); + List details = purchaseReturnDetailService.list(queryDetailWrapper); + for (PurchaseReturnDetail detail : details) { + SubProductStockVo subproductStockVo = new SubProductStockVo(); + + subproductStockVo.setProductId(detail.getProductId()); + subproductStockVo.setScId(purchaseReturn.getScId()); + subproductStockVo.setStockNum(detail.getReturnNum()); + subproductStockVo.setTaxAmount(NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getReturnNum()), 2)); + subproductStockVo.setBizId(purchaseReturn.getId()); + subproductStockVo.setBizDetailId(detail.getId()); + subproductStockVo.setBizCode(purchaseReturn.getCode()); + subproductStockVo.setBizType(ProductStockBizType.PURCHASE_RETURN.getCode()); + + productStockService.subStock(subproductStockVo); + } + + this.sendApprovePassEvent(purchaseReturn); + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreatePurchaseReturnVo vo) { + + PurchaseReturnService thisService = getThis(this.getClass()); + + String returnId = thisService.create(vo); + + ApprovePassPurchaseReturnVo approvePassVo = new ApprovePassPurchaseReturnVo(); + approvePassVo.setId(returnId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return returnId; + } + + @OpLog(type = PurchaseOpLogType.class, name = "审核拒绝采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefusePurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = getBaseMapper().selectById(vo.getId()); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("采购退货单已审核通过,不允许继续执行审核!"); + } + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_REFUSE) { + throw new DefaultClientException("采购退货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购退货单无法审核拒绝!"); + } + + purchaseReturn.setStatus(PurchaseReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseReturn.class) + .set(PurchaseReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseReturn::getApproveTime, LocalDateTime.now()) + .set(PurchaseReturn::getRefuseReason, vo.getRefuseReason()) + .eq(PurchaseReturn::getId, purchaseReturn.getId()) + .eq(PurchaseReturn::getStatus, PurchaseReturnStatus.CREATED); + if (getBaseMapper().update(purchaseReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = PurchaseOpLogType.class, name = "删除采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + PurchaseReturn purchaseReturn = getBaseMapper().selectById(id); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED + && purchaseReturn.getStatus() != PurchaseReturnStatus.APPROVE_REFUSE) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的采购退货单不允许执行删除操作!"); + } + + throw new DefaultClientException("采购退货单无法删除!"); + } + + if (!StringUtil.isBlank(purchaseReturn.getReceiveSheetId())) { + //查询采购退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + List details = purchaseReturnDetailService.list(queryDetailWrapper); + for (PurchaseReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getReceiveSheetDetailId())) { + //恢复已退货数量 + receiveSheetDetailService.subReturnNum(detail.getReceiveSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + purchaseReturnDetailService.remove(deleteDetailWrapper); + + // 删除退货单 + Wrapper deleteWrapper = Wrappers.lambdaQuery(PurchaseReturn.class) + .eq(PurchaseReturn::getId, id).in(PurchaseReturn::getStatus, PurchaseReturnStatus.CREATED, + PurchaseReturnStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("采购退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getSettleStatus, SettleStatus.UN_SETTLE).eq(PurchaseReturn::getId, id) + .eq(PurchaseReturn::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(PurchaseReturn::getId, id) + .in(PurchaseReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getSettleStatus, SettleStatus.SETTLED).eq(PurchaseReturn::getId, id) + .in(PurchaseReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(PurchaseReturn purchaseReturn, CreatePurchaseReturnVo vo, + boolean requireReceive) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + purchaseReturn.setScId(vo.getScId()); + + Supplier supplier = supplierService.findById(vo.getSupplierId()); + if (supplier == null) { + throw new InputErrorException("供应商不存在!"); + } + purchaseReturn.setSupplierId(vo.getSupplierId()); + + if (!StringUtil.isBlank(vo.getPurchaserId())) { + SysUser purchaser = userService.findById(vo.getPurchaserId()); + if (purchaser == null) { + throw new InputErrorException("采购员不存在!"); + } + + purchaseReturn.setPurchaserId(vo.getPurchaserId()); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + GetPaymentDateDto paymentDate = receiveSheetService.getPaymentDate(supplier.getId()); + + purchaseReturn.setPaymentDate( + paymentDate.getAllowModify() ? vo.getPaymentDate() : paymentDate.getPaymentDate()); + + if (requireReceive) { + + ReceiveSheet receiveSheet = receiveSheetService.getById(vo.getReceiveSheetId()); + if (receiveSheet == null) { + throw new DefaultClientException("采购收货单不存在!"); + } + + purchaseReturn.setScId(receiveSheet.getScId()); + purchaseReturn.setSupplierId(receiveSheet.getSupplierId()); + purchaseReturn.setReceiveSheetId(receiveSheet.getId()); + + if (!purchaseConfig.getPurchaseReturnMultipleRelateReceive()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(PurchaseReturn.class) + .eq(PurchaseReturn::getReceiveSheetId, receiveSheet.getId()) + .ne(PurchaseReturn::getId, purchaseReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException( + "采购收货单号:" + receiveSheet.getCode() + + ",已关联其他采购退货单,不允许关联多个采购退货单!"); + } + } + } + + BigDecimal returnNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (ReturnProductVo productVo : vo.getProducts()) { + if (requireReceive) { + if (!StringUtil.isBlank(productVo.getReceiveSheetDetailId())) { + ReceiveSheetDetail detail = receiveSheetDetailService.getById( + productVo.getReceiveSheetDetailId()); + productVo.setPurchasePrice(detail.getTaxPrice()); + } else { + productVo.setPurchasePrice(BigDecimal.ZERO); + } + } + + boolean isGift = NumberUtil.equal(productVo.getPurchasePrice(), BigDecimal.ZERO); + + if (requireReceive) { + if (StringUtil.isBlank(productVo.getReceiveSheetDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getReturnNum()); + } else { + returnNum = NumberUtil.add(returnNum, productVo.getReturnNum()); + } + + BigDecimal taxAmount = NumberUtil.getNumber(NumberUtil.mul(productVo.getPurchasePrice(), productVo.getReturnNum()), 2); + totalAmount = NumberUtil.add(totalAmount, taxAmount); + + PurchaseReturnDetail detail = new PurchaseReturnDetail(); + detail.setId(IdUtil.getId()); + detail.setReturnId(purchaseReturn.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getPurchasePrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许6位小数!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getReturnNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品退货数量最多允许8位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setReturnNum(productVo.getReturnNum()); + detail.setTaxPrice(productVo.getPurchasePrice()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getTaxRate()); + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setTaxAmount(taxAmount); + detail.setOrderNo(orderNo); + if (requireReceive && !StringUtil.isBlank(productVo.getReceiveSheetDetailId())) { + detail.setReceiveSheetDetailId(productVo.getReceiveSheetDetailId()); + receiveSheetDetailService.addReturnNum(productVo.getReceiveSheetDetailId(), + detail.getReturnNum()); + } + + purchaseReturnDetailService.save(detail); + orderNo++; + } + purchaseReturn.setTotalNum(returnNum); + purchaseReturn.setTotalGiftNum(giftNum); + purchaseReturn.setTotalAmount(totalAmount); + purchaseReturn.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + purchaseReturn.setSettleStatus(this.getInitSettleStatus(supplier)); + } + + /** + * 根据供应商获取初始结算状态 + * + * @param supplier + * @return + */ + private SettleStatus getInitSettleStatus(Supplier supplier) { + + if (supplier.getManageType() == ManageType.DISTRIBUTION) { + return SettleStatus.UN_SETTLE; + } else { + return SettleStatus.UN_REQUIRE; + } + } + + private void sendApprovePassEvent(PurchaseReturn r) { + + ApprovePassOrderDto dto = new ApprovePassOrderDto(); + dto.setId(r.getId()); + dto.setTotalAmount(r.getTotalAmount()); + dto.setApproveTime(r.getApproveTime()); + + ApprovePassPurchaseReturnEvent event = new ApprovePassPurchaseReturnEvent(this, dto); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailBundleServiceImpl.java new file mode 100644 index 0000000..2b16b92 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.ReceiveSheetDetailBundleMapper; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class ReceiveSheetDetailBundleServiceImpl extends + BaseMpServiceImpl + implements ReceiveSheetDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailServiceImpl.java new file mode 100644 index 0000000..1688679 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailServiceImpl.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.mappers.ReceiveSheetDetailMapper; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; + +@Service +public class ReceiveSheetDetailServiceImpl extends + BaseMpServiceImpl + implements ReceiveSheetDetailService { + + @Autowired + private ProductService productService; + + @Override + public List getBySheetId(String sheetId) { + + return getBaseMapper().getBySheetId(sheetId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + ReceiveSheetDetail detail = getBaseMapper().selectById(id); + + BigDecimal remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + ReceiveSheetDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReturnNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + orderDetail.getReturnNum() + + "个,本次取消退货数量不允许大于" + orderDetail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetServiceImpl.java new file mode 100644 index 0000000..22920fb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetServiceImpl.java @@ -0,0 +1,766 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.PurchaseOpLogType; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.mappers.ReceiveSheetMapper; +import com.lframework.xingyun.sc.service.purchase.*; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.purchase.receive.*; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class ReceiveSheetServiceImpl extends + BaseMpServiceImpl implements ReceiveSheetService { + + @Autowired + private ReceiveSheetDetailService receiveSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private SysUserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private PurchaseOrderService purchaseOrderService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + @Autowired + private PurchaseOrderDetailService purchaseOrderDetailService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private ReceiveSheetDetailBundleService receiveSheetDetailBundleService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryReceiveSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryReceiveSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + ReceiveSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public GetPaymentDateDto getPaymentDate(String supplierId) { + + // 付款日期默认为当前日期的30天后,如当天为2021-10-01,则付款日期默认为2021-11-01 + //(1)供应商的经营方式为“经销”,且结算方式为“任意指定”,则付款日期按照以上规则展示默认值,允许用户更改,但仅能选择当天及当天之后的日期。 + //(2)供应商的经营方式为“经销”,且结算方式为“货到付款”,则付款日期默认为此刻,即收货单的创建时间,可能会遇到跨日的问题,但付款日期,均赋值为收货单的创建日期。 + //(3)供应商的经营方式为非经销模式时,收货单、退货单不涉及付款,则付款日期字段置灰,为空,且不可点击。 + + Supplier supplier = supplierService.findById(supplierId); + + GetPaymentDateDto result = new GetPaymentDateDto(); + + result.setAllowModify(supplier.getManageType() == ManageType.DISTRIBUTION + && supplier.getSettleType() == SettleType.ARBITRARILY); + if (supplier.getManageType() == ManageType.DISTRIBUTION + && supplier.getSettleType() == SettleType.ARBITRARILY) { + result.setPaymentDate(LocalDate.now().plusMonths(1)); + } else if (supplier.getManageType() == ManageType.DISTRIBUTION + && supplier.getSettleType() == SettleType.CASH_ON_DELIVERY) { + result.setPaymentDate(LocalDate.now()); + } + + return result; + } + + @Override + public ReceiveSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @Override + public ReceiveSheetWithReturnDto getWithReturn(String id) { + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + ReceiveSheetWithReturnDto sheet = getBaseMapper().getWithReturn(id, + purchaseConfig.getPurchaseReturnRequireReceive()); + if (sheet == null) { + throw new InputErrorException("收货单不存在!"); + } + return sheet; + } + + @Override + public PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryReceiveSheetWithReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReturn(vo, + purchaseConfig.getPurchaseReturnMultipleRelateReceive()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = PurchaseOpLogType.class, name = "创建采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建收货单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateReceiveSheetVo vo) { + + ReceiveSheet sheet = new ReceiveSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.RECEIVE_SHEET)); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + this.create(sheet, vo, purchaseConfig.getReceiveRequirePurchase()); + + sheet.setStatus(ReceiveSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = PurchaseOpLogType.class, name = "修改采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改收货单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateReceiveSheetVo vo) { + + ReceiveSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED + && sheet.getStatus() != ReceiveSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("采购收货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("采购收货单无法修改!"); + } + + boolean requirePurchase = !StringUtil.isBlank(sheet.getPurchaseOrderId()); + + if (requirePurchase) { + //查询采购收货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + ReceiveSheetDetail.class).eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + List details = receiveSheetDetailService.list(queryDetailWrapper); + for (ReceiveSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getPurchaseOrderDetailId())) { + //先恢复已收货数量 + purchaseOrderDetailService.subReceiveNum(detail.getPurchaseOrderDetailId(), + detail.getOrderNum()); + } + } + } + + // 删除采购收货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + receiveSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo, requirePurchase); + + sheet.setStatus(ReceiveSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(ReceiveSheetStatus.CREATED); + statusList.add(ReceiveSheetStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getApproveBy, null).set(ReceiveSheet::getApproveTime, null) + .set(ReceiveSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(ReceiveSheet::getId, sheet.getId()).in(ReceiveSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购收货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = PurchaseOpLogType.class, name = "审核通过采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassReceiveSheetVo vo) { + + ReceiveSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED + && sheet.getStatus() != ReceiveSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("采购收货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购收货单无法审核通过!"); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getReceiveMultipleRelatePurchase()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(ReceiveSheet.class) + .eq(ReceiveSheet::getPurchaseOrderId, sheet.getPurchaseOrderId()) + .ne(ReceiveSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + PurchaseOrder purchaseOrder = purchaseOrderService.getById(sheet.getPurchaseOrderId()); + throw new DefaultClientException("采购订单号:" + purchaseOrder.getCode() + + ",已关联其他采购收货单,不允许关联多个采购收货单!"); + } + } + + sheet.setStatus(ReceiveSheetStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(ReceiveSheetStatus.CREATED); + statusList.add(ReceiveSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ReceiveSheet::getApproveTime, LocalDateTime.now()) + .eq(ReceiveSheet::getId, sheet.getId()).in(ReceiveSheet::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(ReceiveSheet::getDescription, vo.getDescription()); + } + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购收货单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(ReceiveSheetDetail::getOrderNo); + List details = receiveSheetDetailService.list(queryDetailWrapper); + + BigDecimal totalNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + + for (ReceiveSheetDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum()), 2)); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + if (isGift) { + giftNum = NumberUtil.add(giftNum, detail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, detail.getOrderNum()); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + ReceiveSheetDetailBundle.class).eq(ReceiveSheetDetailBundle::getSheetId, sheet.getId()) + .eq(ReceiveSheetDetailBundle::getDetailId, detail.getId()); + List receiveSheetDetailBundles = receiveSheetDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(receiveSheetDetailBundles); + + for (ReceiveSheetDetailBundle receiveSheetDetailBundle : receiveSheetDetailBundles) { + ReceiveSheetDetail newDetail = new ReceiveSheetDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setSheetId(sheet.getId()); + newDetail.setProductId(receiveSheetDetailBundle.getProductId()); + newDetail.setOrderNum(receiveSheetDetailBundle.getProductOrderNum()); + newDetail.setTaxPrice(receiveSheetDetailBundle.getProductTaxPrice()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(receiveSheetDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(detail.getOrderNo()); + newDetail.setTaxAmount(receiveSheetDetailBundle.getProductTaxAmount()); + + receiveSheetDetailService.save(newDetail); + receiveSheetDetailService.removeById(detail.getId()); + + receiveSheetDetailBundle.setProductDetailId(newDetail.getId()); + receiveSheetDetailBundleService.updateById(receiveSheetDetailBundle); + + if (isGift) { + giftNum = NumberUtil.add(giftNum, newDetail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, newDetail.getOrderNum()); + } + } + } + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getTotalNum, totalNum).set(ReceiveSheet::getTotalGiftNum, giftNum) + .set(ReceiveSheet::getTotalAmount, totalAmount).eq(ReceiveSheet::getId, sheet.getId()); + this.update(updateWrapper); + + details = receiveSheetDetailService.list(queryDetailWrapper); + for (ReceiveSheetDetail detail : details) { + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(sheet.getScId()); + addProductStockVo.setStockNum(detail.getOrderNum()); + addProductStockVo.setTaxAmount(detail.getTaxAmount()); + addProductStockVo.setBizId(sheet.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(sheet.getCode()); + addProductStockVo.setBizType(ProductStockBizType.PURCHASE.getCode()); + + productStockService.addStock(addProductStockVo); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Override + public String directApprovePass(CreateReceiveSheetVo vo) { + + ReceiveSheetService thisService = getThis(this.getClass()); + + String sheetId = thisService.create(vo); + + ApprovePassReceiveSheetVo approvePassVo = new ApprovePassReceiveSheetVo(); + approvePassVo.setId(sheetId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return sheetId; + } + + @OpLog(type = PurchaseOpLogType.class, name = "审核拒绝采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseReceiveSheetVo vo) { + + ReceiveSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("采购收货单已审核通过,不允许继续执行审核!"); + } + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("采购收货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购收货单无法审核拒绝!"); + } + + sheet.setStatus(ReceiveSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ReceiveSheet::getApproveTime, LocalDateTime.now()) + .set(ReceiveSheet::getRefuseReason, vo.getRefuseReason()) + .eq(ReceiveSheet::getId, sheet.getId()) + .eq(ReceiveSheet::getStatus, ReceiveSheetStatus.CREATED); + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购收货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = PurchaseOpLogType.class, name = "删除采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + ReceiveSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED + && sheet.getStatus() != ReceiveSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的采购收货单不允许执行删除操作!"); + } + + throw new DefaultClientException("采购收货单无法删除!"); + } + + if (!StringUtil.isBlank(sheet.getPurchaseOrderId())) { + //查询采购收货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + ReceiveSheetDetail.class).eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + List details = receiveSheetDetailService.list(queryDetailWrapper); + for (ReceiveSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getPurchaseOrderDetailId())) { + //恢复已收货数量 + purchaseOrderDetailService.subReceiveNum(detail.getPurchaseOrderDetailId(), + detail.getOrderNum()); + } + } + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + receiveSheetDetailService.remove(deleteDetailWrapper); + + // 删除组合商品明细 + Wrapper deleteBundleWrapper = Wrappers.lambdaQuery( + ReceiveSheetDetailBundle.class).eq(ReceiveSheetDetailBundle::getSheetId, sheet.getId()); + receiveSheetDetailBundleService.remove(deleteBundleWrapper); + + // 删除订单 + Wrapper deleteWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .eq(ReceiveSheet::getId, id) + .in(ReceiveSheet::getStatus, ReceiveSheetStatus.CREATED, ReceiveSheetStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("采购收货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(ReceiveSheet::getId, id) + .eq(ReceiveSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getSettleStatus, SettleStatus.PART_SETTLE).eq(ReceiveSheet::getId, id) + .in(ReceiveSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getSettleStatus, SettleStatus.SETTLED).eq(ReceiveSheet::getId, id) + .in(ReceiveSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(ReceiveSheet sheet, CreateReceiveSheetVo vo, boolean receiveRequirePurchase) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + sheet.setScId(vo.getScId()); + + Supplier supplier = supplierService.findById(vo.getSupplierId()); + if (supplier == null) { + throw new InputErrorException("供应商不存在!"); + } + sheet.setSupplierId(vo.getSupplierId()); + + if (!StringUtil.isBlank(vo.getPurchaserId())) { + SysUser purchaser = userService.findById(vo.getPurchaserId()); + if (purchaser == null) { + throw new InputErrorException("采购员不存在!"); + } + + sheet.setPurchaserId(vo.getPurchaserId()); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + GetPaymentDateDto paymentDate = this.getPaymentDate(supplier.getId()); + + sheet.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + sheet.setReceiveDate(vo.getReceiveDate()); + + if (receiveRequirePurchase) { + + PurchaseOrder purchaseOrder = purchaseOrderService.getById(vo.getPurchaseOrderId()); + if (purchaseOrder == null) { + throw new DefaultClientException("采购订单不存在!"); + } + + sheet.setScId(purchaseOrder.getScId()); + sheet.setSupplierId(purchaseOrder.getSupplierId()); + sheet.setPurchaseOrderId(purchaseOrder.getId()); + + if (!purchaseConfig.getReceiveMultipleRelatePurchase()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(ReceiveSheet.class) + .eq(ReceiveSheet::getPurchaseOrderId, purchaseOrder.getId()) + .ne(ReceiveSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("采购订单号:" + purchaseOrder.getCode() + + ",已关联其他采购收货单,不允许关联多个采购收货单!"); + } + } + } + + BigDecimal purchaseNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (ReceiveProductVo productVo : vo.getProducts()) { + if (receiveRequirePurchase) { + if (!StringUtil.isBlank(productVo.getPurchaseOrderDetailId())) { + PurchaseOrderDetail orderDetail = purchaseOrderDetailService.getById( + productVo.getPurchaseOrderDetailId()); + productVo.setPurchasePrice(orderDetail.getTaxPrice()); + } else { + productVo.setPurchasePrice(BigDecimal.ZERO); + } + } + + boolean isGift = NumberUtil.equal(productVo.getPurchasePrice(), BigDecimal.ZERO); + + if (receiveRequirePurchase) { + if (StringUtil.isBlank(productVo.getPurchaseOrderDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getReceiveNum()); + } else { + purchaseNum = NumberUtil.add(purchaseNum, productVo.getReceiveNum()); + } + + BigDecimal taxAmount = NumberUtil.getNumber( + NumberUtil.mul(productVo.getReceiveNum(), productVo.getPurchasePrice()), 2); + totalAmount = NumberUtil.add(totalAmount, taxAmount); + + ReceiveSheetDetail detail = new ReceiveSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getPurchasePrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许6位小数!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getReceiveNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品收货数量最多允许8位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setOrderNum(productVo.getReceiveNum()); + detail.setTaxPrice(productVo.getPurchasePrice()); + detail.setTaxAmount(taxAmount); + detail.setIsGift(isGift); + detail.setTaxRate(product.getTaxRate()); + detail.setDescription(StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + if (receiveRequirePurchase && !StringUtil.isBlank(productVo.getPurchaseOrderDetailId())) { + detail.setPurchaseOrderDetailId(productVo.getPurchaseOrderDetailId()); + purchaseOrderDetailService.addReceiveNum(productVo.getPurchaseOrderDetailId(), + detail.getOrderNum()); + } + + receiveSheetDetailService.save(detail); + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + if (!NumberUtil.isInteger(productVo.getReceiveNum())) { + throw new InputErrorException("第" + orderNo + "行商品收货数量必须是整数!"); + } + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getPurchasePrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(detail.getTaxAmount(), + bundleWeight, 2); + List receiveSheetDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + ReceiveSheetDetailBundle receiveSheetDetailBundle = new ReceiveSheetDetailBundle(); + receiveSheetDetailBundle.setId(IdUtil.getId()); + receiveSheetDetailBundle.setSheetId(sheet.getId()); + receiveSheetDetailBundle.setDetailId(detail.getId()); + receiveSheetDetailBundle.setMainProductId(product.getId()); + receiveSheetDetailBundle.setOrderNum(detail.getOrderNum()); + receiveSheetDetailBundle.setProductId(productBundle.getProductId()); + receiveSheetDetailBundle.setProductOrderNum( + NumberUtil.mul(detail.getOrderNum(), productBundle.getBundleNum())); + receiveSheetDetailBundle.setProductOriPrice(productBundle.getPurchasePrice()); + receiveSheetDetailBundle.setProductTaxAmount(BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue())); + // 这里会有尾差 + receiveSheetDetailBundle.setProductTaxPrice(NumberUtil.getNumber( + NumberUtil.div(receiveSheetDetailBundle.getProductTaxAmount(), + receiveSheetDetailBundle.getProductOrderNum()), 6)); + receiveSheetDetailBundle.setProductTaxRate(bundle.getTaxRate()); + + return receiveSheetDetailBundle; + }).collect(Collectors.toList()); + + receiveSheetDetailBundleService.saveBatch(receiveSheetDetailBundles); + } + orderNo++; + } + sheet.setTotalNum(purchaseNum); + sheet.setTotalGiftNum(giftNum); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setSettleStatus(this.getInitSettleStatus(supplier)); + } + + /** + * 根据供应商获取初始结算状态 + * + * @param supplier + * @return + */ + private SettleStatus getInitSettleStatus(Supplier supplier) { + + if (supplier.getManageType() == ManageType.DISTRIBUTION) { + return SettleStatus.UN_SETTLE; + } else { + return SettleStatus.UN_REQUIRE; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailConfigServiceImpl.java new file mode 100644 index 0000000..e1d76fe --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailConfigServiceImpl.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.enums.RetailOpLogType; +import com.lframework.xingyun.sc.mappers.RetailConfigMapper; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.vo.retail.config.UpdateRetailConfigVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; + +@Service +public class RetailConfigServiceImpl extends BaseMpServiceImpl + implements RetailConfigService { + + @Cacheable(value = RetailConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public RetailConfig get() { + + RetailConfig config = getBaseMapper().selectOne(Wrappers.query()); + + return config; + } + + @OpLog(type = RetailOpLogType.class, name = "修改零售参数设置") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateRetailConfigVo vo) { + + RetailConfig config = getBaseMapper().selectOne(Wrappers.query()); + config.setRetailReturnRequireOutStock(vo.getRetailReturnRequireOutStock()); + config.setRetailReturnMultipleRelateOutStock(vo.getRetailReturnMultipleRelateOutStock()); + config.setRetailOutSheetRequireMember(vo.getRetailOutSheetRequireMember()); + config.setRetailReturnRequireMember(vo.getRetailReturnRequireMember()); + config.setRetailOutSheetRequireLogistics(vo.getRetailOutSheetRequireLogistics()); + + getBaseMapper().updateById(config); + + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = RetailConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailBundleServiceImpl.java new file mode 100644 index 0000000..02e622f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.RetailOutSheetDetailBundleMapper; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class RetailOutSheetDetailBundleServiceImpl extends + BaseMpServiceImpl + implements RetailOutSheetDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailLotServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailLotServiceImpl.java new file mode 100644 index 0000000..109b951 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailLotServiceImpl.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailLot; +import com.lframework.xingyun.sc.mappers.RetailOutSheetDetailLotMapper; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; + +@Service +public class RetailOutSheetDetailLotServiceImpl + extends BaseMpServiceImpl + implements RetailOutSheetDetailLotService { + + @Autowired + private ProductService productService; + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + @Override + public RetailOutSheetDetailLotDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetailLot detail = getBaseMapper().selectById(id); + + BigDecimal remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()); + if (NumberUtil.lt(remainNum, num)) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + + retailOutSheetDetailService.addReturnNum(detail.getDetailId(), num); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetailLot detail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(detail.getReturnNum(), num)) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + detail.getReturnNum() + + "个,本次取消退货数量不允许大于" + detail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(detail.getId(), num) != 1) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + + retailOutSheetDetailService.subReturnNum(detail.getDetailId(), num); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailServiceImpl.java new file mode 100644 index 0000000..82cb9d2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailServiceImpl.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.RetailOutSheetDetailMapper; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailBundleService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; + +@Service +public class RetailOutSheetDetailServiceImpl extends + BaseMpServiceImpl implements + RetailOutSheetDetailService { + + @Autowired + private ProductService productService; + + @Autowired + private RetailOutSheetDetailBundleService retailOutSheetDetailBundleService; + + @Override + public List getBySheetId(String sheetId) { + + return getBaseMapper().getBySheetId(sheetId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetail detail = getBaseMapper().selectById(id); + + BigDecimal remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReturnNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException("(" + product.getCode() + ")" + product.getName() + "已退货数量为" + + orderDetail.getReturnNum() + "个,本次取消退货数量不允许大于" + + orderDetail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + } + + @Override + public BigDecimal getTotalWeightBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(RetailOutSheetDetail.class) + .in(RetailOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumWeight = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class) + .eq(RetailOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = retailOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getWeight() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置重量,请检查!"); + } + + return NumberUtil.getNumber(NumberUtil.mul(targetProduct.getWeight(), b.getProductOrderNum()), 2); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getWeight() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置重量,请检查!"); + } + return NumberUtil.getNumber(NumberUtil.mul(t.getOrderNum(), product.getWeight()), 2); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumWeight; + } + + @Override + public BigDecimal getTotalVolumeBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(RetailOutSheetDetail.class) + .in(RetailOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumVolume = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class) + .eq(RetailOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = retailOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getVolume() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置体积,请检查!"); + } + + return NumberUtil.getNumber(NumberUtil.mul(targetProduct.getVolume(), b.getProductOrderNum()), 2); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getVolume() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置体积,请检查!"); + } + return NumberUtil.getNumber(NumberUtil.mul(t.getOrderNum(), product.getVolume()), 2); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumVolume; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetServiceImpl.java new file mode 100644 index 0000000..6ca383f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetServiceImpl.java @@ -0,0 +1,740 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.*; +import com.lframework.xingyun.sc.events.order.impl.ApprovePassRetailOutSheetEvent; +import com.lframework.xingyun.sc.mappers.RetailOutSheetMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.*; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.retail.out.*; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class RetailOutSheetServiceImpl extends + BaseMpServiceImpl implements RetailOutSheetService { + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + @Autowired + private RetailOutSheetDetailLotService retailOutSheetDetailLotService; + + @Autowired + private RetailOutSheetDetailBundleService retailOutSheetDetailBundleService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private MemberService memberService; + + @Autowired + private SysUserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private RetailConfigService retailConfigService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Autowired + private LogisticsSheetDetailService logisticsSheetDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryRetailOutSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryRetailOutSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + RetailOutSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public GetPaymentDateDto getPaymentDate(String memberId) { + + GetPaymentDateDto result = new GetPaymentDateDto(); + result.setAllowModify(Boolean.TRUE); + result.setPaymentDate(LocalDate.now()); + + return result; + } + + @Override + public RetailOutSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @Override + public RetailOutSheetWithReturnDto getWithReturn(String id) { + + RetailConfig retailConfig = retailConfigService.get(); + + RetailOutSheetWithReturnDto sheet = getBaseMapper().getWithReturn(id, + retailConfig.getRetailReturnRequireOutStock()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + return sheet; + } + + @Override + public PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryRetailOutSheetWithReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + RetailConfig retailConfig = retailConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReturn(vo, + retailConfig.getRetailReturnMultipleRelateOutStock()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = RetailOpLogType.class, name = "创建零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateRetailOutSheetVo vo) { + + RetailOutSheet sheet = new RetailOutSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.RETAIL_OUT_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(RetailOutSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = RetailOpLogType.class, name = "修改零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateRetailOutSheetVo vo) { + + RetailOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,无法修改!"); + } + + throw new DefaultClientException("零售出库单无法修改!"); + } + + // 删除出库单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetail.class).eq(RetailOutSheetDetail::getSheetId, sheet.getId()); + retailOutSheetDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class).eq(RetailOutSheetDetailBundle::getSheetId, sheet.getId()); + retailOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + this.create(sheet, vo); + + sheet.setStatus(RetailOutSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(RetailOutSheetStatus.CREATED); + statusList.add(RetailOutSheetStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, null).set(RetailOutSheet::getApproveTime, null) + .set(RetailOutSheet::getRefuseReason, StringPool.EMPTY_STR) + .set(RetailOutSheet::getMemberId, sheet.getMemberId()) + .eq(RetailOutSheet::getId, sheet.getId()).in(RetailOutSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = RetailOpLogType.class, name = "审核通过零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassRetailOutSheetVo vo) { + + RetailOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售出库单无法审核通过!"); + } + + RetailConfig retailConfig = retailConfigService.get(); + if (retailConfig.getRetailOutSheetRequireLogistics()) { + // 关联物流单 + LogisticsSheetDetail logisticsSheetDetail = logisticsSheetDetailService.getByBizId( + sheet.getId(), LogisticsSheetDetailBizType.RETAIL_OUT_SHEET); + if (logisticsSheetDetail == null) { + throw new DefaultClientException("零售出库单尚未发货,无法审核通过!"); + } + } + + sheet.setStatus(RetailOutSheetStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(RetailOutSheetStatus.CREATED); + statusList.add(RetailOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailOutSheet::getApproveTime, LocalDateTime.now()) + .eq(RetailOutSheet::getId, sheet.getId()).in(RetailOutSheet::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(RetailOutSheet::getDescription, vo.getDescription()); + } + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(sheet.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(sheet.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有支付方式,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetail.class).eq(RetailOutSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(RetailOutSheetDetail::getOrderNo); + List details = retailOutSheetDetailService.list(queryDetailWrapper); + + BigDecimal totalNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (RetailOutSheetDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum()), 2)); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(detail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(detail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.RETAIL.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + RetailOutSheetDetailLot detailLot = new RetailOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(detail.getId()); + detailLot.setOrderNum(detail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(detail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + retailOutSheetDetailLotService.save(detailLot); + + if (isGift) { + giftNum = NumberUtil.add(giftNum, detail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, detail.getOrderNum()); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class) + .eq(RetailOutSheetDetailBundle::getSheetId, sheet.getId()) + .eq(RetailOutSheetDetailBundle::getDetailId, detail.getId()); + List retailOutSheetDetailBundles = retailOutSheetDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(retailOutSheetDetailBundles); + + for (RetailOutSheetDetailBundle retailOutSheetDetailBundle : retailOutSheetDetailBundles) { + RetailOutSheetDetail newDetail = new RetailOutSheetDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setSheetId(sheet.getId()); + newDetail.setProductId(retailOutSheetDetailBundle.getProductId()); + newDetail.setOrderNum(retailOutSheetDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(retailOutSheetDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(retailOutSheetDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(retailOutSheetDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(orderNo++); + newDetail.setSettleStatus(detail.getSettleStatus()); + newDetail.setOriBundleDetailId(detail.getId()); + newDetail.setTaxAmount(retailOutSheetDetailBundle.getProductTaxAmount()); + + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(newDetail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(newDetail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(newDetail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.RETAIL.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + RetailOutSheetDetailLot detailLot = new RetailOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(newDetail.getId()); + detailLot.setOrderNum(newDetail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(newDetail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + retailOutSheetDetailLotService.save(detailLot); + + retailOutSheetDetailService.save(newDetail); + retailOutSheetDetailService.removeById(detail.getId()); + + retailOutSheetDetailBundle.setProductDetailId(newDetail.getId()); + retailOutSheetDetailBundleService.updateById(retailOutSheetDetailBundle); + + if (isGift) { + giftNum = NumberUtil.add(giftNum, newDetail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, newDetail.getOrderNum()); + } + } + } + orderNo++; + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(RetailOutSheet.class) + .set(RetailOutSheet::getTotalNum, totalNum).set(RetailOutSheet::getTotalGiftNum, giftNum) + .set(RetailOutSheet::getTotalAmount, totalAmount).eq(RetailOutSheet::getId, sheet.getId()); + this.update(updateWrapper); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + this.sendApprovePassEvent(sheet); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateRetailOutSheetVo vo) { + + RetailOutSheetService thisService = getThis(this.getClass()); + + String sheetId = thisService.create(vo); + + ApprovePassRetailOutSheetVo approvePassVo = new ApprovePassRetailOutSheetVo(); + approvePassVo.setId(sheetId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return sheetId; + } + + @OpLog(type = RetailOpLogType.class, name = "审核拒绝零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseRetailOutSheetVo vo) { + + RetailOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,不允许继续执行审核!"); + } + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("零售出库单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售出库单无法审核拒绝!"); + } + + sheet.setStatus(RetailOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailOutSheet::getApproveTime, LocalDateTime.now()) + .set(RetailOutSheet::getRefuseReason, vo.getRefuseReason()) + .eq(RetailOutSheet::getId, sheet.getId()) + .eq(RetailOutSheet::getStatus, RetailOutSheetStatus.CREATED); + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = RetailOpLogType.class, name = "删除零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + RetailOutSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的零售出库单不允许执行删除操作!"); + } + + throw new DefaultClientException("零售出库单无法删除!"); + } + + if (logisticsSheetDetailService.getByBizId(sheet.getId(), + LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) != null) { + throw new DefaultClientException("零售出库单已关联物流单,请先删除物流单!"); + } + + // 删除订单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetail.class).eq(RetailOutSheetDetail::getSheetId, sheet.getId()); + List details = retailOutSheetDetailService.list(queryDetailWrapper); + retailOutSheetDetailService.remove(queryDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class).eq(RetailOutSheetDetailBundle::getSheetId, sheet.getId()); + retailOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + Wrapper deleteDetailLotWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailLot.class).in(RetailOutSheetDetailLot::getDetailId, + details.stream().map(RetailOutSheetDetail::getId).collect(Collectors.toList())); + retailOutSheetDetailLotService.remove(deleteDetailLotWrapper); + + // 删除订单 + Wrapper deleteWrapper = Wrappers.lambdaQuery(RetailOutSheet.class) + .eq(RetailOutSheet::getId, id).in(RetailOutSheet::getStatus, RetailOutSheetStatus.CREATED, + RetailOutSheetStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Override + public PageResult queryRetailByCondition(Integer pageIndex, Integer pageSize, + String condition, Boolean isReturn) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryRetailByCondition(condition, isReturn); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryRetailList(Integer pageIndex, Integer pageSize, + QueryRetailProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryRetailList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public RetailProductDto getRetailById(String id) { + + RetailProductDto data = getBaseMapper().getRetailById(id); + return data; + } + + private void create(RetailOutSheet sheet, CreateRetailOutSheetVo vo) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + sheet.setScId(vo.getScId()); + + Member member = null; + if (!StringUtil.isBlank(vo.getMemberId())) { + member = memberService.findById(vo.getMemberId()); + if (member == null) { + throw new InputErrorException("会员不存在!"); + } + sheet.setMemberId(vo.getMemberId()); + } else { + sheet.setMemberId(null); + } + + if (!StringUtil.isBlank(vo.getSalerId())) { + SysUser saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + sheet.setSalerId(vo.getSalerId()); + } + + GetPaymentDateDto paymentDate = this.getPaymentDate(member == null ? null : member.getId()); + + sheet.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + + BigDecimal purchaseNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (RetailOutProductVo productVo : vo.getProducts()) { + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getOrderNum()); + } else { + purchaseNum = NumberUtil.add(purchaseNum, productVo.getOrderNum()); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(productVo.getTaxPrice(), productVo.getOrderNum()), + 2)); + + RetailOutSheetDetail detail = new RetailOutSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setOrderNum(productVo.getOrderNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription(StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(member)); + detail.setTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum()), 2)); + + retailOutSheetDetailService.save(detail); + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + if (!NumberUtil.isInteger(productVo.getOrderNum())) { + throw new InputErrorException("第" + orderNo + "行商品出库数量必须是整数!"); + } + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getRetailPrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(detail.getTaxAmount(), + bundleWeight, 2); + List retailOutSheetDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + RetailOutSheetDetailBundle retailOutSheetDetailBundle = new RetailOutSheetDetailBundle(); + retailOutSheetDetailBundle.setId(IdUtil.getId()); + retailOutSheetDetailBundle.setSheetId(sheet.getId()); + retailOutSheetDetailBundle.setDetailId(detail.getId()); + retailOutSheetDetailBundle.setMainProductId(product.getId()); + retailOutSheetDetailBundle.setOrderNum(detail.getOrderNum()); + retailOutSheetDetailBundle.setProductId(productBundle.getProductId()); + retailOutSheetDetailBundle.setProductOrderNum( + NumberUtil.mul(detail.getOrderNum(), productBundle.getBundleNum())); + retailOutSheetDetailBundle.setProductOriPrice(productBundle.getRetailPrice()); + retailOutSheetDetailBundle.setProductTaxAmount(BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue())); + // 这里会有尾差 + retailOutSheetDetailBundle.setProductTaxPrice(NumberUtil.getNumber( + NumberUtil.div(retailOutSheetDetailBundle.getProductTaxAmount(), + retailOutSheetDetailBundle.getProductOrderNum()), 6)); + retailOutSheetDetailBundle.setProductTaxRate(bundle.getSaleTaxRate()); + + return retailOutSheetDetailBundle; + }).collect(Collectors.toList()); + + retailOutSheetDetailBundleService.saveBatch(retailOutSheetDetailBundles); + } + orderNo++; + } + sheet.setTotalNum(purchaseNum); + sheet.setTotalGiftNum(giftNum); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setSettleStatus(this.getInitSettleStatus(member)); + + orderPayTypeService.create(sheet.getId(), vo.getPayTypes()); + } + + /** + * 根据会员获取初始结算状态 + * + * @param member + * @return + */ + private SettleStatus getInitSettleStatus(Member member) { + + return SettleStatus.UN_SETTLE; + } + + private void sendApprovePassEvent(RetailOutSheet sheet) { + + ApprovePassOrderDto dto = new ApprovePassOrderDto(); + dto.setId(sheet.getId()); + dto.setTotalAmount(sheet.getTotalAmount()); + dto.setApproveTime(sheet.getApproveTime()); + + ApprovePassRetailOutSheetEvent event = new ApprovePassRetailOutSheetEvent(this, dto); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnDetailServiceImpl.java new file mode 100644 index 0000000..57344f0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.RetailReturnDetail; +import com.lframework.xingyun.sc.mappers.RetailReturnDetailMapper; +import com.lframework.xingyun.sc.service.retail.RetailReturnDetailService; +import org.springframework.stereotype.Service; + +@Service +public class RetailReturnDetailServiceImpl extends + BaseMpServiceImpl + implements RetailReturnDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnServiceImpl.java new file mode 100644 index 0000000..ce7b908 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnServiceImpl.java @@ -0,0 +1,578 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.RetailOpLogType; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.events.order.impl.ApprovePassRetailReturnEvent; +import com.lframework.xingyun.sc.mappers.RetailReturnMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.*; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.retail.returned.*; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class RetailReturnServiceImpl extends + BaseMpServiceImpl implements RetailReturnService { + + @Autowired + private RetailReturnDetailService retailReturnDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private MemberService memberService; + + @Autowired + private SysUserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private RetailOutSheetService retailOutSheetService; + + @Autowired + private RetailConfigService retailConfigService; + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + @Autowired + private RetailOutSheetDetailLotService retailOutSheetDetailLotService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryRetailReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryRetailReturnVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public RetailReturnFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = RetailOpLogType.class, name = "创建零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建退单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateRetailReturnVo vo) { + + RetailReturn retailReturn = new RetailReturn(); + retailReturn.setId(IdUtil.getId()); + retailReturn.setCode(generateCodeService.generate(GenerateCodeTypePool.RETAIL_RETURN)); + + RetailConfig retailConfig = retailConfigService.get(); + + this.create(retailReturn, vo, retailConfig.getRetailReturnRequireOutStock()); + + retailReturn.setStatus(RetailReturnStatus.CREATED); + + getBaseMapper().insert(retailReturn); + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + + return retailReturn.getId(); + } + + @OpLog(type = RetailOpLogType.class, name = "修改零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改退单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateRetailReturnVo vo) { + + RetailReturn retailReturn = getBaseMapper().selectById(vo.getId()); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED + && retailReturn.getStatus() != RetailReturnStatus.APPROVE_REFUSE) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("零售退货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("零售退货单无法修改!"); + } + + boolean requireOut = !StringUtil.isBlank(retailReturn.getOutSheetId()); + + if (requireOut) { + //查询零售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailReturnDetail.class).eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + List details = retailReturnDetailService.list(queryDetailWrapper); + for (RetailReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //先恢复已退货数量 + retailOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除零售退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + retailReturnDetailService.remove(deleteDetailWrapper); + + this.create(retailReturn, vo, requireOut); + + retailReturn.setStatus(RetailReturnStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(RetailReturnStatus.CREATED); + statusList.add(RetailReturnStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailReturn.class) + .set(RetailReturn::getApproveBy, null).set(RetailReturn::getApproveTime, null) + .set(RetailReturn::getRefuseReason, StringPool.EMPTY_STR) + .set(RetailReturn::getMemberId, retailReturn.getMemberId()) + .eq(RetailReturn::getId, retailReturn.getId()).in(RetailReturn::getStatus, statusList); + if (getBaseMapper().update(retailReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = RetailOpLogType.class, name = "审核通过零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassRetailReturnVo vo) { + + RetailReturn retailReturn = getBaseMapper().selectById(vo.getId()); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED + && retailReturn.getStatus() != RetailReturnStatus.APPROVE_REFUSE) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("零售退货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售退货单无法审核通过!"); + } + + RetailConfig retailConfig = retailConfigService.get(); + + if (!retailConfig.getRetailReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(RetailReturn.class) + .eq(RetailReturn::getOutSheetId, retailReturn.getOutSheetId()) + .ne(RetailReturn::getId, retailReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + RetailOutSheet retailOutSheet = retailOutSheetService.getById(retailReturn.getOutSheetId()); + throw new DefaultClientException("零售出库单号:" + retailOutSheet.getCode() + + ",已关联其他零售退货单,不允许关联多个零售退货单!"); + } + } + + retailReturn.setStatus(RetailReturnStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(RetailReturnStatus.CREATED); + statusList.add(RetailReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailReturn.class) + .set(RetailReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailReturn::getApproveTime, LocalDateTime.now()) + .eq(RetailReturn::getId, retailReturn.getId()).in(RetailReturn::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(RetailReturn::getDescription, vo.getDescription()); + } + if (getBaseMapper().update(retailReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售退货单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(retailReturn.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(retailReturn.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有支付方式,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()) + .orderByAsc(RetailReturnDetail::getOrderNo); + List details = retailReturnDetailService.list(queryDetailWrapper); + for (RetailReturnDetail detail : details) { + ProductPurchase productPurchase = productPurchaseService.getById(detail.getProductId()); + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(retailReturn.getScId()); + addProductStockVo.setStockNum(detail.getReturnNum()); + addProductStockVo.setDefaultTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(productPurchase.getPrice(), detail.getReturnNum()), + 2)); + addProductStockVo.setBizId(retailReturn.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(retailReturn.getCode()); + addProductStockVo.setBizType(ProductStockBizType.RETAIL_RETURN.getCode()); + + productStockService.addStock(addProductStockVo); + } + + this.sendApprovePassEvent(retailReturn); + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + + this.sendApprovePassEvent(retailReturn); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateRetailReturnVo vo) { + + RetailReturnService thisService = getThis(this.getClass()); + + String returnId = thisService.create(vo); + + ApprovePassRetailReturnVo approvePassVo = new ApprovePassRetailReturnVo(); + approvePassVo.setId(returnId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return returnId; + } + + @OpLog(type = RetailOpLogType.class, name = "审核拒绝零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseRetailReturnVo vo) { + + RetailReturn retailReturn = getBaseMapper().selectById(vo.getId()); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("零售退货单已审核通过,不允许继续执行审核!"); + } + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_REFUSE) { + throw new DefaultClientException("零售退货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售退货单无法审核拒绝!"); + } + + retailReturn.setStatus(RetailReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailReturn.class) + .set(RetailReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailReturn::getApproveTime, LocalDateTime.now()) + .set(RetailReturn::getRefuseReason, vo.getRefuseReason()) + .eq(RetailReturn::getId, retailReturn.getId()) + .eq(RetailReturn::getStatus, RetailReturnStatus.CREATED); + if (getBaseMapper().update(retailReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = RetailOpLogType.class, name = "删除零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + RetailReturn retailReturn = getBaseMapper().selectById(id); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED + && retailReturn.getStatus() != RetailReturnStatus.APPROVE_REFUSE) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的零售退货单不允许执行删除操作!"); + } + + throw new DefaultClientException("零售退货单无法删除!"); + } + + if (!StringUtil.isBlank(retailReturn.getOutSheetId())) { + //查询零售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailReturnDetail.class).eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + List details = retailReturnDetailService.list(queryDetailWrapper); + for (RetailReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //恢复已退货数量 + retailOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + retailReturnDetailService.remove(deleteDetailWrapper); + + // 删除退货单 + Wrapper deleteWrapper = Wrappers.lambdaQuery(RetailReturn.class) + .eq(RetailReturn::getId, retailReturn.getId()) + .in(RetailReturn::getStatus, RetailReturnStatus.CREATED, RetailReturnStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("零售退货单信息已过期,请刷新重试!"); + } + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", retailReturn.getCode()); + } + + private void create(RetailReturn retailReturn, CreateRetailReturnVo vo, boolean requireOut) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + retailReturn.setScId(vo.getScId()); + + Member member = null; + if (!StringUtil.isBlank(vo.getMemberId())) { + member = memberService.findById(vo.getMemberId()); + if (member == null) { + throw new InputErrorException("客户不存在!"); + } + retailReturn.setMemberId(vo.getMemberId()); + } else { + retailReturn.setMemberId(null); + } + + if (!StringUtil.isBlank(vo.getSalerId())) { + SysUser saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("零售员不存在!"); + } + + retailReturn.setSalerId(vo.getSalerId()); + } + + RetailConfig retailConfig = retailConfigService.get(); + + GetPaymentDateDto paymentDate = retailOutSheetService.getPaymentDate( + member == null ? null : member.getId()); + + retailReturn.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + + if (requireOut) { + + RetailOutSheet retailOutSheet = retailOutSheetService.getById(vo.getOutSheetId()); + if (retailOutSheet == null) { + throw new DefaultClientException("零售出库单不存在!"); + } + + retailReturn.setScId(retailOutSheet.getScId()); + retailReturn.setMemberId(retailOutSheet.getMemberId()); + retailReturn.setOutSheetId(retailOutSheet.getId()); + + if (!retailConfig.getRetailReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(RetailReturn.class) + .eq(RetailReturn::getOutSheetId, retailOutSheet.getId()) + .ne(RetailReturn::getId, retailReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("零售出库单号:" + retailOutSheet.getCode() + + ",已关联其他零售退货单,不允许关联多个零售退货单!"); + } + } + } + + BigDecimal returnNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (RetailReturnProductVo productVo : vo.getProducts()) { + if (requireOut) { + if (!StringUtil.isBlank(productVo.getOutSheetDetailId())) { + RetailOutSheetDetailLotDto detailLot = retailOutSheetDetailLotService.findById( + productVo.getOutSheetDetailId()); + RetailOutSheetDetail detail = retailOutSheetDetailService.getById( + detailLot.getDetailId()); + productVo.setOriPrice(detail.getOriPrice()); + productVo.setTaxPrice(detail.getTaxPrice()); + productVo.setDiscountRate(detail.getDiscountRate()); + } else { + productVo.setTaxPrice(BigDecimal.ZERO); + productVo.setDiscountRate(BigDecimal.valueOf(100)); + } + } + + boolean isGift = NumberUtil.equal(productVo.getTaxPrice(), 0D); + + if (requireOut) { + if (StringUtil.isBlank(productVo.getOutSheetDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getReturnNum()); + } else { + returnNum = NumberUtil.add(returnNum, productVo.getReturnNum()); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(productVo.getTaxPrice(), productVo.getReturnNum()), + 2)); + + RetailReturnDetail detail = new RetailReturnDetail(); + detail.setId(IdUtil.getId()); + detail.setReturnId(retailReturn.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setReturnNum(productVo.getReturnNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription(StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(member)); + detail.setTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getReturnNum()), 2)); + if (requireOut && !StringUtil.isBlank(productVo.getOutSheetDetailId())) { + detail.setOutSheetDetailId(productVo.getOutSheetDetailId()); + retailOutSheetDetailLotService.addReturnNum(productVo.getOutSheetDetailId(), + detail.getReturnNum()); + } + + retailReturnDetailService.save(detail); + orderNo++; + } + retailReturn.setTotalNum(returnNum); + retailReturn.setTotalGiftNum(giftNum); + retailReturn.setTotalAmount(totalAmount); + retailReturn.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + retailReturn.setSettleStatus(this.getInitSettleStatus(member)); + + orderPayTypeService.create(retailReturn.getId(), vo.getPayTypes()); + } + + /** + * 根据客户获取初始结算状态 + * + * @param member + * @return + */ + private SettleStatus getInitSettleStatus(Member member) { + + return SettleStatus.UN_SETTLE; + } + + private void sendApprovePassEvent(RetailReturn r) { + + ApprovePassOrderDto dto = new ApprovePassOrderDto(); + dto.setId(r.getId()); + dto.setTotalAmount(r.getTotalAmount()); + dto.setApproveTime(r.getApproveTime()); + + ApprovePassRetailReturnEvent event = new ApprovePassRetailReturnEvent(this, dto); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleConfigServiceImpl.java new file mode 100644 index 0000000..c18e7a1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleConfigServiceImpl.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.enums.SaleOpLogType; +import com.lframework.xingyun.sc.mappers.SaleConfigMapper; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.vo.sale.config.UpdateSaleConfigVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; + +@Service +public class SaleConfigServiceImpl extends BaseMpServiceImpl + implements SaleConfigService { + + @Cacheable(value = SaleConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public SaleConfig get() { + + SaleConfig config = getBaseMapper().selectOne(Wrappers.query()); + + return config; + } + + @OpLog(type = SaleOpLogType.class, name = "修改销售参数设置") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleConfigVo vo) { + + SaleConfig config = getBaseMapper().selectOne(Wrappers.query()); + config.setOutStockRequireSale(vo.getOutStockRequireSale()); + config.setOutStockMultipleRelateSale(vo.getOutStockMultipleRelateSale()); + config.setSaleReturnRequireOutStock(vo.getSaleReturnRequireOutStock()); + config.setSaleReturnMultipleRelateOutStock(vo.getSaleReturnMultipleRelateOutStock()); + config.setOutStockRequireLogistics(vo.getOutStockRequireLogistics()); + + getBaseMapper().updateById(config); + + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = SaleConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailBundleServiceImpl.java new file mode 100644 index 0000000..78233f5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; +import com.lframework.xingyun.sc.mappers.SaleOrderDetailBundleMapper; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class SaleOrderDetailBundleServiceImpl extends + BaseMpServiceImpl + implements SaleOrderDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailServiceImpl.java new file mode 100644 index 0000000..4cc011b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailServiceImpl.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.mappers.SaleOrderDetailMapper; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; + +@Service +public class SaleOrderDetailServiceImpl extends + BaseMpServiceImpl + implements SaleOrderDetailService { + + @Autowired + private ProductService productService; + + @Override + public List getByOrderId(String orderId) { + + return getBaseMapper().getByOrderId(orderId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addOutNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOrderDetail orderDetail = getBaseMapper().selectById(id); + + BigDecimal remainNum = NumberUtil.sub(orderDetail.getOrderNum(), orderDetail.getOutNum()); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余出库数量为" + remainNum + + "个,本次出库数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addOutNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余出库数量不足,不允许继续出库!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subOutNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOrderDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getOutNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已出库数量为" + orderDetail.getOutNum() + + "个,本次取消出库数量不允许大于" + orderDetail.getOutNum() + "个!"); + } + + if (getBaseMapper().subOutNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已出库数量不足,不允许取消出库!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java new file mode 100644 index 0000000..c722ec1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java @@ -0,0 +1,629 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.SaleOpLogType; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import com.lframework.xingyun.sc.events.order.impl.ApprovePassSaleOrderEvent; +import com.lframework.xingyun.sc.mappers.SaleOrderMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailBundleService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.vo.sale.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class SaleOrderServiceImpl extends BaseMpServiceImpl implements + SaleOrderService { + + @Autowired + private SaleOrderDetailService saleOrderDetailService; + + @Autowired + private SaleOrderDetailBundleService saleOrderDetailBundleService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private CustomerService customerService; + + @Autowired + private SysUserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private SaleConfigService saleConfigService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySaleOrderVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySaleOrderVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SaleOrderSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public SaleOrderFullDto getDetail(String id) { + + SaleOrderFullDto order = getBaseMapper().getDetail(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + return order; + } + + @Override + public SaleOrderWithOutDto getWithOut(String id) { + + SaleConfig saleConfig = saleConfigService.get(); + + SaleOrderWithOutDto order = getBaseMapper().getWithOut(id, saleConfig.getOutStockRequireSale()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + return order; + } + + @Override + public PageResult queryWithOut(Integer pageIndex, Integer pageSize, + QuerySaleOrderWithOutVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + SaleConfig saleConfig = saleConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithOut(vo, + saleConfig.getOutStockMultipleRelateSale()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = SaleOpLogType.class, name = "创建销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建订单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSaleOrderVo vo) { + + SaleOrder order = new SaleOrder(); + order.setId(IdUtil.getId()); + order.setCode(generateCodeService.generate(GenerateCodeTypePool.SALE_ORDER)); + + this.create(order, vo); + + order.setStatus(SaleOrderStatus.CREATED); + + getBaseMapper().insert(order); + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + return order.getId(); + } + + @OpLog(type = SaleOpLogType.class, name = "修改销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改订单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleOrderVo vo) { + + SaleOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED + && order.getStatus() != SaleOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,无法修改!"); + } + + throw new DefaultClientException("订单无法修改!"); + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOrderDetail.class) + .eq(SaleOrderDetail::getOrderId, order.getId()); + saleOrderDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class).eq(SaleOrderDetailBundle::getOrderId, order.getId()); + saleOrderDetailBundleService.remove(deleteDetailBundleWrapper); + + this.create(order, vo); + + order.setStatus(SaleOrderStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SaleOrderStatus.CREATED); + statusList.add(SaleOrderStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, null).set(SaleOrder::getApproveTime, null) + .set(SaleOrder::getRefuseReason, StringPool.EMPTY_STR).eq(SaleOrder::getId, order.getId()) + .in(SaleOrder::getStatus, statusList); + if (getBaseMapper().update(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SaleOpLogType.class, name = "审核通过销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSaleOrderVo vo) { + + SaleOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED + && order.getStatus() != SaleOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核通过!"); + } + + order.setStatus(SaleOrderStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(SaleOrderStatus.CREATED); + statusList.add(SaleOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOrder::getApproveTime, LocalDateTime.now()).eq(SaleOrder::getId, order.getId()) + .in(SaleOrder::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(SaleOrder::getDescription, vo.getDescription()); + } + if (getBaseMapper().update(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(order.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有约定支付,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleOrderDetail.class) + .eq(SaleOrderDetail::getOrderId, order.getId()).orderByAsc(SaleOrderDetail::getOrderNo); + List details = saleOrderDetailService.list(queryDetailWrapper); + + BigDecimal totalNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + + for (SaleOrderDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum()), 2)); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + if (isGift) { + giftNum = NumberUtil.add(giftNum, detail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, detail.getOrderNum()); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class).eq(SaleOrderDetailBundle::getOrderId, order.getId()) + .eq(SaleOrderDetailBundle::getDetailId, detail.getId()); + List saleOrderDetailBundles = saleOrderDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(saleOrderDetailBundles); + + for (SaleOrderDetailBundle saleOrderDetailBundle : saleOrderDetailBundles) { + SaleOrderDetail newDetail = new SaleOrderDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setOrderId(order.getId()); + newDetail.setProductId(saleOrderDetailBundle.getProductId()); + newDetail.setOrderNum(saleOrderDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(saleOrderDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(saleOrderDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(saleOrderDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(detail.getOrderNo()); + newDetail.setOriBundleDetailId(detail.getId()); + newDetail.setTaxAmount(saleOrderDetailBundle.getProductTaxAmount()); + + saleOrderDetailService.save(newDetail); + saleOrderDetailService.removeById(detail.getId()); + + saleOrderDetailBundle.setProductDetailId(newDetail.getId()); + saleOrderDetailBundleService.updateById(saleOrderDetailBundle); + + if (isGift) { + giftNum = NumberUtil.add(giftNum, newDetail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, newDetail.getOrderNum()); + } + } + } + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getTotalNum, totalNum).set(SaleOrder::getTotalGiftNum, giftNum) + .set(SaleOrder::getTotalAmount, totalAmount).eq(SaleOrder::getId, order.getId()); + this.update(updateWrapper); + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + this.sendApprovePassEvent(order); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSaleOrderVo vo) { + + SaleOrderService thisService = getThis(this.getClass()); + + String orderId = thisService.create(vo); + + ApprovePassSaleOrderVo approvePassSaleOrderVo = new ApprovePassSaleOrderVo(); + approvePassSaleOrderVo.setId(orderId); + approvePassSaleOrderVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassSaleOrderVo); + + return orderId; + } + + @OpLog(type = SaleOpLogType.class, name = "审核拒绝销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSaleOrderVo vo) { + + SaleOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + if (order.getStatus() == SaleOrderStatus.APPROVE_REFUSE) { + throw new DefaultClientException("订单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核拒绝!"); + } + + order.setStatus(SaleOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOrder::getApproveTime, LocalDateTime.now()) + .set(SaleOrder::getRefuseReason, vo.getRefuseReason()).eq(SaleOrder::getId, order.getId()) + .eq(SaleOrder::getStatus, SaleOrderStatus.CREATED); + if (getBaseMapper().update(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SaleOpLogType.class, name = "删除销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SaleOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED + && order.getStatus() != SaleOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的销售单据不允许执行删除操作!"); + } + + throw new DefaultClientException("订单无法删除!"); + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOrderDetail.class) + .eq(SaleOrderDetail::getOrderId, order.getId()); + saleOrderDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class).eq(SaleOrderDetailBundle::getOrderId, order.getId()); + saleOrderDetailBundleService.remove(deleteDetailBundleWrapper); + + // 删除订单 + Wrapper deleteWrapper = Wrappers.lambdaQuery(SaleOrder.class) + .eq(SaleOrder::getId, id) + .in(SaleOrder::getStatus, SaleOrderStatus.CREATED, SaleOrderStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", order.getCode()); + } + + @Override + public PageResult querySaleByCondition(Integer pageIndex, Integer pageSize, + String condition, Boolean isReturn) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().querySaleByCondition(condition, isReturn); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult querySaleList(Integer pageIndex, Integer pageSize, + QuerySaleProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().querySaleList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public SaleProductDto getSaleById(String id) { + + SaleProductDto data = getBaseMapper().getSaleById(id); + + return data; + } + + private void create(SaleOrder order, CreateSaleOrderVo vo) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + order.setScId(vo.getScId()); + + Customer customer = customerService.findById(vo.getCustomerId()); + if (customer == null) { + throw new InputErrorException("客户不存在!"); + } + order.setCustomerId(vo.getCustomerId()); + + if (!StringUtil.isBlank(vo.getSalerId())) { + SysUser saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + order.setSalerId(vo.getSalerId()); + } + + BigDecimal totalNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (SaleProductVo productVo : vo.getProducts()) { + + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, productVo.getOrderNum()); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(productVo.getTaxPrice(), productVo.getOrderNum()), + 2)); + + SaleOrderDetail orderDetail = new SaleOrderDetail(); + orderDetail.setId(IdUtil.getId()); + orderDetail.setOrderId(order.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + orderDetail.setProductId(productVo.getProductId()); + orderDetail.setOrderNum(productVo.getOrderNum()); + orderDetail.setOriPrice(productVo.getOriPrice()); + orderDetail.setDiscountRate(productVo.getDiscountRate()); + orderDetail.setTaxPrice(productVo.getTaxPrice()); + orderDetail.setIsGift(isGift); + orderDetail.setTaxRate(product.getSaleTaxRate()); + orderDetail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + orderDetail.setOrderNo(orderNo); + orderDetail.setTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(orderDetail.getTaxPrice(), orderDetail.getOrderNum()), + 2)); + + saleOrderDetailService.save(orderDetail); + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + if (!NumberUtil.isInteger(productVo.getOrderNum())) { + throw new InputErrorException("第" + orderNo + "行商品销售数量必须是整数!"); + } + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getSalePrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(orderDetail.getTaxAmount(), + bundleWeight, 2); + List saleOrderDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + SaleOrderDetailBundle saleOrderDetailBundle = new SaleOrderDetailBundle(); + saleOrderDetailBundle.setId(IdUtil.getId()); + saleOrderDetailBundle.setOrderId(order.getId()); + saleOrderDetailBundle.setDetailId(orderDetail.getId()); + saleOrderDetailBundle.setMainProductId(product.getId()); + saleOrderDetailBundle.setOrderNum(orderDetail.getOrderNum()); + saleOrderDetailBundle.setProductId(productBundle.getProductId()); + saleOrderDetailBundle.setProductOrderNum( + NumberUtil.mul(orderDetail.getOrderNum(), productBundle.getBundleNum())); + saleOrderDetailBundle.setProductOriPrice(productBundle.getSalePrice()); + saleOrderDetailBundle.setProductTaxAmount(BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue())); + // 这里会有尾差 + saleOrderDetailBundle.setProductTaxPrice(NumberUtil.getNumber(NumberUtil.div( + saleOrderDetailBundle.getProductTaxAmount(), + saleOrderDetailBundle.getProductOrderNum()), 6)); + saleOrderDetailBundle.setProductTaxRate(bundle.getSaleTaxRate()); + + return saleOrderDetailBundle; + }).collect(Collectors.toList()); + + saleOrderDetailBundleService.saveBatch(saleOrderDetailBundles); + } + orderNo++; + } + order.setTotalNum(totalNum); + order.setTotalGiftNum(giftNum); + order.setTotalAmount(totalAmount); + order.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + orderPayTypeService.create(order.getId(), vo.getPayTypes()); + } + + private void sendApprovePassEvent(SaleOrder order) { + + ApprovePassOrderDto dto = new ApprovePassOrderDto(); + dto.setId(order.getId()); + dto.setTotalAmount(order.getTotalAmount()); + dto.setApproveTime(order.getApproveTime()); + + ApprovePassSaleOrderEvent event = new ApprovePassSaleOrderEvent(this, dto); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailBundleServiceImpl.java new file mode 100644 index 0000000..d6f9344 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.SaleOutSheetDetailBundleMapper; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class SaleOutSheetDetailBundleServiceImpl extends + BaseMpServiceImpl + implements SaleOutSheetDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailLotServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailLotServiceImpl.java new file mode 100644 index 0000000..03888fc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailLotServiceImpl.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; +import com.lframework.xingyun.sc.mappers.SaleOutSheetDetailLotMapper; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; + +@Service +public class SaleOutSheetDetailLotServiceImpl + extends BaseMpServiceImpl + implements SaleOutSheetDetailLotService { + + @Autowired + private ProductService productService; + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Override + public SaleOutSheetDetailLotDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetailLot detail = getBaseMapper().selectById(id); + + BigDecimal remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()); + if (NumberUtil.lt(remainNum, num)) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + + saleOutSheetDetailService.addReturnNum(detail.getDetailId(), num); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetailLot detail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(detail.getReturnNum(), num)) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + detail.getReturnNum() + + "个,本次取消退货数量不允许大于" + detail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(detail.getId(), num) != 1) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + + saleOutSheetDetailService.subReturnNum(detail.getDetailId(), num); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailServiceImpl.java new file mode 100644 index 0000000..c36f1e3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailServiceImpl.java @@ -0,0 +1,172 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.SaleOutSheetDetailMapper; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailBundleService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; + +@Service +public class SaleOutSheetDetailServiceImpl extends + BaseMpServiceImpl + implements SaleOutSheetDetailService { + + @Autowired + private ProductService productService; + + @Autowired + private SaleOutSheetDetailBundleService saleOutSheetDetailBundleService; + + @Override + public List getBySheetId(String sheetId) { + + return getBaseMapper().getBySheetId(sheetId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetail detail = getBaseMapper().selectById(id); + + BigDecimal remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, BigDecimal num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReturnNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + + orderDetail.getReturnNum() + + "个,本次取消退货数量不允许大于" + orderDetail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + } + + @Override + public BigDecimal getTotalWeightBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .in(SaleOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumWeight = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = saleOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getWeight() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置重量,请检查!"); + } + + return NumberUtil.getNumber( + NumberUtil.mul(targetProduct.getWeight(), b.getProductOrderNum()), 2); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getWeight() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置重量,请检查!"); + } + return NumberUtil.getNumber(NumberUtil.mul(t.getOrderNum(), product.getWeight()), 2); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumWeight; + } + + @Override + public BigDecimal getTotalVolumeBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .in(SaleOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumVolume = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = saleOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getVolume() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置体积,请检查!"); + } + + return NumberUtil.getNumber( + NumberUtil.mul(targetProduct.getVolume(), b.getProductOrderNum()), 2); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getVolume() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置体积,请检查!"); + } + return NumberUtil.getNumber(NumberUtil.mul(t.getOrderNum(), product.getVolume()), 2); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumVolume; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetServiceImpl.java new file mode 100644 index 0000000..54577df --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetServiceImpl.java @@ -0,0 +1,847 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.*; +import com.lframework.xingyun.sc.mappers.SaleOutSheetMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.sale.*; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.sale.out.*; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class SaleOutSheetServiceImpl extends + BaseMpServiceImpl implements SaleOutSheetService { + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Autowired + private SaleOutSheetDetailLotService saleOutSheetDetailLotService; + + @Autowired + private SaleOutSheetDetailBundleService saleOutSheetDetailBundleService; + + @Autowired + private SaleOrderDetailBundleService saleOrderDetailBundleService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private CustomerService customerService; + + @Autowired + private SysUserService userService; + + @Autowired + private SaleOrderService saleOrderService; + + @Autowired + private ProductService productService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private SaleConfigService saleConfigService; + + @Autowired + private SaleOrderDetailService saleOrderDetailService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private LogisticsSheetDetailService logisticsSheetDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySaleOutSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySaleOutSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SaleOutSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public GetPaymentDateDto getPaymentDate(String customerId) { + + //默认为当前日期的30天后,如当天为2021-10-01,则付款日期默认为2021-11-01 + //(1)客户的结算方式为“任意指定”,则付款日期按照以上规则展示默认值,允许用户更改,但仅能选择当天及当天之后的日期。 + //(2)客户的结算方式为“货到付款”(这个参数的名字后期会改,如“货销付款”),则付款日期默认为此刻,且不允许修改,即出库单的创建时间,可能会遇到跨日的问题,但付款日期,均赋值为出库单的创建日期。 + + Customer customer = customerService.findById(customerId); + + GetPaymentDateDto result = new GetPaymentDateDto(); + result.setAllowModify(customer.getSettleType() == SettleType.ARBITRARILY); + + if (customer.getSettleType() == SettleType.ARBITRARILY) { + result.setPaymentDate(LocalDate.now().plusMonths(1)); + } else if (customer.getSettleType() == SettleType.CASH_ON_DELIVERY) { + result.setPaymentDate(LocalDate.now()); + } + + return result; + } + + @Override + public SaleOutSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @Override + public SaleOutSheetWithReturnDto getWithReturn(String id) { + + SaleConfig saleConfig = saleConfigService.get(); + + SaleOutSheetWithReturnDto sheet = getBaseMapper().getWithReturn(id, + saleConfig.getSaleReturnRequireOutStock()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + return sheet; + } + + @Override + public PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QuerySaleOutSheetWithReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + SaleConfig saleConfig = saleConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReturn(vo, + saleConfig.getSaleReturnMultipleRelateOutStock()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = SaleOpLogType.class, name = "创建销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSaleOutSheetVo vo) { + + SaleOutSheet sheet = new SaleOutSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SALE_OUT_SHEET)); + + SaleConfig saleConfig = saleConfigService.get(); + + this.create(sheet, vo, saleConfig.getOutStockRequireSale()); + + sheet.setStatus(SaleOutSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = SaleOpLogType.class, name = "修改销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleOutSheetVo vo) { + + SaleOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED + && sheet.getStatus() != SaleOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("销售出库单已审核通过,无法修改!"); + } + + throw new DefaultClientException("销售出库单无法修改!"); + } + + boolean requireSale = !StringUtil.isBlank(sheet.getSaleOrderId()); + + if (requireSale) { + //查询出库单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetail.class).eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + List details = saleOutSheetDetailService.list(queryDetailWrapper); + for (SaleOutSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getSaleOrderDetailId())) { + //先恢复已出库数量 + saleOrderDetailService.subOutNum(detail.getSaleOrderDetailId(), detail.getOrderNum()); + } + } + } + + // 删除出库单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + saleOutSheetDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getSheetId, sheet.getId()); + saleOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + this.create(sheet, vo, requireSale); + + sheet.setStatus(SaleOutSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SaleOutSheetStatus.CREATED); + statusList.add(SaleOutSheetStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getApproveBy, null).set(SaleOutSheet::getApproveTime, null) + .set(SaleOutSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(SaleOutSheet::getId, sheet.getId()).in(SaleOutSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SaleOpLogType.class, name = "审核通过销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSaleOutSheetVo vo) { + + SaleOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED + && sheet.getStatus() != SaleOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("销售出库单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售出库单无法审核通过!"); + } + + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getOutStockMultipleRelateSale()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleOutSheet.class) + .eq(SaleOutSheet::getSaleOrderId, sheet.getSaleOrderId()) + .ne(SaleOutSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + SaleOrder purchaseOrder = saleOrderService.getById(sheet.getSaleOrderId()); + throw new DefaultClientException("销售订单号:" + purchaseOrder.getCode() + + ",已关联其他销售出库单,不允许关联多个销售出库单!"); + } + } + + if (saleConfig.getOutStockRequireLogistics()) { + // 关联物流单 + LogisticsSheetDetail logisticsSheetDetail = logisticsSheetDetailService.getByBizId( + sheet.getId(), LogisticsSheetDetailBizType.SALE_OUT_SHEET); + if (logisticsSheetDetail == null) { + throw new DefaultClientException("销售出库单尚未发货,无法审核通过!"); + } + } + + sheet.setStatus(SaleOutSheetStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(SaleOutSheetStatus.CREATED); + statusList.add(SaleOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOutSheet::getApproveTime, LocalDateTime.now()) + .eq(SaleOutSheet::getId, sheet.getId()).in(SaleOutSheet::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(SaleOutSheet::getDescription, vo.getDescription()); + } + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售出库单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(SaleOutSheetDetail::getOrderNo); + List details = saleOutSheetDetailService.list(queryDetailWrapper); + + BigDecimal totalNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SaleOutSheetDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum())); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(detail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(detail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.SALE.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + SaleOutSheetDetailLot detailLot = new SaleOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(detail.getId()); + detailLot.setOrderNum(detail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(detail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + saleOutSheetDetailLotService.save(detailLot); + + if (isGift) { + giftNum = NumberUtil.add(giftNum, detail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, detail.getOrderNum()); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getSheetId, sheet.getId()) + .eq(SaleOutSheetDetailBundle::getDetailId, detail.getId()); + List saleOutSheetDetailBundles = saleOutSheetDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(saleOutSheetDetailBundles); + + for (SaleOutSheetDetailBundle saleOutSheetDetailBundle : saleOutSheetDetailBundles) { + SaleOutSheetDetail newDetail = new SaleOutSheetDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setSheetId(sheet.getId()); + newDetail.setProductId(saleOutSheetDetailBundle.getProductId()); + newDetail.setOrderNum(saleOutSheetDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(saleOutSheetDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(saleOutSheetDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(saleOutSheetDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(orderNo++); + newDetail.setSettleStatus(detail.getSettleStatus()); + newDetail.setSaleOrderDetailId(detail.getSaleOrderDetailId()); + newDetail.setOriBundleDetailId(detail.getId()); + newDetail.setTaxAmount(saleOutSheetDetailBundle.getProductTaxAmount()); + + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(newDetail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(newDetail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(newDetail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.SALE.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + SaleOutSheetDetailLot detailLot = new SaleOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(newDetail.getId()); + detailLot.setOrderNum(newDetail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(newDetail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + saleOutSheetDetailLotService.save(detailLot); + + saleOutSheetDetailService.save(newDetail); + saleOutSheetDetailService.removeById(detail.getId()); + + saleOutSheetDetailBundle.setProductDetailId(newDetail.getId()); + saleOutSheetDetailBundleService.updateById(saleOutSheetDetailBundle); + + if (isGift) { + giftNum = NumberUtil.add(giftNum, newDetail.getOrderNum()); + } else { + totalNum = NumberUtil.add(totalNum, newDetail.getOrderNum()); + } + } + } + orderNo++; + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getTotalNum, totalNum).set(SaleOutSheet::getTotalGiftNum, giftNum) + .set(SaleOutSheet::getTotalAmount, totalAmount).eq(SaleOutSheet::getId, sheet.getId()); + this.update(updateWrapper); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSaleOutSheetVo vo) { + + SaleOutSheetService thisService = getThis(this.getClass()); + + String sheetId = thisService.create(vo); + + ApprovePassSaleOutSheetVo approvePassVo = new ApprovePassSaleOutSheetVo(); + approvePassVo.setId(sheetId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return sheetId; + } + + @OpLog(type = SaleOpLogType.class, name = "审核拒绝销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSaleOutSheetVo vo) { + + SaleOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("销售出库单已审核通过,不允许继续执行审核!"); + } + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("销售出库单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售出库单无法审核拒绝!"); + } + + sheet.setStatus(SaleOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOutSheet::getApproveTime, LocalDateTime.now()) + .set(SaleOutSheet::getRefuseReason, vo.getRefuseReason()) + .eq(SaleOutSheet::getId, sheet.getId()) + .eq(SaleOutSheet::getStatus, SaleOutSheetStatus.CREATED); + if (getBaseMapper().update(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SaleOpLogType.class, name = "删除销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SaleOutSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED + && sheet.getStatus() != SaleOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的销售出库单不允许执行删除操作!"); + } + + throw new DefaultClientException("销售出库单无法删除!"); + } + + if (logisticsSheetDetailService.getByBizId(sheet.getId(), + LogisticsSheetDetailBizType.SALE_OUT_SHEET) != null) { + throw new DefaultClientException("销售出库单已关联物流单,请先删除物流单!"); + } + + //查询销售出库单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + List details = saleOutSheetDetailService.list(queryDetailWrapper); + + if (!StringUtil.isBlank(sheet.getSaleOrderId())) { + for (SaleOutSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getSaleOrderDetailId())) { + //恢复已出库数量 + saleOrderDetailService.subOutNum(detail.getSaleOrderDetailId(), detail.getOrderNum()); + } + } + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + saleOutSheetDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getSheetId, sheet.getId()); + saleOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + Wrapper deleteDetailLotWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailLot.class).in(SaleOutSheetDetailLot::getDetailId, + details.stream().map(SaleOutSheetDetail::getId).collect(Collectors.toList())); + saleOutSheetDetailLotService.remove(deleteDetailLotWrapper); + + // 删除订单 + Wrapper deleteWrapper = Wrappers.lambdaQuery(SaleOutSheet.class) + .in(SaleOutSheet::getId, id) + .in(SaleOutSheet::getStatus, SaleOutSheetStatus.CREATED, SaleOutSheetStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("销售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(SaleOutSheet::getId, id) + .eq(SaleOutSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getSettleStatus, SettleStatus.PART_SETTLE).eq(SaleOutSheet::getId, id) + .in(SaleOutSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getSettleStatus, SettleStatus.SETTLED).eq(SaleOutSheet::getId, id) + .in(SaleOutSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(SaleOutSheet sheet, CreateSaleOutSheetVo vo, boolean requireSale) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + sheet.setScId(vo.getScId()); + + Customer customer = customerService.findById(vo.getCustomerId()); + if (customer == null) { + throw new InputErrorException("客户不存在!"); + } + sheet.setCustomerId(vo.getCustomerId()); + + if (!StringUtil.isBlank(vo.getSalerId())) { + SysUser saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + sheet.setSalerId(vo.getSalerId()); + } + + SaleConfig saleConfig = saleConfigService.get(); + + GetPaymentDateDto paymentDate = this.getPaymentDate(customer.getId()); + + sheet.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + + if (requireSale) { + + SaleOrder saleOrder = saleOrderService.getById(vo.getSaleOrderId()); + if (saleOrder == null) { + throw new DefaultClientException("销售订单不存在!"); + } + + sheet.setScId(saleOrder.getScId()); + sheet.setCustomerId(saleOrder.getCustomerId()); + sheet.setSaleOrderId(saleOrder.getId()); + + if (!saleConfig.getOutStockMultipleRelateSale()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleOutSheet.class) + .eq(SaleOutSheet::getSaleOrderId, saleOrder.getId()) + .ne(SaleOutSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("销售订单号:" + saleOrder.getCode() + + ",已关联其他销售出库单,不允许关联多个销售出库单!"); + } + } + } + + BigDecimal purchaseNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (SaleOutProductVo productVo : vo.getProducts()) { + if (requireSale) { + if (!StringUtil.isBlank(productVo.getSaleOrderDetailId())) { + SaleOrderDetail orderDetail = saleOrderDetailService.getById( + productVo.getSaleOrderDetailId()); + productVo.setOriPrice(orderDetail.getOriPrice()); + productVo.setTaxPrice(orderDetail.getTaxPrice()); + productVo.setDiscountRate(orderDetail.getDiscountRate()); + } else { + productVo.setTaxPrice(BigDecimal.ZERO); + productVo.setDiscountRate(BigDecimal.valueOf(100)); + } + } + + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (requireSale) { + if (StringUtil.isBlank(productVo.getSaleOrderDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getOrderNum()); + } else { + purchaseNum = NumberUtil.add(purchaseNum, productVo.getOrderNum()); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(productVo.getTaxPrice(), productVo.getOrderNum()), + 2)); + + SaleOutSheetDetail detail = new SaleOutSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setOrderNum(productVo.getOrderNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription(StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(customer)); + detail.setTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum()), 2)); + if (requireSale && !StringUtil.isBlank(productVo.getSaleOrderDetailId())) { + detail.setSaleOrderDetailId(productVo.getSaleOrderDetailId()); + saleOrderDetailService.addOutNum(productVo.getSaleOrderDetailId(), detail.getOrderNum()); + } + + saleOutSheetDetailService.save(detail); + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + if (!NumberUtil.isInteger(productVo.getOrderNum())) { + throw new InputErrorException("第" + orderNo + "行商品出库数量必须是整数!"); + } + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getSalePrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(detail.getTaxAmount(), + bundleWeight, 2); + List saleOutSheetDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + SaleOutSheetDetailBundle saleOutSheetDetailBundle = new SaleOutSheetDetailBundle(); + saleOutSheetDetailBundle.setId(IdUtil.getId()); + saleOutSheetDetailBundle.setSheetId(sheet.getId()); + saleOutSheetDetailBundle.setDetailId(detail.getId()); + saleOutSheetDetailBundle.setMainProductId(product.getId()); + saleOutSheetDetailBundle.setOrderNum(detail.getOrderNum()); + saleOutSheetDetailBundle.setProductId(productBundle.getProductId()); + saleOutSheetDetailBundle.setProductOrderNum( + NumberUtil.mul(detail.getOrderNum(), productBundle.getBundleNum())); + saleOutSheetDetailBundle.setProductOriPrice(productBundle.getSalePrice()); + saleOutSheetDetailBundle.setProductTaxAmount(BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue())); + // 这里会有尾差 + saleOutSheetDetailBundle.setProductTaxPrice(NumberUtil.getNumber(NumberUtil.div( + saleOutSheetDetailBundle.getProductTaxAmount(), + saleOutSheetDetailBundle.getProductOrderNum()), 6)); + saleOutSheetDetailBundle.setProductTaxRate(bundle.getSaleTaxRate()); + + return saleOutSheetDetailBundle; + }).collect(Collectors.toList()); + + saleOutSheetDetailBundleService.saveBatch(saleOutSheetDetailBundles); + } + // 这里记录没有什么意义,因为销售单审核通过后就已经成单品了 + /* else { + if (requireSale && !StringUtil.isBlank(detail.getSaleOrderDetailId())) { + // 这里如果是关联销售单的话,需要把组合商品信息拿过来,价格不用重新算,因为关联销售单的话,价格不允许修改 + Wrapper querySaleOrderDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class) + .eq(SaleOrderDetailBundle::getOrderId, sheet.getSaleOrderId()) + .eq(SaleOrderDetailBundle::getProductDetailId, detail.getSaleOrderDetailId()); + SaleOrderDetailBundle saleOrderDetailBundle = saleOrderDetailBundleService.getOne( + querySaleOrderDetailBundleWrapper); + if (saleOrderDetailBundle != null) { + SaleOutSheetDetailBundle saleOutSheetDetailBundle = new SaleOutSheetDetailBundle(); + saleOutSheetDetailBundle.setId(IdUtil.getId()); + saleOutSheetDetailBundle.setSheetId(sheet.getId()); + saleOutSheetDetailBundle.setDetailId(detail.getId()); + saleOutSheetDetailBundle.setMainProductId(saleOrderDetailBundle.getMainProductId()); + saleOutSheetDetailBundle.setOrderNum(detail.getOrderNum()); + saleOutSheetDetailBundle.setProductId(saleOrderDetailBundle.getProductId()); + saleOutSheetDetailBundle.setProductOrderNum(saleOrderDetailBundle.getProductOrderNum()); + saleOutSheetDetailBundle.setProductOriPrice(saleOrderDetailBundle.getProductOriPrice()); + saleOutSheetDetailBundle.setProductTaxPrice(saleOrderDetailBundle.getProductTaxPrice()); + saleOutSheetDetailBundle.setProductTaxRate(saleOrderDetailBundle.getProductTaxRate()); + saleOutSheetDetailBundle.setProductDetailId(detail.getId()); + saleOutSheetDetailBundleService.save(saleOutSheetDetailBundle); + } + } + }*/ + orderNo++; + } + sheet.setTotalNum(purchaseNum); + sheet.setTotalGiftNum(giftNum); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setSettleStatus(this.getInitSettleStatus(customer)); + } + + /** + * 根据客户获取初始结算状态 + * + * @param customer + * @return + */ + private SettleStatus getInitSettleStatus(Customer customer) { + + return SettleStatus.UN_SETTLE; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnDetailServiceImpl.java new file mode 100644 index 0000000..d380fc6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.SaleReturnDetail; +import com.lframework.xingyun.sc.mappers.SaleReturnDetailMapper; +import com.lframework.xingyun.sc.service.sale.SaleReturnDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SaleReturnDetailServiceImpl extends + BaseMpServiceImpl + implements SaleReturnDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnServiceImpl.java new file mode 100644 index 0000000..70ea861 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnServiceImpl.java @@ -0,0 +1,593 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.dto.order.ApprovePassOrderDto; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.SaleOpLogType; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.events.order.impl.ApprovePassSaleReturnEvent; +import com.lframework.xingyun.sc.mappers.SaleReturnMapper; +import com.lframework.xingyun.sc.service.sale.*; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.sale.returned.*; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class SaleReturnServiceImpl extends + BaseMpServiceImpl implements SaleReturnService { + + @Autowired + private SaleReturnDetailService saleReturnDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private CustomerService customerService; + + @Autowired + private SysUserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private SaleOutSheetService saleOutSheetService; + + @Autowired + private SaleConfigService saleConfigService; + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Autowired + private SaleOutSheetDetailLotService saleOutSheetDetailLotService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySaleReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySaleReturnVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SaleReturnFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SaleOpLogType.class, name = "创建销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建退货单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSaleReturnVo vo) { + + SaleReturn saleReturn = new SaleReturn(); + saleReturn.setId(IdUtil.getId()); + saleReturn.setCode(generateCodeService.generate(GenerateCodeTypePool.SALE_RETURN)); + + SaleConfig saleConfig = saleConfigService.get(); + + this.create(saleReturn, vo, saleConfig.getSaleReturnRequireOutStock()); + + saleReturn.setStatus(SaleReturnStatus.CREATED); + + getBaseMapper().insert(saleReturn); + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + + return saleReturn.getId(); + } + + @OpLog(type = SaleOpLogType.class, name = "修改销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改退货单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleReturnVo vo) { + + SaleReturn saleReturn = getBaseMapper().selectById(vo.getId()); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED + && saleReturn.getStatus() != SaleReturnStatus.APPROVE_REFUSE) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("销售退货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("销售退货单无法修改!"); + } + + boolean requireOut = !StringUtil.isBlank(saleReturn.getOutSheetId()); + + if (requireOut) { + //查询销售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + List details = saleReturnDetailService.list(queryDetailWrapper); + for (SaleReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //先恢复已退货数量 + saleOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除销售退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + saleReturnDetailService.remove(deleteDetailWrapper); + + this.create(saleReturn, vo, requireOut); + + saleReturn.setStatus(SaleReturnStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SaleReturnStatus.CREATED); + statusList.add(SaleReturnStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getApproveBy, null).set(SaleReturn::getApproveTime, null) + .set(SaleReturn::getRefuseReason, StringPool.EMPTY_STR) + .eq(SaleReturn::getId, saleReturn.getId()).in(SaleReturn::getStatus, statusList); + if (getBaseMapper().update(saleReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SaleOpLogType.class, name = "审核通过销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSaleReturnVo vo) { + + SaleReturn saleReturn = getBaseMapper().selectById(vo.getId()); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED + && saleReturn.getStatus() != SaleReturnStatus.APPROVE_REFUSE) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("销售退货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售退货单无法审核通过!"); + } + + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getSaleReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleReturn.class) + .eq(SaleReturn::getOutSheetId, saleReturn.getOutSheetId()) + .ne(SaleReturn::getId, saleReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + SaleOutSheet saleOutSheet = saleOutSheetService.getById(saleReturn.getOutSheetId()); + throw new DefaultClientException("销售出库单号:" + saleOutSheet.getCode() + + ",已关联其他销售退货单,不允许关联多个销售退货单!"); + } + } + + saleReturn.setStatus(SaleReturnStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(SaleReturnStatus.CREATED); + statusList.add(SaleReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleReturn::getApproveTime, LocalDateTime.now()) + .eq(SaleReturn::getId, saleReturn.getId()).in(SaleReturn::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(SaleReturn::getDescription, vo.getDescription()); + } + if (getBaseMapper().update(saleReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售退货单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()) + .orderByAsc(SaleReturnDetail::getOrderNo); + List details = saleReturnDetailService.list(queryDetailWrapper); + for (SaleReturnDetail detail : details) { + ProductPurchase productPurchase = productPurchaseService.getById(detail.getProductId()); + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(saleReturn.getScId()); + addProductStockVo.setStockNum(detail.getReturnNum()); + addProductStockVo.setDefaultTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(productPurchase.getPrice(), detail.getReturnNum()), + 2)); + addProductStockVo.setBizId(saleReturn.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(saleReturn.getCode()); + addProductStockVo.setBizType(ProductStockBizType.SALE_RETURN.getCode()); + + productStockService.addStock(addProductStockVo); + } + + this.sendApprovePassEvent(saleReturn); + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSaleReturnVo vo) { + + SaleReturnService thisService = getThis(this.getClass()); + + String returnId = thisService.create(vo); + + ApprovePassSaleReturnVo approvePassVo = new ApprovePassSaleReturnVo(); + approvePassVo.setId(returnId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return returnId; + } + + @OpLog(type = SaleOpLogType.class, name = "审核拒绝销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSaleReturnVo vo) { + + SaleReturn saleReturn = getBaseMapper().selectById(vo.getId()); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("销售退货单已审核通过,不允许继续执行审核!"); + } + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_REFUSE) { + throw new DefaultClientException("销售退货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售退货单无法审核拒绝!"); + } + + saleReturn.setStatus(SaleReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleReturn::getApproveTime, LocalDateTime.now()) + .set(SaleReturn::getRefuseReason, vo.getRefuseReason()) + .eq(SaleReturn::getId, saleReturn.getId()) + .eq(SaleReturn::getStatus, SaleReturnStatus.CREATED); + if (getBaseMapper().update(saleReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SaleOpLogType.class, name = "删除销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SaleReturn saleReturn = getBaseMapper().selectById(id); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED + && saleReturn.getStatus() != SaleReturnStatus.APPROVE_REFUSE) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的销售退货单不允许执行删除操作!"); + } + + throw new DefaultClientException("销售退货单无法删除!"); + } + + if (!StringUtil.isBlank(saleReturn.getOutSheetId())) { + //查询销售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + List details = saleReturnDetailService.list(queryDetailWrapper); + for (SaleReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //恢复已退货数量 + saleOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + saleReturnDetailService.remove(deleteDetailWrapper); + + // 删除退货单 + Wrapper deleteWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .eq(SaleReturn::getId, id) + .in(SaleReturn::getStatus, SaleReturnStatus.CREATED, SaleReturnStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("销售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", saleReturn.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getSettleStatus, SettleStatus.UN_SETTLE).eq(SaleReturn::getId, id) + .eq(SaleReturn::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getSettleStatus, SettleStatus.PART_SETTLE).eq(SaleReturn::getId, id) + .in(SaleReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getSettleStatus, SettleStatus.SETTLED).eq(SaleReturn::getId, id) + .in(SaleReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(SaleReturn saleReturn, CreateSaleReturnVo vo, boolean requireOut) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + saleReturn.setScId(vo.getScId()); + + Customer customer = customerService.findById(vo.getCustomerId()); + if (customer == null) { + throw new InputErrorException("客户不存在!"); + } + saleReturn.setCustomerId(vo.getCustomerId()); + + if (!StringUtil.isBlank(vo.getSalerId())) { + SysUser saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + saleReturn.setSalerId(vo.getSalerId()); + } + + SaleConfig saleConfig = saleConfigService.get(); + + GetPaymentDateDto paymentDate = saleOutSheetService.getPaymentDate(customer.getId()); + + saleReturn.setPaymentDate( + paymentDate.getAllowModify() ? vo.getPaymentDate() : paymentDate.getPaymentDate()); + + if (requireOut) { + + SaleOutSheet saleOutSheet = saleOutSheetService.getById(vo.getOutSheetId()); + if (saleOutSheet == null) { + throw new DefaultClientException("销售出库单不存在!"); + } + + saleReturn.setScId(saleOutSheet.getScId()); + saleReturn.setCustomerId(saleOutSheet.getCustomerId()); + saleReturn.setOutSheetId(saleOutSheet.getId()); + + if (!saleConfig.getSaleReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleReturn.class) + .eq(SaleReturn::getOutSheetId, saleOutSheet.getId()) + .ne(SaleReturn::getId, saleReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("销售出库单号:" + saleOutSheet.getCode() + + ",已关联其他销售退货单,不允许关联多个销售退货单!"); + } + } + } + + BigDecimal returnNum = BigDecimal.ZERO; + BigDecimal giftNum = BigDecimal.ZERO; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (SaleReturnProductVo productVo : vo.getProducts()) { + if (requireOut) { + if (!StringUtil.isBlank(productVo.getOutSheetDetailId())) { + SaleOutSheetDetailLotDto detailLot = saleOutSheetDetailLotService.findById( + productVo.getOutSheetDetailId()); + SaleOutSheetDetail detail = saleOutSheetDetailService.getById(detailLot.getDetailId()); + productVo.setOriPrice(detail.getOriPrice()); + productVo.setTaxPrice(detail.getTaxPrice()); + productVo.setDiscountRate(detail.getDiscountRate()); + } else { + productVo.setTaxPrice(BigDecimal.ZERO); + productVo.setDiscountRate(BigDecimal.valueOf(100)); + } + } + + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (requireOut) { + if (StringUtil.isBlank(productVo.getOutSheetDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum = NumberUtil.add(giftNum, productVo.getReturnNum()); + } else { + returnNum = NumberUtil.add(returnNum, productVo.getReturnNum()); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.getNumber(NumberUtil.mul(productVo.getTaxPrice(), productVo.getReturnNum()), + 2)); + + SaleReturnDetail detail = new SaleReturnDetail(); + detail.setId(IdUtil.getId()); + detail.setReturnId(saleReturn.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setReturnNum(productVo.getReturnNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription(StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(customer)); + detail.setTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(detail.getTaxPrice(), detail.getReturnNum()), 2)); + if (requireOut && !StringUtil.isBlank(productVo.getOutSheetDetailId())) { + detail.setOutSheetDetailId(productVo.getOutSheetDetailId()); + saleOutSheetDetailLotService.addReturnNum(productVo.getOutSheetDetailId(), + detail.getReturnNum()); + } + + saleReturnDetailService.save(detail); + orderNo++; + } + saleReturn.setTotalNum(returnNum); + saleReturn.setTotalGiftNum(giftNum); + saleReturn.setTotalAmount(totalAmount); + saleReturn.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + saleReturn.setSettleStatus(this.getInitSettleStatus(customer)); + } + + /** + * 根据客户获取初始结算状态 + * + * @param customer + * @return + */ + private SettleStatus getInitSettleStatus(Customer customer) { + + return SettleStatus.UN_SETTLE; + } + + private void sendApprovePassEvent(SaleReturn r) { + + ApprovePassOrderDto dto = new ApprovePassOrderDto(); + dto.setId(r.getId()); + dto.setTotalAmount(r.getTotalAmount()); + dto.setApproveTime(r.getApproveTime()); + + ApprovePassSaleReturnEvent event = new ApprovePassSaleReturnEvent(this, dto); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockLogServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockLogServiceImpl.java new file mode 100644 index 0000000..3d266e3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockLogServiceImpl.java @@ -0,0 +1,121 @@ +package com.lframework.xingyun.sc.impl.stock; + +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.mappers.ProductStockLogMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockLogService; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithAddStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithSubStockVo; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class ProductStockLogServiceImpl extends + BaseMpServiceImpl + implements ProductStockLogService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductStockLogVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductStockLogVo vo) { + + return getBaseMapper().query(vo); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addLogWithAddStock(AddLogWithAddStockVo vo) { + + Assert.greaterThanZero(vo.getStockNum()); + + ProductStockLog record = new ProductStockLog(); + record.setId(IdUtil.getId()); + record.setScId(vo.getScId()); + record.setProductId(vo.getProductId()); + record.setOriStockNum(vo.getOriStockNum()); + record.setCurStockNum(vo.getCurStockNum()); + record.setOriTaxPrice(vo.getOriTaxPrice()); + record.setCurTaxPrice(vo.getCurTaxPrice()); + record.setStockNum(vo.getStockNum()); + record.setTaxAmount(vo.getTaxAmount()); + if (!StringUtil.isBlank(vo.getCreateBy())) { + record.setCreateBy(vo.getCreateBy()); + } + if (!StringUtil.isBlank(vo.getCreateById())) { + record.setCreateById(vo.getCreateById()); + } + record.setCreateTime(vo.getCreateTime()); + if (!StringUtil.isBlank(vo.getBizId())) { + record.setBizId(vo.getBizId()); + } + if (!StringUtil.isBlank(vo.getBizDetailId())) { + record.setBizDetailId(vo.getBizDetailId()); + } + if (!StringUtil.isBlank(vo.getBizCode())) { + record.setBizCode(vo.getBizCode()); + } + record.setBizType(EnumUtil.getByCode(ProductStockBizType.class, vo.getBizType())); + + getBaseMapper().insert(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addLogWithSubStock(AddLogWithSubStockVo vo) { + Assert.greaterThanZero(vo.getStockNum()); + + ProductStockLog record = new ProductStockLog(); + record.setId(IdUtil.getId()); + record.setScId(vo.getScId()); + record.setProductId(vo.getProductId()); + record.setOriStockNum(vo.getOriStockNum()); + record.setCurStockNum(vo.getCurStockNum()); + record.setOriTaxPrice(vo.getOriTaxPrice()); + record.setCurTaxPrice(vo.getCurTaxPrice()); + record.setStockNum(NumberUtil.abs(vo.getStockNum()).negate()); + record.setTaxAmount(NumberUtil.abs(vo.getTaxAmount()).negate()); + if (!StringUtil.isBlank(vo.getCreateBy())) { + record.setCreateBy(vo.getCreateBy()); + } + if (!StringUtil.isBlank(vo.getCreateById())) { + record.setCreateById(vo.getCreateById()); + } + record.setCreateTime(vo.getCreateTime()); + if (!StringUtil.isBlank(vo.getBizId())) { + record.setBizId(vo.getBizId()); + } + if (!StringUtil.isBlank(vo.getBizDetailId())) { + record.setBizDetailId(vo.getBizDetailId()); + } + if (!StringUtil.isBlank(vo.getBizCode())) { + record.setBizCode(vo.getBizCode()); + } + record.setBizType(EnumUtil.getByCode(ProductStockBizType.class, vo.getBizType())); + + getBaseMapper().insert(record); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockServiceImpl.java new file mode 100644 index 0000000..afee7ab --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockServiceImpl.java @@ -0,0 +1,315 @@ +package com.lframework.xingyun.sc.impl.stock; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.events.stock.AddStockEvent; +import com.lframework.xingyun.sc.events.stock.SubStockEvent; +import com.lframework.xingyun.sc.mappers.ProductStockMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockLogService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithAddStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithSubStockVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class ProductStockServiceImpl extends BaseMpServiceImpl + implements ProductStockService { + + @Autowired + private ProductService productService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private ProductStockLogService productStockLogService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductStockVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductStockVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public ProductStock getByProductIdAndScId(String productId, String scId) { + + Product product = productService.findById(productId); + if (product == null) { + return null; + } + + if (product.getProductType() == ProductType.NORMAL) { + return getBaseMapper().getByProductIdAndScId(productId, scId); + } else { + List productBundles = productBundleService.getByMainProductId(productId); + if (CollectionUtil.isEmpty(productBundles)) { + return null; + } + + List productIds = productBundles.stream().map(ProductBundle::getProductId).collect( + Collectors.toList()); + List productStocks = this.getByProductIdsAndScId(productIds, scId, + ProductType.NORMAL.getCode()); + + BigDecimal stockNum = BigDecimal.valueOf(Integer.MAX_VALUE); + for (ProductBundle productBundle : productBundles) { + String id = productBundle.getProductId(); + ProductStock productStock = productStocks.stream().filter(t -> t.getProductId().equals(id)) + .findFirst().orElse(null); + if (productStock == null || NumberUtil.le(productStock.getStockNum(), 0)) { + // 此处说明有单品没有库存 + return null; + } + + stockNum = BigDecimal.valueOf( + NumberUtil.min(NumberUtil.div(productStock.getStockNum(), productBundle.getBundleNum()), + stockNum).intValue()); + } + + ProductStock productStock = new ProductStock(); + productStock.setId(IdUtil.getId()); + productStock.setScId(scId); + productStock.setProductId(productId); + productStock.setStockNum(stockNum); + productStock.setTaxPrice(BigDecimal.ZERO); + productStock.setTaxAmount(BigDecimal.ZERO); + + return productStock; + } + } + + @Override + public List getByProductIdsAndScId(List productIds, String scId, + Integer productType) { + + if (CollectionUtil.isEmpty(productIds)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByProductIdsAndScId(productIds, scId, productType); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public ProductStockChangeDto addStock(AddProductStockVo vo) { + + Assert.greaterThanZero(vo.getStockNum()); + + Product product = productService.findById(vo.getProductId()); + if (product.getProductType() != ProductType.NORMAL) { + throw new DefaultClientException( + "只有商品类型为【" + ProductType.NORMAL.getDesc() + "】的商品支持入库!"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductStock.class) + .eq(ProductStock::getProductId, vo.getProductId()).eq(ProductStock::getScId, vo.getScId()); + + ProductStock productStock = getBaseMapper().selectOne(queryWrapper); + + boolean isStockEmpty = false; + if (productStock == null) { + //首次入库,先新增 + productStock = new ProductStock(); + productStock.setId(IdUtil.getId()); + productStock.setScId(vo.getScId()); + productStock.setProductId(vo.getProductId()); + productStock.setStockNum(BigDecimal.ZERO); + productStock.setTaxPrice(BigDecimal.ZERO); + productStock.setTaxAmount(BigDecimal.ZERO); + + getBaseMapper().insert(productStock); + + isStockEmpty = true; + } + + // 如果taxAmount为null,代表不重算均价,即:按当前均价直接入库 + boolean reCalcCostPrice = vo.getTaxAmount() != null; + + if (vo.getTaxAmount() == null) { + vo.setTaxAmount(isStockEmpty ? + vo.getDefaultTaxAmount() : + productStock.getTaxAmount()); + } + if (vo.getTaxAmount() == null) { + // 如果此时taxPrice还是null,则代表taxPrice和defaultTaxPrice均为null + throw new DefaultSysException( + "商品ID:" + vo.getProductId() + ",没有库存,taxAmount和defaultTaxAmount不能同时为null!"); + } + + if (isStockEmpty) { + // 如果之前没有库存,那么均价必须重算 + reCalcCostPrice = true; + } + + vo.setTaxAmount(NumberUtil.getNumber(vo.getTaxAmount(), 2)); + int count = getBaseMapper().addStock(vo.getProductId(), vo.getScId(), vo.getStockNum(), + vo.getTaxAmount(), productStock.getStockNum(), + productStock.getTaxAmount(), reCalcCostPrice); + if (count != 1) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "入库失败,请稍后重试!"); + } + + AddLogWithAddStockVo addLogWithAddStockVo = new AddLogWithAddStockVo(); + addLogWithAddStockVo.setProductId(vo.getProductId()); + addLogWithAddStockVo.setScId(vo.getScId()); + addLogWithAddStockVo.setStockNum(vo.getStockNum()); + addLogWithAddStockVo.setTaxAmount(vo.getTaxAmount()); + addLogWithAddStockVo.setOriStockNum(productStock.getStockNum()); + addLogWithAddStockVo.setCurStockNum( + NumberUtil.add(productStock.getStockNum(), vo.getStockNum())); + addLogWithAddStockVo.setOriTaxPrice(productStock.getTaxPrice()); + addLogWithAddStockVo.setCurTaxPrice(!reCalcCostPrice ? + productStock.getTaxPrice() : + NumberUtil.equal(addLogWithAddStockVo.getCurStockNum(), BigDecimal.ZERO) ? + BigDecimal.ZERO : + NumberUtil.getNumber( + NumberUtil.div(NumberUtil.add(productStock.getTaxAmount(), vo.getTaxAmount()), + addLogWithAddStockVo.getCurStockNum()), 6)); + addLogWithAddStockVo.setCreateTime(vo.getCreateTime()); + addLogWithAddStockVo.setBizId(vo.getBizId()); + addLogWithAddStockVo.setBizDetailId(vo.getBizDetailId()); + addLogWithAddStockVo.setBizCode(vo.getBizCode()); + addLogWithAddStockVo.setBizType(vo.getBizType()); + + productStockLogService.addLogWithAddStock(addLogWithAddStockVo); + ProductStockChangeDto stockChange = new ProductStockChangeDto(); + stockChange.setScId(vo.getScId()); + stockChange.setProductId(vo.getProductId()); + stockChange.setNum(vo.getStockNum()); + stockChange.setTaxAmount(addLogWithAddStockVo.getTaxAmount()); + stockChange.setCurTaxPrice(addLogWithAddStockVo.getCurTaxPrice()); + stockChange.setCreateTime(vo.getCreateTime()); + stockChange.setCurStockNum(addLogWithAddStockVo.getCurStockNum()); + + AddStockEvent addStockEvent = new AddStockEvent(this, stockChange); + ApplicationUtil.publishEvent(addStockEvent); + + return stockChange; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public ProductStockChangeDto subStock(SubProductStockVo vo) { + Assert.greaterThanZero(vo.getStockNum()); + + Product product = productService.findById(vo.getProductId()); + if (product.getProductType() != ProductType.NORMAL) { + throw new DefaultClientException( + "只有商品类型为【" + ProductType.NORMAL.getDesc() + "】的商品支持出库!"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductStock.class) + .eq(ProductStock::getProductId, vo.getProductId()).eq(ProductStock::getScId, vo.getScId()); + + ProductStock productStock = getBaseMapper().selectOne(queryWrapper); + if (productStock == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "当前库存为0,无法出库!"); + } + + if (NumberUtil.lt(productStock.getStockNum(), vo.getStockNum())) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "当前库存为" + + productStock.getStockNum() + + ",库存不足,无法出库!"); + } + + // 如果taxAmount为null,代表不重算均价,即:按当前均价直接出库 + boolean reCalcCostPrice = vo.getTaxAmount() != null; + if (vo.getTaxAmount() == null) { + vo.setTaxAmount(NumberUtil.mul(productStock.getTaxPrice(), vo.getStockNum())); + } + + vo.setTaxAmount(NumberUtil.getNumber(vo.getTaxAmount(), 2)); + + BigDecimal subTaxAmount = vo.getTaxAmount(); + + int count = getBaseMapper().subStock(vo.getProductId(), vo.getScId(), vo.getStockNum(), + subTaxAmount, + productStock.getStockNum(), productStock.getTaxAmount(), reCalcCostPrice); + if (count != 1) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "出库失败,请稍后重试!"); + } + + AddLogWithSubStockVo addLogWithAddStockVo = new AddLogWithSubStockVo(); + addLogWithAddStockVo.setProductId(vo.getProductId()); + addLogWithAddStockVo.setScId(vo.getScId()); + addLogWithAddStockVo.setStockNum(vo.getStockNum()); + addLogWithAddStockVo.setTaxAmount(subTaxAmount); + addLogWithAddStockVo.setOriStockNum(productStock.getStockNum()); + addLogWithAddStockVo.setCurStockNum( + NumberUtil.sub(productStock.getStockNum(), vo.getStockNum())); + addLogWithAddStockVo.setOriTaxPrice(productStock.getTaxPrice()); + addLogWithAddStockVo.setCurTaxPrice(!reCalcCostPrice ? + productStock.getTaxPrice() : + NumberUtil.equal(addLogWithAddStockVo.getCurStockNum(), BigDecimal.ZERO) ? + BigDecimal.ZERO : + NumberUtil.getNumber( + NumberUtil.div(NumberUtil.sub(productStock.getTaxAmount(), subTaxAmount), + addLogWithAddStockVo.getCurStockNum()), 6)); + addLogWithAddStockVo.setCreateTime(vo.getCreateTime()); + addLogWithAddStockVo.setBizId(vo.getBizId()); + addLogWithAddStockVo.setBizDetailId(vo.getBizDetailId()); + addLogWithAddStockVo.setBizCode(vo.getBizCode()); + addLogWithAddStockVo.setBizType(vo.getBizType()); + + productStockLogService.addLogWithSubStock(addLogWithAddStockVo); + + ProductStockChangeDto stockChange = new ProductStockChangeDto(); + stockChange.setScId(vo.getScId()); + stockChange.setProductId(vo.getProductId()); + stockChange.setNum(vo.getStockNum()); + stockChange.setTaxAmount(subTaxAmount); + stockChange.setCurTaxPrice(addLogWithAddStockVo.getCurTaxPrice()); + stockChange.setCreateTime(vo.getCreateTime()); + stockChange.setCurStockNum(addLogWithAddStockVo.getCurStockNum()); + + SubStockEvent subStockEvent = new SubStockEvent(this, stockChange); + ApplicationUtil.publishEvent(subStockEvent); + + return stockChange; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustReasonServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustReasonServiceImpl.java new file mode 100644 index 0000000..f60df89 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustReasonServiceImpl.java @@ -0,0 +1,158 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.enums.StockAdjustOpLogType; +import com.lframework.xingyun.sc.mappers.StockAdjustReasonMapper; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.CreateStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.UpdateStockAdjustReasonVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class StockAdjustReasonServiceImpl extends + BaseMpServiceImpl + implements StockAdjustReasonService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustReasonVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryStockAdjustReasonVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + StockAdjustReasonSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = StockAdjustReason.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public StockAdjustReason findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = StockAdjustOpLogType.class, name = "删除库存调整原因,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustReason.class) + .set(StockAdjustReason::getAvailable, Boolean.FALSE).eq(StockAdjustReason::getId, id); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = StockAdjustOpLogType.class, name = "新增库存调整原因,ID:{}, 编号:{}", params = { + "#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateStockAdjustReasonVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(StockAdjustReason.class) + .eq(StockAdjustReason::getCode, vo.getCode()) + .eq(StockAdjustReason::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + StockAdjustReason data = new StockAdjustReason(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = StockAdjustOpLogType.class, name = "修改库存调整原因,ID:{}, 编号:{}", params = { + "#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateStockAdjustReasonVo vo) { + + StockAdjustReason data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整原因不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(StockAdjustReason.class) + .eq(StockAdjustReason::getCode, vo.getCode()) + .eq(StockAdjustReason::getAvailable, Boolean.TRUE).ne(StockAdjustReason::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + StockAdjustReason.class) + .set(StockAdjustReason::getCode, vo.getCode()).set(StockAdjustReason::getName, vo.getName()) + .set(StockAdjustReason::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(StockAdjustReason::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = StockAdjustReason.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetDetailServiceImpl.java new file mode 100644 index 0000000..5cf3721 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; +import com.lframework.xingyun.sc.mappers.StockAdjustSheetDetailMapper; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class StockAdjustSheetDetailServiceImpl + extends BaseMpServiceImpl + implements StockAdjustSheetDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetServiceImpl.java new file mode 100644 index 0000000..220990e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetServiceImpl.java @@ -0,0 +1,390 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.StockAdjustOpLogType; +import com.lframework.xingyun.sc.enums.StockAdjustSheetBizType; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import com.lframework.xingyun.sc.mappers.StockAdjustSheetMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetDetailService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetService; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class StockAdjustSheetServiceImpl extends + BaseMpServiceImpl + implements StockAdjustSheetService { + + @Autowired + private StockAdjustSheetDetailService stockAdjustSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Autowired + private ProductService productService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryStockAdjustSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public StockAdjustSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = StockAdjustOpLogType.class, name = "新增库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建调整单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateStockAdjustSheetVo vo) { + + StockAdjustSheet data = new StockAdjustSheet(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.STOCK_ADJUST_SHEET)); + + this.create(data, vo); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = StockAdjustOpLogType.class, name = "修改库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改调整单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateStockAdjustSheetVo vo) { + + StockAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.CREATED + && data.getStatus() != StockAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,无法修改!"); + } + + throw new DefaultClientException("库存调整单无法修改!"); + } + + // 删除出库单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class) + .eq(StockAdjustSheetDetail::getSheetId, data.getId()); + stockAdjustSheetDetailService.remove(deleteDetailWrapper); + + this.create(data, vo); + + data.setStatus(StockAdjustSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(StockAdjustSheetStatus.CREATED); + statusList.add(StockAdjustSheetStatus.APPROVE_REFUSE); + + Wrapper updateSheetWrapper = Wrappers.lambdaUpdate( + StockAdjustSheet.class) + .set(StockAdjustSheet::getApproveBy, null) + .set(StockAdjustSheet::getApproveTime, null) + .set(StockAdjustSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(StockAdjustSheet::getId, data.getId()) + .in(StockAdjustSheet::getStatus, statusList); + if (getBaseMapper().update(data, updateSheetWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = StockAdjustOpLogType.class, name = "删除库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + StockAdjustSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的库存调整单不允许执行删除操作!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, id) + .in(StockAdjustSheet::getStatus, StockAdjustSheetStatus.CREATED, + StockAdjustSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class) + .eq(StockAdjustSheetDetail::getSheetId, id); + stockAdjustSheetDetailService.remove(deleteDetailWrapper); + } + + @OpLog(type = StockAdjustOpLogType.class, name = "审核通过库存调整单,ID:{}", params = {"#vo.id"}) + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassStockAdjustSheetVo vo) { + + StockAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.CREATED + && data.getStatus() != StockAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存调整单无法审核通过!"); + } + + LocalDateTime now = LocalDateTime.now(); + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, data.getId()) + .in(StockAdjustSheet::getStatus, StockAdjustSheetStatus.CREATED, + StockAdjustSheetStatus.APPROVE_REFUSE) + .set(StockAdjustSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(StockAdjustSheet::getApproveTime, now) + .set(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_PASS) + .set(StockAdjustSheet::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class) + .eq(StockAdjustSheetDetail::getSheetId, data.getId()) + .orderByAsc(StockAdjustSheetDetail::getOrderNo); + List details = stockAdjustSheetDetailService.list( + queryDetailWrapper); + + for (StockAdjustSheetDetail detail : details) { + Product product = productService.findById(detail.getProductId()); + ProductPurchase productPurchase = productPurchaseService.getById(product.getId()); + if (data.getBizType() == StockAdjustSheetBizType.IN) { + // 入库 + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(product.getId()); + addProductStockVo.setScId(data.getScId()); + addProductStockVo.setStockNum(detail.getStockNum()); + addProductStockVo.setDefaultTaxAmount( + NumberUtil.getNumber(NumberUtil.mul(productPurchase.getPrice(), detail.getStockNum()), + 2)); + addProductStockVo.setCreateTime(now); + addProductStockVo.setBizId(data.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(data.getCode()); + addProductStockVo.setBizType(ProductStockBizType.STOCK_ADJUST.getCode()); + + productStockService.addStock(addProductStockVo); + } else { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(product.getId()); + subProductStockVo.setScId(data.getScId()); + subProductStockVo.setStockNum(detail.getStockNum()); + subProductStockVo.setCreateTime(now); + subProductStockVo.setBizId(data.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(data.getCode()); + subProductStockVo.setBizType(ProductStockBizType.STOCK_ADJUST.getCode()); + + productStockService.subStock(subProductStockVo); + } + } + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateStockAdjustSheetVo vo) { + + StockAdjustSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassStockAdjustSheetVo approvePassVo = new ApprovePassStockAdjustSheetVo(); + approvePassVo.setId(id); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return id; + } + + @OpLog(type = StockAdjustOpLogType.class, name = "审核拒绝库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseStockAdjustSheetVo vo) { + + StockAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.CREATED + && data.getStatus() != StockAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存调整单无法审核通过!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, data.getId()) + .in(StockAdjustSheet::getStatus, StockAdjustSheetStatus.CREATED, + StockAdjustSheetStatus.APPROVE_REFUSE) + .set(StockAdjustSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(StockAdjustSheet::getApproveTime, LocalDateTime.now()) + .set(StockAdjustSheet::getRefuseReason, vo.getRefuseReason()) + .set(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult queryStockAdjustByCondition(Integer pageIndex, + Integer pageSize, String scId, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryStockAdjustByCondition(scId, + condition); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryStockAdjustList(Integer pageIndex, + Integer pageSize, QueryStockAdjustProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryStockAdjustList(vo); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + private void create(StockAdjustSheet data, CreateStockAdjustSheetVo vo) { + + data.setScId(vo.getScId()); + data.setStatus(StockAdjustSheetStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + data.setBizType(EnumUtil.getByCode(StockAdjustSheetBizType.class, vo.getBizType())); + data.setReasonId(vo.getReasonId()); + + int orderNo = 1; + for (StockAdjustProductVo product : vo.getProducts()) { + StockAdjustSheetDetail detail = new StockAdjustSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setStockNum(product.getStockNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + + stockAdjustSheetDetailService.save(detail); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetDetailServiceImpl.java new file mode 100644 index 0000000..84e297f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; +import com.lframework.xingyun.sc.mappers.PreTakeStockSheetDetailMapper; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class PreTakeStockSheetDetailServiceImpl + extends BaseMpServiceImpl + implements PreTakeStockSheetDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetServiceImpl.java new file mode 100644 index 0000000..decb8ce --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetServiceImpl.java @@ -0,0 +1,229 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import com.lframework.xingyun.sc.enums.TakeStockOpLogType; +import com.lframework.xingyun.sc.mappers.PreTakeStockSheetMapper; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetDetailService; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.pre.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class PreTakeStockSheetServiceImpl extends + BaseMpServiceImpl + implements PreTakeStockSheetService { + + @Autowired + private PreTakeStockSheetDetailService preTakeStockSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryPreTakeStockSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPreTakeStockSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + PreTakeStockSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public PreTakeStockSheetFullDto getDetail(String id) { + + PreTakeStockSheetFullDto data = getBaseMapper().getDetail(id); + if (data == null) { + throw new DefaultClientException("预先盘点单不存在!"); + } + + return data; + } + + @Override + public List getProducts(String id, String planId) { + + return getBaseMapper().getProducts(id, planId); + } + + @OpLog(type = TakeStockOpLogType.class, name = "新增预先盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePreTakeStockSheetVo vo) { + + PreTakeStockSheet data = new PreTakeStockSheet(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.PRE_TAKE_STOCK_SHEET)); + data.setScId(vo.getScId()); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + data.setTakeStatus(EnumUtil.getByCode(PreTakeStockSheetStatus.class, vo.getTakeStatus())); + + getBaseMapper().insert(data); + + int orderNo = 1; + for (PreTakeStockProductVo product : vo.getProducts()) { + PreTakeStockSheetDetail detail = new PreTakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setFirstNum(product.getFirstNum()); + detail.setSecondNum(product.getSecondNum()); + detail.setRandNum(product.getRandNum()); + detail.setOrderNo(orderNo++); + + preTakeStockSheetDetailService.save(detail); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = TakeStockOpLogType.class, name = "修改预先盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePreTakeStockSheetVo vo) { + + PreTakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("预先盘点单不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + PreTakeStockSheet.class) + .set(PreTakeStockSheet::getScId, vo.getScId()).set(PreTakeStockSheet::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(PreTakeStockSheet::getTakeStatus, + EnumUtil.getByCode(PreTakeStockSheetStatus.class, vo.getTakeStatus())) + .eq(PreTakeStockSheet::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PreTakeStockSheetDetail.class) + .eq(PreTakeStockSheetDetail::getSheetId, data.getId()); + preTakeStockSheetDetailService.remove(deleteDetailWrapper); + + int orderNo = 1; + for (PreTakeStockProductVo product : vo.getProducts()) { + PreTakeStockSheetDetail detail = new PreTakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setFirstNum(product.getFirstNum()); + detail.setSecondNum(product.getSecondNum()); + detail.setRandNum(product.getRandNum()); + detail.setOrderNo(orderNo++); + + preTakeStockSheetDetailService.save(detail); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = TakeStockOpLogType.class, name = "删除预先盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + if (takeStockSheetService.hasRelatePreTakeStockSheet(id)) { + throw new DefaultClientException("已有库存盘点单关联此预先盘点单,不允许执行删除操作!"); + } + + getBaseMapper().deleteById(id); + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PreTakeStockSheetDetail.class) + .eq(PreTakeStockSheetDetail::getSheetId, id); + preTakeStockSheetDetailService.remove(deleteDetailWrapper); + } + + @Override + public PageResult queryPreTakeStockByCondition(Integer pageIndex, + Integer pageSize, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPreTakeStockByCondition(condition); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryPreTakeStockList(Integer pageIndex, + Integer pageSize, QueryPreTakeStockProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPreTakeStockList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockConfigServiceImpl.java new file mode 100644 index 0000000..5a1bead --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockConfigServiceImpl.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.enums.TakeStockOpLogType; +import com.lframework.xingyun.sc.mappers.TakeStockConfigMapper; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.vo.stock.take.config.UpdateTakeStockConfigVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; + +@Service +public class TakeStockConfigServiceImpl extends + BaseMpServiceImpl + implements TakeStockConfigService { + + @Cacheable(value = TakeStockConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public TakeStockConfig get() { + + return getBaseMapper().selectOne(Wrappers.query()); + } + + @OpLog(type = TakeStockOpLogType.class, name = "修改盘点参数,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateTakeStockConfigVo vo) { + + TakeStockConfig data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点参数不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + TakeStockConfig.class) + .set(TakeStockConfig::getShowProduct, vo.getShowProduct()) + .set(TakeStockConfig::getShowStock, vo.getShowStock()) + .set(TakeStockConfig::getAutoChangeStock, vo.getAutoChangeStock()) + .set(TakeStockConfig::getAllowChangeNum, vo.getAllowChangeNum()) + .set(TakeStockConfig::getCancelHours, vo.getCancelHours()) + .eq(TakeStockConfig::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = TakeStockConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanDetailServiceImpl.java new file mode 100644 index 0000000..42195ff --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanDetailServiceImpl.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; +import com.lframework.xingyun.sc.mappers.TakeStockPlanDetailMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; + +@Service +public class TakeStockPlanDetailServiceImpl extends + BaseMpServiceImpl + implements TakeStockPlanDetailService { + + @Autowired + private ProductStockService productStockService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Override + public GetTakeStockPlanDetailProductDto getByPlanIdAndProductId(String planId, String productId) { + + return getBaseMapper().getByPlanIdAndProductId(planId, productId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void savePlanDetailBySimple(String planId, List productIds) { + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(planId); + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, planId).orderByAsc(TakeStockPlanDetail::getOrderNo); + + List planDetails = getBaseMapper().selectList(queryDetailWrapper); + + int orderNo = planDetails.size() + 1; + for (String productId : productIds) { + if (planDetails.stream().anyMatch(t -> t.getProductId().equals(productId))) { + continue; + } + + TakeStockPlanDetail detail = new TakeStockPlanDetail(); + detail.setId(IdUtil.getId()); + detail.setPlanId(planId); + detail.setProductId(productId); + + ProductStock productStock = productStockService.getByProductIdAndScId(productId, + takeStockPlan.getScId()); + detail.setStockNum(productStock == null ? BigDecimal.ZERO : productStock.getStockNum()); + + detail.setDescription(StringPool.EMPTY_STR); + detail.setOrderNo(orderNo++); + getBaseMapper().insert(detail); + } + } + + @Override + public List getDetailsByPlanId(String planId) { + + return getBaseMapper().getDetailsByPlanId(planId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateOriTakeNum(String planId, String productId, BigDecimal num) { + + getBaseMapper().updateOriTakeNum(planId, productId, num); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void adjustStockNum(String planId) { + getBaseMapper().adjustStockNum(planId); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanServiceImpl.java new file mode 100644 index 0000000..8533a8d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanServiceImpl.java @@ -0,0 +1,443 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.*; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.qrtz.QrtzJob; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.TakeStockOpLogType; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.events.stock.take.DeleteTakeStockPlanEvent; +import com.lframework.xingyun.sc.mappers.TakeStockPlanMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.*; +import com.lframework.xingyun.sc.vo.stock.take.plan.HandleTakeStockPlanVo.ProductVo; +import lombok.extern.slf4j.Slf4j; +import org.quartz.JobExecutionContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + +@Slf4j +@Service +public class TakeStockPlanServiceImpl extends BaseMpServiceImpl + implements TakeStockPlanService { + + @Autowired + private TakeStockPlanDetailService takeStockPlanDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ProductService productService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private TakeStockConfigService takeStockConfigService; + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryTakeStockPlanVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryTakeStockPlanVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + TakeStockPlanSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public TakeStockPlanFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = TakeStockOpLogType.class, name = "新增盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateTakeStockPlanVo vo) { + + TakeStockPlan data = new TakeStockPlan(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.TAKE_STOCK_PLAN)); + data.setScId(vo.getScId()); + data.setTakeType(EnumUtil.getByCode(TakeStockPlanType.class, vo.getTakeType())); + if (data.getTakeType() == TakeStockPlanType.CATEGORY + || data.getTakeType() == TakeStockPlanType.BRAND) { + data.setBizId(StringUtil.join(",", vo.getBizIds())); + } + + data.setTakeStatus(TakeStockPlanStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + List products = null; + if (data.getTakeType() != TakeStockPlanType.SIMPLE) { + // 单品盘点不生成明细 + if (data.getTakeType() == TakeStockPlanType.ALL) { + // 全场盘点 + // 将所有商品添加明细 + QueryProductVo queryProductVo = new QueryProductVo(); + queryProductVo.setProductType(ProductType.NORMAL.getCode()); + Integer count = productService.queryCount(queryProductVo); + if (count > 2000) { + throw new DefaultClientException( + TakeStockPlanType.ALL.getDesc() + "最多支持2000个商品,当前系统内已经超过2000个商品,无法进行" + + TakeStockPlanType.ALL.getDesc()); + } + products = productService.query(queryProductVo); + } else if (data.getTakeType() == TakeStockPlanType.CATEGORY) { + // 分类盘点 + products = productService.getByCategoryIds(vo.getBizIds(), ProductType.NORMAL.getCode()); + } else if (data.getTakeType() == TakeStockPlanType.BRAND) { + // 品牌盘点 + products = productService.getByBrandIds(vo.getBizIds(), ProductType.NORMAL.getCode()); + } + } + + if (data.getTakeType() != TakeStockPlanType.SIMPLE && CollectionUtil.isEmpty(products)) { + throw new DefaultClientException("没有查询到商品信息,无法生成盘点任务!"); + } + + if (products != null) { + List productIds = products.stream().map(Product::getId) + .collect(Collectors.toList()); + List productStocks = productStockService.getByProductIdsAndScId(productIds, + vo.getScId(), ProductType.NORMAL.getCode()); + int orderNo = 1; + for (Product product : products) { + ProductStock productStock = productStocks.stream() + .filter(t -> t.getProductId().equals(product.getId())) + .findFirst().orElse(null); + + TakeStockPlanDetail detail = new TakeStockPlanDetail(); + detail.setId(IdUtil.getId()); + detail.setPlanId(data.getId()); + detail.setProductId(product.getId()); + + detail.setStockNum(productStock == null ? BigDecimal.ZERO : productStock.getStockNum()); + detail.setTotalOutNum(BigDecimal.ZERO); + detail.setTotalInNum(BigDecimal.ZERO); + detail.setOrderNo(orderNo++); + + takeStockPlanDetailService.save(detail); + } + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = TakeStockOpLogType.class, name = "修改盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateTakeStockPlanVo vo) { + + TakeStockPlan data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点任务不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getScId, vo.getScId()) + .set(TakeStockPlan::getDescription, vo.getDescription()) + .eq(TakeStockPlan::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @Override + public List getProducts(String planId) { + + return getBaseMapper().getProducts(planId); + } + + @OpLog(type = TakeStockOpLogType.class, name = "差异生成,盘点任务ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void createDiff(String id) { + + TakeStockPlan data = getBaseMapper().selectById(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + // 判断是否还有没审核通过的盘点单 + if (takeStockSheetService.hasUnApprove(data.getId())) { + throw new DefaultClientException("盘点任务存在未审核的库存盘点单,请优先处理库存盘点单!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.DIFF_CREATED) + .eq(TakeStockPlan::getId, data.getId()) + .eq(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, data.getId()) + .orderByAsc(TakeStockPlanDetail::getOrderNo); + List details = takeStockPlanDetailService.list(queryDetailWrapper); + if (CollectionUtil.isEmpty(details)) { + throw new DefaultClientException("盘点任务不存在商品信息,不允许执行差异生成操作!"); + } + for (TakeStockPlanDetail detail : details) { + if (detail.getOriTakeNum() != null) { + continue; + } + LambdaUpdateWrapper updateDetailWrapper = Wrappers.lambdaUpdate( + TakeStockPlanDetail.class).set(TakeStockPlanDetail::getOriTakeNum, 0) + .eq(TakeStockPlanDetail::getId, detail.getId()); + + takeStockPlanDetailService.update(updateDetailWrapper); + } + + TakeStockConfig config = takeStockConfigService.get(); + if (config.getAutoChangeStock()) { + takeStockPlanDetailService.adjustStockNum(data.getId()); + } + } + + @OpLog(type = TakeStockOpLogType.class, name = "差异处理,盘点任务ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void handleDiff(HandleTakeStockPlanVo vo) { + + TakeStockPlan data = getBaseMapper().selectById(vo.getId()); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.FINISHED) + .eq(TakeStockPlan::getId, data.getId()) + .eq(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.DIFF_CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + TakeStockConfig config = takeStockConfigService.get(); + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, data.getId()) + .orderByAsc(TakeStockPlanDetail::getOrderNo); + List details = takeStockPlanDetailService.list(queryDetailWrapper); + if (CollectionUtil.isEmpty(details)) { + throw new DefaultClientException("盘点任务不存在商品信息,不允许执行差异处理操作!"); + } + + if (!config.getAllowChangeNum().equals(vo.getAllowChangeNum()) || !config.getAutoChangeStock() + .equals(vo.getAutoChangeStock())) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + for (TakeStockPlanDetail detail : details) { + ProductVo productVo = vo.getProducts().stream() + .filter(t -> t.getProductId().equals(detail.getProductId())).findFirst().get(); + if (config.getAllowChangeNum()) { + // 如果允许修改盘点数量 + detail.setTakeNum(productVo.getTakeNum()); + } else { + detail.setTakeNum(detail.getOriTakeNum()); + } + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + + LambdaUpdateWrapper updateDetailWrapper = Wrappers.lambdaUpdate( + TakeStockPlanDetail.class).set(TakeStockPlanDetail::getTakeNum, detail.getTakeNum()) + .set(TakeStockPlanDetail::getDescription, detail.getDescription()) + .eq(TakeStockPlanDetail::getId, detail.getId()); + takeStockPlanDetailService.update(updateDetailWrapper); + } + + // 进行出入库操作 + for (TakeStockPlanDetail detail : details) { + if (!NumberUtil.equal(detail.getStockNum(), detail.getTakeNum())) { + if (NumberUtil.lt(detail.getStockNum(), detail.getTakeNum())) { + Product product = productService.findById(detail.getProductId()); + ProductPurchase purchase = productPurchaseService.getById(product.getId()); + // 如果库存数量小于盘点数量,则报溢 + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(data.getScId()); + addProductStockVo.setStockNum(NumberUtil.sub(detail.getTakeNum(), detail.getStockNum())); + addProductStockVo.setDefaultTaxAmount(NumberUtil.getNumber( + NumberUtil.mul(purchase.getPrice(), addProductStockVo.getStockNum()), 2)); + addProductStockVo.setBizId(data.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(data.getCode()); + addProductStockVo.setBizType(ProductStockBizType.TAKE_STOCK_IN.getCode()); + + productStockService.addStock(addProductStockVo); + } else { + // 如果库存数量大于盘点数量,则报损 + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(detail.getProductId()); + subProductStockVo.setScId(data.getScId()); + subProductStockVo.setStockNum(NumberUtil.sub(detail.getStockNum(), detail.getTakeNum())); + subProductStockVo.setBizId(data.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(data.getCode()); + subProductStockVo.setBizType(ProductStockBizType.TAKE_STOCK_OUT.getCode()); + + productStockService.subStock(subProductStockVo); + } + } + } + + OpLogUtil.setVariable("id", vo.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = TakeStockOpLogType.class, name = "作废盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void cancel(CancelTakeStockPlanVo vo) { + + TakeStockPlan data = getBaseMapper().selectById(vo.getId()); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CANCELED) + .eq(TakeStockPlan::getId, data.getId()) + .in(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CREATED, + TakeStockPlanStatus.DIFF_CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", vo.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = TakeStockOpLogType.class, name = "删除盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + TakeStockPlan data = getBaseMapper().selectById(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(TakeStockPlan.class) + .eq(TakeStockPlan::getId, data.getId()) + .eq(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CANCELED); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, data.getId()); + takeStockPlanDetailService.remove(deleteDetailWrapper); + + DeleteTakeStockPlanEvent deleteEvent = new DeleteTakeStockPlanEvent(this, data.getId()); + ApplicationUtil.publishEvent(deleteEvent); + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + /** + * 自动作废任务 + */ + @Slf4j + public static class AutoCancelJob extends QrtzJob { + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Override + public void onExecute(JobExecutionContext context) { + + String id = (String) context.getMergedJobDataMap().get("id"); + + CancelTakeStockPlanVo cancelVo = new CancelTakeStockPlanVo(); + cancelVo.setId(id); + takeStockPlanService.cancel(cancelVo); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetDetailServiceImpl.java new file mode 100644 index 0000000..c799ee4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; +import com.lframework.xingyun.sc.mappers.TakeStockSheetDetailMapper; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class TakeStockSheetDetailServiceImpl extends + BaseMpServiceImpl + implements TakeStockSheetDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetServiceImpl.java new file mode 100644 index 0000000..6d7a6d9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetServiceImpl.java @@ -0,0 +1,469 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.*; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; +import com.lframework.xingyun.sc.enums.TakeStockOpLogType; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import com.lframework.xingyun.sc.events.stock.take.DeleteTakeStockPlanEvent; +import com.lframework.xingyun.sc.mappers.TakeStockSheetMapper; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.sheet.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class TakeStockSheetServiceImpl extends + BaseMpServiceImpl + implements TakeStockSheetService { + + @Autowired + private TakeStockSheetDetailService takeStockSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Autowired + private TakeStockPlanDetailService takeStockPlanDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryTakeStockSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryTakeStockSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public TakeStockSheetFullDto getDetail(String id) { + + TakeStockSheetFullDto data = getBaseMapper().getDetail(id); + if (data == null) { + throw new DefaultClientException("盘点单不存在!"); + } + + return data; + } + + @OpLog(type = TakeStockOpLogType.class, name = "新增盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建盘点单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateTakeStockSheetVo vo) { + + TakeStockSheet data = new TakeStockSheet(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.TAKE_STOCK_SHEET)); + data.setPlanId(vo.getPlanId()); + data.setPreSheetId(vo.getPreSheetId()); + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(vo.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许进行新增!"); + } + + data.setScId(takeStockPlan.getScId()); + data.setStatus(TakeStockSheetStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + int orderNo = 1; + for (TakeStockSheetProductVo product : vo.getProducts()) { + TakeStockSheetDetail detail = new TakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setTakeNum(product.getTakeNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + + takeStockSheetDetailService.save(detail); + } + + // 盘点任务如果是单品盘点 + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + takeStockPlanDetailService.savePlanDetailBySimple(takeStockPlan.getId(), + vo.getProducts().stream().map(TakeStockSheetProductVo::getProductId) + .collect(Collectors.toList())); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = TakeStockOpLogType.class, name = "修改盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#_result", name = "修改盘点单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateTakeStockSheetVo vo) { + + TakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许进行修改!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(TakeStockSheet::getApproveBy, null).set(TakeStockSheet::getApproveTime, null) + .set(TakeStockSheet::getRefuseReason, null) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED) + .eq(TakeStockSheet::getId, vo.getId()) + .in(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED, + TakeStockSheetStatus.APPROVE_REFUSE); + + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()); + takeStockSheetDetailService.remove(deleteDetailWrapper); + + int orderNo = 1; + for (TakeStockSheetProductVo product : vo.getProducts()) { + TakeStockSheetDetail detail = new TakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setTakeNum(product.getTakeNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + + takeStockSheetDetailService.save(detail); + } + + // 盘点任务如果是单品盘点 + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + takeStockPlanDetailService.savePlanDetailBySimple(takeStockPlan.getId(), + vo.getProducts().stream().map(TakeStockSheetProductVo::getProductId) + .collect(Collectors.toList())); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = TakeStockOpLogType.class, name = "审核通过盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassTakeStockSheetVo vo) { + + TakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许继续执行审核!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(TakeStockSheet::getApproveTime, LocalDateTime.now()) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.APPROVE_PASS) + .eq(TakeStockSheet::getId, data.getId()) + .in(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED, + TakeStockSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()) + .orderByAsc(TakeStockSheetDetail::getOrderNo); + List details = takeStockSheetDetailService.list(queryDetailWrapper); + for (TakeStockSheetDetail detail : details) { + takeStockPlanDetailService.updateOriTakeNum(data.getPlanId(), detail.getProductId(), + detail.getTakeNum()); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateTakeStockSheetVo vo) { + + TakeStockSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassTakeStockSheetVo approveVo = new ApprovePassTakeStockSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = TakeStockOpLogType.class, name = "审核拒绝盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseTakeStockSheetVo vo) { + + TakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许继续执行审核!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(TakeStockSheet::getApproveTime, LocalDateTime.now()) + .set(TakeStockSheet::getRefuseReason, + StringUtil.isBlank(vo.getRefuseReason()) ? StringPool.EMPTY_STR : vo.getRefuseReason()) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.APPROVE_REFUSE) + .eq(TakeStockSheet::getId, data.getId()) + .eq(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = CancelApproveOrderTimeLineBizType.class, orderId = "#id", name = "取消审核") + @OpLog(type = TakeStockOpLogType.class, name = "取消审核通过盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void cancelApprovePass(String id) { + + TakeStockSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许执行取消审核!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getApproveBy, null).set(TakeStockSheet::getApproveTime, null) + .set(TakeStockSheet::getRefuseReason, null) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED) + .eq(TakeStockSheet::getId, data.getId()) + .eq(TakeStockSheet::getStatus, TakeStockSheetStatus.APPROVE_PASS); + + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()) + .orderByAsc(TakeStockSheetDetail::getOrderNo); + List details = takeStockSheetDetailService.list(queryDetailWrapper); + for (TakeStockSheetDetail detail : details) { + takeStockPlanDetailService.updateOriTakeNum(data.getPlanId(), detail.getProductId(), + detail.getTakeNum().negate()); + } + + OpLogUtil.setVariable("id", data.getId()); + } + + @OpLog(type = TakeStockOpLogType.class, name = "删除盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + TakeStockSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(TakeStockSheet.class) + .eq(TakeStockSheet::getId, id) + .in(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED, + TakeStockSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()); + takeStockSheetDetailService.remove(deleteDetailWrapper); + } + + @Override + public Boolean hasRelatePreTakeStockSheet(String preSheetId) { + + return getBaseMapper().hasRelatePreTakeStockSheet(preSheetId); + } + + @Override + public Boolean hasUnApprove(String planId) { + + return getBaseMapper().hasUnApprove(planId); + } + + @Override + public PageResult queryTakeStockByCondition(Integer pageIndex, + Integer pageSize, String planId, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryTakeStockByCondition(planId, + condition); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryTakeStockList(Integer pageIndex, + Integer pageSize, QueryTakeStockSheetProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryTakeStockList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + @Service + public static class DeleteTakeStockPlanListener implements + ApplicationListener { + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Autowired + private TakeStockSheetDetailService takeStockSheetDetailService; + + @OpLog(type = TakeStockOpLogType.class, name = "删除库存盘点表,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteTakeStockPlanEvent deleteTakeStockPlanEvent) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(TakeStockSheet.class) + .eq(TakeStockSheet::getPlanId, deleteTakeStockPlanEvent.getId()); + List sheets = takeStockSheetService.list(deleteWrapper); + + List ids = CollectionUtil.emptyList(); + + if (!CollectionUtil.isEmpty(sheets)) { + ids = sheets.stream().map(TakeStockSheet::getId).collect(Collectors.toList()); + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .in(TakeStockSheetDetail::getSheetId, ids); + takeStockSheetDetailService.remove(deleteDetailWrapper); + } + + takeStockSheetService.remove(deleteWrapper); + + OpLogUtil.setVariable("ids", ids); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailReceiveServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailReceiveServiceImpl.java new file mode 100644 index 0000000..b7a728d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailReceiveServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.transfer; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import com.lframework.xingyun.sc.mappers.ScTransferOrderDetailReceiveMapper; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailReceiveService; +import org.springframework.stereotype.Service; + +@Service +public class ScTransferOrderDetailReceiveServiceImpl + extends BaseMpServiceImpl + implements ScTransferOrderDetailReceiveService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailServiceImpl.java new file mode 100644 index 0000000..0813b93 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailServiceImpl.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.impl.stock.transfer; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; +import com.lframework.xingyun.sc.mappers.ScTransferOrderDetailMapper; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; + +@Service +public class ScTransferOrderDetailServiceImpl + extends BaseMpServiceImpl + implements ScTransferOrderDetailService { + + @Transactional(rollbackFor = Exception.class) + @Override + public int receive(String orderId, String productId, BigDecimal receiveNum, BigDecimal receiveAmount) { + return getBaseMapper().receive(orderId, productId, receiveNum, receiveAmount); + } + + @Override + public int countUnReceive(String orderId) { + return getBaseMapper().countUnReceive(orderId); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderServiceImpl.java new file mode 100644 index 0000000..5d37f94 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderServiceImpl.java @@ -0,0 +1,477 @@ +package com.lframework.xingyun.sc.impl.stock.transfer; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.core.components.timeline.ReceiveOrderTimeLineBizType; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.ScTransferOpLogType; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import com.lframework.xingyun.sc.mappers.ScTransferOrderMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailReceiveService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderService; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.transfer.*; +import com.lframework.xingyun.sc.vo.stock.transfer.ReceiveScTransferOrderVo.ReceiveScTransferProductVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class ScTransferOrderServiceImpl extends + BaseMpServiceImpl + implements ScTransferOrderService { + + @Autowired + private ScTransferOrderDetailService scTransferOrderDetailService; + + @Autowired + private ScTransferOrderDetailReceiveService scTransferOrderDetailReceiveService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductService productService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryScTransferOrderVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryScTransferOrderVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public ScTransferOrderFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScTransferOpLogType.class, name = "新增仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建调拨单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateScTransferOrderVo vo) { + + ScTransferOrder data = new ScTransferOrder(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.SC_TRANSFER_ORDER)); + + this.create(data, vo); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScTransferOpLogType.class, name = "修改仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改调拨单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateScTransferOrderVo vo) { + + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.CREATED + && data.getStatus() != ScTransferOrderStatus.APPROVE_REFUSE) { + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("仓库调拨单已审核通过,无法修改!"); + } + + throw new DefaultClientException("仓库调拨单无法修改!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class) + .eq(ScTransferOrderDetail::getOrderId, data.getId()); + scTransferOrderDetailService.remove(deleteDetailWrapper); + + this.create(data, vo); + + data.setStatus(ScTransferOrderStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(ScTransferOrderStatus.CREATED); + statusList.add(ScTransferOrderStatus.APPROVE_REFUSE); + + Wrapper updateSheetWrapper = Wrappers.lambdaUpdate( + ScTransferOrder.class) + .set(ScTransferOrder::getApproveBy, null) + .set(ScTransferOrder::getApproveTime, null) + .set(ScTransferOrder::getRefuseReason, StringPool.EMPTY_STR) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, statusList); + if (getBaseMapper().update(data, updateSheetWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScTransferOpLogType.class, name = "删除仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + ScTransferOrder data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS + || data.getStatus() == ScTransferOrderStatus.PART_RECEIVED + || data.getStatus() == ScTransferOrderStatus.RECEIVED) { + throw new DefaultClientException("“审核通过”的仓库调拨单不允许执行删除操作!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(ScTransferOrder.class) + .eq(ScTransferOrder::getId, id) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.CREATED, + ScTransferOrderStatus.APPROVE_REFUSE); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class) + .eq(ScTransferOrderDetail::getOrderId, id); + scTransferOrderDetailService.remove(deleteDetailWrapper); + + Wrapper deleteDetailReceiveWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetailReceive.class).eq(ScTransferOrderDetailReceive::getOrderId, id); + scTransferOrderDetailReceiveService.remove(deleteDetailReceiveWrapper); + } + + @OpLog(type = ScTransferOpLogType.class, name = "审核通过仓库调拨单,ID:{}", params = {"#vo.id"}) + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassScTransferOrderVo vo) { + + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.CREATED + && data.getStatus() != ScTransferOrderStatus.APPROVE_REFUSE) { + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("仓库调拨单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("仓库调拨单无法审核通过!"); + } + + LocalDateTime now = LocalDateTime.now(); + Wrapper updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.CREATED, + ScTransferOrderStatus.APPROVE_REFUSE) + .set(ScTransferOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ScTransferOrder::getApproveTime, now) + .set(ScTransferOrder::getStatus, ScTransferOrderStatus.APPROVE_PASS) + .set(ScTransferOrder::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class) + .eq(ScTransferOrderDetail::getOrderId, data.getId()) + .orderByAsc(ScTransferOrderDetail::getOrderNo); + List details = scTransferOrderDetailService.list( + queryDetailWrapper); + + BigDecimal totalAmount = BigDecimal.ZERO; + for (ScTransferOrderDetail detail : details) { + Product product = productService.findById(detail.getProductId()); + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(product.getId()); + subProductStockVo.setScId(data.getSourceScId()); + subProductStockVo.setStockNum(detail.getTransferNum()); + subProductStockVo.setCreateTime(now); + subProductStockVo.setBizId(data.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(data.getCode()); + subProductStockVo.setBizType(ProductStockBizType.SC_TRANSFER.getCode()); + + ProductStockChangeDto changeDto = productStockService.subStock(subProductStockVo); + + detail.setTaxPrice(changeDto.getCurTaxPrice()); + detail.setTransferAmount(NumberUtil.abs(changeDto.getTaxAmount())); + + Wrapper updateDetailWrapper = Wrappers.lambdaUpdate( + ScTransferOrderDetail.class).eq(ScTransferOrderDetail::getId, detail.getId()) + .set(ScTransferOrderDetail::getTaxPrice, detail.getTaxPrice()).set(ScTransferOrderDetail::getTransferAmount, detail.getTransferAmount()); + scTransferOrderDetailService.update(updateDetailWrapper); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getTransferNum())); + } + + updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .eq(ScTransferOrder::getId, data.getId()).set(ScTransferOrder::getTotalAmount, totalAmount); + this.update(updateWrapper); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateScTransferOrderVo vo) { + + ScTransferOrderService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassScTransferOrderVo approvePassVo = new ApprovePassScTransferOrderVo(); + approvePassVo.setId(id); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return id; + } + + @OpLog(type = ScTransferOpLogType.class, name = "审核拒绝仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseScTransferOrderVo vo) { + + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.CREATED + && data.getStatus() != ScTransferOrderStatus.APPROVE_REFUSE) { + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("仓库调拨单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("仓库调拨单无法审核通过!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.CREATED, + ScTransferOrderStatus.APPROVE_REFUSE) + .set(ScTransferOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ScTransferOrder::getApproveTime, LocalDateTime.now()) + .set(ScTransferOrder::getRefuseReason, vo.getRefuseReason()) + .set(ScTransferOrder::getStatus, ScTransferOrderStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ReceiveOrderTimeLineBizType.class, orderId = "#vo.id", name = "仓库调拨单收货") + @Transactional(rollbackFor = Exception.class) + @Override + public void receive(ReceiveScTransferOrderVo vo) { + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.APPROVE_PASS + && data.getStatus() != ScTransferOrderStatus.PART_RECEIVED) { + + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + LocalDateTime now = LocalDateTime.now(); + for (ReceiveScTransferProductVo productVo : vo.getProducts()) { + Wrapper queryWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class).eq(ScTransferOrderDetail::getOrderId, data.getId()) + .eq(ScTransferOrderDetail::getProductId, productVo.getProductId()); + ScTransferOrderDetail detail = scTransferOrderDetailService.getOne(queryWrapper); + // 入库 + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(data.getTargetScId()); + addProductStockVo.setStockNum(productVo.getReceiveNum()); + if (NumberUtil.equal(productVo.getReceiveNum(), NumberUtil.sub(detail.getTransferNum(), detail.getReceiveNum()))) { + // 本次是全部收货 + addProductStockVo.setTaxAmount(NumberUtil.sub(detail.getTransferAmount(), detail.getReceiveAmount())); + } else { + // 按比例分配 + addProductStockVo.setTaxAmount(NumberUtil.getNumber(NumberUtil.mul(NumberUtil.div(detail.getTransferAmount(), detail.getTransferNum()), productVo.getReceiveNum()), 2)); + } + addProductStockVo.setCreateTime(now); + addProductStockVo.setBizId(data.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(data.getCode()); + addProductStockVo.setBizType(ProductStockBizType.SC_TRANSFER.getCode()); + + productStockService.addStock(addProductStockVo); + + ScTransferOrderDetailReceive detailReceive = new ScTransferOrderDetailReceive(); + detailReceive.setId(IdUtil.getId()); + detailReceive.setOrderId(data.getId()); + detailReceive.setDetailId(detail.getId()); + detailReceive.setReceiveNum(productVo.getReceiveNum()); + detailReceive.setReceiveAmount(addProductStockVo.getTaxAmount()); + scTransferOrderDetailReceiveService.save(detailReceive); + + if (scTransferOrderDetailService.receive(data.getId(), productVo.getProductId(), + productVo.getReceiveNum(), addProductStockVo.getTaxAmount()) != 1) { + Product product = productService.findById(productVo.getProductId()); + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "待收货数量不足,请检查!"); + } + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .set(ScTransferOrder::getStatus, + scTransferOrderDetailService.countUnReceive(data.getId()) > 0 + ? ScTransferOrderStatus.PART_RECEIVED : ScTransferOrderStatus.RECEIVED) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.APPROVE_PASS, + ScTransferOrderStatus.PART_RECEIVED); + if (!this.update(updateWrapper)) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + } + + + @Override + public PageResult queryScTransferByCondition(Integer pageIndex, + Integer pageSize, String scId, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryScTransferByCondition(scId, + condition); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryScTransferList(Integer pageIndex, + Integer pageSize, QueryScTransferProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryScTransferList(vo); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + private void create(ScTransferOrder data, CreateScTransferOrderVo vo) { + + data.setSourceScId(vo.getSourceScId()); + data.setTargetScId(vo.getTargetScId()); + if (StringUtil.equals(vo.getSourceScId(), vo.getTargetScId())) { + throw new DefaultClientException("转出仓库和转入仓库不允许相同!"); + } + data.setStatus(ScTransferOrderStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + BigDecimal totalNum = BigDecimal.ZERO; + int orderNo = 1; + for (ScTransferProductVo product : vo.getProducts()) { + ScTransferOrderDetail detail = new ScTransferOrderDetail(); + detail.setId(IdUtil.getId()); + detail.setOrderId(data.getId()); + detail.setProductId(product.getProductId()); + if (!NumberUtil.isNumberPrecision(product.getTransferNum(), 8)) { + throw new DefaultClientException("第" + orderNo + "行商品的调拨数量最多允许8位小数!"); + } + detail.setTransferNum(product.getTransferNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + + totalNum = NumberUtil.add(detail.getTransferNum(), totalNum); + + scTransferOrderDetailService.save(detail); + } + data.setTotalNum(totalNum); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningNotifyServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningNotifyServiceImpl.java new file mode 100644 index 0000000..4768cdb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningNotifyServiceImpl.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.sc.impl.stock.warning; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.xingyun.sc.entity.ProductStockWarningNotify; +import com.lframework.xingyun.sc.enums.StockWarningOpLogType; +import com.lframework.xingyun.sc.mappers.ProductStockWarningNotifyMapper; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningNotifyService; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; + +@Service +public class ProductStockWarningNotifyServiceImpl extends + BaseMpServiceImpl implements + ProductStockWarningNotifyService { + + @Cacheable(cacheNames = "product_stock_warning_notify", key = "@cacheVariables.tenantId() + 'lastNotifyTime' + '_' + #warningId + '_' + #groupId", unless = "#result == null") + @Override + public LocalDateTime getLastNotifyTime(String warningId, String groupId) { + return null; + } + + @CachePut(cacheNames = "product_stock_warning_notify", key = "@cacheVariables.tenantId() + 'lastNotifyTime' + '_' + #warningId + '_' + #groupId") + @Override + public LocalDateTime setLastNotifyTime(String warningId, String groupId) { + + return LocalDateTime.now(); + } + + @OpLog(type = StockWarningOpLogType.class, name = "新增消息通知组,ID:{}", params = "#groupId") + @Transactional(rollbackFor = Exception.class) + @Override + public void createSetting(String groupId) { + + Wrapper checkWrapper = Wrappers.lambdaQuery( + ProductStockWarningNotify.class) + .eq(ProductStockWarningNotify::getNotifyGroupId, groupId); + if (count(checkWrapper) > 0) { + throw new DefaultClientException("消息通知组已设置,不允许重复设置!"); + } + + ProductStockWarningNotify record = new ProductStockWarningNotify(); + record.setId(IdUtil.getId()); + record.setNotifyGroupId(groupId); + + save(record); + } + + @OpLog(type = StockWarningOpLogType.class, name = "删除消息通知组,ID:{}", params = "#groupId") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteSetting(String groupId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery( + ProductStockWarningNotify.class) + .eq(ProductStockWarningNotify::getNotifyGroupId, groupId); + remove(deleteWrapper); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningServiceImpl.java new file mode 100644 index 0000000..3d9d0dd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningServiceImpl.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.sc.impl.stock.warning; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import com.lframework.xingyun.sc.enums.StockWarningOpLogType; +import com.lframework.xingyun.sc.mappers.ProductStockWarningMapper; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningService; +import com.lframework.xingyun.sc.vo.stock.warning.CreateProductStockWarningVo; +import com.lframework.xingyun.sc.vo.stock.warning.QueryProductStockWarningVo; +import com.lframework.xingyun.sc.vo.stock.warning.UpdateProductStockWarningVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class ProductStockWarningServiceImpl extends + BaseMpServiceImpl implements + ProductStockWarningService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductStockWarningVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductStockWarningVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public ProductStockWarning findById(String id) { + return this.getById(id); + } + + @OpLog(type = StockWarningOpLogType.class, name = "创建库存预警,ID:{}", params = "#_result", autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductStockWarningVo vo) { + + if (NumberUtil.lt(vo.getMaxLimit(), vo.getMinLimit())) { + throw new DefaultClientException("预警上限必须大于预警下限!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductStockWarning.class) + .eq(ProductStockWarning::getScId, vo.getScId()) + .eq(ProductStockWarning::getProductId, vo.getProductId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("该仓库、商品已存在库存预警,不允许重复添加!"); + } + + ProductStockWarning record = new ProductStockWarning(); + record.setId(IdUtil.getId()); + record.setScId(vo.getScId()); + record.setProductId(vo.getProductId()); + record.setMaxLimit(vo.getMaxLimit()); + record.setMinLimit(vo.getMinLimit()); + + this.save(record); + + return record.getId(); + } + + @OpLog(type = StockWarningOpLogType.class, name = "修改库存预警,ID:{}", params = "#vo.id", autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductStockWarningVo vo) { + if (NumberUtil.lt(vo.getMaxLimit(), vo.getMinLimit())) { + throw new DefaultClientException("预警上限必须大于预警下限!"); + } + + ProductStockWarning record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("库存预警不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductStockWarning.class) + .eq(ProductStockWarning::getScId, vo.getScId()) + .eq(ProductStockWarning::getProductId, vo.getProductId()) + .ne(ProductStockWarning::getId, record.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("该仓库、商品已存在库存预警,不允许重复添加!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductStockWarning.class) + .eq(ProductStockWarning::getId, vo.getId()) + .set(ProductStockWarning::getScId, vo.getScId()) + .set(ProductStockWarning::getProductId, vo.getProductId()) + .set(ProductStockWarning::getMaxLimit, vo.getMaxLimit()) + .set(ProductStockWarning::getMinLimit, vo.getMinLimit()) + .set(ProductStockWarning::getAvailable, vo.getAvailable()); + this.update(updateWrapper); + } + + @OpLog(type = StockWarningOpLogType.class, name = "删除库存预警,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + this.removeById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + if (!CollectionUtil.isEmpty(ids)) { + for (String id : ids) { + + ProductStockWarningService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningSysNotifyRule.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningSysNotifyRule.java new file mode 100644 index 0000000..e80152d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/warning/ProductStockWarningSysNotifyRule.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.sc.impl.stock.warning; + +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.notify.SysNotifyRuleEmail; +import com.lframework.starter.web.core.components.notify.SysNotifyRuleSys; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.starter.web.inner.dto.notify.SysNotifyParamsDto; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.Map; + +@Component +public class ProductStockWarningSysNotifyRule implements SysNotifyRuleSys, + SysNotifyRuleEmail { + + public static final Integer BIZ_TYPE = 200; + + @Override + public String getTitle(SysNotifyParamsDto params) { + Map variables = getVariables(params.getVariables()); + String productCode = variables.get("productCode"); + String productName = variables.get("productName"); + String bizType = variables.get("bizType"); + return StringUtil.format("{}商品编号:{},商品名称:{},{}", "【库存预警】", productCode, + productName, "0".equals(bizType) ? "库存不足" : "库存超限"); + } + + @Override + public String getContent(SysNotifyParamsDto params) { + Map variables = getVariables(params.getVariables()); + String productCode = variables.get("productCode"); + String productName = variables.get("productName"); + String currentStock = variables.get("currentStock"); + String bizType = variables.get("bizType"); + BigDecimal minLimit = new BigDecimal(variables.get("minLimit")); + BigDecimal maxLimit = new BigDecimal(variables.get("maxLimit")); + + return StringUtil.format( + "商品编号:{},商品名称:{},当前库存:{},{}:{},{}", + productCode, productName, + currentStock, "0".equals(bizType) ? "已达到当前预警下限" : "已达到当前预警上限", + "0".equals(bizType) ? NumberUtil.getNumber(minLimit, 8) : NumberUtil.getNumber(maxLimit, 8), "0".equals(bizType) ? "请尽快补货" : "请注意"); + } + + @Override + public boolean match(Integer bizType) { + return BIZ_TYPE.equals(bizType); + } + + private Map getVariables(Object vars) { + return JsonUtil.parseMap(String.valueOf(vars), String.class, String.class); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/OrderDataListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/OrderDataListener.java new file mode 100644 index 0000000..117c7d7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/OrderDataListener.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.sc.listeners.app; + +import com.lframework.starter.mq.core.producer.MqProducer; +import com.lframework.xingyun.core.queue.MqConstants; +import com.lframework.xingyun.sc.events.order.ApprovePassOrderEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.event.TransactionalEventListener; + +@Component +public class OrderDataListener { + + @Autowired + private MqProducer mqProducer; + + @TransactionalEventListener + public void execute(ApprovePassOrderEvent event) { + mqProducer.sendMessage(MqConstants.APPROVE_PASS_ORDER, event.getOrder()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockChangeToMqListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockChangeToMqListener.java new file mode 100644 index 0000000..1a0fbfa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockChangeToMqListener.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.listeners.app; + +import com.lframework.starter.mq.core.producer.MqProducer; +import com.lframework.xingyun.core.queue.MqConstants; +import com.lframework.xingyun.sc.events.stock.AddStockEvent; +import com.lframework.xingyun.sc.events.stock.SubStockEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.event.TransactionalEventListener; + +@Component +public class StockChangeToMqListener { + + @Autowired + private MqProducer mqProducer; + + @TransactionalEventListener + public void addStock(AddStockEvent addStockEvent) { + mqProducer.sendMessage(MqConstants.ADD_STOCK, addStockEvent.getChange()); + } + + @TransactionalEventListener + public void subStock(SubStockEvent subStockEvent) { + mqProducer.sendMessage(MqConstants.SUB_STOCK, subStockEvent.getChange()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockWarningForDeleteSysNotifyGroupListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockWarningForDeleteSysNotifyGroupListener.java new file mode 100644 index 0000000..f1586e4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/app/StockWarningForDeleteSysNotifyGroupListener.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.listeners.app; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.web.inner.events.system.DeleteSysNotifyGroupEvent; +import com.lframework.xingyun.sc.entity.ProductStockWarningNotify; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningNotifyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class StockWarningForDeleteSysNotifyGroupListener implements + ApplicationListener { + + @Autowired + private ProductStockWarningNotifyService productStockWarningNotifyService; + + @Override + public void onApplicationEvent(DeleteSysNotifyGroupEvent event) { + Wrapper queryWrapper = Wrappers.lambdaQuery( + ProductStockWarningNotify.class) + .eq(ProductStockWarningNotify::getNotifyGroupId, event.getEntity().getId()); + if (productStockWarningNotifyService.count(queryWrapper) > 0) { + throw new DefaultClientException( + "消息通知组:" + event.getEntity().getName() + + "已被应用在库存预警,请先取消设置再删除该消息通知组!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/ProductStockWarningStockChangeListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/ProductStockWarningStockChangeListener.java new file mode 100644 index 0000000..4071e59 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/ProductStockWarningStockChangeListener.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.sc.listeners.mq; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.locker.LockBuilder; +import com.lframework.starter.common.locker.Locker; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.mq.core.service.MqProducerService; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.starter.web.inner.dto.notify.SysNotifyDto; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.core.queue.MqStringPool; +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import com.lframework.xingyun.sc.entity.ProductStockWarningNotify; +import com.lframework.xingyun.sc.impl.stock.warning.ProductStockWarningSysNotifyRule; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningNotifyService; +import com.lframework.xingyun.sc.service.stock.warning.ProductStockWarningService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.ExchangeTypes; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Slf4j +@Component("productStockWarningStockChangeListener") +public class ProductStockWarningStockChangeListener { + + @Autowired + private ProductStockWarningService productStockWarningService; + + @Autowired + private LockBuilder lockBuilder; + + @Autowired + private ProductStockWarningNotifyService productStockWarningNotifyService; + + @Autowired + private MqProducerService mqProducerService; + + @Autowired + private ProductService productService; + + @RabbitListener(bindings = { + @QueueBinding(value = @Queue(value = "product_stock_warning.add_stock"), exchange = @Exchange(value = MqStringPool.ADD_STOCK_EXCHANGE, type = ExchangeTypes.FANOUT))}) + public void addStock(Message message) { + handleStockChange(message, true); + } + + @RabbitListener(bindings = { + @QueueBinding(value = @Queue(value = "product_stock_warning.sub_stock"), exchange = @Exchange(value = MqStringPool.SUB_STOCK_EXCHANGE, type = ExchangeTypes.FANOUT))}) + public void subStock(Message message) { + handleStockChange(message, false); + } + + private void handleStockChange(Message message, boolean isAdd) { + ProductStockChangeDto dto = message.getPayload(); + ProductStockWarning productStockWarning = getProductStockWarning(dto.getScId(), + dto.getProductId()); + if (productStockWarning == null) { + return; + } + + BigDecimal currentStock = dto.getCurStockNum(); + if ((isAdd && NumberUtil.le(productStockWarning.getMaxLimit(), currentStock)) || (!isAdd + && NumberUtil.ge(productStockWarning.getMinLimit(), currentStock))) { + log.info("scId = {}, productId = {}, 预警{}限 = {}, 当前库存 = {}, 开始预警", + dto.getScId(), dto.getProductId(), isAdd ? "上" : "下", + isAdd ? productStockWarning.getMaxLimit() : productStockWarning.getMinLimit(), + currentStock); + + List notifyList = productStockWarningNotifyService.list(); + if (CollectionUtil.isEmpty(notifyList)) { + log.info("没有设置预警通知组,不发送消息"); + return; + } + + try { + Product product = productService.findById(dto.getProductId()); + if (product == null) { + log.warn("商品 {} 不存在", dto.getProductId()); + return; + } + + Locker locker = lockBuilder.buildLocker( + "product_stock_warning_" + dto.getScId() + "_" + dto.getProductId(), + 60000L, + 5000L); + if (locker.lock()) { + try { + sendNotifications(notifyList, product, productStockWarning, currentStock, isAdd); + } finally { + locker.unLock(); + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + } + + private void sendNotifications(List notifyList, Product product, + ProductStockWarning productStockWarning, BigDecimal currentStock, boolean isAdd) { + for (ProductStockWarningNotify notify : notifyList) { + // 预警增加时效,不能一直预警 + LocalDateTime lastNotifyTime = productStockWarningNotifyService.getLastNotifyTime( + productStockWarning.getId(), notify.getNotifyGroupId()); + if (lastNotifyTime != null && !lastNotifyTime.plusHours(3).isBefore(LocalDateTime.now())) { + // 预警超过3个小时才会重新预警 + log.info("warningId {}, notifyGruopId {}, 距离上次预警不足3小时,不重复提醒", + productStockWarning.getId(), notify.getNotifyGroupId()); + continue; + } + + log.info("开始发送预警,通知组ID = {}", notify.getId()); + SysNotifyDto sysNotifyDto = new SysNotifyDto(); + Map variables = new HashMap<>(6, 1); + variables.put("productCode", product.getCode()); + variables.put("productName", product.getName()); + variables.put("bizType", isAdd ? 1 : 0); + variables.put("currentStock", currentStock); + variables.put("maxLimit", productStockWarning.getMaxLimit()); + variables.put("minLimit", productStockWarning.getMinLimit()); + + sysNotifyDto.setVariables(JsonUtil.toJsonString(variables)); + sysNotifyDto.setBizType(ProductStockWarningSysNotifyRule.BIZ_TYPE); + sysNotifyDto.setNotifyGroupId(notify.getNotifyGroupId()); + + try { + mqProducerService.createSysNotify(sysNotifyDto); + productStockWarningNotifyService.setLastNotifyTime(productStockWarning.getId(), + notify.getNotifyGroupId()); + } catch (Exception e) { + log.error("发送通知失败: {}", e.getMessage(), e); + } + } + } + + private ProductStockWarning getProductStockWarning(String scId, String productId) { + return productStockWarningService.getOne( + Wrappers.lambdaQuery(ProductStockWarning.class).eq(ProductStockWarning::getScId, scId) + .eq(ProductStockWarning::getProductId, productId) + .eq(ProductStockWarning::getAvailable, Boolean.TRUE)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/TakeStockPlanStockChangeListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/TakeStockPlanStockChangeListener.java new file mode 100644 index 0000000..f48deeb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/listeners/mq/TakeStockPlanStockChangeListener.java @@ -0,0 +1,47 @@ +package com.lframework.xingyun.sc.listeners.mq; + +import com.lframework.xingyun.core.queue.MqStringPool; +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.mappers.TakeStockPlanDetailMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.ExchangeTypes; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Slf4j +@Component("takeStockPlanStockChangeListener") +public class TakeStockPlanStockChangeListener { + + @Autowired + private TakeStockPlanDetailMapper takeStockPlanDetailMapper; + + @Transactional(rollbackFor = Exception.class) + @RabbitListener(bindings = { + @QueueBinding(value = @Queue(value = "take_stock_plan.add_stock"), exchange = @Exchange(value = MqStringPool.ADD_STOCK_EXCHANGE, type = ExchangeTypes.FANOUT)) + }) + public void addStock(Message message) { + ProductStockChangeDto change = message.getPayload(); + log.info("增加库存,统计进项数量 scId = {}, productId = {}, num = {}", change.getScId(), + change.getProductId(), change.getNum()); + takeStockPlanDetailMapper.addTotalInNum(change.getScId(), change.getProductId(), + change.getNum()); + } + + @Transactional(rollbackFor = Exception.class) + @RabbitListener(bindings = { + @QueueBinding(value = @Queue(value = "take_stock_plan.sub_stock"), exchange = @Exchange(value = MqStringPool.SUB_STOCK_EXCHANGE, type = ExchangeTypes.FANOUT)) + }) + public void subStock(Message message) { + ProductStockChangeDto change = message.getPayload(); + log.info("扣减库存,统计出项数量 scId = {}, productId = {}, num = {}", change.getScId(), + change.getProductId(), change.getNum()); + takeStockPlanDetailMapper.addTotalOutNum(change.getScId(), change.getProductId(), + change.getNum()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetDetailMapper.java new file mode 100644 index 0000000..a3a2732 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; + +/** + *

+ * 物流单明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface LogisticsSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetMapper.java new file mode 100644 index 0000000..d7f0de1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetMapper.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetSelectorVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetBizOrderVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 物流单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface LogisticsSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "logisticsNo", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + @Sort(value = "deliveryTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List query(@Param("vo") QueryLogisticsSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + LogisticsSheetFullDto getDetail(String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List selector(@Param("vo") LogisticsSheetSelectorVo vo); + + /** + * 查询业务单据列表 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List queryBizOrder(@Param("vo") QueryLogisticsSheetBizOrderVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderPayTypeMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderPayTypeMapper.java new file mode 100644 index 0000000..0b4459b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderPayTypeMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.OrderPayType; + +/** + *

+ * 订单支付方式 Mapper 接口 + *

+ * + * @author zmj + */ +public interface OrderPayTypeMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetDetailMapper.java new file mode 100644 index 0000000..6eedc35 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; + +/** + *

+ * 预先盘点单详情 Mapper 接口 + *

+ * + * @author zmj + */ +public interface PreTakeStockSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetMapper.java new file mode 100644 index 0000000..8e82bdd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetMapper.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockProductVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 预先盘点单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface PreTakeStockSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryPreTakeStockSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PreTakeStockSheetFullDto getDetail(@Param("id") String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "tb") + }) + List selector(@Param("vo") PreTakeStockSheetSelectorVo vo); + + /** + * 根据预先盘点单、盘点任务查询商品信息 + * + * @param id + * @param planId + * @return + */ + List getProducts(@Param("id") String id, + @Param("planId") String planId); + + /** + * 根据关键字查询预先盘点单商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPreTakeStockByCondition(@Param("condition") String condition); + + /** + * 查询预先盘点单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPreTakeStockList(@Param("vo") QueryPreTakeStockProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockLogMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockLogMapper.java new file mode 100644 index 0000000..a077c7f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockLogMapper.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-14 + */ +public interface ProductStockLogMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "scCode", alias = "sc.code"), + @Sort(value = "productCode", alias = "g.code"), + @Sort(value = "oriStockNum", alias = "gsl", autoParse = true), + @Sort(value = "curStockNum", alias = "gsl", autoParse = true), + @Sort(value = "stockNum", alias = "gsl", autoParse = true), + @Sort(value = "oriTaxPrice", alias = "gsl", autoParse = true), + @Sort(value = "curTaxPrice", alias = "gsl", autoParse = true), + @Sort(value = "taxAmount", alias = "gsl", autoParse = true), + @Sort(value = "createTime", alias = "gsl", autoParse = true), + @Sort(value = "bizCode", alias = "gsl", autoParse = true), + @Sort(value = "bizType", alias = "gsl", autoParse = true), + }) + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List query(@Param("vo") QueryProductStockLogVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockMapper.java new file mode 100644 index 0000000..fdb31e6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockMapper.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface ProductStockMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "scCode", alias = "sc.code"), + @Sort(value = "productCode", alias = "g.code"), + @Sort(value = "stockNum", alias = "gs.stock_num"), + }) + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List query(@Param("vo") QueryProductStockVo vo); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productId + * @param scId + * @return + */ + ProductStock getByProductIdAndScId(@Param("productId") String productId, + @Param("scId") String scId); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productIds + * @param scId + * @return + */ + List getByProductIdsAndScId(@Param("productIds") List productIds, + @Param("scId") String scId, @Param("productType") Integer productType); + + /** + * 入库 + * + * @param productId + * @param scId + * @param stockNum + * @param taxAmount + * @param oriStockNum + * @param oriTaxAmount + * @return + */ + int addStock(@Param("productId") String productId, @Param("scId") String scId, + @Param("stockNum") BigDecimal stockNum, + @Param("taxAmount") BigDecimal taxAmount, + @Param("oriStockNum") BigDecimal oriStockNum, @Param("oriTaxAmount") BigDecimal oriTaxAmount, + @Param("reCalcCostPrice") boolean reCalcCostPrice); + + /** + * 出库 + * + * @param productId + * @param scId + * @param stockNum + * @param taxAmount + * @param oriStockNum + * @param oriTaxAmount + * @return + */ + int subStock(@Param("productId") String productId, @Param("scId") String scId, + @Param("stockNum") BigDecimal stockNum, + @Param("taxAmount") BigDecimal taxAmount, + @Param("oriStockNum") BigDecimal oriStockNum, @Param("oriTaxAmount") BigDecimal oriTaxAmount, + @Param("reCalcCostPrice") boolean reCalcCostPrice); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningMapper.java new file mode 100644 index 0000000..6f5dab1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import com.lframework.xingyun.sc.vo.stock.warning.QueryProductStockWarningVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 库存预警 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ProductStockWarningMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "scCode", alias = "sc.code"), + @Sort(value = "productCode", alias = "p.code"), + @Sort(value = "minLimit", alias = "tb.min_limit"), + @Sort(value = "maxLimit", alias = "tb.max_limit"), + @Sort(value = "updateTime", alias = "tb.update_time"), + }) + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "p"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List query(@Param("vo") QueryProductStockWarningVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningNotifyMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningNotifyMapper.java new file mode 100644 index 0000000..ed90af6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockWarningNotifyMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ProductStockWarningNotify; + +/** + *

+ * 库存预警通知组 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ProductStockWarningNotifyMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseConfigMapper.java new file mode 100644 index 0000000..9cd16aa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseConfigMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseConfig; + +public interface PurchaseConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleFormMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleFormMapper.java new file mode 100644 index 0000000..c8c3b0c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleFormMapper.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailBundleForm; + +public interface PurchaseOrderDetailBundleFormMapper extends + BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleMapper.java new file mode 100644 index 0000000..3d37555 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailBundle; + +public interface PurchaseOrderDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailFormMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailFormMapper.java new file mode 100644 index 0000000..de4959d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailFormMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailForm; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface PurchaseOrderDetailFormMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailMapper.java new file mode 100644 index 0000000..5561266 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface PurchaseOrderDetailMapper extends BaseMapper { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加收货数量 + * + * @param id + * @param num + * @return + */ + int addReceiveNum(@Param("id") String id, @Param("num") java.math.BigDecimal num); + + /** + * 减少收货数量 + * + * @param id + * @param num + * @return + */ + int subReceiveNum(@Param("id") String id, @Param("num") java.math.BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderFormMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderFormMapper.java new file mode 100644 index 0000000..74ca033 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderFormMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseOrderForm; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface PurchaseOrderFormMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderMapper.java new file mode 100644 index 0000000..65348b7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderMapper.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.vo.purchase.PurchaseOrderSelectorVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseOrderWithReceiveVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseProductVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface PurchaseOrderMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + @Sort(value = "approveTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List query(@Param("vo") QueryPurchaseOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseOrderFullDto getDetail(@Param("id") String id, @Param("isForm") Boolean isForm); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List selector(@Param("vo") PurchaseOrderSelectorVo vo); + + /** + * 根据ID查询(收货业务) + * + * @param id + * @return + */ + PurchaseOrderWithReceiveDto getWithReceive(@Param("id") String id, + @Param("requirePurchase") Boolean requirePurchase); + + /** + * 查询列表(收货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List queryWithReceive(@Param("vo") QueryPurchaseOrderWithReceiveVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 根据关键字查询采购商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPurchaseByCondition( + @Param("condition") String condition, @Param("isReturn") Boolean isReturn); + + /** + * 查询可采购商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPurchaseList(@Param("vo") QueryPurchaseProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseProductDto getPurchaseById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnDetailMapper.java new file mode 100644 index 0000000..767cf2a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseReturnDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-16 + */ +public interface PurchaseReturnDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnMapper.java new file mode 100644 index 0000000..75717c9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.returned.QueryPurchaseReturnVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-16 + */ +public interface PurchaseReturnMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + @Sort(value = "approveTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QueryPurchaseReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseReturnFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailBundleMapper.java new file mode 100644 index 0000000..3e593c0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetailBundle; + +public interface ReceiveSheetDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailMapper.java new file mode 100644 index 0000000..1e6f50b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailMapper.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-09 + */ +public interface ReceiveSheetDetailMapper extends BaseMapper { + + /** + * 根据收货单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetMapper.java new file mode 100644 index 0000000..e891dde --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetMapper.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveSheetSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-09 + */ +public interface ReceiveSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "r", autoParse = true), + @Sort(value = "createTime", alias = "r", autoParse = true), + @Sort(value = "approveTime", alias = "r", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QueryReceiveSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "r") + }) + List selector(@Param("vo") ReceiveSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ReceiveSheetFullDto getDetail(String id); + + /** + * 根据ID查询(采购退货业务) + * + * @param id + * @return + */ + ReceiveSheetWithReturnDto getWithReturn(@Param("id") String id, + @Param("requireReceive") Boolean requireReceive); + + /** + * 查询列表(采购退货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "r") + }) + List queryWithReturn(@Param("vo") QueryReceiveSheetWithReturnVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailConfigMapper.java new file mode 100644 index 0000000..31ef2ac --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailConfigMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailConfig; + +public interface RetailConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailBundleMapper.java new file mode 100644 index 0000000..159f453 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; + +public interface RetailOutSheetDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailLotMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailLotMapper.java new file mode 100644 index 0000000..b934b39 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailLotMapper.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailLot; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-03 + */ +public interface RetailOutSheetDetailLotMapper extends BaseMapper { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailMapper.java new file mode 100644 index 0000000..3b73536 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailMapper.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface RetailOutSheetDetailMapper extends BaseMapper { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetMapper.java new file mode 100644 index 0000000..a86825d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetMapper.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailProductVo; +import com.lframework.xingyun.sc.vo.retail.out.RetailOutSheetSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface RetailOutSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryRetailOutSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List selector(@Param("vo") RetailOutSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(销售退货业务) + * + * @param id + * @return + */ + RetailOutSheetWithReturnDto getWithReturn(@Param("id") String id, + @Param("requireOut") Boolean requireOut); + + /** + * 查询列表(销售退货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List queryWithReturn(@Param("vo") QueryRetailOutSheetWithReturnVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 根据关键字零售采购商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryRetailByCondition( + @Param("condition") String condition, @Param("isReturn") Boolean isReturn); + + /** + * 查询可零售商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryRetailList(@Param("vo") QueryRetailProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailProductDto getRetailById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnDetailMapper.java new file mode 100644 index 0000000..9e23821 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailReturnDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface RetailReturnDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnMapper.java new file mode 100644 index 0000000..89837b4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnMapper.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.vo.retail.returned.QueryRetailReturnVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface RetailReturnMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "r", autoParse = true), + @Sort(value = "createTime", alias = "r", autoParse = true), + @Sort(value = "approveTime", alias = "r", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QueryRetailReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailReturnFullDto getDetail(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleConfigMapper.java new file mode 100644 index 0000000..072b118 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleConfigMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleConfig; + +public interface SaleConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailBundleMapper.java new file mode 100644 index 0000000..0e76b79 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; + +public interface SaleOrderDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailMapper.java new file mode 100644 index 0000000..e9d242d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailMapper.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-21 + */ +public interface SaleOrderDetailMapper extends BaseMapper { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加出库数量 + * + * @param id + * @param num + * @return + */ + int addOutNum(@Param("id") String id, @Param("num") BigDecimal num); + + /** + * 减少出库数量 + * + * @param id + * @param num + * @return + */ + int subOutNum(@Param("id") String id, @Param("num") BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderMapper.java new file mode 100644 index 0000000..14bd1cb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderMapper.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderWithOutVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleProductVo; +import com.lframework.xingyun.sc.vo.sale.SaleOrderSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-21 + */ +public interface SaleOrderMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List query(@Param("vo") QuerySaleOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOrderFullDto getDetail(String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List selector(@Param("vo") SaleOrderSelectorVo vo); + + /** + * 根据ID查询(出库业务) + * + * @param id + * @return + */ + SaleOrderWithOutDto getWithOut(@Param("id") String id, @Param("requireSale") Boolean requireSale); + + /** + * 查询列表(出库业务) + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "o") + }) + List queryWithOut(@Param("vo") QuerySaleOrderWithOutVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 根据关键字销售采购商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List querySaleByCondition( + @Param("condition") String condition, @Param("isReturn") Boolean isReturn); + + /** + * 查询可销售商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List querySaleList(@Param("vo") QuerySaleProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleProductDto getSaleById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailBundleMapper.java new file mode 100644 index 0000000..c73cf6d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; + +public interface SaleOutSheetDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailLotMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailLotMapper.java new file mode 100644 index 0000000..418d92f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailLotMapper.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-03 + */ +public interface SaleOutSheetDetailLotMapper extends BaseMapper { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailMapper.java new file mode 100644 index 0000000..795ded3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailMapper.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface SaleOutSheetDetailMapper extends BaseMapper { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetMapper.java new file mode 100644 index 0000000..6a212b8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetMapper.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.sale.out.SaleOutSheetSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface SaleOutSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySaleOutSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List selector(@Param("vo") SaleOutSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(销售退货业务) + * + * @param id + * @return + */ + SaleOutSheetWithReturnDto getWithReturn(@Param("id") String id, + @Param("requireOut") Boolean requireOut); + + /** + * 查询列表(销售退货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List queryWithReturn(@Param("vo") QuerySaleOutSheetWithReturnVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnDetailMapper.java new file mode 100644 index 0000000..12e36d4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleReturnDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface SaleReturnDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnMapper.java new file mode 100644 index 0000000..ae0fd5a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.returned.QuerySaleReturnVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface SaleReturnMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "r", autoParse = true), + @Sort(value = "createTime", alias = "r", autoParse = true), + @Sort(value = "approveTime", alias = "r", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QuerySaleReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleReturnFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailMapper.java new file mode 100644 index 0000000..eef4544 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailMapper.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; + +/** + *

+ * 仓库调拨单明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ScTransferOrderDetailMapper extends BaseMapper { + + /** + * 收货 + * + * @param productId + * @param receiveNum + * @return + */ + int receive(@Param("orderId") String orderId, @Param("productId") String productId, + @Param("receiveNum") BigDecimal receiveNum, @Param("receiveAmount") BigDecimal receiveAmount); + + /** + * 统计未收货的商品 + * + * @param orderId + * @return + */ + int countUnReceive(@Param("orderId") String orderId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailReceiveMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailReceiveMapper.java new file mode 100644 index 0000000..9cc4d22 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailReceiveMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; + +/** + *

+ * 仓库调拨单收货明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ScTransferOrderDetailReceiveMapper extends + BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderMapper.java new file mode 100644 index 0000000..dcc6e32 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderMapper.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferProductVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 仓库调拨单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ScTransferOrderMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + @Sort(value = "approveTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryScTransferOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ScTransferOrderFullDto getDetail(@Param("id") String id); + + /** + * 根据关键字查询库存调整单商品信息 + * + * @param scId + * @param condition + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryScTransferByCondition( + @Param("scId") String scId, @Param("condition") String condition); + + /** + * 查询库存调整单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryScTransferList( + @Param("vo") QueryScTransferProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustReasonMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustReasonMapper.java new file mode 100644 index 0000000..c7b1d2d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustReasonMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +public interface StockAdjustReasonMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryStockAdjustReasonVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") StockAdjustReasonSelectorVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetDetailMapper.java new file mode 100644 index 0000000..b9309b5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; + +/** + *

+ * 库存调整单明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface StockAdjustSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetMapper.java new file mode 100644 index 0000000..127ef28 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetMapper.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 库存调整单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface StockAdjustSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + @Sort(value = "approveTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryStockAdjustSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockAdjustSheetFullDto getDetail(@Param("id") String id); + + /** + * 根据关键字查询库存调整单商品信息 + * + * @param scId + * @param condition + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryStockAdjustByCondition( + @Param("scId") String scId, @Param("condition") String condition); + + /** + * 查询库存调整单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryStockAdjustList( + @Param("vo") QueryStockAdjustProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockConfigMapper.java new file mode 100644 index 0000000..64a4d9e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockConfigMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.TakeStockConfig; + +/** + *

+ * 盘点参数 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanDetailMapper.java new file mode 100644 index 0000000..d173393 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanDetailMapper.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + *

+ * 盘点任务详情 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockPlanDetailMapper extends BaseMapper { + + /** + * 根据盘点任务ID、商品ID查询 + * + * @param planId + * @param productId + * @return + */ + GetTakeStockPlanDetailProductDto getByPlanIdAndProductId(@Param("planId") String planId, + @Param("productId") String productId); + + /** + * 根据盘点任务ID查询 + * + * @param planId + * @return + */ + List getDetailsByPlanId(String planId); + + /** + * 更新盘点数量 + * + * @param planId + * @param productId + * @param num + */ + void updateOriTakeNum(@Param("planId") String planId, @Param("productId") String productId, + @Param("num") BigDecimal num); + + /** + * 增加进项数量 + * + * @param scId + * @param productId + * @param num + */ + void addTotalInNum(@Param("scId") String scId, @Param("productId") String productId, + @Param("num") BigDecimal num); + + /** + * 增加出项数量 + * + * @param scId + * @param productId + * @param num + */ + void addTotalOutNum(@Param("scId") String scId, @Param("productId") String productId, + @Param("num") BigDecimal num); + + /** + * 根据盘点任务ID调整库存数量 + * @param planId + */ + void adjustStockNum(@Param("planId") String planId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanMapper.java new file mode 100644 index 0000000..64fcdce --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanMapper.java @@ -0,0 +1,69 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.vo.stock.take.plan.QueryTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 盘点任务 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockPlanMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryTakeStockPlanVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "tb") + }) + List selector(@Param("vo") TakeStockPlanSelectorVo vo); + + /** + * 根据盘点任务ID查询商品信息 + * + * @param planId + * @return + */ + List getProducts(@Param("planId") String planId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + TakeStockPlanFullDto getDetail(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetDetailMapper.java new file mode 100644 index 0000000..ff2b1b2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; + +/** + *

+ * 盘点单详情 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetMapper.java new file mode 100644 index 0000000..e527d3d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetMapper.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.starter.web.inner.components.permission.ProductDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetProductVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 盘点单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + @Sort(value = "approveTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryTakeStockSheetVo vo); + + /** + * 根据ID查询详情 + * + * @param id + * @return + */ + TakeStockSheetFullDto getDetail(String id); + + /** + * 根据预先盘点单ID判断是否有盘点单关联 + * + * @param preSheetId + * @return + */ + Boolean hasRelatePreTakeStockSheet(String preSheetId); + + /** + * 根据盘点任务ID查询是否有未审核通过的盘点单 + * + * @param planId + * @return + */ + Boolean hasUnApprove(String planId); + + /** + * 根据关键字查询盘点单商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryTakeStockByCondition(@Param("planId") String planId, + @Param("condition") String condition); + + /** + * 查询盘点单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = ProductDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryTakeStockList(@Param("vo") QueryTakeStockSheetProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetDetailService.java new file mode 100644 index 0000000..1ecfb86 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetDetailService.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.sc.service.logistics; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; + +public interface LogisticsSheetDetailService extends BaseMpService { + + /** + * 根据业务ID查询 + * + * @param bizId + * @param bizType + * @return + */ + LogisticsSheetDetail getByBizId(String bizId, LogisticsSheetDetailBizType bizType); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetService.java new file mode 100644 index 0000000..eb44449 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetService.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.service.logistics; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.vo.logistics.*; + +import java.util.List; + +public interface LogisticsSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryLogisticsSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryLogisticsSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + LogisticsSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + LogisticsSheetFullDto getDetail(String id); + + /** + * 查询业务单据列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryBizOrder(Integer pageIndex, Integer pageSize, + QueryLogisticsSheetBizOrderVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateLogisticsSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateLogisticsSheetVo vo); + + /** + * 发货 + * + * @param vo + */ + void delivery(DeliveryLogisticsSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/paytype/OrderPayTypeService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/paytype/OrderPayTypeService.java new file mode 100644 index 0000000..47ed4fa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/paytype/OrderPayTypeService.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.sc.service.paytype; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; + +import java.util.List; + +public interface OrderPayTypeService extends BaseMpService { + + /** + * 创建 + * + * @param orderId + * @param data + */ + void create(String orderId, List data); + + /** + * 根据订单ID删除 + * + * @param orderId + */ + void deleteByOrderId(String orderId); + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List findByOrderId(String orderId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseConfigService.java new file mode 100644 index 0000000..7ab1738 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseConfigService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.vo.purchase.config.UpdatePurchaseConfigVo; + +public interface PurchaseConfigService extends BaseMpService { + + /** + * 查询 + * + * @return + */ + PurchaseConfig get(); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePurchaseConfigVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleFormService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleFormService.java new file mode 100644 index 0000000..a57a3c0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleFormService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailBundleForm; + +public interface PurchaseOrderDetailBundleFormService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleService.java new file mode 100644 index 0000000..bb3525b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailBundleService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailBundle; + +public interface PurchaseOrderDetailBundleService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailFormService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailFormService.java new file mode 100644 index 0000000..4f20e1a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailFormService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetailForm; + +public interface PurchaseOrderDetailFormService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailService.java new file mode 100644 index 0000000..954115d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailService.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; + +import java.math.BigDecimal; +import java.util.List; + +public interface PurchaseOrderDetailService extends BaseMpService { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加收货数量 + * + * @param id + * @param num + */ + void addReceiveNum(String id, BigDecimal num); + + /** + * 减少收货数量 + * + * @param id + * @param num + */ + void subReceiveNum(String id, BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderFormService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderFormService.java new file mode 100644 index 0000000..8f7dec8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderFormService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseOrderForm; + +public interface PurchaseOrderFormService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderService.java new file mode 100644 index 0000000..241cd12 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderService.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.vo.purchase.*; + +import java.util.List; + +public interface PurchaseOrderService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryPurchaseOrderVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPurchaseOrderVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + PurchaseOrderSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseOrderFullDto getDetail(String id, Boolean isForm); + + /** + * 根据ID查询(收货业务) + * + * @param id + * @return + */ + PurchaseOrderWithReceiveDto getWithReceive(String id); + + /** + * 查询列表(收货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReceive(Integer pageIndex, Integer pageSize, + QueryPurchaseOrderWithReceiveVo vo); + + /** + * 创建订单 + * + * @param vo + * @return + */ + String create(CreatePurchaseOrderVo vo); + + /** + * 修改订单 + * + * @param vo + */ + void update(UpdatePurchaseOrderVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassPurchaseOrderVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreatePurchaseOrderVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefusePurchaseOrderVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 取消审核 + * + * @param id + */ + void cancelApprovePass(String id); + + /** + * 根据关键字查询采购商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @param isReturn + * @return + */ + PageResult queryPurchaseByCondition(Integer pageIndex, Integer pageSize, String condition, Boolean isReturn); + + /** + * 查询可采购商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryPurchaseList(Integer pageIndex, Integer pageSize, QueryPurchaseProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseProductDto getPurchaseById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnDetailService.java new file mode 100644 index 0000000..72e2f69 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseReturnDetail; + +public interface PurchaseReturnDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnService.java new file mode 100644 index 0000000..7adc7c1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnService.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.returned.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface PurchaseReturnService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryPurchaseReturnVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPurchaseReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseReturnFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreatePurchaseReturnVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePurchaseReturnVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassPurchaseReturnVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreatePurchaseReturnVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefusePurchaseReturnVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailBundleService.java new file mode 100644 index 0000000..e4e4a8d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailBundleService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetailBundle; + +public interface ReceiveSheetDetailBundleService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailService.java new file mode 100644 index 0000000..2834675 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailService.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; + +import java.math.BigDecimal; +import java.util.List; + +public interface ReceiveSheetDetailService extends BaseMpService { + + /** + * 根据收货单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetService.java new file mode 100644 index 0000000..c9f3b4f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetService.java @@ -0,0 +1,157 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.receive.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface ReceiveSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryReceiveSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryReceiveSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, ReceiveSheetSelectorVo vo); + + /** + * 根据供应商ID查询默认付款日期 + * + * @param supplierId + */ + GetPaymentDateDto getPaymentDate(String supplierId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ReceiveSheetFullDto getDetail(String id); + + /** + * 根据ID查询(采购退货业务) + * + * @param id + * @return + */ + ReceiveSheetWithReturnDto getWithReturn(String id); + + /** + * 查询列表(采购退货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryReceiveSheetWithReturnVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateReceiveSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateReceiveSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassReceiveSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateReceiveSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseReceiveSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailConfigService.java new file mode 100644 index 0000000..088504c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailConfigService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.vo.retail.config.UpdateRetailConfigVo; + +public interface RetailConfigService extends BaseMpService { + + /** + * 查询 + * + * @return + */ + RetailConfig get(); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateRetailConfigVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailBundleService.java new file mode 100644 index 0000000..12e7bb0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailBundleService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; + +public interface RetailOutSheetDetailBundleService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailLotService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailLotService.java new file mode 100644 index 0000000..b14e38c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailLotService.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailLot; + +import java.math.BigDecimal; + +public interface RetailOutSheetDetailLotService extends BaseMpService { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailService.java new file mode 100644 index 0000000..3b3cc8f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailService.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; + +import java.math.BigDecimal; +import java.util.List; + +public interface RetailOutSheetDetailService extends BaseMpService { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, BigDecimal num); + + /** + * 根据出库单ID查询商品总重量 + * @param sheetIds + * @return + */ + BigDecimal getTotalWeightBySheetIds(List sheetIds); + + /** + * 根据出库单ID查询商品总体积 + * @param sheetIds + * @return + */ + BigDecimal getTotalVolumeBySheetIds(List sheetIds); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetService.java new file mode 100644 index 0000000..a600d09 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetService.java @@ -0,0 +1,151 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.vo.retail.out.*; + +import java.util.List; + +public interface RetailOutSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryRetailOutSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryRetailOutSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + RetailOutSheetSelectorVo vo); + + /** + * 根据会员ID查询默认付款日期 + * + * @param memberId + */ + GetPaymentDateDto getPaymentDate(String memberId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(零售退货业务) + * + * @param id + * @return + */ + RetailOutSheetWithReturnDto getWithReturn(String id); + + /** + * 查询列表(零售退货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryRetailOutSheetWithReturnVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateRetailOutSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateRetailOutSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassRetailOutSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateRetailOutSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseRetailOutSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据关键字查询零售商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult queryRetailByCondition(Integer pageIndex, Integer pageSize, + String condition, Boolean isReturn); + + /** + * 查询可零售商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryRetailList(Integer pageIndex, Integer pageSize, + QueryRetailProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailProductDto getRetailById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnDetailService.java new file mode 100644 index 0000000..801322c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailReturnDetail; + +public interface RetailReturnDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnService.java new file mode 100644 index 0000000..6b5ccb2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnService.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.vo.retail.returned.*; + +import java.util.List; + +public interface RetailReturnService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryRetailReturnVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryRetailReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailReturnFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateRetailReturnVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateRetailReturnVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassRetailReturnVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateRetailReturnVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseRetailReturnVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleConfigService.java new file mode 100644 index 0000000..6617f98 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleConfigService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.vo.sale.config.UpdateSaleConfigVo; + +public interface SaleConfigService extends BaseMpService { + + /** + * 查询 + * + * @return + */ + SaleConfig get(); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSaleConfigVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailBundleService.java new file mode 100644 index 0000000..93326a3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailBundleService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; + +public interface SaleOrderDetailBundleService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailService.java new file mode 100644 index 0000000..1d28329 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailService.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; + +import java.math.BigDecimal; +import java.util.List; + +public interface SaleOrderDetailService extends BaseMpService { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加出库数量 + * + * @param id + * @param num + */ + void addOutNum(String id, BigDecimal num); + + /** + * 减少出库数量 + * + * @param id + * @param num + */ + void subOutNum(String id, BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderService.java new file mode 100644 index 0000000..483aeef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderService.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.vo.sale.*; + +import java.util.List; + +public interface SaleOrderService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySaleOrderVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySaleOrderVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SaleOrderSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOrderFullDto getDetail(String id); + + /** + * 根据ID查询(发货业务) + * + * @param id + * @return + */ + SaleOrderWithOutDto getWithOut(String id); + + /** + * 查询列表(出库业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithOut(Integer pageIndex, Integer pageSize, + QuerySaleOrderWithOutVo vo); + + /** + * 创建订单 + * + * @param vo + * @return + */ + String create(CreateSaleOrderVo vo); + + /** + * 修改订单 + * + * @param vo + */ + void update(UpdateSaleOrderVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSaleOrderVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSaleOrderVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSaleOrderVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据关键字查询销售商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult querySaleByCondition(Integer pageIndex, Integer pageSize, String condition, Boolean isReturn); + + /** + * 查询可销售商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult querySaleList(Integer pageIndex, Integer pageSize, QuerySaleProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleProductDto getSaleById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailBundleService.java new file mode 100644 index 0000000..61ac255 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailBundleService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; + +public interface SaleOutSheetDetailBundleService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailLotService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailLotService.java new file mode 100644 index 0000000..7ebec56 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailLotService.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; + +import java.math.BigDecimal; + +public interface SaleOutSheetDetailLotService extends BaseMpService { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, BigDecimal num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailService.java new file mode 100644 index 0000000..6dcd092 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailService.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; + +import java.math.BigDecimal; +import java.util.List; + +public interface SaleOutSheetDetailService extends BaseMpService { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, BigDecimal num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, BigDecimal num); + + /** + * 根据出库单ID查询商品总重量 + * @param sheetIds + * @return + */ + BigDecimal getTotalWeightBySheetIds(List sheetIds); + + /** + * 根据出库单ID查询商品总体积 + * @param sheetIds + * @return + */ + BigDecimal getTotalVolumeBySheetIds(List sheetIds); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetService.java new file mode 100644 index 0000000..682404f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetService.java @@ -0,0 +1,157 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.out.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface SaleOutSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySaleOutSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySaleOutSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SaleOutSheetSelectorVo vo); + + /** + * 根据客户ID查询默认付款日期 + * + * @param customerId + */ + GetPaymentDateDto getPaymentDate(String customerId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(销售退货业务) + * + * @param id + * @return + */ + SaleOutSheetWithReturnDto getWithReturn(String id); + + /** + * 查询列表(销售退货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QuerySaleOutSheetWithReturnVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSaleOutSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSaleOutSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSaleOutSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSaleOutSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSaleOutSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnDetailService.java new file mode 100644 index 0000000..0cd614e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleReturnDetail; + +public interface SaleReturnDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnService.java new file mode 100644 index 0000000..7bb8594 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnService.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.returned.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface SaleReturnService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySaleReturnVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySaleReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleReturnFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSaleReturnVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSaleReturnVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSaleReturnVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSaleReturnVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSaleReturnVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockLogService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockLogService.java new file mode 100644 index 0000000..ebd1ce9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockLogService.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.sc.service.stock; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithAddStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithSubStockVo; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; + +import java.util.List; + +public interface ProductStockLogService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductStockLogVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductStockLogVo vo); + + /** + * 添加入库记录 + */ + void addLogWithAddStock(AddLogWithAddStockVo vo); + + /** + * 添加出库记录 + */ + void addLogWithSubStock(AddLogWithSubStockVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockService.java new file mode 100644 index 0000000..a2fa9cc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockService.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.sc.service.stock; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; + +import java.util.List; + +public interface ProductStockService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductStockVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductStockVo vo); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productId + * @param scId + * @return + */ + ProductStock getByProductIdAndScId(String productId, String scId); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productIds + * @param scId + * @return + */ + List getByProductIdsAndScId(List productIds, String scId, + Integer productType); + + /** + * 入库 + * + * @param vo + */ + ProductStockChangeDto addStock(AddProductStockVo vo); + + /** + * 出库 + * + * @param vo + */ + ProductStockChangeDto subStock(SubProductStockVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustReasonService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustReasonService.java new file mode 100644 index 0000000..8df9428 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustReasonService.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.CreateStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.UpdateStockAdjustReasonVo; + +import java.util.List; + +public interface StockAdjustReasonService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustReasonVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryStockAdjustReasonVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + StockAdjustReasonSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockAdjustReason findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateStockAdjustReasonVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateStockAdjustReasonVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetDetailService.java new file mode 100644 index 0000000..6349381 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; + +public interface StockAdjustSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetService.java new file mode 100644 index 0000000..f604dcc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetService.java @@ -0,0 +1,109 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.*; + +import java.util.List; + +/** + * 库存调整单 Service + * + * @author zmj + */ +public interface StockAdjustSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryStockAdjustSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockAdjustSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateStockAdjustSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateStockAdjustSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassStockAdjustSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateStockAdjustSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseStockAdjustSheetVo vo); + + /** + * 根据关键字查询库存调整单商品信息 + * + * @param pageIndex + * @param pageSize + * @param scId + * @param condition + * @return + */ + PageResult queryStockAdjustByCondition(Integer pageIndex, Integer pageSize, + String scId, String condition); + + /** + * 查询库存调整单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryStockAdjustList(Integer pageIndex, Integer pageSize, + QueryStockAdjustProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetDetailService.java new file mode 100644 index 0000000..10e1120 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; + +public interface PreTakeStockSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetService.java new file mode 100644 index 0000000..661957c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetService.java @@ -0,0 +1,106 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.pre.*; + +import java.util.List; + +/** + * 预先盘点单 Service + * + * @author zmj + */ +public interface PreTakeStockSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryPreTakeStockSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPreTakeStockSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + PreTakeStockSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PreTakeStockSheetFullDto getDetail(String id); + + /** + * 根据预先盘点单、盘点任务查询商品信息 + * + * @param id + * @param planId + * @return + */ + List getProducts(String id, String planId); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreatePreTakeStockSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePreTakeStockSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据关键字查询预先盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult queryPreTakeStockByCondition(Integer pageIndex, Integer pageSize, + String condition); + + /** + * 查询预先盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryPreTakeStockList(Integer pageIndex, Integer pageSize, + QueryPreTakeStockProductVo vo); + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockConfigService.java new file mode 100644 index 0000000..6f90a1c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockConfigService.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.vo.stock.take.config.UpdateTakeStockConfigVo; + +/** + * 盘点参数 Service + * + * @author zmj + */ +public interface TakeStockConfigService extends BaseMpService { + + /** + * 根据ID查询 + * + * @return + */ + TakeStockConfig get(); + + + /** + * 修改 + * + * @param vo + */ + void update(UpdateTakeStockConfigVo vo); + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanDetailService.java new file mode 100644 index 0000000..d4ca3a6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanDetailService.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; + +import java.math.BigDecimal; +import java.util.List; + +public interface TakeStockPlanDetailService extends BaseMpService { + + /** + * 根据盘点任务ID、商品ID查询 + * + * @param planId + * @param productId + * @return + */ + GetTakeStockPlanDetailProductDto getByPlanIdAndProductId(String planId, String productId); + + /** + * 单品盘点-保存盘点任务明细 + * + * @param planId + * @param productIds + */ + void savePlanDetailBySimple(String planId, List productIds); + + /** + * 根据盘点任务ID查询 + * + * @param planId + * @return + */ + List getDetailsByPlanId(String planId); + + /** + * 更新盘点数量 + * + * @param planId + * @param productId + * @param num + */ + void updateOriTakeNum(String planId, String productId, BigDecimal num); + + /** + * 根据盘点任务ID调整库存数量 + * @param planId + */ + void adjustStockNum(String planId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanService.java new file mode 100644 index 0000000..7537cf4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanService.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.vo.stock.take.plan.*; + +import java.util.List; + +/** + * 盘点任务 Service + * + * @author zmj + */ +public interface TakeStockPlanService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryTakeStockPlanVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryTakeStockPlanVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + TakeStockPlanSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + TakeStockPlanFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateTakeStockPlanVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateTakeStockPlanVo vo); + + /** + * 根据盘点任务ID查询商品信息 + * + * @param planId + * @return + */ + List getProducts(String planId); + + /** + * 差异生成 + * + * @param id + */ + void createDiff(String id); + + /** + * 差异处理 + * + * @param vo + */ + void handleDiff(HandleTakeStockPlanVo vo); + + /** + * 作废 + * + * @param vo + */ + void cancel(CancelTakeStockPlanVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetDetailService.java new file mode 100644 index 0000000..005130b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; + +public interface TakeStockSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetService.java new file mode 100644 index 0000000..728c7d8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetService.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.sheet.*; + +import java.util.List; + +/** + * 盘点单 Service + * + * @author zmj + */ +public interface TakeStockSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryTakeStockSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryTakeStockSheetVo vo); + + /** + * 根据ID查询详情 + * + * @param id + * @return + */ + TakeStockSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateTakeStockSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateTakeStockSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassTakeStockSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateTakeStockSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseTakeStockSheetVo vo); + + /** + * 取消审核 + * + * @param id + */ + void cancelApprovePass(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据预先盘点单ID判断是否有盘点单关联 + * + * @param preSheetId + * @return + */ + Boolean hasRelatePreTakeStockSheet(String preSheetId); + + /** + * 根据盘点任务ID查询是否有未审核通过的盘点单 + * + * @param planId + * @return + */ + Boolean hasUnApprove(String planId); + + /** + * 根据关键字查询盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult queryTakeStockByCondition(Integer pageIndex, Integer pageSize, String planId, + String condition); + + /** + * 查询盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryTakeStockList(Integer pageIndex, Integer pageSize, + QueryTakeStockSheetProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailReceiveService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailReceiveService.java new file mode 100644 index 0000000..cc258fa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailReceiveService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.stock.transfer; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; + +public interface ScTransferOrderDetailReceiveService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailService.java new file mode 100644 index 0000000..28dcd7d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailService.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.service.stock.transfer; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; + +import java.math.BigDecimal; + +public interface ScTransferOrderDetailService extends BaseMpService { + + /** + * 收货 + * + * @param productId + * @param receiveNum + * @return + */ + int receive(String orderId, String productId, BigDecimal receiveNum, BigDecimal receiveAmount); + + /** + * 统计未收货的商品 + * + * @param orderId + * @return + */ + int countUnReceive(String orderId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderService.java new file mode 100644 index 0000000..61cb1a0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderService.java @@ -0,0 +1,110 @@ +package com.lframework.xingyun.sc.service.stock.transfer; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.vo.stock.transfer.*; + +import java.util.List; + +public interface ScTransferOrderService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryScTransferOrderVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryScTransferOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ScTransferOrderFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateScTransferOrderVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateScTransferOrderVo vo); + + /** + * 根据ID删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassScTransferOrderVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateScTransferOrderVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseScTransferOrderVo vo); + + /** + * 收货 + * @param vo + */ + void receive(ReceiveScTransferOrderVo vo); + + /** + * 根据关键字查询仓库调拨单商品信息 + * + * @param pageIndex + * @param pageSize + * @param scId + * @param condition + * @return + */ + PageResult queryScTransferByCondition(Integer pageIndex, Integer pageSize, + String scId, String condition); + + /** + * 查询仓库调拨单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryScTransferList(Integer pageIndex, Integer pageSize, + QueryScTransferProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningNotifyService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningNotifyService.java new file mode 100644 index 0000000..2780de7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningNotifyService.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.service.stock.warning; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ProductStockWarningNotify; + +import java.time.LocalDateTime; + +public interface ProductStockWarningNotifyService extends BaseMpService { + + /** + * 获取最后通知时间 + * @param warningId + * @param groupId + * @return + */ + LocalDateTime getLastNotifyTime(String warningId, String groupId); + + /** + * 设置最后通知时间 + * @param warningId + * @param groupId + */ + LocalDateTime setLastNotifyTime(String warningId, String groupId); + + /** + * 新增消息通知组设置 + * @param groupId + */ + void createSetting(String groupId); + + /** + * 删除消息通知组设置 + * @param groupId + */ + void deleteSetting(String groupId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningService.java new file mode 100644 index 0000000..6fd3d19 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/warning/ProductStockWarningService.java @@ -0,0 +1,69 @@ +package com.lframework.xingyun.sc.service.stock.warning; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ProductStockWarning; +import com.lframework.xingyun.sc.vo.stock.warning.CreateProductStockWarningVo; +import com.lframework.xingyun.sc.vo.stock.warning.QueryProductStockWarningVo; +import com.lframework.xingyun.sc.vo.stock.warning.UpdateProductStockWarningVo; + +import java.util.List; + +public interface ProductStockWarningService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryProductStockWarningVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductStockWarningVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductStockWarning findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductStockWarningVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductStockWarningVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据ID删除 + * + * @param ids + */ + void deleteByIds(List ids); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/address/CreateOrderAddressVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/address/CreateOrderAddressVo.java new file mode 100644 index 0000000..fa5c0c6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/address/CreateOrderAddressVo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.vo.address; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.sc.enums.OrderAddressOrderType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateOrderAddressVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED) + private String orderId; + + /** + * 地址类型 + */ + @Schema(description = "订单类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "订单类型不能为空!") + @IsEnum(message = "订单类型格式错误!", enumClass = OrderAddressOrderType.class) + private Integer orderType; + + /** + * 地址类型 + */ + @Schema(description = "地址类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "地址类型不能为空!") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @Schema(description = "姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "姓名不能为空!") + private String name; + + /** + * 手机号 + */ + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 省ID + */ + @Schema(description = "省ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "省ID不能为空!") + private String provinceId; + + /** + * 市ID + */ + @Schema(description = "市ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "市ID不能为空!") + private String cityId; + + /** + * 区ID + */ + @Schema(description = "区ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "区ID不能为空!") + private String districtId; + + /** + * 详细地址 + */ + @Schema(description = "详细地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "详细地址不能为空!") + private String address; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/CreateLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/CreateLogisticsSheetVo.java new file mode 100644 index 0000000..08ea895 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/CreateLogisticsSheetVo.java @@ -0,0 +1,150 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class CreateLogisticsSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 物流单号 + */ + @Schema(description = "物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @Schema(description = "物流公司ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "物流公司ID不能为空!") + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + @Schema(description = "寄件人姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "寄件人姓名不能为空!") + private String senderName; + + /** + * 寄件人联系电话 + */ + @Schema(description = "寄件人联系电话", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "寄件人联系电话不能为空!") + private String senderTelephone; + + /** + * 寄件人省 + */ + @Schema(description = "寄件人省", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "寄件人省不能为空!") + private String senderProvinceId; + + /** + * 寄件人市 + */ + @Schema(description = "寄件人市", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "寄件人市不能为空!") + private String senderCityId; + + /** + * 寄件人区 + */ + @Schema(description = "寄件人区", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "寄件人区不能为空!") + private String senderDistrictId; + + /** + * 寄件人地址 + */ + @Schema(description = "寄件人地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "寄件人地址不能为空!") + private String senderAddress; + + /** + * 收件人姓名 + */ + @Schema(description = "收件人姓名", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收件人姓名不能为空!") + private String receiverName; + + /** + * 收件人联系电话 + */ + @Schema(description = "收件人联系电话", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收件人联系电话不能为空!") + private String receiverTelephone; + + /** + * 收件人省 + */ + @Schema(description = "收件人省", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收件人省不能为空!") + private String receiverProvinceId; + + /** + * 收件人市 + */ + @Schema(description = "收件人市", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收件人市不能为空!") + private String receiverCityId; + + /** + * 收件人区 + */ + @Schema(description = "收件人区", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收件人区不能为空!") + private String receiverDistrictId; + + /** + * 收件人地址 + */ + @Schema(description = "收件人地址", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收件人地址不能为空!") + private String receiverAddress; + + /** + * 总重量 + */ + @Schema(description = "总重量") + @Min(value = 0, message = "总重量必须大于0!") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @Schema(description = "总体积") + @Min(value = 0, message = "总体积必须大于0!") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @Schema(description = "物流费") + @Min(value = 0, message = "物流费必须大于0!") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 业务单据 + */ + @NotEmpty(message = "业务单据不能为空!") + @Valid + private List bizOrders; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/DeliveryLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/DeliveryLogisticsSheetVo.java new file mode 100644 index 0000000..08b6bf1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/DeliveryLogisticsSheetVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class DeliveryLogisticsSheetVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 物流单号 + */ + @Schema(description = "物流单号") + private String logisticsNo; + + /** + * 物流费 + */ + @Schema(description = "物流费") + @Min(value = 0, message = "物流费必须大于0!") + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetBizOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetBizOrderVo.java new file mode 100644 index 0000000..fb97733 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetBizOrderVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class LogisticsSheetBizOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "业务单据ID不能为空!") + private String bizId; + + /** + * 业务类型 + */ + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型格式错误!", enumClass = LogisticsSheetDetailBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetCalcWeightOrVolumeVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetCalcWeightOrVolumeVo.java new file mode 100644 index 0000000..8a3075e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetCalcWeightOrVolumeVo.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class LogisticsSheetCalcWeightOrVolumeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据 + */ + @Schema(description = "业务单据", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "业务单据不能为空!") + @Valid + private List bizOrders; + + @Data + public static class BizOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "业务单据ID不能为空!") + private String bizId; + + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型格式错误!", enumClass = LogisticsSheetDetailBizType.class) + private Integer bizType; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetSelectorVo.java new file mode 100644 index 0000000..85680ad --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetSelectorVo.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class LogisticsSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 物流单号 + */ + @Schema(description = "物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @Schema(description = "物流公司ID") + private String logisticsCompanyId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 发货人ID + */ + @Schema(description = "发货人ID") + private String deliveryBy; + + /** + * 发货起始时间 + */ + @Schema(description = "发货起始时间") + private LocalDateTime deliveryStartTime; + + /** + * 发货截止时间 + */ + @Schema(description = "发货截止时间") + private LocalDateTime deliveryEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = LogisticsSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetBizOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetBizOrderVo.java new file mode 100644 index 0000000..d580f86 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetBizOrderVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryLogisticsSheetBizOrderVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetVo.java new file mode 100644 index 0000000..4eabd27 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetVo.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryLogisticsSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 物流单号 + */ + @Schema(description = "物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @Schema(description = "物流公司ID") + private String logisticsCompanyId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 发货人ID + */ + @Schema(description = "发货人ID") + private String deliveryBy; + + /** + * 发货起始时间 + */ + @Schema(description = "发货起始时间") + private LocalDateTime deliveryStartTime; + + /** + * 发货截止时间 + */ + @Schema(description = "发货截止时间") + private LocalDateTime deliveryEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = LogisticsSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/UpdateLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/UpdateLogisticsSheetVo.java new file mode 100644 index 0000000..c98f549 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/UpdateLogisticsSheetVo.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateLogisticsSheetVo extends CreateLogisticsSheetVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/paytype/OrderPayTypeVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/paytype/OrderPayTypeVo.java new file mode 100644 index 0000000..e6baf62 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/paytype/OrderPayTypeVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.vo.paytype; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class OrderPayTypeVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID") + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 支付金额 + */ + @Schema(description = "支付金额") + @NotNull(message = "支付金额不能为空!") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @Schema(description = "支付内容") + private String text; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApprovePassPurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApprovePassPurchaseOrderVo.java new file mode 100644 index 0000000..a2edbb8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApprovePassPurchaseOrderVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassPurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "订单ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApproveRefusePurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApproveRefusePurchaseOrderVo.java new file mode 100644 index 0000000..8838f21 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApproveRefusePurchaseOrderVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefusePurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "订单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/CreatePurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/CreatePurchaseOrderVo.java new file mode 100644 index 0000000..a8d70a4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/CreatePurchaseOrderVo.java @@ -0,0 +1,121 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreatePurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 预计到货日期 + */ + @Schema(description = "预计到货日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "预计到货日期不能为空!") + private LocalDate expectArriveDate; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @Schema(description = "约定支付") + @Valid + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (PurchaseProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getPurchaseNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品采购数量不能为空!"); + } + + if (NumberUtil.le(product.getPurchaseNum(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品采购数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getPurchaseNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品采购数量最多允许8位小数!"); + } + + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品采购价不能为空!"); + } + + if (NumberUtil.lt(product.getPurchasePrice(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品采购价不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getPurchasePrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许6位小数!"); + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.getNumber(NumberUtil.mul(t.getPurchaseNum(), t.getPurchasePrice()), 2)) + .reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseOrderSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseOrderSelectorVo.java new file mode 100644 index 0000000..8b3aff9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseOrderSelectorVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class PurchaseOrderSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = PurchaseOrderStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseProductVo.java new file mode 100644 index 0000000..03b1da7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseProductVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class PurchaseProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 采购数量 + */ + @Schema(description = "采购数量") + private BigDecimal purchaseNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderVo.java new file mode 100644 index 0000000..7caaa01 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderVo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryPurchaseOrderVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = PurchaseOrderStatus.class) + private Integer status; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderWithReceiveVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderWithReceiveVo.java new file mode 100644 index 0000000..37eb182 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderWithReceiveVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryPurchaseOrderWithReceiveVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseProductVo.java new file mode 100644 index 0000000..15c7e58 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseProductVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryPurchaseProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @Schema(description = "检索关键字") + private String condition; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 是否退货 + */ + @Schema(description = "是否退货") + private Boolean isReturn = Boolean.FALSE; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/UpdatePurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/UpdatePurchaseOrderVo.java new file mode 100644 index 0000000..18cd336 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/UpdatePurchaseOrderVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdatePurchaseOrderVo extends CreatePurchaseOrderVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "订单ID不能为空!") + private String id; + + @Schema(description = "是否为表单数据") + private Boolean isForm = Boolean.FALSE; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/config/UpdatePurchaseConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/config/UpdatePurchaseConfigVo.java new file mode 100644 index 0000000..42b5da3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/config/UpdatePurchaseConfigVo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.sc.vo.purchase.config; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdatePurchaseConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 采购收货单是否关联采购订单 + */ + @Schema(description = "采购收货单是否关联采购订单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购收货单是否关联采购订单不能为空!") + private Boolean receiveRequirePurchase; + + /** + * 采购收货单是否多次关联采购订单 + */ + @Schema(description = "采购收货单是否多次关联采购订单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购收货单是否多次关联采购订单不能为空!") + private Boolean receiveMultipleRelatePurchase; + + /** + * 采购退货单是否关联采购收货单 + */ + @Schema(description = "采购退货单是否关联采购收货单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购退货单是否关联采购收货单不能为空!") + private Boolean purchaseReturnRequireReceive; + + /** + * 采购退货单是否多次关联采购收货单 + */ + @Schema(description = "采购退货单是否多次关联采购收货单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购退货单是否多次关联采购收货单不能为空!") + private Boolean purchaseReturnMultipleRelateReceive; + + /** + * 采购订单是否开启审批流程 + */ + @Schema(description = "采购订单是否开启审批流程", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购订单是否开启审批流程不能为空!") + private Boolean purchaseRequireBpm; + + /** + * 采购订单关联的审批流程ID + */ + @Schema(description = "采购订单关联的审批流程ID") + private String purchaseBpmProcessId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApprovePassReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApprovePassReceiveSheetVo.java new file mode 100644 index 0000000..c5fe4b7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApprovePassReceiveSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @Schema(description = "收货单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收货单ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApproveRefuseReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApproveRefuseReceiveSheetVo.java new file mode 100644 index 0000000..cbffde6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApproveRefuseReceiveSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @Schema(description = "收货单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收货单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/CreateReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/CreateReceiveSheetVo.java new file mode 100644 index 0000000..6ad2120 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/CreateReceiveSheetVo.java @@ -0,0 +1,173 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @Schema(description = "是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 到货日期 + */ + @Schema(description = "到货日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "到货日期不能为空!") + private LocalDate receiveDate; + + /** + * 采购订单ID + */ + @Schema(description = "采购订单ID") + private String purchaseOrderId; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 是否关联采购订单 + */ + @Schema(description = "是否关联采购订单") + private Boolean required; + + public void validate() { + + PurchaseConfigService purchaseConfigService = ApplicationUtil.getBean( + PurchaseConfigService.class); + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getReceiveRequirePurchase().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(purchaseConfig.getReceiveRequirePurchase()); + } + + protected void validate(boolean requirePurchase) { + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + GetPaymentDateDto paymentDate = receiveSheetService.getPaymentDate(this.supplierId); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requirePurchase) { + if (StringUtil.isBlank(this.getPurchaseOrderId())) { + throw new InputErrorException("采购订单不能为空!"); + } + } + + PurchaseOrderDetailService purchaseOrderDetailService = ApplicationUtil.getBean( + PurchaseOrderDetailService.class); + + int orderNo = 1; + for (ReceiveProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReceiveNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品收货数量不能为空!"); + } + + if (NumberUtil.le(product.getReceiveNum(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品收货数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getReceiveNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品收货数量最多允许8位小数!"); + } + + if (!requirePurchase) { + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品采购价不能为空!"); + } + + if (NumberUtil.lt(product.getPurchasePrice(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品采购价不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getPurchasePrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许6位小数!"); + } + } else { + if (StringUtil.isNotBlank(product.getPurchaseOrderDetailId())) { + PurchaseOrderDetail orderDetail = purchaseOrderDetailService.getById( + product.getPurchaseOrderDetailId()); + product.setPurchasePrice(orderDetail.getTaxPrice()); + } else { + product.setPurchasePrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetVo.java new file mode 100644 index 0000000..50466fa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetVo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryReceiveSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = ReceiveSheetStatus.class) + private Integer status; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 采购订单号 + */ + @Schema(description = "采购订单号") + private String purchaseOrderCode; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetWithReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetWithReturnVo.java new file mode 100644 index 0000000..2f3e780 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetWithReturnVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryReceiveSheetWithReturnVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveProductVo.java new file mode 100644 index 0000000..4bc5158 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveProductVo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ReceiveProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 采购价 + */ + @Schema(description = "采购价") + private BigDecimal purchasePrice; + + /** + * 收货数量 + */ + @Schema(description = "收货数量") + private BigDecimal receiveNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 采购订单明细ID + */ + @Schema(description = "采购订单明细ID") + private String purchaseOrderDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveSheetSelectorVo.java new file mode 100644 index 0000000..9ed1331 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveSheetSelectorVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class ReceiveSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = ReceiveSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/UpdateReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/UpdateReceiveSheetVo.java new file mode 100644 index 0000000..60d31e0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/UpdateReceiveSheetVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateReceiveSheetVo extends CreateReceiveSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @Schema(description = "收货单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "收货单ID不能为空!") + private String id; + + @Override + public void validate() { + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + ReceiveSheet receiveSheet = receiveSheetService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(receiveSheet.getPurchaseOrderId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApprovePassPurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApprovePassPurchaseReturnVo.java new file mode 100644 index 0000000..dda8bf5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApprovePassPurchaseReturnVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassPurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @Schema(description = "退货单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退货单ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApproveRefusePurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApproveRefusePurchaseReturnVo.java new file mode 100644 index 0000000..835b15c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApproveRefusePurchaseReturnVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefusePurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @Schema(description = "退货单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退货单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/CreatePurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/CreatePurchaseReturnVo.java new file mode 100644 index 0000000..e4c8fb5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/CreatePurchaseReturnVo.java @@ -0,0 +1,167 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreatePurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private LocalDate paymentDate; + + /** + * 收货单ID + */ + @Schema(description = "收货单ID") + private String receiveSheetId; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + @Valid + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 是否关联采购收货单 + */ + @Schema(description = "是否关联采购收货单") + private Boolean required; + + public void validate() { + + PurchaseConfigService purchaseConfigService = ApplicationUtil.getBean( + PurchaseConfigService.class); + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getPurchaseReturnRequireReceive().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(purchaseConfig.getPurchaseReturnRequireReceive()); + } + + protected void validate(boolean requireReceive) { + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + GetPaymentDateDto paymentDate = receiveSheetService.getPaymentDate(this.supplierId); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireReceive) { + if (StringUtil.isBlank(this.getReceiveSheetId())) { + throw new InputErrorException("采购收货单不能为空!"); + } + } + + ReceiveSheetDetailService receiveSheetDetailService = ApplicationUtil.getBean( + ReceiveSheetDetailService.class); + + int orderNo = 1; + for (ReturnProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReturnNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品退货数量不能为空!"); + } + + if (NumberUtil.le(product.getReturnNum(), 0)) { + throw new InputErrorException("第" + orderNo + "行商品退货数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getReturnNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品退货数量最多允许8位小数!"); + } + + if (!requireReceive) { + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品退货价不能为空!"); + } + + if (NumberUtil.lt(product.getPurchasePrice(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品退货价不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getPurchasePrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品退货价最多允许6位小数!"); + } + } else { + if (StringUtil.isNotBlank(product.getReceiveSheetDetailId())) { + ReceiveSheetDetail detail = receiveSheetDetailService.getById( + product.getReceiveSheetDetailId()); + product.setPurchasePrice(detail.getTaxPrice()); + } else { + product.setPurchasePrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/QueryPurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/QueryPurchaseReturnVo.java new file mode 100644 index 0000000..4366ada --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/QueryPurchaseReturnVo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryPurchaseReturnVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = PurchaseReturnStatus.class) + private Integer status; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String purchaserId; + + /** + * 采购订单号 + */ + @Schema(description = "采购订单号") + private String receiveSheetCode; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ReturnProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ReturnProductVo.java new file mode 100644 index 0000000..e1b4af0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ReturnProductVo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ReturnProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 退货价 + */ + @Schema(description = "退货价") + private BigDecimal purchasePrice; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 收货单明细ID + */ + @Schema(description = "收货单明细ID") + private String receiveSheetDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/UpdatePurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/UpdatePurchaseReturnVo.java new file mode 100644 index 0000000..77f13bf --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/UpdatePurchaseReturnVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdatePurchaseReturnVo extends CreatePurchaseReturnVo { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @Schema(description = "退货单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退货单ID不能为空!") + private String id; + + @Override + public void validate() { + + PurchaseReturnService purchaseReturnService = ApplicationUtil.getBean( + PurchaseReturnService.class); + PurchaseReturn purchaseReturn = purchaseReturnService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(purchaseReturn.getReceiveSheetId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/config/UpdateRetailConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/config/UpdateRetailConfigVo.java new file mode 100644 index 0000000..2fdb199 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/config/UpdateRetailConfigVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.retail.config; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateRetailConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 零售出库单上的会员是否必填 + */ + @Schema(description = "零售出库单上的会员是否必填", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "零售出库单上的会员是否必填不能为空!") + private Boolean retailOutSheetRequireMember; + + /** + * 零售退货单是否关联零售出库单 + */ + @Schema(description = "零售退货单是否关联零售出库单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "零售退货单是否关联零售出库单不能为空!") + private Boolean retailReturnRequireOutStock; + + /** + * 零售退货单是否多次关联零售出库单 + */ + @Schema(description = "零售退货单是否多次关联零售出库单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "零售退货单是否多次关联零售出库单不能为空!") + private Boolean retailReturnMultipleRelateOutStock; + + /** + * 零售退货单上的会员是否必填 + */ + @Schema(description = "零售退货单上的会员是否必填", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "零售退货单上的会员是否必填不能为空!") + private Boolean retailReturnRequireMember; + + /** + * 零售出库单是否需要发货 + */ + @Schema(description = "零售出库单是否需要发货", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "零售出库单是否需要发货不能为空!") + private Boolean retailOutSheetRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApprovePassRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApprovePassRetailOutSheetVo.java new file mode 100644 index 0000000..cb98a72 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApprovePassRetailOutSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @Schema(description = "出库单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApproveRefuseRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApproveRefuseRetailOutSheetVo.java new file mode 100644 index 0000000..6acacf8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApproveRefuseRetailOutSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @Schema(description = "出库单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/CreateRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/CreateRetailOutSheetVo.java new file mode 100644 index 0000000..fc23597 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/CreateRetailOutSheetVo.java @@ -0,0 +1,160 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @Schema(description = "是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + @Valid + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + RetailConfigService retailConfigService = ApplicationUtil.getBean(RetailConfigService.class); + RetailConfig config = retailConfigService.get(); + if (config.getRetailOutSheetRequireMember()) { + if (StringUtil.isBlank(this.memberId)) { + throw new DefaultClientException("请选择会员!"); + } + } + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + GetPaymentDateDto paymentDate = retailOutSheetService.getPaymentDate(this.getMemberId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + int orderNo = 1; + for (RetailOutProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getOrderNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品零售数量不能为空!"); + } + + if (NumberUtil.le(product.getOrderNum(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品零售数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getOrderNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品零售数量最多允许8位小数!"); + } + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考零售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (NumberUtil.lt(product.getTaxPrice(), 0D)) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTaxPrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许6位小数!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.getNumber(NumberUtil.mul(t.getOrderNum(), t.getTaxPrice()), 2)).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetVo.java new file mode 100644 index 0000000..485a193 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetVo.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryRetailOutSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = RetailOutSheetStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetWithReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetWithReturnVo.java new file mode 100644 index 0000000..e2e21ba --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetWithReturnVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryRetailOutSheetWithReturnVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailProductVo.java new file mode 100644 index 0000000..bf576f6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailProductVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryRetailProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @Schema(description = "检索关键字") + private String condition; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 是否退货 + */ + @Schema(description = "是否退货") + private Boolean isReturn = Boolean.FALSE; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutProductVo.java new file mode 100644 index 0000000..a3b4d05 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutProductVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class RetailOutProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @Schema(description = "现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @Schema(description = "折扣(%)") + private BigDecimal discountRate; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal orderNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutSheetSelectorVo.java new file mode 100644 index 0000000..5e6d084 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutSheetSelectorVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class RetailOutSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = RetailOutSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/UpdateRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/UpdateRetailOutSheetVo.java new file mode 100644 index 0000000..52e8de9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/UpdateRetailOutSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateRetailOutSheetVo extends CreateRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @Schema(description = "出库单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "出库单ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApprovePassRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApprovePassRetailReturnVo.java new file mode 100644 index 0000000..89f66de --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApprovePassRetailReturnVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @Schema(description = "退单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApproveRefuseRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApproveRefuseRetailReturnVo.java new file mode 100644 index 0000000..100a722 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApproveRefuseRetailReturnVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @Schema(description = "退单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/CreateRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/CreateRetailReturnVo.java new file mode 100644 index 0000000..ca001b6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/CreateRetailReturnVo.java @@ -0,0 +1,210 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String salerId; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @Schema(description = "是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 收货单ID + */ + @Schema(description = "收货单ID") + private String outSheetId; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @Schema(description = "支付方式") + @Valid + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 是否关联零售出库单 + */ + @Schema(description = "是否关联零售出库单") + private Boolean required; + + public void validate() { + + RetailConfigService retailConfigService = ApplicationUtil.getBean(RetailConfigService.class); + RetailConfig retailConfig = retailConfigService.get(); + + if (retailConfig.getRetailReturnRequireMember()) { + if (StringUtil.isBlank(this.memberId)) { + throw new DefaultClientException("请选择会员!"); + } + } + + if (!retailConfig.getRetailReturnRequireOutStock().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(retailConfig.getRetailReturnRequireOutStock()); + } + + protected void validate(boolean requireOut) { + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + GetPaymentDateDto paymentDate = retailOutSheetService.getPaymentDate(this.getMemberId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireOut) { + if (StringUtil.isBlank(this.getOutSheetId())) { + throw new InputErrorException("零售出库单不能为空!"); + } + } + + RetailOutSheetDetailService retailOutSheetDetailService = ApplicationUtil.getBean( + RetailOutSheetDetailService.class); + RetailOutSheetDetailLotService retailOutSheetDetailLotService = ApplicationUtil.getBean( + RetailOutSheetDetailLotService.class); + int orderNo = 1; + for (RetailReturnProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReturnNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品退货数量不能为空!"); + } + + if (NumberUtil.le(product.getReturnNum(), 0)) { + throw new InputErrorException("第" + orderNo + "行商品退货数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getReturnNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品退货数量最多允许8位小数!"); + } + + if (!requireOut) { + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考零售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (NumberUtil.lt(product.getTaxPrice(), 0D)) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTaxPrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许6位小数!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + } else { + if (StringUtil.isNotBlank(product.getOutSheetDetailId())) { + RetailOutSheetDetailLotDto detailLot = retailOutSheetDetailLotService.findById( + product.getOutSheetDetailId()); + RetailOutSheetDetail detail = retailOutSheetDetailService.getById( + detailLot.getDetailId()); + product.setTaxPrice(detail.getTaxPrice()); + } else { + product.setTaxPrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.getNumber(NumberUtil.mul(t.getReturnNum(), t.getTaxPrice()), 2)) + .reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/QueryRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/QueryRetailReturnVo.java new file mode 100644 index 0000000..b715548 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/QueryRetailReturnVo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryRetailReturnVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 会员ID + */ + @Schema(description = "会员ID") + private String memberId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = RetailReturnStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 出库单号 + */ + @Schema(description = "出库单号") + private String outSheetCode; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/RetailReturnProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/RetailReturnProductVo.java new file mode 100644 index 0000000..95d302c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/RetailReturnProductVo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class RetailReturnProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @Schema(description = "现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @Schema(description = "折扣(%)") + private BigDecimal discountRate; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 出库单明细ID + */ + @Schema(description = "出库单明细ID") + private String outSheetDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/UpdateRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/UpdateRetailReturnVo.java new file mode 100644 index 0000000..832dccc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/UpdateRetailReturnVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.service.retail.RetailReturnService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateRetailReturnVo extends CreateRetailReturnVo { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @Schema(description = "退单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退单ID不能为空!") + private String id; + + @Override + public void validate() { + + RetailReturnService saleReturnService = ApplicationUtil.getBean(RetailReturnService.class); + RetailReturn saleReturn = saleReturnService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(saleReturn.getOutSheetId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApprovePassSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApprovePassSaleOrderVo.java new file mode 100644 index 0000000..bba660c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApprovePassSaleOrderVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "订单ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApproveRefuseSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApproveRefuseSaleOrderVo.java new file mode 100644 index 0000000..58eb704 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApproveRefuseSaleOrderVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "订单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java new file mode 100644 index 0000000..f750365 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java @@ -0,0 +1,126 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class CreateSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "客户ID不能为空!") + private String customerId; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @Schema(description = "约定支付") + @Valid + private List payTypes; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SaleProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getOrderNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品销售数量不能为空!"); + } + + if (NumberUtil.le(product.getOrderNum(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品销售数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getOrderNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品销售数量最多允许8位小数!"); + } + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (NumberUtil.lt(product.getTaxPrice(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTaxPrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许6位小数!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.getNumber(NumberUtil.mul(t.getOrderNum(), t.getTaxPrice()), 2)) + .reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderVo.java new file mode 100644 index 0000000..9eb58dd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderVo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySaleOrderVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOrderStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderWithOutVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderWithOutVo.java new file mode 100644 index 0000000..0716d7f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderWithOutVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySaleOrderWithOutVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleProductVo.java new file mode 100644 index 0000000..801d11b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleProductVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QuerySaleProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @Schema(description = "检索关键字") + private String condition; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 是否退货 + */ + @Schema(description = "是否退货") + private Boolean isReturn = Boolean.FALSE; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleOrderSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleOrderSelectorVo.java new file mode 100644 index 0000000..627b218 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleOrderSelectorVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class SaleOrderSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOrderStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleProductVo.java new file mode 100644 index 0000000..6b56960 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleProductVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SaleProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @Schema(description = "现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @Schema(description = "折扣(%)") + private BigDecimal discountRate; + + /** + * 销售数量 + */ + @Schema(description = "销售数量") + private BigDecimal orderNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/UpdateSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/UpdateSaleOrderVo.java new file mode 100644 index 0000000..a85ff60 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/UpdateSaleOrderVo.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.sc.vo.sale; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateSaleOrderVo extends CreateSaleOrderVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "订单ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/config/UpdateSaleConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/config/UpdateSaleConfigVo.java new file mode 100644 index 0000000..d3cd998 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/config/UpdateSaleConfigVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.sale.config; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateSaleConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 销售出库单是否关联销售订单 + */ + @Schema(description = "销售出库单是否关联销售订单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销售出库单是否关联销售订单不能为空!") + private Boolean outStockRequireSale; + + /** + * 销售出库单是否多次关联销售订单 + */ + @Schema(description = "销售出库单是否多次关联销售订单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销售出库单是否多次关联销售订单不能为空!") + private Boolean outStockMultipleRelateSale; + + /** + * 销售退货单是否关联销售出库单 + */ + @Schema(description = "销售退货单是否关联销售出库单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销售退货单是否关联销售出库单不能为空!") + private Boolean saleReturnRequireOutStock; + + /** + * 销售退货单是否多次关联销售出库单 + */ + @Schema(description = "销售退货单是否多次关联销售出库单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销售退货单是否多次关联销售出库单不能为空!") + private Boolean saleReturnMultipleRelateOutStock; + + /** + * 销售出库单是否关联物流单 + */ + @Schema(description = "销售出库单是否关联物流单", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "销售出库单是否关联物流单不能为空!") + private Boolean outStockRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApprovePassSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApprovePassSaleOutSheetVo.java new file mode 100644 index 0000000..0b9cfde --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApprovePassSaleOutSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @Schema(description = "出库单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApproveRefuseSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApproveRefuseSaleOutSheetVo.java new file mode 100644 index 0000000..5bff8ed --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApproveRefuseSaleOutSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @Schema(description = "出库单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/CreateSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/CreateSaleOutSheetVo.java new file mode 100644 index 0000000..b4b5ff0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/CreateSaleOutSheetVo.java @@ -0,0 +1,179 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "客户ID不能为空!") + private String customerId; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @Schema(description = "是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 销售订单ID + */ + @Schema(description = "销售订单ID") + private String saleOrderId; + + /** + * 是否关联销售订单 + */ + @Schema(description = "是否关联销售订单") + private Boolean required; + + public void validate() { + + SaleConfigService saleConfigService = ApplicationUtil.getBean(SaleConfigService.class); + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getOutStockRequireSale().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(saleConfig.getOutStockRequireSale()); + } + + protected void validate(boolean requireSale) { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + GetPaymentDateDto paymentDate = saleOutSheetService.getPaymentDate(this.getCustomerId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireSale) { + if (StringUtil.isBlank(this.getSaleOrderId())) { + throw new InputErrorException("销售订单不能为空!"); + } + } + + SaleOrderDetailService saleOrderDetailService = ApplicationUtil.getBean( + SaleOrderDetailService.class); + + int orderNo = 1; + for (SaleOutProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getOrderNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品销售数量不能为空!"); + } + + if (NumberUtil.le(product.getOrderNum(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品销售数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getOrderNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品销售数量最多允许8位小数!"); + } + + if (!requireSale) { + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (NumberUtil.lt(product.getTaxPrice(), 0D)) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTaxPrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许6位小数!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + } else { + if (StringUtil.isNotBlank(product.getSaleOrderDetailId())) { + SaleOrderDetail orderDetail = saleOrderDetailService.getById( + product.getSaleOrderDetailId()); + product.setTaxPrice(orderDetail.getTaxPrice()); + } else { + product.setTaxPrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetVo.java new file mode 100644 index 0000000..ad5f381 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetVo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySaleOutSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOutSheetStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 销售订单号 + */ + @Schema(description = "销售订单号") + private String saleOrderCode; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetWithReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetWithReturnVo.java new file mode 100644 index 0000000..6d1a7f1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetWithReturnVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySaleOutSheetWithReturnVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutProductVo.java new file mode 100644 index 0000000..a4e0ee0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutProductVo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SaleOutProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @Schema(description = "现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @Schema(description = "折扣(%)") + private BigDecimal discountRate; + + /** + * 出库数量 + */ + @Schema(description = "出库数量") + private BigDecimal orderNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 销售订单明细ID + */ + @Schema(description = "销售订单明细ID") + private String saleOrderDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutSheetSelectorVo.java new file mode 100644 index 0000000..e260340 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutSheetSelectorVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class SaleOutSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOutSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/UpdateSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/UpdateSaleOutSheetVo.java new file mode 100644 index 0000000..7ca7f0d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/UpdateSaleOutSheetVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateSaleOutSheetVo extends CreateSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @Schema(description = "出库单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + @Override + public void validate() { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + SaleOutSheet saleOutSheet = saleOutSheetService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(saleOutSheet.getSaleOrderId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApprovePassSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApprovePassSaleReturnVo.java new file mode 100644 index 0000000..76f6e8d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApprovePassSaleReturnVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @Schema(description = "退单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApproveRefuseSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApproveRefuseSaleReturnVo.java new file mode 100644 index 0000000..f8d4152 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApproveRefuseSaleReturnVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @Schema(description = "退单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/CreateSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/CreateSaleReturnVo.java new file mode 100644 index 0000000..4ce594b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/CreateSaleReturnVo.java @@ -0,0 +1,178 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "客户ID不能为空!") + private String customerId; + + /** + * 采购员ID + */ + @Schema(description = "采购员ID") + private String salerId; + + /** + * 付款日期 + */ + @Schema(description = "付款日期") + private LocalDate paymentDate; + + /** + * 收货单ID + */ + @Schema(description = "收货单ID") + private String outSheetId; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 是否关联销售出库单 + */ + @Schema(description = "是否关联销售出库单") + private Boolean required; + + public void validate() { + + SaleConfigService saleConfigService = ApplicationUtil.getBean(SaleConfigService.class); + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getSaleReturnRequireOutStock().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(saleConfig.getSaleReturnRequireOutStock()); + } + + protected void validate(boolean requireOut) { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + GetPaymentDateDto paymentDate = saleOutSheetService.getPaymentDate(this.getCustomerId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireOut) { + if (StringUtil.isBlank(this.getOutSheetId())) { + throw new InputErrorException("销售出库单不能为空!"); + } + } + + SaleOutSheetDetailService saleOutSheetDetailService = ApplicationUtil.getBean( + SaleOutSheetDetailService.class); + SaleOutSheetDetailLotService saleOutSheetDetailLotService = ApplicationUtil.getBean( + SaleOutSheetDetailLotService.class); + + int orderNo = 1; + for (SaleReturnProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReturnNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品退货数量不能为空!"); + } + + if (NumberUtil.le(product.getReturnNum(), BigDecimal.ZERO)) { + throw new InputErrorException("第" + orderNo + "行商品退货数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getReturnNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品退货数量最多允许8位小数!"); + } + + if (!requireOut) { + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (NumberUtil.lt(product.getTaxPrice(), 0D)) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTaxPrice(), 6)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许6位小数!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + } else { + if (StringUtil.isNotBlank(product.getOutSheetDetailId())) { + SaleOutSheetDetailLot detailLot = saleOutSheetDetailLotService.getById( + product.getOutSheetDetailId()); + SaleOutSheetDetail outSheetDetail = saleOutSheetDetailService.getById( + detailLot.getDetailId()); + product.setTaxPrice(outSheetDetail.getTaxPrice()); + } else { + product.setTaxPrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/QuerySaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/QuerySaleReturnVo.java new file mode 100644 index 0000000..b4f4e5d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/QuerySaleReturnVo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySaleReturnVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 操作人ID + */ + @Schema(description = "操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @Schema(description = "操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @Schema(description = "操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @Schema(description = "审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @Schema(description = "状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleReturnStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @Schema(description = "销售员ID") + private String salerId; + + /** + * 出库单号 + */ + @Schema(description = "出库单号") + private String outSheetCode; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/SaleReturnProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/SaleReturnProductVo.java new file mode 100644 index 0000000..72cde28 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/SaleReturnProductVo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SaleReturnProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 原价 + */ + @Schema(description = "原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @Schema(description = "现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @Schema(description = "折扣(%)") + private BigDecimal discountRate; + + /** + * 退货数量 + */ + @Schema(description = "退货数量") + private BigDecimal returnNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 出库单明细ID + */ + @Schema(description = "出库单明细ID") + private String outSheetDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/UpdateSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/UpdateSaleReturnVo.java new file mode 100644 index 0000000..6bf3138 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/UpdateSaleReturnVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateSaleReturnVo extends CreateSaleReturnVo { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @Schema(description = "退单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "退单ID不能为空!") + private String id; + + @Override + public void validate() { + + SaleReturnService saleReturnService = ApplicationUtil.getBean(SaleReturnService.class); + SaleReturn saleReturn = saleReturnService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(saleReturn.getOutSheetId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/AddProductStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/AddProductStockVo.java new file mode 100644 index 0000000..b104600 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/AddProductStockVo.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.vo.stock; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class AddProductStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 入库数量 + */ + @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "入库数量不能为空!") + private BigDecimal stockNum; + + /** + * 含税成本总金额,如果为null则代表不计算均价入库 + */ + @Schema(description = "含税成本总金额,如果为null则代表不计算均价入库") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 默认的含税成本总金额,如果不为null则代表:入库时商品没有库存(没有均价),按照此成本金额入库 如果与taxAmount同时为null,那么当入库时没有库存就会报错 + */ + @Schema(description = "默认的含税成本总金额,如果不为null则代表:入库时商品没有库存(没有均价),按照此成本总金额入库 如果与taxAmount同时为null,那么当入库时没有库存就会报错") + @Min(message = "默认的含税成本总金额不能小于0!", value = 0) + private BigDecimal defaultTaxAmount; + + /** + * 入库时间 + */ + @Schema(description = "入库时间") + private LocalDateTime createTime = LocalDateTime.now(); + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @Schema(description = "业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/QueryProductStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/QueryProductStockVo.java new file mode 100644 index 0000000..047935c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/QueryProductStockVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.sc.vo.stock; + +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class QueryProductStockVo extends SortPageVo { + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 商品分类ID + */ + @Schema(description = "商品分类ID") + private String categoryId; + + /** + * 商品品牌ID + */ + @Schema(description = "商品品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/SubProductStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/SubProductStockVo.java new file mode 100644 index 0000000..14114bb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/SubProductStockVo.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.sc.vo.stock; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class SubProductStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 出库数量 + */ + @Schema(description = "出库数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "出库数量不能为空!") + private BigDecimal stockNum; + + /** + * 含税成本总金额 + */ + @Schema(description = "含税成本总金额") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 出库时间 + */ + @Schema(description = "出库时间") + private LocalDateTime createTime = LocalDateTime.now(); + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @Schema(description = "业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApprovePassStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApprovePassStockAdjustSheetVo.java new file mode 100644 index 0000000..dce6b65 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApprovePassStockAdjustSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApproveRefuseStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApproveRefuseStockAdjustSheetVo.java new file mode 100644 index 0000000..226678c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApproveRefuseStockAdjustSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID") + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由") + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/CreateStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/CreateStockAdjustSheetVo.java new file mode 100644 index 0000000..23177bb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/CreateStockAdjustSheetVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.StockAdjustSheetBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class CreateStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入仓库ID!") + private String scId; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型格式错误!", enumClass = StockAdjustSheetBizType.class) + private Integer bizType; + + /** + * 调整原因ID + */ + @Schema(description = "调整原因ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "调整原因ID不能为空!") + private String reasonId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + int orderNo = 1; + for (StockAdjustProductVo product : this.products) { + if (NumberUtil.le(product.getStockNum(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行商品的调整库存数量必须大于0!"); + } + if (!NumberUtil.isNumberPrecision(product.getStockNum(), 8)) { + throw new DefaultClientException("第" + orderNo + "行商品的调整库存数量最多允许8位小数!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustProductVo.java new file mode 100644 index 0000000..804ccdb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryStockAdjustProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @Schema(description = "检索关键字") + private String condition; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustSheetVo.java new file mode 100644 index 0000000..f880058 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustSheetVo.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryStockAdjustSheetVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + private Integer bizType; + + /** + * 调整原因ID + */ + @Schema(description = "调整原因ID") + private String reasonId; + + /** + * 状态 + */ + @Schema(description = "状态") + @TypeMismatch(message = "状态格式有误!") + @IsEnum(message = "状态格式有误!", enumClass = StockAdjustSheetStatus.class) + private Integer status; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @Schema(description = "修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @Schema(description = "修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 起始时间 + */ + @Schema(description = "审核时间 起始时间") + @TypeMismatch(message = "审核时间起始时间格式有误!") + private LocalDateTime approveTimeStart; + + /** + * 审核时间 截止时间 + */ + @Schema(description = "审核时间 截止时间") + @TypeMismatch(message = "审核时间截止时间格式有误!") + private LocalDateTime approveTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/StockAdjustProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/StockAdjustProductVo.java new file mode 100644 index 0000000..f813918 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/StockAdjustProductVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class StockAdjustProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 调整库存数量 + */ + @Schema(description = "调整库存数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "调整库存数量不能为空!") + @TypeMismatch(message = "调整库存数量格式有误!") + private BigDecimal stockNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/UpdateStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/UpdateStockAdjustSheetVo.java new file mode 100644 index 0000000..b000d11 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/UpdateStockAdjustSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateStockAdjustSheetVo extends CreateStockAdjustSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/CreateStockAdjustReasonVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/CreateStockAdjustReasonVo.java new file mode 100644 index 0000000..c46b80e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/CreateStockAdjustReasonVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateStockAdjustReasonVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/QueryStockAdjustReasonVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/QueryStockAdjustReasonVo.java new file mode 100644 index 0000000..5473df9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/QueryStockAdjustReasonVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryStockAdjustReasonVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/StockAdjustReasonSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/StockAdjustReasonSelectorVo.java new file mode 100644 index 0000000..ee53a66 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/StockAdjustReasonSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StockAdjustReasonSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/UpdateStockAdjustReasonVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/UpdateStockAdjustReasonVo.java new file mode 100644 index 0000000..02f04e1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/UpdateStockAdjustReasonVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateStockAdjustReasonVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithAddStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithAddStockVo.java new file mode 100644 index 0000000..384e014 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithAddStockVo.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.sc.vo.stock.log; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class AddLogWithAddStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 入库数量 + */ + @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "入库数量不能为空!") + private BigDecimal stockNum; + + /** + * 含税成本总金额 + */ + @Schema(description = "含税成本总金额", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "含税成本总金额不能为空!") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 原库存数量 + */ + @Schema(description = "原库存数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "原库存数量不能为空!") + private BigDecimal oriStockNum; + + /** + * 现库存数量 + */ + @Schema(description = "现库存数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "现库存数量不能为空!") + private BigDecimal curStockNum; + + /** + * 原含税成本价 + */ + @Schema(description = "原含税成本价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "原含税成本价不能为空!") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @Schema(description = "现含税成本价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "现含税成本价不能为空!") + private BigDecimal curTaxPrice; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createById; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 入库时间 + */ + @Schema(description = "入库时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "入库时间不能为空!") + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @Schema(description = "业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithSubStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithSubStockVo.java new file mode 100644 index 0000000..c8f7614 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithSubStockVo.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.sc.vo.stock.log; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class AddLogWithSubStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 出库数量 + */ + @Schema(description = "出库数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "出库数量不能为空!") + private BigDecimal stockNum; + + /** + * 含税成本总金额 + */ + @Schema(description = "含税成本总金额", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "含税成本总金额不能为空!") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 原库存数量 + */ + @Schema(description = "原库存数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "原库存数量不能为空!") + private BigDecimal oriStockNum; + + /** + * 现库存数量 + */ + @Schema(description = "现库存数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "现库存数量不能为空!") + private BigDecimal curStockNum; + + /** + * 原含税成本价 + */ + @Schema(description = "原含税成本价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "原含税成本价不能为空!") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @Schema(description = "现含税成本价", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "现含税成本价不能为空!") + private BigDecimal curTaxPrice; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createById; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 出库时间 + */ + @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "出库时间不能为空!") + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @Schema(description = "业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/QueryProductStockLogVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/QueryProductStockLogVo.java new file mode 100644 index 0000000..a5b06f3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/QueryProductStockLogVo.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.sc.vo.stock.log; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryProductStockLogVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 商品分类ID + */ + @Schema(description = "商品分类ID") + private String categoryId; + + /** + * 商品品牌ID + */ + @Schema(description = "商品品牌ID") + private String brandId; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + @IsEnum(message = "业务类型不存在!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/AddProductLotStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/AddProductLotStockVo.java new file mode 100644 index 0000000..10216e5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/AddProductLotStockVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.stock.lot; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class AddProductLotStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 入库数量 + */ + @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "入库数量不能为空!") + @Min(message = "入库数量必须大于0!", value = 1) + private Integer stockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/CreateProductLotVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/CreateProductLotVo.java new file mode 100644 index 0000000..ab1d9ae --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/CreateProductLotVo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.vo.stock.lot; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class CreateProductLotVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 税率(%) + */ + @Schema(description = "税率(%)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "税率(%)不能为空!") + @Min(message = "税率(%)不能小于0!", value = 0) + private BigDecimal taxRate; + + /** + * 入库时间 + */ + @Schema(description = "入库时间") + private LocalDateTime createTime = LocalDateTime.now(); + + /** + * 业务单据ID + */ + @Schema(description = "业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @Schema(description = "业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/QueryProductLotVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/QueryProductLotVo.java new file mode 100644 index 0000000..a705407 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/QueryProductLotVo.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.sc.vo.stock.lot; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryProductLotVo extends PageVo { + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 商品编号 + */ + @Schema(description = "商品编号") + private String productCode; + + /** + * 商品名称 + */ + @Schema(description = "商品名称") + private String productName; + + /** + * 商品分类ID + */ + @Schema(description = "商品分类ID") + private String categoryId; + + /** + * 商品品牌ID + */ + @Schema(description = "商品品牌ID") + private String brandId; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 生成起始时间 + */ + @Schema(description = "生成起始时间") + private LocalDateTime createStartTime; + + /** + * 生成截止时间 + */ + @Schema(description = "生成截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/config/UpdateTakeStockConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/config/UpdateTakeStockConfigVo.java new file mode 100644 index 0000000..a46edea --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/config/UpdateTakeStockConfigVo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.sc.vo.stock.take.config; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateTakeStockConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据 + */ + @Schema(description = "库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据", requiredMode = Schema.RequiredMode.REQUIRED) + @TypeMismatch(message = "库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据格式有误!") + @NotNull(message = "请选择库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据!") + private Boolean showProduct; + + /** + * 库存盘点单是否显示盘点任务创建时商品的系统库存数量 + */ + @Schema(description = "库存盘点单是否显示盘点任务创建时商品的系统库存数量", requiredMode = Schema.RequiredMode.REQUIRED) + @TypeMismatch(message = "库存盘点单是否显示盘点任务创建时商品的系统库存数量格式有误!") + @NotNull(message = "请选择库存盘点单是否显示盘点任务创建时商品的系统库存数量!") + private Boolean showStock; + + /** + * 盘点差异生成时是否自动调整盘点任务中商品的系统库存数量 + */ + @Schema(description = "盘点差异生成时是否自动调整盘点任务中商品的系统库存数量", requiredMode = Schema.RequiredMode.REQUIRED) + @TypeMismatch(message = "盘点差异生成时是否自动调整盘点任务中商品的系统库存数量格式有误!") + @NotNull(message = "请选择盘点差异生成时是否自动调整盘点任务中商品的系统库存数量!") + private Boolean autoChangeStock; + + /** + * 盘点差异单中的盘点数量是否允许手动修改 + */ + @Schema(description = "盘点差异单中的盘点数量是否允许手动修改", requiredMode = Schema.RequiredMode.REQUIRED) + @TypeMismatch(message = "盘点差异单中的盘点数量是否允许手动修改格式有误!") + @NotNull(message = "请选择盘点差异单中的盘点数量是否允许手动修改!") + private Boolean allowChangeNum; + + /** + * 盘点任务创建后多少小时内未完成,则自动作废 + */ + @Schema(description = "盘点任务创建后多少小时内未完成,则自动作废", requiredMode = Schema.RequiredMode.REQUIRED) + @TypeMismatch(message = "盘点任务自动作废时间格式有误!") + @NotNull(message = "请输入盘点任务自动作废时间!") + @Min(value = 1, message = "盘点任务自动作废时间必须大于0!") + private Integer cancelHours; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CancelTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CancelTakeStockPlanVo.java new file mode 100644 index 0000000..4e0859b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CancelTakeStockPlanVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CancelTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CreateTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CreateTakeStockPlanVo.java new file mode 100644 index 0000000..9c35ae1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CreateTakeStockPlanVo.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入仓库ID!") + private String scId; + + + /** + * 盘点类别 + */ + @Schema(description = "盘点类别", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择盘点类别!") + @TypeMismatch(message = "盘点类别格式有误!") + @IsEnum(message = "盘点类别格式有误!", enumClass = TakeStockPlanType.class) + private Integer takeType; + + /** + * 业务ID + */ + @Schema(description = "业务ID") + private List bizIds; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + TakeStockPlanType takeType = EnumUtil.getByCode(TakeStockPlanType.class, this.takeType); + if (takeType == TakeStockPlanType.CATEGORY) { + if (CollectionUtil.isEmpty(this.bizIds)) { + throw new InputErrorException("请选择商品分类!"); + } + } else if (takeType == TakeStockPlanType.BRAND) { + if (CollectionUtil.isEmpty(this.bizIds)) { + throw new InputErrorException("请选择商品品牌!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/HandleTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/HandleTakeStockPlanVo.java new file mode 100644 index 0000000..df1c12d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/HandleTakeStockPlanVo.java @@ -0,0 +1,106 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class HandleTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "商品信息不能为空!") + private List products; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 是否允许修改数量 + */ + @Schema(description = "是否允许修改数量") + private Boolean allowChangeNum; + + /** + * 是否自动计算数量 + */ + @Schema(description = "是否自动计算数量") + private Boolean autoChangeStock; + + @Data + public static class ProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 修改后盘点数量 + */ + @Schema(description = "修改后盘点数量") + private BigDecimal takeNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + } + + public void validate() { + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + + if (config.getAllowChangeNum()) { + int orderNo = 1; + for (ProductVo product : this.products) { + if (product.getTakeNum() == null) { + throw new DefaultClientException("第" + orderNo + "行商品修改后盘点数量不能为空!"); + } + + if (NumberUtil.lt(product.getTakeNum(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行商品修改后盘点数量不能小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTakeNum(), 8)) { + throw new DefaultClientException("第" + orderNo + "行商品修改后盘点数量最多允许8位小数!"); + } + + orderNo++; + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/QueryTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/QueryTakeStockPlanVo.java new file mode 100644 index 0000000..1c98860 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/QueryTakeStockPlanVo.java @@ -0,0 +1,79 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryTakeStockPlanVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + @TypeMismatch(message = "盘点状态格式有误!") + @IsEnum(message = "盘点状态格式有误!", enumClass = TakeStockPlanStatus.class) + private Integer takeStatus; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 起始时间 + */ + @Schema(description = "创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @Schema(description = "创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @Schema(description = "修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @Schema(description = "修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/TakeStockPlanSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/TakeStockPlanSelectorVo.java new file mode 100644 index 0000000..bc281d0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/TakeStockPlanSelectorVo.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class TakeStockPlanSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 是否正在进行盘点 + */ + @Schema(description = "是否正在进行盘点") + @TypeMismatch(message = "是否正在进行盘点格式有误!") + private Boolean taking; + + /** + * 盘点类别 + */ + @Schema(description = "盘点类别") + @TypeMismatch(message = "盘点类别格式有误!") + @IsEnum(message = "盘点类别格式有误!", enumClass = TakeStockPlanType.class) + private Integer takeType; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + @TypeMismatch(message = "盘点状态格式有误!") + @IsEnum(message = "盘点状态格式有误!", enumClass = TakeStockPlanStatus.class) + private Integer takeStatus; + + /** + * 创建时间 起始时间 + */ + @Schema(description = "创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @Schema(description = "创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + + /** + * 修改时间 起始时间 + */ + @Schema(description = "修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @Schema(description = "修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/UpdateTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/UpdateTakeStockPlanVo.java new file mode 100644 index 0000000..6e35d39 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/UpdateTakeStockPlanVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入仓库ID!") + private String scId; + + /** + * 备注 + */ + @Schema(description = "备注") + @NotBlank(message = "请输入备注!") + private String description; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/CreatePreTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/CreatePreTakeStockSheetVo.java new file mode 100644 index 0000000..e0e99e4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/CreatePreTakeStockSheetVo.java @@ -0,0 +1,111 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Data +public class CreatePreTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请选择仓库!") + private String scId; + + /** + * 预先盘点状态 + */ + @Schema(description = "预先盘点状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请选择预先盘点状态!") + @IsEnum(message = "预先盘点状态格式错误!", enumClass = PreTakeStockSheetStatus.class) + @TypeMismatch(message = "预先盘点状态格式错误!") + private Integer takeStatus; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 商品 + */ + @Schema(description = "商品", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + Set checkSet = new HashSet<>(); + PreTakeStockSheetStatus takeStatus = EnumUtil.getByCode(PreTakeStockSheetStatus.class, + this.getTakeStatus()); + for (int i = 0; i < this.getProducts().size(); i++) { + PreTakeStockProductVo product = this.getProducts().get(i); + if (checkSet.contains(product.getProductId())) { + throw new InputErrorException("第" + (i + 1) + "行商品已存在列表中,请勿重复添加!"); + } + + checkSet.add(product.getProductId()); + + if (takeStatus == PreTakeStockSheetStatus.FIRST_TAKE) { + if (product.getFirstNum() == null) { + throw new InputErrorException("第" + (i + 1) + "行商品的初盘数量不允许为空!"); + } + + if (NumberUtil.lt(product.getFirstNum(), 0)) { + throw new InputErrorException("第" + (i + 1) + "行商品的初盘数量不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getFirstNum(), 8)) { + throw new InputErrorException("第" + (i + 1) + "行商品的初盘数量最多允许8位小数!"); + } + } else if (takeStatus == PreTakeStockSheetStatus.SECOND_TAKE) { + if (product.getSecondNum() == null) { + throw new InputErrorException("第" + (i + 1) + "行商品的复盘数量不允许为空!"); + } + + if (NumberUtil.lt(product.getSecondNum(), 0)) { + throw new InputErrorException("第" + (i + 1) + "行商品的复盘数量不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getSecondNum(), 8)) { + throw new InputErrorException("第" + (i + 1) + "行商品的复盘数量最多允许8位小数!"); + } + } else if (takeStatus == PreTakeStockSheetStatus.RAND_TAKE) { + if (product.getRandNum() == null) { + throw new InputErrorException("第" + (i + 1) + "行商品的抽盘数量不允许为空!"); + } + + if (NumberUtil.lt(product.getRandNum(), 0)) { + throw new InputErrorException("第" + (i + 1) + "行商品的抽盘数量不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getRandNum(), 8)) { + throw new InputErrorException("第" + (i + 1) + "行商品的抽盘数量最多允许8位小数!"); + } + } else { + throw new InputErrorException("预先盘点状态格式错误!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockProductVo.java new file mode 100644 index 0000000..b4bb35f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockProductVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class PreTakeStockProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 初盘数量 + */ + @Schema(description = "初盘数量") + private BigDecimal firstNum; + + /** + * 复盘数量 + */ + @Schema(description = "复盘数量") + private BigDecimal secondNum; + + /** + * 抽盘数量 + */ + @Schema(description = "抽盘数量") + private BigDecimal randNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockSheetSelectorVo.java new file mode 100644 index 0000000..a14e5d2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockSheetSelectorVo.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class PreTakeStockSheetSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + @TypeMismatch(message = "预先盘点状态格式有误!") + @IsEnum(message = "预先盘点状态格式有误!", enumClass = PreTakeStockSheetStatus.class) + private Integer takeStatus; + + /** + * 修改时间 起始时间 + */ + @Schema(description = "修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @Schema(description = "修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockProductVo.java new file mode 100644 index 0000000..8b636dd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockProductVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class QueryPreTakeStockProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 检索关键字 + */ + @Schema(description = "检索关键字") + private String condition; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockSheetVo.java new file mode 100644 index 0000000..64bf0b5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockSheetVo.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryPreTakeStockSheetVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + @TypeMismatch(message = "预先盘点状态格式有误!") + @IsEnum(message = "预先盘点状态格式有误!", enumClass = PreTakeStockSheetStatus.class) + private Integer takeStatus; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @Schema(description = "修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @Schema(description = "修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/UpdatePreTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/UpdatePreTakeStockSheetVo.java new file mode 100644 index 0000000..526e027 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/UpdatePreTakeStockSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdatePreTakeStockSheetVo extends CreatePreTakeStockSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApprovePassTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApprovePassTakeStockSheetVo.java new file mode 100644 index 0000000..7d0dfc0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApprovePassTakeStockSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApproveRefuseTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApproveRefuseTakeStockSheetVo.java new file mode 100644 index 0000000..83df90e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApproveRefuseTakeStockSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/CreateTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/CreateTakeStockSheetVo.java new file mode 100644 index 0000000..c5ab9be --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/CreateTakeStockSheetVo.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 盘点任务ID + */ + @Schema(description = "盘点任务ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请选择关联盘点任务!") + private String planId; + + /** + * 预先盘点单ID + */ + @Schema(description = "预先盘点单ID") + private String preSheetId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + int orderNo = 1; + for (TakeStockSheetProductVo product : this.products) { + if (product.getTakeNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品盘点数量不能为空!"); + } + + if (NumberUtil.lt(product.getTakeNum(), 0)) { + throw new InputErrorException("第" + orderNo + "行商品盘点数量不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTakeNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品盘点数量最多允许8位小数!"); + } + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetProductVo.java new file mode 100644 index 0000000..7aad612 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryTakeStockSheetProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 检索关键字 + */ + @Schema(description = "检索关键字") + private String condition; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; + + /** + * 盘点任务ID + */ + @Schema(description = "盘点任务ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "盘点任务ID不能为空!") + private String planId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetVo.java new file mode 100644 index 0000000..9c033b3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetVo.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryTakeStockSheetVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 关联盘点任务号 + */ + @Schema(description = "关联盘点任务号") + private String planCode; + + /** + * 预先盘点单ID + */ + @Schema(description = "预先盘点单ID") + private String preSheetId; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @Schema(description = "盘点状态") + @TypeMismatch(message = "盘点状态格式有误!") + @IsEnum(message = "盘点状态格式有误!", enumClass = TakeStockPlanStatus.class) + private Integer takeStatus; + + /** + * 状态 + */ + @Schema(description = "状态") + @TypeMismatch(message = "状态格式有误!") + @IsEnum(message = "状态格式有误!", enumClass = TakeStockSheetStatus.class) + private Integer status; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @Schema(description = "修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @Schema(description = "修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 起始时间 + */ + @Schema(description = "审核时间 起始时间") + @TypeMismatch(message = "审核时间起始时间格式有误!") + private LocalDateTime approveTimeStart; + + /** + * 审核时间 截止时间 + */ + @Schema(description = "审核时间 截止时间") + @TypeMismatch(message = "审核时间截止时间格式有误!") + private LocalDateTime approveTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/TakeStockSheetProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/TakeStockSheetProductVo.java new file mode 100644 index 0000000..b27b6c3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/TakeStockSheetProductVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class TakeStockSheetProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 盘点数量 + */ + @Schema(description = "盘点数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "盘点数量不能为空!") + @TypeMismatch(message = "盘点数量格式有误!") + private BigDecimal takeNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/UpdateTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/UpdateTakeStockSheetVo.java new file mode 100644 index 0000000..5409381 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/UpdateTakeStockSheetVo.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class UpdateTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + int orderNo = 1; + for (TakeStockSheetProductVo product : this.products) { + if (product.getTakeNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品盘点数量不能为空!"); + } + + if (NumberUtil.lt(product.getTakeNum(), 0)) { + throw new InputErrorException("第" + orderNo + "行商品盘点数量不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTakeNum(), 8)) { + throw new InputErrorException("第" + orderNo + "行商品盘点数量最多允许8位小数!"); + } + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApprovePassScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApprovePassScTransferOrderVo.java new file mode 100644 index 0000000..0f60c0b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApprovePassScTransferOrderVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApproveRefuseScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApproveRefuseScTransferOrderVo.java new file mode 100644 index 0000000..7991ba5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApproveRefuseScTransferOrderVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID") + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由") + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/CreateScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/CreateScTransferOrderVo.java new file mode 100644 index 0000000..30b29d0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/CreateScTransferOrderVo.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class CreateScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 转出仓库ID + */ + @Schema(description = "转出仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "转出仓库ID不能为空!") + private String sourceScId; + + /** + * 转入仓库ID + */ + @Schema(description = "转入仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "转入仓库ID不能为空!") + private String targetScId; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 商品信息 + */ + @Schema(description = "商品信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + int orderNo = 1; + for (ScTransferProductVo product : this.products) { + if (NumberUtil.le(product.getTransferNum(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行商品的调拨数量必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getTransferNum(), 8)) { + throw new DefaultClientException("第" + orderNo + "行商品的调拨数量最多允许8位小数!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderDetailReceiveVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderDetailReceiveVo.java new file mode 100644 index 0000000..eaf9085 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderDetailReceiveVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QueryScTransferOrderDetailReceiveVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "调拨单ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "调拨单ID不能为空!") + private String orderId; + + @Schema(description = "明细ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "明细ID不能为空!") + private String detailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderVo.java new file mode 100644 index 0000000..de1c011 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderVo.java @@ -0,0 +1,85 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryScTransferOrderVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 转出仓库ID + */ + @Schema(description = "转出仓库ID") + private String sourceScId; + + /** + * 转入仓库ID + */ + @Schema(description = "转入仓库ID") + private String targetScId; + + /** + * 状态 + */ + @Schema(description = "状态") + @TypeMismatch(message = "状态格式有误!") + @IsEnum(message = "状态格式有误!", enumClass = ScTransferOrderStatus.class) + private Integer status; + + /** + * 修改人 + */ + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @Schema(description = "修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @Schema(description = "修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 起始时间 + */ + @Schema(description = "审核时间 起始时间") + @TypeMismatch(message = "审核时间起始时间格式有误!") + private LocalDateTime approveTimeStart; + + /** + * 审核时间 截止时间 + */ + @Schema(description = "审核时间 截止时间") + @TypeMismatch(message = "审核时间截止时间格式有误!") + private LocalDateTime approveTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferProductVo.java new file mode 100644 index 0000000..19a70b3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryScTransferProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @Schema(description = "检索关键字") + private String condition; + + /** + * 分类ID + */ + @Schema(description = "分类ID") + private String categoryId; + + /** + * 品牌ID + */ + @Schema(description = "品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ReceiveScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ReceiveScTransferOrderVo.java new file mode 100644 index 0000000..2171f19 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ReceiveScTransferOrderVo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class ReceiveScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 商品信息 + */ + @Schema(description = "收货商品", requiredMode = Schema.RequiredMode.REQUIRED) + @Valid + @NotEmpty(message = "收货商品不能为空!") + private List products; + + @Data + public static class ReceiveScTransferProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 收货数量 + */ + @Schema(description = "收货数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "收货数量不能为空!") + @TypeMismatch(message = "收货数量格式有误!") + private BigDecimal receiveNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ScTransferProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ScTransferProductVo.java new file mode 100644 index 0000000..2083de5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ScTransferProductVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ScTransferProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 调拨数量 + */ + @Schema(description = "调拨数量", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "调拨数量不能为空!") + @TypeMismatch(message = "调拨数量格式有误!") + private BigDecimal transferNum; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/UpdateScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/UpdateScTransferOrderVo.java new file mode 100644 index 0000000..ac94428 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/UpdateScTransferOrderVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateScTransferOrderVo extends CreateScTransferOrderVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/CreateProductStockWarningVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/CreateProductStockWarningVo.java new file mode 100644 index 0000000..419b3ee --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/CreateProductStockWarningVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.sc.vo.stock.warning; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CreateProductStockWarningVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 商品ID + */ + @Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 预警下限 + */ + @Schema(description = "预警下限", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "预警下限不能为空!") + @Positive(message = "预警下限必须大于0!") + @Digits(integer = 20, fraction = 8, message = "预警下限最多允许8位小数!") + private BigDecimal minLimit; + + /** + * 预警上限 + */ + @Schema(description = "预警上限", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "预警上限不能为空!") + @Positive(message = "预警上限必须大于0!") + @Digits(integer = 20, fraction = 8, message = "预警上限最多允许8位小数!") + private BigDecimal maxLimit; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/QueryProductStockWarningVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/QueryProductStockWarningVo.java new file mode 100644 index 0000000..64cab4b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/QueryProductStockWarningVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.sc.vo.stock.warning; + +import com.lframework.starter.web.core.components.validation.TypeMismatch; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.SortPageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryProductStockWarningVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @Schema(description = "仓库ID") + private String scId; + + /** + * 商品ID + */ + @Schema(description = "商品ID") + private String productId; + + /** + * 操作时间 起始时间 + */ + @Schema(description = "操作时间 起始时间") + @TypeMismatch(message = "操作时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 操作时间 截止时间 + */ + @Schema(description = "操作时间 截止时间") + @TypeMismatch(message = "操作时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 状态 + */ + @Schema(description = "状态") + @TypeMismatch(message = "状态格式有误!") + private Boolean available; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/UpdateProductStockWarningVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/UpdateProductStockWarningVo.java new file mode 100644 index 0000000..b823a24 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/warning/UpdateProductStockWarningVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.stock.warning; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductStockWarningVo extends CreateProductStockWarningVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 状态 + */ + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "状态不能为空!") + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/lombok.config b/xingyun-sc/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-sc/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/mappers/logistics/LogisticsSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/logistics/LogisticsSheetMapper.xml new file mode 100644 index 0000000..6936f24 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/logistics/LogisticsSheetMapper.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + o.* + FROM tbl_logistics_sheet AS o + + + + SELECT + o.id, + o.code, + o.logistics_no, + o.logistics_company_id, + o.sender_name, + o.sender_telephone, + o.sender_province_id, + o.sender_city_id, + o.sender_district_id, + o.sender_address, + o.receiver_name, + o.receiver_telephone, + o.receiver_province_id, + o.receiver_city_id, + o.receiver_district_id, + o.receiver_address, + o.status, + o.description, + o.total_weight, + o.total_volume, + o.total_amount, + o.delivery_by, + o.delivery_time, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + d.id AS detail_id, + d.sheet_id AS detail_sheet_id, + d.biz_id AS detail_biz_id, + d.biz_type AS detail_biz_type + FROM tbl_logistics_sheet AS o + LEFT JOIN tbl_logistics_sheet_detail AS d ON d.sheet_id = o.id + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderDetailMapper.xml new file mode 100644 index 0000000..c0e1168 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderDetailMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.order_id, + d.product_id, + d.order_num, + d.tax_price, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.receive_num + FROM tbl_purchase_order_detail AS d + + + UPDATE tbl_purchase_order_detail + SET receive_num = receive_num + #{num} + WHERE id = #{id} + AND (order_num - receive_num) >= #{num} + + + UPDATE tbl_purchase_order_detail + SET receive_num = receive_num - #{num} + WHERE id = #{id} + AND receive_num >= #{num} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderMapper.xml new file mode 100644 index 0000000..8365c0d --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderMapper.xml @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + o.id, + o.code, + o.sc_id, + o.supplier_id, + o.purchaser_id, + o.expect_arrive_date, + o.total_num, + o.total_gift_num, + o.total_amount, + o.flow_instance_id, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason + FROM tbl_purchase_order AS o + + + + SELECT + o.id, + o.code, + o.sc_id, + o.supplier_id, + o.purchaser_id, + o.expect_arrive_date, + o.total_num, + o.total_gift_num, + o.total_amount, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason, + o.flow_instance_id, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.tax_price AS detail_tax_price, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.tax_amount AS detail_tax_amount + FROM tbl_purchase_order${isForm ? "_form" : ""} AS o + LEFT JOIN tbl_purchase_order_detail${isForm ? "_form" : ""} AS d ON d.order_id = o.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit, + purchase.price AS purchase_price, + g.tax_rate, + g.available + FROM base_data_product AS g + INNER JOIN base_data_product_purchase AS purchase ON purchase.id = g.id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/PurchaseReturnMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseReturnMapper.xml new file mode 100644 index 0000000..ccde5c8 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseReturnMapper.xml @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_purchase_return AS r + LEFT JOIN tbl_receive_sheet AS s ON s.id = r.receive_sheet_id + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.update_by, + r.update_time, + r.approve_by, + r.approve_time, + r.status, + r.refuse_reason, + r.settle_status, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.return_num AS detail_return_num, + d.tax_price AS detail_tax_price, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.tax_amount AS detail_tax_amount, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.receive_sheet_detail_id AS detail_receive_sheet_detail_id + FROM tbl_purchase_return AS r + LEFT JOIN tbl_purchase_return_detail AS d ON d.return_id = r.id + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetDetailMapper.xml new file mode 100644 index 0000000..27c4f04 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetDetailMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.sheet_id, + d.product_id, + d.order_num, + d.tax_price, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.return_num + FROM tbl_receive_sheet_detail AS d + + + UPDATE tbl_receive_sheet_detail + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_receive_sheet_detail + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetMapper.xml new file mode 100644 index 0000000..0b7882e --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetMapper.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_date, + r.purchase_order_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_receive_sheet AS r + LEFT JOIN tbl_purchase_order AS o ON o.id = r.purchase_order_id + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_date, + r.purchase_order_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.update_by, + r.update_time, + r.approve_by, + r.approve_time, + r.status, + r.refuse_reason, + r.settle_status, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.tax_price AS detail_tax_price, + d.tax_amount AS detail_tax_amount, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.purchase_order_detail_id AS detail_purchase_order_detail_id + FROM tbl_receive_sheet AS r + LEFT JOIN tbl_receive_sheet_detail AS d ON d.sheet_id = r.id + + + + SELECT + s.id, + s.sc_id, + s.supplier_id, + s.purchaser_id, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.tax_price AS detail_tax_price, + d.tax_amount AS detail_tax_amount, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.return_num AS detail_return_num + FROM tbl_receive_sheet AS s + LEFT JOIN tbl_receive_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailLotMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailLotMapper.xml new file mode 100644 index 0000000..9f5d0e5 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailLotMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + SELECT + d.id, + d.detail_id, + d.order_num, + d.return_num, + d.cost_tax_amount, + d.settle_status, + d.order_no + FROM tbl_retail_out_sheet_detail_lot AS d + + + UPDATE tbl_retail_out_sheet_detail_lot + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_retail_out_sheet_detail_lot + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailMapper.xml new file mode 100644 index 0000000..69e54a3 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.sheet_id, + d.product_id, + d.order_num, + d.ori_price, + d.tax_price, + d.discount_rate, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.return_num + FROM tbl_retail_out_sheet_detail AS d + + + UPDATE tbl_retail_out_sheet_detail + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_retail_out_sheet_detail + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetMapper.xml new file mode 100644 index 0000000..08dbf2c --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetMapper.xml @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.sc_id, + s.member_id, + s.saler_id, + s.payment_date, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.approve_by, + s.approve_time, + s.status, + s.settle_status + FROM tbl_retail_out_sheet AS s + + + + SELECT + s.id, + s.code, + s.sc_id, + s.member_id, + s.saler_id, + s.payment_date, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + b.main_product_id AS detail_main_product_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.ori_price AS detail_ori_price, + d.tax_price AS detail_tax_price, + d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status, + d.tax_amount AS detail_tax_amount + FROM tbl_retail_out_sheet AS s + LEFT JOIN tbl_retail_out_sheet_detail AS d ON d.sheet_id = s.id + LEFT JOIN tbl_retail_out_sheet_detail_bundle AS b ON b.sheet_id = s.id AND b.product_detail_id = d.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit, + retail.price AS retail_price, + g.sale_tax_rate, + g.available + FROM base_data_product AS g + INNER JOIN base_data_product_retail AS retail ON retail.id = g.id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailReturnMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailReturnMapper.xml new file mode 100644 index 0000000..1f3fd82 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailReturnMapper.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.member_id, + r.saler_id, + r.payment_date, + r.out_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_retail_return AS r + LEFT JOIN tbl_retail_out_sheet AS s ON s.id = r.out_sheet_id + + + + SELECT r.id, r.code, r.sc_id, r.member_id, r.saler_id, r.payment_date, r.out_sheet_id, r.total_num, r.total_gift_num, + r.total_amount, r.description, r.create_by, r.create_time, r.update_by, r.update_time, r.approve_by, r.approve_time, + r.status, r.refuse_reason, r.settle_status, d.id AS detail_id, d.product_id AS detail_product_id, + d.return_num AS detail_return_num, d.ori_price AS detail_ori_price, d.tax_price AS detail_tax_price, d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, d.tax_rate AS detail_tax_rate, d.description AS detail_description, d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status, d.out_sheet_detail_id AS detail_out_sheet_detail_id, d.tax_amount AS detail_tax_amount + FROM tbl_retail_return AS r + LEFT JOIN tbl_retail_return_detail AS d ON d.return_id = r.id + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOrderDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderDetailMapper.xml new file mode 100644 index 0000000..d99e57a --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderDetailMapper.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.order_id, + d.product_id, + d.order_num, + d.ori_price, + d.tax_price, + d.discount_rate, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.out_num + FROM tbl_sale_order_detail AS d + + + UPDATE tbl_sale_order_detail + SET out_num = out_num + #{num} + WHERE id = #{id} + AND (order_num - out_num) >= #{num} + + + UPDATE tbl_sale_order_detail + SET out_num = out_num - #{num} + WHERE id = #{id} + AND out_num >= #{num} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOrderMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderMapper.xml new file mode 100644 index 0000000..0f24490 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderMapper.xml @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + o.id, + o.code, + o.sc_id, + o.customer_id, + o.saler_id, + o.total_num, + o.total_gift_num, + o.total_amount, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason + FROM tbl_sale_order AS o + + + + SELECT + o.id, + o.code, + o.sc_id, + o.customer_id, + o.saler_id, + o.total_num, + o.total_gift_num, + o.total_amount, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason, + d.id AS detail_id, + b.main_product_id AS detail_main_product_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.ori_price AS detail_ori_price, + d.tax_price AS detail_tax_price, + d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.tax_amount AS detail_tax_amount + FROM tbl_sale_order AS o + LEFT JOIN tbl_sale_order_detail AS d ON d.order_id = o.id + LEFT JOIN tbl_sale_order_detail_bundle AS b ON b.order_id = o.id AND b.product_detail_id = d.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit, + sale.price AS sale_price, + g.sale_tax_rate, + g.available + FROM base_data_product AS g + INNER JOIN base_data_product_sale AS sale ON sale.id = g.id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailLotMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailLotMapper.xml new file mode 100644 index 0000000..359384a --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailLotMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + SELECT + d.id, + d.detail_id, + d.order_num, + d.return_num, + d.cost_tax_amount, + d.settle_status, + d.order_no + FROM tbl_sale_out_sheet_detail_lot AS d + + + UPDATE tbl_sale_out_sheet_detail_lot + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_sale_out_sheet_detail_lot + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailMapper.xml new file mode 100644 index 0000000..d21f766 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.sheet_id, + d.product_id, + d.order_num, + d.ori_price, + d.tax_price, + d.discount_rate, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.return_num + FROM tbl_sale_out_sheet_detail AS d + + + UPDATE tbl_sale_out_sheet_detail + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_sale_out_sheet_detail + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetMapper.xml new file mode 100644 index 0000000..0e5c18b --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetMapper.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.sc_id, + s.customer_id, + s.saler_id, + s.payment_date, + s.sale_order_id, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.approve_by, + s.approve_time, + s.status, + s.settle_status + FROM tbl_sale_out_sheet AS s + LEFT JOIN tbl_sale_order AS o ON o.id = s.sale_order_id + + + + SELECT + s.id, + s.code, + s.sc_id, + s.customer_id, + s.saler_id, + s.payment_date, + s.sale_order_id, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + b.main_product_id AS detail_main_product_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.ori_price AS detail_ori_price, + d.tax_price AS detail_tax_price, + d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status, + d.sale_order_detail_id AS detail_sale_order_detail_id, + d.tax_amount AS detail_tax_amount + FROM tbl_sale_out_sheet AS s + LEFT JOIN tbl_sale_out_sheet_detail AS d ON d.sheet_id = s.id + LEFT JOIN tbl_sale_out_sheet_detail_bundle AS b ON b.sheet_id = s.id AND b.product_detail_id = d.id + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleReturnMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleReturnMapper.xml new file mode 100644 index 0000000..86b1176 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleReturnMapper.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.customer_id, + r.saler_id, + r.payment_date, + r.out_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_sale_return AS r + LEFT JOIN tbl_sale_out_sheet AS s ON s.id = r.out_sheet_id + + + + SELECT r.id, r.code, r.sc_id, r.customer_id, r.saler_id, r.payment_date, r.out_sheet_id, r.total_num, r.total_gift_num, + r.total_amount, r.description, r.create_by, r.create_time, r.update_by, r.update_time, r.approve_by, r.approve_time, + r.status, r.refuse_reason, r.settle_status, d.id AS detail_id, d.product_id AS detail_product_id, + d.return_num AS detail_return_num, d.ori_price AS detail_ori_price, d.tax_price AS detail_tax_price, d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, d.tax_rate AS detail_tax_rate, d.description AS detail_description, d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status, d.out_sheet_detail_id AS detail_out_sheet_detail_id, d.tax_amount AS detail_tax_amount + FROM tbl_sale_return AS r + LEFT JOIN tbl_sale_return_detail AS d ON d.return_id = r.id + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/ProductStockLogMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/ProductStockLogMapper.xml new file mode 100644 index 0000000..fec1db1 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/ProductStockLogMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + gsl.id, + gsl.product_id, + gsl.sc_id, + gsl.ori_stock_num, + gsl.cur_stock_num, + gsl.ori_tax_price, + gsl.cur_tax_price, + gsl.stock_num, + gsl.tax_amount, + gsl.create_by, + gsl.create_time, + gsl.biz_id, + gsl.biz_code, + gsl.biz_detail_id, + gsl.biz_type + FROM tbl_product_stock_log AS gsl + INNER JOIN base_data_product AS g ON g.id = gsl.product_id AND g.product_type = 1 + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/ProductStockMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/ProductStockMapper.xml new file mode 100644 index 0000000..d672fba --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/ProductStockMapper.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + SELECT + gs.id, + gs.product_id, + gs.sc_id, + gs.stock_num, + gs.tax_price, + gs.tax_amount + FROM tbl_product_stock AS gs + INNER JOIN base_data_product AS g ON g.id = gs.product_id AND g.product_type = 1 + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + + + + UPDATE tbl_product_stock + SET stock_num = stock_num + #{stockNum}, tax_amount = tax_amount + #{taxAmount} + ,tax_price = CASE WHEN stock_num = 0 THEN 0 ELSE tax_amount / stock_num END + WHERE product_id = #{productId} + AND sc_id = #{scId} + AND stock_num = #{oriStockNum} + AND tax_amount = #{oriTaxAmount} + + + UPDATE tbl_product_stock + SET stock_num = stock_num - #{stockNum}, tax_amount = tax_amount - #{taxAmount} + ,tax_price = CASE WHEN stock_num = 0 THEN tax_price ELSE tax_amount / stock_num END + WHERE product_id = #{productId} + AND sc_id = #{scId} + AND stock_num = #{oriStockNum} + AND tax_amount = #{oriTaxAmount} + AND stock_num >= #{stockNum} + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/ProductStockWarningMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/ProductStockWarningMapper.xml new file mode 100644 index 0000000..a72e05a --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/ProductStockWarningMapper.xml @@ -0,0 +1,40 @@ + + + + + + SELECT + tb.* + FROM tbl_product_stock_warning AS tb + LEFT JOIN base_data_product AS p ON p.id = tb.product_id + LEFT JOIN base_data_store_center AS sc ON sc.id = tb.sc_id + LEFT JOIN base_data_product_brand AS b ON b.id = p.brand_id + LEFT JOIN base_data_product_category AS c ON c.id = p.category_id + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustReasonMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustReasonMapper.xml new file mode 100644 index 0000000..7490b7d --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustReasonMapper.xml @@ -0,0 +1,40 @@ + + + + + + SELECT + tb.* + FROM tbl_stock_adjust_reason AS tb + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml new file mode 100644 index 0000000..df390bd --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_stock_adjust_sheet AS tb + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.biz_type, + tb.reason_id, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + tb.refuse_reason, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.stock_num AS detail_stock_num, + d.description AS detail_description + FROM tbl_stock_adjust_sheet AS tb + LEFT JOIN tbl_stock_adjust_sheet_detail AS d ON d.sheet_id = tb.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM base_data_product AS g + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/PreTaskStockSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/PreTaskStockSheetMapper.xml new file mode 100644 index 0000000..e5172ca --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/PreTaskStockSheetMapper.xml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_pre_take_stock_sheet AS tb + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.take_status, + tb.description, + tb.update_by, + tb.update_time, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.first_num AS detail_first_num, + d.second_num AS detail_second_num, + d.rand_num AS detail_rand_num + FROM tbl_pre_take_stock_sheet AS tb + LEFT JOIN tbl_pre_take_stock_sheet_detail AS d ON d.sheet_id = tb.id + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.take_status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM tbl_pre_take_stock_sheet AS tb + + + + SELECT + tb.product_id, + tb.first_num, + tb.second_num, + tb.rand_num, + sh.take_status + FROM tbl_pre_take_stock_sheet_detail AS tb + LEFT JOIN tbl_pre_take_stock_sheet AS sh ON sh.id = tb.sheet_id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM base_data_product AS g + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockConfigMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockConfigMapper.xml new file mode 100644 index 0000000..8b73d9e --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockConfigMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanDetailMapper.xml new file mode 100644 index 0000000..ebde1ff --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanDetailMapper.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.product_id, + tb.stock_num + FROM tbl_take_stock_plan_detail AS tb + + + + SELECT + tb.id, + tb.product_id, + tb.stock_num, + tb.take_num, + tb.total_out_num, + tb.total_in_num, + tb.description, + tb.order_no + FROM tbl_take_stock_plan_detail AS tb + + + UPDATE tbl_take_stock_plan_detail SET total_in_num = total_in_num + #{num} + WHERE plan_id IN (SELECT id from tbl_take_stock_plan WHERE sc_id = #{scId} AND take_status = 0) AND product_id = #{productId} + + + UPDATE tbl_take_stock_plan_detail SET total_out_num = total_out_num + #{num} + WHERE plan_id IN (SELECT id from tbl_take_stock_plan WHERE sc_id = #{scId} AND take_status = 0) AND product_id = #{productId} + + + UPDATE tbl_take_stock_plan_detail set ori_take_num = IFNULL(ori_take_num, 0) + #{num} + WHERE plan_id = #{planId} AND product_id = #{productId} + + + UPDATE tbl_take_stock_plan_detail + SET stock_num = stock_num + total_in_num - total_out_num + WHERE plan_id = #{planId} + + + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanMapper.xml new file mode 100644 index 0000000..79a96e9 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanMapper.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_take_stock_plan AS tb + + + + SELECT + tb.product_id, + tb.stock_num, + tb.total_out_num, + tb.total_in_num + FROM tbl_take_stock_plan_detail AS tb + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.take_type, + tb.take_status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM tbl_take_stock_plan AS tb + + + + SELECT + tb.id, + tb.product_id, + tb.ori_take_num, + tb.take_num, + tb.stock_num, + tb.total_in_num, + tb.total_out_num, + tb.description + FROM tbl_take_stock_plan_detail AS tb + WHERE tb.plan_id = #{id} + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockSheetMapper.xml new file mode 100644 index 0000000..862e8e0 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockSheetMapper.xml @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.plan_id, + tb.pre_sheet_id, + tb.sc_id, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time + FROM tbl_take_stock_sheet AS tb + LEFT JOIN tbl_take_stock_plan AS plan ON plan.id = tb.plan_id + + + + SELECT + tb.id, + tb.code, + tb.plan_id, + tb.pre_sheet_id, + tb.sc_id, + tb.status, + tb.description, + tb.refuse_reason, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.take_num AS detail_take_num, + d.description AS detail_description + FROM tbl_take_stock_sheet AS tb + LEFT JOIN tbl_take_stock_sheet_detail AS d ON d.sheet_id = tb.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM base_data_product AS g + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderDetailMapper.xml new file mode 100644 index 0000000..5890176 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderDetailMapper.xml @@ -0,0 +1,16 @@ + + + + + UPDATE tbl_sc_transfer_order_detail SET receive_num = receive_num + #{receiveNum}, receive_amount = receive_amount + #{receiveAmount} + WHERE order_id = #{orderId} + AND product_id = #{productId} + AND transfer_num - receive_num >= #{receiveNum} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderMapper.xml new file mode 100644 index 0000000..acd5c4b --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_sc_transfer_order AS tb + + + + SELECT + tb.id, + tb.code, + tb.source_sc_id, + tb.target_sc_id, + tb.total_num, + tb.total_amount, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + tb.refuse_reason, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.transfer_num AS detail_transfer_num, + d.receive_num AS detail_receive_num, + d.description AS detail_description + FROM tbl_sc_transfer_order AS tb + LEFT JOIN tbl_sc_transfer_order_detail AS d ON d.order_id = tb.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM tbl_product_stock AS ps + INNER JOIN base_data_product AS g ON g.id = ps.product_id AND g.product_type = 1 + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/print/purchase-order.ftl b/xingyun-sc/src/main/resources/print/purchase-order.ftl new file mode 100644 index 0000000..4736e19 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/purchase-order.ftl @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 预计到货日期 + ${expectArriveDate!''}
+ 供应商编号 + ${supplierCode!''} + 供应商名称 + ${supplierName!''} + 采购员 + ${purchaserName!''}
+ 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 采购价 + + 采购数量 + + 采购金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.purchasePrice!''}${detail.purchaseNum!''}${detail.purchaseAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/purchase-return.ftl b/xingyun-sc/src/main/resources/print/purchase-return.ftl new file mode 100644 index 0000000..4a32977 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/purchase-return.ftl @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 采购收货单号 + ${receiveSheetCode!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 采购员 + ${purchaserName!''} + 付款日期 + ${paymentDate!''}
+ 供应商编号 + ${supplierCode!''} + 供应商名称 + ${supplierName!''}
+ 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 采购价 + + 退货数量 + + 退货金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.purchasePrice!''}${detail.returnNum!''}${detail.returnAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/receive-sheet.ftl b/xingyun-sc/src/main/resources/print/receive-sheet.ftl new file mode 100644 index 0000000..81f7195 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/receive-sheet.ftl @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 采购订单号 + ${purchaseOrderCode!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 采购员 + ${purchaserName!''} + 付款日期 + ${paymentDate!''}
+ 供应商编号 + ${supplierCode!''} + 供应商名称 + ${supplierName!''} + 实际到货日期 + ${receiveDate!''}
+ 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 采购价 + + 收货数量 + + 收货金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.purchasePrice!''}${detail.receiveNum!''}${detail.receiveAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/retail-out-sheet.ftl b/xingyun-sc/src/main/resources/print/retail-out-sheet.ftl new file mode 100644 index 0000000..b6a991b --- /dev/null +++ b/xingyun-sc/src/main/resources/print/retail-out-sheet.ftl @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 销售员 + ${salerName!''} + 付款日期 + ${paymentDate!''}
+ 会员编号 + ${memberCode!''} + 会员名称 + ${memberName!''} +
+ 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 价格 + + 出库数量 + + 出库金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.taxPrice!''}${detail.outNum!''}${detail.outAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/retail-return.ftl b/xingyun-sc/src/main/resources/print/retail-return.ftl new file mode 100644 index 0000000..34f441a --- /dev/null +++ b/xingyun-sc/src/main/resources/print/retail-return.ftl @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 零售出库单号 + ${outSheetCode!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 销售员 + ${salerName!''} + 付款日期 + ${paymentDate!''}
+ 会员编号 + ${memberCode!''} + 会员名称 + ${memberName!''}
+ 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 供应商 + + 价格 + + 退货数量 + + 退货金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.supplierName!''}${detail.taxPrice!''}${detail.returnNum!''}${detail.returnAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/sale-order.ftl b/xingyun-sc/src/main/resources/print/sale-order.ftl new file mode 100644 index 0000000..0502386 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/sale-order.ftl @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 客户编号 + ${customerCode!''} + 客户名称 + ${customerName!''} + 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''} + 销售员 + ${salerName!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 价格 + + 销售数量 + + 销售金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.taxPrice!''}${detail.orderNum!''}${detail.orderAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/sale-out-sheet.ftl b/xingyun-sc/src/main/resources/print/sale-out-sheet.ftl new file mode 100644 index 0000000..81306a6 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/sale-out-sheet.ftl @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 销售订单号 + ${saleOrderCode!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 销售员 + ${salerName!''} + 付款日期 + ${paymentDate!''}
+ 客户编号 + ${customerCode!''} + 客户名称 + ${customerName!''} +
+ 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 价格 + + 出库数量 + + 出库金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.taxPrice!''}${detail.outNum!''}${detail.outAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/sale-return.ftl b/xingyun-sc/src/main/resources/print/sale-return.ftl new file mode 100644 index 0000000..d4001e7 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/sale-return.ftl @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + +
+ 单据号 + ${code!''}
+ 销售出库单号 + ${outSheetCode!''}
+ 仓库编号 + ${scCode!''} + 仓库名称 + ${scName!''} + 销售员 + ${salerName!''} + 付款日期 + ${paymentDate!''}
+ 客户编号 + ${customerCode!''} + 客户名称 + ${customerName!''}
+ 创建人 + ${createBy!''} + 创建时间 + ${createTime!''}
+ 审核人 + ${approveBy!''} + 审核时间 + ${approveTime!''}
+ 备注 + ${description!''}
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品简码 + + 供应商 + + 价格 + + 退货数量 + + 退货金额 +
${detail.productCode!''}${detail.productName!''}${detail.skuCode!''}${detail.externalCode!''}${detail.supplierName!''}${detail.taxPrice!''}${detail.returnNum!''}${detail.returnAmount!''}
+ + \ No newline at end of file diff --git a/xingyun-server/pom.xml b/xingyun-server/pom.xml new file mode 100644 index 0000000..e08ade5 --- /dev/null +++ b/xingyun-server/pom.xml @@ -0,0 +1,158 @@ + + + 4.0.0 + + com.lframework + xingyun + 1.0.0 + + + xingyun-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com.lframework + rabbitmq-starter + + + org.ssssssss + magic-api-spring-boot-starter + + + org.ssssssss + magic-api-plugin-cluster + + + org.ssssssss + magic-api-servlet-javaee + + + + + + org.ssssssss + magic-api-servlet-javaee + 2.1.1 + + + + + cn.dev33 + sa-token-spring-boot3-starter + 1.44.0 + + + cn.dev33 + sa-token-redis-jackson + 1.44.0 + + + cn.dev33 + sa-token-alone-redis + 1.44.0 + + + + + com.baomidou + mybatis-plus-spring-boot3-starter + 3.5.7 + + + com.baomidou + dynamic-datasource-spring-boot3-starter + 4.3.1 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + copy-resources-to-target + package + + copy-resources + + + ${project.build.directory} + + + ${project.basedir} + true + + Dockerfile + + + + ${project.basedir}/src/main/resources + true + + scripts/* + + + + + + + + + + + src/main/resources + true + + application.yml + + + + src/main/resources + false + + ** + + + db/** + scripts/* + + + + + + \ No newline at end of file diff --git a/xingyun-server/src/main/java/com/lframework/xingyun/server/XingYunApplication.java b/xingyun-server/src/main/java/com/lframework/xingyun/server/XingYunApplication.java new file mode 100644 index 0000000..336e59e --- /dev/null +++ b/xingyun-server/src/main/java/com/lframework/xingyun/server/XingYunApplication.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.server; + +import com.lframework.starter.web.core.annotations.locker.EnableLock; +import com.lframework.starter.web.core.annotations.locker.LockType; +import org.mybatis.spring.annotation.MapperScan; +import org.springdoc.core.models.GroupedOpenApi; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@EnableLock(type = LockType.REDIS) +@ServletComponentScan(basePackages = {"com.lframework"}) +@SpringBootApplication(scanBasePackages = {"com.lframework"}) +@MapperScan({"com.lframework.xingyun.**.mappers"}) +public class XingYunApplication { + + public static void main(String[] args) { + + SpringApplication.run(XingYunApplication.class, args); + } + + @Configuration + public static class MagicApiCompatConfiguration { + + @Bean + @ConditionalOnMissingBean(type = "org.ssssssss.magicapi.servlet.javaee.MagicJavaEEWebRequestInterceptor") + public Object magicJavaEEWebRequestInterceptor(AutowireCapableBeanFactory beanFactory) + throws Exception { + Class clazz = Class.forName( + "org.ssssssss.magicapi.servlet.javaee.MagicJavaEEWebRequestInterceptor"); + java.lang.reflect.Constructor ctor = clazz.getDeclaredConstructors()[0]; + ctor.setAccessible(true); + Object[] args = new Object[ctor.getParameterCount()]; + Class[] pts = ctor.getParameterTypes(); + for (int i = 0; i < pts.length; i++) { + Object candidate = beanFactory.getBeanProvider(pts[i]).getIfAvailable(); + if (candidate == null && pts[i].isPrimitive()) { + if (pts[i] == boolean.class) { + candidate = false; + } else if (pts[i] == byte.class) { + candidate = (byte) 0; + } else if (pts[i] == short.class) { + candidate = (short) 0; + } else if (pts[i] == int.class) { + candidate = 0; + } else if (pts[i] == long.class) { + candidate = 0L; + } else if (pts[i] == float.class) { + candidate = 0F; + } else if (pts[i] == double.class) { + candidate = 0D; + } else if (pts[i] == char.class) { + candidate = '\0'; + } + } + args[i] = candidate; + } + return ctor.newInstance(args); + } + } + + /** + * OpenAPI 分组配置 + */ + @Configuration + public static class SwaggerApiConfiguration { + + @Bean + public GroupedOpenApi defaultApi() { + return GroupedOpenApi.builder() + .group("ERP") + .packagesToScan( + "com.lframework.xingyun.server", + "com.lframework.xingyun.basedata", + "com.lframework.xingyun.chart", + "com.lframework.xingyun.core", + "com.lframework.xingyun.sc", + "com.lframework.xingyun.settle" + ) + .pathsToMatch("/**") + .build(); + } + } +} diff --git a/xingyun-server/src/main/java/lombok.config b/xingyun-server/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-server/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-server/src/main/resources/application-dev.yml b/xingyun-server/src/main/resources/application-dev.yml new file mode 100644 index 0000000..029af33 --- /dev/null +++ b/xingyun-server/src/main/resources/application-dev.yml @@ -0,0 +1,110 @@ +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + level: + com.lframework: DEBUG + io.lettuce.core.protocol: OFF + org.dromara.warm.flow: DEBUG + +spring: + servlet: + multipart: + #临时文件路径 + location: ./tmp-datas + datasource: + dynamic: + # 设置默认数据源 + primary: master + # 是否严格匹配数据源 未匹配到指定数据源时true抛异常,false使用默认数据源 + strict: true + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://192.168.0.193:3306/platform?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 + username: erp + password: 123456 + druid: + initial-size: 10 + min-idle: 10 + max-active: 200 + max-wait: 60000 + time-between-eviction-runs-millis: 300000 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat + #redis配置,这个redis用来缓存业务数据 + data: + redis: + host: 192.168.0.193 + port: 6379 + password: 5291314 + #连接超时时间 + timeout: 10s + lettuce: + pool: + #连接池中的最小空闲连接 + min-idle: 0 + #连接池中的最大空闲连接 + max-idle: 8 + #连接池的最大数据库连接数 + max-active: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + #RabbitMQ配置 + rabbitmq: + addresses: 192.168.0.193:5672 # RabbitMQ集群地址列表,多个地址用逗号分隔 + virtual-host: / + username: lyw + password: 123456 + connection-timeout: 60000 # 连接超时时间(毫秒),默认为60000毫秒(60秒) + ssl: + enabled: false # 是否启用SSL,默认为false + algorithm: TLSv1.2 # SSL算法,默认为TLSv1.2 + publisher-confirm-type: SIMPLE # 发布确认机制 + publisher-returns: true # 是否开启发布返回机制,默认为false + listener: + type: direct + simple: + acknowledge-mode: AUTO # 消费者确认模式,默认为auto + retry: + enabled: false # 是否启用重试机制,默认为false + direct: + acknowledge-mode: AUTO # 消费者确认模式,默认为auto + retry: + enabled: false # 是否启用重试机制,默认为false + +sa-token: + # 配置 Sa-Token 单独使用的 Redis 连接,将业务和鉴权独立 + alone-redis: + # Redis数据库索引(默认为0),最好与业务数据的redis隔离 + database: 1 + # Redis服务器地址 + host: ${spring.data.redis.host} + # Redis服务器连接端口 + port: ${spring.data.redis.port} + # Redis服务器连接密码(默认为空) + password: ${spring.data.redis.password} + # 连接超时时间 + timeout: ${spring.data.redis.timeout} + +jugg: + # 公开上传 + upload: + #下载时的baseUrl,与domain的区别:会在url后面拼接/**作为静态资源的url,而domain是后端系统的具体域名,下载时的完整url例如:upload.domain + upload.url/xxx.jpg + url: /oss + #下载时的域名 + domain: http://localhost:8080 + #上传文件的路径 + location: ./upload-data + # 安全上传 + security-upload: + #下载时的域名,一般情况下和公开上传的域名一致 + domain: ${jugg.upload.domain} + # 上传文件的路径 + location: ${jugg.upload.location} diff --git a/xingyun-server/src/main/resources/application-prod.yml b/xingyun-server/src/main/resources/application-prod.yml new file mode 100644 index 0000000..b40e34b --- /dev/null +++ b/xingyun-server/src/main/resources/application-prod.yml @@ -0,0 +1,114 @@ +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + file: + name: logs/${spring.application.name}.log + max-history: 14 + level: + io.lettuce.core.protocol: OFF + +spring: + servlet: + multipart: + #临时文件路径 + location: ./tmp-datas + datasource: + dynamic: + # 设置默认数据源 + primary: master + # 是否严格匹配数据源 未匹配到指定数据源时true抛异常,false使用默认数据源 + strict: true + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://mysql:3306/platform?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true + username: root + password: root123 + druid: + initial-size: 10 + min-idle: 10 + max-active: 200 + max-wait: 60000 + time-between-eviction-runs-millis: 300000 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat + #redis配置,这个redis用来缓存业务数据 + data: + redis: + host: redis + port: 6379 + #数据库 + database: 0 + password: redis123 + #连接超时时间 + timeout: 10s + lettuce: + pool: + #连接池中的最小空闲连接 + min-idle: 0 + #连接池中的最大空闲连接 + max-idle: 8 + #连接池的最大数据库连接数 + max-active: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + #RabbitMQ配置 + rabbitmq: + addresses: rabbitmq:5672 # RabbitMQ集群地址列表,多个地址用逗号分隔 + virtual-host: / + username: admin + password: admin123 + connection-timeout: 60000 # 连接超时时间(毫秒),默认为60000毫秒(60秒) + ssl: + enabled: false # 是否启用SSL,默认为false + algorithm: TLSv1.2 # SSL算法,默认为TLSv1.2 + publisher-confirm-type: SIMPLE # 发布确认机制 + publisher-returns: true # 是否开启发布返回机制,默认为false + listener: + type: direct + simple: + acknowledge-mode: AUTO # 消费者确认模式,默认为auto + retry: + enabled: false # 是否启用重试机制,默认为false + direct: + acknowledge-mode: AUTO # 消费者确认模式,默认为auto + retry: + enabled: false # 是否启用重试机制,默认为false + +sa-token: + # 配置 Sa-Token 单独使用的 Redis 连接,将业务和鉴权独立 + alone-redis: + # Redis数据库索引(默认为0),最好与业务数据的redis隔离 + database: 1 + # Redis服务器地址 + host: ${spring.data.redis.host} + # Redis服务器连接端口 + port: ${spring.data.redis.port} + # Redis服务器连接密码(默认为空) + password: ${spring.data.redis.password} + # 连接超时时间 + timeout: ${spring.data.redis.timeout} + +jugg: + # 公开上传 + upload: + #下载时的baseUrl,与domain的区别:会在url后面拼接/**作为静态资源的url,而domain是后端系统的具体域名,下载时的完整url例如:upload.domain + upload.url/xxx.jpg + url: /oss + #下载时的域名 + domain: https://www.jianyaojd.com + #上传文件的路径 + location: /app/upload-data + # 安全上传 + security-upload: + #下载时的域名,一般情况下和公开上传的域名一致 + domain: ${jugg.upload.domain} + url: /download/security + # 上传文件的路径 + location: ${jugg.upload.location} \ No newline at end of file diff --git a/xingyun-server/src/main/resources/application-test.yml b/xingyun-server/src/main/resources/application-test.yml new file mode 100644 index 0000000..712f9ef --- /dev/null +++ b/xingyun-server/src/main/resources/application-test.yml @@ -0,0 +1,115 @@ +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + file: + name: logs/${spring.application.name}.log + max-history: 14 + level: + io.lettuce.core.protocol: OFF + +spring: + servlet: + multipart: + #临时文件路径 + location: D:\tmp\tmp-datas + datasource: + dynamic: + # 设置默认数据源 + primary: master + # 是否严格匹配数据源 未匹配到指定数据源时true抛异常,false使用默认数据源 + strict: true + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/platform?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 + username: root + password: password + druid: + initial-size: 10 + min-idle: 10 + max-active: 200 + max-wait: 60000 + time-between-eviction-runs-millis: 300000 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat + #redis配置,这个redis用来缓存业务数据 + redis: + #地址 + host: 127.0.0.1 + #端口,默认为6379 + port: 6379 + #数据库 + database: 0 + #密码 + password: password + #连接超时时间 + timeout: 10s + lettuce: + pool: + #连接池中的最小空闲连接 + min-idle: 0 + #连接池中的最大空闲连接 + max-idle: 8 + #连接池的最大数据库连接数 + max-active: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + #RabbitMQ配置 + rabbitmq: + addresses: 127.0.0.1:5672 # RabbitMQ集群地址列表,多个地址用逗号分隔 + virtual-host: / + username: username + password: password + connection-timeout: 60000 # 连接超时时间(毫秒),默认为60000毫秒(60秒) + ssl: + enabled: false # 是否启用SSL,默认为false + algorithm: TLSv1.2 # SSL算法,默认为TLSv1.2 + publisher-confirm-type: SIMPLE # 发布确认机制 + publisher-returns: true # 是否开启发布返回机制,默认为false + listener: + type: direct + simple: + acknowledge-mode: AUTO # 消费者确认模式,默认为auto + retry: + enabled: false # 是否启用重试机制,默认为false + direct: + acknowledge-mode: AUTO # 消费者确认模式,默认为auto + retry: + enabled: false # 是否启用重试机制,默认为false + +sa-token: + # 配置 Sa-Token 单独使用的 Redis 连接,将业务和鉴权独立 + alone-redis: + # Redis数据库索引(默认为0),最好与业务数据的redis隔离 + database: 1 + # Redis服务器地址 + host: ${spring.redis.host} + # Redis服务器连接端口 + port: ${spring.redis.port} + # Redis服务器连接密码(默认为空) + password: ${spring.redis.password} + # 连接超时时间 + timeout: ${spring.redis.timeout} + +jugg: + # 公开上传 + upload: + #下载时的baseUrl,与domain的区别:会在url后面拼接/**作为静态资源的url,而domain是后端系统的具体域名,下载时的完整url例如:upload.domain + upload.url/xxx.jpg + url: /oss + #下载时的域名 + domain: http://localhost:8080 + #上传文件的路径 + location: D:\upload\upload-data + # 安全上传 + security-upload: + #下载时的域名,一般情况下和公开上传的域名一致 + domain: ${jugg.upload.domain} + # 上传文件的路径 + location: ${jugg.upload.location} diff --git a/xingyun-server/src/main/resources/application.yml b/xingyun-server/src/main/resources/application.yml new file mode 100644 index 0000000..d0f4391 --- /dev/null +++ b/xingyun-server/src/main/resources/application.yml @@ -0,0 +1,229 @@ +server: + #端口 + port: 8080 +spring: + main: + allow-bean-definition-overriding: true + allow-circular-references: true + application: + name: @project.artifactId@ + profiles: + active: @profiles-active@ + servlet: + multipart: + #是否开启文件上传 + enabled: true + #单个文件最大值 + max-file-size: 10MB + #请求中所有文件的最大值 + max-request-size: 100MB + #将文件写入磁盘的阈值 + #file-size-threshold: 0 + #是否要延迟解析文件 + #resolve-lazily: false + quartz: + jdbc: + initialize-schema: never + job-store-type: jdbc + wait-for-jobs-to-complete-on-shutdown: true + #时间格式 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + default-property-inclusion: non_null + #使用redis存储SESSION + session: + store-type: redis + redis: + lettuce: + reader-idle-time-seconds: 30 + +knife4j: + enable: true + setting: + language: zh-CN + # 是否显示界面中SwaggerModel功能 + enableSwaggerModels: false + # 是否显示界面中"文档管理"功能 + enableDocumentManage: true + # 是否默认显示底部Footer + enableFooter: false + # 是否自定义Footer + enableFooterCustom: true + # 自定义Footer内容(支持Markdown语法) + footerCustomContent: Apache License 2.0 | Copyright 2019-[星云ERP](https://gitee.com/lframework/xingyun) + # 是否开启调试 + enableDebug: true + # 是否显示OpenAPI原始结构的Tab框,默认显示 + enableOpenApi: false + # 是否生产环境 + production: false + +# Sa-Token配置 +sa-token: + # token名称 (同时也是cookie名称),此值不要修改 + token-name: X-Auth-Token + # token有效期,单位s 默认30天, -1代表永不过期 + timeout: 25920000 + # token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + active-timeout: -1 + # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + is-concurrent: true + # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + is-share: false + # token风格 + token-style: uuid + # 是否输出操作日志 + is-log: false + # Sa-Token 单独 Redis 连接(避免占位符解析失败,直接使用显式值) + alone-redis: + host: 192.168.1.101 + port: 6379 + password: lei123456 + database: 1 + timeout: 10s + +jugg: + secret: + # 秘钥,用于敏感信息加密,生产环境一定要更改此项,并且产生数据后不要更改秘钥 + # 提供了EncryptUtil工具类,包含:生成秘钥、加密、解密方法。 + key: eRE2drUFINojkG9ivqtfOA== + #默认配置 + default-setting: + #默认的用户ID,用于写入数据库时的createById和updateById的自动赋值,如果有登录人则取登录人ID,如果没有则取默认用户ID,如果不配置,默认是1 + default-user-id: 1 + #默认的用户姓名,用于写入数据库时的createBy和updateBy的自动赋值,如果有登录人则取登录人姓名,如果没有则取默认用户姓名,如果不配置,默认是系统管理员 + default-user-name: 系统管理员 + web: + #不需要认证的Url + filter-url: ${magic-api.push_path} + #终端ID + worker-id: 1 + #数据中心ID + center-id: 1 + #重复提交拦截暂时不实现 + #repeat-request: + #重复提交拦截间隔(单位:秒) + #filter-interval: 1 + #缓存TTL配置 单位:秒 + cache: + #公共缓存过期时间 + ttl: 1800 + #特殊指定缓存过期时间,以下示例为cacheName的过期时间是3600秒、cacheName2的过期是7200秒。cacheName、cacheName2对应的是@Cacheable的Value属性 + #regions: + # cacheName: 3600 + # cacheName2: 7200 + regions: + product_stock_warning_notify: 86400 + #开启websocket + ws: + enabled: true + #通信topic + #topic: xingyun:ws:topic + #是否支持跨域 + #support-cross-domain: false + #验证码配置 + kaptcha: + #过期时间(单位:分钟) + expire-time: 5 + session-config-key: KAPTCHA_SESSION_KEY + session-config-date: KAPTCHA_SESSION_DATE + border: true + border-color: black + border-thickness: 1 + noise-color: black + noise-impl: com.google.code.kaptcha.impl.DefaultNoise + obscurificator-impl: com.google.code.kaptcha.impl.WaterRipple + producer-impl: com.google.code.kaptcha.impl.DefaultKaptcha + text-producer-impl: com.google.code.kaptcha.text.impl.DefaultTextCreator + text-producer-char-string: abcde2345678gfynmnpwx + text-producer-char-length: 4 + text-producer-font-names: Arial,Courier + text-producer-font-color: black + text-producer-font-size: 28 + text-producer-char-space: 2 + word-render-impl: com.google.code.kaptcha.text.impl.DefaultWordRenderer + back-ground-impl: com.google.code.kaptcha.impl.DefaultBackground + back-ground-clr-from: lightGray + back-ground-clr-to: white + image-width: 120 + image-height: 40 + + +#PageHelper分页器 +pagehelper: + offset-as-page-num: true + row-bounds-with-count: true + page-size-zero: true + reasonable: false + params: pageNum=pageIndex;pageSize=pageSize; + support-methods-arguments: false +mybatis-plus: + mapper-locations: classpath*:/mappers/**/*.xml + typeEnumsPackage: com.lframework.starter.**.enums,com.lframework.xingyun.**.enums + +op-logs: + #是否开启 + enabled: true + #操作日志保留天数 + retain-days: 7 + +# 是否移除内置权限,针对admin等内置权限,因为内置权限等同于通配符权限,设置为true时会用具体的权限将内置权限替换掉,生产环境建议设置为true +remove-fixed-permissions: false + +magic-api: + enabled: false + # 编辑器配置项 + editor-config: classpath:magic-editor-config.js + # 这里改为项目运行时的域名,菜单中嵌入的页面为base-url + web,这里示例即为http://localhost:8080/dynamic/web + base-url: http://localhost:8080 + # 编辑器页面的访问路径url + web: /dynamic/web + resource: + type: database + tableName: magic_api_file + prefix: /magic-api + readonly: false + # 接口前缀 + prefix: /dynamic-api + # 禁止覆盖应用接口 + allow-override: true + # 是否支持跨域 + support-cross-domain: false + # 推送路径 + push_path: /_magic-api-sync + # 推送秘钥,自行修改 + secret-key: 123456789 + throw-exception: true + response: |- #配置JSON格式,格式为magic-script中的表达式 + { + code: code, + msg: message, + data, + timestamp, + requestTime, + executeTime, + } + response-code: + success: 200 + invalid: 400 + exception: 500 + page: + size: pageSize # 页大小的参数名称 + page: pageIndex # 页码的参数名称 + default-page: 1 # 未传页码时的默认首页 + default-size: 20 # 未传页大小时的默认页大小 + backup: + enable: true + max-history: 14 #备份保留天数,-1为永久保留 + table-name: magic_api_file_backup + +# warm-flow +warm-flow: + token-name: ${sa-token.token-name} + data-fill-handler-path: com.lframework.starter.bpm.handlers.BpmDataFillHandler + # 是否开启逻辑删除(orm框架本身不支持逻辑删除,可通过这种方式开启) + logic_delete: true + # 逻辑删除字段值(开启后默认为2) + logic_delete_value: 2 + # 逻辑未删除字段(开启后默认为0) + logic_not_delete_value: 0 \ No newline at end of file diff --git a/xingyun-server/src/main/resources/magic-editor-config.js b/xingyun-server/src/main/resources/magic-editor-config.js new file mode 100644 index 0000000..f582920 --- /dev/null +++ b/xingyun-server/src/main/resources/magic-editor-config.js @@ -0,0 +1,21 @@ +var MAGIC_EDITOR_CONFIG = { + title: '在线开发平台', + header: { + skin: false, // 屏蔽皮肤按钮 + document: false, // 屏蔽文档按钮 + repo: false, // 屏蔽gitee和github + qqGroup: false // 屏蔽加入QQ群 + }, + getMagicTokenValue: function(){ + return this.getCookie('X-Auth-Token'); + }, + getCookie: function(name) { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = cookies[i].trim().split('='); + if (cookie[0] === name) { + return decodeURIComponent(cookie[1]); + } + } + } +} \ No newline at end of file diff --git a/xingyun-settle/pom.xml b/xingyun-settle/pom.xml new file mode 100644 index 0000000..5d7d303 --- /dev/null +++ b/xingyun-settle/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + com.lframework + xingyun + 1.0.0 + + + xingyun-settle + + + + com.lframework + xingyun-core + + + + com.lframework + xingyun-sc + + + + \ No newline at end of file diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/GetSettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/GetSettleCheckSheetBo.java new file mode 100644 index 0000000..5be910b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/GetSettleCheckSheetBo.java @@ -0,0 +1,280 @@ +package com.lframework.xingyun.settle.bo.check; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @Schema(description = "未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + @Schema(description = "明细") + private List details; + + public GetSettleCheckSheetBo() { + + } + + public GetSettleCheckSheetBo(SettleCheckSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleCheckSheetFullDto dto) { + + return super.convert(dto, GetSettleCheckSheetBo::getStatus, GetSettleCheckSheetBo::getDetails); + } + + @Override + protected void afterInit(SettleCheckSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String bizId; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @Schema(description = "计算类型") + private Integer calcType; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 单据金额 + */ + @Schema(description = "单据金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal payAmount; + + /** + * 单据备注 + */ + @Schema(description = "单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(SettleCheckSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert( + SettleCheckSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto, SettleCheckSheetFullDto.SheetDetailDto::getBizType, + SettleCheckSheetFullDto.SheetDetailDto::getCalcType); + } + + @Override + protected void afterInit(SettleCheckSheetFullDto.SheetDetailDto dto) { + + SettleCheckSheetService settleCheckSheetService = ApplicationUtil.getBean( + SettleCheckSheetService.class); + SettleCheckBizItemDto item = settleCheckSheetService.getBizItem(dto.getBizId(), + dto.getBizType()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.bizType = dto.getBizType().getCode(); + this.totalAmount = item.getTotalAmount(); + this.calcType = dto.getCalcType().getCode(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/QuerySettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/QuerySettleCheckSheetBo.java new file mode 100644 index 0000000..58ddf23 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/QuerySettleCheckSheetBo.java @@ -0,0 +1,180 @@ +package com.lframework.xingyun.settle.bo.check; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QuerySettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @Schema(description = "未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QuerySettleCheckSheetBo() { + + } + + public QuerySettleCheckSheetBo(SettleCheckSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleCheckSheet dto) { + + return super.convert(dto, QuerySettleCheckSheetBo::getStatus, + QuerySettleCheckSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SettleCheckSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/SettleCheckBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/SettleCheckBizItemBo.java new file mode 100644 index 0000000..9ee2825 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/SettleCheckBizItemBo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.settle.bo.check; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class SettleCheckBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String code; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @Schema(description = "计算类型") + private Integer calcType; + + /** + * 对账金额 + */ + @Schema(description = "对账金额") + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public SettleCheckBizItemBo() { + + } + + public SettleCheckBizItemBo(SettleCheckBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleCheckBizItemDto dto) { + + return super.convert(dto, SettleCheckBizItemBo::getBizType, SettleCheckBizItemBo::getCalcType); + } + + @Override + protected void afterInit(SettleCheckBizItemDto dto) { + + this.bizType = dto.getBizType().getCode(); + this.calcType = dto.getCalcType().getCode(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/CustomerSettleCheckBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/CustomerSettleCheckBizItemBo.java new file mode 100644 index 0000000..6ef0af5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/CustomerSettleCheckBizItemBo.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.settle.bo.check.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class CustomerSettleCheckBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String code; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @Schema(description = "计算类型") + private Integer calcType; + + /** + * 对账金额 + */ + @Schema(description = "对账金额") + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public CustomerSettleCheckBizItemBo() { + + } + + public CustomerSettleCheckBizItemBo(CustomerSettleCheckBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckBizItemDto dto) { + + return super.convert(dto, CustomerSettleCheckBizItemBo::getBizType, + CustomerSettleCheckBizItemBo::getCalcType); + } + + @Override + protected void afterInit(CustomerSettleCheckBizItemDto dto) { + + this.bizType = dto.getBizType().getCode(); + this.calcType = dto.getCalcType().getCode(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/GetCustomerSettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/GetCustomerSettleCheckSheetBo.java new file mode 100644 index 0000000..faa146a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/GetCustomerSettleCheckSheetBo.java @@ -0,0 +1,283 @@ +package com.lframework.xingyun.settle.bo.check.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetCustomerSettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @Schema(description = "未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + @Schema(description = "明细") + private List details; + + public GetCustomerSettleCheckSheetBo() { + + } + + public GetCustomerSettleCheckSheetBo(CustomerSettleCheckSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettleCheckSheetBo::getStatus, + GetCustomerSettleCheckSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettleCheckSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends + BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String bizId; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String bizCode; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @Schema(description = "计算类型") + private Integer calcType; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 单据金额 + */ + @Schema(description = "单据金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal payAmount; + + /** + * 单据备注 + */ + @Schema(description = "单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(CustomerSettleCheckSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + CustomerSettleCheckSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto, CustomerSettleCheckSheetFullDto.SheetDetailDto::getBizType, + CustomerSettleCheckSheetFullDto.SheetDetailDto::getCalcType); + } + + @Override + protected void afterInit(CustomerSettleCheckSheetFullDto.SheetDetailDto dto) { + + CustomerSettleCheckSheetService settleCheckSheetService = ApplicationUtil.getBean( + CustomerSettleCheckSheetService.class); + CustomerSettleCheckBizItemDto item = settleCheckSheetService.getBizItem(dto.getBizId(), + dto.getBizType()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.bizType = dto.getBizType().getCode(); + this.totalAmount = item.getTotalAmount(); + this.calcType = dto.getCalcType().getCode(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/QueryCustomerSettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/QueryCustomerSettleCheckSheetBo.java new file mode 100644 index 0000000..3b8c882 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/QueryCustomerSettleCheckSheetBo.java @@ -0,0 +1,180 @@ +package com.lframework.xingyun.settle.bo.check.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @Schema(description = "未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QueryCustomerSettleCheckSheetBo() { + + } + + public QueryCustomerSettleCheckSheetBo(CustomerSettleCheckSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckSheet dto) { + + return super.convert(dto, QueryCustomerSettleCheckSheetBo::getStatus, + QueryCustomerSettleCheckSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(CustomerSettleCheckSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/GetSettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/GetSettleFeeSheetBo.java new file mode 100644 index 0000000..877b34c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/GetSettleFeeSheetBo.java @@ -0,0 +1,210 @@ +package com.lframework.xingyun.settle.bo.fee; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 单据类型 + */ + @Schema(description = "单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + private List details; + + public GetSettleFeeSheetBo() { + + } + + public GetSettleFeeSheetBo(SettleFeeSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleFeeSheetFullDto dto) { + + return super.convert(dto, GetSettleFeeSheetBo::getSheetType, GetSettleFeeSheetBo::getStatus, + GetSettleFeeSheetBo::getDetails); + } + + @Override + protected void afterInit(SettleFeeSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new SheetDetailBo(t, dto.getSheetType())) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String itemId; + + /** + * 项目名称 + */ + @Schema(description = "项目名称") + private String itemName; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; + + @JsonIgnore + private SettleFeeSheetType sheetType; + + public SheetDetailBo(SettleFeeSheetFullDto.SheetDetailDto dto, SettleFeeSheetType sheetType) { + + this.sheetType = sheetType; + + this.init(dto); + } + + @Override + protected void afterInit(SettleFeeSheetFullDto.SheetDetailDto dto) { + + if (this.sheetType == SettleFeeSheetType.RECEIVE) { + SettleInItemService settleInItemService = ApplicationUtil.getBean( + SettleInItemService.class); + SettleInItem item = settleInItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } else { + SettleOutItemService settleOutItemService = ApplicationUtil.getBean( + SettleOutItemService.class); + SettleOutItem item = settleOutItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/QuerySettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/QuerySettleFeeSheetBo.java new file mode 100644 index 0000000..a283235 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/QuerySettleFeeSheetBo.java @@ -0,0 +1,141 @@ +package com.lframework.xingyun.settle.bo.fee; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QuerySettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 单据类型 + */ + @Schema(description = "单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QuerySettleFeeSheetBo() { + + } + + public QuerySettleFeeSheetBo(SettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleFeeSheet dto) { + + return super.convert(dto, QuerySettleFeeSheetBo::getSheetType, QuerySettleFeeSheetBo::getStatus, + QuerySettleFeeSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SettleFeeSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/GetCustomerSettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/GetCustomerSettleFeeSheetBo.java new file mode 100644 index 0000000..c23e39b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/GetCustomerSettleFeeSheetBo.java @@ -0,0 +1,213 @@ +package com.lframework.xingyun.settle.bo.fee.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetCustomerSettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 单据类型 + */ + @Schema(description = "单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + @Schema(description = "明细") + private List details; + + public GetCustomerSettleFeeSheetBo() { + + } + + public GetCustomerSettleFeeSheetBo(CustomerSettleFeeSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleFeeSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettleFeeSheetBo::getSheetType, + GetCustomerSettleFeeSheetBo::getStatus, + GetCustomerSettleFeeSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettleFeeSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new SheetDetailBo(t, dto.getSheetType())) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String itemId; + + /** + * 项目名称 + */ + @Schema(description = "项目名称") + private String itemName; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; + + @JsonIgnore + private CustomerSettleFeeSheetType sheetType; + + public SheetDetailBo(CustomerSettleFeeSheetFullDto.SheetDetailDto dto, + CustomerSettleFeeSheetType sheetType) { + + this.sheetType = sheetType; + + this.init(dto); + } + + @Override + protected void afterInit(CustomerSettleFeeSheetFullDto.SheetDetailDto dto) { + + if (this.sheetType == CustomerSettleFeeSheetType.RECEIVE) { + SettleInItemService settleInItemService = ApplicationUtil.getBean( + SettleInItemService.class); + SettleInItem item = settleInItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } else { + SettleOutItemService settleOutItemService = ApplicationUtil.getBean( + SettleOutItemService.class); + SettleOutItem item = settleOutItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/QueryCustomerSettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/QueryCustomerSettleFeeSheetBo.java new file mode 100644 index 0000000..0e91341 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/QueryCustomerSettleFeeSheetBo.java @@ -0,0 +1,142 @@ +package com.lframework.xingyun.settle.bo.fee.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 单据类型 + */ + @Schema(description = "单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QueryCustomerSettleFeeSheetBo() { + + } + + public QueryCustomerSettleFeeSheetBo(CustomerSettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleFeeSheet dto) { + + return super.convert(dto, QueryCustomerSettleFeeSheetBo::getSheetType, + QueryCustomerSettleFeeSheetBo::getStatus, + QueryCustomerSettleFeeSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(CustomerSettleFeeSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/GetSettleInItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/GetSettleInItemBo.java new file mode 100644 index 0000000..e229ac1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/GetSettleInItemBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.bo.item.in; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetSettleInItemBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetSettleInItemBo() { + + } + + public GetSettleInItemBo(SettleInItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/QuerySettleInItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/QuerySettleInItemBo.java new file mode 100644 index 0000000..af7bb7a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/QuerySettleInItemBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.bo.item.in; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySettleInItemBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySettleInItemBo() { + + } + + public QuerySettleInItemBo(SettleInItem dto) { + + super(dto); + } + + @Override + protected void afterInit(SettleInItem dto) { + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/SettleInItemSelectorBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/SettleInItemSelectorBo.java new file mode 100644 index 0000000..f8634c3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/SettleInItemSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.settle.bo.item.in; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class SettleInItemSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public SettleInItemSelectorBo() { + + } + + public SettleInItemSelectorBo(SettleInItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/GetSettleOutItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/GetSettleOutItemBo.java new file mode 100644 index 0000000..a3db82f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/GetSettleOutItemBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.bo.item.out; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class GetSettleOutItemBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public GetSettleOutItemBo() { + + } + + public GetSettleOutItemBo(SettleOutItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/QuerySettleOutItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/QuerySettleOutItemBo.java new file mode 100644 index 0000000..7dae802 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/QuerySettleOutItemBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.bo.item.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySettleOutItemBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @Schema(description = "修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySettleOutItemBo() { + + } + + public QuerySettleOutItemBo(SettleOutItem dto) { + + super(dto); + } + + @Override + protected void afterInit(SettleOutItem dto) { + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/SettleOutItemSelectorBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/SettleOutItemSelectorBo.java new file mode 100644 index 0000000..313425f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/SettleOutItemSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.settle.bo.item.out; + +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class SettleOutItemSelectorBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + public SettleOutItemSelectorBo() { + + } + + public SettleOutItemSelectorBo(SettleOutItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/GetSettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/GetSettlePreSheetBo.java new file mode 100644 index 0000000..4bd5290 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/GetSettlePreSheetBo.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.settle.bo.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + @Schema(description = "明细") + private List details; + + public GetSettlePreSheetBo() { + + } + + public GetSettlePreSheetBo(SettlePreSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettlePreSheetFullDto dto) { + + return super.convert(dto, GetSettlePreSheetBo::getStatus, GetSettlePreSheetBo::getDetails); + } + + @Override + protected void afterInit(SettlePreSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String itemId; + + /** + * 项目名称 + */ + @Schema(description = "项目名称") + private String itemName; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; + + public SheetDetailBo() { + + } + + public SheetDetailBo(SettlePreSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + protected void afterInit(SettlePreSheetFullDto.SheetDetailDto dto) { + + SettleOutItemService settleOutItemService = ApplicationUtil.getBean( + SettleOutItemService.class); + SettleOutItem item = settleOutItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/QuerySettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/QuerySettlePreSheetBo.java new file mode 100644 index 0000000..0093a48 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/QuerySettlePreSheetBo.java @@ -0,0 +1,134 @@ +package com.lframework.xingyun.settle.bo.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QuerySettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QuerySettlePreSheetBo() { + + } + + public QuerySettlePreSheetBo(SettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettlePreSheet dto) { + + return super.convert(dto, QuerySettlePreSheetBo::getStatus, + QuerySettlePreSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SettlePreSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/GetCustomerSettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/GetCustomerSettlePreSheetBo.java new file mode 100644 index 0000000..e2a99fa --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/GetCustomerSettlePreSheetBo.java @@ -0,0 +1,192 @@ +package com.lframework.xingyun.settle.bo.pre.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.service.SettleInItemService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetCustomerSettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + @Schema(description = "明细") + private List details; + + public GetCustomerSettlePreSheetBo() { + + } + + public GetCustomerSettlePreSheetBo(CustomerSettlePreSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettlePreSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettlePreSheetBo::getStatus, + GetCustomerSettlePreSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettlePreSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String itemId; + + /** + * 项目名称 + */ + @Schema(description = "项目名称") + private String itemName; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; + + public SheetDetailBo() { + + } + + public SheetDetailBo(CustomerSettlePreSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + protected void afterInit(CustomerSettlePreSheetFullDto.SheetDetailDto dto) { + + SettleInItemService settleInItemService = ApplicationUtil.getBean( + SettleInItemService.class); + SettleInItem item = settleInItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/QueryCustomerSettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/QueryCustomerSettlePreSheetBo.java new file mode 100644 index 0000000..9513ee7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/QueryCustomerSettlePreSheetBo.java @@ -0,0 +1,134 @@ +package com.lframework.xingyun.settle.bo.pre.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + private Integer settleStatus; + + public QueryCustomerSettlePreSheetBo() { + + } + + public QueryCustomerSettlePreSheetBo(CustomerSettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettlePreSheet dto) { + + return super.convert(dto, QueryCustomerSettlePreSheetBo::getStatus, + QueryCustomerSettlePreSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(CustomerSettlePreSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/GetSettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/GetSettleSheetBo.java new file mode 100644 index 0000000..03a393c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/GetSettleSheetBo.java @@ -0,0 +1,268 @@ +package com.lframework.xingyun.settle.bo.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.service.SettleSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetSettleSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + @Schema(description = "明细") + private List details; + + public GetSettleSheetBo() { + + } + + public GetSettleSheetBo(SettleSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleSheetFullDto dto) { + + return super.convert(dto, GetSettleSheetBo::getStatus, GetSettleSheetBo::getDetails); + } + + @Override + protected void afterInit(SettleSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String bizId; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String bizCode; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @Schema(description = "已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @Schema(description = "未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 实付金额 + */ + @Schema(description = "实付金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal discountAmount; + + /** + * 单据备注 + */ + @Schema(description = "单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(SettleSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + SettleSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SettleSheetFullDto.SheetDetailDto dto) { + + SettleSheetService settleSheetService = ApplicationUtil.getBean(SettleSheetService.class); + SettleBizItemDto item = settleSheetService.getBizItem(dto.getBizId()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.totalPayAmount = item.getTotalPayAmount(); + this.totalPayedAmount = item.getTotalPayedAmount(); + this.totalDiscountAmount = item.getTotalDiscountAmount(); + this.totalUnPayAmount = item.getTotalUnPayAmount(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/QuerySettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/QuerySettleSheetBo.java new file mode 100644 index 0000000..e2c1cc4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/QuerySettleSheetBo.java @@ -0,0 +1,150 @@ +package com.lframework.xingyun.settle.bo.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QuerySettleSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @Schema(description = "供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @Schema(description = "供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + public QuerySettleSheetBo() { + + } + + public QuerySettleSheetBo(SettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleSheet dto) { + + return super.convert(dto, QuerySettleSheetBo::getStatus); + } + + @Override + protected void afterInit(SettleSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/SettleBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/SettleBizItemBo.java new file mode 100644 index 0000000..241106b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/SettleBizItemBo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.bo.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class SettleBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String code; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @Schema(description = "已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @Schema(description = "未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public SettleBizItemBo() { + + } + + public SettleBizItemBo(SettleBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleBizItemDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SettleBizItemDto dto) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/CustomerSettleBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/CustomerSettleBizItemBo.java new file mode 100644 index 0000000..ec601bf --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/CustomerSettleBizItemBo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.bo.sheet.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class CustomerSettleBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String code; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @Schema(description = "已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @Schema(description = "未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public CustomerSettleBizItemBo() { + + } + + public CustomerSettleBizItemBo(CustomerSettleBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleBizItemDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(CustomerSettleBizItemDto dto) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/GetCustomerSettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/GetCustomerSettleSheetBo.java new file mode 100644 index 0000000..0930dde --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/GetCustomerSettleSheetBo.java @@ -0,0 +1,271 @@ +package com.lframework.xingyun.settle.bo.sheet.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.service.CustomerSettleSheetService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Data +public class GetCustomerSettleSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人ID + */ + @Schema(description = "创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + /** + * 拒绝原因 + */ + @Schema(description = "拒绝原因") + private String refuseReason; + + @Schema(description = "明细") + private List details; + + public GetCustomerSettleSheetBo() { + + } + + public GetCustomerSettleSheetBo(CustomerSettleSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettleSheetBo::getStatus, + GetCustomerSettleSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettleSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @Schema(description = "明细ID") + private String id; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String bizId; + + /** + * 单据号 + */ + @Schema(description = "单据号") + private String bizCode; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @Schema(description = "已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @Schema(description = "已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @Schema(description = "未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 实付金额 + */ + @Schema(description = "实付金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal discountAmount; + + /** + * 单据备注 + */ + @Schema(description = "单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(CustomerSettleSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + CustomerSettleSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(CustomerSettleSheetFullDto.SheetDetailDto dto) { + + CustomerSettleSheetService settleSheetService = ApplicationUtil.getBean( + CustomerSettleSheetService.class); + CustomerSettleBizItemDto item = settleSheetService.getBizItem(dto.getBizId()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.totalPayAmount = item.getTotalPayAmount(); + this.totalPayedAmount = item.getTotalPayedAmount(); + this.totalDiscountAmount = item.getTotalDiscountAmount(); + this.totalUnPayAmount = item.getTotalUnPayAmount(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/QueryCustomerSettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/QueryCustomerSettleSheetBo.java new file mode 100644 index 0000000..fc97dd7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/QueryCustomerSettleSheetBo.java @@ -0,0 +1,150 @@ +package com.lframework.xingyun.settle.bo.sheet.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettleSheetBo extends BaseBo { + + /** + * ID + */ + @Schema(description = "ID") + private String id; + + /** + * 单号 + */ + @Schema(description = "单号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 总金额 + */ + @Schema(description = "总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @Schema(description = "截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核时间 + */ + @Schema(description = "审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @Schema(description = "状态") + private Integer status; + + public QueryCustomerSettleSheetBo() { + + } + + public QueryCustomerSettleSheetBo(CustomerSettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleSheet dto) { + + return super.convert(dto, QueryCustomerSettleSheetBo::getStatus); + } + + @Override + protected void afterInit(CustomerSettleSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/components/code/GenerateCodeTypePool.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/components/code/GenerateCodeTypePool.java new file mode 100644 index 0000000..4d4f7d3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/components/code/GenerateCodeTypePool.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.settle.components.code; + +public interface GenerateCodeTypePool { + + /** + * 对账单 + */ + Integer SETTLE_CHECK_SHEET = 300; + + /** + * 费用单 + */ + Integer SETTLE_FEE_SHEET = 301; + + /** + * 预付款单 + */ + Integer SETTLE_PRE_SHEET = 302; + + /** + * 结算单 + */ + Integer SETTLE_SHEET = 303; + + /** + * 客户对账单 + */ + Integer CUSTOMER_SETTLE_CHECK_SHEET = 304; + + /** + * 客户费用单 + */ + Integer CUSTOMER_SETTLE_FEE_SHEET = 305; + + /** + * 客户预付款单 + */ + Integer CUSTOMER_SETTLE_PRE_SHEET = 306; + + /** + * 客户结算单 + */ + Integer CUSTOMER_SETTLE_SHEET = 307; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleCheckSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleCheckSheetController.java new file mode 100644 index 0000000..3e0a7a0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleCheckSheetController.java @@ -0,0 +1,205 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.check.customer.CustomerSettleCheckBizItemBo; +import com.lframework.xingyun.settle.bo.check.customer.GetCustomerSettleCheckSheetBo; +import com.lframework.xingyun.settle.bo.check.customer.QueryCustomerSettleCheckSheetBo; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.excel.check.customer.CustomerSettleCheckSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import com.lframework.xingyun.settle.vo.check.customer.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 客户对账单 + * + * @author zmj + */ +@Tag(name = "客户对账单") +@Validated +@RestController +@RequestMapping("/customer/settle/checksheet") +public class CustomerSettleCheckSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettleCheckSheetService customerSettleCheckSheetService; + + /** + * 客户对账单列表 + */ + @Operation(summary = "客户对账单列表") + @HasPermission({"customer-settle:check-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettleCheckSheetVo vo) { + + PageResult pageResult = customerSettleCheckSheetService.query( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettleCheckSheetBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"customer-settle:check-sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryCustomerSettleCheckSheetVo vo) { + + ExportTaskUtil.exportTask("客户对账单信息", CustomerSettleCheckSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:check-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户对账单ID不能为空!") String id) { + + CustomerSettleCheckSheetFullDto data = customerSettleCheckSheetService.getDetail(id); + + GetCustomerSettleCheckSheetBo result = new GetCustomerSettleCheckSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户对账单 + */ + @Operation(summary = "创建客户对账单") + @HasPermission({"customer-settle:check-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettleCheckSheetVo vo) { + + vo.validate(); + + String id = customerSettleCheckSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户对账单 + */ + @Operation(summary = "修改客户对账单") + @HasPermission({"customer-settle:check-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettleCheckSheetVo vo) { + + vo.validate(); + + customerSettleCheckSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户对账单 + */ + @Operation(summary = "审核通过客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass( + @RequestBody @Valid ApprovePassCustomerSettleCheckSheetVo vo) { + + customerSettleCheckSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户对账单 + */ + @Operation(summary = "直接审核通过客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass( + @RequestBody @Valid CreateCustomerSettleCheckSheetVo vo) { + + vo.validate(); + + customerSettleCheckSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户对账单 + */ + @Operation(summary = "审核拒绝客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettleCheckSheetVo vo) { + + customerSettleCheckSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户对账单 + */ + @Operation(summary = "删除客户对账单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:check-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户对账单ID不能为空!") String id) { + + customerSettleCheckSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未对账的业务单据 + */ + @Operation(summary = "查询未对账的业务单据") + @HasPermission({"customer-settle:check-sheet:add", "customer-settle:check-sheet:modify"}) + @GetMapping("/uncheck-items") + public InvokeResult> getUnCheckItems( + @Valid QueryCustomerUnCheckBizItemVo vo) { + + List results = customerSettleCheckSheetService.getUnCheckBizItems( + vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(CustomerSettleCheckBizItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleFeeSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleFeeSheetController.java new file mode 100644 index 0000000..ca177f2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleFeeSheetController.java @@ -0,0 +1,183 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.fee.customer.GetCustomerSettleFeeSheetBo; +import com.lframework.xingyun.settle.bo.fee.customer.QueryCustomerSettleFeeSheetBo; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.excel.fee.customer.CustomerSettleFeeSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetService; +import com.lframework.xingyun.settle.vo.fee.customer.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 客户费用单 + * + * @author zmj + */ +@Tag(name = "客户费用单") +@Validated +@RestController +@RequestMapping("/customer/settle/feesheet") +public class CustomerSettleFeeSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettleFeeSheetService customerSettleFeeSheetService; + + /** + * 客户费用单列表 + */ + @Operation(summary = "客户费用单列表") + @HasPermission({"customer-settle:fee-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettleFeeSheetVo vo) { + + PageResult pageResult = customerSettleFeeSheetService.query( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettleFeeSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"customer-settle:fee-sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryCustomerSettleFeeSheetVo vo) { + + ExportTaskUtil.exportTask("客户费用单信息", CustomerSettleFeeSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:fee-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户费用单ID不能为空!") String id) { + + CustomerSettleFeeSheetFullDto data = customerSettleFeeSheetService.getDetail(id); + + GetCustomerSettleFeeSheetBo result = new GetCustomerSettleFeeSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户费用单 + */ + @Operation(summary = "创建客户费用单") + @HasPermission({"customer-settle:fee-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettleFeeSheetVo vo) { + + vo.validate(); + + String id = customerSettleFeeSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户费用单 + */ + @Operation(summary = "修改客户费用单") + @HasPermission({"customer-settle:fee-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettleFeeSheetVo vo) { + + vo.validate(); + + customerSettleFeeSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户费用单 + */ + @Operation(summary = "审核通过客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass( + @RequestBody @Valid ApprovePassCustomerSettleFeeSheetVo vo) { + + customerSettleFeeSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户费用单 + */ + @Operation(summary = "直接审核通过客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass( + @RequestBody @Valid CreateCustomerSettleFeeSheetVo vo) { + + vo.validate(); + + customerSettleFeeSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户费用单 + */ + @Operation(summary = "审核拒绝客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettleFeeSheetVo vo) { + + customerSettleFeeSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户费用单 + */ + @Operation(summary = "删除客户费用单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:fee-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户费用单ID不能为空!") String id) { + + customerSettleFeeSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettlePreSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettlePreSheetController.java new file mode 100644 index 0000000..2aa4162 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettlePreSheetController.java @@ -0,0 +1,183 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.pre.customer.GetCustomerSettlePreSheetBo; +import com.lframework.xingyun.settle.bo.pre.customer.QueryCustomerSettlePreSheetBo; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.excel.pre.customer.CustomerSettlePreSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.customer.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 客户预付款单 + * + * @author zmj + */ +@Tag(name = "客户预付款单") +@Validated +@RestController +@RequestMapping("/customer/settle/presheet") +public class CustomerSettlePreSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettlePreSheetService settlePreSheetService; + + /** + * 客户预付款单列表 + */ + @Operation(summary = "客户预付款单列表") + @HasPermission({"customer-settle:pre-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettlePreSheetVo vo) { + + PageResult pageResult = settlePreSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettlePreSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"customer-settle:pre-sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryCustomerSettlePreSheetVo vo) { + + ExportTaskUtil.exportTask("客户预收款单信息", CustomerSettlePreSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:pre-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户预付款单ID不能为空!") String id) { + + CustomerSettlePreSheetFullDto data = settlePreSheetService.getDetail(id); + + GetCustomerSettlePreSheetBo result = new GetCustomerSettlePreSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户预付款单 + */ + @Operation(summary = "创建客户预付款单") + @HasPermission({"customer-settle:pre-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettlePreSheetVo vo) { + + vo.validate(); + + String id = settlePreSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户预付款单 + */ + @Operation(summary = "修改客户预付款单") + @HasPermission({"customer-settle:pre-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettlePreSheetVo vo) { + + vo.validate(); + + settlePreSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户预付款单 + */ + @Operation(summary = "审核通过客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass( + @RequestBody @Valid ApprovePassCustomerSettlePreSheetVo vo) { + + settlePreSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户预付款单 + */ + @Operation(summary = "直接审核通过客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass( + @RequestBody @Valid CreateCustomerSettlePreSheetVo vo) { + + vo.validate(); + + settlePreSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户预付款单 + */ + @Operation(summary = "审核拒绝客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettlePreSheetVo vo) { + + settlePreSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户预付款单 + */ + @Operation(summary = "删除客户预付款单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:pre-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户预付款单ID不能为空!") String id) { + + settlePreSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleSheetController.java new file mode 100644 index 0000000..8dfd7ea --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleSheetController.java @@ -0,0 +1,201 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.sheet.customer.CustomerSettleBizItemBo; +import com.lframework.xingyun.settle.bo.sheet.customer.GetCustomerSettleSheetBo; +import com.lframework.xingyun.settle.bo.sheet.customer.QueryCustomerSettleSheetBo; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.excel.sheet.customer.CustomerSettleSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.CustomerSettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.customer.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 客户结算单 + * + * @author zmj + */ +@Tag(name = "客户结算单") +@Validated +@RestController +@RequestMapping("/customer/settle/sheet") +public class CustomerSettleSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettleSheetService customerSettleSheetService; + + /** + * 客户结算单列表 + */ + @Operation(summary = "客户结算单列表") + @HasPermission({"customer-settle:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettleSheetVo vo) { + + PageResult pageResult = customerSettleSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettleSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"customer-settle:sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QueryCustomerSettleSheetVo vo) { + + ExportTaskUtil.exportTask("客户结算单信息", CustomerSettleSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户结算单ID不能为空!") String id) { + + CustomerSettleSheetFullDto data = customerSettleSheetService.getDetail(id); + + GetCustomerSettleSheetBo result = new GetCustomerSettleSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户结算单 + */ + @Operation(summary = "创建客户结算单") + @HasPermission({"customer-settle:sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettleSheetVo vo) { + + vo.validate(); + + String id = customerSettleSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户结算单 + */ + @Operation(summary = "修改客户结算单") + @HasPermission({"customer-settle:sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettleSheetVo vo) { + + vo.validate(); + + customerSettleSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户结算单 + */ + @Operation(summary = "审核通过客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassCustomerSettleSheetVo vo) { + + customerSettleSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户结算单 + */ + @Operation(summary = "直接审核通过客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateCustomerSettleSheetVo vo) { + + vo.validate(); + + customerSettleSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户结算单 + */ + @Operation(summary = "审核拒绝客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettleSheetVo vo) { + + customerSettleSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户结算单 + */ + @Operation(summary = "删除客户结算单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"customer-settle:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户结算单ID不能为空!") String id) { + + customerSettleSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未结算的业务单据 + */ + @Operation(summary = "查询未结算的业务单据") + @HasPermission({"customer-settle:sheet:add", "customer-settle:sheet:modify"}) + @GetMapping("/unsettle-items") + public InvokeResult> getUnSettleItems( + @Valid QueryCustomerUnSettleBizItemVo vo) { + + List results = customerSettleSheetService.getUnSettleBizItems(vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(CustomerSettleBizItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleCheckSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleCheckSheetController.java new file mode 100644 index 0000000..9b39b1b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleCheckSheetController.java @@ -0,0 +1,199 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.check.GetSettleCheckSheetBo; +import com.lframework.xingyun.settle.bo.check.QuerySettleCheckSheetBo; +import com.lframework.xingyun.settle.bo.check.SettleCheckBizItemBo; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.excel.check.SettleCheckSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import com.lframework.xingyun.settle.vo.check.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 供应商对账单 + * + * @author zmj + */ +@Tag(name = "供应商对账单") +@Validated +@RestController +@RequestMapping("/settle/checksheet") +public class SettleCheckSheetController extends DefaultBaseController { + + @Autowired + private SettleCheckSheetService settleCheckSheetService; + + /** + * 供应商对账单列表 + */ + @Operation(summary = "供应商对账单列表") + @HasPermission({"settle:check-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QuerySettleCheckSheetVo vo) { + + PageResult pageResult = settleCheckSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleCheckSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"settle:check-sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySettleCheckSheetVo vo) { + + ExportTaskUtil.exportTask("供应商对账单信息", SettleCheckSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:check-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "供应商对账单ID不能为空!") String id) { + + SettleCheckSheetFullDto data = settleCheckSheetService.getDetail(id); + + GetSettleCheckSheetBo result = new GetSettleCheckSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商对账单 + */ + @Operation(summary = "创建供应商对账单") + @HasPermission({"settle:check-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettleCheckSheetVo vo) { + + vo.validate(); + + String id = settleCheckSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商对账单 + */ + @Operation(summary = "修改供应商对账单") + @HasPermission({"settle:check-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettleCheckSheetVo vo) { + + vo.validate(); + + settleCheckSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商对账单 + */ + @Operation(summary = "审核通过供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettleCheckSheetVo vo) { + + settleCheckSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商对账单 + */ + @Operation(summary = "直接审核通过供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettleCheckSheetVo vo) { + + vo.validate(); + + settleCheckSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商对账单 + */ + @Operation(summary = "审核拒绝供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettleCheckSheetVo vo) { + + settleCheckSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商对账单 + */ + @Operation(summary = "删除供应商对账单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:check-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商对账单ID不能为空!") String id) { + + settleCheckSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未对账的业务单据 + */ + @Operation(summary = "查询未对账的业务单据") + @HasPermission({"settle:check-sheet:add", "settle:check-sheet:modify"}) + @GetMapping("/uncheck-items") + public InvokeResult> getUnCheckItems(@Valid QueryUnCheckBizItemVo vo) { + + List results = settleCheckSheetService.getUnCheckBizItems(vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(SettleCheckBizItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleFeeSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleFeeSheetController.java new file mode 100644 index 0000000..f1769c2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleFeeSheetController.java @@ -0,0 +1,179 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.fee.GetSettleFeeSheetBo; +import com.lframework.xingyun.settle.bo.fee.QuerySettleFeeSheetBo; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.excel.fee.SettleFeeSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.SettleFeeSheetService; +import com.lframework.xingyun.settle.vo.fee.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 供应商费用单 + * + * @author zmj + */ +@Tag(name = "供应商费用单") +@Validated +@RestController +@RequestMapping("/settle/feesheet") +public class SettleFeeSheetController extends DefaultBaseController { + + @Autowired + private SettleFeeSheetService settleFeeSheetService; + + /** + * 供应商费用单列表 + */ + @Operation(summary = "供应商费用单列表") + @HasPermission({"settle:fee-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleFeeSheetVo vo) { + + PageResult pageResult = settleFeeSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleFeeSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"settle:fee-sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySettleFeeSheetVo vo) { + + ExportTaskUtil.exportTask("供应商费用单信息", SettleFeeSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:fee-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "供应商费用单ID不能为空!") String id) { + + SettleFeeSheetFullDto data = settleFeeSheetService.getDetail(id); + + GetSettleFeeSheetBo result = new GetSettleFeeSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商费用单 + */ + @Operation(summary = "创建供应商费用单") + @HasPermission({"settle:fee-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettleFeeSheetVo vo) { + + vo.validate(); + + String id = settleFeeSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商费用单 + */ + @Operation(summary = "修改供应商费用单") + @HasPermission({"settle:fee-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettleFeeSheetVo vo) { + + vo.validate(); + + settleFeeSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商费用单 + */ + @Operation(summary = "审核通过供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettleFeeSheetVo vo) { + + settleFeeSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商费用单 + */ + @Operation(summary = "直接审核通过供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettleFeeSheetVo vo) { + + vo.validate(); + + settleFeeSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商费用单 + */ + @Operation(summary = "审核拒绝供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettleFeeSheetVo vo) { + + settleFeeSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商费用单 + */ + @Operation(summary = "删除供应商费用单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:fee-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商费用单ID不能为空!") String id) { + + settleFeeSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleInItemController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleInItemController.java new file mode 100644 index 0000000..a537db7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleInItemController.java @@ -0,0 +1,143 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.item.in.GetSettleInItemBo; +import com.lframework.xingyun.settle.bo.item.in.QuerySettleInItemBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.excel.item.in.SettleInItemExportTaskWorker; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.vo.item.in.CreateSettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.UpdateSettleInItemVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 收入项目 + * + * @author zmj + */ +@Tag(name = "收入项目") +@Validated +@RestController +@RequestMapping("/settle/item/in") +public class SettleInItemController extends DefaultBaseController { + + @Autowired + private SettleInItemService settleInItemService; + + /** + * 收入项目列表 + */ + @Operation(summary = "收入项目列表") + @HasPermission({"settle:in-item:query", "settle:in-item:add", "settle:in-item:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleInItemVo vo) { + + PageResult pageResult = settleInItemService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleInItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询收入项目 + */ + @Operation(summary = "查询收入项目") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:in-item:query", "settle:in-item:add", "settle:in-item:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SettleInItem data = settleInItemService.findById(id); + if (data == null) { + throw new DefaultClientException("收入项目不存在!"); + } + + GetSettleInItemBo result = new GetSettleInItemBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出收入项目 + */ + @Operation(summary = "导出收入项目") + @HasPermission({"settle:in-item:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySettleInItemVo vo) { + + ExportTaskUtil.exportTask("收入项目信息", SettleInItemExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"settle:in-item:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "收入项目ID不能为空!") String id) { + + settleInItemService.deleteById(id); + + settleInItemService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增收入项目 + */ + @Operation(summary = "新增收入项目") + @HasPermission({"settle:in-item:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSettleInItemVo vo) { + + settleInItemService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改收入项目 + */ + @Operation(summary = "修改收入项目") + @HasPermission({"settle:in-item:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSettleInItemVo vo) { + + settleInItemService.update(vo); + + settleInItemService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleOutItemController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleOutItemController.java new file mode 100644 index 0000000..b95183c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleOutItemController.java @@ -0,0 +1,144 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.item.out.GetSettleOutItemBo; +import com.lframework.xingyun.settle.bo.item.out.QuerySettleOutItemBo; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.excel.item.out.SettleOutItemExportTaskWorker; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.item.out.CreateSettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.UpdateSettleOutItemVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 支出项目 + * + * @author zmj + */ +@Tag(name = "支出项目") +@Validated +@RestController +@RequestMapping("/settle/item/out") +public class SettleOutItemController extends DefaultBaseController { + + @Autowired + private SettleOutItemService settleOutItemService; + + /** + * 支出项目列表 + */ + @Operation(summary = "支出项目列表") + @HasPermission({"settle:out-item:query", "settle:out-item:add", "settle:out-item:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleOutItemVo vo) { + + PageResult pageResult = settleOutItemService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleOutItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询支出项目 + */ + @Operation(summary = "查询支出项目") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:out-item:query", "settle:out-item:add", "settle:out-item:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SettleOutItem data = settleOutItemService.findById(id); + if (data == null) { + throw new DefaultClientException("支出项目不存在!"); + } + + GetSettleOutItemBo result = new GetSettleOutItemBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出支出项目 + */ + @Operation(summary = "导出支出项目") + @HasPermission({"settle:out-item:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySettleOutItemVo vo) { + + ExportTaskUtil.exportTask("支出项目信息", SettleOutItemExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + + } + + /** + * 根据ID删除 + */ + @Operation(summary = "根据ID删除") + @HasPermission({"settle:out-item:delete"}) + @DeleteMapping + public InvokeResult deleteById( + @Parameter(description = "ID", required = true) @NotEmpty(message = "支出项目ID不能为空!") String id) { + + settleOutItemService.deleteById(id); + + settleOutItemService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 新增支出项目 + */ + @Operation(summary = "新增支出项目") + @HasPermission({"settle:out-item:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSettleOutItemVo vo) { + + settleOutItemService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改支出项目 + */ + @Operation(summary = "修改支出项目") + @HasPermission({"settle:out-item:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSettleOutItemVo vo) { + + settleOutItemService.update(vo); + + settleOutItemService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettlePreSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettlePreSheetController.java new file mode 100644 index 0000000..2bf317b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettlePreSheetController.java @@ -0,0 +1,178 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.pre.GetSettlePreSheetBo; +import com.lframework.xingyun.settle.bo.pre.QuerySettlePreSheetBo; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.excel.pre.SettlePreSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.SettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 供应商预付款单 + * + * @author zmj + */ +@Tag(name = "供应商预付款单") +@Validated +@RestController +@RequestMapping("/settle/presheet") +public class SettlePreSheetController extends DefaultBaseController { + + @Autowired + private SettlePreSheetService settlePreSheetService; + + /** + * 供应商预付款单列表 + */ + @Operation(summary = "供应商预付款单列表") + @HasPermission({"settle:pre-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettlePreSheetVo vo) { + + PageResult pageResult = settlePreSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettlePreSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"settle:pre-sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySettlePreSheetVo vo) { + ExportTaskUtil.exportTask("供应商预付款单信息", SettlePreSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:pre-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "供应商预付款单ID不能为空!") String id) { + + SettlePreSheetFullDto data = settlePreSheetService.getDetail(id); + + GetSettlePreSheetBo result = new GetSettlePreSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商预付款单 + */ + @Operation(summary = "创建供应商预付款单") + @HasPermission({"settle:pre-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettlePreSheetVo vo) { + + vo.validate(); + + String id = settlePreSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商预付款单 + */ + @Operation(summary = "修改供应商预付款单") + @HasPermission({"settle:pre-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettlePreSheetVo vo) { + + vo.validate(); + + settlePreSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商预付款单 + */ + @Operation(summary = "审核通过供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettlePreSheetVo vo) { + + settlePreSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商预付款单 + */ + @Operation(summary = "直接审核通过供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettlePreSheetVo vo) { + + vo.validate(); + + settlePreSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商预付款单 + */ + @Operation(summary = "审核拒绝供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettlePreSheetVo vo) { + + settlePreSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商预付款单 + */ + @Operation(summary = "删除供应商预付款单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:pre-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商预付款单ID不能为空!") String id) { + + settlePreSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSelectorController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSelectorController.java new file mode 100644 index 0000000..2c18376 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSelectorController.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.item.in.SettleInItemSelectorBo; +import com.lframework.xingyun.settle.bo.item.out.SettleOutItemSelectorBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 数据选择器 + * + * @author zmj + */ +@Tag(name = "数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class SettleSelectorController extends DefaultBaseController { + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private SettleOutItemService settleOutItemService; + + /** + * 收入项目 + */ + @Operation(summary = "收入项目") + @GetMapping("/settle/item/in") + public InvokeResult> selector( + @Valid SettleInItemSelectorVo vo) { + + PageResult pageResult = settleInItemService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(SettleInItemSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载收入项目 + */ + @Operation(summary = "加载收入项目") + @PostMapping("/settle/item/in/load") + public InvokeResult> loadSettleInItem( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> settleInItemService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(SettleInItemSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 支出项目 + */ + @Operation(summary = "支出项目") + @GetMapping("/settle/item/out") + public InvokeResult> selector( + @Valid SettleOutItemSelectorVo vo) { + + PageResult pageResult = settleOutItemService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SettleOutItemSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载支出项目 + */ + @Operation(summary = "加载支出项目") + @PostMapping("/settle/item/out/load") + public InvokeResult> loadSettleOutItem( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> settleOutItemService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(SettleOutItemSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSheetController.java new file mode 100644 index 0000000..59d0ee8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSheetController.java @@ -0,0 +1,198 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.mq.core.utils.ExportTaskUtil; +import com.lframework.starter.web.core.annotations.security.HasPermission; +import com.lframework.starter.web.core.components.resp.InvokeResult; +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.controller.DefaultBaseController; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.bo.sheet.GetSettleSheetBo; +import com.lframework.xingyun.settle.bo.sheet.QuerySettleSheetBo; +import com.lframework.xingyun.settle.bo.sheet.SettleBizItemBo; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.excel.sheet.SettleSheetExportTaskWorker; +import com.lframework.xingyun.settle.service.SettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 供应商结算单 + * + * @author zmj + */ +@Tag(name = "供应商结算单") +@Validated +@RestController +@RequestMapping("/settle/sheet") +public class SettleSheetController extends DefaultBaseController { + + @Autowired + private SettleSheetService settleSheetService; + + /** + * 供应商结算单列表 + */ + @Operation(summary = "供应商结算单列表") + @HasPermission({"settle:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleSheetVo vo) { + + PageResult pageResult = settleSheetService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @Operation(summary = "导出") + @HasPermission({"settle:sheet:export"}) + @PostMapping("/export") + public InvokeResult export(@Valid QuerySettleSheetVo vo) { + + ExportTaskUtil.exportTask("供应商结算单信息", SettleSheetExportTaskWorker.class, vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID查询 + */ + @Operation(summary = "根据ID查询") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "供应商结算单ID不能为空!") String id) { + + SettleSheetFullDto data = settleSheetService.getDetail(id); + + GetSettleSheetBo result = new GetSettleSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商结算单 + */ + @Operation(summary = "创建供应商结算单") + @HasPermission({"settle:sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettleSheetVo vo) { + + vo.validate(); + + String id = settleSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商结算单 + */ + @Operation(summary = "修改供应商结算单") + @HasPermission({"settle:sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettleSheetVo vo) { + + vo.validate(); + + settleSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商结算单 + */ + @Operation(summary = "审核通过供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettleSheetVo vo) { + + settleSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商结算单 + */ + @Operation(summary = "直接审核通过供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettleSheetVo vo) { + + vo.validate(); + + settleSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商结算单 + */ + @Operation(summary = "审核拒绝供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettleSheetVo vo) { + + settleSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商结算单 + */ + @Operation(summary = "删除供应商结算单") + @Parameter(description = "ID", name = "id", required = true) + @HasPermission({"settle:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商结算单ID不能为空!") String id) { + + settleSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未结算的业务单据 + */ + @Operation(summary = "查询未结算的业务单据") + @HasPermission({"settle:sheet:add", "settle:sheet:modify"}) + @GetMapping("/unsettle-items") + public InvokeResult> getUnCheckItems(@Valid QueryUnSettleBizItemVo vo) { + + List results = settleSheetService.getUnSettleBizItems(vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(SettleBizItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckBizItemDto.java new file mode 100644 index 0000000..97236f7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckBizItemDto.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.settle.dto.check; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetCalcType; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class SettleCheckBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 业务类型 + */ + private SettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private SettleCheckSheetCalcType calcType; + + /** + * 对账金额 + */ + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckSheetFullDto.java new file mode 100644 index 0000000..ab6dc9d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckSheetFullDto.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.settle.dto.check; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetCalcType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class SettleCheckSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private SettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private SettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckBizItemDto.java new file mode 100644 index 0000000..0f3b546 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckBizItemDto.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.settle.dto.check.customer; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetCalcType; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class CustomerSettleCheckBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 业务类型 + */ + private CustomerSettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private CustomerSettleCheckSheetCalcType calcType; + + /** + * 对账金额 + */ + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckSheetFullDto.java new file mode 100644 index 0000000..bcd7efe --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckSheetFullDto.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.settle.dto.check.customer; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetCalcType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class CustomerSettleCheckSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private CustomerSettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private CustomerSettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/SettleFeeSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/SettleFeeSheetFullDto.java new file mode 100644 index 0000000..2d43125 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/SettleFeeSheetFullDto.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.settle.dto.fee; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class SettleFeeSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 单据类型 + */ + private SettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/customer/CustomerSettleFeeSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/customer/CustomerSettleFeeSheetFullDto.java new file mode 100644 index 0000000..02a177a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/customer/CustomerSettleFeeSheetFullDto.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.settle.dto.fee.customer; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class CustomerSettleFeeSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 单据类型 + */ + private CustomerSettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/SettlePreSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/SettlePreSheetFullDto.java new file mode 100644 index 0000000..f3a914d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/SettlePreSheetFullDto.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.settle.dto.pre; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class SettlePreSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/customer/CustomerSettlePreSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/customer/CustomerSettlePreSheetFullDto.java new file mode 100644 index 0000000..f9ca92a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/customer/CustomerSettlePreSheetFullDto.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.settle.dto.pre.customer; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class CustomerSettlePreSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleBizItemDto.java new file mode 100644 index 0000000..5cd6e97 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleBizItemDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.dto.sheet; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class SettleBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleSheetFullDto.java new file mode 100644 index 0000000..7afe1e9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleSheetFullDto.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.settle.dto.sheet; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class SettleSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleBizItemDto.java new file mode 100644 index 0000000..c0784e4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleBizItemDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.dto.sheet.customer; + +import com.lframework.starter.web.core.dto.BaseDto; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class CustomerSettleBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleSheetFullDto.java new file mode 100644 index 0000000..9b59e47 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleSheetFullDto.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.settle.dto.sheet.customer; + +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class CustomerSettleSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheet.java new file mode 100644 index 0000000..6b62eb5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheet.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_check_sheet") +public class CustomerSettleCheckSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheetDetail.java new file mode 100644 index 0000000..6a38c27 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheetDetail.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetCalcType; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_check_sheet_detail") +public class CustomerSettleCheckSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 对账单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private CustomerSettleCheckSheetBizType bizType; + + /** + * 计算方式 + */ + private CustomerSettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheet.java new file mode 100644 index 0000000..ad29119 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheet.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("customer_settle_fee_sheet") +public class CustomerSettleFeeSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 单据类型 + */ + private CustomerSettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheetDetail.java new file mode 100644 index 0000000..c107d6d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheetDetail.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("customer_settle_fee_sheet_detail") +public class CustomerSettleFeeSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 费用单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheet.java new file mode 100644 index 0000000..cc38000 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheet.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_pre_sheet") +public class CustomerSettlePreSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheetDetail.java new file mode 100644 index 0000000..058f55b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheetDetail.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_pre_sheet_detail") +public class CustomerSettlePreSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 预付款单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheet.java new file mode 100644 index 0000000..7c7112f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheet.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("customer_settle_sheet") +public class CustomerSettleSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheetDetail.java new file mode 100644 index 0000000..dddb79a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheetDetail.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("customer_settle_sheet_detail") +public class CustomerSettleSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 结算单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheet.java new file mode 100644 index 0000000..f3187c9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheet.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_check_sheet") +public class SettleCheckSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheetDetail.java new file mode 100644 index 0000000..d800a02 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheetDetail.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetCalcType; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_check_sheet_detail") +public class SettleCheckSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 对账单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private SettleCheckSheetBizType bizType; + + /** + * 计算方式 + */ + private SettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheet.java new file mode 100644 index 0000000..66ae26a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheet.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("settle_fee_sheet") +public class SettleFeeSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 单据类型 + */ + private SettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheetDetail.java new file mode 100644 index 0000000..9d82da6 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheetDetail.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("settle_fee_sheet_detail") +public class SettleFeeSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 费用单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleInItem.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleInItem.java new file mode 100644 index 0000000..0f9bf70 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleInItem.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-28 + */ +@Data +@TableName("settle_in_item") +public class SettleInItem extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SettleInItem"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleOutItem.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleOutItem.java new file mode 100644 index 0000000..8721d59 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleOutItem.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-28 + */ +@Data +@TableName("settle_out_item") +public class SettleOutItem extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SettleOutItem"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheet.java new file mode 100644 index 0000000..9ecba9b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheet.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_pre_sheet") +public class SettlePreSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheetDetail.java new file mode 100644 index 0000000..366d6d5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheetDetail.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_pre_sheet_detail") +public class SettlePreSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 预付款单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheet.java new file mode 100644 index 0000000..c38eb10 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheet.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("settle_sheet") +public class SettleSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheetDetail.java new file mode 100644 index 0000000..bb9292f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheetDetail.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.core.dto.BaseDto; +import com.lframework.starter.web.core.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("settle_sheet_detail") +public class SettleSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 结算单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetBizType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetBizType.java new file mode 100644 index 0000000..7e76096 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetBizType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum CustomerSettleCheckSheetBizType implements BaseEnum { + OUT_SHEET(1, "销售出库单"), SALE_RETURN(2, "销售退单"), SETTLE_FEE_SHEET(3, "客户费用单"), SETTLE_PRE_SHEET(4, + "客户预收款单"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleCheckSheetBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetCalcType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetCalcType.java new file mode 100644 index 0000000..f4bea40 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetCalcType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum CustomerSettleCheckSheetCalcType implements BaseEnum { + ADD(1, "加"), SUB(2, "减"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleCheckSheetCalcType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetStatus.java new file mode 100644 index 0000000..e00a0f3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum CustomerSettleCheckSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleCheckSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetStatus.java new file mode 100644 index 0000000..a486c4b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum CustomerSettleFeeSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleFeeSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetType.java new file mode 100644 index 0000000..ff2cd0b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum CustomerSettleFeeSheetType implements BaseEnum { + RECEIVE(1, "应收款"), PAY(2, "应付款"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleFeeSheetType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettlePreSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettlePreSheetStatus.java new file mode 100644 index 0000000..81a6cb2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettlePreSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum CustomerSettlePreSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettlePreSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleSheetStatus.java new file mode 100644 index 0000000..9198c26 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum CustomerSettleSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetBizType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetBizType.java new file mode 100644 index 0000000..b20ebf0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetBizType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleCheckSheetBizType implements BaseEnum { + RECEIVE_SHEET(1, "采购收货单"), PURCHASE_RETURN(2, "采购退单"), SETTLE_FEE_SHEET(3, "供应商费用单"), SETTLE_PRE_SHEET(4, + "供应商预付款单"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleCheckSheetBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetCalcType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetCalcType.java new file mode 100644 index 0000000..8cb0746 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetCalcType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleCheckSheetCalcType implements BaseEnum { + ADD(1, "加"), SUB(2, "减"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleCheckSheetCalcType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetStatus.java new file mode 100644 index 0000000..9860bf7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleCheckSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleCheckSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetStatus.java new file mode 100644 index 0000000..edce04e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleFeeSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleFeeSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetType.java new file mode 100644 index 0000000..c380e87 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleFeeSheetType implements BaseEnum { + RECEIVE(1, "应收款"), PAY(2, "应付款"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleFeeSheetType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleOpLogType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleOpLogType.java new file mode 100644 index 0000000..4ff42fc --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleOpLogType.java @@ -0,0 +1,12 @@ +package com.lframework.xingyun.settle.enums; + +import com.lframework.starter.web.core.components.oplog.OpLogType; +import org.springframework.stereotype.Component; + +@Component +public class SettleOpLogType implements OpLogType { + @Override + public Integer getCode() { + return 3000; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettlePreSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettlePreSheetStatus.java new file mode 100644 index 0000000..d5ceccf --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettlePreSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettlePreSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettlePreSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleSheetStatus.java new file mode 100644 index 0000000..801bc42 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.core.enums.BaseEnum; + +public enum SettleSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportModel.java new file mode 100644 index 0000000..886b4d2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportModel.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.settle.excel.check; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class SettleCheckSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 单据金额 + */ + @ExcelProperty("单据金额") + private BigDecimal totalAmount; + + /** + * 应付总金额 + */ + @ExcelProperty("应付总金额") + private BigDecimal totalPayAmount; + + /** + * 已付款金额 + */ + @ExcelProperty("已付款金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ExcelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @ExcelProperty("未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettleCheckSheetExportModel() { + + } + + public SettleCheckSheetExportModel(SettleCheckSheet dto) { + + super(dto); + } + + @Override + public
BaseBo convert(SettleCheckSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettleCheckSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalPayAmount(dto.getTotalPayAmount()); + this.setTotalPayedAmount(dto.getTotalPayedAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setTotalUnPayAmount( + NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount())); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettleCheckSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportTaskWorker.java new file mode 100644 index 0000000..73e6eec --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.check; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import com.lframework.xingyun.settle.vo.check.QuerySettleCheckSheetVo; + +public class SettleCheckSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySettleCheckSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySettleCheckSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QuerySettleCheckSheetVo params) { + + SettleCheckSheetService SettleCheckSheetService = ApplicationUtil.getBean( + SettleCheckSheetService.class); + + return SettleCheckSheetService.query(pageIndex, pageSize, params); + } + + @Override + public SettleCheckSheetExportModel exportData(SettleCheckSheet data) { + return new SettleCheckSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return SettleCheckSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportModel.java new file mode 100644 index 0000000..93c715c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportModel.java @@ -0,0 +1,171 @@ +package com.lframework.xingyun.settle.excel.check.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class CustomerSettleCheckSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 单据金额 + */ + @ExcelProperty("单据金额") + private BigDecimal totalAmount; + + /** + * 应付总金额 + */ + @ExcelProperty("应付总金额") + private BigDecimal totalPayAmount; + + /** + * 已付款金额 + */ + @ExcelProperty("已付款金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ExcelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @ExcelProperty("未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettleCheckSheetExportModel() { + + } + + public CustomerSettleCheckSheetExportModel(CustomerSettleCheckSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettleCheckSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalPayAmount(dto.getTotalPayAmount()); + this.setTotalPayedAmount(dto.getTotalPayedAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setTotalUnPayAmount( + NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount())); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettleCheckSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportTaskWorker.java new file mode 100644 index 0000000..a5c40b8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.check.customer; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerSettleCheckSheetVo; + +public class CustomerSettleCheckSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryCustomerSettleCheckSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryCustomerSettleCheckSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryCustomerSettleCheckSheetVo params) { + + CustomerSettleCheckSheetService customerSettleCheckSheetService = ApplicationUtil.getBean( + CustomerSettleCheckSheetService.class); + + return customerSettleCheckSheetService.query(pageIndex, pageSize, params); + } + + @Override + public CustomerSettleCheckSheetExportModel exportData(CustomerSettleCheckSheet data) { + return new CustomerSettleCheckSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return CustomerSettleCheckSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportModel.java new file mode 100644 index 0000000..e8c881d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportModel.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.settle.excel.fee; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class SettleFeeSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettleFeeSheetExportModel() { + + } + + public SettleFeeSheetExportModel(SettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleFeeSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettleFeeSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettleFeeSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportTaskWorker.java new file mode 100644 index 0000000..9833b26 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.fee; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.service.SettleFeeSheetService; +import com.lframework.xingyun.settle.vo.fee.QuerySettleFeeSheetVo; + +public class SettleFeeSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySettleFeeSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySettleFeeSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QuerySettleFeeSheetVo params) { + + SettleFeeSheetService SettleFeeSheetService = ApplicationUtil.getBean( + SettleFeeSheetService.class); + + return SettleFeeSheetService.query(pageIndex, pageSize, params); + } + + @Override + public SettleFeeSheetExportModel exportData(SettleFeeSheet data) { + return new SettleFeeSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return SettleFeeSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportModel.java new file mode 100644 index 0000000..1262174 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportModel.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.settle.excel.fee.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class CustomerSettleFeeSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettleFeeSheetExportModel() { + + } + + public CustomerSettleFeeSheetExportModel(CustomerSettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleFeeSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettleFeeSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettleFeeSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportTaskWorker.java new file mode 100644 index 0000000..aa58fa3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.fee.customer; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetService; +import com.lframework.xingyun.settle.vo.fee.customer.QueryCustomerSettleFeeSheetVo; + +public class CustomerSettleFeeSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryCustomerSettleFeeSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryCustomerSettleFeeSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryCustomerSettleFeeSheetVo params) { + + CustomerSettleFeeSheetService customerSettleFeeSheetService = ApplicationUtil.getBean( + CustomerSettleFeeSheetService.class); + + return customerSettleFeeSheetService.query(pageIndex, pageSize, params); + } + + @Override + public CustomerSettleFeeSheetExportModel exportData(CustomerSettleFeeSheet data) { + return new CustomerSettleFeeSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return CustomerSettleFeeSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportModel.java new file mode 100644 index 0000000..8a430c5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportModel.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.excel.item.in; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.xingyun.settle.entity.SettleInItem; +import lombok.Data; + +@Data +public class SettleInItemExportModel extends BaseBo implements ExcelModel { + + @ExcelProperty("编号") + private String code; + + @ExcelProperty("名称") + private String name; + + @ExcelProperty("备注") + private String description; + + public SettleInItemExportModel() { + + } + + public SettleInItemExportModel(SettleInItem dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleInItem dto) { + + return this; + } + + @Override + protected void afterInit(SettleInItem dto) { + + this.setCode(dto.getCode()); + this.setName(dto.getName()); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportTaskWorker.java new file mode 100644 index 0000000..9cff6ad --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportTaskWorker.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.settle.excel.item.in; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; + +public class SettleInItemExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySettleInItemVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySettleInItemVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QuerySettleInItemVo params) { + + SettleInItemService settleInItemService = ApplicationUtil.getBean(SettleInItemService.class); + + return settleInItemService.query(pageIndex, pageSize, params); + } + + @Override + public SettleInItemExportModel exportData(SettleInItem data) { + return new SettleInItemExportModel(data); + } + + @Override + public Class getModelClass() { + return SettleInItemExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportModel.java new file mode 100644 index 0000000..e406d1d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportModel.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.excel.item.out; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import lombok.Data; + +@Data +public class SettleOutItemExportModel extends BaseBo implements ExcelModel { + + @ExcelProperty("编号") + private String code; + + @ExcelProperty("名称") + private String name; + + @ExcelProperty("备注") + private String description; + + public SettleOutItemExportModel() { + + } + + public SettleOutItemExportModel(SettleOutItem dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleOutItem dto) { + + return this; + } + + @Override + protected void afterInit(SettleOutItem dto) { + + this.setCode(dto.getCode()); + this.setName(dto.getName()); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportTaskWorker.java new file mode 100644 index 0000000..3f30ec5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportTaskWorker.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.settle.excel.item.out; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; + +public class SettleOutItemExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySettleOutItemVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySettleOutItemVo.class); + } + + @Override + public PageResult getDataList(int pageOutdex, int pageSize, + QuerySettleOutItemVo params) { + + SettleOutItemService settleOutItemService = ApplicationUtil.getBean(SettleOutItemService.class); + + return settleOutItemService.query(pageOutdex, pageSize, params); + } + + @Override + public SettleOutItemExportModel exportData(SettleOutItem data) { + return new SettleOutItemExportModel(data); + } + + @Override + public Class getModelClass() { + return SettleOutItemExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportModel.java new file mode 100644 index 0000000..299c877 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportModel.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.settle.excel.pre; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class SettlePreSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettlePreSheetExportModel() { + + } + + public SettlePreSheetExportModel(SettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettlePreSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettlePreSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettlePreSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportTaskWorker.java new file mode 100644 index 0000000..2974dc5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.pre; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.service.SettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.QuerySettlePreSheetVo; + +public class SettlePreSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySettlePreSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySettlePreSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QuerySettlePreSheetVo params) { + + SettlePreSheetService SettlePreSheetService = ApplicationUtil.getBean( + SettlePreSheetService.class); + + return SettlePreSheetService.query(pageIndex, pageSize, params); + } + + @Override + public SettlePreSheetExportModel exportData(SettlePreSheet data) { + return new SettlePreSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return SettlePreSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportModel.java new file mode 100644 index 0000000..ffe42e1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportModel.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.settle.excel.pre.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class CustomerSettlePreSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettlePreSheetExportModel() { + + } + + public CustomerSettlePreSheetExportModel(CustomerSettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettlePreSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettlePreSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettlePreSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportTaskWorker.java new file mode 100644 index 0000000..38ca962 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.pre.customer; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.customer.QueryCustomerSettlePreSheetVo; + +public class CustomerSettlePreSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryCustomerSettlePreSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryCustomerSettlePreSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryCustomerSettlePreSheetVo params) { + + CustomerSettlePreSheetService customerSettlePreSheetService = ApplicationUtil.getBean( + CustomerSettlePreSheetService.class); + + return customerSettlePreSheetService.query(pageIndex, pageSize, params); + } + + @Override + public CustomerSettlePreSheetExportModel exportData(CustomerSettlePreSheet data) { + return new CustomerSettlePreSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return CustomerSettlePreSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportModel.java new file mode 100644 index 0000000..42178bf --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportModel.java @@ -0,0 +1,137 @@ +package com.lframework.xingyun.settle.excel.sheet; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class SettleSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 实付总金额 + */ + @ExcelProperty("实付总金额") + private BigDecimal totalAmount; + + /** + * 优惠总金额 + */ + @ExcelProperty("优惠总金额") + private BigDecimal totalDiscountAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettleSheetExportModel() { + + } + + public SettleSheetExportModel(SettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettleSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettleSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportTaskWorker.java new file mode 100644 index 0000000..ea6446c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.sheet; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.service.SettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.QuerySettleSheetVo; + +public class SettleSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QuerySettleSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QuerySettleSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QuerySettleSheetVo params) { + + SettleSheetService SettleSheetService = ApplicationUtil.getBean( + SettleSheetService.class); + + return SettleSheetService.query(pageIndex, pageSize, params); + } + + @Override + public SettleSheetExportModel exportData(SettleSheet data) { + return new SettleSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return SettleSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportModel.java new file mode 100644 index 0000000..1454ba7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportModel.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.settle.excel.sheet.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.bo.BaseBo; +import com.lframework.starter.web.core.components.excel.ExcelModel; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.EnumUtil; +import com.lframework.starter.web.inner.entity.SysUser; +import com.lframework.starter.web.inner.service.system.SysUserService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class CustomerSettleSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @Schema(description = "客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @Schema(description = "客户名称") + private String customerName; + + /** + * 实付总金额 + */ + @ExcelProperty("实付总金额") + private BigDecimal totalAmount; + + /** + * 优惠总金额 + */ + @ExcelProperty("优惠总金额") + private BigDecimal totalDiscountAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettleSheetExportModel() { + + } + + public CustomerSettleSheetExportModel(CustomerSettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettleSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + SysUserService userService = ApplicationUtil.getBean(SysUserService.class); + SysUser approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettleSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportTaskWorker.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportTaskWorker.java new file mode 100644 index 0000000..3737f82 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportTaskWorker.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.excel.sheet.customer; + +import com.lframework.starter.mq.core.components.export.ExportTaskWorker; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.utils.ApplicationUtil; +import com.lframework.starter.web.core.utils.JsonUtil; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.service.CustomerSettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerSettleSheetVo; + +public class CustomerSettleSheetExportTaskWorker implements + ExportTaskWorker { + + @Override + public QueryCustomerSettleSheetVo parseParams(String json) { + return JsonUtil.parseObject(json, QueryCustomerSettleSheetVo.class); + } + + @Override + public PageResult getDataList(int pageIndex, int pageSize, + QueryCustomerSettleSheetVo params) { + + CustomerSettleSheetService customerSettleSheetService = ApplicationUtil.getBean( + CustomerSettleSheetService.class); + + return customerSettleSheetService.query(pageIndex, pageSize, params); + } + + @Override + public CustomerSettleSheetExportModel exportData(CustomerSettleSheet data) { + return new CustomerSettleSheetExportModel(data); + } + + @Override + public Class getModelClass() { + return CustomerSettleSheetExportModel.class; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetDetailServiceImpl.java new file mode 100644 index 0000000..5cf0093 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetDetailServiceImpl.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettleCheckSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettleCheckSheetDetailServiceImpl + extends + BaseMpServiceImpl + implements CustomerSettleCheckSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetServiceImpl.java new file mode 100644 index 0000000..279f9fc --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetServiceImpl.java @@ -0,0 +1,781 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.enums.*; +import com.lframework.xingyun.settle.mappers.CustomerSettleCheckSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetService; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetService; +import com.lframework.xingyun.settle.vo.check.customer.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class CustomerSettleCheckSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleCheckSheetService { + + @Autowired + private CustomerSettleCheckSheetDetailService customerSettleCheckSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private SaleOutSheetService saleOutSheetService; + + @Autowired + private SaleReturnService saleReturnService; + + @Autowired + private CustomerSettleFeeSheetService customerSettleFeeSheetService; + + @Autowired + private CustomerSettlePreSheetService customerSettlePreSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleCheckSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettleCheckSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettleCheckSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = new CustomerSettleCheckSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode( + generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_CHECK_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleCheckSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户对账单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户对账单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleCheckSheetDetail::getOrderNo); + List sheetDetails = customerSettleCheckSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()); + customerSettleCheckSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleCheckSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleCheckSheetStatus.CREATED); + statusList.add(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getApproveBy, null) + .set(CustomerSettleCheckSheet::getApproveTime, null) + .set(CustomerSettleCheckSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettleCheckSheet::getId, sheet.getId()) + .in(CustomerSettleCheckSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户对账单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户对账单无法审核通过!"); + } + + sheet.setStatus(CustomerSettleCheckSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleCheckSheetStatus.CREATED); + statusList.add(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .eq(CustomerSettleCheckSheet::getId, sheet.getId()) + .in(CustomerSettleCheckSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettleCheckSheetVo approveVo = new ApprovePassCustomerSettleCheckSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户对账单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户对账单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户对账单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleCheckSheetStatus.CREATED); + statusList.add(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .eq(CustomerSettleCheckSheet::getId, sheet.getId()) + .in(CustomerSettleCheckSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户对账单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户对账单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleCheckSheetDetail::getOrderNo); + List sheetDetails = customerSettleCheckSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()); + customerSettleCheckSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Override + public CustomerSettleCheckBizItemDto getBizItem(String id, + CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + + switch (bizType) { + case OUT_SHEET: { + SaleOutSheet outSheet = saleOutSheetService.getById(id); + + result.setId(outSheet.getId()); + result.setCode(outSheet.getCode()); + result.setTotalAmount(outSheet.getTotalAmount()); + result.setApproveTime(outSheet.getApproveTime()); + result.setCalcType(CustomerSettleCheckSheetCalcType.ADD); + break; + } + case SALE_RETURN: { + SaleReturn saleReturn = saleReturnService.getById(id); + + result.setId(saleReturn.getId()); + result.setCode(saleReturn.getCode()); + result.setTotalAmount(saleReturn.getTotalAmount()); + result.setApproveTime(saleReturn.getApproveTime()); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_FEE_SHEET: { + CustomerSettleFeeSheet feeSheet = customerSettleFeeSheetService.getById(id); + + result.setId(feeSheet.getId()); + result.setCode(feeSheet.getCode()); + result.setTotalAmount(feeSheet.getTotalAmount()); + result.setApproveTime(feeSheet.getApproveTime()); + result.setCalcType(feeSheet.getSheetType() == CustomerSettleFeeSheetType.RECEIVE ? + CustomerSettleCheckSheetCalcType.ADD : + CustomerSettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_PRE_SHEET: { + CustomerSettlePreSheet preSheet = customerSettlePreSheetService.getById(id); + + result.setId(preSheet.getId()); + result.setCode(preSheet.getCode()); + result.setTotalAmount(preSheet.getTotalAmount()); + result.setApproveTime(preSheet.getApproveTime()); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + + result.setBizType(bizType); + if (result.getCalcType() == CustomerSettleCheckSheetCalcType.SUB) { + result.setTotalAmount(result.getTotalAmount().negate()); + } + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id, CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case OUT_SHEET: { + int count = saleOutSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SALE_RETURN: { + int count = saleReturnService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = customerSettleFeeSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = customerSettlePreSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id, CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case OUT_SHEET: { + int count = saleOutSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SALE_RETURN: { + int count = saleReturnService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = customerSettleFeeSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = customerSettlePreSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id, CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case OUT_SHEET: { + int count = saleOutSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SALE_RETURN: { + int count = saleReturnService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = customerSettleFeeSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = customerSettlePreSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + } + + @Override + public List getUnCheckBizItems( + QueryCustomerUnCheckBizItemVo vo) { + + List results = new ArrayList<>(); + + List outSheetList = saleOutSheetService.getApprovedList(vo.getCustomerId(), + vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List saleReturnList = saleReturnService.getApprovedList(vo.getCustomerId(), + vo.getStartTime(), vo.getEndTime(), SettleStatus.UN_SETTLE); + + List feeSheetList = customerSettleFeeSheetService.getApprovedList( + vo.getCustomerId(), vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List preSheetList = customerSettlePreSheetService.getApprovedList( + vo.getCustomerId(), vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + if (!CollectionUtil.isEmpty(outSheetList)) { + for (SaleOutSheet item : outSheetList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.OUT_SHEET); + result.setCalcType(CustomerSettleCheckSheetCalcType.ADD); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(saleReturnList)) { + for (SaleReturn item : saleReturnList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.SALE_RETURN); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(feeSheetList)) { + for (CustomerSettleFeeSheet item : feeSheetList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.SETTLE_FEE_SHEET); + result.setCalcType(item.getSheetType() == CustomerSettleFeeSheetType.RECEIVE ? + CustomerSettleCheckSheetCalcType.ADD : + CustomerSettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(preSheetList)) { + for (CustomerSettlePreSheet item : preSheetList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.SETTLE_PRE_SHEET); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + results.stream().filter(t -> t.getCalcType() == CustomerSettleCheckSheetCalcType.SUB) + .forEach(t -> t.setTotalAmount(t.getTotalAmount().negate())); + + return results; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE) + .eq(CustomerSettleCheckSheet::getId, id) + .eq(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(CustomerSettleCheckSheet::getId, id) + .in(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.SETTLED) + .eq(CustomerSettleCheckSheet::getId, id) + .in(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, id) + .orderByAsc(CustomerSettleCheckSheetDetail::getOrderNo); + List sheetDetails = customerSettleCheckSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemSettled(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + return count; + } + + @Override + public List getApprovedList(String customerId, + LocalDateTime startTime, LocalDateTime endTime) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setSettleAmount(String id, BigDecimal totalPayedAmount, + BigDecimal totalDiscountAmount) { + + CustomerSettleCheckSheet checkSheet = getBaseMapper().selectById(id); + BigDecimal remainTotalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), + checkSheet.getTotalPayedAmount(), checkSheet.getTotalDiscountAmount(), + totalPayedAmount, + totalDiscountAmount); + BigDecimal totalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), + checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount()); + if (NumberUtil.lt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余收款金额为" + totalPayAmount + "元,本次收款金额为" + + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + if (NumberUtil.gt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余收款金额为" + totalPayAmount + "元,本次收款金额为" + + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getTotalPayedAmount, + NumberUtil.add(totalPayedAmount, checkSheet.getTotalPayedAmount())) + .set(CustomerSettleCheckSheet::getTotalDiscountAmount, + NumberUtil.add(totalDiscountAmount, checkSheet.getTotalDiscountAmount())) + .eq(CustomerSettleCheckSheet::getId, id) + .eq(CustomerSettleCheckSheet::getTotalPayedAmount, checkSheet.getTotalPayedAmount()) + .eq(CustomerSettleCheckSheet::getTotalDiscountAmount, + checkSheet.getTotalDiscountAmount()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("结账单:" + checkSheet.getCode() + ",信息已过期,请刷新重试!"); + } + + if (NumberUtil.equal(remainTotalPayAmount, 0)) { + this.setSettled(id); + } + } + + private void create(CustomerSettleCheckSheet sheet, CreateCustomerSettleCheckSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalPayAmount = BigDecimal.ZERO; + + int orderNo = 0; + for (CustomerSettleCheckSheetItemVo itemVo : vo.getItems()) { + orderNo++; + CustomerSettleCheckBizItemDto item = this.getBizItem(itemVo.getId(), + EnumUtil.getByCode(CustomerSettleCheckSheetBizType.class, itemVo.getBizType())); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + CustomerSettleCheckSheetDetail detail = new CustomerSettleCheckSheetDetail(); + + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setBizType( + EnumUtil.getByCode(CustomerSettleCheckSheetBizType.class, itemVo.getBizType())); + detail.setCalcType(item.getCalcType()); + if (item.getCalcType() == CustomerSettleCheckSheetCalcType.ADD) { + if (NumberUtil.lt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应收金额不允许小于0!"); + } + } else { + if (NumberUtil.gt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应收金额不允许大于0!"); + } + } + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + customerSettleCheckSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, item.getTotalAmount()); + totalPayAmount = NumberUtil.add(totalPayAmount, itemVo.getPayAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId(), detail.getBizType()); + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalPayAmount(totalPayAmount); + sheet.setTotalPayedAmount(BigDecimal.ZERO); + sheet.setTotalDiscountAmount(BigDecimal.ZERO); + sheet.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR + : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetDetailServiceImpl.java new file mode 100644 index 0000000..24505fa --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettleFeeSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettleFeeSheetDetailServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleFeeSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetServiceImpl.java new file mode 100644 index 0000000..482ec7d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetServiceImpl.java @@ -0,0 +1,391 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.CustomerSettleFeeSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetService; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.fee.customer.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class CustomerSettleFeeSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleFeeSheetService { + + @Autowired + private CustomerSettleFeeSheetDetailService customerSettleFeeSheetDetailService; + + @Autowired + private SettleOutItemService settleOutItemService; + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleFeeSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettleFeeSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettleFeeSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = new CustomerSettleFeeSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_FEE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleFeeSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户费用单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户费用单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleFeeSheetDetail.class) + .eq(CustomerSettleFeeSheetDetail::getSheetId, sheet.getId()); + customerSettleFeeSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleFeeSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleFeeSheetStatus.CREATED); + statusList.add(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getApproveBy, null) + .set(CustomerSettleFeeSheet::getApproveTime, null) + .set(CustomerSettleFeeSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettleFeeSheet::getId, sheet.getId()) + .in(CustomerSettleFeeSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户费用单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户费用单无法审核通过!"); + } + + sheet.setStatus(CustomerSettleFeeSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleFeeSheetStatus.CREATED); + statusList.add(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .eq(CustomerSettleFeeSheet::getId, sheet.getId()) + .in(CustomerSettleFeeSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettleFeeSheetVo approveVo = new ApprovePassCustomerSettleFeeSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户费用单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户费用单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户费用单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleFeeSheetStatus.CREATED); + statusList.add(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .eq(CustomerSettleFeeSheet::getId, sheet.getId()) + .in(CustomerSettleFeeSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户费用单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户费用单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleFeeSheetDetail.class) + .eq(CustomerSettleFeeSheetDetail::getSheetId, sheet.getId()); + customerSettleFeeSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE) + .eq(CustomerSettleFeeSheet::getId, id) + .eq(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(CustomerSettleFeeSheet::getId, id) + .in(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.SETTLED) + .eq(CustomerSettleFeeSheet::getId, id) + .in(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(CustomerSettleFeeSheet sheet, CreateCustomerSettleFeeSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (CustomerSettleFeeSheetItemVo itemVo : vo.getItems()) { + if (vo.getSheetType() == CustomerSettleFeeSheetType.RECEIVE.getCode().intValue()) { + SettleInItem item = settleInItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } else { + SettleOutItem item = settleOutItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } + CustomerSettleFeeSheetDetail detail = new CustomerSettleFeeSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + customerSettleFeeSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setSheetType(EnumUtil.getByCode(CustomerSettleFeeSheetType.class, vo.getSheetType())); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetDetailServiceImpl.java new file mode 100644 index 0000000..2e5d08e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettlePreSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettlePreSheetDetailServiceImpl extends + BaseMpServiceImpl + implements CustomerSettlePreSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetServiceImpl.java new file mode 100644 index 0000000..b902493 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetServiceImpl.java @@ -0,0 +1,380 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.CustomerSettlePreSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetService; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.vo.pre.customer.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class CustomerSettlePreSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettlePreSheetService { + + @Autowired + private CustomerSettlePreSheetDetailService settlePreSheetDetailService; + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettlePreSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettlePreSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettlePreSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建客户预收款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建预收款单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = new CustomerSettlePreSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_PRE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettlePreSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改客户预收款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改预收款单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户预收款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED + && sheet.getStatus() != CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户预收款单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户预收款单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettlePreSheetDetail.class) + .eq(CustomerSettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettlePreSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettlePreSheetStatus.CREATED); + statusList.add(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getApproveBy, null) + .set(CustomerSettlePreSheet::getApproveTime, null) + .set(CustomerSettlePreSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettlePreSheet::getId, sheet.getId()) + .in(CustomerSettlePreSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户预收款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过客户预收款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户预收款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED + && sheet.getStatus() != CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户预收款单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户预收款单无法审核通过!"); + } + + sheet.setStatus(CustomerSettlePreSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettlePreSheetStatus.CREATED); + statusList.add(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .eq(CustomerSettlePreSheet::getId, sheet.getId()) + .in(CustomerSettlePreSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户预收款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettlePreSheetVo approveVo = new ApprovePassCustomerSettlePreSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝客户预收款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户预收款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户预收款单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户预收款单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户预收款单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettlePreSheetStatus.CREATED); + statusList.add(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .eq(CustomerSettlePreSheet::getId, sheet.getId()) + .in(CustomerSettlePreSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户预收款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除客户预收款单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettlePreSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户预收款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED + && sheet.getStatus() != CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户预收款单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户预收款单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettlePreSheetDetail.class) + .eq(CustomerSettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE) + .eq(CustomerSettlePreSheet::getId, id) + .eq(CustomerSettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(CustomerSettlePreSheet::getId, id) + .in(CustomerSettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getSettleStatus, SettleStatus.SETTLED) + .eq(CustomerSettlePreSheet::getId, id) + .in(CustomerSettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(CustomerSettlePreSheet sheet, CreateCustomerSettlePreSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (CustomerSettlePreSheetItemVo itemVo : vo.getItems()) { + SettleInItem item = settleInItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + CustomerSettlePreSheetDetail detail = new CustomerSettlePreSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + settlePreSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetDetailServiceImpl.java new file mode 100644 index 0000000..f9bbf94 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettleSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettleSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettleSheetDetailServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetServiceImpl.java new file mode 100644 index 0000000..4ea9a08 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetServiceImpl.java @@ -0,0 +1,492 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.CustomerSettleSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import com.lframework.xingyun.settle.service.CustomerSettleSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.customer.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class CustomerSettleSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleSheetService { + + @Autowired + private CustomerSettleSheetDetailService customerSettleSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private CustomerSettleCheckSheetService customerSettleCheckSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettleSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettleSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = new CustomerSettleSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户结算单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户结算单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleSheetDetail::getOrderNo); + List sheetDetails = customerSettleSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()); + customerSettleSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleSheetStatus.CREATED); + statusList.add(CustomerSettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(CustomerSettleSheet.class) + .set(CustomerSettleSheet::getApproveBy, null).set(CustomerSettleSheet::getApproveTime, null) + .set(CustomerSettleSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettleSheet::getId, sheet.getId()) + .in(CustomerSettleSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户结算单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户结算单无法审核通过!"); + } + + sheet.setStatus(CustomerSettleSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleSheetStatus.CREATED); + statusList.add(CustomerSettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(CustomerSettleSheet.class) + .eq(CustomerSettleSheet::getId, sheet.getId()) + .in(CustomerSettleSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户结算单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleSheetDetail::getOrderNo); + List details = customerSettleSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleSheetDetail detail : details) { + customerSettleCheckSheetService.setSettleAmount(detail.getBizId(), detail.getPayAmount(), + detail.getDiscountAmount()); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettleSheetVo vo) { + + CustomerSettleSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettleSheetVo approveVo = new ApprovePassCustomerSettleSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户结算单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户结算单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户结算单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettleSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleSheetStatus.CREATED); + statusList.add(CustomerSettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(CustomerSettleSheet.class) + .eq(CustomerSettleSheet::getId, sheet.getId()) + .in(CustomerSettleSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettleSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户结算单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户结算单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleSheetDetail::getOrderNo); + List sheetDetails = customerSettleSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()); + customerSettleSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Override + public CustomerSettleBizItemDto getBizItem(String id) { + + CustomerSettleCheckSheet checkSheet = customerSettleCheckSheetService.getById(id); + + CustomerSettleBizItemDto result = new CustomerSettleBizItemDto(); + result.setId(checkSheet.getId()); + result.setCode(checkSheet.getCode()); + result.setTotalPayAmount(checkSheet.getTotalPayAmount()); + result.setTotalPayedAmount(checkSheet.getTotalPayedAmount()); + result.setTotalDiscountAmount(checkSheet.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(checkSheet.getTotalPayAmount(), checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount())); + result.setApproveTime(checkSheet.getApproveTime()); + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id) { + + CustomerSettleCheckSheet item = customerSettleCheckSheetService.getById(id); + int count = customerSettleCheckSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id) { + + CustomerSettleCheckSheet item = customerSettleCheckSheetService.getById(id); + int count = customerSettleCheckSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id) { + + CustomerSettleCheckSheet item = customerSettleCheckSheetService.getById(id); + int count = customerSettleCheckSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,无法重复结算!"); + } + } + + @Override + public List getUnSettleBizItems(QueryCustomerUnSettleBizItemVo vo) { + + List results = new ArrayList<>(); + + List sheetList = customerSettleCheckSheetService.getApprovedList( + vo.getCustomerId(), + vo.getStartTime(), vo.getEndTime()); + + if (!CollectionUtil.isEmpty(sheetList)) { + for (CustomerSettleCheckSheet item : sheetList) { + CustomerSettleBizItemDto result = new CustomerSettleBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalPayAmount(item.getTotalPayAmount()); + result.setTotalPayedAmount(item.getTotalPayedAmount()); + result.setTotalDiscountAmount(item.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(item.getTotalPayAmount(), item.getTotalPayedAmount(), + item.getTotalDiscountAmount())); + result.setApproveTime(item.getApproveTime()); + + results.add(result); + } + } + + return results; + } + + private void create(CustomerSettleSheet sheet, CreateCustomerSettleSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalDiscountAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (CustomerSettleSheetItemVo itemVo : vo.getItems()) { + CustomerSettleBizItemDto item = this.getBizItem(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + + if (NumberUtil.lt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额不允许大于0!"); + } + + if (NumberUtil.gt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许大于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额、优惠金额不能同时等于0!"); + } + + if (NumberUtil.gt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException("第" + orderNo + "行实收金额与优惠金额相加不允许小于未收款金额!"); + } + } else if (NumberUtil.gt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额不允许小于0!"); + } + + if (NumberUtil.lt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许小于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额、优惠金额不能同时等于0!"); + } + if (NumberUtil.lt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException("第" + orderNo + "行实收金额与优惠金额相加不允许大于未收款金额!"); + } + } else { + // 单据应收款等于0 + if (!NumberUtil.equal(itemVo.getPayAmount(), 0) || !NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额、优惠金额必须同时等于0!"); + } + } + + CustomerSettleSheetDetail detail = new CustomerSettleSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDiscountAmount(itemVo.getDiscountAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + customerSettleSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, itemVo.getPayAmount()); + totalDiscountAmount = NumberUtil.add(totalDiscountAmount, itemVo.getDiscountAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalDiscountAmount(totalDiscountAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetDetailServiceImpl.java new file mode 100644 index 0000000..05899d9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; +import com.lframework.xingyun.settle.mappers.SettleCheckSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettleCheckSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettleCheckSheetDetailServiceImpl + extends BaseMpServiceImpl + implements SettleCheckSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetServiceImpl.java new file mode 100644 index 0000000..f4cd80a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetServiceImpl.java @@ -0,0 +1,770 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.enums.*; +import com.lframework.xingyun.settle.mappers.SettleCheckSheetMapper; +import com.lframework.xingyun.settle.service.SettleCheckSheetDetailService; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import com.lframework.xingyun.settle.service.SettleFeeSheetService; +import com.lframework.xingyun.settle.service.SettlePreSheetService; +import com.lframework.xingyun.settle.vo.check.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class SettleCheckSheetServiceImpl extends + BaseMpServiceImpl + implements SettleCheckSheetService { + + @Autowired + private SettleCheckSheetDetailService settleCheckSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private PurchaseReturnService purchaseReturnService; + + @Autowired + private SettleFeeSheetService settleFeeSheetService; + + @Autowired + private SettlePreSheetService settlePreSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySettleCheckSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleCheckSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettleCheckSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = new SettleCheckSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_CHECK_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettleCheckSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED + && sheet.getStatus() != SettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商对账单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商对账单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(SettleCheckSheetDetail::getOrderNo); + List sheetDetails = settleCheckSheetDetailService.list( + queryDetailWrapper); + for (SettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()); + settleCheckSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettleCheckSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettleCheckSheetStatus.CREATED); + statusList.add(SettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getApproveBy, null).set(SettleCheckSheet::getApproveTime, null) + .set(SettleCheckSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(SettleCheckSheet::getId, sheet.getId()) + .in(SettleCheckSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED + && sheet.getStatus() != SettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商对账单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商对账单无法审核通过!"); + } + + sheet.setStatus(SettleCheckSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettleCheckSheetStatus.CREATED); + statusList.add(SettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .eq(SettleCheckSheet::getId, sheet.getId()).in(SettleCheckSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettleCheckSheetVo vo) { + + SettleCheckSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettleCheckSheetVo approveVo = new ApprovePassSettleCheckSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED) { + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商对账单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商对账单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商对账单无法审核拒绝!"); + } + + sheet.setStatus(SettleCheckSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettleCheckSheetStatus.CREATED); + statusList.add(SettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .eq(SettleCheckSheet::getId, sheet.getId()).in(SettleCheckSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettleCheckSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED + && sheet.getStatus() != SettleCheckSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商对账单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商对账单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(SettleCheckSheetDetail::getOrderNo); + List sheetDetails = settleCheckSheetDetailService.list( + queryDetailWrapper); + for (SettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()); + settleCheckSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + Wrapper deleteWrapper = Wrappers.lambdaQuery(SettleCheckSheet.class) + .eq(SettleCheckSheet::getId, id) + .in(SettleCheckSheet::getStatus, SettleCheckSheetStatus.CREATED, + SettleCheckSheetStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("供应商对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Override + public SettleCheckBizItemDto getBizItem(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + + switch (bizType) { + case RECEIVE_SHEET: { + ReceiveSheet receiveSheet = receiveSheetService.getById(id); + + result.setId(receiveSheet.getId()); + result.setCode(receiveSheet.getCode()); + result.setTotalAmount(receiveSheet.getTotalAmount()); + result.setApproveTime(receiveSheet.getApproveTime()); + result.setCalcType(SettleCheckSheetCalcType.ADD); + break; + } + case PURCHASE_RETURN: { + PurchaseReturn purchaseReturn = purchaseReturnService.getById(id); + + result.setId(purchaseReturn.getId()); + result.setCode(purchaseReturn.getCode()); + result.setTotalAmount(purchaseReturn.getTotalAmount()); + result.setApproveTime(purchaseReturn.getApproveTime()); + result.setCalcType(SettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_FEE_SHEET: { + SettleFeeSheet feeSheet = settleFeeSheetService.getById(id); + + result.setId(feeSheet.getId()); + result.setCode(feeSheet.getCode()); + result.setTotalAmount(feeSheet.getTotalAmount()); + result.setApproveTime(feeSheet.getApproveTime()); + result.setCalcType(feeSheet.getSheetType() == SettleFeeSheetType.PAY ? + SettleCheckSheetCalcType.ADD : + SettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_PRE_SHEET: { + SettlePreSheet preSheet = settlePreSheetService.getById(id); + + result.setId(preSheet.getId()); + result.setCode(preSheet.getCode()); + result.setTotalAmount(preSheet.getTotalAmount()); + result.setApproveTime(preSheet.getApproveTime()); + result.setCalcType(SettleCheckSheetCalcType.SUB); + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + + result.setBizType(bizType); + if (result.getCalcType() == SettleCheckSheetCalcType.SUB) { + result.setTotalAmount(result.getTotalAmount().negate()); + } + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case RECEIVE_SHEET: { + int count = receiveSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case PURCHASE_RETURN: { + int count = purchaseReturnService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = settleFeeSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = settlePreSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case RECEIVE_SHEET: { + int count = receiveSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case PURCHASE_RETURN: { + int count = purchaseReturnService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = settleFeeSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = settlePreSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case RECEIVE_SHEET: { + int count = receiveSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case PURCHASE_RETURN: { + int count = purchaseReturnService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = settleFeeSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = settlePreSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + } + + @Override + public List getUnCheckBizItems(QueryUnCheckBizItemVo vo) { + + List results = new ArrayList<>(); + + List receiveSheetList = receiveSheetService.getApprovedList(vo.getSupplierId(), + vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List purchaseReturnList = purchaseReturnService.getApprovedList( + vo.getSupplierId(), + vo.getStartTime(), vo.getEndTime(), SettleStatus.UN_SETTLE); + + List feeSheetList = settleFeeSheetService.getApprovedList(vo.getSupplierId(), + vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List preSheetList = settlePreSheetService.getApprovedList(vo.getSupplierId(), + vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + if (!CollectionUtil.isEmpty(receiveSheetList)) { + for (ReceiveSheet item : receiveSheetList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.RECEIVE_SHEET); + result.setCalcType(SettleCheckSheetCalcType.ADD); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(purchaseReturnList)) { + for (PurchaseReturn item : purchaseReturnList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.PURCHASE_RETURN); + result.setCalcType(SettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(feeSheetList)) { + for (SettleFeeSheet item : feeSheetList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.SETTLE_FEE_SHEET); + result.setCalcType(item.getSheetType() == SettleFeeSheetType.PAY ? + SettleCheckSheetCalcType.ADD : + SettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(preSheetList)) { + for (SettlePreSheet item : preSheetList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.SETTLE_PRE_SHEET); + result.setCalcType(SettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + results.stream().filter(t -> t.getCalcType() == SettleCheckSheetCalcType.SUB) + .forEach(t -> t.setTotalAmount(t.getTotalAmount().negate())); + + return results; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE) + .eq(SettleCheckSheet::getId, id) + .eq(SettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(SettleCheckSheet::getId, id) + .in(SettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getSettleStatus, SettleStatus.SETTLED) + .eq(SettleCheckSheet::getId, id) + .in(SettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, id).orderByAsc(SettleCheckSheetDetail::getOrderNo); + List sheetDetails = settleCheckSheetDetailService.list( + queryDetailWrapper); + for (SettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemSettled(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setSettleAmount(String id, BigDecimal totalPayedAmount, + BigDecimal totalDiscountAmount) { + + SettleCheckSheet checkSheet = getBaseMapper().selectById(id); + BigDecimal remainTotalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), + checkSheet.getTotalPayedAmount(), checkSheet.getTotalDiscountAmount(), totalPayedAmount, + totalDiscountAmount); + BigDecimal totalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), + checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount()); + if (NumberUtil.lt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余付款金额为" + totalPayAmount + "元,本次付款金额为" + + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + if (NumberUtil.gt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余付款金额为" + totalPayAmount + "元,本次付款金额为" + + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getTotalPayedAmount, + NumberUtil.add(totalPayedAmount, checkSheet.getTotalPayedAmount())) + .set(SettleCheckSheet::getTotalDiscountAmount, + NumberUtil.add(totalDiscountAmount, checkSheet.getTotalDiscountAmount())) + .eq(SettleCheckSheet::getId, id) + .eq(SettleCheckSheet::getTotalPayedAmount, checkSheet.getTotalPayedAmount()) + .eq(SettleCheckSheet::getTotalDiscountAmount, checkSheet.getTotalDiscountAmount()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException( + "结账单:" + checkSheet.getCode() + ",信息已过期,请刷新重试!"); + } + + if (NumberUtil.equal(remainTotalPayAmount, 0)) { + this.setSettled(id); + } + } + + private void create(SettleCheckSheet sheet, CreateSettleCheckSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalPayAmount = BigDecimal.ZERO; + + int orderNo = 0; + for (SettleCheckSheetItemVo itemVo : vo.getItems()) { + orderNo++; + SettleCheckBizItemDto item = this.getBizItem(itemVo.getId(), + EnumUtil.getByCode(SettleCheckSheetBizType.class, itemVo.getBizType())); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + SettleCheckSheetDetail detail = new SettleCheckSheetDetail(); + + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setBizType(EnumUtil.getByCode(SettleCheckSheetBizType.class, itemVo.getBizType())); + detail.setCalcType(item.getCalcType()); + if (item.getCalcType() == SettleCheckSheetCalcType.ADD) { + if (NumberUtil.lt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应付金额不允许小于0!"); + } + } else { + if (NumberUtil.gt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应付金额不允许大于0!"); + } + } + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + settleCheckSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, item.getTotalAmount()); + totalPayAmount = NumberUtil.add(totalPayAmount, itemVo.getPayAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId(), detail.getBizType()); + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalPayAmount(totalPayAmount); + sheet.setTotalPayedAmount(BigDecimal.ZERO); + sheet.setTotalDiscountAmount(BigDecimal.ZERO); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetDetailServiceImpl.java new file mode 100644 index 0000000..ecd1335 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetDetailServiceImpl.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; +import com.lframework.xingyun.settle.mappers.SettleFeeSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettleFeeSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettleFeeSheetDetailServiceImpl extends BaseMpServiceImpl + implements SettleFeeSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetServiceImpl.java new file mode 100644 index 0000000..fc34cd5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetServiceImpl.java @@ -0,0 +1,384 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.*; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.SettleFeeSheetMapper; +import com.lframework.xingyun.settle.service.SettleFeeSheetDetailService; +import com.lframework.xingyun.settle.service.SettleFeeSheetService; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.fee.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class SettleFeeSheetServiceImpl extends + BaseMpServiceImpl + implements SettleFeeSheetService { + + @Autowired + private SettleFeeSheetDetailService settleFeeSheetDetailService; + + @Autowired + private SettleOutItemService settleOutItemService; + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySettleFeeSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleFeeSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettleFeeSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = new SettleFeeSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_FEE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettleFeeSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED + && sheet.getStatus() != SettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商费用单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商费用单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + SettleFeeSheetDetail.class) + .eq(SettleFeeSheetDetail::getSheetId, sheet.getId()); + settleFeeSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettleFeeSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettleFeeSheetStatus.CREATED); + statusList.add(SettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getApproveBy, null).set(SettleFeeSheet::getApproveTime, null) + .set(SettleFeeSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(SettleFeeSheet::getId, sheet.getId()) + .in(SettleFeeSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED + && sheet.getStatus() != SettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商费用单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商费用单无法审核通过!"); + } + + sheet.setStatus(SettleFeeSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettleFeeSheetStatus.CREATED); + statusList.add(SettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .eq(SettleFeeSheet::getId, sheet.getId()).in(SettleFeeSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettleFeeSheetVo vo) { + + SettleFeeSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettleFeeSheetVo approveVo = new ApprovePassSettleFeeSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED) { + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商费用单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商费用单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商费用单无法审核拒绝!"); + } + + sheet.setStatus(SettleFeeSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettleFeeSheetStatus.CREATED); + statusList.add(SettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .eq(SettleFeeSheet::getId, sheet.getId()).in(SettleFeeSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettleFeeSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED + && sheet.getStatus() != SettleFeeSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商费用单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商费用单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + SettleFeeSheetDetail.class) + .eq(SettleFeeSheetDetail::getSheetId, sheet.getId()); + settleFeeSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + Wrapper deleteWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .eq(SettleFeeSheet::getId, sheet.getId()) + .in(SettleFeeSheet::getStatus, SettleFeeSheetStatus.CREATED, + SettleFeeSheetStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("供应商费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(SettleFeeSheet::getId, id) + .eq(SettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(SettleFeeSheet::getId, id) + .in(SettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getSettleStatus, SettleStatus.SETTLED).eq(SettleFeeSheet::getId, id) + .in(SettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(SettleFeeSheet sheet, CreateSettleFeeSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SettleFeeSheetItemVo itemVo : vo.getItems()) { + if (vo.getSheetType() == SettleFeeSheetType.RECEIVE.getCode().intValue()) { + SettleInItem item = settleInItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } else { + SettleOutItem item = settleOutItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } + SettleFeeSheetDetail detail = new SettleFeeSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + settleFeeSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setSheetType(EnumUtil.getByCode(SettleFeeSheetType.class, vo.getSheetType())); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleInItemServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleInItemServiceImpl.java new file mode 100644 index 0000000..fe8d71b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleInItemServiceImpl.java @@ -0,0 +1,153 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.SettleInItemMapper; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.vo.item.in.CreateSettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.in.UpdateSettleInItemVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class SettleInItemServiceImpl extends BaseMpServiceImpl + implements SettleInItemService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySettleInItemVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleInItemVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SettleInItemSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SettleInItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SettleInItem findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SettleOpLogType.class, name = "删除收入项目,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleInItem.class) + .set(SettleInItem::getAvailable, Boolean.FALSE).eq(SettleInItem::getId, id); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = SettleOpLogType.class, name = "新增收入项目,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleInItemVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleInItem.class) + .eq(SettleInItem::getCode, vo.getCode()).eq(SettleInItem::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + SettleInItem data = new SettleInItem(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改收入项目,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleInItemVo vo) { + + SettleInItem data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("收入项目不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleInItem.class) + .eq(SettleInItem::getCode, vo.getCode()).eq(SettleInItem::getAvailable, Boolean.TRUE) + .ne(SettleInItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SettleInItem.class) + .set(SettleInItem::getCode, vo.getCode()).set(SettleInItem::getName, vo.getName()) + .set(SettleInItem::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(SettleInItem::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = SettleInItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleOutItemServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleOutItemServiceImpl.java new file mode 100644 index 0000000..f624076 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleOutItemServiceImpl.java @@ -0,0 +1,153 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.SettleOutItemMapper; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.item.out.CreateSettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.out.UpdateSettleOutItemVo; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Service +public class SettleOutItemServiceImpl extends BaseMpServiceImpl + implements SettleOutItemService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySettleOutItemVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleOutItemVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SettleOutItemSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SettleOutItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SettleOutItem findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SettleOpLogType.class, name = "删除支出项目,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleOutItem.class) + .set(SettleOutItem::getAvailable, Boolean.FALSE).eq(SettleOutItem::getId, id); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = SettleOpLogType.class, name = "新增支出项目,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleOutItemVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleOutItem.class) + .eq(SettleOutItem::getCode, vo.getCode()).eq(SettleOutItem::getAvailable, Boolean.TRUE); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + SettleOutItem data = new SettleOutItem(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改支出项目,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleOutItemVo vo) { + + SettleOutItem data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("支出项目不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleOutItem.class) + .eq(SettleOutItem::getCode, vo.getCode()).eq(SettleOutItem::getAvailable, Boolean.TRUE) + .ne(SettleOutItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SettleOutItem.class) + .set(SettleOutItem::getCode, vo.getCode()).set(SettleOutItem::getName, vo.getName()) + .set(SettleOutItem::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(SettleOutItem::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = SettleOutItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetDetailServiceImpl.java new file mode 100644 index 0000000..6750384 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetDetailServiceImpl.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; +import com.lframework.xingyun.settle.mappers.SettlePreSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettlePreSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettlePreSheetDetailServiceImpl extends BaseMpServiceImpl + implements SettlePreSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetServiceImpl.java new file mode 100644 index 0000000..d703af7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetServiceImpl.java @@ -0,0 +1,372 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import com.lframework.xingyun.settle.mappers.SettlePreSheetMapper; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.service.SettlePreSheetDetailService; +import com.lframework.xingyun.settle.service.SettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class SettlePreSheetServiceImpl extends + BaseMpServiceImpl + implements SettlePreSheetService { + + @Autowired + private SettlePreSheetDetailService settlePreSheetDetailService; + + @Autowired + private SettleOutItemService settleOutItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySettlePreSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettlePreSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettlePreSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建预付款单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettlePreSheetVo vo) { + + SettlePreSheet sheet = new SettlePreSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_PRE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettlePreSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改预付款单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettlePreSheetVo vo) { + + SettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED + && sheet.getStatus() != SettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商预付款单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商预付款单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + SettlePreSheetDetail.class) + .eq(SettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettlePreSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettlePreSheetStatus.CREATED); + statusList.add(SettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getApproveBy, null).set(SettlePreSheet::getApproveTime, null) + .set(SettlePreSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(SettlePreSheet::getId, sheet.getId()) + .in(SettlePreSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettlePreSheetVo vo) { + + SettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED + && sheet.getStatus() != SettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商预付款单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商预付款单无法审核通过!"); + } + + sheet.setStatus(SettlePreSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettlePreSheetStatus.CREATED); + statusList.add(SettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .eq(SettlePreSheet::getId, sheet.getId()).in(SettlePreSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettlePreSheetVo vo) { + + SettlePreSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettlePreSheetVo approveVo = new ApprovePassSettlePreSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettlePreSheetVo vo) { + + SettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED) { + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商预付款单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商预付款单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商预付款单无法审核拒绝!"); + } + + sheet.setStatus(SettlePreSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettlePreSheetStatus.CREATED); + statusList.add(SettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .eq(SettlePreSheet::getId, sheet.getId()).in(SettlePreSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettlePreSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED + && sheet.getStatus() != SettlePreSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商预付款单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商预付款单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + SettlePreSheetDetail.class) + .eq(SettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + Wrapper deleteWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .eq(SettlePreSheet::getId, id).in(SettlePreSheet::getStatus, SettlePreSheetStatus.CREATED, + SettlePreSheetStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("供应商预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(SettlePreSheet::getId, id) + .eq(SettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(SettlePreSheet::getId, id) + .in(SettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getSettleStatus, SettleStatus.SETTLED).eq(SettlePreSheet::getId, id) + .in(SettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(SettlePreSheet sheet, CreateSettlePreSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SettlePreSheetItemVo itemVo : vo.getItems()) { + SettleOutItem item = settleOutItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + SettlePreSheetDetail detail = new SettlePreSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + settlePreSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetDetailServiceImpl.java new file mode 100644 index 0000000..663e7db --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetDetailServiceImpl.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; +import com.lframework.xingyun.settle.mappers.SettleSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettleSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettleSheetDetailServiceImpl extends BaseMpServiceImpl + implements SettleSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetServiceImpl.java new file mode 100644 index 0000000..680ffa4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetServiceImpl.java @@ -0,0 +1,483 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.annotations.oplog.OpLog; +import com.lframework.starter.web.core.annotations.timeline.OrderTimeLineLog; +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.components.security.AbstractUserDetails; +import com.lframework.starter.web.core.components.security.SecurityUtil; +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; +import com.lframework.starter.web.core.utils.IdUtil; +import com.lframework.starter.web.core.utils.OpLogUtil; +import com.lframework.starter.web.core.utils.PageHelperUtil; +import com.lframework.starter.web.core.utils.PageResultUtil; +import com.lframework.starter.web.inner.components.timeline.ApprovePassOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.ApproveReturnOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.CreateOrderTimeLineBizType; +import com.lframework.starter.web.inner.components.timeline.UpdateOrderTimeLineBizType; +import com.lframework.starter.web.inner.service.GenerateCodeService; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import com.lframework.xingyun.settle.mappers.SettleSheetMapper; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import com.lframework.xingyun.settle.service.SettleSheetDetailService; +import com.lframework.xingyun.settle.service.SettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class SettleSheetServiceImpl extends BaseMpServiceImpl + implements SettleSheetService { + + @Autowired + private SettleSheetDetailService settleSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private SettleCheckSheetService settleCheckSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySettleSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettleSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.class, name = "创建供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = CreateOrderTimeLineBizType.class, orderId = "#_result", name = "创建结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleSheetVo vo) { + + SettleSheet sheet = new SettleSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettleSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.class, name = "修改供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = UpdateOrderTimeLineBizType.class, orderId = "#vo.id", name = "修改结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleSheetVo vo) { + + SettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED + && sheet.getStatus() != SettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商结算单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商结算单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleSheetDetail::getOrderNo); + List sheetDetails = settleSheetDetailService.list(queryDetailWrapper); + for (SettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()); + settleSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettleSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettleSheetStatus.CREATED); + statusList.add(SettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleSheet.class) + .set(SettleSheet::getApproveBy, null).set(SettleSheet::getApproveTime, null) + .set(SettleSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(SettleSheet::getId, sheet.getId()) + .in(SettleSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "审核通过供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettleSheetVo vo) { + + SettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED + && sheet.getStatus() != SettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商结算单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商结算单无法审核通过!"); + } + + sheet.setStatus(SettleSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettleSheetStatus.CREATED); + statusList.add(SettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleSheet.class) + .eq(SettleSheet::getId, sheet.getId()).in(SettleSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商结算单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleSheetDetail::getOrderNo); + List details = settleSheetDetailService.list(queryDetailWrapper); + for (SettleSheetDetail detail : details) { + settleCheckSheetService.setSettleAmount(detail.getBizId(), detail.getPayAmount(), + detail.getDiscountAmount()); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = ApprovePassOrderTimeLineBizType.class, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettleSheetVo vo) { + + SettleSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettleSheetVo approveVo = new ApprovePassSettleSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.class, name = "审核拒绝供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = ApproveReturnOrderTimeLineBizType.class, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettleSheetVo vo) { + + SettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED) { + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商结算单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettleSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商结算单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商结算单无法审核拒绝!"); + } + + sheet.setStatus(SettleSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettleSheetStatus.CREATED); + statusList.add(SettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleSheet.class) + .eq(SettleSheet::getId, sheet.getId()).in(SettleSheet::getStatus, statusList); + if (getBaseMapper().update(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.class, name = "删除供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettleSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED + && sheet.getStatus() != SettleSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商结算单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商结算单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleSheetDetail::getOrderNo); + List sheetDetails = settleSheetDetailService.list(queryDetailWrapper); + for (SettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()); + settleSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + Wrapper deleteWrapper = Wrappers.lambdaUpdate(SettleSheet.class) + .eq(SettleSheet::getId, id) + .in(SettleSheet::getStatus, SettleSheetStatus.CREATED, SettleSheetStatus.APPROVE_REFUSE); + if (!remove(deleteWrapper)) { + throw new DefaultClientException("供应商结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Override + public SettleBizItemDto getBizItem(String id) { + + SettleCheckSheet checkSheet = settleCheckSheetService.getById(id); + + SettleBizItemDto result = new SettleBizItemDto(); + result.setId(checkSheet.getId()); + result.setCode(checkSheet.getCode()); + result.setTotalPayAmount(checkSheet.getTotalPayAmount()); + result.setTotalPayedAmount(checkSheet.getTotalPayedAmount()); + result.setTotalDiscountAmount(checkSheet.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(checkSheet.getTotalPayAmount(), checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount())); + result.setApproveTime(checkSheet.getApproveTime()); + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id) { + + SettleCheckSheet item = settleCheckSheetService.getById(id); + int count = settleCheckSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id) { + + SettleCheckSheet item = settleCheckSheetService.getById(id); + int count = settleCheckSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id) { + + SettleCheckSheet item = settleCheckSheetService.getById(id); + int count = settleCheckSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,无法重复结算!"); + } + } + + @Override + public List getUnSettleBizItems(QueryUnSettleBizItemVo vo) { + + List results = new ArrayList<>(); + + List sheetList = settleCheckSheetService.getApprovedList(vo.getSupplierId(), + vo.getStartTime(), vo.getEndTime()); + + if (!CollectionUtil.isEmpty(sheetList)) { + for (SettleCheckSheet item : sheetList) { + SettleBizItemDto result = new SettleBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalPayAmount(item.getTotalPayAmount()); + result.setTotalPayedAmount(item.getTotalPayedAmount()); + result.setTotalDiscountAmount(item.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(item.getTotalPayAmount(), item.getTotalPayedAmount(), + item.getTotalDiscountAmount())); + result.setApproveTime(item.getApproveTime()); + + results.add(result); + } + } + + return results; + } + + private void create(SettleSheet sheet, CreateSettleSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalDiscountAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SettleSheetItemVo itemVo : vo.getItems()) { + SettleBizItemDto item = this.getBizItem(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + + if (NumberUtil.lt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额不允许大于0!"); + } + + if (NumberUtil.gt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许大于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额、优惠金额不能同时等于0!"); + } + + if (NumberUtil.gt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException( + "第" + orderNo + "行实付金额与优惠金额相加不允许小于未付款金额!"); + } + } else if (NumberUtil.gt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额不允许小于0!"); + } + + if (NumberUtil.lt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许小于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额、优惠金额不能同时等于0!"); + } + if (NumberUtil.lt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException( + "第" + orderNo + "行实付金额与优惠金额相加不允许大于未付款金额!"); + } + } else { + // 单据应付款等于0 + if (!NumberUtil.equal(itemVo.getPayAmount(), 0) || !NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额、优惠金额必须同时等于0!"); + } + } + + SettleSheetDetail detail = new SettleSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDiscountAmount(itemVo.getDiscountAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + settleSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, itemVo.getPayAmount()); + totalDiscountAmount = NumberUtil.add(totalDiscountAmount, itemVo.getDiscountAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalDiscountAmount(totalDiscountAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetDetailMapper.java new file mode 100644 index 0000000..da15b34 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetDetailMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettleCheckSheetDetailMapper extends + BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetMapper.java new file mode 100644 index 0000000..8c16147 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetMapper.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerSettleCheckSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettleCheckSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleCheckSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetDetailMapper.java new file mode 100644 index 0000000..b1d2115 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetDetailMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface CustomerSettleFeeSheetDetailMapper extends + BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetMapper.java new file mode 100644 index 0000000..3b6d605 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.customer.QueryCustomerSettleFeeSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface CustomerSettleFeeSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleFeeSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetDetailMapper.java new file mode 100644 index 0000000..c13df19 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetDetailMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettlePreSheetDetailMapper extends + BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetMapper.java new file mode 100644 index 0000000..8758360 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.customer.QueryCustomerSettlePreSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettlePreSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettlePreSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetDetailMapper.java new file mode 100644 index 0000000..1c7ca60 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface CustomerSettleSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetMapper.java new file mode 100644 index 0000000..8fbbf02 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetMapper.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerSettleSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface CustomerSettleSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleSheetFullDto getDetail(String id); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetDetailMapper.java new file mode 100644 index 0000000..5db1055 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettleCheckSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetMapper.java new file mode 100644 index 0000000..ce1acfb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetMapper.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.vo.check.QuerySettleCheckSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettleCheckSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleCheckSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetDetailMapper.java new file mode 100644 index 0000000..22a0442 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface SettleFeeSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetMapper.java new file mode 100644 index 0000000..ed17195 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.QuerySettleFeeSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface SettleFeeSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleFeeSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleInItemMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleInItemMapper.java new file mode 100644 index 0000000..c083b68 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleInItemMapper.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-28 + */ +public interface SettleInItemMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QuerySettleInItemVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SettleInItemSelectorVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleOutItemMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleOutItemMapper.java new file mode 100644 index 0000000..1f29953 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleOutItemMapper.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-28 + */ +public interface SettleOutItemMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QuerySettleOutItemVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SettleOutItemSelectorVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetDetailMapper.java new file mode 100644 index 0000000..4ae7375 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettlePreSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetMapper.java new file mode 100644 index 0000000..352b9a0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.QuerySettlePreSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettlePreSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettlePreSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetDetailMapper.java new file mode 100644 index 0000000..5150405 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface SettleSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetMapper.java new file mode 100644 index 0000000..6fe86b8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetMapper.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.core.annotations.permission.DataPermission; +import com.lframework.starter.web.core.annotations.permission.DataPermissions; +import com.lframework.starter.web.core.annotations.sort.Sort; +import com.lframework.starter.web.core.annotations.sort.Sorts; +import com.lframework.starter.web.core.mapper.BaseMapper; +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.vo.sheet.QuerySettleSheetVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface SettleSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleSheetFullDto getDetail(String id); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetDetailService.java new file mode 100644 index 0000000..6a9d4fd --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; + +public interface CustomerSettleCheckSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetService.java new file mode 100644 index 0000000..a557ef3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetService.java @@ -0,0 +1,171 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.vo.check.customer.*; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +public interface CustomerSettleCheckSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleCheckSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleCheckSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettleCheckSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettleCheckSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettleCheckSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettleCheckSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettleCheckSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 查询业务单据 + * + * @param id + * @param bizType + * @return + */ + CustomerSettleCheckBizItemDto getBizItem(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 更新业务单据未结算 + * + * @param id + * @param bizType + */ + void setBizItemUnSettle(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 更新业务单据结算中 + * + * @param id + * @param bizType + */ + void setBizItemPartSettle(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 更新业务单据已结算 + * + * @param id + * @param bizType + */ + void setBizItemSettled(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 查询未对账单据 + * + * @param vo + * @return + */ + List getUnCheckBizItems(QueryCustomerUnCheckBizItemVo vo); + + /** + * 更新结算状态-未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 更新结算状态-结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 更新结算状态-已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime); + + /** + * 设置结算金额 + * + * @param id + * @param totalPayedAmount + * @param totalDiscountAmount + */ + void setSettleAmount(String id, BigDecimal totalPayedAmount, BigDecimal totalDiscountAmount); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetDetailService.java new file mode 100644 index 0000000..22d5f6e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; + +public interface CustomerSettleFeeSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetService.java new file mode 100644 index 0000000..57d3114 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetService.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.customer.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface CustomerSettleFeeSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleFeeSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleFeeSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettleFeeSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettleFeeSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettleFeeSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettleFeeSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettleFeeSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetDetailService.java new file mode 100644 index 0000000..ad605cb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; + +public interface CustomerSettlePreSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetService.java new file mode 100644 index 0000000..068f810 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetService.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.customer.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface CustomerSettlePreSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettlePreSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettlePreSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettlePreSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettlePreSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettlePreSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettlePreSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettlePreSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetDetailService.java new file mode 100644 index 0000000..3c8e579 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; + +public interface CustomerSettleSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetService.java new file mode 100644 index 0000000..78e6940 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetService.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.vo.sheet.customer.*; + +import java.util.List; + +public interface CustomerSettleSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettleSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettleSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettleSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettleSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettleSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 查询业务单据 + * + * @param id + * @return + */ + CustomerSettleBizItemDto getBizItem(String id); + + /** + * 更新业务单据未结算 + * + * @param id + */ + void setBizItemUnSettle(String id); + + /** + * 更新业务单据结算中 + * + * @param id + */ + void setBizItemPartSettle(String id); + + /** + * 更新业务单据已结算 + * + * @param id + */ + void setBizItemSettled(String id); + + /** + * 查询未结算单据 + * + * @param vo + * @return + */ + List getUnSettleBizItems(QueryCustomerUnSettleBizItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetDetailService.java new file mode 100644 index 0000000..92eacb6 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; + +public interface SettleCheckSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetService.java new file mode 100644 index 0000000..1607ac8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetService.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.vo.check.*; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +public interface SettleCheckSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleCheckSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleCheckSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleCheckSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleCheckSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettleCheckSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettleCheckSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettleCheckSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 查询业务单据 + * + * @param id + * @param bizType + * @return + */ + SettleCheckBizItemDto getBizItem(String id, SettleCheckSheetBizType bizType); + + /** + * 更新业务单据未结算 + * + * @param id + * @param bizType + */ + void setBizItemUnSettle(String id, SettleCheckSheetBizType bizType); + + /** + * 更新业务单据结算中 + * + * @param id + * @param bizType + */ + void setBizItemPartSettle(String id, SettleCheckSheetBizType bizType); + + /** + * 更新业务单据已结算 + * + * @param id + * @param bizType + */ + void setBizItemSettled(String id, SettleCheckSheetBizType bizType); + + /** + * 查询未对账单据 + * + * @param vo + * @return + */ + List getUnCheckBizItems(QueryUnCheckBizItemVo vo); + + /** + * 更新结算状态-未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 更新结算状态-结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 更新结算状态-已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime); + + /** + * 设置结算金额 + * + * @param id + * @param totalPayedAmount + * @param totalDiscountAmount + */ + void setSettleAmount(String id, BigDecimal totalPayedAmount, BigDecimal totalDiscountAmount); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetDetailService.java new file mode 100644 index 0000000..bf007cd --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; + +public interface SettleFeeSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetService.java new file mode 100644 index 0000000..d8fe9b1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetService.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface SettleFeeSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleFeeSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleFeeSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleFeeSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleFeeSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettleFeeSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettleFeeSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettleFeeSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleInItemService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleInItemService.java new file mode 100644 index 0000000..170e7f1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleInItemService.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.vo.item.in.CreateSettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.in.UpdateSettleInItemVo; + +import java.util.List; + +public interface SettleInItemService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleInItemVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleInItemVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SettleInItemSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleInItem findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleInItemVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleInItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleOutItemService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleOutItemService.java new file mode 100644 index 0000000..cff892c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleOutItemService.java @@ -0,0 +1,69 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.vo.item.out.CreateSettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.out.UpdateSettleOutItemVo; + +import java.util.List; + +public interface SettleOutItemService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleOutItemVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleOutItemVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SettleOutItemSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleOutItem findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleOutItemVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleOutItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetDetailService.java new file mode 100644 index 0000000..a2258d3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; + +public interface SettlePreSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetService.java new file mode 100644 index 0000000..0a56d54 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetService.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface SettlePreSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettlePreSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettlePreSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettlePreSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettlePreSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettlePreSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettlePreSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettlePreSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetDetailService.java new file mode 100644 index 0000000..86d05dc --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; + +public interface SettleSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetService.java new file mode 100644 index 0000000..a722e93 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetService.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.core.components.resp.PageResult; +import com.lframework.starter.web.core.service.BaseMpService; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.vo.sheet.*; + +import java.util.List; + +public interface SettleSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettleSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettleSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettleSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 查询业务单据 + * + * @param id + * @return + */ + SettleBizItemDto getBizItem(String id); + + /** + * 更新业务单据未结算 + * + * @param id + */ + void setBizItemUnSettle(String id); + + /** + * 更新业务单据结算中 + * + * @param id + */ + void setBizItemPartSettle(String id); + + /** + * 更新业务单据已结算 + * + * @param id + */ + void setBizItemSettled(String id); + + /** + * 查询未结算单据 + * + * @param vo + * @return + */ + List getUnSettleBizItems(QueryUnSettleBizItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApprovePassSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApprovePassSettleCheckSheetVo.java new file mode 100644 index 0000000..5130f94 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApprovePassSettleCheckSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApproveRefuseSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApproveRefuseSettleCheckSheetVo.java new file mode 100644 index 0000000..aee5c32 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApproveRefuseSettleCheckSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/CreateSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/CreateSettleCheckSheetVo.java new file mode 100644 index 0000000..3c1757b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/CreateSettleCheckSheetVo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @Schema(description = "起始日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @Schema(description = "截止日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettleCheckSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行业务单据不能为空!"); + } + + if (item.getBizType() == null) { + throw new InputErrorException("第" + orderNo + "行业务类型不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行应付金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QuerySettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QuerySettleCheckSheetVo.java new file mode 100644 index 0000000..d8f1167 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QuerySettleCheckSheetVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySettleCheckSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettleCheckSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QueryUnCheckBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QueryUnCheckBizItemVo.java new file mode 100644 index 0000000..f15e428 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QueryUnCheckBizItemVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryUnCheckBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @Schema(description = "截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/SettleCheckSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/SettleCheckSheetItemVo.java new file mode 100644 index 0000000..4abc08c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/SettleCheckSheetItemVo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SettleCheckSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + @IsEnum(message = "业务类型格式不正确!", enumClass = SettleCheckSheetBizType.class) + private Integer bizType; + + /** + * 应付金额 + */ + @Schema(description = "应付金额") + private BigDecimal payAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/UpdateSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/UpdateSettleCheckSheetVo.java new file mode 100644 index 0000000..af33d40 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/UpdateSettleCheckSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.check; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleCheckSheetVo extends CreateSettleCheckSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApprovePassCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApprovePassCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..86c2044 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApprovePassCustomerSettleCheckSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApproveRefuseCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApproveRefuseCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..e0d9c63 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApproveRefuseCustomerSettleCheckSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CreateCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CreateCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..575a496 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CreateCustomerSettleCheckSheetVo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @Schema(description = "起始日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @Schema(description = "截止日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettleCheckSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行业务单据不能为空!"); + } + + if (item.getBizType() == null) { + throw new InputErrorException("第" + orderNo + "行业务类型不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行应收金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CustomerSettleCheckSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CustomerSettleCheckSheetItemVo.java new file mode 100644 index 0000000..210d497 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CustomerSettleCheckSheetItemVo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CustomerSettleCheckSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 业务类型 + */ + @Schema(description = "业务类型") + @IsEnum(message = "业务类型格式不正确!", enumClass = CustomerSettleCheckSheetBizType.class) + private Integer bizType; + + /** + * 应收金额 + */ + @Schema(description = "应收金额") + private BigDecimal payAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..0a42a77 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerSettleCheckSheetVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettleCheckSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettleCheckSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerUnCheckBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerUnCheckBizItemVo.java new file mode 100644 index 0000000..02d75cf --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerUnCheckBizItemVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryCustomerUnCheckBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @Schema(description = "截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/UpdateCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/UpdateCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..06a5f81 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/UpdateCustomerSettleCheckSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettleCheckSheetVo extends CreateCustomerSettleCheckSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApprovePassSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApprovePassSettleFeeSheetVo.java new file mode 100644 index 0000000..f7f52e7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApprovePassSettleFeeSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApproveRefuseSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApproveRefuseSettleFeeSheetVo.java new file mode 100644 index 0000000..a5fb6f5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApproveRefuseSettleFeeSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/CreateSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/CreateSettleFeeSheetVo.java new file mode 100644 index 0000000..54b07c6 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/CreateSettleFeeSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 收支方式 + */ + @Schema(description = "收支方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "收支方式不能为空!") + @IsEnum(message = "收支方式不能为空!", enumClass = SettleFeeSheetType.class) + private Integer sheetType; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettleFeeSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/QuerySettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/QuerySettleFeeSheetVo.java new file mode 100644 index 0000000..cdd728d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/QuerySettleFeeSheetVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySettleFeeSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettleFeeSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/SettleFeeSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/SettleFeeSheetItemVo.java new file mode 100644 index 0000000..a78d679 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/SettleFeeSheetItemVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SettleFeeSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String id; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/UpdateSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/UpdateSettleFeeSheetVo.java new file mode 100644 index 0000000..1e095ba --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/UpdateSettleFeeSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.fee; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleFeeSheetVo extends CreateSettleFeeSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApprovePassCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApprovePassCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..83ccab8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApprovePassCustomerSettleFeeSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApproveRefuseCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApproveRefuseCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..8f5877c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApproveRefuseCustomerSettleFeeSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CreateCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CreateCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..b65bbea --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CreateCustomerSettleFeeSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 收支方式 + */ + @Schema(description = "收支方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "收支方式不能为空!") + @IsEnum(message = "收支方式不能为空!", enumClass = CustomerSettleFeeSheetType.class) + private Integer sheetType; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettleFeeSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CustomerSettleFeeSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CustomerSettleFeeSheetItemVo.java new file mode 100644 index 0000000..4d6992f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CustomerSettleFeeSheetItemVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CustomerSettleFeeSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String id; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/QueryCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/QueryCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..0c93cb0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/QueryCustomerSettleFeeSheetVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettleFeeSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettleFeeSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/UpdateCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/UpdateCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..d70910f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/UpdateCustomerSettleFeeSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettleFeeSheetVo extends CreateCustomerSettleFeeSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/CreateSettleInItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/CreateSettleInItemVo.java new file mode 100644 index 0000000..00df717 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/CreateSettleInItemVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateSettleInItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/QuerySettleInItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/QuerySettleInItemVo.java new file mode 100644 index 0000000..2175c1e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/QuerySettleInItemVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QuerySettleInItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/SettleInItemSelectorVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/SettleInItemSelectorVo.java new file mode 100644 index 0000000..1730ec1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/SettleInItemSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SettleInItemSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/UpdateSettleInItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/UpdateSettleInItemVo.java new file mode 100644 index 0000000..cdc3271 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/UpdateSettleInItemVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateSettleInItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/CreateSettleOutItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/CreateSettleOutItemVo.java new file mode 100644 index 0000000..c37f015 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/CreateSettleOutItemVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateSettleOutItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/QuerySettleOutItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/QuerySettleOutItemVo.java new file mode 100644 index 0000000..d368cfb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/QuerySettleOutItemVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QuerySettleOutItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/SettleOutItemSelectorVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/SettleOutItemSelectorVo.java new file mode 100644 index 0000000..57c8c5a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/SettleOutItemSelectorVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.core.vo.BaseVo; +import com.lframework.starter.web.core.vo.PageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SettleOutItemSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @Schema(description = "编号") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/UpdateSettleOutItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/UpdateSettleOutItemVo.java new file mode 100644 index 0000000..2b199fb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/UpdateSettleOutItemVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.core.components.validation.IsCode; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UpdateSettleOutItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApprovePassSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApprovePassSettlePreSheetVo.java new file mode 100644 index 0000000..1ec65c5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApprovePassSettlePreSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApproveRefuseSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApproveRefuseSettlePreSheetVo.java new file mode 100644 index 0000000..3c2130f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApproveRefuseSettlePreSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/CreateSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/CreateSettlePreSheetVo.java new file mode 100644 index 0000000..c5d912c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/CreateSettlePreSheetVo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettlePreSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/QuerySettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/QuerySettlePreSheetVo.java new file mode 100644 index 0000000..cfd1a10 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/QuerySettlePreSheetVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySettlePreSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettlePreSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/SettlePreSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/SettlePreSheetItemVo.java new file mode 100644 index 0000000..1ef9f46 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/SettlePreSheetItemVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SettlePreSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String id; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/UpdateSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/UpdateSettlePreSheetVo.java new file mode 100644 index 0000000..8b6911f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/UpdateSettlePreSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.pre; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettlePreSheetVo extends CreateSettlePreSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApprovePassCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApprovePassCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..1f0be3e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApprovePassCustomerSettlePreSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApproveRefuseCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApproveRefuseCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..3c997b2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApproveRefuseCustomerSettlePreSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CreateCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CreateCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..a1327f6 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CreateCustomerSettlePreSheetVo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class CreateCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettlePreSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CustomerSettlePreSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CustomerSettlePreSheetItemVo.java new file mode 100644 index 0000000..33f94e8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CustomerSettlePreSheetItemVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CustomerSettlePreSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @Schema(description = "项目ID") + private String id; + + /** + * 金额 + */ + @Schema(description = "金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/QueryCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/QueryCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..f2c5fce --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/QueryCustomerSettlePreSheetVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettlePreSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettlePreSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @Schema(description = "结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/UpdateCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/UpdateCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..1ac4b94 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/UpdateCustomerSettlePreSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettlePreSheetVo extends CreateCustomerSettlePreSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApprovePassSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApprovePassSettleSheetVo.java new file mode 100644 index 0000000..44d557c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApprovePassSettleSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApproveRefuseSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApproveRefuseSettleSheetVo.java new file mode 100644 index 0000000..d6c06e1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApproveRefuseSettleSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/CreateSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/CreateSettleSheetVo.java new file mode 100644 index 0000000..daa88ca --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/CreateSettleSheetVo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @Schema(description = "起始日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @Schema(description = "截止日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettleSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行对账单不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行实付金额不能为空!"); + } + + if (item.getDiscountAmount() == null) { + throw new InputErrorException("第" + orderNo + "行优惠金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QuerySettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QuerySettleSheetVo.java new file mode 100644 index 0000000..302ba60 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QuerySettleSheetVo.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QuerySettleSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettleSheetStatus.class) + private Integer status; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QueryUnSettleBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QueryUnSettleBizItemVo.java new file mode 100644 index 0000000..32a1fac --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QueryUnSettleBizItemVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryUnSettleBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @Schema(description = "截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/SettleSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/SettleSheetItemVo.java new file mode 100644 index 0000000..bd77e0b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/SettleSheetItemVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class SettleSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 实付金额 + */ + @Schema(description = "实付金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal discountAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/UpdateSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/UpdateSettleSheetVo.java new file mode 100644 index 0000000..53834de --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/UpdateSettleSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleSheetVo extends CreateSettleSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApprovePassCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApprovePassCustomerSettleSheetVo.java new file mode 100644 index 0000000..a630e2f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApprovePassCustomerSettleSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApprovePassCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApproveRefuseCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApproveRefuseCustomerSettleSheetVo.java new file mode 100644 index 0000000..44c2912 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApproveRefuseCustomerSettleSheetVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApproveRefuseCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @Schema(description = "拒绝理由", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CreateCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CreateCustomerSettleSheetVo.java new file mode 100644 index 0000000..3608d2b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CreateCustomerSettleSheetVo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + +@Data +public class CreateCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 项目 + */ + @Schema(description = "项目", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @Schema(description = "起始日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @Schema(description = "截止日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettleSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行对账单不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行实收金额不能为空!"); + } + + if (item.getDiscountAmount() == null) { + throw new InputErrorException("第" + orderNo + "行优惠金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CustomerSettleSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CustomerSettleSheetItemVo.java new file mode 100644 index 0000000..2a10bdf --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CustomerSettleSheetItemVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class CustomerSettleSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @Schema(description = "单据ID") + private String id; + + /** + * 实收金额 + */ + @Schema(description = "实收金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @Schema(description = "优惠金额") + private BigDecimal discountAmount; + + /** + * 备注 + */ + @Schema(description = "备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerSettleSheetVo.java new file mode 100644 index 0000000..4098d8f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerSettleSheetVo.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.core.components.validation.IsEnum; +import com.lframework.starter.web.core.vo.PageVo; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class QueryCustomerSettleSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @Schema(description = "业务单据号") + private String code; + + /** + * 客户ID + */ + @Schema(description = "客户ID") + private String customerId; + + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @Schema(description = "创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @Schema(description = "创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @Schema(description = "审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @Schema(description = "审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @Schema(description = "审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettleSheetStatus.class) + private Integer status; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerUnSettleBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerUnSettleBizItemVo.java new file mode 100644 index 0000000..2344722 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerUnSettleBizItemVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.core.vo.BaseVo; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class QueryCustomerUnSettleBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 起始时间 + */ + @Schema(description = "起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @Schema(description = "截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/UpdateCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/UpdateCustomerSettleSheetVo.java new file mode 100644 index 0000000..022ffa9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/UpdateCustomerSettleSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettleSheetVo extends CreateCustomerSettleSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/lombok.config b/xingyun-settle/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-settle/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettleCheckSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettleCheckSheetMapper.xml new file mode 100644 index 0000000..5dfd3da --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettleCheckSheetMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM customer_settle_check_sheet AS s + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.biz_type AS detail_biz_type, + d.calc_type AS detail_calc_type, + d.pay_amount AS detail_pay_amount, + d.description AS detail_description + FROM customer_settle_check_sheet AS s + LEFT JOIN customer_settle_check_sheet_detail AS d ON d.sheet_id = s.id + + diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettleFeeSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettleFeeSheetMapper.xml new file mode 100644 index 0000000..3737952 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettleFeeSheetMapper.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM customer_settle_fee_sheet AS s + + + SELECT s.id, + s.code, + s.customer_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM customer_settle_fee_sheet AS s + LEFT JOIN customer_settle_fee_sheet_detail AS d ON d.sheet_id = s.id + + diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettlePreSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettlePreSheetMapper.xml new file mode 100644 index 0000000..480df8d --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettlePreSheetMapper.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM customer_settle_pre_sheet AS s + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM customer_settle_pre_sheet AS s + LEFT JOIN customer_settle_pre_sheet_detail AS d ON d.sheet_id = s.id + + diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettleSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettleSheetMapper.xml new file mode 100644 index 0000000..597c250 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettleSheetMapper.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.pay_amount AS detail_pay_amount, + d.discount_amount AS detail_discount_amount, + d.description AS detail_description + FROM customer_settle_sheet AS s + LEFT JOIN customer_settle_sheet_detail AS d ON d.sheet_id = s.id + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason + FROM customer_settle_sheet AS s + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleCheckSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleCheckSheetMapper.xml new file mode 100644 index 0000000..2387483 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleCheckSheetMapper.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM settle_check_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.biz_type AS detail_biz_type, + d.calc_type AS detail_calc_type, + d.pay_amount AS detail_pay_amount, + d.description AS detail_description + FROM settle_check_sheet AS s + LEFT JOIN settle_check_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleFeeSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleFeeSheetMapper.xml new file mode 100644 index 0000000..1f6f616 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleFeeSheetMapper.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM settle_fee_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM settle_fee_sheet AS s + LEFT JOIN settle_fee_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleInItemMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleInItemMapper.xml new file mode 100644 index 0000000..ecd29d5 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleInItemMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM settle_in_item + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleOutItemMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleOutItemMapper.xml new file mode 100644 index 0000000..3c76b77 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleOutItemMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM settle_out_item + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettlePreSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettlePreSheetMapper.xml new file mode 100644 index 0000000..1d02cdb --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettlePreSheetMapper.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM settle_pre_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM settle_pre_sheet AS s + LEFT JOIN settle_pre_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleSheetMapper.xml new file mode 100644 index 0000000..70990df --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleSheetMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason + FROM settle_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.pay_amount AS detail_pay_amount, + d.discount_amount AS detail_discount_amount, + d.description AS detail_description + FROM settle_sheet AS s + LEFT JOIN settle_sheet_detail AS d ON d.sheet_id = s.id + + + + + +