From 4bdf2bf032d949b8d3f7fb289d75fb7410b9d3c9 Mon Sep 17 00:00:00 2001
From: pj7zf6ina <1552567007@qq.com>
Date: Thu, 13 Mar 2025 12:38:42 +0800
Subject: [PATCH 01/11] Initial commit
---
README.md | 2 +
.../.gitee/ISSUE_TEMPLATE.zh-CN.md | 13 +
.../.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 15 +
warehouseManager-developer/.idea/.gitignore | 8 +
.../.idea/dataSources.xml | 31 +
.../.idea/libraries/WMS.xml | 13 +
warehouseManager-developer/.idea/misc.xml | 7 +
warehouseManager-developer/.idea/modules.xml | 8 +
.../.idea/sqldialects.xml | 6 +
.../.idea/warehouseManager-developer.iml | 10 +
.../.idea/webContexts.xml | 10 +
warehouseManager-developer/LICENSE | 201 +
warehouseManager-developer/README.md | 112 +
warehouseManager-developer/WMS/.gitignore | 8 +
warehouseManager-developer/WMS/pom.xml | 318 +
.../WMS/sql/createtable.sql | 224 +
.../controller/CustomerManageHandler.java | 278 +
.../common/controller/FileSourceHandler.java | 44 +
.../common/controller/GoodsManageHandler.java | 277 +
.../RepositoryAdminManageHandler.java | 288 +
.../controller/RepositoryManageHandler.java | 309 +
.../controller/StockRecordManageHandler.java | 210 +
.../controller/StorageManageHandler.java | 364 +
.../controller/SupplierManageHandler.java | 272 +
.../common/controller/SystemLogHandler.java | 136 +
.../Impl/CustomerManageServiceImpl.java | 338 +
.../service/Impl/GoodsManageServiceImpl.java | 348 +
.../RepositoryAdminManageServiceImpl.java | 405 +
.../Impl/RepositoryManageServiceImpl.java | 377 +
.../Impl/StockRecordManageServiceImpl.java | 443 ++
.../Impl/StorageManageServiceImpl.java | 514 ++
.../Impl/SupplierManageServiceImpl.java | 333 +
.../service/Impl/SystemLogServiceImpl.java | 292 +
.../Interface/CustomerManageService.java | 101 +
.../service/Interface/GoodsManageService.java | 101 +
.../RepositoryAdminManageService.java | 118 +
.../service/Interface/RepositoryService.java | 108 +
.../Interface/StockRecordManageService.java | 58 +
.../Interface/StorageManageService.java | 153 +
.../Interface/SupplierManageService.java | 101 +
.../service/Interface/SystemLogService.java | 81 +
.../com/ken/wms/common/util/EJConvertor.java | 684 ++
.../com/ken/wms/common/util/FileUtil.java | 27 +
.../com/ken/wms/common/util/Response.java | 78 +
.../ken/wms/common/util/ResponseFactory.java | 18 +
.../com/ken/wms/dao/AccessRecordMapper.java | 36 +
.../com/ken/wms/dao/AccessRecordMapper.xml | 46 +
.../java/com/ken/wms/dao/CustomerMapper.java | 72 +
.../java/com/ken/wms/dao/CustomerMapper.xml | 106 +
.../java/com/ken/wms/dao/GoodsMapper.java | 73 +
.../main/java/com/ken/wms/dao/GoodsMapper.xml | 100 +
.../ken/wms/dao/RepositoryAdminMapper.java | 64 +
.../com/ken/wms/dao/RepositoryAdminMapper.xml | 107 +
.../com/ken/wms/dao/RepositoryMapper.java | 63 +
.../java/com/ken/wms/dao/RepositoryMapper.xml | 105 +
.../com/ken/wms/dao/RolePermissionMapper.java | 14 +
.../com/ken/wms/dao/RolePermissionMapper.xml | 23 +
.../java/com/ken/wms/dao/RolesMapper.java | 15 +
.../main/java/com/ken/wms/dao/RolesMapper.xml | 16 +
.../java/com/ken/wms/dao/StockInMapper.java | 87 +
.../java/com/ken/wms/dao/StockInMapper.xml | 163 +
.../java/com/ken/wms/dao/StockOutMapper.java | 86 +
.../java/com/ken/wms/dao/StockOutMapper.xml | 163 +
.../java/com/ken/wms/dao/StorageMapper.java | 83 +
.../java/com/ken/wms/dao/StorageMapper.xml | 168 +
.../java/com/ken/wms/dao/SupplierMapper.java | 74 +
.../java/com/ken/wms/dao/SupplierMapper.xml | 106 +
.../java/com/ken/wms/dao/UserInfoMapper.java | 61 +
.../java/com/ken/wms/dao/UserInfoMapper.xml | 68 +
.../wms/dao/UserOperationRecordMapper.java | 34 +
.../ken/wms/dao/UserOperationRecordMapper.xml | 42 +
.../com/ken/wms/dao/UserPermissionMapper.java | 33 +
.../com/ken/wms/dao/UserPermissionMapper.xml | 35 +
.../com/ken/wms/domain/AccessRecordDO.java | 103 +
.../com/ken/wms/domain/AccessRecordDTO.java | 101 +
.../java/com/ken/wms/domain/Customer.java | 73 +
.../main/java/com/ken/wms/domain/Goods.java | 62 +
.../java/com/ken/wms/domain/Repository.java | 82 +
.../com/ken/wms/domain/RepositoryAdmin.java | 84 +
.../main/java/com/ken/wms/domain/RoleDO.java | 48 +
.../com/ken/wms/domain/RolePermissionDO.java | 64 +
.../java/com/ken/wms/domain/StockInDO.java | 137 +
.../java/com/ken/wms/domain/StockOutDO.java | 137 +
.../com/ken/wms/domain/StockRecordDTO.java | 129 +
.../main/java/com/ken/wms/domain/Storage.java | 83 +
.../java/com/ken/wms/domain/Supplier.java | 73 +
.../main/java/com/ken/wms/domain/User.java | 44 +
.../java/com/ken/wms/domain/UserInfoDO.java | 76 +
.../java/com/ken/wms/domain/UserInfoDTO.java | 119 +
.../ken/wms/domain/UserOperationRecordDO.java | 102 +
.../wms/domain/UserOperationRecordDTO.java | 101 +
.../ken/wms/exception/BusinessException.java | 33 +
.../CustomerManageServiceException.java | 21 +
.../GoodsManageServiceException.java | 21 +
...RepositoryAdminManageServiceException.java | 25 +
.../RepositoryManageServiceException.java | 21 +
.../StockRecordManageServiceException.java | 26 +
.../StorageManageServiceException.java | 21 +
.../SupplierManageServiceException.java | 21 +
.../exception/SystemLogServiceException.java | 24 +
.../UserAccountServiceException.java | 28 +
.../exception/UserInfoServiceException.java | 25 +
.../security/controller/AccountHandler.java | 232 +
.../controller/PageForwardHandler.java | 41 +
.../filter/AnyOfRolesAuthorizationFilter.java | 38 +
.../ExtendFormAuthenticationFilter.java | 95 +
.../filter/KickoutSessionControlFilter.java | 151 +
.../security/listener/SessionListener.java | 55 +
.../security/realms/UserAuthorizingRealm.java | 104 +
.../FilterChainDefinitionMapBuilder.java | 95 +
.../service/Impl/AccountServiceImpl.java | 86 +
.../service/Impl/UserInfoServiceImpl.java | 265 +
.../service/Interface/AccountService.java | 20 +
.../service/Interface/UserInfoService.java | 59 +
.../wms/security/util/CaptchaGenerator.java | 101 +
.../com/ken/wms/security/util/MD5Util.java | 39 +
.../ken/wms/util/GlobalExceptionHandler.java | 39 +
.../com/ken/wms/util/aop/ServiceLogging.java | 57 +
.../com/ken/wms/util/aop/UserOperation.java | 17 +
.../wms/util/aop/UserOperationLogging.java | 61 +
.../main/resources/config/DBConfig.properties | 10 +
.../src/main/resources/config/EJConvertor.xsd | 34 +
.../resources/config/EJConvertorConfig.xml | 172 +
.../resources/config/MyBatisConfiguration.xml | 20 +
.../resources/config/ShiroConfiguration.xml | 147 +
.../config/SpringContextConfiguration.xml | 105 +
.../config/SpringMVCConfiguration.xml | 35 +
.../WMS/src/main/resources/config/ehcache.xml | 101 +
.../main/resources/config/log4j.properties | 52 +
.../webapp/WEB-INF/download/customerInfo.xlsx | Bin 0 -> 8680 bytes
.../webapp/WEB-INF/download/goodsInfo.xlsx | Bin 0 -> 8652 bytes
.../WEB-INF/download/repositoryAdminInfo.xlsx | Bin 0 -> 8673 bytes
.../WEB-INF/download/repositoryInfo.xlsx | Bin 0 -> 8652 bytes
.../WEB-INF/download/storageRecord.xlsx | Bin 0 -> 8700 bytes
.../webapp/WEB-INF/download/supplierInfo.xlsx | Bin 0 -> 8651 bytes
.../WMS/src/main/webapp/WEB-INF/jsp/login.jsp | 219 +
.../src/main/webapp/WEB-INF/jsp/mainPage.jsp | 437 ++
.../WMS/src/main/webapp/WEB-INF/web.xml | 79 +
.../css/bootstrap-datetimepicker.min.css | 9 +
.../src/main/webapp/css/bootstrap-table.css | 306 +
.../src/main/webapp/css/bootstrap-theme.css | 587 ++
.../main/webapp/css/bootstrap-theme.css.map | 1 +
.../main/webapp/css/bootstrap-theme.min.css | 5 +
.../WMS/src/main/webapp/css/bootstrap.css | 6800 +++++++++++++++++
.../WMS/src/main/webapp/css/bootstrap.css.map | 1 +
.../WMS/src/main/webapp/css/bootstrap.min.css | 5 +
.../webapp/css/bootstrapValidator.min.css | 11 +
.../WMS/src/main/webapp/css/jquery-ui.css | 630 ++
.../src/main/webapp/css/jquery.mloading.css | 94 +
.../WMS/src/main/webapp/css/mainPage.css | 44 +
.../src/main/webapp/css/model/login/login.css | 11 +
.../src/main/webapp/errorPage/404Error.html | 17 +
.../src/main/webapp/errorPage/500Error.html | 17 +
.../fonts/glyphicons-halflings-regular.eot | Bin 0 -> 20127 bytes
.../fonts/glyphicons-halflings-regular.svg | 288 +
.../fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 45404 bytes
.../fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23424 bytes
.../fonts/glyphicons-halflings-regular.woff2 | Bin 0 -> 18028 bytes
.../WMS/src/main/webapp/js/ajaxfileupload.js | 225 +
.../webapp/js/bootstrap-datetimepicker.min.js | 1 +
.../js/bootstrap-datetimepicker.zh-CN.js | 16 +
.../webapp/js/bootstrap-table-zh-CN.min.js | 7 +
.../src/main/webapp/js/bootstrap-table.min.js | 8 +
.../WMS/src/main/webapp/js/bootstrap.js | 2363 ++++++
.../WMS/src/main/webapp/js/bootstrap.min.js | 7 +
.../main/webapp/js/bootstrapValidator.min.js | 12 +
.../src/main/webapp/js/jquery-2.2.3.min.js | 4 +
.../WMS/src/main/webapp/js/jquery-ui.min.js | 6 +
.../WMS/src/main/webapp/js/jquery.md5.js | 229 +
.../WMS/src/main/webapp/js/jquery.mloading.js | 202 +
.../WMS/src/main/webapp/js/mainPage.js | 226 +
.../WMS/src/main/webapp/js/npm.js | 13 +
.../WMS/src/main/webapp/js/zh_CN.js | 334 +
.../main/webapp/media/icons/error-icon.png | Bin 0 -> 5099 bytes
.../main/webapp/media/icons/stock_in-512.png | Bin 0 -> 7761 bytes
.../main/webapp/media/icons/stock_out-512.png | Bin 0 -> 7888 bytes
.../webapp/media/icons/stock_search-512.png | Bin 0 -> 8247 bytes
.../main/webapp/media/icons/success-icon.png | Bin 0 -> 4387 bytes
.../main/webapp/media/icons/warning-icon.png | Bin 0 -> 2598 bytes
.../WMS/src/main/webapp/media/images/404.jpg | Bin 0 -> 9049 bytes
.../WMS/src/main/webapp/media/images/500.jpg | Bin 0 -> 11482 bytes
.../webapp/media/images/backgroundPic.png | Bin 0 -> 464400 bytes
.../pagecomponent/accessRecordManagement.jsp | 148 +
.../pagecomponent/customerManagement.jsp | 902 +++
.../webapp/pagecomponent/goodsManagement.jsp | 850 +++
.../pagecomponent/passwordModification.jsp | 197 +
.../repositoryAdminManagement.jsp | 978 +++
.../pagecomponent/repositoryManagement.jsp | 866 +++
.../pagecomponent/stock-inManagement.jsp | 563 ++
.../stock-inManagementCommon.jsp | 544 ++
.../pagecomponent/stock-outManagement.jsp | 558 ++
.../stock-outManagementCommon.jsp | 546 ++
.../pagecomponent/stockRecordManagement.jsp | 221 +
.../pagecomponent/storageManagement.jsp | 878 +++
.../pagecomponent/storageManagementCommon.jsp | 342 +
.../pagecomponent/supplierManagement.jsp | 902 +++
.../userOperationRecorderManagement.jsp | 133 +
.../main/webapp/pagecomponent/welcomePage.jsp | 58 +
.../src/test/java/com/ken/wms/MapperTest.java | 111 +
.../WMS/src/test/java/com/ken/wms/MyTest.java | 13 +
.../untitled1/.gitignore | 38 +
.../untitled1/.idea/.gitignore | 8 +
.../untitled1/.idea/misc.xml | 14 +
warehouseManager-developer/untitled1/pom.xml | 17 +
204 files changed, 36101 insertions(+)
create mode 100644 README.md
create mode 100644 warehouseManager-developer/.gitee/ISSUE_TEMPLATE.zh-CN.md
create mode 100644 warehouseManager-developer/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
create mode 100644 warehouseManager-developer/.idea/.gitignore
create mode 100644 warehouseManager-developer/.idea/dataSources.xml
create mode 100644 warehouseManager-developer/.idea/libraries/WMS.xml
create mode 100644 warehouseManager-developer/.idea/misc.xml
create mode 100644 warehouseManager-developer/.idea/modules.xml
create mode 100644 warehouseManager-developer/.idea/sqldialects.xml
create mode 100644 warehouseManager-developer/.idea/warehouseManager-developer.iml
create mode 100644 warehouseManager-developer/.idea/webContexts.xml
create mode 100644 warehouseManager-developer/LICENSE
create mode 100644 warehouseManager-developer/README.md
create mode 100644 warehouseManager-developer/WMS/.gitignore
create mode 100644 warehouseManager-developer/WMS/pom.xml
create mode 100644 warehouseManager-developer/WMS/sql/createtable.sql
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/CustomerManageHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/FileSourceHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/GoodsManageHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryAdminManageHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryManageHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StockRecordManageHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StorageManageHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SupplierManageHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SystemLogHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/CustomerManageServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/GoodsManageServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryAdminManageServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryManageServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StockRecordManageServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StorageManageServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/SupplierManageServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/SystemLogServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/CustomerManageService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/GoodsManageService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/RepositoryAdminManageService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/RepositoryService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/StockRecordManageService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/StorageManageService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/SupplierManageService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Interface/SystemLogService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/util/EJConvertor.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/util/FileUtil.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/util/Response.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/util/ResponseFactory.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/AccessRecordMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/AccessRecordMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/CustomerMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/CustomerMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/GoodsMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/GoodsMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RepositoryAdminMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RepositoryAdminMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RepositoryMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RepositoryMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RolePermissionMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RolePermissionMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RolesMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/RolesMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/StockInMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/StockInMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/StockOutMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/StockOutMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/StorageMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/StorageMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/SupplierMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/SupplierMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/UserInfoMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/UserInfoMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/UserOperationRecordMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/UserOperationRecordMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/UserPermissionMapper.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/dao/UserPermissionMapper.xml
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/AccessRecordDO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/AccessRecordDTO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/Customer.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/Goods.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/Repository.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/RepositoryAdmin.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/RoleDO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/RolePermissionDO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/StockInDO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/StockOutDO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/StockRecordDTO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/Storage.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/Supplier.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/User.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/UserInfoDO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/UserInfoDTO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/UserOperationRecordDO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/domain/UserOperationRecordDTO.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/BusinessException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/CustomerManageServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/GoodsManageServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/RepositoryAdminManageServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/RepositoryManageServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/StockRecordManageServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/StorageManageServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/SupplierManageServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/SystemLogServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/UserAccountServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/exception/UserInfoServiceException.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/controller/AccountHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/controller/PageForwardHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/filter/AnyOfRolesAuthorizationFilter.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/filter/ExtendFormAuthenticationFilter.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/filter/KickoutSessionControlFilter.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/listener/SessionListener.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/realms/UserAuthorizingRealm.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/service/FilterChainDefinitionMapBuilder.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/service/Impl/AccountServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/service/Impl/UserInfoServiceImpl.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/service/Interface/AccountService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/service/Interface/UserInfoService.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/util/CaptchaGenerator.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/security/util/MD5Util.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/util/GlobalExceptionHandler.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/util/aop/ServiceLogging.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/util/aop/UserOperation.java
create mode 100644 warehouseManager-developer/WMS/src/main/java/com/ken/wms/util/aop/UserOperationLogging.java
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/DBConfig.properties
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/EJConvertor.xsd
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/EJConvertorConfig.xml
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/MyBatisConfiguration.xml
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/ShiroConfiguration.xml
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/SpringContextConfiguration.xml
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/SpringMVCConfiguration.xml
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/ehcache.xml
create mode 100644 warehouseManager-developer/WMS/src/main/resources/config/log4j.properties
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/download/customerInfo.xlsx
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/download/goodsInfo.xlsx
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/download/repositoryAdminInfo.xlsx
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/download/repositoryInfo.xlsx
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/download/storageRecord.xlsx
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/download/supplierInfo.xlsx
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/jsp/login.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/jsp/mainPage.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/WEB-INF/web.xml
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap-datetimepicker.min.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap-table.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap-theme.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap-theme.css.map
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap-theme.min.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap.css.map
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrap.min.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/bootstrapValidator.min.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/jquery-ui.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/jquery.mloading.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/mainPage.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/css/model/login/login.css
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/errorPage/404Error.html
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/errorPage/500Error.html
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/fonts/glyphicons-halflings-regular.eot
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/fonts/glyphicons-halflings-regular.svg
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/fonts/glyphicons-halflings-regular.ttf
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/fonts/glyphicons-halflings-regular.woff
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/fonts/glyphicons-halflings-regular.woff2
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/ajaxfileupload.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/bootstrap-datetimepicker.min.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/bootstrap-datetimepicker.zh-CN.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/bootstrap-table-zh-CN.min.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/bootstrap-table.min.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/bootstrap.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/bootstrap.min.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/bootstrapValidator.min.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/jquery-2.2.3.min.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/jquery-ui.min.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/jquery.md5.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/jquery.mloading.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/mainPage.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/npm.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/js/zh_CN.js
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/icons/error-icon.png
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/icons/stock_in-512.png
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/icons/stock_out-512.png
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/icons/stock_search-512.png
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/icons/success-icon.png
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/icons/warning-icon.png
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/images/404.jpg
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/images/500.jpg
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/media/images/backgroundPic.png
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/accessRecordManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/customerManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/goodsManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/passwordModification.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/repositoryAdminManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/repositoryManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/stock-inManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/stock-inManagementCommon.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/stock-outManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/stock-outManagementCommon.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/stockRecordManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/storageManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/storageManagementCommon.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/supplierManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/userOperationRecorderManagement.jsp
create mode 100644 warehouseManager-developer/WMS/src/main/webapp/pagecomponent/welcomePage.jsp
create mode 100644 warehouseManager-developer/WMS/src/test/java/com/ken/wms/MapperTest.java
create mode 100644 warehouseManager-developer/WMS/src/test/java/com/ken/wms/MyTest.java
create mode 100644 warehouseManager-developer/untitled1/.gitignore
create mode 100644 warehouseManager-developer/untitled1/.idea/.gitignore
create mode 100644 warehouseManager-developer/untitled1/.idea/misc.xml
create mode 100644 warehouseManager-developer/untitled1/pom.xml
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..597f736
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# cangku
+
diff --git a/warehouseManager-developer/.gitee/ISSUE_TEMPLATE.zh-CN.md b/warehouseManager-developer/.gitee/ISSUE_TEMPLATE.zh-CN.md
new file mode 100644
index 0000000..f09d98d
--- /dev/null
+++ b/warehouseManager-developer/.gitee/ISSUE_TEMPLATE.zh-CN.md
@@ -0,0 +1,13 @@
+### 该问题是怎么引起的?
+
+
+
+### 重现步骤
+
+
+
+### 报错信息
+
+
+
+
diff --git a/warehouseManager-developer/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/warehouseManager-developer/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
new file mode 100644
index 0000000..534be43
--- /dev/null
+++ b/warehouseManager-developer/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
@@ -0,0 +1,15 @@
+### 该Pull Request关联的Issue
+
+
+### 修改描述
+
+
+
+### 测试用例
+
+
+
+### 修复效果的截屏
+
+
+
diff --git a/warehouseManager-developer/.idea/.gitignore b/warehouseManager-developer/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/warehouseManager-developer/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/warehouseManager-developer/.idea/dataSources.xml b/warehouseManager-developer/.idea/dataSources.xml
new file mode 100644
index 0000000..5983d33
--- /dev/null
+++ b/warehouseManager-developer/.idea/dataSources.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306
+
+
+
+
+
+
+ $ProjectFileDir$
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306/wms_db
+
+
+
+
+
+
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/warehouseManager-developer/.idea/libraries/WMS.xml b/warehouseManager-developer/.idea/libraries/WMS.xml
new file mode 100644
index 0000000..0e14349
--- /dev/null
+++ b/warehouseManager-developer/.idea/libraries/WMS.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/warehouseManager-developer/.idea/misc.xml b/warehouseManager-developer/.idea/misc.xml
new file mode 100644
index 0000000..a289170
--- /dev/null
+++ b/warehouseManager-developer/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/warehouseManager-developer/.idea/modules.xml b/warehouseManager-developer/.idea/modules.xml
new file mode 100644
index 0000000..fd14004
--- /dev/null
+++ b/warehouseManager-developer/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/warehouseManager-developer/.idea/sqldialects.xml b/warehouseManager-developer/.idea/sqldialects.xml
new file mode 100644
index 0000000..3404959
--- /dev/null
+++ b/warehouseManager-developer/.idea/sqldialects.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/warehouseManager-developer/.idea/warehouseManager-developer.iml b/warehouseManager-developer/.idea/warehouseManager-developer.iml
new file mode 100644
index 0000000..78fa7a4
--- /dev/null
+++ b/warehouseManager-developer/.idea/warehouseManager-developer.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/warehouseManager-developer/.idea/webContexts.xml b/warehouseManager-developer/.idea/webContexts.xml
new file mode 100644
index 0000000..5ce618f
--- /dev/null
+++ b/warehouseManager-developer/.idea/webContexts.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/warehouseManager-developer/LICENSE b/warehouseManager-developer/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/warehouseManager-developer/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/warehouseManager-developer/README.md b/warehouseManager-developer/README.md
new file mode 100644
index 0000000..12eaf07
--- /dev/null
+++ b/warehouseManager-developer/README.md
@@ -0,0 +1,112 @@
+
+
+
+# 基于SSM框架的仓库管理系统
+
+
+## ✅ 分支说明
+
+| 分支 | spring框架 | MySQL8.0 | MySQL5.7 | 登录验证码 |
+|----|----------|----------|----------|----------|
+| dev-springboot | springboot | ✅ | ✅ | ✅ |
+| developer | springmvc | ✅ | ✅ | ✅ |
+| 去登录验证码 | springmvc | ✅ | ✅ | ❎ |
+| MySQL5.7 | springmvc | ❎ | ✅ | ✅ |
+
+
+## ✅ 非常紧急的问题或功能定制可以关注公众号->发消息:仓库管理
+
+> 
+
+## 计划
+- [x] 录制idea启动系统演示视频(价值:很多初学者需要)
+- [x] 数据库驱动兼容8.0,兼容MySQL5.7的旧代码放在分支mysql5.7(价值:应届毕业生80%以上默认用的MySQL8.0+)
+- [x] springmvc迁移到springboot(价值:应届毕业生80%以上默认用的springboot框架),见【dev-springboot】分支
+
+
+
+
+## ⭕ 视频-IDEA导入+运行项目演示
+
+> [基于SSM框架的仓库管理系统演示.mp4](/video/基于SSM框架的仓库管理系统演示.mp4)
+
+## 📋 功能
+
+* 系统操作权限管理。系统提供基本的登入登出功能,同时系统包含两个角色:系统超级管理员和普通管理员,超级管理员具有最高的操作权限,而普通管理员仅具有最基本的操作权限,而且仅能操作自己被指派的仓库。
+* 请求URL鉴权。对于系统使用者登陆后进行操作发送请求的URL,后台会根据当前用户的角色判断是否拥有请求该URL的权限。
+* 基础数据信息管理。对包括:货物信息、供应商信息、客户信息、仓库信息在内的基础数据信息进行管理,提供的操作有:添加、删除、修改、条件查询、导出为Excel和到从Excel导入。
+* 仓库管理员管理。对仓库管理员信息CRUD操作,或者为指定的仓库管理员指派所管理的仓库。上述中的仓库管理员可以以普通管理员身份登陆到系统。
+* 库存信息管理。对库存信息的CRUD操作,导入导出操作,同时查询的时候可以根据仓库以及商品ID等信息进行多条件查询。
+* 基本仓库事务操作。执行货物的入库与出库操作。
+* 系统登陆日志查询。超级管理员可以查询某一用户在特定时间段内的系统登陆日志。
+* 系统操作日志查询。超级管理员可以查询某一用户在特定时间段内对系统进行操作的操作记录。、
+* 密码修改。
+
+
+
+## ✳️ 使用到的框架和库
+
+* Apache POI
+* MyBatis
+* Spring Framework
+* Spring MVC
+* Apache Shiro
+* Ehcache
+* Apache Commons
+* Log4j
+* Slf4j
+* Jackson
+* C3P0
+* Junit
+* MySQL-Connector
+* jQuery
+* Bootstrap
+## ✴️ 登陆系统方式
+用户ID : 1001
+密码 :123456
+
+加密代码
+```
+// 用户密码(wms_user.USER_PASSWORD)加密规则
+String tempStr = MD5Util.MD5("123456");// 第一次对密码进行加密
+String encryptPassword = MD5Util.MD5(tempStr + "1001");// 第二次对密码进行加密
+//存入数据库的加密密码
+System.out.println(encryptPassword);
+```
+新增用户默认密码为用户ID(比如新增一个用户ID为1012,密码也为1012)
+## 📚 JDK版本
+
+### jdk 1.8
+
+## 📚 数据库版本
+### MySQL 8.0+
+查看版本号命令如下:
+> MySQL> select version();
+
+## ⭐ 数据库关系图
+
+
+## 📚 部分截图
+
+
+
+
+
+
+
+
+
+## 📚 常见问题
+#### ①中文乱码
+
+解决方式:数据库连接后面加上编码方式jdbc.url = jdbc:mysql:///192.168.X.X:3306\WMS_DB?useUnicode=true&characterEncoding=utf8
+
+
+## 👍 支持
+
+- If the project is very helpful to you, you can buy the author a cup of coffee☕.
+- 如果这个项目对您有帮助,可以请作者喝杯咖啡哟☕
+
+|支付宝 | 微信|
+| :--------: | :--------:|
+| | |
\ No newline at end of file
diff --git a/warehouseManager-developer/WMS/.gitignore b/warehouseManager-developer/WMS/.gitignore
new file mode 100644
index 0000000..269dea9
--- /dev/null
+++ b/warehouseManager-developer/WMS/.gitignore
@@ -0,0 +1,8 @@
+## .gitignore
+
+# .gitignore for maven
+target/
+
+# IDE support file
+.idea
+WMS.iml
\ No newline at end of file
diff --git a/warehouseManager-developer/WMS/pom.xml b/warehouseManager-developer/WMS/pom.xml
new file mode 100644
index 0000000..46ef51e
--- /dev/null
+++ b/warehouseManager-developer/WMS/pom.xml
@@ -0,0 +1,318 @@
+
+
+
+ 4.0.0
+ war
+
+ WMS
+ com.ken
+ WMS
+ 1.0-SNAPSHOT
+
+
+
+ 3.1.0
+ 4.12
+ 1.0
+ 1.8.0
+ 1.3.1
+ 2.1
+ 1.9.3
+ 3.4
+ 3.15-beta2
+ 3.4.0
+ 1.3.0
+ 4.1.6
+ 4.3.0.RELEASE
+ 1.4.0
+ 2.10.2
+ 8.0.28
+ 0.9.5.5
+ 1.2.17
+ 1.7.21
+ 2.7.0
+
+
+ 2.1
+ 8080
+ /WMS
+ 3.3
+ 1.8
+
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ ${servlet.version}
+ provided
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+
+
+
+ aopalliance
+ aopalliance
+ ${aopalliance.version}
+
+
+ org.aspectj
+ aspectjweaver
+ ${aspectjweaver.version}
+
+
+
+
+ commons-fileupload
+ commons-fileupload
+ ${commons.fileuoload.version}
+
+
+ commons-io
+ commons-io
+ ${commons.io.version}
+
+
+ commons-beanutils
+ commons-beanutils
+ ${commons.beanutils.version}
+
+
+ org.apache.commons
+ commons-lang3
+ 3.4
+
+
+
+
+
+ org.apache.poi
+ poi
+ ${poi.version}
+
+
+ org.apache.poi
+ poi-excelant
+ ${poi.version}
+
+
+ org.apache.poi
+ poi-ooxml
+ ${poi.version}
+
+
+ org.apache.poi
+ poi-ooxml-schemas
+ ${poi.version}
+
+
+ org.apache.poi
+ poi-scratchpad
+ ${poi.version}
+
+
+
+
+ org.mybatis
+ mybatis
+ ${mybatis.version}
+
+
+ org.mybatis
+ mybatis-spring
+ ${mybatisSpring.version}
+
+
+ com.github.pagehelper
+ pagehelper
+ ${pagehelper.version}
+
+
+
+
+
+ org.springframework
+ spring-aop
+ ${spring.version}
+
+
+ org.springframework
+ spring-beans
+ ${spring.version}
+
+
+ org.springframework
+ spring-context
+ ${spring.version}
+
+
+ org.springframework
+ spring-core
+ ${spring.version}
+
+
+ org.springframework
+ spring-expression
+ ${spring.version}
+
+
+ org.springframework
+ spring-jdbc
+ ${spring.version}
+
+
+ org.springframework
+ spring-orm
+ ${spring.version}
+
+
+ org.springframework
+ spring-test
+ ${spring.version}
+
+
+ org.springframework
+ spring-tx
+ ${spring.version}
+
+
+ org.springframework
+ spring-web
+ ${spring.version}
+
+
+ org.springframework
+ spring-webmvc
+ ${spring.version}
+
+
+
+
+ org.apache.shiro
+ shiro-core
+ ${shiro.version}
+
+
+ org.apache.shiro
+ shiro-web
+ ${shiro.version}
+
+
+ org.apache.shiro
+ shiro-spring
+ ${shiro.version}
+
+
+ org.apache.shiro
+ shiro-ehcache
+ ${shiro.version}
+
+
+
+
+ net.sf.ehcache
+ ehcache
+ ${ehcache.version}
+
+
+
+
+ mysql
+ mysql-connector-java
+ ${mysqlconnector.version}
+
+
+
+
+
+ com.mchange
+ c3p0
+ ${c3p0.version}
+
+
+
+
+ log4j
+ log4j
+ ${log4j.version}
+
+
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+ org.slf4j
+ slf4j-log4j12
+ ${slf4j.version}
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ ${jackson.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${jackson.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson.version}
+
+
+
+
+
+
+
+ src/main/resources
+
+
+ src/main/java
+
+ **/*.xml
+
+
+
+
+ src/main/java
+
+
+
+ org.apache.tomcat.maven
+ tomcat7-maven-plugin
+ ${plugin.tomcat.version}
+
+ ${plugin.tomcat.port}
+ ${plugin.tomcat.path}
+ UTF-8
+ tomcat7
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${plugin.maven.varsion}
+
+ ${plugin.maven.jdk}
+ ${plugin.maven.jdk}
+
+
+
+
+
+
diff --git a/warehouseManager-developer/WMS/sql/createtable.sql b/warehouseManager-developer/WMS/sql/createtable.sql
new file mode 100644
index 0000000..387e54f
--- /dev/null
+++ b/warehouseManager-developer/WMS/sql/createtable.sql
@@ -0,0 +1,224 @@
+create database wms_db
+DEFAULT CHARACTER SET utf8mb4
+DEFAULT COLLATE utf8mb4_general_ci;
+
+use wms_db;
+
+# 创建数据表
+
+# 创建供应商信息表
+create table wms_supplier
+(
+ SUPPLIER_ID int not null auto_increment,
+ SUPPLIER_NAME varchar(30) not null,
+ SUPPLIER_PERSON varchar(10) not null,
+ SUPPLIER_TEL varchar(20) not null,
+ SUPPLIER_EMAIL varchar(20) not null,
+ SUPPLIER_ADDRESS varchar(30) not null,
+ primary key(SUPPLIER_ID)
+)engine=innodb;
+
+# 创建客户信息表
+create table wms_customer
+(
+ CUSTOMER_ID int not null auto_increment,
+ CUSTOMER_NAME varchar(30) not null,
+ CUSTOMER_PERSON varchar(10) not null,
+ CUSTOMER_TEL varchar(20) not null,
+ CUSTOMER_EMAIL varchar(20) not null,
+ CUSTOMER_ADDRESS varchar(30) not null,
+ primary key(CUSTOMER_ID)
+ )engine=innodb;
+
+ # 创建货物信息表
+ create table wms_goods
+ (
+ GOOD_ID int not null auto_increment,
+ GOOD_NAME varChar(30) not null,
+ GOOD_RYPE varchar(20),
+ GOOD_SIZE varchar(20),
+ GOOD_VALUE double not null,
+ primary key(GOOD_ID)
+ )engine=innodb;
+
+ # 创建仓库信息表
+ create table wms_respository
+ (
+ REPO_ID int not null auto_increment,
+ REPO_ADDRESS varchar(30) not null,
+ REPO_STATUS varchar(20) not null,
+ REPO_AREA varchar(20) not null,
+ REPO_DESC varchar(50),
+ primary key(REPO_ID)
+ )engine=innodb;
+
+ # 创建仓库管理员信息表
+ create table wms_repo_admin
+ (
+ REPO_ADMIN_ID int not null auto_increment,
+ REPO_ADMIN_NAME varchar(10) not null,
+ REPO_ADMIN_SEX varchar(10) not null,
+ REPO_ADMIN_TEL varchar(20) not null,
+ REPO_ADMIN_ADDRESS varchar(30) not null,
+ REPO_ADMIN_BIRTH datetime not null,
+ REPO_ADMIN_REPOID int,
+ primary key(REPO_ADMIN_ID),
+ foreign key (REPO_ADMIN_REPOID) references wms_respository(REPO_ID)
+)engine=innodb;
+
+# 创建入库记录表
+create table wms_record_in
+(
+ RECORD_ID int not null auto_increment,
+ RECORD_SUPPLIERID int not null,
+ RECORD_GOODID int not null,
+ RECORD_NUMBER int not null,
+ RECORD_TIME datetime not null,
+ RECORD_PERSON varchar(10) not null,
+ RECORD_REPOSITORYID int not null,
+ primary key(RECORD_ID),
+ foreign key(RECORD_SUPPLIERID) references wms_supplier(SUPPLIER_ID),
+ foreign key(RECORD_GOODID) references wms_goods(GOOD_ID),
+ foreign key(RECORD_REPOSITORYID) references wms_respository(REPO_ID)
+)engine=innodb;
+
+# 创建出库记录表
+create table wms_record_out
+(
+ RECORD_ID int not null auto_increment,
+ RECORD_CUSTOMERID int not null,
+ RECORD_GOODID int not null,
+ RECORD_NUMBER int not null,
+ RECORD_TIME datetime not null,
+ RECORD_PERSON varchar(10) not null,
+ RECORD_REPOSITORYID int not null,
+ primary key(RECORD_ID),
+ foreign key(RECORD_CUSTOMERID) references wms_customer(CUSTOMER_ID),
+ foreign key(RECORD_GOODID) references wms_goods(GOOD_ID),
+ foreign key(RECORD_REPOSITORYID) references wms_respository(REPO_ID)
+)engine=innodb;
+
+# 创建库存记录表
+create table wms_record_storage
+(
+ RECORD_GOODID int not null auto_increment,
+ RECORD_REPOSITORY int not null,
+ RECORD_NUMBER int not null,
+ primary key(RECORD_GOODID, RECORD_REPOSITORY),
+ foreign key (RECORD_GOODID) references wms_goods(GOOD_ID),
+ foreign key (RECORD_REPOSITORY) references wms_respository(REPO_ID)
+)engine=innodb;
+
+# 创建系统用户信息表
+create table wms_user
+(
+ USER_ID int not null auto_increment,
+ USER_USERNAME varchar(30) not null,
+ USER_PASSWORD varchar(40) not null,
+ USER_FIRST_LOGIN int not null,
+ primary key (USER_ID)
+)engine=innodb;
+
+# 创建用户角色表
+create table wms_roles
+(
+ ROLE_ID int not null auto_increment,
+ ROLE_NAME varchar(20) not null,
+ ROLE_DESC varchar(30),
+ ROLE_URL_PREFIX varchar(20) not null,
+ primary key(ROLE_ID)
+)engine=innodb;
+
+# 创建URL权限表
+create table wms_action
+(
+ ACTION_ID int not null auto_increment,
+ ACTION_NAME varchar(30) not null,
+ ACTION_DESC varchar(30),
+ ACTION_PARAM varchar(50) not null,
+ primary key(ACTION_ID)
+)engine=innodb;
+
+# 用户 - 角色关联表
+create table wms_user_role
+(
+ ROLE_ID int not null,
+ USER_ID int not null,
+ primary key(ROLE_ID,USER_ID),
+ foreign key(ROLE_ID) references wms_roles(ROLE_ID),
+ foreign key(USER_ID) references wms_user(USER_ID)
+)engine=innodb;
+
+# 角色 - URL权限关联表
+create table wms_role_action
+(
+ ACTION_ID int not null,
+ ROLE_ID int not null,
+ primary key(ACTION_ID,ROLE_ID),
+ foreign key(ROLE_ID) references wms_roles(ROLE_ID),
+ foreign key(ACTION_ID) references wms_action(ACTION_ID)
+)engine=innodb;
+
+# 系统登入登出记录表
+create table wms_access_record
+(
+ RECORD_ID int auto_increment primary key,
+ USER_ID int not null,
+ USER_NAME varchar(50) not null,
+ ACCESS_TYPE varchar(30) not null,
+ ACCESS_TIME datetime not null,
+ ACCESS_IP varchar(45) not null
+);
+
+# 用户系统操作记录表
+create table wms_operation_record
+(
+ RECORD_ID int auto_increment primary key,
+ USER_ID int not null,
+ USER_NAME varchar(50) not null,
+ OPERATION_NAME varchar(30) not null,
+ OPERATION_TIME datetime not null,
+ OPERATION_RESULT varchar(15) not null
+);
+
+
+# 导入数据
+
+# 导入系统用户信息
+INSERT INTO `wms_user` VALUES (1001,'admin','6f5379e73c1a9eac6163ab8eaec7e41c',0),(1018,'王皓','50f202f4862360e55635b0a9616ded13',1),(1019,'李富荣','c4b3af5a5ab3e3d5aac4c5a5436201b8',1);
+
+# 导入系统角色信息
+INSERT INTO `wms_roles` VALUES (1,'systemAdmin',NULL,'systemAdmin'),(2,'commonsAdmin',NULL,'commonsAdmin');
+
+# 导入 系统用户 - 角色 信息
+INSERT INTO `wms_user_role` VALUES (1,1001),(2,1018),(2,1019);
+
+# 导入URL权限信息
+INSERT INTO `wms_action` VALUES (1,'addSupplier',NULL,'/supplierManage/addSupplier'),(2,'deleteSupplier',NULL,'/supplierManage/deleteSupplier'),(3,'updateSupplier',NULL,'/supplierManage/updateSupplier'),(4,'selectSupplier',NULL,'/supplierManage/getSupplierList'),(5,'getSupplierInfo',NULL,'/supplierManage/getSupplierInfo'),(6,'importSupplier',NULL,'/supplierManage/importSupplier'),(7,'exportSupplier',NULL,'/supplierManage/exportSupplier'),(8,'selectCustomer',NULL,'/customerManage/getCustomerList'),(9,'addCustomer',NULL,'/customerManage/addCustomer'),(10,'getCustomerInfo',NULL,'/customerManage/getCustomerInfo'),(11,'updateCustomer',NULL,'/customerManage/updateCustomer'),(12,'deleteCustomer',NULL,'/customerManage/deleteCustomer'),(13,'importCustomer',NULL,'/customerManage/importCustomer'),(14,'exportCustomer',NULL,'/customerManage/exportCustomer'),(15,'selectGoods',NULL,'/goodsManage/getGoodsList'),(16,'addGoods',NULL,'/goodsManage/addGoods'),(17,'getGoodsInfo',NULL,'/goodsManage/getGoodsInfo'),(18,'updateGoods',NULL,'/goodsManage/updateGoods'),(19,'deleteGoods',NULL,'/goodsManage/deleteGoods'),(20,'importGoods',NULL,'/goodsManage/importGoods'),(21,'exportGoods',NULL,'/goodsManage/exportGoods'),(22,'selectRepository',NULL,'/repositoryManage/getRepositoryList'),(23,'addRepository',NULL,'/repositoryManage/addRepository'),(24,'getRepositoryInfo',NULL,'/repositoryManage/getRepository'),(25,'updateRepository',NULL,'/repositoryManage/updateRepository'),(26,'deleteRepository',NULL,'/repositoryManage/deleteRepository'),(27,'importRepository',NULL,'/repositoryManage/importRepository'),(28,'exportRepository',NULL,'/repositoryManage/exportRepository'),(29,'selectRepositoryAdmin',NULL,'/repositoryAdminManage/getRepositoryAdminList'),(30,'addRepositoryAdmin',NULL,'/repositoryAdminManage/addRepositoryAdmin'),(31,'getRepositoryAdminInfo',NULL,'/repositoryAdminManage/getRepositoryAdminInfo'),(32,'updateRepositoryAdmin',NULL,'/repositoryAdminManage/updateRepositoryAdmin'),(33,'deleteRepositoryAdmin',NULL,'/repositoryAdminManage/deleteRepositoryAdmin'),(34,'importRepositoryAd,om',NULL,'/repositoryAdminManage/importRepositoryAdmin'),(35,'exportRepository',NULL,'/repositoryAdminManage/exportRepositoryAdmin'),(36,'getUnassignRepository',NULL,'/repositoryManage/getUnassignRepository'),(37,'getStorageListWithRepository',NULL,'/storageManage/getStorageListWithRepository'),(38,'getStorageList',NULL,'/storageManage/getStorageList'),(39,'addStorageRecord',NULL,'/storageManage/addStorageRecord'),(40,'updateStorageRecord',NULL,'/storageManage/updateStorageRecord'),(41,'deleteStorageRecord',NULL,'/storageManage/deleteStorageRecord'),(42,'importStorageRecord',NULL,'/storageManage/importStorageRecord'),(43,'exportStorageRecord',NULL,'/storageManage/exportStorageRecord'),(44,' stockIn','货物进库操作','/stockRecordManage/stockIn'),(45,'stockOut','货物出库操作','/stockRecordManage/stockOut'),(46,'searchStockRecord','查询货物出入库记录','/stockRecordManage/searchStockRecord'),(47,'getAccessRecords','查询登入登出记录','/systemLog/getAccessRecords'),(48,'selectUserOperationRecords','查村用户操作记录','/systemLog/selectUserOperationRecords');
+
+# 导入 角色 - URL权限 信息
+INSERT INTO `wms_role_action` VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(4,2),(8,2),(15,2),(38,2),(43,2),(44,2),(45,2);
+
+# 导入供应商信息
+INSERT INTO `wms_supplier` VALUES (1013,'浙江奇同电器有限公司','王泽伟','13777771126','86827868@126.com','中国 浙江 温州市龙湾区 龙湾区永强大道1648号'),(1014,'醴陵春天陶瓷实业有限公司','温仙容','13974167256','23267999@126.com','中国 湖南 醴陵市 东正街15号'),(1015,'洛阳嘉吉利饮品有限公司','郑绮云','26391678','22390898@qq.com','中国 广东 佛山市顺德区 北滘镇怡和路2号怡和中心14楼');
+
+# 导入客户信息
+INSERT INTO `wms_customer` VALUES (1214,'醴陵荣旗瓷业有限公司','陈娟','17716786888','23369888@136.com','中国 湖南 醴陵市 嘉树乡玉茶村柏树组'),(1215,'深圳市松林达电子有限公司','刘明','85263335-820','85264958@126.com','中国 广东 深圳市宝安区 深圳市宝安区福永社区桥头村桥塘路育'),(1216,'郑州绿之源饮品有限公司 ','赵志敬','87094196','87092165@qq.com','中国 河南 郑州市 郑州市嘉亿东方大厦609');
+
+# 导入货物信息
+INSERT INTO `wms_goods` VALUES (103,'五孔插座西门子墙壁开关','电器','86*86',1.85),(104,'陶瓷马克杯','陶瓷','9*9*11',3.5),(105,'精酿苹果醋','饮料','312ml',300);
+
+# 导入仓库信息
+INSERT INTO `wms_respository` VALUES (1003,'北京顺义南彩工业园区彩祥西路9号','可用','11000㎡','提供服务完整'),(1004,'广州白云石井石潭路大基围工业区','可用','1000㎡','物流极为便利'),(1005,' 香港北区文锦渡路(红桥新村)','可用','5000.00㎡',NULL);
+
+# 导入仓库管理员信息
+INSERT INTO `wms_repo_admin` VALUES (1018,'王皓','女','12345874526','中国佛山','2016-12-09 00:00:00',1004),(1019,'李富荣','男','1234','广州','2016-12-07 00:00:00',1003);
+
+# 导入入库记录
+INSERT INTO `wms_record_in` VALUES (15,1015,105,1000,'2016-12-31 00:00:00','admin',1004),(16,1015,105,200,'2017-01-02 00:00:00','admin',1004);
+
+# 导入出库记录
+INSERT INTO `wms_record_out` VALUES (7,1214,104,750,'2016-12-31 00:00:00','admin',1003);
+
+# 导入库存信息
+INSERT INTO `wms_record_storage` VALUES (103,1005,10000),(104,1003,1750),(105,1004,2000);
\ No newline at end of file
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/CustomerManageHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/CustomerManageHandler.java
new file mode 100644
index 0000000..5a23ddc
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/CustomerManageHandler.java
@@ -0,0 +1,278 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.CustomerManageService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.Customer;
+import com.ken.wms.domain.Supplier;
+import com.ken.wms.exception.CustomerManageServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户信息管理请求 Handler
+ */
+@RequestMapping(value = "/**/customerManage")
+@Controller
+public class CustomerManageHandler {
+
+ @Autowired
+ private CustomerManageService customerManageService;
+
+ private static final String SEARCH_BY_ID = "searchByID";
+ private static final String SEARCH_BY_NAME = "searchByName";
+ private static final String SEARCH_ALL = "searchAll";
+
+ /**
+ * 通用的结果查询方法
+ *
+ * @param searchType 查询方式
+ * @param keyWord 查询关键字
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 返回指定条件查询的结果
+ */
+ private Map query(String searchType, String keyWord, int offset, int limit) throws CustomerManageServiceException {
+ Map queryResult = null;
+
+ switch (searchType) {
+ case SEARCH_BY_ID:
+ if (StringUtils.isNumeric(keyWord))
+ queryResult = customerManageService.selectById(Integer.valueOf(keyWord));
+ break;
+ case SEARCH_BY_NAME:
+ queryResult = customerManageService.selectByName(offset, limit, keyWord);
+ break;
+ case SEARCH_ALL:
+ queryResult = customerManageService.selectAll(offset, limit);
+ break;
+ default:
+ // do other thing
+ break;
+ }
+ return queryResult;
+ }
+
+ /**
+ * 搜索客户信息
+ *
+ * @param searchType 搜索类型
+ * @param offset 如有多条记录时分页的偏移值
+ * @param limit 如有多条记录时分页的大小
+ * @param keyWord 搜索的关键字
+ * @return 返回查询的结果,其中键值为 rows 的代表查询到的每一记录,若有分页则为分页大小的记录;键值为 total 代表查询到的符合要求的记录总条数
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getCustomerList", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getCustomerList(@RequestParam("searchType") String searchType,
+ @RequestParam("offset") int offset,
+ @RequestParam("limit") int limit,
+ @RequestParam("keyWord") String keyWord) throws CustomerManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ List rows = null;
+ long total = 0;
+
+ Map queryResult = query(searchType, keyWord, offset, limit);
+
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+
+ // 设置 Response
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ responseContent.setResponseResult(Response.RESPONSE_RESULT_SUCCESS);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 添加一条客户信息
+ *
+ * @param customer 客户信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "addCustomer", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map addCustomer(@RequestBody Customer customer) throws CustomerManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 添加记录
+ String result = customerManageService.addCustomer(customer) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询指定 customer ID 客户的信息
+ *
+ * @param customerID 客户ID
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为客户信息
+ */
+ @RequestMapping(value = "getCustomerInfo", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getCustomerInfo(@RequestParam("customerID") String customerID) throws CustomerManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 获取客户信息
+ Customer customer = null;
+ Map queryResult = query(SEARCH_BY_ID, customerID, -1, -1);
+ if (queryResult != null) {
+ customer = (Customer) queryResult.get("data");
+ if (customer != null) {
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseData(customer);
+
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 更新客户信息
+ *
+ * @param customer 客户信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "updateCustomer", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map updateCustomer(@RequestBody Customer customer) throws CustomerManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 更新
+ String result = customerManageService.updateCustomer(customer) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 删除客户记录
+ *
+ * @param customerIDStr 客户ID
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "deleteCustomer", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map deleteCustomer(@RequestParam("customerID") String customerIDStr) throws CustomerManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 参数检查
+ if (StringUtils.isNumeric(customerIDStr)) {
+ // 转换为 Integer
+ Integer customerID = Integer.valueOf(customerIDStr);
+
+ // 刪除
+ String result = customerManageService.deleteCustomer(customerID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+ responseContent.setResponseResult(result);
+ } else
+ responseContent.setResponseResult(Response.RESPONSE_RESULT_ERROR);
+
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导入客户信息
+ *
+ * @param file 保存有客户信息的文件
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
+ * error;key为total表示导入的总条数;key为available表示有效的条数
+ */
+ @RequestMapping(value = "importCustomer", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map importCustomer(@RequestParam("file") MultipartFile file) throws CustomerManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_SUCCESS;
+
+ // 读取文件内容
+ int total = 0;
+ int available = 0;
+ if (file == null)
+ result = Response.RESPONSE_RESULT_ERROR;
+ Map importInfo = customerManageService.importCustomer(file);
+ if (importInfo != null) {
+ total = (int) importInfo.get("total");
+ available = (int) importInfo.get("available");
+ }
+
+ responseContent.setResponseResult(result);
+ responseContent.setResponseTotal(total);
+ responseContent.setCustomerInfo("available", available);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导出客户信息
+ *
+ * @param searchType 查找类型
+ * @param keyWord 查找关键字
+ * @param response HttpServletResponse
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "exportCustomer", method = RequestMethod.GET)
+ public void exportCustomer(@RequestParam("searchType") String searchType, @RequestParam("keyWord") String keyWord,
+ HttpServletResponse response) throws CustomerManageServiceException, IOException {
+
+ String fileName = "customerInfo.xlsx";
+
+ List customers = null;
+ Map queryResult = query(searchType, keyWord, -1, -1);
+
+ if (queryResult != null) {
+ customers = (List) queryResult.get("data");
+ }
+
+ // 获取生成的文件
+ File file = customerManageService.exportCustomer(customers);
+
+ // 写出文件
+ if (file != null) {
+ // 设置响应头
+ response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+ FileInputStream inputStream = new FileInputStream(file);
+ OutputStream outputStream = response.getOutputStream();
+ byte[] buffer = new byte[8192];
+
+ int len;
+ while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
+ outputStream.write(buffer, 0, len);
+ outputStream.flush();
+ }
+
+ inputStream.close();
+ outputStream.close();
+
+ }
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/FileSourceHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/FileSourceHandler.java
new file mode 100644
index 0000000..b3c37a2
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/FileSourceHandler.java
@@ -0,0 +1,44 @@
+package com.ken.wms.common.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * 处理文件下载请求
+ Spring MVC控制器类,用于处理文件下载请求
+ @PathVariable获取路径中的文件名
+ HttpServletRequest和HttpServletResponse用于处理请求和响应
+ */
+@Controller
+@RequestMapping("/commons/fileSource")//指定了基础路径
+public class FileSourceHandler {
+
+ @RequestMapping(value = "download/{fileName:.+}", method = RequestMethod.GET)//处理GET请求路径中包含文件名参数,使用正则表达式.+匹配带扩展名的文件名
+ public void fileDownload(@PathVariable("fileName") String fileName, HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+
+ if (fileName == null)
+ return;
+
+ // 获取文件
+ ServletContext context = request.getServletContext();
+ String directory = context.getRealPath("/WEB-INF/download");
+ Path file = Paths.get(directory, fileName);
+ if (Files.exists(file)) {
+ // 设置响应头
+ response.addHeader("Content-Disposition", "attachment;filename=" + file.getFileName());
+ Files.copy(file, response.getOutputStream());
+ response.getOutputStream().flush();
+ }
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/GoodsManageHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/GoodsManageHandler.java
new file mode 100644
index 0000000..eb86627
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/GoodsManageHandler.java
@@ -0,0 +1,277 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.GoodsManageService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.Goods;
+import com.ken.wms.domain.Supplier;
+import com.ken.wms.exception.GoodsManageServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 货物信息管理请求 Handler
+
+ */
+@RequestMapping(value = "/**/goodsManage")
+@Controller
+public class GoodsManageHandler {
+
+ @Autowired
+ private GoodsManageService goodsManageService;
+
+ private static final String SEARCH_BY_ID = "searchByID";
+ private static final String SEARCH_BY_NAME = "searchByName";
+ private static final String SEARCH_ALL = "searchAll";
+
+ /**
+ * 通用的记录查询
+ *
+ * @param searchType 查询类型
+ * @param keyWord 查询关键字
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 返回一个 Map ,包含所有符合要求的查询结果,以及记录的条数
+ */
+ private Map query(String searchType, String keyWord, int offset, int limit) throws GoodsManageServiceException {
+ Map queryResult = null;
+
+ switch (searchType) {
+ case SEARCH_BY_ID:
+ if (StringUtils.isNumeric(keyWord))
+ queryResult = goodsManageService.selectById(Integer.valueOf(keyWord));
+ break;
+ case SEARCH_BY_NAME:
+ queryResult = goodsManageService.selectByName(keyWord);
+ break;
+ case SEARCH_ALL:
+ queryResult = goodsManageService.selectAll(offset, limit);
+ break;
+ default:
+ // do other thing
+ break;
+ }
+
+ return queryResult;
+ }
+
+ /**
+ * 搜索货物信息
+ *
+ * @param searchType 搜索类型
+ * @param offset 如有多条记录时分页的偏移值
+ * @param limit 如有多条记录时分页的大小
+ * @param keyWord 搜索的关键字
+ * @return 返回所有符合要求的记录
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getGoodsList", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getGoodsList(@RequestParam("searchType") String searchType,
+ @RequestParam("offset") int offset, @RequestParam("limit") int limit,
+ @RequestParam("keyWord") String keyWord) throws GoodsManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ List rows = null;
+ long total = 0;
+
+ // 查询
+ Map queryResult = query(searchType, keyWord, offset, limit);
+
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+
+ // 设置 Response
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 添加一条货物信息
+ *
+ * @param goods 货物信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "addGoods", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map addGoods(@RequestBody Goods goods) throws GoodsManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 添加记录
+ String result = goodsManageService.addGoods(goods) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询指定 goods ID 货物的信息
+ *
+ * @param goodsID 货物ID
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为货物信息
+ */
+ @RequestMapping(value = "getGoodsInfo", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getGoodsInfo(@RequestParam("goodsID") Integer goodsID) throws GoodsManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 获取货物信息
+ Goods goods = null;
+ Map queryResult = goodsManageService.selectById(goodsID);
+ if (queryResult != null) {
+ goods = (Goods) queryResult.get("data");
+ if (goods != null) {
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseData(goods);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 更新货物信息
+ *
+ * @param goods 货物信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "updateGoods", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map updateGoods(@RequestBody Goods goods) throws GoodsManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 更新
+ String result = goodsManageService.updateGoods(goods) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 删除货物记录
+ *
+ * @param goodsID 货物ID
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "deleteGoods", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map deleteGoods(@RequestParam("goodsID") Integer goodsID) throws GoodsManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 删除
+ String result = goodsManageService.deleteGoods(goodsID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导入货物信息
+ *
+ * @param file 保存有货物信息的文件
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
+ * error;key为total表示导入的总条数;key为available表示有效的条数
+ */
+ @RequestMapping(value = "importGoods", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map importGoods(@RequestParam("file") MultipartFile file) throws GoodsManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 读取文件内容
+ int total = 0;
+ int available = 0;
+ if (file != null) {
+ Map importInfo = goodsManageService.importGoods(file);
+ if (importInfo != null) {
+ total = (int) importInfo.get("total");
+ available = (int) importInfo.get("available");
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseTotal(total);
+ responseContent.setCustomerInfo("available", available);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导出货物信息
+ *
+ * @param searchType 查找类型
+ * @param keyWord 查找关键字
+ * @param response HttpServletResponse
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "exportGoods", method = RequestMethod.GET)
+ public void exportGoods(@RequestParam("searchType") String searchType, @RequestParam("keyWord") String keyWord,
+ HttpServletResponse response) throws GoodsManageServiceException, IOException {
+
+ String fileName = "goodsInfo.xlsx";
+
+ List goodsList = null;
+ Map queryResult = query(searchType, keyWord, -1, -1);
+
+ if (queryResult != null) {
+ goodsList = (List) queryResult.get("data");
+ }
+
+ // 获取生成的文件
+ File file = goodsManageService.exportGoods(goodsList);
+
+ // 写出文件
+ if (file != null) {
+ // 设置响应头
+ response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+
+ FileInputStream inputStream = new FileInputStream(file);
+ OutputStream outputStream = response.getOutputStream();
+ byte[] buffer = new byte[8192];
+
+ int len;
+ while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
+ outputStream.write(buffer, 0, len);
+ outputStream.flush();
+ }
+
+ inputStream.close();
+ outputStream.close();
+
+ }
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryAdminManageHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryAdminManageHandler.java
new file mode 100644
index 0000000..8d70d73
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryAdminManageHandler.java
@@ -0,0 +1,288 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.RepositoryAdminManageService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.RepositoryAdmin;
+import com.ken.wms.exception.RepositoryAdminManageServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 仓库管理员管理请求 Handler
+
+ */
+@Controller
+@RequestMapping(value = "/**/repositoryAdminManage")
+public class RepositoryAdminManageHandler {
+
+ @Autowired
+ private RepositoryAdminManageService repositoryAdminManageService;
+
+ // 查询类型
+ private static final String SEARCH_BY_ID = "searchByID";
+ private static final String SEARCH_BY_NAME = "searchByName";
+ private static final String SEARCH_BY_REPOSITORY_ID = "searchByRepositoryID";
+ private static final String SEARCH_ALL = "searchAll";
+
+ /**
+ * 通用记录查询
+ *
+ * @param keyWord 查询关键字
+ * @param searchType 查询类型
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 返回所有符合条件的记录
+ */
+ private Map query(String keyWord, String searchType, int offset, int limit) throws RepositoryAdminManageServiceException {
+ Map queryResult = null;
+
+ // query
+ switch (searchType) {
+ case SEARCH_ALL:
+ queryResult = repositoryAdminManageService.selectAll(offset, limit);
+ break;
+ case SEARCH_BY_ID:
+ if (StringUtils.isNumeric(keyWord))
+ queryResult = repositoryAdminManageService.selectByID(Integer.valueOf(keyWord));
+ break;
+ case SEARCH_BY_NAME:
+ queryResult = repositoryAdminManageService.selectByName(offset, limit, keyWord);
+ break;
+ case SEARCH_BY_REPOSITORY_ID:
+ if (StringUtils.isNumeric(keyWord))
+ queryResult = repositoryAdminManageService.selectByRepositoryID(Integer.valueOf(keyWord));
+ break;
+ default:
+ // do other things
+ break;
+ }
+
+ return queryResult;
+ }
+
+ /**
+ * 查询仓库管理员信息
+ *
+ * @param searchType 查询类型
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @param keyWord 查询关键字
+ * @return 返回一个Map,其中key=rows,表示查询出来的记录;key=total,表示记录的总条数
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getRepositoryAdminList", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getRepositoryAdmin(@RequestParam("searchType") String searchType,
+ @RequestParam("keyWord") String keyWord, @RequestParam("offset") int offset,
+ @RequestParam("limit") int limit) throws RepositoryAdminManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ List rows = null;
+ long total = 0;
+
+ // 查询
+ Map queryResult = query(keyWord, searchType, offset, limit);
+
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+
+ // 设置 Response
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 添加一条仓库管理员信息
+ *
+ * @param repositoryAdmin 仓库管理员信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "addRepositoryAdmin", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map addRepositoryAdmin(@RequestBody RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 添加结果
+ String result = repositoryAdminManageService.addRepositoryAdmin(repositoryAdmin)
+ ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询指定 ID 的仓库管理员信息
+ *
+ * @param repositoryAdminID 仓库管理员ID
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为仓库管理员信息
+ */
+ @RequestMapping(value = "getRepositoryAdminInfo", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getRepositoryAdminInfo(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 查询
+ RepositoryAdmin repositoryAdmin = null;
+ Map queryResult = repositoryAdminManageService.selectByID(repositoryAdminID);
+ if (queryResult != null) {
+ if ((repositoryAdmin = (RepositoryAdmin) queryResult.get("data")) != null)
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseData(repositoryAdmin);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 更新仓库管理员信息
+ *
+ * @param repositoryAdmin 仓库管理员信息
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为仓库管理员信息
+ */
+ @RequestMapping(value = "updateRepositoryAdmin", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map updateRepositoryAdmin(@RequestBody RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 更新
+ String result = repositoryAdminManageService.updateRepositoryAdmin(repositoryAdmin)
+ ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 删除指定 ID 的仓库管理员信息
+ *
+ * @param repositoryAdminID 仓库ID
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为仓库管理员信息
+ */
+ @RequestMapping(value = "deleteRepositoryAdmin", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map deleteRepositoryAdmin(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 删除记录
+ String result = repositoryAdminManageService.deleteRepositoryAdmin(repositoryAdminID)
+ ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 从文件中导入仓库管理员信息
+ *
+ * @param file 保存有仓库管理员信息的文件
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
+ * error;key为total表示导入的总条数;key为available表示有效的条数
+ */
+ @RequestMapping(value = "importRepositoryAdmin", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map importRepositoryAdmin(MultipartFile file) throws RepositoryAdminManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 读取文件
+ long total = 0;
+ long available = 0;
+ if (file != null) {
+ Map importInfo = repositoryAdminManageService.importRepositoryAdmin(file);
+ if (importInfo != null) {
+ total = (long) importInfo.get("total");
+ available = (long) importInfo.get("available");
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseTotal(total);
+ responseContent.setCustomerInfo("available", available);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导出仓库管理员信息到文件中
+ *
+ * @param searchType 查询类型
+ * @param keyWord 查询关键字
+ * @param response HttpServletResponse
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "exportRepositoryAdmin", method = RequestMethod.GET)
+ public void exportRepositoryAdmin(@RequestParam("searchType") String searchType,
+ @RequestParam("keyWord") String keyWord, HttpServletResponse response) throws RepositoryAdminManageServiceException, IOException {
+
+ // 导出文件名
+ String fileName = "repositoryAdminInfo.xlsx";
+
+ // 查询
+ List repositoryAdmins;
+ Map queryResult = query(keyWord, searchType, -1, -1);
+
+ if (queryResult != null)
+ repositoryAdmins = (List) queryResult.get("data");
+ else
+ repositoryAdmins = new ArrayList<>();
+
+ // 生成文件
+ File file = repositoryAdminManageService.exportRepositoryAdmin(repositoryAdmins);
+
+ // 输出文件
+ if (file != null) {
+ // 设置响应头
+ response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+ FileInputStream inputStream = new FileInputStream(file);
+ OutputStream outputStream = response.getOutputStream();
+ byte[] buffer = new byte[8192];
+
+ int len;
+ while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
+ outputStream.write(buffer, 0, len);
+ outputStream.flush();
+ }
+
+ inputStream.close();
+ outputStream.close();
+ }
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryManageHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryManageHandler.java
new file mode 100644
index 0000000..3a35a49
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/RepositoryManageHandler.java
@@ -0,0 +1,309 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.RepositoryService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.Repository;
+import com.ken.wms.exception.RepositoryManageServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 仓库信息管理请求 Handler
+ */
+@Controller
+@RequestMapping(value = "/**/repositoryManage")
+public class RepositoryManageHandler {
+
+ @Autowired
+ private RepositoryService repositoryService;
+
+ private static final String SEARCH_BY_ID = "searchByID";
+ private static final String SEARCH_BY_ADDRESS = "searchByAddress";
+ private static final String SEARCH_ALL = "searchAll";
+
+ /**
+ * 通用的记录查询
+ *
+ * @param searchType 查询方式
+ * @param keyword 查询关键字
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 返回所有符合条件的查询结果
+ */
+ private Map query(String searchType, String keyword, int offset, int limit) throws RepositoryManageServiceException {
+ Map queryResult = null;
+
+ switch (searchType) {
+ case SEARCH_BY_ID:
+ if (StringUtils.isNumeric(keyword)) {
+ queryResult = repositoryService.selectById(Integer.valueOf(keyword));
+ }
+ break;
+ case SEARCH_BY_ADDRESS:
+ queryResult = repositoryService.selectByAddress(offset, limit, keyword);
+ break;
+ case SEARCH_ALL:
+ queryResult = repositoryService.selectAll(offset, limit);
+ break;
+ default:
+ // do other thing
+ break;
+ }
+
+ return queryResult;
+ }
+
+ /**
+ * 查询仓库信息
+ *
+ * @param searchType 查询类型
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @param keyWord 查询关键字
+ * @return 返回一个Map,其中key=rows,表示查询出来的记录;key=total,表示记录的总条数
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getRepositoryList", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getRepositoryList(@RequestParam("searchType") String searchType,
+ @RequestParam("offset") int offset, @RequestParam("limit") int limit,
+ @RequestParam("keyWord") String keyWord) throws RepositoryManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ List rows = null;
+ long total = 0;
+
+ // 查询
+ Map queryResult = query(searchType, keyWord, offset, limit);
+
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+
+ // 设置 Response
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询所有未指派管理员的仓库
+ *
+ * @return 返回一个 map,其中key=data表示查询的记录,key=total表示记录的条数
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getUnassignRepository", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getUnassignRepository() throws RepositoryManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List data;
+ long total = 0;
+
+ // 查询
+ Map queryResult = repositoryService.selectUnassign();
+ if (queryResult != null) {
+ data = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ } else
+ data = new ArrayList<>();
+
+ resultSet.put("data", data);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 添加一条仓库信息
+ *
+ * @param repository 仓库信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "addRepository", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map addRepository(@RequestBody Repository repository) throws RepositoryManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 添加记录
+ String result = repositoryService.addRepository(repository) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询指定 ID 的仓库信息
+ *
+ * @param repositoryID 仓库ID
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为仓库信息
+ */
+ @RequestMapping(value = "getRepositoryInfo", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getRepositoryInfo(@RequestParam("repositoryID") Integer repositoryID) throws RepositoryManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 查询
+ Repository repository = null;
+ Map queryResult = repositoryService.selectById(repositoryID);
+ if (queryResult != null) {
+ repository = (Repository) queryResult.get("data");
+ if (repository != null)
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseData(repository);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 更新仓库信息
+ *
+ * @param repository 仓库信息
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为仓库信息
+ */
+ @RequestMapping(value = "updateRepository", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map updateRepository(@RequestBody Repository repository) throws RepositoryManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 更新
+ String result = repositoryService.updateRepository(repository) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 删除指定 ID 的仓库信息
+ *
+ * @param repositoryID 仓库ID
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为仓库信息
+ */
+ @RequestMapping(value = "deleteRepository", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map deleteRepository(@RequestParam("repositoryID") Integer repositoryID) throws RepositoryManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 删除记录
+ String result = repositoryService.deleteRepository(repositoryID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 从文件中导入仓库信息
+ *
+ * @param file 保存有仓库信息的文件
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
+ * error;key为total表示导入的总条数;key为available表示有效的条数
+ */
+ @RequestMapping(value = "importRepository", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map importRepository(MultipartFile file) throws RepositoryManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 读取文件
+ int total = 0;
+ int available = 0;
+ if (file != null) {
+ Map importInfo = repositoryService.importRepository(file);
+ if (importInfo != null) {
+ total = (int) importInfo.get("total");
+ available = (int) importInfo.get("available");
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseTotal(total);
+ responseContent.setCustomerInfo("available", available);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导出仓库信息到文件中
+ *
+ * @param searchType 查询类型
+ * @param keyWord 查询关键字
+ * @param response HttpServletResponse
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "exportRepository", method = RequestMethod.GET)
+ public void exportRepository(@RequestParam("searchType") String searchType, @RequestParam("keyWord") String keyWord,
+ HttpServletResponse response) throws RepositoryManageServiceException, IOException {
+
+ // 导出文件名
+ String fileName = "repositoryInfo.xlsx";
+
+ // 查询
+ List repositories;
+
+ Map queryResult = query(searchType, keyWord, -1, -1);
+
+ if (queryResult != null)
+ repositories = (List) queryResult.get("data");
+ else
+ repositories = new ArrayList<>();
+
+ // 生成文件
+ File file = repositoryService.exportRepository(repositories);
+
+ // 输出文件
+ if (file != null) {
+ // 设置响应头
+ response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+ FileInputStream inputStream = new FileInputStream(file);
+ OutputStream outputStream = response.getOutputStream();
+ byte[] buffer = new byte[8192];
+
+ int len;
+ while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
+ outputStream.write(buffer, 0, len);
+ outputStream.flush();
+ }
+
+ inputStream.close();
+ outputStream.close();
+ }
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StockRecordManageHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StockRecordManageHandler.java
new file mode 100644
index 0000000..6b1f267
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StockRecordManageHandler.java
@@ -0,0 +1,210 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.StockRecordManageService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.StockRecordDTO;
+import com.ken.wms.domain.UserInfoDTO;
+import com.ken.wms.exception.StockRecordManageServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商品出入库管理请求Handler
+ */
+@Controller
+@RequestMapping(value = "stockRecordManage")
+public class StockRecordManageHandler {
+
+ @Autowired
+ private StockRecordManageService stockRecordManageService;
+
+ /**
+ * 货物出库操作
+ *
+ * @param customerID 客户ID
+ * @param goodsID 货物ID
+ * @param repositoryIDStr 仓库ID
+ * @param number 出库数量
+ * @return 返回一个map,key为result的值表示操作是否成功
+ */
+ @RequestMapping(value = "stockOut", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map stockOut(@RequestParam("customerID") Integer customerID,
+ @RequestParam("goodsID") Integer goodsID,
+ @RequestParam(value = "repositoryID", required = false) String repositoryIDStr,
+ @RequestParam("number") long number) throws StockRecordManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+ boolean authorizeCheck = true;
+ boolean argumentCheck = true;
+ Integer repositoryID = null;
+
+ // 参数检查
+ if (repositoryIDStr != null) {
+ if (StringUtils.isNumeric(repositoryIDStr)) {
+ repositoryID = Integer.valueOf(repositoryIDStr);
+ } else {
+ argumentCheck = false;
+ responseContent.setResponseMsg("request argument error");
+ }
+ }
+
+ // 获取 session 中的信息
+ Subject currentUser = SecurityUtils.getSubject();
+ Session session = currentUser.getSession();
+ UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");
+ String personInCharge = userInfo == null ? "none" : userInfo.getUserName();
+ Integer repositoryIDBelong = userInfo == null ? -1 : userInfo.getRepositoryBelong();
+
+ // 设置非管理员请求的仓库ID
+ if (!currentUser.hasRole("systemAdmin")) {
+ if (repositoryIDBelong < 0) {
+ authorizeCheck = false;
+ responseContent.setResponseMsg("You are not authorized");
+ } else {
+ repositoryID = repositoryIDBelong;
+ }
+ }
+
+ if (authorizeCheck && argumentCheck) {
+ if (stockRecordManageService.stockOutOperation(customerID, goodsID, repositoryID, number, personInCharge))
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 货物入库操作
+ *
+ * @param supplierID 供应商ID
+ * @param goodsID 货物ID
+ * @param repositoryIDStr 仓库ID
+ * @param number 入库数目
+ * @return 返回一个map,key为result的值表示操作是否成功
+ */
+ @RequestMapping(value = "stockIn", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map stockIn(@RequestParam("supplierID") Integer supplierID,
+ @RequestParam("goodsID") Integer goodsID,
+ @RequestParam(value = "repositoryID", required = false) String repositoryIDStr,
+ @RequestParam("number") long number) throws StockRecordManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+ boolean authorizeCheck = true;
+ boolean argumentCheck = true;
+ Integer repositoryID = null;
+
+ // 参数检查
+ if (repositoryIDStr != null) {
+ if (StringUtils.isNumeric(repositoryIDStr)) {
+ repositoryID = Integer.valueOf(repositoryIDStr);
+ } else {
+ argumentCheck = false;
+ responseContent.setResponseMsg("request argument error");
+ }
+ }
+
+ // 获取session中的信息
+ Subject currentUser = SecurityUtils.getSubject();
+ Session session = currentUser.getSession();
+ UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");
+ String personInCharge = userInfo == null ? "none" : userInfo.getUserName();
+ Integer repositoryIDBelong = userInfo == null ? -1 : userInfo.getRepositoryBelong();
+
+ // 设置非管理员请求的仓库ID
+ if (!currentUser.hasRole("systemAdmin")) {
+ if (repositoryIDBelong < 0) {
+ authorizeCheck = false;
+ responseContent.setResponseMsg("You are not authorized");
+ } else {
+ repositoryID = repositoryIDBelong;
+ }
+ }
+
+ // 执行 Service
+ if (authorizeCheck && argumentCheck) {
+ if (stockRecordManageService.stockInOperation(supplierID, goodsID, repositoryID, number, personInCharge)) {
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询出入库记录
+ *
+ * @param searchType 查询类型(查询所有或仅查询入库记录或仅查询出库记录)
+ * @param repositoryIDStr 查询记录所对应的仓库ID
+ * @param endDateStr 查询的记录起始日期
+ * @param startDateStr 查询的记录结束日期
+ * @param limit 分页大小
+ * @param offset 分页偏移值
+ * @return 返回一个Map,其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数
+ */
+ @SuppressWarnings({"SingleStatementInBlock", "unchecked"})
+ @RequestMapping(value = "searchStockRecord", method = RequestMethod.GET)
+ public @ResponseBody
+ Map getStockRecord(@RequestParam("searchType") String searchType,
+ @RequestParam("repositoryID") String repositoryIDStr,
+ @RequestParam("startDate") String startDateStr,
+ @RequestParam("endDate") String endDateStr,
+ @RequestParam("limit") int limit,
+ @RequestParam("offset") int offset) throws ParseException, StockRecordManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ List rows = null;
+ long total = 0;
+
+ // 参数检查
+ String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
+ boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
+ boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
+ boolean repositoryIDCheck = (StringUtils.isEmpty(repositoryIDStr) || StringUtils.isNumeric(repositoryIDStr));
+
+ if (startDateFormatCheck && endDateFormatCheck && repositoryIDCheck) {
+ Integer repositoryID = -1;
+ if (StringUtils.isNumeric(repositoryIDStr)) {
+ repositoryID = Integer.valueOf(repositoryIDStr);
+ }
+
+ // 转到 Service 执行查询
+ Map queryResult = stockRecordManageService.selectStockRecord(repositoryID, startDateStr, endDateStr, searchType, offset, limit);
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+ } else
+ responseContent.setResponseMsg("Request argument error");
+
+ if (rows == null)
+ rows = new ArrayList<>(0);
+
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ return responseContent.generateResponse();
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StorageManageHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StorageManageHandler.java
new file mode 100644
index 0000000..8966ce8
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/StorageManageHandler.java
@@ -0,0 +1,364 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.StockRecordManageService;
+import com.ken.wms.common.service.Interface.StorageManageService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.Storage;
+import com.ken.wms.domain.UserInfoDTO;
+import com.ken.wms.exception.StorageManageServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 库存管理请求处理
+ *
+ */
+@Controller
+@RequestMapping(value = "/**/storageManage")
+public class StorageManageHandler {
+
+ @Autowired
+ private StorageManageService storageManageService;
+ @Autowired
+ private StockRecordManageService stockRecordManageService;
+
+ private static final String SEARCH_BY_GOODS_ID = "searchByGoodsID";
+ private static final String SEARCH_BY_GOODS_NAME = "searchByGoodsName";
+ private static final String SEARCH_BY_GOODS_TYPE = "searchByGoodsType";
+ private static final String SEARCH_ALL = "searchAll";
+
+ /**
+ * 查询库存信息
+ *
+ * @param searchType 查询类型
+ * @param keyword 查询关键字
+ * @param repositoryBelong 查询仓库
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ private Map query(String searchType, String keyword, String repositoryBelong, int offset,
+ int limit) throws StorageManageServiceException {
+ Map queryResult = null;
+
+ switch (searchType) {
+ case SEARCH_ALL:
+ if (StringUtils.isNumeric(repositoryBelong)) {
+ Integer repositoryID = Integer.valueOf(repositoryBelong);
+ queryResult = storageManageService.selectAll(repositoryID, offset, limit);
+ } else {
+ queryResult = storageManageService.selectAll(-1, offset, limit);
+ }
+ break;
+ case SEARCH_BY_GOODS_ID:
+ if (StringUtils.isNumeric(keyword)) {
+ Integer goodsID = Integer.valueOf(keyword);
+ if (StringUtils.isNumeric(repositoryBelong)) {
+ Integer repositoryID = Integer.valueOf(repositoryBelong);
+ queryResult = storageManageService.selectByGoodsID(goodsID, repositoryID, offset, limit);
+ } else
+ queryResult = storageManageService.selectByGoodsID(goodsID, -1, offset, limit);
+ }
+ break;
+ case SEARCH_BY_GOODS_TYPE:
+ if (StringUtils.isNumeric(repositoryBelong)) {
+ Integer repositoryID = Integer.valueOf(repositoryBelong);
+ queryResult = storageManageService.selectByGoodsType(keyword, repositoryID, offset, limit);
+ } else
+ queryResult = storageManageService.selectByGoodsType(keyword, -1, offset, limit);
+ break;
+ case SEARCH_BY_GOODS_NAME:
+ if (StringUtils.isNumeric(repositoryBelong)) {
+ Integer repositoryID = Integer.valueOf(repositoryBelong);
+ queryResult = storageManageService.selectByGoodsName(keyword, repositoryID, offset, limit);
+ } else
+ queryResult = storageManageService.selectByGoodsName(keyword, -1, offset, limit);
+ break;
+ default:
+ // do other thing
+ break;
+ }
+
+ return queryResult;
+ }
+
+ /**
+ * 可指定仓库对库存信息查询
+ *
+ * @param keyword 查询关键字
+ * @param searchType 查询类型
+ * @param repositoryBelong 查询所属的仓库
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 结果的一个Map,其中: key为 rows 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getStorageListWithRepository", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getStorageListWithRepoID(@RequestParam("keyword") String keyword,
+ @RequestParam("searchType") String searchType, @RequestParam("repositoryBelong") String repositoryBelong,
+ @RequestParam("offset") int offset, @RequestParam("limit") int limit) throws StorageManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ List rows;
+ long total = 0;
+
+ // query
+ Map queryResult = query(searchType, keyword, repositoryBelong, offset, limit);
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ } else
+ rows = new ArrayList<>();
+
+ // 设置 Response
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询库存信息,查询所属的仓库为session保存的信息
+ *
+ * @param keyword 查询关键字
+ * @param searchType 查询类型
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @param request 请求
+ * @return 结果的一个Map,其中: key为 rows 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getStorageList", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getStorageList(@RequestParam("keyword") String keyword,
+ @RequestParam("searchType") String searchType, @RequestParam("offset") int offset,
+ @RequestParam("limit") int limit, HttpServletRequest request) throws StorageManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ List rows = null;
+ long total = 0;
+
+ HttpSession session = request.getSession();
+ UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");
+ Integer repositoryID = userInfo.getRepositoryBelong();
+ if (repositoryID > 0) {
+ Map queryResult = query(searchType, keyword, repositoryID.toString(), offset, limit);
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+ }
+
+ if (rows == null)
+ rows = new ArrayList<>();
+
+ // 设置 Response
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 添加一条库存信息
+ *
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "addStorageRecord", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map addStorageRecord(@RequestBody Map params) throws StorageManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String isSuccess = Response.RESPONSE_RESULT_ERROR;
+ boolean isAvailable = true;
+
+ String goodsID = (String) params.get("goodsID");
+ String repositoryID = (String) params.get("repositoryID");
+ String number = (String) params.get("number");
+
+ if (StringUtils.isBlank(goodsID) || !StringUtils.isNumeric(goodsID))
+ isAvailable = false;
+ if (StringUtils.isBlank(repositoryID) || !StringUtils.isNumeric(repositoryID))
+ isAvailable = false;
+ if (StringUtils.isBlank(number) || !StringUtils.isNumeric(number))
+ isAvailable = false;
+
+ if (isAvailable) {
+ isSuccess = storageManageService.addNewStorage(Integer.valueOf(goodsID), Integer.valueOf(repositoryID),
+ Integer.valueOf(number)) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(isSuccess);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 更新库存信息
+ *
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "updateStorageRecord", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map updateStorageRecord(@RequestBody Map params) throws StorageManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ boolean isAvailable = true;
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ String goodsID = (String) params.get("goodsID");
+ String repositoryID = (String) params.get("repositoryID");
+ String number = (String) params.get("number");
+
+ if (StringUtils.isBlank(goodsID) || !StringUtils.isNumeric(goodsID))
+ isAvailable = false;
+ if (StringUtils.isBlank(repositoryID) || !StringUtils.isNumeric(repositoryID))
+ isAvailable = false;
+ if (StringUtils.isBlank(number) || !StringUtils.isNumeric(number))
+ isAvailable = false;
+
+ if (isAvailable) {
+ result = storageManageService.updateStorage(Integer.valueOf(goodsID), Integer.valueOf(repositoryID),
+ Integer.valueOf(number)) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 删除一条库存信息
+ *
+ * @param goodsID 货物ID
+ * @param repositoryID 仓库ID
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "deleteStorageRecord", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map deleteStorageRecord(@RequestParam("goodsID") String goodsID,
+ @RequestParam("repositoryID") String repositoryID) throws StorageManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ String result = Response.RESPONSE_RESULT_ERROR;
+ boolean isAvailable = true;
+
+ if (StringUtils.isBlank(goodsID) || !StringUtils.isNumeric(goodsID))
+ isAvailable = false;
+ if (StringUtils.isBlank(repositoryID) || !StringUtils.isNumeric(repositoryID))
+ isAvailable = false;
+
+ if (isAvailable) {
+ result = storageManageService.deleteStorage(Integer.valueOf(goodsID), Integer.valueOf(repositoryID))
+ ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导入库存信息
+ *
+ * @param file 保存有库存信息的文件
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
+ * error;key为total表示导入的总条数;key为available表示有效的条数
+ */
+ @RequestMapping(value = "importStorageRecord", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map importStorageRecord(@RequestParam("file") MultipartFile file) throws StorageManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ int total = 0;
+ int available = 0;
+
+ if (file != null) {
+ Map importInfo = storageManageService.importStorage(file);
+ if (importInfo != null) {
+ total = (int) importInfo.get("total");
+ available = (int) importInfo.get("available");
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseTotal(total);
+ responseContent.setCustomerInfo("available", available);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导出库存信息
+ *
+ * @param searchType 查询类型
+ * @param keyword 查询关键字
+ * @param repositoryBelong 查询所属仓库
+ * @param request 请求
+ * @param response 响应
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "exportStorageRecord", method = RequestMethod.GET)
+ public void exportStorageRecord(@RequestParam("searchType") String searchType,
+ @RequestParam("keyword") String keyword,
+ @RequestParam(value = "repositoryBelong", required = false) String repositoryBelong,
+ HttpServletRequest request, HttpServletResponse response) throws StorageManageServiceException, IOException {
+ String fileName = "storageRecord.xlsx";
+
+ HttpSession session = request.getSession();
+ UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");
+ Integer sessionRepositoryBelong = userInfo.getRepositoryBelong();
+ if (sessionRepositoryBelong > 0)
+ repositoryBelong = sessionRepositoryBelong.toString();
+
+ List storageList = null;
+ Map queryResult = query(searchType, keyword, repositoryBelong, -1, -1);
+ if (queryResult != null)
+ storageList = (List) queryResult.get("data");
+
+ File file = storageManageService.exportStorage(storageList);
+ if (file != null) {
+ // 设置响应头
+ response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+ FileInputStream inputStream = new FileInputStream(file);
+ OutputStream outputStream = response.getOutputStream();
+ byte[] buffer = new byte[8192];
+
+ int len;
+ while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
+ outputStream.write(buffer, 0, len);
+ outputStream.flush();
+ }
+
+ inputStream.close();
+ outputStream.close();
+
+ }
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SupplierManageHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SupplierManageHandler.java
new file mode 100644
index 0000000..4d1b6fe
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SupplierManageHandler.java
@@ -0,0 +1,272 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.SupplierManageService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.Supplier;
+import com.ken.wms.exception.SupplierManageServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 供应商信息管理请求 Handler
+
+ */
+@RequestMapping(value = "/**/supplierManage")
+@Controller
+public class SupplierManageHandler {
+
+ @Autowired
+ private SupplierManageService supplierManageService;
+
+ private static final String SEARCH_BY_ID = "searchByID";
+ private static final String SEARCH_BY_NAME = "searchByName";
+ private static final String SEARCH_ALL = "searchAll";
+
+ /**
+ * 通用的记录查询
+ *
+ * @param searchType 查询类型
+ * @param keyWord 查询关键字
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 返回所有符合条件的记录
+ */
+ private Map query(String searchType, String keyWord, int offset, int limit) throws SupplierManageServiceException {
+ Map queryResult = null;
+
+ switch (searchType) {
+ case SEARCH_BY_ID:
+ if (StringUtils.isNumeric(keyWord)) {
+ queryResult = supplierManageService.selectById(Integer.valueOf(keyWord));
+ }
+ break;
+ case SEARCH_BY_NAME:
+ queryResult = supplierManageService.selectByName(offset, limit, keyWord);
+ break;
+ case SEARCH_ALL:
+ queryResult = supplierManageService.selectAll(offset, limit);
+ break;
+ default:
+ // do other thing
+ break;
+ }
+
+ return queryResult;
+ }
+
+ /**
+ * 搜索供应商信息
+ *
+ * @param searchType 搜索类型
+ * @param offset 如有多条记录时分页的偏移值
+ * @param limit 如有多条记录时分页的大小
+ * @param keyWord 搜索的关键字
+ * @return
+ */
+ @RequestMapping(value = "getSupplierList", method = RequestMethod.GET)
+ @ResponseBody
+ public Map getSupplierList(@RequestParam("searchType") String searchType,
+ @RequestParam("offset") int offset, @RequestParam("limit") int limit,
+ @RequestParam("keyWord") String keyWord) throws SupplierManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ List rows = null;
+ long total = 0;
+
+ Map queryResult = query(searchType, keyWord, offset, limit);
+
+ // 结果转换
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+
+ responseContent.setCustomerInfo("rows", rows);
+ responseContent.setResponseTotal(total);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 添加一条供应商信息
+ *
+ * @param supplier 供应商信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "addSupplier", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map addSupplier(@RequestBody Supplier supplier) throws SupplierManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 添加记录
+ String result = supplierManageService.addSupplier(supplier) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 查询指定 supplierID 供应商的信息
+ *
+ * @param supplierID 供应商ID
+ * @return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
+ * 的值为供应商信息
+ */
+ @RequestMapping(value = "getSupplierInfo", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map getSupplierInfo(@RequestParam("supplierID") int supplierID) throws SupplierManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_ERROR;
+
+ // 获取供应点信息
+ Supplier supplier = null;
+ Map queryResult = supplierManageService.selectById(supplierID);
+ if (queryResult != null) {
+ supplier = (Supplier) queryResult.get("data");
+ if (supplier != null)
+ result = Response.RESPONSE_RESULT_SUCCESS;
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseData(supplier);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 更新供应商信息
+ *
+ * @param supplier 供应商信息
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "updateSupplier", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map updateSupplier(@RequestBody Supplier supplier) throws SupplierManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 更新
+ String result = supplierManageService.updateSupplier(supplier) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 删除供应商记录
+ *
+ * @param supplierID 供应商ID
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
+ */
+ @RequestMapping(value = "deleteSupplier", method = RequestMethod.GET)
+ public
+ @ResponseBody
+ Map deleteSupplier(@RequestParam("supplierID") Integer supplierID) {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+
+ // 刪除
+ String result = supplierManageService.deleteSupplier(supplierID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导入供应商信息
+ *
+ * @param file 保存有供应商信息的文件
+ * @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
+ * error;key为total表示导入的总条数;key为available表示有效的条数
+ */
+ @RequestMapping(value = "importSupplier", method = RequestMethod.POST)
+ public
+ @ResponseBody
+ Map importSupplier(@RequestParam("file") MultipartFile file) throws SupplierManageServiceException {
+ // 初始化 Response
+ Response responseContent = ResponseFactory.newInstance();
+ String result = Response.RESPONSE_RESULT_SUCCESS;
+
+ // 读取文件内容
+ int total = 0;
+ int available = 0;
+ if (file == null)
+ result = Response.RESPONSE_RESULT_ERROR;
+ Map importInfo = supplierManageService.importSupplier(file);
+ if (importInfo != null) {
+ total = (int) importInfo.get("total");
+ available = (int) importInfo.get("available");
+ }
+
+ // 设置 Response
+ responseContent.setResponseResult(result);
+ responseContent.setResponseTotal(total);
+ responseContent.setCustomerInfo("available", available);
+ return responseContent.generateResponse();
+ }
+
+ /**
+ * 导出供应商信息
+ *
+ * @param searchType 查找类型
+ * @param keyWord 查找关键字
+ * @param response HttpServletResponse
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "exportSupplier", method = RequestMethod.GET)
+ public void exportSupplier(@RequestParam("searchType") String searchType, @RequestParam("keyWord") String keyWord,
+ HttpServletResponse response) throws SupplierManageServiceException, IOException {
+
+ String fileName = "supplierInfo.xlsx";
+
+ // 根据查询类型进行查询
+ List suppliers = null;
+ Map queryResult;
+ queryResult = query(searchType, keyWord, -1, -1);
+
+ if (queryResult != null) {
+ suppliers = (List) queryResult.get("data");
+ }
+
+ // 获取生成的文件
+ File file = supplierManageService.exportSupplier(suppliers);
+
+ // 写出文件
+ if (file != null) {
+ // 设置响应头
+ response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+ FileInputStream inputStream = new FileInputStream(file);
+ OutputStream outputStream = response.getOutputStream();
+ byte[] buffer = new byte[8192];
+
+ int len;
+ while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
+ outputStream.write(buffer, 0, len);
+ outputStream.flush();
+ }
+
+ inputStream.close();
+ outputStream.close();
+ }
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SystemLogHandler.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SystemLogHandler.java
new file mode 100644
index 0000000..906dada
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/controller/SystemLogHandler.java
@@ -0,0 +1,136 @@
+package com.ken.wms.common.controller;
+
+import com.ken.wms.common.service.Interface.SystemLogService;
+import com.ken.wms.common.util.Response;
+import com.ken.wms.common.util.ResponseFactory;
+import com.ken.wms.domain.AccessRecordDO;
+import com.ken.wms.domain.UserOperationRecordDTO;
+import com.ken.wms.exception.SystemLogServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 系统操作日志请求 Handler
+ *
+ */
+@Controller
+@RequestMapping(value = "/systemLog")
+public class SystemLogHandler {
+
+ @Autowired
+ private SystemLogService systemLogService;
+
+ /**
+ * 查询系统的登入登出日志
+ *
+ * @param userIDStr 用户ID
+ * @param accessType 记录类型(登入、登出或全部)
+ * @param startDateStr 记录的起始日期
+ * @param endDateStr 记录的结束日期
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @return 返回 JSON 数据 其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数
+ * @throws SystemLogServiceException SystemLogServiceException
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getAccessRecords", method = RequestMethod.GET)
+ public @ResponseBody
+ Map getAccessRecords(@RequestParam("userID") String userIDStr,
+ @RequestParam("accessType") String accessType,
+ @RequestParam("startDate") String startDateStr,
+ @RequestParam("endDate") String endDateStr,
+ @RequestParam("offset") int offset,
+ @RequestParam("limit") int limit) throws SystemLogServiceException {
+ // 创建 Response 对象
+ Response response = ResponseFactory.newInstance();
+ List rows = null;
+ long total = 0;
+
+ // 检查参数
+ String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
+ boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
+ boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
+ boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
+
+ if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
+ // 转到 Service 执行查询
+ Integer userID = -1;
+ if (StringUtils.isNumeric(userIDStr))
+ userID = Integer.valueOf(userIDStr);
+ Map queryResult = systemLogService.selectAccessRecord(userID, accessType, startDateStr, endDateStr, offset, limit);
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+ } else
+ response.setResponseMsg("Request Argument Error");
+
+ if (rows == null)
+ rows = new ArrayList<>(0);
+
+ // 返回 Response
+ response.setCustomerInfo("rows", rows);
+ response.setResponseTotal(total);
+ return response.generateResponse();
+ }
+
+ /**
+ * 查询系统的操作日志
+ *
+ * @param userIDStr 用户ID
+ * @param startDateStr 记录的起始日期
+ * @param endDateStr 记录的结束日期
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @return 返回 JSON 数据 其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数
+ * @throws SystemLogServiceException SystemLogServiceException
+ */
+ @SuppressWarnings("unchecked")
+ @RequestMapping(value = "getUserOperationRecords")
+ public @ResponseBody
+ Map selectUserOperationRecords(@RequestParam("userID") String userIDStr,
+ @RequestParam("startDate") String startDateStr,
+ @RequestParam("endDate") String endDateStr,
+ @RequestParam("offset") int offset,
+ @RequestParam("limit") int limit) throws SystemLogServiceException {
+ // 创建 Response
+ Response response = ResponseFactory.newInstance();
+ List rows = null;
+ long total = 0;
+
+ // 检查参数
+ String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
+ boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
+ boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
+ boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
+
+ if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
+ // 转到 Service 进行查询
+ Integer userID = -1;
+ if (StringUtils.isNumeric(userIDStr))
+ userID = Integer.valueOf(userIDStr);
+ Map queryResult = systemLogService.selectUserOperationRecord(userID, startDateStr, endDateStr, offset, limit);
+ if (queryResult != null) {
+ rows = (List) queryResult.get("data");
+ total = (long) queryResult.get("total");
+ }
+ } else
+ response.setResponseMsg("Request argument error");
+
+ if (rows == null)
+ rows = new ArrayList<>(0);
+
+ response.setCustomerInfo("rows", rows);
+ response.setResponseTotal(total);
+ return response.generateResponse();
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/CustomerManageServiceImpl.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/CustomerManageServiceImpl.java
new file mode 100644
index 0000000..3ed4265
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/CustomerManageServiceImpl.java
@@ -0,0 +1,338 @@
+package com.ken.wms.common.service.Impl;
+
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ken.wms.common.service.Interface.CustomerManageService;
+import com.ken.wms.common.util.EJConvertor;
+import com.ken.wms.common.util.FileUtil;
+import com.ken.wms.dao.CustomerMapper;
+import com.ken.wms.dao.StockOutMapper;
+import com.ken.wms.domain.Customer;
+import com.ken.wms.domain.StockOutDO;
+import com.ken.wms.exception.CustomerManageServiceException;
+import com.ken.wms.util.aop.UserOperation;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户信息管理 service 实现类
+ 主要功能包括客户信息的增删改查以及导入
+ */
+@Service
+public class CustomerManageServiceImpl implements CustomerManageService {
+
+ @Autowired
+ private CustomerMapper customerMapper;
+ @Autowired
+ private StockOutMapper stockOutMapper;
+ @Autowired
+ private EJConvertor ejConvertor;
+
+ /**
+ * 返回指定customer id 的客户记录
+ *
+ * @param customerId 客户ID
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectById(Integer customerId) throws CustomerManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List customers = new ArrayList<>();
+ long total = 0;
+
+ // 查询
+ Customer customer;
+ try {
+ customer = customerMapper.selectById(customerId);
+ } catch (PersistenceException e) {
+ System.out.println("exception catch");
+ e.printStackTrace();
+ throw new CustomerManageServiceException(e);
+ }
+
+ if (customer != null) {
+ customers.add(customer);
+ total = 1;
+ }
+
+ resultSet.put("data", customers);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 customer name 的客户记录 支持查询分页以及模糊查询
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @param customerName 客户的名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByName(int offset, int limit, String customerName) throws CustomerManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List customers;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ customers = customerMapper.selectApproximateByName(customerName);
+ if (customers != null) {
+ PageInfo pageInfo = new PageInfo<>(customers);
+ total = pageInfo.getTotal();
+ } else
+ customers = new ArrayList<>();
+ } else {
+ customers = customerMapper.selectApproximateByName(customerName);
+ if (customers != null)
+ total = customers.size();
+ else
+ customers = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new CustomerManageServiceException(e);
+ }
+
+ resultSet.put("data", customers);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 customer Name 的客户记录 支持模糊查询
+ *
+ * @param customerName 客户名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByName(String customerName) throws CustomerManageServiceException {
+ return selectByName(-1, -1, customerName);
+ }
+
+ /**
+ * 分页查询客户的记录
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll(int offset, int limit) throws CustomerManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List customers;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ customers = customerMapper.selectAll();
+ if (customers != null) {
+ PageInfo pageInfo = new PageInfo<>(customers);
+ total = pageInfo.getTotal();
+ } else
+ customers = new ArrayList<>();
+ } else {
+ customers = customerMapper.selectAll();
+ if (customers != null)
+ total = customers.size();
+ else
+ customers = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new CustomerManageServiceException(e);
+ }
+
+ resultSet.put("data", customers);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 查询所有客户的记录
+ *
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll() throws CustomerManageServiceException {
+ return selectAll(-1, -1);
+ }
+
+ /**
+ * 检查客户信息是否满足要求
+ *
+ * @param customer 客户信息实体
+ * @return 返回是否满足要求
+ */
+ private boolean customerCheck(Customer customer) {
+ return customer.getName() != null && customer.getPersonInCharge() != null && customer.getTel() != null
+ && customer.getEmail() != null && customer.getAddress() != null;
+ }
+
+ /**
+ * 添加客户信息
+ *
+ * @param customer 客户信息
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "添加客户信息")
+ @Override
+ public boolean addCustomer(Customer customer) throws CustomerManageServiceException {
+
+ // 插入新的记录
+ if (customer != null) {
+ // 验证
+ if (customerCheck(customer)) {
+ try {
+ if (null == customerMapper.selectByName(customer.getName())) {
+ customerMapper.insert(customer);
+ return true;
+ }
+ } catch (PersistenceException e) {
+ throw new CustomerManageServiceException(e);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 更新客户信息
+ *
+ * @param customer 客户信息
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "修改客户信息")
+ @Override
+ public boolean updateCustomer(Customer customer) throws CustomerManageServiceException {
+
+ // 更新记录
+ if (customer != null) {
+ // 检验
+ if (customerCheck(customer)) {
+ try {
+ // 检查重名
+ Customer customerFromDB = customerMapper.selectByName(customer.getName());
+ if (customerFromDB == null || customerFromDB.getId().equals(customer.getId())) {
+ customerMapper.update(customer);
+ return true;
+ }
+ } catch (PersistenceException e) {
+ throw new CustomerManageServiceException(e);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 删除客户信息
+ *
+ * @param customerId 客户ID
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "删除客户信息")
+ @Override
+ public boolean deleteCustomer(Integer customerId) throws CustomerManageServiceException {
+
+ try {
+ // 查询该客户是否有出库记录
+ List records = stockOutMapper.selectByCustomerId(customerId);
+ if (records != null && records.size() > 0) {
+ return false;
+ } else {
+ // 删除该条客户记录
+ customerMapper.deleteById(customerId);
+ return true;
+
+ }
+ } catch (PersistenceException e) {
+ throw new CustomerManageServiceException(e);
+ }
+ }
+
+ /**
+ * 从文件中导入客户信息
+ *
+ * @param file 导入信息的文件
+ * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数
+ */
+ @UserOperation(value = "导入客户信息")
+ @Override
+ public Map importCustomer(MultipartFile file) throws CustomerManageServiceException {
+ // 初始化结果集
+ Map result = new HashMap<>();
+ int total = 0;
+ int available = 0;
+
+ // 从 Excel 文件中读取
+ try {
+ List customers = ejConvertor.excelReader(Customer.class, FileUtil.convertMultipartFileToFile(file));
+ if (customers != null) {
+ total = customers.size();
+
+ // 验证每一条记录
+ List availableList = new ArrayList<>();
+ for (Customer customer : customers) {
+ if (customerCheck(customer)) {
+ if (customerMapper.selectByName(customer.getName()) == null)
+ availableList.add(customer);
+ }
+ }
+
+ // 保存到数据库
+ available = availableList.size();
+ if (available > 0) {
+ customerMapper.insertBatch(availableList);
+ }
+ }
+ } catch (PersistenceException | IOException e) {
+ throw new CustomerManageServiceException(e);
+ }
+
+ result.put("total", total);
+ result.put("available", available);
+ return result;
+ }
+
+ /**
+ * 导出客户信息到文件中
+ *
+ * @param customers 包含若干条 customer 信息的 List
+ * @return Excel 文件
+ */
+ @UserOperation(value = "导出客户信息")
+ @Override
+ public File exportCustomer(List customers) {
+ if (customers == null)
+ return null;
+
+ return ejConvertor.excelWriter(Customer.class, customers);
+ }
+
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/GoodsManageServiceImpl.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/GoodsManageServiceImpl.java
new file mode 100644
index 0000000..c045087
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/GoodsManageServiceImpl.java
@@ -0,0 +1,348 @@
+package com.ken.wms.common.service.Impl;
+
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ken.wms.common.service.Interface.GoodsManageService;
+import com.ken.wms.common.util.EJConvertor;
+import com.ken.wms.common.util.FileUtil;
+import com.ken.wms.dao.GoodsMapper;
+import com.ken.wms.dao.StockInMapper;
+import com.ken.wms.dao.StockOutMapper;
+import com.ken.wms.dao.StorageMapper;
+import com.ken.wms.domain.Goods;
+import com.ken.wms.domain.StockInDO;
+import com.ken.wms.domain.StockOutDO;
+import com.ken.wms.domain.Storage;
+import com.ken.wms.exception.GoodsManageServiceException;
+import com.ken.wms.util.aop.UserOperation;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 货物信息管理Service 实现类
+
+ */
+@Service
+public class GoodsManageServiceImpl implements GoodsManageService {
+
+ @Autowired
+ private GoodsMapper goodsMapper;
+ @Autowired
+ private StockInMapper stockInMapper;
+ @Autowired
+ private StockOutMapper stockOutMapper;
+ @Autowired
+ private StorageMapper storageMapper;
+ @Autowired
+ private EJConvertor ejConvertor;
+
+ /**
+ * 返回指定goods ID 的货物记录
+ *
+ * @param goodsId 货物ID
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectById(Integer goodsId) throws GoodsManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List goodsList = new ArrayList<>();
+ long total = 0;
+
+ // 查询
+ Goods goods;
+ try {
+ goods = goodsMapper.selectById(goodsId);
+ } catch (PersistenceException e) {
+ throw new GoodsManageServiceException(e);
+ }
+
+ if (goods != null) {
+ goodsList.add(goods);
+ total = 1;
+ }
+
+ resultSet.put("data", goodsList);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 goods name 的货物记录 支持查询分页以及模糊查询
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @param goodsName 货物的名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByName(int offset, int limit, String goodsName) throws GoodsManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List goodsList;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ goodsList = goodsMapper.selectApproximateByName(goodsName);
+ if (goodsList != null) {
+ PageInfo pageInfo = new PageInfo<>(goodsList);
+ total = pageInfo.getTotal();
+ } else
+ goodsList = new ArrayList<>();
+ } else {
+ goodsList = goodsMapper.selectApproximateByName(goodsName);
+ if (goodsList != null)
+ total = goodsList.size();
+ else
+ goodsList = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new GoodsManageServiceException(e);
+ }
+
+ resultSet.put("data", goodsList);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 goods name 的货物记录 支持模糊查询
+ *
+ * @param goodsName 货物名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByName(String goodsName) throws GoodsManageServiceException {
+ return selectByName(-1, -1, goodsName);
+ }
+
+ /**
+ * 分页查询货物记录
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll(int offset, int limit) throws GoodsManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List goodsList;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ goodsList = goodsMapper.selectAll();
+ if (goodsList != null) {
+ PageInfo pageInfo = new PageInfo<>(goodsList);
+ total = pageInfo.getTotal();
+ } else
+ goodsList = new ArrayList<>();
+ } else {
+ goodsList = goodsMapper.selectAll();
+ if (goodsList != null)
+ total = goodsList.size();
+ else
+ goodsList = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new GoodsManageServiceException(e);
+ }
+
+ resultSet.put("data", goodsList);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 查询所有的货物记录
+ *
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll() throws GoodsManageServiceException {
+ return selectAll(-1, -1);
+ }
+
+ /**
+ * 检查货物信息是否满足要求
+ *
+ * @param goods 货物信息
+ * @return 若货物信息满足要求则返回true,否则返回false
+ */
+ private boolean goodsCheck(Goods goods) {
+ if (goods != null) {
+ if (goods.getName() != null && goods.getValue() != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 添加货物记录
+ *
+ * @param goods 货物信息
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "添加货物信息")
+ @Override
+ public boolean addGoods(Goods goods) throws GoodsManageServiceException {
+
+ try {
+ // 插入新的记录
+ if (goods != null) {
+ // 验证
+ if (goodsCheck(goods)) {
+ goodsMapper.insert(goods);
+ return true;
+ }
+ }
+ return false;
+ } catch (PersistenceException e) {
+ throw new GoodsManageServiceException(e);
+ }
+ }
+
+ /**
+ * 更新货物记录
+ *
+ * @param goods 货物信息
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "修改货物信息")
+ @Override
+ public boolean updateGoods(Goods goods) throws GoodsManageServiceException {
+
+ try {
+ // 更新记录
+ if (goods != null) {
+ // 检验
+ if (goodsCheck(goods)) {
+ goodsMapper.update(goods);
+ return true;
+ }
+ }
+ return false;
+ } catch (PersistenceException e) {
+ throw new GoodsManageServiceException(e);
+ }
+ }
+
+ /**
+ * 删除货物记录
+ *
+ * @param goodsId 货物ID
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "删除货物信息")
+ @Override
+ public boolean deleteGoods(Integer goodsId) throws GoodsManageServiceException {
+
+ try {
+ // 检查该货物是否有入库信息
+ List stockInDORecord = stockInMapper.selectByGoodID(goodsId);
+ if (stockInDORecord != null && !stockInDORecord.isEmpty())
+ return false;
+
+ // 检查该货物是否有出库信息
+ List stockOutDORecord = stockOutMapper.selectByGoodId(goodsId);
+ if (stockOutDORecord != null && !stockOutDORecord.isEmpty())
+ return false;
+
+ // 检查该货物是否有存储信息
+ List storageRecord = storageMapper.selectByGoodsIDAndRepositoryID(goodsId, null);
+ if (storageRecord != null && !storageRecord.isEmpty())
+ return false;
+
+ // 删除货物记录
+ goodsMapper.deleteById(goodsId);
+ return true;
+ } catch (PersistenceException e) {
+ throw new GoodsManageServiceException(e);
+ }
+ }
+
+ /**
+ * 从文件中导入货物信息
+ *
+ * @param file 导入信息的文件
+ * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数
+ */
+ @UserOperation(value = "导入货物信息")
+ @Override
+ public Map importGoods(MultipartFile file) throws GoodsManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ int total = 0;
+ int available = 0;
+
+ // 从 Excel 文件中读取
+ try {
+ List goodsList = ejConvertor.excelReader(Goods.class, FileUtil.convertMultipartFileToFile(file));
+ if (goodsList != null) {
+ total = goodsList.size();
+
+ // 验证每一条记录
+ List availableList = new ArrayList<>();
+ for (Goods goods : goodsList) {
+ if (goodsCheck(goods)) {
+ availableList.add(goods);
+ }
+ }
+ // 保存到数据库
+ available = availableList.size();
+ if (available > 0) {
+ goodsMapper.insertBatch(availableList);
+ }
+ }
+ } catch (PersistenceException | IOException e) {
+ throw new GoodsManageServiceException(e);
+ }
+
+ resultSet.put("total", total);
+ resultSet.put("available", available);
+ return resultSet;
+ }
+
+ /**
+ * 导出货物信息到文件中
+ *
+ * @param goods 包含若干条 Supplier 信息的 List
+ * @return excel 文件
+ */
+ @UserOperation(value = "导出货物信息")
+ @Override
+ public File exportGoods(List goods) {
+ if (goods == null)
+ return null;
+
+ return ejConvertor.excelWriter(Goods.class, goods);
+ }
+
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryAdminManageServiceImpl.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryAdminManageServiceImpl.java
new file mode 100644
index 0000000..d267bc9
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryAdminManageServiceImpl.java
@@ -0,0 +1,405 @@
+package com.ken.wms.common.service.Impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ken.wms.common.service.Interface.RepositoryAdminManageService;
+import com.ken.wms.common.util.EJConvertor;
+import com.ken.wms.common.util.FileUtil;
+import com.ken.wms.dao.RepositoryAdminMapper;
+import com.ken.wms.domain.RepositoryAdmin;
+import com.ken.wms.domain.UserInfoDTO;
+import com.ken.wms.exception.RepositoryAdminManageServiceException;
+import com.ken.wms.exception.UserInfoServiceException;
+import com.ken.wms.security.service.Interface.UserInfoService;
+import com.ken.wms.util.aop.UserOperation;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * 仓库管理员管理 service 实现类
+
+ */
+@Service
+public class RepositoryAdminManageServiceImpl implements RepositoryAdminManageService {
+
+ @Autowired
+ private RepositoryAdminMapper repositoryAdminMapper;
+ @Autowired
+ private EJConvertor ejConvertor;
+ @Autowired
+ private UserInfoService userInfoService;
+
+ /**
+ * 返回指定repository id 的仓库管理员记录
+ *
+ * @param repositoryAdminID 仓库管理员ID
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByID(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List repositoryAdmins = new ArrayList<>();
+ long total = 0;
+
+ // 查询
+ RepositoryAdmin repositoryAdmin;
+ try {
+ repositoryAdmin = repositoryAdminMapper.selectByID(repositoryAdminID);
+ } catch (PersistenceException e) {
+ throw new RepositoryAdminManageServiceException(e);
+ }
+
+ if (repositoryAdmin != null) {
+ repositoryAdmins.add(repositoryAdmin);
+ total = 1;
+ }
+
+ resultSet.put("data", repositoryAdmins);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 repository address 的仓库管理员记录 支持查询分页以及模糊查询
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @param name 仓库管理员的名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByName(int offset, int limit, String name) {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List repositoryAdmins;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ repositoryAdmins = repositoryAdminMapper.selectByName(name);
+ if (repositoryAdmins != null) {
+ PageInfo pageInfo = new PageInfo<>(repositoryAdmins);
+ total = pageInfo.getTotal();
+ } else
+ repositoryAdmins = new ArrayList<>();
+ } else {
+ repositoryAdmins = repositoryAdminMapper.selectByName(name);
+ if (repositoryAdmins != null)
+ total = repositoryAdmins.size();
+ else
+ repositoryAdmins = new ArrayList<>();
+ }
+
+ resultSet.put("data", repositoryAdmins);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 repository Name 的仓库管理员记录 支持模糊查询
+ *
+ * @param name 仓库管理员名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByName(String name) {
+ return selectByName(-1, -1, name);
+ }
+
+ /**
+ * 分页查询仓库管理员的记录
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll(int offset, int limit) throws RepositoryAdminManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List repositoryAdmins;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ repositoryAdmins = repositoryAdminMapper.selectAll();
+ if (repositoryAdmins != null) {
+ PageInfo pageInfo = new PageInfo<>(repositoryAdmins);
+ total = pageInfo.getTotal();
+ } else
+ repositoryAdmins = new ArrayList<>();
+ } else {
+ repositoryAdmins = repositoryAdminMapper.selectAll();
+ if (repositoryAdmins != null)
+ total = repositoryAdmins.size();
+ else
+ repositoryAdmins = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new RepositoryAdminManageServiceException(e);
+ }
+
+ resultSet.put("data", repositoryAdmins);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 查询所有仓库管理员的记录
+ *
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll() throws RepositoryAdminManageServiceException {
+ return selectAll(-1, -1);
+ }
+
+ /**
+ * 添加仓库管理员信息
+ *
+ * @param repositoryAdmin 仓库管理员信息
+ * @return 返回一个boolean值,值为true代表添加成功,否则代表失败
+ */
+ @UserOperation(value = "添加仓库管理员信息")
+ @Override
+ public boolean addRepositoryAdmin(RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
+
+ if (repositoryAdmin != null) {
+ if (repositoryAdminCheck(repositoryAdmin)) {
+ try {
+ // 添加仓库管理员信息到数据库中
+ repositoryAdminMapper.insert(repositoryAdmin);
+
+ // 获取插入数据后返回的用户ID
+ Integer userID = repositoryAdmin.getId();
+ if (userID == null)
+ return false;
+
+ // 为仓库管理员创建账户
+ UserInfoDTO userInfo = new UserInfoDTO();
+ userInfo.setUserID(userID);
+ userInfo.setUserName(repositoryAdmin.getName());
+ userInfo.setPassword(repositoryAdmin.getId().toString());
+ userInfo.setRole(new ArrayList<>(Collections.singletonList("commonsAdmin")));
+
+ // 添加新创建的仓库管理员账户信息
+ return userInfoService.insertUserInfo(userInfo);
+
+ } catch (PersistenceException | UserInfoServiceException e) {
+ throw new RepositoryAdminManageServiceException(e, "Fail to persist repository admin info");
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 更新仓库管理员信息
+ *
+ * @param repositoryAdmin 仓库管理员信息
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "修改仓库管理员信息")
+ @Override
+ public boolean updateRepositoryAdmin(RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
+
+ if (repositoryAdmin != null) {
+ try {
+ // 检查属性
+ if (!repositoryAdminCheck(repositoryAdmin))
+ return false;
+
+ // 若有指派的仓库则检查
+ if (repositoryAdmin.getRepositoryBelongID() != null) {
+ RepositoryAdmin rAdminFromDB = repositoryAdminMapper.selectByRepositoryID(repositoryAdmin.getRepositoryBelongID());
+ if (rAdminFromDB != null && !Objects.equals(rAdminFromDB.getId(), repositoryAdmin.getId()))
+ return false;
+ }
+
+ // 更新
+ repositoryAdminMapper.update(repositoryAdmin);
+
+ return true;
+ } catch (PersistenceException e) {
+ throw new RepositoryAdminManageServiceException(e);
+ }
+ } else
+ return false;
+
+ }
+
+ /**
+ * 删除仓库管理员信息
+ *
+ * @param repositoryAdminID 仓库管理员ID
+ * @return 返回一个boolean值,值为true代表删除成功,否则代表失败
+ */
+ @UserOperation(value = "删除仓库管理员信息")
+ @Override
+ public boolean deleteRepositoryAdmin(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
+
+ try {
+ // 判断是否已指派仓库
+ RepositoryAdmin repositoryAdmin = repositoryAdminMapper.selectByID(repositoryAdminID);
+ if (repositoryAdmin != null && repositoryAdmin.getRepositoryBelongID() == null) {
+
+ // 删除仓库管理员信息
+ repositoryAdminMapper.deleteByID(repositoryAdminID);
+
+ // 删除账户信息
+ userInfoService.deleteUserInfo(repositoryAdminID);
+
+ return true;
+ } else
+ return false;
+ } catch (PersistenceException | UserInfoServiceException e) {
+ throw new RepositoryAdminManageServiceException(e);
+ }
+ }
+
+ /**
+ * 为仓库管理员指派指定 ID 的仓库
+ *
+ * @param repositoryAdminID 仓库管理员ID
+ * @param repositoryID 所指派的仓库ID
+ * @return 返回一个 boolean 值,值为 true 表示仓库指派成功,否则表示失败
+ */
+ @UserOperation(value = "指派仓库管理员")
+ @Override
+ public boolean assignRepository(Integer repositoryAdminID, Integer repositoryID) throws RepositoryAdminManageServiceException {
+
+ try {
+ RepositoryAdmin repositoryAdmin = repositoryAdminMapper.selectByID(repositoryAdminID);
+ if (repositoryAdmin != null) {
+ repositoryAdmin.setRepositoryBelongID(repositoryID);
+ return updateRepositoryAdmin(repositoryAdmin);
+ } else
+ return false;
+ } catch (PersistenceException e) {
+ throw new RepositoryAdminManageServiceException(e);
+ }
+ }
+
+ /**
+ * 从文件中导入仓库管理员信息
+ *
+ * @param file 导入信息的文件
+ * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数
+ */
+ @UserOperation(value = "导入仓库管理员信息")
+ @Override
+ public Map importRepositoryAdmin(MultipartFile file) throws RepositoryAdminManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ long total = 0;
+ long available = 0;
+
+ // 从文件中读取
+ try {
+ List repositoryAdmins = ejConvertor.excelReader(RepositoryAdmin.class, FileUtil.convertMultipartFileToFile(file));
+
+ if (repositoryAdmins != null) {
+ total = repositoryAdmins.size();
+
+ // 验证记录
+ List availableList = new ArrayList<>();
+ for (RepositoryAdmin repositoryAdmin : repositoryAdmins) {
+ if (repositoryAdminCheck(repositoryAdmin))
+ availableList.add(repositoryAdmin);
+ }
+
+ // 保存到数据库
+ available = availableList.size();
+ if (available > 0)
+ repositoryAdminMapper.insertBatch(availableList);
+ }
+ } catch (PersistenceException | IOException e) {
+ throw new RepositoryAdminManageServiceException(e);
+ }
+
+ resultSet.put("total", total);
+ resultSet.put("available", available);
+ return resultSet;
+ }
+
+ /**
+ * 导出仓库管理员信息到文件中
+ *
+ * @param repositoryAdmins 包含若干条 repository 信息的 List
+ * @return Excel 文件
+ */
+ @UserOperation(value = "导出仓库管理员信息")
+ @Override
+ public File exportRepositoryAdmin(List repositoryAdmins) {
+ File file = null;
+
+ if (repositoryAdmins != null) {
+ file = ejConvertor.excelWriter(RepositoryAdmin.class, repositoryAdmins);
+ }
+
+ return file;
+ }
+
+ /**
+ * 检验 repositoryAdmin 信息是否有效
+ *
+ * @param repositoryAdmin 仓库管理员信息
+ * @return 返回一个 boolean 值,若仓库管理员信息中要求非空均有值,返回 true,否则返回 false
+ */
+ private boolean repositoryAdminCheck(RepositoryAdmin repositoryAdmin) {
+
+ return repositoryAdmin.getName() != null && repositoryAdmin.getSex() != null && repositoryAdmin.getTel() != null
+ && repositoryAdmin.getBirth() != null && repositoryAdmin.getBirth() != null;
+ }
+
+ /**
+ * 返回所属指定 repositoryID 的仓库管理员信息
+ *
+ * @param repositoryID 仓库ID 其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ * @return 返回一个Map,
+ */
+ @Override
+ public Map selectByRepositoryID(Integer repositoryID) throws RepositoryAdminManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List repositoryAdmins = new ArrayList<>();
+ long total = 0;
+
+ // 查询
+ RepositoryAdmin repositoryAdmin;
+ try {
+ repositoryAdmin = repositoryAdminMapper.selectByRepositoryID(repositoryID);
+ } catch (PersistenceException e) {
+ throw new RepositoryAdminManageServiceException(e);
+ }
+
+ if (repositoryAdmin != null) {
+ repositoryAdmins.add(repositoryAdmin);
+ total = 1;
+ }
+
+ resultSet.put("data", repositoryAdmins);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryManageServiceImpl.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryManageServiceImpl.java
new file mode 100644
index 0000000..c104e0f
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/RepositoryManageServiceImpl.java
@@ -0,0 +1,377 @@
+package com.ken.wms.common.service.Impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ken.wms.common.service.Interface.RepositoryService;
+import com.ken.wms.common.util.EJConvertor;
+import com.ken.wms.common.util.FileUtil;
+import com.ken.wms.dao.*;
+import com.ken.wms.domain.*;
+import com.ken.wms.exception.RepositoryManageServiceException;
+import com.ken.wms.util.aop.UserOperation;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 仓库信息管理 service 实现类
+
+ */
+@Service
+public class RepositoryManageServiceImpl implements RepositoryService {
+
+ @Autowired
+ private RepositoryMapper repositoryMapper;
+ @Autowired
+ private EJConvertor ejConvertor;
+ @Autowired
+ private StockInMapper stockInMapper;
+ @Autowired
+ private StockOutMapper stockOutMapper;
+ @Autowired
+ private StorageMapper storageMapper;
+ @Autowired
+ private RepositoryAdminMapper repositoryAdminMapper;
+
+ /**
+ * 返回指定 repository ID 的仓库记录
+ *
+ * @param repositoryId 仓库ID
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectById(Integer repositoryId) throws RepositoryManageServiceException {
+ // 初始化結果集
+ Map resultSet = new HashMap<>();
+ List repositories = new ArrayList<>();
+ long total = 0;
+
+ // 查詢
+ Repository repository;
+ try {
+ repository = repositoryMapper.selectByID(repositoryId);
+ } catch (PersistenceException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+
+ if (repository != null) {
+ repositories.add(repository);
+ total = 1;
+ }
+
+ resultSet.put("data", repositories);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 repository address 的仓库记录 支持查询分页以及模糊查询
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @param address 仓库的地址
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByAddress(int offset, int limit, String address) throws RepositoryManageServiceException {
+ // 初始化結果集
+ Map resultSet = new HashMap<>();
+ List repositories;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ repositories = repositoryMapper.selectByAddress(address);
+ if (repositories != null) {
+ PageInfo pageInfo = new PageInfo<>(repositories);
+ total = pageInfo.getTotal();
+ } else
+ repositories = new ArrayList<>();
+ } else {
+ repositories = repositoryMapper.selectByAddress(address);
+ if (repositories != null)
+ total = repositories.size();
+ else
+ repositories = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+
+ resultSet.put("data", repositories);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定 repository address 的仓库记录 支持模糊查询
+ *
+ * @param address 仓库名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByAddress(String address) throws RepositoryManageServiceException {
+ return selectByAddress(-1, -1, address);
+ }
+
+ /**
+ * 分页查询仓库记录
+ *
+ * @param offset 分页的偏移值
+ * @param limit 分页的大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll(int offset, int limit) throws RepositoryManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List repositories;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ //query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ repositories = repositoryMapper.selectAll();
+ if (repositories != null) {
+ PageInfo pageInfo = new PageInfo<>(repositories);
+ total = pageInfo.getTotal();
+ } else
+ repositories = new ArrayList<>();
+ } else {
+ repositories = repositoryMapper.selectAll();
+ if (repositories != null)
+ total = repositories.size();
+ else
+ repositories = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+
+ resultSet.put("data", repositories);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 查询所有的仓库记录
+ *
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll() throws RepositoryManageServiceException {
+ return selectAll(-1, -1);
+ }
+
+ /**
+ * 检查仓库信息是否满足
+ *
+ * @param repository 仓库信息
+ * @return 若仓库信息满足要求则返回true,否则返回false
+ */
+ private boolean repositoryCheck(Repository repository) {
+ return repository.getAddress() != null && repository.getStatus() != null && repository.getArea() != null;
+ }
+
+ /**
+ * 添加仓库记录
+ *
+ * @param repository 仓库信息
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "添加仓库信息")
+ @Override
+ public boolean addRepository(Repository repository) throws RepositoryManageServiceException {
+
+ // 插入一条新的记录
+ if (repository != null) {
+ try {
+ // 有效性验证
+ if (repositoryCheck(repository))
+ repositoryMapper.insert(repository);
+ if (repository.getId() != null) {
+ return true;
+ }
+ } catch (PersistenceException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 更新仓库记录
+ *
+ * @param repository 仓库信息
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "修改仓库信息")
+ @Override
+ public boolean updateRepository(Repository repository) throws RepositoryManageServiceException {
+
+ // 更新仓库记录
+ if (repository != null) {
+ // 有效性验证
+ try {
+ if (repositoryCheck(repository)) {
+ if (repository.getId() != null) {
+ repositoryMapper.update(repository);
+ return true;
+ }
+ }
+ } catch (PersistenceException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 删除仓库记录
+ *
+ * @param repositoryId 仓库ID
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "删除仓库信息")
+ @Override
+ public boolean deleteRepository(Integer repositoryId) throws RepositoryManageServiceException {
+
+ try {
+ // 检查是否存在出库记录
+ List stockOutDOList = stockOutMapper.selectByRepositoryID(repositoryId);
+ if (stockOutDOList != null && !stockOutDOList.isEmpty())
+ return false;
+
+ // 检查是否存在入库记录
+ List stockInDOList = stockInMapper.selectByRepositoryID(repositoryId);
+ if (stockInDOList != null && !stockInDOList.isEmpty())
+ return false;
+
+ // 检查是否存在库存记录
+ List storageRecords = storageMapper.selectAllAndRepositoryID(repositoryId);
+ if (storageRecords != null && !storageRecords.isEmpty())
+ return false;
+
+ // 检查是否已指派仓库管理员
+ RepositoryAdmin repositoryAdmin = repositoryAdminMapper.selectByRepositoryID(repositoryId);
+ if (repositoryAdmin != null)
+ return false;
+
+ // 删除记录
+ repositoryMapper.deleteByID(repositoryId);
+
+ return true;
+ } catch (PersistenceException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+ }
+
+ /**
+ * 从文件中导入仓库信息
+ *
+ * @param file 导入信息的文件
+ * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数
+ */
+ @UserOperation(value = "导入仓库信息")
+ @Override
+ public Map importRepository(MultipartFile file) throws RepositoryManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ int total = 0;
+ int available = 0;
+
+ // 从文件中读取
+ try {
+ List repositories = ejConvertor.excelReader(Repository.class, FileUtil.convertMultipartFileToFile(file));
+
+ if (repositories != null) {
+ total = repositories.size();
+
+ // 验证每一条记录
+ List availableList = new ArrayList<>();
+ for (Repository repository : repositories) {
+ if (repository.getAddress() != null && repository.getStatus() != null && repository.getArea() != null)
+ availableList.add(repository);
+ }
+
+ // 保存到数据库
+ available = availableList.size();
+ if (available > 0)
+ repositoryMapper.insertbatch(availableList);
+ }
+ } catch (PersistenceException | IOException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+
+
+ resultSet.put("total", total);
+ resultSet.put("available", available);
+ return resultSet;
+ }
+
+ /**
+ * 导出仓库信息到文件中
+ *
+ * @param repositories 包含若干条 Supplier 信息的 List
+ * @return excel 文件
+ */
+ @UserOperation(value = "导出仓库信息")
+ @Override
+ public File exportRepository(List repositories) {
+ if (repositories == null)
+ return null;
+
+ // 导出为文件
+ return ejConvertor.excelWriter(Repository.class, repositories);
+ }
+
+ /**
+ * 查询所有未指派仓库管理员的仓库记录
+ *
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectUnassign() throws RepositoryManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List repositories;
+ long total = 0;
+
+ // 查询
+ try {
+ repositories = repositoryMapper.selectUnassign();
+ } catch (PersistenceException e) {
+ throw new RepositoryManageServiceException(e);
+ }
+ if (repositories != null)
+ total = repositories.size();
+ else
+ repositories = new ArrayList<>();
+
+ resultSet.put("data", repositories);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StockRecordManageServiceImpl.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StockRecordManageServiceImpl.java
new file mode 100644
index 0000000..311abcd
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StockRecordManageServiceImpl.java
@@ -0,0 +1,443 @@
+package com.ken.wms.common.service.Impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ken.wms.common.service.Interface.StockRecordManageService;
+import com.ken.wms.common.service.Interface.StorageManageService;
+import com.ken.wms.dao.*;
+import com.ken.wms.domain.*;
+import com.ken.wms.exception.StockRecordManageServiceException;
+import com.ken.wms.exception.StorageManageServiceException;
+import com.ken.wms.util.aop.UserOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Service
+public class StockRecordManageServiceImpl implements StockRecordManageService {
+
+ @Autowired
+ private SupplierMapper supplierMapper;
+ @Autowired
+ private CustomerMapper customerMapper;
+ @Autowired
+ private GoodsMapper goodsMapper;
+ @Autowired
+ private RepositoryMapper repositoryMapper;
+ @Autowired
+ private StorageManageService storageManageService;
+ @Autowired
+ private StockInMapper stockinMapper;
+ @Autowired
+ private StockOutMapper stockOutMapper;
+
+ /**
+ * 货物入库操作
+ *
+ * @param supplierID 供应商ID
+ * @param goodsID 货物ID
+ * @param repositoryID 入库仓库ID
+ * @param number 入库数量
+ * @return 返回一个boolean 值,若值为true表示入库成功,否则表示入库失败
+ */
+ @UserOperation(value = "货物入库")
+ @Override
+ public boolean stockInOperation(Integer supplierID, Integer goodsID, Integer repositoryID, long number, String personInCharge) throws StockRecordManageServiceException {
+
+ // ID对应的记录是否存在
+ if (!(supplierValidate(supplierID) && goodsValidate(goodsID) && repositoryValidate(repositoryID)))
+ return false;
+
+ if (personInCharge == null)
+ return false;
+
+ // 检查入库数量有效性
+ if (number < 0)
+ return false;
+
+ try {
+ // 更新库存记录
+ boolean isSuccess;
+ isSuccess = storageManageService.storageIncrease(goodsID, repositoryID, number);
+
+ // 保存入库记录
+ if (isSuccess) {
+ StockInDO stockInDO = new StockInDO();
+ stockInDO.setGoodID(goodsID);
+ stockInDO.setSupplierID(supplierID);
+ stockInDO.setNumber(number);
+ stockInDO.setPersonInCharge(personInCharge);
+ stockInDO.setTime(new Date());
+ stockInDO.setRepositoryID(repositoryID);
+ stockinMapper.insert(stockInDO);
+ }
+
+ return isSuccess;
+ } catch (PersistenceException | StorageManageServiceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+ }
+
+ /**
+ * 货物出库操作
+ *
+ * @param customerID 客户ID
+ * @param goodsID 货物ID
+ * @param repositoryID 出库仓库ID
+ * @param number 出库数量
+ * @return 返回一个boolean值,若值为true表示出库成功,否则表示出库失败
+ */
+ @UserOperation(value = "货物出库")
+ @Override
+ public boolean stockOutOperation(Integer customerID, Integer goodsID, Integer repositoryID, long number, String personInCharge) throws StockRecordManageServiceException {
+
+ // 检查ID对应的记录是否存在
+ if (!(customerValidate(customerID) && goodsValidate(goodsID) && repositoryValidate(repositoryID)))
+ return false;
+
+ // 检查出库数量范围是否有效
+ if (number < 0)
+ return false;
+
+ try {
+ // 更新库存信息
+ boolean isSuccess;
+ isSuccess = storageManageService.storageDecrease(goodsID, repositoryID, number);
+
+ // 保存出库记录
+ if (isSuccess) {
+ StockOutDO stockOutDO = new StockOutDO();
+ stockOutDO.setCustomerID(customerID);
+ stockOutDO.setGoodID(goodsID);
+ stockOutDO.setNumber(number);
+ stockOutDO.setPersonInCharge(personInCharge);
+ stockOutDO.setRepositoryID(repositoryID);
+ stockOutDO.setTime(new Date());
+ stockOutMapper.insert(stockOutDO);
+ }
+
+ return isSuccess;
+ } catch (PersistenceException | StorageManageServiceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+ }
+
+ /**
+ * 查询出入库记录
+ *
+ * @param repositoryID 仓库ID
+ * @param endDateStr 查询记录起始日期
+ * @param startDateStr 查询记录结束日期
+ * @param searchType 记录查询方式
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectStockRecord(Integer repositoryID, String startDateStr, String endDateStr, String searchType) throws StockRecordManageServiceException {
+ return selectStockRecord(repositoryID, startDateStr, endDateStr, searchType, -1, -1);
+ }
+
+ /**
+ * 分页查询出入库记录
+ *
+ * @param repositoryID 仓库ID
+ * @param endDateStr 查询记录起始日期
+ * @param startDateStr 查询记录结束日期
+ * @param searchType 记录查询方式
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Map selectStockRecord(Integer repositoryID, String startDateStr, String endDateStr, String searchType, int offset, int limit) throws StockRecordManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ long total = 0;
+
+ // 检查传入参数
+ if (repositoryID == null || searchType == null)
+ throw new StockRecordManageServiceException("exception");
+
+ // 转换 Date 对象
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ Date startDate = null;
+ Date endDate = null;
+ try {
+ if (StringUtils.isNotEmpty(startDateStr))
+ startDate = dateFormat.parse(startDateStr);
+ if (StringUtils.isNotEmpty(endDateStr))
+ endDate = dateFormat.parse(endDateStr);
+ } catch (ParseException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+
+ // 根据查询模式执行查询
+ List stockRecordDTOS = new ArrayList<>();
+ Map stockInTemp;
+ Map stockOutTemp;
+ List stockInRecordDOS = null;
+ List stockOutRecordDOS = null;
+ switch (searchType) {
+ case "all": {
+ if (offset < 0 || limit < 0) {
+ stockInTemp = selectStockInRecord(repositoryID, startDate, endDate, offset, limit);
+ stockOutTemp = selectStockOutRecord(repositoryID, startDate, endDate, offset, limit);
+ stockInRecordDOS = (List) stockInTemp.get("data");
+ stockOutRecordDOS = (List) stockOutTemp.get("data");
+ } else {
+ int stockInRecordOffset = offset / 2;
+ int stockOutRecordOffset = stockInRecordOffset * 2 < offset ? stockInRecordOffset + 1 : stockInRecordOffset;
+ int stockInRecordLimit = limit / 2;
+ int stockOutRecordLimit = stockInRecordLimit * 2 < limit ? stockInRecordLimit + 1 : stockInRecordLimit;
+
+ stockInTemp = selectStockInRecord(repositoryID, startDate, endDate, stockInRecordOffset, limit);
+ stockOutTemp = selectStockOutRecord(repositoryID, startDate, endDate, stockOutRecordOffset, limit);
+
+ stockInRecordDOS = (List) stockInTemp.get("data");
+ stockOutRecordDOS = (List) stockOutTemp.get("data");
+
+ int stockInRecordDosSize = stockInRecordDOS.size();
+ int stockOutRecordDoSize = stockOutRecordDOS.size();
+ if (stockInRecordDosSize >= stockInRecordLimit && stockOutRecordDoSize >= stockOutRecordLimit) {
+ stockInRecordDOS = stockInRecordDOS.subList(0, stockInRecordLimit);
+ stockOutRecordDOS = stockOutRecordDOS.subList(0, stockOutRecordLimit);
+ } else if (stockInRecordDosSize < stockInRecordLimit && stockOutRecordDoSize > stockOutRecordLimit) {
+ int appendSize = (stockOutRecordDoSize - stockOutRecordLimit) > (stockInRecordLimit - stockInRecordDosSize) ?
+ (stockInRecordLimit - stockInRecordDosSize) : (stockOutRecordDoSize - stockOutRecordLimit);
+ stockOutRecordDOS = stockOutRecordDOS.subList(0, stockInRecordLimit + appendSize - 1);
+ } else if (stockOutRecordDoSize < stockOutRecordLimit && stockInRecordDosSize > stockInRecordLimit) {
+ int appendSize = (stockInRecordDosSize - stockInRecordLimit) > (stockOutRecordLimit - stockOutRecordDoSize) ?
+ (stockOutRecordLimit - stockOutRecordDoSize) : (stockInRecordDosSize - stockInRecordLimit);
+ stockInRecordDOS = stockInRecordDOS.subList(0, stockInRecordLimit + appendSize);
+ }
+ }
+ long stockInRecordDOSTotal = (long) stockInTemp.get("total");
+ long stockOutRecordDOSTotal = (long) stockOutTemp.get("total");
+ total = stockInRecordDOSTotal + stockOutRecordDOSTotal;
+ break;
+ }
+ case "stockInOnly": {
+ stockInTemp = selectStockInRecord(repositoryID, startDate, endDate, offset, limit);
+ total = (long) stockInTemp.get("total");
+ stockInRecordDOS = (List) stockInTemp.get("data");
+ break;
+ }
+ case "stockOutOnly": {
+ stockOutTemp = selectStockOutRecord(repositoryID, startDate, endDate, offset, limit);
+ total = (long) stockOutTemp.get("total");
+ stockOutRecordDOS = (List) stockOutTemp.get("data");
+ break;
+ }
+ case "none": {
+ break;
+ }
+ }
+
+ if (stockInRecordDOS != null)
+ stockInRecordDOS.forEach(stockInDO -> stockRecordDTOS.add(stockInRecordConvertToStockRecordDTO(stockInDO)));
+ if (stockOutRecordDOS != null)
+ stockOutRecordDOS.forEach(stockOutDO -> stockRecordDTOS.add(stockOutDoConvertToStockRecordDTO(stockOutDO)));
+
+ resultSet.put("data", stockRecordDTOS);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 查询入库记录
+ *
+ * @param repositoryID 入库仓库ID
+ * @param startDate 入库记录起始日期
+ * @param endDate 入库记录结束日期
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 返回所有符合要求的入库记录
+ */
+ private Map selectStockInRecord(Integer repositoryID, Date startDate, Date endDate, int offset, int limit) throws StockRecordManageServiceException {
+ Map result = new HashMap<>();
+ List stockInRecords;
+ long stockInTotal = 0;
+ boolean isPagination = true;
+
+ // 检查是否需要分页查询
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // 查询记录
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ stockInRecords = stockinMapper.selectByRepositoryIDAndDate(repositoryID, startDate, endDate);
+ if (stockInRecords != null)
+ stockInTotal = new PageInfo<>(stockInRecords).getTotal();
+ else
+ stockInRecords = new ArrayList<>(10);
+ } else {
+ stockInRecords = stockinMapper.selectByRepositoryIDAndDate(repositoryID, startDate, endDate);
+ if (stockInRecords != null)
+ stockInTotal = stockInRecords.size();
+ else
+ stockInRecords = new ArrayList<>(10);
+ }
+ } catch (PersistenceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+
+ result.put("data", stockInRecords);
+ result.put("total", stockInTotal);
+ return result;
+ }
+
+ /**
+ * 查询出库记录
+ *
+ * @param repositoryID 出库仓库ID
+ * @param startDate 出库记录起始日期
+ * @param endDate 出库记录结束日期
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 返回所有符合要求的出库记录
+ */
+ private Map selectStockOutRecord(Integer repositoryID, Date startDate, Date endDate, int offset, int limit) throws StockRecordManageServiceException {
+ Map result = new HashMap<>();
+ List stockOutRecords;
+ long stockOutRecordTotal = 0;
+ boolean isPagination = true;
+
+ // 检查是否需要分页
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // 查询记录
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ stockOutRecords = stockOutMapper.selectByRepositoryIDAndDate(repositoryID, startDate, endDate);
+ if (stockOutRecords != null)
+ stockOutRecordTotal = new PageInfo<>(stockOutRecords).getTotal();
+ else
+ stockOutRecords = new ArrayList<>(10);
+ } else {
+ stockOutRecords = stockOutMapper.selectByRepositoryIDAndDate(repositoryID, startDate, endDate);
+ if (stockOutRecords != null)
+ stockOutRecordTotal = stockOutRecords.size();
+ else
+ stockOutRecords = new ArrayList<>(10);
+ }
+ } catch (PersistenceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+
+ result.put("data", stockOutRecords);
+ result.put("total", stockOutRecordTotal);
+ return result;
+ }
+
+ private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm");
+
+ /**
+ * 将 StockInDO 转换为 StockRecordDTO
+ *
+ * @param stockInDO StockInDO 对象
+ * @return 返回 StockRecordDTO 对象
+ */
+ private StockRecordDTO stockInRecordConvertToStockRecordDTO(StockInDO stockInDO) {
+ StockRecordDTO stockRecordDTO = new StockRecordDTO();
+ stockRecordDTO.setRecordID(stockInDO.getId());
+ stockRecordDTO.setSupplierOrCustomerName(stockInDO.getSupplierName());
+ stockRecordDTO.setGoodsName(stockInDO.getGoodName());
+ stockRecordDTO.setNumber(stockInDO.getNumber());
+ stockRecordDTO.setTime(dateFormat.format(stockInDO.getTime()));
+ stockRecordDTO.setRepositoryID(stockInDO.getRepositoryID());
+ stockRecordDTO.setPersonInCharge(stockInDO.getPersonInCharge());
+ stockRecordDTO.setType("入库");
+ return stockRecordDTO;
+ }
+
+ /**
+ * 将 StockOutDO 转换为 StockRecordDTO 对象
+ *
+ * @param stockOutDO StockOutDO 对象
+ * @return 返回 StockRecordDTO 对象
+ */
+ private StockRecordDTO stockOutDoConvertToStockRecordDTO(StockOutDO stockOutDO) {
+ StockRecordDTO stockRecordDTO = new StockRecordDTO();
+ stockRecordDTO.setRecordID(stockOutDO.getId());
+ stockRecordDTO.setSupplierOrCustomerName(stockOutDO.getCustomerName());
+ stockRecordDTO.setGoodsName(stockOutDO.getGoodName());
+ stockRecordDTO.setNumber(stockOutDO.getNumber());
+ stockRecordDTO.setTime(dateFormat.format(stockOutDO.getTime()));
+ stockRecordDTO.setRepositoryID(stockOutDO.getRepositoryID());
+ stockRecordDTO.setPersonInCharge(stockOutDO.getPersonInCharge());
+ stockRecordDTO.setType("出库");
+ return stockRecordDTO;
+ }
+
+
+ /**
+ * 检查货物ID对应的记录是否存在
+ *
+ * @param goodsID 货物ID
+ * @return 若存在则返回true,否则返回false
+ */
+ private boolean goodsValidate(Integer goodsID) throws StockRecordManageServiceException {
+ try {
+ Goods goods = goodsMapper.selectById(goodsID);
+ return goods != null;
+ } catch (PersistenceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+ }
+
+ /**
+ * 检查仓库ID对应的记录是否存在
+ *
+ * @param repositoryID 仓库ID
+ * @return 若存在则返回true,否则返回false
+ */
+ private boolean repositoryValidate(Integer repositoryID) throws StockRecordManageServiceException {
+ try {
+ Repository repository = repositoryMapper.selectByID(repositoryID);
+ return repository != null;
+ } catch (PersistenceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+ }
+
+ /**
+ * 检查供应商ID对应的记录是否存在
+ *
+ * @param supplierID 供应商ID
+ * @return 若存在则返回true,否则返回false
+ */
+ private boolean supplierValidate(Integer supplierID) throws StockRecordManageServiceException {
+ try {
+ Supplier supplier = supplierMapper.selectById(supplierID);
+ return supplier != null;
+ } catch (PersistenceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+ }
+
+ /**
+ * 检查客户ID对应的记录是否存在
+ *
+ * @param cumtomerID 客户ID
+ * @return 若存在则返回true,否则返回false
+ */
+ private boolean customerValidate(Integer cumtomerID) throws StockRecordManageServiceException {
+ try {
+ Customer customer = customerMapper.selectById(cumtomerID);
+ return customer != null;
+ } catch (PersistenceException e) {
+ throw new StockRecordManageServiceException(e);
+ }
+ }
+
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StorageManageServiceImpl.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StorageManageServiceImpl.java
new file mode 100644
index 0000000..eaac191
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/StorageManageServiceImpl.java
@@ -0,0 +1,514 @@
+package com.ken.wms.common.service.Impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ken.wms.common.service.Interface.StorageManageService;
+import com.ken.wms.common.util.EJConvertor;
+import com.ken.wms.common.util.FileUtil;
+import com.ken.wms.dao.GoodsMapper;
+import com.ken.wms.dao.RepositoryMapper;
+import com.ken.wms.dao.StorageMapper;
+import com.ken.wms.domain.Goods;
+import com.ken.wms.domain.Repository;
+import com.ken.wms.domain.Storage;
+import com.ken.wms.exception.StorageManageServiceException;
+import com.ken.wms.util.aop.UserOperation;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 库存信息管理 service 实现类
+
+ */
+@Service
+public class StorageManageServiceImpl implements StorageManageService {
+
+ @Autowired
+ private StorageMapper storageMapper;
+ @Autowired
+ private GoodsMapper goodsMapper;
+ @Autowired
+ private RepositoryMapper repositoryMapper;
+ @Autowired
+ private EJConvertor ejConvertor;
+
+ /**
+ * 返回所有的库存记录
+ *
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll(Integer repository) throws StorageManageServiceException {
+ return selectAll(repository, -1, -1);
+ }
+
+ /**
+ * 分页返回所有的库存记录
+ *
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectAll(Integer repositoryID, int offset, int limit) throws StorageManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List storageList;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ storageList = storageMapper.selectAllAndRepositoryID(repositoryID);
+ if (storageList != null) {
+ PageInfo pageInfo = new PageInfo<>(storageList);
+ total = pageInfo.getTotal();
+ } else
+ storageList = new ArrayList<>();
+ } else {
+ storageList = storageMapper.selectAllAndRepositoryID(repositoryID);
+ if (storageList != null)
+ total = storageList.size();
+ else
+ storageList = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new StorageManageServiceException(e);
+ }
+
+ resultSet.put("data", storageList);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定货物ID的库存记录
+ *
+ * @param goodsID 指定的货物ID
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByGoodsID(Integer goodsID, Integer repository) throws StorageManageServiceException {
+ return selectByGoodsID(goodsID, repository, -1, -1);
+ }
+
+ /**
+ * 分页返回指定的货物库存记录
+ *
+ * @param goodsID 指定的货物ID
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByGoodsID(Integer goodsID, Integer repositoryID, int offset, int limit) throws StorageManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List storageList;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ storageList = storageMapper.selectByGoodsIDAndRepositoryID(goodsID, repositoryID);
+ if (storageList != null) {
+ PageInfo pageInfo = new PageInfo<>(storageList);
+ total = pageInfo.getTotal();
+ } else
+ storageList = new ArrayList<>();
+ } else {
+ storageList = storageMapper.selectByGoodsIDAndRepositoryID(goodsID, repositoryID);
+ if (storageList != null)
+ total = storageList.size();
+ else
+ storageList = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new StorageManageServiceException(e);
+ }
+
+ resultSet.put("data", storageList);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定货物名称的库存记录
+ *
+ * @param goodsName 货物名称
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByGoodsName(String goodsName, Integer repository) throws StorageManageServiceException {
+ return selectByGoodsName(goodsName, repository, -1, -1);
+ }
+
+ /**
+ * 分页返回指定货物名称的库存记录
+ *
+ * @param goodsName 货物名称
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByGoodsName(String goodsName, Integer repositoryID, int offset, int limit) throws StorageManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List storageList;
+ long total = 0;
+ boolean isPagination = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPagination = false;
+
+ // query
+ try {
+ if (isPagination) {
+ PageHelper.offsetPage(offset, limit);
+ storageList = storageMapper.selectByGoodsNameAndRepositoryID(goodsName, repositoryID);
+ if (storageList != null) {
+ PageInfo pageInfo = new PageInfo<>(storageList);
+ total = pageInfo.getTotal();
+ } else
+ storageList = new ArrayList<>();
+ } else {
+ storageList = storageMapper.selectByGoodsNameAndRepositoryID(goodsName, repositoryID);
+ if (storageList != null)
+ total = storageList.size();
+ else
+ storageList = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new StorageManageServiceException(e);
+ }
+
+ resultSet.put("data", storageList);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 返回指定货物类型的库存记录
+ *
+ * @param goodsType 指定的货物类型
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByGoodsType(String goodsType, Integer repositoryID) throws StorageManageServiceException {
+ return selectByGoodsType(goodsType, repositoryID, -1, -1);
+ }
+
+ /**
+ * 分页返回指定货物类型的库存记录
+ *
+ * @param goodsType 指定的货物类型
+ * @param offset 分页偏移值
+ * @param limit 分页大小
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map selectByGoodsType(String goodsType, Integer repositoryID, int offset, int limit) throws StorageManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ List storageList;
+ long total = 0;
+ boolean isPaginatin = true;
+
+ // validate
+ if (offset < 0 || limit < 0)
+ isPaginatin = false;
+
+ // query
+ try {
+ if (isPaginatin) {
+ PageHelper.offsetPage(offset, limit);
+ storageList = storageMapper.selectByGoodsTypeAndRepositoryID(goodsType, repositoryID);
+ if (storageList != null) {
+ PageInfo pageInfo = new PageInfo<>(storageList);
+ total = pageInfo.getTotal();
+ } else
+ storageList = new ArrayList<>();
+ } else {
+ storageList = storageMapper.selectByGoodsTypeAndRepositoryID(goodsType, repositoryID);
+ if (storageList != null)
+ total = storageList.size();
+ else
+ storageList = new ArrayList<>();
+ }
+ } catch (PersistenceException e) {
+ throw new StorageManageServiceException(e);
+ }
+
+ resultSet.put("data", storageList);
+ resultSet.put("total", total);
+ return resultSet;
+ }
+
+ /**
+ * 添加一条库存记录
+ *
+ * @param goodsID 指定的货物ID
+ * @param repositoryID 指定的仓库ID
+ * @param number 库存数量
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "添加库存记录")
+ @Override
+ public boolean addNewStorage(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException {
+ try {
+ boolean isAvailable = true;
+
+ // validate
+ Goods goods = goodsMapper.selectById(goodsID);
+ Repository repository = repositoryMapper.selectByID(repositoryID);
+ if (goods == null)
+ isAvailable = false;
+ if (repository == null)
+ isAvailable = false;
+ if (number < 0)
+ isAvailable = false;
+ List storageList = storageMapper.selectByGoodsIDAndRepositoryID(goodsID, repositoryID);
+ if (!(storageList != null && storageList.isEmpty()))
+ isAvailable = false;
+
+ if (isAvailable) {
+ // insert
+ Storage storage = new Storage();
+ storage.setGoodsID(goodsID);
+ storage.setRepositoryID(repositoryID);
+ storage.setNumber(number);
+ storageMapper.insert(storage);
+ }
+
+ return isAvailable;
+ } catch (PersistenceException e) {
+ throw new StorageManageServiceException(e);
+ }
+ }
+
+ /**
+ * 更新一条库存记录
+ *
+ * @param goodsID 指定的货物ID
+ * @param repositoryID 指定的仓库ID
+ * @param number 更新的库存数量
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "修改库存记录")
+ @Override
+ public boolean updateStorage(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException {
+ try {
+ boolean isUpdate = false;
+
+ // validate
+ List storageList = storageMapper.selectByGoodsIDAndRepositoryID(goodsID, repositoryID);
+ if (storageList != null && !storageList.isEmpty()) {
+ if (number >= 0) {
+ // update
+ Storage storage = storageList.get(0);
+ storage.setNumber(number);
+ storageMapper.update(storage);
+ isUpdate = true;
+ }
+ }
+
+ return isUpdate;
+ } catch (PersistenceException e) {
+ throw new StorageManageServiceException(e);
+ }
+ }
+
+ /**
+ * 删除一条库存记录
+ * 货物ID与仓库ID可唯一确定一条库存记录
+ *
+ * @param goodsID 指定的货物ID
+ * @param repositoryID 指定的仓库ID
+ * @return 返回一个boolean值,值为true代表更新成功,否则代表失败
+ */
+ @UserOperation(value = "删除库存记录")
+ @Override
+ public boolean deleteStorage(Integer goodsID, Integer repositoryID) throws StorageManageServiceException {
+ try {
+ boolean isDelete = false;
+
+ // validate
+ List storageList = storageMapper.selectByGoodsIDAndRepositoryID(goodsID, repositoryID);
+ if (storageList != null && !storageList.isEmpty()) {
+ // delete
+ storageMapper.deleteByRepositoryIDAndGoodsID(goodsID, repositoryID);
+ isDelete = true;
+ }
+
+ return isDelete;
+ } catch (PersistenceException e) {
+ throw new StorageManageServiceException(e);
+ }
+ }
+
+ /**
+ * 导入库存记录
+ *
+ * @param file 保存有的库存记录的文件
+ * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数
+ */
+ @UserOperation(value = "导入库存记录")
+ @Override
+ public Map importStorage(MultipartFile file) throws StorageManageServiceException {
+ // 初始化结果集
+ Map resultSet = new HashMap<>();
+ int total = 0;
+ int available = 0;
+
+ // 从文件中读取
+ try {
+ List storageList = ejConvertor.excelReader(Storage.class, FileUtil.convertMultipartFileToFile(file));
+ if (storageList != null) {
+ total = storageList.size();
+
+ boolean isAvailable;
+ List availableList = new ArrayList<>();
+ Goods goods;
+ Repository repository;
+ for (Storage storage : storageList) {
+ isAvailable = true;
+
+ // validate
+ goods = goodsMapper.selectById(storage.getGoodsID());
+ repository = repositoryMapper.selectByID(storage.getRepositoryID());
+ if (goods == null)
+ isAvailable = false;
+ if (repository == null)
+ isAvailable = false;
+ if (storage.getNumber() < 0)
+ isAvailable = false;
+ List temp = storageMapper.selectByGoodsIDAndRepositoryID(storage.getGoodsID(), storage.getRepositoryID());
+ if (!(temp != null && temp.isEmpty()))
+ isAvailable = false;
+
+ if (isAvailable) {
+ availableList.add(storage);
+ }
+ }
+ // 保存到数据库
+ available = availableList.size();
+ System.out.println(available);
+ if (available > 0)
+ storageMapper.insertBatch(availableList);
+ }
+ } catch (PersistenceException | IOException e) {
+ throw new StorageManageServiceException(e);
+ }
+
+ resultSet.put("total", total);
+ resultSet.put("available", available);
+ return resultSet;
+ }
+
+ /**
+ * 导出库存记录
+ *
+ * @param storageList 保存有库存记录的List
+ * @return excel 文件
+ */
+ @UserOperation(value = "导出库存记录")
+ @Override
+ public File exportStorage(List storageList) {
+ if (storageList == null)
+ return null;
+ return ejConvertor.excelWriter(Storage.class, storageList);
+ }
+
+ /**
+ * 为指定的货物库存记录增加指定数目
+ *
+ * @param goodsID 货物ID
+ * @param repositoryID 仓库ID
+ * @param number 增加的数量
+ * @return 返回一个 boolean 值,若值为true表示数目增加成功,否则表示增加失败
+ */
+ @Override
+ public boolean storageIncrease(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException {
+
+ // 检查货物库存增加数目的有效性
+ if (number < 0)
+ return false;
+
+ synchronized (this) {
+ // 检查对应的库存记录是否存在
+ Storage storage = getStorage(goodsID, repositoryID);
+ if (storage != null) {
+ long newStorage = storage.getNumber() + number;
+ updateStorage(goodsID, repositoryID, newStorage);
+ } else {
+ addNewStorage(goodsID, repositoryID, number);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 为指定的货物库存记录减少指定的数目
+ *
+ * @param goodsID 货物ID
+ * @param repositoryID 仓库ID
+ * @param number 减少的数量
+ * @return 返回一个 boolean 值,若值为 true 表示数目减少成功,否则表示减少失败
+ */
+ @Override
+ public boolean storageDecrease(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException {
+
+ synchronized (this) {
+ // 检查对应的库存记录是否存在
+ Storage storage = getStorage(goodsID, repositoryID);
+ if (null != storage) {
+ // 检查库存减少数目的范围是否合理
+ if (number < 0 || storage.getNumber() < number)
+ return false;
+
+ long newStorage = storage.getNumber() - number;
+ updateStorage(goodsID, repositoryID, newStorage);
+ return true;
+ } else
+ return false;
+ }
+ }
+
+ /**
+ * 获取指定货物ID,仓库ID对应的库存记录
+ *
+ * @param goodsID 货物ID
+ * @param repositoryID 仓库ID
+ * @return 若存在则返回对应的记录,否则返回null
+ */
+ private Storage getStorage(Integer goodsID, Integer repositoryID) {
+ Storage storage = null;
+ List storageList = storageMapper.selectByGoodsIDAndRepositoryID(goodsID, repositoryID);
+ if (!storageList.isEmpty())
+ storage = storageList.get(0);
+ return storage;
+ }
+}
diff --git a/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/SupplierManageServiceImpl.java b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/SupplierManageServiceImpl.java
new file mode 100644
index 0000000..3796a49
--- /dev/null
+++ b/warehouseManager-developer/WMS/src/main/java/com/ken/wms/common/service/Impl/SupplierManageServiceImpl.java
@@ -0,0 +1,333 @@
+package com.ken.wms.common.service.Impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ken.wms.common.service.Interface.SupplierManageService;
+import com.ken.wms.common.util.EJConvertor;
+import com.ken.wms.common.util.FileUtil;
+import com.ken.wms.dao.StockInMapper;
+import com.ken.wms.dao.SupplierMapper;
+import com.ken.wms.domain.StockInDO;
+import com.ken.wms.domain.Supplier;
+import com.ken.wms.exception.SupplierManageServiceException;
+import com.ken.wms.util.aop.UserOperation;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 供应商信息管理 service 实现类
+
+ */
+@Service
+public class SupplierManageServiceImpl implements SupplierManageService {
+
+ @Autowired
+ private SupplierMapper supplierMapper;
+ @Autowired
+ private StockInMapper stockInMapper;
+ @Autowired
+ private EJConvertor ejConvertor;
+
+ /**
+ * 返回指定supplierID 的供应商记录
+ *
+ * @param supplierId 供应商ID
+ * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量
+ */
+ @Override
+ public Map